math-exercises 3.0.52 → 3.0.54

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 (238) hide show
  1. package/lib/exercises/math/calcul/fractions/fractionAndIntegerDivision.d.ts.map +1 -1
  2. package/lib/exercises/math/calcul/fractions/fractionAndIntegerDivision.js +0 -2
  3. package/lib/exercises/math/calcul/fractions/fractionAndIntegerProduct.d.ts.map +1 -1
  4. package/lib/exercises/math/calcul/fractions/fractionAndIntegerProduct.js +0 -2
  5. package/lib/exercises/math/calcul/fractions/fractionsDivision.d.ts.map +1 -1
  6. package/lib/exercises/math/calcul/fractions/fractionsDivision.js +0 -2
  7. package/lib/exercises/math/calcul/fractions/fractionsSum.d.ts.map +1 -1
  8. package/lib/exercises/math/calcul/fractions/fractionsSum.js +0 -2
  9. package/lib/exercises/math/calcul/mentalCaluls/mentalAddAndSub.d.ts.map +1 -1
  10. package/lib/exercises/math/calcul/mentalCaluls/mentalAddAndSub.js +3 -17
  11. package/lib/exercises/math/calcul/mentalCaluls/mentalMultiplications.d.ts.map +1 -1
  12. package/lib/exercises/math/calcul/mentalCaluls/mentalMultiplications.js +0 -12
  13. package/lib/exercises/math/calcul/mentalCaluls/mentalPercentage.d.ts.map +1 -1
  14. package/lib/exercises/math/calcul/mentalCaluls/mentalPercentage.js +0 -13
  15. package/lib/exercises/math/calcul/operations/operationsPrioritiesParenthesis.d.ts.map +1 -1
  16. package/lib/exercises/math/calcul/operations/operationsPrioritiesParenthesis.js +0 -2
  17. package/lib/exercises/math/calculLitteral/equation/binomialsTrinomialsProposedSolutions.d.ts +8 -3
  18. package/lib/exercises/math/calculLitteral/equation/binomialsTrinomialsProposedSolutions.d.ts.map +1 -1
  19. package/lib/exercises/math/calculLitteral/equation/binomialsTrinomialsProposedSolutions.js +53 -30
  20. package/lib/exercises/math/calculLitteral/equation/equa4.d.ts.map +1 -1
  21. package/lib/exercises/math/calculLitteral/equation/equa4.js +0 -2
  22. package/lib/exercises/math/calculLitteral/equation/multiplicationEquation.d.ts.map +1 -1
  23. package/lib/exercises/math/calculLitteral/equation/multiplicationEquation.js +3 -0
  24. package/lib/exercises/math/calculLitteral/factorisation/factoIdRmq2.d.ts.map +1 -1
  25. package/lib/exercises/math/calculLitteral/factorisation/factoIdRmq2.js +4 -4
  26. package/lib/exercises/math/calculLitteral/factorisation/factoType1Exercise.d.ts.map +1 -1
  27. package/lib/exercises/math/calculLitteral/factorisation/factoType1Exercise.js +0 -2
  28. package/lib/exercises/math/calculLitteral/simplifying/evaluateExpression.d.ts.map +1 -1
  29. package/lib/exercises/math/calculLitteral/simplifying/evaluateExpression.js +0 -2
  30. package/lib/exercises/math/calculLitteral/systems/basicNiceValuesSystemResolution.d.ts +2 -2
  31. package/lib/exercises/math/calculLitteral/systems/basicNiceValuesSystemResolution.d.ts.map +1 -1
  32. package/lib/exercises/math/calculLitteral/systems/basicNiceValuesSystemResolution.js +52 -25
  33. package/lib/exercises/math/calculLitteral/systems/basicSystemResolution.d.ts +2 -2
  34. package/lib/exercises/math/calculLitteral/systems/basicSystemResolution.d.ts.map +1 -1
  35. package/lib/exercises/math/calculLitteral/systems/basicSystemResolution.js +50 -33
  36. package/lib/exercises/math/calculLitteral/systems/verifySystemSolution.d.ts +2 -1
  37. package/lib/exercises/math/calculLitteral/systems/verifySystemSolution.d.ts.map +1 -1
  38. package/lib/exercises/math/calculLitteral/systems/verifySystemSolution.js +37 -17
  39. package/lib/exercises/math/functions/affines/affineExpressionFromTwoImages.d.ts.map +1 -1
  40. package/lib/exercises/math/functions/affines/affineExpressionFromTwoImages.js +0 -2
  41. package/lib/exercises/math/functions/affines/affineExpressionReading.d.ts.map +1 -1
  42. package/lib/exercises/math/functions/affines/affineExpressionReading.js +3 -2
  43. package/lib/exercises/math/functions/affines/interceptReading.d.ts.map +1 -1
  44. package/lib/exercises/math/functions/affines/interceptReading.js +47 -18
  45. package/lib/exercises/math/functions/affines/leadingCoefficientCalculV2.d.ts.map +1 -1
  46. package/lib/exercises/math/functions/affines/leadingCoefficientCalculV2.js +46 -13
  47. package/lib/exercises/math/geometry/angles/recognizeAngleType.d.ts.map +1 -1
  48. package/lib/exercises/math/geometry/angles/recognizeAngleType.js +33 -12
  49. package/lib/exercises/math/geometry/areas/circleArea.d.ts.map +1 -1
  50. package/lib/exercises/math/geometry/areas/circleArea.js +45 -2
  51. package/lib/exercises/math/geometry/areas/squareArea.d.ts.map +1 -1
  52. package/lib/exercises/math/geometry/areas/squareArea.js +40 -7
  53. package/lib/exercises/math/geometry/areas/triangleArea.d.ts.map +1 -1
  54. package/lib/exercises/math/geometry/cartesian/cartesianEquationOfLine.d.ts.map +1 -1
  55. package/lib/exercises/math/geometry/cartesian/cartesianEquationOfLine.js +52 -7
  56. package/lib/exercises/math/geometry/cartesian/cartesianFromTwoPoints.d.ts +9 -0
  57. package/lib/exercises/math/geometry/cartesian/cartesianFromTwoPoints.d.ts.map +1 -0
  58. package/lib/exercises/math/geometry/cartesian/cartesianFromTwoPoints.js +162 -0
  59. package/lib/exercises/math/geometry/cartesian/cartesianFromVectorAndPoint.d.ts +10 -0
  60. package/lib/exercises/math/geometry/cartesian/cartesianFromVectorAndPoint.d.ts.map +1 -0
  61. package/lib/exercises/math/geometry/cartesian/cartesianFromVectorAndPoint.js +161 -0
  62. package/lib/exercises/math/geometry/cartesian/directionVector.d.ts +4 -2
  63. package/lib/exercises/math/geometry/cartesian/directionVector.d.ts.map +1 -1
  64. package/lib/exercises/math/geometry/cartesian/directionVector.js +110 -79
  65. package/lib/exercises/math/geometry/cartesian/directionVectorEquation.d.ts.map +1 -1
  66. package/lib/exercises/math/geometry/cartesian/directionVectorEquation.js +55 -11
  67. package/lib/exercises/math/geometry/cartesian/drawAlineInGGB.d.ts.map +1 -1
  68. package/lib/exercises/math/geometry/cartesian/drawAlineInGGB.js +18 -2
  69. package/lib/exercises/math/geometry/cartesian/index.d.ts +2 -0
  70. package/lib/exercises/math/geometry/cartesian/index.d.ts.map +1 -1
  71. package/lib/exercises/math/geometry/cartesian/index.js +2 -0
  72. package/lib/exercises/math/geometry/cartesian/pointCoordinates.d.ts.map +1 -1
  73. package/lib/exercises/math/geometry/cartesian/pointCoordinates.js +0 -2
  74. package/lib/exercises/math/geometry/cartesian/pointCoordinatesNoAxisNumbers.d.ts.map +1 -1
  75. package/lib/exercises/math/geometry/cartesian/pointCoordinatesNoAxisNumbers.js +0 -2
  76. package/lib/exercises/math/geometry/cartesian/pointCoordinatesNoOrthonorm.d.ts.map +1 -1
  77. package/lib/exercises/math/geometry/cartesian/pointCoordinatesNoOrthonorm.js +0 -2
  78. package/lib/exercises/math/geometry/lines/aAndBFromReductEquation.d.ts +9 -0
  79. package/lib/exercises/math/geometry/lines/aAndBFromReductEquation.d.ts.map +1 -0
  80. package/lib/exercises/math/geometry/lines/aAndBFromReductEquation.js +108 -0
  81. package/lib/exercises/math/geometry/lines/cartesianEquationToReduced.d.ts.map +1 -1
  82. package/lib/exercises/math/geometry/lines/cartesianEquationToReduced.js +20 -1
  83. package/lib/exercises/math/geometry/lines/cartesianEquationsIntersection.d.ts +9 -0
  84. package/lib/exercises/math/geometry/lines/cartesianEquationsIntersection.d.ts.map +1 -0
  85. package/lib/exercises/math/geometry/lines/cartesianEquationsIntersection.js +115 -0
  86. package/lib/exercises/math/geometry/lines/directorVectorFromAnother.d.ts +9 -0
  87. package/lib/exercises/math/geometry/lines/directorVectorFromAnother.d.ts.map +1 -0
  88. package/lib/exercises/math/geometry/lines/directorVectorFromAnother.js +122 -0
  89. package/lib/exercises/math/geometry/lines/directorVectorFromReductEquation.d.ts +9 -0
  90. package/lib/exercises/math/geometry/lines/directorVectorFromReductEquation.d.ts.map +1 -0
  91. package/lib/exercises/math/geometry/lines/directorVectorFromReductEquation.js +121 -0
  92. package/lib/exercises/math/geometry/lines/drawLineFromCartesianEquation.d.ts +10 -0
  93. package/lib/exercises/math/geometry/lines/drawLineFromCartesianEquation.d.ts.map +1 -0
  94. package/lib/exercises/math/geometry/lines/drawLineFromCartesianEquation.js +124 -0
  95. package/lib/exercises/math/geometry/lines/drawLineFromPointAndVector.d.ts +10 -0
  96. package/lib/exercises/math/geometry/lines/drawLineFromPointAndVector.d.ts.map +1 -0
  97. package/lib/exercises/math/geometry/lines/drawLineFromPointAndVector.js +123 -0
  98. package/lib/exercises/math/geometry/lines/findParallelLineFromCartesianEquation.d.ts +12 -0
  99. package/lib/exercises/math/geometry/lines/findParallelLineFromCartesianEquation.d.ts.map +1 -0
  100. package/lib/exercises/math/geometry/lines/findParallelLineFromCartesianEquation.js +130 -0
  101. package/lib/exercises/math/geometry/lines/findParallelLineFromReductEquation.d.ts +10 -0
  102. package/lib/exercises/math/geometry/lines/findParallelLineFromReductEquation.d.ts.map +1 -0
  103. package/lib/exercises/math/geometry/lines/findParallelLineFromReductEquation.js +109 -0
  104. package/lib/exercises/math/geometry/lines/index.d.ts +10 -0
  105. package/lib/exercises/math/geometry/lines/index.d.ts.map +1 -1
  106. package/lib/exercises/math/geometry/lines/index.js +10 -0
  107. package/lib/exercises/math/geometry/lines/reductEquationFindY.d.ts +10 -0
  108. package/lib/exercises/math/geometry/lines/reductEquationFindY.d.ts.map +1 -0
  109. package/lib/exercises/math/geometry/lines/reductEquationFindY.js +105 -0
  110. package/lib/exercises/math/geometry/lines/reductEquationFromTwoPoints.d.ts +10 -0
  111. package/lib/exercises/math/geometry/lines/reductEquationFromTwoPoints.d.ts.map +1 -0
  112. package/lib/exercises/math/geometry/lines/reductEquationFromTwoPoints.js +149 -0
  113. package/lib/exercises/math/geometry/lines/reductEquationReading.d.ts +8 -0
  114. package/lib/exercises/math/geometry/lines/reductEquationReading.d.ts.map +1 -0
  115. package/lib/exercises/math/geometry/lines/reductEquationReading.js +142 -0
  116. package/lib/exercises/math/geometry/perimeters/circleCircumference.d.ts.map +1 -1
  117. package/lib/exercises/math/geometry/perimeters/circleCircumference.js +58 -9
  118. package/lib/exercises/math/geometry/perimeters/rectanglePerimeter.d.ts.map +1 -1
  119. package/lib/exercises/math/geometry/perimeters/rectanglePerimeter.js +39 -6
  120. package/lib/exercises/math/geometry/perimeters/squarePerimeter.d.ts.map +1 -1
  121. package/lib/exercises/math/geometry/perimeters/squarePerimeter.js +40 -7
  122. package/lib/exercises/math/geometry/perimeters/trianglePerimeter.d.ts.map +1 -1
  123. package/lib/exercises/math/geometry/perimeters/trianglePerimeter.js +34 -7
  124. package/lib/exercises/math/geometry/pythagore/pythagore.d.ts.map +1 -1
  125. package/lib/exercises/math/geometry/pythagore/pythagore.js +51 -15
  126. package/lib/exercises/math/geometry/pythagore/pythagoreCalcul.d.ts.map +1 -1
  127. package/lib/exercises/math/geometry/pythagore/pythagoreCalcul.js +109 -19
  128. package/lib/exercises/math/geometry/thales/thales.d.ts.map +1 -1
  129. package/lib/exercises/math/geometry/thales/thales.js +36 -5
  130. package/lib/exercises/math/geometry/triangles/triangleNature.d.ts.map +1 -1
  131. package/lib/exercises/math/geometry/triangles/triangleNature.js +45 -14
  132. package/lib/exercises/math/geometry/vectors/alignementViaColinearity.d.ts.map +1 -1
  133. package/lib/exercises/math/geometry/vectors/alignementViaColinearity.js +78 -15
  134. package/lib/exercises/math/geometry/vectors/colinearity.d.ts +5 -4
  135. package/lib/exercises/math/geometry/vectors/colinearity.d.ts.map +1 -1
  136. package/lib/exercises/math/geometry/vectors/colinearity.js +82 -21
  137. package/lib/exercises/math/geometry/vectors/determinant.js +1 -1
  138. package/lib/exercises/math/geometry/vectors/findCoordForAligment.d.ts +2 -0
  139. package/lib/exercises/math/geometry/vectors/findCoordForAligment.d.ts.map +1 -0
  140. package/lib/exercises/math/geometry/vectors/findCoordForAligment.js +92 -0
  141. package/lib/exercises/math/geometry/vectors/lineFromDirectorVector.d.ts.map +1 -1
  142. package/lib/exercises/math/geometry/vectors/lineFromDirectorVector.js +117 -76
  143. package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductViaCos.js +1 -1
  144. package/lib/exercises/math/powers/calculateNegativePower.d.ts.map +1 -1
  145. package/lib/exercises/math/powers/calculateNegativePower.js +0 -2
  146. package/lib/exercises/math/powers/calculatePower.d.ts.map +1 -1
  147. package/lib/exercises/math/powers/calculatePower.js +63 -8
  148. package/lib/exercises/math/powers/decimalToScientific.d.ts.map +1 -1
  149. package/lib/exercises/math/powers/decimalToScientific.js +0 -15
  150. package/lib/exercises/math/powers/powerDefinition.d.ts.map +1 -1
  151. package/lib/exercises/math/powers/powerDefinition.js +39 -8
  152. package/lib/exercises/math/powers/powersOfTenToDecimal.d.ts.map +1 -1
  153. package/lib/exercises/math/powers/powersOfTenToDecimal.js +2 -1
  154. package/lib/exercises/math/powers/powersPower.d.ts +5 -2
  155. package/lib/exercises/math/powers/powersPower.d.ts.map +1 -1
  156. package/lib/exercises/math/powers/powersPower.js +59 -28
  157. package/lib/exercises/math/powers/scientificToDecimal.d.ts.map +1 -1
  158. package/lib/exercises/math/powers/scientificToDecimal.js +0 -15
  159. package/lib/exercises/math/primitive/logarithmePrimitive.js +1 -1
  160. package/lib/exercises/math/probaStat/index.d.ts +1 -0
  161. package/lib/exercises/math/probaStat/index.d.ts.map +1 -1
  162. package/lib/exercises/math/probaStat/index.js +1 -0
  163. package/lib/exercises/math/probaStat/randomVariable/index.d.ts +5 -0
  164. package/lib/exercises/math/probaStat/randomVariable/index.d.ts.map +1 -0
  165. package/lib/exercises/math/probaStat/randomVariable/index.js +4 -0
  166. package/lib/exercises/math/probaStat/randomVariable/isTableProbabilityLaw.d.ts +10 -0
  167. package/lib/exercises/math/probaStat/randomVariable/isTableProbabilityLaw.d.ts.map +1 -0
  168. package/lib/exercises/math/probaStat/randomVariable/isTableProbabilityLaw.js +81 -0
  169. package/lib/exercises/math/probaStat/randomVariable/randomVariableAverage.d.ts +9 -0
  170. package/lib/exercises/math/probaStat/randomVariable/randomVariableAverage.d.ts.map +1 -0
  171. package/lib/exercises/math/probaStat/randomVariable/randomVariableAverage.js +95 -0
  172. package/lib/exercises/math/probaStat/randomVariable/randomVariableStandardDeviation.d.ts +9 -0
  173. package/lib/exercises/math/probaStat/randomVariable/randomVariableStandardDeviation.d.ts.map +1 -0
  174. package/lib/exercises/math/probaStat/randomVariable/randomVariableStandardDeviation.js +106 -0
  175. package/lib/exercises/math/probaStat/randomVariable/randomVariableVariance.d.ts +9 -0
  176. package/lib/exercises/math/probaStat/randomVariable/randomVariableVariance.d.ts.map +1 -0
  177. package/lib/exercises/math/probaStat/randomVariable/randomVariableVariance.js +105 -0
  178. package/lib/exercises/math/trigonometry/calculateCosSinAndTan.d.ts.map +1 -1
  179. package/lib/exercises/math/trigonometry/calculateCosSinAndTan.js +21 -0
  180. package/lib/exercises/math/trigonometry/mainRemarkableValues.d.ts.map +1 -1
  181. package/lib/exercises/math/trigonometry/mainRemarkableValues.js +1 -1
  182. package/lib/exercises/math/trigonometry/remarkableValues.d.ts.map +1 -1
  183. package/lib/exercises/math/trigonometry/remarkableValues.js +3 -0
  184. package/lib/index.d.ts +76 -15
  185. package/lib/index.d.ts.map +1 -1
  186. package/lib/math/geometry/angle.d.ts.map +1 -1
  187. package/lib/math/geometry/angle.js +12 -7
  188. package/lib/math/geometry/line.d.ts +5 -10
  189. package/lib/math/geometry/line.d.ts.map +1 -1
  190. package/lib/math/geometry/line.js +71 -37
  191. package/lib/math/geometry/point.d.ts +2 -1
  192. package/lib/math/geometry/point.d.ts.map +1 -1
  193. package/lib/math/geometry/point.js +3 -0
  194. package/lib/math/geometry/segment.js +1 -1
  195. package/lib/math/geometry/triangles/triangle.d.ts.map +1 -1
  196. package/lib/math/geometry/triangles/triangle.js +11 -11
  197. package/lib/math/geometry/vector.d.ts +6 -0
  198. package/lib/math/geometry/vector.d.ts.map +1 -1
  199. package/lib/math/geometry/vector.js +30 -4
  200. package/lib/math/probability/randomVariable.d.ts +15 -0
  201. package/lib/math/probability/randomVariable.d.ts.map +1 -0
  202. package/lib/math/probability/randomVariable.js +56 -0
  203. package/lib/math/systems/generalSystem.d.ts +12 -1
  204. package/lib/math/systems/generalSystem.d.ts.map +1 -1
  205. package/lib/math/systems/generalSystem.js +92 -55
  206. package/lib/math/trigonometry/remarkableValue.d.ts.map +1 -1
  207. package/lib/math/trigonometry/remarkableValue.js +1 -1
  208. package/lib/playground.d.ts.map +1 -1
  209. package/lib/playground.js +1 -8
  210. package/lib/server.js +1 -1
  211. package/lib/tree/nodes/algebraicNode.d.ts +0 -1
  212. package/lib/tree/nodes/algebraicNode.d.ts.map +1 -1
  213. package/lib/tree/nodes/equations/equalNode.d.ts +3 -3
  214. package/lib/tree/nodes/equations/equalNode.d.ts.map +1 -1
  215. package/lib/tree/nodes/equations/equalNode.js +3 -3
  216. package/lib/tree/nodes/functions/cosNode.d.ts.map +1 -1
  217. package/lib/tree/nodes/functions/cosNode.js +11 -5
  218. package/lib/tree/nodes/functions/sinNode.d.ts.map +1 -1
  219. package/lib/tree/nodes/functions/sinNode.js +11 -5
  220. package/lib/tree/nodes/functions/tanNode.d.ts.map +1 -1
  221. package/lib/tree/nodes/functions/tanNode.js +11 -5
  222. package/lib/tree/nodes/node.d.ts +9 -8
  223. package/lib/tree/nodes/node.d.ts.map +1 -1
  224. package/lib/tree/nodes/nodeConstructor.d.ts.map +1 -1
  225. package/lib/tree/nodes/nodeConstructor.js +1 -1
  226. package/lib/tree/nodes/numbers/numberNode.d.ts.map +1 -1
  227. package/lib/tree/nodes/numbers/numberNode.js +6 -2
  228. package/lib/tree/nodes/operators/binomialCoefficientNode.d.ts +2 -1
  229. package/lib/tree/nodes/operators/binomialCoefficientNode.d.ts.map +1 -1
  230. package/lib/tree/nodes/operators/binomialCoefficientNode.js +7 -2
  231. package/lib/tree/nodes/operators/fractionNode.js +2 -2
  232. package/lib/tree/nodes/operators/multiplyNode.js +1 -1
  233. package/lib/tree/nodes/operators/powerNode.d.ts +4 -4
  234. package/lib/tree/nodes/operators/powerNode.d.ts.map +1 -1
  235. package/lib/tree/nodes/operators/powerNode.js +5 -5
  236. package/lib/tree/parsers/latexParser.d.ts.map +1 -1
  237. package/lib/tree/parsers/latexParser.js +6 -0
  238. package/package.json +1 -1
