math-exercises 2.2.94 → 2.2.96

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 (209) hide show
  1. package/lib/exercises/math/calcul/fractions/fractionSquare.d.ts.map +1 -1
  2. package/lib/exercises/math/calcul/fractions/fractionSquare.js +2 -1
  3. package/lib/exercises/math/calcul/fractions/fractionsSum.d.ts.map +1 -1
  4. package/lib/exercises/math/calcul/fractions/fractionsSum.js +2 -1
  5. package/lib/exercises/math/calcul/fractions/fractionsSumsMultiplesDenominators.d.ts.map +1 -1
  6. package/lib/exercises/math/calcul/fractions/fractionsSumsMultiplesDenominators.js +2 -1
  7. package/lib/exercises/math/calcul/fractions/fractionsSumsPrimeDenominators.d.ts.map +1 -1
  8. package/lib/exercises/math/calcul/fractions/fractionsSumsPrimeDenominators.js +2 -1
  9. package/lib/exercises/math/calcul/fractions/fractionsSumsSameDenominators.d.ts.map +1 -1
  10. package/lib/exercises/math/calcul/fractions/fractionsSumsSameDenominators.js +2 -1
  11. package/lib/exercises/math/calcul/proportionality/findCoeffInProportionalTableNonIntegers.d.ts.map +1 -1
  12. package/lib/exercises/math/calcul/proportionality/findCoeffInProportionalTableNonIntegers.js +2 -1
  13. package/lib/exercises/math/calculLitteral/distributivity/doubleDistributivityWithCoeff.d.ts.map +1 -1
  14. package/lib/exercises/math/calculLitteral/distributivity/doubleDistributivityWithCoeff.js +0 -4
  15. package/lib/exercises/math/calculLitteral/distributivity/firstIdentity.d.ts.map +1 -1
  16. package/lib/exercises/math/calculLitteral/distributivity/firstIdentity.js +82 -34
  17. package/lib/exercises/math/calculLitteral/distributivity/identitiesWithNonIntegers.d.ts.map +1 -1
  18. package/lib/exercises/math/calculLitteral/distributivity/identitiesWithNonIntegers.js +2 -1
  19. package/lib/exercises/math/calculLitteral/distributivity/secondIdentity.d.ts.map +1 -1
  20. package/lib/exercises/math/calculLitteral/distributivity/secondIdentity.js +86 -36
  21. package/lib/exercises/math/calculLitteral/distributivity/thirdIdentity.d.ts.map +1 -1
  22. package/lib/exercises/math/calculLitteral/distributivity/thirdIdentity.js +82 -32
  23. package/lib/exercises/math/calculLitteral/equation/equationSimpleSquare.d.ts.map +1 -1
  24. package/lib/exercises/math/calculLitteral/equation/equationSimpleSquare.js +2 -1
  25. package/lib/exercises/math/calculLitteral/factorisation/factoByX.d.ts.map +1 -1
  26. package/lib/exercises/math/calculLitteral/factorisation/factoByX.js +2 -1
  27. package/lib/exercises/math/calculLitteral/factorisation/factoIdRmq1.d.ts.map +1 -1
  28. package/lib/exercises/math/calculLitteral/factorisation/factoIdRmq1.js +2 -1
  29. package/lib/exercises/math/calculLitteral/factorisation/factoIdRmq2.d.ts.map +1 -1
  30. package/lib/exercises/math/calculLitteral/factorisation/factoIdRmq2.js +2 -1
  31. package/lib/exercises/math/calculLitteral/factorisation/factoIdRmq3.d.ts.map +1 -1
  32. package/lib/exercises/math/calculLitteral/factorisation/factoIdRmq3.js +2 -1
  33. package/lib/exercises/math/calculLitteral/factorisation/factoType1Exercise.d.ts.map +1 -1
  34. package/lib/exercises/math/calculLitteral/factorisation/factoType1Exercise.js +3 -1
  35. package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType0.d.ts.map +1 -1
  36. package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType0.js +2 -1
  37. package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType1.d.ts.map +1 -1
  38. package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType1.js +2 -1
  39. package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType2.d.ts.map +1 -1
  40. package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType2.js +2 -1
  41. package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType3.d.ts.map +1 -1
  42. package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType3.js +2 -1
  43. package/lib/exercises/math/calculLitteral/inequations/squareFunctionInequation.d.ts.map +1 -1
  44. package/lib/exercises/math/calculLitteral/inequations/squareFunctionInequation.js +2 -1
  45. package/lib/exercises/math/calculLitteral/simplifying/distributeAndSimplify.d.ts.map +1 -1
  46. package/lib/exercises/math/calculLitteral/simplifying/distributeAndSimplify.js +38 -16
  47. package/lib/exercises/math/calculLitteral/simplifying/reduceExpression.d.ts +3 -3
  48. package/lib/exercises/math/calculLitteral/simplifying/reduceExpression.d.ts.map +1 -1
  49. package/lib/exercises/math/calculLitteral/simplifying/reduceExpression.js +171 -75
  50. package/lib/exercises/math/dataReading/index.d.ts +2 -0
  51. package/lib/exercises/math/dataReading/index.d.ts.map +1 -0
  52. package/lib/exercises/math/dataReading/index.js +17 -0
  53. package/lib/exercises/math/dataReading/tableReading.d.ts +8 -0
  54. package/lib/exercises/math/dataReading/tableReading.d.ts.map +1 -0
  55. package/lib/exercises/math/dataReading/tableReading.js +105 -0
  56. package/lib/exercises/math/derivation/derivative/convexityQuadrinomials.d.ts.map +1 -1
  57. package/lib/exercises/math/derivation/derivative/convexityQuadrinomials.js +2 -1
  58. package/lib/exercises/math/derivation/derivative/expDerivativeFour.d.ts.map +1 -1
  59. package/lib/exercises/math/derivation/derivative/expDerivativeFour.js +2 -1
  60. package/lib/exercises/math/derivation/derivative/expDerivativeThree.d.ts.map +1 -1
  61. package/lib/exercises/math/derivation/derivative/expDerivativeThree.js +2 -1
  62. package/lib/exercises/math/derivation/derivative/lnDerivativeThree.d.ts.map +1 -1
  63. package/lib/exercises/math/derivation/derivative/lnDerivativeThree.js +2 -1
  64. package/lib/exercises/math/derivation/derivative/powerCompositionDerivation.d.ts.map +1 -1
  65. package/lib/exercises/math/derivation/derivative/powerCompositionDerivation.js +75 -11
  66. package/lib/exercises/math/derivation/derivative/quotientDerivative.d.ts.map +1 -1
  67. package/lib/exercises/math/derivation/derivative/quotientDerivative.js +2 -1
  68. package/lib/exercises/math/derivation/derivative/rootFunctionDerivative.d.ts.map +1 -1
  69. package/lib/exercises/math/derivation/derivative/rootFunctionDerivative.js +2 -1
  70. package/lib/exercises/math/derivation/derivative/sqrtCompositionDerivation.d.ts.map +1 -1
  71. package/lib/exercises/math/derivation/derivative/sqrtCompositionDerivation.js +2 -1
  72. package/lib/exercises/math/derivation/derivative/thirdDegreeDerivative.d.ts.map +1 -1
  73. package/lib/exercises/math/derivation/derivative/thirdDegreeDerivative.js +2 -1
  74. package/lib/exercises/math/derivation/derivative/thirdDegreeFunctionVariation.d.ts.map +1 -1
  75. package/lib/exercises/math/derivation/derivative/thirdDegreeFunctionVariation.js +2 -1
  76. package/lib/exercises/math/functions/absolute/absolueValueAffineEquation.d.ts.map +1 -1
  77. package/lib/exercises/math/functions/absolute/absolueValueAffineEquation.js +2 -1
  78. package/lib/exercises/math/functions/absolute/absolueValueInequationsSup.d.ts.map +1 -1
  79. package/lib/exercises/math/functions/absolute/absolueValueInequationsSup.js +2 -1
  80. package/lib/exercises/math/functions/absolute/absoluteValueInequations.d.ts.map +1 -1
  81. package/lib/exercises/math/functions/absolute/absoluteValueInequations.js +2 -1
  82. package/lib/exercises/math/functions/affines/affineExpressionFromTwoImages.d.ts.map +1 -1
  83. package/lib/exercises/math/functions/affines/affineExpressionFromTwoImages.js +2 -2
  84. package/lib/exercises/math/functions/affines/affineExpressionReading.js +2 -1
  85. package/lib/exercises/math/functions/affines/signFunction.d.ts.map +1 -1
  86. package/lib/exercises/math/functions/affines/signFunction.js +2 -1
  87. package/lib/exercises/math/functions/basics/graphicEquation.d.ts.map +1 -1
  88. package/lib/exercises/math/functions/basics/graphicEquation.js +2 -1
  89. package/lib/exercises/math/functions/basics/graphicInequation.d.ts.map +1 -1
  90. package/lib/exercises/math/functions/basics/graphicInequation.js +2 -1
  91. package/lib/exercises/math/functions/basics/graphicInequationAffine.d.ts.map +1 -1
  92. package/lib/exercises/math/functions/basics/graphicInequationAffine.js +2 -1
  93. package/lib/exercises/math/functions/basics/imageFunction.d.ts.map +1 -1
  94. package/lib/exercises/math/functions/basics/imageFunction.js +2 -1
  95. package/lib/exercises/math/functions/basics/twoFunctionsInequation.d.ts.map +1 -1
  96. package/lib/exercises/math/functions/basics/twoFunctionsInequation.js +2 -1
  97. package/lib/exercises/math/functions/exponential/expEquation.d.ts.map +1 -1
  98. package/lib/exercises/math/functions/exponential/expEquation.js +2 -1
  99. package/lib/exercises/math/functions/logarithm/logPowerEquation.d.ts.map +1 -1
  100. package/lib/exercises/math/functions/logarithm/logPowerEquation.js +2 -1
  101. package/lib/exercises/math/functions/sign/affineProductSign.d.ts.map +1 -1
  102. package/lib/exercises/math/functions/sign/affineProductSign.js +2 -1
  103. package/lib/exercises/math/functions/square/squareImageInterval.d.ts.map +1 -1
  104. package/lib/exercises/math/functions/square/squareImageInterval.js +2 -1
  105. package/lib/exercises/math/functions/trinoms/coefficientsIdentification.d.ts.map +1 -1
  106. package/lib/exercises/math/functions/trinoms/coefficientsIdentification.js +2 -1
  107. package/lib/exercises/math/functions/trinoms/secondDegreeInequation.d.ts.map +1 -1
  108. package/lib/exercises/math/functions/trinoms/secondDegreeInequation.js +2 -1
  109. package/lib/exercises/math/functions/trinoms/trinomSignFromRoots.d.ts.map +1 -1
  110. package/lib/exercises/math/functions/trinoms/trinomSignFromRoots.js +2 -1
  111. package/lib/exercises/math/geometry/cartesian/readAbscissOnLine.d.ts.map +1 -1
  112. package/lib/exercises/math/geometry/cartesian/readAbscissOnLine.js +2 -1
  113. package/lib/exercises/math/geometry/cartesian/readAbscissOnSemiLine.d.ts.map +1 -1
  114. package/lib/exercises/math/geometry/cartesian/readAbscissOnSemiLine.js +2 -1
  115. package/lib/exercises/math/geometry/convexity/convexityQuadrinomialsGeo.d.ts.map +1 -1
  116. package/lib/exercises/math/geometry/convexity/convexityQuadrinomialsGeo.js +2 -1
  117. package/lib/exercises/math/geometry/parametric/extractPointFromParametricLine.d.ts.map +1 -1
  118. package/lib/exercises/math/geometry/parametric/extractPointFromParametricLine.js +2 -1
  119. package/lib/exercises/math/geometry/parametric/extractVectorFromParametricLine.d.ts.map +1 -1
  120. package/lib/exercises/math/geometry/parametric/extractVectorFromParametricLine.js +2 -1
  121. package/lib/exercises/math/index.d.ts +1 -0
  122. package/lib/exercises/math/index.d.ts.map +1 -1
  123. package/lib/exercises/math/index.js +1 -0
  124. package/lib/exercises/math/matrices/matrixInversibilityDomain.d.ts.map +1 -1
  125. package/lib/exercises/math/matrices/matrixInversibilityDomain.js +2 -1
  126. package/lib/exercises/math/percent/index.d.ts +1 -0
  127. package/lib/exercises/math/percent/index.d.ts.map +1 -1
  128. package/lib/exercises/math/percent/index.js +1 -1
  129. package/lib/exercises/math/percent/percentWritings.d.ts.map +1 -1
  130. package/lib/exercises/math/percent/percentWritings.js +10 -1
  131. package/lib/exercises/math/powers/powersMixOperations.d.ts.map +1 -1
  132. package/lib/exercises/math/powers/powersMixOperations.js +2 -1
  133. package/lib/exercises/math/probaStat/diceBasicProbas.d.ts.map +1 -1
  134. package/lib/exercises/math/probaStat/diceBasicProbas.js +72 -20
  135. package/lib/exercises/math/probaStat/probabilityTree.d.ts.map +1 -1
  136. package/lib/exercises/math/probaStat/probabilityTree.js +2 -1
  137. package/lib/exercises/math/sampling/confidenceInterval.d.ts.map +1 -1
  138. package/lib/exercises/math/sampling/confidenceInterval.js +2 -1
  139. package/lib/exercises/math/sampling/fluctuationInterval.d.ts.map +1 -1
  140. package/lib/exercises/math/sampling/fluctuationInterval.js +2 -1
  141. package/lib/exercises/math/sequences/geometric/geometricExplicitFormulaUsage.d.ts.map +1 -1
  142. package/lib/exercises/math/sequences/geometric/geometricExplicitFormulaUsage.js +2 -1
  143. package/lib/exercises/math/sets/intervals/inequalityToInterval.d.ts.map +1 -1
  144. package/lib/exercises/math/sets/intervals/inequalityToInterval.js +2 -1
  145. package/lib/exercises/math/sets/intervals/intervalsIntersection.d.ts.map +1 -1
  146. package/lib/exercises/math/sets/intervals/intervalsIntersection.js +2 -1
  147. package/lib/exercises/math/sets/intervals/intervalsUnion.d.ts.map +1 -1
  148. package/lib/exercises/math/sets/intervals/intervalsUnion.js +2 -1
  149. package/lib/exercises/math/trigonometry/degreeToRadians.d.ts.map +1 -1
  150. package/lib/exercises/math/trigonometry/degreeToRadians.js +2 -1
  151. package/lib/exercises/math/trigonometry/mainAngleMeasure.d.ts.map +1 -1
  152. package/lib/exercises/math/trigonometry/mainAngleMeasure.js +2 -1
  153. package/lib/exercises/vea/equationVEA.d.ts.map +1 -1
  154. package/lib/exercises/vea/equationVEA.js +2 -1
  155. package/lib/exercises/vea/rationalVEA.d.ts.map +1 -1
  156. package/lib/exercises/vea/rationalVEA.js +3 -2
  157. package/lib/exercises/vea/sqrtVEA.d.ts.map +1 -1
  158. package/lib/exercises/vea/sqrtVEA.js +2 -1
  159. package/lib/index.d.ts +9 -3
  160. package/lib/index.d.ts.map +1 -1
  161. package/lib/tree/nodes/algebraicNode.d.ts +1 -0
  162. package/lib/tree/nodes/algebraicNode.d.ts.map +1 -1
  163. package/lib/tree/nodes/operators/addNode.d.ts +2 -1
  164. package/lib/tree/nodes/operators/addNode.d.ts.map +1 -1
  165. package/lib/tree/nodes/operators/addNode.js +22 -4
  166. package/lib/tree/nodes/operators/fractionNode.d.ts.map +1 -1
  167. package/lib/tree/nodes/operators/fractionNode.js +1 -1
  168. package/lib/tree/nodes/operators/multiplyNode.d.ts +2 -1
  169. package/lib/tree/nodes/operators/multiplyNode.d.ts.map +1 -1
  170. package/lib/tree/nodes/operators/multiplyNode.js +13 -1
  171. package/lib/tree/nodes/operators/operatorNode.d.ts +5 -0
  172. package/lib/tree/nodes/operators/operatorNode.d.ts.map +1 -1
  173. package/lib/tree/nodes/operators/operatorNode.js +5 -1
  174. package/lib/tree/nodes/polynomials/monomNode.d.ts +2 -6
  175. package/lib/tree/nodes/polynomials/monomNode.d.ts.map +1 -1
  176. package/lib/tree/nodes/polynomials/monomNode.js +102 -94
  177. package/lib/tree/parsers/affineParser.d.ts +1 -1
  178. package/lib/tree/parsers/affineParser.d.ts.map +1 -1
  179. package/lib/tree/parsers/affineParser.js +18 -22
  180. package/lib/tree/parsers/discreteSetParser.d.ts.map +1 -1
  181. package/lib/tree/parsers/discreteSetParser.js +2 -1
  182. package/lib/tree/parsers/equationSolutionParser.d.ts.map +1 -1
  183. package/lib/tree/parsers/equationSolutionParser.js +2 -1
  184. package/lib/tree/parsers/inequationParser.d.ts.map +1 -1
  185. package/lib/tree/parsers/inequationParser.js +2 -1
  186. package/lib/tree/parsers/intervalParser.d.ts.map +1 -1
  187. package/lib/tree/parsers/intervalParser.js +3 -2
  188. package/lib/tree/parsers/latexParser.js +3 -3
  189. package/lib/tree/parsers/monomParser.d.ts.map +1 -1
  190. package/lib/tree/parsers/monomParser.js +2 -1
  191. package/lib/tree/parsers/polynomialParser.d.ts +5 -1
  192. package/lib/tree/parsers/polynomialParser.d.ts.map +1 -1
  193. package/lib/tree/parsers/polynomialParser.js +5 -4
  194. package/lib/tree/parsers/powerParser.d.ts.map +1 -1
  195. package/lib/tree/parsers/powerParser.js +2 -1
  196. package/lib/tree/parsers/purifyLatex.d.ts +1 -1
  197. package/lib/tree/parsers/purifyLatex.js +1 -1
  198. package/lib/tree/parsers/sqrtParser.d.ts.map +1 -1
  199. package/lib/tree/parsers/sqrtParser.js +2 -1
  200. package/lib/tree/parsers/trinomParser.d.ts.map +1 -1
  201. package/lib/tree/parsers/trinomParser.js +2 -1
  202. package/lib/tree/parsers/unionIntervalParser.d.ts.map +1 -1
  203. package/lib/tree/parsers/unionIntervalParser.js +2 -1
  204. package/lib/utils/alea/random.js +1 -1
  205. package/lib/utils/alea/shuffle.js +1 -1
  206. package/lib/utils/errors/handleVEAError.d.ts +2 -0
  207. package/lib/utils/errors/handleVEAError.d.ts.map +1 -0
  208. package/lib/utils/errors/handleVEAError.js +9 -0
  209. package/package.json +1 -1
