math-exercises 3.0.183 → 3.0.184
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/exercises/math/functions/composition/functionComposition.d.ts.map +1 -1
- package/lib/exercises/math/functions/composition/functionComposition.js +11 -22
- package/lib/exercises/math/functions/exponential/algebraic/rewriteExpUsingExpA.d.ts.map +1 -1
- package/lib/exercises/math/functions/exponential/algebraic/rewriteExpUsingExpA.js +18 -3
- package/lib/exercises/math/functions/exponential/expKT/derivativeOfAExpKT.d.ts +8 -0
- package/lib/exercises/math/functions/exponential/expKT/derivativeOfAExpKT.d.ts.map +1 -0
- package/lib/exercises/math/functions/exponential/expKT/derivativeOfAExpKT.js +108 -0
- package/lib/exercises/math/functions/exponential/expKT/drugConcentrationMaximum.d.ts +8 -0
- package/lib/exercises/math/functions/exponential/expKT/drugConcentrationMaximum.d.ts.map +1 -0
- package/lib/exercises/math/functions/exponential/expKT/drugConcentrationMaximum.js +144 -0
- package/lib/exercises/math/functions/exponential/expKT/index.d.ts +3 -0
- package/lib/exercises/math/functions/exponential/expKT/index.d.ts.map +1 -0
- package/lib/exercises/math/functions/exponential/expKT/index.js +2 -0
- package/lib/exercises/math/functions/exponential/expSimplifiying.d.ts.map +1 -1
- package/lib/exercises/math/functions/exponential/expSimplifiying.js +94 -4
- package/lib/exercises/math/functions/exponential/index.d.ts +3 -0
- package/lib/exercises/math/functions/exponential/index.d.ts.map +1 -1
- package/lib/exercises/math/functions/exponential/index.js +3 -0
- package/lib/exercises/math/functions/exponential/sign/expFunctionBasicSign.d.ts +9 -0
- package/lib/exercises/math/functions/exponential/sign/expFunctionBasicSign.d.ts.map +1 -0
- package/lib/exercises/math/functions/exponential/sign/expFunctionBasicSign.js +101 -0
- package/lib/exercises/math/functions/exponential/sign/index.d.ts +2 -0
- package/lib/exercises/math/functions/exponential/sign/index.d.ts.map +1 -0
- package/lib/exercises/math/functions/exponential/sign/index.js +1 -0
- package/lib/exercises/math/functions/exponential/variations/index.d.ts +3 -0
- package/lib/exercises/math/functions/exponential/variations/index.d.ts.map +1 -0
- package/lib/exercises/math/functions/exponential/variations/index.js +2 -0
- package/lib/exercises/math/functions/exponential/variations/varSignTableOfAffineTimesExp.d.ts +7 -0
- package/lib/exercises/math/functions/exponential/variations/varSignTableOfAffineTimesExp.d.ts.map +1 -0
- package/lib/exercises/math/functions/exponential/variations/varSignTableOfAffineTimesExp.js +144 -0
- package/lib/exercises/math/functions/exponential/variations/varSignTableOfExpMinusX.d.ts +7 -0
- package/lib/exercises/math/functions/exponential/variations/varSignTableOfExpMinusX.d.ts.map +1 -0
- package/lib/exercises/math/functions/exponential/variations/varSignTableOfExpMinusX.js +139 -0
- package/lib/exercises/math/probaStat/independancy/independantSuccessiveEventsComputeTwoSuccess.d.ts +7 -0
- package/lib/exercises/math/probaStat/independancy/independantSuccessiveEventsComputeTwoSuccess.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/independancy/independantSuccessiveEventsComputeTwoSuccess.js +100 -0
- package/lib/exercises/math/probaStat/independancy/index.d.ts +1 -0
- package/lib/exercises/math/probaStat/independancy/index.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/independancy/index.js +1 -0
- package/lib/exercises/math/probaStat/trees/index.d.ts +4 -1
- package/lib/exercises/math/probaStat/trees/index.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/trees/index.js +4 -9
- package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFromTwoConsecutiveTerms.d.ts.map +1 -1
- package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFromTwoConsecutiveTerms.js +37 -39
- package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFromTwoTerms.d.ts.map +1 -1
- package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFromTwoTerms.js +14 -4
- package/lib/exercises/math/sequences/geometric/situations/geometricFindExplicitFormulaFromSituation.d.ts.map +1 -1
- package/lib/exercises/math/sequences/geometric/situations/geometricFindExplicitFormulaFromSituation.js +12 -3
- package/lib/exercises/vea/treeTableVEA.d.ts.map +1 -1
- package/lib/exercises/vea/treeTableVEA.js +3 -0
- package/lib/index.d.ts +33 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/latexTester.js +1 -1
- package/lib/tests/singleExo.test.js +2 -2
- package/lib/tree/nodes/functions/expNode.d.ts +1 -1
- package/lib/tree/nodes/functions/expNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/expNode.js +3 -6
- package/lib/tree/nodes/operators/addNode.d.ts +1 -1
- package/lib/tree/nodes/operators/addNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/addNode.js +2 -2
- package/lib/tree/nodes/operators/substractNode.d.ts +1 -1
- package/lib/tree/nodes/operators/substractNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/substractNode.js +2 -2
- package/lib/tree/utilities/nodeComparator.d.ts +7 -0
- package/lib/tree/utilities/nodeComparator.d.ts.map +1 -0
- package/lib/tree/utilities/nodeComparator.js +88 -0
- package/lib/tree/utilities/nodeInspector.d.ts +5 -0
- package/lib/tree/utilities/nodeInspector.d.ts.map +1 -0
- package/lib/tree/utilities/nodeInspector.js +15 -0
- package/lib/tree/utilities/nodeRewriter.d.ts +9 -0
- package/lib/tree/utilities/nodeRewriter.d.ts.map +1 -0
- package/lib/tree/utilities/nodeRewriter.js +172 -0
- package/lib/tree/utilities/nodeShuffler.d.ts +2 -4
- package/lib/tree/utilities/nodeShuffler.d.ts.map +1 -1
- package/lib/tree/utilities/nodeShuffler.js +13 -104
- package/lib/tree/utilities/nodeSimplifier.d.ts +1 -2
- package/lib/tree/utilities/nodeSimplifier.d.ts.map +1 -1
- package/lib/tree/utilities/nodeSimplifier.js +14 -88
- package/package.json +1 -1
|
@@ -4,12 +4,14 @@ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQue
|
|
|
4
4
|
import { randfloat } from "../../../../math/utils/random/randfloat.js";
|
|
5
5
|
import { randint } from "../../../../math/utils/random/randint.js";
|
|
6
6
|
import { round } from "../../../../math/utils/round.js";
|
|
7
|
-
import { EqualNode } from "../../../../tree/nodes/equations/equalNode.js";
|
|
7
|
+
import { EqualNode, isEqualNode, } from "../../../../tree/nodes/equations/equalNode.js";
|
|
8
8
|
import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
|
|
9
9
|
import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
10
10
|
import { power } from "../../../../tree/nodes/operators/powerNode.js";
|
|
11
11
|
import { substract } from "../../../../tree/nodes/operators/substractNode.js";
|
|
12
12
|
import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
|
|
13
|
+
import { NodeComparator } from "../../../../tree/utilities/nodeComparator.js";
|
|
14
|
+
import { NodeRewriter } from "../../../../tree/utilities/nodeRewriter.js";
|
|
13
15
|
import { coinFlip } from "../../../../utils/alea/coinFlip.js";
|
|
14
16
|
import { random } from "../../../../utils/alea/random.js";
|
|
15
17
|
import { shuffle } from "../../../../utils/alea/shuffle.js";
|
|
@@ -122,46 +124,41 @@ const getPropositions = (n, { answer, ..._identifiers }, optsIn) => {
|
|
|
122
124
|
});
|
|
123
125
|
return shuffle(propositions);
|
|
124
126
|
};
|
|
125
|
-
const isAnswerValid = (ans, { answer }) => {
|
|
127
|
+
const isAnswerValid = (ans, { answer, ...identifiers }, optsIn) => {
|
|
128
|
+
const opts = optsIn ?? optsDefault;
|
|
126
129
|
try {
|
|
127
130
|
//TODO faire fonctionner parseAlgebraic("u_n=3+2n") (token _ not implemented)
|
|
128
|
-
const
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
131
|
+
const nodeAnswer = getAnswerStuff(identifiers, opts).answerNode;
|
|
132
|
+
if (!ans.includes("=")) {
|
|
133
|
+
// return false;
|
|
134
|
+
ans = nodeAnswer.leftChild.toTex() + "=" + ans;
|
|
135
|
+
}
|
|
136
|
+
// const nodeAns = parseAlgebraic(ans);
|
|
137
|
+
const nodeAns = (() => {
|
|
138
|
+
const [lhs, rhs] = ans.split("=");
|
|
139
|
+
const nodeLhs = lhs.toTree();
|
|
140
|
+
const nodeRhs = parseAlgebraic(rhs);
|
|
141
|
+
return new EqualNode(nodeLhs, nodeRhs);
|
|
142
|
+
})();
|
|
143
|
+
if (!isEqualNode(nodeAns)) {
|
|
132
144
|
return false;
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
// const isValidLhs = () =>
|
|
151
|
-
// nodeAns.leftChild.toTex() === nodeAnswer.leftChild.toTex();
|
|
152
|
-
// const isValidRhs = () => {
|
|
153
|
-
// const nodeAnsRhs = nodeAns.rightChild;
|
|
154
|
-
// const nodeAnswerRhs = nodeAnswer.rightChild;
|
|
155
|
-
// return [0, 1, 2].every((n) => {
|
|
156
|
-
// return (
|
|
157
|
-
// substract(
|
|
158
|
-
// nodeAnsRhs.evaluate({ n }),
|
|
159
|
-
// nodeAnswerRhs.evaluate({ n }),
|
|
160
|
-
// ).evaluate() === 0
|
|
161
|
-
// );
|
|
162
|
-
// });
|
|
163
|
-
// };
|
|
164
|
-
// return isValidLhs() && isValidRhs();
|
|
145
|
+
}
|
|
146
|
+
const isValidLhs = () => nodeAns.leftChild.toTex() === nodeAnswer.leftChild.toTex();
|
|
147
|
+
const isValidRhs = () => {
|
|
148
|
+
const nodeAnsRhs = nodeAns.rightChild;
|
|
149
|
+
const nodeAnswerRhs = nodeAnswer.rightChild;
|
|
150
|
+
const isEquivalentFound = () => {
|
|
151
|
+
const nodeAns = nodeAnsRhs;
|
|
152
|
+
const nodeAnswer = nodeAnswerRhs;
|
|
153
|
+
const arrNodeAnswerEquivalent = NodeRewriter.getArrNodeEquivalent(nodeAnswer);
|
|
154
|
+
return arrNodeAnswerEquivalent.some((nodeAnswerRefined) => {
|
|
155
|
+
const isEqual = NodeComparator.isEqualViaFrac(nodeAns, nodeAnswerRefined);
|
|
156
|
+
return isEqual;
|
|
157
|
+
});
|
|
158
|
+
};
|
|
159
|
+
return isEquivalentFound();
|
|
160
|
+
};
|
|
161
|
+
return isValidLhs() && isValidRhs();
|
|
165
162
|
}
|
|
166
163
|
catch (e) {
|
|
167
164
|
handleVEAError(e);
|
|
@@ -246,7 +243,8 @@ const createRandomIdentifiersCurated = (opts) => {
|
|
|
246
243
|
counter++;
|
|
247
244
|
const identifiersCandidate = createRandomIdentifiersRaw(opts);
|
|
248
245
|
const answer = getAnswer(identifiersCandidate, opts);
|
|
249
|
-
|
|
246
|
+
const isVEAOk = () => isAnswerValid(answer, { answer, ...identifiersCandidate }, opts);
|
|
247
|
+
isValid = !answer.includes("NaN") && isVEAOk();
|
|
250
248
|
if (isValid) {
|
|
251
249
|
identifiers = identifiersCandidate;
|
|
252
250
|
}
|
package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFromTwoTerms.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geometricFindExplicitFormulaFromTwoTerms.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/geometric/geometricFindExplicitFormulaFromTwoTerms.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAEL,sBAAsB,EACvB,MAAM,mDAAmD,CAAC;
|
|
1
|
+
{"version":3,"file":"geometricFindExplicitFormulaFromTwoTerms.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/geometric/geometricFindExplicitFormulaFromTwoTerms.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAEL,sBAAsB,EACvB,MAAM,mDAAmD,CAAC;AAsB3D,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,gBAAgB,EAAE,MAAM,CAAC;IACzB,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC;AAiXF,KAAK,OAAO,GAAG,sBAAsB,CAAC;AAMtC,eAAO,MAAM,wCAAwC,EAAE,QAAQ,CAC7D,WAAW,EACX,OAAO,CAoBR,CAAC"}
|
|
@@ -10,6 +10,8 @@ import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
|
10
10
|
import { power } from "../../../../tree/nodes/operators/powerNode.js";
|
|
11
11
|
import { substract } from "../../../../tree/nodes/operators/substractNode.js";
|
|
12
12
|
import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
|
|
13
|
+
import { NodeComparator } from "../../../../tree/utilities/nodeComparator.js";
|
|
14
|
+
import { NodeRewriter } from "../../../../tree/utilities/nodeRewriter.js";
|
|
13
15
|
import { coinFlip } from "../../../../utils/alea/coinFlip.js";
|
|
14
16
|
import { random } from "../../../../utils/alea/random.js";
|
|
15
17
|
import { shuffle } from "../../../../utils/alea/shuffle.js";
|
|
@@ -156,9 +158,16 @@ const isAnswerValid = (ans, { answer, ...identifiers }, optsIn) => {
|
|
|
156
158
|
const isValidRhs = () => {
|
|
157
159
|
const nodeAnsRhs = nodeAns.rightChild;
|
|
158
160
|
const nodeAnswerRhs = nodeAnswer.rightChild;
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
161
|
+
const isEquivalentFound = () => {
|
|
162
|
+
const nodeAns = nodeAnsRhs;
|
|
163
|
+
const nodeAnswer = nodeAnswerRhs;
|
|
164
|
+
const arrNodeAnswerEquivalent = NodeRewriter.getArrNodeEquivalent(nodeAnswer);
|
|
165
|
+
return arrNodeAnswerEquivalent.some((nodeAnswerRefined) => {
|
|
166
|
+
const isEqual = NodeComparator.isEqualViaFrac(nodeAns, nodeAnswerRefined);
|
|
167
|
+
return isEqual;
|
|
168
|
+
});
|
|
169
|
+
};
|
|
170
|
+
return isEquivalentFound();
|
|
162
171
|
};
|
|
163
172
|
return isValidLhs() && isValidRhs();
|
|
164
173
|
}
|
|
@@ -245,7 +254,8 @@ const createRandomIdentifiersCurated = (opts) => {
|
|
|
245
254
|
counter++;
|
|
246
255
|
const identifiersCandidate = createRandomIdentifiersRaw(opts);
|
|
247
256
|
const answer = getAnswer(identifiersCandidate, opts);
|
|
248
|
-
|
|
257
|
+
const isVEAOk = () => isAnswerValid(answer, { answer, ...identifiersCandidate }, opts);
|
|
258
|
+
isValid = !answer.includes("NaN") && isVEAOk();
|
|
249
259
|
if (isValid) {
|
|
250
260
|
identifiers = identifiersCandidate;
|
|
251
261
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geometricFindExplicitFormulaFromSituation.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/sequences/geometric/situations/geometricFindExplicitFormulaFromSituation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAEL,sBAAsB,EACvB,MAAM,mDAAmD,CAAC;AAC3D,OAAO,EAEL,2BAA2B,EAC5B,MAAM,wDAAwD,CAAC;AAIhE,OAAO,EAEL,iCAAiC,EAElC,MAAM,iEAAiE,CAAC;
|
|
1
|
+
{"version":3,"file":"geometricFindExplicitFormulaFromSituation.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/sequences/geometric/situations/geometricFindExplicitFormulaFromSituation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAEL,sBAAsB,EACvB,MAAM,mDAAmD,CAAC;AAC3D,OAAO,EAEL,2BAA2B,EAC5B,MAAM,wDAAwD,CAAC;AAIhE,OAAO,EAEL,iCAAiC,EAElC,MAAM,iEAAiE,CAAC;AAmBzE,KAAK,WAAW,GAAG;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,iCAAiC,CAAC;CACrD,CAAC;AA0PF,KAAK,OAAO,GAAG,sBAAsB,GAAG,2BAA2B,CAAC;AAcpE,eAAO,MAAM,yCAAyC,EAAE,QAAQ,CAC9D,WAAW,EACX,OAAO,CAoBR,CAAC"}
|
|
@@ -11,6 +11,8 @@ import { multiply } from "../../../../../tree/nodes/operators/multiplyNode.js";
|
|
|
11
11
|
import { power } from "../../../../../tree/nodes/operators/powerNode.js";
|
|
12
12
|
import { substract } from "../../../../../tree/nodes/operators/substractNode.js";
|
|
13
13
|
import { parseAlgebraic } from "../../../../../tree/parsers/latexParser.js";
|
|
14
|
+
import { NodeComparator } from "../../../../../tree/utilities/nodeComparator.js";
|
|
15
|
+
import { NodeRewriter } from "../../../../../tree/utilities/nodeRewriter.js";
|
|
14
16
|
import { handleVEAError } from "../../../../../utils/errors/handleVEAError.js";
|
|
15
17
|
const getNodeFactor = (firstRank, varName = "n") => {
|
|
16
18
|
const nodeN = varName.toTree();
|
|
@@ -121,9 +123,16 @@ const isAnswerValid = (ans, { answer, ...identifiers }, optsIn) => {
|
|
|
121
123
|
const isValidRhs = () => {
|
|
122
124
|
const nodeAnsRhs = nodeAns.rightChild;
|
|
123
125
|
const nodeAnswerRhs = nodeAnswer.rightChild;
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
126
|
+
const isEquivalentFound = () => {
|
|
127
|
+
const nodeAns = nodeAnsRhs;
|
|
128
|
+
const nodeAnswer = nodeAnswerRhs;
|
|
129
|
+
const arrNodeAnswerEquivalent = NodeRewriter.getArrNodeEquivalent(nodeAnswer);
|
|
130
|
+
return arrNodeAnswerEquivalent.some((nodeAnswerRefined) => {
|
|
131
|
+
const isEqual = NodeComparator.isEqualViaFrac(nodeAns, nodeAnswerRefined);
|
|
132
|
+
return isEqual;
|
|
133
|
+
});
|
|
134
|
+
};
|
|
135
|
+
return isEquivalentFound();
|
|
127
136
|
};
|
|
128
137
|
return isValidLhs() && isValidRhs();
|
|
129
138
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"treeTableVEA.d.ts","sourceRoot":"","sources":["../../../src/exercises/vea/treeTableVEA.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,YAAY,GACvB,KAAK,MAAM,EAAE,EAAE,EAAE,EAAE,EACnB,aAAa,MAAM,EAAE,EAAE,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"treeTableVEA.d.ts","sourceRoot":"","sources":["../../../src/exercises/vea/treeTableVEA.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,YAAY,GACvB,KAAK,MAAM,EAAE,EAAE,EAAE,EAAE,EACnB,aAAa,MAAM,EAAE,EAAE,EAAE,EAAE,YAgB5B,CAAC"}
|
|
@@ -2,6 +2,9 @@ import { rationalVEA } from "./rationalVEA.js";
|
|
|
2
2
|
// type Options = {
|
|
3
3
|
// }
|
|
4
4
|
export const treeTableVEA = (ans, answerTable) => {
|
|
5
|
+
//TODO
|
|
6
|
+
//les branches peuvent commuter au sein d'un block
|
|
7
|
+
//les blocks peuvent commuter au sein d'un step
|
|
5
8
|
return ans.every((step, i) => step.every((block, j) => block.every((branch, k) => branch.every((value, l) => value === answerTable[i][j][k][l] ||
|
|
6
9
|
rationalVEA(value, answerTable[i][j][k][l])))));
|
|
7
10
|
};
|
package/lib/index.d.ts
CHANGED
|
@@ -1636,6 +1636,20 @@ declare const mathExercises: (Exercise<{
|
|
|
1636
1636
|
}, Record<string, string | boolean | string[]>> | Exercise<{
|
|
1637
1637
|
a: number;
|
|
1638
1638
|
k: number;
|
|
1639
|
+
}, Record<string, string | boolean | string[]>> | Exercise<{
|
|
1640
|
+
a: number;
|
|
1641
|
+
k: number;
|
|
1642
|
+
}, Record<string, string | boolean | string[]>> | Exercise<{
|
|
1643
|
+
coeffs: number[];
|
|
1644
|
+
}, Record<string, string | boolean | string[]>> | Exercise<{
|
|
1645
|
+
a: number;
|
|
1646
|
+
}, Record<string, string | boolean | string[]>> | Exercise<{
|
|
1647
|
+
a: number;
|
|
1648
|
+
k: number;
|
|
1649
|
+
type: number;
|
|
1650
|
+
}, Record<string, string | boolean | string[]>> | Exercise<{
|
|
1651
|
+
a: number;
|
|
1652
|
+
k: number;
|
|
1639
1653
|
}, Record<string, string | boolean | string[]>> | Exercise<{
|
|
1640
1654
|
pm: number;
|
|
1641
1655
|
a: number;
|
|
@@ -2996,6 +3010,8 @@ declare const mathExercises: (Exercise<{
|
|
|
2996
3010
|
pAIds: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
|
|
2997
3011
|
p_ABIds: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
|
|
2998
3012
|
p_ABarreBIds: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
|
|
3013
|
+
}, Record<string, string | boolean | string[]>> | Exercise<{
|
|
3014
|
+
percent: number;
|
|
2999
3015
|
}, Record<string, string | boolean | string[]>> | Exercise<{
|
|
3000
3016
|
questionType: string;
|
|
3001
3017
|
value?: string;
|
|
@@ -3255,11 +3271,25 @@ declare const mathExercises: (Exercise<{
|
|
|
3255
3271
|
BC: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
|
|
3256
3272
|
BD: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
|
|
3257
3273
|
probaName: string;
|
|
3274
|
+
useContraryNames?: boolean;
|
|
3258
3275
|
}, {
|
|
3259
|
-
allowApproximate
|
|
3260
|
-
eventTypes
|
|
3261
|
-
probaType
|
|
3276
|
+
allowApproximate?: string;
|
|
3277
|
+
eventTypes?: string[];
|
|
3278
|
+
probaType?: string;
|
|
3279
|
+
eventsNames?: string;
|
|
3262
3280
|
}> | Exercise<{
|
|
3281
|
+
initTree: string[][][][];
|
|
3282
|
+
valueDatas: {
|
|
3283
|
+
isComp: boolean;
|
|
3284
|
+
value: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
|
|
3285
|
+
}[];
|
|
3286
|
+
}, {
|
|
3287
|
+
probaType?: string;
|
|
3288
|
+
}> | Exercise<{
|
|
3289
|
+
params: import("./exercises/math/probaStat/trees/probaTreeSituations.js").ProbaTreeSituationParams;
|
|
3290
|
+
}, Record<string, string | boolean | string[]>> | Exercise<{
|
|
3291
|
+
params: import("./exercises/math/probaStat/trees/probaTreeSituations.js").ProbaTreeSituationParams;
|
|
3292
|
+
}, Record<string, string | boolean | string[]>> | Exercise<{
|
|
3263
3293
|
firstValue: number;
|
|
3264
3294
|
askedRank: number;
|
|
3265
3295
|
reason: number;
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,KAAK,aAAa,MAAM,2BAA2B,CAAC;AAE3D,OAAO,4BAA4B,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,QAAA,MAAM,aAAa
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,KAAK,aAAa,MAAM,2BAA2B,CAAC;AAE3D,OAAO,4BAA4B,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,QAAA,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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ultInMathMode && (inDollarMode || inDoubleDollarMode))
|
|
156
|
-
throw new Error(`Math mode not finished`);
|
|
156
|
+
throw new Error(`Math mode not finished ${formated}`);
|
|
157
157
|
if (leftRightCount !== 0)
|
|
158
158
|
throw new Error("Left right not balanced");
|
|
159
159
|
if (commandModeCount !== 0)
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import "../prototypesEnhancement.js";
|
|
2
2
|
import { exoTest } from "./exoTest.js";
|
|
3
|
-
import {
|
|
3
|
+
import { geometricFindExplicitFormulaFromSituation, } from "../exercises/math/index.js";
|
|
4
4
|
try {
|
|
5
5
|
for (let i = 0; i < 1000; i++)
|
|
6
|
-
exoTest(
|
|
6
|
+
exoTest(geometricFindExplicitFormulaFromSituation);
|
|
7
7
|
}
|
|
8
8
|
catch (err) {
|
|
9
9
|
throw err;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Node, NodeIds, NodeOptions, NodeType } from "../node.js";
|
|
2
2
|
import { FunctionNode, FunctionsIds } from "./functionNode.js";
|
|
3
3
|
import { AlgebraicNode, SimplifyOptions } from "../algebraicNode.js";
|
|
4
|
-
export declare const exp: (a: AlgebraicNode | number | string) => ExpNode;
|
|
4
|
+
export declare const exp: (a: AlgebraicNode | number | string, opts?: NodeOptions) => ExpNode;
|
|
5
5
|
export declare function isExpNode(a: Node): a is ExpNode;
|
|
6
6
|
export declare class ExpNode implements FunctionNode {
|
|
7
7
|
opts?: NodeOptions;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/functions/expNode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,YAAY,EAAkB,MAAM,mBAAmB,CAAC;AAC/E,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;A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AC;IAGxD,UAAU,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,aAAa;CAGxD"}
|
|
@@ -4,9 +4,9 @@ import { FunctionsIds, isFunctionNode } from "./functionNode.js";
|
|
|
4
4
|
import { isNumberNode } from "../numbers/numberNode.js";
|
|
5
5
|
import { isLogNode } from "./logNode.js";
|
|
6
6
|
import { multiply } from "../operators/multiplyNode.js";
|
|
7
|
-
export const exp = (a) => {
|
|
7
|
+
export const exp = (a, opts) => {
|
|
8
8
|
const nodeA = typeof a === "number" ? a.toTree() : typeof a === "string" ? a.toTree() : a;
|
|
9
|
-
return new ExpNode(nodeA);
|
|
9
|
+
return new ExpNode(nodeA, opts);
|
|
10
10
|
};
|
|
11
11
|
export function isExpNode(a) {
|
|
12
12
|
return isFunctionNode(a) && a.id === FunctionsIds.exp;
|
|
@@ -54,10 +54,7 @@ export class ExpNode {
|
|
|
54
54
|
if (this.opts?.useExpNotation) {
|
|
55
55
|
return `\\exp\\left(${tex}\\right)`;
|
|
56
56
|
}
|
|
57
|
-
|
|
58
|
-
if (needBraces)
|
|
59
|
-
return `e^{${tex}}`;
|
|
60
|
-
return `e^${tex}`;
|
|
57
|
+
return `e^{${tex}}`;
|
|
61
58
|
}
|
|
62
59
|
// toMathjs() {
|
|
63
60
|
// return exp(this.child.toMathjs());
|
|
@@ -2,7 +2,7 @@ import { Node, NodeIds, NodeOptions, NodeType, ToTexOptions } from "../node.js";
|
|
|
2
2
|
import { CommutativeOperatorNode, OperatorIds } from "./operatorNode.js";
|
|
3
3
|
import { AlgebraicNode, SimplifyOptions } from "../algebraicNode.js";
|
|
4
4
|
export declare function isAddNode(a: Node): a is AddNode;
|
|
5
|
-
export declare const add: (a: AlgebraicNode | number | string, b: AlgebraicNode | number | string) => AddNode;
|
|
5
|
+
export declare const add: (a: AlgebraicNode | number | string, b: AlgebraicNode | number | string, opts?: NodeOptions) => AddNode;
|
|
6
6
|
export declare class AddNode implements CommutativeOperatorNode {
|
|
7
7
|
id: OperatorIds;
|
|
8
8
|
leftChild: AlgebraicNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/operators/addNode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAChF,OAAO,EACL,uBAAuB,EACvB,WAAW,EAEZ,MAAM,mBAAmB,CAAC;AAI3B,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAerE,wBAAgB,SAAS,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,IAAI,OAAO,CAE/C;AAED,eAAO,MAAM,GAAG,GACd,GAAG,aAAa,GAAG,MAAM,GAAG,MAAM,EAClC,GAAG,aAAa,GAAG,MAAM,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"addNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/operators/addNode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAChF,OAAO,EACL,uBAAuB,EACvB,WAAW,EAEZ,MAAM,mBAAmB,CAAC;AAI3B,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAerE,wBAAgB,SAAS,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,IAAI,OAAO,CAE/C;AAED,eAAO,MAAM,GAAG,GACd,GAAG,aAAa,GAAG,MAAM,GAAG,MAAM,EAClC,GAAG,aAAa,GAAG,MAAM,GAAG,MAAM,EAClC,OAAO,WAAW,YAOnB,CAAC;AAEF,qBAAa,OAAQ,YAAW,uBAAuB;IACrD,EAAE,EAAE,WAAW,CAAC;IAChB,SAAS,EAAE,aAAa,CAAC;IACzB,UAAU,EAAE,aAAa,CAAC;IAC1B,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,SAAS,EAAE,OAAO,CAAC;gBAEjB,SAAS,EAAE,aAAa,EACxB,UAAU,EAAE,aAAa,EACzB,IAAI,CAAC,EAAE,WAAW;IAUpB;;OAEG;IACH,OAAO,gBAIL;IAEF,YAAY,IAAI,MAAM;IAItB,iBAAiB,CAAC,IAAI,CAAC,EAAE,WAAW,GAAG,aAAa,EAAE;IAoCtD,SAAS,IAAI,MAAM,EAAE;IAIrB,cAAc,CAAC,IAAI,CAAC,EAAE,WAAW,GAAG,MAAM,EAAE;IAK5C,KAAK,CAAC,OAAO,CAAC,EAAE,YAAY,GAAG,MAAM;IAerC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAGtC,mBAAmB;IAUnB,QAAQ,CAAC,IAAI,CAAC,EAAE,eAAe,EAAE,IAAI,UAAQ,GAAG,aAAa;IAyJ7D,aAAa;;;;;;;;;IAOb,MAAM,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO;IAUpC,oBAAoB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC;IAMxD,UAAU,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,aAAa;IAMvD,mBAAmB,CAAC,IAAI,CAAC,EAAE,eAAe;CAK3C"}
|
|
@@ -16,10 +16,10 @@ import { shuffle } from "../../../utils/alea/shuffle.js";
|
|
|
16
16
|
export function isAddNode(a) {
|
|
17
17
|
return isOperatorNode(a) && a.id === OperatorIds.add;
|
|
18
18
|
}
|
|
19
|
-
export const add = (a, b) => {
|
|
19
|
+
export const add = (a, b, opts) => {
|
|
20
20
|
const nodeA = typeof a === "number" ? a.toTree() : typeof a === "string" ? a.toTree() : a;
|
|
21
21
|
const nodeB = typeof b === "number" ? b.toTree() : typeof b === "string" ? b.toTree() : b;
|
|
22
|
-
return new AddNode(nodeA, nodeB);
|
|
22
|
+
return new AddNode(nodeA, nodeB, opts);
|
|
23
23
|
};
|
|
24
24
|
export class AddNode {
|
|
25
25
|
id;
|
|
@@ -3,7 +3,7 @@ import { OperatorIds, OperatorNode } from "./operatorNode.js";
|
|
|
3
3
|
import { AddNode } from "./addNode.js";
|
|
4
4
|
import { AlgebraicNode, SimplifyOptions } from "../algebraicNode.js";
|
|
5
5
|
export declare function isSubstractNode(a: Node): a is SubstractNode;
|
|
6
|
-
export declare const substract: (a: AlgebraicNode | number | string, b: AlgebraicNode | number | string) => SubstractNode;
|
|
6
|
+
export declare const substract: (a: AlgebraicNode | number | string, b: AlgebraicNode | number | string, opts?: NodeOptions) => SubstractNode;
|
|
7
7
|
export declare class SubstractNode implements OperatorNode {
|
|
8
8
|
id: OperatorIds;
|
|
9
9
|
leftChild: AlgebraicNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"substractNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/operators/substractNode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAChF,OAAO,EAAE,WAAW,EAAE,YAAY,EAAkB,MAAM,mBAAmB,CAAC;AAE9E,OAAO,EAAO,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAIrE,wBAAgB,eAAe,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,IAAI,aAAa,CAE3D;AAED,eAAO,MAAM,SAAS,GACpB,GAAG,aAAa,GAAG,MAAM,GAAG,MAAM,EAClC,GAAG,aAAa,GAAG,MAAM,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"substractNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/operators/substractNode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW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AAU,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,aAAa;IAMvD,OAAO,uBAGL;CACH"}
|
|
@@ -9,10 +9,10 @@ import { round } from "../../../math/utils/round.js";
|
|
|
9
9
|
export function isSubstractNode(a) {
|
|
10
10
|
return isOperatorNode(a) && a.id === OperatorIds.substract;
|
|
11
11
|
}
|
|
12
|
-
export const substract = (a, b) => {
|
|
12
|
+
export const substract = (a, b, opts) => {
|
|
13
13
|
const nodeA = typeof a === "number" ? a.toTree() : typeof a === "string" ? a.toTree() : a;
|
|
14
14
|
const nodeB = typeof b === "number" ? b.toTree() : typeof b === "string" ? b.toTree() : b;
|
|
15
|
-
return new SubstractNode(nodeA, nodeB);
|
|
15
|
+
return new SubstractNode(nodeA, nodeB, opts);
|
|
16
16
|
};
|
|
17
17
|
export class SubstractNode {
|
|
18
18
|
id;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AlgebraicNode } from "../nodes/algebraicNode.js";
|
|
2
|
+
export declare abstract class NodeComparator {
|
|
3
|
+
static compareViaSub: <T extends AlgebraicNode>(node1: T, node2: T) => -1 | 0 | 1;
|
|
4
|
+
static isEqualViaSub: (node1: AlgebraicNode, node2: AlgebraicNode) => boolean;
|
|
5
|
+
static isEqualViaFrac: (node1: AlgebraicNode, node2: AlgebraicNode) => boolean;
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=nodeComparator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nodeComparator.d.ts","sourceRoot":"","sources":["../../../src/tree/utilities/nodeComparator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAM1D,8BAAsB,cAAc;IAGlC,MAAM,CAAC,aAAa,GAAI,CAAC,SAAS,aAAa,EAC7C,OAAO,CAAC,EACR,OAAO,CAAC,KACP,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CA4DX;IAEF,MAAM,CAAC,aAAa,GAClB,OAAO,aAAa,EACpB,OAAO,aAAa,KACnB,OAAO,CAER;IAIF,MAAM,CAAC,cAAc,GACnB,OAAO,aAAa,EACpB,OAAO,aAAa,KACnB,OAAO,CAgBR;CACH"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { frac } from "../nodes/operators/fractionNode.js";
|
|
2
|
+
import { substract } from "../nodes/operators/substractNode.js";
|
|
3
|
+
import { NodeRewriter } from "./nodeRewriter.js";
|
|
4
|
+
import { NodeSimplifier } from "./nodeSimplifier.js";
|
|
5
|
+
export class NodeComparator {
|
|
6
|
+
//via sub
|
|
7
|
+
static compareViaSub = (node1, node2) => {
|
|
8
|
+
const isSameTex = () => {
|
|
9
|
+
return node1.toTex() === node2.toTex();
|
|
10
|
+
};
|
|
11
|
+
function compareValueSub(valueSub) {
|
|
12
|
+
if (isNaN(valueSub)) {
|
|
13
|
+
throw new Error("valueSub is NaN");
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
if (valueSub === 0) {
|
|
17
|
+
return 0;
|
|
18
|
+
}
|
|
19
|
+
else if (valueSub > 0) {
|
|
20
|
+
return 1;
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
return -1;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
const compareUsingEvaluate = () => {
|
|
28
|
+
const valueSub = substract(node1, node2).evaluate();
|
|
29
|
+
return compareValueSub(valueSub);
|
|
30
|
+
};
|
|
31
|
+
const isEquivalent = () => {
|
|
32
|
+
const [arrNode1, arrNode2] = [node1, node2].map((node) => NodeRewriter.getArrNodeEquivalent(node));
|
|
33
|
+
return arrNode1.some((node1Equivalent) => {
|
|
34
|
+
return arrNode2.some((node2Equivalent) => {
|
|
35
|
+
try {
|
|
36
|
+
const nodeSub = substract(node1Equivalent, node2Equivalent);
|
|
37
|
+
const nodeSubSimplified = NodeSimplifier.simplifyByVibrating(nodeSub);
|
|
38
|
+
const valueSub = nodeSubSimplified.evaluate();
|
|
39
|
+
return compareValueSub(valueSub);
|
|
40
|
+
}
|
|
41
|
+
catch (_) {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
try {
|
|
48
|
+
if (isSameTex()) {
|
|
49
|
+
return 0;
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
return compareUsingEvaluate();
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
catch (_) {
|
|
56
|
+
try {
|
|
57
|
+
if (isEquivalent()) {
|
|
58
|
+
return 0;
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
return 1;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
catch (_) {
|
|
65
|
+
return 1;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
static isEqualViaSub = (node1, node2) => {
|
|
70
|
+
return this.compareViaSub(node1, node2) === 0;
|
|
71
|
+
};
|
|
72
|
+
//via frac
|
|
73
|
+
static isEqualViaFrac = (node1, node2) => {
|
|
74
|
+
const [arrNode1, arrNode2] = [node1, node2].map((node) => NodeRewriter.getArrNodeEquivalent(node));
|
|
75
|
+
return arrNode1.some((node1Equivalent) => {
|
|
76
|
+
return arrNode2.some((node2Equivalent) => {
|
|
77
|
+
try {
|
|
78
|
+
const nodeFrac = frac(node1Equivalent, node2Equivalent);
|
|
79
|
+
const nodeFracSimplified = NodeSimplifier.simplifyByVibrating(nodeFrac);
|
|
80
|
+
return this.isEqualViaSub(nodeFracSimplified, (1).toTree());
|
|
81
|
+
}
|
|
82
|
+
catch (_) {
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
};
|
|
88
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nodeInspector.d.ts","sourceRoot":"","sources":["../../../src/tree/utilities/nodeInspector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAI1D,8BAAsB,aAAa;IACjC,MAAM,CAAC,WAAW,CAAC,aAAa,EAAE,aAAa;CAShD"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { isFunctionNode } from "../nodes/functions/functionNode.js";
|
|
2
|
+
import { isOperatorNode } from "../nodes/operators/operatorNode.js";
|
|
3
|
+
export class NodeInspector {
|
|
4
|
+
static getChildren(algebraicNode) {
|
|
5
|
+
if (isOperatorNode(algebraicNode)) {
|
|
6
|
+
return [algebraicNode.leftChild, algebraicNode.rightChild];
|
|
7
|
+
}
|
|
8
|
+
else if (isFunctionNode(algebraicNode)) {
|
|
9
|
+
return [algebraicNode.child];
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
return [];
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AlgebraicNode } from "../nodes/algebraicNode.js";
|
|
2
|
+
export declare abstract class NodeRewriter {
|
|
3
|
+
static rewriteTopLevel: <T extends AlgebraicNode>(algebraicNode: T, indexIn?: number, shuffleArrayIn?: number[]) => AlgebraicNode;
|
|
4
|
+
static getCreateNodeFromChildrenFunction: <T extends AlgebraicNode>(algebraicNode: T, indexIn?: number) => (children: AlgebraicNode[]) => AlgebraicNode;
|
|
5
|
+
static getArrCreateNodeFromChildrenFunction: (algebraicNode: AlgebraicNode) => ((children: AlgebraicNode[]) => AlgebraicNode)[];
|
|
6
|
+
static getArrRewriteTopLevel(algebraicNode: AlgebraicNode): AlgebraicNode[];
|
|
7
|
+
static getArrNodeEquivalent(algebraicNode: AlgebraicNode, isDistinctTex?: boolean): AlgebraicNode[];
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=nodeRewriter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nodeRewriter.d.ts","sourceRoot":"","sources":["../../../src/tree/utilities/nodeRewriter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAkC1D,8BAAsB,YAAY;IAChC,MAAM,CAAC,eAAe,GAAI,CAAC,SAAS,aAAa,EAC/C,eAAe,CAAC,EAChB,UAAU,MAAM,EAChB,iBAAiB,MAAM,EAAE,KACxB,aAAa,CAUd;IAEF,MAAM,CAAC,iCAAiC,GAAI,CAAC,SAAS,aAAa,EACjE,eAAe,CAAC,EAChB,UAAU,MAAM,gBAgBH,aAAa,EAAE,KAAK,aAAa,CAP9C;IAKF,MAAM,CAAC,oCAAoC,GACzC,eAAe,aAAa,KAC3B,CAAC,CAAC,QAAQ,EAAE,aAAa,EAAE,KAAK,aAAa,CAAC,EAAE,CA2HjD;IAEF,MAAM,CAAC,qBAAqB,CAAC,aAAa,EAAE,aAAa,GAAG,aAAa,EAAE;IAW3E,MAAM,CAAC,oBAAoB,CACzB,aAAa,EAAE,aAAa,EAC5B,aAAa,GAAE,OAAc,GAC5B,aAAa,EAAE;CAwCnB"}
|