math-exercises 3.0.48 → 3.0.50

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 (189) hide show
  1. package/lib/exercises/math/calcul/addAndSub.d.ts +7 -1
  2. package/lib/exercises/math/calcul/addAndSub.d.ts.map +1 -1
  3. package/lib/exercises/math/calcul/addAndSub.js +26 -14
  4. package/lib/exercises/math/calcul/addAndSubWithoutRelatives.d.ts.map +1 -1
  5. package/lib/exercises/math/calcul/operations/expressionNature.d.ts.map +1 -1
  6. package/lib/exercises/math/calcul/ordering/decimalOrdering.d.ts.map +1 -1
  7. package/lib/exercises/math/calcul/ordering/decimalOrdering.js +0 -2
  8. package/lib/exercises/math/calcul/proportionality/proportionalityTable.d.ts.map +1 -1
  9. package/lib/exercises/math/calcul/proportionality/proportionalityTable.js +6 -0
  10. package/lib/exercises/math/calcul/proportionality/proportionalityTableCoefficient.d.ts.map +1 -1
  11. package/lib/exercises/math/calcul/proportionality/proportionalityTableCoefficient.js +33 -3
  12. package/lib/exercises/math/calculLitteral/factorisation/factoIdRmq1.d.ts.map +1 -1
  13. package/lib/exercises/math/calculLitteral/factorisation/factoIdRmq2.d.ts.map +1 -1
  14. package/lib/exercises/math/calculLitteral/factorisation/factoIdRmq3.d.ts.map +1 -1
  15. package/lib/exercises/math/calculLitteral/index.d.ts +1 -0
  16. package/lib/exercises/math/calculLitteral/index.d.ts.map +1 -1
  17. package/lib/exercises/math/calculLitteral/index.js +1 -0
  18. package/lib/exercises/math/calculLitteral/isolate/index.d.ts +2 -0
  19. package/lib/exercises/math/calculLitteral/isolate/index.d.ts.map +1 -0
  20. package/lib/exercises/math/calculLitteral/isolate/index.js +2 -0
  21. package/lib/exercises/math/calculLitteral/isolate/isolateVariable.d.ts +2 -0
  22. package/lib/exercises/math/calculLitteral/isolate/isolateVariable.d.ts.map +1 -0
  23. package/lib/exercises/math/calculLitteral/isolate/isolateVariable.js +83 -0
  24. package/lib/exercises/math/calculLitteral/simplifying/reduceExpression.d.ts.map +1 -1
  25. package/lib/exercises/math/derivation/derivative/lnDerivativeThree.d.ts.map +1 -1
  26. package/lib/exercises/math/derivation/derivative/rootFunctionDerivative.d.ts.map +1 -1
  27. package/lib/exercises/math/derivation/derivative/rootFunctionDerivative.js +1 -1
  28. package/lib/exercises/math/equaDiff/equaDiffCheckSolutionFirstOrder.d.ts.map +1 -1
  29. package/lib/exercises/math/functions/affines/affineExpressionReading.d.ts.map +1 -1
  30. package/lib/exercises/math/functions/affines/affineExpressionReading.js +0 -1
  31. package/lib/exercises/math/functions/affines/index.d.ts +0 -1
  32. package/lib/exercises/math/functions/affines/index.d.ts.map +1 -1
  33. package/lib/exercises/math/functions/affines/index.js +0 -1
  34. package/lib/exercises/math/functions/affines/signFunction.d.ts.map +1 -1
  35. package/lib/exercises/math/functions/basics/inverseImageFunction.d.ts.map +1 -1
  36. package/lib/exercises/math/functions/basics/inverseImageFunction.js +16 -3
  37. package/lib/exercises/math/functions/trinoms/equation/secondDegreeInequation.d.ts.map +1 -1
  38. package/lib/exercises/math/functions/trinoms/equation/solveSecondDegreeEquationFromCano.d.ts.map +1 -1
  39. package/lib/exercises/math/functions/trinoms/roots/rootsFromFactorizedForm.d.ts.map +1 -1
  40. package/lib/exercises/math/functions/trinoms/roots/rootsFromFactorizedForm.js +10 -0
  41. package/lib/exercises/math/functions/trinoms/summitAndCanonical/summitAbscissFromDevForm.d.ts.map +1 -1
  42. package/lib/exercises/math/functions/trinoms/summitAndCanonical/summitAbscissFromDevForm.js +31 -16
  43. package/lib/exercises/math/functions/trinoms/summitAndCanonical/summitAbscissFromRoots.d.ts.map +1 -1
  44. package/lib/exercises/math/functions/trinoms/summitAndCanonical/summitAbscissFromRoots.js +50 -14
  45. package/lib/exercises/math/geometry/cartesian/directionVectorEquation.d.ts +1 -0
  46. package/lib/exercises/math/geometry/cartesian/directionVectorEquation.d.ts.map +1 -1
  47. package/lib/exercises/math/geometry/cartesian/directionVectorEquation.js +48 -40
  48. package/lib/exercises/math/geometry/lines/cartesianEquationToReduced.d.ts +10 -0
  49. package/lib/exercises/math/geometry/lines/cartesianEquationToReduced.d.ts.map +1 -0
  50. package/lib/exercises/math/geometry/lines/cartesianEquationToReduced.js +171 -0
  51. package/lib/exercises/math/geometry/lines/findPointOnLineWithCartesianEquation.d.ts +9 -0
  52. package/lib/exercises/math/geometry/lines/findPointOnLineWithCartesianEquation.d.ts.map +1 -0
  53. package/lib/exercises/math/geometry/lines/findPointOnLineWithCartesianEquation.js +146 -0
  54. package/lib/exercises/math/geometry/lines/findPointOnLineWithReductEquation.d.ts +8 -0
  55. package/lib/exercises/math/geometry/lines/findPointOnLineWithReductEquation.d.ts.map +1 -0
  56. package/lib/exercises/math/geometry/lines/findPointOnLineWithReductEquation.js +99 -0
  57. package/lib/exercises/math/geometry/lines/index.d.ts +5 -0
  58. package/lib/exercises/math/geometry/lines/index.d.ts.map +1 -1
  59. package/lib/exercises/math/geometry/lines/index.js +5 -0
  60. package/lib/exercises/math/geometry/lines/isPointOnCartesianLine.d.ts +13 -0
  61. package/lib/exercises/math/geometry/lines/isPointOnCartesianLine.d.ts.map +1 -0
  62. package/lib/exercises/math/geometry/lines/isPointOnCartesianLine.js +118 -0
  63. package/lib/exercises/math/geometry/lines/isPointOnLine.d.ts +11 -0
  64. package/lib/exercises/math/geometry/lines/isPointOnLine.d.ts.map +1 -0
  65. package/lib/exercises/math/geometry/lines/isPointOnLine.js +94 -0
  66. package/lib/exercises/math/geometry/lines/linesRelativePositions.d.ts.map +1 -1
  67. package/lib/exercises/math/geometry/lines/linesRelativePositions.js +0 -2
  68. package/lib/exercises/math/geometry/vectors/scalarProduct/angleFromScalarProduct.d.ts +8 -0
  69. package/lib/exercises/math/geometry/vectors/scalarProduct/angleFromScalarProduct.d.ts.map +1 -0
  70. package/lib/exercises/math/geometry/vectors/scalarProduct/angleFromScalarProduct.js +93 -0
  71. package/lib/exercises/math/geometry/vectors/scalarProduct/findCoordinatesToOrthogonalize.d.ts +9 -0
  72. package/lib/exercises/math/geometry/vectors/scalarProduct/findCoordinatesToOrthogonalize.d.ts.map +1 -0
  73. package/lib/exercises/math/geometry/vectors/scalarProduct/findCoordinatesToOrthogonalize.js +111 -0
  74. package/lib/exercises/math/geometry/vectors/scalarProduct/index.d.ts +3 -0
  75. package/lib/exercises/math/geometry/vectors/scalarProduct/index.d.ts.map +1 -1
  76. package/lib/exercises/math/geometry/vectors/scalarProduct/index.js +3 -0
  77. package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductIdentities.d.ts +10 -0
  78. package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductIdentities.d.ts.map +1 -0
  79. package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductIdentities.js +174 -0
  80. package/lib/exercises/math/geometry/vectors/vectorLinearCombination.js +2 -2
  81. package/lib/exercises/math/primitive/constantPrimitive.d.ts.map +1 -1
  82. package/lib/exercises/math/primitive/constantPrimitive.js +22 -5
  83. package/lib/exercises/math/primitive/expUPrimitive.d.ts.map +1 -1
  84. package/lib/exercises/math/primitive/expUPrimitive.js +25 -7
  85. package/lib/exercises/math/primitive/exponentialPrimitive.d.ts.map +1 -1
  86. package/lib/exercises/math/primitive/exponentialPrimitive.js +23 -5
  87. package/lib/exercises/math/primitive/index.d.ts +2 -0
  88. package/lib/exercises/math/primitive/index.d.ts.map +1 -1
  89. package/lib/exercises/math/primitive/index.js +2 -0
  90. package/lib/exercises/math/primitive/kexpUPrimitive.d.ts +9 -0
  91. package/lib/exercises/math/primitive/kexpUPrimitive.d.ts.map +1 -0
  92. package/lib/exercises/math/primitive/kexpUPrimitive.js +130 -0
  93. package/lib/exercises/math/primitive/klogUPrimitive.d.ts +9 -0
  94. package/lib/exercises/math/primitive/klogUPrimitive.d.ts.map +1 -0
  95. package/lib/exercises/math/primitive/klogUPrimitive.js +120 -0
  96. package/lib/exercises/math/primitive/logarithmePrimitive.d.ts.map +1 -1
  97. package/lib/exercises/math/primitive/logarithmePrimitive.js +30 -18
  98. package/lib/exercises/math/primitive/polynomialPrimitive.d.ts.map +1 -1
  99. package/lib/exercises/math/primitive/polynomialPrimitive.js +0 -11
  100. package/lib/exercises/math/primitive/sinCosPrimitive.d.ts.map +1 -1
  101. package/lib/exercises/math/primitive/sinUCosUPrimitive.d.ts.map +1 -1
  102. package/lib/exercises/math/primitive/sinUCosUPrimitive.js +33 -18
  103. package/lib/exercises/math/probaStat/ballsBasicProbas.d.ts.map +1 -1
  104. package/lib/exercises/math/probaStat/ballsBasicProbas.js +28 -4
  105. package/lib/exercises/math/probaStat/probabilityTree.d.ts.map +1 -1
  106. package/lib/exercises/math/probaStat/stats1var/etendueList.d.ts.map +1 -1
  107. package/lib/exercises/math/probaStat/stats1var/etendueList.js +46 -14
  108. package/lib/exercises/math/squareRoots/squareRootIdentities.d.ts.map +1 -1
  109. package/lib/index.d.ts +45 -7
  110. package/lib/index.d.ts.map +1 -1
  111. package/lib/math/geometry/spaceVector.d.ts +1 -2
  112. package/lib/math/geometry/spaceVector.d.ts.map +1 -1
  113. package/lib/math/geometry/vector.d.ts +8 -0
  114. package/lib/math/geometry/vector.d.ts.map +1 -1
  115. package/lib/math/geometry/vector.js +12 -1
  116. package/lib/math/numbers/decimals/decimal.d.ts.map +1 -1
  117. package/lib/math/numbers/integer/integer.d.ts.map +1 -1
  118. package/lib/math/numbers/integer/power.d.ts.map +1 -1
  119. package/lib/math/numbers/nombre.d.ts.map +1 -1
  120. package/lib/math/numbers/rationals/rational.d.ts.map +1 -1
  121. package/lib/math/numbers/reals/real.d.ts.map +1 -1
  122. package/lib/math/polynomials/polynomial.d.ts.map +1 -1
  123. package/lib/math/sequences/geometricSequence.js +2 -2
  124. package/lib/math/sequences/sequence.d.ts +3 -3
  125. package/lib/math/sequences/sequence.d.ts.map +1 -1
  126. package/lib/playground.d.ts.map +1 -1
  127. package/lib/playground.js +4 -6
  128. package/lib/prototypesEnhancement.d.ts.map +1 -1
  129. package/lib/tree/nodes/algebraicNode.d.ts +0 -1
  130. package/lib/tree/nodes/algebraicNode.d.ts.map +1 -1
  131. package/lib/tree/nodes/complex/complexNode.d.ts.map +1 -1
  132. package/lib/tree/nodes/equations/equalNode.d.ts +14 -8
  133. package/lib/tree/nodes/equations/equalNode.d.ts.map +1 -1
  134. package/lib/tree/nodes/equations/equalNode.js +119 -6
  135. package/lib/tree/nodes/equations/equationSolutionNode.d.ts +8 -2
  136. package/lib/tree/nodes/equations/equationSolutionNode.d.ts.map +1 -1
  137. package/lib/tree/nodes/equations/equationSolutionNode.js +14 -0
  138. package/lib/tree/nodes/equations/multiEqualNode.d.ts +7 -1
  139. package/lib/tree/nodes/equations/multiEqualNode.d.ts.map +1 -1
  140. package/lib/tree/nodes/equations/multiEqualNode.js +14 -0
  141. package/lib/tree/nodes/functions/arccosNode.d.ts +1 -0
  142. package/lib/tree/nodes/functions/arccosNode.d.ts.map +1 -1
  143. package/lib/tree/nodes/functions/arccosNode.js +4 -0
  144. package/lib/tree/nodes/functions/integralNode.d.ts +8 -3
  145. package/lib/tree/nodes/functions/integralNode.d.ts.map +1 -1
  146. package/lib/tree/nodes/functions/integralNode.js +14 -0
  147. package/lib/tree/nodes/geometry/pointNode.d.ts +8 -2
  148. package/lib/tree/nodes/geometry/pointNode.d.ts.map +1 -1
  149. package/lib/tree/nodes/geometry/pointNode.js +14 -0
  150. package/lib/tree/nodes/geometry/vectorNode.d.ts +8 -2
  151. package/lib/tree/nodes/geometry/vectorNode.d.ts.map +1 -1
  152. package/lib/tree/nodes/geometry/vectorNode.js +14 -0
  153. package/lib/tree/nodes/inequations/inequationNode.d.ts +8 -3
  154. package/lib/tree/nodes/inequations/inequationNode.d.ts.map +1 -1
  155. package/lib/tree/nodes/inequations/inequationNode.js +14 -0
  156. package/lib/tree/nodes/inequations/inequationSolutionNode.d.ts +8 -2
  157. package/lib/tree/nodes/inequations/inequationSolutionNode.d.ts.map +1 -1
  158. package/lib/tree/nodes/inequations/inequationSolutionNode.js +14 -0
  159. package/lib/tree/nodes/node.d.ts +1 -0
  160. package/lib/tree/nodes/node.d.ts.map +1 -1
  161. package/lib/tree/nodes/nodeConstructor.d.ts.map +1 -1
  162. package/lib/tree/nodes/numbers/numberNode.d.ts.map +1 -1
  163. package/lib/tree/nodes/numbers/numberNode.js +4 -1
  164. package/lib/tree/nodes/numbers/percentNode.d.ts +10 -3
  165. package/lib/tree/nodes/numbers/percentNode.d.ts.map +1 -1
  166. package/lib/tree/nodes/numbers/percentNode.js +17 -1
  167. package/lib/tree/nodes/operators/addNode.d.ts.map +1 -1
  168. package/lib/tree/nodes/operators/fractionNode.d.ts.map +1 -1
  169. package/lib/tree/nodes/operators/fractionNode.js +14 -25
  170. package/lib/tree/nodes/operators/multiplyNode.d.ts.map +1 -1
  171. package/lib/tree/nodes/operators/multiplyNode.js +7 -1
  172. package/lib/tree/nodes/operators/scalarProductNode.d.ts.map +1 -1
  173. package/lib/tree/nodes/polynomials/monomNode.js +1 -2
  174. package/lib/tree/nodes/sets/belongsNode.d.ts +11 -5
  175. package/lib/tree/nodes/sets/belongsNode.d.ts.map +1 -1
  176. package/lib/tree/nodes/sets/belongsNode.js +14 -0
  177. package/lib/tree/parsers/affineParser.d.ts.map +1 -1
  178. package/lib/tree/parsers/affineParser.js +0 -1
  179. package/lib/tree/parsers/equationSolutionParser.d.ts +1 -1
  180. package/lib/tree/parsers/equationSolutionParser.d.ts.map +1 -1
  181. package/lib/tree/parsers/pointParser.d.ts +3 -0
  182. package/lib/tree/parsers/pointParser.d.ts.map +1 -0
  183. package/lib/tree/parsers/pointParser.js +13 -0
  184. package/lib/tree/parsers/spacePointParser.d.ts.map +1 -1
  185. package/lib/tree/parsers/spacePointParser.js +2 -0
  186. package/lib/tree/parsers/vectorParser.d.ts +3 -0
  187. package/lib/tree/parsers/vectorParser.d.ts.map +1 -0
  188. package/lib/tree/parsers/vectorParser.js +13 -0
  189. package/package.json +1 -1
