math-exercises 3.0.146 → 3.0.148

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 (69) hide show
  1. package/lib/exercises/math/calcul/arithmetics/findLeftoverInContext.js +1 -1
  2. package/lib/exercises/math/calcul/mentalCaluls/index.d.ts +1 -0
  3. package/lib/exercises/math/calcul/mentalCaluls/index.d.ts.map +1 -1
  4. package/lib/exercises/math/calcul/mentalCaluls/index.js +1 -0
  5. package/lib/exercises/math/calcul/mentalCaluls/mentalAddAndSub.d.ts.map +1 -1
  6. package/lib/exercises/math/calcul/mentalCaluls/mentalAddAndSub.js +28 -4
  7. package/lib/exercises/math/calcul/mentalCaluls/mentalAddAndSubNoRelative.d.ts.map +1 -1
  8. package/lib/exercises/math/calcul/mentalCaluls/mentalAddAndSubNoRelative.js +50 -23
  9. package/lib/exercises/math/calcul/mentalCaluls/mentalApplyPercentageEvolution.d.ts +9 -0
  10. package/lib/exercises/math/calcul/mentalCaluls/mentalApplyPercentageEvolution.d.ts.map +1 -0
  11. package/lib/exercises/math/calcul/mentalCaluls/mentalApplyPercentageEvolution.js +423 -0
  12. package/lib/exercises/math/calcul/mentalCaluls/mentalMultiplications.d.ts.map +1 -1
  13. package/lib/exercises/math/calcul/mentalCaluls/mentalMultiplications.js +48 -24
  14. package/lib/exercises/math/calcul/mentalCaluls/mentalPercentage.d.ts.map +1 -1
  15. package/lib/exercises/math/calcul/mentalCaluls/mentalPercentage.js +236 -22
  16. package/lib/exercises/math/calcul/operations/operationsPriorities.d.ts.map +1 -1
  17. package/lib/exercises/math/calcul/operations/operationsPriorities.js +48 -20
  18. package/lib/exercises/math/calcul/operations/operationsPrioritiesParenthesis.d.ts.map +1 -1
  19. package/lib/exercises/math/calcul/operations/operationsPrioritiesParenthesis.js +47 -19
  20. package/lib/exercises/math/calcul/proportionality/findCoeffInProportionalTableNonIntegers.d.ts.map +1 -1
  21. package/lib/exercises/math/calcul/proportionality/findCoeffInProportionalTableNonIntegers.js +26 -6
  22. package/lib/exercises/math/calcul/proportionality/rectangleSideAfterReduction.d.ts.map +1 -1
  23. package/lib/exercises/math/calcul/proportionality/rectangleSideAfterReduction.js +92 -16
  24. package/lib/exercises/math/calculLitteral/equation/solveByFactorizingWithIdRmq3.d.ts.map +1 -1
  25. package/lib/exercises/math/calculLitteral/equation/solveByFactorizingWithIdRmq3.js +1 -0
  26. package/lib/exercises/math/conversion/volumeCapacityConversion.d.ts.map +1 -1
  27. package/lib/exercises/math/conversion/volumeCapacityConversion.js +171 -0
  28. package/lib/exercises/math/dataRepresentations/barChartReading.d.ts.map +1 -1
  29. package/lib/exercises/math/dataRepresentations/barChartReading.js +17 -8
  30. package/lib/exercises/math/dataRepresentations/functionGraphReading.d.ts.map +1 -1
  31. package/lib/exercises/math/dataRepresentations/functionGraphReading.js +94 -8
  32. package/lib/exercises/math/functions/affines/affineExpressionReading.d.ts +6 -1
  33. package/lib/exercises/math/functions/affines/affineExpressionReading.d.ts.map +1 -1
  34. package/lib/exercises/math/functions/affines/affineExpressionReading.js +166 -52
  35. package/lib/exercises/math/functions/affines/drawAffineFromLitExp.d.ts +5 -1
  36. package/lib/exercises/math/functions/affines/drawAffineFromLitExp.d.ts.map +1 -1
  37. package/lib/exercises/math/functions/affines/drawAffineFromLitExp.js +59 -17
  38. package/lib/exercises/math/functions/basics/graphicInequation.js +1 -1
  39. package/lib/exercises/math/functions/index.d.ts +1 -0
  40. package/lib/exercises/math/functions/index.d.ts.map +1 -1
  41. package/lib/exercises/math/functions/index.js +1 -0
  42. package/lib/exercises/math/functions/linear/index.d.ts +3 -0
  43. package/lib/exercises/math/functions/linear/index.d.ts.map +1 -0
  44. package/lib/exercises/math/functions/linear/index.js +2 -0
  45. package/lib/exercises/math/functions/linear/linearFromExercise.d.ts +9 -0
  46. package/lib/exercises/math/functions/linear/linearFromExercise.d.ts.map +1 -0
  47. package/lib/exercises/math/functions/linear/linearFromExercise.js +354 -0
  48. package/lib/exercises/math/functions/linear/linearFromPercentageEvolution.d.ts +8 -0
  49. package/lib/exercises/math/functions/linear/linearFromPercentageEvolution.d.ts.map +1 -0
  50. package/lib/exercises/math/functions/linear/linearFromPercentageEvolution.js +233 -0
  51. package/lib/exercises/math/functions/trinoms/devForm/coefficientsIdentification.d.ts.map +1 -1
  52. package/lib/exercises/math/functions/trinoms/devForm/coefficientsIdentification.js +2 -5
  53. package/lib/exercises/math/geometry/thales/thalesIsParallelFromAbstractFormula.d.ts +22 -0
  54. package/lib/exercises/math/geometry/thales/thalesIsParallelFromAbstractFormula.d.ts.map +1 -0
  55. package/lib/exercises/math/geometry/thales/thalesIsParallelFromAbstractFormula.js +647 -0
  56. package/lib/exercises/math/geometry/thales/thalesPickFormulaForIsParallel.d.ts +23 -0
  57. package/lib/exercises/math/geometry/thales/thalesPickFormulaForIsParallel.d.ts.map +1 -0
  58. package/lib/exercises/math/geometry/thales/thalesPickFormulaForIsParallel.js +540 -0
  59. package/lib/exercises/math/spaceGeometry/basis/spaceCoordinatesInPrism.d.ts.map +1 -1
  60. package/lib/exercises/math/spaceGeometry/basis/spaceCoordinatesInPrism.js +75 -6
  61. package/lib/index.d.ts +22 -3
  62. package/lib/index.d.ts.map +1 -1
  63. package/lib/tree/nodes/equations/notEqualNode.d.ts +35 -0
  64. package/lib/tree/nodes/equations/notEqualNode.d.ts.map +1 -0
  65. package/lib/tree/nodes/equations/notEqualNode.js +84 -0
  66. package/lib/tree/utilities/nodeSimplifier.d.ts +16 -0
  67. package/lib/tree/utilities/nodeSimplifier.d.ts.map +1 -0
  68. package/lib/tree/utilities/nodeSimplifier.js +283 -0
  69. package/package.json +1 -1
