math-exercises 3.0.29 → 3.0.31

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 (175) hide show
  1. package/lib/exercises/math/calcul/arithmetics/euclideanDivision.js +2 -2
  2. package/lib/exercises/math/calcul/fractions/fractionSquare.d.ts.map +1 -1
  3. package/lib/exercises/math/calcul/fractions/fractionSquare.js +4 -0
  4. package/lib/exercises/math/calcul/fractions/fractionsProduct.d.ts.map +1 -1
  5. package/lib/exercises/math/calcul/fractions/fractionsProduct.js +4 -2
  6. package/lib/exercises/math/calcul/fractions/fractionsSubstraction.d.ts +11 -0
  7. package/lib/exercises/math/calcul/fractions/fractionsSubstraction.d.ts.map +1 -0
  8. package/lib/exercises/math/calcul/fractions/fractionsSubstraction.js +106 -0
  9. package/lib/exercises/math/calcul/fractions/fractionsSumsPrimeDenominators.js +1 -1
  10. package/lib/exercises/math/calcul/fractions/fractionsSumsSameDenominators.js +1 -1
  11. package/lib/exercises/math/calcul/fractions/index.d.ts +1 -0
  12. package/lib/exercises/math/calcul/fractions/index.d.ts.map +1 -1
  13. package/lib/exercises/math/calcul/fractions/index.js +1 -0
  14. package/lib/exercises/math/calcul/fractions/periodicWritingToFraction.js +1 -1
  15. package/lib/exercises/math/calcul/fractions/simplifyFraction.d.ts.map +1 -1
  16. package/lib/exercises/math/calcul/fractions/simplifyFraction.js +19 -10
  17. package/lib/exercises/math/calcul/proportionality/proportionalityTable.d.ts.map +1 -1
  18. package/lib/exercises/math/calcul/proportionality/proportionalityTable.js +23 -7
  19. package/lib/exercises/math/calcul/proportionality/rectangleSideAfterReduction.d.ts.map +1 -1
  20. package/lib/exercises/math/calcul/proportionality/rectangleSideAfterReduction.js +4 -0
  21. package/lib/exercises/math/calcul/sign/signFromAx.d.ts.map +1 -1
  22. package/lib/exercises/math/calcul/sign/signFromAx.js +4 -0
  23. package/lib/exercises/math/calculLitteral/distributivity/allIdentities.js +3 -3
  24. package/lib/exercises/math/calculLitteral/distributivity/doubleDistri.d.ts +8 -0
  25. package/lib/exercises/math/calculLitteral/distributivity/doubleDistri.d.ts.map +1 -0
  26. package/lib/exercises/math/calculLitteral/distributivity/doubleDistri.js +155 -0
  27. package/lib/exercises/math/calculLitteral/distributivity/idRmq1.d.ts +11 -0
  28. package/lib/exercises/math/calculLitteral/distributivity/idRmq1.d.ts.map +1 -0
  29. package/lib/exercises/math/calculLitteral/distributivity/idRmq1.js +147 -0
  30. package/lib/exercises/math/calculLitteral/distributivity/idRmq2.d.ts +11 -0
  31. package/lib/exercises/math/calculLitteral/distributivity/idRmq2.d.ts.map +1 -0
  32. package/lib/exercises/math/calculLitteral/distributivity/idRmq2.js +150 -0
  33. package/lib/exercises/math/calculLitteral/distributivity/idRmq3.d.ts +11 -0
  34. package/lib/exercises/math/calculLitteral/distributivity/idRmq3.d.ts.map +1 -0
  35. package/lib/exercises/math/calculLitteral/distributivity/idRmq3.js +143 -0
  36. package/lib/exercises/math/calculLitteral/distributivity/index.d.ts +5 -5
  37. package/lib/exercises/math/calculLitteral/distributivity/index.d.ts.map +1 -1
  38. package/lib/exercises/math/calculLitteral/distributivity/index.js +5 -5
  39. package/lib/exercises/math/calculLitteral/distributivity/simpleDistri.d.ts +9 -0
  40. package/lib/exercises/math/calculLitteral/distributivity/simpleDistri.d.ts.map +1 -0
  41. package/lib/exercises/math/calculLitteral/distributivity/simpleDistri.js +116 -0
  42. package/lib/exercises/math/calculLitteral/distributivity/simpleDistriXCoeff.d.ts.map +1 -1
  43. package/lib/exercises/math/calculLitteral/distributivity/simpleDistriXCoeff.js +1 -0
  44. package/lib/exercises/math/calculLitteral/equation/equa1.d.ts +11 -0
  45. package/lib/exercises/math/calculLitteral/equation/equa1.d.ts.map +1 -0
  46. package/lib/exercises/math/calculLitteral/equation/equa1.js +111 -0
  47. package/lib/exercises/math/calculLitteral/equation/equa2.d.ts +17 -0
  48. package/lib/exercises/math/calculLitteral/equation/equa2.d.ts.map +1 -0
  49. package/lib/exercises/math/calculLitteral/equation/equa2.js +164 -0
  50. package/lib/exercises/math/calculLitteral/equation/equa3.d.ts +12 -0
  51. package/lib/exercises/math/calculLitteral/equation/equa3.d.ts.map +1 -0
  52. package/lib/exercises/math/calculLitteral/equation/equa3.js +113 -0
  53. package/lib/exercises/math/calculLitteral/equation/equa4.d.ts +13 -0
  54. package/lib/exercises/math/calculLitteral/equation/equa4.d.ts.map +1 -0
  55. package/lib/exercises/math/calculLitteral/equation/equa4.js +106 -0
  56. package/lib/exercises/math/calculLitteral/equation/index.d.ts +4 -4
  57. package/lib/exercises/math/calculLitteral/equation/index.d.ts.map +1 -1
  58. package/lib/exercises/math/calculLitteral/equation/index.js +4 -4
  59. package/lib/exercises/math/calculLitteral/simplifying/reduceExpression.d.ts.map +1 -1
  60. package/lib/exercises/math/calculLitteral/simplifying/reduceExpression.js +5 -1
  61. package/lib/exercises/math/calculLitteral/simplifying/valuateExpression.d.ts.map +1 -1
  62. package/lib/exercises/math/calculLitteral/simplifying/valuateExpression.js +4 -0
  63. package/lib/exercises/math/dataRepresentations/functionGraphReading.d.ts.map +1 -1
  64. package/lib/exercises/math/dataRepresentations/functionGraphReading.js +4 -0
  65. package/lib/exercises/math/dataRepresentations/pieChartReading.d.ts.map +1 -1
  66. package/lib/exercises/math/dataRepresentations/pieChartReading.js +4 -0
  67. package/lib/exercises/math/derivation/derivative/expDerivativeOne.d.ts.map +1 -1
  68. package/lib/exercises/math/derivation/derivative/expDerivativeOne.js +0 -6
  69. package/lib/exercises/math/derivation/derivative/powerFunctionDerivative.d.ts.map +1 -1
  70. package/lib/exercises/math/derivation/derivative/powerFunctionDerivative.js +30 -0
  71. package/lib/exercises/math/functions/affines/leadingCoefficient.d.ts.map +1 -1
  72. package/lib/exercises/math/functions/affines/leadingCoefficient.js +26 -11
  73. package/lib/exercises/math/functions/logarithm/logSimplifiying.js +1 -1
  74. package/lib/exercises/math/geometry/areas/rightTriangleArea.d.ts +1 -1
  75. package/lib/exercises/math/geometry/areas/rightTriangleArea.d.ts.map +1 -1
  76. package/lib/exercises/math/geometry/areas/rightTriangleArea.js +1 -1
  77. package/lib/exercises/math/geometry/areas/triangleArea.d.ts +1 -1
  78. package/lib/exercises/math/geometry/areas/triangleArea.d.ts.map +1 -1
  79. package/lib/exercises/math/geometry/areas/triangleArea.js +1 -1
  80. package/lib/exercises/math/geometry/euclidian/pythagoreOrThales.d.ts.map +1 -1
  81. package/lib/exercises/math/geometry/euclidian/pythagoreOrThales.js +6 -2
  82. package/lib/exercises/math/geometry/index.d.ts +1 -0
  83. package/lib/exercises/math/geometry/index.d.ts.map +1 -1
  84. package/lib/exercises/math/geometry/index.js +1 -1
  85. package/lib/exercises/math/geometry/lines/linesRelativePositions.d.ts.map +1 -1
  86. package/lib/exercises/math/geometry/lines/linesRelativePositions.js +4 -0
  87. package/lib/exercises/math/geometry/pythagore/pythagore.d.ts +1 -1
  88. package/lib/exercises/math/geometry/pythagore/pythagore.d.ts.map +1 -1
  89. package/lib/exercises/math/geometry/pythagore/pythagore.js +1 -1
  90. package/lib/exercises/math/geometry/pythagore/pythagoreCalcul.d.ts +1 -1
  91. package/lib/exercises/math/geometry/pythagore/pythagoreCalcul.d.ts.map +1 -1
  92. package/lib/exercises/math/geometry/pythagore/pythagoreCalcul.js +1 -1
  93. package/lib/exercises/math/geometry/quadrilaterals/quadrilateralRecognition.d.ts +4 -4
  94. package/lib/exercises/math/geometry/quadrilaterals/quadrilateralRecognition.d.ts.map +1 -1
  95. package/lib/exercises/math/geometry/quadrilaterals/quadrilateralRecognition.js +4 -4
  96. package/lib/exercises/math/geometry/thales/thales.d.ts +1 -1
  97. package/lib/exercises/math/geometry/thales/thales.d.ts.map +1 -1
  98. package/lib/exercises/math/geometry/thales/thales.js +1 -1
  99. package/lib/exercises/math/geometry/thales/thalesCalcul.d.ts +1 -1
  100. package/lib/exercises/math/geometry/thales/thalesCalcul.d.ts.map +1 -1
  101. package/lib/exercises/math/geometry/thales/thalesCalcul.js +1 -1
  102. package/lib/exercises/math/geometry/triangles/index.d.ts +1 -1
  103. package/lib/exercises/math/geometry/triangles/index.d.ts.map +1 -1
  104. package/lib/exercises/math/geometry/triangles/index.js +2 -1
  105. package/lib/exercises/math/geometry/triangles/triangleNature.d.ts +9 -0
  106. package/lib/exercises/math/geometry/triangles/triangleNature.d.ts.map +1 -0
  107. package/lib/exercises/math/geometry/triangles/triangleNature.js +121 -0
  108. package/lib/exercises/math/geometry/triangles/triangleThirdAngleValue.d.ts +9 -0
  109. package/lib/exercises/math/geometry/triangles/triangleThirdAngleValue.d.ts.map +1 -0
  110. package/lib/exercises/math/geometry/triangles/triangleThirdAngleValue.js +134 -0
  111. package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductViaNorms.d.ts +1 -1
  112. package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductViaNorms.d.ts.map +1 -1
  113. package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductViaNorms.js +1 -1
  114. package/lib/exercises/math/percent/findRightCalculForPriceEvolution.d.ts +10 -0
  115. package/lib/exercises/math/percent/findRightCalculForPriceEvolution.d.ts.map +1 -0
  116. package/lib/exercises/math/percent/findRightCalculForPriceEvolution.js +117 -0
  117. package/lib/exercises/math/percent/index.d.ts +1 -1
  118. package/lib/exercises/math/percent/index.d.ts.map +1 -1
  119. package/lib/exercises/math/percent/index.js +1 -1
  120. package/lib/exercises/math/percent/percentToDecimal.js +2 -2
  121. package/lib/exercises/math/powers/powersOfTenToDecimal.d.ts.map +1 -1
  122. package/lib/exercises/math/powers/powersOfTenToDecimal.js +4 -0
  123. package/lib/exercises/math/powers/powersProduct.d.ts.map +1 -1
  124. package/lib/exercises/math/powers/powersProduct.js +10 -14
  125. package/lib/exercises/math/probaStat/stats1var/choseReasoningForIndicator.d.ts.map +1 -1
  126. package/lib/exercises/math/probaStat/stats1var/choseReasoningForIndicator.js +4 -0
  127. package/lib/exercises/math/spaceGeometry/basis/spaceCoordinatesInPrism.d.ts.map +1 -1
  128. package/lib/exercises/math/spaceGeometry/basis/spaceCoordinatesInPrism.js +4 -0
  129. package/lib/exercises/math/squareRoots/simpifySquareRoot.js +1 -1
  130. package/lib/exercises/math/squareRoots/squareRootsProducts.js +1 -1
  131. package/lib/exercises/math/trigonometry/trigonometry.d.ts +1 -1
  132. package/lib/exercises/math/trigonometry/trigonometry.d.ts.map +1 -1
  133. package/lib/exercises/math/trigonometry/trigonometry.js +1 -1
  134. package/lib/exercises/math/trigonometry/trigonometryAngleCalcul.d.ts +1 -1
  135. package/lib/exercises/math/trigonometry/trigonometryAngleCalcul.d.ts.map +1 -1
  136. package/lib/exercises/math/trigonometry/trigonometryAngleCalcul.js +1 -1
  137. package/lib/exercises/math/trigonometry/trigonometrySideCalcul.d.ts +1 -1
  138. package/lib/exercises/math/trigonometry/trigonometrySideCalcul.d.ts.map +1 -1
  139. package/lib/exercises/math/trigonometry/trigonometrySideCalcul.js +2 -2
  140. package/lib/exercises/pc/index.d.ts +4 -4
  141. package/lib/exercises/pc/index.d.ts.map +1 -1
  142. package/lib/exercises/pc/index.js +4 -4
  143. package/lib/index.d.ts +23 -15
  144. package/lib/index.d.ts.map +1 -1
  145. package/lib/math/geometry/angle.d.ts +6 -0
  146. package/lib/math/geometry/angle.d.ts.map +1 -1
  147. package/lib/math/geometry/angle.js +20 -7
  148. package/lib/math/geometry/quadrilaterals/parallelogram.d.ts +23 -0
  149. package/lib/math/geometry/quadrilaterals/parallelogram.d.ts.map +1 -0
  150. package/lib/math/geometry/quadrilaterals/parallelogram.js +65 -0
  151. package/lib/math/geometry/quadrilaterals/quadrilateral.d.ts +15 -0
  152. package/lib/math/geometry/quadrilaterals/quadrilateral.d.ts.map +1 -0
  153. package/lib/math/geometry/quadrilaterals/quadrilateral.js +38 -0
  154. package/lib/math/geometry/quadrilaterals/rectangle.d.ts +24 -0
  155. package/lib/math/geometry/quadrilaterals/rectangle.d.ts.map +1 -0
  156. package/lib/math/geometry/quadrilaterals/rectangle.js +59 -0
  157. package/lib/math/geometry/quadrilaterals/rhombus.d.ts +19 -0
  158. package/lib/math/geometry/quadrilaterals/rhombus.d.ts.map +1 -0
  159. package/lib/math/geometry/quadrilaterals/rhombus.js +41 -0
  160. package/lib/math/geometry/quadrilaterals/square.d.ts +22 -0
  161. package/lib/math/geometry/quadrilaterals/square.d.ts.map +1 -0
  162. package/lib/math/geometry/quadrilaterals/square.js +38 -0
  163. package/lib/math/geometry/triangles/equilateralTriangle.d.ts +21 -0
  164. package/lib/math/geometry/triangles/equilateralTriangle.d.ts.map +1 -0
  165. package/lib/math/geometry/triangles/equilateralTriangle.js +52 -0
  166. package/lib/math/geometry/triangles/isoceleTriangle.d.ts +23 -0
  167. package/lib/math/geometry/triangles/isoceleTriangle.d.ts.map +1 -0
  168. package/lib/math/geometry/triangles/isoceleTriangle.js +66 -0
  169. package/lib/math/geometry/triangles/rightTriangle.d.ts +31 -0
  170. package/lib/math/geometry/triangles/rightTriangle.d.ts.map +1 -0
  171. package/lib/math/geometry/triangles/rightTriangle.js +108 -0
  172. package/lib/math/geometry/triangles/triangle.d.ts +68 -0
  173. package/lib/math/geometry/triangles/triangle.d.ts.map +1 -0
  174. package/lib/math/geometry/triangles/triangle.js +240 -0
  175. package/package.json +1 -1
