math-exercises 3.0.125 → 3.0.126

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 +217 -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 +221 -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 +135 -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 +367 -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 +414 -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 +107 -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 +182 -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 +178 -241
  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 +8 -0
  97. package/lib/exercises/math/conversion/kmPerMinToKmPerHourConversion.d.ts.map +1 -0
  98. package/lib/exercises/math/conversion/kmPerMinToKmPerHourConversion.js +98 -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 +233 -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 +50 -0
  109. package/lib/exercises/math/dataRepresentations/barChartInterpreting.d.ts.map +1 -0
  110. package/lib/exercises/math/dataRepresentations/barChartInterpreting.js +517 -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 +139 -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 +145 -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 +103 -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 +100 -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 +206 -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 +13 -0
  162. package/lib/exercises/math/functions/affines/representationOfAffine.d.ts.map +1 -0
  163. package/lib/exercises/math/functions/affines/representationOfAffine.js +184 -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 +216 -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 +42 -80
  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 +217 -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 +30 -0
  207. package/lib/exercises/math/probaStat/probaAsSumOfProbas.d.ts.map +1 -0
  208. package/lib/exercises/math/probaStat/probaAsSumOfProbas.js +548 -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 +90 -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 +151 -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 +346 -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,98 @@
1
+ import { 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) => {
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}$ ) ?`;
14
+ };
15
+ const getAnswer = (identifiers) => {
16
+ const { distance, minutes } = identifiers;
17
+ const nodeAnswer = multiply(distance, frac(60, minutes));
18
+ return `${nodeAnswer.simplify().toTex()}km.h^{-1}`;
19
+ };
20
+ const isAnswerValid = (ans, { distance, minutes }) => {
21
+ const nodeAnswer = multiply(distance, frac(60, minutes));
22
+ const nodeAns = parseAlgebraic(ans.replace("$km.h^{-1}$", "").replace("km/h", ""));
23
+ return substract(nodeAns, nodeAnswer).evaluate() === 0;
24
+ };
25
+ const getHint = () => {
26
+ return `Combien de minutes constituent une heure ?`;
27
+ };
28
+ const getCorrection = (identifiers) => {
29
+ const { distance, minutes } = identifiers;
30
+ return `En $60$ minutes, on parcourt $${multiply(distance, frac(60, minutes)).toTex()}$ km
31
+ donc la vitesse est de $${multiply(distance, frac(60, minutes).simplify()).toTex()} = ${multiply(distance, frac(60, minutes))
32
+ .simplify()
33
+ .toTex()}$ $km.h^{-1}$`;
34
+ };
35
+ const getPropositions = (n, { answer, distance, minutes }) => {
36
+ const propositions = [];
37
+ 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}`);
41
+ return shuffleProps(propositions, n);
42
+ };
43
+ const getKmPerMinToKmPerHourConversionQuestion = () => {
44
+ const distance = randint(1, 101);
45
+ const minutes = random(dividersOf(60));
46
+ const identifiers = {
47
+ distance,
48
+ minutes,
49
+ };
50
+ return getQuestionFromIdentifiers(identifiers);
51
+ };
52
+ const getQuestionFromIdentifiers = (identifiers) => {
53
+ const question = {
54
+ answer: getAnswer(identifiers),
55
+ instruction: getInstruction(identifiers),
56
+ keys: [
57
+ {
58
+ id: "custom",
59
+ label: "{km}.{h}^{-1}",
60
+ labelType: "tex",
61
+ mathfieldInstructions: {
62
+ 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",
73
+ },
74
+ },
75
+ ],
76
+ answerFormat: "tex",
77
+ identifiers,
78
+ hint: getHint(identifiers),
79
+ correction: getCorrection(identifiers),
80
+ };
81
+ return question;
82
+ };
83
+ export const kmPerMinToKmPerHourConversion = {
84
+ id: "kmPerMinToKmPerHourConversion",
85
+ connector: "=",
86
+ label: "Effectuer des conversions de vitesse ( $x$ km en $y$ min donne une vitesse $V$ en km/h)",
87
+ isSingleStep: true,
88
+ generator: (nb) => getDistinctQuestions(getKmPerMinToKmPerHourConversionQuestion, nb),
89
+ qcmTimer: 60,
90
+ freeTimer: 60,
91
+ getPropositions,
92
+ isAnswerValid,
93
+ subject: "Mathématiques",
94
+ getQuestionFromIdentifiers,
95
+ hasHintAndCorrection: true,
96
+ shouldHaveCalculator: true,
97
+ answerType: "QCU",
98
+ };
@@ -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;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"}
@@ -0,0 +1,233 @@
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
+ return mdTable([
96
+ ["Préfixe", "Symbole", "Signification", "Puissance"],
97
+ ...prefixes.map((prefix, i) => [
98
+ prefix.name,
99
+ `$${prefix.symbol}$`,
100
+ prefix.meaning,
101
+ `$${prefix.texPow10}$`,
102
+ ].map((str) => (i === indexBold ? boldify(str) : str))),
103
+ ]);
104
+ };
105
+ const getInstruction = (identifiers) => {
106
+ const { prefixIndex, isFromSymbol, isToPow10 } = identifiers;
107
+ const prefix = prefixes[prefixIndex];
108
+ return `Quelle est la valeur du préfixe ${isFromSymbol ? `$${prefix.symbol}$` : prefix.name} ?
109
+
110
+ Ecris la réponse sous la forme ${isToPow10 ? `d'une puissance de $10$` : `d'un nombre décimal`}.`;
111
+ };
112
+ const getHint = (identifiers) => {
113
+ const { prefixIndexesPool } = identifiers;
114
+ const prefixPool = prefixIndexesPool.map((i) => prefixes[i]);
115
+ return getMdTable(prefixPool);
116
+ };
117
+ const getCorrection = (identifiers) => {
118
+ const { prefixIndexesPool, prefixIndex } = identifiers;
119
+ const prefixPool = prefixIndexesPool.map((i) => prefixes[i]);
120
+ const indexBold = (() => {
121
+ for (let i = 0; i < prefixIndexesPool.length; i++) {
122
+ if (prefixIndexesPool[i] === prefixIndex)
123
+ return i;
124
+ }
125
+ })();
126
+ return getMdTable(prefixPool, indexBold);
127
+ };
128
+ const getAnswer = (identifiers) => {
129
+ const { prefixIndex, isToPow10 } = identifiers;
130
+ const prefix = prefixes[prefixIndex];
131
+ return isToPow10 ? prefix.texPow10 : prefix.texValue;
132
+ };
133
+ const getPropositions = (n, { answer, ...identifiers }) => {
134
+ const { prefixIndexesPool, prefixIndex, isToPow10 } = identifiers;
135
+ const propositions = [];
136
+ addValidProp(propositions, answer);
137
+ const wrongIndexesPool = prefixIndexesPool.filter((i) => i !== prefixIndex);
138
+ let availableWrongPrefixIndexes = wrongIndexesPool.length >= n - 1
139
+ ? wrongIndexesPool
140
+ : prefixes.map((_, i) => i).filter((i) => i !== prefixIndex);
141
+ propWhile(propositions, n, () => {
142
+ const wrongPrefixIndex = random(availableWrongPrefixIndexes);
143
+ const wrongPrefix = prefixes[wrongPrefixIndex];
144
+ const wrongTex = isToPow10 ? wrongPrefix.texPow10 : wrongPrefix.texValue;
145
+ tryToAddWrongProp(propositions, wrongTex);
146
+ availableWrongPrefixIndexes = availableWrongPrefixIndexes.filter((i) => i !== wrongPrefixIndex);
147
+ });
148
+ return shuffle(propositions);
149
+ };
150
+ const isAnswerValid = (ans, { answer }) => {
151
+ const nodeAns = parseAlgebraic(ans);
152
+ const nodeAnswer = parseAlgebraic(answer);
153
+ return substract(nodeAns, nodeAnswer).evaluate() === 0;
154
+ };
155
+ const optionsDefault = {
156
+ prefixPool: prefixes.map((prefix) => prefix.name),
157
+ isToPow10: [true, false],
158
+ isFromSymbol: [true, false],
159
+ };
160
+ const options = [
161
+ {
162
+ id: "prefixPool",
163
+ label: "N'utiliser que les préfixes suivants :",
164
+ type: GeneratorOptionType.multiselect,
165
+ target: GeneratorOptionTarget.generation,
166
+ values: prefixes.map((prefix) => prefix.name),
167
+ },
168
+ {
169
+ id: "isToPow10",
170
+ label: "Réponse sous forme de puissance de 10 ?",
171
+ type: GeneratorOptionType.checkbox,
172
+ target: GeneratorOptionTarget.generation,
173
+ values: optionsDefault.isToPow10,
174
+ },
175
+ {
176
+ id: "units",
177
+ label: "Utiliser le symbole pour la question ?",
178
+ type: GeneratorOptionType.checkbox,
179
+ target: GeneratorOptionTarget.generation,
180
+ values: optionsDefault.isFromSymbol,
181
+ },
182
+ ];
183
+ const getPrefixToNumberQuestion = (optsIn) => {
184
+ const opts = optsIn ? Object.assign(optionsDefault, optsIn) : optionsDefault;
185
+ const prefixIndexesPool = opts.prefixPool.map((prefixName) => {
186
+ const prefixIndex = (() => {
187
+ for (let i = 0; i < prefixes.length; i++) {
188
+ if (prefixes[i].name === prefixName)
189
+ return i;
190
+ }
191
+ })();
192
+ return prefixIndex;
193
+ }) ?? optionsDefault.prefixPool;
194
+ const prefixIndex = random(prefixIndexesPool);
195
+ const isFromSymbol = optsIn?.isFromSymbol ?? random(optionsDefault.isFromSymbol);
196
+ const isToPow10 = optsIn?.isToPow10 ?? random(optionsDefault.isToPow10);
197
+ const identifiers = {
198
+ prefixIndexesPool,
199
+ prefixIndex,
200
+ isFromSymbol,
201
+ isToPow10,
202
+ };
203
+ return getQuestionFromIdentifiers(identifiers, optsIn);
204
+ };
205
+ const getQuestionFromIdentifiers = (identifiers, opts) => {
206
+ const question = {
207
+ instruction: getInstruction(identifiers, opts),
208
+ answer: getAnswer(identifiers, opts),
209
+ keys: [],
210
+ answerFormat: "tex",
211
+ identifiers,
212
+ hint: getHint(identifiers),
213
+ correction: getCorrection(identifiers),
214
+ };
215
+ return question;
216
+ };
217
+ export const prefixToNumber = {
218
+ id: "prefixToNumber",
219
+ connector: "=",
220
+ label: "Convertir un préfixe en nombre",
221
+ isSingleStep: true,
222
+ generator: (nb, opts) => getDistinctQuestions(() => getPrefixToNumberQuestion(opts), nb),
223
+ qcmTimer: 60,
224
+ freeTimer: 60,
225
+ getPropositions,
226
+ isAnswerValid,
227
+ subject: "Mathématiques",
228
+ getAnswer,
229
+ getInstruction,
230
+ options,
231
+ hasHintAndCorrection: true,
232
+ getQuestionFromIdentifiers,
233
+ };
@@ -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"}
@@ -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 { isSecondsToHours, nodeIdsSeconds, nodeIdsHours } = identifiers;
15
+ const seconds = NodeConstructor.fromIdentifiers(nodeIdsSeconds);
16
+ const hours = NodeConstructor.fromIdentifiers(nodeIdsHours);
17
+ return `Convertir ${isSecondsToHours ? `$${seconds.toTex()}$ s` : `$${hours.toTex()}$ h`} en ${isSecondsToHours ? "heures" : "secondes"}.
18
+
19
+ Donner la valeur exacte (et pas la valeur arrondie).`;
20
+ };
21
+ const getAnswer = (identifiers) => {
22
+ const { isSecondsToHours, nodeIdsSeconds, nodeIdsHours } = identifiers;
23
+ const seconds = NodeConstructor.fromIdentifiers(nodeIdsSeconds);
24
+ const hours = NodeConstructor.fromIdentifiers(nodeIdsHours);
25
+ const answer = isSecondsToHours
26
+ ? `${hours.toTex()}\\text{h}`
27
+ : `${seconds.toTex()}\\text{s}`;
28
+ return answer;
29
+ };
30
+ const isAnswerValid = (ans, { isSecondsToHours, nodeIdsSeconds, nodeIdsHours }) => {
31
+ if (isSecondsToHours) {
32
+ if (ans.includes("\\text{s}"))
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{s}", ""));
42
+ const nodeAnswer = NodeConstructor.fromIdentifiers(nodeIdsSeconds);
43
+ return substract(nodeAns, nodeAnswer).evaluate() === 0;
44
+ }
45
+ };
46
+ const getHint = (identifiers) => {
47
+ const { isSecondsToHours } = identifiers;
48
+ if (isSecondsToHours) {
49
+ return `Combien y-a-t-il d'heures dans $7200$ secondes ?`;
50
+ }
51
+ else {
52
+ return `Combien y-a-t-il de secondes dans une heure ?`;
53
+ }
54
+ };
55
+ const getCorrection = (identifiers) => {
56
+ const { isSecondsToHours, nodeIdsSeconds, nodeIdsHours } = identifiers;
57
+ const seconds = NodeConstructor.fromIdentifiers(nodeIdsSeconds);
58
+ const hours = NodeConstructor.fromIdentifiers(nodeIdsHours);
59
+ return `
60
+ ${(() => {
61
+ if (isSecondsToHours) {
62
+ return `Comme il y a $3600$ secondes dans une heure alors $${seconds.toTex()}$ minutes correspondent à $${frac(seconds, 3600).toTex()} = ${hours.toTex()} $ ${hours.evaluate() >= 2 ? `heures` : `heure`}.`;
63
+ }
64
+ else {
65
+ return `Comme il y a $3600$ secondes dans une heure alors $${hours.toTex()}$ ${hours.evaluate() >= 2 ? `heures` : `heure`} correspondent à $${hours.toTex()} \\times {3600} = ${seconds.toTex()} $ secondes.`;
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 { isSecondsToHours, nodeIdsSeconds, nodeIdsHours } = identifiers;
73
+ const seconds = NodeConstructor.fromIdentifiers(nodeIdsSeconds);
74
+ const hours = NodeConstructor.fromIdentifiers(nodeIdsHours);
75
+ const propositions = [];
76
+ addValidProp(propositions, answer);
77
+ if (isSecondsToHours) {
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(seconds.evaluate(), 3600).simplify().toTex()}\\text{h}`);
82
+ tryToAddWrongProp(propositions, `${frac(3600, seconds).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(), 3600).evaluate(), 0).frenchify()}\\text{s}`);
90
+ tryToAddWrongProp(propositions, `${round(multiply(round(hours.evaluate(), 0), 3600).evaluate(), 0).frenchify()}\\text{s}`);
91
+ tryToAddWrongProp(propositions, `${frac(3600, hours).simplify().toTex()}\\text{s}`);
92
+ tryToAddWrongProp(propositions, `${multiply(hours, frac(1, 3600)).simplify().toTex()}\\text{s}`);
93
+ tryToAddWrongProp(propositions, `${multiply(hours, frac(1, 3600)).toTex()}\\text{s}`);
94
+ tryToAddWrongProp(propositions, `${round(multiply(hours, round(frac(1, 3600).evaluate(), 4)).evaluate(), 0).frenchify()}\\text{s}`);
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 isSecondsToHours = coinFlip();
112
+ let seconds;
113
+ let hours;
114
+ const dividersOf3600 = dividersOf(3600);
115
+ if (isSecondsToHours) {
116
+ seconds = coinFlip()
117
+ ? randint(1, 18000).toTree()
118
+ : multiply(randint(1, 101), random(dividersOf3600)).evaluate().toTree();
119
+ hours = frac(seconds, 3600).simplify();
120
+ }
121
+ else {
122
+ const numerator = coinFlip()
123
+ ? randint(1, 1800).toTree()
124
+ : multiply(randint(1, 21), random(dividersOf3600));
125
+ hours = frac(numerator, random(dividersOf3600)).simplify();
126
+ seconds = multiply(hours, 3600).simplify();
127
+ }
128
+ const identifiers = {
129
+ isSecondsToHours,
130
+ nodeIdsSeconds: seconds.toIdentifiers(),
131
+ nodeIdsHours: hours.toIdentifiers(),
132
+ };
133
+ return getQuestionFromIdentifiers(identifiers);
134
+ };
135
+ export const secondsToHours = {
136
+ id: "secondsToHours",
137
+ connector: "=",
138
+ label: "Convertir une durée en secondes 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
+ };