@@ -4,6 +4,7 @@ import { RationalConstructor } from "../../../../math/numbers/rationals/rational
4
4
  import { randfloat } from "../../../../math/utils/random/randfloat.js";
5
5
  import { randint } from "../../../../math/utils/random/randint.js";
6
6
  import { NodeConstructor, } from "../../../../tree/nodes/nodeConstructor.js";
7
+ import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
7
8
  import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
8
9
  import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
9
10
  import { random } from "../../../../utils/alea/random.js";
@@ -43,8 +44,26 @@ ${mdTable([xTexs.map((v) => dollarize(v)), yTexs.map((v) => dollarize(v))])}
43
44
  Quel est le coefficient de proportionnalité ?
44
45
  `;
45
46
  };
46
- // const getHint: GetHint<Identifiers> = (identifiers) => {};
47
- // const getCorrection: GetCorrection<Identifiers> = (identifiers) => {};
47
+ const getHint = () => {
48
+ return `Il y a $2$ lignes.
49
+ Le coefficient de proportionnalité est le facteur par lequel multiplier les valeurs de la ligne du haut pour obtenir les valeurs de la ligne du bas.`;
50
+ };
51
+ const getCorrection = (identifiers) => {
52
+ const { xValues, yValues } = identifiers;
53
+ const nodeXs = xValues.map((x) => NodeConstructor.fromIdentifiers(x));
54
+ const nodeYs = yValues.map((y) => NodeConstructor.fromIdentifiers(y));
55
+ const nodeFrac = frac(nodeYs[0], nodeXs[0]);
56
+ return `On prend un couple de valeurs "(haut,bas)".
57
+ On prend le couple : $(${nodeXs[0].toTex()};${nodeYs[0].toTex()})$.
58
+
59
+ On calcule :
60
+
61
+ $$
62
+ ${nodeFrac.toTex()} = ${nodeFrac.simplify({ fractionsToDecimal: true }).toTex()}
63
+ $$
64
+
65
+ Le coefficient de proportionnalité est $${nodeFrac.simplify().toTex()}$.`;
66
+ };
48
67
  const getKeys = () => {
49
68
  return [];
50
69
  };
@@ -101,8 +120,8 @@ const getQuestionFromIdentifiers = (identifiers) => {
101
120
  keys: getKeys(identifiers),
102
121
  answerFormat: "tex",
103
122
  identifiers,
104
- // hint: getHint(identifiers),
105
- // correction: getCorrection(identifiers),
123
+ hint: getHint(identifiers),
124
+ correction: getCorrection(identifiers),
106
125
  style: {
107
126
  tableHasNoHeader: true,
108
127
  },
@@ -138,9 +157,10 @@ export const findCoeffInProportionalTableNonIntegers = {
138
157
  getPropositions,
139
158
  isAnswerValid,
140
159
  subject: "Mathématiques",
141
- // getHint,
142
- // getCorrection,
143
160
  getAnswer,
144
161
  options,
145
162
  getQuestionFromIdentifiers,
163
+ getHint,
164
+ getCorrection,
165
+ hasHintAndCorrection: true,
146
166
  };
@@ -1 +1 @@
1
- {"version":3,"file":"rectangleSideAfterReduction.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/proportionality/rectangleSideAfterReduction.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAgBT,MAAM,6BAA6B,CAAC;AASrC,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,MAAM,EAAE,CAAC;CAGnB,CAAC;AA4PF,eAAO,MAAM,2BAA2B,EAAE,QAAQ,CAAC,WAAW,CAoB7D,CAAC"}
1
+ {"version":3,"file":"rectangleSideAfterReduction.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/proportionality/rectangleSideAfterReduction.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAgBT,MAAM,6BAA6B,CAAC;AAWrC,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,MAAM,EAAE,CAAC;CAGnB,CAAC;AAwUF,eAAO,MAAM,2BAA2B,EAAE,QAAQ,CAAC,WAAW,CAqB7D,CAAC"}
@@ -1,12 +1,11 @@
1
- import { addValidProp, shuffleProps, tryToAddWrongProp, propWhile,
2
- // GetHint,
3
- // GetCorrection,
4
- } from "../../../../exercises/exercise.js";
1
+ import { addValidProp, shuffleProps, tryToAddWrongProp, propWhile, } from "../../../../exercises/exercise.js";
5
2
  import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
6
3
  import { numberVEA } from "../../../../exercises/vea/numberVEA.js";
7
4
  import { randfloat } from "../../../../math/utils/random/randfloat.js";
8
5
  import { randint } from "../../../../math/utils/random/randint.js";
9
6
  import { round } from "../../../../math/utils/round.js";
7
+ import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
8
+ import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
10
9
  import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
11
10
  import { D3Node } from "d3-node";
12
11
  const getPropositions = (n, { answer, ...identifiers }) => {
@@ -125,8 +124,6 @@ ${d3n.svgString()}
125
124
 
126
125
  Quelle est la ${sideTypeAsked} (en $\\textrm{cm}$) du ${sideIsOnFirstRect ? "premier" : "deuxième"} rectangle ? Arrondir à $0,1\\ \\textrm{cm}$ si nécessaire.`;