@@ -0,0 +1,142 @@
1
+ import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { randomColor } from "../../../../geogebra/colors.js";
4
+ import { GeogebraConstructor } from "../../../../geogebra/geogebraConstructor.js";
5
+ import { randint } from "../../../../math/utils/random/randint.js";
6
+ import { add } from "../../../../tree/nodes/operators/addNode.js";
7
+ import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
8
+ import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
9
+ import { substract } from "../../../../tree/nodes/operators/substractNode.js";
10
+ import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
11
+ import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
12
+ const getPropositions = (n, { answer, ...identifiers }) => {
13
+ const propositions = [];
14
+ const { b, secondPoint } = identifiers;
15
+ addValidProp(propositions, answer);
16
+ while (propositions.length < n) {
17
+ const randomPoint = [randint(-5, 6, [0]), randint(-5, 6)];
18
+ const a = frac(substract(randomPoint[1], b), randomPoint[0]);
19
+ tryToAddWrongProp(propositions, `y=${add(multiply(a, "x"), b)
20
+ .simplify({ forbidFactorize: true, forceDistributeFractions: true })
21
+ .toTex()}`);
22
+ }
23
+ return shuffleProps(propositions, n);
24
+ };
25
+ const getAnswer = (identifiers) => {
26
+ const { b, secondPoint } = identifiers;
27
+ const a = frac(substract(secondPoint[1], b), secondPoint[0]);
28
+ return `y=${add(multiply(a, "x"), b)
29
+ .simplify({ forbidFactorize: true, forceDistributeFractions: true })
30
+ .toTex()}`;
31
+ };
32
+ const getInstruction = (identifiers) => {
33
+ return `Déterminer graphiquement l'équation réduite de la droite tracée ci-dessous :`;
34
+ };
35
+ const getHint = (identifers) => {
36
+ return `L'équation réduite de la droite est de la forme :
37
+
38
+ $$
39
+ y = ax+b
40
+ $$
41
+
42
+ $b$ est l'ordonnée à l'origine de la droite : c'est l'ordonnée du point d'abscisse $0$.
43
+
44
+ $a$ est le coefficient directeur. Pour le déterminer, on repère deux points $A(x_A; y_A)$ et $B(x_B;y_B)$ de la droite, et on a alors :
45
+
46
+ $$
47
+ a = \\frac{y_B-y_A}{x_B-x_A}
48
+ $$`;
49
+ };
50
+ const getCorrection = (identifiers) => {
51
+ const { b, secondPoint } = identifiers;
52
+ return `On lit graphiquement que l'ordonnée à l'origine est $${b}$ : c'est l'ordonnée du point d'abscisse $0$ appartenant à la droite.
53
+
54
+ Pour trouver $a$, on repère que la droite passe par le point de coordonnées $(${secondPoint[0]};${secondPoint[1]})$. On a alors :
55
+
56
+ $$
57
+ a = ${frac(substract(secondPoint[1], b), secondPoint[0]).toSimplificationTex()}
58
+ $$
59
+
60
+ L'équation réduite de $d$ est donc :
61
+
62
+ $$
63
+ ${getAnswer(identifiers)}
64
+ $$`;
65
+ };
66
+ const getGGBOptions = (identifiers) => {
67
+ const { b, secondPoint } = identifiers;
68
+ let xMin = Math.min(0, secondPoint[0]);
69
+ let xMax = Math.max(0, secondPoint[0]);
70
+ let yMin = Math.min(b, secondPoint[1]);
71
+ let yMax = Math.max(b, secondPoint[1]);
72
+ const commands = [
73
+ `l = Line[(0, ${b}), (${secondPoint[0]}, ${secondPoint[1]})]`,
74
+ `SetColor(l, "${randomColor()}")`,
75
+ "SetFixed(l, true)",
76
+ ];
77
+ const ggb = new GeogebraConstructor({
78
+ commands,
79
+ });
80
+ return ggb.getOptions({
81
+ coords: ggb.getAdaptedCoords({ xMin, xMax, yMin, yMax }),
82
+ });
83
+ };
84
+ const getKeys = (identifiers) => {
85
+ return ["y", "equal", "x"];
86
+ };
87
+ const isAnswerValid = (ans, { answer }) => {
88
+ try {
89
+ const formated = ans.replaceAll("y", "").replaceAll("=", "");
90
+ const parsed = parseAlgebraic(formated);
91
+ if (!parsed)
92
+ return false;
93
+ return ("y=" +
94
+ parsed
95
+ .simplify({
96
+ forbidFactorize: true,
97
+ decimalToFractions: true,
98
+ forceDistributeFractions: true,
99
+ })
100
+ .toTex() ===
101
+ answer);
102
+ }
103
+ catch (err) {
104
+ return handleVEAError(err);
105
+ }
106
+ };
107
+ const getReductEquationReadingQuestion = (ops) => {
108
+ const b = randint(-5, 6);
109
+ const secondPoint = [randint(-5, 6, [0]), randint(-5, 6)];
110
+ const identifiers = { b, secondPoint };
111
+ return getQuestionFromIdentifiers(identifiers);
112
+ };
113
+ const getQuestionFromIdentifiers = (identifiers) => {
114
+ return {
115
+ answer: getAnswer(identifiers),
116
+ instruction: getInstruction(identifiers),
117
+ keys: getKeys(identifiers),
118
+ answerFormat: "tex",
119
+ identifiers,
120
+ hint: getHint(identifiers),
121
+ correction: getCorrection(identifiers),
122
+ ggbOptions: getGGBOptions(identifiers),
123
+ };
124
+ };
125
+ export const reductEquationReading = {
126
+ id: "reductEquationReading",
127
+ label: "Lire graphiquement l'équation réduite d'une droite",
128
+ isSingleStep: true,
129
+ generator: (nb, opts) => getDistinctQuestions(() => getReductEquationReadingQuestion(opts), nb),
130
+ qcmTimer: 60,
131
+ freeTimer: 60,
132
+ getPropositions,
133
+ isAnswerValid,
134
+ subject: "Mathématiques",
135
+ getInstruction,
136
+ // getHint,
137
+ // getCorrection,
138
+ getAnswer,
139
+ getQuestionFromIdentifiers,
140
+ hasGeogebra: true,
141
+ hasHintAndCorrection: true,
142
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"circleCircumference.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/perimeters/circleCircumference.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAQT,MAAM,6BAA6B,CAAC;AAMrC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AA2CF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,WAAW,CAarD,CAAC"}
1
+ {"version":3,"file":"circleCircumference.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/perimeters/circleCircumference.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAMrC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAmGF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,WAAW,CAarD,CAAC"}
@@ -4,24 +4,73 @@ import { randint } from "../../../../math/utils/random/randint.js";
4
4
  import { round } from "../../../../math/utils/round.js";
