math-exercises 3.0.217 → 3.0.218

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 (180) hide show
  1. package/lib/exercises/math/calcul/arithmetics/commonDivisorsList.d.ts.map +1 -1
  2. package/lib/exercises/math/calcul/arithmetics/commonDivisorsList.js +1 -0
  3. package/lib/exercises/math/calcul/fractions/fractionAndIntegerDivision.d.ts.map +1 -1
  4. package/lib/exercises/math/calcul/fractions/fractionAndIntegerDivision.js +5 -8
  5. package/lib/exercises/math/calcul/fractions/fractionAndIntegerProduct.d.ts.map +1 -1
  6. package/lib/exercises/math/calcul/fractions/fractionAndIntegerProduct.js +7 -17
  7. package/lib/exercises/math/calcul/fractions/fractionForbiddenValue.d.ts.map +1 -1
  8. package/lib/exercises/math/calcul/fractions/fractionForbiddenValue.js +5 -6
  9. package/lib/exercises/math/calcul/fractions/fractionsDivision.d.ts.map +1 -1
  10. package/lib/exercises/math/calcul/fractions/fractionsDivision.js +7 -17
  11. package/lib/exercises/math/calcul/fractions/fractionsSum.d.ts.map +1 -1
  12. package/lib/exercises/math/calcul/fractions/fractionsSum.js +7 -22
  13. package/lib/exercises/math/calcul/fractions/fractionsSumFillInTheBlank.d.ts.map +1 -1
  14. package/lib/exercises/math/calcul/fractions/fractionsSumFillInTheBlank.js +7 -19
  15. package/lib/exercises/math/calcul/fractions/fractionsSumsMultiplesDenominators.d.ts.map +1 -1
  16. package/lib/exercises/math/calcul/fractions/fractionsSumsMultiplesDenominators.js +7 -22
  17. package/lib/exercises/math/calcul/fractions/fractionsSumsPrimeDenominators.d.ts.map +1 -1
  18. package/lib/exercises/math/calcul/fractions/fractionsSumsPrimeDenominators.js +7 -22
  19. package/lib/exercises/math/calcul/fractions/fractionsSumsSameDenominators.d.ts +4 -1
  20. package/lib/exercises/math/calcul/fractions/fractionsSumsSameDenominators.d.ts.map +1 -1
  21. package/lib/exercises/math/calcul/fractions/fractionsSumsSameDenominators.js +7 -23
  22. package/lib/exercises/math/calcul/fractions/periodicWritingToFraction.d.ts.map +1 -1
  23. package/lib/exercises/math/calcul/fractions/periodicWritingToFraction.js +3 -7
  24. package/lib/exercises/math/calcul/fractions/simplifyFraction.d.ts.map +1 -1
  25. package/lib/exercises/math/calcul/fractions/simplifyFraction.js +6 -7
  26. package/lib/exercises/math/calcul/mentalCaluls/mentalDivisions.d.ts.map +1 -1
  27. package/lib/exercises/math/calcul/mentalCaluls/mentalDivisions.js +3 -4
  28. package/lib/exercises/math/calcul/mentalCaluls/mentalMultiplication101AndFriends.d.ts.map +1 -1
  29. package/lib/exercises/math/calcul/mentalCaluls/mentalMultiplication101AndFriends.js +2 -4
  30. package/lib/exercises/math/calcul/mentalCaluls/mentalMultiplication11AndFriends.d.ts.map +1 -1
  31. package/lib/exercises/math/calcul/mentalCaluls/mentalMultiplication11AndFriends.js +2 -4
  32. package/lib/exercises/math/calcul/mentalCaluls/mentalMultiplicationTable.d.ts.map +1 -1
  33. package/lib/exercises/math/calcul/mentalCaluls/mentalMultiplicationTable.js +2 -4
  34. package/lib/exercises/math/calcul/mentalCaluls/mentalMultiplications.d.ts.map +1 -1
  35. package/lib/exercises/math/calcul/mentalCaluls/mentalMultiplications.js +2 -4
  36. package/lib/exercises/math/calcul/operations/operationsPrioritiesWithoutRelative.d.ts.map +1 -1
  37. package/lib/exercises/math/calcul/operations/operationsPrioritiesWithoutRelative.js +3 -4
  38. package/lib/exercises/math/calculLitteral/distributivity/doubleDistributivityAdd.d.ts.map +1 -1
  39. package/lib/exercises/math/calculLitteral/distributivity/doubleDistributivityAdd.js +14 -3
  40. package/lib/exercises/math/calculLitteral/distributivity/doubleDistributivitySubstract.d.ts.map +1 -1
  41. package/lib/exercises/math/calculLitteral/distributivity/doubleDistributivitySubstract.js +14 -3
  42. package/lib/exercises/math/calculLitteral/distributivity/doubleDistributivityWithCoeff.d.ts.map +1 -1
  43. package/lib/exercises/math/calculLitteral/distributivity/doubleDistributivityWithCoeff.js +8 -5
  44. package/lib/exercises/math/calculLitteral/distributivity/simpleDistriXCoeff.d.ts.map +1 -1
  45. package/lib/exercises/math/calculLitteral/distributivity/simpleDistriXCoeff.js +14 -5
  46. package/lib/exercises/math/calculLitteral/equation/fractionEquation.d.ts.map +1 -1
  47. package/lib/exercises/math/calculLitteral/equation/fractionEquation.js +10 -10
  48. package/lib/exercises/math/calculLitteral/factorisation/factoByXK.d.ts +0 -8
  49. package/lib/exercises/math/calculLitteral/factorisation/factoByXK.d.ts.map +1 -1
  50. package/lib/exercises/math/calculLitteral/factorisation/factoByXK.js +223 -190
  51. package/lib/exercises/math/calculLitteral/factorisation/factorizeCanonicalFormWithSqrt.d.ts.map +1 -1
  52. package/lib/exercises/math/calculLitteral/factorisation/factorizeCanonicalFormWithSqrt.js +22 -9
  53. package/lib/exercises/math/calculLitteral/factorisation/index.d.ts +0 -1
  54. package/lib/exercises/math/calculLitteral/factorisation/index.d.ts.map +1 -1
  55. package/lib/exercises/math/calculLitteral/factorisation/index.js +1 -1
  56. package/lib/exercises/math/complex/argumentFromAlgebraicComplex.d.ts.map +1 -1
  57. package/lib/exercises/math/complex/argumentFromAlgebraicComplex.js +10 -4
  58. package/lib/exercises/math/functions/absolute/absoluteValueEquations.js +12 -12
  59. package/lib/exercises/math/functions/affines/adjustment/affineAdjustmentRsquared.d.ts.map +1 -1
  60. package/lib/exercises/math/functions/affines/adjustment/affineAdjustmentRsquared.js +10 -18
  61. package/lib/exercises/math/functions/affines/affineMeanValue.d.ts.map +1 -1
  62. package/lib/exercises/math/functions/affines/affineMeanValue.js +3 -5
  63. package/lib/exercises/math/functions/basics/findZeroesProductQuotient.d.ts.map +1 -1
  64. package/lib/exercises/math/functions/basics/findZeroesProductQuotient.js +0 -1
  65. package/lib/exercises/math/functions/basics/twoFunctionsEquation.d.ts.map +1 -1
  66. package/lib/exercises/math/functions/basics/twoFunctionsEquation.js +12 -7
  67. package/lib/exercises/math/functions/integral/integralExpAxPlusB.d.ts.map +1 -1
  68. package/lib/exercises/math/functions/integral/integralExpAxPlusB.js +19 -3
  69. package/lib/exercises/math/functions/logarithm/log10Simplifying.d.ts.map +1 -1
  70. package/lib/exercises/math/functions/logarithm/log10Simplifying.js +20 -6
  71. package/lib/exercises/math/functions/logarithm/logSimplifiying.d.ts.map +1 -1
  72. package/lib/exercises/math/functions/logarithm/logSimplifiying.js +14 -9
  73. package/lib/exercises/math/functions/rationalFraction/rationalFractionForbiddenValue.d.ts.map +1 -1
  74. package/lib/exercises/math/functions/rationalFraction/rationalFractionForbiddenValue.js +9 -6
  75. package/lib/exercises/math/functions/trinoms/equation/solveSecondDegreeEquationFromCano.d.ts.map +1 -1
  76. package/lib/exercises/math/functions/trinoms/equation/solveSecondDegreeEquationFromCano.js +12 -8
  77. package/lib/exercises/math/functions/trinoms/summitAndCanonical/canonicalFromDevForm.d.ts.map +1 -1
  78. package/lib/exercises/math/functions/trinoms/summitAndCanonical/canonicalFromDevForm.js +21 -4
  79. package/lib/exercises/math/functions/trinoms/summitAndCanonical/extremumFromCanonicalForm.d.ts.map +1 -1
  80. package/lib/exercises/math/functions/trinoms/summitAndCanonical/extremumFromCanonicalForm.js +4 -7
  81. package/lib/exercises/math/functions/trinoms/trinomialMeanValue.d.ts.map +1 -1
  82. package/lib/exercises/math/functions/trinoms/trinomialMeanValue.js +3 -5
  83. package/lib/exercises/math/geometry/areas/circleArea.d.ts.map +1 -1
  84. package/lib/exercises/math/geometry/areas/circleArea.js +4 -2
  85. package/lib/exercises/math/geometry/areas/rectangleArea.d.ts.map +1 -1
  86. package/lib/exercises/math/geometry/areas/rectangleArea.js +4 -2
  87. package/lib/exercises/math/geometry/areas/rightTriangleArea.d.ts.map +1 -1
  88. package/lib/exercises/math/geometry/areas/rightTriangleArea.js +14 -11
  89. package/lib/exercises/math/geometry/areas/squareArea.d.ts.map +1 -1
  90. package/lib/exercises/math/geometry/areas/squareArea.js +4 -2
  91. package/lib/exercises/math/geometry/areas/squareSideFromArea.d.ts.map +1 -1
  92. package/lib/exercises/math/geometry/areas/squareSideFromArea.js +6 -4
  93. package/lib/exercises/math/geometry/areas/triangleArea.d.ts.map +1 -1
  94. package/lib/exercises/math/geometry/areas/triangleArea.js +3 -1
  95. package/lib/exercises/math/geometry/areas/triangleAreaV2.d.ts.map +1 -1
  96. package/lib/exercises/math/geometry/areas/triangleAreaV2.js +4 -2
  97. package/lib/exercises/math/geometry/cartesian/midpoint.d.ts.map +1 -1
  98. package/lib/exercises/math/geometry/cartesian/midpoint.js +6 -11
  99. package/lib/exercises/math/geometry/perimeters/rectangleSideFromPerimeter.d.ts.map +1 -1
  100. package/lib/exercises/math/geometry/perimeters/rectangleSideFromPerimeter.js +3 -3
  101. package/lib/exercises/math/geometry/perimeters/squareSideFromPerimeter.d.ts.map +1 -1
  102. package/lib/exercises/math/geometry/perimeters/squareSideFromPerimeter.js +3 -3
  103. package/lib/exercises/math/geometry/vectors/vectorNormCalculation.d.ts.map +1 -1
  104. package/lib/exercises/math/geometry/vectors/vectorNormCalculation.js +3 -5
  105. package/lib/exercises/math/geometry/volumes/parallelepipedVolume.d.ts.map +1 -1
  106. package/lib/exercises/math/geometry/volumes/parallelepipedVolume.js +3 -4
  107. package/lib/exercises/math/geometry/volumes/sphereVolume.d.ts.map +1 -1
  108. package/lib/exercises/math/geometry/volumes/sphereVolume.js +3 -4
  109. package/lib/exercises/math/geometry/volumes/volumeOfCube.d.ts.map +1 -1
  110. package/lib/exercises/math/geometry/volumes/volumeOfCube.js +3 -4
  111. package/lib/exercises/math/geometry/volumes/volumeOfPyramidWithTriangleBase.d.ts.map +1 -1
  112. package/lib/exercises/math/geometry/volumes/volumeOfPyramidWithTriangleBase.js +3 -6
  113. package/lib/exercises/math/geometry/volumes/volumeOfPyramidWithTriangleRectBase.d.ts.map +1 -1
  114. package/lib/exercises/math/geometry/volumes/volumeOfPyramidWithTriangleRectBase.js +3 -6
  115. package/lib/exercises/math/graphs/graphsChainOrPathOfLengthN.d.ts.map +1 -1
  116. package/lib/exercises/math/graphs/graphsChainOrPathOfLengthN.js +3 -1
  117. package/lib/exercises/math/graphs/graphsCheckIsConnectedGraph.d.ts.map +1 -1
  118. package/lib/exercises/math/graphs/graphsCheckIsConnectedGraph.js +19 -42
  119. package/lib/exercises/math/graphs/graphsCheckIsSameGraph.d.ts +0 -2
  120. package/lib/exercises/math/graphs/graphsCheckIsSameGraph.d.ts.map +1 -1
  121. package/lib/exercises/math/graphs/graphsCheckIsSameGraph.js +4 -14
  122. package/lib/exercises/math/graphs/graphsCheckIsVerticesAdjacent.d.ts.map +1 -1
  123. package/lib/exercises/math/graphs/graphsCheckIsVerticesAdjacent.js +3 -1
  124. package/lib/exercises/math/graphs/graphsDegreeOfVertex.d.ts.map +1 -1
  125. package/lib/exercises/math/graphs/graphsDegreeOfVertex.js +3 -1
  126. package/lib/exercises/math/graphs/graphsOrderOfGraph.d.ts.map +1 -1
  127. package/lib/exercises/math/graphs/graphsOrderOfGraph.js +3 -1
  128. package/lib/exercises/math/limits/rationalFracLimit.d.ts.map +1 -1
  129. package/lib/exercises/math/limits/rationalFracLimit.js +9 -20
  130. package/lib/exercises/math/limits/sequences/sequenceRationalFracLimit.d.ts.map +1 -1
  131. package/lib/exercises/math/limits/sequences/sequenceRationalFracLimit.js +9 -20
  132. package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormula.d.ts.map +1 -1
  133. package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormula.js +11 -28
  134. package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFirstRankOne.d.ts.map +1 -1
  135. package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFirstRankOne.js +12 -27
  136. package/lib/exercises/math/spaceGeometry/vectors/spaceVectorNormCalculation.d.ts.map +1 -1
  137. package/lib/exercises/math/spaceGeometry/vectors/spaceVectorNormCalculation.js +3 -5
  138. package/lib/exercises/math/squareRoots/simpifySquareRoot.d.ts.map +1 -1
  139. package/lib/exercises/math/squareRoots/simpifySquareRoot.js +5 -4
  140. package/lib/exercises/math/squareRoots/squareRootEquation.d.ts.map +1 -1
  141. package/lib/exercises/math/squareRoots/squareRootEquation.js +9 -8
  142. package/lib/exercises/math/squareRoots/squareRootIdentities.d.ts.map +1 -1
  143. package/lib/exercises/math/squareRoots/squareRootIdentities.js +7 -4
  144. package/lib/exercises/math/squareRoots/squareRootsDistributivity.d.ts.map +1 -1
  145. package/lib/exercises/math/squareRoots/squareRootsDistributivity.js +7 -8
  146. package/lib/exercises/math/trigonometry/arcLength.d.ts.map +1 -1
  147. package/lib/exercises/math/trigonometry/arcLength.js +3 -8
  148. package/lib/exercises/pc/chemicalElements/findAtomEntitiesNumberFromMass.d.ts.map +1 -1
  149. package/lib/exercises/pc/chemicalElements/findAtomEntitiesNumberFromMass.js +0 -6
  150. package/lib/exercises/pc/dosage/beerLambertRandomValue.d.ts.map +1 -1
  151. package/lib/exercises/pc/dosage/beerLambertRandomValue.js +3 -4
  152. package/lib/exercises/pc/dosage/concentrationFromMassCalculation.d.ts.map +1 -1
  153. package/lib/exercises/pc/dosage/concentrationFromMassCalculation.js +3 -18
  154. package/lib/exercises/pc/energy/energyTransfer.d.ts.map +1 -1
  155. package/lib/exercises/pc/energy/energyTransfer.js +3 -8
  156. package/lib/exercises/pc/energy/thermalEnergyTransferCalculation.d.ts.map +1 -1
  157. package/lib/exercises/pc/energy/thermalEnergyTransferCalculation.js +3 -24
  158. package/lib/exercises/pc/math/proportionnalityCoeffFromLine.d.ts.map +1 -1
  159. package/lib/exercises/pc/math/proportionnalityCoeffFromLine.js +9 -6
  160. package/lib/exercises/vea/equationVEA.d.ts.map +1 -1
  161. package/lib/exercises/vea/equationVEA.js +2 -0
  162. package/lib/exercises/vea/rationalVEA.d.ts +2 -1
  163. package/lib/exercises/vea/rationalVEA.d.ts.map +1 -1
  164. package/lib/exercises/vea/rationalVEA.js +36 -2
  165. package/lib/index.d.ts +3 -8
  166. package/lib/index.d.ts.map +1 -1
  167. package/lib/math/utils/graphs/graphRenderer.d.ts +7 -9
  168. package/lib/math/utils/graphs/graphRenderer.d.ts.map +1 -1
  169. package/lib/math/utils/graphs/graphRenderer.js +25 -117
  170. package/lib/tree/nodes/algebraicNode.d.ts +2 -0
  171. package/lib/tree/nodes/algebraicNode.d.ts.map +1 -1
  172. package/lib/tree/nodes/algebraicNode.js +11 -0
  173. package/lib/tree/nodes/functions/log10Node.d.ts +2 -2
  174. package/lib/tree/nodes/functions/log10Node.d.ts.map +1 -1
  175. package/lib/tree/nodes/functions/log10Node.js +3 -1
  176. package/lib/tree/nodes/functions/logNode.d.ts.map +1 -1
  177. package/lib/tree/nodes/functions/logNode.js +2 -0
  178. package/lib/tree/nodes/operators/addNode.js +1 -1
  179. package/lib/tree/nodes/operators/fractionNode.js +1 -1
  180. package/package.json +1 -7