127
126
  };
128
- // const getHint: GetHint<Identifiers> = (identifiers) => {};
129
- // const getCorrection: GetCorrection<Identifiers> = (identifiers) => {};
130
127
  const getKeys = () => {
131
128
  return [];
132
129
  };
@@ -138,12 +135,90 @@ const isAnswerValid = (ans, { answer }) => {
138
135
  return handleVEAError(err);
139
136
  }
140
137
  };
141
- // const getHint: GetHint<Identifiers> = (identifiers) => {
142
- // return ``;
143
- // };
144
- // const getCorrection: GetCorrection<Identifiers> = (identifiers) => {
145
- // return ``;
146
- // };
138
+ const getHint = (identifiers) => {
139
+ const { lengths } = identifiers;
140
+ const [big1, big2] = lengths;
141
+ const isShrink = big1 !== 0 && big2 !== 0;
142
+ return `Détermine le coefficient ${isShrink ? "de réduction" : "d'agrandissement"} en considérant un côté sur le grand rectangle et son homologue sur le petit rectangle
143
+ dont les longueurs sont données.`;
144
+ };
145
+ const getCorrection = (identifiers) => {
146
+ const { lengths } = identifiers;
147
+ const [big1, big2, small1, small2] = lengths;
148
+ const isShrink = big1 !== 0 && big2 !== 0;
149
+ if (isShrink) {
150
+ if (small1 === 0) {
151
+ const nodeFrac = frac(small2, big2);
152
+ const nodeLength = multiply(big1, nodeFrac.simplify());
153
+ return `Le coefficient de réduction est :
154
+
155
+ $$
156
+ ${nodeFrac.toSimplificationTex()}
157
+ $$
158
+
159
+ La longueur recherchée est donc :
160
+
161
+ $$
162
+ ${nodeLength.toSimplificationTex({ fractionsToDecimal: true })}
163
+ $$
164
+
165
+ `;
166
+ }
167
+ else {
168
+ const nodeFrac = frac(small1, big1);
169
+ const nodeLength = multiply(big2, nodeFrac.simplify());
170
+ return `Le coefficient de réduction est :
171
+
172
+ $$
173
+ ${nodeFrac.toSimplificationTex()}
174
+ $$
175
+
176
+ La longueur recherchée est donc :
177
+
178
+ $$
179
+ ${nodeLength.toSimplificationTex({ fractionsToDecimal: true })}
180
+ $$
181
+
182
+ `;
183
+ }
184
+ }
185
+ else {
186
+ if (big1 === 0) {
187
+ const nodeFrac = frac(big2, small2);
188
+ const nodeLength = multiply(small1, nodeFrac.simplify());
189
+ return `Le coefficient d'agrandissement est :
190
+
191
+ $$
192
+ ${nodeFrac.toSimplificationTex()}
193
+ $$
194
+
195
+ La longueur recherchée est donc :
196
+
197
+ $$
198
+ ${nodeLength.toSimplificationTex({ fractionsToDecimal: true })}
199
+ $$
200
+
201
+ `;
202
+ }
203
+ else {
204
+ const nodeFrac = frac(big1, small1);
205
+ const nodeLength = multiply(small2, nodeFrac.simplify());
206
+ return `Le coefficient de réduction est :
207
+
208
+ $$
209
+ ${nodeFrac.toSimplificationTex()}
210
+ $$
211
+
212
+ La longueur recherchée est donc :
213
+
214
+ $$
215
+ ${nodeLength.toSimplificationTex({ fractionsToDecimal: true })}
216
+ $$
217
+
218
+ `;
219
+ }
220
+ }
221
+ };
147
222
  const getRectangleSideAfterReductionQuestion = () => {
148
223
  const askedSize = randint(0, 4);
149
224
  let a;
@@ -189,8 +264,8 @@ const getQuestionFromIdentifiers = (identifiers) => {
189
264
  keys: getKeys(identifiers),
190
265
  answerFormat: "tex",
191
266
  identifiers,
192
- // hint: getHint(identifiers),
193
- // correction: getCorrection(identifiers),
267
+ hint: getHint(identifiers),
268
+ correction: getCorrection(identifiers),
194
269
  };
195
270
  return question;
196
271
  };
