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,368 @@
1
+ import { GeneratorOptionTarget, GeneratorOptionType, addValidProp, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { randint } from "../../../../math/utils/random/randint.js";
4
+ import { NodeConstructor, } from "../../../../tree/nodes/nodeConstructor.js";
5
+ import { add } from "../../../../tree/nodes/operators/addNode.js";
6
+ import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
7
+ import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
8
+ import { substract } from "../../../../tree/nodes/operators/substractNode.js";
9
+ import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
10
+ import { coinFlip } from "../../../../utils/alea/coinFlip.js";
11
+ import { random, randomMany } from "../../../../utils/alea/random.js";
12
+ import { shuffle } from "../../../../utils/alea/shuffle.js";
13
+ import { permute } from "../../../../utils/arrays/permutations.js";
14
+ const getDecimalFormatTex = (questionParam) => {
15
+ return NodeConstructor.fromIdentifiers(questionParam.nodeIds)
16
+ .evaluate()
17
+ .frenchify();
18
+ };
19
+ const getInstruction = (identifiers, optsIn) => {
20
+ const { dictFakeNameToQuestionParam } = identifiers;
21
+ const opts = Object.assign(optsDefault, optsIn);
22
+ return `Voici trois nombres.
23
+
24
+ ${opts.isUseABC
25
+ ? Object.entries(dictFakeNameToQuestionParam)
26
+ .toSorted(([fakeName1], [fakeName2]) => fakeName1.localeCompare(fakeName2))
27
+ .map(([fakeName, questionParam]) => {
28
+ return `
29
+
30
+ $$
31
+ ${fakeName} = ${questionParam.tex}
32
+ $$
33
+
34
+ `;
35
+ })
36
+ .join("")
37
+ : `
38
+
39
+ $$
40
+ ${Object.values(dictFakeNameToQuestionParam)
41
+ .map((questionParam) => questionParam.tex)
42
+ .join(" ; ")}
43
+ $$
44
+
45
+ `}
46
+
47
+ Le classement par ordre décroissant de ces trois nombres est :`;
48
+ };
49
+ const getHint = () => {
50
+ return `Pour comparer des nombres on peut soit les écrire sous forme décimale
51
+
52
+ soit les mettre au même dénominateur.`;
53
+ };
54
+ const getCorrection = (identifiers, optsIn) => {
55
+ const { sign, a, dictFakeNameToQuestionParam } = identifiers;
56
+ const opts = Object.assign(optsDefault, optsIn);
57
+ const dictTrueNameToQuestionParam = Object.fromEntries(Object.entries(dictFakeNameToQuestionParam).map(([, questionParam]) => [
58
+ questionParam.trueName,
59
+ questionParam,
60
+ ]));
61
+ const letters = Object.keys(dictTrueNameToQuestionParam).toSorted((s1, s2) => s1.localeCompare(s2));
62
+ const [A, B, C] = letters.map((trueName) => {
63
+ const questionParam = dictTrueNameToQuestionParam[trueName];
64
+ return opts.isUseABC ? questionParam.fakeName : questionParam.tex;
65
+ });
66
+ return `
67
+
68
+ ${(() => {
69
+ if (opts.nbDecimalFormat > 0) {
70
+ return `On a :
71
+
72
+ ${letters
73
+ .toSorted((trueName1, trueName2) => {
74
+ const [fakeName1, fakeName2] = [trueName1, trueName2].map((trueName) => dictTrueNameToQuestionParam[trueName].fakeName);
75
+ return fakeName1.localeCompare(fakeName2);
76
+ })
77
+ .map((trueName) => {
78
+ const questionParam = dictTrueNameToQuestionParam[trueName];
79
+ return questionParam.explainTex;
80
+ })
81
+ .join("")}`;
82
+ }
83
+ else {
84
+ return `On a :
85
+
86
+ $$
87
+ ${A} = ${sign === +1 ? `` : `-`}\\frac{${a} \\times 20}{5 \\times 20} = ${sign === +1 ? `` : `-`}\\frac{${20 * a}}{100}
88
+ $$
89
+
90
+ De plus :
91
+
92
+ $$
93
+ ${A} = ${sign === +1 ? `` : `-`}\\frac{${a} \\times 2}{5 \\times 2} = ${sign === +1 ? `` : `-`}\\frac{${2 * a}}{10}
94
+ $$
95
+
96
+ Ainsi :
97
+
98
+ ${(() => {
99
+ if (sign === +1) {
100
+ return `
101
+
102
+ $$
103
+ ${dictTrueNameToQuestionParam["C"].tex} > \\frac{${2 * a}}{10} = \\frac{${20 * a}}{100} > ${dictTrueNameToQuestionParam["B"].tex}
104
+ $$
105
+
106
+ `;
107
+ }
108
+ else {
109
+ return `
110
+
111
+ $$
112
+ ${dictTrueNameToQuestionParam["B"].tex} > -\\frac{${20 * a}}{100} = -\\frac{${2 * a}}{10} > ${dictTrueNameToQuestionParam["C"].tex}
113
+ $$
114
+
115
+ `;
116
+ }
117
+ })()}
118
+ `;
119
+ }
120
+ })()}
121
+
122
+
123
+ Or :
124
+
125
+ ${(() => {
126
+ if (sign === +1) {
127
+ return `
128
+
129
+ $$
130
+ ${getDecimalFormatTex(dictTrueNameToQuestionParam["C"])}
131
+ >
132
+ ${getDecimalFormatTex(dictTrueNameToQuestionParam["A"])}
133
+ >
134
+ ${getDecimalFormatTex(dictTrueNameToQuestionParam["B"])}
135
+ $$
136
+
137
+ Le classement par ordre décroissant est donc :
138
+
139
+ $$
140
+ ${C} > ${A} > ${B}
141
+ $$
142
+
143
+ `;
144
+ }
145
+ else {
146
+ return `
147
+
148
+ $$
149
+ ${getDecimalFormatTex(dictTrueNameToQuestionParam["B"])}
150
+ >
151
+ ${getDecimalFormatTex(dictTrueNameToQuestionParam["A"])}
152
+ >
153
+ ${getDecimalFormatTex(dictTrueNameToQuestionParam["C"])}
154
+ $$
155
+
156
+ Le classement par ordre décroissant est donc :
157
+
158
+ $$
159
+ ${B} > ${A} > ${C}
160
+ $$
161
+
162
+ `;
163
+ }
164
+ })()}`;
165
+ };
166
+ const getPropositions = (_, { answer, ...identifiers }) => {
167
+ const { items } = identifiers;
168
+ const propositions = [];
169
+ items.forEach((item) => {
170
+ if (item.isValidAnswer) {
171
+ addValidProp(propositions, item.tex, "tex");
172
+ }
173
+ else {
174
+ tryToAddWrongProp(propositions, item.tex, "tex");
175
+ }
176
+ });
177
+ return propositions;
178
+ };
179
+ const getAnswer = (identifiers) => {
180
+ const { items } = identifiers;
181
+ const answer = items.find((item) => item.isValidAnswer).tex;
182
+ return answer;
183
+ };
184
+ const isAnswerValid = (ans, { answer }) => {
185
+ const [ansNodes, answerNodes] = [ans, answer].map((str) => str.split(">").map((tex) => parseAlgebraic(tex)));
186
+ return (ansNodes.length === 3 &&
187
+ [0, 1, 2].every((i) => ansNodes[i].equals(answerNodes[i])));
188
+ };
189
+ const getKeys = (identifiers, optsIn) => {
190
+ const { dictFakeNameToQuestionParam } = identifiers;
191
+ const opts = Object.assign(optsDefault, optsIn);
192
+ return [
193
+ "sup",
194
+ "inf",
195
+ ...Object.values(dictFakeNameToQuestionParam).map((questionParam) => {
196
+ const tex = opts.isUseABC ? questionParam.fakeName : questionParam.tex;
197
+ return {
198
+ id: "custom",
199
+ label: tex,
200
+ labelType: "tex",
201
+ mathfieldInstructions: {
202
+ method: "write",
203
+ content: tex,
204
+ },
205
+ };
206
+ }),
207
+ ];
208
+ };
209
+ const getCompareFracAndDecQuestion = (optsIn) => {
210
+ const opts = Object.assign(optsDefault, optsIn);
211
+ const sign = opts.isAllowingNegativeNumbers ? (coinFlip() ? +1 : -1) : +1;
212
+ const a = random([...Array(19).keys()].map((i) => i + 1).filter((i) => i % 5 !== 0));
213
+ const b = randint(1, a - 1);
214
+ const c = random([...Array(99).keys()].map((i) => i + 1));
215
+ const nodes = {
216
+ A: frac(a, 5),
217
+ B: frac(substract(multiply(20, a), b).simplify(), 100),
218
+ C: frac(add(multiply(2, a), c).simplify(), 10)
219
+ .evaluate()
220
+ .toTree(),
221
+ };
222
+ Object.keys(nodes).forEach((letter) => {
223
+ nodes[letter] = multiply(sign, nodes[letter]);
224
+ });
225
+ const dictIsInDecimalFormat = Object.fromEntries(randomMany(["A", "C"], opts.nbDecimalFormat).map((letter) => [
226
+ letter,
227
+ true,
228
+ ]));
229
+ const nbTotal = 4;
230
+ const nbValid = 1;
231
+ const nbInvalid = nbTotal - nbValid;
232
+ const letters = Object.keys(nodes).toSorted((s1, s2) => s1.localeCompare(s2));
233
+ const shuffledLetters = shuffle(letters);
234
+ const dictFakeNameToQuestionParam = Object.fromEntries(letters.map((trueName, i) => {
235
+ const node = nodes[trueName];
236
+ const fakeName = shuffledLetters[i];
237
+ return [
238
+ fakeName,
239
+ {
240
+ fakeName: fakeName,
241
+ trueName: trueName,
242
+ nodeIds: node.toIdentifiers(),
243
+ tex: dictIsInDecimalFormat[trueName]
244
+ ? node.evaluate().frenchify()
245
+ : node.toTex(),
246
+ explainTex: (() => {
247
+ if (opts.isUseABC || !dictIsInDecimalFormat[trueName]) {
248
+ return `
249
+
250
+ $$
251
+ ${opts.isUseABC ? `${fakeName} =` : ``}${dictIsInDecimalFormat[trueName]
252
+ ? ``
253
+ : (() => {
254
+ if (trueName === "A") {
255
+ return `${node.toTex()} =
256
+ ${sign === +1 ? `` : `-`}\\frac{${a} \\times 2}{5 \\times 2} =
257
+ ${sign === +1 ? `` : `-`}\\frac{${2 * a}}{10} =`;
258
+ }
259
+ else {
260
+ return `${node.toTex()} =`;
261
+ }
262
+ })()}
263
+ ${node.evaluate().frenchify()}
264
+ $$
265
+
266
+ `;
267
+ }
268
+ else {
269
+ return ``;
270
+ }
271
+ })(),
272
+ },
273
+ ];
274
+ }));
275
+ const dictTrueNameToQuestionParam = Object.fromEntries(Object.values(dictFakeNameToQuestionParam).map((questionParam) => [
276
+ questionParam.trueName,
277
+ questionParam,
278
+ ]));
279
+ const [A, B, C] = letters.map((trueName) => {
280
+ const questionParam = dictTrueNameToQuestionParam[trueName];
281
+ return opts.isUseABC ? questionParam.fakeName : questionParam.tex;
282
+ });
283
+ const validItems = [
284
+ {
285
+ tex: sign === +1 ? `{${C}}>{${A}}>{${B}}` : `{${B}}>{${A}}>{${C}}`,
286
+ isValidAnswer: true,
287
+ },
288
+ ];
289
+ const invalidItems = permute([A, B, C])
290
+ .filter(([D, E, F]) => `{${D}}>{${E}}>{${F}}` !== validItems[0].tex)
291
+ .map(([D, E, F]) => {
292
+ return {
293
+ tex: `{${D}}>{${E}}>{${F}}`,
294
+ isValidAnswer: false,
295
+ };
296
+ });
297
+ const items = shuffle([
298
+ validItems[0],
299
+ ...shuffle(validItems.slice(1)).slice(0, nbValid - 1),
300
+ ...shuffle(invalidItems).slice(0, nbInvalid),
301
+ ]);
302
+ return getQuestionFromIdentifiers({
303
+ sign,
304
+ a,
305
+ b,
306
+ c,
307
+ dictFakeNameToQuestionParam,
308
+ items,
309
+ });
310
+ };
311
+ const getQuestionFromIdentifiers = (identifiers, opts) => {
312
+ const question = {
313
+ answer: getAnswer(identifiers, opts),
314
+ instruction: getInstruction(identifiers, opts),
315
+ keys: getKeys(identifiers, opts),
316
+ answerFormat: "tex",
317
+ identifiers,
318
+ hint: getHint(identifiers, opts),
319
+ correction: getCorrection(identifiers, opts),
320
+ options: opts,
321
+ };
322
+ return question;
323
+ };
324
+ const optsDefault = {
325
+ isUseABC: false,
326
+ nbDecimalFormat: 1,
327
+ isAllowingNegativeNumbers: false,
328
+ };
329
+ const options = [
330
+ {
331
+ id: "isUseABC",
332
+ label: "Utiliser A,B,C",
333
+ target: GeneratorOptionTarget.generation,
334
+ type: GeneratorOptionType.checkbox,
335
+ defaultValue: optsDefault.isUseABC,
336
+ },
337
+ {
338
+ id: "nbDecimalFormat",
339
+ label: "Nombre d'écritures décimales",
340
+ target: GeneratorOptionTarget.generation,
341
+ type: GeneratorOptionType.select,
342
+ values: [1, 2],
343
+ defaultValue: optsDefault.nbDecimalFormat,
344
+ },
345
+ {
346
+ id: "isAllowingNegativeNumbers",
347
+ label: "Permettre les nombres négatifs",
348
+ target: GeneratorOptionTarget.generation,
349
+ type: GeneratorOptionType.checkbox,
350
+ defaultValue: optsDefault.isAllowingNegativeNumbers,
351
+ },
352
+ ];
353
+ export const compareFracAndDec = {
354
+ id: "compareFracAndDec",
355
+ label: "Comparer une fraction, une fraction décimale et une écriture fractionnaire",
356
+ isSingleStep: true,
357
+ generator: (nb, opts) => getDistinctQuestions(() => getCompareFracAndDecQuestion(opts), nb, 30),
358
+ options,
359
+ qcmTimer: 60,
360
+ freeTimer: 60,
361
+ getPropositions,
362
+ isAnswerValid,
363
+ subject: "Mathématiques",
364
+ maxAllowedQuestions: 30,
365
+ getQuestionFromIdentifiers,
366
+ answerType: "QCU",
367
+ hasHintAndCorrection: true,
368
+ };
@@ -0,0 +1,12 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ import { NodeIdentifiers } from "../../../../tree/nodes/nodeConstructor.js";
3
+ type Item = {
4
+ name: string;
5
+ nodeIds: NodeIdentifiers;
6
+ };
7
+ type Identifiers = {
8
+ items: Item[];
9
+ };
10
+ export declare const comparePowersOfFracs: Exercise<Identifiers>;
11
+ export {};
12
+ //# sourceMappingURL=comparePowersOfFracs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"comparePowersOfFracs.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/ordering/comparePowersOfFracs.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAIrC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAO7C,KAAK,IAAI,GAAG;IACV,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,eAAe,CAAC;CAC1B,CAAC;AAEF,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,IAAI,EAAE,CAAC;CACf,CAAC;AAiMF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CActD,CAAC"}
@@ -0,0 +1,164 @@
1
+ import { addValidProp, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { randint } from "../../../../math/utils/random/randint.js";
4
+ import { NodeConstructor, } from "../../../../tree/nodes/nodeConstructor.js";
5
+ import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
6
+ import { power } from "../../../../tree/nodes/operators/powerNode.js";
7
+ import { substract } from "../../../../tree/nodes/operators/substractNode.js";
8
+ import { coinFlip } from "../../../../utils/alea/coinFlip.js";
9
+ import { shuffle } from "../../../../utils/alea/shuffle.js";
10
+ const getInstruction = (identifiers) => {
11
+ const { items } = identifiers;
12
+ return `Voici quatre nombres :
13
+
14
+ ${items
15
+ .map((item) => `
16
+
17
+ $$
18
+ ${item.name} = ${NodeConstructor.fromIdentifiers(item.nodeIds).toTex()}
19
+ $$
20
+
21
+ `)
22
+ .join("")}
23
+
24
+ Le plus grand de ces quatre nombres est :`;
25
+ };
26
+ const getHint = () => {
27
+ return `Ecris chaque nombre sous la forme d'une fraction.`;
28
+ };
29
+ const getCorrection = (identifiers) => {
30
+ const { items } = identifiers;
31
+ const nodes = items.map((item) => NodeConstructor.fromIdentifiers(item.nodeIds));
32
+ const sortedIndexes = [...Array(nodes.length).keys()].toSorted((i1, i2) => substract(nodes[i1], nodes[i2]).simplify().evaluate());
33
+ const compareSigns = [...Array(sortedIndexes.length).keys()]
34
+ .slice(0, -1)
35
+ .map((i) => {
36
+ const difference = substract(nodes[sortedIndexes[i]], nodes[sortedIndexes[i + 1]])
37
+ .simplify()
38
+ .evaluate();
39
+ const comparison = difference > 0 ? 1 : difference < 0 ? -1 : 0;
40
+ const compSymbol = comparison == 1 ? ">" : comparison == -1 ? "<" : "=";
41
+ return compSymbol;
42
+ });
43
+ const itemGreatest = sortedIndexes.map((sortedI) => items[sortedI])[items.length - 1];
44
+ return `On a :
45
+
46
+ ${items
47
+ .toSorted((item1, item2) => item1.name.localeCompare(item2.name))
48
+ .map((item) => {
49
+ const node = NodeConstructor.fromIdentifiers(item.nodeIds);
50
+ return `
51
+
52
+ $$
53
+ ${item.name} = ${node.toTex()} = ${node
54
+ .simplify({ calculatePowers: true, distributePowersOnFrac: true })
55
+ .toTex()}
56
+ $$
57
+
58
+ `;
59
+ })
60
+ .join("")}
61
+
62
+ Dans l'ordre croissant :
63
+
64
+ $$
65
+ ${sortedIndexes
66
+ .map((sortedI, i) => `${nodes[sortedI]
67
+ .simplify({ calculatePowers: true, distributePowersOnFrac: true })
68
+ .toTex()} ${i < sortedIndexes.length - 1 ? compareSigns[i] : ""}`)
69
+ .join("")}
70
+ $$
71
+
72
+ Le plus grand de ces $${items.length}$ nombres est $${itemGreatest.name}$.
73
+ `;
74
+ };
75
+ const getPropositions = (_, { answer, items }) => {
76
+ const propositions = [];
77
+ items
78
+ .toSorted((item1, item2) => item1.name.localeCompare(item2.name))
79
+ .forEach((item) => {
80
+ if (item.name === answer) {
81
+ addValidProp(propositions, answer);
82
+ }
83
+ else {
84
+ tryToAddWrongProp(propositions, item.name);
85
+ }
86
+ });
87
+ return propositions;
88
+ };
89
+ const getAnswer = (identifiers) => {
90
+ const { items } = identifiers;
91
+ const nodes = items.map((item) => NodeConstructor.fromIdentifiers(item.nodeIds));
92
+ const sortedIndexes = [...Array(items.length).keys()].toSorted((i1, i2) => substract(nodes[i1], nodes[i2]).simplify().evaluate());
93
+ const itemGreatest = sortedIndexes.map((i) => items[i])[items.length - 1];
94
+ return itemGreatest.name;
95
+ };
96
+ const getComparePowersOfFracsQuestion = () => {
97
+ function generateNodes() {
98
+ const a = coinFlip() ? 2 : 3;
99
+ const b = randint(a, 6);
100
+ const c = a + 1;
101
+ const nodes = [
102
+ power(frac(1, a), b),
103
+ power(frac(1, b), a),
104
+ frac(a, 100),
105
+ power(frac(1, c), c),
106
+ ];
107
+ return nodes;
108
+ }
109
+ function checkNodes(nodes) {
110
+ const sortedIndexes = [...Array(nodes.length).keys()].toSorted((i1, i2) => substract(nodes[i1], nodes[i2]).simplify().evaluate());
111
+ const compareSigns = [...Array(sortedIndexes.length).keys()]
112
+ .slice(0, -1)
113
+ .map((i) => {
114
+ const difference = substract(nodes[sortedIndexes[i]], nodes[sortedIndexes[i + 1]])
115
+ .simplify()
116
+ .evaluate();
117
+ const comparison = difference > 0 ? 1 : difference < 0 ? -1 : 0;
118
+ const compSymbol = comparison == 1 ? ">" : comparison == -1 ? "<" : "=";
119
+ return compSymbol;
120
+ });
121
+ return compareSigns[compareSigns.length - 1] !== "=";
122
+ }
123
+ let nodes;
124
+ do {
125
+ nodes = generateNodes();
126
+ } while (!checkNodes(nodes));
127
+ const names = ["A", "B", "C", "D"];
128
+ const items = shuffle(nodes).map((node, i) => {
129
+ return {
130
+ name: names[i],
131
+ nodeIds: node.toIdentifiers(),
132
+ };
133
+ });
134
+ return getQuestionFromIdentifiers({
135
+ items,
136
+ });
137
+ };
138
+ const getQuestionFromIdentifiers = (identifiers, opts) => {
139
+ const question = {
140
+ answer: getAnswer(identifiers),
141
+ instruction: getInstruction(identifiers),
142
+ keys: [],
143
+ answerFormat: "tex",
144
+ identifiers,
145
+ hint: getHint(identifiers),
146
+ correction: getCorrection(identifiers),
147
+ options: opts,
148
+ };
149
+ return question;
150
+ };
151
+ export const comparePowersOfFracs = {
152
+ id: "comparePowersOfFracs",
153
+ label: "Comparer des puissances de fractions",
154
+ isSingleStep: true,
155
+ generator: (nb, opts) => getDistinctQuestions(() => getComparePowersOfFracsQuestion(opts), nb, 30),
156
+ qcmTimer: 60,
157
+ freeTimer: 60,
158
+ getPropositions,
159
+ subject: "Mathématiques",
160
+ maxAllowedQuestions: 30,
161
+ getQuestionFromIdentifiers,
162
+ answerType: "QCU",
163
+ hasHintAndCorrection: true,
164
+ };
@@ -0,0 +1,9 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ type Identifiers = {
3
+ a: number;
4
+ b: number;
5
+ isAdd: boolean;
6
+ };
7
+ export declare const compareWithSquareRoots: Exercise<Identifiers>;
8
+ export {};
9
+ //# sourceMappingURL=compareWithSquareRoots.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compareWithSquareRoots.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/ordering/compareWithSquareRoots.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAQrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,OAAO,CAAC;CAChB,CAAC;AAmKF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,CAgBxD,CAAC"}
@@ -0,0 +1,140 @@
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 { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
5
+ import { coinFlip } from "../../../../utils/alea/coinFlip.js";
6
+ import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
7
+ const getInstruction = (identifiers) => {
8
+ const { a, b, isAdd } = identifiers;
9
+ return `Sachant que $\\sqrt{${a}} < \\sqrt{${a + 1}}$,
10
+
11
+ comparer $${b} ${isAdd ? "+" : "-"} \\sqrt{${a}}$ et $${b} ${isAdd ? "+" : "-"} \\sqrt{${a + 1}}$.`;
12
+ };
13
+ const getHint = (identifiers) => {
14
+ const { a } = identifiers;
15
+ return `En partant de $\\sqrt{${a}} < \\sqrt{${a + 1}}$,
16
+
17
+ essaie de te ramener aux expressions demandées
18
+
19
+ par des opérations que l'on effectue à droite et à gauche de l'inégalité.
20
+
21
+ Attention si tu multiplies à droite et à gauche d'une inégalité par un nombre négatif, l'inégalité se renverse.`;
22
+ };
23
+ const getCorrection = (identifiers) => {
24
+ const { a, b, isAdd } = identifiers;
25
+ return `On sait que :
26
+
27
+ $$
28
+ \\sqrt{${a}} < \\sqrt{${a + 1}}
29
+ $$
30
+
31
+ ${isAdd
32
+ ? ``
33
+ : `On multiplie par $-1$ des deux côtés et on renverse l'inégalité :
34
+
35
+ $$
36
+ -\\sqrt{${a}} > -\\sqrt{${a + 1}}
37
+ $$
38
+
39
+ `}
40
+ On ajoute $${b}$ de chaque côté de l'inégalité :
41
+
42
+ $$
43
+ ${b} ${isAdd ? "+" : "-"} \\sqrt{${a}} ${isAdd ? "<" : ">"} ${b} ${isAdd ? "+" : "-"} \\sqrt{${a + 1}}
44
+ $$
45
+
46
+ `;
47
+ };
48
+ const getAnswer = (identifiers) => {
49
+ const { a, b, isAdd } = identifiers;
50
+ return `${b} ${isAdd ? "+" : "-"} \\sqrt{${a}} ${isAdd ? "<" : ">"} ${b} ${isAdd ? "+" : "-"} \\sqrt{${a + 1}}`;
51
+ };
52
+ const isAnswerValid = (ans, { answer }) => {
53
+ function getOrderedNodesFromTex(tex, compSymbol) {
54
+ return tex
55
+ .split(compSymbol)
56
+ .map((str) => parseAlgebraic(str))
57
+ .toSorted(() => (compSymbol === "<" ? -1 : +1));
58
+ }
59
+ try {
60
+ const compSymbol = ans.includes("<")
61
+ ? "<"
62
+ : ans.includes(">")
63
+ ? ">"
64
+ : undefined;
65
+ if (compSymbol) {
66
+ const [ansNode1, ansNode2] = getOrderedNodesFromTex(ans, compSymbol);
67
+ const [answerNode1, answerNode2] = getOrderedNodesFromTex(answer, "<");
68
+ return (ansNode1.simplify().equals(answerNode1.simplify()) &&
69
+ ansNode2.simplify().equals(answerNode2.simplify()));
70
+ }
71
+ else {
72
+ return false;
73
+ }
74
+ }
75
+ catch (err) {
76
+ return handleVEAError(err);
77
+ }
78
+ };
79
+ const getPropositions = (nbProps, { answer, ...identifiers }) => {
80
+ const { a, b, isAdd } = identifiers;
81
+ const propositions = [];
82
+ addValidProp(propositions, `${b} ${isAdd ? "+" : "-"} \\sqrt{${a}} ${isAdd ? "<" : ">"} ${b} ${isAdd ? "+" : "-"} \\sqrt{${a + 1}}`, "tex");
83
+ tryToAddWrongProp(propositions, `${b} ${isAdd ? "+" : "-"} \\sqrt{${a}} ${!isAdd ? "<" : ">"} ${b} ${isAdd ? "+" : "-"} \\sqrt{${a + 1}}`, "tex");
84
+ return shuffleProps(propositions, nbProps);
85
+ };
86
+ const getKeys = (identifiers) => {
87
+ const { a, b, isAdd } = identifiers;
88
+ return [
89
+ "inf",
90
+ "sup",
91
+ ...[
92
+ `${b} ${isAdd ? "+" : "-"} \\sqrt{${a}}`,
93
+ `${b} ${isAdd ? "+" : "-"} \\sqrt{${a + 1}}`,
94
+ ].map((tex) => {
95
+ return {
96
+ id: "custom",
97
+ label: tex,
98
+ labelType: "tex",
99
+ mathfieldInstructions: {
100
+ method: "write",
101
+ content: tex,
102
+ },
103
+ };
104
+ }),
105
+ ];
106
+ };
107
+ const getCompareWithSquareRootsQuestion = () => {
108
+ const a = randint(2, 150);
109
+ const b = randint(1, 100);
110
+ const isAdd = coinFlip();
111
+ return getQuestionFromIdentifiers({ a, b, isAdd });
112
+ };
113
+ const getQuestionFromIdentifiers = (identifiers) => {
114
+ const question = {
115
+ answer: getAnswer(identifiers),
116
+ instruction: getInstruction(identifiers),
117
+ keys: getKeys(identifiers),
118
+ answerFormat: "tex",
119
+ identifiers,
120
+ hint: getHint(identifiers),
121
+ correction: getCorrection(identifiers),
122
+ };
123
+ return question;
124
+ };
125
+ export const compareWithSquareRoots = {
126
+ id: "compareWithSquareRoots",
127
+ label: "Comparer deux nombres directement (avec des racines carrées)",
128
+ isSingleStep: true,
129
+ generator: (nb) => getDistinctQuestions(() => getCompareWithSquareRootsQuestion(), nb, 30),
130
+ qcmTimer: 60,
131
+ freeTimer: 60,
132
+ getPropositions,
133
+ isAnswerValid,
134
+ getAnswer,
135
+ subject: "Mathématiques",
136
+ maxAllowedQuestions: 30,
137
+ getQuestionFromIdentifiers,
138
+ answerType: "QCU",
139
+ hasHintAndCorrection: true,
140
+ };