math-exercises 3.0.56 → 3.0.57

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 (97) hide show
  1. package/lib/exercises/math/calculLitteral/equation/choseOperationToSolveEquation.d.ts.map +1 -1
  2. package/lib/exercises/math/calculLitteral/equation/choseOperationToSolveEquation.js +65 -13
  3. package/lib/exercises/math/calculLitteral/factorisation/factoType1Exercise.d.ts.map +1 -1
  4. package/lib/exercises/math/calculLitteral/factorisation/factoType1Exercise.js +43 -0
  5. package/lib/exercises/math/calculLitteral/systems/basicNiceValuesSystemResolution.d.ts.map +1 -1
  6. package/lib/exercises/math/calculLitteral/systems/basicNiceValuesSystemResolution.js +23 -0
  7. package/lib/exercises/math/calculLitteral/systems/basicSystemResolution.d.ts.map +1 -1
  8. package/lib/exercises/math/calculLitteral/systems/basicSystemResolution.js +23 -0
  9. package/lib/exercises/math/calculLitteral/systems/verifySystemSolution.d.ts.map +1 -1
  10. package/lib/exercises/math/calculLitteral/systems/verifySystemSolution.js +49 -0
  11. package/lib/exercises/math/conversion/capacityConversion.d.ts.map +1 -1
  12. package/lib/exercises/math/conversion/capacityConversion.js +68 -12
  13. package/lib/exercises/math/conversion/hoursToDecimal.d.ts.map +1 -1
  14. package/lib/exercises/math/conversion/hoursToDecimal.js +73 -15
  15. package/lib/exercises/math/conversion/lengthConversion.d.ts.map +1 -1
  16. package/lib/exercises/math/conversion/lengthConversion.js +55 -6
  17. package/lib/exercises/math/conversion/massConversion.d.ts.map +1 -1
  18. package/lib/exercises/math/conversion/massConversion.js +72 -16
  19. package/lib/exercises/math/conversion/volumeConversion.d.ts.map +1 -1
  20. package/lib/exercises/math/conversion/volumeConversion.js +72 -12
  21. package/lib/exercises/math/functions/affines/signFunction.d.ts.map +1 -1
  22. package/lib/exercises/math/functions/affines/signFunction.js +23 -11
  23. package/lib/exercises/math/geometry/cartesian/cartesianEquationOfLine.d.ts.map +1 -1
  24. package/lib/exercises/math/geometry/cartesian/cartesianEquationOfLine.js +12 -5
  25. package/lib/exercises/math/geometry/lines/cartesianEquationToReduced.d.ts.map +1 -1
  26. package/lib/exercises/math/geometry/lines/cartesianEquationToReduced.js +68 -29
  27. package/lib/exercises/math/geometry/lines/cartesianEquationsIntersection.d.ts.map +1 -1
  28. package/lib/exercises/math/geometry/lines/cartesianEquationsIntersection.js +56 -4
  29. package/lib/exercises/math/geometry/lines/drawLineFromCartesianEquation.d.ts.map +1 -1
  30. package/lib/exercises/math/geometry/lines/drawLineFromCartesianEquation.js +71 -25
  31. package/lib/exercises/math/limits/polynomLimit.d.ts +1 -1
  32. package/lib/exercises/math/limits/polynomLimit.d.ts.map +1 -1
  33. package/lib/exercises/math/limits/polynomLimit.js +28 -9
  34. package/lib/exercises/math/limits/polynomLimitNoFI.d.ts +1 -1
  35. package/lib/exercises/math/limits/polynomLimitNoFI.d.ts.map +1 -1
  36. package/lib/exercises/math/limits/polynomLimitNoFI.js +29 -10
  37. package/lib/exercises/math/powers/calculateNegativePower.d.ts.map +1 -1
  38. package/lib/exercises/math/powers/calculateNegativePower.js +59 -16
  39. package/lib/exercises/math/powers/decimalToScientific.d.ts.map +1 -1
  40. package/lib/exercises/math/powers/decimalToScientific.js +55 -11
  41. package/lib/exercises/math/powers/index.d.ts +1 -0
  42. package/lib/exercises/math/powers/index.d.ts.map +1 -1
  43. package/lib/exercises/math/powers/index.js +1 -0
  44. package/lib/exercises/math/powers/powersDivision.d.ts +5 -2
  45. package/lib/exercises/math/powers/powersDivision.d.ts.map +1 -1
  46. package/lib/exercises/math/powers/powersDivision.js +68 -53
  47. package/lib/exercises/math/powers/powersMixOperations.d.ts +1 -0
  48. package/lib/exercises/math/powers/powersMixOperations.d.ts.map +1 -1
  49. package/lib/exercises/math/powers/powersMixOperations.js +88 -17
  50. package/lib/exercises/math/powers/powersOfTenMixOperations.d.ts +10 -0
  51. package/lib/exercises/math/powers/powersOfTenMixOperations.d.ts.map +1 -0
  52. package/lib/exercises/math/powers/powersOfTenMixOperations.js +129 -0
  53. package/lib/exercises/math/powers/powersOfTenToDecimal.d.ts.map +1 -1
  54. package/lib/exercises/math/powers/powersOfTenToDecimal.js +32 -3
  55. package/lib/exercises/math/powers/powersProduct.d.ts.map +1 -1
  56. package/lib/exercises/math/powers/powersProduct.js +1 -0
  57. package/lib/exercises/math/powers/scientificToDecimal.d.ts.map +1 -1
  58. package/lib/exercises/math/powers/scientificToDecimal.js +50 -10
  59. package/lib/exercises/math/primitive/polynomialPrimitive.d.ts.map +1 -1
  60. package/lib/exercises/math/primitive/polynomialPrimitive.js +1 -0
  61. package/lib/exercises/math/sequences/geometric/geometricFirstTermsGeneralSum.d.ts.map +1 -1
  62. package/lib/exercises/math/sequences/geometric/geometricFirstTermsGeneralSum.js +40 -2
  63. package/lib/exercises/math/sequences/geometric/geometricFirstTermsSum.d.ts.map +1 -1
  64. package/lib/exercises/math/sequences/geometric/geometricFirstTermsSum.js +32 -0
  65. package/lib/exercises/math/trigonometry/trigonometry.d.ts.map +1 -1
  66. package/lib/exercises/math/trigonometry/trigonometry.js +67 -1
  67. package/lib/exercises/math/trigonometry/trigonometryAngleCalcul.d.ts.map +1 -1
  68. package/lib/exercises/math/trigonometry/trigonometryAngleCalcul.js +89 -0
  69. package/lib/index.d.ts +14 -4
  70. package/lib/index.d.ts.map +1 -1
  71. package/lib/math/geometry/angle.d.ts.map +1 -1
  72. package/lib/math/geometry/angle.js +0 -5
  73. package/lib/math/geometry/vector.d.ts +1 -0
  74. package/lib/math/geometry/vector.d.ts.map +1 -1
  75. package/lib/math/geometry/vector.js +19 -0
  76. package/lib/math/numbers/decimals/decimal.d.ts +1 -0
  77. package/lib/math/numbers/decimals/decimal.d.ts.map +1 -1
  78. package/lib/math/numbers/decimals/decimal.js +2 -0
  79. package/lib/math/systems/generalSystem.d.ts +6 -1
  80. package/lib/math/systems/generalSystem.d.ts.map +1 -1
  81. package/lib/math/systems/generalSystem.js +137 -0
  82. package/lib/math/utils/arithmetic/lcm.js +1 -1
  83. package/lib/playground.d.ts.map +1 -1
  84. package/lib/playground.js +1 -36
  85. package/lib/tree/nodes/algebraicNode.d.ts +1 -0
  86. package/lib/tree/nodes/algebraicNode.d.ts.map +1 -1
  87. package/lib/tree/nodes/equations/equalNode.d.ts +7 -1
  88. package/lib/tree/nodes/equations/equalNode.d.ts.map +1 -1
  89. package/lib/tree/nodes/equations/equalNode.js +17 -9
  90. package/lib/tree/nodes/operators/addNode.js +1 -1
  91. package/lib/tree/nodes/operators/fractionNode.d.ts.map +1 -1
  92. package/lib/tree/nodes/operators/fractionNode.js +31 -11
  93. package/lib/tree/nodes/operators/powerNode.d.ts.map +1 -1
  94. package/lib/tree/nodes/operators/powerNode.js +5 -0
  95. package/lib/tree/nodes/sets/intervalNode.d.ts.map +1 -1
  96. package/lib/tree/nodes/sets/intervalNode.js +3 -1
  97. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"choseOperationToSolveEquation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/equation/choseOperationToSolveEquation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAuJF,eAAO,MAAM,6BAA6B,EAAE,QAAQ,CAAC,WAAW,CAoB/D,CAAC"}