@@ -206,8 +281,9 @@ export const rectangleSideAfterReduction = {
206
281
  isAnswerValid,
207
282
  subject: "Mathématiques",
208
283
  getInstruction,
209
- // getHint,
210
- // getCorrection,
211
284
  getAnswer,
212
285
  getQuestionFromIdentifiers,
286
+ getHint,
287
+ getCorrection,
288
+ hasHintAndCorrection: true,
213
289
  };
@@ -1 +1 @@
1
- {"version":3,"file":"solveByFactorizingWithIdRmq3.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/equation/solveByFactorizingWithIdRmq3.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAMrC,OAAO,EACL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;AAW7C,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,eAAe,CAAC;IACtB,IAAI,EAAE,eAAe,CAAC;CACvB,CAAC;AA0LF,KAAK,OAAO,GAAG;IACb,cAAc,EAAE,OAAO,CAAC;CACzB,CAAC;AAUF,eAAO,MAAM,4BAA4B,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAsBvE,CAAC"}
1
+ {"version":3,"file":"solveByFactorizingWithIdRmq3.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/equation/solveByFactorizingWithIdRmq3.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAMrC,OAAO,EACL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;AAW7C,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,eAAe,CAAC;IACtB,IAAI,EAAE,eAAe,CAAC;CACvB,CAAC;AA2LF,KAAK,OAAO,GAAG;IACb,cAAc,EAAE,OAAO,CAAC;CACzB,CAAC;AAUF,eAAO,MAAM,4BAA4B,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAsBvE,CAAC"}
@@ -124,6 +124,7 @@ const isAnswerValid = (ans, { answer, ...identifiers }, opts) => {
124
124
  try {
125
125
  if (opts?.useSetAsAnswer) {
126
126
  const setParsed = discreteSetParser(ans);
127
+ //!!!TODO
127
128
  console.log(setParsed);
128
129
  return false;
129
130
  }
@@ -1 +1 @@
1
- {"version":3,"file":"volumeCapacityConversion.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/conversion/volumeCapacityConversion.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,QAAQ,EAYT,MAAM,mBAAmB,CAAC;AAE3B,KAAK,WAAW,GAAG;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,0BAA0B,EAAE,MAAM,CAAC;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,kBAAkB,EAAE,OAAO,CAAC;CAC7B,CAAC;AAuGF,eAAO,MAAM,wBAAwB,EAAE,QAAQ,CAAC,WAAW,CAa1D,CAAC"}
1
+ {"version":3,"file":"volumeCapacityConversion.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/conversion/volumeCapacityConversion.ts"],"names":[],"mappings":"AAcA,OAAO,EACL,QAAQ,EAcT,MAAM,mBAAmB,CAAC;AAE3B,KAAK,WAAW,GAAG;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,0BAA0B,EAAE,MAAM,CAAC;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,kBAAkB,EAAE,OAAO,CAAC;CAC7B,CAAC;AAoSF,eAAO,MAAM,wBAAwB,EAAE,QAAQ,CAAC,WAAW,CAgB1D,CAAC"}
@@ -1,5 +1,8 @@
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, MultiplyNode, } from "../../../tree/nodes/operators/multiplyNode.js";
5
+ import { operatorComposition } from "../../../tree/utilities/operatorComposition.js";
3
6
  import { coinFlip } from "../../../utils/alea/coinFlip.js";
4
7
  import { shuffle } from "../../../utils/alea/shuffle.js";
5
8
  import { doWhile } from "../../../utils/doWhile.js";
@@ -7,6 +10,26 @@ import { addValidProp, propWhile, tryToAddWrongProp, } from "../../exercise.js";
7
10
  import { getDistinctQuestions } from "../../utils/getDistinctQuestions.js";
8
11
  const volumeUnits = ["mm", "cm", "dm", "m", "dam", "hm", "km"];
9
12
  const capacityUnits = ["mL", "cL", "dL", "L", "daL", "hL", "kL"];
