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,454 @@
1
+ import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { randfloat } from "../../../../math/utils/random/randfloat.js";
4
+ import { randint } from "../../../../math/utils/random/randint.js";
5
+ import { round } from "../../../../math/utils/round.js";
6
+ import { EqualNode, isEqualNode, } from "../../../../tree/nodes/equations/equalNode.js";
7
+ import { add } from "../../../../tree/nodes/operators/addNode.js";
8
+ import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
9
+ import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
10
+ import { substract } from "../../../../tree/nodes/operators/substractNode.js";
11
+ import { random, randomMany } from "../../../../utils/alea/random.js";
12
+ import { isOperatorNode, OperatorIds, } from "../../../../tree/nodes/operators/operatorNode.js";
13
+ import { parseLatex } from "../../../../tree/parsers/latexParser.js";
14
+ import { mdTable } from "../../../../utils/markdown/mdTable.js";
15
+ import { alignTex } from "../../../../utils/latex/alignTex.js";
16
+ class ProblemConstructor {
17
+ static byHydratingSkeleton(skeleton, groupNameToVarNameToValue, mysteryVarPath, shuffleArrays) {
18
+ const shuffleFuncs = shuffleArrays.map((shuffleArray) => {
19
+ return (array) => {
20
+ return array.map((_, i) => array[shuffleArray[i]]);
21
+ };
22
+ });
23
+ const groups = Object.fromEntries(Object.entries(skeleton.groups).map(([gpName, gp]) => {
24
+ const vars = Object.fromEntries(Object.entries(gp.vars).map(([varName, varSkeleton]) => {
25
+ const node = groupNameToVarNameToValue[gpName][varName];
26
+ return [varName, new ProblemVar(varSkeleton, node)];
27
+ }));
28
+ return [gpName, new ProblemVarGroup(gp, vars)];
29
+ }));
30
+ const [mysteryGroupName, mysteryVarNameInGroup] = mysteryVarPath.split(".");
31
+ const mysteryGroup = groups[mysteryGroupName];
32
+ const mysteryVar = mysteryGroup.vars[mysteryVarNameInGroup];
33
+ return new Problem(skeleton, groups, mysteryGroup, mysteryVar, shuffleFuncs);
34
+ }
35
+ }
36
+ class Problem {
37
+ skeleton;
38
+ groups;
39
+ mysteryGroup;
40
+ mysteryVar;
41
+ shuffleFuncs;
42
+ equalNode;
43
+ frenchStr;
44
+ constructor(skeleton, groups, mysteryGroup, mysteryVar, shuffleFuncs) {
45
+ this.skeleton = skeleton;
46
+ this.groups = groups;
47
+ this.mysteryGroup = mysteryGroup;
48
+ this.mysteryVar = mysteryVar;
49
+ this.shuffleFuncs = shuffleFuncs;
50
+ this.equalNode = this.skeleton.equalNodeFunc(mysteryGroup, mysteryVar, groups, shuffleFuncs);
51
+ this.frenchStr = this.skeleton.strFunc(mysteryGroup, mysteryVar, groups, shuffleFuncs);
52
+ //populate computed groups
53
+ Object.values(groups)
54
+ .filter((group) => group.skeleton.isComputed)
55
+ .forEach((group) => {
56
+ Object.values(group.vars).forEach((problemVar) => {
57
+ if (problemVar.value === undefined) {
58
+ problemVar.value = group.getNode(mysteryVar, groups, shuffleFuncs);
59
+ }
60
+ });
61
+ });
62
+ }
63
+ getArrayOfUsefulVarNames() {
64
+ return [this.mysteryVar.skeleton.varName];
65
+ }
66
+ getArrayOfUsefulNodes() {
67
+ return Object.values(this.groups).flatMap((group) => {
68
+ return Object.values(group.vars)
69
+ .flatMap((problemVar) => problemVar === this.mysteryVar
70
+ ? problemVar.getVarNode()
71
+ : problemVar.getValueNode())
72
+ .filter((node) => !!node);
73
+ });
74
+ }
75
+ getExplanationString() {
76
+ const arrArr = Object.values(this.groups).map((group) => [
77
+ `\\text{${group.getScalarString(this.mysteryVar).replaceAll("$", "")}}`,
78
+ `:`,
79
+ `${group
80
+ .getNode(this.mysteryVar, this.groups, this.shuffleFuncs)
81
+ .toTex()}`,
82
+ ]);
83
+ return alignTex(arrArr, false);
84
+ }
85
+ }
86
+ class ProblemVarGroup {
87
+ skeleton;
88
+ vars;
89
+ constructor(skeleton, vars) {
90
+ this.skeleton = skeleton;
91
+ this.vars = vars;
92
+ }
93
+ toTex(mysteryVar) {
94
+ return this.skeleton.strFunc(this, mysteryVar);
95
+ }
96
+ getNode(mysteryVar, groups, shuffleFuncs) {
97
+ return this.skeleton.nodeFunc(this, mysteryVar, groups, shuffleFuncs);
98
+ }
99
+ getScalarString(mysteryVar) {
100
+ return `${this.skeleton.strToScalar} ${this.toTex(mysteryVar)}`;
101
+ }
102
+ }
103
+ class ProblemVar {
104
+ skeleton;
105
+ value;
106
+ constructor(skeleton, value) {
107
+ this.skeleton = skeleton;
108
+ this.value = value;
109
+ }
110
+ getVarNode() {
111
+ return this.skeleton.varName.toTree();
112
+ }
113
+ getValueNode() {
114
+ return this.value;
115
+ }
116
+ }
117
+ class ProblemVarSkeletonGroup {
118
+ vars;
119
+ strToScalar;
120
+ strFunc;
121
+ nodeFunc;
122
+ isCanBeMysteryGroup;
123
+ isComputed;
124
+ constructor(vars, strToScalar, strFunc, nodeFunc, isCanBeMysteryGroup, isComputed) {
125
+ this.vars = vars;
126
+ this.strToScalar = strToScalar;
127
+ this.strFunc = strFunc;
128
+ this.nodeFunc = nodeFunc;
129
+ this.isCanBeMysteryGroup = isCanBeMysteryGroup;
130
+ this.isComputed = isComputed;
131
+ }
132
+ createRandomValuesDict() {
133
+ return Object.fromEntries(Object.entries(this.vars)
134
+ .filter(([_, varSkeleton]) => !!varSkeleton.randNode)
135
+ .map(([varName, varSkeleton]) => {
136
+ return [varName, varSkeleton.randNode()];
137
+ }));
138
+ }
139
+ }
140
+ class ProblemSkeleton {
141
+ sampleStr;
142
+ strFunc;
143
+ equalNodeFunc;
144
+ groups;
145
+ swappableGroups;
146
+ constructor(sampleStr, strFunc, equalNodeFunc, groups, swappableGroups) {
147
+ this.sampleStr = sampleStr;
148
+ this.strFunc = strFunc;
149
+ this.equalNodeFunc = equalNodeFunc;
150
+ this.groups = groups;
151
+ this.swappableGroups = swappableGroups;
152
+ }
153
+ createRandomValuesDict() {
154
+ return Object.fromEntries(Object.entries(this.groups).map(([gpName, gp]) => {
155
+ return [gpName, gp.createRandomValuesDict()];
156
+ }));
157
+ }
158
+ createRandomMysteryVarPath() {
159
+ const [groupName, group] = random(Object.entries(this.groups).filter(([_, group]) => group.isCanBeMysteryGroup));
160
+ const [groupVarNameInGroup, _] = random(Object.entries(group.vars));
161
+ return `${groupName}.${groupVarNameInGroup}`;
162
+ }
163
+ createRandomShuffleArrays() {
164
+ return this.swappableGroups.map((arrayOfGroupNames) => {
165
+ return randomMany([...Array(arrayOfGroupNames.length).keys()], arrayOfGroupNames.length);
166
+ });
167
+ }
168
+ }
169
+ const skeletons = [
170
+ new ProblemSkeleton(`Clara a acheté des ingrédients pour réaliser des pizzas.
171
+ Elle a pris trois pâtes à pizza à 1,95 € l’unité et deux pots de sauce tomate.
172
+ Elle a payé au total 8,37 €.
173
+ Quel est le prix, noté a, d'un pot de sauce ?`, (_group, mysteryVar, groups, shuffleFuncs) => {
174
+ const { total, ...groupsWithoutTotal } = groups;
175
+ const [gp1, gp2] = shuffleFuncs[0](Object.values(groupsWithoutTotal));
176
+ return `Clara a acheté des ingrédients pour réaliser des pizzas. Elle a pris ${gp1.toTex(mysteryVar)} et, dans un autre rayon, ${gp2.toTex(mysteryVar)}. Elle a payé au total $${total
177
+ .getNode(mysteryVar, groups, shuffleFuncs)
178
+ .toTex()}$ €. ${mysteryVar.skeleton.question}`;
179
+ }, (_group, mysteryVar, groups, shuffleFuncs) => {
180
+ const { pizza, sauce } = groups;
181
+ const [gp1, gp2] = shuffleFuncs[0]([pizza, sauce]);
182
+ return new EqualNode(add(gp1.getNode(mysteryVar), gp2.getNode(mysteryVar)), groups.total.getNode(mysteryVar, groups, shuffleFuncs));
183
+ }, {
184
+ pizza: new ProblemVarSkeletonGroup({
185
+ count: {
186
+ varName: "n",
187
+ str: "le nombre de pâtes à pizza",
188
+ question: `Quel est le nombre, noté $n$, de pâtes à pizza ?`,
189
+ randNode() {
190
+ return randint(1, 11, []).toTree();
191
+ },
192
+ },
193
+ price: {
194
+ varName: "p",
195
+ str: "le prix d'une pâte à pizza",
196
+ question: `Quel est le prix, noté $p$, d'une pâte à pizza ?`,
197
+ randNode() {
198
+ return randfloat(0.5, 4, 2, []).toTree();
199
+ },
200
+ },
201
+ }, "le coût pour", (group, mysteryVar) => {
202
+ switch (mysteryVar?.skeleton.varName) {
203
+ case "n":
204
+ return `des pâtes à pizza à $${group.vars.price.value.toTex()}$ € l’unité`;
205
+ case "p": {
206
+ const isPlural = group.vars.count.value.evaluate() >= 2;
207
+ return `$${group.vars.count.value.toTex()}$ ${"pâte" + (isPlural ? "s" : "")} à pizza`;
208
+ }
209
+ default: {
210
+ const isPlural = group.vars.count.value.evaluate() >= 2;
211
+ return `$${group.vars.count.value.toTex()}$ ${"pâte" + (isPlural ? "s" : "")} à pizza à $${group.vars.price.value.toTex()}$ € l’unité`;
212
+ }
213
+ }
214
+ }, (group, mysteryVar) => {
215
+ const varCount = group.vars.count;
216
+ const varPrice = group.vars.price;
217
+ return multiply(varCount === mysteryVar
218
+ ? varCount.getVarNode()
219
+ : varCount.getValueNode(), varPrice === mysteryVar
220
+ ? varPrice.getVarNode()
221
+ : varPrice.getValueNode());
222
+ }, true, false),
223
+ sauce: new ProblemVarSkeletonGroup({
224
+ count: {
225
+ varName: "m",
226
+ str: "le nombre de boîtes de sauce tomate",
227
+ question: `Quel est le nombre, noté $m$, de boîtes de sauce tomate ?`,
228
+ randNode() {
229
+ return randint(1, 11, []).toTree();
230
+ },
231
+ },
232
+ price: {
233
+ varName: "s",
234
+ str: "le prix d'une boîte de sauce",
235
+ question: `Quel est le prix, noté $s$, d'une boîte de sauce tomate ?`,
236
+ randNode() {
237
+ return randfloat(0.5, 4, 2, []).toTree();
238
+ },
239
+ },
240
+ }, "le coût pour", (group, mysteryVar) => {
241
+ switch (mysteryVar?.skeleton.varName) {
242
+ case "m":
243
+ return `des boîtes de sauce tomate à $${group.vars.price.value.toTex()}$ € l’unité`;
244
+ case "s": {
245
+ const isPlural = group.vars.count.value.evaluate() >= 2;
246
+ return `$${group.vars.count.value.toTex()}$ ${"boîte" + (isPlural ? "s" : "")} de sauce tomate`;
247
+ }
248
+ default: {
249
+ const isPlural = group.vars.count.value.evaluate() >= 2;
250
+ return `$${group.vars.count.value.toTex()}$ ${"boîte" + (isPlural ? "s" : "")} de sauce tomate à $${group.vars.price.value.toTex()}$ € l’unité`;
251
+ }
252
+ }
253
+ }, (group, mysteryVar) => {
254
+ const varCount = group.vars.count;
255
+ const varPrice = group.vars.price;
256
+ return multiply(varCount === mysteryVar
257
+ ? varCount.getVarNode()
258
+ : varCount.getValueNode(), varPrice === mysteryVar
259
+ ? varPrice.getVarNode()
260
+ : varPrice.getValueNode());
261
+ }, true, false),
262
+ total: new ProblemVarSkeletonGroup({
263
+ total: {
264
+ varName: "t",
265
+ str: "le coût total",
266
+ question: `Quel est le coût total, noté $t$, de ses achats ?`,
267
+ },
268
+ }, "le", () => {
269
+ return "coût total";
270
+ }, (_group, _mysteryVar, groups, shuffleFuncs) => {
271
+ const { total, ...groupsWithoutTotal } = groups;
272
+ const orderedNodes = shuffleFuncs[0](Object.values(groupsWithoutTotal)).map((group) => group.getNode());
273
+ // console.log(
274
+ // "orderedNodes[0].leftChild",
275
+ // (orderedNodes[0] as MultiplyNode).leftChild,
276
+ // );
277
+ // console.log(
278
+ // "isAlgebraicNode((orderedNodes[0] as MultiplyNode).leftChild)",
279
+ // isAlgebraicNode((orderedNodes[0] as MultiplyNode).leftChild),
280
+ // );
281
+ // console.log(
282
+ // "orderedNodes[0].leftChild.evaluate",
283
+ // (orderedNodes[0] as MultiplyNode).leftChild.evaluate,
284
+ // );
285
+ // console.log("orderedNodes[0].evaluate()", orderedNodes[0].evaluate());
286
+ // console.log("orderedNodes[1].evaluate()", orderedNodes[1].evaluate());
287
+ return round(add(orderedNodes[0], orderedNodes[1]).evaluate(), 2).toTree();
288
+ }, false, true),
289
+ }, [["pizza", "sauce"]]),
290
+ ];
291
+ const getInstruction = (identifiers) => {
292
+ const { problemSkeletonIndex, groupNameToVarNameToValue, mysteryVarPath, shuffleArrays, } = identifiers;
293
+ const skeleton = skeletons[problemSkeletonIndex];
294
+ const problem = ProblemConstructor.byHydratingSkeleton(skeleton, groupNameToVarNameToValue, mysteryVarPath, shuffleArrays);
295
+ return `${mdTable([[""], [problem.frenchStr]])}
296
+
297
+ Parmi les équations suivantes, laquelle modélise cette situation ?`;
298
+ };
299
+ const getHint = (identifiers) => {
300
+ const { problemSkeletonIndex, groupNameToVarNameToValue, mysteryVarPath, shuffleArrays, } = identifiers;
301
+ const skeleton = skeletons[problemSkeletonIndex];
302
+ const problem = ProblemConstructor.byHydratingSkeleton(skeleton, groupNameToVarNameToValue, mysteryVarPath, shuffleArrays);
303
+ return `${Object.values(problem.groups).map((group) => `Quel est ${group.getScalarString(problem.mysteryVar)} ?`).join(`
304
+
305
+ `)}`;
306
+ };
307
+ const getCorrection = (identifiers) => {
308
+ const { problemSkeletonIndex, groupNameToVarNameToValue, mysteryVarPath, shuffleArrays, } = identifiers;
309
+ const skeleton = skeletons[problemSkeletonIndex];
310
+ const problem = ProblemConstructor.byHydratingSkeleton(skeleton, groupNameToVarNameToValue, mysteryVarPath, shuffleArrays);
311
+ return `On peut former les expressions suivantes:
312
+ ${problem.getExplanationString()}
313
+
314
+ L'équation qui modélise la situation est donc:
315
+
316
+ $$
317
+ ${getAnswer(identifiers)}
318
+ $$
319
+
320
+ `;
321
+ };
322
+ const getAnswerNode = (identifiers) => {
323
+ const { problemSkeletonIndex, groupNameToVarNameToValue, mysteryVarPath, shuffleArrays, } = identifiers;
324
+ const skeleton = skeletons[problemSkeletonIndex];
325
+ const problem = ProblemConstructor.byHydratingSkeleton(skeleton, groupNameToVarNameToValue, mysteryVarPath, shuffleArrays);
326
+ return problem.equalNode;
327
+ };
328
+ const getAnswer = (identifiers) => {
329
+ return getAnswerNode(identifiers).toTex();
330
+ };
331
+ const getKeys = (identifiers) => {
332
+ const { problemSkeletonIndex, groupNameToVarNameToValue, mysteryVarPath, shuffleArrays, } = identifiers;
333
+ const skeleton = skeletons[problemSkeletonIndex];
334
+ const problem = ProblemConstructor.byHydratingSkeleton(skeleton, groupNameToVarNameToValue, mysteryVarPath, shuffleArrays);
335
+ const arrayOfNodes = problem.getArrayOfUsefulNodes();
336
+ return [
337
+ "equal",
338
+ ...arrayOfNodes.map((node) => {
339
+ const tex = node.toTex();
340
+ return {
341
+ id: "custom",
342
+ label: tex,
343
+ labelType: "tex",
344
+ mathfieldInstructions: {
345
+ method: "write",
346
+ content: tex,
347
+ },
348
+ };
349
+ }),
350
+ ];
351
+ };
352
+ const getEquationFromSentenceExerciseQuestion = () => {
353
+ const problemSkeletonIndex = random([...Array(skeletons.length).keys()]);
354
+ const problemSkeleton = skeletons[problemSkeletonIndex];
355
+ const groupNameToVarNameToValue = problemSkeleton.createRandomValuesDict();
356
+ const mysteryVarPath = problemSkeleton.createRandomMysteryVarPath();
357
+ const shuffleArrays = problemSkeleton.createRandomShuffleArrays();
358
+ const problem = ProblemConstructor.byHydratingSkeleton(problemSkeleton, groupNameToVarNameToValue, mysteryVarPath, shuffleArrays);
359
+ const equalNodeIds = problem.equalNode.toIdentifiers();
360
+ const identifiers = {
361
+ problemSkeletonIndex,
362
+ groupNameToVarNameToValue,
363
+ mysteryVarPath,
364
+ shuffleArrays,
365
+ equalNodeIds,
366
+ };
367
+ return getQuestionFromIdentifiers(identifiers);
368
+ };
369
+ const getQuestionFromIdentifiers = (identifiers) => {
370
+ const question = {
371
+ answer: getAnswer(identifiers),
372
+ instruction: getInstruction(identifiers),
373
+ hint: getHint(identifiers),
374
+ correction: getCorrection(identifiers),
375
+ keys: getKeys(identifiers),
376
+ answerFormat: "tex",
377
+ identifiers,
378
+ };
379
+ return question;
380
+ };
381
+ const getPropositions = (n, { answer, ...identifiers }) => {
382
+ const propositions = [];
383
+ addValidProp(propositions, answer);
384
+ const answerNode = getAnswerNode(identifiers);
385
+ function nodeByReplacingOperations(node, replacementDict) {
386
+ if (isOperatorNode(node)) {
387
+ const leftChild = nodeByReplacingOperations(node.leftChild, replacementDict);
388
+ const rightChild = nodeByReplacingOperations(node.rightChild, replacementDict);
389
+ const targetOperatorId = replacementDict[+node.id] ?? node.id;
390
+ switch (+targetOperatorId) {
391
+ case OperatorIds.add:
392
+ return add(leftChild, rightChild);
393
+ case OperatorIds.substract:
394
+ return substract(leftChild, rightChild);
395
+ case OperatorIds.multiply:
396
+ return multiply(leftChild, rightChild);
397
+ case OperatorIds.divide:
398
+ return frac(leftChild, rightChild);
399
+ default:
400
+ return add(leftChild, rightChild);
401
+ }
402
+ }
403
+ else if (isEqualNode(node)) {
404
+ const leftChild = nodeByReplacingOperations(node.leftChild, replacementDict);
405
+ const rightChild = nodeByReplacingOperations(node.rightChild, replacementDict);
406
+ return new EqualNode(leftChild, rightChild);
407
+ }
408
+ else {
409
+ return node;
410
+ }
411
+ }
412
+ //add everywhere
413
+ {
414
+ const wrongEqualNode = nodeByReplacingOperations(answerNode, {
415
+ [OperatorIds.multiply]: OperatorIds.add,
416
+ [OperatorIds.substract]: OperatorIds.add,
417
+ [OperatorIds.divide]: OperatorIds.add,
418
+ });
419
+ tryToAddWrongProp(propositions, wrongEqualNode.toTex());
420
+ }
421
+ //multiply becomes frac
422
+ {
423
+ const wrongEqualNode = nodeByReplacingOperations(answerNode, {
424
+ [OperatorIds.multiply]: OperatorIds.divide,
425
+ });
426
+ tryToAddWrongProp(propositions, wrongEqualNode.toTex());
427
+ }
428
+ //l*r = a becomes l = r
429
+ {
430
+ const leftChild = answerNode.leftChild;
431
+ const wrongEqualNode = new EqualNode(leftChild.leftChild, leftChild.rightChild);
432
+ tryToAddWrongProp(propositions, wrongEqualNode.toTex());
433
+ }
434
+ return shuffleProps(propositions, n);
435
+ };
436
+ const isAnswerValid = (ans, { answer, ...identifiers }) => {
437
+ const answerNode = getAnswerNode(identifiers); //!TODO: this call crashes but it's a mystery
438
+ const ansNode = parseLatex(ans);
439
+ return substract(ansNode, answerNode).evaluate() === 0;
440
+ };
441
+ export const equationFromProblem = {
442
+ id: "equationFromProblem",
443
+ label: "Traduire un problème en une équation mathématique",
444
+ isSingleStep: true,
445
+ generator: (nb) => getDistinctQuestions(getEquationFromSentenceExerciseQuestion, nb),
446
+ qcmTimer: 60,
447
+ freeTimer: 60,
448
+ getPropositions,
449
+ isAnswerValid,
450
+ subject: "Mathématiques",
451
+ getQuestionFromIdentifiers,
452
+ answerType: "QCU",
453
+ hasHintAndCorrection: true,
454
+ };
@@ -14,4 +14,5 @@ export * from "./binomialsTrinomialsProposedSolutions.js";
14
14
  export * from "./equationWithDistributivity.js";