1
+ {"version":3,"file":"choseOperationToSolveEquation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/equation/choseOperationToSolveEquation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AA6MF,eAAO,MAAM,6BAA6B,EAAE,QAAQ,CAAC,WAAW,CAoB/D,CAAC"}
@@ -77,17 +77,6 @@ $$
77
77
  il faut d'abord effectuer :
78
78
  `;
79
79
  };
80
- // const getHint: GetHint<Identifiers> = (identifiers) => {
81
- // };
82
- // const getCorrection: GetCorrection<Identifiers> = (identifiers) => {
83
- // return ``
84
- // };
85
- const getKeys = (identifiers) => {
86
- return [];
87
- };
88
- const isAnswerValid = (ans, { answer }) => {
89
- throw Error("VEA not implemented");
90
- };
91
80
  const getChoseOperationToSolveEquationQuestion = (opts) => {
92
81
  //ax=b avec a entier, ax+b = c tout entier, x/a = b tout entier, x+-a = b entiers ,
93
82
  let a;
@@ -132,13 +121,76 @@ const getChoseOperationToSolveEquationQuestion = (opts) => {
132
121
  const identifiers = { type, a, b, c };
133
122
  return getQuestionFromIdentifiers(identifiers);
134
123
  };
124
+ const getHint = (identifiers) => {
125
+ const { type } = identifiers;
126
+ switch (type) {
127
+ case 1:
128
+ //ax = b tous entiers
129
+ return `L'écriture $ax$ signifie $a$ multiplié par $x$.
130
+
131
+ Quelle opération permet d'annuler une multiplication ?`;
132
+ case 2:
133
+ // ax + b = c tous entiers
134
+ return `Quelle opération permet d'annuler une addition ?`;
135
+ case 3:
136
+ //ax-b = c tous entiers
137
+ return `Quelle opération permet d'annuler une soustraction ?`;
138
+ case 4:
139
+ //x/a = b tous entiers
140
+ return `Quelle opération permet d'annuler une division ?`;
141
+ case 5:
142
+ //x+a = b
143
+ return `Quelle opération permet d'annuler une addition ?`;
144
+ case 6:
145
+ default:
146
+ //x-a = b
147
+ return `Quelle opération permet d'annuler une soustraction ?`;
148
+ }
149
+ };
150
+ const getCorrection = (identifiers) => {
151
+ const { type, a, b, c } = identifiers;
152
+ switch (type) {
153
+ case 1:
154
+ //ax = b tous entiers
155
+ return `$${multiply(a, "x").toTex()}$ est une multiplication de $${a}$ par $x$.
156
+
157
+ Pour isoler $x$, il faut donc diviser par $${a}$.`;
158
+ case 2:
159
+ // ax + b = c tous entiers
160
+ return `Pour isoler $x$, on commence par passer $${b}$ à droite de l'équation.
161
+
162
+ Pour cela, il faut soustraire par $${b}$.`;
163
+ case 3:
164
+ //ax-b = c tous entiers
165
+ return `Pour isoler $x$, on commence par passer $${-b}$ à droite de l'équation.
166
+
167
+ Pour cela, il faut additionner par $${b}$.`;
168
+ case 4:
169
+ //x/a = b tous entiers
170
+ return `Pour isoler $x$, on doit "annuler" la division par $${a}$.
171
+
172
+ Pour cela, on multiplie par $${a}$.`;
173
+ case 5:
174
+ //x+a = b
175
+ return `Pour isoler $x$, il faut faire passer $${a}$ à droite de l'équation.
176
+
177
+ Pour cela, il faut soustraire par $${a}$.`;
178
+ case 6:
179
+ default:
180
+ //x-a = b
181
+ return `Pour isoler $x$, il faut faire passer $${-a}$ à droite de l'équation.
182
+
183
+ Pour cela, il faut additionner par $${a}$.`;
184
+ }
185
+ };
135
186
  const getQuestionFromIdentifiers = (identifiers) => {
136
187
  const question = {
137
188
  answer: getAnswer(identifiers),
138
189
  instruction: getInstruction(identifiers),
139
- keys: getKeys(identifiers),
140
190
  answerFormat: "tex",
141
191
  identifiers,
192
+ hint: getHint(identifiers),
193
+ correction: getCorrection(identifiers),
142
194
  };
143
195
  return question;
144
196
  };
