math-exercises 3.0.10 → 3.0.12
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/calcul/fractions/fractionsOperations.d.ts.map +1 -1
- package/lib/exercises/math/calcul/fractions/fractionsOperations.js +0 -1
- package/lib/exercises/math/calculLitteral/equation/equationType4Exercise.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/equationType4Exercise.js +17 -15
- package/lib/exercises/math/calculLitteral/equation/firstDegreeEquationIntType1.js +1 -1
- package/lib/exercises/math/calculLitteral/equation/firstDegreeEquationIntType3.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/firstDegreeEquationIntType3.js +17 -3
- package/lib/exercises/math/calculLitteral/factorisation/factoType1Exercise.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/factorisation/factoType1Exercise.js +6 -2
- package/lib/exercises/math/functions/basics/inverseImageFunction.d.ts +2 -2
- package/lib/exercises/math/functions/basics/inverseImageFunction.d.ts.map +1 -1
- package/lib/exercises/math/functions/basics/inverseImageFunction.js +81 -14
- package/lib/exercises/math/functions/trinoms/devForm/coefficientsIdentification.d.ts +11 -0
- package/lib/exercises/math/functions/trinoms/devForm/coefficientsIdentification.d.ts.map +1 -0
- package/lib/exercises/math/functions/trinoms/devForm/coefficientsIdentification.js +134 -0
- package/lib/exercises/math/functions/trinoms/devForm/index.d.ts +3 -0
- package/lib/exercises/math/functions/trinoms/devForm/index.d.ts.map +1 -0
- package/lib/exercises/math/functions/trinoms/devForm/index.js +2 -0
- package/lib/exercises/math/functions/trinoms/devForm/variationsFromAlgebricForm.d.ts +9 -0
- package/lib/exercises/math/functions/trinoms/devForm/variationsFromAlgebricForm.d.ts.map +1 -0
- package/lib/exercises/math/functions/trinoms/devForm/variationsFromAlgebricForm.js +42 -0
- package/lib/exercises/math/functions/trinoms/equation/deltaTrinom.d.ts +9 -0
- package/lib/exercises/math/functions/trinoms/equation/deltaTrinom.d.ts.map +1 -0
- package/lib/exercises/math/functions/trinoms/equation/deltaTrinom.js +50 -0
- package/lib/exercises/math/functions/trinoms/equation/index.d.ts +5 -0
- package/lib/exercises/math/functions/trinoms/equation/index.d.ts.map +1 -0
- package/lib/exercises/math/functions/trinoms/equation/index.js +4 -0
- package/lib/exercises/math/functions/trinoms/equation/secondDegreeInequation.d.ts +11 -0
- package/lib/exercises/math/functions/trinoms/equation/secondDegreeInequation.d.ts.map +1 -0
- package/lib/exercises/math/functions/trinoms/equation/secondDegreeInequation.js +102 -0
- package/lib/exercises/math/functions/trinoms/equation/solveSecondDegreeEquationByFactorisation.d.ts +9 -0
- package/lib/exercises/math/functions/trinoms/equation/solveSecondDegreeEquationByFactorisation.d.ts.map +1 -0
- package/lib/exercises/math/functions/trinoms/equation/solveSecondDegreeEquationByFactorisation.js +131 -0
- package/lib/exercises/math/functions/trinoms/equation/solveSecondDegreeEquationFromCano.d.ts +7 -0
- package/lib/exercises/math/functions/trinoms/equation/solveSecondDegreeEquationFromCano.d.ts.map +1 -0
- package/lib/exercises/math/functions/trinoms/equation/solveSecondDegreeEquationFromCano.js +69 -0
- package/lib/exercises/math/functions/trinoms/factoForm/factorizedFormFromRoots.d.ts +8 -0
- package/lib/exercises/math/functions/trinoms/factoForm/factorizedFormFromRoots.d.ts.map +1 -0
- package/lib/exercises/math/functions/trinoms/factoForm/factorizedFormFromRoots.js +72 -0
- package/lib/exercises/math/functions/trinoms/factoForm/index.d.ts +2 -0
- package/lib/exercises/math/functions/trinoms/factoForm/index.d.ts.map +1 -0
- package/lib/exercises/math/functions/trinoms/factoForm/index.js +1 -0
- package/lib/exercises/math/functions/trinoms/index.d.ts +7 -23
- package/lib/exercises/math/functions/trinoms/index.d.ts.map +1 -1
- package/lib/exercises/math/functions/trinoms/index.js +7 -23
- package/lib/exercises/math/functions/trinoms/parabole/index.d.ts +3 -0
- package/lib/exercises/math/functions/trinoms/parabole/index.d.ts.map +1 -0
- package/lib/exercises/math/functions/trinoms/parabole/index.js +2 -0
- package/lib/exercises/math/functions/trinoms/parabole/paraboleExpressionReading.d.ts +8 -0
- package/lib/exercises/math/functions/trinoms/parabole/paraboleExpressionReading.d.ts.map +1 -0
- package/lib/exercises/math/functions/trinoms/parabole/paraboleExpressionReading.js +285 -0
- package/lib/exercises/math/functions/trinoms/parabole/trinomSymetryAxisFromFacto.d.ts +9 -0
- package/lib/exercises/math/functions/trinoms/parabole/trinomSymetryAxisFromFacto.d.ts.map +1 -0
- package/lib/exercises/math/functions/trinoms/parabole/trinomSymetryAxisFromFacto.js +112 -0
- package/lib/exercises/math/functions/trinoms/roots/findSecondRoot.d.ts +10 -0
- package/lib/exercises/math/functions/trinoms/roots/findSecondRoot.d.ts.map +1 -0
- package/lib/exercises/math/functions/trinoms/roots/findSecondRoot.js +124 -0
- package/lib/exercises/math/functions/trinoms/roots/index.d.ts +8 -0
- package/lib/exercises/math/functions/trinoms/roots/index.d.ts.map +1 -0
- package/lib/exercises/math/functions/trinoms/roots/index.js +7 -0
- package/lib/exercises/math/functions/trinoms/roots/niceRootsFromDevForm.d.ts +9 -0
- package/lib/exercises/math/functions/trinoms/roots/niceRootsFromDevForm.d.ts.map +1 -0
- package/lib/exercises/math/functions/trinoms/roots/niceRootsFromDevForm.js +54 -0
- package/lib/exercises/math/functions/trinoms/roots/rootsFromDevForm.d.ts +9 -0
- package/lib/exercises/math/functions/trinoms/roots/rootsFromDevForm.d.ts.map +1 -0
- package/lib/exercises/math/functions/trinoms/roots/rootsFromDevForm.js +55 -0
- package/lib/exercises/math/functions/trinoms/roots/rootsFromFactorizedForm.d.ts +9 -0
- package/lib/exercises/math/functions/trinoms/roots/rootsFromFactorizedForm.d.ts.map +1 -0
- package/lib/exercises/math/functions/trinoms/roots/rootsFromFactorizedForm.js +67 -0
- package/lib/exercises/math/functions/trinoms/roots/rootsProduct.d.ts +8 -0
- package/lib/exercises/math/functions/trinoms/roots/rootsProduct.d.ts.map +1 -0
- package/lib/exercises/math/functions/trinoms/roots/rootsProduct.js +109 -0
- package/lib/exercises/math/functions/trinoms/roots/rootsReading.d.ts +9 -0
- package/lib/exercises/math/functions/trinoms/roots/rootsReading.d.ts.map +1 -0
- package/lib/exercises/math/functions/trinoms/roots/rootsReading.js +63 -0
- package/lib/exercises/math/functions/trinoms/roots/rootsSum.d.ts +8 -0
- package/lib/exercises/math/functions/trinoms/roots/rootsSum.d.ts.map +1 -0
- package/lib/exercises/math/functions/trinoms/roots/rootsSum.js +109 -0
- package/lib/exercises/math/functions/trinoms/sign/index.d.ts +3 -0
- package/lib/exercises/math/functions/trinoms/sign/index.d.ts.map +1 -0
- package/lib/exercises/math/functions/trinoms/sign/index.js +2 -0
- package/lib/exercises/math/functions/trinoms/sign/trinomSignFromFacto.d.ts +8 -0
- package/lib/exercises/math/functions/trinoms/sign/trinomSignFromFacto.d.ts.map +1 -0
- package/lib/exercises/math/functions/trinoms/sign/trinomSignFromFacto.js +120 -0
- package/lib/exercises/math/functions/trinoms/sign/trinomSignFromRoots.d.ts +8 -0
- package/lib/exercises/math/functions/trinoms/sign/trinomSignFromRoots.d.ts.map +1 -0
- package/lib/exercises/math/functions/trinoms/sign/trinomSignFromRoots.js +119 -0
- package/lib/exercises/math/functions/trinoms/summitAndCanonical/alphaBetaFromDevForm.d.ts +8 -0
- package/lib/exercises/math/functions/trinoms/summitAndCanonical/alphaBetaFromDevForm.d.ts.map +1 -0
- package/lib/exercises/math/functions/trinoms/summitAndCanonical/alphaBetaFromDevForm.js +49 -0
- package/lib/exercises/math/functions/trinoms/summitAndCanonical/alphaBetaInCanonicalForm.d.ts +10 -0
- package/lib/exercises/math/functions/trinoms/summitAndCanonical/alphaBetaInCanonicalForm.d.ts.map +1 -0
- package/lib/exercises/math/functions/trinoms/summitAndCanonical/alphaBetaInCanonicalForm.js +64 -0
- package/lib/exercises/math/functions/trinoms/summitAndCanonical/canonicalFromDevForm.d.ts +9 -0
- package/lib/exercises/math/functions/trinoms/summitAndCanonical/canonicalFromDevForm.d.ts.map +1 -0
- package/lib/exercises/math/functions/trinoms/summitAndCanonical/canonicalFromDevForm.js +48 -0
- package/lib/exercises/math/functions/trinoms/summitAndCanonical/extremumFromCanonicalForm.d.ts +9 -0
- package/lib/exercises/math/functions/trinoms/summitAndCanonical/extremumFromCanonicalForm.d.ts.map +1 -0
- package/lib/exercises/math/functions/trinoms/summitAndCanonical/extremumFromCanonicalForm.js +55 -0
- package/lib/exercises/math/functions/trinoms/summitAndCanonical/extremumTypeFromAlgebricForm.d.ts +9 -0
- package/lib/exercises/math/functions/trinoms/summitAndCanonical/extremumTypeFromAlgebricForm.d.ts.map +1 -0
- package/lib/exercises/math/functions/trinoms/summitAndCanonical/extremumTypeFromAlgebricForm.js +42 -0
- package/lib/exercises/math/functions/trinoms/summitAndCanonical/index.d.ts +9 -0
- package/lib/exercises/math/functions/trinoms/summitAndCanonical/index.d.ts.map +1 -0
- package/lib/exercises/math/functions/trinoms/summitAndCanonical/index.js +8 -0
- package/lib/exercises/math/functions/trinoms/summitAndCanonical/summitAbscissFromDevForm.d.ts +9 -0
- package/lib/exercises/math/functions/trinoms/summitAndCanonical/summitAbscissFromDevForm.d.ts.map +1 -0
- package/lib/exercises/math/functions/trinoms/summitAndCanonical/summitAbscissFromDevForm.js +90 -0
- package/lib/exercises/math/functions/trinoms/summitAndCanonical/summitAbscissFromRoots.d.ts +9 -0
- package/lib/exercises/math/functions/trinoms/summitAndCanonical/summitAbscissFromRoots.d.ts.map +1 -0
- package/lib/exercises/math/functions/trinoms/summitAndCanonical/summitAbscissFromRoots.js +55 -0
- package/lib/exercises/math/functions/trinoms/summitAndCanonical/summitReading.d.ts +9 -0
- package/lib/exercises/math/functions/trinoms/summitAndCanonical/summitReading.d.ts.map +1 -0
- package/lib/exercises/math/functions/trinoms/summitAndCanonical/summitReading.js +59 -0
- package/lib/exercises/math/geometry/areas/triangleArea.d.ts +2 -0
- package/lib/exercises/math/geometry/areas/triangleArea.d.ts.map +1 -1
- package/lib/exercises/math/geometry/areas/triangleArea.js +56 -31
- package/lib/exercises/math/geometry/cartesian/drawAlineInGGB.d.ts.map +1 -1
- package/lib/exercises/math/geometry/cartesian/drawAlineInGGB.js +34 -14
- package/lib/exercises/math/trigonometry/equationCosOnRandomInterval.js +10 -10
- package/lib/exercises/math/trigonometry/equationSinOnRandomInterval.js +10 -10
- package/lib/exercises/math/trigonometry/mainAngleMeasure.d.ts.map +1 -1
- package/lib/exercises/math/trigonometry/mainAngleMeasure.js +1 -0
- package/lib/exercises/math/trigonometry/trigonometrySideCalcul.d.ts.map +1 -1
- package/lib/exercises/math/trigonometry/trigonometrySideCalcul.js +170 -106
- package/lib/exercises/vea/numberVEA.d.ts +1 -1
- package/lib/exercises/vea/numberVEA.d.ts.map +1 -1
- package/lib/exercises/vea/numberVEA.js +2 -2
- package/lib/index.d.ts +44 -33
- package/lib/index.d.ts.map +1 -1
- package/lib/math/geometry/triangle.d.ts +1 -0
- package/lib/math/geometry/triangle.d.ts.map +1 -1
- package/lib/math/geometry/triangle.js +10 -2
- package/lib/math/polynomials/affine.d.ts +2 -0
- package/lib/math/polynomials/affine.d.ts.map +1 -1
- package/lib/math/polynomials/affine.js +5 -0
- package/lib/math/systems/generalSystem.d.ts.map +1 -1
- package/lib/tests/questionTest.d.ts.map +1 -1
- package/lib/tests/questionTest.js +1 -1
- package/lib/tree/nodes/algebraicNode.d.ts +1 -0
- package/lib/tree/nodes/algebraicNode.d.ts.map +1 -1
- package/lib/tree/nodes/equations/equalNode.d.ts +1 -2
- package/lib/tree/nodes/equations/equalNode.d.ts.map +1 -1
- package/lib/tree/nodes/equations/equalNode.js +47 -22
- package/lib/tree/nodes/polynomials/trinomNode.d.ts +1 -0
- package/lib/tree/nodes/polynomials/trinomNode.d.ts.map +1 -1
- package/lib/tree/nodes/polynomials/trinomNode.js +9 -0
- package/lib/tree/nodes/variables/variableNode.d.ts.map +1 -1
- package/lib/tree/nodes/variables/variableNode.js +1 -3
- package/lib/tree/parsers/numberParser.d.ts +1 -1
- package/lib/tree/parsers/numberParser.d.ts.map +1 -1
- package/lib/tree/parsers/numberParser.js +4 -1
- package/package.json +1 -1
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { coinFlip } from "../../../utils/alea/coinFlip.js";
|
|
2
|
+
import { alignTex } from "../../../utils/latex/alignTex.js";
|
|
2
3
|
import { NodeIds, NodeType } from "../node.js";
|
|
3
4
|
import { NodeConstructor } from "../nodeConstructor.js";
|
|
5
|
+
import { add } from "../operators/addNode.js";
|
|
6
|
+
import { frac } from "../operators/fractionNode.js";
|
|
7
|
+
import { multiply } from "../operators/multiplyNode.js";
|
|
8
|
+
import { substract } from "../operators/substractNode.js";
|
|
9
|
+
import { monom } from "../polynomials/monomNode.js";
|
|
4
10
|
export const equal = (a, b) => {
|
|
5
11
|
const nodeA = typeof a === "number" ? a.toTree() : typeof a === "string" ? a.toTree() : a;
|
|
6
12
|
const nodeB = typeof b === "number" ? b.toTree() : typeof b === "string" ? b.toTree() : b;
|
|
@@ -67,26 +73,45 @@ export class EqualNode {
|
|
|
67
73
|
return new EqualNode(this.rightChild, this.leftChild, this.opts);
|
|
68
74
|
}
|
|
69
75
|
}
|
|
70
|
-
export const
|
|
71
|
-
//
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
76
|
+
export const equationResolutionTex = (a, b, c, d) => {
|
|
77
|
+
//(+-a)x(+-b) = (+-c)x(+-d)
|
|
78
|
+
const steps = [];
|
|
79
|
+
const iteration = (a, b, c, d) => {
|
|
80
|
+
const aEv = a.evaluate();
|
|
81
|
+
const bEv = b.evaluate();
|
|
82
|
+
const cEv = c.evaluate();
|
|
83
|
+
if (bEv === 0) {
|
|
84
|
+
if (cEv === 0) {
|
|
85
|
+
//ax = d
|
|
86
|
+
if (aEv === 1) {
|
|
87
|
+
//x = d
|
|
88
|
+
steps.push(`x=${d.toTex()}`);
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
//ax = d
|
|
93
|
+
steps.push(`${multiply(a, "x").toTex()}=${d.toTex()}`);
|
|
94
|
+
iteration((1).toTree(), (0).toTree(), (0).toTree(), frac(d, a).simplify());
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
steps.push(`${monom(a, 1).toTex()}=${add(monom(c, 1), d).toTex()}`);
|
|
99
|
+
//ax = c!x + d
|
|
100
|
+
iteration(substract(a, c).simplify(), (0).toTree(), (0).toTree(), d);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
//ax + b! = cx + d
|
|
105
|
+
steps.push(`${add(multiply(a, "x"), b).simplify().toTex()}=${add(multiply(c, "x"), d)
|
|
106
|
+
.simplify()
|
|
107
|
+
.toTex()}`);
|
|
108
|
+
iteration(a, (0).toTree(), c, substract(d, b).simplify());
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
iteration(a, b, c, d);
|
|
112
|
+
if (steps.length === 1) {
|
|
113
|
+
return steps[0];
|
|
114
|
+
}
|
|
115
|
+
return alignTex(steps.map((e) => [e.split("=")[0], "=", e.split("=")[1]]), true);
|
|
116
|
+
return steps;
|
|
92
117
|
};
|
|
@@ -62,6 +62,7 @@ export declare class TrinomNode implements AlgebraicNode {
|
|
|
62
62
|
toMathString(): string;
|
|
63
63
|
getRoots(): AlgebraicNode[];
|
|
64
64
|
toTree(): import("../../../tree/nodes/operators/addNode.js").AddNode | import("../../../tree/nodes/operators/multiplyNode.js").MultiplyNode;
|
|
65
|
+
toFactorized(): AlgebraicNode | import("../../../tree/nodes/operators/addNode.js").AddNode | import("../../../tree/nodes/operators/multiplyNode.js").MultiplyNode;
|
|
65
66
|
toTex(): string;
|
|
66
67
|
getCoeffs(): number[];
|
|
67
68
|
toIdentifiers(): TrinomNodeIdentifiers;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trinomNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/polynomials/trinomNode.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,aAAa,EACb,eAAe,EAChB,MAAM,mCAAmC,CAAC;AAG3C,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAC1E,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAE7C,8BAAsB,qBAAqB;IACzC,MAAM,CAAC,MAAM,CACX,KAAK,CAAC,EAAE;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,EAC3D,KAAK,CAAC,EAAE;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,EAC3D,KAAK,CAAC,EAAE;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,GAC1D,UAAU;IAmBb,MAAM,CAAC,eAAe,CACpB,KAAK,CAAC,EAAE;QACN,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;QACpB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;KACjB,EACD,SAAS,CAAC,EAAE;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,C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iBAAiB;IAU1B,QAAQ;IAgBR,UAAU,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS;IAGvC,MAAM,CAAC,IAAI,EAAE,aAAa;IAG1B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAGtC,oBAAoB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC;IAGxD,QAAQ,CAAC,IAAI,CAAC,EAAE,eAAe;IAG/B,cAAc,CAAC,IAAI,CAAC,EAAE,WAAW,GAAG,SAAS;IAG7C,iBAAiB,CAAC,IAAI,CAAC,EAAE,WAAW,GAAG,SAAS;IAGhD,YAAY;IAIZ,QAAQ,IAAI,aAAa,EAAE;IAgB3B,MAAM;IAYN,YAAY;IAiBZ,KAAK;IAGL,SAAS;IAIT,aAAa,IAAI,qBAAqB;CASvC"}
|
|
@@ -138,6 +138,15 @@ export class TrinomNode {
|
|
|
138
138
|
return add(highMonom, this.c);
|
|
139
139
|
return add(highMonom, add(middleMonom, this.c));
|
|
140
140
|
}
|
|
141
|
+
toFactorized() {
|
|
142
|
+
const roots = this.getRoots();
|
|
143
|
+
if (!roots.length)
|
|
144
|
+
return this.toTree();
|
|
145
|
+
if (roots.length === 1) {
|
|
146
|
+
return multiply(this.a, square(substract(this.variable, roots[0]))).simplify();
|
|
147
|
+
}
|
|
148
|
+
return multiply(this.a, multiply(substract(this.variable, roots[0]), substract(this.variable, roots[1]))).simplify();
|
|
149
|
+
}
|
|
141
150
|
toTex() {
|
|
142
151
|
return this.toTree().toTex();
|
|
143
152
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"variableNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/variables/variableNode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CA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Aa,CAAC;IAGxD,UAAU,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,aAAa;CAKxD"}
|
|
@@ -47,9 +47,7 @@ export class VariableNode {
|
|
|
47
47
|
return isVariableNode(node) && node.name === this.name;
|
|
48
48
|
}
|
|
49
49
|
toDetailedEvaluation(vars) {
|
|
50
|
-
|
|
51
|
-
throw Error("Detailed Evaluation variable non handled");
|
|
52
|
-
return vars[this.name];
|
|
50
|
+
return vars[this.name] ?? this;
|
|
53
51
|
}
|
|
54
52
|
derivative(varName) {
|
|
55
53
|
const variable = varName ?? "x";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const numberParser: (ans: string) => string | false;
|
|
1
|
+
export declare const numberParser: (ans: string, roundTo?: number) => string | false;
|
|
2
2
|
//# sourceMappingURL=numberParser.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"numberParser.d.ts","sourceRoot":"","sources":["../../../src/tree/parsers/numberParser.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"numberParser.d.ts","sourceRoot":"","sources":["../../../src/tree/parsers/numberParser.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,YAAY,QAAS,MAAM,YAAY,MAAM,mBAKzD,CAAC"}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
import { round } from "../../math/utils/round.js";
|
|
1
2
|
//returns false if ans is NaN (even in french form) and returns the frenchified form otherwise
|
|
2
|
-
export const numberParser = (ans) => {
|
|
3
|
+
export const numberParser = (ans, roundTo) => {
|
|
3
4
|
const nb = ans.unfrenchify();
|
|
4
5
|
if (isNaN(nb))
|
|
5
6
|
return false;
|
|
7
|
+
if (roundTo !== undefined)
|
|
8
|
+
return round(nb, roundTo).frenchify();
|
|
6
9
|
return nb.frenchify();
|
|
7
10
|
};
|