15
15
  export * from "./choseOperationToSolveEquation.js";
16
16
  export * from "./factorizeEquation.js";
17
+ export * from "./equationFromProblem.js";
17
18
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/equation/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,uBAAuB,CAAC;AACtC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,0BAA0B,CAAC;AACzC,cAAc,kCAAkC,CAAC;AACjD,cAAc,kCAAkC,CAAC;AACjD,cAAc,kCAAkC,CAAC;AACjD,cAAc,mCAAmC,CAAC;AAClD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,iCAAiC,CAAC;AAChD,cAAc,oCAAoC,CAAC;AACnD,cAAc,wBAAwB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/equation/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,uBAAuB,CAAC;AACtC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,0BAA0B,CAAC;AACzC,cAAc,kCAAkC,CAAC;AACjD,cAAc,kCAAkC,CAAC;AACjD,cAAc,kCAAkC,CAAC;AACjD,cAAc,mCAAmC,CAAC;AAClD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,iCAAiC,CAAC;AAChD,cAAc,oCAAoC,CAAC;AACnD,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC"}
@@ -14,3 +14,4 @@ export * from "./binomialsTrinomialsProposedSolutions.js";
14
14
  export * from "./equationWithDistributivity.js";
15
15
  export * from "./choseOperationToSolveEquation.js";