@@ -151,10 +203,10 @@ export const choseOperationToSolveEquation = {
151
203
  qcmTimer: 60,
152
204
  freeTimer: 60,
153
205
  getPropositions,
154
- isAnswerValid,
155
206
  subject: "Mathématiques",
156
207
  getInstruction,
157
208
  getAnswer,
158
209
  answerType: "QCU",
159
210
  getQuestionFromIdentifiers,
211
+ hasHintAndCorrection: true,
160
212
  };
@@ -1 +1 @@
1
- {"version":3,"file":"factoType1Exercise.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/factorisation/factoType1Exercise.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,QAAQ,EAUT,MAAM,6BAA6B,CAAC;AAuBrC;;;GAGG;AACH,KAAK,WAAW,GAAG;IAEjB,aAAa,EAAE,MAAM,EAAE,EAAE,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;IAIlB,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB,CAAC;AAoKF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,CAapD,CAAC"}
1
+ {"version":3,"file":"factoType1Exercise.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/factorisation/factoType1Exercise.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAwBrC;;;GAGG;AACH,KAAK,WAAW,GAAG;IAEjB,aAAa,EAAE,MAAM,EAAE,EAAE,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;IAIlB,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB,CAAC;AA4NF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,CAepD,CAAC"}
@@ -13,6 +13,7 @@ import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
13
13
  import { random } from "../../../../utils/alea/random.js";
14
14
  import { shuffle } from "../../../../utils/alea/shuffle.js";
15
15
  import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
