math-exercises 3.0.124 → 3.0.126

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (351) hide show
  1. package/lib/exercises/math/calcul/arithmetics/primeNumbers.d.ts +1 -1
  2. package/lib/exercises/math/calcul/arithmetics/primeNumbers.d.ts.map +1 -1
  3. package/lib/exercises/math/calcul/arithmetics/primeNumbers.js +20 -14
  4. package/lib/exercises/math/calcul/fractions/fractionsMix.js +1 -1
  5. package/lib/exercises/math/calcul/fractions/fractionsSumsPrimeDenominators.d.ts.map +1 -1
  6. package/lib/exercises/math/calcul/fractions/fractionsSumsPrimeDenominators.js +61 -1
  7. package/lib/exercises/math/calcul/mentalCaluls/index.d.ts +1 -0
  8. package/lib/exercises/math/calcul/mentalCaluls/index.d.ts.map +1 -1
  9. package/lib/exercises/math/calcul/mentalCaluls/index.js +1 -0
  10. package/lib/exercises/math/calcul/mentalCaluls/mentalProgramSolve.d.ts +15 -0
  11. package/lib/exercises/math/calcul/mentalCaluls/mentalProgramSolve.d.ts.map +1 -0
  12. package/lib/exercises/math/calcul/mentalCaluls/mentalProgramSolve.js +217 -0
  13. package/lib/exercises/math/calcul/ordering/compareA10N.d.ts +16 -0
  14. package/lib/exercises/math/calcul/ordering/compareA10N.d.ts.map +1 -0
  15. package/lib/exercises/math/calcul/ordering/compareA10N.js +327 -0
  16. package/lib/exercises/math/calcul/ordering/compareABUsingQuotient.d.ts +8 -0
  17. package/lib/exercises/math/calcul/ordering/compareABUsingQuotient.d.ts.map +1 -0
  18. package/lib/exercises/math/calcul/ordering/compareABUsingQuotient.js +221 -0
  19. package/lib/exercises/math/calcul/ordering/compareFracABWithFracAPlusCBPlusC.d.ts +9 -0
  20. package/lib/exercises/math/calcul/ordering/compareFracABWithFracAPlusCBPlusC.d.ts.map +1 -0
  21. package/lib/exercises/math/calcul/ordering/compareFracABWithFracAPlusCBPlusC.js +135 -0
  22. package/lib/exercises/math/calcul/ordering/compareFracAndDec.d.ts +29 -0
  23. package/lib/exercises/math/calcul/ordering/compareFracAndDec.d.ts.map +1 -0
  24. package/lib/exercises/math/calcul/ordering/compareFracAndDec.js +367 -0
  25. package/lib/exercises/math/calcul/ordering/comparePowersOfFracs.d.ts +12 -0
  26. package/lib/exercises/math/calcul/ordering/comparePowersOfFracs.d.ts.map +1 -0
  27. package/lib/exercises/math/calcul/ordering/comparePowersOfFracs.js +164 -0
  28. package/lib/exercises/math/calcul/ordering/compareWithSquareRoots.d.ts +9 -0
  29. package/lib/exercises/math/calcul/ordering/compareWithSquareRoots.d.ts.map +1 -0
  30. package/lib/exercises/math/calcul/ordering/compareWithSquareRoots.js +140 -0
  31. package/lib/exercises/math/calcul/ordering/index.d.ts +6 -0
  32. package/lib/exercises/math/calcul/ordering/index.d.ts.map +1 -1
  33. package/lib/exercises/math/calcul/ordering/index.js +6 -0
  34. package/lib/exercises/math/calcul/rounding/estimateAroundPow10NTimesAroundPow10N.d.ts +9 -0
  35. package/lib/exercises/math/calcul/rounding/estimateAroundPow10NTimesAroundPow10N.d.ts.map +1 -0
  36. package/lib/exercises/math/calcul/rounding/estimateAroundPow10NTimesAroundPow10N.js +84 -0
  37. package/lib/exercises/math/calcul/rounding/estimatePow10NPlusPow10MinusN.d.ts +8 -0
  38. package/lib/exercises/math/calcul/rounding/estimatePow10NPlusPow10MinusN.d.ts.map +1 -0
  39. package/lib/exercises/math/calcul/rounding/estimatePow10NPlusPow10MinusN.js +90 -0
  40. package/lib/exercises/math/calcul/rounding/index.d.ts +2 -0
  41. package/lib/exercises/math/calcul/rounding/index.d.ts.map +1 -1
  42. package/lib/exercises/math/calcul/rounding/index.js +2 -0
  43. package/lib/exercises/math/calculLitteral/equation/equationFromProblem.d.ts +13 -0
  44. package/lib/exercises/math/calculLitteral/equation/equationFromProblem.d.ts.map +1 -0
  45. package/lib/exercises/math/calculLitteral/equation/equationFromProblem.js +414 -0
  46. package/lib/exercises/math/calculLitteral/equation/index.d.ts +1 -0
  47. package/lib/exercises/math/calculLitteral/equation/index.d.ts.map +1 -1
  48. package/lib/exercises/math/calculLitteral/equation/index.js +1 -0
  49. package/lib/exercises/math/calculLitteral/factorisation/factorizeAX2PlusBX.d.ts +10 -0
  50. package/lib/exercises/math/calculLitteral/factorisation/factorizeAX2PlusBX.d.ts.map +1 -0
  51. package/lib/exercises/math/calculLitteral/factorisation/factorizeAX2PlusBX.js +70 -0
  52. package/lib/exercises/math/calculLitteral/factorisation/index.d.ts +1 -0
  53. package/lib/exercises/math/calculLitteral/factorisation/index.d.ts.map +1 -1
  54. package/lib/exercises/math/calculLitteral/factorisation/index.js +1 -0
  55. package/lib/exercises/math/calculLitteral/index.d.ts +2 -0
  56. package/lib/exercises/math/calculLitteral/index.d.ts.map +1 -1
  57. package/lib/exercises/math/calculLitteral/index.js +2 -0
  58. package/lib/exercises/math/calculLitteral/isolate/index.d.ts +2 -1
  59. package/lib/exercises/math/calculLitteral/isolate/index.d.ts.map +1 -1
  60. package/lib/exercises/math/calculLitteral/isolate/index.js +2 -1
  61. package/lib/exercises/math/calculLitteral/isolate/isolateUInInvXPlusInvYEqualsInvU.d.ts +8 -0
  62. package/lib/exercises/math/calculLitteral/isolate/isolateUInInvXPlusInvYEqualsInvU.d.ts.map +1 -0
  63. package/lib/exercises/math/calculLitteral/isolate/isolateUInInvXPlusInvYEqualsInvU.js +107 -0
  64. package/lib/exercises/math/calculLitteral/isolate/isolateXInInvXPlusInvYEqualsInvU.d.ts +7 -0
  65. package/lib/exercises/math/calculLitteral/isolate/isolateXInInvXPlusInvYEqualsInvU.d.ts.map +1 -0
  66. package/lib/exercises/math/calculLitteral/isolate/isolateXInInvXPlusInvYEqualsInvU.js +80 -0
  67. package/lib/exercises/math/calculLitteral/ordering/compareAMinusB.d.ts +10 -0
  68. package/lib/exercises/math/calculLitteral/ordering/compareAMinusB.d.ts.map +1 -0
  69. package/lib/exercises/math/calculLitteral/ordering/compareAMinusB.js +182 -0
  70. package/lib/exercises/math/calculLitteral/ordering/compareFromPiMinusFrac.d.ts +9 -0
  71. package/lib/exercises/math/calculLitteral/ordering/compareFromPiMinusFrac.d.ts.map +1 -0
  72. package/lib/exercises/math/calculLitteral/ordering/compareFromPiMinusFrac.js +144 -0
  73. package/lib/exercises/math/calculLitteral/ordering/index.d.ts +3 -0
  74. package/lib/exercises/math/calculLitteral/ordering/index.d.ts.map +1 -0
  75. package/lib/exercises/math/calculLitteral/ordering/index.js +2 -0
  76. package/lib/exercises/math/calculLitteral/simplifying/compareATimes0.d.ts +11 -0
  77. package/lib/exercises/math/calculLitteral/simplifying/compareATimes0.d.ts.map +1 -0
  78. package/lib/exercises/math/calculLitteral/simplifying/compareATimes0.js +120 -0
  79. package/lib/exercises/math/calculLitteral/simplifying/compareFracXA.d.ts +8 -0
  80. package/lib/exercises/math/calculLitteral/simplifying/compareFracXA.d.ts.map +1 -0
  81. package/lib/exercises/math/calculLitteral/simplifying/compareFracXA.js +67 -0
  82. package/lib/exercises/math/calculLitteral/simplifying/compareMinusA.d.ts +11 -0
  83. package/lib/exercises/math/calculLitteral/simplifying/compareMinusA.d.ts.map +1 -0
  84. package/lib/exercises/math/calculLitteral/simplifying/compareMinusA.js +114 -0
  85. package/lib/exercises/math/calculLitteral/simplifying/index.d.ts +5 -0
  86. package/lib/exercises/math/calculLitteral/simplifying/index.d.ts.map +1 -1
  87. package/lib/exercises/math/calculLitteral/simplifying/index.js +5 -0
  88. package/lib/exercises/math/calculLitteral/simplifying/pickSameAsAPercentOfB.d.ts +13 -0
  89. package/lib/exercises/math/calculLitteral/simplifying/pickSameAsAPercentOfB.d.ts.map +1 -0
  90. package/lib/exercises/math/calculLitteral/simplifying/pickSameAsAPercentOfB.js +125 -0
  91. package/lib/exercises/math/calculLitteral/simplifying/pickSameAsInverseOfFracAB.d.ts +14 -0
  92. package/lib/exercises/math/calculLitteral/simplifying/pickSameAsInverseOfFracAB.d.ts.map +1 -0
  93. package/lib/exercises/math/calculLitteral/simplifying/pickSameAsInverseOfFracAB.js +148 -0
  94. package/lib/exercises/math/calculLitteral/writing/writeLitExpFromFrenchExp.d.ts +5 -27
  95. package/lib/exercises/math/calculLitteral/writing/writeLitExpFromFrenchExp.d.ts.map +1 -1
  96. package/lib/exercises/math/calculLitteral/writing/writeLitExpFromFrenchExp.js +178 -241
  97. package/lib/exercises/math/conversion/index.d.ts +4 -0
  98. package/lib/exercises/math/conversion/index.d.ts.map +1 -1
  99. package/lib/exercises/math/conversion/index.js +4 -0
  100. package/lib/exercises/math/conversion/kmPerMinToKmPerHourConversion.d.ts +8 -0
  101. package/lib/exercises/math/conversion/kmPerMinToKmPerHourConversion.d.ts.map +1 -0
  102. package/lib/exercises/math/conversion/kmPerMinToKmPerHourConversion.js +98 -0
  103. package/lib/exercises/math/conversion/minutesToHours.d.ts +10 -0
  104. package/lib/exercises/math/conversion/minutesToHours.d.ts.map +1 -0
  105. package/lib/exercises/math/conversion/minutesToHours.js +150 -0
  106. package/lib/exercises/math/conversion/prefixToNumber.d.ts +15 -0
  107. package/lib/exercises/math/conversion/prefixToNumber.d.ts.map +1 -0
  108. package/lib/exercises/math/conversion/prefixToNumber.js +233 -0
  109. package/lib/exercises/math/conversion/secondsToHours.d.ts +10 -0
  110. package/lib/exercises/math/conversion/secondsToHours.d.ts.map +1 -0
  111. package/lib/exercises/math/conversion/secondsToHours.js +150 -0
  112. package/lib/exercises/math/conversion/volumeConversion.d.ts.map +1 -1
  113. package/lib/exercises/math/conversion/volumeConversion.js +7 -1
  114. package/lib/exercises/math/dataRepresentations/barChartInterpreting.d.ts +50 -0
  115. package/lib/exercises/math/dataRepresentations/barChartInterpreting.d.ts.map +1 -0
  116. package/lib/exercises/math/dataRepresentations/barChartInterpreting.js +517 -0
  117. package/lib/exercises/math/dataRepresentations/boxPlotInterpreting.d.ts +7 -0
  118. package/lib/exercises/math/dataRepresentations/boxPlotInterpreting.d.ts.map +1 -0
  119. package/lib/exercises/math/dataRepresentations/boxPlotInterpreting.js +223 -0
  120. package/lib/exercises/math/dataRepresentations/cartesianGraphExtremaReading.d.ts +10 -0
  121. package/lib/exercises/math/dataRepresentations/cartesianGraphExtremaReading.d.ts.map +1 -0
  122. package/lib/exercises/math/dataRepresentations/cartesianGraphExtremaReading.js +139 -0
  123. package/lib/exercises/math/dataRepresentations/dataToGraphGraphToData.d.ts +8 -0
  124. package/lib/exercises/math/dataRepresentations/dataToGraphGraphToData.d.ts.map +1 -0
  125. package/lib/exercises/math/dataRepresentations/dataToGraphGraphToData.js +133 -0
  126. package/lib/exercises/math/dataRepresentations/graphReading.d.ts +8 -0
  127. package/lib/exercises/math/dataRepresentations/graphReading.d.ts.map +1 -0
  128. package/lib/exercises/math/dataRepresentations/graphReading.js +136 -0
  129. package/lib/exercises/math/dataRepresentations/halfPieChartCommenting.d.ts +18 -0
  130. package/lib/exercises/math/dataRepresentations/halfPieChartCommenting.d.ts.map +1 -0
  131. package/lib/exercises/math/dataRepresentations/halfPieChartCommenting.js +228 -0
  132. package/lib/exercises/math/dataRepresentations/halfPieChartReading.d.ts +8 -0
  133. package/lib/exercises/math/dataRepresentations/halfPieChartReading.d.ts.map +1 -0
  134. package/lib/exercises/math/dataRepresentations/halfPieChartReading.js +213 -0
  135. package/lib/exercises/math/dataRepresentations/histogramReading.d.ts +9 -0
  136. package/lib/exercises/math/dataRepresentations/histogramReading.d.ts.map +1 -0
  137. package/lib/exercises/math/dataRepresentations/histogramReading.js +163 -0
  138. package/lib/exercises/math/dataRepresentations/index.d.ts +10 -0
  139. package/lib/exercises/math/dataRepresentations/index.d.ts.map +1 -1
  140. package/lib/exercises/math/dataRepresentations/index.js +10 -0
  141. package/lib/exercises/math/dataRepresentations/plausibleGraph.d.ts +9 -0
  142. package/lib/exercises/math/dataRepresentations/plausibleGraph.d.ts.map +1 -0
  143. package/lib/exercises/math/dataRepresentations/plausibleGraph.js +145 -0
  144. package/lib/exercises/math/dataRepresentations/scatterPlotCommenting.d.ts +9 -0
  145. package/lib/exercises/math/dataRepresentations/scatterPlotCommenting.d.ts.map +1 -0
  146. package/lib/exercises/math/dataRepresentations/scatterPlotCommenting.js +308 -0
  147. package/lib/exercises/math/derivation/derivative/exp/expDerivativeFour.d.ts.map +1 -1
  148. package/lib/exercises/math/derivation/derivative/exp/expDerivativeFour.js +10 -5
  149. package/lib/exercises/math/functions/affines/coordsOfPointOnAffineFindX.d.ts +8 -0
  150. package/lib/exercises/math/functions/affines/coordsOfPointOnAffineFindX.d.ts.map +1 -0
  151. package/lib/exercises/math/functions/affines/coordsOfPointOnAffineFindX.js +103 -0
  152. package/lib/exercises/math/functions/affines/coordsOfPointOnAffineFindY.d.ts +8 -0
  153. package/lib/exercises/math/functions/affines/coordsOfPointOnAffineFindY.d.ts.map +1 -0
  154. package/lib/exercises/math/functions/affines/coordsOfPointOnAffineFindY.js +100 -0
  155. package/lib/exercises/math/functions/affines/drawAffineFromLitExp.js +5 -5
  156. package/lib/exercises/math/functions/affines/drawAffineFromPointAndLeadingCoeff.d.ts +16 -0
  157. package/lib/exercises/math/functions/affines/drawAffineFromPointAndLeadingCoeff.d.ts.map +1 -0
  158. package/lib/exercises/math/functions/affines/drawAffineFromPointAndLeadingCoeff.js +215 -0
  159. package/lib/exercises/math/functions/affines/drawAffineFromProgCalc.d.ts +13 -0
  160. package/lib/exercises/math/functions/affines/drawAffineFromProgCalc.d.ts.map +1 -0
  161. package/lib/exercises/math/functions/affines/drawAffineFromProgCalc.js +206 -0
  162. package/lib/exercises/math/functions/affines/index.d.ts +7 -0
  163. package/lib/exercises/math/functions/affines/index.d.ts.map +1 -1
  164. package/lib/exercises/math/functions/affines/index.js +7 -0
  165. package/lib/exercises/math/functions/affines/recognizeExprAffine.d.ts +20 -0
  166. package/lib/exercises/math/functions/affines/recognizeExprAffine.d.ts.map +1 -0
  167. package/lib/exercises/math/functions/affines/recognizeExprAffine.js +284 -0
  168. package/lib/exercises/math/functions/affines/representationOfAffine.d.ts +13 -0
  169. package/lib/exercises/math/functions/affines/representationOfAffine.d.ts.map +1 -0
  170. package/lib/exercises/math/functions/affines/representationOfAffine.js +184 -0
  171. package/lib/exercises/math/functions/basics/coordsOfPointOnCurveFindY.d.ts +14 -0
  172. package/lib/exercises/math/functions/basics/coordsOfPointOnCurveFindY.d.ts.map +1 -0
  173. package/lib/exercises/math/functions/basics/coordsOfPointOnCurveFindY.js +216 -0
  174. package/lib/exercises/math/functions/basics/findZeroesProductQuotient.d.ts.map +1 -1
  175. package/lib/exercises/math/functions/basics/findZeroesProductQuotient.js +29 -2
  176. package/lib/exercises/math/functions/basics/index.d.ts +1 -0
  177. package/lib/exercises/math/functions/basics/index.d.ts.map +1 -1
  178. package/lib/exercises/math/functions/basics/index.js +1 -0
  179. package/lib/exercises/math/functions/basics/inverseImageFunctionGeogebra.d.ts.map +1 -1
  180. package/lib/exercises/math/functions/basics/inverseImageFunctionGeogebra.js +72 -61
  181. package/lib/exercises/math/functions/composition/functionComposition.d.ts +8 -0
  182. package/lib/exercises/math/functions/composition/functionComposition.d.ts.map +1 -0
  183. package/lib/exercises/math/functions/composition/functionComposition.js +238 -0
  184. package/lib/exercises/math/functions/composition/index.d.ts +2 -0
  185. package/lib/exercises/math/functions/composition/index.d.ts.map +1 -0
  186. package/lib/exercises/math/functions/composition/index.js +1 -0
  187. package/lib/exercises/math/functions/index.d.ts +1 -0
  188. package/lib/exercises/math/functions/index.d.ts.map +1 -1
  189. package/lib/exercises/math/functions/index.js +1 -0
  190. package/lib/exercises/math/functions/trinoms/roots/rootsFromDevForm.d.ts.map +1 -1
  191. package/lib/exercises/math/functions/trinoms/roots/rootsFromDevForm.js +41 -16
  192. package/lib/exercises/math/functions/trinoms/roots/rootsReading.d.ts.map +1 -1
  193. package/lib/exercises/math/functions/trinoms/roots/rootsReading.js +3 -2
  194. package/lib/exercises/math/functions/trinoms/sign/trinomSignFromFacto.d.ts +1 -0
  195. package/lib/exercises/math/functions/trinoms/sign/trinomSignFromFacto.d.ts.map +1 -1
  196. package/lib/exercises/math/functions/trinoms/sign/trinomSignFromFacto.js +21 -13
  197. package/lib/exercises/math/geometry/angles/anglesUsingIsParallel.d.ts +23 -0
  198. package/lib/exercises/math/geometry/angles/anglesUsingIsParallel.d.ts.map +1 -0
  199. package/lib/exercises/math/geometry/angles/anglesUsingIsParallel.js +448 -0
  200. package/lib/exercises/math/geometry/angles/index.js +2 -0
  201. package/lib/exercises/math/geometry/angles/isParallelUsingAngles.d.ts +23 -0
  202. package/lib/exercises/math/geometry/angles/isParallelUsingAngles.d.ts.map +1 -0
  203. package/lib/exercises/math/geometry/angles/isParallelUsingAngles.js +402 -0
  204. package/lib/exercises/math/geometry/cartesian/placeAbscissOnSemiLine.d.ts +9 -6
  205. package/lib/exercises/math/geometry/cartesian/placeAbscissOnSemiLine.d.ts.map +1 -1
  206. package/lib/exercises/math/geometry/cartesian/placeAbscissOnSemiLine.js +140 -60
  207. package/lib/exercises/math/geometry/convexity/convexityQuadrinomialsGeo.js +1 -1
  208. package/lib/exercises/math/geometry/perimeters/circleCircumference.d.ts.map +1 -1
  209. package/lib/exercises/math/geometry/perimeters/circleCircumference.js +15 -7
  210. package/lib/exercises/math/geometry/shapes/basicShapesNaming.d.ts.map +1 -1
  211. package/lib/exercises/math/geometry/shapes/basicShapesNaming.js +5 -3
  212. package/lib/exercises/math/geometry/vectors/colinearity/colinearityFromPicture.d.ts.map +1 -1
  213. package/lib/exercises/math/geometry/vectors/colinearity/colinearityFromPicture.js +121 -104
  214. package/lib/exercises/math/geometry/vectors/vectorRepresentative.d.ts.map +1 -1
  215. package/lib/exercises/math/geometry/vectors/vectorRepresentative.js +3 -2
  216. package/lib/exercises/math/percent/evolutions/evolutionToCM.js +2 -2
  217. package/lib/exercises/math/percent/findProportion.d.ts +6 -1
  218. package/lib/exercises/math/percent/findProportion.d.ts.map +1 -1
  219. package/lib/exercises/math/percent/findProportion.js +162 -45
  220. package/lib/exercises/math/powers/calculateNegativePower.d.ts +5 -1
  221. package/lib/exercises/math/powers/calculateNegativePower.d.ts.map +1 -1
  222. package/lib/exercises/math/powers/calculateNegativePower.js +93 -29
  223. package/lib/exercises/math/probaStat/basicProbas/index.d.ts +1 -0
  224. package/lib/exercises/math/probaStat/basicProbas/index.d.ts.map +1 -1
  225. package/lib/exercises/math/probaStat/basicProbas/index.js +1 -0
  226. package/lib/exercises/math/probaStat/basicProbas/possibleValuesForProba.d.ts +0 -1
  227. package/lib/exercises/math/probaStat/basicProbas/possibleValuesForProba.d.ts.map +1 -1
  228. package/lib/exercises/math/probaStat/basicProbas/possibleValuesForProba.js +42 -80
  229. package/lib/exercises/math/probaStat/conditionalProbaWriteFromFrench.d.ts +9 -0
  230. package/lib/exercises/math/probaStat/conditionalProbaWriteFromFrench.d.ts.map +1 -0
  231. package/lib/exercises/math/probaStat/conditionalProbaWriteFromFrench.js +217 -0
  232. package/lib/exercises/math/probaStat/index.d.ts +2 -0
  233. package/lib/exercises/math/probaStat/index.d.ts.map +1 -1
  234. package/lib/exercises/math/probaStat/index.js +2 -0
  235. package/lib/exercises/math/probaStat/probaAsSumOfProbas.d.ts +30 -0
  236. package/lib/exercises/math/probaStat/probaAsSumOfProbas.d.ts.map +1 -0
  237. package/lib/exercises/math/probaStat/probaAsSumOfProbas.js +548 -0
  238. package/lib/exercises/math/probaStat/probaFromTableNoContext.d.ts.map +1 -1
  239. package/lib/exercises/math/probaStat/probaFromTableNoContext.js +10 -2
  240. package/lib/exercises/math/probaStat/probaFromTableWithContext.d.ts.map +1 -1
  241. package/lib/exercises/math/probaStat/probaFromTableWithContext.js +2 -1
  242. package/lib/exercises/math/probaStat/stats1var/index.d.ts +2 -0
  243. package/lib/exercises/math/probaStat/stats1var/index.d.ts.map +1 -1
  244. package/lib/exercises/math/probaStat/stats1var/index.js +2 -0
  245. package/lib/exercises/math/probaStat/stats1var/interpretIndicatorsForLists.d.ts +9 -0
  246. package/lib/exercises/math/probaStat/stats1var/interpretIndicatorsForLists.d.ts.map +1 -0
  247. package/lib/exercises/math/probaStat/stats1var/interpretIndicatorsForLists.js +90 -0
  248. package/lib/exercises/math/probaStat/stats1var/plausibilityOfAverage.d.ts +10 -0
  249. package/lib/exercises/math/probaStat/stats1var/plausibilityOfAverage.d.ts.map +1 -0
  250. package/lib/exercises/math/probaStat/stats1var/plausibilityOfAverage.js +151 -0
  251. package/lib/exercises/math/probaStat/stats1var/quartilesList.d.ts +4 -1
  252. package/lib/exercises/math/probaStat/stats1var/quartilesList.d.ts.map +1 -1
  253. package/lib/exercises/math/probaStat/stats1var/quartilesList.js +46 -27
  254. package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormula.d.ts.map +1 -1
  255. package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormula.js +14 -2
  256. package/lib/exercises/math/sequences/geometric/geometricReasonUsage.d.ts +1 -0
  257. package/lib/exercises/math/sequences/geometric/geometricReasonUsage.d.ts.map +1 -1
  258. package/lib/exercises/math/sequences/geometric/geometricReasonUsage.js +43 -19
  259. package/lib/exercises/math/sequences/sequenceEvaluation.d.ts.map +1 -1
  260. package/lib/exercises/math/sequences/sequenceEvaluation.js +18 -1
  261. package/lib/exercises/pc/chemicalReactions/chemicalEquations.d.ts.map +1 -1
  262. package/lib/exercises/pc/chemicalReactions/chemicalEquations.js +17 -2
  263. package/lib/exercises/pc/electricity/calculateUEqualsRI.d.ts +7 -0
  264. package/lib/exercises/pc/electricity/calculateUEqualsRI.d.ts.map +1 -0
  265. package/lib/exercises/pc/electricity/calculateUEqualsRI.js +73 -0
  266. package/lib/exercises/pc/electricity/index.d.ts +1 -0
  267. package/lib/exercises/pc/electricity/index.d.ts.map +1 -1
  268. package/lib/exercises/pc/electricity/index.js +1 -0
  269. package/lib/exercises/pc/index.d.ts +1 -0
  270. package/lib/exercises/pc/index.d.ts.map +1 -1
  271. package/lib/exercises/pc/index.js +1 -0
  272. package/lib/exercises/pc/mole/molarMass.d.ts.map +1 -1
  273. package/lib/exercises/pc/mole/molarMass.js +7 -1
  274. package/lib/exercises/pc/moleculeFormula.d.ts.map +1 -1
  275. package/lib/exercises/pc/moleculeFormula.js +4 -3
  276. package/lib/exercises/pc/motion/averageSpeed.d.ts +9 -4
  277. package/lib/exercises/pc/motion/averageSpeed.d.ts.map +1 -1
  278. package/lib/exercises/pc/motion/averageSpeed.js +132 -61
  279. package/lib/exercises/pc/motion/averageSpeedCalculation.d.ts.map +1 -1
  280. package/lib/exercises/pc/motion/averageSpeedCalculation.js +10 -4
  281. package/lib/exercises/pc/optics/index.d.ts +2 -0
  282. package/lib/exercises/pc/optics/index.d.ts.map +1 -0
  283. package/lib/exercises/pc/optics/index.js +1 -0
  284. package/lib/exercises/pc/optics/lensFormula.d.ts +21 -0
  285. package/lib/exercises/pc/optics/lensFormula.d.ts.map +1 -0
  286. package/lib/exercises/pc/optics/lensFormula.js +415 -0
  287. package/lib/exercises/pc/recognizeRefractionOrReflectionAngles.d.ts +2 -2
  288. package/lib/exercises/pc/recognizeRefractionOrReflectionAngles.js +15 -15
  289. package/lib/exercises/pc/weight/calculateWeight.d.ts +8 -1
  290. package/lib/exercises/pc/weight/calculateWeight.d.ts.map +1 -1
  291. package/lib/exercises/pc/weight/calculateWeight.js +113 -38
  292. package/lib/exercises/utils/geogebra/toolBarConstructor.d.ts +1 -0
  293. package/lib/exercises/utils/geogebra/toolBarConstructor.d.ts.map +1 -1
  294. package/lib/exercises/utils/geogebra/toolBarConstructor.js +3 -1
  295. package/lib/geogebra/parsers/geogebraParser.d.ts +4 -0
  296. package/lib/geogebra/parsers/geogebraParser.d.ts.map +1 -1
  297. package/lib/geogebra/parsers/geogebraParser.js +17 -0
  298. package/lib/index.d.ts +392 -23
  299. package/lib/index.d.ts.map +1 -1
  300. package/lib/latexTester.d.ts.map +1 -1
  301. package/lib/latexTester.js +1 -0
  302. package/lib/math/geometry/CloudPoints.d.ts +10 -0
  303. package/lib/math/geometry/CloudPoints.d.ts.map +1 -1
  304. package/lib/math/geometry/CloudPoints.js +119 -0
  305. package/lib/math/geometry/line.d.ts +1 -0
  306. package/lib/math/geometry/line.d.ts.map +1 -1
  307. package/lib/math/geometry/line.js +10 -2
  308. package/lib/math/geometry/vector.d.ts +1 -0
  309. package/lib/math/geometry/vector.d.ts.map +1 -1
  310. package/lib/math/geometry/vector.js +12 -0
  311. package/lib/math/progCalc/progCalc.d.ts +46 -0
  312. package/lib/math/progCalc/progCalc.d.ts.map +1 -0
  313. package/lib/math/progCalc/progCalc.js +239 -0
  314. package/lib/math/utils/latex/realize.d.ts +12 -0
  315. package/lib/math/utils/latex/realize.d.ts.map +1 -0
  316. package/lib/math/utils/latex/realize.js +43 -0
  317. package/lib/pc/constants/molecularChemistry/molecule.d.ts +2 -0
  318. package/lib/pc/constants/molecularChemistry/molecule.d.ts.map +1 -1
  319. package/lib/pc/constants/molecularChemistry/molecule.js +52 -0
  320. package/lib/pc/units/timeUnits.d.ts +5 -3
  321. package/lib/pc/units/timeUnits.d.ts.map +1 -1
  322. package/lib/pc/units/timeUnits.js +25 -19
  323. package/lib/tests/questionTest.d.ts.map +1 -1
  324. package/lib/tests/questionTest.js +1 -1
  325. package/lib/tests/singleExo.test.js +3 -3
  326. package/lib/tree/nodes/algebraicNode.d.ts.map +1 -1
  327. package/lib/tree/nodes/operators/addNode.d.ts +4 -2
  328. package/lib/tree/nodes/operators/addNode.d.ts.map +1 -1
  329. package/lib/tree/nodes/operators/addNode.js +8 -17
  330. package/lib/tree/nodes/operators/fractionNode.d.ts +1 -1
  331. package/lib/tree/nodes/operators/fractionNode.d.ts.map +1 -1
  332. package/lib/tree/nodes/operators/fractionNode.js +5 -1
  333. package/lib/tree/nodes/operators/multiplyNode.d.ts +4 -2
  334. package/lib/tree/nodes/operators/multiplyNode.d.ts.map +1 -1
  335. package/lib/tree/nodes/operators/multiplyNode.js +8 -17
  336. package/lib/tree/nodes/operators/operatorNode.d.ts +3 -3
  337. package/lib/tree/nodes/operators/operatorNode.d.ts.map +1 -1
  338. package/lib/tree/nodes/variables/variableNode.d.ts +1 -1
  339. package/lib/tree/nodes/variables/variableNode.d.ts.map +1 -1
  340. package/lib/tree/utilities/nodeShuffler.d.ts +12 -0
  341. package/lib/tree/utilities/nodeShuffler.d.ts.map +1 -0
  342. package/lib/tree/utilities/nodeShuffler.js +123 -0
  343. package/lib/utils/arrays/getAllPicks.d.ts +2 -0
  344. package/lib/utils/arrays/getAllPicks.d.ts.map +1 -0
  345. package/lib/utils/arrays/getAllPicks.js +17 -0
  346. package/lib/utils/errors/handleVEAError.d.ts +1 -1
  347. package/lib/utils/errors/handleVEAError.d.ts.map +1 -1
  348. package/lib/utils/strings/decapitalize.d.ts +2 -0
  349. package/lib/utils/strings/decapitalize.d.ts.map +1 -0
  350. package/lib/utils/strings/decapitalize.js +3 -0
  351. package/package.json +1 -1