16
16
  export * from "./factorizeEquation.js";
17
+ export * from "./equationFromProblem.js";
@@ -0,0 +1,10 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ type Identifiers = {
3
+ a: number;
4
+ b: number;
5
+ isAdd: boolean;
6
+ varName: string;
7
+ };
8
+ export declare const factorizeAX2PlusBX: Exercise<Identifiers>;
9
+ export {};
10
+ //# sourceMappingURL=factorizeAX2PlusBX.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"factorizeAX2PlusBX.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/factorisation/factorizeAX2PlusBX.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AASrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,OAAO,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAmFF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,CAcpD,CAAC"}
@@ -0,0 +1,70 @@
1
+ import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { primes } from "../../../../math/numbers/integer/primes.js";
4
+ import { add } from "../../../../tree/nodes/operators/addNode.js";
5
+ import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
6
+ import { substract } from "../../../../tree/nodes/operators/substractNode.js";
7
+ import { coinFlip } from "../../../../utils/alea/coinFlip.js";
8
+ import { random, randomMany } from "../../../../utils/alea/random.js";
9
+ const getInstruction = (identifiers) => {
10
+ const { a, b, isAdd, varName } = identifiers;
11
+ const x = varName;
12
+ return `Laquelle de ces propositions est la forme factorisée de $${a}${x}^2 ${isAdd ? "+" : "-"} ${b}${x}$ ?`;
13
+ };
14
+ const getHint = (identifiers) => {
15
+ const { varName } = identifiers;
16
+ return `$${varName}$ semble être le facteur commun.`;
17
+ };
18
+ const getCorrection = (identifiers) => {
19
+ const { a, b, isAdd, varName } = identifiers;
20
+ const x = varName;
21
+ return `Si on factorise par $${x}$ on obtient :
22
+
23
+ $$
24
+ ${a}${x}^2 ${isAdd ? "+" : "-"} ${b}${x} = ${x}(${a}${x}${isAdd ? "+" : "-"}${b})
25
+ $$
26
+
27
+ `;
28
+ };
29
+ const getPropositions = (n, { answer, ...identifiers }) => {
30
+ const { a, b, isAdd, varName } = identifiers;
31
+ const x = varName;
32
+ const addSub = isAdd ? add : substract;
33
+ const propositions = [];
34
+ addValidProp(propositions, `${x}(${a}${x}${isAdd ? "+" : "-"}${b})`, "tex");
35
+ tryToAddWrongProp(propositions, `(${multiply(a.toTree(), b.toTree()).toTex()})${x}^3`, "tex");
36
+ tryToAddWrongProp(propositions, `(${addSub(a.toTree(), b.toTree()).toTex()})${x}`, "tex");
37
+ tryToAddWrongProp(propositions, `(${a}${x}^2${isAdd ? "+" : "-"}${b}${x})${x}^2`, "tex");
38
+ return shuffleProps(propositions, n);
39
+ };
40
+ const getFactorizeAX2PlusBXQuestion = () => {
41
+ const [a, b] = randomMany(primes, 2);
42
+ const varName = random(["x", "y", "z", "t"]);
43
+ const isAdd = coinFlip();
44
+ return getQuestionFromIdentifiers({ a, b, isAdd, varName });
45
+ };
46
+ const getQuestionFromIdentifiers = (identifiers) => {
47
+ const question = {
48
+ instruction: getInstruction(identifiers),
49
+ keys: [],
50
+ answerFormat: "tex",
51
+ identifiers,
52
+ hint: getHint(identifiers),
53
+ correction: getCorrection(identifiers),
54
+ };
55
+ return question;
56
+ };
57
+ export const factorizeAX2PlusBX = {
58
+ id: "factorizeAX2PlusBX",
59
+ label: "Factoriser $ax^2 + bx$",
60
+ isSingleStep: true,
61
+ generator: (nb) => getDistinctQuestions(() => getFactorizeAX2PlusBXQuestion(), nb, 30),
62
+ qcmTimer: 60,
63
+ freeTimer: 60,
64
+ getPropositions,
65
+ subject: "Mathématiques",
66
+ maxAllowedQuestions: 30,
67
+ getQuestionFromIdentifiers,
68
+ answerType: "QCU",
69
+ hasHintAndCorrection: true,
70
+ };
@@ -6,4 +6,5 @@ export * from "./factorizeCanonicalForm.js";
6
6
  export * from "./factorizeCanonicalFormWithSqrt.js";