16
+ import { alignTex } from "../../../../utils/latex/alignTex.js";
16
17
  const getStatementNode = (identifiers) => {
17
18
  const { affinesCoeffs, operation, affinesOrder } = identifiers;
18
19
  const affines = affinesCoeffs.map((coeffs) => new Affine(coeffs[1], coeffs[0]));
@@ -71,6 +72,9 @@ const getFactoType1Question = () => {
71
72
  operation,
72
73
  affinesOrder: [random([0, 1]), random([0, 1])],
73
74
  };
75
+ return getQuestionFromIdentifiers(identifiers);
76
+ };
77
+ const getQuestionFromIdentifiers = (identifiers) => {
74
78
  const question = {
75
79
  instruction: getInstruction(identifiers),
76
80
  startStatement: getStatementNode(identifiers).toTex(),
@@ -78,9 +82,46 @@ const getFactoType1Question = () => {
78
82
  keys: ["x"],
79
83
  answerFormat: "tex",
80
84
  identifiers,
85
+ hint: getHint(identifiers),
86
+ correction: getCorrection(identifiers),
81
87
  };
82
88
  return question;
83
89
  };
90
+ const getHint = (identifiers) => {
91
+ return `On repère le facteur commun dans les deux termes de l'expression.
92
+
93
+ On utilise ensuite la propriété :
94
+
95
+ $$
96
+ k\\times a + k \\times b = k\\times (a+b)
97
+ $$`;
98
+ };
99
+ const getCorrection = (identifiers) => {
100
+ const { affinesCoeffs, operation, affinesOrder } = identifiers;
101
+ const affines = affinesCoeffs.map((coeffs) => new Affine(coeffs[1], coeffs[0]));
102
+ const order = [[], []];
103
+ order[0][affinesOrder[0]] = affines[1];
104
+ order[1][affinesOrder[1]] = affines[2];
105
+ order[0][1 - affinesOrder[0]] = affines[0];
106
+ order[1][1 - affinesOrder[1]] = affines[0];
107
+ const statementTree = (operation === "add" ? add : substract)(new MultiplyNode(order[0][0].toTree(), order[0][1].toTree()), new MultiplyNode(order[1][0].toTree(), order[1][1].toTree()));
108
+ return `On repère que le facteur commun dans les deux termes est :
109
+
110
+ $$
111
+ ${affines[0].toTree().toTex()}
112
+ $$
113
+
114
+ On a donc :
115
+
116
+ ${alignTex([
117
+ ["", statementTree.toTex()],
118
+ [
119
+ "=",
120
+ multiply(affines[0].toTree(), (operation === "add" ? add : substract)(affines[1].toTree(), affines[2].toTree())).toTex(),
121
+ ],
122
+ ["=", getAnswer(identifiers)],
123
+ ])}`;
124
+ };
84
125
  const getPropositions = (n, { answer, affinesCoeffs, operation }) => {
85
126
  const propositions = [];
86
127
  addValidProp(propositions, answer);
@@ -138,4 +179,6 @@ export const factoType1Exercise = {
138
179
  subject: "Mathématiques",
139
180
  getInstruction,
140
181
  getAnswer,
182
+ getQuestionFromIdentifiers,
183
+ hasHintAndCorrection: true,
141
184
  };
@@ -1 +1 @@
1
- {"version":3,"file":"basicNiceValuesSystemResolution.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/systems/basicNiceValuesSystemResolution.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AASrC,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAKtE,KAAK,WAAW,GAAG;IACjB,SAAS,EAAE,eAAe,EAAE,EAAE,CAAC;CAIhC,CAAC;AA2EF,eAAO,MAAM,+BAA+B,EAAE,QAAQ,CAAC,WAAW,CAgBjE,CAAC"}
1
+ {"version":3,"file":"basicNiceValuesSystemResolution.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/systems/basicNiceValuesSystemResolution.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AASrC,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAKtE,KAAK,WAAW,GAAG;IACjB,SAAS,EAAE,eAAe,EAAE,EAAE,CAAC;CAIhC,CAAC;AAkGF,eAAO,MAAM,+BAA+B,EAAE,QAAQ,CAAC,WAAW,CAiBjE,CAAC"}
@@ -22,6 +22,26 @@ $$
22
22
 
23
23
  *Donner le couple solution sous la forme $\\left(x;y\\right)$ : par exemple, si la solution est $x=2$ et $y=3$, alors on écrira $\\left(2;3\\right)$.*`;
24
24
  };
25
+ const getHint = (identifiers) => {
26
+ return `On peut utilise la méthode par substitution ou bien celle par combinaison :
27
+
28
+ - Si une des variables est facile à isoler dans une des équations, alors on utilise la méthode par substitution : on isole cette variable, puis on injecte le résultat obtenu dans l'autre équation.
29
+
30
+ - Sinon, on utilise la méthode par combinaison : on multiple une (ou les deux) équation(s) par un nombre, afin que lorsqu'on additionne les deux équations, une des variables disparaisse.`;
31
+ };
32
+ const getCorrection = (identifiers) => {
33
+ const sys = GeneralSystemConstructor.fromIdentifiers(identifiers);
34
+ let corr = "";
35
+ corr += sys.toCorrectionTex();
36
+ corr += `
37
+
38
+ La solution du système est donc le couple :
39
+
40
+ $$
41
+ ${getAnswer(identifiers)}
42
+ $$`;
43
+ return corr;
44
+ };
25
45
  const getAnswer = (identifiers) => {
26
46
  const sys = GeneralSystemConstructor.fromIdentifiers(identifiers);
27
47
  const { x, y } = sys.solve();
@@ -41,6 +61,8 @@ const getQuestionFromIdentifiers = (identifiers) => {
41
61
  keys: [],
42
62
  answerFormat: "tex",
43
63
  identifiers,
64
+ hint: getHint(identifiers),
65
+ correction: getCorrection(identifiers),
44
66
  };
45
67
  return question;
46
68
  };
@@ -80,4 +102,5 @@ export const basicNiceValuesSystemResolution = {
80
102
  subject: "Mathématiques",
81
103
  getQuestionFromIdentifiers,
82
104
  rebuildIdentifiers,
105
+ hasHintAndCorrection: true,
83
106
  };
@@ -1 +1 @@
1
- {"version":3,"file":"basicSystemResolution.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/systems/basicSystemResolution.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AASrC,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAKtE,KAAK,WAAW,GAAG;IACjB,SAAS,EAAE,eAAe,EAAE,EAAE,CAAC;CAIhC,CAAC;AA6EF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,WAAW,CAgBvD,CAAC"}
1
+ {"version":3,"file":"basicSystemResolution.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/systems/basicSystemResolution.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AASrC,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAMtE,KAAK,WAAW,GAAG;IACjB,SAAS,EAAE,eAAe,EAAE,EAAE,CAAC;CAIhC,CAAC;AAoGF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,WAAW,CAiBvD,CAAC"}
@@ -34,6 +34,26 @@ const getBasicSystemResolutionQuestion = () => {
34
34
  };
35
35
  return getQuestionFromIdentifiers(identifiers);
36
36
  };