@@ -1,7 +1,13 @@
1
1
  import { Exercise } from "../../exercise.js";
2
+ /**
3
+ * a±b±c±d
4
+ */
2
5
  type Identifiers = {
3
6
  numbers: number[];
4
7
  };
5
- export declare const addAndSubExercise: Exercise<Identifiers>;
8
+ type Options = {
9
+ explicitWriting?: boolean;
10
+ };
11
+ export declare const addAndSubExercise: Exercise<Identifiers, Options>;
6
12
  export {};
7
13
  //# sourceMappingURL=addAndSub.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"addAndSub.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/calcul/addAndSub.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,QAAQ,EAWT,MAAM,mBAAmB,CAAC;AAgD3B,KAAK,WAAW,GAAG;IAAE,OAAO,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC;AAkBzC,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,WAAW,CAcnD,CAAC"}
1
+ {"version":3,"file":"addAndSub.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/calcul/addAndSub.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,QAAQ,EAcT,MAAM,mBAAmB,CAAC;AAE3B;;GAEG;AAEH,KAAK,WAAW,GAAG;IAAE,OAAO,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC;AAYzC,KAAK,OAAO,GAAG;IACb,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,CAAC;AAyEF,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAgB5D,CAAC"}
@@ -4,11 +4,17 @@ import { randint } from "../../../math/utils/random/randint.js";
4
4
  import { NumberNode } from "../../../tree/nodes/numbers/numberNode.js";
