math-exercises 3.0.49 → 3.0.51

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 (174) hide show
  1. package/lib/exercises/math/calcul/addAndSubWithoutRelatives.d.ts.map +1 -1
  2. package/lib/exercises/math/calcul/fractions/fractionsOperations.js +2 -2
  3. package/lib/exercises/math/calcul/mentalCaluls/mentalAddAndSub.js +1 -1
  4. package/lib/exercises/math/calcul/mentalCaluls/mentalMultiplications.js +1 -1
  5. package/lib/exercises/math/calcul/operations/expressionNature.d.ts.map +1 -1
  6. package/lib/exercises/math/calcul/operations/expressionNature.js +6 -12
  7. package/lib/exercises/math/calcul/operations/operationsPriorities.d.ts.map +1 -1
  8. package/lib/exercises/math/calcul/operations/operationsPriorities.js +5 -6
  9. package/lib/exercises/math/calcul/operations/operationsPrioritiesParenthesis.js +1 -2
  10. package/lib/exercises/math/calcul/operations/operationsPrioritiesParenthesisNoRelatives.d.ts.map +1 -1
  11. package/lib/exercises/math/calcul/operations/operationsPrioritiesParenthesisNoRelatives.js +1 -2
  12. package/lib/exercises/math/calcul/operations/operationsPrioritiesWithoutRelative.d.ts.map +1 -1
  13. package/lib/exercises/math/calcul/operations/operationsPrioritiesWithoutRelative.js +1 -2
  14. package/lib/exercises/math/calcul/ordering/decimalOrdering.d.ts.map +1 -1
  15. package/lib/exercises/math/calcul/ordering/decimalOrdering.js +0 -2
  16. package/lib/exercises/math/calcul/proportionality/proportionalityTable.d.ts.map +1 -1
  17. package/lib/exercises/math/calcul/proportionality/proportionalityTable.js +6 -0
  18. package/lib/exercises/math/calcul/proportionality/proportionalityTableCoefficient.d.ts.map +1 -1
  19. package/lib/exercises/math/calcul/proportionality/proportionalityTableCoefficient.js +33 -3
  20. package/lib/exercises/math/calculLitteral/index.d.ts +1 -0
  21. package/lib/exercises/math/calculLitteral/index.d.ts.map +1 -1
  22. package/lib/exercises/math/calculLitteral/index.js +1 -0
  23. package/lib/exercises/math/calculLitteral/isolate/index.d.ts +2 -0
  24. package/lib/exercises/math/calculLitteral/isolate/index.d.ts.map +1 -0
  25. package/lib/exercises/math/calculLitteral/isolate/index.js +2 -0
  26. package/lib/exercises/math/calculLitteral/isolate/isolateVariable.d.ts +2 -0
  27. package/lib/exercises/math/calculLitteral/isolate/isolateVariable.d.ts.map +1 -0
  28. package/lib/exercises/math/calculLitteral/isolate/isolateVariable.js +147 -0
  29. package/lib/exercises/math/calculLitteral/simplifying/reduceExpression.d.ts.map +1 -1
  30. package/lib/exercises/math/derivation/derivative/lnDerivativeThree.d.ts.map +1 -1
  31. package/lib/exercises/math/derivation/derivative/rootFunctionDerivative.d.ts.map +1 -1
  32. package/lib/exercises/math/derivation/derivative/rootFunctionDerivative.js +1 -1
  33. package/lib/exercises/math/equaDiff/equaDiffCheckSolutionFirstOrder.d.ts.map +1 -1
  34. package/lib/exercises/math/functions/affines/affineExpressionReading.d.ts.map +1 -1
  35. package/lib/exercises/math/functions/affines/signFunction.d.ts.map +1 -1
  36. package/lib/exercises/math/functions/basics/inverseImageFunction.d.ts.map +1 -1
  37. package/lib/exercises/math/functions/basics/inverseImageFunction.js +16 -3
  38. package/lib/exercises/math/functions/exponential/expSimplifiying.d.ts.map +1 -1
  39. package/lib/exercises/math/functions/exponential/expSimplifiying.js +1 -2
  40. package/lib/exercises/math/functions/trinoms/equation/secondDegreeInequation.d.ts.map +1 -1
  41. package/lib/exercises/math/functions/trinoms/equation/solveSecondDegreeEquationFromCano.d.ts.map +1 -1
  42. package/lib/exercises/math/functions/trinoms/roots/rootsFromFactorizedForm.d.ts.map +1 -1
  43. package/lib/exercises/math/functions/trinoms/roots/rootsFromFactorizedForm.js +10 -0
  44. package/lib/exercises/math/functions/trinoms/summitAndCanonical/summitAbscissFromDevForm.d.ts.map +1 -1
  45. package/lib/exercises/math/functions/trinoms/summitAndCanonical/summitAbscissFromDevForm.js +31 -16
  46. package/lib/exercises/math/functions/trinoms/summitAndCanonical/summitAbscissFromRoots.d.ts.map +1 -1
  47. package/lib/exercises/math/functions/trinoms/summitAndCanonical/summitAbscissFromRoots.js +50 -14
  48. package/lib/exercises/math/geometry/cartesian/directionVectorEquation.d.ts +1 -0
  49. package/lib/exercises/math/geometry/cartesian/directionVectorEquation.d.ts.map +1 -1
  50. package/lib/exercises/math/geometry/cartesian/directionVectorEquation.js +48 -40
  51. package/lib/exercises/math/geometry/lines/isPointOnLine.js +1 -1
  52. package/lib/exercises/math/geometry/lines/linesRelativePositions.d.ts.map +1 -1
  53. package/lib/exercises/math/geometry/lines/linesRelativePositions.js +0 -2
  54. package/lib/exercises/math/geometry/vectors/scalarProduct/angleFromScalarProduct.d.ts +8 -0
  55. package/lib/exercises/math/geometry/vectors/scalarProduct/angleFromScalarProduct.d.ts.map +1 -0
  56. package/lib/exercises/math/geometry/vectors/scalarProduct/angleFromScalarProduct.js +93 -0
  57. package/lib/exercises/math/geometry/vectors/scalarProduct/findCoordinatesToOrthogonalize.d.ts +9 -0
  58. package/lib/exercises/math/geometry/vectors/scalarProduct/findCoordinatesToOrthogonalize.d.ts.map +1 -0
  59. package/lib/exercises/math/geometry/vectors/scalarProduct/findCoordinatesToOrthogonalize.js +111 -0
  60. package/lib/exercises/math/geometry/vectors/scalarProduct/index.d.ts +3 -0
  61. package/lib/exercises/math/geometry/vectors/scalarProduct/index.d.ts.map +1 -1
  62. package/lib/exercises/math/geometry/vectors/scalarProduct/index.js +3 -0
  63. package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductIdentities.d.ts +10 -0
  64. package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductIdentities.d.ts.map +1 -0
  65. package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductIdentities.js +174 -0
  66. package/lib/exercises/math/geometry/vectors/vectorLinearCombination.js +2 -2
  67. package/lib/exercises/math/primitive/constantPrimitive.d.ts.map +1 -1
  68. package/lib/exercises/math/primitive/constantPrimitive.js +22 -5
  69. package/lib/exercises/math/primitive/expUPrimitive.d.ts.map +1 -1
  70. package/lib/exercises/math/primitive/expUPrimitive.js +25 -7
  71. package/lib/exercises/math/primitive/exponentialPrimitive.d.ts.map +1 -1
  72. package/lib/exercises/math/primitive/exponentialPrimitive.js +23 -5
  73. package/lib/exercises/math/primitive/index.d.ts +2 -0
  74. package/lib/exercises/math/primitive/index.d.ts.map +1 -1
  75. package/lib/exercises/math/primitive/index.js +2 -0
  76. package/lib/exercises/math/primitive/kexpUPrimitive.d.ts +9 -0
  77. package/lib/exercises/math/primitive/kexpUPrimitive.d.ts.map +1 -0
  78. package/lib/exercises/math/primitive/kexpUPrimitive.js +130 -0
  79. package/lib/exercises/math/primitive/klogUPrimitive.d.ts +9 -0
  80. package/lib/exercises/math/primitive/klogUPrimitive.d.ts.map +1 -0
  81. package/lib/exercises/math/primitive/klogUPrimitive.js +120 -0
  82. package/lib/exercises/math/primitive/logarithmePrimitive.d.ts.map +1 -1
  83. package/lib/exercises/math/primitive/logarithmePrimitive.js +30 -18
  84. package/lib/exercises/math/primitive/polynomialPrimitive.d.ts.map +1 -1
  85. package/lib/exercises/math/primitive/polynomialPrimitive.js +0 -11
  86. package/lib/exercises/math/primitive/sinCosPrimitive.d.ts.map +1 -1
  87. package/lib/exercises/math/primitive/sinUCosUPrimitive.d.ts.map +1 -1
  88. package/lib/exercises/math/primitive/sinUCosUPrimitive.js +33 -18
  89. package/lib/exercises/math/probaStat/ballsBasicProbas.d.ts.map +1 -1
  90. package/lib/exercises/math/probaStat/ballsBasicProbas.js +28 -4
  91. package/lib/exercises/math/probaStat/basicStats/calculateFrequency.d.ts +4 -1
  92. package/lib/exercises/math/probaStat/basicStats/calculateFrequency.d.ts.map +1 -1
  93. package/lib/exercises/math/probaStat/basicStats/calculateFrequency.js +43 -18
  94. package/lib/exercises/math/squareRoots/squareRootIdentities.d.ts.map +1 -1
  95. package/lib/index.d.ts +20 -1
  96. package/lib/index.d.ts.map +1 -1
  97. package/lib/math/geometry/spaceVector.d.ts +1 -2
  98. package/lib/math/geometry/spaceVector.d.ts.map +1 -1
  99. package/lib/math/geometry/vector.d.ts +8 -0
  100. package/lib/math/geometry/vector.d.ts.map +1 -1
  101. package/lib/math/geometry/vector.js +12 -1
  102. package/lib/math/numbers/decimals/decimal.d.ts.map +1 -1
  103. package/lib/math/numbers/integer/integer.d.ts.map +1 -1
  104. package/lib/math/numbers/integer/power.d.ts.map +1 -1
  105. package/lib/math/numbers/nombre.d.ts.map +1 -1
  106. package/lib/math/numbers/rationals/rational.d.ts.map +1 -1
  107. package/lib/math/numbers/reals/real.d.ts.map +1 -1
  108. package/lib/math/polynomials/polynomial.d.ts.map +1 -1
  109. package/lib/math/sequences/sequence.d.ts +3 -3
  110. package/lib/math/sequences/sequence.d.ts.map +1 -1
  111. package/lib/playground.d.ts.map +1 -1
  112. package/lib/playground.js +8 -0
  113. package/lib/prototypesEnhancement.d.ts.map +1 -1
  114. package/lib/tree/nodes/complex/complexNode.d.ts.map +1 -1
  115. package/lib/tree/nodes/equations/equalNode.d.ts +14 -8
  116. package/lib/tree/nodes/equations/equalNode.d.ts.map +1 -1
  117. package/lib/tree/nodes/equations/equalNode.js +126 -6
  118. package/lib/tree/nodes/equations/equationSolutionNode.d.ts +8 -2
  119. package/lib/tree/nodes/equations/equationSolutionNode.d.ts.map +1 -1
  120. package/lib/tree/nodes/equations/equationSolutionNode.js +14 -0
  121. package/lib/tree/nodes/equations/multiEqualNode.d.ts +7 -1
  122. package/lib/tree/nodes/equations/multiEqualNode.d.ts.map +1 -1
  123. package/lib/tree/nodes/equations/multiEqualNode.js +14 -0
  124. package/lib/tree/nodes/functions/arccosNode.d.ts +1 -0
  125. package/lib/tree/nodes/functions/arccosNode.d.ts.map +1 -1
  126. package/lib/tree/nodes/functions/arccosNode.js +4 -0
  127. package/lib/tree/nodes/functions/integralNode.d.ts +8 -3
  128. package/lib/tree/nodes/functions/integralNode.d.ts.map +1 -1
  129. package/lib/tree/nodes/functions/integralNode.js +14 -0
  130. package/lib/tree/nodes/geometry/pointNode.d.ts +8 -2
  131. package/lib/tree/nodes/geometry/pointNode.d.ts.map +1 -1
  132. package/lib/tree/nodes/geometry/pointNode.js +14 -0
  133. package/lib/tree/nodes/geometry/vectorNode.d.ts +8 -2
  134. package/lib/tree/nodes/geometry/vectorNode.d.ts.map +1 -1
  135. package/lib/tree/nodes/geometry/vectorNode.js +14 -0
  136. package/lib/tree/nodes/hasVariableNode.d.ts +1 -1
  137. package/lib/tree/nodes/hasVariableNode.d.ts.map +1 -1
  138. package/lib/tree/nodes/hasVariableNode.js +4 -4
  139. package/lib/tree/nodes/inequations/inequationNode.d.ts +8 -3
  140. package/lib/tree/nodes/inequations/inequationNode.d.ts.map +1 -1
  141. package/lib/tree/nodes/inequations/inequationNode.js +14 -0
  142. package/lib/tree/nodes/inequations/inequationSolutionNode.d.ts +8 -2
  143. package/lib/tree/nodes/inequations/inequationSolutionNode.d.ts.map +1 -1
  144. package/lib/tree/nodes/inequations/inequationSolutionNode.js +14 -0
  145. package/lib/tree/nodes/nodeConstructor.d.ts.map +1 -1
  146. package/lib/tree/nodes/numbers/percentNode.d.ts +10 -3
  147. package/lib/tree/nodes/numbers/percentNode.d.ts.map +1 -1
  148. package/lib/tree/nodes/numbers/percentNode.js +17 -1
  149. package/lib/tree/nodes/operators/addNode.d.ts +1 -1
  150. package/lib/tree/nodes/operators/addNode.d.ts.map +1 -1
  151. package/lib/tree/nodes/operators/addNode.js +2 -1
  152. package/lib/tree/nodes/operators/divideNode.d.ts +1 -1
  153. package/lib/tree/nodes/operators/divideNode.d.ts.map +1 -1
  154. package/lib/tree/nodes/operators/divideNode.js +1 -2
  155. package/lib/tree/nodes/operators/multiplyNode.d.ts +1 -1
  156. package/lib/tree/nodes/operators/multiplyNode.d.ts.map +1 -1
  157. package/lib/tree/nodes/operators/multiplyNode.js +2 -1
  158. package/lib/tree/nodes/operators/operatorNode.d.ts +1 -1
  159. package/lib/tree/nodes/operators/operatorNode.d.ts.map +1 -1
  160. package/lib/tree/nodes/operators/scalarProductNode.d.ts.map +1 -1
  161. package/lib/tree/nodes/operators/substractNode.d.ts +2 -1
  162. package/lib/tree/nodes/operators/substractNode.d.ts.map +1 -1
  163. package/lib/tree/nodes/operators/substractNode.js +4 -3
  164. package/lib/tree/nodes/sets/belongsNode.d.ts +11 -5
  165. package/lib/tree/nodes/sets/belongsNode.d.ts.map +1 -1
  166. package/lib/tree/nodes/sets/belongsNode.js +14 -0
  167. package/lib/tree/parsers/affineParser.d.ts.map +1 -1
  168. package/lib/tree/parsers/affineParser.js +0 -1
  169. package/lib/tree/parsers/equationSolutionParser.d.ts +1 -1
  170. package/lib/tree/parsers/equationSolutionParser.d.ts.map +1 -1
  171. package/lib/tree/parsers/vectorParser.d.ts +3 -0
  172. package/lib/tree/parsers/vectorParser.d.ts.map +1 -0
  173. package/lib/tree/parsers/vectorParser.js +13 -0
  174. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"addAndSubWithoutRelatives.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/calcul/addAndSubWithoutRelatives.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,QAAQ,EAQT,MAAM,mBAAmB,CAAC;AA4C3B,KAAK,WAAW,GAAG;IAAE,OAAO,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC;AAoBzC,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,WAAW,CAc3D,CAAC"}