37
+ const getHint = (identifiers) => {
38
+ return `On peut utilise la méthode par substitution ou bien celle par combinaison :
39
+
40
+ - Si une des variables est facile à isoler dans une des équations, alors on utilise la méthode par substitution : on isole cette variable, puis on injecte le résultat obtenu dans l'autre équation.
41
+
42
+ - Sinon, on utilise la méthode par combinaison : on multiple une (ou les deux) équation(s) par un nombre, afin que lorsqu'on additionne les deux équations, une des variables disparaisse.`;
43
+ };
44
+ const getCorrection = (identifiers) => {
45
+ const sys = GeneralSystemConstructor.fromIdentifiers(identifiers);
46
+ let corr = "";
47
+ corr += sys.toCorrectionTex();
48
+ corr += `
49
+
50
+ La solution du système est donc le couple :
51
+
52
+ $$
53
+ ${getAnswer(identifiers)}
54
+ $$`;
55
+ return corr;
56
+ };
37
57
  const getQuestionFromIdentifiers = (identifiers) => {
38
58
  const question = {
39
59
  answer: getAnswer(identifiers),
@@ -41,6 +61,8 @@ const getQuestionFromIdentifiers = (identifiers) => {
41
61
  keys: [],
42
62
  answerFormat: "tex",
43
63
  identifiers,
64
+ hint: getHint(identifiers),
65
+ correction: getCorrection(identifiers),
44
66
  };
45
67
  return question;
46
68
  };
@@ -82,4 +104,5 @@ export const basicSystemResolution = {
82
104
  subject: "Mathématiques",
83
105
  getQuestionFromIdentifiers,
84
106
  rebuildIdentifiers,
107
+ hasHintAndCorrection: true,
85
108
  };
@@ -1 +1 @@
1
- {"version":3,"file":"verifySystemSolution.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/systems/verifySystemSolution.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAGL,wBAAwB,EACzB,MAAM,qCAAqC,CAAC;AAK7C,KAAK,WAAW,GAAG;IAGjB,MAAM,EAAE,wBAAwB,CAAC;IACjC,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAuEF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAetD,CAAC"}
1
+ {"version":3,"file":"verifySystemSolution.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/systems/verifySystemSolution.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAGL,wBAAwB,EACzB,MAAM,qCAAqC,CAAC;AAK7C,KAAK,WAAW,GAAG;IAGjB,MAAM,EAAE,wBAAwB,CAAC;IACjC,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAkIF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAgBtD,CAAC"}
@@ -44,11 +44,59 @@ const getVerifySystemSolutionQuestion = () => {
44
44
  const identifiers = { sysIds: sys.toIdentifiers(), x, y };
45
45
  return getQuestionFromIdentifiers(identifiers);
46
46
  };
47
+ const getHint = (identifiers) => {
48
+ return `On remplace $x$ par $${identifiers.x}$ et $y$ par $${identifiers.y}$ dans les deux équations.
49
+
50
+ Si les deux égalités sont vraies, alors le couple est bien une solution du système. Sinon, ce n'en est pas une.`;
51
+ };
52
+ const getCorrection = (identifiers) => {
53
+ const { sysIds, x, y } = identifiers;
54
+ const sys = GeneralSystemConstructor.fromIdentifiers(sysIds);
55
+ const equas = sys.getEqualNodes();
56
+ const equasDetailed = equas.map((e) => e.toDetailedEvaluation({
57
+ x: x.toTree(),
58
+ y: y.toTree(),
59
+ }));
60
+ const equasDetailedSimp = equasDetailed.map((e) => e.simplify());
61
+ const firstIsTrue = equasDetailedSimp[0].isVerified();
62
+ const secondIsTrue = equasDetailedSimp[1].isVerified();
63
+ return `On remplace $x$ par $${x}$ et $y$ par $${y}$ dans les deux équations :
64
+
65
+ $$
66
+ ${equasDetailed[0].leftChild.toTex()} = ${equasDetailedSimp[0].leftChild.toTex()}
67
+ $$
68
+
69
+ ${firstIsTrue
70
+ ? "La première équation est donc bien vérifiée."
71
+ : "La première équation n'est donc pas vérifiée : le couple n'est donc pas une solution du système."}
72
+
73
+ ${firstIsTrue
74
+ ? `
75
+
76
+ On vérifie maintenant la deuxième équation :
77
+
78
+ $$
79
+ ${equasDetailed[1].leftChild.toTex()} = ${equasDetailedSimp[1].leftChild.toTex()}
80
+ $$
81
+
82
+ ${secondIsTrue
83
+ ? "La deuxième équation est donc bien vérifiée."
84
+ : "La deuxième équation n'est donc pas vérifiée : le couple n'est donc pas une solution du système."}
85
+ `
86
+ : ""}
87
+
88
+ ${firstIsTrue && secondIsTrue
89
+ ? "Les deux équations sont donc bien vérifiées : le couple est bien une solution du système."
90
+ : ""}
91
+ `;
92
+ };
47
93
  const getQuestionFromIdentifiers = (identifiers) => {
48
94
  const question = {
49
95
  instruction: getInstruction(identifiers),
50
96
  answerFormat: "raw",
51
97
  identifiers,
98
+ hint: getHint(identifiers),
99
+ correction: getCorrection(identifiers),
52
100
  };
53
101
  return question;
54
102
  };
@@ -77,4 +125,5 @@ export const verifySystemSolution = {
77
125
  answerType: "QCU",
78
126
  getQuestionFromIdentifiers,
79
127
  rebuildIdentifiers,
128
+ hasHintAndCorrection: true,
80
129
  };
@@ -1 +1 @@
1
- {"version":3,"file":"capacityConversion.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/conversion/capacityConversion.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,QAAQ,EAQT,MAAM,mBAAmB,CAAC;AAG3B,KAAK,WAAW,GAAG;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,0BAA0B,EAAE,MAAM,CAAC;IACnC,cAAc,EAAE,MAAM,CAAC;CACxB,CAAC;AA0DF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,CAcpD,CAAC"}
1
+ {"version":3,"file":"capacityConversion.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/conversion/capacityConversion.ts"],"names":[],"mappings":"AAUA,OAAO,EACL,QAAQ,EAaT,MAAM,mBAAmB,CAAC;AAG3B,KAAK,WAAW,GAAG;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,0BAA0B,EAAE,MAAM,CAAC;IACnC,cAAc,EAAE,MAAM,CAAC;CACxB,CAAC;AA0HF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,CAcpD,CAAC"}
@@ -1,7 +1,10 @@
1
1
  import { Decimal, DecimalConstructor, } from "../../../math/numbers/decimals/decimal.js";
