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.
Files changed (86) hide show
  1. package/lib/exercises/math/calcul/fractions/fractionAndIntegerSum.d.ts +1 -0
  2. package/lib/exercises/math/calcul/fractions/fractionAndIntegerSum.d.ts.map +1 -1
  3. package/lib/exercises/math/calcul/fractions/fractionAndIntegerSum.js +51 -37
  4. package/lib/exercises/math/calcul/fractions/fractionsSum.d.ts.map +1 -1
  5. package/lib/exercises/math/calcul/fractions/fractionsSumsMultiplesDenominators.d.ts.map +1 -1
  6. package/lib/exercises/math/calcul/fractions/fractionsSumsPrimeDenominators.d.ts.map +1 -1
  7. package/lib/exercises/math/calcul/proportionality/findCoeffInProportionalTableNonIntegers.d.ts.map +1 -1
  8. package/lib/exercises/math/calcul/proportionality/findCoeffInProportionalTableNonIntegers.js +8 -3
  9. package/lib/exercises/math/calculLitteral/distributivity/firstIdentity.js +1 -1
  10. package/lib/exercises/math/calculLitteral/equation/choseOperationToSolveEquation.d.ts +1 -0
  11. package/lib/exercises/math/calculLitteral/equation/choseOperationToSolveEquation.d.ts.map +1 -0
  12. package/lib/exercises/math/calculLitteral/equation/choseOperationToSolveEquation.js +122 -0
  13. package/lib/exercises/math/calculLitteral/equation/equationType2Exercise.d.ts +9 -3
  14. package/lib/exercises/math/calculLitteral/equation/equationType2Exercise.d.ts.map +1 -1
  15. package/lib/exercises/math/calculLitteral/equation/equationType2Exercise.js +64 -17
  16. package/lib/exercises/math/functions/affines/algebricExpressionOfAffine.js +1 -1
  17. package/lib/exercises/math/functions/trinoms/coefficientsIdentification.d.ts.map +1 -1
  18. package/lib/exercises/math/functions/trinoms/coefficientsIdentification.js +8 -3
  19. package/lib/exercises/math/geometry/cartesian/distanceBetweenTwoPoints.d.ts.map +1 -1
  20. package/lib/exercises/math/geometry/cartesian/distanceBetweenTwoPoints.js +3 -1
  21. package/lib/exercises/math/geometry/cartesian/drawAlineInGGB.d.ts.map +1 -1
  22. package/lib/exercises/math/geometry/cartesian/drawAlineInGGB.js +1 -2
  23. package/lib/exercises/math/geometry/cartesian/placeAPoint.d.ts.map +1 -1
  24. package/lib/exercises/math/geometry/cartesian/placeAPoint.js +1 -2
  25. package/lib/exercises/math/geometry/euclidianConstructions/buildMediatriceWithCompass.d.ts.map +1 -1
  26. package/lib/exercises/math/geometry/euclidianConstructions/buildMediatriceWithCompass.js +1 -2
  27. package/lib/exercises/math/geometry/vectors/drawAVectorInGGB.d.ts.map +1 -1
  28. package/lib/exercises/math/geometry/vectors/drawAVectorInGGB.js +1 -2
  29. package/lib/exercises/math/percent/applyPercent.d.ts.map +1 -1
  30. package/lib/exercises/math/percent/applyPercent.js +2 -4
  31. package/lib/exercises/math/probaStat/probabilityTree.d.ts +10 -7
  32. package/lib/exercises/math/probaStat/probabilityTree.d.ts.map +1 -1
  33. package/lib/exercises/math/probaStat/probabilityTree.js +194 -90
  34. package/lib/exercises/math/spaceGeometry/vectors/spaceVectorNormCalculation.d.ts.map +1 -1
  35. package/lib/exercises/math/spaceGeometry/vectors/spaceVectorNormCalculation.js +7 -3
  36. package/lib/exercises/math/squareRoots/squareRootIdentities.d.ts.map +1 -1
  37. package/lib/exercises/math/squareRoots/squareRootIdentities.js +5 -1
  38. package/lib/exercises/math/squareRoots/squareRootsDistributivity.d.ts.map +1 -1
  39. package/lib/exercises/math/squareRoots/squareRootsDistributivity.js +5 -1
  40. package/lib/exercises/pc/calibrationCurveOfSolution.d.ts.map +1 -1
  41. package/lib/exercises/pc/calibrationCurveOfSolution.js +1 -2
  42. package/lib/exercises/vea/rationalVEA.d.ts +7 -1
  43. package/lib/exercises/vea/rationalVEA.d.ts.map +1 -1
  44. package/lib/exercises/vea/rationalVEA.js +34 -4
  45. package/lib/index.d.ts +24 -13
  46. package/lib/index.d.ts.map +1 -1
  47. package/lib/math/complex/complex.d.ts +1 -1
  48. package/lib/math/numbers/rationals/rational.d.ts +1 -1
  49. package/lib/math/numbers/reals/extendedRingElement.d.ts +1 -1
  50. package/lib/math/polynomials/generalAffine.d.ts +10 -0
  51. package/lib/math/polynomials/generalAffine.d.ts.map +1 -0
  52. package/lib/math/polynomials/generalAffine.js +32 -0
  53. package/lib/math/polynomials/generalTrinom.d.ts +1 -1
  54. package/lib/math/polynomials/trinom.d.ts +3 -3
  55. package/lib/playground.d.ts.map +1 -1
  56. package/lib/playground.js +2 -3
  57. package/lib/prototypesEnhancement.d.ts +3 -1
  58. package/lib/prototypesEnhancement.d.ts.map +1 -1
  59. package/lib/tree/nodes/equations/equalNode.d.ts +13 -9
  60. package/lib/tree/nodes/equations/equalNode.d.ts.map +1 -1
  61. package/lib/tree/nodes/equations/equalNode.js +17 -1
  62. package/lib/tree/nodes/functions/absNode.d.ts +1 -1
  63. package/lib/tree/nodes/inequations/inequationSolutionNode.d.ts +1 -1
  64. package/lib/tree/nodes/operators/addNode.d.ts.map +1 -1
  65. package/lib/tree/nodes/operators/addNode.js +2 -1
  66. package/lib/tree/nodes/operators/fractionNode.d.ts +8 -9
  67. package/lib/tree/nodes/operators/fractionNode.d.ts.map +1 -1
  68. package/lib/tree/nodes/operators/fractionNode.js +15 -0
  69. package/lib/tree/parsers/affineParser.d.ts +1 -2
  70. package/lib/tree/parsers/affineParser.d.ts.map +1 -1
  71. package/lib/tree/parsers/affineParser.js +22 -17
  72. package/lib/tree/parsers/latexParser.d.ts.map +1 -1
  73. package/lib/tree/parsers/latexParser.js +34 -9
  74. package/lib/tree/parsers/monomParser.d.ts +9 -1
  75. package/lib/tree/parsers/monomParser.d.ts.map +1 -1
  76. package/lib/tree/parsers/monomParser.js +65 -2
  77. package/lib/tree/parsers/powerParser.d.ts +1 -1
  78. package/lib/tree/parsers/purifyLatex.d.ts +9 -0
  79. package/lib/tree/parsers/purifyLatex.d.ts.map +1 -0
  80. package/lib/tree/parsers/purifyLatex.js +17 -0
  81. package/lib/tree/parsers/rationalParser.d.ts +1 -1
  82. package/lib/tree/parsers/rationalParser.d.ts.map +1 -1
  83. package/lib/tree/parsers/trinomParser.d.ts +2 -0
  84. package/lib/tree/parsers/trinomParser.d.ts.map +1 -0
  85. package/lib/tree/parsers/trinomParser.js +31 -0
  86. 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 monomParser = (str) => { };
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/fractionNode").FractionNode | import("../nodes/operators/powerNode").PowerNode;
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/algebraicNode").AlgebraicNode | FractionNode | import("../nodes/functions/oppositeNode").OppositeNode | undefined;
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,+IA0BzC,CAAC"}
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,2 @@
1
+ export declare const trinomParser: (ans: string, variable?: string) => false | undefined;
2
+ //# sourceMappingURL=trinomParser.d.ts.map
@@ -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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "math-exercises",
3
- "version": "2.2.65",
3
+ "version": "2.2.67",
4
4
  "description": "Math exercises generator for middle school and high school",
5
5
  "main": "lib/index.js",
6
6
  "files": [