@@ -17,7 +17,7 @@ const getEuclideanDivisionQuestions = () => {
17
17
  const answer = new EqualNode(new NumberNode(dividend), new AddNode(new MultiplyNode(new NumberNode(divisor), new NumberNode(quotient)), new NumberNode(remainder)));
18
18
  const answerTex = answer.toTex();
19
19
  const question = {
20
- instruction: `Ecrire la division euclidienne de $${dividend}$ par $${divisor}$.`,
20
+ instruction: `Écrire la division euclidienne de $${dividend}$ par $${divisor}$.`,
21
21
  answer: answerTex,
22
22
  keys: ["equal"],
23
23
  answerFormat: "tex",
@@ -45,7 +45,7 @@ const getPropositions = (n, { answer, dividend }) => {
45
45
  export const euclideanDivision = {
46
46
  id: "euclideanDivision",
47
47
  connector: "=",
48
- label: "Ecrire une division euclidienne",
48
+ label: "Écrire une division euclidienne",
49
49
  levels: ["6ème", "5ème", "4ème"],
50
50
  sections: ["Arithmétique"],
51
51
  isSingleStep: true,
@@ -1 +1 @@
1
- {"version":3,"file":"fractionSquare.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/fractionSquare.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAgBrC,KAAK,WAAW,GAAG;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AA6FF,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,WAAW,CAiBhD,CAAC"}
1
+ {"version":3,"file":"fractionSquare.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/fractionSquare.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAgBrC,KAAK,WAAW,GAAG;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAiGF,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,WAAW,CAkBhD,CAAC"}
@@ -74,6 +74,9 @@ const getFractionSquareQuestion = (ops) => {
74
74
  num: rational.num,
75
75
  denum: rational.denum,
76
76
  };
77
+ return getQuestionFromIdentifiers(identifiers);
78
+ };
79
+ const getQuestionFromIdentifiers = (identifiers) => {
77
80
  const question = {
78
81
  answer: getAnswer(identifiers),
79
82
  instruction: getInstruction(identifiers),
@@ -101,4 +104,5 @@ export const fractionSquare = {
101
104
  getCorrection,
102
105
  getAnswer,
103
106
  hasHintAndCorrection: true,
107
+ getQuestionFromIdentifiers,
104
108
  };
@@ -1 +1 @@
1
- {"version":3,"file":"fractionsProduct.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/fractionsProduct.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAiBrC,KAAK,WAAW,GAAG;IACjB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,aAAa,EAAE,MAAM,EAAE,CAAC;CACzB,CAAC;AAEF,KAAK,OAAO,GAAG;IACb,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC,CAAC;AA2HF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAoB3D,CAAC"}
1
+ {"version":3,"file":"fractionsProduct.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/fractionsProduct.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAiBrC,KAAK,WAAW,GAAG;IACjB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,aAAa,EAAE,MAAM,EAAE,CAAC;CACzB,CAAC;AAEF,KAAK,OAAO,GAAG;IACb,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC,CAAC;AAiIF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAmB3D,CAAC"}
@@ -62,6 +62,9 @@ const getFractionsProduct = (opts) => {
62
62
  rationalNum: [rational.num, rational.denum],
63
63
  rationalDenum: [rational2.num, rational2.denum],
64
64
  };
65
+ return getQuestionFromIdentifiers(identifiers, opts);
66
+ };
67
+ const getQuestionFromIdentifiers = (identifiers, opts) => {
65
68
  const question = {
66
69
  instruction: getInstruction(identifiers, opts),
67
70
  startStatement: getStartStatement(identifiers, opts),
@@ -105,8 +108,6 @@ export const fractionsProduct = {
105
108
  id: "fractionsProduct",
106
109
  connector: "=",
107
110
  label: "Produits de fractions",
108
- levels: ["4ème", "3ème", "2nde", "CAP", "2ndPro", "1rePro"],
109
- sections: ["Fractions"],
110
111
  isSingleStep: false,
111
112
  generator: (nb, opts) => getDistinctQuestions(() => getFractionsProduct(opts), nb),
112
113
  qcmTimer: 60,
@@ -120,4 +121,5 @@ export const fractionsProduct = {
120
121
  getAnswer,
121
122
  getHint,
122
123
  getCorrection,
124
+ getQuestionFromIdentifiers,
123
125
  };
@@ -0,0 +1,11 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ type Identifiers = {
3
+ frac1: number[];
4
+ frac2: number[];
5
+ };
6
+ type Options = {
7
+ allowNonIrreductible?: boolean;
8
+ };
9
+ export declare const fractionsSubstraction: Exercise<Identifiers, Options>;
10
+ export {};
11
+ //# sourceMappingURL=fractionsSubstraction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fractionsSubstraction.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/fractionsSubstraction.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;AAWrC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB,CAAC;AAEF,KAAK,OAAO,GAAG;IACb,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC,CAAC;AA8GF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAkBhE,CAAC"}
@@ -0,0 +1,106 @@
1
+ import { addValidProp, shuffleProps, GeneratorOptionType, GeneratorOptionTarget, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { RationalConstructor, } from "../../../../math/numbers/rationals/rational.js";
4
+ import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
5
+ import { substract } from "../../../../tree/nodes/operators/substractNode.js";
6
+ import { rationalParser } from "../../../../tree/parsers/rationalParser.js";
7
+ import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
8
+ const options = [
9
+ {
10
+ id: "allowNonIrreductible",
11
+ label: "Autoriser les fractions non réduites",
12
+ type: GeneratorOptionType.checkbox,
13
+ target: GeneratorOptionTarget.vea,
14
+ },
15
+ ];
16
+ const getStatementNode = (identifiers) => {
17
+ const { frac1, frac2 } = identifiers;
18
+ return substract(frac(frac1[0], frac1[1]), frac(frac2[0], frac2[1]));
19
+ };
20
+ const getPropositions = (n, { answer, frac1, frac2 }) => {
21
+ const propositions = [];
22
+ addValidProp(propositions, answer);
23
+ tryToAddWrongProp(propositions, frac(frac1[0] - frac2[0], frac1[1] - frac2[1], {
24
+ allowDivideByZero: true,
25
+ }).toTex());
26
+ while (propositions.length < n) {
27
+ tryToAddWrongProp(propositions, RationalConstructor.randomIrreductible().toTex());
28
+ }
29
+ return shuffleProps(propositions, n);
30
+ };
31
+ const getAnswer = (identifiers) => {
32
+ return getStatementNode(identifiers).simplify().toTex();
33
+ };
34
+ const getInstruction = (identifiers, opts) => {
35
+ return `Calculer ${opts?.allowNonIrreductible
36
+ ? ""
37
+ : "et donner le résultat sous la forme la plus simplifiée possible"} :
38
+
39
+ $$
40
+ ${getStatementNode(identifiers).toTex()}
41
+ $$`;
42
+ };
43
+ // const getHint: GetHint<Identifiers> = (identifiers) => {};
44
+ // const getCorrection: GetCorrection<Identifiers> = (identifiers) => {};
45
+ const getKeys = (identifiers) => {
46
+ return [];
47
+ };
48
+ const isAnswerValid = (ans, { answer }, opts) => {
49
+ const allow = opts?.allowNonIrreductible;
50
+ try {
51
+ if (allow) {
52
+ const parsed = rationalParser(ans);
53
+ if (!parsed)
54
+ return false;
55
+ return parsed.simplify({ decimalToFractions: true }).toTex() === answer;
56
+ }
57
+ else {
58
+ return ans === answer;
59
+ }
60
+ }
61
+ catch (err) {
62
+ return handleVEAError(err);
63
+ }
64
+ };
65
+ const getFractionsSubstractionQuestion = (opts) => {
66
+ const ratio1 = RationalConstructor.randomIrreductible();
67
+ let ratio2;
68
+ do {
69
+ ratio2 = RationalConstructor.randomIrreductible(12);
70
+ } while (ratio2.value >= ratio1.value);
71
+ const identifiers = {
72
+ frac1: [ratio1.num, ratio1.denum],
73
+ frac2: [ratio2.num, ratio2.denum],
74
+ };
75
+ return getQuestionFromIdentifiers(identifiers, opts);
76
+ };
77
+ const getQuestionFromIdentifiers = (identifiers, opts) => {
78
+ const question = {
79
+ answer: getAnswer(identifiers),
80
+ instruction: getInstruction(identifiers, opts),
81
+ keys: getKeys(identifiers),
82
+ answerFormat: "tex",
83
+ identifiers,
84
+ // hint: getHint(identifiers),
85
+ // correction: getCorrection(identifiers),
86
+ };
87
+ return question;
88
+ };
89
+ export const fractionsSubstraction = {
90
+ id: "fractionsSubstraction",
91
+ connector: "=",
92
+ label: "Soustraction de fractions",
93
+ isSingleStep: true,
94
+ generator: (nb, opts) => getDistinctQuestions(() => getFractionsSubstractionQuestion(opts), nb),
95
+ qcmTimer: 60,
96
+ freeTimer: 60,
97
+ getPropositions,
98
+ isAnswerValid,
99
+ subject: "Mathématiques",
100
+ getInstruction,
101
+ // getHint,
102
+ // getCorrection,
103
+ getAnswer,
104
+ options,
105
+ getQuestionFromIdentifiers,
106
+ };
@@ -74,7 +74,7 @@ const options = [
74
74
  export const fractionsSumsPrimeDenominators = {
75
75
  id: "fractionsSumsPrimeDenominators",
76
76
  connector: "=",
77
- label: "Sommes de fractions (dénominateurs premiers entre eux)",
77
+ label: "Sommes de fractions (avec dénominateurs premiers entre eux)",
78
78
  levels: [],
79
79
  isSingleStep: true,
80
80
  sections: [],
@@ -101,7 +101,7 @@ const options = [
101
101
  export const fractionsSumsSameDenominators = {
102
102
  id: "fractionsSumsSameDenominators",
103
103
  connector: "=",
104
- label: "Sommes de fractions (avec même dénominateurs)",
104
+ label: "Sommes de fractions (avec même dénominateur)",
105
105
  levels: [],
106
106
  isSingleStep: true,
107
107
  sections: [],
@@ -12,4 +12,5 @@ export * from "./fractionsSumsMultiplesDenominators.js";
12
12
  export * from "./fractionsSumsPrimeDenominators.js";
13
13
  export * from "./fractionsOperations.js";
14
14
  export * from "./fractionSquare.js";
15
+ export * from "./fractionsSubstraction.js";
15
16
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/index.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAC;AAChD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,iCAAiC,CAAC;AAChD,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oCAAoC,CAAC;AACnD,cAAc,yCAAyC,CAAC;AACxD,cAAc,qCAAqC,CAAC;AACpD,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/index.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAC;AAChD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,iCAAiC,CAAC;AAChD,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oCAAoC,CAAC;AACnD,cAAc,yCAAyC,CAAC;AACxD,cAAc,qCAAqC,CAAC;AACpD,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC;AACpC,cAAc,4BAA4B,CAAC"}
@@ -12,3 +12,4 @@ export * from "./fractionsSumsMultiplesDenominators.js";
12
12
  export * from "./fractionsSumsPrimeDenominators.js";
13
13
  export * from "./fractionsOperations.js";
14
14
  export * from "./fractionSquare.js";
15
+ export * from "./fractionsSubstraction.js";
@@ -34,7 +34,7 @@ const getPeriodicWritingToFractionQuestion = () => {
34
34
  .toTex();
35
35
  const question = {
36
36
  answer,
37
- instruction: `Ecrire sous forme de fraction : $${x}$`,
37
+ instruction: `Écrire sous forme de fraction : $${x}$`,
38
38
  keys: [],
39
39
  answerFormat: "tex",
40
40
  identifiers: { num, denum, leadingPart: leadingPart.value },
@@ -1 +1 @@
1
- {"version":3,"file":"simplifyFraction.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/simplifyFraction.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,6BAA6B,CAAC;AASrC,KAAK,WAAW,GAAG;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAqDF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,WAAW,CAalD,CAAC"}
1
+ {"version":3,"file":"simplifyFraction.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/simplifyFraction.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAWT,MAAM,6BAA6B,CAAC;AASrC,KAAK,WAAW,GAAG;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAgEF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,WAAW,CAWlD,CAAC"}
@@ -1,25 +1,36 @@
1
1
  import { addValidProp, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
2
2
  import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
3
  import { Rational, RationalConstructor, } from "../../../../math/numbers/rationals/rational.js";
4
- import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
5
4
  import { shuffle } from "../../../../utils/alea/shuffle.js";
5
+ const getStatementNode = (identifiers) => {
6
+ const { num, denum } = identifiers;
7
+ const rational = new Rational(num, denum).toTree();
8
+ return rational;
9
+ };
10
+ const getStartStatement = (identifiers) => {
11
+ const rationalTex = getStatementNode(identifiers).toTex();
12
+ return rationalTex;
13
+ };
6
14
  const getInstruction = (identifiers) => {
7
- const rational = frac(identifiers.num, identifiers.denum);
8
15
  return `Simplifier le plus possible :
9
16
 
10
17
  $$
11
- ${rational.toTex()}
18
+ ${getStartStatement(identifiers)}
12
19
  $$`;
13
20
  };
21
+ const getAnswer = (identifiers) => {
22
+ const { num, denum } = identifiers;
23
+ const rational = new Rational(num, denum);
24
+ const answer = rational.simplify().toTree().toTex();
25
+ return answer;
26
+ };
14
27
  const getSimplifyFraction = () => {
15
28
  const rational = RationalConstructor.randomSimplifiable(10);
16
- const rationalTex = rational.toTree().toTex();
17
- const answer = rational.simplify().toTree().toTex();
18
29
  const identifiers = { num: rational.num, denum: rational.denum };
19
30
  const question = {
20
31
  instruction: getInstruction(identifiers),
21
- startStatement: rationalTex,
22
- answer,
32
+ startStatement: getStartStatement(identifiers),
33
+ answer: getAnswer(identifiers),
23
34
  keys: [],
24
35
  answerFormat: "tex",
25
36
  identifiers,
@@ -46,9 +57,7 @@ const isAnswerValid = (ans, { num, denum }) => {
46
57
  export const simplifyFraction = {
47
58
  id: "simplifyFrac",
48
59
  connector: "=",
49
- label: "Simplification de fractions",
50
- levels: ["4ème", "3ème", "2nde", "CAP", "2ndPro", "1rePro"],
51
- sections: ["Fractions"],
60
+ label: "Simplifier une fraction",
52
61
  isSingleStep: false,
53
62
  generator: (nb) => getDistinctQuestions(getSimplifyFraction, nb),
54
63
  qcmTimer: 60,
@@ -1 +1 @@
1
- {"version":3,"file":"proportionalityTable.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/proportionality/proportionalityTable.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,6BAA6B,CAAC;AAQrC,KAAK,WAAW,GAAG;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;CACrB,CAAC;AA0EF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CActD,CAAC"}
1
+ {"version":3,"file":"proportionalityTable.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/proportionality/proportionalityTable.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAWT,MAAM,6BAA6B,CAAC;AASrC,KAAK,WAAW,GAAG;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;CACrB,CAAC;AA0FF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAgBtD,CAAC"}
@@ -2,6 +2,7 @@ import { addValidProp, tryToAddWrongProp, } from "../../../../exercises/exercise
2
2
  import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
3
  import { IntegerConstructor } from "../../../../math/numbers/integer/integer.js";
4
4
  import { randint } from "../../../../math/utils/random/randint.js";
5
+ import { round } from "../../../../math/utils/round.js";
5
6
  import { shuffle } from "../../../../utils/alea/shuffle.js";
6
7
  import { dollarize } from "../../../../utils/latex/dollarize.js";
7
8
  import { mdTable } from "../../../../utils/markdown/mdTable.js";
@@ -15,37 +16,50 @@ ${mdTable([
15
16
 
16
17
  Déterminer le nombre manquant.`;
17
18
  };
19
+ const getAnswer = (identifiers) => {
20
+ const { randQuation, x1, x2, x3, x4 } = identifiers;
21
+ const table = [x1, x2, x3, x4].map(Number);
22
+ switch (randQuation) {
23
+ case 0:
24
+ return round((table[1] * table[2]) / table[3], 0).frenchify();
25
+ case 1:
26
+ return round((table[0] * table[3]) / table[2], 0).frenchify();
27
+ case 2:
28
+ return round((table[3] * table[0]) / table[1], 0).frenchify();
29
+ case 3:
30
+ default:
31
+ return round((table[2] * table[1]) / table[0], 0).frenchify();
32
+ }
33
+ };
18
34
  const getProportionalityTable = () => {
19
35
  const fact = randint(2, 10);
20
36
  let [x1, x2] = IntegerConstructor.randomDifferents(1, 100 / fact, 2);
21
37
  let [x3, x4] = [x1 * fact, x2 * fact];
22
- let answer = "";
23
38
  const randQuation = randint(0, 4);
24
39
  switch (randQuation) {
25
40
  case 0:
26
- answer = x1 + "";
27
41
  x1 = "?";
28
42
  break;
29
43
  case 1:
30
- answer = +x2 + "";
31
44
  x2 = "?";
32
45
  break;
33
46
  case 2:
34
- answer = x3 + "";
35
47
  x3 = "?";
36
48
  break;
37
49
  case 3:
38
- answer = x4 + "";
39
50
  x4 = "?";
40
51
  break;
41
52
  }
42
53
  const identifiers = { x1, x2, x3, x4, randQuation };
54
+ return getQuestionFromIdentifiers(identifiers);
55
+ };
56
+ const getQuestionFromIdentifiers = (identifiers) => {
43
57
  const question = {
44
58
  instruction: getInstruction(identifiers),
45
- answer: answer,
59
+ answer: getAnswer(identifiers),
46
60
  keys: [],
47
61
  answerFormat: "tex",
48
- identifiers: { randQuation, x1, x2, x3, x4 },
62
+ identifiers,
49
63
  style: {
50
64
  tableHasNoHeader: true,
51
65
  },
@@ -77,4 +91,6 @@ export const proportionalityTable = {
77
91
  isAnswerValid,
78
92
  subject: "Mathématiques",
79
93
  getInstruction,
94
+ getQuestionFromIdentifiers,
95
+ getAnswer,
80
96
  };
@@ -1 +1 @@
1
- {"version":3,"file":"rectangleSideAfterReduction.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/proportionality/rectangleSideAfterReduction.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,MAAM,EAAE,CAAC;CAGnB,CAAC;AA8OF,eAAO,MAAM,2BAA2B,EAAE,QAAQ,CAAC,WAAW,CAmB7D,CAAC"}
1
+ {"version":3,"file":"rectangleSideAfterReduction.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/proportionality/rectangleSideAfterReduction.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,MAAM,EAAE,CAAC;CAGnB,CAAC;AAoPF,eAAO,MAAM,2BAA2B,EAAE,QAAQ,CAAC,WAAW,CAoB7D,CAAC"}
@@ -169,6 +169,9 @@ const getRectangleSideAfterReductionQuestion = (ops) => {
169
169
  const identifiers = {
170
170
  lengths: [a, b, c, d],
171
171
  };
172
+ return getQuestionFromIdentifiers(identifiers);
173
+ };
174
+ const getQuestionFromIdentifiers = (identifiers) => {
172
175
  const question = {
173
176
  answer: getAnswer(identifiers),
174
177
  instruction: getInstruction(identifiers),
@@ -195,4 +198,5 @@ export const rectangleSideAfterReduction = {
195
198
  // getHint,
196
199
  // getCorrection,
197
200
  getAnswer,
201
+ getQuestionFromIdentifiers,
198
202
  };
@@ -1 +1 @@
1
- {"version":3,"file":"signFromAx.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/sign/signFromAx.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AASrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAwGF,eAAO,MAAM,UAAU,EAAE,QAAQ,CAAC,WAAW,CAiB5C,CAAC"}
1
+ {"version":3,"file":"signFromAx.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/sign/signFromAx.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AASrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AA6GF,eAAO,MAAM,UAAU,EAAE,QAAQ,CAAC,WAAW,CAkB5C,CAAC"}
@@ -80,6 +80,9 @@ const getSignFromAxQuestion = (ops) => {
80
80
  [1, 0.45],
81
81
  ]),
82
82
  };
83
+ return getQuestionFromIdentifiers(identifiers);
84
+ };
85
+ const getQuestionFromIdentifiers = (identifiers) => {
83
86
  const question = {
84
87
  answer: getAnswer(identifiers),
85
88
  instruction: getInstruction(identifiers),
@@ -107,4 +110,5 @@ export const signFromAx = {
107
110
  hasHintAndCorrection: true,
108
111
  getAnswer,
109
112
  answerType: "QCU",
113
+ getQuestionFromIdentifiers,
110
114
  };
@@ -1,8 +1,8 @@
1
1
  import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
2
2
  import { random } from "../../../../utils/alea/random.js";
3
- import { getFirstIdentityPropositions, getFirstIdentityQuestion, isFirstIdentityAnswerValid, } from "./firstIdentity.js";
4
- import { getSecondIdentityPropositions, getSecondIdentityQuestion, isSecondIdentityAnswerValid, } from "./secondIdentity.js";
5
- import { getThirdIdentityPropositions, getThirdIdentityQuestion, isThirdIdentityAnswerValid, } from "./thirdIdentity.js";
3
+ import { getFirstIdentityPropositions, getFirstIdentityQuestion, isFirstIdentityAnswerValid, } from "./idRmq1.js";
4
+ import { getSecondIdentityPropositions, getSecondIdentityQuestion, isSecondIdentityAnswerValid, } from "./idRmq2.js";
5
+ import { getThirdIdentityPropositions, getThirdIdentityQuestion, isThirdIdentityAnswerValid, } from "./idRmq3.js";
6
6
  const getAllIdentitiesQuestion = () => {
7
7
  const type = random([1, 2, 3]);
8
8
  let question;
@@ -0,0 +1,8 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ type Identifiers = {
3
+ affine1Coeffs: number[];
4
+ affine2Coeffs: number[];
5
+ };
6
+ export declare const doubleDistributivity: Exercise<Identifiers>;
7
+ export {};
8
+ //# sourceMappingURL=doubleDistri.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"doubleDistri.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/distributivity/doubleDistri.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAYrC,KAAK,WAAW,GAAG;IACjB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,aAAa,EAAE,MAAM,EAAE,CAAC;CACzB,CAAC;AA+JF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAmBtD,CAAC"}
@@ -0,0 +1,155 @@
1
+ import { addValidProp, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { Affine, AffineConstructor } from "../../../../math/polynomials/affine.js";
4
+ import { randint } from "../../../../math/utils/random/randint.js";
5
+ import { AddNode } from "../../../../tree/nodes/operators/addNode.js";
6
+ import { MultiplyNode } from "../../../../tree/nodes/operators/multiplyNode.js";
7
+ import { operatorComposition } from "../../../../tree/utilities/operatorComposition.js";
8
+ import { alignTex } from "../../../../utils/latex/alignTex.js";
9
+ import { shuffle } from "../../../../utils/alea/shuffle.js";
10
+ import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
11
+ import { polynomialParser } from "../../../../tree/parsers/polynomialParser.js";
12
+ const getStatementNode = (identifiers) => {
13
+ const { affine1Coeffs, affine2Coeffs } = identifiers;
14
+ const affines = [
15
+ new Affine(affine1Coeffs[1], affine1Coeffs[0]),
16
+ new Affine(affine2Coeffs[1], affine2Coeffs[0]),
17
+ ];
18
+ const statementTree = new MultiplyNode(affines[0].toTree(), affines[1].toTree());
19
+ return statementTree;
20
+ };
21
+ const getStartStatement = (identifiers) => {
22
+ return getStatementNode(identifiers).toTex();
23
+ };
24
+ const getInstruction = (identifiers) => {
25
+ return `Développer et réduire :
26
+
27
+ $$
28
+ ${getStartStatement(identifiers)}
29
+ $$`;
30
+ };
31
+ const getAnswer = (identifiers) => {
32
+ const { affine1Coeffs, affine2Coeffs } = identifiers;
33
+ const affines = [
34
+ new Affine(affine1Coeffs[1], affine1Coeffs[0]),
35
+ new Affine(affine2Coeffs[1], affine2Coeffs[0]),
36
+ ];
37
+ const answer = affines[0].multiply(affines[1]).toTree().toTex();
38
+ return answer;
39
+ };
40
+ const getHint = (identifiers) => {
41
+ return "Multiplie chaque terme du premier facteur par chaque terme du second facteur, puis regroupe les termes similaires.";
42
+ };
43
+ const getCorrection = (identifiers) => {
44
+ const statementTex = getStartStatement(identifiers);
45
+ const answer = getAnswer(identifiers);
46
+ const { affine1Coeffs, affine2Coeffs } = identifiers;
47
+ const affines = [
48
+ new Affine(affine1Coeffs[1], affine1Coeffs[0]),
49
+ new Affine(affine2Coeffs[1], affine2Coeffs[0]),
50
+ ];
51
+ const subTerms = [
52
+ new MultiplyNode(affines[0].a.toTree(), "x".toTree()),
53
+ affines[0].b.toTree(),
54
+ new MultiplyNode(affines[1].a.toTree(), "x".toTree()),
55
+ affines[1].b.toTree(),
56
+ ];
57
+ const subMultiplications = [
58
+ new MultiplyNode(subTerms[0], subTerms[2], { forceTimesSign: true }),
59
+ new MultiplyNode(subTerms[0], subTerms[3], { forceTimesSign: true }),
60
+ new MultiplyNode(subTerms[1], subTerms[2], { forceTimesSign: true }),
61
+ new MultiplyNode(subTerms[1], subTerms[3], { forceTimesSign: true }),
62
+ ];
63
+ return `
64
+ ${alignTex([
65
+ [statementTex, "=", operatorComposition(AddNode, subMultiplications).toTex()],
66
+ [
67
+ "",
68
+ "=",
69
+ operatorComposition(AddNode, subMultiplications.map((e) => e.simplify())).toTex(),
70
+ ],
71
+ ["", "=", answer],
72
+ ])}
73
+
74
+ `;
75
+ };
76
+ const getDoubleDistributivityQuestion = () => {
77
+ const affines = AffineConstructor.differentRandoms(2, undefined, {
78
+ excludes: [0],
79
+ });
80
+ const statementTree = new MultiplyNode(affines[0].toTree(), affines[1].toTree());
81
+ const identifiers = {
82
+ affine1Coeffs: affines[0].coefficients,
83
+ affine2Coeffs: affines[1].coefficients,
84
+ };
85
+ const question = {
86
+ instruction: getInstruction(identifiers),
87
+ startStatement: statementTree.toTex(),
88
+ answer: getAnswer(identifiers),
89
+ keys: ["x"],
90
+ answerFormat: "tex",
91
+ identifiers,
92
+ hint: getHint(identifiers),
93
+ correction: getCorrection(identifiers),
94
+ };
95
+ return question;
96
+ };
97
+ const getPropositions = (n, { answer, affine1Coeffs, affine2Coeffs }) => {
98
+ const propositions = [];
99
+ addValidProp(propositions, answer);
100
+ const affines = [
101
+ new Affine(affine1Coeffs[1], affine1Coeffs[0]),
102
+ new Affine(affine2Coeffs[1], affine2Coeffs[0]),
103
+ ];
104
+ tryToAddWrongProp(propositions, affines[0]
105
+ .multiply(new Affine(-affines[1].a, randint(-9, 10, [affines[1].b])))
106
+ .toTree()
107
+ .toTex());
108
+ tryToAddWrongProp(propositions, affines[1]
109
+ .multiply(new Affine(randint(-9, 10, [affines[0].a, 0]), affines[0].b))
110
+ .toTree()
111
+ .toTex());
112
+ while (propositions.length < n) {
113
+ const affinesTemps = AffineConstructor.differentRandoms(2, undefined, {
114
+ excludes: [0],
115
+ });
116
+ const wrongAnswer = affinesTemps[0].multiply(affinesTemps[1]).toTree();
117
+ tryToAddWrongProp(propositions, wrongAnswer.toTex());
118
+ }
119
+ return shuffle(propositions);
120
+ };
121
+ const isAnswerValid = (ans, { answer }) => {
122
+ try {
123
+ const parsed = polynomialParser(ans);
124
+ if (!parsed)
125
+ return false;
126
+ return (parsed
127
+ .simplify({
128
+ forbidFactorize: true,
129
+ towardsDistribute: true,
130
+ })
131
+ .toTex() === answer);
132
+ }
133
+ catch (err) {
134
+ return handleVEAError(err);
135
+ }
136
+ };
137
+ export const doubleDistributivity = {
138
+ id: "doubleDistri",
139
+ connector: "=",
140
+ label: "Distributivité double",
141
+ levels: ["3ème", "2nde", "1reTech"],
142
+ sections: ["Calcul littéral"],
143
+ isSingleStep: false,
144
+ generator: (nb) => getDistinctQuestions(getDoubleDistributivityQuestion, nb),
145
+ qcmTimer: 60,
146
+ freeTimer: 60,
147
+ getPropositions,
148
+ isAnswerValid,
149
+ subject: "Mathématiques",
150
+ hasHintAndCorrection: true,
151
+ getInstruction,
152
+ getAnswer,
153
+ getCorrection,
154
+ getHint,
155
+ };
@@ -0,0 +1,11 @@
1
+ import { Exercise, QCMGenerator, QuestionGenerator, VEA } from "../../../../exercises/exercise.js";
2
+ type Identifiers = {
3
+ a: number;
4
+ b: number;
5
+ };
6
+ export declare const getFirstIdentityQuestion: QuestionGenerator<Identifiers>;
7
+ export declare const getFirstIdentityPropositions: QCMGenerator<Identifiers>;
8
+ export declare const isFirstIdentityAnswerValid: VEA<Identifiers>;
9
+ export declare const firstIdentity: Exercise<Identifiers>;
10
+ export {};
11
+ //# sourceMappingURL=idRmq1.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"idRmq1.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/distributivity/idRmq1.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAOR,YAAY,EAEZ,iBAAiB,EACjB,GAAG,EAGJ,MAAM,6BAA6B,CAAC;AAerC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AA2EF,eAAO,MAAM,wBAAwB,EAAE,iBAAiB,CAAC,WAAW,CAwBnE,CAAC;AAEF,eAAO,MAAM,4BAA4B,EAAE,YAAY,CAAC,WAAW,CAkClE,CAAC;AAEF,eAAO,MAAM,0BAA0B,EAAE,GAAG,CAAC,WAAW,CAgBvD,CAAC;AAMF,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,WAAW,CAmB/C,CAAC"}