7
7
  export * from "./factoType2.js";
8
8
  export * from "./factoByX.js";
9
+ export * from "./factorizeAX2PlusBX.js";
9
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/factorisation/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,6BAA6B,CAAC;AAC5C,cAAc,qCAAqC,CAAC;AACpD,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/factorisation/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,6BAA6B,CAAC;AAC5C,cAAc,qCAAqC,CAAC;AACpD,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,yBAAyB,CAAC"}
@@ -6,3 +6,4 @@ export * from "./factorizeCanonicalForm.js";
6
6
  export * from "./factorizeCanonicalFormWithSqrt.js";
7
7
  export * from "./factoType2.js";
8
8
  export * from "./factoByX.js";
9
+ export * from "./factorizeAX2PlusBX.js";
@@ -5,5 +5,7 @@ export * from "./inequations/index.js";
5
5
  export * from "./simplifying/index.js";
6
6
  export * from "./systems/index.js";
7
7
  export * from "./isolate/index.js";
8
+ export * from "./writing/index.js";
8
9
  export * from "./formulas/index.js";
10
+ export * from "./ordering/index.js";
9
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/calculLitteral/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/calculLitteral/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC"}
@@ -5,4 +5,6 @@ export * from "./inequations/index.js";
5
5
  export * from "./simplifying/index.js";