1
+ {"version":3,"file":"addAndSubWithoutRelatives.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/calcul/addAndSubWithoutRelatives.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,QAAQ,EAQT,MAAM,mBAAmB,CAAC;AA4C3B,KAAK,WAAW,GAAG;IAAE,OAAO,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC;AAoBzC,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,WAAW,CAc3D,CAAC"}
@@ -47,12 +47,12 @@ const getFractionsOperationsQuestion = (ops) => {
47
47
  RationalConstructor.randomIrreductible().toTree(),
48
48
  RationalConstructor.randomIrreductible().toTree(),
49
49
  ];
50
- const statement = firstOp(secondOp(rationals[0], rationals[1]), rationals[2]);
50
+ let statement = firstOp(secondOp(rationals[0], rationals[1]), rationals[2]);
51
51
  //éviter division par une soustraction qui donne 0
52
52
  if (firstOpIndex !== 3 ||
53
53
  secondOpIndex !== 1 ||
54
54
  rationals[0].evaluate() - rationals[1].evaluate() !== 0) {
55
- statement.shuffle();
55
+ statement = statement.shuffle();
56
56
  }
57
57
  const ids = statement.toIdentifiers();
58
58
  const identifiers = {
@@ -27,7 +27,7 @@ const getMentalAddAndSub = () => {
27
27
  let statementTree = new AddNode(allNumbersNodes[0], allNumbersNodes[1]);
28
28
  for (let i = 2; i < nbrOperations; i++)
29
29
  statementTree = new AddNode(statementTree, allNumbersNodes[i]);
30
- statementTree.shuffle();
30
+ statementTree = statementTree.shuffle();
31
31
  const statement = statementTree.toTex();
32
32
  const answer = (round(sum, 2) + "").replace(".", ",");
33
33
  const question = {
@@ -36,7 +36,7 @@ const getMentalMultiplications = () => {
36
36
  statementTree = new MultiplyNode(allNumbersNodes[0], new MultiplyNode(allNumbersNodes[1], allNumbersNodes[2]));
37
37
  answer = numbers[0] * numbers[1] * numbers[2];
38
38
  }
39
- statementTree.shuffle();
39
+ statementTree = statementTree.shuffle();
40
40
  const statementTex = statementTree.toTex();
41
41
  const answerTex = round(answer, 2).frenchify();
42
42
  const question = {
@@ -1 +1 @@
1
- {"version":3,"file":"expressionNature.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/operations/expressionNature.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAUT,MAAM,6BAA6B,CAAC;AAarC,KAAK,WAAW,GAAG;IAAE,OAAO,EAAE,GAAG,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAoLnE,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,WAAW,CAgBlD,CAAC"}
1
+ {"version":3,"file":"expressionNature.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/operations/expressionNature.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAUT,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IAAE,OAAO,EAAE,GAAG,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAoLnE,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,WAAW,CAgBlD,CAAC"}
@@ -24,8 +24,7 @@ const getExpressionNatureQuestion = () => {
24
24
  switch (subType) {
25
25
  case 1:
26
26
  //ab+c
27
- node = new AddNode(new MultiplyNode(a, b), c);
28
- node.shuffle();
27
+ node = new AddNode(new MultiplyNode(a, b), c).shuffle();
29
28
  break;
30
29
  case 2:
31
30
  //ab + cd
@@ -33,13 +32,11 @@ const getExpressionNatureQuestion = () => {
33
32
  break;
34
33
  case 3:
35
34
  //a/b + c
36
- node = new AddNode(new DivideNode(a, b), c);
37
- node.shuffle();
35
+ node = new AddNode(new DivideNode(a, b), c).shuffle();
38
36
  break;
39
37
  case 4:
40
38
  //ab + c/d
41
- node = new AddNode(new MultiplyNode(a, b), new DivideNode(c, d));
42
- node.shuffle();
39
+ node = new AddNode(new MultiplyNode(a, b), new DivideNode(c, d)).shuffle();
43
40
  break;
44
41
  case 5:
45
42
  //a/b + c/d
@@ -84,13 +81,11 @@ const getExpressionNatureQuestion = () => {
84
81
  switch (subType) {
85
82
  case 1:
86
83
  //(a+b)*c
87
- node = new MultiplyNode(new AddNode(a, b), c);
88
- node.shuffle();
84
+ node = new MultiplyNode(new AddNode(a, b), c).shuffle();
89
85
  break;
90
86
  case 2:
91
87
  //(a-b)*c
92
- node = new MultiplyNode(new SubstractNode(a, b), c);
93
- node.shuffle();
88
+ node = new MultiplyNode(new SubstractNode(a, b), c).shuffle();
94
89
  break;
95
90
  case 3:
96
91
  //(a+b)(c+d)
@@ -98,8 +93,7 @@ const getExpressionNatureQuestion = () => {
98
93
  break;
99
94
  case 4:
100
95
  //(a+b)(c-d)
101
- node = new MultiplyNode(new AddNode(a, b), new SubstractNode(c, d));
102
- node.shuffle();
96
+ node = new MultiplyNode(new AddNode(a, b), new SubstractNode(c, d)).shuffle();
103
97
  break;
104
98
  case 5:
105
99
  //(a-b)(c-d)
@@ -1 +1 @@
1
- {"version":3,"file":"operationsPriorities.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/operations/operationsPriorities.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,QAAQ,EAQT,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACvB,CAAC;AAmJF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAatD,CAAC"}
1
+ {"version":3,"file":"operationsPriorities.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/operations/operationsPriorities.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,QAAQ,EAQT,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACvB,CAAC;AAkJF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAatD,CAAC"}
@@ -29,7 +29,7 @@ const getPriorityQuestions = () => {
29
29
  new AddNode(new MultiplyNode(new NumberNode(a), new NumberNode(b)), new AddNode(new NumberNode(c), new NumberNode(d)))
30
30
  : //a*b middle
31
31
  new AddNode(new AddNode(new NumberNode(c), new MultiplyNode(new NumberNode(a), new NumberNode(b))), new NumberNode(d));
32
- statement.shuffle();
32
+ statement = statement.shuffle();
33
33
  startStatement = statement.toTex();
34
34
  answer = (a * b + c + d).toString();
35
35
  break;
@@ -41,7 +41,7 @@ const getPriorityQuestions = () => {
41
41
  new AddNode(new DivideNode(new NumberNode(a), new NumberNode(b)), new AddNode(new NumberNode(c), new NumberNode(d)))
42
42
  : //a/b middle
43
43
  new AddNode(new AddNode(new NumberNode(c), new DivideNode(new NumberNode(a), new NumberNode(b))), new NumberNode(d));
44
- statement.shuffle();
44
+ statement = statement.shuffle();
45
45
  startStatement = statement.toTex();
46
46
  answer = (a / b + c + d).toString();
47
47
  break;
@@ -56,7 +56,7 @@ const getPriorityQuestions = () => {
56
56
  d = randint(-10, 11, [0]);
57
57
  c = d * randint(0, 11);
58
58
  statement = new AddNode(new MultiplyNode(new NumberNode(a), new NumberNode(b)), new DivideNode(new NumberNode(c), new NumberNode(d)));
59
- statement.shuffle();
59
+ statement = statement.shuffle();
60
60
  startStatement = statement.toTex();
61
61
  answer = (a * b + c / d).toString();
62
62
  break;
@@ -71,7 +71,7 @@ const getPriorityQuestions = () => {
71
71
  case 6: // a*b*c ± d
72
72
  [a, b, c, d] = [1, 2, 3, 4].map((el) => randint(-10, 11, [0]));
73
73
  statement = new AddNode(new MultiplyNode(new MultiplyNode(new NumberNode(a), new NumberNode(b)), new NumberNode(c)), new NumberNode(d));
74
- statement.shuffle();
74
+ statement = statement.shuffle();
75
75
  startStatement = statement.toTex();
76
76
  answer = (a * b * c + d).toString();
77
77
  break;
@@ -79,8 +79,7 @@ const getPriorityQuestions = () => {
79
79
  b = randint(2, 10);
80
80
  a = b * randint(2, 10);
81
81
  c = randint(2, 10);
82
- statement = new MultiplyNode(new DivideNode(a.toTree(), b.toTree()), c.toTree());
83
- statement.shuffle();
82
+ statement = new MultiplyNode(new DivideNode(a.toTree(), b.toTree()), c.toTree()).shuffle();
84
83
  answer = ((a / b) * c).frenchify();
85
84
  startStatement = statement.toTex();
86
85
  break;
@@ -15,8 +15,7 @@ const getOperationsPrioritiesParenthesisQuestion = () => {
15
15
  case 1: //a*(b+-c)
16
16
  a = randint(-10, 11, [0, 1, -1]);
17
17
  [b, c] = [1, 2].map((el) => randint(-10, 11, [0]));
18
- statement = new MultiplyNode(a.toTree(), new AddNode(b.toTree(), c.toTree()), { forceTimesSign: true });
19
- statement.shuffle();
18
+ statement = new MultiplyNode(a.toTree(), new AddNode(b.toTree(), c.toTree()), { forceTimesSign: true }).shuffle();
20
19
  answer = (a * (b + c)).frenchify();
21
20
  break;
22
21
  case 2: //a/(b+-c) ou (b+-c)/a
@@ -1 +1 @@
1
- {"version":3,"file":"operationsPrioritiesParenthesisNoRelatives.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/operations/operationsPrioritiesParenthesisNoRelatives.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAUT,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,GAAG,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAoIF,eAAO,MAAM,0CAA0C,EAAE,QAAQ,CAAC,WAAW,CAkB1E,CAAC"}
1
+ {"version":3,"file":"operationsPrioritiesParenthesisNoRelatives.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/operations/operationsPrioritiesParenthesisNoRelatives.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAUT,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,GAAG,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAmIF,eAAO,MAAM,0CAA0C,EAAE,QAAQ,CAAC,WAAW,CAkB1E,CAAC"}
@@ -16,8 +16,7 @@ const getOperationsPrioritiesParenthesisNoRelativesQuestion = () => {
16
16
  a = randint(2, 11);
17
17
  b = randint(1, 11);
18
18
  c = randint(-b, 11, [0]);
19
- statement = new MultiplyNode(a.toTree(), new AddNode(b.toTree(), c.toTree()));
20
- statement.shuffle();
19
+ statement = new MultiplyNode(a.toTree(), new AddNode(b.toTree(), c.toTree())).shuffle();
21
20
  answer = (a * (b + c)).frenchify();
22
21
  break;
23
22
  case 2: //a/(b+-c) ou (b+-c)/a
@@ -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,EAQT,MAAM,6BAA6B,CAAC;AAWrC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAiSF,eAAO,MAAM,mCAAmC,EAAE,QAAQ,CAAC,WAAW,CAcrE,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,EAQT,MAAM,6BAA6B,CAAC;AAWrC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAgSF,eAAO,MAAM,mCAAmC,EAAE,QAAQ,CAAC,WAAW,CAcrE,CAAC"}
@@ -162,8 +162,7 @@ const getOperationsPrioritiesWithoutRelative = () => {
162
162
  b = randint(2, 10);
163
163
  a = b * randint(2, 10);
164
164
  c = randint(2, 10);
165
- statement = new MultiplyNode(new DivideNode(a.toTree(), b.toTree()), c.toTree());
166
- statement.shuffle();
165
+ statement = new MultiplyNode(new DivideNode(a.toTree(), b.toTree()), c.toTree()).shuffle();
167
166
  answer = ((a / b) * c).frenchify();
168
167
  startStatement = statement.toTex();
169
168
  break;
@@ -1 +1 @@
1
- {"version":3,"file":"decimalOrdering.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/ordering/decimalOrdering.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAUT,MAAM,6BAA6B,CAAC;AAMrC,KAAK,WAAW,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAgE1D,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,WAAW,CAejD,CAAC"}
1
+ {"version":3,"file":"decimalOrdering.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/ordering/decimalOrdering.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAUT,MAAM,6BAA6B,CAAC;AAMrC,KAAK,WAAW,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAgE1D,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,WAAW,CAajD,CAAC"}
@@ -63,9 +63,7 @@ export const decimalOrdering = {
63
63
  id: "decimalOrdering",
64
64
  connector: "\\iff",
65
65
  label: "Comparer des nombres décimaux",
66
- levels: [],
67
66
  isSingleStep: true,
68
- sections: [],
69
67
  generator: (nb) => getDistinctQuestions(getDecimalOrderingQuestion, nb),
70
68
  qcmTimer: 60,
71
69
  freeTimer: 60,
@@ -1 +1 @@
1
- {"version":3,"file":"proportionalityTable.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/proportionality/proportionalityTable.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAWT,MAAM,6BAA6B,CAAC;AASrC,KAAK,WAAW,GAAG;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;CACrB,CAAC;AA0FF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAgBtD,CAAC"}
1
+ {"version":3,"file":"proportionalityTable.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/proportionality/proportionalityTable.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AASrC,KAAK,WAAW,GAAG;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;CACrB,CAAC;AAiGF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAgBtD,CAAC"}
@@ -53,6 +53,12 @@ const getProportionalityTable = () => {
53
53
  const identifiers = { x1, x2, x3, x4, randQuation };
54
54
  return getQuestionFromIdentifiers(identifiers);
55
55
  };
56
+ const getHint = () => {
57
+ return ``;
58
+ };
59
+ const getCorrection = () => {
60
+ return ``;
61
+ };
56
62
  const getQuestionFromIdentifiers = (identifiers) => {
57
63
  const question = {
58
64
  instruction: getInstruction(identifiers),
@@ -1 +1 @@
1
- {"version":3,"file":"proportionalityTableCoefficient.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/proportionality/proportionalityTableCoefficient.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,6BAA6B,CAAC;AAQrC,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AAuDF,eAAO,MAAM,+BAA+B,EAAE,QAAQ,CAAC,WAAW,CAejE,CAAC"}
1
+ {"version":3,"file":"proportionalityTableCoefficient.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/proportionality/proportionalityTableCoefficient.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAWrC,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AAiFF,eAAO,MAAM,+BAA+B,EAAE,QAAQ,CAAC,WAAW,CAgBjE,CAAC"}
@@ -2,7 +2,10 @@ import { addValidProp, tryToAddWrongProp, } from "../../../../exercises/exercise
2
2
  import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
3
  import { IntegerConstructor } from "../../../../math/numbers/integer/integer.js";
4
4
  import { randint } from "../../../../math/utils/random/randint.js";
5
+ import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
6
+ import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
5
7
  import { shuffle } from "../../../../utils/alea/shuffle.js";
8
+ import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
6
9
  import { dollarize } from "../../../../utils/latex/dollarize.js";
7
10
  import { mdTable } from "../../../../utils/markdown/mdTable.js";
8
11
  const getInstruction = ({ xValues, yValues }) => {
@@ -16,19 +19,39 @@ ${dataTable}
16
19
 
17
20
  Calculer le coefficient de proportionnalité.`;
18
21
  };
22
+ const getAnswer = (identifiers) => {
23
+ const factor = identifiers.yValues[1] / identifiers.xValues[1];
24
+ const answer = factor.toTree().toTex();
25
+ return answer;
26
+ };
27
+ const getHint = (identifiers) => {
28
+ return `Le coefficient de proportionnalité est le nomber par lequel on multiplie les valeurs de la première ligne pour obtenir les valeurs de la deuxième ligne.`;
29
+ };
30
+ const getCorrection = (identifiers) => {
31
+ const { xValues, yValues } = identifiers;
32
+ const factor = yValues[1] / xValues[1];
33
+ return `Le coefficient de proportionnalité est le nomber par lequel on multiplie les valeurs de la première ligne pour obtenir les valeurs de la deuxième ligne.
34
+
35
+ Pour l'obtenir, on divise une valeur de la deuxième ligne par la valeur correspondante dans la première ligne, par exemple :
36
+
37
+ $$
38
+ ${frac(xValues[0], yValues[0]).toSimplificationTex()}
39
+ $$`;
40
+ };
19
41
  const getProportionalityTableCoefficient = () => {
20
42
  const factor = randint(2, 15);
21
43
  const xValues = IntegerConstructor.randomDifferents(1, 100 / factor, 3).sort((a, b) => a - b);
22
44
  const yValues = xValues.map((x) => x * factor);
23
- const answer = factor.toTree().toTex();
24
45
  const identifiers = { xValues, yValues };
25
46
  const question = {
26
47
  instruction: getInstruction(identifiers),
27
- answer,
48
+ answer: getAnswer(identifiers),
28
49
  keys: [],
29
50
  answerFormat: "tex",
30
51
  identifiers,
31
52
  style: { tableHasNoHeader: true },
53
+ hint: getHint(identifiers),
54
+ correction: getCorrection(identifiers),
32
55
  };
33
56
  return question;
34
57
  };
@@ -41,7 +64,13 @@ const getPropositions = (n, { answer }) => {
41
64
  return shuffle(propositions);
42
65
  };
43
66
  const isAnswerValid = (ans, { answer }) => {
44
- return ans === answer;
67
+ try {
68
+ const parsed = parseAlgebraic(ans);
69
+ return parsed.simplify().toTex() === answer;
70
+ }
71
+ catch (err) {
72
+ return handleVEAError(err);
73
+ }
45
74
  };
46
75
  export const proportionalityTableCoefficient = {
47
76
  id: "proportionalityTableCoefficient",
@@ -57,4 +86,5 @@ export const proportionalityTableCoefficient = {
57
86
  isAnswerValid,
58
87
  subject: "Mathématiques",
59
88
  getInstruction,
89
+ hasHintAndCorrection: true,
60
90
  };
@@ -4,4 +4,5 @@ export * from "./factorisation/index.js";
4
4
  export * from "./inequations/index.js";
5
5
  export * from "./simplifying/index.js";
6
6
  export * from "./systems/index.js";
7
+ export * from "./isolate/index.js";
7
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/calculLitteral/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/calculLitteral/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC"}
@@ -4,3 +4,4 @@ export * from "./factorisation/index.js";
4
4
  export * from "./inequations/index.js";
5
5
  export * from "./simplifying/index.js";
6
6
  export * from "./systems/index.js";
7
+ export * from "./isolate/index.js";
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/isolate/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ // export * from "./isolateVariable.js";
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=isolateVariable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isolateVariable.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/isolate/isolateVariable.ts"],"names":[],"mappings":""}
@@ -0,0 +1,147 @@
1
+ // import {
2
+ // Exercise,
3
+ // Proposition,
4
+ // QCMGenerator,
5
+ // Question,
6
+ // QuestionGenerator,
7
+ // VEA,
8
+ // addValidProp,
9
+ // shuffleProps,
10
+ // GetAnswer,
11
+ // GetHint,
12
+ // GetCorrection,
13
+ // GetInstruction,
14
+ // GetKeys,
15
+ // GetQuestionFromIdentifiers,
16
+ // } from "../../../../exercises/exercise.js";
17
+ // import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
18
+ // import { GeneralAffine } from "../../../../math/polynomials/generalAffine.js";
19
+ // import { randint } from "../../../../math/utils/random/randint.js";
20
+ // import { AlgebraicNode } from "../../../../tree/nodes/algebraicNode.js";
21
+ // import {
22
+ // EqualNode,
23
+ // EqualNodeConstructor,
24
+ // EqualNodeIdentifiers,
25
+ // } from "../../../../tree/nodes/equations/equalNode.js";
26
+ // import { opposite } from "../../../../tree/nodes/functions/oppositeNode.js";
27
+ // import { reifyAlgebraic } from "../../../../tree/nodes/nodeConstructor.js";
28
+ // import { add } from "../../../../tree/nodes/operators/addNode.js";
29
+ // import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
30
+ // import { coinFlip } from "../../../../utils/alea/coinFlip.js";
31
+ // import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
32
+ export {};
33
+ // type Identifiers = {
34
+ // eqNodeIds: EqualNodeIdentifiers;
35
+ // type: number;
36
+ // };
37
+ // //1. x+a = b (plus ou moins, droite ou gauche)
38
+ // //2. ax + b = c (plus ou moins, droite ou gauche)
39
+ // //3. a/x = b , a +b/x =c, x num ou denum
40
+ // //4. ax / b = c
41
+ // //5. x(a+b)=c
42
+ // //6. x*a*b = c ou xa = bc
43
+ // //7. x+a / b =c/ d (x+a) place aléatire , pm
44
+ // //8. (x+a)/b = c
45
+ // const getPropositions: QCMGenerator<Identifiers> = (n, { answer }) => {
46
+ // const propositions: Proposition[] = [];
47
+ // addValidProp(propositions, answer);
48
+ // while (propositions.length < n) {
49
+ // throw Error("QCM not implemented");
50
+ // }
51
+ // return shuffleProps(propositions, n);
52
+ // };
53
+ // const getAnswer: GetAnswer<Identifiers> = (identifiers) => {
54
+ // const { type, eqNodeIds } = identifiers;
55
+ // const eq = EqualNodeConstructor.fromIdentifiers(eqNodeIds);
56
+ // // return "";
57
+ // return eq.isolate("x").toTex();
58
+ // };
59
+ // const getInstruction: GetInstruction<Identifiers> = (identifiers) => {
60
+ // const { type, eqNodeIds } = identifiers;
61
+ // const eq = reifyAlgebraic(eqNodeIds);
62
+ // return `Isoler $x$ dans l'égalité suivante :
63
+ // $$
64
+ // ${eq.toTex()}
65
+ // $$`;
66
+ // };
67
+ // // const getHint : GetHint<Identifiers> = (identifiers)=>{
68
+ // // }
69
+ // // const getCorrection : GetCorrection<Identifiers> = (identifiers)=>{
70
+ // // }
71
+ // const getKeys: GetKeys<Identifiers> = (identifiers) => {
72
+ // return ["x", "a", "b", "c", "d"];
73
+ // };
74
+ // const isAnswerValid: VEA<Identifiers> = (ans, { answer }) => {
75
+ // try {
76
+ // throw Error("VEA not implemented");
77
+ // } catch (err) {
78
+ // return handleVEAError(err);
79
+ // }
80
+ // };
81
+ // const getIsolateVariableQuestion: QuestionGenerator<Identifiers> = (ops) => {
82
+ // //1. x+a = b (plus ou moins, droite ou gauche)
83
+ // //2. ax + b = c (plus ou moins, droite ou gauche)
84
+ // //3. a/x = b , a +b/x =c, x num ou denum
85
+ // //4. ax / b = c
86
+ // //5. x(a+b)=c
87
+ // //6. x*a*b = c ou xa = bc
88
+ // //7. x+a / b =c/ d (x+a) place aléatire , pm
89
+ // //8. (x+a)/b = c
90
+ // const type = randint(0, 8);
91
+ // const x = "x".toTree();
92
+ // const a = "a".toTree();
93
+ // const b = "b".toTree();
94
+ // const c = "c".toTree();
95
+ // const d = "d".toTree();
96
+ // const signify = (x: AlgebraicNode) => (coinFlip() ? x : opposite(x));
97
+ // let eqNode: EqualNode;
98
+ // switch (type) {
99
+ // case 1:
100
+ // let n = add(signify(x), signify(a)).shuffle();
101
+ // eqNode = new EqualNode(n, b).shuffle();
102
+ // break;
103
+ // case 2:
104
+ // default:
105
+ // eqNode = new EqualNode(
106
+ // add(multiply(signify(a), x), signify(b)).shuffle(),
107
+ // signify(c),
108
+ // ).shuffle();
109
+ // break;
110
+ // }
111
+ // const identifiers: Identifiers = {
112
+ // type,
113
+ // eqNodeIds: eqNode.toIdentifiers(),
114
+ // };
115
+ // return getQuestionFromIdentifiers(identifiers);
116
+ // };
117
+ // const getQuestionFromIdentifiers: GetQuestionFromIdentifiers<Identifiers> = (
118
+ // identifiers,
119
+ // ) => {
120
+ // return {
121
+ // answer: getAnswer(identifiers),
122
+ // instruction: getInstruction(identifiers),
123
+ // keys: getKeys(identifiers),
124
+ // answerFormat: "tex",
125
+ // identifiers,
126
+ // // hint: getHint(identifiers),
127
+ // // correction: getCorrection(identifiers)
128
+ // };
129
+ // };
130
+ // export const isolateVariable: Exercise<Identifiers> = {
131
+ // id: "isolateVariable",
132
+ // connector: "\\iff",
133
+ // label: "Isoler une variable",
134
+ // isSingleStep: true,
135
+ // generator: (nb, opts) =>
136
+ // getDistinctQuestions(() => getIsolateVariableQuestion(opts), nb),
137
+ // qcmTimer: 60,
138
+ // freeTimer: 60,
139
+ // getPropositions,
140
+ // isAnswerValid,
141
+ // subject: "Mathématiques",
142
+ // getInstruction,
143
+ // // getHint,
144
+ // // getCorrection,
145
+ // getAnswer,
146
+ // getQuestionFromIdentifiers,
147
+ // };
@@ -1 +1 @@
1
- {"version":3,"file":"reduceExpression.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/simplifying/reduceExpression.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAmBrC,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,MAAM,CAAC;IAOjB,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC;IAGnB,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB,CAAC;AAqOF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,WAAW,CAkBlD,CAAC"}
1
+ {"version":3,"file":"reduceExpression.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/simplifying/reduceExpression.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAkBrC,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,MAAM,CAAC;IAOjB,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC;IAGnB,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB,CAAC;AAqOF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,WAAW,CAkBlD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"lnDerivativeThree.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivative/lnDerivativeThree.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAgBrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AA8GF,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,WAAW,CAgBnD,CAAC"}
1
+ {"version":3,"file":"lnDerivativeThree.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivative/lnDerivativeThree.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAcrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AA8GF,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,WAAW,CAgBnD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"rootFunctionDerivative.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivative/rootFunctionDerivative.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAoBrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AA+FF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,CAiBxD,CAAC"}
1
+ {"version":3,"file":"rootFunctionDerivative.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivative/rootFunctionDerivative.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAYrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AA+FF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,CAiBxD,CAAC"}
@@ -4,7 +4,7 @@ import { randint } from "../../../../math/utils/random/randint.js";
4
4
  import { round } from "../../../../math/utils/round.js";
5
5
  import { sqrt } from "../../../../tree/nodes/functions/sqrtNode.js";
6
6
  import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
7
- import { multiply, } from "../../../../tree/nodes/operators/multiplyNode.js";
7
+ import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
8
8
  import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
9
9
  import { shuffle } from "../../../../utils/alea/shuffle.js";
10
10
  import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
@@ -1 +1 @@
1
- {"version":3,"file":"equaDiffCheckSolutionFirstOrder.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/equaDiff/equaDiffCheckSolutionFirstOrder.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,6BAA6B,CAAC;AAgBrC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACvB,CAAC;AAkHF,eAAO,MAAM,+BAA+B,EAAE,QAAQ,CAAC,WAAW,CAejE,CAAC"}
1
+ {"version":3,"file":"equaDiffCheckSolutionFirstOrder.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/equaDiff/equaDiffCheckSolutionFirstOrder.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,6BAA6B,CAAC;AAerC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACvB,CAAC;AAkHF,eAAO,MAAM,+BAA+B,EAAE,QAAQ,CAAC,WAAW,CAejE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"affineExpressionReading.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/affines/affineExpressionReading.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAiBrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB,CAAC;AAiIF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,WAAW,CAezD,CAAC"}
1
+ {"version":3,"file":"affineExpressionReading.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/affines/affineExpressionReading.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAgBrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB,CAAC;AAiIF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,WAAW,CAezD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"signFunction.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/affines/signFunction.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAoBrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,cAAc,EAAE,OAAO,CAAC;CACzB,CAAC;AAgIF,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,WAAW,CAqB9C,CAAC"}
1
+ {"version":3,"file":"signFunction.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/affines/signFunction.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAmBrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,cAAc,EAAE,OAAO,CAAC;CACzB,CAAC;AAgIF,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,WAAW,CAqB9C,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"inverseImageFunction.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/basics/inverseImageFunction.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAQrC,KAAK,WAAW,GAAG;IAIjB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AA4GF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAoBtD,CAAC"}
1
+ {"version":3,"file":"inverseImageFunction.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/basics/inverseImageFunction.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAWrC,KAAK,WAAW,GAAG;IAIjB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAuHF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAkBtD,CAAC"}
@@ -1,11 +1,13 @@
1
1
  import { addValidProp, 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 { AffineConstructor } from "../../../../math/polynomials/affine.js";
4
5
  import { Polynomial } from "../../../../math/polynomials/polynomial.js";
5
6
  import { randint } from "../../../../math/utils/random/randint.js";
6
7
  import { equationResolutionTex } from "../../../../tree/nodes/equations/equalNode.js";
7
8
  import { add } from "../../../../tree/nodes/operators/addNode.js";
8
9
  import { shuffle } from "../../../../utils/alea/shuffle.js";
10
+ import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
9
11
  const rebuildIdentifiers = (oldIds) => {
10
12
  if (oldIds.coeffs?.length)
11
13
  return oldIds;
@@ -94,15 +96,26 @@ const getPropositions = (n, { answer, coeffs, yValue }) => {
94
96
  return shuffle(propositions);
95
97
  };
96
98
  const isAnswerValid = (ans, { answer }) => {
97
- return [answer, answer.split("=")[1]].includes(ans);
99
+ try {
100
+ const formated = ans.split("=").filter(Boolean);
101
+ if (formated.length === 2) {
102
+ return (formated[0] === "x" && numberVEA(formated[1], answer.split("=")[1]));
103
+ }
104
+ else if (formated.length === 1) {
105
+ return numberVEA(formated[0], answer.split("=")[1]);
106
+ }
107
+ else
108
+ return false;
109
+ }
110
+ catch (err) {
111
+ return handleVEAError(err);
112
+ }
98
113
  };
99
114
  export const inverseImageFunction = {
100
115
  id: "inverseImageFunction",
101
116
  connector: "\\iff",
102
117
  getPropositions,
103
118
  label: "Calculer des antécédents",
104
- levels: ["3ème", "2nde", "CAP", "2ndPro", "1rePro", "1reTech"],
105
- sections: ["Fonctions"],
106
119
  isSingleStep: true,
107
120
  generator: (nb) => getDistinctQuestions(getInverseImageFunction, nb),
108
121
  qcmTimer: 60,
@@ -1 +1 @@
1
- {"version":3,"file":"expSimplifiying.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/exponential/expSimplifiying.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAQT,MAAM,6BAA6B,CAAC;AAarC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AAmIF,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,WAAW,CAajD,CAAC"}
1
+ {"version":3,"file":"expSimplifiying.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/exponential/expSimplifiying.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAQT,MAAM,6BAA6B,CAAC;AAarC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AAkIF,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,WAAW,CAajD,CAAC"}
@@ -26,8 +26,7 @@ const getExpSimplifiying = () => {
26
26
  //e^u * e^v
27
27
  u = new Polynomial([randint(-9, 10), randint(-9, 10, [0])]);
28
28
  v = new Polynomial([randint(-9, 10), randint(-9, 10, [0])]);
29
- expression = new MultiplyNode(new ExpNode(u.toTree()), new ExpNode(v.toTree()));
30
- expression.shuffle();
29
+ expression = new MultiplyNode(new ExpNode(u.toTree()), new ExpNode(v.toTree())).shuffle();
31
30
  answer = new ExpNode(u.add(v).toTree()).toTex();
32
31
  break;
33
32
  case 3:
@@ -1 +1 @@
1
- {"version":3,"file":"secondDegreeInequation.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/equation/secondDegreeInequation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,6BAA6B,CAAC;AAErC,OAAO,EACL,gBAAgB,EAGjB,MAAM,sCAAsC,CAAC;AAiB9C,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,QAAQ,EAAE,gBAAgB,CAAC;CAC5B,CAAC;AAwHF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,CAexD,CAAC"}
1
+ {"version":3,"file":"secondDegreeInequation.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/equation/secondDegreeInequation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,6BAA6B,CAAC;AAErC,OAAO,EACL,gBAAgB,EAGjB,MAAM,sCAAsC,CAAC;AAgB9C,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,QAAQ,EAAE,gBAAgB,CAAC;CAC5B,CAAC;AAwHF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,CAexD,CAAC"}