math-exercises 3.0.55 → 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 (147) hide show
  1. package/lib/exercises/math/calcul/arithmetics/index.d.ts +1 -0
  2. package/lib/exercises/math/calcul/arithmetics/index.d.ts.map +1 -1
  3. package/lib/exercises/math/calcul/arithmetics/index.js +1 -0
  4. package/lib/exercises/math/calcul/arithmetics/ppcmCalcul.d.ts +8 -0
  5. package/lib/exercises/math/calcul/arithmetics/ppcmCalcul.d.ts.map +1 -0
  6. package/lib/exercises/math/calcul/arithmetics/ppcmCalcul.js +87 -0
  7. package/lib/exercises/math/calcul/proportionality/proportionalityTable.d.ts.map +1 -1
  8. package/lib/exercises/math/calcul/proportionality/proportionalityTable.js +2 -2
  9. package/lib/exercises/math/calculLitteral/equation/binomialsTrinomialsProposedSolutions.d.ts.map +1 -1
  10. package/lib/exercises/math/calculLitteral/equation/binomialsTrinomialsProposedSolutions.js +7 -1
  11. package/lib/exercises/math/calculLitteral/equation/choseOperationToSolveEquation.d.ts.map +1 -1
  12. package/lib/exercises/math/calculLitteral/equation/choseOperationToSolveEquation.js +65 -13
  13. package/lib/exercises/math/calculLitteral/factorisation/factoType1Exercise.d.ts.map +1 -1
  14. package/lib/exercises/math/calculLitteral/factorisation/factoType1Exercise.js +43 -0
  15. package/lib/exercises/math/calculLitteral/systems/basicNiceValuesSystemResolution.d.ts.map +1 -1
  16. package/lib/exercises/math/calculLitteral/systems/basicNiceValuesSystemResolution.js +23 -0
  17. package/lib/exercises/math/calculLitteral/systems/basicSystemResolution.d.ts.map +1 -1
  18. package/lib/exercises/math/calculLitteral/systems/basicSystemResolution.js +23 -0
  19. package/lib/exercises/math/calculLitteral/systems/verifySystemSolution.d.ts.map +1 -1
  20. package/lib/exercises/math/calculLitteral/systems/verifySystemSolution.js +49 -0
  21. package/lib/exercises/math/conversion/capacityConversion.d.ts.map +1 -1
  22. package/lib/exercises/math/conversion/capacityConversion.js +68 -12
  23. package/lib/exercises/math/conversion/hoursToDecimal.d.ts.map +1 -1
  24. package/lib/exercises/math/conversion/hoursToDecimal.js +73 -15
  25. package/lib/exercises/math/conversion/lengthConversion.d.ts.map +1 -1
  26. package/lib/exercises/math/conversion/lengthConversion.js +55 -6
  27. package/lib/exercises/math/conversion/massConversion.d.ts.map +1 -1
  28. package/lib/exercises/math/conversion/massConversion.js +72 -16
  29. package/lib/exercises/math/conversion/volumeConversion.d.ts.map +1 -1
  30. package/lib/exercises/math/conversion/volumeConversion.js +72 -12
  31. package/lib/exercises/math/functions/affines/signFunction.d.ts.map +1 -1
  32. package/lib/exercises/math/functions/affines/signFunction.js +23 -11
  33. package/lib/exercises/math/functions/basics/imageFunctionGeogebra.d.ts.map +1 -1
  34. package/lib/exercises/math/functions/basics/imageFunctionGeogebra.js +16 -0
  35. package/lib/exercises/math/geometry/areas/triangleArea.d.ts.map +1 -1
  36. package/lib/exercises/math/geometry/areas/triangleArea.js +34 -2
  37. package/lib/exercises/math/geometry/areas/triangleAreaV2.d.ts.map +1 -1
  38. package/lib/exercises/math/geometry/areas/triangleAreaV2.js +54 -8
  39. package/lib/exercises/math/geometry/cartesian/cartesianEquationOfLine.d.ts.map +1 -1
  40. package/lib/exercises/math/geometry/cartesian/cartesianEquationOfLine.js +12 -5
  41. package/lib/exercises/math/geometry/cartesian/readAbscissOnLine.d.ts.map +1 -1
  42. package/lib/exercises/math/geometry/cartesian/readAbscissOnLine.js +29 -1
  43. package/lib/exercises/math/geometry/cartesian/readAbscissOnSemiLine.d.ts.map +1 -1
  44. package/lib/exercises/math/geometry/cartesian/readAbscissOnSemiLine.js +25 -1
  45. package/lib/exercises/math/geometry/lines/cartesianEquationToReduced.d.ts.map +1 -1
  46. package/lib/exercises/math/geometry/lines/cartesianEquationToReduced.js +68 -29
  47. package/lib/exercises/math/geometry/lines/cartesianEquationsIntersection.d.ts.map +1 -1
  48. package/lib/exercises/math/geometry/lines/cartesianEquationsIntersection.js +56 -4
  49. package/lib/exercises/math/geometry/lines/directorVectorFromAnother.d.ts.map +1 -1
  50. package/lib/exercises/math/geometry/lines/directorVectorFromAnother.js +1 -0
  51. package/lib/exercises/math/geometry/lines/drawLineFromCartesianEquation.d.ts.map +1 -1
  52. package/lib/exercises/math/geometry/lines/drawLineFromCartesianEquation.js +71 -25
  53. package/lib/exercises/math/geometry/lines/index.d.ts +1 -0
  54. package/lib/exercises/math/geometry/lines/index.d.ts.map +1 -1
  55. package/lib/exercises/math/geometry/lines/index.js +1 -0
  56. package/lib/exercises/math/geometry/vectors/findCoordForAligment.d.ts +6 -0
  57. package/lib/exercises/math/geometry/vectors/findCoordForAligment.d.ts.map +1 -1
  58. package/lib/exercises/math/geometry/vectors/findCoordForAligment.js +161 -92
  59. package/lib/exercises/math/geometry/vectors/index.d.ts +1 -0
  60. package/lib/exercises/math/geometry/vectors/index.d.ts.map +1 -1
  61. package/lib/exercises/math/geometry/vectors/index.js +1 -0
  62. package/lib/exercises/math/geometry/volumes/coneVolume.d.ts.map +1 -1
  63. package/lib/exercises/math/geometry/volumes/coneVolume.js +68 -6
  64. package/lib/exercises/math/geometry/volumes/parallelepipedVolume.d.ts.map +1 -1
  65. package/lib/exercises/math/geometry/volumes/parallelepipedVolume.js +55 -11
  66. package/lib/exercises/math/geometry/volumes/sphereVolume.d.ts.map +1 -1
  67. package/lib/exercises/math/geometry/volumes/sphereVolume.js +31 -3
  68. package/lib/exercises/math/geometry/volumes/volumeOfCube.d.ts.map +1 -1
  69. package/lib/exercises/math/geometry/volumes/volumeOfCube.js +46 -18
  70. package/lib/exercises/math/geometry/volumes/volumeOfPyramidWithSquareOrRectBase.d.ts.map +1 -1
  71. package/lib/exercises/math/geometry/volumes/volumeOfPyramidWithSquareOrRectBase.js +114 -63
  72. package/lib/exercises/math/geometry/volumes/volumeOfPyramidWithTriangleBase.d.ts.map +1 -1
  73. package/lib/exercises/math/geometry/volumes/volumeOfPyramidWithTriangleBase.js +102 -64
  74. package/lib/exercises/math/geometry/volumes/volumeOfPyramidWithTriangleRectBase.d.ts.map +1 -1
  75. package/lib/exercises/math/geometry/volumes/volumeOfPyramidWithTriangleRectBase.js +99 -53
  76. package/lib/exercises/math/limits/polynomLimit.d.ts +1 -1
  77. package/lib/exercises/math/limits/polynomLimit.d.ts.map +1 -1
  78. package/lib/exercises/math/limits/polynomLimit.js +28 -9
  79. package/lib/exercises/math/limits/polynomLimitNoFI.d.ts +1 -1
  80. package/lib/exercises/math/limits/polynomLimitNoFI.d.ts.map +1 -1
  81. package/lib/exercises/math/limits/polynomLimitNoFI.js +29 -10
  82. package/lib/exercises/math/powers/calculateNegativePower.d.ts.map +1 -1
  83. package/lib/exercises/math/powers/calculateNegativePower.js +59 -16
  84. package/lib/exercises/math/powers/decimalToScientific.d.ts.map +1 -1
  85. package/lib/exercises/math/powers/decimalToScientific.js +55 -11
  86. package/lib/exercises/math/powers/index.d.ts +1 -0
  87. package/lib/exercises/math/powers/index.d.ts.map +1 -1
  88. package/lib/exercises/math/powers/index.js +1 -0
  89. package/lib/exercises/math/powers/powersDivision.d.ts +5 -2
  90. package/lib/exercises/math/powers/powersDivision.d.ts.map +1 -1
  91. package/lib/exercises/math/powers/powersDivision.js +68 -53
  92. package/lib/exercises/math/powers/powersMixOperations.d.ts +1 -0
  93. package/lib/exercises/math/powers/powersMixOperations.d.ts.map +1 -1
  94. package/lib/exercises/math/powers/powersMixOperations.js +88 -17
  95. package/lib/exercises/math/powers/powersOfTenMixOperations.d.ts +10 -0
  96. package/lib/exercises/math/powers/powersOfTenMixOperations.d.ts.map +1 -0
  97. package/lib/exercises/math/powers/powersOfTenMixOperations.js +129 -0
  98. package/lib/exercises/math/powers/powersOfTenToDecimal.d.ts.map +1 -1
  99. package/lib/exercises/math/powers/powersOfTenToDecimal.js +32 -3
  100. package/lib/exercises/math/powers/powersProduct.d.ts.map +1 -1
  101. package/lib/exercises/math/powers/powersProduct.js +1 -0
  102. package/lib/exercises/math/powers/scientificToDecimal.d.ts.map +1 -1
  103. package/lib/exercises/math/powers/scientificToDecimal.js +50 -10
  104. package/lib/exercises/math/primitive/polynomialPrimitive.d.ts.map +1 -1
  105. package/lib/exercises/math/primitive/polynomialPrimitive.js +1 -0
  106. package/lib/exercises/math/sequences/geometric/geometricFirstTermsGeneralSum.d.ts.map +1 -1
  107. package/lib/exercises/math/sequences/geometric/geometricFirstTermsGeneralSum.js +50 -3
  108. package/lib/exercises/math/sequences/geometric/geometricFirstTermsSum.d.ts.map +1 -1
  109. package/lib/exercises/math/sequences/geometric/geometricFirstTermsSum.js +32 -0
  110. package/lib/exercises/math/trigonometry/remarkableValues.d.ts.map +1 -1
  111. package/lib/exercises/math/trigonometry/remarkableValues.js +8 -0
  112. package/lib/exercises/math/trigonometry/trigonometry.d.ts.map +1 -1
  113. package/lib/exercises/math/trigonometry/trigonometry.js +67 -1
  114. package/lib/exercises/math/trigonometry/trigonometryAngleCalcul.d.ts.map +1 -1
  115. package/lib/exercises/math/trigonometry/trigonometryAngleCalcul.js +89 -0
  116. package/lib/index.d.ts +22 -4
  117. package/lib/index.d.ts.map +1 -1
  118. package/lib/math/geometry/angle.d.ts.map +1 -1
  119. package/lib/math/geometry/angle.js +0 -5
  120. package/lib/math/geometry/vector.d.ts +3 -0
  121. package/lib/math/geometry/vector.d.ts.map +1 -1
  122. package/lib/math/geometry/vector.js +25 -0
  123. package/lib/math/numbers/decimals/decimal.d.ts +1 -0
  124. package/lib/math/numbers/decimals/decimal.d.ts.map +1 -1
  125. package/lib/math/numbers/decimals/decimal.js +2 -0
  126. package/lib/math/systems/generalSystem.d.ts +6 -1
  127. package/lib/math/systems/generalSystem.d.ts.map +1 -1
  128. package/lib/math/systems/generalSystem.js +137 -0
  129. package/lib/math/utils/arithmetic/lcm.d.ts +2 -0
  130. package/lib/math/utils/arithmetic/lcm.d.ts.map +1 -0
  131. package/lib/math/utils/arithmetic/lcm.js +5 -0
  132. package/lib/playground.d.ts.map +1 -1
  133. package/lib/playground.js +1 -3
  134. package/lib/tree/nodes/algebraicNode.d.ts +1 -0
  135. package/lib/tree/nodes/algebraicNode.d.ts.map +1 -1
  136. package/lib/tree/nodes/equations/equalNode.d.ts +7 -1
  137. package/lib/tree/nodes/equations/equalNode.d.ts.map +1 -1
  138. package/lib/tree/nodes/equations/equalNode.js +17 -9
  139. package/lib/tree/nodes/operators/addNode.js +1 -1
  140. package/lib/tree/nodes/operators/fractionNode.d.ts +2 -2
  141. package/lib/tree/nodes/operators/fractionNode.d.ts.map +1 -1
  142. package/lib/tree/nodes/operators/fractionNode.js +37 -17
  143. package/lib/tree/nodes/operators/powerNode.d.ts.map +1 -1
  144. package/lib/tree/nodes/operators/powerNode.js +5 -0
  145. package/lib/tree/nodes/sets/intervalNode.d.ts.map +1 -1
  146. package/lib/tree/nodes/sets/intervalNode.js +3 -1
  147. package/package.json +1 -1