6
6
  export * from "./systems/index.js";
7
7
  export * from "./isolate/index.js";
8
+ export * from "./writing/index.js";
8
9
  export * from "./formulas/index.js";
10
+ export * from "./ordering/index.js";
@@ -1,2 +1,3 @@
1
- export {};
1
+ export * from "./isolateXInInvXPlusInvYEqualsInvU.js";
2
+ export * from "./isolateUInInvXPlusInvYEqualsInvU.js";
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/isolate/index.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/isolate/index.ts"],"names":[],"mappings":"AACA,cAAc,uCAAuC,CAAC;AACtD,cAAc,uCAAuC,CAAC"}
@@ -1,2 +1,3 @@
1
- export {};
2
1
  // export * from "./isolateVariable.js";
2
+ export * from "./isolateXInInvXPlusInvYEqualsInvU.js";
3
+ export * from "./isolateUInInvXPlusInvYEqualsInvU.js";
@@ -0,0 +1,8 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ type Identifiers = {
3
+ varNames: string[];
4
+ };
5
+ export declare const isolateUInInvXPlusInvYEqualsInvU: Exercise<Identifiers>;
6
+ export declare const isolateRInInvR1PlusInvR2EqualsInvR: Exercise<Identifiers>;
7
+ export {};
8
+ //# sourceMappingURL=isolateUInInvXPlusInvYEqualsInvU.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isolateUInInvXPlusInvYEqualsInvU.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/isolate/isolateUInInvXPlusInvYEqualsInvU.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAKrC,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB,CAAC;AAqEF,eAAO,MAAM,gCAAgC,EAAE,QAAQ,CAAC,WAAW,CAmBlE,CAAC;AAUF,eAAO,MAAM,kCAAkC,EAAE,QAAQ,CAAC,WAAW,CAoBpE,CAAC"}