math-exercises 3.0.125 → 3.0.127

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 (291) hide show
  1. package/lib/exercises/math/calcul/fractions/fractionsSumsPrimeDenominators.d.ts.map +1 -1
  2. package/lib/exercises/math/calcul/fractions/fractionsSumsPrimeDenominators.js +61 -1
  3. package/lib/exercises/math/calcul/mentalCaluls/index.d.ts +1 -0
  4. package/lib/exercises/math/calcul/mentalCaluls/index.d.ts.map +1 -1
  5. package/lib/exercises/math/calcul/mentalCaluls/index.js +1 -0
  6. package/lib/exercises/math/calcul/mentalCaluls/mentalProgramSolve.d.ts +15 -0
  7. package/lib/exercises/math/calcul/mentalCaluls/mentalProgramSolve.d.ts.map +1 -0
  8. package/lib/exercises/math/calcul/mentalCaluls/mentalProgramSolve.js +231 -0
  9. package/lib/exercises/math/calcul/ordering/compareA10N.d.ts +16 -0
  10. package/lib/exercises/math/calcul/ordering/compareA10N.d.ts.map +1 -0
  11. package/lib/exercises/math/calcul/ordering/compareA10N.js +327 -0
  12. package/lib/exercises/math/calcul/ordering/compareABUsingQuotient.d.ts +8 -0
  13. package/lib/exercises/math/calcul/ordering/compareABUsingQuotient.d.ts.map +1 -0
  14. package/lib/exercises/math/calcul/ordering/compareABUsingQuotient.js +123 -0
  15. package/lib/exercises/math/calcul/ordering/compareFracABWithFracAPlusCBPlusC.d.ts +9 -0
  16. package/lib/exercises/math/calcul/ordering/compareFracABWithFracAPlusCBPlusC.d.ts.map +1 -0
  17. package/lib/exercises/math/calcul/ordering/compareFracABWithFracAPlusCBPlusC.js +149 -0
  18. package/lib/exercises/math/calcul/ordering/compareFracAndDec.d.ts +29 -0
  19. package/lib/exercises/math/calcul/ordering/compareFracAndDec.d.ts.map +1 -0
  20. package/lib/exercises/math/calcul/ordering/compareFracAndDec.js +368 -0
  21. package/lib/exercises/math/calcul/ordering/comparePowersOfFracs.d.ts +12 -0
  22. package/lib/exercises/math/calcul/ordering/comparePowersOfFracs.d.ts.map +1 -0
  23. package/lib/exercises/math/calcul/ordering/comparePowersOfFracs.js +164 -0
  24. package/lib/exercises/math/calcul/ordering/compareWithSquareRoots.d.ts +9 -0
  25. package/lib/exercises/math/calcul/ordering/compareWithSquareRoots.d.ts.map +1 -0
  26. package/lib/exercises/math/calcul/ordering/compareWithSquareRoots.js +140 -0
  27. package/lib/exercises/math/calcul/ordering/index.d.ts +6 -0
  28. package/lib/exercises/math/calcul/ordering/index.d.ts.map +1 -1
  29. package/lib/exercises/math/calcul/ordering/index.js +6 -0
  30. package/lib/exercises/math/calcul/rounding/estimateAroundPow10NTimesAroundPow10N.d.ts +9 -0
  31. package/lib/exercises/math/calcul/rounding/estimateAroundPow10NTimesAroundPow10N.d.ts.map +1 -0
  32. package/lib/exercises/math/calcul/rounding/estimateAroundPow10NTimesAroundPow10N.js +84 -0
  33. package/lib/exercises/math/calcul/rounding/estimatePow10NPlusPow10MinusN.d.ts +8 -0
  34. package/lib/exercises/math/calcul/rounding/estimatePow10NPlusPow10MinusN.d.ts.map +1 -0
  35. package/lib/exercises/math/calcul/rounding/estimatePow10NPlusPow10MinusN.js +90 -0
  36. package/lib/exercises/math/calcul/rounding/index.d.ts +2 -0
  37. package/lib/exercises/math/calcul/rounding/index.d.ts.map +1 -1
  38. package/lib/exercises/math/calcul/rounding/index.js +2 -0
  39. package/lib/exercises/math/calculLitteral/equation/equationFromProblem.d.ts +13 -0
  40. package/lib/exercises/math/calculLitteral/equation/equationFromProblem.d.ts.map +1 -0
  41. package/lib/exercises/math/calculLitteral/equation/equationFromProblem.js +454 -0
  42. package/lib/exercises/math/calculLitteral/equation/index.d.ts +1 -0
  43. package/lib/exercises/math/calculLitteral/equation/index.d.ts.map +1 -1
  44. package/lib/exercises/math/calculLitteral/equation/index.js +1 -0
  45. package/lib/exercises/math/calculLitteral/factorisation/factorizeAX2PlusBX.d.ts +10 -0
  46. package/lib/exercises/math/calculLitteral/factorisation/factorizeAX2PlusBX.d.ts.map +1 -0
  47. package/lib/exercises/math/calculLitteral/factorisation/factorizeAX2PlusBX.js +70 -0
  48. package/lib/exercises/math/calculLitteral/factorisation/index.d.ts +1 -0
  49. package/lib/exercises/math/calculLitteral/factorisation/index.d.ts.map +1 -1
  50. package/lib/exercises/math/calculLitteral/factorisation/index.js +1 -0
  51. package/lib/exercises/math/calculLitteral/index.d.ts +2 -0
  52. package/lib/exercises/math/calculLitteral/index.d.ts.map +1 -1
  53. package/lib/exercises/math/calculLitteral/index.js +2 -0
  54. package/lib/exercises/math/calculLitteral/isolate/index.d.ts +2 -1
  55. package/lib/exercises/math/calculLitteral/isolate/index.d.ts.map +1 -1
  56. package/lib/exercises/math/calculLitteral/isolate/index.js +2 -1
  57. package/lib/exercises/math/calculLitteral/isolate/isolateUInInvXPlusInvYEqualsInvU.d.ts +8 -0
  58. package/lib/exercises/math/calculLitteral/isolate/isolateUInInvXPlusInvYEqualsInvU.d.ts.map +1 -0
  59. package/lib/exercises/math/calculLitteral/isolate/isolateUInInvXPlusInvYEqualsInvU.js +86 -0
  60. package/lib/exercises/math/calculLitteral/isolate/isolateXInInvXPlusInvYEqualsInvU.d.ts +7 -0
  61. package/lib/exercises/math/calculLitteral/isolate/isolateXInInvXPlusInvYEqualsInvU.d.ts.map +1 -0
  62. package/lib/exercises/math/calculLitteral/isolate/isolateXInInvXPlusInvYEqualsInvU.js +80 -0
  63. package/lib/exercises/math/calculLitteral/ordering/compareAMinusB.d.ts +10 -0
  64. package/lib/exercises/math/calculLitteral/ordering/compareAMinusB.d.ts.map +1 -0
  65. package/lib/exercises/math/calculLitteral/ordering/compareAMinusB.js +180 -0
  66. package/lib/exercises/math/calculLitteral/ordering/compareFromPiMinusFrac.d.ts +9 -0
  67. package/lib/exercises/math/calculLitteral/ordering/compareFromPiMinusFrac.d.ts.map +1 -0
  68. package/lib/exercises/math/calculLitteral/ordering/compareFromPiMinusFrac.js +144 -0
  69. package/lib/exercises/math/calculLitteral/ordering/index.d.ts +3 -0
  70. package/lib/exercises/math/calculLitteral/ordering/index.d.ts.map +1 -0
  71. package/lib/exercises/math/calculLitteral/ordering/index.js +2 -0
  72. package/lib/exercises/math/calculLitteral/simplifying/compareATimes0.d.ts +11 -0
  73. package/lib/exercises/math/calculLitteral/simplifying/compareATimes0.d.ts.map +1 -0
  74. package/lib/exercises/math/calculLitteral/simplifying/compareATimes0.js +120 -0
  75. package/lib/exercises/math/calculLitteral/simplifying/compareFracXA.d.ts +8 -0
  76. package/lib/exercises/math/calculLitteral/simplifying/compareFracXA.d.ts.map +1 -0
  77. package/lib/exercises/math/calculLitteral/simplifying/compareFracXA.js +67 -0
  78. package/lib/exercises/math/calculLitteral/simplifying/compareMinusA.d.ts +11 -0
  79. package/lib/exercises/math/calculLitteral/simplifying/compareMinusA.d.ts.map +1 -0
  80. package/lib/exercises/math/calculLitteral/simplifying/compareMinusA.js +114 -0
  81. package/lib/exercises/math/calculLitteral/simplifying/index.d.ts +5 -0
  82. package/lib/exercises/math/calculLitteral/simplifying/index.d.ts.map +1 -1
  83. package/lib/exercises/math/calculLitteral/simplifying/index.js +5 -0
  84. package/lib/exercises/math/calculLitteral/simplifying/pickSameAsAPercentOfB.d.ts +13 -0
  85. package/lib/exercises/math/calculLitteral/simplifying/pickSameAsAPercentOfB.d.ts.map +1 -0
  86. package/lib/exercises/math/calculLitteral/simplifying/pickSameAsAPercentOfB.js +125 -0
  87. package/lib/exercises/math/calculLitteral/simplifying/pickSameAsInverseOfFracAB.d.ts +14 -0
  88. package/lib/exercises/math/calculLitteral/simplifying/pickSameAsInverseOfFracAB.d.ts.map +1 -0
  89. package/lib/exercises/math/calculLitteral/simplifying/pickSameAsInverseOfFracAB.js +148 -0
  90. package/lib/exercises/math/calculLitteral/writing/writeLitExpFromFrenchExp.d.ts +5 -27
  91. package/lib/exercises/math/calculLitteral/writing/writeLitExpFromFrenchExp.d.ts.map +1 -1
  92. package/lib/exercises/math/calculLitteral/writing/writeLitExpFromFrenchExp.js +231 -248
  93. package/lib/exercises/math/conversion/index.d.ts +4 -0
  94. package/lib/exercises/math/conversion/index.d.ts.map +1 -1
  95. package/lib/exercises/math/conversion/index.js +4 -0
  96. package/lib/exercises/math/conversion/kmPerMinToKmPerHourConversion.d.ts +11 -0
  97. package/lib/exercises/math/conversion/kmPerMinToKmPerHourConversion.d.ts.map +1 -0
  98. package/lib/exercises/math/conversion/kmPerMinToKmPerHourConversion.js +116 -0
  99. package/lib/exercises/math/conversion/minutesToHours.d.ts +10 -0
  100. package/lib/exercises/math/conversion/minutesToHours.d.ts.map +1 -0
  101. package/lib/exercises/math/conversion/minutesToHours.js +150 -0
  102. package/lib/exercises/math/conversion/prefixToNumber.d.ts +15 -0
  103. package/lib/exercises/math/conversion/prefixToNumber.d.ts.map +1 -0
  104. package/lib/exercises/math/conversion/prefixToNumber.js +243 -0
  105. package/lib/exercises/math/conversion/secondsToHours.d.ts +10 -0
  106. package/lib/exercises/math/conversion/secondsToHours.d.ts.map +1 -0
  107. package/lib/exercises/math/conversion/secondsToHours.js +150 -0
  108. package/lib/exercises/math/dataRepresentations/barChartInterpreting.d.ts +53 -0
  109. package/lib/exercises/math/dataRepresentations/barChartInterpreting.d.ts.map +1 -0
  110. package/lib/exercises/math/dataRepresentations/barChartInterpreting.js +533 -0
  111. package/lib/exercises/math/dataRepresentations/boxPlotInterpreting.d.ts +7 -0
  112. package/lib/exercises/math/dataRepresentations/boxPlotInterpreting.d.ts.map +1 -0
  113. package/lib/exercises/math/dataRepresentations/boxPlotInterpreting.js +223 -0
  114. package/lib/exercises/math/dataRepresentations/cartesianGraphExtremaReading.d.ts +10 -0
  115. package/lib/exercises/math/dataRepresentations/cartesianGraphExtremaReading.d.ts.map +1 -0
  116. package/lib/exercises/math/dataRepresentations/cartesianGraphExtremaReading.js +140 -0
  117. package/lib/exercises/math/dataRepresentations/dataToGraphGraphToData.d.ts +8 -0
  118. package/lib/exercises/math/dataRepresentations/dataToGraphGraphToData.d.ts.map +1 -0
  119. package/lib/exercises/math/dataRepresentations/dataToGraphGraphToData.js +133 -0
  120. package/lib/exercises/math/dataRepresentations/graphReading.d.ts +8 -0
  121. package/lib/exercises/math/dataRepresentations/graphReading.d.ts.map +1 -0
  122. package/lib/exercises/math/dataRepresentations/graphReading.js +136 -0
  123. package/lib/exercises/math/dataRepresentations/halfPieChartCommenting.d.ts +18 -0
  124. package/lib/exercises/math/dataRepresentations/halfPieChartCommenting.d.ts.map +1 -0
  125. package/lib/exercises/math/dataRepresentations/halfPieChartCommenting.js +228 -0
  126. package/lib/exercises/math/dataRepresentations/halfPieChartReading.d.ts +8 -0
  127. package/lib/exercises/math/dataRepresentations/halfPieChartReading.d.ts.map +1 -0
  128. package/lib/exercises/math/dataRepresentations/halfPieChartReading.js +213 -0
  129. package/lib/exercises/math/dataRepresentations/histogramReading.d.ts +9 -0
  130. package/lib/exercises/math/dataRepresentations/histogramReading.d.ts.map +1 -0
  131. package/lib/exercises/math/dataRepresentations/histogramReading.js +163 -0
  132. package/lib/exercises/math/dataRepresentations/index.d.ts +10 -0
  133. package/lib/exercises/math/dataRepresentations/index.d.ts.map +1 -1
  134. package/lib/exercises/math/dataRepresentations/index.js +10 -0
  135. package/lib/exercises/math/dataRepresentations/plausibleGraph.d.ts +9 -0
  136. package/lib/exercises/math/dataRepresentations/plausibleGraph.d.ts.map +1 -0
  137. package/lib/exercises/math/dataRepresentations/plausibleGraph.js +194 -0
  138. package/lib/exercises/math/dataRepresentations/scatterPlotCommenting.d.ts +9 -0
  139. package/lib/exercises/math/dataRepresentations/scatterPlotCommenting.d.ts.map +1 -0
  140. package/lib/exercises/math/dataRepresentations/scatterPlotCommenting.js +308 -0
  141. package/lib/exercises/math/derivation/derivative/exp/expDerivativeFour.d.ts.map +1 -1
  142. package/lib/exercises/math/derivation/derivative/exp/expDerivativeFour.js +5 -6
  143. package/lib/exercises/math/functions/affines/coordsOfPointOnAffineFindX.d.ts +8 -0
  144. package/lib/exercises/math/functions/affines/coordsOfPointOnAffineFindX.d.ts.map +1 -0
  145. package/lib/exercises/math/functions/affines/coordsOfPointOnAffineFindX.js +117 -0
  146. package/lib/exercises/math/functions/affines/coordsOfPointOnAffineFindY.d.ts +8 -0
  147. package/lib/exercises/math/functions/affines/coordsOfPointOnAffineFindY.d.ts.map +1 -0
  148. package/lib/exercises/math/functions/affines/coordsOfPointOnAffineFindY.js +118 -0
  149. package/lib/exercises/math/functions/affines/drawAffineFromPointAndLeadingCoeff.d.ts +16 -0
  150. package/lib/exercises/math/functions/affines/drawAffineFromPointAndLeadingCoeff.d.ts.map +1 -0
  151. package/lib/exercises/math/functions/affines/drawAffineFromPointAndLeadingCoeff.js +215 -0
  152. package/lib/exercises/math/functions/affines/drawAffineFromProgCalc.d.ts +13 -0
  153. package/lib/exercises/math/functions/affines/drawAffineFromProgCalc.d.ts.map +1 -0
  154. package/lib/exercises/math/functions/affines/drawAffineFromProgCalc.js +223 -0
  155. package/lib/exercises/math/functions/affines/index.d.ts +7 -0
  156. package/lib/exercises/math/functions/affines/index.d.ts.map +1 -1
  157. package/lib/exercises/math/functions/affines/index.js +7 -0
  158. package/lib/exercises/math/functions/affines/recognizeExprAffine.d.ts +20 -0
  159. package/lib/exercises/math/functions/affines/recognizeExprAffine.d.ts.map +1 -0
  160. package/lib/exercises/math/functions/affines/recognizeExprAffine.js +284 -0
  161. package/lib/exercises/math/functions/affines/representationOfAffine.d.ts +16 -0
  162. package/lib/exercises/math/functions/affines/representationOfAffine.d.ts.map +1 -0
  163. package/lib/exercises/math/functions/affines/representationOfAffine.js +275 -0
  164. package/lib/exercises/math/functions/basics/coordsOfPointOnCurveFindY.d.ts +14 -0
  165. package/lib/exercises/math/functions/basics/coordsOfPointOnCurveFindY.d.ts.map +1 -0
  166. package/lib/exercises/math/functions/basics/coordsOfPointOnCurveFindY.js +235 -0
  167. package/lib/exercises/math/functions/basics/index.d.ts +1 -0
  168. package/lib/exercises/math/functions/basics/index.d.ts.map +1 -1
  169. package/lib/exercises/math/functions/basics/index.js +1 -0
  170. package/lib/exercises/math/functions/composition/functionComposition.d.ts +8 -0
  171. package/lib/exercises/math/functions/composition/functionComposition.d.ts.map +1 -0
  172. package/lib/exercises/math/functions/composition/functionComposition.js +238 -0
  173. package/lib/exercises/math/functions/composition/index.d.ts +2 -0
  174. package/lib/exercises/math/functions/composition/index.d.ts.map +1 -0
  175. package/lib/exercises/math/functions/composition/index.js +1 -0
  176. package/lib/exercises/math/functions/index.d.ts +1 -0
  177. package/lib/exercises/math/functions/index.d.ts.map +1 -1
  178. package/lib/exercises/math/functions/index.js +1 -0
  179. package/lib/exercises/math/geometry/angles/anglesUsingIsParallel.d.ts +23 -0
  180. package/lib/exercises/math/geometry/angles/anglesUsingIsParallel.d.ts.map +1 -0
  181. package/lib/exercises/math/geometry/angles/anglesUsingIsParallel.js +448 -0
  182. package/lib/exercises/math/geometry/angles/index.js +2 -0
  183. package/lib/exercises/math/geometry/angles/isParallelUsingAngles.d.ts +23 -0
  184. package/lib/exercises/math/geometry/angles/isParallelUsingAngles.d.ts.map +1 -0
  185. package/lib/exercises/math/geometry/angles/isParallelUsingAngles.js +402 -0
  186. package/lib/exercises/math/geometry/cartesian/placeAbscissOnSemiLine.d.ts +9 -6
  187. package/lib/exercises/math/geometry/cartesian/placeAbscissOnSemiLine.d.ts.map +1 -1
  188. package/lib/exercises/math/geometry/cartesian/placeAbscissOnSemiLine.js +140 -60
  189. package/lib/exercises/math/geometry/convexity/convexityQuadrinomialsGeo.js +1 -1
  190. package/lib/exercises/math/geometry/vectors/colinearity/colinearityFromPicture.d.ts.map +1 -1
  191. package/lib/exercises/math/geometry/vectors/colinearity/colinearityFromPicture.js +121 -104
  192. package/lib/exercises/math/geometry/vectors/vectorRepresentative.d.ts.map +1 -1
  193. package/lib/exercises/math/geometry/vectors/vectorRepresentative.js +3 -2
  194. package/lib/exercises/math/probaStat/basicProbas/index.d.ts +1 -0
  195. package/lib/exercises/math/probaStat/basicProbas/index.d.ts.map +1 -1
  196. package/lib/exercises/math/probaStat/basicProbas/index.js +1 -0
  197. package/lib/exercises/math/probaStat/basicProbas/possibleValuesForProba.d.ts +0 -1
  198. package/lib/exercises/math/probaStat/basicProbas/possibleValuesForProba.d.ts.map +1 -1
  199. package/lib/exercises/math/probaStat/basicProbas/possibleValuesForProba.js +65 -88
  200. package/lib/exercises/math/probaStat/conditionalProbaWriteFromFrench.d.ts +9 -0
  201. package/lib/exercises/math/probaStat/conditionalProbaWriteFromFrench.d.ts.map +1 -0
  202. package/lib/exercises/math/probaStat/conditionalProbaWriteFromFrench.js +221 -0
  203. package/lib/exercises/math/probaStat/index.d.ts +2 -0
  204. package/lib/exercises/math/probaStat/index.d.ts.map +1 -1
  205. package/lib/exercises/math/probaStat/index.js +2 -0
  206. package/lib/exercises/math/probaStat/probaAsSumOfProbas.d.ts +29 -0
  207. package/lib/exercises/math/probaStat/probaAsSumOfProbas.d.ts.map +1 -0
  208. package/lib/exercises/math/probaStat/probaAsSumOfProbas.js +547 -0
  209. package/lib/exercises/math/probaStat/stats1var/index.d.ts +2 -0
  210. package/lib/exercises/math/probaStat/stats1var/index.d.ts.map +1 -1
  211. package/lib/exercises/math/probaStat/stats1var/index.js +2 -0
  212. package/lib/exercises/math/probaStat/stats1var/interpretIndicatorsForLists.d.ts +9 -0
  213. package/lib/exercises/math/probaStat/stats1var/interpretIndicatorsForLists.d.ts.map +1 -0
  214. package/lib/exercises/math/probaStat/stats1var/interpretIndicatorsForLists.js +89 -0
  215. package/lib/exercises/math/probaStat/stats1var/plausibilityOfAverage.d.ts +10 -0
  216. package/lib/exercises/math/probaStat/stats1var/plausibilityOfAverage.d.ts.map +1 -0
  217. package/lib/exercises/math/probaStat/stats1var/plausibilityOfAverage.js +152 -0
  218. package/lib/exercises/pc/electricity/calculateUEqualsRI.d.ts +7 -0
  219. package/lib/exercises/pc/electricity/calculateUEqualsRI.d.ts.map +1 -0
  220. package/lib/exercises/pc/electricity/calculateUEqualsRI.js +73 -0
  221. package/lib/exercises/pc/electricity/index.d.ts +1 -0
  222. package/lib/exercises/pc/electricity/index.d.ts.map +1 -1
  223. package/lib/exercises/pc/electricity/index.js +1 -0
  224. package/lib/exercises/pc/index.d.ts +1 -0
  225. package/lib/exercises/pc/index.d.ts.map +1 -1
  226. package/lib/exercises/pc/index.js +1 -0
  227. package/lib/exercises/pc/moleculeFormula.d.ts.map +1 -1
  228. package/lib/exercises/pc/moleculeFormula.js +4 -3
  229. package/lib/exercises/pc/optics/index.d.ts +2 -0
  230. package/lib/exercises/pc/optics/index.d.ts.map +1 -0
  231. package/lib/exercises/pc/optics/index.js +1 -0
  232. package/lib/exercises/pc/optics/lensFormula.d.ts +21 -0
  233. package/lib/exercises/pc/optics/lensFormula.d.ts.map +1 -0
  234. package/lib/exercises/pc/optics/lensFormula.js +415 -0
  235. package/lib/exercises/pc/weight/calculateWeight.d.ts +8 -1
  236. package/lib/exercises/pc/weight/calculateWeight.d.ts.map +1 -1
  237. package/lib/exercises/pc/weight/calculateWeight.js +113 -38
  238. package/lib/geogebra/parsers/geogebraParser.d.ts +4 -0
  239. package/lib/geogebra/parsers/geogebraParser.d.ts.map +1 -1
  240. package/lib/geogebra/parsers/geogebraParser.js +17 -0
  241. package/lib/index.d.ts +351 -12
  242. package/lib/index.d.ts.map +1 -1
  243. package/lib/latexTester.d.ts.map +1 -1
  244. package/lib/latexTester.js +1 -0
  245. package/lib/math/geometry/CloudPoints.d.ts +10 -0
  246. package/lib/math/geometry/CloudPoints.d.ts.map +1 -1
  247. package/lib/math/geometry/CloudPoints.js +119 -0
  248. package/lib/math/geometry/line.d.ts +1 -0
  249. package/lib/math/geometry/line.d.ts.map +1 -1
  250. package/lib/math/geometry/line.js +10 -2
  251. package/lib/math/geometry/vector.d.ts +1 -0
  252. package/lib/math/geometry/vector.d.ts.map +1 -1
  253. package/lib/math/geometry/vector.js +12 -0
  254. package/lib/math/progCalc/progCalc.d.ts +46 -0
  255. package/lib/math/progCalc/progCalc.d.ts.map +1 -0
  256. package/lib/math/progCalc/progCalc.js +239 -0
  257. package/lib/math/utils/latex/realize.d.ts +12 -0
  258. package/lib/math/utils/latex/realize.d.ts.map +1 -0
  259. package/lib/math/utils/latex/realize.js +43 -0
  260. package/lib/pc/constants/molecularChemistry/molecule.d.ts +2 -0
  261. package/lib/pc/constants/molecularChemistry/molecule.d.ts.map +1 -1
  262. package/lib/pc/constants/molecularChemistry/molecule.js +52 -0
  263. package/lib/tests/questionTest.d.ts.map +1 -1
  264. package/lib/tests/questionTest.js +1 -1
  265. package/lib/tests/singleExo.test.js +3 -3
  266. package/lib/tree/nodes/algebraicNode.d.ts.map +1 -1
  267. package/lib/tree/nodes/operators/addNode.d.ts +4 -2
  268. package/lib/tree/nodes/operators/addNode.d.ts.map +1 -1
  269. package/lib/tree/nodes/operators/addNode.js +8 -17
  270. package/lib/tree/nodes/operators/fractionNode.d.ts +1 -1
  271. package/lib/tree/nodes/operators/fractionNode.d.ts.map +1 -1
  272. package/lib/tree/nodes/operators/fractionNode.js +5 -1
  273. package/lib/tree/nodes/operators/multiplyNode.d.ts +4 -2
  274. package/lib/tree/nodes/operators/multiplyNode.d.ts.map +1 -1
  275. package/lib/tree/nodes/operators/multiplyNode.js +8 -17
  276. package/lib/tree/nodes/operators/operatorNode.d.ts +3 -3
  277. package/lib/tree/nodes/operators/operatorNode.d.ts.map +1 -1
  278. package/lib/tree/nodes/variables/variableNode.d.ts +1 -1
  279. package/lib/tree/nodes/variables/variableNode.d.ts.map +1 -1
  280. package/lib/tree/utilities/nodeShuffler.d.ts +12 -0
  281. package/lib/tree/utilities/nodeShuffler.d.ts.map +1 -0
  282. package/lib/tree/utilities/nodeShuffler.js +123 -0
  283. package/lib/utils/arrays/getAllPicks.d.ts +2 -0
  284. package/lib/utils/arrays/getAllPicks.d.ts.map +1 -0
  285. package/lib/utils/arrays/getAllPicks.js +17 -0
  286. package/lib/utils/errors/handleVEAError.d.ts +1 -1
  287. package/lib/utils/errors/handleVEAError.d.ts.map +1 -1
  288. package/lib/utils/strings/decapitalize.d.ts +2 -0
  289. package/lib/utils/strings/decapitalize.d.ts.map +1 -0
  290. package/lib/utils/strings/decapitalize.js +3 -0
  291. package/package.json +1 -1