@@ -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"}
@@ -3,9 +3,12 @@ import { Decimal, DecimalConstructor, } from "../../../math/numbers/decimals/dec
3
3
  import { randint } from "../../../math/utils/random/randint.js";
4
4
  import { Measure } from "../../../pc/measure/measure.js";
5
5
  import { DistanceUnit } from "../../../pc/units/distanceUnits.js";
6
+ import { frac } from "../../../tree/nodes/operators/fractionNode.js";
7
+ import { multiply } from "../../../tree/nodes/operators/multiplyNode.js";
6
8
  import { random } from "../../../utils/alea/random.js";
7
9
  import { shuffle } from "../../../utils/alea/shuffle.js";
8
10
  import { doWhile } from "../../../utils/doWhile.js";
11
+ import { alignTex } from "../../../utils/latex/alignTex.js";
9
12
  import { GeneratorOptionTarget, GeneratorOptionType, addValidProp, tryToAddWrongProp, } from "../../exercise.js";
10
13
  import { getDistinctQuestions } from "../../utils/getDistinctQuestions.js";
11
14
  const units = ["mm", "cm", "dm", "m", "dam", "hm", "km"];
@@ -18,11 +21,50 @@ const unitsObj = [
18
21
  DistanceUnit.hm,
19
22
  DistanceUnit.km,
20
23
  ];