2
2
  import { randint } from "../../../math/utils/random/randint.js";
3
+ import { frac } from "../../../tree/nodes/operators/fractionNode.js";
4
+ import { multiply } from "../../../tree/nodes/operators/multiplyNode.js";
3
5
  import { shuffle } from "../../../utils/alea/shuffle.js";
4
6
  import { doWhile } from "../../../utils/doWhile.js";
7
+ import { alignTex } from "../../../utils/latex/alignTex.js";
5
8
  import { addValidProp, tryToAddWrongProp, } from "../../exercise.js";
6
9
  import { getDistinctQuestions } from "../../utils/getDistinctQuestions.js";
7
10
  const units = ["mL", "cL", "dL", "L", "daL", "hL", "kL"];
@@ -9,19 +12,72 @@ const getCapacityConversion = () => {
9
12
  const randomUnitIndex = randint(0, 7);
10
13
  const randomUnitInstructionIndex = randint(0, 7, [randomUnitIndex]);
11
14
  const randomCapacity = doWhile(() => DecimalConstructor.random(0, 1000, randint(0, 4)), (x) => x.value === 0);
12
- const answer = (randomCapacity.multiplyByPowerOfTen(randomUnitIndex - randomUnitInstructionIndex).value + "").replace(".", ",");
15
+ const identifiers = {
16
+ randomCapacity: randomCapacity.value,
17
+ randomUnitIndex,
18
+ randomUnitInstructionIndex,
19
+ };
20
+ return getQuestionFromIdentifiers(identifiers);
21
+ };
22
+ const getInstruction = (identifiers) => {
23
+ const { randomCapacity, randomUnitIndex, randomUnitInstructionIndex } = identifiers;
24
+ return `Compléter :
25
+
26
+ $$
27
+ ${randomCapacity.frenchify()} \\textrm{${units[randomUnitIndex]}} = \\ldots \\textrm{${units[randomUnitInstructionIndex]}}
28
+ $$`;
29
+ };
30
+ const getAnswer = (identifiers) => {
31
+ const { randomCapacity, randomUnitIndex, randomUnitInstructionIndex } = identifiers;
32
+ const answer = new Decimal(randomCapacity)
33
+ .multiplyByPowerOfTen(randomUnitIndex - randomUnitInstructionIndex)
34
+ .value.frenchify();
35
+ return answer;
36
+ };
37
+ const getHint = (identifiers) => {
38
+ const { randomUnitIndex, randomUnitInstructionIndex } = identifiers;
39
+ const unit = units[randomUnitIndex];
40
+ const target = units[randomUnitInstructionIndex];
41
+ const space = randomUnitIndex - randomUnitInstructionIndex;
42
+ return `On rappelle que :
43
+
44
+ $$
45
+ 1 \\ \\textrm{${unit}} = ${space > 0 ? Math.pow(10, space) : frac(1, Math.pow(10, -space)).toTex()} \\ \\textrm{${target}}
46
+ $$`;
47
+ };
48
+ const getCorrection = (identifiers) => {
49
+ const { randomCapacity, randomUnitIndex, randomUnitInstructionIndex } = identifiers;
50
+ const unit = units[randomUnitIndex];
51
+ const target = units[randomUnitInstructionIndex];
52
+ const space = randomUnitIndex - randomUnitInstructionIndex;
53
+ const coeff = space > 0 ? Math.pow(10, space).toTree() : frac(1, Math.pow(10, -space));
54
+ return `On sait que :
55
+
56
+ $$
57
+ 1 \\ \\textrm{${unit}} = ${coeff.toTex()} \\ \\textrm{${target}}
58
+ $$
59
+
60
+ Il suffit alors de multiplier $${randomCapacity.frenchify()}$ par $${coeff.toTex()}$ :
61
+
62
+ ${alignTex([
63
+ [
64
+ `${randomCapacity.frenchify()} \\textrm{${unit}} `,
65
+ "=",
66
+ `${multiply(coeff, randomCapacity).toTex()}\\ \\textrm{${target}}`,
67
+ ],
68
+ ["", "=", `${getAnswer(identifiers)}\\ \\textrm{${target}}`],
69
+ ])}
70
+ `;
71
+ };
72
+ const getQuestionFromIdentifiers = (identifiers) => {
13
73
  const question = {
14
- instruction: `Compléter : $${randomCapacity.value
15
- .toString()
16
- .replace(".", ",")} \\textrm{${units[randomUnitIndex]}} = \\ldots \\textrm{${units[randomUnitInstructionIndex]}}$`,
17
- answer,
74
+ instruction: getInstruction(identifiers),
75
+ answer: getAnswer(identifiers),
18
76
  keys: [],
19
77
  answerFormat: "tex",
20
- identifiers: {
21
- randomCapacity: randomCapacity.value,
22
- randomUnitIndex,
23
- randomUnitInstructionIndex,
24
- },
78
+ identifiers,
79
+ hint: getHint(identifiers),
80
+ correction: getCorrection(identifiers),
25
81
  };
26
82
  return question;
27
83
  };