@@ -9,32 +9,54 @@ const powerNode_1 = require("../../../../tree/nodes/operators/powerNode");
9
9
  const substractNode_1 = require("../../../../tree/nodes/operators/substractNode");
10
10
  const alignTex_1 = require("../../../../utils/latex/alignTex");
11
11
  const shuffle_1 = require("../../../../utils/alea/shuffle");
12
- const getThirdIdentityQuestion = () => {
13
- const affine = affine_1.AffineConstructor.random(undefined, { excludes: [0] });
14
- const affine2 = new affine_1.Affine(affine.a, -affine.b);
12
+ const latexParser_1 = require("../../../../tree/parsers/latexParser");
13
+ const addNode_1 = require("../../../../tree/nodes/operators/addNode");
14
+ const handleVEAError_1 = require("../../../../utils/errors/handleVEAError");
15
+ const getStatementNode = (identifiers) => {
16
+ const { affine1Coeffs, affine2Coeffs } = identifiers;
17
+ const affine = new affine_1.Affine(affine1Coeffs[1], affine1Coeffs[0]);
18
+ const affine2 = new affine_1.Affine(affine2Coeffs[1], affine2Coeffs[0]);
15
19
  const statementTree = new multiplyNode_1.MultiplyNode(affine.toTree(), affine2.toTree());
20
+ return statementTree;
21
+ };
22
+ const getStartStatement = (identifiers) => {
23
+ return getStatementNode(identifiers).toTex();
24
+ };
25
+ const getInstruction = (identifiers) => {
26
+ return `Développer et réduire :
27
+
28
+ $$
29
+ ${getStartStatement(identifiers)}
30
+ $$`;
31
+ };
32
+ const getAnswer = (identifiers) => {
33
+ const { affine1Coeffs, affine2Coeffs } = identifiers;
34
+ const affine = new affine_1.Affine(affine1Coeffs[1], affine1Coeffs[0]);
35
+ const affine2 = new affine_1.Affine(affine2Coeffs[1], affine2Coeffs[0]);
16
36
  const answer = affine.multiply(affine2).toTree().toTex();
37
+ return answer;
38
+ };
39
+ const getHint = (identifiers) => {
40
+ const { affine1Coeffs, affine2Coeffs } = identifiers;
41
+ const affine = new affine_1.Affine(affine1Coeffs[1], affine1Coeffs[0]);
17
42
  const aMonom = new multiplyNode_1.MultiplyNode(affine.a.toTree(), "x".toTree());
18
43
  const bPositive = Math.abs(affine.b);
19
- const statementTex = statementTree.toTex();
20
- const question = {
21
- instruction: `Développer et réduire : $${statementTex}$`,
22
- startStatement: statementTex,
23
- answer,
24
- keys: ["x"],
25
- answerFormat: "tex",
26
- identifiers: {
27
- affine1Coeffs: affine.coefficients,
28
- affine2Coeffs: affine2.coefficients,
29
- },
30
- hint: `Utilise l'identité remarquable
44
+ return `Utilise l'identité remarquable
31
45
 
32
46
  $$
33
47
  (a-b)(a+b) = a^2 - b^2
34
48
  $$
35
49
 
36
- en prenant $a=${aMonom.toTex()}$ et $b=${bPositive}$`,
37
- correction: `
50
+ en prenant $a=${aMonom.toTex()}$ et $b=${bPositive}$`;
51
+ };
52
+ const getCorrection = (identifiers) => {
53
+ const { affine1Coeffs, affine2Coeffs } = identifiers;
54
+ const affine = new affine_1.Affine(affine1Coeffs[1], affine1Coeffs[0]);
55
+ const aMonom = new multiplyNode_1.MultiplyNode(affine.a.toTree(), "x".toTree());
56
+ const bPositive = Math.abs(affine.b);
57
+ const statementTex = getStartStatement(identifiers);
58
+ const answer = getAnswer(identifiers);
59
+ return `
38
60
  On utilise l'identité remarquable
39
61
 
40
62
  $$
@@ -44,13 +66,30 @@ $$
44
66
  en prenant $a=${aMonom.toTex()}$ et $b=${bPositive}$.
45
67
 
46
68
  ${(0, alignTex_1.alignTex)([
47
- [
48
- statementTex,
49
- "=",
50
- new substractNode_1.SubstractNode(new powerNode_1.SquareNode(aMonom), new powerNode_1.SquareNode(bPositive.toTree())).toTex(),
51
- ],
52
- ["", "=", answer],
53
- ])}`,
69
+ [
70
+ statementTex,
71
+ "=",
72
+ new substractNode_1.SubstractNode(new powerNode_1.SquareNode(aMonom), new powerNode_1.SquareNode(bPositive.toTree())).toTex(),
73
+ ],
74
+ ["", "=", answer],
75
+ ])}`;
76
+ };
77
+ const getThirdIdentityQuestion = () => {
78
+ const affine = affine_1.AffineConstructor.random(undefined, { excludes: [0] });
79
+ const affine2 = new affine_1.Affine(affine.a, -affine.b);
80
+ const identifiers = {
81
+ affine1Coeffs: affine.coefficients,
82
+ affine2Coeffs: affine2.coefficients,
83
+ };
84
+ const question = {
85
+ instruction: getInstruction(identifiers),
86
+ startStatement: getStartStatement(identifiers),
87
+ answer: getAnswer(identifiers),
88
+ keys: ["x"],
89
+ answerFormat: "tex",
90
+ identifiers,
91
+ hint: getHint(identifiers),
92
+ correction: getCorrection(identifiers),
54
93
  };
55
94
  return question;
56
95
  };
@@ -74,20 +113,26 @@ const getThirdIdentityPropositions = (n, { answer, affine1Coeffs, affine2Coeffs
74
113
  return (0, shuffle_1.shuffle)(propositions);
75
114
  };
76
115
  exports.getThirdIdentityPropositions = getThirdIdentityPropositions;
77
- const isThirdIdentityAnswerValid = (ans, { affine1Coeffs, affine2Coeffs }) => {
78
- const affine = new affine_1.Affine(affine1Coeffs[1], affine1Coeffs[0]);
79
- const affine2 = new affine_1.Affine(affine2Coeffs[1], affine2Coeffs[0]);
80
- const answer = affine.multiply(affine2).toTree();
81
- const texs = answer.toAllValidTexs();
82
- return texs.includes(ans);
116
+ const isThirdIdentityAnswerValid = (ans, { answer, affine1Coeffs, affine2Coeffs }) => {
117
+ try {
118
+ const parsed = (0, latexParser_1.parseAlgebraic)(ans);
119
+ if (!parsed)
120
+ return false;
121
+ if (!(0, addNode_1.isAddNode)(parsed) && !(0, substractNode_1.isSubstractNode)(parsed))
122
+ return false;
123
+ return (parsed
124
+ .simplify({ forbidFactorize: true, towardsDistribute: true })
125
+ .toTex() === answer);
126
+ }
127
+ catch (err) {
128
+ return (0, handleVEAError_1.handleVEAError)(err);
129
+ }
83
130
  };
84
131
  exports.isThirdIdentityAnswerValid = isThirdIdentityAnswerValid;
85
132
  exports.thirdIdentity = {
86
133
  id: "idRmq3",
87
134
  connector: "=",
88
135
  label: "Identité remarquable $(a+b)(a-b)$",
89
- levels: ["3ème", "2nde"],
90
- sections: ["Calcul littéral"],
91
136
  isSingleStep: false,
92
137
  generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(exports.getThirdIdentityQuestion, nb),
93
138
  getPropositions: exports.getThirdIdentityPropositions,
@@ -96,4 +141,9 @@ exports.thirdIdentity = {
96
141
  freeTimer: 60,
97
142
  subject: "Mathématiques",
98
143
  hasHintAndCorrection: true,
144
+ getInstruction,
145
+ getCorrection,
146
+ getHint,
147
+ getAnswer,
148
+ getStartStatement,
99
149
  };
@@ -1 +1 @@
1
- {"version":3,"file":"equationSimpleSquare.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/equation/equationSimpleSquare.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,0BAA0B,CAAC;AA2BlC,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AA+JF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAkBtD,CAAC"}
1
+ {"version":3,"file":"equationSimpleSquare.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/equation/equationSimpleSquare.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,0BAA0B,CAAC;AA4BlC,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AA+JF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAkBtD,CAAC"}
@@ -15,6 +15,7 @@ const diceFlip_1 = require("../../../../utils/alea/diceFlip");
15
15
  const isInt_1 = require("../../../../utils/isInt");
16
16
  const random_1 = require("../../../../utils/alea/random");
17
17
  const discreteSetParser_1 = require("../../../../tree/parsers/discreteSetParser");
18
+ const handleVEAError_1 = require("../../../../utils/errors/handleVEAError");
18
19
  const squares = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12].map((el) => el ** 2);
19
20
  const higherFactor = (n) => {
20
21
  for (let i = Math.floor(Math.sqrt(n)); i > 0; i--)
@@ -141,7 +142,7 @@ const isAnswerValid = (ans, { answer, randNbr }) => {
141
142
  return "S=" + parsed.simplify().toTex() === answer;
142
143
  }
143
144
  catch (err) {
144
- return false;
145
+ return (0, handleVEAError_1.handleVEAError)(err);
145
146
  }
146
147
  };
147
148
  exports.equationSimpleSquare = {
@@ -1 +1 @@
1
- {"version":3,"file":"factoByX.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/factorisation/factoByX.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,0BAA0B,CAAC;AAiBlC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAqJF,eAAO,MAAM,QAAQ,EAAE,QAAQ,CAAC,WAAW,CAiB1C,CAAC"}
1
+ {"version":3,"file":"factoByX.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/factorisation/factoByX.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,0BAA0B,CAAC;AAkBlC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAqJF,eAAO,MAAM,QAAQ,EAAE,QAAQ,CAAC,WAAW,CAiB1C,CAAC"}
@@ -11,6 +11,7 @@ const addNode_1 = require("../../../../tree/nodes/operators/addNode");
11
11
  const multiplyNode_1 = require("../../../../tree/nodes/operators/multiplyNode");
12
12
  const powerNode_1 = require("../../../../tree/nodes/operators/powerNode");
13
13
  const latexParser_1 = require("../../../../tree/parsers/latexParser");
14
+ const handleVEAError_1 = require("../../../../utils/errors/handleVEAError");
14
15
  const alignTex_1 = require("../../../../utils/latex/alignTex");
15
16
  const getPropositions = (n, { answer, ...identifiers }) => {
16
17
  const propositions = [];
@@ -106,7 +107,7 @@ const isAnswerValid = (ans, { answer, ...identifiers }) => {
106
107
  .toTex() === statement.toTex());
107
108
  }
108
109
  catch (err) {
109
- return false;
110
+ return (0, handleVEAError_1.handleVEAError)(err);
110
111
  }
111
112
  };
112
113
  const getFactoByXQuestion = (ops) => {
@@ -1 +1 @@
1
- {"version":3,"file":"factoIdRmq1.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/factorisation/factoIdRmq1.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,0BAA0B,CAAC;AAsBlC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAqIF,eAAO,MAAM,WAAW,EAAE,QAAQ,CAAC,WAAW,CAkB7C,CAAC"}
1
+ {"version":3,"file":"factoIdRmq1.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/factorisation/factoIdRmq1.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,0BAA0B,CAAC;AAuBlC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAqIF,eAAO,MAAM,WAAW,EAAE,QAAQ,CAAC,WAAW,CAkB7C,CAAC"}
@@ -12,6 +12,7 @@ const powerNode_1 = require("../../../../tree/nodes/operators/powerNode");
12
12
  const alignTex_1 = require("../../../../utils/latex/alignTex");
13
13
  const shuffle_1 = require("../../../../utils/alea/shuffle");
14
14
  const latexParser_1 = require("../../../../tree/parsers/latexParser");
15
+ const handleVEAError_1 = require("../../../../utils/errors/handleVEAError");
15
16
  const getStatementNode = (identifiers) => {
16
17
  const affine = new affine_1.Affine(identifiers.a, identifiers.b);
17
18
  const statementTree = affine.multiply(affine).toTree();
@@ -105,7 +106,7 @@ const isAnswerValid = (ans, { answer, a, b }) => {
105
106
  return parsed.simplify().toTex() === answer;
106
107
  }
107
108
  catch (err) {
108
- return false;
109
+ return (0, handleVEAError_1.handleVEAError)(err);
109
110
  }
110
111
  };
111
112
  exports.factoIdRmq1 = {
@@ -1 +1 @@
1
- {"version":3,"file":"factoIdRmq2.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/factorisation/factoIdRmq2.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,0BAA0B,CAAC;AAuBlC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AA+HF,eAAO,MAAM,WAAW,EAAE,QAAQ,CAAC,WAAW,CAkB7C,CAAC"}
1
+ {"version":3,"file":"factoIdRmq2.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/factorisation/factoIdRmq2.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,0BAA0B,CAAC;AAwBlC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AA+HF,eAAO,MAAM,WAAW,EAAE,QAAQ,CAAC,WAAW,CAkB7C,CAAC"}
@@ -13,6 +13,7 @@ const substractNode_1 = require("../../../../tree/nodes/operators/substractNode"
13
13
  const alignTex_1 = require("../../../../utils/latex/alignTex");
14
14
  const shuffle_1 = require("../../../../utils/alea/shuffle");
15
15
  const latexParser_1 = require("../../../../tree/parsers/latexParser");
16
+ const handleVEAError_1 = require("../../../../utils/errors/handleVEAError");
16
17
  const getInstruction = (identifiers) => {
17
18
  return `Factoriser :
18
19
 
@@ -103,7 +104,7 @@ const isAnswerValid = (ans, { answer, a, b }) => {
103
104
  return parsed.simplify().toTex() === answer;
104
105
  }
105
106
  catch (err) {
106
- return false;
107
+ return (0, handleVEAError_1.handleVEAError)(err);
107
108
  }
108
109
  };
109
110
  exports.factoIdRmq2 = {
@@ -1 +1 @@
1
- {"version":3,"file":"factoIdRmq3.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/factorisation/factoIdRmq3.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,0BAA0B,CAAC;AAkBlC,KAAK,WAAW,GAAG;IACjB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,aAAa,EAAE,MAAM,EAAE,CAAC;CACzB,CAAC;AAmKF,eAAO,MAAM,WAAW,EAAE,QAAQ,CAAC,WAAW,CAkB7C,CAAC"}
1
+ {"version":3,"file":"factoIdRmq3.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/factorisation/factoIdRmq3.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,0BAA0B,CAAC;AAmBlC,KAAK,WAAW,GAAG;IACjB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,aAAa,EAAE,MAAM,EAAE,CAAC;CACzB,CAAC;AAmKF,eAAO,MAAM,WAAW,EAAE,QAAQ,CAAC,WAAW,CAkB7C,CAAC"}
@@ -9,6 +9,7 @@ const multiplyNode_1 = require("../../../../tree/nodes/operators/multiplyNode");
9
9
  const powerNode_1 = require("../../../../tree/nodes/operators/powerNode");
10
10
  const substractNode_1 = require("../../../../tree/nodes/operators/substractNode");
11
11
  const latexParser_1 = require("../../../../tree/parsers/latexParser");
12
+ const handleVEAError_1 = require("../../../../utils/errors/handleVEAError");
12
13
  const alignTex_1 = require("../../../../utils/latex/alignTex");
13
14
  const getAnswer = (identifiers) => {
14
15
  const affine = new affine_1.Affine(identifiers.affine1Coeffs[1], identifiers.affine1Coeffs[0]);
@@ -112,7 +113,7 @@ const isAnswerValid = (ans, { answer, ...identifiers }) => {
112
113
  .toTex() === getStartStatement(identifiers));
113
114
  }
114
115
  catch (err) {
115
- return false;
116
+ return (0, handleVEAError_1.handleVEAError)(err);
116
117
  }
117
118
  };
118
119
  exports.factoIdRmq3 = {
@@ -1 +1 @@
1
- {"version":3,"file":"factoType1Exercise.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/factorisation/factoType1Exercise.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,QAAQ,EAUT,MAAM,0BAA0B,CAAC;AAkBlC;;;GAGG;AACH,KAAK,WAAW,GAAG;IACjB,aAAa,EAAE,MAAM,EAAE,EAAE,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAgKF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,CAepD,CAAC"}
1
+ {"version":3,"file":"factoType1Exercise.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/factorisation/factoType1Exercise.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,QAAQ,EAUT,MAAM,0BAA0B,CAAC;AAmBlC;;;GAGG;AACH,KAAK,WAAW,GAAG;IACjB,aAAa,EAAE,MAAM,EAAE,EAAE,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAiKF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,CAepD,CAAC"}
@@ -14,6 +14,7 @@ const substractNode_1 = require("../../../../tree/nodes/operators/substractNode"
14
14
  const latexParser_1 = require("../../../../tree/parsers/latexParser");
15
15
  const random_1 = require("../../../../utils/alea/random");
16
16
  const shuffle_1 = require("../../../../utils/alea/shuffle");
17
+ const handleVEAError_1 = require("../../../../utils/errors/handleVEAError");
17
18
  const getStatementNode = (identifiers) => {
18
19
  const { affinesCoeffs, operation } = identifiers;
19
20
  const affines = affinesCoeffs.map((coeffs) => new affine_1.Affine(coeffs[1], coeffs[0]));
@@ -102,6 +103,7 @@ const getPropositions = (n, { answer, affinesCoeffs, operation }) => {
102
103
  };
103
104
  const isAnswerValid = (ans, { answer, ...identifiers }) => {
104
105
  try {
106
+ console.log(ans, answer);
105
107
  const parsed = (0, latexParser_1.parseAlgebraic)(ans);
106
108
  if (!parsed)
107
109
  return false;
@@ -118,7 +120,7 @@ const isAnswerValid = (ans, { answer, ...identifiers }) => {
118
120
  return simp.toTex() === answerSimp.toTex();
119
121
  }
120
122
  catch (err) {
121
- return false;
123
+ return (0, handleVEAError_1.handleVEAError)(err);
122
124
  }
123
125
  };
124
126
  exports.factoType1Exercise = {
@@ -1 +1 @@
1
- {"version":3,"file":"firstDegreeInequationsType0.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/inequations/firstDegreeInequationsType0.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,0BAA0B,CAAC;AAIlC,OAAO,EACL,gBAAgB,EAGjB,MAAM,mCAAmC,CAAC;AAe3C,cAAc;AAEd,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,QAAQ,EAAE,gBAAgB,CAAC;CAC5B,CAAC;AA6JF,KAAK,OAAO,GAAG;IACb,wBAAwB,EAAE,MAAM,CAAC;CAClC,CAAC;AAGF,eAAO,MAAM,2BAA2B,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAqBtE,CAAC"}
1
+ {"version":3,"file":"firstDegreeInequationsType0.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/inequations/firstDegreeInequationsType0.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,0BAA0B,CAAC;AAIlC,OAAO,EACL,gBAAgB,EAGjB,MAAM,mCAAmC,CAAC;AAgB3C,cAAc;AAEd,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,QAAQ,EAAE,gBAAgB,CAAC;CAC5B,CAAC;AA6JF,KAAK,OAAO,GAAG;IACb,wBAAwB,EAAE,MAAM,CAAC;CAClC,CAAC;AAGF,eAAO,MAAM,2BAA2B,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAqBtE,CAAC"}
@@ -15,6 +15,7 @@ const inequationParser_1 = require("../../../../tree/parsers/inequationParser");
15
15
  const intervalParser_1 = require("../../../../tree/parsers/intervalParser");
16
16
  const coinFlip_1 = require("../../../../utils/alea/coinFlip");
17
17
  const shuffle_1 = require("../../../../utils/alea/shuffle");
18
+ const handleVEAError_1 = require("../../../../utils/errors/handleVEAError");
18
19
  const getHint = (identifiers) => {
19
20
  return `Pour résoudre cette inéquation, il faut isoler $x$ à gauche. Pour cela, il faut effectuer des deux côtés de l'inéquation la bonne opération qui permet de supprimer le terme $${identifiers.b < 0 ? "" : "+"}${identifiers.b}$.`;
20
21
  };
@@ -115,7 +116,7 @@ const isAnswerValid = (ans, { answer, ineqType, b, c }, opts) => {
115
116
  }
116
117
  }
117
118
  catch (err) {
118
- return false;
119
+ return (0, handleVEAError_1.handleVEAError)(err);
119
120
  }
120
121
  };
121
122
  const options = [inequationSolutionFormat_1.inequationSolutionFormat];
@@ -1 +1 @@
1
- {"version":3,"file":"firstDegreeInequationsType1.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/inequations/firstDegreeInequationsType1.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,0BAA0B,CAAC;AAIlC,OAAO,EACL,gBAAgB,EAGjB,MAAM,mCAAmC,CAAC;AAc3C,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,QAAQ,EAAE,gBAAgB,CAAC;CAC5B,CAAC;AAgLF,KAAK,OAAO,GAAG;IACb,wBAAwB,EAAE,MAAM,CAAC;CAClC,CAAC;AAGF,eAAO,MAAM,2BAA2B,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAsBtE,CAAC"}
1
+ {"version":3,"file":"firstDegreeInequationsType1.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/inequations/firstDegreeInequationsType1.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,0BAA0B,CAAC;AAIlC,OAAO,EACL,gBAAgB,EAGjB,MAAM,mCAAmC,CAAC;AAe3C,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,QAAQ,EAAE,gBAAgB,CAAC;CAC5B,CAAC;AAgLF,KAAK,OAAO,GAAG;IACb,wBAAwB,EAAE,MAAM,CAAC;CAClC,CAAC;AAGF,eAAO,MAAM,2BAA2B,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAsBtE,CAAC"}
@@ -15,6 +15,7 @@ const inequationParser_1 = require("../../../../tree/parsers/inequationParser");
15
15
  const intervalParser_1 = require("../../../../tree/parsers/intervalParser");
16
16
  const coinFlip_1 = require("../../../../utils/alea/coinFlip");
17
17
  const shuffle_1 = require("../../../../utils/alea/shuffle");
18
+ const handleVEAError_1 = require("../../../../utils/errors/handleVEAError");
18
19
  /**ax<b */
19
20
  const getHint = (identifiers) => {
20
21
  return `Pour résoudre cette inéquation, il faut isoler $x$ à gauche. Pour cela, il faut effectuer des deux côtés de l'inéquation la bonne opération qui permet de supprimer le facteur $${identifiers.a}$.`;
@@ -124,7 +125,7 @@ const isAnswerValid = (ans, { answer, a, b, ineqType }, opts) => {
124
125
  }
125
126
  }
126
127
  catch (err) {
127
- return false;
128
+ return (0, handleVEAError_1.handleVEAError)(err);
128
129
  }
129
130
  };
130
131
  const options = [inequationSolutionFormat_1.inequationSolutionFormat];
@@ -1 +1 @@
1
- {"version":3,"file":"firstDegreeInequationsType2.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/inequations/firstDegreeInequationsType2.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EACL,gBAAgB,EAGjB,MAAM,mCAAmC,CAAC;AAW3C,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAwIF,KAAK,OAAO,GAAG;IACb,wBAAwB,EAAE,MAAM,CAAC;CAClC,CAAC;AAGF,eAAO,MAAM,2BAA2B,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAkBtE,CAAC"}
1
+ {"version":3,"file":"firstDegreeInequationsType2.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/inequations/firstDegreeInequationsType2.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EACL,gBAAgB,EAGjB,MAAM,mCAAmC,CAAC;AAY3C,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAwIF,KAAK,OAAO,GAAG;IACb,wBAAwB,EAAE,MAAM,CAAC;CAClC,CAAC;AAGF,eAAO,MAAM,2BAA2B,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAkBtE,CAAC"}
@@ -14,6 +14,7 @@ const inequationParser_1 = require("../../../../tree/parsers/inequationParser");
14
14
  const intervalParser_1 = require("../../../../tree/parsers/intervalParser");
15
15
  const coinFlip_1 = require("../../../../utils/alea/coinFlip");
16
16
  const shuffle_1 = require("../../../../utils/alea/shuffle");
17
+ const handleVEAError_1 = require("../../../../utils/errors/handleVEAError");
17
18
  /**ax+b<c */
18
19
  const getKeys = (identifiers, opts) => {
19
20
  const isInterval = opts?.inequationSolutionFormat === "Intervalle (S = [a;b])";
@@ -99,7 +100,7 @@ const isAnswerValid = (ans, { answer, a, b, c, ineqType }, opts) => {
99
100
  }
100
101
  }
101
102
  catch (err) {
102
- return false;
103
+ return (0, handleVEAError_1.handleVEAError)(err);
103
104
  }
104
105
  };
105
106
  const options = [inequationSolutionFormat_1.inequationSolutionFormat];
@@ -1 +1 @@
1
- {"version":3,"file":"firstDegreeInequationsType3.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/inequations/firstDegreeInequationsType3.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EACL,gBAAgB,EAGjB,MAAM,mCAAmC,CAAC;AAW3C,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAmJF,KAAK,OAAO,GAAG;IACb,wBAAwB,EAAE,MAAM,CAAC;CAClC,CAAC;AAGF,eAAO,MAAM,2BAA2B,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAkBtE,CAAC"}
1
+ {"version":3,"file":"firstDegreeInequationsType3.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/inequations/firstDegreeInequationsType3.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EACL,gBAAgB,EAGjB,MAAM,mCAAmC,CAAC;AAY3C,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAmJF,KAAK,OAAO,GAAG;IACb,wBAAwB,EAAE,MAAM,CAAC;CAClC,CAAC;AAGF,eAAO,MAAM,2BAA2B,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAkBtE,CAAC"}
@@ -14,6 +14,7 @@ const inequationParser_1 = require("../../../../tree/parsers/inequationParser");
14
14
  const intervalParser_1 = require("../../../../tree/parsers/intervalParser");
15
15
  const coinFlip_1 = require("../../../../utils/alea/coinFlip");
16
16
  const shuffle_1 = require("../../../../utils/alea/shuffle");
17
+ const handleVEAError_1 = require("../../../../utils/errors/handleVEAError");
17
18
  /**ax+b<cx+d */
18
19
  const getInstruction = (identifiers) => {
19
20
  const { ineqType, a, b, c, d } = identifiers;
@@ -108,7 +109,7 @@ const isAnswerValid = (ans, { answer, a, b, c, d, ineqType }, opts) => {
108
109
  }
109
110
  }
110
111
  catch (err) {
111
- return false;
112
+ return (0, handleVEAError_1.handleVEAError)(err);
112
113
  }
113
114
  };
114
115
  const options = [inequationSolutionFormat_1.inequationSolutionFormat];
@@ -1 +1 @@
1
- {"version":3,"file":"squareFunctionInequation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/inequations/squareFunctionInequation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAWT,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,gBAAgB,EAGjB,MAAM,mCAAmC,CAAC;AAe3C,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,gBAAgB,EAAE,gBAAgB,CAAC;CACpC,CAAC;AAqFF,eAAO,MAAM,wBAAwB,EAAE,QAAQ,CAAC,WAAW,CAgB1D,CAAC"}
1
+ {"version":3,"file":"squareFunctionInequation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/inequations/squareFunctionInequation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAWT,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,gBAAgB,EAGjB,MAAM,mCAAmC,CAAC;AAgB3C,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,gBAAgB,EAAE,gBAAgB,CAAC;CACpC,CAAC;AAqFF,eAAO,MAAM,wBAAwB,EAAE,QAAQ,CAAC,WAAW,CAgB1D,CAAC"}
@@ -12,6 +12,7 @@ const closure_1 = require("../../../../tree/nodes/sets/closure");
12
12
  const intervalNode_1 = require("../../../../tree/nodes/sets/intervalNode");
13
13
  const unionIntervalParser_1 = require("../../../../tree/parsers/unionIntervalParser");
14
14
  const coinFlip_1 = require("../../../../utils/alea/coinFlip");
15
+ const handleVEAError_1 = require("../../../../utils/errors/handleVEAError");
15
16
  const getAnswer = (identifiers) => {
16
17
  const { k, inequationSymbol } = identifiers;
17
18
  const sqrtTree = (0, sqrtNode_1.sqrt)(k).simplify();
@@ -66,7 +67,7 @@ const isAnswerValid = (ans, { answer, k, inequationSymbol }) => {
66
67
  return "S=\\ " + parsed.simplify().toTex() === answer;
67
68
  }
68
69
  catch (err) {
69
- return false;
70
+ return (0, handleVEAError_1.handleVEAError)(err);
70
71
  }
71
72
  };
72
73
  exports.squareFunctionInequation = {
@@ -1 +1 @@
1
- {"version":3,"file":"distributeAndSimplify.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/simplifying/distributeAndSimplify.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,0BAA0B,CAAC;AAQlC,KAAK,WAAW,GAAG;IACjB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AA2DF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,WAAW,CAcvD,CAAC"}
1
+ {"version":3,"file":"distributeAndSimplify.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/simplifying/distributeAndSimplify.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,0BAA0B,CAAC;AAUlC,KAAK,WAAW,GAAG;IACjB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AA+EF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,WAAW,CAcvD,CAAC"}
@@ -7,9 +7,32 @@ const affine_1 = require("../../../../math/polynomials/affine");
7
7
  const randint_1 = require("../../../../math/utils/random/randint");
8
8
  const addNode_1 = require("../../../../tree/nodes/operators/addNode");
9
9
  const multiplyNode_1 = require("../../../../tree/nodes/operators/multiplyNode");
10
+ const polynomialParser_1 = require("../../../../tree/parsers/polynomialParser");
10
11
  const coinFlip_1 = require("../../../../utils/alea/coinFlip");
12
+ const handleVEAError_1 = require("../../../../utils/errors/handleVEAError");
11
13
  //[a]|[b*(cx+d)] +- e*(fx+g)]
12
14
  // c & f > 0
15
+ const getStatementNode = (identifiers) => {
16
+ const { firstTermIsAffine, a, b, c, d, e, f, g } = identifiers;
17
+ const statement = new addNode_1.AddNode(firstTermIsAffine
18
+ ? new multiplyNode_1.MultiplyNode(b.toTree(), new affine_1.Affine(c, d).toTree())
19
+ : a.toTree(), new multiplyNode_1.MultiplyNode(e.toTree(), new affine_1.Affine(f, g).toTree()));
20
+ return statement;
21
+ };
22
+ const getInstruction = (identifiers) => {
23
+ return `Développer et réduire :
24
+
25
+ $$
26
+ ${getStatementNode(identifiers).toTex()}
27
+ $$`;
28
+ };
29
+ const getAnswer = (identifiers) => {
30
+ const { firstTermIsAffine, a, b, c, d, e, f, g } = identifiers;
31
+ const answer = firstTermIsAffine
32
+ ? new affine_1.Affine(b * c + e * f, b * d + e * g).toTree().toTex()
33
+ : new affine_1.Affine(e * f, a + e * g).toTree().toTex();
34
+ return answer;
35
+ };
13
36
  const getDistributeAndSimplifyQuestion = () => {
14
37
  const firstTermIsAffine = (0, coinFlip_1.coinFlip)();
15
38
  const a = (0, randint_1.randint)(-5, 6, [0]);
@@ -22,18 +45,13 @@ const getDistributeAndSimplifyQuestion = () => {
22
45
  f = (0, randint_1.randint)(1, 6);
23
46
  } while (b * c + e * f === 0);
24
47
  const g = (0, randint_1.randint)(-5, 6, [0]);
25
- const statement = new addNode_1.AddNode(firstTermIsAffine
26
- ? new multiplyNode_1.MultiplyNode(b.toTree(), new affine_1.Affine(c, d).toTree())
27
- : a.toTree(), new multiplyNode_1.MultiplyNode(e.toTree(), new affine_1.Affine(f, g).toTree())).simplify();
28
- const answer = firstTermIsAffine
29
- ? new affine_1.Affine(b * c + e * f, b * d + e * g).toTree().toTex()
30
- : new affine_1.Affine(e * f, a + e * g).toTree().toTex();
48
+ const identifiers = { firstTermIsAffine, a, b, c, d, e, f, g };
31
49
  const question = {
32
- answer,
33
- instruction: `Développer et réduire : $${statement.toTex()}$`,
50
+ answer: getAnswer(identifiers),
51
+ instruction: getInstruction(identifiers),
34
52
  keys: ["x"],
35
53
  answerFormat: "tex",
36
- identifiers: { firstTermIsAffine, a, b, c, d, e, f, g },
54
+ identifiers,
37
55
  };
38
56
  return question;
39
57
  };
@@ -46,23 +64,27 @@ const getPropositions = (n, { answer }) => {
46
64
  return (0, exercise_1.shuffleProps)(propositions, n);
47
65
  };
48
66
  const isAnswerValid = (ans, { answer, firstTermIsAffine, a, b, c, d, e, f, g }) => {
49
- const answerNode = firstTermIsAffine
50
- ? new affine_1.Affine(b * c + e * f, b * d + e * g).toTree()
51
- : new affine_1.Affine(e * f, a + e * g).toTree();
52
- const texs = answerNode.toAllValidTexs();
53
- return texs.includes(ans);
67
+ try {
68
+ const parsed = (0, polynomialParser_1.polynomialParser)(ans);
69
+ if (!parsed)
70
+ return false;
71
+ return parsed.simplify().toTex() === answer;
72
+ }
73
+ catch (err) {
74
+ return (0, handleVEAError_1.handleVEAError)(err);
75
+ }
54
76
  };
55
77
  exports.distributeAndSimplify = {
56
78
  id: "distributeAndSimplify",
57
79
  connector: "=",
58
80
  label: "Développer et réduire une expression",
59
- levels: ["4ème", "3ème", "2nde"],
60
81
  isSingleStep: true,
61
- sections: ["Calcul littéral"],
62
82
  generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getDistributeAndSimplifyQuestion, nb),
63
83
  qcmTimer: 60,
64
84
  freeTimer: 60,
65
85
  getPropositions,
66
86
  isAnswerValid,
67
87
  subject: "Mathématiques",
88
+ getAnswer,
89
+ getInstruction,
68
90
  };
@@ -1,8 +1,8 @@
1
1
  import { Exercise } from "../../../../exercises/exercise";
2
2
  type Identifiers = {
3
- rand: number;
4
- polynome1Coeffs: number[];
5
- polynome2Coeffs: number[];
3
+ variable: string;
4
+ coeffs: number[][];
5
+ order: number[];
6
6
  };
7
7
  export declare const reduceExpression: Exercise<Identifiers>;
8
8
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"reduceExpression.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/simplifying/reduceExpression.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAQT,MAAM,0BAA0B,CAAC;AAQlC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,eAAe,EAAE,MAAM,EAAE,CAAC;CAC3B,CAAC;AAiHF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,WAAW,CAalD,CAAC"}
1
+ {"version":3,"file":"reduceExpression.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/simplifying/reduceExpression.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,0BAA0B,CAAC;AAkBlC,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,MAAM,CAAC;IAOjB,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC;IAGnB,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB,CAAC;AA+MF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,WAAW,CAgBlD,CAAC"}