24
+ const getHint = (identifiers) => {
25
+ const { randomUnitIndex, randomUnitInstructionIndex } = identifiers;
26
+ const unit = units[randomUnitIndex];
27
+ const target = units[randomUnitInstructionIndex];
28
+ const space = randomUnitIndex - randomUnitInstructionIndex;
29
+ return `On rappelle que :
30
+
31
+ $$
32
+ 1 \\ \\textrm{${unit}} = ${space > 0 ? Math.pow(10, space) : frac(1, Math.pow(10, -space)).toTex()} \\ \\textrm{${target}}
33
+ $$`;
34
+ };
35
+ const getCorrection = (identifiers) => {
36
+ const { randomLength, randomUnitIndex, randomUnitInstructionIndex } = identifiers;
37
+ const unit = units[randomUnitIndex];
38
+ const target = units[randomUnitInstructionIndex];
39
+ const space = randomUnitIndex - randomUnitInstructionIndex;
40
+ const coeff = space > 0 ? Math.pow(10, space).toTree() : frac(1, Math.pow(10, -space));
41
+ return `On sait que :
42
+
43
+ $$
44
+ 1 \\ \\textrm{${unit}} = ${coeff.toTex()} \\ \\textrm{${target}}
45
+ $$
46
+
47
+ Il suffit alors de multiplier $${randomLength.frenchify()}$ par $${coeff.toTex()}$ :
48
+
49
+ ${alignTex([
50
+ [
51
+ `${randomLength.frenchify()} \\textrm{${unit}} `,
52
+ "=",
53
+ `${multiply(coeff, randomLength).toTex()}\\ \\textrm{${target}}`,
54
+ ],
55
+ ["", "=", `${getAnswer(identifiers)}\\ \\textrm{${target}}`],
56
+ ])}
57
+ `;
58
+ };
21
59
  const getInstruction = (identifiers, options) => {
22
60
  const measure = new Measure(identifiers.randomLength, 0, unitsObj[identifiers.randomUnitIndex]);
23
- return `Compléter : $${measure.toTex({
61
+ return `Compléter :
62
+
63
+ $$
64
+ ${measure.toTex({
24
65
  notScientific: true,
25
- })} = \\ldots ${unitsObj[identifiers.randomUnitInstructionIndex].toTex()}$`;
66
+ })} = \\ldots ${unitsObj[identifiers.randomUnitInstructionIndex].toTex()}
67
+ $$`;
26
68
  };