@@ -1,7 +1,7 @@
1
1
  import { GeneratorOptionTarget, GeneratorOptionType, addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
2
2
  import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
3
  import { defaultArrayedOptsWhereNeeded } from "../../../../exercises/utils/options/arrayedOptions.js";
4
- import { NumberNode } from "../../../../tree/nodes/numbers/numberNode.js";
4
+ import { numberVEA } from "../../../../exercises/vea/numberVEA.js";
5
5
  import { MultiplyNode } from "../../../../tree/nodes/operators/multiplyNode.js";
6
6
  import { operatorComposition } from "../../../../tree/utilities/operatorComposition.js";
7
7
  import { random } from "../../../../utils/alea/random.js";
@@ -74,9 +74,7 @@ const getPropositions = (n, { answer, ...identifiers }) => {
74
74
  return shuffleProps(propositions, n);
75
75
  };
76
76
  const isAnswerValid = (studentAns, { answer }) => {
77
- const answerTree = new NumberNode(Number(answer.replace(",", ".")));
78
- const texs = answerTree.toAllValidTexs();
79
- return texs.includes(studentAns);
77
+ return numberVEA(studentAns, answer);
80
78
  };
81
79
  const getMentalMultiplicationTableQuestion = (optsIn) => {
82
80
  const arrayedOptions = defaultArrayedOptsWhereNeeded(optsIn, arrayedOptsDefault);
@@ -1 +1 @@
1
- {"version":3,"file":"mentalMultiplications.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/mentalCaluls/mentalMultiplications.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAWrC,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AA8GF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,WAAW,CAevD,CAAC"}
1
+ {"version":3,"file":"mentalMultiplications.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/mentalCaluls/mentalMultiplications.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAWrC,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AA4GF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,WAAW,CAevD,CAAC"}
@@ -1,8 +1,8 @@
1
1
  import { addValidProp, propWhile, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
2
2
  import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { numberVEA } from "../../../../exercises/vea/numberVEA.js";
3
4
  import { randint } from "../../../../math/utils/random/randint.js";
4
5
  import { round } from "../../../../math/utils/round.js";
5
- import { NumberNode } from "../../../../tree/nodes/numbers/numberNode.js";
6
6
  import { MultiplyNode } from "../../../../tree/nodes/operators/multiplyNode.js";
7
7
  import { NodeSimplifier } from "../../../../tree/utilities/nodeSimplifier.js";
8
8
  import { operatorComposition } from "../../../../tree/utilities/operatorComposition.js";
@@ -55,9 +55,7 @@ const getPropositions = (n, { answer }) => {
55
55
  return shuffle(propositions);
56
56
  };
57
57
  const isAnswerValid = (studentAns, { answer }) => {
58
- const answerTree = new NumberNode(Number(answer.replace(",", ".")));
59
- const texs = answerTree.toAllValidTexs();
60
- return texs.includes(studentAns);
58
+ return numberVEA(studentAns, answer);
61
59
  };
62
60
  const getMentalMultiplications = () => {
63
61
  let numbers = [];
@@ -1 +1 @@
1
- {"version":3,"file":"operationsPrioritiesWithoutRelative.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/operations/operationsPrioritiesWithoutRelative.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAgVF,eAAO,MAAM,mCAAmC,EAAE,QAAQ,CAAC,WAAW,CAarE,CAAC"}
1
+ {"version":3,"file":"operationsPrioritiesWithoutRelative.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/operations/operationsPrioritiesWithoutRelative.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAWrC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AA8UF,eAAO,MAAM,mCAAmC,EAAE,QAAQ,CAAC,WAAW,CAarE,CAAC"}
@@ -7,6 +7,7 @@
7
7
  */
8
8
  import { addValidProp, propWhile, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
9
9
  import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
10
+ import { numberVEA } from "../../../../exercises/vea/numberVEA.js";
10
11
  import { randint } from "../../../../math/utils/random/randint.js";
11
12
  import { NumberNode } from "../../../../tree/nodes/numbers/numberNode.js";
12
13
  import { AddNode } from "../../../../tree/nodes/operators/addNode.js";
@@ -249,10 +250,8 @@ const getPropositions = (n, { answer }) => {
249
250
  });
250
251
  return shuffle(propositions);
251
252
  };
252
- const isAnswerValid = (studentAns, { answer }) => {
253
- const answerTree = new NumberNode(Number(answer));
254
- const texs = answerTree.toAllValidTexs();
255
- return texs.includes(studentAns);
253
+ const isAnswerValid = (ans, { answer }) => {
254
+ return numberVEA(ans, answer);
256
255
  };
257
256
  export const operationsPrioritiesWithoutRelative = {
258
257
  id: "operationsPrioritiesWithoutRelative",
@@ -1 +1 @@
1
- {"version":3,"file":"doubleDistributivityAdd.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/distributivity/doubleDistributivityAdd.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAgBT,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAGL,wBAAwB,EACzB,MAAM,yCAAyC,CAAC;AASjD,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IAEb,OAAO,EAAE,wBAAwB,CAAC;IAClC,OAAO,EAAE,wBAAwB,CAAC;IAElC,OAAO,EAAE,wBAAwB,CAAC;IAElC,OAAO,CAAC,EAAE,wBAAwB,CAAC;CACpC,CAAC;AAoLF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,WAAW,CAczD,CAAC"}
1
+ {"version":3,"file":"doubleDistributivityAdd.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/distributivity/doubleDistributivityAdd.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAgBT,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAGL,wBAAwB,EACzB,MAAM,yCAAyC,CAAC;AAWjD,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IAEb,OAAO,EAAE,wBAAwB,CAAC;IAClC,OAAO,EAAE,wBAAwB,CAAC;IAElC,OAAO,EAAE,wBAAwB,CAAC;IAElC,OAAO,CAAC,EAAE,wBAAwB,CAAC;CACpC,CAAC;AA6LF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,WAAW,CAczD,CAAC"}
@@ -7,6 +7,8 @@ import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
7
7
  import { square } from "../../../../tree/nodes/operators/powerNode.js";
8
8
  import { substract } from "../../../../tree/nodes/operators/substractNode.js";
9
9
  import { TrinomNodeConstructor } from "../../../../tree/nodes/polynomials/trinomNode.js";
10
+ import { polynomialParser } from "../../../../tree/parsers/polynomialParser.js";
11
+ import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
10
12
  import { alignTex } from "../../../../utils/latex/alignTex.js";
11
13
  //(ax+b)(cx+d)+ex(gx+h)
12
14
  //(ax+b)(cx+d)+(ex+f)(gx+h)
@@ -122,9 +124,18 @@ ${alignTex([
122
124
  const getKeys = () => {
123
125
  return ["x"];
124
126
  };
125
- const isAnswerValid = (ans, { answer, ...identifiers }) => {
126
- const texs = getAnswerNode(identifiers).toAllValidTexs({});
127
- return texs.includes(ans);
127
+ const isAnswerValid = (ans, { answer }) => {
128
+ try {
129
+ const parsed = polynomialParser(ans);
130
+ if (!parsed)
131
+ return false;
132
+ return (parsed
133
+ .simplify({ towardsDistribute: true, forbidFactorize: true })
134
+ .toTex() === answer);
135
+ }
136
+ catch (err) {
137
+ return handleVEAError(err);
138
+ }
128
139
  };
129
140
  const getDoubleDistributivityAddQuestion = () => {
130
141
  const type = randint(1, 4);
@@ -1 +1 @@
1
- {"version":3,"file":"doubleDistributivitySubstract.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/distributivity/doubleDistributivitySubstract.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAgBT,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAGL,wBAAwB,EACzB,MAAM,yCAAyC,CAAC;AASjD,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IAEb,OAAO,EAAE,wBAAwB,CAAC;IAClC,OAAO,EAAE,wBAAwB,CAAC;IAElC,OAAO,EAAE,wBAAwB,CAAC;IAElC,OAAO,CAAC,EAAE,wBAAwB,CAAC;CACpC,CAAC;AAoLF,eAAO,MAAM,6BAA6B,EAAE,QAAQ,CAAC,WAAW,CAiB/D,CAAC"}
1
+ {"version":3,"file":"doubleDistributivitySubstract.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/distributivity/doubleDistributivitySubstract.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAgBT,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAGL,wBAAwB,EACzB,MAAM,yCAAyC,CAAC;AAWjD,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IAEb,OAAO,EAAE,wBAAwB,CAAC;IAClC,OAAO,EAAE,wBAAwB,CAAC;IAElC,OAAO,EAAE,wBAAwB,CAAC;IAElC,OAAO,CAAC,EAAE,wBAAwB,CAAC;CACpC,CAAC;AA6LF,eAAO,MAAM,6BAA6B,EAAE,QAAQ,CAAC,WAAW,CAiB/D,CAAC"}
@@ -7,6 +7,8 @@ import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
7
7
  import { square } from "../../../../tree/nodes/operators/powerNode.js";
8
8
  import { substract } from "../../../../tree/nodes/operators/substractNode.js";
9
9
  import { TrinomNodeConstructor } from "../../../../tree/nodes/polynomials/trinomNode.js";
10
+ import { polynomialParser } from "../../../../tree/parsers/polynomialParser.js";
11
+ import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
10
12
  import { alignTex } from "../../../../utils/latex/alignTex.js";
11
13
  //(ax+b)(cx+d)-ex(gx+h)
12
14
  //(ax+b)(cx+d)-(ex+f)(gx+h)
@@ -122,9 +124,18 @@ ${alignTex([
122
124
  const getKeys = () => {
123
125
  return ["x"];
124
126
  };
125
- const isAnswerValid = (ans, { answer, ...identifiers }) => {
126
- const texs = getAnswerNode(identifiers).toAllValidTexs({});
127
- return texs.includes(ans);
127
+ const isAnswerValid = (ans, { answer }) => {
128
+ try {
129
+ const parsed = polynomialParser(ans);
130
+ if (!parsed)
131
+ return false;
132
+ return (parsed
133
+ .simplify({ towardsDistribute: true, forbidFactorize: true })
134
+ .toTex() === answer);
135
+ }
136
+ catch (err) {
137
+ return handleVEAError(err);
138
+ }
128
139
  };
129
140
  const getDoubleDistributivitySubstractQuestion = () => {
130
141
  const type = randint(1, 4);
@@ -1 +1 @@
1
- {"version":3,"file":"doubleDistributivityWithCoeff.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/distributivity/doubleDistributivityWithCoeff.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AASrC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AA4IF,eAAO,MAAM,6BAA6B,EAAE,QAAQ,CAAC,WAAW,CAc/D,CAAC"}
1
+ {"version":3,"file":"doubleDistributivityWithCoeff.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/distributivity/doubleDistributivityWithCoeff.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AA+IF,eAAO,MAAM,6BAA6B,EAAE,QAAQ,CAAC,WAAW,CAc/D,CAAC"}
@@ -5,6 +5,7 @@ import { TrinomConstructor } from "../../../../math/polynomials/trinom.js";
5
5
  import { randint } from "../../../../math/utils/random/randint.js";
6
6
  import { AddNode } from "../../../../tree/nodes/operators/addNode.js";
7
7
  import { MultiplyNode } from "../../../../tree/nodes/operators/multiplyNode.js";
8
+ import { polynomialParser } from "../../../../tree/parsers/polynomialParser.js";
8
9
  import { alignTex } from "../../../../utils/latex/alignTex.js";
9
10
  const getHint = () => {
10
11
  return `Choisis deux facteurs de ce produit et multiplie les entre eux. Puis multiplie le résultat obtenu par le troisième terme.`;
@@ -83,11 +84,13 @@ const getPropositions = (n, { answer }) => {
83
84
  });
84
85
  return shuffleProps(propositions, n);
85
86
  };
86
- const isAnswerValid = (ans, { affine1, affine2, coeff }) => {
87
- const affine1Obj = AffineConstructor.fromCoeffs(affine1);
88
- const affine2Obj = AffineConstructor.fromCoeffs(affine2);
89
- const answerTree = affine1Obj.times(coeff).multiply(affine2Obj).toTree();
90
- return answerTree.toAllValidTexs().includes(ans);
87
+ const isAnswerValid = (ans, { answer }) => {
88
+ const parsed = polynomialParser(ans);
89
+ if (!parsed)
90
+ return false;
91
+ return (parsed
92
+ .simplify({ towardsDistribute: true, forbidFactorize: true })
93
+ .toTex() === answer);
91
94
  };
92
95
  export const doubleDistributivityWithCoeff = {
93
96
  id: "doubleDistributivityWithCoeff",
@@ -1 +1 @@
1
- {"version":3,"file":"simpleDistriXCoeff.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/distributivity/simpleDistriXCoeff.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAgBT,MAAM,6BAA6B,CAAC;AAWrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAiHF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,CAepD,CAAC"}
1
+ {"version":3,"file":"simpleDistriXCoeff.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/distributivity/simpleDistriXCoeff.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAgBT,MAAM,6BAA6B,CAAC;AAarC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAwHF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,CAepD,CAAC"}
@@ -6,6 +6,8 @@ import { randint } from "../../../../math/utils/random/randint.js";
6
6
  import { NumberNode } from "../../../../tree/nodes/numbers/numberNode.js";
7
7
  import { AddNode } from "../../../../tree/nodes/operators/addNode.js";
8
8
  import { MultiplyNode } from "../../../../tree/nodes/operators/multiplyNode.js";
9
+ import { polynomialParser } from "../../../../tree/parsers/polynomialParser.js";
10
+ import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
9
11
  import { alignTex } from "../../../../utils/latex/alignTex.js";
10
12
  const getPropositions = (n, { answer, a, b, c }) => {
11
13
  const propositions = [];
@@ -68,11 +70,18 @@ const getCorrection = (identifiers) => {
68
70
  const getKeys = () => {
69
71
  return ["x"];
70
72
  };
71
- const isAnswerValid = (ans, { a, b, c }) => {
72
- const affine = new Affine(a, 0);
73
- const affine2 = new Affine(b, c);
74
- const ansTree = affine.multiply(affine2).toTree();
75
- return ansTree.toAllValidTexs().includes(ans);
73
+ const isAnswerValid = (ans, { answer }) => {
74
+ try {
75
+ const parsed = polynomialParser(ans);
76
+ if (!parsed)
77
+ return false;
78
+ return (parsed
79
+ .simplify({ towardsDistribute: true, forbidFactorize: true })
80
+ .toTex() === answer);
81
+ }
82
+ catch (err) {
83
+ return handleVEAError(err);
84
+ }
76
85
  };
77
86
  const getSimpleDistriXCoeffQuestion = () => {
78
87
  const a = randint(-10, 11, [0]);
@@ -1 +1 @@
1
- {"version":3,"file":"fractionEquation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/equation/fractionEquation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAerC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAwIF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,WAAW,CAalD,CAAC"}
1
+ {"version":3,"file":"fractionEquation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/equation/fractionEquation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAcrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAoIF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,WAAW,CAalD,CAAC"}
@@ -6,9 +6,11 @@ import { randint } from "../../../../math/utils/random/randint.js";
6
6
  import { EqualNode } from "../../../../tree/nodes/equations/equalNode.js";
7
7
  import { EquationSolutionNode } from "../../../../tree/nodes/equations/equationSolutionNode.js";
8
8
  import { FractionNode } from "../../../../tree/nodes/operators/fractionNode.js";
9
- import { DiscreteSetNode, EmptySet, } from "../../../../tree/nodes/sets/discreteSetNode.js";
9
+ import { DiscreteSetNode } from "../../../../tree/nodes/sets/discreteSetNode.js";
10
10
  import { alignTex } from "../../../../utils/latex/alignTex.js";
11
11
  import { shuffle } from "../../../../utils/alea/shuffle.js";
12
+ import { equationVEA } from "../../../../exercises/vea/equationVEA.js";
13
+ import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
12
14
  const getStatementNode = (identifiers) => {
13
15
  const { a, b, c, d } = identifiers;
14
16
  const polynome1 = new Polynomial([b, a]);
@@ -110,15 +112,13 @@ const getPropositions = (n, { answer, c, d }) => {
110
112
  });
111
113
  return shuffle(propositions);
112
114
  };
113
- const isAnswerValid = (ans, { a, b, c, d }) => {
114
- const solutions = -d / c === -b / a
115
- ? EmptySet
116
- : new DiscreteSetNode([new Rational(-b, a).simplify().toTree()]);
117
- const answer = new EquationSolutionNode(solutions, {
118
- opts: { allowFractionToDecimal: true },
119
- });
120
- const validLatexs = answer.toAllValidTexs();
121
- return validLatexs.includes(ans);
115
+ const isAnswerValid = (ans, { answer }) => {
116
+ try {
117
+ return equationVEA(ans, answer.replace("S=", ""));
118
+ }
119
+ catch (err) {
120
+ return handleVEAError(err);
121
+ }
122
122
  };
123
123
  export const fractionEquation = {
124
124
  id: "fractionEquation",
@@ -1,10 +1,2 @@
1
- import { Exercise } from "../../../../exercises/exercise.js";
2
- type Identifiers = {
3
- a: number;
4
- k1: number;
5
- b: number;
6
- k2: number;
7
- };
8
- export declare const factoByXK: Exercise<Identifiers>;
9
1
  export {};
10
2
  //# sourceMappingURL=factoByXK.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"factoByXK.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/factorisation/factoByXK.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAgBT,MAAM,6BAA6B,CAAC;AAcrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,EAAE,EAAE,MAAM,CAAC;IACX,CAAC,EAAE,MAAM,CAAC;IACV,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AA4MF,eAAO,MAAM,SAAS,EAAE,QAAQ,CAAC,WAAW,CAc3C,CAAC"}
1
+ {"version":3,"file":"factoByXK.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/factorisation/factoByXK.ts"],"names":[],"mappings":""}