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,327 @@
1
+ import { GeneratorOptionTarget, GeneratorOptionType, 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 { frac } from "../../../../tree/nodes/operators/fractionNode.js";
7
+ import { multiply, } from "../../../../tree/nodes/operators/multiplyNode.js";
8
+ import { power } from "../../../../tree/nodes/operators/powerNode.js";
9
+ import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
10
+ import { coinFlip } from "../../../../utils/alea/coinFlip.js";
11
+ import { probaLawFlip } from "../../../../utils/alea/probaLawFlip.js";
12
+ import { random, randomMany } from "../../../../utils/alea/random.js";
13
+ import { shuffle } from "../../../../utils/alea/shuffle.js";
14
+ import { permute } from "../../../../utils/arrays/permutations.js";
15
+ const getTexForA10N = (a10N) => {
16
+ const { a, n } = a10N;
17
+ return `${a.frenchify()} \\times 10^{${n}}`;
18
+ };
19
+ const getSciMultNodeForA10N = (a10N) => {
20
+ const { a, n } = a10N;
21
+ const sign = Math.sign(a);
22
+ const sciMultNodeA = getSciMultNodeForA(sign * a);
23
+ const factor = sign * sciMultNodeA.leftChild.evaluate();
24
+ const nodePower10 = sciMultNodeA.rightChild;
25
+ const exponent = nodePower10.rightChild.evaluate() + n;
26
+ return multiply(factor, power(10, exponent));
27
+ };
28
+ const getSciMultNodeForA = (a) => {
29
+ //a must be positive
30
+ const exponent = Math.floor(Math.log10(a));
31
+ const factor = round(frac(a, power(10, exponent)).evaluate(), 2);
32
+ const sciMultNode = multiply(factor, power(10, exponent));
33
+ return sciMultNode;
34
+ };
35
+ const compareFuncForA10N = (a10N1, a10N2) => {
36
+ const { a: a1, n: n1 } = a10N1;
37
+ const { a: a2, n: n2 } = a10N2;
38
+ const [sign1, sign2] = [a1, a2].map((a) => Math.sign(a));
39
+ if (sign1 !== sign2) {
40
+ return sign1 - sign2;
41
+ }
42
+ else {
43
+ const sign = sign1;
44
+ const [nodeSciA1, nodeSciA2] = [a1, a2].map((a) => getSciMultNodeForA(sign * a));
45
+ const [factorA1, factorA2] = [nodeSciA1, nodeSciA2].map((nodeSciA) => nodeSciA.leftChild.evaluate());
46
+ const [nA1, nA2] = [nodeSciA1, nodeSciA2].map((nodeSciA) => nodeSciA.rightChild.rightChild.evaluate());
47
+ const exponent1 = n1 + nA1;
48
+ const exponent2 = n2 + nA2;
49
+ if (exponent1 !== exponent2) {
50
+ return sign * (exponent1 - exponent2);
51
+ }
52
+ else {
53
+ return sign * (factorA1 - factorA2);
54
+ }
55
+ }
56
+ };
57
+ const getInstruction = (identifiers) => {
58
+ const { items } = identifiers;
59
+ return `Ranger par ordre croissant les nombres suivants :
60
+
61
+ $$
62
+ ${items.map((item) => getTexForA10N(item)).join(" ; ")}
63
+ $$`;
64
+ };
65
+ const getHint = (identifiers) => {
66
+ const { signType } = identifiers;
67
+ return `Même si on a l'impression que les nombres sont écris en écriture scientifique, ce n'est pas le cas.
68
+ Il faut les convertir en écriture scientifique et utiliser cette écriture pour les ranger dans l'ordre croissant.
69
+ ${(() => {
70
+ switch (signType) {
71
+ case "positifs":
72
+ return `Ici, tous les nombres sont positifs, donc
73
+ on range les puissances de $10$ en ordre croissant, puis pour chaque puissance de $10$, les facteurs en ordre croissant.
74
+ C'est un double tri.`;
75
+ case "négatifs":
76
+ return `Ici, tous les nombres sont négatifs, donc
77
+ on range les puissances de $10$ en ordre décroissant, puis pour chaque puissance de $10$, les facteurs en ordre décroissant.
78
+ C'est un double tri.`;
79
+ case "mélange":
80
+ return `Ici, il y a des nombres négatifs et des nombres positifs.
81
+ On commence par les négatifs :
82
+ On range les puissances de $10$ en ordre décroissant, puis pour chaque puissance de $10$, les facteurs en ordre décroissant.
83
+ Puis on range les positifs :
84
+ On range les puissances de $10$ en ordre croissant, puis pour chaque puissance de $10$, les facteurs en ordre croissant.`;
85
+ }
86
+ })()}
87
+ `;
88
+ };
89
+ const getCorrection = (identifiers) => {
90
+ const { signType, items } = identifiers;
91
+ return `Même si on a l'impression que les nombres sont écris en écriture scientifique, ce n'est pas le cas.
92
+ Il faut les convertir en écriture scientifique et utiliser cette écriture pour les ranger dans l'ordre croissant.
93
+
94
+ ${items
95
+ .map((item) => `
96
+
97
+ $$
98
+ ${getTexForA10N(item)} = ${getSciMultNodeForA10N(item).toTex()}
99
+ $$
100
+
101
+ `)
102
+ .join("")}
103
+
104
+ ${(() => {
105
+ switch (signType) {
106
+ case "positifs": {
107
+ const positive = items.toSorted(compareFuncForA10N);
108
+ return `Ici, tous les nombres sont positifs, donc
109
+ on range les puissances de $10$ en ordre croissant, puis pour chaque puissance de $10$, les facteurs en ordre croissant.
110
+ C'est un double tri.
111
+
112
+ $$
113
+ ${positive.map((item) => getSciMultNodeForA10N(item).toTex()).join("<")}
114
+ $$
115
+
116
+ Conclusion :
117
+
118
+ $$
119
+ ${positive.map((item) => getTexForA10N(item)).join("<")}
120
+ $$
121
+
122
+ `;
123
+ }
124
+ case "négatifs": {
125
+ const negative = items.toSorted(compareFuncForA10N);
126
+ return `Ici, tous les nombres sont négatifs, donc
127
+ on range les puissances de $10$ en ordre décroissant, puis pour chaque puissance de $10$, les facteurs en ordre décroissant.
128
+ C'est un double tri.
129
+
130
+ $$
131
+ ${negative.map((item) => getSciMultNodeForA10N(item).toTex()).join("<")}
132
+ $$
133
+
134
+ Conclusion :
135
+
136
+ $$
137
+ ${negative.map((item) => getTexForA10N(item)).join("<")}
138
+ $$
139
+ `;
140
+ }
141
+ case "mélange": {
142
+ const positive = items
143
+ .filter(({ a }) => a >= 0)
144
+ .toSorted(compareFuncForA10N);
145
+ const negative = items
146
+ .filter(({ a }) => a < 0)
147
+ .toSorted(compareFuncForA10N);
148
+ return `Ici, il y a des nombres négatifs et des nombres positifs.
149
+ On commence par les négatifs :
150
+ on range les puissances de $10$ en ordre décroissant, puis pour chaque puissance de $10$, les facteurs en ordre décroissant.
151
+
152
+ $$
153
+ ${negative.map((item) => getSciMultNodeForA10N(item).toTex()).join("<")}
154
+ $$
155
+
156
+ Puis on range les positifs :
157
+ on range les puissances de $10$ en ordre croissant, puis pour chaque puissance de $10$, les facteurs en ordre croissant.
158
+
159
+ $$
160
+ ${positive.map((item) => getSciMultNodeForA10N(item).toTex()).join("<")}
161
+ $$
162
+
163
+ Conclusion :
164
+
165
+ $$
166
+ ${[...negative, ...positive].map((item) => getTexForA10N(item)).join("<")}
167
+ $$
168
+ `;
169
+ }
170
+ }
171
+ })()}
172
+ `;
173
+ };
174
+ const getPropositions = (n, { answer, ...identifiers }) => {
175
+ const { items } = identifiers;
176
+ const propositions = [];
177
+ addValidProp(propositions, answer);
178
+ permute(items)
179
+ .slice(0, 5)
180
+ .forEach((permutedItems) => {
181
+ const arrayOfTex = permutedItems.map((item) => getTexForA10N(item));
182
+ tryToAddWrongProp(propositions, arrayOfTex.join("<"));
183
+ tryToAddWrongProp(propositions, arrayOfTex.join(">"));
184
+ });
185
+ return shuffleProps(propositions, n);
186
+ };
187
+ const getAnswer = (identifiers) => {
188
+ const { items } = identifiers;
189
+ const answer = items
190
+ .toSorted(compareFuncForA10N)
191
+ .map((item) => getTexForA10N(item))
192
+ .join("<");
193
+ return answer;
194
+ };
195
+ const isAnswerValid = (ans, { answer, items }) => {
196
+ const nbItems = items.length;
197
+ const [ansNodes, answerNodes] = [ans, answer].map((str) => str.split("<").map((tex) => parseAlgebraic(tex)));
198
+ return (ansNodes.length === nbItems &&
199
+ [...Array(nbItems).keys()].every((i) => ansNodes[i].equals(answerNodes[i])));
200
+ };
201
+ const getKeys = (identifiers) => {
202
+ const { items } = identifiers;
203
+ return [
204
+ "sup",
205
+ "inf",
206
+ ...items.map((item) => {
207
+ const tex = getTexForA10N(item);
208
+ return {
209
+ id: "custom",
210
+ label: tex,
211
+ labelType: "tex",
212
+ mathfieldInstructions: {
213
+ method: "write",
214
+ content: tex,
215
+ },
216
+ };
217
+ }),
218
+ ];
219
+ };
220
+ const getCompareA10NQuestion = (optsIn) => {
221
+ const opts = optsIn ? Object.assign(optsIn, optsDefault) : optsDefault;
222
+ const signType = random(opts.signTypes);
223
+ const nbCollisions = random(opts.nbCollisions);
224
+ const nbItems = 4;
225
+ let arrayOfA = [...Array(nbItems).keys()].map(() => {
226
+ const pow10 = random([0, 1, 2]);
227
+ const nbDigits = probaLawFlip([
228
+ [0, 0.5],
229
+ [1, 0.3],
230
+ [2, 0.2],
231
+ ]);
232
+ return round(randfloat(0, 10, 2, [10]) * Math.pow(10, pow10) +
233
+ randfloat(0, 1, nbDigits), 2);
234
+ });
235
+ switch (signType) {
236
+ case "négatifs":
237
+ arrayOfA = arrayOfA.map((a) => -1 * a);
238
+ break;
239
+ case "mélange":
240
+ {
241
+ const nbRandomSign = nbItems - 2;
242
+ const signs = shuffle([
243
+ +1,
244
+ -1,
245
+ ...[...Array(nbRandomSign).keys()].map(() => (coinFlip() ? +1 : -1)),
246
+ ]);
247
+ arrayOfA = arrayOfA.map((a, i) => signs[i] * a);
248
+ }
249
+ break;
250
+ default:
251
+ break;
252
+ }
253
+ const nMin = -90;
254
+ const nMax = +90;
255
+ const combStep = 5;
256
+ const combOffset = randint(0, combStep);
257
+ const poolOfN = [...Array(nMax - nMin + 1).keys()]
258
+ .map((i) => i + nMin)
259
+ .filter((n) => n % combStep === combOffset);
260
+ const subPoolOfN = randomMany(poolOfN, nbItems - nbCollisions);
261
+ let arrayOfN = subPoolOfN;
262
+ for (let i = 0; i < nbCollisions; i++) {
263
+ arrayOfN.push(random(subPoolOfN) + random([-2, -1, 0, 1, 2]));
264
+ }
265
+ arrayOfN = shuffle(arrayOfN);
266
+ const items = [...Array(nbItems).keys()].map((i) => {
267
+ return {
268
+ a: arrayOfA[i],
269
+ n: arrayOfN[i],
270
+ };
271
+ });
272
+ return getQuestionFromIdentifiers({
273
+ signType,
274
+ items,
275
+ });
276
+ };
277
+ const optsDefault = {
278
+ signTypes: ["positifs", "négatifs", "mélange"],
279
+ nbCollisions: [0, 1, 2, 3],
280
+ };
281
+ const options = [
282
+ {
283
+ id: "signTypes",
284
+ label: "Signes des nombres",
285
+ type: GeneratorOptionType.multiselect,
286
+ target: GeneratorOptionTarget.generation,
287
+ values: ["positifs", "négatifs", "mélange"],
288
+ defaultValue: optsDefault.signTypes,
289
+ },
290
+ {
291
+ id: "nbCollisions",
292
+ label: "Nombre de collisions",
293
+ type: GeneratorOptionType.multiselect,
294
+ target: GeneratorOptionTarget.generation,
295
+ values: [0, 1, 2, 3],
296
+ defaultValue: optsDefault.nbCollisions,
297
+ },
298
+ ];
299
+ const getQuestionFromIdentifiers = (identifiers, opts) => {
300
+ const question = {
301
+ answer: getAnswer(identifiers),
302
+ instruction: getInstruction(identifiers),
303
+ keys: getKeys(identifiers),
304
+ answerFormat: "tex",
305
+ identifiers,
306
+ hint: getHint(identifiers),
307
+ correction: getCorrection(identifiers),
308
+ options: opts,
309
+ };
310
+ return question;
311
+ };
312
+ export const compareA10N = {
313
+ id: "compareA10N",
314
+ label: "Comparer des nombres de la forme $a \\times 10^n$",
315
+ isSingleStep: true,
316
+ generator: (nb, opts) => getDistinctQuestions(() => getCompareA10NQuestion(opts), nb, 30),
317
+ options,
318
+ qcmTimer: 60,
319
+ freeTimer: 60,
320
+ getPropositions,
321
+ isAnswerValid,
322
+ subject: "Mathématiques",
323
+ maxAllowedQuestions: 30,
324
+ getQuestionFromIdentifiers,
325
+ answerType: "QCU",
326
+ hasHintAndCorrection: true,
327
+ };
@@ -0,0 +1,8 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ import { NodeIdentifiers } from "../../../../tree/nodes/nodeConstructor.js";
3
+ type Identifiers = {
4
+ orderedNodeIds: NodeIdentifiers[];
5
+ };
6
+ export declare const compareABUsingQuotient: Exercise<Identifiers>;
7
+ export {};
8
+ //# sourceMappingURL=compareABUsingQuotient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compareABUsingQuotient.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/ordering/compareABUsingQuotient.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAIrC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAK7C,KAAK,WAAW,GAAG;IACjB,cAAc,EAAE,eAAe,EAAE,CAAC;CACnC,CAAC;AA+IF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,CAiBxD,CAAC"}
@@ -0,0 +1,123 @@
1
+ import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { randint } from "../../../../math/utils/random/randint.js";
4
+ import { sqrt } from "../../../../tree/nodes/functions/sqrtNode.js";
5
+ import { NodeConstructor, } from "../../../../tree/nodes/nodeConstructor.js";
6
+ import { add } from "../../../../tree/nodes/operators/addNode.js";
7
+ import { coinFlip } from "../../../../utils/alea/coinFlip.js";
8
+ const getInstruction = (identifiers) => {
9
+ const { orderedNodeIds } = identifiers;
10
+ const [A, B] = orderedNodeIds.map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds).toTex());
11
+ return `Sachant que $\\frac{${B}}{${A}} > 1$,
12
+
13
+ comparer $${B}$ et $${A}$.;`;
14
+ };
15
+ const getHint = (identifiers) => {
16
+ const { orderedNodeIds } = identifiers;
17
+ const [A, B] = orderedNodeIds.map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds).toTex());
18
+ return `En partant de
19
+
20
+ $$
21
+ \\frac{${B}}{${A}} > 1
22
+ $$
23
+
24
+ essaye d’isoler chaque expression de chaque côté de l’inégalité.`;
25
+ };
26
+ const getCorrection = (identifiers) => {
27
+ const { orderedNodeIds } = identifiers;
28
+ const [A, B] = orderedNodeIds.map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds).toTex());
29
+ return `On a :
30
+
31
+ $$
32
+ \\frac{${B}}{${A}} > 1
33
+ $$
34
+
35
+ On multiplie par $${A}$ des deux côtés. $${A} > 0$ donc on ne renverse pas l'inégalité :
36
+
37
+ $$
38
+ ${B} > ${A}
39
+ $$
40
+ `;
41
+ };
42
+ const getAnswer = (identifiers) => {
43
+ const { orderedNodeIds } = identifiers;
44
+ const [A, B] = orderedNodeIds.map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds).toTex());
45
+ return `${B} > ${A}`;
46
+ };
47
+ const isAnswerValid = (ans, { ...identifiers }) => {
48
+ const { orderedNodeIds } = identifiers;
49
+ const [A, B] = orderedNodeIds.map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds).toTex());
50
+ const compSymbol = ans.includes(">")
51
+ ? ">"
52
+ : ans.includes("<")
53
+ ? "<"
54
+ : undefined;
55
+ if (!compSymbol) {
56
+ return false;
57
+ }
58
+ else {
59
+ return (compSymbol === ">" ? [B, A] : [A, B]).every((tex, i) => tex === ans.split(compSymbol)[i]);
60
+ }
61
+ };
62
+ const getPropositions = (nbProps, { ...identifiers }) => {
63
+ const { orderedNodeIds } = identifiers;
64
+ const [A, B] = orderedNodeIds.map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds).toTex());
65
+ const propositions = [];
66
+ addValidProp(propositions, coinFlip() ? `${A}<${B}` : `${B}>${A}`);
67
+ tryToAddWrongProp(propositions, coinFlip() ? `${B}<${A}` : `${A}>${B}`);
68
+ return shuffleProps(propositions, nbProps);
69
+ };
70
+ const getKeys = (identifiers) => {
71
+ const { orderedNodeIds } = identifiers;
72
+ const [A, B] = orderedNodeIds.map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds).toTex());
73
+ return [
74
+ "inf",
75
+ "sup",
76
+ ...[A, B].map((tex) => {
77
+ return {
78
+ id: "custom",
79
+ label: tex,
80
+ labelType: "tex",
81
+ mathfieldInstructions: {
82
+ method: "write",
83
+ content: tex,
84
+ },
85
+ };
86
+ }),
87
+ ];
88
+ };
89
+ const getCompareABUsingQuotientQuestion = () => {
90
+ const n = randint(2, 150);
91
+ const orderedNodesIncreasing = [add(1, sqrt(add(1, n))), add(2, sqrt(n))];
92
+ return getQuestionFromIdentifiers({
93
+ orderedNodeIds: orderedNodesIncreasing.map((node) => node.toIdentifiers()),
94
+ });
95
+ };
96
+ const getQuestionFromIdentifiers = (identifiers) => {
97
+ const question = {
98
+ answer: getAnswer(identifiers),
99
+ instruction: getInstruction(identifiers),
100
+ keys: getKeys(identifiers),
101
+ answerFormat: "tex",
102
+ identifiers,
103
+ hint: getHint(identifiers),
104
+ correction: getCorrection(identifiers),
105
+ };
106
+ return question;
107
+ };
108
+ export const compareABUsingQuotient = {
109
+ id: "compareABUsingQuotient",
110
+ label: "Comparer deux nombres strictement positifs par le calcul de leur quotient",
111
+ isSingleStep: true,
112
+ generator: (nb) => getDistinctQuestions(() => getCompareABUsingQuotientQuestion(), nb, 30),
113
+ qcmTimer: 60,
114
+ freeTimer: 60,
115
+ getPropositions,
116
+ isAnswerValid,
117
+ getAnswer,
118
+ subject: "Mathématiques",
119
+ maxAllowedQuestions: 30,
120
+ getQuestionFromIdentifiers,
121
+ answerType: "QCU",
122
+ hasHintAndCorrection: true,
123
+ };
@@ -0,0 +1,9 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ import { NodeIdentifiers } from "../../../../tree/nodes/nodeConstructor.js";
3
+ type Identifiers = {
4
+ nodeIds: NodeIdentifiers[];
5
+ texAnswers: string[];
6
+ };
7
+ export declare const compareFracABWithFracAPlusCBPlusC: Exercise<Identifiers>;
8
+ export {};
9
+ //# sourceMappingURL=compareFracABWithFracAPlusCBPlusC.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compareFracABWithFracAPlusCBPlusC.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/ordering/compareFracABWithFracAPlusCBPlusC.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAIrC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAY7C,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AA4LF,eAAO,MAAM,iCAAiC,EAAE,QAAQ,CAAC,WAAW,CAoBnE,CAAC"}
@@ -0,0 +1,149 @@
1
+ import { addValidProp, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { lcm } from "../../../../math/utils/arithmetic/lcm.js";
4
+ import { randint } from "../../../../math/utils/random/randint.js";
5
+ import { NodeConstructor, } from "../../../../tree/nodes/nodeConstructor.js";
6
+ import { add } from "../../../../tree/nodes/operators/addNode.js";
7
+ import { frac, isFractionNode, } from "../../../../tree/nodes/operators/fractionNode.js";
8
+ import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
9
+ import { coinFlip } from "../../../../utils/alea/coinFlip.js";
10
+ import { shuffle } from "../../../../utils/alea/shuffle.js";
11
+ const getInstruction = (identifiers) => {
12
+ const { nodeIds } = identifiers;
13
+ const nodes = nodeIds.map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds));
14
+ return `Comparer $${nodes[0].toTex()}$ et $${nodes[1].toTex()}$.`;
15
+ };
16
+ const getHint = () => {
17
+ return `Pour comparer deux fractions on peut les mettre au même dénominateur.`;
18
+ };
19
+ const getCorrection = (identifiers) => {
20
+ const { nodeIds } = identifiers;
21
+ const nodes = nodeIds.map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds));
22
+ const nodesSimplified = nodes.map((node) => node.simplify());
23
+ const [den1, den2] = nodesSimplified.map((nodeSimplified) => {
24
+ return isFractionNode(nodeSimplified)
25
+ ? nodeSimplified.rightChild
26
+ : (1).toTree();
27
+ });
28
+ const sameDen = lcm(den1.evaluate(), den2.evaluate());
29
+ const nodesSameDenMult = nodesSimplified.map((node) => isFractionNode(node)
30
+ ? frac(multiply(node.leftChild.simplify(), frac(sameDen, node.rightChild).simplify()), multiply(node.rightChild.simplify(), frac(sameDen, node.rightChild).simplify()))
31
+ : frac(multiply(node, sameDen), multiply(1, sameDen)));
32
+ const nodesSameDen = nodes.map((node) => isFractionNode(node)
33
+ ? frac(multiply(node.leftChild.simplify(), frac(sameDen, node.rightChild)).simplify(), sameDen)
34
+ : frac(multiply(node, sameDen).simplify(), sameDen));
35
+ const answer = getAnswer(identifiers);
36
+ return `On a :
37
+
38
+ $$
39
+ ${nodes[1].toSimplificationTex()}
40
+ $$
41
+
42
+ On veut donc comparer $${nodesSimplified[0].toTex()}$ et $${nodesSimplified[1].toTex()}$.
43
+
44
+ On peut choisir $${sameDen.frenchify()}$ comme dénominateur commun.
45
+
46
+ ${nodes
47
+ .map((node, i) => node.rightChild.evaluate() !== sameDen
48
+ ? `
49
+
50
+ $$
51
+ ${(i === 0 ? nodes[i] : nodes[i].simplify()).toTex()} = ${[
52
+ ...new Set([
53
+ nodesSameDenMult[i].toTex(),
54
+ nodesSameDen[i].toTex(),
55
+ ]).values(),
56
+ ].join("=")}
57
+ $$`
58
+ : ``)
59
+ .join("")}
60
+
61
+ Conclusion :
62
+
63
+ $$
64
+ ${answer}
65
+ $$
66
+
67
+ `;
68
+ };
69
+ /*
70
+ Plus généralement :
71
+ Si $a<b$ alors $\\frac{a}{b} < \\frac{a+c}{b+c}$ sinon c'est l'inverse.
72
+ */
73
+ const getPropositions = (_, { answer }) => {
74
+ const propositions = [];
75
+ addValidProp(propositions, answer);
76
+ tryToAddWrongProp(propositions, answer
77
+ .replace(">", "TMP(>)")
78
+ .replace("<", "TMP(<)")
79
+ .replace("TMP(>)", "<")
80
+ .replace("TMP(<)", ">"));
81
+ return shuffle(propositions);
82
+ };
83
+ const getAnswer = (identifiers) => {
84
+ const { texAnswers } = identifiers;
85
+ return texAnswers[0];
86
+ };
87
+ const isAnswerValid = (ans, { texAnswers }) => {
88
+ return texAnswers.includes(ans);
89
+ };
90
+ const getCompareFracABWithFracAPlusCBPlusCQuestion = () => {
91
+ const a = randint(1, 10);
92
+ const b = randint(1, 10, [a]);
93
+ const c = randint(1, 10);
94
+ const nodes = [frac(a, b), frac(add(a, c), add(b, c))];
95
+ const isOrderAsc = coinFlip();
96
+ const sortedNodes = nodes.toSorted((node1, node2) => (isOrderAsc ? +1 : -1) * (node1.evaluate() - node2.evaluate()));
97
+ const texAnswers = [
98
+ `${sortedNodes[0].toTex()}${isOrderAsc ? "<" : ">"}${sortedNodes[1].toTex()}`,
99
+ `${sortedNodes[1].toTex()}${isOrderAsc ? ">" : "<"}${sortedNodes[0].toTex()}`,
100
+ ];
101
+ return getQuestionFromIdentifiers({
102
+ nodeIds: nodes.map((node) => node.toIdentifiers()),
103
+ texAnswers,
104
+ });
105
+ };
106
+ const getQuestionFromIdentifiers = (identifiers, opts) => {
107
+ const question = {
108
+ answer: getAnswer(identifiers),
109
+ instruction: getInstruction(identifiers),
110
+ keys: [
111
+ "sup",
112
+ "inf",
113
+ ...identifiers.nodeIds.map((nodeIds) => {
114
+ const node = NodeConstructor.fromIdentifiers(nodeIds);
115
+ const tex = node.toTex();
116
+ return {
117
+ id: "custom",
118
+ label: tex,
119
+ labelType: "tex",
120
+ mathfieldInstructions: {
121
+ method: "write",
122
+ content: tex,
123
+ },
124
+ };
125
+ }),
126
+ ],
127
+ answerFormat: "tex",
128
+ identifiers,
129
+ hint: getHint(identifiers),
130
+ correction: getCorrection(identifiers),
131
+ options: opts,
132
+ };
133
+ return question;
134
+ };
135
+ export const compareFracABWithFracAPlusCBPlusC = {
136
+ id: "compareFracABWithFracAPlusCBPlusC",
137
+ label: "Effectuer des comparaisons entre des fractions simples (de la forme $\\frac{a}{b}$ et $\\frac{a+c}{b+c}$)",
138
+ isSingleStep: true,
139
+ generator: (nb, opts) => getDistinctQuestions(() => getCompareFracABWithFracAPlusCBPlusCQuestion(opts), nb, 30),
140
+ qcmTimer: 60,
141
+ freeTimer: 60,
142
+ isAnswerValid,
143
+ getPropositions,
144
+ subject: "Mathématiques",
145
+ maxAllowedQuestions: 30,
146
+ getQuestionFromIdentifiers,
147
+ answerType: "QCU",
148
+ hasHintAndCorrection: true,
149
+ };
@@ -0,0 +1,29 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ import { NodeIdentifiers } from "../../../../tree/nodes/nodeConstructor.js";
3
+ type QCMItem = {
4
+ tex: string;
5
+ isValidAnswer: boolean;
6
+ };
7
+ type QuestionParam = {
8
+ fakeName: string;
9
+ trueName: string;
10
+ tex: string;
11
+ nodeIds: NodeIdentifiers;
12
+ explainTex: string;
13
+ };
14
+ type Identifiers = {
15
+ sign: number;
16
+ a: number;
17
+ b: number;
18
+ c: number;
19
+ dictFakeNameToQuestionParam: Record<string, QuestionParam>;
20
+ items: QCMItem[];
21
+ };
22
+ type Options = {
23
+ isUseABC: boolean;
24
+ nbDecimalFormat: number;
25
+ isAllowingNegativeNumbers: boolean;
26
+ };
27
+ export declare const compareFracAndDec: Exercise<Identifiers, Options>;
28
+ export {};
29
+ //# sourceMappingURL=compareFracAndDec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compareFracAndDec.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/ordering/compareFracAndDec.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAiBT,MAAM,6BAA6B,CAAC;AAIrC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAY7C,KAAK,OAAO,GAAG;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,aAAa,EAAE,OAAO,CAAC;CACxB,CAAC;AAEF,KAAK,aAAa,GAAG;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,eAAe,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,2BAA2B,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IAC3D,KAAK,EAAE,OAAO,EAAE,CAAC;CAClB,CAAC;AAkYF,KAAK,OAAO,GAAG;IACb,QAAQ,EAAE,OAAO,CAAC;IAClB,eAAe,EAAE,MAAM,CAAC;IACxB,yBAAyB,EAAE,OAAO,CAAC;CACpC,CAAC;AA+BF,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAiB5D,CAAC"}