27
69
  const getAnswer = (identifiers, options) => {
28
70
  const measure = new Measure(identifiers.randomLength, 0, unitsObj[identifiers.randomUnitIndex]);
@@ -31,12 +73,12 @@ const getAnswer = (identifiers, options) => {
31
73
  .toTex({ notScientific: true, hideUnit: true });
32
74
  return answer;
33
75
  };
34
- const getLengthConversion = (options) => {
76
+ const getLengthConversion = (opts) => {
35
77
  // if (options && !validateOptions(options).valid)
36
78
  // throw Error("options invalides, gen lengthConversion");
37
79
  const availableUnitsIndexes = units
38
80
  .map((e, i) => i)
39
- .filter((i) => !options?.units?.length || options.units.includes(units[i]));
81
+ .filter((i) => !opts?.units?.length || opts.units.includes(units[i]));
40
82
  const randomUnitIndex = random(availableUnitsIndexes);
41
83
  const randomUnitInstructionIndex = random(availableUnitsIndexes, [
42
84
  randomUnitIndex,
@@ -47,12 +89,17 @@ const getLengthConversion = (options) => {
47
89
  randomUnitIndex,
48
90
  randomUnitInstructionIndex,
49
91
  };
92
+ return getQuestionFromIdentifiers(identifiers, opts);
93
+ };
94
+ const getQuestionFromIdentifiers = (identifiers, opts) => {
50
95
  const question = {
51
- instruction: getInstruction(identifiers, options),
52
- answer: getAnswer(identifiers, options),
96
+ instruction: getInstruction(identifiers, opts),
97
+ answer: getAnswer(identifiers, opts),
53
98
  keys: [],
54
99
  answerFormat: "tex",
55
100
  identifiers,
101
+ hint: getHint(identifiers),
102
+ correction: getCorrection(identifiers),
56
103
  };
57
104
  return question;
58
105
  };
@@ -107,4 +154,6 @@ export const lengthConversion = {
107
154
  getInstruction,
108
155
  options,
109
156
  validateOptions,
157
+ hasHintAndCorrection: true,
158
+ getQuestionFromIdentifiers,
110
159
  };
@@ -1 +1 @@
1
- {"version":3,"file":"massConversion.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/conversion/massConversion.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,QAAQ,EAQT,MAAM,mBAAmB,CAAC;AAG3B,KAAK,WAAW,GAAG;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,0BAA0B,EAAE,MAAM,CAAC;IACnC,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AA8DF,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,WAAW,CAahD,CAAC"}
1
+ {"version":3,"file":"massConversion.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/conversion/massConversion.ts"],"names":[],"mappings":"AAYA,OAAO,EACL,QAAQ,EAaT,MAAM,mBAAmB,CAAC;AAG3B,KAAK,WAAW,GAAG;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,0BAA0B,EAAE,MAAM,CAAC;IACnC,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AA6HF,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,WAAW,CAahD,CAAC"}
@@ -1,31 +1,87 @@
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 { numberParser } from "../../../tree/parsers/numberParser.js";
4
6
  import { shuffle } from "../../../utils/alea/shuffle.js";
5
7
  import { doWhile } from "../../../utils/doWhile.js";
8
+ import { alignTex } from "../../../utils/latex/alignTex.js";
6
9
  import { addValidProp, tryToAddWrongProp, } from "../../exercise.js";
7
10
  import { getDistinctQuestions } from "../../utils/getDistinctQuestions.js";
8
11
  const units = ["mg", "cg", "dg", "g", "dag", "hg", "kg"];
9
- const getMassConversion = () => {
10
- const randomUnitIndex = randint(0, 7);
11
- const randomUnitInstructionIndex = randint(0, 7, [randomUnitIndex]);
12
- const randomMass = doWhile(() => DecimalConstructor.random(0, 1000, randint(0, 4)), (x) => x.value === 0);
13
- const answer = (randomMass.multiplyByPowerOfTen(randomUnitIndex - randomUnitInstructionIndex).value + "").replace(".", ",");
12
+ const getHint = (identifiers) => {
13
+ const { randomUnitIndex, randomUnitInstructionIndex } = identifiers;
14
+ const unit = units[randomUnitIndex];
15
+ const target = units[randomUnitInstructionIndex];
16
+ const space = randomUnitIndex - randomUnitInstructionIndex;
17
+ return `On rappelle que :
18
+
19
+ $$
20
+ 1 \\ \\textrm{${unit}} = ${space > 0 ? Math.pow(10, space) : frac(1, Math.pow(10, -space)).toTex()} \\ \\textrm{${target}}
21
+ $$`;
22
+ };
23
+ const getCorrection = (identifiers) => {
24
+ const { randomMass, randomUnitIndex, randomUnitInstructionIndex } = identifiers;
25
+ const unit = units[randomUnitIndex];
26
+ const target = units[randomUnitInstructionIndex];
27
+ const space = randomUnitIndex - randomUnitInstructionIndex;
28
+ const coeff = space > 0 ? Math.pow(10, space).toTree() : frac(1, Math.pow(10, -space));
29
+ return `On sait que :
30
+
31
+ $$
32
+ 1 \\ \\textrm{${unit}} = ${coeff.toTex()} \\ \\textrm{${target}}
33
+ $$
34
+
35
+ Il suffit alors de multiplier $${randomMass.frenchify()}$ par $${coeff.toTex()}$ :
36
+
37
+ ${alignTex([
38
+ [
39
+ `${randomMass.frenchify()} \\textrm{${unit}} `,
40
+ "=",
41
+ `${multiply(coeff, randomMass).toTex()}\\ \\textrm{${target}}`,
42
+ ],
43
+ ["", "=", `${getAnswer(identifiers)}\\ \\textrm{${target}}`],
44
+ ])}
45
+ `;
46
+ };
47
+ const getInstruction = (identifiers) => {
48
+ const { randomMass, randomUnitIndex, randomUnitInstructionIndex } = identifiers;
49
+ return `Compléter :
50
+
51
+ $$
52
+ ${randomMass.frenchify()} \\textrm{${units[randomUnitIndex]}} = \\ldots \\textrm{${units[randomUnitInstructionIndex]}}
53
+ $$`;
54
+ };
55
+ const getAnswer = (identifiers) => {
56
+ const { randomMass, randomUnitIndex, randomUnitInstructionIndex } = identifiers;
57
+ const answer = new Decimal(randomMass)
58
+ .multiplyByPowerOfTen(randomUnitIndex - randomUnitInstructionIndex)
59
+ .value.frenchify();
60
+ return answer;
61
+ };
62
+ const getQuestionFromIdentifiers = (identifiers) => {
14
63
  const question = {
15
- instruction: `Compléter : $${randomMass.value
16
- .toString()
17
- .replace(".", ",")} \\textrm{${units[randomUnitIndex]}} = \\ldots \\textrm{${units[randomUnitInstructionIndex]}}$`,
18
- answer,
64
+ instruction: getInstruction(identifiers),
65
+ answer: getAnswer(identifiers),
19
66
  keys: [],
20
67
  answerFormat: "tex",
21
- identifiers: {
22
- randomMass: randomMass.value,
23
- randomUnitIndex,
24
- randomUnitInstructionIndex,
25
- },
68
+ identifiers,
69
+ hint: getHint(identifiers),
70
+ correction: getCorrection(identifiers),
26
71
  };
27
72
  return question;
28
73
  };
74
+ const getMassConversion = () => {
75
+ const randomUnitIndex = randint(0, 7);
76
+ const randomUnitInstructionIndex = randint(0, 7, [randomUnitIndex]);
77
+ const randomMass = doWhile(() => DecimalConstructor.random(0, 1000, randint(0, 4)), (x) => x.value === 0);
78
+ const identifiers = {
79
+ randomMass: randomMass.value,
80
+ randomUnitIndex,
81
+ randomUnitInstructionIndex,
82
+ };
83
+ return getQuestionFromIdentifiers(identifiers);
84
+ };
29
85
  const getPropositions = (n, { answer, randomMass, randomUnitIndex, randomUnitInstructionIndex }) => {
30
86
  const propositions = [];
31
87
  addValidProp(propositions, answer);
@@ -49,8 +105,6 @@ export const massConversion = {
49
105
  id: "massConversion",
50
106
  connector: "=",
51
107
  label: "Conversion de masses",
52
- levels: ["6ème", "5ème", "CAP", "2ndPro"],
53
- sections: ["Conversions"],
54
108
  isSingleStep: true,
55
109
  generator: (nb) => getDistinctQuestions(getMassConversion, nb),
56
110
  getPropositions,
@@ -58,4 +112,6 @@ export const massConversion = {
58
112
  qcmTimer: 60,
59
113
  freeTimer: 60,
60
114
  subject: "Mathématiques",
115
+ getQuestionFromIdentifiers,
116
+ hasHintAndCorrection: true,
61
117
  };
@@ -1 +1 @@
1
- {"version":3,"file":"volumeConversion.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/conversion/volumeConversion.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,QAAQ,EAQT,MAAM,mBAAmB,CAAC;AAE3B,KAAK,WAAW,GAAG;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,0BAA0B,EAAE,MAAM,CAAC;IACnC,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AA+DF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,WAAW,CAclD,CAAC"}
1
+ {"version":3,"file":"volumeConversion.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/conversion/volumeConversion.ts"],"names":[],"mappings":"AAUA,OAAO,EACL,QAAQ,EAaT,MAAM,mBAAmB,CAAC;AAE3B,KAAK,WAAW,GAAG;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,0BAA0B,EAAE,MAAM,CAAC;IACnC,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAgIF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,WAAW,CAclD,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 = ["mm", "cm", "dm", "m", "dam", "hm", "km"];
@@ -9,19 +12,76 @@ const getVolumeConversion = () => {
9
12
  const randomUnitIndex = randint(0, 7);
10
13
  const randomUnitInstructionIndex = randint(Math.max(0, randomUnitIndex - 2), Math.min(7, randomUnitIndex + 3), [randomUnitIndex]);
11
14
  const randomVolume = doWhile(() => DecimalConstructor.random(0, 1000, randint(0, 4)), (x) => x.value === 0);
12
- const answer = (randomVolume.multiplyByPowerOfTen(3 * (randomUnitIndex - randomUnitInstructionIndex)).value + "").replace(".", ",");
15
+ const identifiers = {
16
+ randomUnitIndex,
17
+ randomUnitInstructionIndex,
18
+ randomVolume: randomVolume.value,
19
+ };
20
+ return getQuestionFromIdentifiers(identifiers);
21
+ };
22
+ const getInstruction = (identifiers) => {
23
+ const { randomUnitIndex, randomUnitInstructionIndex, randomVolume } = identifiers;
24
+ return `Compléter :
25
+
26
+ $$
27
+ ${randomVolume.frenchify()} \\textrm{${units[randomUnitIndex]}}^3 = \\ldots \\textrm{${units[randomUnitInstructionIndex]}}^3
28
+ $$`;
29
+ };
30
+ const getAnswer = (identifiers) => {
31
+ const { randomUnitIndex, randomUnitInstructionIndex, randomVolume } = identifiers;
32
+ const answer = new Decimal(randomVolume)
33
+ .multiplyByPowerOfTen(3 * (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}}^3 = ${space > 0
46
+ ? Math.pow(10, space * 3)
47
+ : frac(1, Math.pow(10, -(space * 3))).toTex()} \\ \\textrm{${target}}^3
48
+ $$`;
49
+ };
50
+ const getCorrection = (identifiers) => {
51
+ const { randomVolume, randomUnitIndex, randomUnitInstructionIndex } = identifiers;
52
+ const unit = units[randomUnitIndex];
53
+ const target = units[randomUnitInstructionIndex];
54
+ const space = randomUnitIndex - randomUnitInstructionIndex;
55
+ const coeff = space > 0
56
+ ? Math.pow(10, space * 3).toTree()
57
+ : frac(1, Math.pow(10, -(space * 3)));
58
+ return `On sait que :
59
+
60
+ $$
61
+ 1 \\ \\textrm{${unit}}^3 = ${coeff.toTex()} \\ \\textrm{${target}}^3
62
+ $$
63
+
64
+ Il suffit alors de multiplier $${randomVolume.frenchify()}$ par $${coeff.toTex()}$ :
65
+
66
+ ${alignTex([
67
+ [
68
+ `${randomVolume.frenchify()} \\textrm{${unit}}^3 `,
69
+ "=",
70
+ `${multiply(coeff, randomVolume).toTex()}\\ \\textrm{${target}}^3`,
71
+ ],
72
+ ["", "=", `${getAnswer(identifiers)}\\ \\textrm{${target}}^3`],
73
+ ])}
74
+ `;
75
+ };
76
+ const getQuestionFromIdentifiers = (identifiers) => {
13
77
  const question = {
14
- instruction: `Compléter : $${randomVolume.value
15
- .toString()
16
- .replace(".", ",")} \\textrm{${units[randomUnitIndex]}}^3 = \\ldots \\textrm{${units[randomUnitInstructionIndex]}}^3$`,
17
- answer,
78
+ instruction: getInstruction(identifiers),
79
+ answer: getAnswer(identifiers),
18
80
  keys: [],
19
81
  answerFormat: "tex",
20
- identifiers: {
21
- randomUnitIndex,
22
- randomUnitInstructionIndex,
23
- randomVolume: randomVolume.value,
24
- },
82
+ identifiers,
83
+ hint: getHint(identifiers),
84
+ correction: getCorrection(identifiers),
25
85
  };
26
86
  return question;
27
87
  };
@@ -45,8 +105,6 @@ export const volumeConversion = {
45
105
  id: "volumeConversion",
46
106
  connector: "=",
47
107
  label: "Conversion de volumes",
48
- levels: ["6ème", "5ème", "CAP", "2ndPro"],
49
- sections: ["Conversions"],
50
108
  isSingleStep: true,
51
109
  generator: (nb) => getDistinctQuestions(getVolumeConversion, nb),
52
110
  getPropositions,
@@ -54,4 +112,6 @@ export const volumeConversion = {
54
112
  qcmTimer: 60,
55
113
  freeTimer: 60,
56
114
  subject: "Mathématiques",
115
+ getQuestionFromIdentifiers,
116
+ hasHintAndCorrection: true,
57
117
  };
@@ -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;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
+ {"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;AA2IF,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,WAAW,CAqB9C,CAAC"}
@@ -8,7 +8,7 @@ import { firstDegreeInequationResolutionTex } from "../../../../tree/nodes/inequ
8
8
  import { MinusInfinityNode, PlusInfinityNode, } from "../../../../tree/nodes/numbers/infiniteNode.js";
9
9
  import { ClosureType } from "../../../../tree/nodes/sets/closure.js";
10
10
  import { IntervalNode } from "../../../../tree/nodes/sets/intervalNode.js";
11
- import { intervalParser } from "../../../../tree/parsers/intervalParser.js";
11
+ import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
12
12
  import { coinFlip } from "../../../../utils/alea/coinFlip.js";
13
13
  import { shuffle } from "../../../../utils/alea/shuffle.js";
14
14
  import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
@@ -51,10 +51,11 @@ $$
51
51
 
52
52
  Sur quel intervalle $f$ est-elle ${identifiers.askingPositive ? "positive" : "négative"} ?`;
53
53
  };
54
- const getAnswer = ({ a, b, askingPositive }) => {
54
+ const getAnswerNode = (identifiers) => {
55
+ const { a, b, askingPositive } = identifiers;
55
56
  const root = new Rational(-b, a).simplify().toTree();
56
- const toRightInfInterval = new IntervalNode(root, PlusInfinityNode, ClosureType.FO).toTex();
57
- const toLeftInfInteral = new IntervalNode(MinusInfinityNode, root, ClosureType.OF).toTex();
57
+ const toRightInfInterval = new IntervalNode(root, PlusInfinityNode, ClosureType.FO);
58
+ const toLeftInfInteral = new IntervalNode(MinusInfinityNode, root, ClosureType.OF);
58
59
  if (askingPositive) {
59
60
  return a > 0 ? toRightInfInterval : toLeftInfInteral;
60
61
  }
@@ -62,6 +63,9 @@ const getAnswer = ({ a, b, askingPositive }) => {
62
63
  return a > 0 ? toLeftInfInteral : toRightInfInterval;
63
64
  }
64
65
  };
66
+ const getAnswer = (identifiers) => {
67
+ return getAnswerNode(identifiers).toTex();
68
+ };
65
69
  const getSignFunction = () => {
66
70
  const a = randint(-9, 10, [0]);
67
71
  const b = randint(-9, 10);
@@ -92,15 +96,23 @@ const getPropositions = (n, { answer }) => {
92
96
  }
93
97
  return shuffle(propositions);
94
98
  };
95
- const isAnswerValid = (ans, { answer, a, b, askingPositive }) => {
99
+ const isAnswerValid = (ans, { answer, ...identifiers }) => {
96
100
  try {
97
- const parsed = intervalParser(ans, {
98
- allowCommaInsteadOfSemicolon: true,
99
- allowNoBrackets: true,
100
- });
101
- if (!parsed)
101
+ //? on accepte les réponses peu importe le sens des crochets, meme pour l'infini
102
+ const formated = ans
103
+ .replaceAll("]", "")
104
+ .replaceAll("[", "")
105
+ .replaceAll("\\ ", "");
106
+ const splitted = formated.includes(";")
107
+ ? formated.split(";")
108
+ : formated.split(",");
109
+ if (splitted.length !== 2)
102
110
  return false;
103
- return parsed.simplify().toTex() === answer;
111
+ const a = parseAlgebraic(splitted[0]);
112
+ const b = parseAlgebraic(splitted[1]);
113
+ const intAnswer = getAnswerNode(identifiers);
114
+ return (a.simplify().toTex() === intAnswer.a.toTex() &&
115
+ b.simplify().toTex() === intAnswer.b.toTex());
104
116
  }
105
117
  catch (err) {
106
118
  return handleVEAError(err);
@@ -1 +1 @@
1
- {"version":3,"file":"imageFunctionGeogebra.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/basics/imageFunctionGeogebra.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;AAyBrC,KAAK,WAAW,GAAG;IACjB,cAAc;IAMd,UAAU;IAMV,UAAU;IACV,YAAY,EAAE,MAAM,CAAC;IACrB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,EAAE,EAAE,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC;AA0SF,KAAK,OAAO,GAAG;IACb,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AACF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAqBhE,CAAC"}
1
+ {"version":3,"file":"imageFunctionGeogebra.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/basics/imageFunctionGeogebra.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAoBT,MAAM,6BAA6B,CAAC;AAyBrC,KAAK,WAAW,GAAG;IACjB,cAAc;IAMd,UAAU;IAMV,UAAU;IACV,YAAY,EAAE,MAAM,CAAC;IACrB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,EAAE,EAAE,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC;AA4TF,KAAK,OAAO,GAAG;IACb,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AACF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAsBhE,CAAC"}
@@ -69,6 +69,19 @@ const getAnswer = (identifiers) => {
69
69
  return "\\text{Aucun}";
70
70
  return y.frenchify();
71
71
  };
72
+ const getHint = (identifiers) => {
73
+ return `L'image d'un nombre $x$ par $f$ est l'ordonnée du point de la courbe de $f$ dont l'abscisse est $x$.`;
74
+ };
75
+ const getCorrection = (identifiers) => {
76
+ const { x, y } = identifiers;
77
+ return `On cherche le point sur la courbe de $f$ qui a pour abscisse $${x}$.
78
+
79
+ ${y === undefined
80
+ ? `On voit qu'il n'y a pas de tel point. On en conclut que l'image de $x$ par $f$ n'existe pas.`
81
+ : `On voit que c'est le point de coordonnées $\\left(${x};${y}\\right)$.
82
+
83
+ On en conclut que l'image de $${x}$ par $f$ est $${y}$.`}`;
84
+ };
72
85
  const getGGBOptions = (identifiers) => {
73
86
  const { functionType, otherPoints, wrongY, x, y, functionCommand } = identifiers;
74
87
  const allPoints = [...otherPoints];
@@ -180,6 +193,8 @@ const getQuestionFromIdentifiers = (identifiers, opts) => {
180
193
  ggbOptions: getGGBOptions(identifiers, opts),
181
194
  answerFormat: "tex",
182
195
  identifiers,
196
+ hint: getHint(identifiers),
197
+ correction: getCorrection(identifiers),
183
198
  };
184
199
  return question;
185
200
  };
@@ -298,4 +313,5 @@ export const imageFunctionGeogebra = {
298
313
  getQuestionFromIdentifiers,
299
314
  getKeys,
300
315
  getStartStatement,
316
+ hasHintAndCorrection: true,
301
317
  };
@@ -1 +1 @@
1
- {"version":3,"file":"triangleArea.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/areas/triangleArea.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAWT,MAAM,6BAA6B,CAAC;AAGrC,OAAO,EAGL,mBAAmB,EACpB,MAAM,2CAA2C,CAAC;AAOnD,OAAO,EAGL,kBAAkB,EACnB,MAAM,gCAAgC,CAAC;AAKxC,KAAK,WAAW,GAAG;IACjB,mBAAmB,EAAE,mBAAmB,CAAC;IACzC,iBAAiB,EAAE,kBAAkB,CAAC;IACtC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AA4GF,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,WAAW,CAiB9C,CAAC"}
1
+ {"version":3,"file":"triangleArea.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/areas/triangleArea.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAGrC,OAAO,EAGL,mBAAmB,EACpB,MAAM,2CAA2C,CAAC;AAOnD,OAAO,EAGL,kBAAkB,EACnB,MAAM,gCAAgC,CAAC;AAOxC,KAAK,WAAW,GAAG;IACjB,mBAAmB,EAAE,mBAAmB,CAAC;IACzC,iBAAiB,EAAE,kBAAkB,CAAC;IACtC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAiJF,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,WAAW,CAiB9C,CAAC"}