math-exercises 3.0.150 → 3.0.152

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 (217) hide show
  1. package/lib/exercises/exercise.d.ts +5 -0
  2. package/lib/exercises/exercise.d.ts.map +1 -1
  3. package/lib/exercises/math/calcul/arithmetics/primeNumbersAffirmations.js +1 -1
  4. package/lib/exercises/math/calcul/fractions/fractionToPercentToDecimal.d.ts +5 -1
  5. package/lib/exercises/math/calcul/fractions/fractionToPercentToDecimal.d.ts.map +1 -1
  6. package/lib/exercises/math/calcul/fractions/fractionToPercentToDecimal.js +92 -38
  7. package/lib/exercises/math/calcul/proportionality/findCoeffInProportionalTableNonIntegers.d.ts.map +1 -1
  8. package/lib/exercises/math/calcul/proportionality/findCoeffInProportionalTableNonIntegers.js +5 -1
  9. package/lib/exercises/math/calcul/proportionality/isTableProportional.d.ts.map +1 -1
  10. package/lib/exercises/math/calcul/proportionality/isTableProportional.js +7 -1
  11. package/lib/exercises/math/calcul/proportionality/isTableProportionalNonInteger.d.ts.map +1 -1
  12. package/lib/exercises/math/calcul/proportionality/isTableProportionalNonInteger.js +5 -1
  13. package/lib/exercises/math/calcul/proportionality/proportionalityTable.d.ts.map +1 -1
  14. package/lib/exercises/math/calcul/proportionality/proportionalityTable.js +5 -1
  15. package/lib/exercises/math/calcul/proportionality/proportionalityTableCoefficient.d.ts.map +1 -1
  16. package/lib/exercises/math/calcul/proportionality/proportionalityTableCoefficient.js +8 -2
  17. package/lib/exercises/math/calculLitteral/equation/equa1.d.ts +4 -1
  18. package/lib/exercises/math/calculLitteral/equation/equa1.d.ts.map +1 -1
  19. package/lib/exercises/math/calculLitteral/equation/equa1.js +27 -7
  20. package/lib/exercises/math/calculLitteral/equation/equa2.d.ts +1 -0
  21. package/lib/exercises/math/calculLitteral/equation/equa2.d.ts.map +1 -1
  22. package/lib/exercises/math/calculLitteral/equation/equa2.js +18 -1
  23. package/lib/exercises/math/calculLitteral/equation/equa3.d.ts +4 -1
  24. package/lib/exercises/math/calculLitteral/equation/equa3.d.ts.map +1 -1
  25. package/lib/exercises/math/calculLitteral/equation/equa3.js +26 -6
  26. package/lib/exercises/math/calculLitteral/equation/equa4.d.ts +4 -1
  27. package/lib/exercises/math/calculLitteral/equation/equa4.d.ts.map +1 -1
  28. package/lib/exercises/math/calculLitteral/equation/equa4.js +27 -7
  29. package/lib/exercises/math/calculLitteral/equation/firstDegree/equa1.d.ts +14 -0
  30. package/lib/exercises/math/calculLitteral/equation/firstDegree/equa1.d.ts.map +1 -0
  31. package/lib/exercises/math/calculLitteral/equation/firstDegree/equa1.js +129 -0
  32. package/lib/exercises/math/calculLitteral/equation/firstDegree/equa2.d.ts +18 -0
  33. package/lib/exercises/math/calculLitteral/equation/firstDegree/equa2.d.ts.map +1 -0
  34. package/lib/exercises/math/calculLitteral/equation/firstDegree/equa2.js +167 -0
  35. package/lib/exercises/math/calculLitteral/equation/firstDegree/equa3.d.ts +15 -0
  36. package/lib/exercises/math/calculLitteral/equation/firstDegree/equa3.d.ts.map +1 -0
  37. package/lib/exercises/math/calculLitteral/equation/firstDegree/equa3.js +129 -0
  38. package/lib/exercises/math/calculLitteral/equation/firstDegree/equa4.d.ts +16 -0
  39. package/lib/exercises/math/calculLitteral/equation/firstDegree/equa4.d.ts.map +1 -0
  40. package/lib/exercises/math/calculLitteral/equation/firstDegree/equa4.js +124 -0
  41. package/lib/exercises/math/calculLitteral/equation/firstDegree/firstDegreeEquationIntType1.d.ts +9 -0
  42. package/lib/exercises/math/calculLitteral/equation/firstDegree/firstDegreeEquationIntType1.d.ts.map +1 -0
  43. package/lib/exercises/math/calculLitteral/equation/firstDegree/firstDegreeEquationIntType1.js +107 -0
  44. package/lib/exercises/math/calculLitteral/equation/firstDegree/firstDegreeEquationIntType2.d.ts +10 -0
  45. package/lib/exercises/math/calculLitteral/equation/firstDegree/firstDegreeEquationIntType2.d.ts.map +1 -0
  46. package/lib/exercises/math/calculLitteral/equation/firstDegree/firstDegreeEquationIntType2.js +108 -0
  47. package/lib/exercises/math/calculLitteral/equation/firstDegree/firstDegreeEquationIntType3.d.ts +11 -0
  48. package/lib/exercises/math/calculLitteral/equation/firstDegree/firstDegreeEquationIntType3.d.ts.map +1 -0
  49. package/lib/exercises/math/calculLitteral/equation/firstDegree/firstDegreeEquationIntType3.js +104 -0
  50. package/lib/exercises/math/calculLitteral/equation/firstDegree/index.d.ts +8 -0
  51. package/lib/exercises/math/calculLitteral/equation/firstDegree/index.d.ts.map +1 -0
  52. package/lib/exercises/math/calculLitteral/equation/firstDegree/index.js +7 -0
  53. package/lib/exercises/math/calculLitteral/equation/index.d.ts +1 -7
  54. package/lib/exercises/math/calculLitteral/equation/index.d.ts.map +1 -1
  55. package/lib/exercises/math/calculLitteral/equation/index.js +1 -7
  56. package/lib/exercises/math/dataRepresentations/histogram/etendueHistogram.d.ts +8 -0
  57. package/lib/exercises/math/dataRepresentations/histogram/etendueHistogram.d.ts.map +1 -0
  58. package/lib/exercises/math/dataRepresentations/histogram/etendueHistogram.js +175 -0
  59. package/lib/exercises/math/dataRepresentations/histogram/histogramCommenting.d.ts +9 -0
  60. package/lib/exercises/math/dataRepresentations/histogram/histogramCommenting.d.ts.map +1 -0
  61. package/lib/exercises/math/dataRepresentations/histogram/histogramCommenting.js +250 -0
  62. package/lib/exercises/math/dataRepresentations/histogram/histogramFillDataTableFromHistogramData.d.ts +9 -0
  63. package/lib/exercises/math/dataRepresentations/histogram/histogramFillDataTableFromHistogramData.d.ts.map +1 -0
  64. package/lib/exercises/math/dataRepresentations/histogram/histogramFillDataTableFromHistogramData.js +173 -0
  65. package/lib/exercises/math/dataRepresentations/histogram/histogramIsSameData.d.ts +14 -0
  66. package/lib/exercises/math/dataRepresentations/histogram/histogramIsSameData.d.ts.map +1 -0
  67. package/lib/exercises/math/dataRepresentations/histogram/histogramIsSameData.js +239 -0
  68. package/lib/exercises/math/dataRepresentations/histogram/histogramReading.d.ts +9 -0
  69. package/lib/exercises/math/dataRepresentations/histogram/histogramReading.d.ts.map +1 -0
  70. package/lib/exercises/math/dataRepresentations/histogram/histogramReading.js +163 -0
  71. package/lib/exercises/math/dataRepresentations/histogram/index.d.ts +6 -0
  72. package/lib/exercises/math/dataRepresentations/histogram/index.d.ts.map +1 -0
  73. package/lib/exercises/math/dataRepresentations/histogram/index.js +5 -0
  74. package/lib/exercises/math/dataRepresentations/index.d.ts +1 -1
  75. package/lib/exercises/math/dataRepresentations/index.d.ts.map +1 -1
  76. package/lib/exercises/math/dataRepresentations/index.js +1 -1
  77. package/lib/exercises/math/dataRepresentations/tableReading.d.ts.map +1 -1
  78. package/lib/exercises/math/dataRepresentations/tableReading.js +7 -0
  79. package/lib/exercises/math/functions/affines/affineAdjustment.d.ts.map +1 -1
  80. package/lib/exercises/math/functions/affines/affineAdjustment.js +7 -1
  81. package/lib/exercises/math/functions/affines/affineAdjustmentComplete.d.ts.map +1 -1
  82. package/lib/exercises/math/functions/affines/affineAdjustmentComplete.js +7 -1
  83. package/lib/exercises/math/functions/affines/affineAdjustmentRsquared.d.ts.map +1 -1
  84. package/lib/exercises/math/functions/affines/affineAdjustmentRsquared.js +7 -1
  85. package/lib/exercises/math/functions/affines/leadingCoeffAndOriginOrdinate.d.ts +4 -1
  86. package/lib/exercises/math/functions/affines/leadingCoeffAndOriginOrdinate.d.ts.map +1 -1
  87. package/lib/exercises/math/functions/affines/leadingCoeffAndOriginOrdinate.js +19 -4
  88. package/lib/exercises/math/functions/affines/leadingCoefficient.d.ts +1 -0
  89. package/lib/exercises/math/functions/affines/leadingCoefficient.d.ts.map +1 -1
  90. package/lib/exercises/math/functions/affines/leadingCoefficient.js +13 -1
  91. package/lib/exercises/math/functions/affines/recognizeAffineGraph.d.ts +4 -1
  92. package/lib/exercises/math/functions/affines/recognizeAffineGraph.d.ts.map +1 -1
  93. package/lib/exercises/math/functions/affines/recognizeAffineGraph.js +19 -4
  94. package/lib/exercises/math/functions/basics/inverseImageFunctionTable.d.ts.map +1 -1
  95. package/lib/exercises/math/functions/basics/inverseImageFunctionTable.js +7 -1
  96. package/lib/exercises/math/functions/basics/placePointsFromValueTable.d.ts.map +1 -1
  97. package/lib/exercises/math/functions/basics/placePointsFromValueTable.js +7 -0
  98. package/lib/exercises/math/geometry/euclidian/pythagoreOrThales.d.ts +4 -1
  99. package/lib/exercises/math/geometry/euclidian/pythagoreOrThales.d.ts.map +1 -1
  100. package/lib/exercises/math/geometry/euclidian/pythagoreOrThales.js +18 -3
  101. package/lib/exercises/math/geometry/triangles/index.d.ts +1 -0
  102. package/lib/exercises/math/geometry/triangles/index.d.ts.map +1 -1
  103. package/lib/exercises/math/geometry/triangles/index.js +1 -0
  104. package/lib/exercises/math/geometry/triangles/similar/index.d.ts +4 -0
  105. package/lib/exercises/math/geometry/triangles/similar/index.d.ts.map +1 -0
  106. package/lib/exercises/math/geometry/triangles/similar/index.js +3 -0
  107. package/lib/exercises/math/geometry/triangles/similar/isSimilarTrianglesWithAngles.d.ts +10 -0
  108. package/lib/exercises/math/geometry/triangles/similar/isSimilarTrianglesWithAngles.d.ts.map +1 -0
  109. package/lib/exercises/math/geometry/triangles/similar/isSimilarTrianglesWithAngles.js +122 -0
  110. package/lib/exercises/math/geometry/triangles/similar/isSimilarTrianglesWrtSideLengths.d.ts +15 -0
  111. package/lib/exercises/math/geometry/triangles/similar/isSimilarTrianglesWrtSideLengths.d.ts.map +1 -0
  112. package/lib/exercises/math/geometry/triangles/similar/isSimilarTrianglesWrtSideLengths.js +351 -0
  113. package/lib/exercises/math/geometry/triangles/similar/placeSegmentsOfSimilarTriangle.d.ts +11 -0
  114. package/lib/exercises/math/geometry/triangles/similar/placeSegmentsOfSimilarTriangle.d.ts.map +1 -0
  115. package/lib/exercises/math/geometry/triangles/similar/placeSegmentsOfSimilarTriangle.js +311 -0
  116. package/lib/exercises/math/probaStat/basicProbas/calculateProbaFromProbaLaw.d.ts +10 -0
  117. package/lib/exercises/math/probaStat/basicProbas/calculateProbaFromProbaLaw.d.ts.map +1 -0
  118. package/lib/exercises/math/probaStat/basicProbas/calculateProbaFromProbaLaw.js +135 -0
  119. package/lib/exercises/math/probaStat/basicProbas/findEffectifFromProba.d.ts +9 -0
  120. package/lib/exercises/math/probaStat/basicProbas/findEffectifFromProba.d.ts.map +1 -0
  121. package/lib/exercises/math/probaStat/basicProbas/findEffectifFromProba.js +109 -0
  122. package/lib/exercises/math/probaStat/basicProbas/getMissingProbabilityValue.d.ts.map +1 -1
  123. package/lib/exercises/math/probaStat/basicProbas/getMissingProbabilityValue.js +7 -0
  124. package/lib/exercises/math/probaStat/basicProbas/getMissingProbabilityValueMiddleSchool.d.ts +9 -0
  125. package/lib/exercises/math/probaStat/basicProbas/getMissingProbabilityValueMiddleSchool.d.ts.map +1 -0
  126. package/lib/exercises/math/probaStat/basicProbas/getMissingProbabilityValueMiddleSchool.js +120 -0
  127. package/lib/exercises/math/probaStat/basicProbas/index.d.ts +4 -0
  128. package/lib/exercises/math/probaStat/basicProbas/index.d.ts.map +1 -1
  129. package/lib/exercises/math/probaStat/basicProbas/index.js +4 -0
  130. package/lib/exercises/math/probaStat/basicProbas/pickEquiprobableTo.d.ts +12 -0
  131. package/lib/exercises/math/probaStat/basicProbas/pickEquiprobableTo.d.ts.map +1 -0
  132. package/lib/exercises/math/probaStat/basicProbas/pickEquiprobableTo.js +374 -0
  133. package/lib/exercises/math/probaStat/probaFromTableNoContext.d.ts.map +1 -1
  134. package/lib/exercises/math/probaStat/probaFromTableNoContext.js +7 -0
  135. package/lib/exercises/math/probaStat/probaFromTableWithContext.d.ts.map +1 -1
  136. package/lib/exercises/math/probaStat/probaFromTableWithContext.js +7 -0
  137. package/lib/exercises/math/probaStat/stats1var/averageWithTable.d.ts.map +1 -1
  138. package/lib/exercises/math/probaStat/stats1var/averageWithTable.js +7 -1
  139. package/lib/exercises/math/probaStat/stats1var/calculateMeanFromFrequencies.d.ts.map +1 -1
  140. package/lib/exercises/math/probaStat/stats1var/calculateMeanFromFrequencies.js +7 -0
  141. package/lib/exercises/math/probaStat/stats1var/cumulativeSum.d.ts.map +1 -1
  142. package/lib/exercises/math/probaStat/stats1var/cumulativeSum.js +7 -0
  143. package/lib/exercises/math/probaStat/stats1var/etendueTable.d.ts.map +1 -1
  144. package/lib/exercises/math/probaStat/stats1var/etendueTable.js +7 -1
  145. package/lib/exercises/math/probaStat/stats1var/getQuartileProportionQuestion.d.ts.map +1 -1
  146. package/lib/exercises/math/probaStat/stats1var/getQuartileProportionQuestion.js +7 -0
  147. package/lib/exercises/math/probaStat/stats1var/interquartilesTable.d.ts.map +1 -1
  148. package/lib/exercises/math/probaStat/stats1var/interquartilesTable.js +5 -1
  149. package/lib/exercises/math/probaStat/stats1var/marginalAndConditionalFrequency.d.ts.map +1 -1
  150. package/lib/exercises/math/probaStat/stats1var/marginalAndConditionalFrequency.js +7 -0
  151. package/lib/exercises/math/probaStat/stats1var/medianWithList.d.ts +2 -0
  152. package/lib/exercises/math/probaStat/stats1var/medianWithList.d.ts.map +1 -1
  153. package/lib/exercises/math/probaStat/stats1var/medianWithList.js +67 -14
  154. package/lib/exercises/math/probaStat/stats1var/medianWithTable.d.ts.map +1 -1
  155. package/lib/exercises/math/probaStat/stats1var/medianWithTable.js +7 -1
  156. package/lib/exercises/math/probaStat/stats1var/quartiles.d.ts.map +1 -1
  157. package/lib/exercises/math/probaStat/stats1var/quartiles.js +7 -1
  158. package/lib/exercises/math/probaStat/stats1var/standardDeviationTable.d.ts.map +1 -1
  159. package/lib/exercises/math/probaStat/stats1var/standardDeviationTable.js +5 -1
  160. package/lib/exercises/math/probaStat/stats1var/varianceTable.d.ts.map +1 -1
  161. package/lib/exercises/math/probaStat/stats1var/varianceTable.js +5 -1
  162. package/lib/exercises/math/probaStat/stats2var/averagePoint.d.ts.map +1 -1
  163. package/lib/exercises/math/probaStat/stats2var/averagePoint.js +7 -1
  164. package/lib/exercises/math/probaStat/twoStepExperiments/headsOrTailsTwiceOutcomes.d.ts +7 -0
  165. package/lib/exercises/math/probaStat/twoStepExperiments/headsOrTailsTwiceOutcomes.d.ts.map +1 -0
  166. package/lib/exercises/math/probaStat/twoStepExperiments/headsOrTailsTwiceOutcomes.js +171 -0
  167. package/lib/exercises/math/probaStat/twoStepExperiments/headsOrTailsTwiceProbas.d.ts +7 -0
  168. package/lib/exercises/math/probaStat/twoStepExperiments/headsOrTailsTwiceProbas.d.ts.map +1 -0
  169. package/lib/exercises/math/probaStat/twoStepExperiments/headsOrTailsTwiceProbas.js +155 -0
  170. package/lib/exercises/math/probaStat/twoStepExperiments/index.d.ts +3 -0
  171. package/lib/exercises/math/probaStat/twoStepExperiments/index.d.ts.map +1 -1
  172. package/lib/exercises/math/probaStat/twoStepExperiments/index.js +3 -0
  173. package/lib/exercises/math/probaStat/twoStepExperiments/numberPoolTwiceProbas.d.ts +7 -0
  174. package/lib/exercises/math/probaStat/twoStepExperiments/numberPoolTwiceProbas.d.ts.map +1 -0
  175. package/lib/exercises/math/probaStat/twoStepExperiments/numberPoolTwiceProbas.js +189 -0
  176. package/lib/exercises/math/spaceGeometry/index.d.ts +1 -0
  177. package/lib/exercises/math/spaceGeometry/index.d.ts.map +1 -1
  178. package/lib/exercises/math/spaceGeometry/index.js +1 -0
  179. package/lib/exercises/math/spaceGeometry/sections/areaOfConeSection.d.ts +14 -0
  180. package/lib/exercises/math/spaceGeometry/sections/areaOfConeSection.d.ts.map +1 -0
  181. package/lib/exercises/math/spaceGeometry/sections/areaOfConeSection.js +439 -0
  182. package/lib/exercises/math/spaceGeometry/sections/areaOfCylinderSection.d.ts +14 -0
  183. package/lib/exercises/math/spaceGeometry/sections/areaOfCylinderSection.d.ts.map +1 -0
  184. package/lib/exercises/math/spaceGeometry/sections/areaOfCylinderSection.js +548 -0
  185. package/lib/exercises/math/spaceGeometry/sections/areaOfRectangularPrismSection.d.ts +11 -0
  186. package/lib/exercises/math/spaceGeometry/sections/areaOfRectangularPrismSection.d.ts.map +1 -0
  187. package/lib/exercises/math/spaceGeometry/sections/areaOfRectangularPrismSection.js +360 -0
  188. package/lib/exercises/math/spaceGeometry/sections/areaOfSphereSection.d.ts +9 -0
  189. package/lib/exercises/math/spaceGeometry/sections/areaOfSphereSection.d.ts.map +1 -0
  190. package/lib/exercises/math/spaceGeometry/sections/areaOfSphereSection.js +272 -0
  191. package/lib/exercises/math/spaceGeometry/sections/index.d.ts +9 -0
  192. package/lib/exercises/math/spaceGeometry/sections/index.d.ts.map +1 -0
  193. package/lib/exercises/math/spaceGeometry/sections/index.js +8 -0
  194. package/lib/exercises/math/spaceGeometry/sections/recognizeSectionsOfCone.d.ts +11 -0
  195. package/lib/exercises/math/spaceGeometry/sections/recognizeSectionsOfCone.d.ts.map +1 -0
  196. package/lib/exercises/math/spaceGeometry/sections/recognizeSectionsOfCone.js +266 -0
  197. package/lib/exercises/math/spaceGeometry/sections/recognizeSectionsOfCylinder.d.ts +11 -0
  198. package/lib/exercises/math/spaceGeometry/sections/recognizeSectionsOfCylinder.d.ts.map +1 -0
  199. package/lib/exercises/math/spaceGeometry/sections/recognizeSectionsOfCylinder.js +236 -0
  200. package/lib/exercises/math/spaceGeometry/sections/recognizeSectionsOfRectangularPrism.d.ts +7 -0
  201. package/lib/exercises/math/spaceGeometry/sections/recognizeSectionsOfRectangularPrism.d.ts.map +1 -0
  202. package/lib/exercises/math/spaceGeometry/sections/recognizeSectionsOfRectangularPrism.js +92 -0
  203. package/lib/exercises/math/spaceGeometry/sections/recognizeSectionsOfSphereOrBall.d.ts +9 -0
  204. package/lib/exercises/math/spaceGeometry/sections/recognizeSectionsOfSphereOrBall.d.ts.map +1 -0
  205. package/lib/exercises/math/spaceGeometry/sections/recognizeSectionsOfSphereOrBall.js +236 -0
  206. package/lib/exercises/pc/mathExosInPC.d.ts +4 -4
  207. package/lib/exercises/pc/mathExosInPC.d.ts.map +1 -1
  208. package/lib/exercises/pc/mathExosInPC.js +4 -4
  209. package/lib/index.d.ts +173 -45
  210. package/lib/index.d.ts.map +1 -1
  211. package/lib/math/geometry/spacePoint.d.ts +10 -0
  212. package/lib/math/geometry/spacePoint.d.ts.map +1 -1
  213. package/lib/math/geometry/spacePoint.js +13 -0
  214. package/lib/tree/nodes/operators/substractNode.d.ts +1 -0
  215. package/lib/tree/nodes/operators/substractNode.d.ts.map +1 -1
  216. package/lib/tree/nodes/operators/substractNode.js +6 -0
  217. package/package.json +1 -1