@@ -0,0 +1,116 @@
1
+ import { GeneratorOptionTarget, GeneratorOptionType, addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../exercises/utils/getDistinctQuestions.js";
3
+ import { dividersOf } from "../../../math/utils/arithmetic/dividersOf.js";
4
+ import { randint } from "../../../math/utils/random/randint.js";
5
+ import { frac } from "../../../tree/nodes/operators/fractionNode.js";
6
+ import { multiply } from "../../../tree/nodes/operators/multiplyNode.js";
7
+ import { substract } from "../../../tree/nodes/operators/substractNode.js";
8
+ import { parseAlgebraic } from "../../../tree/parsers/latexParser.js";
9
+ import { random } from "../../../utils/alea/random.js";
10
+ const getInstruction = (identifiers, optsIn) => {
11
+ const { distance, minutes } = identifiers;
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}$ ?`;
16
+ };
17
+ const getAnswer = (identifiers, optsIn) => {
18
+ const { distance, minutes } = identifiers;
19
+ const opts = optsIn ?? optsDefault;
20
+ const { unitTex } = opts;
21
+ const nodeAnswer = multiply(distance, frac(60, minutes));
22
+ return `${nodeAnswer.simplify().toTex()} \\ ${unitTex}`;
23
+ };
24
+ const isAnswerValid = (ans, { distance, minutes }) => {
25
+ const nodeAnswer = multiply(distance, frac(60, minutes));
26
+ const nodeAns = parseAlgebraic(["\\textrm{km/h}", "\\textrm{km}.\\textrm{h}^{-1}"].reduce((acc, x) => acc.replace(x, ""), ans));
27
+ return substract(nodeAns, nodeAnswer).evaluate() === 0;
28
+ };
29
+ const getHint = () => {
30
+ return `Combien de minutes constituent une heure ?`;
31
+ };
32
+ const getCorrection = (identifiers, optsIn) => {
33
+ const { distance, minutes } = identifiers;
34
+ const opts = optsIn ?? optsDefault;
35
+ const { unitTex } = opts;
36
+ return `En $60$ minutes, on parcourt $${multiply(distance, frac(60, minutes)).toTex()} \\ \\textrm{km}$
37
+ donc la vitesse est de $${multiply(distance, frac(60, minutes).simplify()).toTex()} = ${multiply(distance, frac(60, minutes))
38
+ .simplify()
39
+ .toTex()} \\ ${unitTex}$`;
40
+ };
41
+ const getPropositions = (n, { answer, distance, minutes }, optsIn) => {
42
+ const opts = optsIn ?? optsDefault;
43
+ const { unitTex } = opts;
44
+ const propositions = [];
45
+ addValidProp(propositions, answer);
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}`);
51
+ return shuffleProps(propositions, n);
52
+ };
53
+ const getKmPerMinToKmPerHourConversionQuestion = (optsIn) => {
54
+ const opts = optsIn ?? optsDefault;
55
+ const distance = randint(1, 101);
56
+ const minutes = random(dividersOf(60));
57
+ const identifiers = {
58
+ distance,
59
+ minutes,
60
+ };
61
+ return getQuestionFromIdentifiers(identifiers, opts);
62
+ };
63
+ const getQuestionFromIdentifiers = (identifiers, optsIn) => {
64
+ const opts = optsIn ?? optsDefault;
65
+ const question = {
66
+ answer: getAnswer(identifiers, opts),
67
+ instruction: getInstruction(identifiers, opts),
68
+ keys: [
69
+ {
70
+ id: "custom",
71
+ label: opts.unitTex,
72
+ labelType: "tex",
73
+ mathfieldInstructions: {
74
+ method: "write",
75
+ content: opts.unitTex,
76
+ },
77
+ },
78
+ ],
79
+ answerFormat: "tex",
80
+ identifiers,
81
+ hint: getHint(identifiers, opts),
82
+ correction: getCorrection(identifiers, opts),
83
+ options: opts,
84
+ };
85
+ return question;
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
+ ];
100
+ export const kmPerMinToKmPerHourConversion = {
101
+ id: "kmPerMinToKmPerHourConversion",
102
+ connector: "=",
103
+ label: "Effectuer des conversions de vitesse ( $x$ km en $y$ min donne une vitesse $V$ en \\textrm{km/h})",
104
+ isSingleStep: true,
105
+ generator: (nb, opts) => getDistinctQuestions(() => getKmPerMinToKmPerHourConversionQuestion(opts), nb),
106
+ options,
107
+ qcmTimer: 60,
108
+ freeTimer: 60,
109
+ getPropositions,
110
+ isAnswerValid,
111
+ subject: "Mathématiques",
112
+ getQuestionFromIdentifiers,
113
+ hasHintAndCorrection: true,
114
+ shouldHaveCalculator: true,
115
+ answerType: "QCU",
116
+ };
@@ -0,0 +1,10 @@
1
+ import { Exercise } from "../../../exercises/exercise.js";
2
+ import { NodeIdentifiers } from "../../../tree/nodes/nodeConstructor.js";
3
+ type Identifiers = {
4
+ isMinutesToHours: boolean;
5
+ nodeIdsMinutes: NodeIdentifiers;
6
+ nodeIdsHours: NodeIdentifiers;
7
+ };
8
+ export declare const minutesToHours: Exercise<Identifiers>;
9
+ export {};
10
+ //# sourceMappingURL=minutesToHours.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,150 @@
1
+ import { addValidProp, propWhile, shuffleProps, tryToAddWrongProp, } from "../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../exercises/utils/getDistinctQuestions.js";
3
+ import { dividersOf } from "../../../math/utils/arithmetic/dividersOf.js";
4
+ import { randint } from "../../../math/utils/random/randint.js";
5
+ import { round } from "../../../math/utils/round.js";
6
+ import { NodeConstructor, } from "../../../tree/nodes/nodeConstructor.js";
7
+ import { frac } from "../../../tree/nodes/operators/fractionNode.js";
8
+ import { multiply } from "../../../tree/nodes/operators/multiplyNode.js";
9
+ import { substract } from "../../../tree/nodes/operators/substractNode.js";
10
+ import { parseAlgebraic } from "../../../tree/parsers/latexParser.js";
11
+ import { coinFlip } from "../../../utils/alea/coinFlip.js";
12
+ import { random } from "../../../utils/alea/random.js";
13
+ const getInstruction = (identifiers) => {
14
+ const { isMinutesToHours, nodeIdsMinutes, nodeIdsHours } = identifiers;
15
+ const minutes = NodeConstructor.fromIdentifiers(nodeIdsMinutes);
16
+ const hours = NodeConstructor.fromIdentifiers(nodeIdsHours);
17
+ return `Convertir ${isMinutesToHours ? `$${minutes.toTex()}$ min` : `$${hours.toTex()}$ h`} en ${isMinutesToHours ? "heures" : "minutes"}.
18
+
19
+ Donner la valeur exacte (et pas la valeur arrondie).`;
20
+ };
21
+ const getAnswer = (identifiers) => {
22
+ const { isMinutesToHours, nodeIdsMinutes, nodeIdsHours } = identifiers;
23
+ const minutes = NodeConstructor.fromIdentifiers(nodeIdsMinutes);
24
+ const hours = NodeConstructor.fromIdentifiers(nodeIdsHours);
25
+ const answer = isMinutesToHours
26
+ ? `${hours.toTex()}\\text{h}`
27
+ : `${minutes.toTex()}\\text{min}`;
28
+ return answer;
29
+ };
30
+ const isAnswerValid = (ans, { isMinutesToHours, nodeIdsMinutes, nodeIdsHours }) => {
31
+ if (isMinutesToHours) {
32
+ if (ans.includes("\\text{min}"))
33
+ return false;
34
+ const nodeAns = parseAlgebraic(ans.replace("\\text{h}", ""));
35
+ const nodeAnswer = NodeConstructor.fromIdentifiers(nodeIdsHours);
36
+ return substract(nodeAns, nodeAnswer).evaluate() === 0;
37
+ }
38
+ else {
39
+ if (ans.includes("\\text{h}"))
40
+ return false;
41
+ const nodeAns = parseAlgebraic(ans.replace("\\text{min}", ""));
42
+ const nodeAnswer = NodeConstructor.fromIdentifiers(nodeIdsMinutes);
43
+ return substract(nodeAns, nodeAnswer).evaluate() === 0;
44
+ }
45
+ };
46
+ const getHint = (identifiers) => {
47
+ const { isMinutesToHours } = identifiers;
48
+ if (isMinutesToHours) {
49
+ return `Combien y-a-t-il d'heures dans $120$ minutes ?`;
50
+ }
51
+ else {
52
+ return `Combien y-a-t-il de minutes dans une heure ?`;
53
+ }
54
+ };
55
+ const getCorrection = (identifiers) => {
56
+ const { isMinutesToHours, nodeIdsMinutes, nodeIdsHours } = identifiers;
57
+ const minutes = NodeConstructor.fromIdentifiers(nodeIdsMinutes);
58
+ const hours = NodeConstructor.fromIdentifiers(nodeIdsHours);
59
+ return `
60
+ ${(() => {
61
+ if (isMinutesToHours) {
62
+ return `Comme il y a $60$ minutes dans une heure alors $${minutes.toTex()}$ minutes correspondent à $${frac(minutes, 60).toTex()} = ${hours.toTex()} $ ${hours.evaluate() >= 2 ? `heures` : `heure`}.`;
63
+ }
64
+ else {
65
+ return `Comme il y a $60$ minutes dans une heure alors $${hours.toTex()}$ ${hours.evaluate() >= 2 ? `heures` : `heure`} correspondent à $${hours.toTex()} \\times {60} = ${minutes.toTex()} $ minutes.`;
66
+ }
67
+ })()}
68
+
69
+ Attention, il fallait donner la valeur exacte et pas la valeur approchée.`;
70
+ };
71
+ const getPropositions = (n, { answer, ...identifiers }) => {
72
+ const { isMinutesToHours, nodeIdsMinutes, nodeIdsHours } = identifiers;
73
+ const minutes = NodeConstructor.fromIdentifiers(nodeIdsMinutes);
74
+ const hours = NodeConstructor.fromIdentifiers(nodeIdsHours);
75
+ const propositions = [];
76
+ addValidProp(propositions, answer);
77
+ if (isMinutesToHours) {
78
+ const roundedValue = round(hours.evaluate(), 2);
79
+ const texDecimal = roundedValue.frenchify().split(",")[1];
80
+ tryToAddWrongProp(propositions, `${roundedValue.frenchify()}\\text{h}`);
81
+ tryToAddWrongProp(propositions, `${multiply(minutes.evaluate(), 60).simplify().toTex()}\\text{h}`);
82
+ tryToAddWrongProp(propositions, `${frac(60, minutes).toTex()}\\text{h}`);
83
+ propWhile(propositions, n, () => {
84
+ tryToAddWrongProp(propositions, `${0},${texDecimal}\\text{h}`);
85
+ tryToAddWrongProp(propositions, `${1},${texDecimal}\\text{h}`);
86
+ });
87
+ }
88
+ else {
89
+ tryToAddWrongProp(propositions, `${round(multiply(hours.evaluate(), 60).evaluate(), 0).frenchify()}\\text{min}`);
90
+ tryToAddWrongProp(propositions, `${round(multiply(round(hours.evaluate(), 0), 60).evaluate(), 0).frenchify()}\\text{min}`);
91
+ tryToAddWrongProp(propositions, `${frac(60, hours).simplify().toTex()}\\text{min}`);
92
+ tryToAddWrongProp(propositions, `${multiply(hours, frac(1, 60)).simplify().toTex()}\\text{min}`);
93
+ tryToAddWrongProp(propositions, `${multiply(hours, frac(1, 60)).toTex()}\\text{min}`);
94
+ tryToAddWrongProp(propositions, `${round(multiply(hours, round(frac(1, 60).evaluate(), 4)).evaluate(), 0).frenchify()}\\text{min}`);
95
+ }
96
+ return shuffleProps(propositions, n);
97
+ };
98
+ const getQuestionFromIdentifiers = (identifiers) => {
99
+ const question = {
100
+ answer: getAnswer(identifiers),
101
+ instruction: getInstruction(identifiers),
102
+ keys: ["hours", "minutes"],
103
+ answerFormat: "tex",
104
+ identifiers,
105
+ hint: getHint(identifiers),
106
+ correction: getCorrection(identifiers),
107
+ };
108
+ return question;
109
+ };
110
+ const getMinutesToHoursQuestion = () => {
111
+ const isMinutesToHours = coinFlip();
112
+ let minutes;
113
+ let hours;
114
+ const dividersOf60 = dividersOf(60);
115
+ if (isMinutesToHours) {
116
+ minutes = coinFlip()
117
+ ? randint(1, 18000).toTree()
118
+ : multiply(randint(1, 101), random(dividersOf60)).evaluate().toTree();
119
+ hours = frac(minutes, 60).simplify();
120
+ }
121
+ else {
122
+ const numerator = coinFlip()
123
+ ? randint(1, 1800).toTree()
124
+ : multiply(randint(1, 21), random(dividersOf60));
125
+ hours = frac(numerator, random(dividersOf60)).simplify();
126
+ minutes = multiply(hours, 60).simplify();
127
+ }
128
+ const identifiers = {
129
+ isMinutesToHours,
130
+ nodeIdsMinutes: minutes.toIdentifiers(),
131
+ nodeIdsHours: hours.toIdentifiers(),
132
+ };
133
+ return getQuestionFromIdentifiers(identifiers);
134
+ };
135
+ export const minutesToHours = {
136
+ id: "minutesToHours",
137
+ connector: "=",
138
+ label: "Convertir une durée en minutes en une durée en heures et inversement",
139
+ isSingleStep: true,
140
+ generator: (nb) => getDistinctQuestions(getMinutesToHoursQuestion, nb),
141
+ qcmTimer: 60,
142
+ freeTimer: 60,
143
+ getPropositions,
144
+ isAnswerValid,
145
+ subject: "Mathématiques",
146
+ getQuestionFromIdentifiers,
147
+ hasHintAndCorrection: true,
148
+ shouldHaveCalculator: true,
149
+ answerType: "QCU",
150
+ };
@@ -0,0 +1,15 @@
1
+ import { Exercise } from "../../exercise.js";
2
+ type Identifiers = {
3
+ prefixIndexesPool: number[];
4
+ prefixIndex: number;
5
+ isToPow10: boolean;
6
+ isFromSymbol: boolean;
7
+ };
8
+ type Options = {
9
+ prefixPool: string[];
10
+ isToPow10: boolean;
11
+ isFromSymbol: boolean;
12
+ };
13
+ export declare const prefixToNumber: Exercise<Identifiers, Options>;
14
+ export {};
15
+ //# sourceMappingURL=prefixToNumber.d.ts.map
@@ -0,0 +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;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"}
@@ -0,0 +1,243 @@
1
+ import { power } from "../../../tree/nodes/operators/powerNode.js";
2
+ import { substract } from "../../../tree/nodes/operators/substractNode.js";
3
+ import { parseAlgebraic } from "../../../tree/parsers/latexParser.js";
4
+ import { random } from "../../../utils/alea/random.js";
5
+ import { shuffle } from "../../../utils/alea/shuffle.js";
6
+ import { mdTable } from "../../../utils/markdown/mdTable.js";
7
+ import { GeneratorOptionTarget, GeneratorOptionType, addValidProp, propWhile, tryToAddWrongProp, } from "../../exercise.js";
8
+ import { getDistinctQuestions } from "../../utils/getDistinctQuestions.js";
9
+ const prefixes = [
10
+ {
11
+ name: "Déca",
12
+ symbol: "da",
13
+ meaning: "dix",
14
+ superscript: 1,
15
+ texPow10: power(10, 1).toTex(),
16
+ texValue: "10",
17
+ },
18
+ {
19
+ name: "Hecto",
20
+ symbol: "h",
21
+ meaning: "cent",
22
+ superscript: 2,
23
+ texPow10: power(10, 2).toTex(),
24
+ texValue: "100",
25
+ },
26
+ {
27
+ name: "Kilo",
28
+ symbol: "k",
29
+ meaning: "mille",
30
+ superscript: 3,
31
+ texPow10: power(10, 3).toTex(),
32
+ texValue: "1 000",
33
+ },
34
+ {
35
+ name: "Méga",
36
+ symbol: "M",
37
+ meaning: "million",
38
+ superscript: 6,
39
+ texPow10: power(10, 6).toTex(),
40
+ texValue: "1 000 000",
41
+ },
42
+ {
43
+ name: "Giga",
44
+ symbol: "G",
45
+ meaning: "milliard",
46
+ superscript: 9,
47
+ texPow10: power(10, 9).toTex(),
48
+ texValue: "1 000 000 000",
49
+ },
50
+ {
51
+ name: "Déci",
52
+ symbol: "d",
53
+ meaning: "dixième de",
54
+ superscript: -1,
55
+ texPow10: power(10, -1).toTex(),
56
+ texValue: "0,1",
57
+ },
58
+ {
59
+ name: "Centi",
60
+ symbol: "c",
61
+ meaning: "centième de",
62
+ superscript: -2,
63
+ texPow10: power(10, -2).toTex(),
64
+ texValue: "0,01",
65
+ },
66
+ {
67
+ name: "Milli",
68
+ symbol: "m",
69
+ meaning: "millième de",
70
+ superscript: -3,
71
+ texPow10: power(10, -3).toTex(),
72
+ texValue: "0,001",
73
+ },
74
+ {
75
+ name: "Micro",
76
+ symbol: "\\mu",
77
+ meaning: "millionième de",
78
+ superscript: -6,
79
+ texPow10: power(10, -6).toTex(),
80
+ texValue: "0,000 001",
81
+ },
82
+ {
83
+ name: "Nano",
84
+ symbol: "n",
85
+ meaning: "milliardième de",
86
+ superscript: -9,
87
+ texPow10: power(10, -9).toTex(),
88
+ texValue: "0,000 000 001",
89
+ },
90
+ ].toSorted((prefix1, prefix2) => prefix1.superscript - prefix2.superscript);
91
+ const getMdTable = (prefixes, indexBold = -1) => {
92
+ function boldify(str) {
93
+ return `**${str}**`;
94
+ }
95
+ const isBolded = 0 <= indexBold && indexBold < prefixes.length;
96
+ return mdTable([
97
+ ["Préfixe", "Symbole", "Signification", "Puissance"],
98
+ ...prefixes
99
+ .filter((_, i) => (isBolded ? i === indexBold : true))
100
+ .map((prefix, i) => [
101
+ prefix.name,
102
+ `$${prefix.symbol}$`,
103
+ prefix.meaning,
104
+ `$${prefix.texPow10}$`,
105
+ ].map((str) => (i === indexBold ? boldify(str) : str))),
106
+ ]);
107
+ };
108
+ const getInstruction = (identifiers) => {
109
+ const { prefixIndex, isFromSymbol, isToPow10 } = identifiers;
110
+ const prefix = prefixes[prefixIndex];
111
+ return `Quelle est la valeur du préfixe ${isFromSymbol ? `$${prefix.symbol}$` : prefix.name} ?
112
+
113
+ Ecrire la réponse sous la forme ${isToPow10 ? `d'une puissance de $10$` : `d'un nombre décimal`}.`;
114
+ };
115
+ const getHint = (identifiers) => {
116
+ const { prefixIndexesPool } = identifiers;
117
+ const prefixPool = prefixIndexesPool.map((i) => prefixes[i]);
118
+ return getMdTable(prefixPool);
119
+ };
120
+ const getCorrection = (identifiers) => {
121
+ const { prefixIndexesPool, prefixIndex, isToPow10 } = identifiers;
122
+ const prefix = prefixes[prefixIndex];
123
+ const prefixPool = prefixIndexesPool.map((i) => prefixes[i]);
124
+ const indexBold = (() => {
125
+ for (let i = 0; i < prefixIndexesPool.length; i++) {
126
+ if (prefixIndexesPool[i] === prefixIndex)
127
+ return i;
128
+ }
129
+ })();
130
+ return `Voici un tableau récapitulatif :
131
+
132
+ ${getMdTable(prefixPool, indexBold)}
133
+
134
+ ${!isToPow10
135
+ ? `$${prefix.texPow10}$ correspond à l'écriture décimale $${prefix.texValue}$.`
136
+ : ``}`;
137
+ };
138
+ const getAnswer = (identifiers) => {
139
+ const { prefixIndex, isToPow10 } = identifiers;
140
+ const prefix = prefixes[prefixIndex];
141
+ return isToPow10 ? prefix.texPow10 : prefix.texValue;
142
+ };
143
+ const getPropositions = (n, { answer, ...identifiers }) => {
144
+ const { prefixIndexesPool, prefixIndex, isToPow10 } = identifiers;
145
+ const propositions = [];
146
+ addValidProp(propositions, answer);
147
+ const wrongIndexesPool = prefixIndexesPool.filter((i) => i !== prefixIndex);
148
+ let availableWrongPrefixIndexes = wrongIndexesPool.length >= n - 1
149
+ ? wrongIndexesPool
150
+ : prefixes.map((_, i) => i).filter((i) => i !== prefixIndex);
151
+ propWhile(propositions, n, () => {
152
+ const wrongPrefixIndex = random(availableWrongPrefixIndexes);
153
+ const wrongPrefix = prefixes[wrongPrefixIndex];
154
+ const wrongTex = isToPow10 ? wrongPrefix.texPow10 : wrongPrefix.texValue;
155
+ tryToAddWrongProp(propositions, wrongTex);
156
+ availableWrongPrefixIndexes = availableWrongPrefixIndexes.filter((i) => i !== wrongPrefixIndex);
157
+ });
158
+ return shuffle(propositions);
159
+ };
160
+ const isAnswerValid = (ans, { answer }) => {
161
+ const nodeAns = parseAlgebraic(ans);
162
+ const nodeAnswer = parseAlgebraic(answer);
163
+ return substract(nodeAns, nodeAnswer).evaluate() === 0;
164
+ };
165
+ const optionsDefault = {
166
+ prefixPool: prefixes.map((prefix) => prefix.name),
167
+ isToPow10: [true, false],
168
+ isFromSymbol: [true, false],
169
+ };
170
+ const options = [
171
+ {
172
+ id: "prefixPool",
173
+ label: "N'utiliser que les préfixes suivants :",
174
+ type: GeneratorOptionType.multiselect,
175
+ target: GeneratorOptionTarget.generation,
176
+ values: prefixes.map((prefix) => prefix.name),
177
+ },
178
+ {
179
+ id: "isToPow10",
180
+ label: "Réponse sous forme de puissance de 10 ?",
181
+ type: GeneratorOptionType.checkbox,
182
+ target: GeneratorOptionTarget.generation,
183
+ values: optionsDefault.isToPow10,
184
+ },
185
+ {
186
+ id: "units",
187
+ label: "Utiliser le symbole pour la question ?",
188
+ type: GeneratorOptionType.checkbox,
189
+ target: GeneratorOptionTarget.generation,
190
+ values: optionsDefault.isFromSymbol,
191
+ },
192
+ ];
193
+ const getPrefixToNumberQuestion = (optsIn) => {
194
+ const opts = optsIn ? Object.assign(optionsDefault, optsIn) : optionsDefault;
195
+ const prefixIndexesPool = opts.prefixPool.map((prefixName) => {
196
+ const prefixIndex = (() => {
197
+ for (let i = 0; i < prefixes.length; i++) {
198
+ if (prefixes[i].name === prefixName)
199
+ return i;
200
+ }
201
+ })();
202
+ return prefixIndex;
203
+ }) ?? optionsDefault.prefixPool;
204
+ const prefixIndex = random(prefixIndexesPool);
205
+ const isFromSymbol = optsIn?.isFromSymbol ?? random(optionsDefault.isFromSymbol);
206
+ const isToPow10 = optsIn?.isToPow10 ?? random(optionsDefault.isToPow10);
207
+ const identifiers = {
208
+ prefixIndexesPool,
209
+ prefixIndex,
210
+ isFromSymbol,
211
+ isToPow10,
212
+ };
213
+ return getQuestionFromIdentifiers(identifiers, optsIn);
214
+ };
215
+ const getQuestionFromIdentifiers = (identifiers, opts) => {
216
+ const question = {
217
+ instruction: getInstruction(identifiers, opts),
218
+ answer: getAnswer(identifiers, opts),
219
+ keys: [],
220
+ answerFormat: "tex",
221
+ identifiers,
222
+ hint: getHint(identifiers),
223
+ correction: getCorrection(identifiers),
224
+ };
225
+ return question;
226
+ };
227
+ export const prefixToNumber = {
228
+ id: "prefixToNumber",
229
+ connector: "=",
230
+ label: "Convertir un préfixe en nombre",
231
+ isSingleStep: true,
232
+ generator: (nb, opts) => getDistinctQuestions(() => getPrefixToNumberQuestion(opts), nb),
233
+ qcmTimer: 60,
234
+ freeTimer: 60,
235
+ getPropositions,
236
+ isAnswerValid,
237
+ subject: "Mathématiques",
238
+ getAnswer,
239
+ getInstruction,
240
+ options,
241
+ hasHintAndCorrection: true,
242
+ getQuestionFromIdentifiers,
243
+ };
@@ -0,0 +1,10 @@
1
+ import { Exercise } from "../../../exercises/exercise.js";
2
+ import { NodeIdentifiers } from "../../../tree/nodes/nodeConstructor.js";
3
+ type Identifiers = {
4
+ isSecondsToHours: boolean;
5
+ nodeIdsSeconds: NodeIdentifiers;
6
+ nodeIdsHours: NodeIdentifiers;
7
+ };
8
+ export declare const secondsToHours: Exercise<Identifiers>;
9
+ export {};
10
+ //# sourceMappingURL=secondsToHours.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"secondsToHours.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/conversion/secondsToHours.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,CAiBhD,CAAC"}