math-exercises 2.2.65 → 2.2.67
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/fractionAndIntegerSum.d.ts +1 -0
- package/lib/exercises/math/calcul/fractions/fractionAndIntegerSum.d.ts.map +1 -1
- package/lib/exercises/math/calcul/fractions/fractionAndIntegerSum.js +51 -37
- package/lib/exercises/math/calcul/fractions/fractionsSum.d.ts.map +1 -1
- package/lib/exercises/math/calcul/fractions/fractionsSumsMultiplesDenominators.d.ts.map +1 -1
- package/lib/exercises/math/calcul/fractions/fractionsSumsPrimeDenominators.d.ts.map +1 -1
- package/lib/exercises/math/calcul/proportionality/findCoeffInProportionalTableNonIntegers.d.ts.map +1 -1
- package/lib/exercises/math/calcul/proportionality/findCoeffInProportionalTableNonIntegers.js +8 -3
- package/lib/exercises/math/calculLitteral/distributivity/firstIdentity.js +1 -1
- package/lib/exercises/math/calculLitteral/equation/choseOperationToSolveEquation.d.ts +1 -0
- package/lib/exercises/math/calculLitteral/equation/choseOperationToSolveEquation.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/equation/choseOperationToSolveEquation.js +122 -0
- package/lib/exercises/math/calculLitteral/equation/equationType2Exercise.d.ts +9 -3
- package/lib/exercises/math/calculLitteral/equation/equationType2Exercise.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/equationType2Exercise.js +64 -17
- package/lib/exercises/math/functions/affines/algebricExpressionOfAffine.js +1 -1
- package/lib/exercises/math/functions/trinoms/coefficientsIdentification.d.ts.map +1 -1
- package/lib/exercises/math/functions/trinoms/coefficientsIdentification.js +8 -3
- package/lib/exercises/math/geometry/cartesian/distanceBetweenTwoPoints.d.ts.map +1 -1
- package/lib/exercises/math/geometry/cartesian/distanceBetweenTwoPoints.js +3 -1
- package/lib/exercises/math/geometry/cartesian/drawAlineInGGB.d.ts.map +1 -1
- package/lib/exercises/math/geometry/cartesian/drawAlineInGGB.js +1 -2
- package/lib/exercises/math/geometry/cartesian/placeAPoint.d.ts.map +1 -1
- package/lib/exercises/math/geometry/cartesian/placeAPoint.js +1 -2
- package/lib/exercises/math/geometry/euclidianConstructions/buildMediatriceWithCompass.d.ts.map +1 -1
- package/lib/exercises/math/geometry/euclidianConstructions/buildMediatriceWithCompass.js +1 -2
- package/lib/exercises/math/geometry/vectors/drawAVectorInGGB.d.ts.map +1 -1
- package/lib/exercises/math/geometry/vectors/drawAVectorInGGB.js +1 -2
- package/lib/exercises/math/percent/applyPercent.d.ts.map +1 -1
- package/lib/exercises/math/percent/applyPercent.js +2 -4
- package/lib/exercises/math/probaStat/probabilityTree.d.ts +10 -7
- package/lib/exercises/math/probaStat/probabilityTree.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/probabilityTree.js +194 -90
- package/lib/exercises/math/spaceGeometry/vectors/spaceVectorNormCalculation.d.ts.map +1 -1
- package/lib/exercises/math/spaceGeometry/vectors/spaceVectorNormCalculation.js +7 -3
- package/lib/exercises/math/squareRoots/squareRootIdentities.d.ts.map +1 -1
- package/lib/exercises/math/squareRoots/squareRootIdentities.js +5 -1
- package/lib/exercises/math/squareRoots/squareRootsDistributivity.d.ts.map +1 -1
- package/lib/exercises/math/squareRoots/squareRootsDistributivity.js +5 -1
- package/lib/exercises/pc/calibrationCurveOfSolution.d.ts.map +1 -1
- package/lib/exercises/pc/calibrationCurveOfSolution.js +1 -2
- package/lib/exercises/vea/rationalVEA.d.ts +7 -1
- package/lib/exercises/vea/rationalVEA.d.ts.map +1 -1
- package/lib/exercises/vea/rationalVEA.js +34 -4
- package/lib/index.d.ts +24 -13
- package/lib/index.d.ts.map +1 -1
- package/lib/math/complex/complex.d.ts +1 -1
- package/lib/math/numbers/rationals/rational.d.ts +1 -1
- package/lib/math/numbers/reals/extendedRingElement.d.ts +1 -1
- package/lib/math/polynomials/generalAffine.d.ts +10 -0
- package/lib/math/polynomials/generalAffine.d.ts.map +1 -0
- package/lib/math/polynomials/generalAffine.js +32 -0
- package/lib/math/polynomials/generalTrinom.d.ts +1 -1
- package/lib/math/polynomials/trinom.d.ts +3 -3
- package/lib/playground.d.ts.map +1 -1
- package/lib/playground.js +2 -3
- package/lib/prototypesEnhancement.d.ts +3 -1
- package/lib/prototypesEnhancement.d.ts.map +1 -1
- package/lib/tree/nodes/equations/equalNode.d.ts +13 -9
- package/lib/tree/nodes/equations/equalNode.d.ts.map +1 -1
- package/lib/tree/nodes/equations/equalNode.js +17 -1
- package/lib/tree/nodes/functions/absNode.d.ts +1 -1
- package/lib/tree/nodes/inequations/inequationSolutionNode.d.ts +1 -1
- package/lib/tree/nodes/operators/addNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/addNode.js +2 -1
- package/lib/tree/nodes/operators/fractionNode.d.ts +8 -9
- package/lib/tree/nodes/operators/fractionNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/fractionNode.js +15 -0
- package/lib/tree/parsers/affineParser.d.ts +1 -2
- package/lib/tree/parsers/affineParser.d.ts.map +1 -1
- package/lib/tree/parsers/affineParser.js +22 -17
- package/lib/tree/parsers/latexParser.d.ts.map +1 -1
- package/lib/tree/parsers/latexParser.js +34 -9
- package/lib/tree/parsers/monomParser.d.ts +9 -1
- package/lib/tree/parsers/monomParser.d.ts.map +1 -1
- package/lib/tree/parsers/monomParser.js +65 -2
- package/lib/tree/parsers/powerParser.d.ts +1 -1
- package/lib/tree/parsers/purifyLatex.d.ts +9 -0
- package/lib/tree/parsers/purifyLatex.d.ts.map +1 -0
- package/lib/tree/parsers/purifyLatex.js +17 -0
- package/lib/tree/parsers/rationalParser.d.ts +1 -1
- package/lib/tree/parsers/rationalParser.d.ts.map +1 -1
- package/lib/tree/parsers/trinomParser.d.ts +2 -0
- package/lib/tree/parsers/trinomParser.d.ts.map +1 -0
- package/lib/tree/parsers/trinomParser.js +31 -0
- package/package.json +1 -1
|
@@ -1,5 +1,68 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.monomParser = void 0;
|
|
4
|
-
const
|
|
3
|
+
exports.isMonomNode = exports.monomParser = void 0;
|
|
4
|
+
const fractionNode_1 = require("../nodes/operators/fractionNode");
|
|
5
|
+
const multiplyNode_1 = require("../nodes/operators/multiplyNode");
|
|
6
|
+
const powerNode_1 = require("../nodes/operators/powerNode");
|
|
7
|
+
const variableNode_1 = require("../nodes/variables/variableNode");
|
|
8
|
+
const latexParser_1 = require("./latexParser");
|
|
9
|
+
const monomParser = (str, { variable, maxDegree, minDegree } = {
|
|
10
|
+
variable: "x",
|
|
11
|
+
maxDegree: undefined,
|
|
12
|
+
minDegree: 0,
|
|
13
|
+
}) => {
|
|
14
|
+
try {
|
|
15
|
+
const parsed = (0, latexParser_1.parseAlgebraic)(str);
|
|
16
|
+
return (0, exports.isMonomNode)(parsed, { variable, maxDegree, minDegree })
|
|
17
|
+
? parsed
|
|
18
|
+
: false;
|
|
19
|
+
if ((0, fractionNode_1.isFractionNode)(parsed)) {
|
|
20
|
+
//!unimplemented
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
else
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
catch (err) {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
};
|
|
5
30
|
exports.monomParser = monomParser;
|
|
31
|
+
const isMonomNode = (node, { variable, maxDegree, minDegree } = {
|
|
32
|
+
variable: "x",
|
|
33
|
+
maxDegree: undefined,
|
|
34
|
+
minDegree: 0,
|
|
35
|
+
}) => {
|
|
36
|
+
variable = variable ?? "x";
|
|
37
|
+
maxDegree = maxDegree ?? undefined;
|
|
38
|
+
minDegree = minDegree ?? 0;
|
|
39
|
+
if (node.isNumeric && minDegree === 0)
|
|
40
|
+
return true;
|
|
41
|
+
if ((0, variableNode_1.isVariableNode)(node) && node.name === variable && minDegree < 2)
|
|
42
|
+
return true;
|
|
43
|
+
if ((0, multiplyNode_1.isMultiplyNode)(node)) {
|
|
44
|
+
const numericChild = node.leftChild.isNumeric
|
|
45
|
+
? "left"
|
|
46
|
+
: node.rightChild.isNumeric
|
|
47
|
+
? "right"
|
|
48
|
+
: undefined;
|
|
49
|
+
if (!numericChild)
|
|
50
|
+
return false;
|
|
51
|
+
const varChild = numericChild === "left" ? node.rightChild : node.leftChild;
|
|
52
|
+
if ((0, variableNode_1.isVariableNode)(varChild) && varChild.name === "x" && minDegree < 2)
|
|
53
|
+
return true;
|
|
54
|
+
if ((0, powerNode_1.isPowerNode)(varChild) &&
|
|
55
|
+
(0, variableNode_1.isVariableNode)(varChild.leftChild) &&
|
|
56
|
+
varChild.leftChild.name === "x" &&
|
|
57
|
+
varChild.rightChild.isNumeric) {
|
|
58
|
+
const powerEv = varChild.rightChild.evaluate();
|
|
59
|
+
if (maxDegree && powerEv > maxDegree)
|
|
60
|
+
return false;
|
|
61
|
+
if (minDegree && powerEv < minDegree)
|
|
62
|
+
return false;
|
|
63
|
+
return true;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return false;
|
|
67
|
+
};
|
|
68
|
+
exports.isMonomNode = isMonomNode;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const powerParser: (ans: string) => false | import("../nodes/operators/
|
|
1
|
+
export declare const powerParser: (ans: string) => false | import("../nodes/operators/powerNode").PowerNode | import("../nodes/operators/fractionNode").FractionNode;
|
|
2
2
|
//# sourceMappingURL=powerParser.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* supprime les éléments superflus sans aucun calcul maths
|
|
3
|
+
* ex : transforme (2) en 2
|
|
4
|
+
* ex : transforme (9)/3 en 9/3 mais pas en 3
|
|
5
|
+
* doit-il transformer 1*x en x ?
|
|
6
|
+
* @param str réponse élève
|
|
7
|
+
*/
|
|
8
|
+
export declare const purifyLatex: (str: string) => void;
|
|
9
|
+
//# sourceMappingURL=purifyLatex.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"purifyLatex.d.ts","sourceRoot":"","sources":["../../../src/tree/parsers/purifyLatex.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,QAAS,MAAM,SAKtC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.purifyLatex = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* supprime les éléments superflus sans aucun calcul maths
|
|
6
|
+
* ex : transforme (2) en 2
|
|
7
|
+
* ex : transforme (9)/3 en 9/3 mais pas en 3
|
|
8
|
+
* doit-il transformer 1*x en x ?
|
|
9
|
+
* @param str réponse élève
|
|
10
|
+
*/
|
|
11
|
+
const purifyLatex = (str) => {
|
|
12
|
+
//on peut supprimer des parenthèses si :
|
|
13
|
+
//* pas suivi/précédé d'une multiplication
|
|
14
|
+
//* pas arguments d'une fonction
|
|
15
|
+
//* .. ?
|
|
16
|
+
};
|
|
17
|
+
exports.purifyLatex = purifyLatex;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { FractionNode } from "../nodes/operators/fractionNode";
|
|
2
|
-
export declare const rationalParser: (ans: string) => false | import("../nodes/
|
|
2
|
+
export declare const rationalParser: (ans: string) => false | import("../nodes/numbers/numberNode").NumberNode | import("../nodes/numbers/constantNode").ConstantNode | import("../nodes/functions/oppositeNode").OppositeNode | FractionNode | undefined;
|
|
3
3
|
//# sourceMappingURL=rationalParser.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rationalParser.d.ts","sourceRoot":"","sources":["../../../src/tree/parsers/rationalParser.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAQ,MAAM,iCAAiC,CAAC;AAGrE,eAAO,MAAM,cAAc,QAAS,MAAM
|
|
1
|
+
{"version":3,"file":"rationalParser.d.ts","sourceRoot":"","sources":["../../../src/tree/parsers/rationalParser.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAQ,MAAM,iCAAiC,CAAC;AAGrE,eAAO,MAAM,cAAc,QAAS,MAAM,wMA0BzC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trinomParser.d.ts","sourceRoot":"","sources":["../../../src/tree/parsers/trinomParser.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,YAAY,QAAS,MAAM,aAAY,MAAM,sBAyBzD,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.trinomParser = void 0;
|
|
4
|
+
const trinomParser = (ans, variable = "x") => {
|
|
5
|
+
try {
|
|
6
|
+
//! difficile !
|
|
7
|
+
//! peut etre que je fais fausse, il faut peut etre simplifier canoniquement et checker si ca ressemble à un trinome
|
|
8
|
+
//! mais ce qui m'embete dans cette approche c'est que la simplification va etre trop "gentille", on va accepter des trucs qu'on aurait pas du ...
|
|
9
|
+
// const monom = monomParser(ans, { variable, maxDegree: 2, minDegree: 2 });
|
|
10
|
+
// if (monom) return monom;
|
|
11
|
+
// const parsed = parseAlgebraic(ans);
|
|
12
|
+
// if (isAddNode(parsed) || isSubstractNode(parsed)) {
|
|
13
|
+
// const numericChild = parsed.leftChild.isNumeric
|
|
14
|
+
// ? "left"
|
|
15
|
+
// : parsed.rightChild.isNumeric
|
|
16
|
+
// ? "right"
|
|
17
|
+
// : undefined;
|
|
18
|
+
// //si numeric : alors ax^2 + b ou ax+b
|
|
19
|
+
// //sinon : ax^2 + bx + c car monom déjà exclu
|
|
20
|
+
// if (!numericChild) return false;
|
|
21
|
+
// const varChild =
|
|
22
|
+
// numericChild === "left" ? parsed.rightChild : parsed.leftChild;
|
|
23
|
+
// return isMonomNode(varChild, { variable, maxDegree: 1 }) ? parsed : false;
|
|
24
|
+
// }
|
|
25
|
+
// return false;
|
|
26
|
+
}
|
|
27
|
+
catch (err) {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
exports.trinomParser = trinomParser;
|