13
+ const getDecimalFactorForPrefix = (prefix) => {
14
+ switch (prefix) {
15
+ case "m":
16
+ return 0.001;
17
+ case "c":
18
+ return 0.01;
19
+ case "d":
20
+ return 0.1;
21
+ case "":
22
+ return 1;
23
+ case "da":
24
+ return 10;
25
+ case "h":
26
+ return 100;
27
+ case "k":
28
+ return 1000;
29
+ default:
30
+ throw new Error("unsupported");
31
+ }
32
+ };
10
33
  const getInstruction = (identifiers) => {
11
34
  const { randomValue, randomUnitIndex, randomUnitInstructionIndex, isVolumeToCapacity, } = identifiers;
12
35
  let instructionUnit;
@@ -40,6 +63,149 @@ const getAnswer = (identifiers) => {
40
63
  .toTex();
41
64
  }
42
65
  };
66
+ const getHint = (identifiers) => {
67
+ const { randomUnitIndex, randomUnitInstructionIndex, isVolumeToCapacity } = identifiers;
68
+ let volumeUnit;
69
+ let capacityUnit;
70
+ if (isVolumeToCapacity) {
71
+ volumeUnit = volumeUnits[randomUnitIndex];
72
+ capacityUnit = capacityUnits[randomUnitInstructionIndex];
73
+ }
74
+ else {
75
+ capacityUnit = capacityUnits[randomUnitIndex];
76
+ volumeUnit = volumeUnits[randomUnitInstructionIndex];
77
+ }
78
+ const prefixVolume = volumeUnit.slice(0, -1);
79
+ return `Une manière de procéder, très générale, est de convertir les deux unités proposées en $ {\\textrm{m}}^3 $.
80
+
81
+ ${(() => {
82
+ if (prefixVolume !== "") {
83
+ return `Pour ce faire,
84
+ retiens que l'unité qui figure sous l'exposant $ {}^3 $ donne la longueur du côté du cube de référence utilisé pour mesurer le volume.
85
+
86
+ $$
87
+ 1 {\\textrm{${volumeUnit}}}^3 = {1 \\ \\textrm{${volumeUnit}}} \\times {1 \\ \\textrm{${volumeUnit}}} \\times {1 \\ \\textrm{${volumeUnit}}}
88
+ $$
89
+
90
+ $$
91
+ 1 {\\textrm{${volumeUnit}}}^3
92
+ =
93
+ {${getDecimalFactorForPrefix(prefixVolume).frenchify()} \\ \\textrm{m}}
94
+ \\times
95
+ {${getDecimalFactorForPrefix(prefixVolume).frenchify()} \\ \\textrm{m}}
96
+ \\times
97
+ {${getDecimalFactorForPrefix(prefixVolume).frenchify()} \\ \\textrm{m}}
98
+ $$`;
99
+ }
100
+ else {
101
+ return "";
102
+ }
103
+ })()}
104
+
105
+ Retiens que dans $1 \\ {\\textrm{m}}^3$, il y $1000 \\ \\textrm{L}$ (comme les "tonnes à eau" dans les jardins).
106
+ Convertis donc les $\\textrm{${capacityUnit}}$ en $\\textrm{L}$ puis les $\\textrm{L}$ en $ {\\textrm{m}}^3 $.
107
+
108
+ `;
109
+ };
110
+ const getCorrection = (identifiers) => {
111
+ const { randomValue, randomUnitIndex, randomUnitInstructionIndex, isVolumeToCapacity, } = identifiers;
112
+ let instructionUnit;
113
+ let answerUnit;
114
+ let volumeUnit;
115
+ let capacityUnit;
116
+ if (isVolumeToCapacity) {
117
+ volumeUnit = volumeUnits[randomUnitIndex];
118
+ capacityUnit = capacityUnits[randomUnitInstructionIndex];
119
+ instructionUnit = volumeUnit;
120
+ answerUnit = capacityUnit;
121
+ }
122
+ else {
123
+ capacityUnit = capacityUnits[randomUnitIndex];
124
+ volumeUnit = volumeUnits[randomUnitInstructionIndex];
125
+ instructionUnit = capacityUnit;
126
+ answerUnit = volumeUnit;
127
+ }
128
+ const prefixVolume = volumeUnit.slice(0, -1);
129
+ const prefixCapacity = capacityUnit.slice(0, -1);
130
+ const nodeFactorCapacityUnitToL = getDecimalFactorForPrefix(prefixCapacity).toTree();
131
+ const nodeFactorCapacityUnitToM3 = multiply(nodeFactorCapacityUnitToL, frac(1, 1000));
132
+ const nodeFactorLengthUnitToM = getDecimalFactorForPrefix(prefixVolume).toTree();
133
+ const nodeFactorVolumeUnitToM3 = operatorComposition(MultiplyNode, [...Array(3).keys()].map(() => nodeFactorLengthUnitToM));
134
+ let nodeFraction;
135
+ if (isVolumeToCapacity) {
136
+ nodeFraction = frac(nodeFactorVolumeUnitToM3, nodeFactorCapacityUnitToM3);
137
+ }
138
+ else {
139
+ nodeFraction = frac(nodeFactorCapacityUnitToM3, nodeFactorVolumeUnitToM3);
140
+ }
141
+ return `Si on nomme $x$ le nombre que l'on recherche, on a :
142
+
143
+ $$
144
+ ${randomValue.frenchify()}\\ \\textrm{${instructionUnit}}${isVolumeToCapacity ? "^3" : ""} = x \\ \\textrm{${answerUnit}}${!isVolumeToCapacity ? "^3" : ""}
145
+ $$
146
+
147
+ Quand on calcule avec des unités, l'unité est multipliée de façon implicite :
148
+
149
+ L'égalité précédente est équivalente à :
150
+
151
+ $$
152
+ ${randomValue.frenchify()}\\ \\times 1 \\ \\textrm{${instructionUnit}}${isVolumeToCapacity ? "^3" : ""} = x \\times 1 \\ \\textrm{${answerUnit}}${!isVolumeToCapacity ? "^3" : ""}
153
+ $$
154
+
155
+ Donc :
156
+
157
+ $$
158
+ ${randomValue.frenchify()}\\ \\times
159
+ \\frac{1 \\ \\textrm{${instructionUnit}}${isVolumeToCapacity ? "^3" : ""}}
160
+ {1 \\textrm{${answerUnit}}${!isVolumeToCapacity ? "^3" : ""}} = x
161
+ $$
162
+
163
+ On convertit toutes les unités en $ {\\textrm{m}}^3 $ :
164
+
165
+ ${(() => {
166
+ if (prefixVolume !== "") {
167
+ return `
168
+
169
+ $$
170
+ 1 \\ \\textrm{${volumeUnit}}^3 = ${nodeFactorVolumeUnitToM3.toTex()} \\ {\\textrm{m}}^3
171
+ $$
172
+
173
+ `;
174
+ }
175
+ else {
176
+ return "";
177
+ }
178
+ })()}
179
+
180
+ ${(() => {
181
+ if (prefixCapacity !== "") {
182
+ return `
183
+
184
+ $$
185
+ 1 \\ \\textrm{${capacityUnit}} = ${nodeFactorCapacityUnitToL.toTex()} \\ \\textrm{L} = ${nodeFactorCapacityUnitToM3.toTex()} \\ {\\textrm{m}}^3
186
+ $$
187
+
188
+ `;
189
+ }
190
+ else {
191
+ return `
192
+
193
+ $$
194
+ 1 \\ \\textrm{L} = ${nodeFactorCapacityUnitToM3.toTex()} \\ {\\textrm{m}}^3
195
+ $$
196
+
197
+ `;
198
+ }
199
+ })()}
200
+
201
+ Le nombre recherché est donc :
202
+
203
+ $$
204
+ x = ${randomValue.frenchify()}\\ \\times ${nodeFraction.toTex()} = ${getAnswer(identifiers)}
205
+ $$
206
+
207
+ `;
208
+ };
43
209
  const getVolumeCapacityConversion = () => {
44
210
  const randomUnitInstructionIndex = randint(0, 7);
45
211
  const randomUnitIndex = randint(
@@ -62,6 +228,8 @@ const getQuestionFromIdentifiers = (identifiers) => {
62
228
  keys: [],
63
229
  answerFormat: "tex",
64
230
  identifiers,
231
+ hint: getHint(identifiers),
232
+ correction: getCorrection(identifiers),
65
233
  };
66
234
  return question;
67
235
  };
@@ -90,4 +258,7 @@ export const volumeCapacityConversion = {
90
258
  isAnswerValid,
91
259
  subject: "Mathématiques",
92
260
  getQuestionFromIdentifiers,
261
+ getHint,
262
+ getCorrection,
263
+ hasHintAndCorrection: true,
93
264
  };
@@ -1 +1 @@
1
- {"version":3,"file":"barChartReading.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/dataRepresentations/barChartReading.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAOrC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AA4HF,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,WAAW,CAajD,CAAC;;AAgFF,oBAAoB;AACpB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmFG"}
1
+ {"version":3,"file":"barChartReading.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/dataRepresentations/barChartReading.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAiBT,MAAM,6BAA6B,CAAC;AAOrC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAwIF,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,WAAW,CAgBjD,CAAC;;AAgFF,oBAAoB;AACpB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmFG"}
@@ -25,12 +25,18 @@ const getInstruction = (identifiers) => {
25
25
  Combien de pommes de $${labels[itemAsked]}\\ \\textrm{cm}$ de diamètre le producteur a-t-il récoltées ?
26
26
  `;
27
27
  };
28
- // const getHint: GetHint<Identifiers> = (identifiers) => {
29
- // return "";
30
- // };
31
- // const getCorrection: GetCorrection<Identifiers> = (identifiers) => {
32
- // return "";
33
- // };
28
+ const getHint = (identifiers) => {
29
+ const { labels, itemAsked } = identifiers;
30
+ return `Trouve le bâton qui correspond aux pommes de $${labels[itemAsked]}\\ \\textrm{cm}$ et lis la graduation correspondant à sa hauteur.`;
31
+ };
32
+ const getCorrection = (identifiers) => {
33
+ const { labels, itemAsked, data } = identifiers;
34
+ return `Le bâton qui correspond aux pommes de $${labels[itemAsked]}\\ \\textrm{cm}$ est le $${itemAsked + 1}^{\\text{${itemAsked > 0 ? "e" : "er"}}}$ en partant de la gauche.
35
+ La graduation correspondante est $${data[itemAsked].frenchify()}$.
36
+
37
+ Le producteur a récolté $${data[itemAsked].frenchify()}$ pommes de $${labels[itemAsked]}\\ \\textrm{cm}$.
38
+ `;
39
+ };
34
40
  const getKeys = () => {
35
41
  return [];
36
42
  };
@@ -98,8 +104,8 @@ const getQuestionFromIdentifiers = (identifiers) => {
98
104
  keys: getKeys(identifiers),
99
105
  answerFormat: "tex",
100
106
  identifiers,
101
- // hint: getHint(identifiers),
102
- // correction: getCorrection(identifiers),
107
+ hint: getHint(identifiers),
108
+ correction: getCorrection(identifiers),
103
109
  ggbOptions: getGGBOptions(identifiers),
104
110
  };
105
111
  return question;
@@ -116,6 +122,9 @@ export const barChartReading = {
116
122
  subject: "Mathématiques",
117
123
  getQuestionFromIdentifiers,
118
124
  hasGeogebra: true,
125
+ getHint,
126
+ getCorrection,
127
+ hasHintAndCorrection: true,
119
128
  };
120
129
  // !signtable
121
130
  // const options = { svg: true };
@@ -1 +1 @@
1
- {"version":3,"file":"functionGraphReading.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/dataRepresentations/functionGraphReading.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAWrC,KAAK,WAAW,GAAG;IACjB,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAwHF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAkBtD,CAAC;;AAEF,UAAU;AACV;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsGE"}
1
+ {"version":3,"file":"functionGraphReading.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/dataRepresentations/functionGraphReading.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAiBT,MAAM,6BAA6B,CAAC;AAYrC,KAAK,WAAW,GAAG;IACjB,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AA+MF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAmBtD,CAAC;;AAEF,UAAU;AACV;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsGE"}
@@ -1,8 +1,9 @@
1
1
  import { addValidProp, shuffleProps, tryToAddWrongProp, propWhile, } from "../../../exercises/exercise.js";
2
2
  import { getDistinctQuestions } from "../../../exercises/utils/getDistinctQuestions.js";
3
- import { randomColor } from "../../../geogebra/colors.js";
3
+ import { greenMain, randomColor } from "../../../geogebra/colors.js";
4
4
  import { GeogebraConstructor } from "../../../geogebra/geogebraConstructor.js";
5
5
  import { approxEqual } from "../../../geogebra/parsers/approxEqual.js";
6
+ import { Point } from "../../../math/geometry/point.js";
6
7
  import { randint } from "../../../math/utils/random/randint.js";
7
8
  import { round } from "../../../math/utils/round.js";
8
9
  import { valueParser } from "../../../tree/parsers/valueParser.js";
@@ -32,11 +33,94 @@ const getInstruction = (identifiers) => {
32
33
  return `La droite $(d_1)$ modélise l'évolution du coût total d'un voyage scolaire en fonction du nombre de participants.
33
34
 
34
35
  ${isAskingX
35
- ? `Si le coût total du voyage est de $${yValue}€$, quel est le nombre de participants ?`
36
+ ? `Si le coût total du voyage est de $${yValue}\\ \\textrm{€}$, quel est le nombre de participants ?`
36
37
  : `Si le nombre de participants est $${xValue}$, quel est le coût total du voyage ?`}`;
37
38
  };
38
- // const getHint: GetHint<Identifiers> = (identifiers) => {};
39
- // const getCorrection: GetCorrection<Identifiers> = (identifiers) => {};
39
+ const getHint = () => {
40
+ return `Cherche l'axe et la graduation représentant la donnée qui t'est fournie puis utilise la grille pour atteindre la droite et ensuite la graduation correspondante sur l'autre axe.`;
41
+ };
42
+ const getCorrection = (identifiers) => {
43
+ const { isAskingX, xValue, yValue } = identifiers;
44
+ if (isAskingX) {
45
+ return `On part de l'axe des ordonnées, à la graduation $${yValue}$.
46
+
47
+ On suit la grille horizontalement jusqu'à atteindre la droite.
48
+
49
+ On suit la grille verticalement jusqu'à atteindre l'axe des abscisses.
50
+
51
+ On lit la valeur $${getAnswer(identifiers)}$.
52
+
53
+ Le nombre de participants est donc $${getAnswer(identifiers)}$.`;
54
+ }
55
+ else {
56
+ return `On part de l'axe des abscisses, à la graduation $${xValue}$.
57
+
58
+ On suit la grille verticalement jusqu'à atteindre la droite.
59
+
60
+ On suit la grille horizontalement jusqu'à atteindre l'axe des abscisses.
61
+
62
+ On lit la valeur $${getAnswer(identifiers)}$.
63
+
64
+ Le coût total du voyage est donc $${getAnswer(identifiers)} \\ \\textrm{€}$.`;
65
+ }
66
+ };
67
+ const getCorrectionGGBOptions = (identifiers) => {
68
+ const { a, b, yValue, xValue, isAskingX } = identifiers;
69
+ const x = xValue ?? (yValue - b) / a;
70
+ const y = yValue ?? a * xValue + b;
71
+ const xText = 4;
72
+ const yText = a * xText + b;
73
+ const color = randomColor();
74
+ const pointX0 = new Point("PX0", x, 0);
75
+ const point0Y = new Point("P0Y", 0, y);
76
+ const pointXY = new Point("PXY", x, y);
77
+ const ggb = new GeogebraConstructor({
78
+ commands: [
79
+ `f = Function(${a}*x+${b}, 0, 1000)`,
80
+ `SetColor(f, "${color}")`,
81
+ `T = Text("$(d_1)$", (${xText},${yText}), true, true)`,
82
+ `SetColor(T, "${color}")`,
83
+ `Text("Nombre \\ de \\ participants", (x(Corner(2)),50), true, true, -1)`,
84
+ `Text("Coût \\ en \\ €", (1, y(Corner(4))), true, true)`,
85
+ // `(${xValue},${yValue})`,
86
+ ...(() => {
87
+ if (isAskingX) {
88
+ return [
89
+ `v1 = Vector(${point0Y.toMathString()},${pointXY.toMathString()})`,
90
+ `SetColor(v1, "${greenMain}")`,
91
+ `v2 = Vector(${pointXY.toMathString()},${pointX0.toMathString()})`,
92
+ `SetColor(v2, "${greenMain}")`,
93
+ ];
94
+ }
95
+ else {
96
+ return [
97
+ `v1 = Vector(${pointX0.toMathString()},${pointXY.toMathString()})`,
98
+ `SetColor(v1, "${greenMain}")`,
99
+ `v2 = Vector(${pointXY.toMathString()},${point0Y.toMathString()})`,
100
+ `SetColor(v2, "${greenMain}")`,
101
+ ];
102
+ }
103
+ })(),
104
+ ],
105
+ forbidShiftDragZoom: false,
106
+ gridDistance: [2, 500],
107
+ lockedAxesRatio: 2 / 500,
108
+ xAxis: {
109
+ // label: "$\\math{\\tiny \\text{Nb. de \\\\ participants}}$",
110
+ steps: 2,
111
+ showPositive: true,
112
+ },
113
+ yAxis: {
114
+ // label: "y",
115
+ steps: 500,
116
+ showPositive: true,
117
+ },
118
+ fontSize: 14,
119
+ });
120
+ return ggb.getOptions({
121
+ coords: [-1, x + 6, -100, y + 500],
122
+ });
123
+ };
40
124
  const getGGBOptions = (identifiers) => {
41
125
  const { a, b, yValue, xValue } = identifiers;
42
126
  const x = xValue ?? (yValue - b) / a;
@@ -111,9 +195,10 @@ const getQuestionFromIdentifiers = (identifiers) => {
111
195
  keys: getKeys(identifiers),
112
196
  answerFormat: "tex",
113
197
  identifiers,
114
- // hint: getHint(identifiers),
115
- // correction: getCorrection(identifiers),
198
+ hint: getHint(identifiers),
199
+ correction: getCorrection(identifiers),
116
200
  ggbOptions: getGGBOptions(identifiers),
201
+ correctionGgbOptions: getCorrectionGGBOptions(identifiers),
117
202
  };
118
203
  return question;
119
204
  };
@@ -127,13 +212,14 @@ export const functionGraphReading = {
127
212
  getPropositions,
128
213
  isAnswerValid,
129
214
  subject: "Mathématiques",
130
- // getHint,
131
- // getCorrection,
132
215
  getInstruction,
133
216
  getAnswer,
134
217
  getGGBOptions,
135
218
  hasGeogebra: true,
136
219
  getQuestionFromIdentifiers,
220
+ getHint,
221
+ getCorrection,
222
+ hasHintAndCorrection: true,
137
223
  };
138
224
  /***SVG */
139
225
  /**
@@ -1,8 +1,13 @@
1
1
  import { Exercise } from "../../../../exercises/exercise.js";
2
+ type Options = {
3
+ isLinear: boolean;
4
+ };
2
5
  type Identifiers = {
6
+ isLinear: boolean;
3
7
  b: number;
4
8
  secondPoint: number[];
5
9
  };
6
- export declare const affineExpressionReading: Exercise<Identifiers>;
10
+ export declare const affineExpressionReading: Exercise<Identifiers, Options>;
11
+ export declare const linearExpressionReading: Exercise<Identifiers, Options>;
7
12
  export {};
8
13
  //# sourceMappingURL=affineExpressionReading.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"affineExpressionReading.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/affines/affineExpressionReading.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAgBT,MAAM,6BAA6B,CAAC;AAkBrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB,CAAC;AA8KF,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,EAiBT,MAAM,6BAA6B,CAAC;AAmBrC,KAAK,OAAO,GAAG;IACb,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,OAAO,CAAC;IAClB,CAAC,EAAE,MAAM,CAAC;IACV,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB,CAAC;AAiTF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAkBlE,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAmBlE,CAAC"}