@@ -0,0 +1,135 @@
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 } 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 [den1, den2] = nodes.map((node) => node.rightChild);
23
+ const sameDen = lcm(den1.evaluate(), den2.evaluate());
24
+ const nodesSameDenMult = nodes.map((node) => frac(multiply(node.leftChild.simplify(), frac(sameDen, node.rightChild).simplify()), sameDen));
25
+ const nodesSameDen = nodes.map((node) => frac(multiply(node.leftChild.simplify(), frac(sameDen, node.rightChild)).simplify(), sameDen));
26
+ const answer = getAnswer(identifiers);
27
+ return `On a :
28
+
29
+ $$
30
+ ${nodes[1].toTex()} = ${frac(nodes[1].leftChild.simplify(), nodes[1].rightChild.simplify()).toTex()}
31
+ $$
32
+
33
+ On veut donc comparer $${nodes[0].toTex()}$ et $${nodes[1].simplify().toTex()}$.
34
+
35
+ On peut choisir $${sameDen.frenchify()}$ comme dénominateur commun.
36
+
37
+ ${nodes
38
+ .map((node, i) => node.rightChild.evaluate() !== sameDen
39
+ ? `
40
+
41
+ $$
42
+ ${(i === 0 ? nodes[i] : nodes[i].simplify()).toTex()} = ${nodesSameDenMult[i].toTex()} = ${nodesSameDen[i].toTex()}
43
+ $$`
44
+ : ``)
45
+ .join("")}
46
+
47
+ Conclusion :
48
+
49
+ $$
50
+ ${answer}
51
+ $$
52
+
53
+ `;
54
+ };
55
+ /*
56
+ Plus généralement :
57
+ Si $a<b$ alors $\\frac{a}{b} < \\frac{a+c}{b+c}$ sinon c'est l'inverse.
58
+ */
59
+ const getPropositions = (_, { answer }) => {
60
+ const propositions = [];
61
+ addValidProp(propositions, answer);
62
+ tryToAddWrongProp(propositions, answer
63
+ .replace(">", "TMP(>)")
64
+ .replace("<", "TMP(<)")
65
+ .replace("TMP(>)", "<")
66
+ .replace("TMP(<)", ">"));
67
+ return shuffle(propositions);
68
+ };
69
+ const getAnswer = (identifiers) => {
70
+ const { texAnswers } = identifiers;
71
+ return texAnswers[0];
72
+ };
73
+ const isAnswerValid = (ans, { texAnswers }) => {
74
+ return texAnswers.includes(ans);
75
+ };
76
+ const getCompareFracABWithFracAPlusCBPlusCQuestion = () => {
77
+ const a = randint(1, 10);
78
+ const b = randint(1, 10);
79
+ const c = randint(1, 10);
80
+ const nodes = [frac(a, b), frac(add(a, c), add(b, c))];
81
+ const isOrderAsc = coinFlip();
82
+ const sortedNodes = nodes.toSorted((node1, node2) => (isOrderAsc ? +1 : -1) * (node1.evaluate() - node2.evaluate()));
83
+ const texAnswers = [
84
+ `${sortedNodes[0].toTex()}${isOrderAsc ? "<" : ">"}${sortedNodes[1].toTex()}`,
85
+ `${sortedNodes[1].toTex()}${isOrderAsc ? ">" : "<"}${sortedNodes[0].toTex()}`,
86
+ ];
87
+ return getQuestionFromIdentifiers({
88
+ nodeIds: nodes.map((node) => node.toIdentifiers()),
89
+ texAnswers,
90
+ });
91
+ };
92
+ const getQuestionFromIdentifiers = (identifiers, opts) => {
93
+ const question = {
94
+ answer: getAnswer(identifiers),
95
+ instruction: getInstruction(identifiers),
96
+ keys: [
97
+ "sup",
98
+ "inf",
99
+ ...identifiers.nodeIds.map((nodeIds) => {
100
+ const node = NodeConstructor.fromIdentifiers(nodeIds);
101
+ const tex = node.toTex();
102
+ return {
103
+ id: "custom",
104
+ label: tex,
105
+ labelType: "tex",
106
+ mathfieldInstructions: {
107
+ method: "write",
108
+ content: tex,
109
+ },
110
+ };
111
+ }),
112
+ ],
113
+ answerFormat: "tex",
114
+ identifiers,
115
+ hint: getHint(identifiers),
116
+ correction: getCorrection(identifiers),
117
+ options: opts,
118
+ };
119
+ return question;
120
+ };
121
+ export const compareFracABWithFracAPlusCBPlusC = {
122
+ id: "compareFracABWithFracAPlusCBPlusC",
123
+ label: "Effectuer des comparaisons entre des fractions simples (de la forme $\\frac{a}{b}$ et $\\frac{a+c}{b+c}$)",
124
+ isSingleStep: true,
125
+ generator: (nb, opts) => getDistinctQuestions(() => getCompareFracABWithFracAPlusCBPlusCQuestion(opts), nb, 30),
126
+ qcmTimer: 60,
127
+ freeTimer: 60,
128
+ isAnswerValid,
129
+ getPropositions,
130
+ subject: "Mathématiques",
131
+ maxAllowedQuestions: 30,
132
+ getQuestionFromIdentifiers,
133
+ answerType: "QCU",
134
+ hasHintAndCorrection: true,
135
+ };
@@ -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;AAiYF,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"}
@@ -0,0 +1,367 @@
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 formes décimales
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
+ };
220
+ Object.keys(nodes).forEach((letter) => {
221
+ nodes[letter] = multiply(sign, nodes[letter]);
222
+ });
223
+ const dictIsInDecimalFormat = Object.fromEntries(randomMany(["A", "C"], opts.nbDecimalFormat).map((letter) => [
224
+ letter,
225
+ true,
226
+ ]));
227
+ const nbTotal = 4;
228
+ const nbValid = 1;
229
+ const nbInvalid = nbTotal - nbValid;
230
+ const letters = Object.keys(nodes).toSorted((s1, s2) => s1.localeCompare(s2));
231
+ const shuffledLetters = shuffle(letters);
232
+ const dictFakeNameToQuestionParam = Object.fromEntries(letters.map((trueName, i) => {
233
+ const node = nodes[trueName];
234
+ const fakeName = shuffledLetters[i];
235
+ return [
236
+ fakeName,
237
+ {
238
+ fakeName: fakeName,
239
+ trueName: trueName,
240
+ nodeIds: node.toIdentifiers(),
241
+ tex: dictIsInDecimalFormat[trueName]
242
+ ? node.evaluate().frenchify()
243
+ : node.toTex(),
244
+ explainTex: (() => {
245
+ if (opts.isUseABC || !dictIsInDecimalFormat[trueName]) {
246
+ return `
247
+
248
+ $$
249
+ ${opts.isUseABC ? `${fakeName} =` : ``}
250
+ ${dictIsInDecimalFormat[trueName]
251
+ ? ``
252
+ : (() => {
253
+ if (trueName === "A") {
254
+ return `${node.toTex()} =
255
+ ${sign === +1 ? `` : `-`}\\frac{${a} \\times 2}{5 \\times 2} =
256
+ ${sign === +1 ? `` : `-`}\\frac{${2 * a}}{10} =`;
257
+ }
258
+ else {
259
+ return `${node.toTex()} =`;
260
+ }
261
+ })()}
262
+ ${node.evaluate().frenchify()}
263
+ $$
264
+
265
+ `;
266
+ }
267
+ else {
268
+ return ``;
269
+ }
270
+ })(),
271
+ },
272
+ ];
273
+ }));
274
+ const dictTrueNameToQuestionParam = Object.fromEntries(Object.values(dictFakeNameToQuestionParam).map((questionParam) => [
275
+ questionParam.trueName,
276
+ questionParam,
277
+ ]));
278
+ const [A, B, C] = letters.map((trueName) => {
279
+ const questionParam = dictTrueNameToQuestionParam[trueName];
280
+ return opts.isUseABC ? questionParam.fakeName : questionParam.tex;
281
+ });
282
+ const validItems = [
283
+ {
284
+ tex: sign === +1 ? `{${C}}>{${A}}>{${B}}` : `{${B}}>{${A}}>{${C}}`,
285
+ isValidAnswer: true,
286
+ },
287
+ ];
288
+ const invalidItems = permute([A, B, C])
289
+ .filter(([D, E, F]) => `{${D}}>{${E}}>{${F}}` !== validItems[0].tex)
290
+ .map(([D, E, F]) => {
291
+ return {
292
+ tex: `{${D}}>{${E}}>{${F}}`,
293
+ isValidAnswer: false,
294
+ };
295
+ });
296
+ const items = shuffle([
297
+ validItems[0],
298
+ ...shuffle(validItems.slice(1)).slice(0, nbValid - 1),
299
+ ...shuffle(invalidItems).slice(0, nbInvalid),
300
+ ]);
301
+ return getQuestionFromIdentifiers({
302
+ sign,
303
+ a,
304
+ b,
305
+ c,
306
+ dictFakeNameToQuestionParam,
307
+ items,
308
+ });
309
+ };
310
+ const getQuestionFromIdentifiers = (identifiers, opts) => {
311
+ const question = {
312
+ answer: getAnswer(identifiers, opts),
313
+ instruction: getInstruction(identifiers, opts),
314
+ keys: getKeys(identifiers, opts),
315
+ answerFormat: "tex",
316
+ identifiers,
317
+ hint: getHint(identifiers, opts),
318
+ correction: getCorrection(identifiers, opts),
319
+ options: opts,
320
+ };
321
+ return question;
322
+ };
323
+ const optsDefault = {
324
+ isUseABC: false,
325
+ nbDecimalFormat: 0,
326
+ isAllowingNegativeNumbers: false,
327
+ };
328
+ const options = [
329
+ {
330
+ id: "isUseABC",
331
+ label: "Utiliser A,B,C",
332
+ target: GeneratorOptionTarget.generation,
333
+ type: GeneratorOptionType.checkbox,
334
+ defaultValue: optsDefault.isUseABC,
335
+ },
336
+ {
337
+ id: "nbDecimalFormat",
338
+ label: "Nombre d'écritures décimales",
339
+ target: GeneratorOptionTarget.generation,
340
+ type: GeneratorOptionType.select,
341
+ values: [0, 1, 2],
342
+ defaultValue: optsDefault.nbDecimalFormat,
343
+ },
344
+ {
345
+ id: "isAllowingNegativeNumbers",
346
+ label: "Permettre les nombres négatifs",
347
+ target: GeneratorOptionTarget.generation,
348
+ type: GeneratorOptionType.checkbox,
349
+ defaultValue: optsDefault.isAllowingNegativeNumbers,
350
+ },
351
+ ];
352
+ export const compareFracAndDec = {
353
+ id: "compareFracAndDec",
354
+ label: "Comparer une fraction, une fraction décimale et une écriture fractionnaire",
355
+ isSingleStep: true,
356
+ generator: (nb, opts) => getDistinctQuestions(() => getCompareFracAndDecQuestion(opts), nb, 30),
357
+ options,
358
+ qcmTimer: 60,
359
+ freeTimer: 60,
360
+ getPropositions,
361
+ isAnswerValid,
362
+ subject: "Mathématiques",
363
+ maxAllowedQuestions: 30,
364
+ getQuestionFromIdentifiers,
365
+ answerType: "QCU",
366
+ hasHintAndCorrection: true,
367
+ };
@@ -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"}