@@ -46,12 +102,12 @@ export const capacityConversion = {
46
102
  connector: "=",
47
103
  getPropositions,
48
104
  label: "Conversion de capacités",
49
- levels: ["6ème", "5ème", "CAP", "2ndPro"],
50
- sections: ["Conversions"],
51
105
  isSingleStep: true,
52
106
  generator: (nb) => getDistinctQuestions(getCapacityConversion, nb),
53
107
  qcmTimer: 60,
54
108
  freeTimer: 60,
55
109
  isAnswerValid,
56
110
  subject: "Mathématiques",
111
+ getQuestionFromIdentifiers,
112
+ hasHintAndCorrection: true,
57
113
  };
@@ -1 +1 @@
1
- {"version":3,"file":"hoursToDecimal.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/conversion/hoursToDecimal.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,gBAAgB,EAAE,OAAO,CAAC;CAC3B,CAAC;AAwEF,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,WAAW,CAchD,CAAC"}
1
+ {"version":3,"file":"hoursToDecimal.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/conversion/hoursToDecimal.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAarC,KAAK,WAAW,GAAG;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,gBAAgB,EAAE,OAAO,CAAC;CAC3B,CAAC;AAwIF,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,WAAW,CAchD,CAAC"}
@@ -3,28 +3,88 @@ import { getDistinctQuestions } from "../../../exercises/utils/getDistinctQuesti
3
3
  import { DecimalConstructor, } from "../../../math/numbers/decimals/decimal.js";
4
4
  import { randint } from "../../../math/utils/random/randint.js";
5
5
  import { round } from "../../../math/utils/round.js";
6
+ import { frac } from "../../../tree/nodes/operators/fractionNode.js";
7
+ import { multiply } from "../../../tree/nodes/operators/multiplyNode.js";
6
8
  import { coinFlip } from "../../../utils/alea/coinFlip.js";