5
5
  import { coinFlip } from "../../../../utils/alea/coinFlip.js";
6
6
  import { shuffle } from "../../../../utils/alea/shuffle.js";
7
- const getCircleCircumference = () => {
8
- const radius = randint(1, 13);
9
- const diametre = randint(1, 21);
10
- const coin = coinFlip();
7
+ const getInstruction = (identifiers) => {
8
+ const { coin, radius, diametre } = identifiers;
9
+ return `Calculer la circonférence d'un cercle de ${coin ? "rayon " + `$${radius}$` : "diamètre " + `$${diametre}$`} cm.
10
+
11
+ Donner une réponse arrondie au centième.`;
12
+ };
13
+ const getAnswer = (identifiers) => {
14
+ const { coin, radius, diametre } = identifiers;
11
15
  const answerNb = coin
12
16
  ? round(2 * Math.PI * radius, 2)
13
17
  : round(Math.PI * diametre, 2);
14
18
  const answer = (answerNb + "").replace(".", ",");
15
19
  const answerTex = answer + "\\text{cm}";
20
+ return answerTex;
21
+ };
22
+ const getHint = (identifiers) => {
23
+ return `La circonférence d'un cercle de rayon $r$ est donnée par :
24
+
25
+ $$
26
+ C = 2\\pi r
27
+ $$`;
28
+ };
29
+ const getCorrection = (identifiers) => {
30
+ const { coin, radius, diametre } = identifiers;
31
+ const isRadius = coin;
32
+ return `La circonférence d'un cercle de ${isRadius ? "rayon $r$" : "diamètre $d$"} est donnée par :
33
+
34
+ $$
35
+ C = ${isRadius ? "2\\pi r" : "\\pi\\times d"}
36
+ $$
37
+
38
+ ${isRadius
39
+ ? `Ici, on a $r = ${radius}$ cm.
40
+
41
+ La circonférence est donc égale à :
42
+
43
+ $$
44
+ C = 2\\pi \\times ${radius} \\approx ${getAnswer(identifiers)}
45
+ $$`
46
+ : `Ici, on a $d = ${diametre}$ cm.
47
+
48
+ La circonférence est donc égale à :
49
+
50
+ $$
51
+ C = \\pi \\times ${diametre} \\approx ${getAnswer(identifiers)}
52
+ $$
53
+ `}`;
54
+ };
55
+ const getQuestionFromIdentifiers = (identifiers) => {
16
56
  const question = {
17
- instruction: `Calculer la circonférence d'un cercle de ${coin ? "rayon " + `$${radius}$` : "diamètre " + `$${diametre}$`} cm.`,
18
- answer: answerTex,
57
+ instruction: getInstruction(identifiers),
58
+ answer: getAnswer(identifiers),
19
59
  answerFormat: "tex",
20
60
  keys: ["cm", "cm2"],
21
- identifiers: { coin, diametre, radius },
61
+ identifiers,
62
+ hint: getHint(identifiers),
63
+ correction: getCorrection(identifiers),
22
64
  };
23
65
  return question;
24
66
  };
67
+ const getCircleCircumference = () => {
68
+ const radius = randint(1, 13);
69
+ const diametre = randint(1, 21);
70
+ const coin = coinFlip();
71
+ const identifiers = { coin, diametre, radius };
72
+ return getQuestionFromIdentifiers(identifiers);
73
+ };
25
74
  const getPropositions = (n, { answer }) => {
26
75
  const propositions = [];
27
76
  addValidProp(propositions, answer);
@@ -38,13 +87,13 @@ export const circleCircumference = {
38
87
  id: "circleCircumference",
39
88
  connector: "=",
40
89
  label: "Calculer la circonférence d'un cercle",
41
- levels: ["4ème", "3ème", "2nde"],
42
90
  isSingleStep: false,
43
- sections: ["Périmètres", "Géométrie euclidienne"],
44
91
  generator: (nb) => getDistinctQuestions(getCircleCircumference, nb),
45
92
  qcmTimer: 60,
46
93
  freeTimer: 60,
47
94
  getPropositions,
48
95
  isAnswerValid,
49
96
  subject: "Mathématiques",
97
+ getQuestionFromIdentifiers,
98
+ hasHintAndCorrection: true,
50
99
  };
@@ -1 +1 @@
1
- {"version":3,"file":"rectanglePerimeter.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/perimeters/rectanglePerimeter.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAQT,MAAM,6BAA6B,CAAC;AAKrC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAkCF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,CAWpD,CAAC"}
1
+ {"version":3,"file":"rectanglePerimeter.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/perimeters/rectanglePerimeter.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAKrC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAwEF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,CAapD,CAAC"}
@@ -2,20 +2,51 @@ import { addValidProp, tryToAddWrongProp, } from "../../../../exercises/exercise
2
2
  import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
3
  import { randint } from "../../../../math/utils/random/randint.js";
4
4
  import { shuffle } from "../../../../utils/alea/shuffle.js";
5
- const getRectanglePerimeter = () => {
6
- const length = randint(3, 13);
7
- const width = randint(1, length);
5
+ const getInstruction = (identifiers) => {
6
+ const { width, length } = identifiers;
7
+ return `Calculer le périmètre d'un rectangle de $${length}$ cm de longueur et de $${width}$ cm de largeur.`;
8
+ };
9
+ const getAnswer = (identifiers) => {
10
+ const { width, length } = identifiers;
8
11
  const answer = (length + width) * 2 + "";
9
12
  const answerTex = answer + "\\text{cm}";
13
+ return answerTex;
14
+ };
15
+ const getHint = (identifiers) => {
16
+ return `Le périmètre d'un rectangle est la somme des longueurs de ses quatre côtés.`;
17
+ };
18
+ const getCorrection = (identifiers) => {
19
+ const { width, length } = identifiers;
20
+ return `Puisque les côtés opposés d'un rectangle sont égaux, le périmètre d'un rectangle est :
21
+
22
+ $$
23
+ P = 2\\times \\text{Longueur} + 2\\times \\text{largeur}
24
+ $$
25
+
26
+ Ici, le périmètre du rectangle est donc :
27
+
28
+ $$
29
+ P = 2\\times ${width} + 2\\times ${length} = ${getAnswer(identifiers)}
30
+ $$`;
31
+ };
32
+ const getQuestionFromIdentifiers = (identifiers) => {
10
33
  const question = {
11
- instruction: `Calculer le périmètre d'un rectangle de $${length}$ cm de longueur et de $${width}$ cm de largeur.`,
12
- answer: answerTex,
34
+ instruction: getInstruction(identifiers),
35
+ answer: getAnswer(identifiers),
13
36
  answerFormat: "tex",
14
37
  keys: ["cm", "cm2"],
15
- identifiers: { length, width },
38
+ identifiers,
39
+ hint: getHint(identifiers),
40
+ correction: getCorrection(identifiers),
16
41
  };
17
42
  return question;
18
43
  };
44
+ const getRectanglePerimeter = () => {
45
+ const length = randint(3, 13);
46
+ const width = randint(1, length);
47
+ const identifiers = { length, width };
48
+ return getQuestionFromIdentifiers(identifiers);
49
+ };
19
50
  const getPropositions = (n, { answer }) => {
20
51
  const propositions = [];
21
52
  addValidProp(propositions, answer);
@@ -39,4 +70,6 @@ export const rectanglePerimeter = {
39
70
  getPropositions,
40
71
  isAnswerValid,
41
72
  subject: "Mathématiques",
73
+ getQuestionFromIdentifiers,
74
+ hasHintAndCorrection: true,
42
75
  };
@@ -1 +1 @@
1
- {"version":3,"file":"squarePerimeter.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/perimeters/squarePerimeter.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAQT,MAAM,6BAA6B,CAAC;AAKrC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAiCF,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,WAAW,CAcjD,CAAC"}
1
+ {"version":3,"file":"squarePerimeter.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/perimeters/squarePerimeter.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAKrC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAwEF,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,WAAW,CAcjD,CAAC"}
@@ -2,16 +2,49 @@ import { addValidProp, tryToAddWrongProp, } from "../../../../exercises/exercise
2
2
  import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
3
  import { randint } from "../../../../math/utils/random/randint.js";
4
4
  import { shuffle } from "../../../../utils/alea/shuffle.js";
5
- const getSquarePerimeter = () => {
6
- const side = randint(1, 21);
5
+ const getInstruction = (identifiers) => {
6
+ const { side } = identifiers;
7
+ return `Calculer le périmètre d'un carré de $${side}$ cm de côté.`;
8
+ };
9
+ const getAnswer = (identifiers) => {
10
+ const { side } = identifiers;
7
11
  const answer = side * 4 + "";
8
12
  const answerTex = answer + "\\text{cm}";
13
+ return answerTex;
14
+ };
15
+ const getHint = (identifiers) => {
16
+ return "Le périmètre d'un carré est la somme des longueurs de ses côtés.";
17
+ };
18
+ const getCorrection = (identifiers) => {
19
+ const { side } = identifiers;
20
+ return `Puisque tous les côtés d'un carré sont égaux, le périmètre d'un carré est égal à :
21
+
22
+ $$
23
+ P = 4\\times \\text{longueur d'un côté}
24
+ $$
25
+
26
+ Ici, la longueur d'un côté du carré est $${side}\\ \\text{cm}$.
27
+
28
+ Le périmètre est donc égal à :
29
+
30
+ $$
31
+ P = 4\\times ${side} = ${getAnswer(identifiers)}
32
+ $$`;
33
+ };
34
+ const getSquarePerimeter = () => {
35
+ const side = randint(1, 21);
36
+ const identifiers = { side };
37
+ return getQuestionFromIdentifiers(identifiers);
38
+ };
39
+ const getQuestionFromIdentifiers = (identifiers) => {
9
40
  const question = {
10
- instruction: `Calculer le périmètre d'un carré de $${side}$ cm de côté.`,
11
- answer: answerTex,
41
+ instruction: getInstruction(identifiers),
42
+ answer: getAnswer(identifiers),
12
43
  answerFormat: "tex",
13
44
  keys: ["cm", "cm2"],
14
- identifiers: { side },
45
+ identifiers,
46
+ hint: getHint(identifiers),
47
+ correction: getCorrection(identifiers),
15
48
  };
16
49
  return question;
17
50
  };
@@ -31,9 +64,7 @@ export const squarePerimeter = {
31
64
  id: "squarePerimeter",
32
65
  connector: "=",
33
66
  label: "Calculer le périmètre d'un carré",
34
- levels: ["4ème", "3ème", "2nde"],
35
67
  isSingleStep: false,
36
- sections: ["Géométrie euclidienne"],
37
68
  generator: (nb) => getDistinctQuestions(getSquarePerimeter, nb, 20),
38
69
  qcmTimer: 60,
39
70
  freeTimer: 60,
@@ -41,4 +72,6 @@ export const squarePerimeter = {
41
72
  getPropositions,
42
73
  isAnswerValid,
43
74
  subject: "Mathématiques",
75
+ getQuestionFromIdentifiers,
76
+ hasHintAndCorrection: true,
44
77
  };
@@ -1 +1 @@
1
- {"version":3,"file":"trianglePerimeter.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/perimeters/trianglePerimeter.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAQT,MAAM,6BAA6B,CAAC;AAKrC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB,CAAC;AAiCF,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,WAAW,CAanD,CAAC"}
1
+ {"version":3,"file":"trianglePerimeter.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/perimeters/trianglePerimeter.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAKrC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB,CAAC;AAkEF,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,WAAW,CAanD,CAAC"}
@@ -2,19 +2,46 @@ import { addValidProp, tryToAddWrongProp, } from "../../../../exercises/exercise
2
2
  import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
3
  import { randint } from "../../../../math/utils/random/randint.js";
4
4
  import { shuffle } from "../../../../utils/alea/shuffle.js";
5
- const getTrianglePerimeter = () => {
6
- const sides = [randint(1, 13), randint(1, 13), randint(1, 13)];
5
+ const getInstruction = (identifiers) => {
6
+ const { sides } = identifiers;
7
+ return `Calculer le périmètre d'un triangle dont les côtés mesurent : $${sides[0]}$ cm, $${sides[1]}$ cm et $${sides[2]}$ cm.`;
8
+ };
9
+ const getAnswer = (identifiers) => {
10
+ const { sides } = identifiers;
7
11
  const answer = sides[0] + sides[1] + sides[2] + "";
8
12
  const answerTex = answer + "\\text{cm}";
13
+ return answerTex;
14
+ };
15
+ const getHint = (identifiers) => {
16
+ return `Le périmètre d'un triangle est la somme des longueurs de ses $3$ côtés.`;
17
+ };
18
+ const getCorrection = (identifiers) => {
19
+ const { sides } = identifiers;
20
+ return `Le périmètre d'un triangle est la somme des longueurs de ses $3$ côtés.
21
+
22
+ Ici, le périmètre est donc :
23
+
24
+ $$
25
+ P = ${sides.join("+")} = ${getAnswer(identifiers)}
26
+ $$`;
27
+ };
28
+ const getQuestionFromIdentifiers = (identifiers) => {
9
29
  const question = {
10
- instruction: `Calculer le périmètre d'un triangle dont les côtés mesurent : $${sides[0]}$ cm, $${sides[1]}$ cm et $${sides[2]}$ cm.`,
11
- answer: answerTex,
30
+ instruction: getInstruction(identifiers),
31
+ answer: getAnswer(identifiers),
12
32
  answerFormat: "tex",
13
33
  keys: ["cm", "cm2"],
14
- identifiers: { sides },
34
+ identifiers,
35
+ hint: getHint(identifiers),
36
+ correction: getCorrection(identifiers),
15
37
  };
16
38
  return question;
17
39
  };
40
+ const getTrianglePerimeter = () => {
41
+ const sides = [randint(1, 13), randint(1, 13), randint(1, 13)];
42
+ const identifiers = { sides };
43
+ return getQuestionFromIdentifiers(identifiers);
44
+ };
18
45
  const getPropositions = (n, { answer }) => {
19
46
  const propositions = [];
20
47
  addValidProp(propositions, answer);
@@ -32,13 +59,13 @@ export const trianglePerimeter = {
32
59
  id: "trianglePerimeter",
33
60
  connector: "=",
34
61
  label: "Calculer le périmètre d'un triangle",
35
- levels: ["5ème", "4ème", "3ème", "2nde"],
36
62
  isSingleStep: false,
37
- sections: ["Périmètres", "Géométrie euclidienne"],
38
63
  generator: (nb) => getDistinctQuestions(getTrianglePerimeter, nb),
39
64
  qcmTimer: 60,
40
65
  freeTimer: 60,
41
66
  getPropositions,
42
67
  isAnswerValid,
43
68
  subject: "Mathématiques",
69
+ getQuestionFromIdentifiers,
70
+ hasHintAndCorrection: true,
44
71
  };
@@ -1 +1 @@
1
- {"version":3,"file":"pythagore.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/pythagore/pythagore.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAEL,mBAAmB,EACpB,MAAM,2CAA2C,CAAC;AAUnD,KAAK,WAAW,GAAG;IACjB,mBAAmB,EAAE,mBAAmB,CAAC;CAC1C,CAAC;AA8DF,eAAO,MAAM,SAAS,EAAE,QAAQ,CAAC,WAAW,CAc3C,CAAC"}
1
+ {"version":3,"file":"pythagore.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/pythagore/pythagore.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAgBT,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAEL,mBAAmB,EACpB,MAAM,2CAA2C,CAAC;AAUnD,KAAK,WAAW,GAAG;IACjB,mBAAmB,EAAE,mBAAmB,CAAC;CAC1C,CAAC;AA8GF,eAAO,MAAM,SAAS,EAAE,QAAQ,CAAC,WAAW,CAc3C,CAAC"}
@@ -6,29 +6,65 @@ import { EqualNode } from "../../../../tree/nodes/equations/equalNode.js";
6
6
  import { SquareNode } from "../../../../tree/nodes/operators/powerNode.js";
7
7
  import { GeogebraConstructor } from "../../../../geogebra/geogebraConstructor.js";
8
8
  import { RightTriangleConstructor } from "../../../../math/geometry/triangles/rightTriangle.js";
9
- const getPythagore = () => {
10
- const triangle = RightTriangleConstructor.randomNiceSides({
11
- randomName: true,
12
- });
13
- const triangleIdentifiers = triangle.toIdentifiers();
9
+ const getInstruction = (identifiers) => {
10
+ return "Écrire l'égalité de Pythagore pour le triangle rectangle suivant : ";
11
+ };
12
+ const getAnswer = (identifiers) => {
13
+ const triangle = RightTriangleConstructor.fromIdentifiers(identifiers.triangleIdentifiers);
14
+ const answer = triangle.getPythagorianTex();
15
+ return answer;
16
+ };
17
+ const getGGBOptions = (identifiers) => {
18
+ const triangle = RightTriangleConstructor.fromIdentifiers(identifiers.triangleIdentifiers);
14
19
  const ggb = new GeogebraConstructor({
15
20
  commands: triangle.commands,
16
21
  hideAxes: true,
17
22
  hideGrid: true,
18
23
  });
19
- const answer = triangle.getPythagorianTex();
24
+ return ggb.getOptions({
25
+ coords: triangle.generateCoords(),
26
+ });
27
+ };
28
+ const getHint = (identifiers) => {
29
+ return "D'après le théorème de Pythagore : dans un triangle rectangle, le carré de l'hypoténuse est égal à la somme des carrés des deux autres côtés.";
30
+ };
31
+ const getCorrection = (identifiers) => {
32
+ const triangle = RightTriangleConstructor.fromIdentifiers(identifiers.triangleIdentifiers);
33
+ return `Le triangle $${triangle.name}$ est rectangle en $${triangle.points[0].name}$.
34
+
35
+ L'hypoténuse dans ce triangle est donc le côté $${triangle.sides[0].toTex()}$.
36
+
37
+ D'après le théorème de Pythagore, on a donc :
38
+
39
+ $$
40
+ ${getAnswer(identifiers)}
41
+ $$`;
42
+ };
43
+ const getKeys = (identifiers) => {
44
+ const triangle = RightTriangleConstructor.fromIdentifiers(identifiers.triangleIdentifiers);
45
+ return [...triangle.points.map((p) => p.name), "equal"];
46
+ };
47
+ const getQuestionFromIdentifiers = (identifiers) => {
20
48
  const question = {
21
- instruction: "Écrire l'égalité de Pythagore pour le triangle rectangle suivant : ",
22
- answer,
23
- keys: [...triangle.points.map((p) => p.name), "equal"],
24
- ggbOptions: ggb.getOptions({
25
- coords: triangle.generateCoords(),
26
- }),
49
+ instruction: getInstruction(identifiers),
50
+ answer: getAnswer(identifiers),
51
+ keys: getKeys(identifiers),
52
+ ggbOptions: getGGBOptions(identifiers),
27
53
  answerFormat: "tex",
28
- identifiers: { triangleIdentifiers },
54
+ identifiers,
55
+ hint: getHint(identifiers),
56
+ correction: getCorrection(identifiers),
29
57
  };
30
58
  return question;
31
59
  };
60
+ const getPythagore = () => {
61
+ const triangle = RightTriangleConstructor.randomNiceSides({
62
+ randomName: true,
63
+ });
64
+ const triangleIdentifiers = triangle.toIdentifiers();
65
+ const identifiers = { triangleIdentifiers };
66
+ return getQuestionFromIdentifiers(identifiers);
67
+ };
32
68
  const getPropositions = (n, { answer, triangleIdentifiers }) => {
33
69
  const propositions = [];
34
70
  addValidProp(propositions, answer);
@@ -53,9 +89,7 @@ export const pythagore = {
53
89
  id: "pythagore",
54
90
  connector: "=",
55
91
  label: "Écrire l'égalité de Pythagore",
56
- levels: ["4ème", "3ème", "2nde"],
57
92
  isSingleStep: false,
58
- sections: ["Théorème de Pythagore", "Géométrie euclidienne"],
59
93
  generator: (nb) => getDistinctQuestions(getPythagore, nb),
60
94
  qcmTimer: 60,
61
95
  freeTimer: 60,
@@ -63,4 +97,6 @@ export const pythagore = {
63
97
  isAnswerValid,
64
98
  hasGeogebra: true,
65
99
  subject: "Mathématiques",
100
+ getQuestionFromIdentifiers,
101
+ hasHintAndCorrection: true,
66
102
  };
@@ -1 +1 @@
1
- {"version":3,"file":"pythagoreCalcul.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/pythagore/pythagoreCalcul.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAQT,MAAM,6BAA6B,CAAC;AAGrC,OAAO,EAEL,mBAAmB,EACpB,MAAM,2CAA2C,CAAC;AAiBnD,KAAK,WAAW,GAAG;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,mBAAmB,EAAE,mBAAmB,CAAC;CAC1C,CAAC;AA+EF,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,WAAW,CAcjD,CAAC"}
1
+ {"version":3,"file":"pythagoreCalcul.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/pythagore/pythagoreCalcul.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAGrC,OAAO,EAEL,mBAAmB,EACpB,MAAM,2CAA2C,CAAC;AAcnD,KAAK,WAAW,GAAG;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,mBAAmB,EAAE,mBAAmB,CAAC;CAC1C,CAAC;AA8LF,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,WAAW,CAcjD,CAAC"}