5
5
  import { AddNode } from "../../../tree/nodes/operators/addNode.js";
6
6
  import { shuffle } from "../../../utils/alea/shuffle.js";
7
- import { addValidProp, tryToAddWrongProp, } from "../../exercise.js";
8
- /**
9
- * a±b±c±d
10
- */
11
- const getStatementNode = (identifiers) => {
7
+ import { GeneratorOptionTarget, GeneratorOptionType, addValidProp, tryToAddWrongProp, } from "../../exercise.js";
8
+ const options = [
9
+ {
10
+ id: "explicitWriting",
11
+ label: "Utiliser l'écriture explicite (parenthèses autour de chaque nombre)",
12
+ target: GeneratorOptionTarget.instruction,
13
+ type: GeneratorOptionType.checkbox,
14
+ defaultValue: false,
15
+ },
16
+ ];
17
+ const getStatementNode = (identifiers, opts) => {
12
18
  const { numbers } = identifiers;
13
19
  const allNumbersNodes = numbers.map((nb) => new NumberNode(nb));
14
20
  let statementTree = new AddNode(allNumbersNodes[0], allNumbersNodes[1]);
@@ -17,14 +23,16 @@ const getStatementNode = (identifiers) => {
17
23
  }
18
24
  return statementTree;
19
25
  };
20
- const getStartStatement = (identifiers) => {
21
- return getStatementNode(identifiers).toTex();
26
+ const getStartStatement = (identifiers, opts) => {
27
+ return getStatementNode(identifiers, opts).toTex({
28
+ explicitNumberWriting: opts?.explicitWriting,
29
+ });
22
30
  };
23
- const getInstruction = (identifiers) => {
31
+ const getInstruction = (identifiers, opts) => {
24
32
  return `Calculer :
25
33
 
26
34
  $$
27
- ${getStartStatement(identifiers)}
35
+ ${getStartStatement(identifiers, opts)}
28
36
  $$`;
29
37
  };
30
38
  const getAnswer = (identifiers) => {
@@ -32,17 +40,20 @@ const getAnswer = (identifiers) => {
32
40
  const answer = numbers.reduce((a, b) => a + b) + "";
33
41
  return answer;
34
42
  };
35
- const getAddAndSubQuestions = () => {
43
+ const getAddAndSubQuestions = (opts) => {
36
44
  const nbOperations = randint(2, 4);
37
45
  const numbers = [];
38
46
  for (let i = 0; i < nbOperations + 1; i++) {
39
47
  numbers.push(randint(-15, 15, [0]));
40
48
  }
49
+ if (numbers.every((n) => n > 0)) {
50
+ numbers[randint(0, numbers.length)] *= -1;
51
+ }
41
52
  const identifiers = { numbers };
42
53
  const question = {
43
- instruction: getInstruction(identifiers),
44
- startStatement: getStartStatement(identifiers),
45
- answer: getAnswer(identifiers),
54
+ instruction: getInstruction(identifiers, opts),
55
+ startStatement: getStartStatement(identifiers, opts),
56
+ answer: getAnswer(identifiers, opts),
46
57
  keys: [],
47
58
  answerFormat: "tex",
48
59
  identifiers,
@@ -67,7 +78,7 @@ export const addAndSubExercise = {
67
78
  connector: "=",
68
79
  label: "Additions et soustractions de nombres entiers",
69
80
  isSingleStep: true,
70
- generator: (nb) => getDistinctQuestions(getAddAndSubQuestions, nb),
81
+ generator: (nb, opts) => getDistinctQuestions(() => getAddAndSubQuestions(opts), nb),
71
82
  qcmTimer: 60,
72
83
  freeTimer: 60,
73
84
  getPropositions,
@@ -76,4 +87,5 @@ export const addAndSubExercise = {
76
87
  getInstruction,
77
88
  getAnswer,
78
89
  getStartStatement,
90
+ options,
79
91
  };
@@ -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"}
@@ -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"}
@@ -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
  };
@@ -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,6BAA6B,CAAC;AAuBrC,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,6BAA6B,CAAC;AAsBrC,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 +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,6BAA6B,CAAC;AAwBrC,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,6BAA6B,CAAC;AAsBrC,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 +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,6BAA6B,CAAC;AAmBrC,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,6BAA6B,CAAC;AAkBrC,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"}
@@ -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,83 @@
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 { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
19
+ export {};
20
+ // type Identifiers = {
21
+ // };
22
+ // //1. x+a = b (plus ou moins, droite ou gauche)
23
+ // //2. ax + b = c (plus ou moins, droite ou gauche)
24
+ // //3. a/x = b
25
+ // //4. ax / b = c
26
+ // const getPropositions: QCMGenerator<Identifiers> = (n, { answer }) => {
27
+ // const propositions: Proposition[] = [];
28
+ // addValidProp(propositions, answer);
29
+ // while (propositions.length < n) {
30
+ // throw Error("QCM not implemented")
31
+ // }
32
+ // return shuffleProps(propositions, n);
33
+ // };
34
+ // const getAnswer : GetAnswer<Identifiers> = (identifiers)=>{
35
+ // }
36
+ // const getInstruction : GetInstruction<Identifiers> = (identifiers)=>{
37
+ // }
38
+ // const getHint : GetHint<Identifiers> = (identifiers)=>{
39
+ // }
40
+ // const getCorrection : GetCorrection<Identifiers> = (identifiers)=>{
41
+ // }
42
+ // const getKeys : GetKeys<Identifiers> = (identifiers)=>{
43
+ // return []
44
+ // }
45
+ // const isAnswerValid: VEA<Identifiers> = (ans, {answer})=>{
46
+ // try {
47
+ // throw Error("VEA not implemented")
48
+ // } catch(err){
49
+ // return handleVEAError(err)
50
+ // }
51
+ // }
52
+ // const getIsolateVariableQuestion: QuestionGenerator<Identifiers> = (ops)=>{
53
+ // const identifiers: Identifiers = {}
54
+ // return getQuestionFromIdentifiers(identifiers);
55
+ // }
56
+ // const getQuestionFromIdentifiers: GetQuestionFromIdentifiers<Identifiers> = (identifiers)=>{
57
+ // return {
58
+ // answer: getAnswer(identifiers),
59
+ // instruction: getInstruction(identifiers),
60
+ // keys: getKeys(identifiers),
61
+ // answerFormat: 'tex',
62
+ // identifiers,
63
+ // hint: getHint(identifiers),
64
+ // correction: getCorrection(identifiers)
65
+ // }
66
+ // }
67
+ // export const isolateVariable: Exercise<Identifiers> = {
68
+ // id: 'isolateVariable',
69
+ // connector: "",
70
+ // label: undefined,
71
+ // isSingleStep: true,
72
+ // generator: (nb, opts) => getDistinctQuestions(()=>getIsolateVariableQuestion(opts), nb),
73
+ // qcmTimer: 60,
74
+ // freeTimer: 60,
75
+ // getPropositions,
76
+ // isAnswerValid,
77
+ // subject: "Mathématiques",
78
+ // getInstruction,
79
+ // getHint,
80
+ // getCorrection,
81
+ // getAnswer,
82
+ // getQuestionFromIdentifiers
83
+ // };
@@ -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;AAkIF,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"}
@@ -90,7 +90,6 @@ const isAnswerValid = (ans, { answer, secondPoint, b }) => {
90
90
  parsed
91
91
  .simplify({
92
92
  forbidFactorize: true,
93
- forceIsolateMonomCoeffs: true,
94
93
  decimalToFractions: true,
95
94
  forceDistributeFractions: true,
96
95
  })
@@ -11,5 +11,4 @@ export * from "./affineAdjustmentRsquared.js";
11
11
  export * from "./affineAdjustmentComplete.js";
12
12
  export * from "./affineMeanValue.js";
13
13
  export * from "./affineExpressionFromTwoImages.js";
14
- export * from "./isPointOnLine.js";
15
14
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/affines/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,iCAAiC,CAAC;AAChD,cAAc,iCAAiC,CAAC;AAChD,cAAc,mBAAmB,CAAC;AAClC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,uBAAuB,CAAC;AACtC,cAAc,iCAAiC,CAAC;AAChD,cAAc,oCAAoC,CAAC;AACnD,cAAc,uBAAuB,CAAC;AACtC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,sBAAsB,CAAC;AACrC,cAAc,oCAAoC,CAAC;AACnD,cAAc,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/affines/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,iCAAiC,CAAC;AAChD,cAAc,iCAAiC,CAAC;AAChD,cAAc,mBAAmB,CAAC;AAClC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,uBAAuB,CAAC;AACtC,cAAc,iCAAiC,CAAC;AAChD,cAAc,oCAAoC,CAAC;AACnD,cAAc,uBAAuB,CAAC;AACtC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,sBAAsB,CAAC;AACrC,cAAc,oCAAoC,CAAC"}
@@ -11,4 +11,3 @@ export * from "./affineAdjustmentRsquared.js";
11
11
  export * from "./affineAdjustmentComplete.js";
12
12
  export * from "./affineMeanValue.js";
13
13
  export * from "./affineExpressionFromTwoImages.js";
14
- export * from "./isPointOnLine.js";
@@ -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":"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"}
@@ -1 +1 @@
1
- {"version":3,"file":"solveSecondDegreeEquationFromCano.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/equation/solveSecondDegreeEquationFromCano.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AAkEF,eAAO,MAAM,iCAAiC,EAAE,QAAQ,CAAC,WAAW,CAcnE,CAAC"}
1
+ {"version":3,"file":"solveSecondDegreeEquationFromCano.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/equation/solveSecondDegreeEquationFromCano.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AAmEF,eAAO,MAAM,iCAAiC,EAAE,QAAQ,CAAC,WAAW,CAcnE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"rootsFromFactorizedForm.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/roots/rootsFromFactorizedForm.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAUT,MAAM,6BAA6B,CAAC;AAYrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAiGF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,WAAW,CAczD,CAAC"}
1
+ {"version":3,"file":"rootsFromFactorizedForm.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/roots/rootsFromFactorizedForm.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAYrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AA4GF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,WAAW,CAczD,CAAC"}
@@ -7,6 +7,16 @@ import { NumberNode } from "../../../../../tree/nodes/numbers/numberNode.js";
7
7
  import { discreteSetParser } from "../../../../../tree/parsers/discreteSetParser.js";
8
8
  import { shuffle } from "../../../../../utils/alea/shuffle.js";
9
9
  import { handleVEAError } from "../../../../../utils/errors/handleVEAError.js";
10
+ const getHint = (identifiers) => {
11
+ return `Un produit est nul si et seulement si un de ses facteurs est nul.
12
+
13
+ Il faut donc trouver les valeurs de $x$ qui rendent un des facteurs nuls.`;
14
+ };
15
+ const getCorrection = (identifiers) => {
16
+ const { a, b, c } = identifiers;
17
+ const trinom = new Trinom(a, b, c);
18
+ return ``;
19
+ };
10
20
  const getInstruction = (identifiers) => {
11
21
  const { a, b, c } = identifiers;
12
22
  const trinom = new Trinom(a, b, c);
@@ -1 +1 @@
1
- {"version":3,"file":"summitAbscissFromDevForm.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/summitAndCanonical/summitAbscissFromDevForm.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAWT,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAgFF,eAAO,MAAM,wBAAwB,EAAE,QAAQ,CAAC,WAAW,CAkB1D,CAAC"}
1
+ {"version":3,"file":"summitAbscissFromDevForm.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/summitAndCanonical/summitAbscissFromDevForm.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAYrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AA+FF,eAAO,MAAM,wBAAwB,EAAE,QAAQ,CAAC,WAAW,CAkB1D,CAAC"}
@@ -1,22 +1,36 @@
1
1
  import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../../exercises/exercise.js";
2
2
  import { getDistinctQuestions } from "../../../../../exercises/utils/getDistinctQuestions.js";
3
3
  import { Rational } from "../../../../../math/numbers/rationals/rational.js";
4
- import { TrinomConstructor } from "../../../../../math/polynomials/trinom.js";
4
+ import { Trinom, TrinomConstructor } from "../../../../../math/polynomials/trinom.js";
5
5
  import { randint } from "../../../../../math/utils/random/randint.js";
6
6
  import { opposite } from "../../../../../tree/nodes/functions/oppositeNode.js";
7
7
  import { frac } from "../../../../../tree/nodes/operators/fractionNode.js";
8
8
  import { multiply } from "../../../../../tree/nodes/operators/multiplyNode.js";
9
+ import { parseAlgebraic } from "../../../../../tree/parsers/latexParser.js";
10
+ import { handleVEAError } from "../../../../../utils/errors/handleVEAError.js";
9
11
  import { alignTex } from "../../../../../utils/latex/alignTex.js";
10
- const getSummitAbscissFromDevFormQuestion = () => {
11
- const trinom = TrinomConstructor.random();
12
+ const getInstruction = (identifiers) => {
13
+ const { a, b, c } = identifiers;
14
+ const trinom = new Trinom(a, b, c);
15
+ return `Soit $f(x) = ${trinom
16
+ .toTree()
17
+ .toTex()}$ une fonction polynôme du second degré.
18
+
19
+ Quelle est l'abscisse du sommet de la parabole représentant $f$ ?`;
20
+ };
21
+ const getAnswer = (identifiers) => {
22
+ const { a, b, c } = identifiers;
23
+ const trinom = new Trinom(a, b, c);
12
24
  const alpha = trinom.getAlphaNode();
13
25
  const answer = alpha.toTex();
26
+ return answer;
27
+ };
28
+ const getSummitAbscissFromDevFormQuestion = () => {
29
+ const trinom = TrinomConstructor.random();
14
30
  const identifiers = { a: trinom.a, b: trinom.b, c: trinom.c };
15
31
  const question = {
16
- answer,
17
- instruction: `Soit $f(x) = ${trinom
18
- .toTree()
19
- .toTex()}$ une fonction polynôme du second degré. Quelle est l'abscisse du sommet de la parabole représentant $f$ ?`,
32
+ answer: getAnswer(identifiers),
33
+ instruction: getInstruction(identifiers),
20
34
  keys: [],
21
35
  answerFormat: "tex",
22
36
  identifiers,
@@ -63,21 +77,20 @@ ${alignTex([
63
77
  ])}
64
78
  `;
65
79
  };
66
- const isAnswerValid = (ans, { a, b, c }) => {
67
- const node = new Rational(-b, 2 * a).simplify().toTree();
68
- const texs = node.toAllValidTexs({
69
- allowFractionToDecimal: true,
70
- allowMinusAnywhereInFraction: true,
71
- });
72
- return texs.includes(ans);
80
+ const isAnswerValid = (ans, { answer, a, b, c }) => {
81
+ try {
82
+ const parsed = parseAlgebraic(ans);
83
+ return parsed.simplify({ decimalToFractions: true }).toTex() === answer;
84
+ }
85
+ catch (err) {
86
+ return handleVEAError(err);
87
+ }
73
88
  };
74
89
  export const summitAbscissFromDevForm = {
75
90
  id: "summitAbscissFromDevForm",
76
91
  connector: "=",
77
92
  label: "Déterminer l'abscisse du sommet d'une parabole en connaissant la forme développée",
78
- levels: ["1rePro", "1reSpé", "1reTech"],
79
93
  isSingleStep: true,
80
- sections: ["Second degré"],
81
94
  generator: (nb) => getDistinctQuestions(getSummitAbscissFromDevFormQuestion, nb),
82
95
  qcmTimer: 60,
83
96
  freeTimer: 60,
@@ -87,4 +100,6 @@ export const summitAbscissFromDevForm = {
87
100
  getHint,
88
101
  getCorrection,
89
102
  subject: "Mathématiques",
103
+ getInstruction,
104
+ getAnswer,
90
105
  };