7
- const getHoursToDecimalQuestion = () => {
8
- const isDecimalToHours = coinFlip();
9
- const dec = DecimalConstructor.random(0, 3, 2);
10
- const hours = Math.floor(dec.value);
11
- const mins = round((dec.value - hours) * 100 * 0.6, 0);
12
- const decTex = dec.toTree().toTex();
9
+ import { approxOrEqual } from "../../../utils/latex/approxOrEqual.js";
10
+ const getInstruction = (identifiers) => {
11
+ const { dec, isDecimalToHours } = identifiers;
12
+ const hours = Math.floor(dec);
13
+ const mins = round((dec - hours) * 100 * 0.6, 0);
14
+ const decTex = dec.frenchify();
13
15
  const durationTex = isDecimalToHours
14
- ? decTex + "\\text{h}"
15
- : `${hours}\\text{h}${mins}\\text{min}`;
16
+ ? decTex + "\\ \\textrm{h}"
17
+ : `${hours}\\ \\textrm{h}\\ ${mins}\\ \\textrm{min}`;
18
+ return `Convertir la durée suivante en ${isDecimalToHours ? "heures et minutes" : "$\\ \\textrm{h}$ (nombre décimal)"} :
19
+
20
+ $$
21
+ ${durationTex}
22
+ $$
23
+
24
+ Arrondir ${isDecimalToHours ? "à la minute près" : "au centième près"}.`;
25
+ };
26
+ const getAnswer = (identifiers) => {
27
+ const { dec, isDecimalToHours } = identifiers;
28
+ const hours = Math.floor(dec);
29
+ const mins = round((dec - hours) * 100 * 0.6, 0);
16
30
  const answer = isDecimalToHours
17
31
  ? `${hours}\\text{h}${mins}\\text{min}`
18
32
  : `${hours},${round((mins / 60) * 100, 0)}\\text{h}`;
33
+ return answer;
34
+ };
35
+ const getHint = (identifiers) => {
36
+ const { dec, isDecimalToHours } = identifiers;
37
+ const hours = Math.floor(dec);
38
+ const mins = round((dec - hours) * 100 * 0.6, 0);
39
+ if (isDecimalToHours) {
40
+ return `Dans $1\\ \\text{h}$, il y a $60$ minutes. Un calcul de proportionnalité permet donc de déterminer combien y a-t-il de minutes dans $${dec.frenchify()} \\text{h}$.`;
41
+ }
42
+ return `$60$ minutes correspondent à $1 \\ \\text{h}$. Un calcul de proportionnalité permet donc de convertir $${mins} \\ \\text{min}$ en heures.`;
43
+ };
44
+ const getCorrection = (identifiers) => {
45
+ const { dec, isDecimalToHours } = identifiers;
46
+ const hours = Math.floor(dec);
47
+ const mins = round((dec - hours) * 100 * 0.6, 0);
48
+ const fracDec = round(dec - Math.floor(dec), 2);
49
+ if (isDecimalToHours) {
50
+ return `Dans $1\\ \\text{h}$, il y a $60$ minutes. Un calcul de proportionnalité permet donc de déterminer combien y a-t-il de minutes dans $${fracDec.frenchify()} \\text{h}$ :
51
+
52
+ $$
53
+ ${multiply(fracDec, 60).toTex()} ${approxOrEqual(fracDec * 60, 0).join("")}
54
+ $$
55
+
56
+ $${dec.frenchify()}\\ \\text{h}$ correspond donc à $${getAnswer(identifiers)}$.`;
57
+ }
58
+ return `$60$ minutes correspondent à $1 \\ \\text{h}$. Un calcul de proportionnalité permet donc de convertir $${mins} \\ \\text{min}$ en heures :
59
+
60
+ $$
61
+ ${frac(mins, 60).toTex()} ${approxOrEqual(mins / 60, 2).join("")}
62
+ $$
63
+
64
+ Le résultat attendu est donc :
65
+
66
+ $$
67
+ ${getAnswer(identifiers)}
68
+ $$`;
69
+ };
70
+ const getQuestionFromIdentifiers = (identifiers) => {
19
71
  const question = {
20
- answer,
21
- instruction: `Convertir la durée suivante en ${isDecimalToHours ? "heures et minutes" : "$\\text{h}$ (nombre décimal)"} : $${durationTex}$ (arrondir ${isDecimalToHours ? "à la minute près" : "au centième près"})`,
72
+ answer: getAnswer(identifiers),
73
+ instruction: getInstruction(identifiers),
22
74
  keys: ["hours", "minutes"],
23
75
  answerFormat: "tex",
24
- identifiers: { isDecimalToHours, dec: dec.value },
76
+ identifiers,
77
+ hint: getHint(identifiers),
78
+ correction: getCorrection(identifiers),
25
79
  };
26
80
  return question;
27
81
  };
82
+ const getHoursToDecimalQuestion = () => {
83
+ const isDecimalToHours = coinFlip();
84
+ const dec = DecimalConstructor.random(0, 3, 2);
85
+ const identifiers = { isDecimalToHours, dec: dec.value };
86
+ return getQuestionFromIdentifiers(identifiers);
87
+ };
28
88
  const getPropositions = (n, { answer, isDecimalToHours, dec }) => {
29
89
  const propositions = [];
30
90
  addValidProp(propositions, answer);
@@ -49,8 +109,6 @@ const getPropositions = (n, { answer, isDecimalToHours, dec }) => {
49
109
  const isAnswerValid = (ans, { answer, isDecimalToHours, dec }) => {
50
110
  if (isDecimalToHours)
51
111
  return ans === answer;
52
- // const hours = Math.floor(dec);
53
- // const mins = round((dec - hours) * 100 * 0.6, 0);
54
112
  const texs = [answer, answer.replace("\\text{h}", "")];
55
113
  return texs.includes(ans);
56
114
  };
@@ -58,13 +116,13 @@ export const hoursToDecimal = {
58
116
  id: "hoursToDecimal",
59
117
  connector: "=",
60
118
  label: "Convertir une durée en nombre décimal et inversement",
61
- levels: ["2nde", "2ndPro", "3ème"],
62
119
  isSingleStep: true,
63
- sections: ["Conversions"],
64
120
  generator: (nb) => getDistinctQuestions(getHoursToDecimalQuestion, nb),
65
121
  qcmTimer: 60,
66
122
  freeTimer: 60,
67
123
  getPropositions,
68
124
  isAnswerValid,
69
125
  subject: "Mathématiques",
126
+ getQuestionFromIdentifiers,
127
+ hasHintAndCorrection: true,
70
128
  };
@@ -1 +1 @@
1
- {"version":3,"file":"lengthConversion.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/conversion/lengthConversion.ts"],"names":[],"mappings":"AAWA,OAAO,EACL,QAAQ,EAaT,MAAM,mBAAmB,CAAC;AAG3B,KAAK,WAAW,GAAG;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,0BAA0B,EAAE,MAAM,CAAC;IACnC,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AACF,KAAK,OAAO,GAAG;IACb,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB,CAAC;AAuHF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAgB3D,CAAC"}
1
+ {"version":3,"file":"lengthConversion.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/conversion/lengthConversion.ts"],"names":[],"mappings":"AAcA,OAAO,EACL,QAAQ,EAgBT,MAAM,mBAAmB,CAAC;AAG3B,KAAK,WAAW,GAAG;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,0BAA0B,EAAE,MAAM,CAAC;IACnC,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AACF,KAAK,OAAO,GAAG;IACb,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB,CAAC;AA2KF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAkB3D,CAAC"}