math-exercises 3.0.126 → 3.0.128

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 (221) hide show
  1. package/lib/exercises/math/calcul/arithmetics/isMultipleOrDivisor.d.ts.map +1 -1
  2. package/lib/exercises/math/calcul/arithmetics/isMultipleOrDivisor.js +0 -10
  3. package/lib/exercises/math/calcul/mentalCaluls/mentalProgramSolve.d.ts +1 -1
  4. package/lib/exercises/math/calcul/mentalCaluls/mentalProgramSolve.d.ts.map +1 -1
  5. package/lib/exercises/math/calcul/mentalCaluls/mentalProgramSolve.js +66 -42
  6. package/lib/exercises/math/calcul/operations/expressionNature.d.ts.map +1 -1
  7. package/lib/exercises/math/calcul/operations/expressionNature.js +0 -4
  8. package/lib/exercises/math/calcul/ordering/compareA10N.d.ts.map +1 -1
  9. package/lib/exercises/math/calcul/ordering/compareA10N.js +0 -1
  10. package/lib/exercises/math/calcul/ordering/compareABUsingQuotient.d.ts.map +1 -1
  11. package/lib/exercises/math/calcul/ordering/compareABUsingQuotient.js +6 -105
  12. package/lib/exercises/math/calcul/ordering/compareFracABWithFracAPlusCBPlusC.d.ts.map +1 -1
  13. package/lib/exercises/math/calcul/ordering/compareFracABWithFracAPlusCBPlusC.js +22 -9
  14. package/lib/exercises/math/calcul/ordering/compareFracAndDec.d.ts.map +1 -1
  15. package/lib/exercises/math/calcul/ordering/compareFracAndDec.js +7 -7
  16. package/lib/exercises/math/calcul/ordering/compareWithSquareRoots.d.ts.map +1 -1
  17. package/lib/exercises/math/calcul/ordering/compareWithSquareRoots.js +23 -14
  18. package/lib/exercises/math/calcul/ordering/decimalOrdering.d.ts.map +1 -1
  19. package/lib/exercises/math/calcul/ordering/decimalOrdering.js +0 -4
  20. package/lib/exercises/math/calcul/ordering/decimalOrderingNoRelatives.d.ts.map +1 -1
  21. package/lib/exercises/math/calcul/ordering/decimalOrderingNoRelatives.js +0 -4
  22. package/lib/exercises/math/calcul/ordering/integerOrdering.d.ts.map +1 -1
  23. package/lib/exercises/math/calcul/ordering/integerOrdering.js +0 -4
  24. package/lib/exercises/math/calcul/proportionality/findCoeffInProportionalTableNonIntegers.d.ts.map +1 -1
  25. package/lib/exercises/math/calcul/proportionality/findCoeffInProportionalTableNonIntegers.js +0 -1
  26. package/lib/exercises/math/calcul/proportionality/isTableProportional.d.ts.map +1 -1
  27. package/lib/exercises/math/calcul/proportionality/isTableProportional.js +0 -4
  28. package/lib/exercises/math/calcul/proportionality/isTableProportionalNonInteger.d.ts.map +1 -1
  29. package/lib/exercises/math/calcul/proportionality/isTableProportionalNonInteger.js +0 -4
  30. package/lib/exercises/math/calcul/rounding/estimateAroundPow10NTimesAroundPow10N.d.ts.map +1 -1
  31. package/lib/exercises/math/calcul/rounding/estimateAroundPow10NTimesAroundPow10N.js +0 -1
  32. package/lib/exercises/math/calcul/rounding/estimatePow10NPlusPow10MinusN.d.ts.map +1 -1
  33. package/lib/exercises/math/calcul/rounding/estimatePow10NPlusPow10MinusN.js +0 -1
  34. package/lib/exercises/math/calcul/rounding/getPhysicalOrderOfMagnitude.d.ts.map +1 -1
  35. package/lib/exercises/math/calcul/rounding/getPhysicalOrderOfMagnitude.js +28 -14
  36. package/lib/exercises/math/calcul/sign/signFromAx.d.ts.map +1 -1
  37. package/lib/exercises/math/calcul/sign/signFromAx.js +0 -10
  38. package/lib/exercises/math/calculLitteral/equation/equationFromProblem.d.ts.map +1 -1
  39. package/lib/exercises/math/calculLitteral/equation/equationFromProblem.js +63 -24
  40. package/lib/exercises/math/calculLitteral/inequations/isInequalityTrue.d.ts.map +1 -1
  41. package/lib/exercises/math/calculLitteral/inequations/isInequalityTrue.js +0 -10
  42. package/lib/exercises/math/calculLitteral/isolate/isolateUInInvXPlusInvYEqualsInvU.d.ts.map +1 -1
  43. package/lib/exercises/math/calculLitteral/isolate/isolateUInInvXPlusInvYEqualsInvU.js +6 -27
  44. package/lib/exercises/math/calculLitteral/ordering/compareAMinusB.d.ts.map +1 -1
  45. package/lib/exercises/math/calculLitteral/ordering/compareAMinusB.js +41 -39
  46. package/lib/exercises/math/calculLitteral/ordering/compareFromPiMinusFrac.d.ts.map +1 -1
  47. package/lib/exercises/math/calculLitteral/ordering/compareFromPiMinusFrac.js +1 -2
  48. package/lib/exercises/math/calculLitteral/simplifying/valuateExpression.d.ts.map +1 -1
  49. package/lib/exercises/math/calculLitteral/simplifying/valuateExpression.js +0 -10
  50. package/lib/exercises/math/calculLitteral/writing/writeLitExpFromFrenchExp.d.ts.map +1 -1
  51. package/lib/exercises/math/calculLitteral/writing/writeLitExpFromFrenchExp.js +68 -23
  52. package/lib/exercises/math/conversion/kmPerMinToKmPerHourConversion.d.ts +4 -1
  53. package/lib/exercises/math/conversion/kmPerMinToKmPerHourConversion.d.ts.map +1 -1
  54. package/lib/exercises/math/conversion/kmPerMinToKmPerHourConversion.js +52 -35
  55. package/lib/exercises/math/conversion/minutesToHours.d.ts.map +1 -1
  56. package/lib/exercises/math/conversion/minutesToHours.js +0 -1
  57. package/lib/exercises/math/conversion/prefixToNumber.d.ts.map +1 -1
  58. package/lib/exercises/math/conversion/prefixToNumber.js +14 -4
  59. package/lib/exercises/math/conversion/secondsToHours.d.ts.map +1 -1
  60. package/lib/exercises/math/conversion/secondsToHours.js +1 -2
  61. package/lib/exercises/math/dataRepresentations/barChartInterpreting.d.ts +5 -2
  62. package/lib/exercises/math/dataRepresentations/barChartInterpreting.d.ts.map +1 -1
  63. package/lib/exercises/math/dataRepresentations/barChartInterpreting.js +47 -31
  64. package/lib/exercises/math/dataRepresentations/cartesianGraphExtremaReading.d.ts.map +1 -1
  65. package/lib/exercises/math/dataRepresentations/cartesianGraphExtremaReading.js +5 -4
  66. package/lib/exercises/math/dataRepresentations/compareBoxPlot.d.ts.map +1 -1
  67. package/lib/exercises/math/dataRepresentations/compareBoxPlot.js +0 -1
  68. package/lib/exercises/math/dataRepresentations/dataToGraphGraphToData.js +4 -4
  69. package/lib/exercises/math/dataRepresentations/graphReading.js +13 -13
  70. package/lib/exercises/math/dataRepresentations/histogramReading.d.ts.map +1 -1
  71. package/lib/exercises/math/dataRepresentations/histogramReading.js +32 -32
  72. package/lib/exercises/math/dataRepresentations/plausibleGraph.d.ts.map +1 -1
  73. package/lib/exercises/math/dataRepresentations/plausibleGraph.js +53 -4
  74. package/lib/exercises/math/derivation/convexity/convexityQuadrinomials.d.ts.map +1 -1
  75. package/lib/exercises/math/derivation/convexity/convexityQuadrinomials.js +0 -1
  76. package/lib/exercises/math/equaDiff/equaDiffCheckSolutionFirstOrder.d.ts.map +1 -1
  77. package/lib/exercises/math/equaDiff/equaDiffCheckSolutionFirstOrder.js +0 -4
  78. package/lib/exercises/math/functions/affines/affineAdjustmentComplete.d.ts.map +1 -1
  79. package/lib/exercises/math/functions/affines/affineAdjustmentComplete.js +0 -1
  80. package/lib/exercises/math/functions/affines/coordsOfPointOnAffineFindX.d.ts.map +1 -1
  81. package/lib/exercises/math/functions/affines/coordsOfPointOnAffineFindX.js +17 -4
  82. package/lib/exercises/math/functions/affines/coordsOfPointOnAffineFindY.d.ts.map +1 -1
  83. package/lib/exercises/math/functions/affines/coordsOfPointOnAffineFindY.js +27 -10
  84. package/lib/exercises/math/functions/affines/drawAffineFromProgCalc.d.ts.map +1 -1
  85. package/lib/exercises/math/functions/affines/drawAffineFromProgCalc.js +33 -16
  86. package/lib/exercises/math/functions/affines/recognizeAffineGraph.d.ts.map +1 -1
  87. package/lib/exercises/math/functions/affines/recognizeAffineGraph.js +0 -4
  88. package/lib/exercises/math/functions/affines/representationOfAffine.d.ts +3 -0
  89. package/lib/exercises/math/functions/affines/representationOfAffine.d.ts.map +1 -1
  90. package/lib/exercises/math/functions/affines/representationOfAffine.js +121 -30
  91. package/lib/exercises/math/functions/basics/coordsOfPointOnCurveFindY.d.ts.map +1 -1
  92. package/lib/exercises/math/functions/basics/coordsOfPointOnCurveFindY.js +29 -11
  93. package/lib/exercises/math/functions/basics/isPointOnFunction.d.ts.map +1 -1
  94. package/lib/exercises/math/functions/basics/isPointOnFunction.js +0 -10
  95. package/lib/exercises/math/functions/basics/signOfFunction.d.ts.map +1 -1
  96. package/lib/exercises/math/functions/basics/signOfFunction.js +0 -10
  97. package/lib/exercises/math/functions/composition/functionComposition.d.ts.map +1 -1
  98. package/lib/exercises/math/functions/composition/functionComposition.js +2 -2
  99. package/lib/exercises/math/functions/cube/isPointOnCubicFunction.d.ts.map +1 -1
  100. package/lib/exercises/math/functions/cube/isPointOnCubicFunction.js +0 -10
  101. package/lib/exercises/math/functions/exponentials/exponentialsVariations.d.ts.map +1 -1
  102. package/lib/exercises/math/functions/exponentials/exponentialsVariations.js +0 -4
  103. package/lib/exercises/math/functions/inverse/compareInverseValues.d.ts.map +1 -1
  104. package/lib/exercises/math/functions/inverse/compareInverseValues.js +0 -1
  105. package/lib/exercises/math/functions/inverse/isPointOnReciprocalFunction.d.ts.map +1 -1
  106. package/lib/exercises/math/functions/inverse/isPointOnReciprocalFunction.js +0 -10
  107. package/lib/exercises/math/functions/parity/parityFromAlgebra.d.ts.map +1 -1
  108. package/lib/exercises/math/functions/parity/parityFromAlgebra.js +0 -4
  109. package/lib/exercises/math/functions/square/compareSquaredValues.d.ts.map +1 -1
  110. package/lib/exercises/math/functions/square/compareSquaredValues.js +0 -10
  111. package/lib/exercises/math/geometry/convexity/convexityTrinomialsGeo.d.ts.map +1 -1
  112. package/lib/exercises/math/geometry/convexity/convexityTrinomialsGeo.js +0 -4
  113. package/lib/exercises/math/geometry/euclidian/pythagoreOrThales.d.ts.map +1 -1
  114. package/lib/exercises/math/geometry/euclidian/pythagoreOrThales.js +0 -4
  115. package/lib/exercises/math/geometry/lines/isPointOnCartesianLine.d.ts.map +1 -1
  116. package/lib/exercises/math/geometry/lines/isPointOnCartesianLine.js +0 -4
  117. package/lib/exercises/math/geometry/lines/isPointOnLine.d.ts.map +1 -1
  118. package/lib/exercises/math/geometry/lines/isPointOnLine.js +0 -4
  119. package/lib/exercises/math/geometry/lines/linesRelativePositions.d.ts.map +1 -1
  120. package/lib/exercises/math/geometry/lines/linesRelativePositions.js +0 -4
  121. package/lib/exercises/math/geometry/parametric/pointFromParametricLine.d.ts.map +1 -1
  122. package/lib/exercises/math/geometry/parametric/pointFromParametricLine.js +0 -4
  123. package/lib/exercises/math/geometry/pythagore/isTriangleRight.d.ts.map +1 -1
  124. package/lib/exercises/math/geometry/pythagore/isTriangleRight.js +0 -4
  125. package/lib/exercises/math/geometry/quadrilaterals/parallelogramRectangle.d.ts.map +1 -1
  126. package/lib/exercises/math/geometry/quadrilaterals/parallelogramRectangle.js +0 -4
  127. package/lib/exercises/math/geometry/quadrilaterals/parallelogramRhombus.d.ts.map +1 -1
  128. package/lib/exercises/math/geometry/quadrilaterals/parallelogramRhombus.js +0 -4
  129. package/lib/exercises/math/geometry/quadrilaterals/quadrilateralRecognition.d.ts.map +1 -1
  130. package/lib/exercises/math/geometry/quadrilaterals/quadrilateralRecognition.js +0 -4
  131. package/lib/exercises/math/geometry/shapes/basicShapesRecognition.d.ts.map +1 -1
  132. package/lib/exercises/math/geometry/shapes/basicShapesRecognition.js +6 -7
  133. package/lib/exercises/math/geometry/vectors/colinearity/colinearityFromBasis.d.ts.map +1 -1
  134. package/lib/exercises/math/geometry/vectors/colinearity/colinearityFromBasis.js +0 -10
  135. package/lib/exercises/math/geometry/vectors/colinearity/colinearityFromPicture.d.ts.map +1 -1
  136. package/lib/exercises/math/geometry/vectors/colinearity/colinearityFromPicture.js +0 -10
  137. package/lib/exercises/math/geometry/vectors/equalCaracteristicFromGraph.d.ts.map +1 -1
  138. package/lib/exercises/math/geometry/vectors/equalCaracteristicFromGraph.js +0 -4
  139. package/lib/exercises/math/percent/evolutions/findRightCalculForPriceEvolution.d.ts.map +1 -1
  140. package/lib/exercises/math/percent/evolutions/findRightCalculForPriceEvolution.js +0 -4
  141. package/lib/exercises/math/probaStat/basicProbas/mostLeastProbable.d.ts.map +1 -1
  142. package/lib/exercises/math/probaStat/basicProbas/mostLeastProbable.js +0 -10
  143. package/lib/exercises/math/probaStat/basicProbas/possibleValuesForProba.d.ts.map +1 -1
  144. package/lib/exercises/math/probaStat/basicProbas/possibleValuesForProba.js +24 -9
  145. package/lib/exercises/math/probaStat/checkEquiprobability.d.ts.map +1 -1
  146. package/lib/exercises/math/probaStat/checkEquiprobability.js +0 -10
  147. package/lib/exercises/math/probaStat/conditionalProbaWriteFromFrench.d.ts.map +1 -1
  148. package/lib/exercises/math/probaStat/conditionalProbaWriteFromFrench.js +9 -6
  149. package/lib/exercises/math/probaStat/events/describeEvent.d.ts.map +1 -1
  150. package/lib/exercises/math/probaStat/events/describeEvent.js +0 -10
  151. package/lib/exercises/math/probaStat/events/eventNotation.d.ts.map +1 -1
  152. package/lib/exercises/math/probaStat/events/eventNotation.js +0 -10
  153. package/lib/exercises/math/probaStat/probaAsSumOfProbas.d.ts +0 -1
  154. package/lib/exercises/math/probaStat/probaAsSumOfProbas.d.ts.map +1 -1
  155. package/lib/exercises/math/probaStat/probaAsSumOfProbas.js +13 -14
  156. package/lib/exercises/math/probaStat/stats1var/compareSeriesDispersion.d.ts.map +1 -1
  157. package/lib/exercises/math/probaStat/stats1var/compareSeriesDispersion.js +0 -4
  158. package/lib/exercises/math/probaStat/stats1var/getQuartileProportionQuestion.d.ts.map +1 -1
  159. package/lib/exercises/math/probaStat/stats1var/getQuartileProportionQuestion.js +0 -10
  160. package/lib/exercises/math/probaStat/stats1var/interpretIndicatorsForLists.d.ts.map +1 -1
  161. package/lib/exercises/math/probaStat/stats1var/interpretIndicatorsForLists.js +2 -3
  162. package/lib/exercises/math/probaStat/stats1var/plausibilityOfAverage.d.ts.map +1 -1
  163. package/lib/exercises/math/probaStat/stats1var/plausibilityOfAverage.js +26 -25
  164. package/lib/exercises/math/probaStat/stats2var/fineAdjustementExercise.d.ts.map +1 -1
  165. package/lib/exercises/math/probaStat/stats2var/fineAdjustementExercise.js +0 -4
  166. package/lib/exercises/math/python/pythonForLoopInstructionCompletion.d.ts.map +1 -1
  167. package/lib/exercises/math/python/pythonForLoopInstructionCompletion.js +0 -10
  168. package/lib/exercises/math/python/pythonIfStatementCompletion.d.ts.map +1 -1
  169. package/lib/exercises/math/python/pythonIfStatementCompletion.js +7 -8
  170. package/lib/exercises/math/python/pythonSimpleFunctionInstructionCompletion.d.ts.map +1 -1
  171. package/lib/exercises/math/python/pythonSimpleFunctionInstructionCompletion.js +0 -10
  172. package/lib/exercises/math/python/pythonWhileStatementCompletion.d.ts.map +1 -1
  173. package/lib/exercises/math/python/pythonWhileStatementCompletion.js +5 -6
  174. package/lib/exercises/math/python/pythonWhileStatementOperationCompletion.d.ts.map +1 -1
  175. package/lib/exercises/math/python/pythonWhileStatementOperationCompletion.js +5 -6
  176. package/lib/exercises/math/python/variableType.d.ts.map +1 -1
  177. package/lib/exercises/math/python/variableType.js +0 -10
  178. package/lib/exercises/math/sampling/isSamplingRepresentative.d.ts.map +1 -1
  179. package/lib/exercises/math/sampling/isSamplingRepresentative.js +0 -4
  180. package/lib/exercises/math/sequences/arithmetic/recognizeArithmeticFromFirstTerms.d.ts.map +1 -1
  181. package/lib/exercises/math/sequences/arithmetic/recognizeArithmeticFromFirstTerms.js +0 -4
  182. package/lib/exercises/math/sequences/arithmetic/recognizeArithmeticFromGraph.d.ts.map +1 -1
  183. package/lib/exercises/math/sequences/arithmetic/recognizeArithmeticFromGraph.js +0 -4
  184. package/lib/exercises/math/sequences/geometric/geometricVariations.d.ts.map +1 -1
  185. package/lib/exercises/math/sequences/geometric/geometricVariations.js +0 -4
  186. package/lib/exercises/math/sets/intervals/isNumberInInterval.d.ts.map +1 -1
  187. package/lib/exercises/math/sets/intervals/isNumberInInterval.js +0 -10
  188. package/lib/exercises/math/sets/isNumberDecimal.d.ts.map +1 -1
  189. package/lib/exercises/math/sets/isNumberDecimal.js +0 -10
  190. package/lib/exercises/math/sets/nameOfNumberSets.d.ts.map +1 -1
  191. package/lib/exercises/math/sets/nameOfNumberSets.js +0 -10
  192. package/lib/exercises/pc/chemicalElements/atomicStructureOfNucleus.d.ts.map +1 -1
  193. package/lib/exercises/pc/chemicalElements/atomicStructureOfNucleus.js +0 -1
  194. package/lib/exercises/pc/chemicalElements/identifyRightElectronicConfiguration.d.ts.map +1 -1
  195. package/lib/exercises/pc/chemicalElements/identifyRightElectronicConfiguration.js +0 -4
  196. package/lib/exercises/pc/chemicalReactions/identifyLimitingReagent.d.ts.map +1 -1
  197. package/lib/exercises/pc/chemicalReactions/identifyLimitingReagent.js +0 -4
  198. package/lib/exercises/pc/chemicalReactions/identifyStoichiometricMixture.d.ts.map +1 -1
  199. package/lib/exercises/pc/chemicalReactions/identifyStoichiometricMixture.js +0 -4
  200. package/lib/exercises/pc/chemicalReactions/stoichiometricReaction.d.ts.map +1 -1
  201. package/lib/exercises/pc/chemicalReactions/stoichiometricReaction.js +0 -4
  202. package/lib/exercises/pc/electricity/ohmicConductorOrGenerator.d.ts.map +1 -1
  203. package/lib/exercises/pc/electricity/ohmicConductorOrGenerator.js +0 -4
  204. package/lib/exercises/pc/moleculeNomenclature.d.ts.map +1 -1
  205. package/lib/exercises/pc/moleculeNomenclature.js +0 -4
  206. package/lib/exercises/pc/motion/motionReference.d.ts.map +1 -1
  207. package/lib/exercises/pc/motion/motionReference.js +0 -4
  208. package/lib/exercises/pc/motion/typeOfAcceleration.d.ts.map +1 -1
  209. package/lib/exercises/pc/motion/typeOfAcceleration.js +0 -4
  210. package/lib/exercises/pc/sound/frequencyComparison.d.ts.map +1 -1
  211. package/lib/exercises/pc/sound/frequencyComparison.js +0 -4
  212. package/lib/index.d.ts +10 -5
  213. package/lib/index.d.ts.map +1 -1
  214. package/lib/math/progCalc/progCalc.d.ts +3 -3
  215. package/lib/math/progCalc/progCalc.d.ts.map +1 -1
  216. package/lib/math/progCalc/progCalc.js +13 -3
  217. package/lib/tests/exoTest.d.ts.map +1 -1
  218. package/lib/tests/exoTest.js +7 -0
  219. package/lib/tests/questionTest.d.ts.map +1 -1
  220. package/lib/tests/questionTest.js +3 -2
  221. package/package.json +1 -1