@@ -1,6 +1,5 @@
1
- import { addValidProp, propWhile, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
1
+ import { GeneratorOptionTarget, GeneratorOptionType, addValidProp, propWhile, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
2
2
  import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
- import { equationKeys } from "../../../../exercises/utils/keys/equationKeys.js";
4
3
  import { Rational } from "../../../../math/numbers/rationals/rational.js";
5
4
  import { Affine } from "../../../../math/polynomials/affine.js";
6
5
  import { randint } from "../../../../math/utils/random/randint.js";
@@ -9,6 +8,7 @@ import { VariableNode } from "../../../../tree/nodes/variables/variableNode.js";
9
8
  import { shuffle } from "../../../../utils/alea/shuffle.js";
10
9
  import { equationVEA } from "../../../../exercises/vea/equationVEA.js";
11
10
  import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
11
+ import { equationKeys } from "../../../../exercises/utils/keys/equationKeys.js";
12
12
  const getStatementNode = (identifiers) => {
13
13
  const { a, b, c, d } = identifiers;
14
14
  const affines = [new Affine(a, b), new Affine(c, d)];
@@ -32,7 +32,7 @@ const getAnswer = (identifiers) => {
32
32
  const answer = answerTree.toTex();
33
33
  return answer;
34
34
  };
35
- const getEquationType4ExerciseQuestion = () => {
35
+ const getEquationType4ExerciseQuestion = (opts) => {
36
36
  const a = randint(-10, 11, [0, 1]);
37
37
  const b = randint(-10, 11, [0]);
38
38
  const c = randint(-10, 11, [0, a]);
@@ -43,14 +43,23 @@ const getEquationType4ExerciseQuestion = () => {
43
43
  c,
44
44
  d,
45
45
  };
46
- return getQuestionFromIdentifiers(identifiers);
46
+ return getQuestionFromIdentifiers(identifiers, opts);
47
+ };
48
+ const getKeys = (_identifiers, opts) => {
49
+ if (opts?.solutionFormat === "Ensemble") {
50
+ return ["S", "equal", "lbrace", "semicolon", "rbrace", "varnothing"];
51
+ }
52
+ if (opts?.solutionFormat === "$x=\\ldots$") {
53
+ return ["x", "equal"];
54
+ }
55
+ return equationKeys;
47
56
  };
48
- const getQuestionFromIdentifiers = (identifiers) => {
57
+ const getQuestionFromIdentifiers = (identifiers, opts) => {
49
58
  const question = {
50
59
  instruction: getInstruction(identifiers),
51
60
  startStatement: getStartStatement(identifiers),
52
61
  answer: getAnswer(identifiers),
53
- keys: equationKeys,
62
+ keys: getKeys(identifiers, opts),
54
63
  answerFormat: "tex",
55
64
  identifiers,
56
65
  hint: getHint(identifiers),
@@ -84,12 +93,22 @@ const isAnswerValid = (ans, { a, b, c, d }) => {
84
93
  .toTex();
85
94
  return equationVEA(ans, solution);
86
95
  };
96
+ const options = [
97
+ {
98
+ id: "solutionFormat",
99
+ label: "Donner la solution sous la forme :",
100
+ target: GeneratorOptionTarget.generation,
101
+ type: GeneratorOptionType.select,
102
+ values: ["Ensemble", "$x=\\ldots$", "Permettre les deux"],
103
+ defaultValue: "Permettre les deux",
104
+ },
105
+ ];
87
106
  export const equationType4Exercise = {
88
107
  id: "equa4",
89
108
  connector: "\\iff",
90
109
  label: "Résoudre une équation du type $ax+b=cx+d$",
91
110
  isSingleStep: false,
92
- generator: (nb) => getDistinctQuestions(getEquationType4ExerciseQuestion, nb),
111
+ generator: (nb, opts) => getDistinctQuestions(() => getEquationType4ExerciseQuestion(opts), nb),
93
112
  qcmTimer: 60,
94
113
  freeTimer: 60,
95
114
  getPropositions,
@@ -101,4 +120,5 @@ export const equationType4Exercise = {
101
120
  getHint,
102
121
  getCorrection,
103
122
  hasHintAndCorrection: true,
123
+ options,
104
124
  };
@@ -0,0 +1,14 @@
1
+ import { Exercise } from "../../../../../exercises/exercise.js";
2
+ /**
3
+ * type x+a=b
4
+ */
5
+ type Identifiers = {
6
+ a: number;
7
+ b: number;
8
+ };
9
+ type Options = {
10
+ solutionFormat: string;
11
+ };
12
+ export declare const equationType1Exercise: Exercise<Identifiers, Options>;
13
+ export {};
14
+ //# sourceMappingURL=equa1.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"equa1.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/calculLitteral/equation/firstDegree/equa1.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAmBT,MAAM,6BAA6B,CAAC;AAYrC;;GAEG;AACH,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAqHF,KAAK,OAAO,GAAG;IACb,cAAc,EAAE,MAAM,CAAC;CACxB,CAAC;AAYF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAoBhE,CAAC"}
@@ -0,0 +1,129 @@
1
+ import { GeneratorOptionTarget, GeneratorOptionType, addValidProp, propWhile, tryToAddWrongProp, } from "../../../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { Affine } from "../../../../../math/polynomials/affine.js";
4
+ import { randint } from "../../../../../math/utils/random/randint.js";
5
+ import { NumberNode } from "../../../../../tree/nodes/numbers/numberNode.js";
6
+ import { shuffle } from "../../../../../utils/alea/shuffle.js";
7
+ import { EqualNode } from "../../../../../tree/nodes/equations/equalNode.js";
8
+ import { alignTex } from "../../../../../utils/latex/alignTex.js";
9
+ import { AddNode } from "../../../../../tree/nodes/operators/addNode.js";
10
+ import { equationVEA } from "../../../../../exercises/vea/equationVEA.js";
11
+ import { equationKeys } from "../../../../../exercises/utils/keys/equationKeys.js";
12
+ const getInstruction = (identifiers) => {
13
+ const { a, b } = identifiers;
14
+ const affine = new Affine(1, a).toTree();
15
+ const tree = new EqualNode(affine, new NumberNode(b));
16
+ const statementTree = tree.toTex();
17
+ return `Résoudre :
18
+
19
+ $$
20
+ ${statementTree}
21
+ $$`;
22
+ };
23
+ const getAnswer = (identifiers) => {
24
+ const { a, b } = identifiers;
25
+ const solution = b - a;
26
+ const answer = `x=${solution}`;
27
+ return answer;
28
+ };
29
+ const getHint = (identifiers) => {
30
+ const { a } = identifiers;
31
+ return `Il faut isoler $x$ à gauche. Pour cela, effectue des deux côtés de l'équation l'opération qui permet de supprimer le terme $${a < 0 ? "" : "+"}${a}$.`;
32
+ };
33
+ const getCorrection = (identifiers) => {
34
+ const { a, b } = identifiers;
35
+ const affine = new Affine(1, a).toTree();
36
+ const tree = new EqualNode(affine, new NumberNode(b));
37
+ const statementTree = tree.toTex();
38
+ const answer = getAnswer(identifiers);
39
+ return `Pour isoler $x$ à gauche, on effectue l'opération $${a > 0 ? `-${a}` : `+${Math.abs(a)}`}$ des deux côtés de l'équation :
40
+
41
+ ${alignTex([
42
+ [
43
+ `${statementTree}`,
44
+ "\\iff",
45
+ new EqualNode(new AddNode(affine, new NumberNode(-a)), new AddNode(b.toTree(), new NumberNode(-a))).toTex(),
46
+ ],
47
+ ["", "\\iff", answer],
48
+ ])}`;
49
+ };
50
+ const getStartStatement = (identifiers) => {
51
+ const { a, b } = identifiers;
52
+ const affine = new Affine(1, a).toTree();
53
+ const tree = new EqualNode(affine, new NumberNode(b));
54
+ const statementTree = tree.toTex();
55
+ return statementTree;
56
+ };
57
+ const getEquationType1ExerciseQuestion = (opts) => {
58
+ const b = randint(-10, 11);
59
+ const a = randint(-10, 11, [0]);
60
+ const identifiers = { a, b };
61
+ return getQuestionFromIdentifiers(identifiers, opts);
62
+ };
63
+ const getKeys = (_identifiers, opts) => {
64
+ if (opts?.solutionFormat === "Ensemble") {
65
+ return ["S", "equal", "lbrace", "semicolon", "rbrace", "varnothing"];
66
+ }
67
+ if (opts?.solutionFormat === "$x=\\ldots$") {
68
+ return ["x", "equal"];
69
+ }
70
+ return equationKeys;
71
+ };
72
+ const getQuestionFromIdentifiers = (identifiers, opts) => {
73
+ const question = {
74
+ instruction: getInstruction(identifiers),
75
+ startStatement: getStartStatement(identifiers),
76
+ answer: getAnswer(identifiers),
77
+ keys: getKeys(identifiers, opts),
78
+ answerFormat: "tex",
79
+ identifiers,
80
+ hint: getHint(identifiers),
81
+ correction: getCorrection(identifiers),
82
+ };
83
+ return question;
84
+ };
85
+ const getPropositions = (n, { answer, a, b }) => {
86
+ const propositions = [];
87
+ addValidProp(propositions, answer);
88
+ const solution = b - a;
89
+ tryToAddWrongProp(propositions, `x=${b + a}`);
90
+ propWhile(propositions, n, () => {
91
+ const wrongAnswer = solution + randint(-3, 4, [0]);
92
+ tryToAddWrongProp(propositions, `x=${wrongAnswer}`);
93
+ });
94
+ return shuffle(propositions);
95
+ };
96
+ const isAnswerValid = (ans, { a, b }) => {
97
+ const solution = (b - a).toTree().toTex();
98
+ return equationVEA(ans, solution);
99
+ };
100
+ const options = [
101
+ {
102
+ id: "solutionFormat",
103
+ label: "Donner la solution sous la forme :",
104
+ target: GeneratorOptionTarget.generation,
105
+ type: GeneratorOptionType.select,
106
+ values: ["Ensemble", "$x=\\ldots$", "Permettre les deux"],
107
+ defaultValue: "Permettre les deux",
108
+ },
109
+ ];
110
+ export const equationType1Exercise = {
111
+ id: "equa1",
112
+ connector: "\\iff",
113
+ label: "Résoudre une équation du type $x+a = b$",
114
+ isSingleStep: true,
115
+ generator: (nb, opts) => getDistinctQuestions(() => getEquationType1ExerciseQuestion(opts), nb),
116
+ getPropositions,
117
+ qcmTimer: 60,
118
+ freeTimer: 60,
119
+ isAnswerValid,
120
+ subject: "Mathématiques",
121
+ hasHintAndCorrection: true,
122
+ getCorrection,
123
+ getHint,
124
+ getInstruction,
125
+ getAnswer,
126
+ getStartStatement,
127
+ getQuestionFromIdentifiers,
128
+ options,
129
+ };
@@ -0,0 +1,18 @@
1
+ import { Exercise } from "../../../../../exercises/exercise.js";
2
+ import { NodeIdentifiers } from "../../../../../tree/nodes/nodeConstructor.js";
3
+ /**
4
+ * type ax=b
5
+ */
6
+ type Identifiers = {
7
+ a: NodeIdentifiers;
8
+ b: NodeIdentifiers;
9
+ isXRight: boolean;
10
+ aNumberType: string;
11
+ };
12
+ type Options = {
13
+ aNumberType: string[];
14
+ solutionFormat: string;
15
+ };
16
+ export declare const equationType2Exercise: Exercise<Identifiers, Options>;
17
+ export {};
18
+ //# sourceMappingURL=equa2.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"equa2.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/calculLitteral/equation/firstDegree/equa2.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAmBT,MAAM,6BAA6B,CAAC;AAarC,OAAO,EAEL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;AAM7C;;GAEG;AAGH,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,eAAe,CAAC;IACnB,CAAC,EAAE,eAAe,CAAC;IACnB,QAAQ,EAAE,OAAO,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAuJF,KAAK,OAAO,GAAG;IACb,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;CACxB,CAAC;AAqBF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAoBhE,CAAC"}
@@ -0,0 +1,167 @@
1
+ import { GeneratorOptionTarget, GeneratorOptionType, addValidProp, propWhile, tryToAddWrongProp, } from "../../../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { equationKeys } from "../../../../../exercises/utils/keys/equationKeys.js";
4
+ import { RationalConstructor } from "../../../../../math/numbers/rationals/rational.js";
5
+ import { randint } from "../../../../../math/utils/random/randint.js";
6
+ import { EqualNode, equal } from "../../../../../tree/nodes/equations/equalNode.js";
7
+ import { VariableNode } from "../../../../../tree/nodes/variables/variableNode.js";
8
+ import { shuffle } from "../../../../../utils/alea/shuffle.js";
9
+ import { alignTex } from "../../../../../utils/latex/alignTex.js";
10
+ import { frac } from "../../../../../tree/nodes/operators/fractionNode.js";
11
+ import { coinFlip } from "../../../../../utils/alea/coinFlip.js";
12
+ import { random } from "../../../../../utils/alea/random.js";
13
+ import { GeneralAffine } from "../../../../../math/polynomials/generalAffine.js";
14
+ import { NodeConstructor, reifyAlgebraic, } from "../../../../../tree/nodes/nodeConstructor.js";
15
+ import { substract } from "../../../../../tree/nodes/operators/substractNode.js";
16
+ import { add } from "../../../../../tree/nodes/operators/addNode.js";
17
+ import { equationVEA } from "../../../../../exercises/vea/equationVEA.js";
18
+ const getInstruction = (identifiers) => {
19
+ return `Résoudre :
20
+
21
+ $$
22
+ ${getStatementNode(identifiers).toTex()}
23
+ $$`;
24
+ };
25
+ const getAnswer = (identifiers) => {
26
+ const { a, b } = identifiers;
27
+ const aTree = reifyAlgebraic(a);
28
+ const bTree = reifyAlgebraic(b);
29
+ const solution = frac(bTree, aTree).simplify();
30
+ const answer = new EqualNode(new VariableNode("x"), solution).toTex();
31
+ return answer;
32
+ };
33
+ const getHint = (identifiers) => {
34
+ const { a, isXRight } = identifiers;
35
+ const aTree = reifyAlgebraic(a);
36
+ return `Il faut isoler $x$ à ${isXRight ? "droite" : "gauche"}. Pour cela, effectue des deux côtés de l'équation l'opération qui permet de supprimer la multiplication par $${aTree.toTex()}$.`;
37
+ };
38
+ const getCorrection = (identifiers) => {
39
+ const { a, b, isXRight } = identifiers;
40
+ const aTree = reifyAlgebraic(a);
41
+ const bTree = reifyAlgebraic(b);
42
+ const affine = new GeneralAffine(aTree, 0).toTree();
43
+ const equalTree = new EqualNode(affine, bTree);
44
+ const tree = isXRight ? equalTree.reverse() : equalTree;
45
+ const answer = getAnswer(identifiers);
46
+ return `Pour isoler $x$ à ${isXRight ? "droite" : "gauche"}, on divise les deux côtés de l'équation par $${aTree.toTex()}$ :
47
+
48
+ ${alignTex([
49
+ [
50
+ `${tree.toTex()}`,
51
+ "\\iff",
52
+ isXRight
53
+ ? equal(frac(bTree, aTree), frac(affine, aTree)).toTex()
54
+ : equal(frac(affine, aTree), frac(bTree, aTree)).toTex(),
55
+ ],
56
+ ["", "\\iff", answer],
57
+ ])}
58
+ `;
59
+ };
60
+ const getStatementNode = (identifiers) => {
61
+ const { a, b, isXRight } = identifiers;
62
+ const aTree = reifyAlgebraic(a);
63
+ const bTree = reifyAlgebraic(b);
64
+ const affine = new GeneralAffine(aTree, 0).toTree();
65
+ const equalTree = new EqualNode(affine, bTree);
66
+ const tree = isXRight ? equalTree.reverse() : equalTree;
67
+ return tree;
68
+ };
69
+ const getStartStatement = (identifiers) => {
70
+ return getStatementNode(identifiers).toTex();
71
+ };
72
+ const getEquationType2ExerciseQuestion = (opts) => {
73
+ const types = opts?.aNumberType ?? ["Entier"];
74
+ const b = randint(-10, 11).toTree();
75
+ const type = random(types);
76
+ const a = type === "Entier"
77
+ ? randint(-9, 10, [0, 1]).toTree()
78
+ : RationalConstructor.randomIrreductibleWithSign().toTree();
79
+ const isXRight = coinFlip();
80
+ const identifiers = {
81
+ a: a.toIdentifiers(),
82
+ b: b.toIdentifiers(),
83
+ isXRight,
84
+ aNumberType: type,
85
+ };
86
+ return getQuestionFromIdentifiers(identifiers, opts);
87
+ };
88
+ const getKeys = (_identifiers, opts) => {
89
+ if (opts?.solutionFormat === "Ensemble") {
90
+ return ["S", "equal", "lbrace", "semicolon", "rbrace", "varnothing"];
91
+ }
92
+ if (opts?.solutionFormat === "$x=\\ldots$") {
93
+ return ["x", "equal"];
94
+ }
95
+ return equationKeys;
96
+ };
97
+ const getQuestionFromIdentifiers = (identifiers, opts) => {
98
+ const question = {
99
+ instruction: getInstruction(identifiers, opts),
100
+ startStatement: getStartStatement(identifiers, opts),
101
+ answer: getAnswer(identifiers, opts),
102
+ keys: getKeys(identifiers, opts),
103
+ answerFormat: "tex",
104
+ identifiers,
105
+ hint: getHint(identifiers, opts),
106
+ correction: getCorrection(identifiers, opts),
107
+ };
108
+ return question;
109
+ };
110
+ const getPropositions = (n, { answer, a, b }) => {
111
+ const aNode = NodeConstructor.fromIdentifiers(a);
112
+ const bNode = NodeConstructor.fromIdentifiers(b);
113
+ const propositions = [];
114
+ addValidProp(propositions, answer);
115
+ tryToAddWrongProp(propositions, substract(bNode, aNode).simplify().toTex());
116
+ propWhile(propositions, n, () => {
117
+ const bEv = randint(-7, 8, [0, -bNode.evaluate()]);
118
+ const a = add(aNode, randint(-7, 8, [-aNode.evaluate(), 0]));
119
+ const wrongAnswer = frac(bEv, a).simplify();
120
+ tryToAddWrongProp(propositions, new EqualNode(new VariableNode("x"), wrongAnswer).toTex());
121
+ });
122
+ return shuffle(propositions);
123
+ };
124
+ const isAnswerValid = (ans, { a, b }) => {
125
+ const aNode = NodeConstructor.fromIdentifiers(a);
126
+ const bNode = NodeConstructor.fromIdentifiers(b);
127
+ const solution = frac(bNode, aNode).simplify().toTex();
128
+ return equationVEA(ans, solution);
129
+ };
130
+ const options = [
131
+ {
132
+ id: "aNumberType",
133
+ label: "Type du coefficient $a$",
134
+ target: GeneratorOptionTarget.generation,
135
+ type: GeneratorOptionType.multiselect,
136
+ defaultValue: ["Entier"],
137
+ values: ["Entier", "Rationnel"],
138
+ },
139
+ {
140
+ id: "solutionFormat",
141
+ label: "Donner la solution sous la forme :",
142
+ target: GeneratorOptionTarget.generation,
143
+ type: GeneratorOptionType.select,
144
+ values: ["Ensemble", "$x=\\ldots$", "Permettre les deux"],
145
+ defaultValue: "Permettre les deux",
146
+ },
147
+ ];
148
+ export const equationType2Exercise = {
149
+ id: "equa2",
150
+ connector: "\\iff",
151
+ label: "Résoudre une équation du type $ax=b$",
152
+ isSingleStep: true,
153
+ generator: (nb, opts) => getDistinctQuestions(() => getEquationType2ExerciseQuestion(opts), nb),
154
+ qcmTimer: 60,
155
+ freeTimer: 60,
156
+ getPropositions,
157
+ isAnswerValid,
158
+ subject: "Mathématiques",
159
+ hasHintAndCorrection: true,
160
+ options,
161
+ getCorrection,
162
+ getHint,
163
+ getInstruction,
164
+ getAnswer,
165
+ getStartStatement,
166
+ getQuestionFromIdentifiers,
167
+ };
@@ -0,0 +1,15 @@
1
+ import { Exercise } from "../../../../../exercises/exercise.js";
2
+ /**
3
+ * type ax+b=c
4
+ */
5
+ type Identifiers = {
6
+ a: number;
7
+ b: number;
8
+ c: number;
9
+ };
10
+ type Options = {
11
+ solutionFormat: string;
12
+ };
13
+ export declare const equationType3Exercise: Exercise<Identifiers, Options>;
14
+ export {};
15
+ //# sourceMappingURL=equa3.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"equa3.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/calculLitteral/equation/firstDegree/equa3.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAmBT,MAAM,6BAA6B,CAAC;AAerC;;GAEG;AACH,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAmHF,KAAK,OAAO,GAAG;IACb,cAAc,EAAE,MAAM,CAAC;CACxB,CAAC;AAYF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAqBhE,CAAC"}
@@ -0,0 +1,129 @@
1
+ import { GeneratorOptionTarget, GeneratorOptionType, addValidProp, propWhile, tryToAddWrongProp, } from "../../../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { equationKeys } from "../../../../../exercises/utils/keys/equationKeys.js";
4
+ import { Rational } from "../../../../../math/numbers/rationals/rational.js";
5
+ import { Affine } from "../../../../../math/polynomials/affine.js";
6
+ import { randint } from "../../../../../math/utils/random/randint.js";
7
+ import { EqualNode } from "../../../../../tree/nodes/equations/equalNode.js";
8
+ import { VariableNode } from "../../../../../tree/nodes/variables/variableNode.js";
9
+ import { shuffle } from "../../../../../utils/alea/shuffle.js";
10
+ import { NumberNode } from "../../../../../tree/nodes/numbers/numberNode.js";
11
+ import { alignTex } from "../../../../../utils/latex/alignTex.js";
12
+ import { MultiplyNode } from "../../../../../tree/nodes/operators/multiplyNode.js";
13
+ import { frac } from "../../../../../tree/nodes/operators/fractionNode.js";
14
+ import { equationVEA } from "../../../../../exercises/vea/equationVEA.js";
15
+ const getStatementNode = (identifiers) => {
16
+ const { a, b, c } = identifiers;
17
+ const affine = new Affine(a, b).toTree();
18
+ const statementTree = new EqualNode(affine, new NumberNode(c));
19
+ return statementTree;
20
+ };
21
+ const getInstruction = (identifiers) => {
22
+ return `Résoudre :
23
+
24
+ $$
25
+ ${getStatementNode(identifiers).toTex()}
26
+ $$`;
27
+ };
28
+ const getHint = () => {
29
+ return "Isole le terme $x$ dans le membre gauche de l'équation.";
30
+ };
31
+ const getCorrection = (identifiers) => {
32
+ const { a, b, c } = identifiers;
33
+ const statementTex = getStatementNode(identifiers).toTex();
34
+ const answer = getAnswer(identifiers);
35
+ return `On commence par soustraire $${b}$ des deux côtés de l'équation pour l'éliminer du côté gauche. Ensuite, on divise les deux côtés de l'équation par $${a}$ pour isoler $x$.
36
+
37
+ ${alignTex([
38
+ [
39
+ statementTex,
40
+ "\\iff",
41
+ new EqualNode(new MultiplyNode(a.toTree(), new VariableNode("x")), (c - b).toTree()).toTex(),
42
+ ],
43
+ ["", "\\iff", answer],
44
+ ])}`;
45
+ };
46
+ const getStartStatement = (identifiers) => {
47
+ return getStatementNode(identifiers).toTex();
48
+ };
49
+ const getAnswer = (identifiers) => {
50
+ const { a, b, c } = identifiers;
51
+ const solution = new Rational(c - b, a).simplify();
52
+ const answerTree = new EqualNode(new VariableNode("x"), solution.toTree());
53
+ const answer = answerTree.toTex();
54
+ return answer;
55
+ };
56
+ const getEquationType3ExerciseQuestion = (opts) => {
57
+ const b = randint(-10, 11, [0]);
58
+ const a = randint(-10, 11, [0, 1]);
59
+ const c = randint(-10, 11);
60
+ const identifiers = { a, b, c };
61
+ return getQuestionFromIdentifiers(identifiers, opts);
62
+ };
63
+ const getKeys = (_identifiers, opts) => {
64
+ if (opts?.solutionFormat === "Ensemble") {
65
+ return ["S", "equal", "lbrace", "semicolon", "rbrace", "varnothing"];
66
+ }
67
+ if (opts?.solutionFormat === "$x=\\ldots$") {
68
+ return ["x", "equal"];
69
+ }
70
+ return equationKeys;
71
+ };
72
+ const getQuestionFromIdentifiers = (identifiers, opts) => {
73
+ const question = {
74
+ instruction: getInstruction(identifiers),
75
+ hint: getHint(identifiers),
76
+ correction: getCorrection(identifiers),
77
+ startStatement: getStartStatement(identifiers),
78
+ answer: getAnswer(identifiers),
79
+ keys: getKeys(identifiers, opts),
80
+ answerFormat: "tex",
81
+ identifiers,
82
+ };
83
+ return question;
84
+ };
85
+ const getPropositions = (n, { answer, a, b, c }) => {
86
+ const propositions = [];
87
+ addValidProp(propositions, answer);
88
+ propWhile(propositions, n, () => {
89
+ const wrongAnswer = new Rational(c - b + randint(-7, 8, [0, -c + b]), a + randint(-7, 8, [-a, 0])).simplify();
90
+ tryToAddWrongProp(propositions, new EqualNode(new VariableNode("x"), wrongAnswer.toTree()).toTex());
91
+ });
92
+ return shuffle(propositions);
93
+ };
94
+ const isAnswerValid = (ans, { a, b, c }) => {
95
+ const solution = frac(c - b, a)
96
+ .simplify()
97
+ .toTex();
98
+ return equationVEA(ans, solution);
99
+ };
100
+ const options = [
101
+ {
102
+ id: "solutionFormat",
103
+ label: "Donner la solution sous la forme :",
104
+ target: GeneratorOptionTarget.generation,
105
+ type: GeneratorOptionType.select,
106
+ values: ["Ensemble", "$x=\\ldots$", "Permettre les deux"],
107
+ defaultValue: "Permettre les deux",
108
+ },
109
+ ];
110
+ export const equationType3Exercise = {
111
+ id: "equa3",
112
+ connector: "\\iff",
113
+ label: "Résoudre une équation du type $ax+b=c$",
114
+ isSingleStep: false,
115
+ generator: (nb, opts) => getDistinctQuestions(() => getEquationType3ExerciseQuestion(opts), nb),
116
+ qcmTimer: 60,
117
+ freeTimer: 60,
118
+ getPropositions,
119
+ isAnswerValid,
120
+ subject: "Mathématiques",
121
+ hasHintAndCorrection: true,
122
+ getAnswer,
123
+ getInstruction,
124
+ getCorrection,
125
+ getHint,
126
+ getStartStatement,
127
+ getQuestionFromIdentifiers,
128
+ options,
129
+ };
@@ -0,0 +1,16 @@
1
+ import { Exercise } from "../../../../../exercises/exercise.js";
2
+ /**
3
+ * type ax+b=cx+d
4
+ */
5
+ type Identifiers = {
6
+ a: number;
7
+ b: number;
8
+ c: number;
9
+ d: number;
10
+ };
11
+ type Options = {
12
+ solutionFormat: string;
13
+ };
14
+ export declare const equationType4Exercise: Exercise<Identifiers, Options>;
15
+ export {};
16
+ //# sourceMappingURL=equa4.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"equa4.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/calculLitteral/equation/firstDegree/equa4.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAmBT,MAAM,6BAA6B,CAAC;AAerC;;GAEG;AAEH,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAgHF,KAAK,OAAO,GAAG;IACb,cAAc,EAAE,MAAM,CAAC;CACxB,CAAC;AAaF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAmBhE,CAAC"}