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
@@ -5,38 +5,128 @@ import { shuffle } from "../../../../utils/alea/shuffle.js";
5
5
  import { random } from "../../../../utils/alea/random.js";
6
6
  import { RightTriangleConstructor } from "../../../../math/geometry/triangles/rightTriangle.js";
7
7
  import { sqrtVEA } from "../../../../exercises/vea/sqrtVEA.js";
8
+ import { add } from "../../../../tree/nodes/operators/addNode.js";
8
9
  import { square } from "../../../../tree/nodes/operators/powerNode.js";
9
10
  import { randfloat } from "../../../../math/utils/random/randfloat.js";
10
11
  import { round } from "../../../../math/utils/round.js";
11
- const getPythagoreCalcul = () => {
12
- const triangle = RightTriangleConstructor.randomNiceSides({
13
- randomName: true,
12
+ import { EqualNode } from "../../../../tree/nodes/equations/equalNode.js";
13
+ import { substract } from "../../../../tree/nodes/operators/substractNode.js";
14
+ import { sqrt } from "../../../../tree/nodes/functions/sqrtNode.js";
15
+ const getInstruction = (identifiers) => {
16
+ const { sideAsked, triangleIdentifiers } = identifiers;
17
+ const triangle = RightTriangleConstructor.fromIdentifiers(triangleIdentifiers);
18
+ return `Dans le triangle $${triangle.name}$ rectangle en $${triangle.points[0].name}$, on sait que $${triangle.sides[(sideAsked + 1) % 3].toLengthTex()}$ et que $${triangle.sides[(sideAsked + 2) % 3].toLengthTex()}$.
19
+
20
+ Calculer la longueur exacte $${triangle.sides[sideAsked].toInsideName()}$.`;
21
+ };
22
+ const getAnswer = (identifiers) => {
23
+ const { sideAsked, triangleIdentifiers } = identifiers;
24
+ const triangle = RightTriangleConstructor.fromIdentifiers(triangleIdentifiers);
25
+ const answer = triangle.sides[sideAsked].getLengthNode().toTex();
26
+ return answer;
27
+ };
28
+ const getHint = (identifiers) => {
29
+ const { sideAsked, triangleIdentifiers } = identifiers;
30
+ const triangle = RightTriangleConstructor.fromIdentifiers(triangleIdentifiers);
31
+ return `Le triangle $${triangle.name}$ est rectangle en $${triangle.points[0].name}$.
32
+
33
+ D'après le théorème de Pythagore, on a donc :
34
+
35
+ $$
36
+ ${triangle.getPythagorianTex()}
37
+ $$
38
+
39
+ Remplace les valeurs données dans l'énoncé dans cette égalité. Puis, isole le côté recherché. Enfin, utilise la racine carrée.`;
40
+ };
41
+ const getCorrection = (identifiers) => {
42
+ const { sideAsked, triangleIdentifiers } = identifiers;
43
+ const triangle = RightTriangleConstructor.fromIdentifiers(triangleIdentifiers);
44
+ const sidesNames = triangle.sides.map((e) => e.toInsideName());
45
+ const sidesSquared = sidesNames.map((e) => square(e));
46
+ const equality = new EqualNode(sidesSquared[0], add(sidesSquared[1], sidesSquared[2]));
47
+ const isolated = sideAsked === 0
48
+ ? equality
49
+ : new EqualNode(sidesSquared[sideAsked], substract(sidesSquared[0], sidesSquared[3 - sideAsked]));
50
+ const detailed = isolated.toDetailedEvaluation({
51
+ ...(sideAsked !== 0 && {
52
+ [sidesNames[0]]: triangle.sides[0].getLengthNode(),
53
+ }),
54
+ ...(sideAsked !== 1 && {
55
+ [sidesNames[1]]: triangle.sides[1].getLengthNode(),
56
+ }),
57
+ ...(sideAsked !== 2 && {
58
+ [sidesNames[2]]: triangle.sides[2].getLengthNode(),
59
+ }),
14
60
  });
15
- //une chance sur deux d'avoir hypoténuse
16
- const sideIndexAsked = random([0, random([1, 2])]);
17
- const answer = triangle.sides[sideIndexAsked].getLengthNode().toTex();
18
- triangle.showSidesLength([sideIndexAsked]);
61
+ const rightSimp = detailed.rightChild.simplify();
62
+ return `Le triangle $${triangle.name}$ est rectangle en $${triangle.points[0].name}$.
63
+
64
+ D'après le théorème de Pythagore, on a donc :
65
+
66
+ $$
67
+ ${equality.toTex()}
68
+ $$
69
+
70
+ ${sideAsked === 0
71
+ ? ""
72
+ : `On isole le côté recherché :
73
+
74
+ $$
75
+ ${isolated.toTex()}
76
+ $$`}
77
+
78
+ On remplace par les valeurs données dans l'énoncé :
79
+
80
+ $$
81
+ ${detailed.toTex()} = ${rightSimp.toTex()}
82
+ $$
83
+
84
+
85
+
86
+ On applique enfin la racine carrée pour obtenir la valeur recherchée :
87
+
88
+ $$
89
+ ${sidesNames[sideAsked]} = ${sqrt(rightSimp).toTex()} = ${getAnswer(identifiers)}
90
+ $$
91
+ `;
92
+ };
93
+ const getGGBOptions = (identifiers) => {
94
+ const { sideAsked, triangleIdentifiers } = identifiers;
95
+ const triangle = RightTriangleConstructor.fromIdentifiers(triangleIdentifiers);
96
+ triangle.showSidesLength([sideAsked]);
19
97
  const commands = [...triangle.commands];
20
98
  const ggb = new GeogebraConstructor({
21
99
  commands,
22
100
  hideAxes: true,
23
101
  hideGrid: true,
24
102
  });
25
- const triangleIdentifiers = triangle.toIdentifiers();
103
+ return ggb.getOptions({
104
+ coords: triangle.generateCoords(),
105
+ });
106
+ };
107
+ const getQuestionFromIdentifiers = (identifiers) => {
26
108
  const question = {
27
- instruction: `Dans le triangle $${triangle.name}$ rectangle en $${triangle.points[0].name}$, on sait que $${triangle.sides[(sideIndexAsked + 1) % 3].toLengthTex()}$ et que $${triangle.sides[(sideIndexAsked + 2) % 3].toLengthTex()}$.
28
-
29
- Calculer la longueur exacte $${triangle.sides[sideIndexAsked].toInsideName()}$.`,
30
- answer,
109
+ instruction: getInstruction(identifiers),
110
+ answer: getAnswer(identifiers),
31
111
  keys: [],
32
- ggbOptions: ggb.getOptions({
33
- coords: triangle.generateCoords(),
34
- }),
112
+ ggbOptions: getGGBOptions(identifiers),
35
113
  answerFormat: "tex",
36
- identifiers: { sideAsked: sideIndexAsked, triangleIdentifiers },
114
+ identifiers,
115
+ hint: getHint(identifiers),
116
+ correction: getCorrection(identifiers),
37
117
  };
38
118
  return question;
39
119
  };
120
+ const getPythagoreCalcul = () => {
121
+ const triangle = RightTriangleConstructor.randomNiceSides({
122
+ randomName: true,
123
+ });
124
+ //une chance sur deux d'avoir hypoténuse
125
+ const sideIndexAsked = random([0, random([1, 2])]);
126
+ const triangleIdentifiers = triangle.toIdentifiers();
127
+ const identifiers = { sideAsked: sideIndexAsked, triangleIdentifiers };
128
+ return getQuestionFromIdentifiers(identifiers);
129
+ };
40
130
  const getPropositions = (n, { answer, triangleIdentifiers, sideAsked }) => {
41
131
  const propositions = [];
42
132
  addValidProp(propositions, answer);
@@ -59,10 +149,8 @@ const isAnswerValid = (ans, { answer, sideAsked, triangleIdentifiers }) => {
59
149
  export const pythagoreCalcul = {
60
150
  id: "pythagoreCalcul",
61
151
  connector: "=",
62
- label: "Utiliser le théoreme de Pythagore pour calculer un côté",
63
- levels: ["4ème", "3ème", "2nde"],
152
+ label: "Utiliser le théorème de Pythagore pour calculer un côté",
64
153
  isSingleStep: false,
65
- sections: ["Théorème de Pythagore", "Géométrie euclidienne"],
66
154
  generator: (nb) => getDistinctQuestions(getPythagoreCalcul, nb),
67
155
  qcmTimer: 60,
68
156
  freeTimer: 60,
@@ -70,4 +158,6 @@ export const pythagoreCalcul = {
70
158
  isAnswerValid,
71
159
  hasGeogebra: true,
72
160
  subject: "Mathématiques",
161
+ getQuestionFromIdentifiers,
162
+ hasHintAndCorrection: true,
73
163
  };
@@ -1 +1 @@
1
- {"version":3,"file":"thales.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/thales/thales.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAIrC,OAAO,EAGL,mBAAmB,EACpB,MAAM,2CAA2C,CAAC;AAuBnD,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,mBAAmB,EAAE,mBAAmB,CAAC;IACzC,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,UAAU,EAAE,OAAO,CAAC;CACrB,CAAC;AAyFF,KAAK,OAAO,GAAG;IACb,iBAAiB,EAAE,MAAM,CAAC;CAC3B,CAAC;AAoIF,eAAO,MAAM,MAAM,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAgBjD,CAAC"}
1
+ {"version":3,"file":"thales.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/thales/thales.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;AAIrC,OAAO,EAGL,mBAAmB,EACpB,MAAM,2CAA2C,CAAC;AAuBnD,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,mBAAmB,EAAE,mBAAmB,CAAC;IACzC,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,UAAU,EAAE,OAAO,CAAC;CACrB,CAAC;AAyFF,KAAK,OAAO,GAAG;IACb,iBAAiB,EAAE,MAAM,CAAC;CAC3B,CAAC;AAoLF,eAAO,MAAM,MAAM,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAkBjD,CAAC"}
@@ -106,17 +106,46 @@ const getThales = (opts) => {
106
106
  isPapillon,
107
107
  ratio,
108
108
  };
109
+ return getQuestionFromIdentifiers(identifiers);
110
+ };
111
+ const getHint = (identifiers) => {
112
+ const triangle = TriangleConstructor.fromIdentifiers(identifiers.triangleIdentifiers);
113
+ const subTriangle = getSubTriangle({
114
+ triangle,
115
+ insidePointsNames: identifiers.insidePointsNames,
116
+ ratio: identifiers.ratio,
117
+ isPapillon: identifiers.isPapillon,
118
+ });
119
+ return `Puisque les droites $\\left(${identifiers.insidePointsNames.join("")}\\right)$ et $\\left(${triangle.sides[2].toInsideName()}\\right)$ sont parallèles, les triangles $${triangle.name}$ et $${subTriangle.name}$ sont semblables. Leurs côtés sont donc proportionnels deux à deux.`;
120
+ };
121
+ const getCorrection = (identifiers) => {
122
+ const { triangleIdentifiers, insidePointsNames } = identifiers;
123
+ const triangle = TriangleConstructor.fromIdentifiers(triangleIdentifiers);
124
+ return `Puisque les droites $\\left(${insidePointsNames.join("")}\\right)$ et $\\left(${triangle.sides[2].toInsideName()}\\right)$ sont parallèles, d'après le théorème de Thalès, on a :
125
+
126
+ $$
127
+ ${getAnswer(identifiers)}
128
+ $$`;
129
+ };
130
+ const getKeys = (identifiers) => {
131
+ const { triangleIdentifiers, insidePointsNames, isPapillon, ratio } = identifiers;
132
+ const triangle = TriangleConstructor.fromIdentifiers(identifiers.triangleIdentifiers);
133
+ return [
134
+ "equal",
135
+ ...triangle.points.map((p) => p.name),
136
+ ...insidePointsNames,
137
+ ];
138
+ };
139
+ const getQuestionFromIdentifiers = (identifiers) => {
109
140
  const question = {
110
141
  instruction: getInstruction(identifiers),
111
142
  answer: getAnswer(identifiers),
112
- keys: [
113
- "equal",
114
- ...triangle.points.map((p) => p.name),
115
- ...[dName, eName],
116
- ],
143
+ keys: getKeys(identifiers),
117
144
  ggbOptions: getGGBOptions(identifiers),
118
145
  answerFormat: "tex",
119
146
  identifiers,
147
+ hint: getHint(identifiers),
148
+ correction: getCorrection(identifiers),
120
149
  };
121
150
  return question;
122
151
  };
@@ -195,4 +224,6 @@ export const thales = {
195
224
  getInstruction,
196
225
  getGGBOptions,
197
226
  options,
227
+ getQuestionFromIdentifiers,
228
+ hasHintAndCorrection: true,
198
229
  };
@@ -1 +1 @@
1
- {"version":3,"file":"triangleNature.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/triangles/triangleNature.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;AAMrC,OAAO,EAEL,mBAAmB,EACpB,MAAM,2CAA2C,CAAC;AAKnD,KAAK,WAAW,GAAG;IACjB,mBAAmB,EAAE,mBAAmB,CAAC;IACzC,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,OAAO,CAAC;CACpB,CAAC;AAqJF,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,WAAW,CAkBhD,CAAC"}
1
+ {"version":3,"file":"triangleNature.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/triangles/triangleNature.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAmBT,MAAM,6BAA6B,CAAC;AAMrC,OAAO,EAEL,mBAAmB,EACpB,MAAM,2CAA2C,CAAC;AAKnD,KAAK,WAAW,GAAG;IACjB,mBAAmB,EAAE,mBAAmB,CAAC;IACzC,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,OAAO,CAAC;CACpB,CAAC;AAoLF,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,WAAW,CAoBhD,CAAC"}
@@ -39,8 +39,40 @@ const getInstruction = (identifiers) => {
39
39
 
40
40
  D'après les informations données sur la figure, quelle est la nature du triangle $${triangle.name}$ ? `;
41
41
  };
42
- // const getHint: GetHint<Identifiers> = (identifiers) => {};
43
- // const getCorrection: GetCorrection<Identifiers> = (identifiers) => {};
42
+ const getHint = (identifiers) => {
43
+ const { triangleIdentifiers, type, useAngles } = identifiers;
44
+ return `Voici quelques rappels :
45
+
46
+ - un triangle qui a un angle droit est un triangle rectangle ;
47
+ - un triangle qui a deux côtés égaux (ou deux angles égaux) est un triangle isocèle ;
48
+ - un triangle qiu a trois côtés égaux (ou trois angles égaux) est un triangle équilatéral.`;
49
+ };
50
+ const getCorrection = (identifiers) => {
51
+ const { triangleIdentifiers, type, useAngles } = identifiers;
52
+ switch (type) {
53
+ case 0:
54
+ return "Il n'y a aucune information donnée par la figure sur les longueurs des côtés où les mesures des angles du triangle. On en conclut donc que ce triangle est quelconque.";
55
+ case 1:
56
+ if (useAngles) {
57
+ return `Le triangle possède deux angles égaux : c'est donc un triangle isocèle.`;
58
+ }
59
+ else {
60
+ return `Le triangle possède deux côtés égaux : c'est donc un triangle isocèle.`;
61
+ }
62
+ case 2:
63
+ if (useAngles) {
64
+ return `Le triangle possède trois angles égaux : c'est donc un triangle équilatéral.`;
65
+ }
66
+ else {
67
+ return `Le triangle possède trois côtés égaux : c'est donc un triangle équilatéral.`;
68
+ }
69
+ case 3:
70
+ return `Le triangle possède un angle droit : c'est donc un triangle rectangle.`;
71
+ case 4:
72
+ default:
73
+ return `Le triangle possède un angle droit : il est donc rectangle. De plus, il possède ${useAngles ? "deux angles égaux" : "deux côtés égaux"} : il est donc également isocèle. `;
74
+ }
75
+ };
44
76
  const getGGBOptions = (identifiers) => {
45
77
  const { triangleIdentifiers, type, useAngles } = identifiers;
46
78
  let triangle;
@@ -84,12 +116,6 @@ const getGGBOptions = (identifiers) => {
84
116
  coords: triangle.generateCoords(),
85
117
  });
86
118
  };
87
- const getKeys = (identifiers) => {
88
- return [];
89
- };
90
- const isAnswerValid = (ans, { answer }) => {
91
- throw Error("VEA not implemented");
92
- };
93
119
  const getTriangleNatureQuestion = (opts) => {
94
120
  // const type = random(["scalène","isocèle","équilatéral", "rectangle", "rectangle et isocèle"]);
95
121
  const type = randint(0, 5);
@@ -129,13 +155,16 @@ const getTriangleNatureQuestion = (opts) => {
129
155
  type,
130
156
  useAngles,
131
157
  };
158
+ return getQuestionFromIdentifiers(identifiers);
159
+ };
160
+ const getQuestionFromIdentifiers = (identifiers) => {
132
161
  const question = {
133
162
  instruction: getInstruction(identifiers),
134
- keys: getKeys(identifiers),
163
+ // keys: getKeys(identifiers),
135
164
  answerFormat: "tex",
136
165
  identifiers,
137
- // hint: getHint(identifiers),
138
- // correction: getCorrection(identifiers),
166
+ hint: getHint(identifiers),
167
+ correction: getCorrection(identifiers),
139
168
  ggbOptions: getGGBOptions(identifiers),
140
169
  };
141
170
  return question;
@@ -148,13 +177,15 @@ export const triangleNature = {
148
177
  qcmTimer: 60,
149
178
  freeTimer: 60,
150
179
  getPropositions,
151
- isAnswerValid,
180
+ // isAnswerValid,
152
181
  subject: "Mathématiques",
153
- // getHint,
154
- // getCorrection,
182
+ getHint,
183
+ getCorrection,
155
184
  getInstruction,
156
185
  getGGBOptions,
157
186
  hasGeogebra: true,
158
187
  answerType: "QCM",
159
188
  isQCM: true,
189
+ hasHintAndCorrection: true,
190
+ getQuestionFromIdentifiers,
160
191
  };
@@ -1 +1 @@
1
- {"version":3,"file":"alignementViaColinearity.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/vectors/alignementViaColinearity.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AA8CF,eAAO,MAAM,wBAAwB,EAAE,QAAQ,CAAC,WAAW,CAa1D,CAAC"}
1
+ {"version":3,"file":"alignementViaColinearity.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/vectors/alignementViaColinearity.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAWrC,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AA0HF,eAAO,MAAM,wBAAwB,EAAE,QAAQ,CAAC,WAAW,CAa1D,CAAC"}
@@ -1,11 +1,69 @@
1
1
  import { addValidProp, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
2
2
  import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
- import { PointConstructor } from "../../../../math/geometry/point.js";
4
- import { VectorConstructor } from "../../../../math/geometry/vector.js";
3
+ import { Point, PointConstructor } from "../../../../math/geometry/point.js";
4
+ import { Vector, VectorConstructor } from "../../../../math/geometry/vector.js";
5
5
  import { randint } from "../../../../math/utils/random/randint.js";
6
6
  import { NumberNode } from "../../../../tree/nodes/numbers/numberNode.js";
7
+ import { substract } from "../../../../tree/nodes/operators/substractNode.js";
7
8
  import { coinFlip } from "../../../../utils/alea/coinFlip.js";
8
9
  import { shuffle } from "../../../../utils/alea/shuffle.js";
10
+ const getPoints = (identifiers) => {
11
+ const { xA, xB, xC, yA, yB, yC } = identifiers;
12
+ return [
13
+ new Point("A", xA, yA),
14
+ new Point("B", xB, yB),
15
+ new Point("C", xC, yC),
16
+ ];
17
+ };
18
+ const getInstruction = (identifiers) => {
19
+ const points = getPoints(identifiers);
20
+ return `Soient trois points $${points[0].toTexWithCoords()}$, $${points[1].toTexWithCoords()}$ et $${points[2].toTexWithCoords()}$ dans un repère orthonormé.
21
+
22
+ Les points $A$, $B$ et $C$ sont-ils alignés ?`;
23
+ };
24
+ const getAnswer = (identifiers) => {
25
+ const points = getPoints(identifiers);
26
+ const vec1 = VectorConstructor.fromPoints(points[0], points[1]);
27
+ const vec2 = VectorConstructor.fromPoints(points[0], points[2]);
28
+ const isAligned = vec1.isColinear(vec2);
29
+ const answer = isAligned ? "Oui" : "Non";
30
+ return answer;
31
+ };
32
+ const getHint = (identifiers) => {
33
+ return `Les points $A$, $B$ est $C$ sont alignés si et seulement si les vecteurs $\\overrightarrow{AB}$ et $\\overrightarrow{AC}$ sont colinéaires.`;
34
+ };
35
+ const getCorrection = (identifiers) => {
36
+ const points = getPoints(identifiers);
37
+ const vec1 = new Vector("AB", substract(points[1].x, points[0].x), substract(points[1].y, points[0].y));
38
+ const vec1Simp = vec1.simplify();
39
+ const vec2 = new Vector("AC", substract(points[2].x, points[0].x), substract(points[2].y, points[0].y));
40
+ const vec2Simp = vec2.simplify();
41
+ const det = vec1Simp.determinant(vec2Simp);
42
+ const isAligned = vec1.isColinear(vec2);
43
+ return `Les points $A$, $B$ est $C$ sont alignés si et seulement si les vecteurs $\\overrightarrow{AB}$ et $\\overrightarrow{AC}$ sont colinéaires.
44
+
45
+ On calcule les coordonnées de ces vecteurs :
46
+
47
+ $$
48
+ ${vec1.toTexWithCoords()}=${vec1Simp.toBinomCoords().toTex()}
49
+ $$
50
+
51
+ et
52
+
53
+ $$
54
+ ${vec2.toTexWithCoords()}=${vec2Simp.toBinomCoords().toTex()}
55
+ $$
56
+
57
+ On calcule ensuite le déterminant des deux vecteurs :
58
+
59
+ $$
60
+ \\det(${vec1.toTex()};${vec2.toTex()})=${det.toTex()}=${det.simplify().toTex()}
61
+ $$
62
+
63
+ ${isAligned
64
+ ? `Puisque le déterminant est nul, les vecteurs sont colinéaires. Les points $A$, $B$ et $C$ sont donc alignés.`
65
+ : `Puisque le déterminant n'est pas nul, les vecteurs ne sont pas colinéaires. Les points $A$, $B$ et $C$ ne sont donc pas alignés.`}`;
66
+ };
9
67
  const getAlignementViaColinearityQuestion = () => {
10
68
  const points = PointConstructor.randomDifferent(2, { names: ["A", "B"] });
11
69
  const AB = VectorConstructor.fromPoints(points[0], points[1]);
@@ -20,20 +78,25 @@ const getAlignementViaColinearityQuestion = () => {
20
78
  C = PointConstructor.random("C");
21
79
  } while (AB.isColinear(VectorConstructor.fromPoints(points[0], C)));
22
80
  }
23
- const answer = isAligned ? "Oui" : "Non";
81
+ const identifiers = {
82
+ xA: points[0].x.evaluate({}),
83
+ xB: points[1].x.evaluate({}),
84
+ xC: C.x.evaluate({}),
85
+ yA: points[0].y.evaluate({}),
86
+ yB: points[1].y.evaluate({}),
87
+ yC: C.y.evaluate({}),
88
+ };
89
+ return getQuestionFromIdentifiers(identifiers);
90
+ };
91
+ const getQuestionFromIdentifiers = (identifiers) => {
24
92
  const question = {
25
- answer,
26
- instruction: `Soient trois points $${points[0].toTexWithCoords()}$, $${points[1].toTexWithCoords()}$ et $${C.toTexWithCoords()}$. Les points $A$, $B$ et $C$ sont-ils alignés ?`,
93
+ answer: getAnswer(identifiers),
94
+ instruction: getInstruction(identifiers),
27
95
  keys: [],
28
96
  answerFormat: "raw",
29
- identifiers: {
30
- xA: points[0].x.evaluate({}),
31
- xB: points[1].x.evaluate({}),
32
- xC: C.x.evaluate({}),
33
- yA: points[0].y.evaluate({}),
34
- yB: points[1].y.evaluate({}),
35
- yC: C.y.evaluate({}),
36
- },
97
+ identifiers,
98
+ hint: getHint(identifiers),
99
+ correction: getCorrection(identifiers),
37
100
  };
38
101
  return question;
39
102
  };
@@ -48,13 +111,13 @@ const getPropositions = (n, { answer }) => {
48
111
  export const alignementViaColinearity = {
49
112
  id: "alignementViaColinearity",
50
113
  label: "Utiliser la colinéarité pour déterminer un alignement",
51
- levels: ["2nde", "1reSpé"],
52
114
  isSingleStep: true,
53
- sections: ["Vecteurs", "Droites"],
54
115
  generator: (nb) => getDistinctQuestions(getAlignementViaColinearityQuestion, nb),
55
116
  qcmTimer: 60,
56
117
  freeTimer: 60,
57
118
  getPropositions,
58
119
  answerType: "QCU",
59
120
  subject: "Mathématiques",
121
+ getQuestionFromIdentifiers,
122
+ hasHintAndCorrection: true,
60
123
  };
@@ -1,9 +1,10 @@
1
1
  import { Exercise } from "../../../../exercises/exercise.js";
2
+ import { NodeIdentifiers } from "../../../../tree/nodes/nodeConstructor.js";
2
3
  type Identifiers = {
3
- xu: number;
4
- yu: number;
5
- xv: number;
6
- yv: number;
4
+ xu: NodeIdentifiers;
5
+ yu: NodeIdentifiers;
6
+ xv: NodeIdentifiers;
7
+ yv: NodeIdentifiers;
7
8
  };
8
9
  export declare const colinearity: Exercise<Identifiers>;
9
10
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"colinearity.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/vectors/colinearity.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,6BAA6B,CAAC;AAQrC,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAyCF,eAAO,MAAM,WAAW,EAAE,QAAQ,CAAC,WAAW,CAY7C,CAAC"}
1
+ {"version":3,"file":"colinearity.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/vectors/colinearity.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAKrC,OAAO,EACL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;AAM7C,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,eAAe,CAAC;IACpB,EAAE,EAAE,eAAe,CAAC;IACpB,EAAE,EAAE,eAAe,CAAC;IACpB,EAAE,EAAE,eAAe,CAAC;CACrB,CAAC;AA4GF,eAAO,MAAM,WAAW,EAAE,QAAQ,CAAC,WAAW,CAa7C,CAAC"}
@@ -1,16 +1,79 @@
1
1
  import { addValidProp, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
2
2
  import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
- import { VectorConstructor } from "../../../../math/geometry/vector.js";
3
+ import { Vector, VectorConstructor } from "../../../../math/geometry/vector.js";
4
+ import { RationalConstructor } from "../../../../math/numbers/rationals/rational.js";
4
5
  import { randint } from "../../../../math/utils/random/randint.js";
6
+ import { reifyAlgebraic, } from "../../../../tree/nodes/nodeConstructor.js";
5
7
  import { NumberNode } from "../../../../tree/nodes/numbers/numberNode.js";
6
8
  import { coinFlip } from "../../../../utils/alea/coinFlip.js";
7
9
  import { shuffle } from "../../../../utils/alea/shuffle.js";
10
+ import { alignTex } from "../../../../utils/latex/alignTex.js";
11
+ const rebuildIdentifiers = (oldIds) => {
12
+ if (oldIds.xu?.id)
13
+ return oldIds;
14
+ return {
15
+ xu: oldIds.xu.toTree().toIdentifiers(),
16
+ yu: oldIds.yu.toTree().toIdentifiers(),
17
+ xv: oldIds.xv.toTree().toIdentifiers(),
18
+ yv: oldIds.yv.toTree().toIdentifiers(),
19
+ };
20
+ };
21
+ const getInstruction = (identifiers) => {
22
+ const { xu, yu, xv, yv } = identifiers;
23
+ const u = new Vector("u", reifyAlgebraic(xu), reifyAlgebraic(yu));
24
+ const v = new Vector("v", reifyAlgebraic(xv), reifyAlgebraic(yv));
25
+ return `Soit deux vecteurs $${u.toTexWithCoords()}$ et $${v.toTexWithCoords()}$.
26
+
27
+ Les vecteurs $${u.toTex()}$ et $${v.toTex()}$ sont-ils colinéaires ?`;
28
+ };
29
+ const getHint = (identifiers) => {
30
+ const u = new Vector("u", "x".toTree(), "y".toTree());
31
+ const v = new Vector("v", "x'".toTree(), "y'".toTree());
32
+ return `Deux vecteurs sont colinéaires si et seulement si leur déterminant est nul.
33
+
34
+ Le déterminant de deux vecteurs $${u.toTexWithCoords()}$ et $${v.toTexWithCoords()}$ est :
35
+
36
+ $$
37
+ \\det(${u.toTex()}, ${v.toTex()}) = ${u.determinant(v).simplify().toTex()}
38
+ $$`;
39
+ };
40
+ const getCorrection = (identifiers) => {
41
+ const { xu, yu, xv, yv } = identifiers;
42
+ const u = new Vector("u", reifyAlgebraic(xu), reifyAlgebraic(yu));
43
+ const v = new Vector("v", reifyAlgebraic(xv), reifyAlgebraic(yv));
44
+ const det = u.determinant(v);
45
+ const detSimp = det.simplify();
46
+ const isCol = detSimp.evaluate() === 0;
47
+ return `On calcule le déterminant de $${u.toTex()}$ et $${v.toTex()}$ :
48
+
49
+ ${alignTex([
50
+ ["", `\\det(${u.toTex()}, ${v.toTex()})`],
51
+ ["=", det.toTex()],
52
+ ["=", detSimp.toTex()],
53
+ ])}
54
+
55
+ ${isCol
56
+ ? `Puisque le déterminant est nul, les vecteurs sont bien colinéaires.`
57
+ : `Puisque le déterminant n'est pas nul, les vecteurs ne sont pas colinéaires.`}`;
58
+ };
59
+ const getQuestionFromIdentifiers = (identifiers) => {
60
+ const question = {
61
+ instruction: getInstruction(identifiers),
62
+ answerFormat: "raw",
63
+ identifiers,
64
+ hint: getHint(identifiers),
65
+ correction: getCorrection(identifiers),
66
+ };
67
+ return question;
68
+ };
8
69
  const getColinearityQuestion = () => {
9
70
  const u = VectorConstructor.random("u", false);
10
71
  const isColinear = coinFlip();
11
72
  let v;
12
73
  if (isColinear) {
13
- const coeff = new NumberNode(randint(-5, 5));
74
+ const coeff = coinFlip()
75
+ ? new NumberNode(randint(-5, 5, [0, 1]))
76
+ : RationalConstructor.randomIrreductible(5).toTree();
14
77
  v = u.times(coeff, "v");
15
78
  }
16
79
  else {
@@ -18,25 +81,22 @@ const getColinearityQuestion = () => {
18
81
  v = VectorConstructor.random("v", false);
19
82
  } while (u.isColinear(v));
20
83
  }
21
- // const isColinear = u.isColinear(v);
22
- const answer = isColinear ? "Oui" : "Non";
23
- const question = {
24
- answer,
25
- instruction: `Soit deux vecteurs $${u.toTexWithCoords()}$ et $${v.toTexWithCoords()}$. $${u.toTex()}$ et $${v.toTex()}$ sont-ils colinéaires ?`,
26
- keys: [],
27
- answerFormat: "raw",
28
- identifiers: {
29
- xu: u.x.evaluate({}),
30
- xv: v.x.evaluate({}),
31
- yu: u.y.evaluate({}),
32
- yv: v.y.evaluate({}),
33
- },
84
+ const identifiers = {
85
+ xu: u.x.toIdentifiers(),
86
+ xv: v.x.toIdentifiers(),
87
+ yu: u.y.toIdentifiers(),
88
+ yv: v.y.toIdentifiers(),
34
89
  };
35
- return question;
90
+ return getQuestionFromIdentifiers(identifiers);
36
91
  };
37
- const getPropositions = (n, { answer }) => {
92
+ const getPropositions = (n, { answer, ...identifiers }) => {
38
93
  const propositions = [];
39
- addValidProp(propositions, answer, "raw");
94
+ // addValidProp(propositions, answer, "raw");
95
+ const { xu, yu, xv, yv } = identifiers;
96
+ const u = new Vector("u", reifyAlgebraic(xu), reifyAlgebraic(yu));
97
+ const v = new Vector("v", reifyAlgebraic(xv), reifyAlgebraic(yv));
98
+ const isCol = u.isColinear(v);
99
+ addValidProp(propositions, isCol ? "Oui" : "Non", "raw");
40
100
  tryToAddWrongProp(propositions, "Oui", "raw");
41
101
  tryToAddWrongProp(propositions, "Non", "raw");
42
102
  tryToAddWrongProp(propositions, "On ne peut pas savoir", "raw");
@@ -44,14 +104,15 @@ const getPropositions = (n, { answer }) => {
44
104
  };
45
105
  export const colinearity = {
46
106
  id: "colinearity",
47
- label: "Déterminer si deux vecteurs sont colinéaires",
48
- levels: ["2nde", "1reSpé"],
107
+ label: "Déterminer si deux vecteurs sont colinéaires (par les coordonnées)",
49
108
  isSingleStep: true,
50
- sections: ["Vecteurs"],
51
109
  generator: (nb) => getDistinctQuestions(getColinearityQuestion, nb),
52
110
  qcmTimer: 60,
53
111
  freeTimer: 60,
54
112
  getPropositions,
55
113
  answerType: "QCU",
56
114
  subject: "Mathématiques",
115
+ getQuestionFromIdentifiers,
116
+ hasHintAndCorrection: true,
117
+ rebuildIdentifiers,
57
118
  };
@@ -7,7 +7,7 @@ import { shuffle } from "../../../../utils/alea/shuffle.js";
7
7
  const getDeterminantQuestion = () => {
8
8
  const u = VectorConstructor.random("u");
9
9
  const v = VectorConstructor.random("v");
10
- const answer = u.determinant(v);
10
+ const answer = u.determinant(v).simplify();
11
11
  const answerTex = answer.toTex();
12
12
  const question = {
13
13
  answer: answerTex,
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=findCoordForAligment.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"findCoordForAligment.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/vectors/findCoordForAligment.ts"],"names":[],"mappings":""}