@@ -1,6 +1,7 @@
1
1
  import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
2
2
  import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
3
  import { randomMany } from "../../../../utils/alea/random.js";
4
+ import { alignTex } from "../../../../utils/latex/alignTex.js";
4
5
  const getInstruction = (identifiers) => {
5
6
  const { varNames } = identifiers;
6
7
  const [x, y, u] = varNames;
@@ -20,33 +21,11 @@ const getHint = (identifiers) => {
20
21
  const getCorrection = (identifiers) => {
21
22
  const { varNames } = identifiers;
22
23
  const [x, y, u] = varNames;
23
- return `L'inverse de $\\frac{1}{${u}}$ est $${u}$.
24
-
25
- L'inverse de $\\frac{1}{${x}}+\\frac{1}{${y}}$ est $\\frac{1}{\\frac{1}{${x}}+\\frac{1}{${y}}}$.
26
-
27
- Il faut donc mettre ces deux fractions au même dénominateur.
28
-
29
- On obtient :
30
-
31
- $$
32
- \\frac{1}{\\frac{1}{${x}}+\\frac{1}{${y}}}
33
- $$
34
-
35
- $$
36
- = \\frac{1}{\\frac{${x}+${y}}{${x}${y}}}
37
- $$
38
-
39
- $$
40
- = \\frac{${x}${y}}{${x}+${y}}
41
- $$
42
-
43
- Conclusion :
44
-
45
- $$
46
- \\frac{1}{${u}} = \\frac{${x}${y}}{${x}+${y}}
47
- $$
48
-
49
- `;
24
+ return alignTex([
25
+ [`${u}`, "=", `\\frac{1}{\\frac{1}{${x}}+\\frac{1}{${y}}}`],
26
+ [``, "=", `\\frac{1}{\\frac{${x}+${y}}{${x}${y}}}`],
27
+ [``, "=", `\\frac{${x}${y}}{${x}+${y}}`],
28
+ ]);
50
29
  };
51
30
  const getPropositions = (nbProps, { answer, ...identifiers }) => {
52
31
  const { varNames } = identifiers;
@@ -1 +1 @@
1
- {"version":3,"file":"compareAMinusB.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/ordering/compareAMinusB.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAMrC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AAkMF,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,WAAW,CAgBhD,CAAC"}
1
+ {"version":3,"file":"compareAMinusB.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/ordering/compareAMinusB.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAOrC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AAyMF,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,WAAW,CAchD,CAAC"}
@@ -2,6 +2,7 @@ import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../exer
2
2
  import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
3
  import { coinFlip } from "../../../../utils/alea/coinFlip.js";
4
4
  import { random, randomMany } from "../../../../utils/alea/random.js";
5
+ import { shuffle } from "../../../../utils/alea/shuffle.js";
5
6
  const getInstruction = (identifiers) => {
6
7
  const { names, texInstruction } = identifiers;
7
8
  return `Si $${names[0]}$ et $${names[1]}$ sont deux nombres tels que
@@ -12,9 +13,8 @@ $$
12
13
 
13
14
  alors on peut dire que :`;
14
15
  };
15
- const getHint = (identifiers) => {
16
- const { names } = identifiers;
17
- return `Il s'agit de comparer $${names[0]}$ et $${names[1]}$.`;
16
+ const getHint = () => {
17
+ return `Essaye d’isoler chaque variable de chaque côté de l’inégalité.`;
18
18
  };
19
19
  const getCorrection = (identifiers) => {
20
20
  const { names, texInstruction, texsCorrection } = identifiers;
@@ -44,30 +44,34 @@ $$
44
44
  };
45
45
  const getPropositions = (n, { names, texsAnswer }) => {
46
46
  const propositions = [];
47
- texsAnswer.forEach((tex) => {
48
- addValidProp(propositions, tex);
49
- });
50
- const invalidProps = [
51
- `${names[0]} < ${names[1]}`,
52
- `${names[0]} > ${names[1]}`,
53
- `${names[0]} \\leq ${names[1]}`,
54
- `${names[0]} \\geq ${names[1]}`,
55
- `${names[1]} < ${names[0]}`,
56
- `${names[1]} > ${names[0]}`,
57
- `${names[1]} \\leq ${names[0]}`,
58
- `${names[1]} \\geq ${names[0]}`,
59
- ].filter((tex) => !texsAnswer.includes(tex));
47
+ const validSample = shuffle(texsAnswer)[0];
48
+ addValidProp(propositions, validSample);
49
+ const allPossibleProps = [
50
+ `${names[0]}<${names[1]}`,
51
+ `${names[0]}>${names[1]}`,
52
+ `${names[0]}\\le ${names[1]}`,
53
+ `${names[0]}\\ge ${names[1]}`,
54
+ `${names[1]}<${names[0]}`,
55
+ `${names[1]}>${names[0]}`,
56
+ `${names[1]}\\le ${names[0]}`,
57
+ `${names[1]}\\ge ${names[0]}`,
58
+ ];
59
+ const invalidProps = allPossibleProps.filter((tex) => !texsAnswer.includes(tex));
60
60
  invalidProps.forEach((tex) => {
61
61
  tryToAddWrongProp(propositions, tex);
62
62
  });
63
63
  return shuffleProps(propositions, n);
64
64
  };
65
+ const getAnswer = (identifiers) => {
66
+ const { texsAnswer } = identifiers;
67
+ return texsAnswer[0];
68
+ };
65
69
  const isAnswerValid = (ans, { texsAnswer }) => {
66
70
  return texsAnswer.includes(ans);
67
71
  };
68
72
  const getCompareAMinusBQuestion = () => {
69
73
  const namesPool = ["a", "b", "c", "d", "r", "s", "t", "u", "v"];
70
- let names = randomMany(namesPool, 2);
74
+ const names = randomMany(namesPool, 2);
71
75
  const compareSymbol = random(["inf", "sup", "leq", "geq"]);
72
76
  let texsObjectArray = [];
73
77
  switch (compareSymbol) {
@@ -76,13 +80,13 @@ const getCompareAMinusBQuestion = () => {
76
80
  texsObjectArray = [
77
81
  {
78
82
  texInstruction: `x - y < 0`,
79
- texsCorrection: [`x < y`, `x \\leq y`],
80
- texsAnswer: [`x < y`, `x \\leq y`, `y > x`, `y \\geq x`],
83
+ texsCorrection: [`x<y`, `x\\le y`],
84
+ texsAnswer: [`x<y`, `x\\le y`, `y>x`, `y\\ge x`],
81
85
  },
82
86
  {
83
87
  texInstruction: `0 > x - y`,
84
- texsCorrection: [`y > x`, `y \\geq x`],
85
- texsAnswer: [`x < y`, `x \\leq y`, `y > x`, `y \\geq x`],
88
+ texsCorrection: [`y>x`, `y\\ge x`],
89
+ texsAnswer: [`x<y`, `x\\le y`, `y>x`, `y\\ge x`],
86
90
  },
87
91
  ];
88
92
  }
@@ -92,13 +96,13 @@ const getCompareAMinusBQuestion = () => {
92
96
  texsObjectArray = [
93
97
  {
94
98
  texInstruction: `x - y > 0`,
95
- texsCorrection: [`x > y`, `x \\geq y`],
96
- texsAnswer: [`x > y`, `x \\geq y`, `y < x`, `y \\leq x`],
99
+ texsCorrection: [`x>y`, `x\\ge y`],
100
+ texsAnswer: [`x>y`, `x\\ge y`, `y<x`, `y\\le x`],
97
101
  },
98
102
  {
99
103
  texInstruction: `0 < x - y`,
100
- texsCorrection: [`y < x`, `y \\leq x`],
101
- texsAnswer: [`x > y`, `x \\geq y`, `y < x`, `y \\leq x`],
104
+ texsCorrection: [`y<x`, `y\\le x`],
105
+ texsAnswer: [`x>y`, `x\\ge y`, `y<x`, `y\\le x`],
102
106
  },
103
107
  ];
104
108
  }
@@ -107,14 +111,14 @@ const getCompareAMinusBQuestion = () => {
107
111
  {
108
112
  texsObjectArray = [
109
113
  {
110
- texInstruction: `x - y \\leq 0`,
111
- texsCorrection: [`x \\leq y`],
112
- texsAnswer: [`x \\leq y`, `y \\geq x`],
114
+ texInstruction: `x - y \\le 0`,
115
+ texsCorrection: [`x\\le y`],
116
+ texsAnswer: [`x\\le y`, `y\\ge x`],
113
117
  },
114
118
  {
115
- texInstruction: `0 \\geq x - y`,
116
- texsCorrection: [`y \\geq x`],
117
- texsAnswer: [`x \\leq y`, `y \\geq x`],
119
+ texInstruction: `0 \\ge x - y`,
120
+ texsCorrection: [`y\\ge x`],
121
+ texsAnswer: [`x\\le y`, `y\\ge x`],
118
122
  },
119
123
  ];
120
124
  }
@@ -123,14 +127,14 @@ const getCompareAMinusBQuestion = () => {
123
127
  {
124
128
  texsObjectArray = [
125
129
  {
126
- texInstruction: `x - y \\geq 0`,
127
- texsCorrection: [`x \\geq y`],
128
- texsAnswer: [`x \\geq y`, `y \\leq x`],
130
+ texInstruction: `x - y \\ge 0`,
131
+ texsCorrection: [`x\\ge y`],
132
+ texsAnswer: [`x\\ge y`, `y\\le x`],
129
133
  },
130
134
  {
131
135
  texInstruction: `0 \\leq x - y`,
132
- texsCorrection: [`y \\leq x`],
133
- texsAnswer: [`x \\geq y`, `y \\leq x`],
136
+ texsCorrection: [`y\\le x`],
137
+ texsAnswer: [`x\\ge y`, `y\\le x`],
134
138
  },
135
139
  ];
136
140
  }
@@ -144,7 +148,6 @@ const getCompareAMinusBQuestion = () => {
144
148
  texInstruction = replaceVarNames(texInstruction);
145
149
  texsCorrection = texsCorrection.map((tex) => replaceVarNames(tex));
146
150
  texsAnswer = texsAnswer.map((tex) => replaceVarNames(tex));
147
- names = order.map((i) => names[i]);
148
151
  return getQuestionFromIdentifiers({
149
152
  names,
150
153
  texInstruction,
@@ -154,6 +157,7 @@ const getCompareAMinusBQuestion = () => {
154
157
  };
155
158
  const getQuestionFromIdentifiers = (identifiers, opts) => {
156
159
  const question = {
160
+ answer: getAnswer(identifiers),
157
161
  instruction: getInstruction(identifiers),
158
162
  keys: ["inf", "sup", "leq", "geq", ...identifiers.names],
159
163
  answerFormat: "tex",
@@ -177,6 +181,4 @@ export const compareAMinusB = {
177
181
  maxAllowedQuestions: 30,
178
182
  getQuestionFromIdentifiers,
179
183
  hasHintAndCorrection: true,
180
- answerType: "QCM",
181
- isQCM: true,
182
184
  };
@@ -1 +1 @@
1
- {"version":3,"file":"compareFromPiMinusFrac.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/ordering/compareFromPiMinusFrac.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AAmJF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,CAgBxD,CAAC"}
1
+ {"version":3,"file":"compareFromPiMinusFrac.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/ordering/compareFromPiMinusFrac.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AAmJF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,CAexD,CAAC"}
@@ -129,7 +129,7 @@ const getQuestionFromIdentifiers = (identifiers, opts) => {
129
129
  };
130
130
  export const compareFromPiMinusFrac = {
131
131
  id: "compareFromPiMinusFrac",
132
- label: "Comparer deux nombres (Pi et une fraction approximante) par le calcul de leur différence",
132
+ label: "Comparer deux nombres ($\\pi$ et une fraction approximante) par le calcul de leur différence",
133
133
  isSingleStep: true,
134
134
  generator: (nb, opts) => getDistinctQuestions(() => getCompareFromPiMinusFracQuestion(opts), nb, 30),
135
135
  qcmTimer: 60,
@@ -139,6 +139,5 @@ export const compareFromPiMinusFrac = {
139
139
  subject: "Mathématiques",
140
140
  maxAllowedQuestions: 30,
141
141
  getQuestionFromIdentifiers,
142
- answerType: "QCU",
143
142
  hasHintAndCorrection: true,
144
143
  };
@@ -1 +1 @@
1
- {"version":3,"file":"valuateExpression.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/simplifying/valuateExpression.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,UAAU,EAAE,OAAO,CAAC;CACrB,CAAC;AAgHF,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,WAAW,CAkBnD,CAAC"}
1
+ {"version":3,"file":"valuateExpression.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/simplifying/valuateExpression.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AASrC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,UAAU,EAAE,OAAO,CAAC;CACrB,CAAC;AAyGF,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,WAAW,CAiBnD,CAAC"}
@@ -5,7 +5,6 @@ import { add } from "../../../../tree/nodes/operators/addNode.js";
5
5
  import { power } from "../../../../tree/nodes/operators/powerNode.js";
6
6
  import { monom } from "../../../../tree/nodes/polynomials/monomNode.js";
7
7
  import { coinFlip } from "../../../../utils/alea/coinFlip.js";
8
- import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
9
8
  const getExpression = (identifiers) => {
10
9
  const { a, b, monomFirst } = identifiers;
11
10
  return add(monomFirst ? monom(a, 1) : b, monomFirst ? b : monom(a, 1));
@@ -53,14 +52,6 @@ $$`;
53
52
  const getKeys = () => {
54
53
  return [];
55
54
  };
56
- const isAnswerValid = () => {
57
- try {
58
- throw Error("VEA not implemented");
59
- }
60
- catch (err) {
61
- return handleVEAError(err);
62
- }
63
- };
64
55
  const getValuateExpressionQuestion = () => {
65
56
  const a = randint(-9, 10, [0, 1, -1]);
66
57
  const b = randint(-9, 10, [0]);
@@ -93,7 +84,6 @@ export const valuateExpression = {
93
84
  qcmTimer: 60,
94
85
  freeTimer: 60,
95
86
  getPropositions,
96
- isAnswerValid,
97
87
  subject: "Mathématiques",
98
88
  getInstruction,
99
89
  getHint,
@@ -1 +1 @@
1
- {"version":3,"file":"writeLitExpFromFrenchExp.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/writing/writeLitExpFromFrenchExp.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAmCrC,KAAK,QAAQ,GACT,UAAU,GACV,SAAS,GACT,KAAK,GACL,UAAU,GACV,UAAU,GACV,QAAQ,CAAC;AAoEb,KAAK,WAAW,GAAG;IACjB,YAAY,EAAE,QAAQ,CAAC;IACvB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACnB,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IAC/B,wBAAwB,EAAE,OAAO,CAAC;CACnC,CAAC;AAyNF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,CAkBxD,CAAC"}
1
+ {"version":3,"file":"writeLitExpFromFrenchExp.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/writing/writeLitExpFromFrenchExp.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAmCrC,KAAK,QAAQ,GACT,UAAU,GACV,SAAS,GACT,KAAK,GACL,UAAU,GACV,UAAU,GACV,QAAQ,CAAC;AAoEb,KAAK,WAAW,GAAG;IACjB,YAAY,EAAE,QAAQ,CAAC;IACvB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACnB,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IAC/B,wBAAwB,EAAE,OAAO,CAAC;CACnC,CAAC;AAuRF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,CAkBxD,CAAC"}
@@ -40,27 +40,27 @@ class ExpressionConstructor {
40
40
  case "opposite":
41
41
  return {
42
42
  node: opposite(a),
43
- str__french: `L'opposé de $ ${a} $`,
43
+ strFrench: `L'opposé de $ ${a} $`,
44
44
  };
45
45
  case "inverse":
46
46
  return {
47
47
  node: frac(1, a),
48
- str__french: `L'inverse de $ ${a} $`,
48
+ strFrench: `L'inverse de $ ${a} $`,
49
49
  };
50
50
  case "add":
51
51
  return {
52
52
  node: add(a, b),
53
- str__french: `La somme de $ ${a} $ et de $ ${b} $`,
53
+ strFrench: `La somme de $ ${a} $ et de $ ${b} $`,
54
54
  };
55
55
  case "subtract":
56
56
  return {
57
57
  node: substract(a, b),
58
- str__french: `La différence entre $ ${a} $ et $ ${b} $`,
58
+ strFrench: `La différence entre $ ${a} $ et $ ${b} $`,
59
59
  };
60
60
  case "multiply":
61
61
  return {
62
62
  node: multiply(a, b),
63
- str__french: typeof b === "string" && isUsingFrenchFactorNouns
63
+ strFrench: typeof b === "string" && isUsingFrenchFactorNouns
64
64
  ? dictTexFactorToFrenchFactor[a.frenchify()]
65
65
  ? `${dictTexFactorToFrenchFactor[a.frenchify()]} de $ ${b} $`
66
66
  : `Le produit de $ ${a} $ par $ ${b} $`
@@ -69,7 +69,7 @@ class ExpressionConstructor {
69
69
  case "divide":
70
70
  return {
71
71
  node: frac(a, b),
72
- str__french: typeof a === "string" && isUsingFrenchFactorNouns
72
+ strFrench: typeof a === "string" && isUsingFrenchFactorNouns
73
73
  ? dictTexFactorToFrenchFactor[frac(1, b).toTex()]
74
74
  ? `${dictTexFactorToFrenchFactor[frac(1, b).toTex()]} de $ ${a} $`
75
75
  : `Le quotient de $ ${a} $ par $ ${b} $`
@@ -145,7 +145,7 @@ const getAnswer = (identifiers) => {
145
145
  return node.toTex();
146
146
  };
147
147
  const getInstruction = (identifiers) => {
148
- const statementString = ExpressionConstructor.fromIdentifiers(identifiers).str__french;
148
+ const statementString = ExpressionConstructor.fromIdentifiers(identifiers).strFrench;
149
149
  return `Écrire l'expression littérale pour :
150
150
 
151
151
  ${statementString}
@@ -157,32 +157,77 @@ const getHint = (identifiers) => {
157
157
  case "opposite":
158
158
  return `La somme d'un nombre et de son opposé donne $0$.`;
159
159
  case "inverse":
160
- return `L'inverse de $8$ est $0.25$.`;
160
+ return `L'inverse de $8$ est $0,25$.`;
161
161
  case "add":
162
- return `La somme de $8457$ et de $6567$ est $${8457 + 6567}$.`;
162
+ return `La somme de $8$ et de $6$ est $14$.`;
163
163
  case "subtract":
164
- return `La différence entre $8457$ est $6567$ est $${8457 - 6567}$.`;
165
- case "multiply":
166
- return `Le produit de $8457$ par $6567$ est $${8457 * 6567}$ .`;
167
- case "divide":
168
- return `Le quotient de $200$ par $8$ est $25$.`;
164
+ return `La différence entre $8$ et $6$ est $2$.`;
165
+ case "multiply": {
166
+ const statementString = ExpressionConstructor.fromIdentifiers(identifiers).strFrench;
167
+ if (!statementString.includes("produit")) {
168
+ const bHint = randint(2, 10, typeof identifiers.b === "number" ? [identifiers.b] : []);
169
+ const exprHint1 = ExpressionConstructor.fromIdentifiers(Object.assign({}, identifiers, {
170
+ b: "" + bHint,
171
+ }));
172
+ const exprHint2 = ExpressionConstructor.fromIdentifiers(Object.assign({}, identifiers, {
173
+ b: bHint,
174
+ }));
175
+ return `${capitalize(exprHint1.strFrench)} est $${exprHint2.node
176
+ .simplify()
177
+ .toTex()}$.`;
178
+ }
179
+ else {
180
+ return `Le produit de $8$ par $6$ est $48$.`;
181
+ }
182
+ }
183
+ case "divide": {
184
+ const statementString = ExpressionConstructor.fromIdentifiers(identifiers).strFrench;
185
+ if (!statementString.includes("quotient")) {
186
+ const aHint = randint(2, 10, typeof identifiers.a === "number" ? [identifiers.a] : []);
187
+ const exprHint1 = ExpressionConstructor.fromIdentifiers(Object.assign({}, identifiers, {
188
+ a: "" + aHint,
189
+ }));
190
+ const exprHint2 = ExpressionConstructor.fromIdentifiers(Object.assign({}, identifiers, {
191
+ a: aHint,
192
+ }));
193
+ return `${capitalize(exprHint1.strFrench)} est $${exprHint2.node.toTex()}$.`;
194
+ }
195
+ else {
196
+ return `Le quotient de $200$ par $8$ est $25$.`;
197
+ }
198
+ }
169
199
  }
170
200
  };
171
201
  const getCorrection = (identifiers) => {
202
+ const { a, operatorName, b } = identifiers;
172
203
  const expression = ExpressionConstructor.fromIdentifiers(identifiers);
173
- const statementString = expression.str__french;
174
- let outString = `${capitalize(statementString)} est $ ${getAnswer(identifiers)} $.`;
204
+ const statementString = expression.strFrench;
175
205
  //explain rewriting if needed
176
206
  const nodeRaw = expression.node;
177
207
  const nodeRefined = nodeRaw.simplify();
178
- const texRaw = nodeRaw.toTex({
179
- allowDoubleMinus: true,
180
- forceTimesSign: true,
181
- forceParenthesis: true,
182
- forceNoSimplification: true,
183
- allowMinusAnywhereInFraction: true,
184
- });
208
+ let texRaw;
209
+ switch (operatorName) {
210
+ case "add":
211
+ {
212
+ const [texA, texB] = [a, b].map((c) => parseAlgebraic("" + c).toTex());
213
+ const isWrapWithParenthesis = ("" + b).startsWith("-");
214
+ texRaw = `${texA}+${isWrapWithParenthesis ? `(${texB})` : `${texB}`}`;
215
+ }
216
+ break;
217
+ default:
218
+ {
219
+ texRaw = nodeRaw.toTex({
220
+ allowDoubleMinus: true,
221
+ forceTimesSign: true,
222
+ forceParenthesis: true,
223
+ forceNoSimplification: true,
224
+ allowMinusAnywhereInFraction: true,
225
+ });
226
+ }
227
+ break;
228
+ }
185
229
  const texRefined = nodeRefined.toTex();
230
+ let outString = `${capitalize(statementString)} est $ ${texRefined} $.`;
186
231
  if (texRaw !== texRefined) {
187
232
  outString += `
188
233
 
@@ -3,6 +3,9 @@ type Identifiers = {
3
3
  distance: number;
4
4
  minutes: number;
5
5
  };
6
- export declare const kmPerMinToKmPerHourConversion: Exercise<Identifiers>;
6
+ type Options = {
7
+ unitTex: string;
8
+ };
9
+ export declare const kmPerMinToKmPerHourConversion: Exercise<Identifiers, Options>;
7
10
  export {};
8
11
  //# sourceMappingURL=kmPerMinToKmPerHourConversion.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"kmPerMinToKmPerHourConversion.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/conversion/kmPerMinToKmPerHourConversion.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAWrC,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAkHF,eAAO,MAAM,6BAA6B,EAAE,QAAQ,CAAC,WAAW,CAiB/D,CAAC"}
1
+ {"version":3,"file":"kmPerMinToKmPerHourConversion.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/conversion/kmPerMinToKmPerHourConversion.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAiBT,MAAM,6BAA6B,CAAC;AAWrC,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AA2IF,KAAK,OAAO,GAAG;IACb,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAgBF,eAAO,MAAM,6BAA6B,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAoBxE,CAAC"}
@@ -1,4 +1,4 @@
1
- import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../exercises/exercise.js";
1
+ import { GeneratorOptionTarget, GeneratorOptionType, addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../exercises/exercise.js";
2
2
  import { getDistinctQuestions } from "../../../exercises/utils/getDistinctQuestions.js";
3
3
  import { dividersOf } from "../../../math/utils/arithmetic/dividersOf.js";
4
4
  import { randint } from "../../../math/utils/random/randint.js";
@@ -7,85 +7,103 @@ import { multiply } from "../../../tree/nodes/operators/multiplyNode.js";
7
7
  import { substract } from "../../../tree/nodes/operators/substractNode.js";
8
8
  import { parseAlgebraic } from "../../../tree/parsers/latexParser.js";
9
9
  import { random } from "../../../utils/alea/random.js";
10
- const getInstruction = (identifiers) => {
10
+ const getInstruction = (identifiers, optsIn) => {
11
11
  const { distance, minutes } = identifiers;
12
- return `Si on parcourt $${distance.frenchify()}$ km en $${minutes.frenchify()}$ min,
13
- quelle est la vitesse moyenne en km/h ( $km.h^{-1}$ ) ?`;
12
+ const opts = optsIn ?? optsDefault;
13
+ const { unitTex } = opts;
14
+ return `Si on parcourt $${distance.frenchify()} \\ \\textrm{km}$ en $${minutes.frenchify()} \\ \\textrm{min}$,
15
+ quelle est la vitesse moyenne en $${unitTex}$ ?`;
14
16
  };
15
- const getAnswer = (identifiers) => {
17
+ const getAnswer = (identifiers, optsIn) => {
16
18
  const { distance, minutes } = identifiers;
19
+ const opts = optsIn ?? optsDefault;
20
+ const { unitTex } = opts;
17
21
  const nodeAnswer = multiply(distance, frac(60, minutes));
18
- return `${nodeAnswer.simplify().toTex()}km.h^{-1}`;
22
+ return `${nodeAnswer.simplify().toTex()} \\ ${unitTex}`;
19
23
  };
20
24
  const isAnswerValid = (ans, { distance, minutes }) => {
21
25
  const nodeAnswer = multiply(distance, frac(60, minutes));
22
- const nodeAns = parseAlgebraic(ans.replace("$km.h^{-1}$", "").replace("km/h", ""));
26
+ const nodeAns = parseAlgebraic(["\\textrm{km/h}", "\\textrm{km}.\\textrm{h}^{-1}"].reduce((acc, x) => acc.replace(x, ""), ans));
23
27
  return substract(nodeAns, nodeAnswer).evaluate() === 0;
24
28
  };
25
29
  const getHint = () => {
26
30
  return `Combien de minutes constituent une heure ?`;
27
31
  };
28
- const getCorrection = (identifiers) => {
32
+ const getCorrection = (identifiers, optsIn) => {
29
33
  const { distance, minutes } = identifiers;
30
- return `En $60$ minutes, on parcourt $${multiply(distance, frac(60, minutes)).toTex()}$ km
34
+ const opts = optsIn ?? optsDefault;
35
+ const { unitTex } = opts;
36
+ return `En $60$ minutes, on parcourt $${multiply(distance, frac(60, minutes)).toTex()} \\ \\textrm{km}$
31
37
  donc la vitesse est de $${multiply(distance, frac(60, minutes).simplify()).toTex()} = ${multiply(distance, frac(60, minutes))
32
38
  .simplify()
33
- .toTex()}$ $km.h^{-1}$`;
39
+ .toTex()} \\ ${unitTex}$`;
34
40
  };
35
- const getPropositions = (n, { answer, distance, minutes }) => {
41
+ const getPropositions = (n, { answer, distance, minutes }, optsIn) => {
42
+ const opts = optsIn ?? optsDefault;
43
+ const { unitTex } = opts;
36
44
  const propositions = [];
37
45
  addValidProp(propositions, answer);
38
- tryToAddWrongProp(propositions, `${multiply(60, minutes).simplify().toTex()}km.h^{-1}`);
39
- tryToAddWrongProp(propositions, `${frac(distance, minutes).simplify().toTex()}km.h^{-1}`);
40
- tryToAddWrongProp(propositions, `${multiply(3.6, frac(distance, minutes)).simplify().toTex()}km.h^{-1}`);
46
+ tryToAddWrongProp(propositions, `${multiply(60, minutes).simplify().toTex()} \\ ${unitTex}`);
47
+ tryToAddWrongProp(propositions, `${frac(distance, minutes).simplify().toTex()} \\ ${unitTex}`);
48
+ tryToAddWrongProp(propositions, `${multiply(3.6, frac(distance, minutes))
49
+ .simplify()
50
+ .toTex()} \\ ${unitTex}`);
41
51
  return shuffleProps(propositions, n);
42
52
  };
43
- const getKmPerMinToKmPerHourConversionQuestion = () => {
53
+ const getKmPerMinToKmPerHourConversionQuestion = (optsIn) => {
54
+ const opts = optsIn ?? optsDefault;
44
55
  const distance = randint(1, 101);
45
56
  const minutes = random(dividersOf(60));
46
57
  const identifiers = {
47
58
  distance,
48
59
  minutes,
49
60
  };
50
- return getQuestionFromIdentifiers(identifiers);
61
+ return getQuestionFromIdentifiers(identifiers, opts);
51
62
  };
52
- const getQuestionFromIdentifiers = (identifiers) => {
63
+ const getQuestionFromIdentifiers = (identifiers, optsIn) => {
64
+ const opts = optsIn ?? optsDefault;
53
65
  const question = {
54
- answer: getAnswer(identifiers),
55
- instruction: getInstruction(identifiers),
66
+ answer: getAnswer(identifiers, opts),
67
+ instruction: getInstruction(identifiers, opts),
56
68
  keys: [
57
69
  {
58
70
  id: "custom",
59
- label: "{km}.{h}^{-1}",
71
+ label: opts.unitTex,
60
72
  labelType: "tex",
61
73
  mathfieldInstructions: {
62
74
  method: "write",
63
- content: "{km}.{h}^{-1}",
64
- },
65
- },
66
- {
67
- id: "custom",
68
- label: "km/h",
69
- labelType: "raw",
70
- mathfieldInstructions: {
71
- method: "write",
72
- content: "km/h",
75
+ content: opts.unitTex,
73
76
  },
74
77
  },
75
78
  ],
76
79
  answerFormat: "tex",
77
80
  identifiers,
78
- hint: getHint(identifiers),
79
- correction: getCorrection(identifiers),
81
+ hint: getHint(identifiers, opts),
82
+ correction: getCorrection(identifiers, opts),
83
+ options: opts,
80
84
  };
81
85
  return question;
82
86
  };
87
+ const optsDefault = {
88
+ unitTex: "\\textrm{km/h}",
89
+ };
90
+ const options = [
91
+ {
92
+ id: "unitTex",
93
+ label: "Unité affichée",
94
+ target: GeneratorOptionTarget.generation,
95
+ type: GeneratorOptionType.select,
96
+ values: ["\\textrm{km/h}", "\\textrm{km}.\\textrm{h}^{-1}"],
97
+ defaultValue: optsDefault.unitTex,
98
+ },
99
+ ];
83
100
  export const kmPerMinToKmPerHourConversion = {
84
101
  id: "kmPerMinToKmPerHourConversion",
85
102
  connector: "=",
86
- label: "Effectuer des conversions de vitesse ( $x$ km en $y$ min donne une vitesse $V$ en km/h)",
103
+ label: "Effectuer des conversions de vitesse ( $x$ km en $y$ min donne une vitesse $V$ en \\textrm{km/h})",
87
104
  isSingleStep: true,
88
- generator: (nb) => getDistinctQuestions(getKmPerMinToKmPerHourConversionQuestion, nb),
105
+ generator: (nb, opts) => getDistinctQuestions(() => getKmPerMinToKmPerHourConversionQuestion(opts), nb),
106
+ options,
89
107
  qcmTimer: 60,
90
108
  freeTimer: 60,
91
109
  getPropositions,
@@ -94,5 +112,4 @@ export const kmPerMinToKmPerHourConversion = {
94
112
  getQuestionFromIdentifiers,
95
113
  hasHintAndCorrection: true,
96
114
  shouldHaveCalculator: true,
97
- answerType: "QCU",
98
115
  };
@@ -1 +1 @@
1
- {"version":3,"file":"minutesToHours.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/conversion/minutesToHours.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAMrC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAQ7C,KAAK,WAAW,GAAG;IACjB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,cAAc,EAAE,eAAe,CAAC;IAChC,YAAY,EAAE,eAAe,CAAC;CAC/B,CAAC;AA2LF,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,WAAW,CAgBhD,CAAC"}
1
+ {"version":3,"file":"minutesToHours.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/conversion/minutesToHours.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAMrC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAQ7C,KAAK,WAAW,GAAG;IACjB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,cAAc,EAAE,eAAe,CAAC;IAChC,YAAY,EAAE,eAAe,CAAC;CAC/B,CAAC;AA2LF,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,WAAW,CAehD,CAAC"}
@@ -146,5 +146,4 @@ export const minutesToHours = {
146
146
  getQuestionFromIdentifiers,
147
147
  hasHintAndCorrection: true,
148
148
  shouldHaveCalculator: true,
149
- answerType: "QCU",
150
149
  };
@@ -1 +1 @@
1
- {"version":3,"file":"prefixToNumber.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/conversion/prefixToNumber.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,QAAQ,EAiBT,MAAM,mBAAmB,CAAC;AAG3B,KAAK,WAAW,GAAG;IACjB,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,YAAY,EAAE,OAAO,CAAC;CACvB,CAAC;AAsLF,KAAK,OAAO,GAAG;IACb,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,SAAS,EAAE,OAAO,CAAC;IACnB,YAAY,EAAE,OAAO,CAAC;CACvB,CAAC;AA+EF,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAiBzD,CAAC"}
1
+ {"version":3,"file":"prefixToNumber.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/conversion/prefixToNumber.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,QAAQ,EAiBT,MAAM,mBAAmB,CAAC;AAG3B,KAAK,WAAW,GAAG;IACjB,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,YAAY,EAAE,OAAO,CAAC;CACvB,CAAC;AAoMF,KAAK,OAAO,GAAG;IACb,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,SAAS,EAAE,OAAO,CAAC;IACnB,YAAY,EAAE,OAAO,CAAC;CACvB,CAAC;AA+EF,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAiBzD,CAAC"}