math-exercises 3.0.125 → 3.0.126

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (291) hide show
  1. package/lib/exercises/math/calcul/fractions/fractionsSumsPrimeDenominators.d.ts.map +1 -1
  2. package/lib/exercises/math/calcul/fractions/fractionsSumsPrimeDenominators.js +61 -1
  3. package/lib/exercises/math/calcul/mentalCaluls/index.d.ts +1 -0
  4. package/lib/exercises/math/calcul/mentalCaluls/index.d.ts.map +1 -1
  5. package/lib/exercises/math/calcul/mentalCaluls/index.js +1 -0
  6. package/lib/exercises/math/calcul/mentalCaluls/mentalProgramSolve.d.ts +15 -0
  7. package/lib/exercises/math/calcul/mentalCaluls/mentalProgramSolve.d.ts.map +1 -0
  8. package/lib/exercises/math/calcul/mentalCaluls/mentalProgramSolve.js +217 -0
  9. package/lib/exercises/math/calcul/ordering/compareA10N.d.ts +16 -0
  10. package/lib/exercises/math/calcul/ordering/compareA10N.d.ts.map +1 -0
  11. package/lib/exercises/math/calcul/ordering/compareA10N.js +327 -0
  12. package/lib/exercises/math/calcul/ordering/compareABUsingQuotient.d.ts +8 -0
  13. package/lib/exercises/math/calcul/ordering/compareABUsingQuotient.d.ts.map +1 -0
  14. package/lib/exercises/math/calcul/ordering/compareABUsingQuotient.js +221 -0
  15. package/lib/exercises/math/calcul/ordering/compareFracABWithFracAPlusCBPlusC.d.ts +9 -0
  16. package/lib/exercises/math/calcul/ordering/compareFracABWithFracAPlusCBPlusC.d.ts.map +1 -0
  17. package/lib/exercises/math/calcul/ordering/compareFracABWithFracAPlusCBPlusC.js +135 -0
  18. package/lib/exercises/math/calcul/ordering/compareFracAndDec.d.ts +29 -0
  19. package/lib/exercises/math/calcul/ordering/compareFracAndDec.d.ts.map +1 -0
  20. package/lib/exercises/math/calcul/ordering/compareFracAndDec.js +367 -0
  21. package/lib/exercises/math/calcul/ordering/comparePowersOfFracs.d.ts +12 -0
  22. package/lib/exercises/math/calcul/ordering/comparePowersOfFracs.d.ts.map +1 -0
  23. package/lib/exercises/math/calcul/ordering/comparePowersOfFracs.js +164 -0
  24. package/lib/exercises/math/calcul/ordering/compareWithSquareRoots.d.ts +9 -0
  25. package/lib/exercises/math/calcul/ordering/compareWithSquareRoots.d.ts.map +1 -0
  26. package/lib/exercises/math/calcul/ordering/compareWithSquareRoots.js +140 -0
  27. package/lib/exercises/math/calcul/ordering/index.d.ts +6 -0
  28. package/lib/exercises/math/calcul/ordering/index.d.ts.map +1 -1
  29. package/lib/exercises/math/calcul/ordering/index.js +6 -0
  30. package/lib/exercises/math/calcul/rounding/estimateAroundPow10NTimesAroundPow10N.d.ts +9 -0
  31. package/lib/exercises/math/calcul/rounding/estimateAroundPow10NTimesAroundPow10N.d.ts.map +1 -0
  32. package/lib/exercises/math/calcul/rounding/estimateAroundPow10NTimesAroundPow10N.js +84 -0
  33. package/lib/exercises/math/calcul/rounding/estimatePow10NPlusPow10MinusN.d.ts +8 -0
  34. package/lib/exercises/math/calcul/rounding/estimatePow10NPlusPow10MinusN.d.ts.map +1 -0
  35. package/lib/exercises/math/calcul/rounding/estimatePow10NPlusPow10MinusN.js +90 -0
  36. package/lib/exercises/math/calcul/rounding/index.d.ts +2 -0
  37. package/lib/exercises/math/calcul/rounding/index.d.ts.map +1 -1
  38. package/lib/exercises/math/calcul/rounding/index.js +2 -0
  39. package/lib/exercises/math/calculLitteral/equation/equationFromProblem.d.ts +13 -0
  40. package/lib/exercises/math/calculLitteral/equation/equationFromProblem.d.ts.map +1 -0
  41. package/lib/exercises/math/calculLitteral/equation/equationFromProblem.js +414 -0
  42. package/lib/exercises/math/calculLitteral/equation/index.d.ts +1 -0
  43. package/lib/exercises/math/calculLitteral/equation/index.d.ts.map +1 -1
  44. package/lib/exercises/math/calculLitteral/equation/index.js +1 -0
  45. package/lib/exercises/math/calculLitteral/factorisation/factorizeAX2PlusBX.d.ts +10 -0
  46. package/lib/exercises/math/calculLitteral/factorisation/factorizeAX2PlusBX.d.ts.map +1 -0
  47. package/lib/exercises/math/calculLitteral/factorisation/factorizeAX2PlusBX.js +70 -0
  48. package/lib/exercises/math/calculLitteral/factorisation/index.d.ts +1 -0
  49. package/lib/exercises/math/calculLitteral/factorisation/index.d.ts.map +1 -1
  50. package/lib/exercises/math/calculLitteral/factorisation/index.js +1 -0
  51. package/lib/exercises/math/calculLitteral/index.d.ts +2 -0
  52. package/lib/exercises/math/calculLitteral/index.d.ts.map +1 -1
  53. package/lib/exercises/math/calculLitteral/index.js +2 -0
  54. package/lib/exercises/math/calculLitteral/isolate/index.d.ts +2 -1
  55. package/lib/exercises/math/calculLitteral/isolate/index.d.ts.map +1 -1
  56. package/lib/exercises/math/calculLitteral/isolate/index.js +2 -1
  57. package/lib/exercises/math/calculLitteral/isolate/isolateUInInvXPlusInvYEqualsInvU.d.ts +8 -0
  58. package/lib/exercises/math/calculLitteral/isolate/isolateUInInvXPlusInvYEqualsInvU.d.ts.map +1 -0
  59. package/lib/exercises/math/calculLitteral/isolate/isolateUInInvXPlusInvYEqualsInvU.js +107 -0
  60. package/lib/exercises/math/calculLitteral/isolate/isolateXInInvXPlusInvYEqualsInvU.d.ts +7 -0
  61. package/lib/exercises/math/calculLitteral/isolate/isolateXInInvXPlusInvYEqualsInvU.d.ts.map +1 -0
  62. package/lib/exercises/math/calculLitteral/isolate/isolateXInInvXPlusInvYEqualsInvU.js +80 -0
  63. package/lib/exercises/math/calculLitteral/ordering/compareAMinusB.d.ts +10 -0
  64. package/lib/exercises/math/calculLitteral/ordering/compareAMinusB.d.ts.map +1 -0
  65. package/lib/exercises/math/calculLitteral/ordering/compareAMinusB.js +182 -0
  66. package/lib/exercises/math/calculLitteral/ordering/compareFromPiMinusFrac.d.ts +9 -0
  67. package/lib/exercises/math/calculLitteral/ordering/compareFromPiMinusFrac.d.ts.map +1 -0
  68. package/lib/exercises/math/calculLitteral/ordering/compareFromPiMinusFrac.js +144 -0
  69. package/lib/exercises/math/calculLitteral/ordering/index.d.ts +3 -0
  70. package/lib/exercises/math/calculLitteral/ordering/index.d.ts.map +1 -0
  71. package/lib/exercises/math/calculLitteral/ordering/index.js +2 -0
  72. package/lib/exercises/math/calculLitteral/simplifying/compareATimes0.d.ts +11 -0
  73. package/lib/exercises/math/calculLitteral/simplifying/compareATimes0.d.ts.map +1 -0
  74. package/lib/exercises/math/calculLitteral/simplifying/compareATimes0.js +120 -0
  75. package/lib/exercises/math/calculLitteral/simplifying/compareFracXA.d.ts +8 -0
  76. package/lib/exercises/math/calculLitteral/simplifying/compareFracXA.d.ts.map +1 -0
  77. package/lib/exercises/math/calculLitteral/simplifying/compareFracXA.js +67 -0
  78. package/lib/exercises/math/calculLitteral/simplifying/compareMinusA.d.ts +11 -0
  79. package/lib/exercises/math/calculLitteral/simplifying/compareMinusA.d.ts.map +1 -0
  80. package/lib/exercises/math/calculLitteral/simplifying/compareMinusA.js +114 -0
  81. package/lib/exercises/math/calculLitteral/simplifying/index.d.ts +5 -0
  82. package/lib/exercises/math/calculLitteral/simplifying/index.d.ts.map +1 -1
  83. package/lib/exercises/math/calculLitteral/simplifying/index.js +5 -0
  84. package/lib/exercises/math/calculLitteral/simplifying/pickSameAsAPercentOfB.d.ts +13 -0
  85. package/lib/exercises/math/calculLitteral/simplifying/pickSameAsAPercentOfB.d.ts.map +1 -0
  86. package/lib/exercises/math/calculLitteral/simplifying/pickSameAsAPercentOfB.js +125 -0
  87. package/lib/exercises/math/calculLitteral/simplifying/pickSameAsInverseOfFracAB.d.ts +14 -0
  88. package/lib/exercises/math/calculLitteral/simplifying/pickSameAsInverseOfFracAB.d.ts.map +1 -0
  89. package/lib/exercises/math/calculLitteral/simplifying/pickSameAsInverseOfFracAB.js +148 -0
  90. package/lib/exercises/math/calculLitteral/writing/writeLitExpFromFrenchExp.d.ts +5 -27
  91. package/lib/exercises/math/calculLitteral/writing/writeLitExpFromFrenchExp.d.ts.map +1 -1
  92. package/lib/exercises/math/calculLitteral/writing/writeLitExpFromFrenchExp.js +178 -241
  93. package/lib/exercises/math/conversion/index.d.ts +4 -0
  94. package/lib/exercises/math/conversion/index.d.ts.map +1 -1
  95. package/lib/exercises/math/conversion/index.js +4 -0
  96. package/lib/exercises/math/conversion/kmPerMinToKmPerHourConversion.d.ts +8 -0
  97. package/lib/exercises/math/conversion/kmPerMinToKmPerHourConversion.d.ts.map +1 -0
  98. package/lib/exercises/math/conversion/kmPerMinToKmPerHourConversion.js +98 -0
  99. package/lib/exercises/math/conversion/minutesToHours.d.ts +10 -0
  100. package/lib/exercises/math/conversion/minutesToHours.d.ts.map +1 -0
  101. package/lib/exercises/math/conversion/minutesToHours.js +150 -0
  102. package/lib/exercises/math/conversion/prefixToNumber.d.ts +15 -0
  103. package/lib/exercises/math/conversion/prefixToNumber.d.ts.map +1 -0
  104. package/lib/exercises/math/conversion/prefixToNumber.js +233 -0
  105. package/lib/exercises/math/conversion/secondsToHours.d.ts +10 -0
  106. package/lib/exercises/math/conversion/secondsToHours.d.ts.map +1 -0
  107. package/lib/exercises/math/conversion/secondsToHours.js +150 -0
  108. package/lib/exercises/math/dataRepresentations/barChartInterpreting.d.ts +50 -0
  109. package/lib/exercises/math/dataRepresentations/barChartInterpreting.d.ts.map +1 -0
  110. package/lib/exercises/math/dataRepresentations/barChartInterpreting.js +517 -0
  111. package/lib/exercises/math/dataRepresentations/boxPlotInterpreting.d.ts +7 -0
  112. package/lib/exercises/math/dataRepresentations/boxPlotInterpreting.d.ts.map +1 -0
  113. package/lib/exercises/math/dataRepresentations/boxPlotInterpreting.js +223 -0
  114. package/lib/exercises/math/dataRepresentations/cartesianGraphExtremaReading.d.ts +10 -0
  115. package/lib/exercises/math/dataRepresentations/cartesianGraphExtremaReading.d.ts.map +1 -0
  116. package/lib/exercises/math/dataRepresentations/cartesianGraphExtremaReading.js +139 -0
  117. package/lib/exercises/math/dataRepresentations/dataToGraphGraphToData.d.ts +8 -0
  118. package/lib/exercises/math/dataRepresentations/dataToGraphGraphToData.d.ts.map +1 -0
  119. package/lib/exercises/math/dataRepresentations/dataToGraphGraphToData.js +133 -0
  120. package/lib/exercises/math/dataRepresentations/graphReading.d.ts +8 -0
  121. package/lib/exercises/math/dataRepresentations/graphReading.d.ts.map +1 -0
  122. package/lib/exercises/math/dataRepresentations/graphReading.js +136 -0
  123. package/lib/exercises/math/dataRepresentations/halfPieChartCommenting.d.ts +18 -0
  124. package/lib/exercises/math/dataRepresentations/halfPieChartCommenting.d.ts.map +1 -0
  125. package/lib/exercises/math/dataRepresentations/halfPieChartCommenting.js +228 -0
  126. package/lib/exercises/math/dataRepresentations/halfPieChartReading.d.ts +8 -0
  127. package/lib/exercises/math/dataRepresentations/halfPieChartReading.d.ts.map +1 -0
  128. package/lib/exercises/math/dataRepresentations/halfPieChartReading.js +213 -0
  129. package/lib/exercises/math/dataRepresentations/histogramReading.d.ts +9 -0
  130. package/lib/exercises/math/dataRepresentations/histogramReading.d.ts.map +1 -0
  131. package/lib/exercises/math/dataRepresentations/histogramReading.js +163 -0
  132. package/lib/exercises/math/dataRepresentations/index.d.ts +10 -0
  133. package/lib/exercises/math/dataRepresentations/index.d.ts.map +1 -1
  134. package/lib/exercises/math/dataRepresentations/index.js +10 -0
  135. package/lib/exercises/math/dataRepresentations/plausibleGraph.d.ts +9 -0
  136. package/lib/exercises/math/dataRepresentations/plausibleGraph.d.ts.map +1 -0
  137. package/lib/exercises/math/dataRepresentations/plausibleGraph.js +145 -0
  138. package/lib/exercises/math/dataRepresentations/scatterPlotCommenting.d.ts +9 -0
  139. package/lib/exercises/math/dataRepresentations/scatterPlotCommenting.d.ts.map +1 -0
  140. package/lib/exercises/math/dataRepresentations/scatterPlotCommenting.js +308 -0
  141. package/lib/exercises/math/derivation/derivative/exp/expDerivativeFour.d.ts.map +1 -1
  142. package/lib/exercises/math/derivation/derivative/exp/expDerivativeFour.js +5 -6
  143. package/lib/exercises/math/functions/affines/coordsOfPointOnAffineFindX.d.ts +8 -0
  144. package/lib/exercises/math/functions/affines/coordsOfPointOnAffineFindX.d.ts.map +1 -0
  145. package/lib/exercises/math/functions/affines/coordsOfPointOnAffineFindX.js +103 -0
  146. package/lib/exercises/math/functions/affines/coordsOfPointOnAffineFindY.d.ts +8 -0
  147. package/lib/exercises/math/functions/affines/coordsOfPointOnAffineFindY.d.ts.map +1 -0
  148. package/lib/exercises/math/functions/affines/coordsOfPointOnAffineFindY.js +100 -0
  149. package/lib/exercises/math/functions/affines/drawAffineFromPointAndLeadingCoeff.d.ts +16 -0
  150. package/lib/exercises/math/functions/affines/drawAffineFromPointAndLeadingCoeff.d.ts.map +1 -0
  151. package/lib/exercises/math/functions/affines/drawAffineFromPointAndLeadingCoeff.js +215 -0
  152. package/lib/exercises/math/functions/affines/drawAffineFromProgCalc.d.ts +13 -0
  153. package/lib/exercises/math/functions/affines/drawAffineFromProgCalc.d.ts.map +1 -0
  154. package/lib/exercises/math/functions/affines/drawAffineFromProgCalc.js +206 -0
  155. package/lib/exercises/math/functions/affines/index.d.ts +7 -0
  156. package/lib/exercises/math/functions/affines/index.d.ts.map +1 -1
  157. package/lib/exercises/math/functions/affines/index.js +7 -0
  158. package/lib/exercises/math/functions/affines/recognizeExprAffine.d.ts +20 -0
  159. package/lib/exercises/math/functions/affines/recognizeExprAffine.d.ts.map +1 -0
  160. package/lib/exercises/math/functions/affines/recognizeExprAffine.js +284 -0
  161. package/lib/exercises/math/functions/affines/representationOfAffine.d.ts +13 -0
  162. package/lib/exercises/math/functions/affines/representationOfAffine.d.ts.map +1 -0
  163. package/lib/exercises/math/functions/affines/representationOfAffine.js +184 -0
  164. package/lib/exercises/math/functions/basics/coordsOfPointOnCurveFindY.d.ts +14 -0
  165. package/lib/exercises/math/functions/basics/coordsOfPointOnCurveFindY.d.ts.map +1 -0
  166. package/lib/exercises/math/functions/basics/coordsOfPointOnCurveFindY.js +216 -0
  167. package/lib/exercises/math/functions/basics/index.d.ts +1 -0
  168. package/lib/exercises/math/functions/basics/index.d.ts.map +1 -1
  169. package/lib/exercises/math/functions/basics/index.js +1 -0
  170. package/lib/exercises/math/functions/composition/functionComposition.d.ts +8 -0
  171. package/lib/exercises/math/functions/composition/functionComposition.d.ts.map +1 -0
  172. package/lib/exercises/math/functions/composition/functionComposition.js +238 -0
  173. package/lib/exercises/math/functions/composition/index.d.ts +2 -0
  174. package/lib/exercises/math/functions/composition/index.d.ts.map +1 -0
  175. package/lib/exercises/math/functions/composition/index.js +1 -0
  176. package/lib/exercises/math/functions/index.d.ts +1 -0
  177. package/lib/exercises/math/functions/index.d.ts.map +1 -1
  178. package/lib/exercises/math/functions/index.js +1 -0
  179. package/lib/exercises/math/geometry/angles/anglesUsingIsParallel.d.ts +23 -0
  180. package/lib/exercises/math/geometry/angles/anglesUsingIsParallel.d.ts.map +1 -0
  181. package/lib/exercises/math/geometry/angles/anglesUsingIsParallel.js +448 -0
  182. package/lib/exercises/math/geometry/angles/index.js +2 -0
  183. package/lib/exercises/math/geometry/angles/isParallelUsingAngles.d.ts +23 -0
  184. package/lib/exercises/math/geometry/angles/isParallelUsingAngles.d.ts.map +1 -0
  185. package/lib/exercises/math/geometry/angles/isParallelUsingAngles.js +402 -0
  186. package/lib/exercises/math/geometry/cartesian/placeAbscissOnSemiLine.d.ts +9 -6
  187. package/lib/exercises/math/geometry/cartesian/placeAbscissOnSemiLine.d.ts.map +1 -1
  188. package/lib/exercises/math/geometry/cartesian/placeAbscissOnSemiLine.js +140 -60
  189. package/lib/exercises/math/geometry/convexity/convexityQuadrinomialsGeo.js +1 -1
  190. package/lib/exercises/math/geometry/vectors/colinearity/colinearityFromPicture.d.ts.map +1 -1
  191. package/lib/exercises/math/geometry/vectors/colinearity/colinearityFromPicture.js +121 -104
  192. package/lib/exercises/math/geometry/vectors/vectorRepresentative.d.ts.map +1 -1
  193. package/lib/exercises/math/geometry/vectors/vectorRepresentative.js +3 -2
  194. package/lib/exercises/math/probaStat/basicProbas/index.d.ts +1 -0
  195. package/lib/exercises/math/probaStat/basicProbas/index.d.ts.map +1 -1
  196. package/lib/exercises/math/probaStat/basicProbas/index.js +1 -0
  197. package/lib/exercises/math/probaStat/basicProbas/possibleValuesForProba.d.ts +0 -1
  198. package/lib/exercises/math/probaStat/basicProbas/possibleValuesForProba.d.ts.map +1 -1
  199. package/lib/exercises/math/probaStat/basicProbas/possibleValuesForProba.js +42 -80
  200. package/lib/exercises/math/probaStat/conditionalProbaWriteFromFrench.d.ts +9 -0
  201. package/lib/exercises/math/probaStat/conditionalProbaWriteFromFrench.d.ts.map +1 -0
  202. package/lib/exercises/math/probaStat/conditionalProbaWriteFromFrench.js +217 -0
  203. package/lib/exercises/math/probaStat/index.d.ts +2 -0
  204. package/lib/exercises/math/probaStat/index.d.ts.map +1 -1
  205. package/lib/exercises/math/probaStat/index.js +2 -0
  206. package/lib/exercises/math/probaStat/probaAsSumOfProbas.d.ts +30 -0
  207. package/lib/exercises/math/probaStat/probaAsSumOfProbas.d.ts.map +1 -0
  208. package/lib/exercises/math/probaStat/probaAsSumOfProbas.js +548 -0
  209. package/lib/exercises/math/probaStat/stats1var/index.d.ts +2 -0
  210. package/lib/exercises/math/probaStat/stats1var/index.d.ts.map +1 -1
  211. package/lib/exercises/math/probaStat/stats1var/index.js +2 -0
  212. package/lib/exercises/math/probaStat/stats1var/interpretIndicatorsForLists.d.ts +9 -0
  213. package/lib/exercises/math/probaStat/stats1var/interpretIndicatorsForLists.d.ts.map +1 -0
  214. package/lib/exercises/math/probaStat/stats1var/interpretIndicatorsForLists.js +90 -0
  215. package/lib/exercises/math/probaStat/stats1var/plausibilityOfAverage.d.ts +10 -0
  216. package/lib/exercises/math/probaStat/stats1var/plausibilityOfAverage.d.ts.map +1 -0
  217. package/lib/exercises/math/probaStat/stats1var/plausibilityOfAverage.js +151 -0
  218. package/lib/exercises/pc/electricity/calculateUEqualsRI.d.ts +7 -0
  219. package/lib/exercises/pc/electricity/calculateUEqualsRI.d.ts.map +1 -0
  220. package/lib/exercises/pc/electricity/calculateUEqualsRI.js +73 -0
  221. package/lib/exercises/pc/electricity/index.d.ts +1 -0
  222. package/lib/exercises/pc/electricity/index.d.ts.map +1 -1
  223. package/lib/exercises/pc/electricity/index.js +1 -0
  224. package/lib/exercises/pc/index.d.ts +1 -0
  225. package/lib/exercises/pc/index.d.ts.map +1 -1
  226. package/lib/exercises/pc/index.js +1 -0
  227. package/lib/exercises/pc/moleculeFormula.d.ts.map +1 -1
  228. package/lib/exercises/pc/moleculeFormula.js +4 -3
  229. package/lib/exercises/pc/optics/index.d.ts +2 -0
  230. package/lib/exercises/pc/optics/index.d.ts.map +1 -0
  231. package/lib/exercises/pc/optics/index.js +1 -0
  232. package/lib/exercises/pc/optics/lensFormula.d.ts +21 -0
  233. package/lib/exercises/pc/optics/lensFormula.d.ts.map +1 -0
  234. package/lib/exercises/pc/optics/lensFormula.js +415 -0
  235. package/lib/exercises/pc/weight/calculateWeight.d.ts +8 -1
  236. package/lib/exercises/pc/weight/calculateWeight.d.ts.map +1 -1
  237. package/lib/exercises/pc/weight/calculateWeight.js +113 -38
  238. package/lib/geogebra/parsers/geogebraParser.d.ts +4 -0
  239. package/lib/geogebra/parsers/geogebraParser.d.ts.map +1 -1
  240. package/lib/geogebra/parsers/geogebraParser.js +17 -0
  241. package/lib/index.d.ts +346 -12
  242. package/lib/index.d.ts.map +1 -1
  243. package/lib/latexTester.d.ts.map +1 -1
  244. package/lib/latexTester.js +1 -0
  245. package/lib/math/geometry/CloudPoints.d.ts +10 -0
  246. package/lib/math/geometry/CloudPoints.d.ts.map +1 -1
  247. package/lib/math/geometry/CloudPoints.js +119 -0
  248. package/lib/math/geometry/line.d.ts +1 -0
  249. package/lib/math/geometry/line.d.ts.map +1 -1
  250. package/lib/math/geometry/line.js +10 -2
  251. package/lib/math/geometry/vector.d.ts +1 -0
  252. package/lib/math/geometry/vector.d.ts.map +1 -1
  253. package/lib/math/geometry/vector.js +12 -0
  254. package/lib/math/progCalc/progCalc.d.ts +46 -0
  255. package/lib/math/progCalc/progCalc.d.ts.map +1 -0
  256. package/lib/math/progCalc/progCalc.js +239 -0
  257. package/lib/math/utils/latex/realize.d.ts +12 -0
  258. package/lib/math/utils/latex/realize.d.ts.map +1 -0
  259. package/lib/math/utils/latex/realize.js +43 -0
  260. package/lib/pc/constants/molecularChemistry/molecule.d.ts +2 -0
  261. package/lib/pc/constants/molecularChemistry/molecule.d.ts.map +1 -1
  262. package/lib/pc/constants/molecularChemistry/molecule.js +52 -0
  263. package/lib/tests/questionTest.d.ts.map +1 -1
  264. package/lib/tests/questionTest.js +1 -1
  265. package/lib/tests/singleExo.test.js +3 -3
  266. package/lib/tree/nodes/algebraicNode.d.ts.map +1 -1
  267. package/lib/tree/nodes/operators/addNode.d.ts +4 -2
  268. package/lib/tree/nodes/operators/addNode.d.ts.map +1 -1
  269. package/lib/tree/nodes/operators/addNode.js +8 -17
  270. package/lib/tree/nodes/operators/fractionNode.d.ts +1 -1
  271. package/lib/tree/nodes/operators/fractionNode.d.ts.map +1 -1
  272. package/lib/tree/nodes/operators/fractionNode.js +5 -1
  273. package/lib/tree/nodes/operators/multiplyNode.d.ts +4 -2
  274. package/lib/tree/nodes/operators/multiplyNode.d.ts.map +1 -1
  275. package/lib/tree/nodes/operators/multiplyNode.js +8 -17
  276. package/lib/tree/nodes/operators/operatorNode.d.ts +3 -3
  277. package/lib/tree/nodes/operators/operatorNode.d.ts.map +1 -1
  278. package/lib/tree/nodes/variables/variableNode.d.ts +1 -1
  279. package/lib/tree/nodes/variables/variableNode.d.ts.map +1 -1
  280. package/lib/tree/utilities/nodeShuffler.d.ts +12 -0
  281. package/lib/tree/utilities/nodeShuffler.d.ts.map +1 -0
  282. package/lib/tree/utilities/nodeShuffler.js +123 -0
  283. package/lib/utils/arrays/getAllPicks.d.ts +2 -0
  284. package/lib/utils/arrays/getAllPicks.d.ts.map +1 -0
  285. package/lib/utils/arrays/getAllPicks.js +17 -0
  286. package/lib/utils/errors/handleVEAError.d.ts +1 -1
  287. package/lib/utils/errors/handleVEAError.d.ts.map +1 -1
  288. package/lib/utils/strings/decapitalize.d.ts +2 -0
  289. package/lib/utils/strings/decapitalize.d.ts.map +1 -0
  290. package/lib/utils/strings/decapitalize.js +3 -0
  291. package/package.json +1 -1
@@ -0,0 +1,548 @@
1
+ import { randint } from "../../../math/utils/random/randint.js";
2
+ import { GeneratorOptionTarget, GeneratorOptionType, addValidProp, shuffleProps, tryToAddWrongProp, } from "../../exercise.js";
3
+ import { getDistinctQuestions } from "../../utils/getDistinctQuestions.js";
4
+ import { shuffle } from "../../../utils/alea/shuffle.js";
5
+ import { frac } from "../../../tree/nodes/operators/fractionNode.js";
6
+ import { NodeConstructor, } from "../../../tree/nodes/nodeConstructor.js";
7
+ import { random, randomMany } from "../../../utils/alea/random.js";
8
+ import { AddNode } from "../../../tree/nodes/operators/addNode.js";
9
+ import { operatorComposition } from "../../../tree/utilities/operatorComposition.js";
10
+ import { getAllPicks } from "../../../utils/arrays/getAllPicks.js";
11
+ import { primes } from "../../../math/numbers/integer/primes.js";
12
+ import { multiply, MultiplyNode, } from "../../../tree/nodes/operators/multiplyNode.js";
13
+ import { substract } from "../../../tree/nodes/operators/substractNode.js";
14
+ import { parseAlgebraic } from "../../../tree/parsers/latexParser.js";
15
+ class Event {
16
+ type;
17
+ id;
18
+ str;
19
+ p;
20
+ index;
21
+ arrSubEvent;
22
+ isTailoredStr;
23
+ constructor(type, id, str, p, index, arrSubEvent, isTailoredStr) {
24
+ this.type = type;
25
+ this.id = id;
26
+ this.str = str;
27
+ this.p = p;
28
+ this.index = index;
29
+ this.arrSubEvent = arrSubEvent;
30
+ this.isTailoredStr = isTailoredStr;
31
+ }
32
+ toIdentifiers() {
33
+ const p = this.p.toIdentifiers();
34
+ switch (this.type) {
35
+ case "elementary":
36
+ return {
37
+ type: this.type,
38
+ id: this.id,
39
+ str: this.str,
40
+ p,
41
+ index: this.index,
42
+ };
43
+ case "union": {
44
+ const arrSubEvent = this.arrSubEvent.map((event) => event.toIdentifiers());
45
+ return {
46
+ type: this.type,
47
+ id: this.id,
48
+ str: this.str,
49
+ p,
50
+ arrSubEvent,
51
+ isTailoredStr: this.isTailoredStr,
52
+ };
53
+ }
54
+ }
55
+ }
56
+ getArrElem() {
57
+ switch (this.type) {
58
+ case "elementary":
59
+ return [this];
60
+ case "union":
61
+ return this.arrSubEvent.flatMap((event) => event.getArrElem());
62
+ }
63
+ }
64
+ }
65
+ class EventConstructor {
66
+ static elementary(str, p, index) {
67
+ return new Event("elementary", `E_{${index}}`, str, p, index);
68
+ }
69
+ static union(str, arrSubEvent, isTailoredStr = false) {
70
+ const arrElemSorted = arrSubEvent
71
+ .flatMap((event) => event.getArrElem())
72
+ .toSorted((ev1, ev2) => ev1.index - ev2.index);
73
+ return new Event("union", `{${arrElemSorted
74
+ .map((evElem) => evElem.index)
75
+ .map((i) => `E_{${i}}`)
76
+ .join(" \\cup ")}}`, str, operatorComposition(AddNode, arrSubEvent.map((ev) => ev.p)).simplify({
77
+ //nbMaxSteps: 100,
78
+ }), undefined, arrSubEvent, isTailoredStr);
79
+ }
80
+ static fromIdentifiers(eventIds) {
81
+ const p = NodeConstructor.fromIdentifiers(eventIds.p);
82
+ switch (eventIds.type) {
83
+ case "elementary":
84
+ return EventConstructor.elementary(eventIds.str, p, eventIds.index);
85
+ case "union": {
86
+ const arrSubEvent = eventIds.arrSubEvent.map((eventIds) => EventConstructor.fromIdentifiers(eventIds));
87
+ return EventConstructor.union(eventIds.str, arrSubEvent, eventIds.isTailoredStr);
88
+ }
89
+ }
90
+ }
91
+ }
92
+ class Situation {
93
+ str;
94
+ strElem;
95
+ allElem;
96
+ someElem;
97
+ someUnion;
98
+ //There can be multiple events with the same .id in someUnion: everything is the same except .str
99
+ constructor(str, strElem, allElem, someElem, someUnion) {
100
+ this.str = str;
101
+ this.strElem = strElem;
102
+ this.allElem = allElem;
103
+ this.someElem = someElem;
104
+ this.someUnion = someUnion;
105
+ }
106
+ getRandomUnionEvent(unionLength) {
107
+ return random(this.someUnion.filter((evUnion) => evUnion.getArrElem().length === unionLength));
108
+ }
109
+ }
110
+ class SituationConstructor {
111
+ static createDiceSituation(nbSides) {
112
+ const str = `On lance un dé à $${nbSides}$ faces numérotées de $1$ à $${nbSides}$.
113
+ Le dé n'est pas équilibré.`;
114
+ const strElem = `Pour $i$ allant de $1$ à $${nbSides}$, on note $E_i$ l'évènement:
115
+ "Le résultat est $i$.".`;
116
+ const nbPickSomeElem = Math.min(nbSides, 6);
117
+ const allIndexesElem = [...Array(nbSides).keys()].map((i) => i + 1);
118
+ const dictAllElem = Object.fromEntries(allIndexesElem.map((index) => [
119
+ index,
120
+ EventConstructor.elementary(`Le résultat est $${index}$.`, `p_{E_{${index}}}`.toTree(), index),
121
+ ]));
122
+ //we only pick some events to build unions with, because number of unions grows exponentially
123
+ const someIndexesElem = randomMany(allIndexesElem, nbPickSomeElem).toSorted((i1, i2) => i1 - i2);
124
+ const dictSomeElem = Object.fromEntries(someIndexesElem.map((index) => [index, dictAllElem[index]]));
125
+ const arrayOfUnionsAsArrayOfIndexes = getAllPicks(someIndexesElem)
126
+ .filter((arr) => arr.length > 1)
127
+ .map((arrayOfIndexes) => arrayOfIndexes.toSorted((i1, i2) => i1 - i2));
128
+ const arrayOfUnionEventsInTheFormEitherOr = arrayOfUnionsAsArrayOfIndexes.map((arrayOfIndexes) => {
129
+ return EventConstructor.union(`Le résultat est soit ${arrayOfIndexes
130
+ .map((i) => `$${i}$`)
131
+ .join(" soit ")}.`, arrayOfIndexes.map((i) => dictSomeElem[i]), false);
132
+ });
133
+ const arrayOfUnionEventsInTheFormTailoredString = [
134
+ //"i ou j"
135
+ ...arrayOfUnionsAsArrayOfIndexes
136
+ .filter((arrayOfIndexes) => arrayOfIndexes.length == 2)
137
+ .map((arrayOfIndexes) => EventConstructor.union(`Le résultat est ${arrayOfIndexes
138
+ .map((i) => `$${i}$`)
139
+ .join(" ou ")}.`, arrayOfIndexes.map((i) => dictSomeElem[i]), true)),
140
+ ];
141
+ //"est un chiffre du nombre ABAACDB"
142
+ for (let j = 0; j < arrayOfUnionsAsArrayOfIndexes.length; j++) {
143
+ const arrayOfCandidateIndexes = arrayOfUnionsAsArrayOfIndexes[j];
144
+ if (arrayOfCandidateIndexes.every((i) => i < 10)) {
145
+ const nbFiller = randint(0, 3);
146
+ const arrayOfDigits = shuffle([
147
+ ...arrayOfCandidateIndexes,
148
+ ...[...Array(nbFiller).keys()].map((_) => random(arrayOfCandidateIndexes)),
149
+ ]);
150
+ const unionEventInTheFormDigitOfNumber = EventConstructor.union(`Le résultat est un chiffre du nombre $${arrayOfDigits
151
+ .map((digit) => digit.frenchify())
152
+ .join("")}$`, arrayOfCandidateIndexes.map((i) => dictSomeElem[i]), true);
153
+ arrayOfUnionEventsInTheFormTailoredString.push(unionEventInTheFormDigitOfNumber);
154
+ }
155
+ }
156
+ //strictement inférieur à n
157
+ function isStrictlyBelowN(arrayOfIndexes) {
158
+ const n = someIndexesElem[someIndexesElem.length - 1] + 1;
159
+ return (arrayOfIndexes.length === n - 1 && arrayOfIndexes.every((i) => i < n));
160
+ }
161
+ if (isStrictlyBelowN(someIndexesElem)) {
162
+ const n = someIndexesElem[someIndexesElem.length - 1] + 1;
163
+ arrayOfUnionEventsInTheFormTailoredString.push(EventConstructor.union(`Le résultat est strictement inférieur à $${n}$.`, someIndexesElem.map((i) => dictSomeElem[i]), true));
164
+ }
165
+ //inférieur ou égal à n
166
+ function isBelowOrN(arrayOfIndexes) {
167
+ const n = someIndexesElem[someIndexesElem.length - 1];
168
+ return arrayOfIndexes.length === n && arrayOfIndexes.every((i) => i <= n);
169
+ }
170
+ if (isBelowOrN(someIndexesElem)) {
171
+ const n = someIndexesElem[someIndexesElem.length - 1];
172
+ arrayOfUnionEventsInTheFormTailoredString.push(EventConstructor.union(`Le résultat est inférieur ou égal à $${n}$.`, someIndexesElem.map((i) => dictSomeElem[i]), true));
173
+ }
174
+ return new Situation(str, strElem, Object.values(dictAllElem).toSorted((ev1, ev2) => ev1.index - ev2.index), Object.values(dictSomeElem).toSorted((ev1, ev2) => ev1.index - ev2.index), [
175
+ ...arrayOfUnionEventsInTheFormEitherOr,
176
+ ...arrayOfUnionEventsInTheFormTailoredString,
177
+ ]);
178
+ }
179
+ }
180
+ const arrayOfSituations = [
181
+ SituationConstructor.createDiceSituation(4),
182
+ SituationConstructor.createDiceSituation(6),
183
+ SituationConstructor.createDiceSituation(10),
184
+ SituationConstructor.createDiceSituation(12),
185
+ ];
186
+ class FiniteProbDistrUtils {
187
+ static createRandomArrProbaPrimeBased(n, nbUnique) {
188
+ const arrayOfUniqueNumbers = randomMany(primes.filter((prime) => prime <= 13), //au delà, fractionNode.simplify() crashe car le dénominateur dépasse Number.MAX_SAFE_INTEGER
189
+ nbUnique);
190
+ const arrayOfUnscaled = [
191
+ ...arrayOfUniqueNumbers,
192
+ ...[...Array(n - nbUnique).keys()].map((_) => random(arrayOfUniqueNumbers)),
193
+ ];
194
+ const sum = arrayOfUnscaled.reduce((acc, x) => acc + x);
195
+ const arrProba = arrayOfUnscaled.map((v) => frac(v, sum));
196
+ return arrProba;
197
+ }
198
+ }
199
+ class FiniteProbDistrConstructor {
200
+ static randomDistr(n, nbUnique) {
201
+ const arrProba = FiniteProbDistrUtils.createRandomArrProbaPrimeBased(n, nbUnique);
202
+ const arrProbaShuffled = shuffle(arrProba);
203
+ return new FiniteProbDistr(arrProbaShuffled);
204
+ }
205
+ static fromArrProba(arrProba) {
206
+ return new FiniteProbDistr(arrProba);
207
+ }
208
+ }
209
+ class FiniteProbDistr {
210
+ arrProba;
211
+ dictIndexToP;
212
+ dictPToArrayOfIndexes;
213
+ constructor(arrProba) {
214
+ this.arrProba = arrProba;
215
+ this.dictIndexToP = Object.fromEntries(arrProba.map((p, i) => [i + 1, p]));
216
+ const dictPToArrayOfIndexes = {};
217
+ for (let i = 0; i < arrProba.length; i++) {
218
+ const p = arrProba[i];
219
+ console.log("will simplify", p);
220
+ const tex = p.simplify().toTex();
221
+ if (dictPToArrayOfIndexes[tex] === undefined) {
222
+ dictPToArrayOfIndexes[tex] = [];
223
+ }
224
+ dictPToArrayOfIndexes[tex].push(i + 1);
225
+ }
226
+ this.dictPToArrayOfIndexes = dictPToArrayOfIndexes;
227
+ }
228
+ getPForIndex(index) {
229
+ const p = this.dictIndexToP[index];
230
+ if (!p) {
231
+ throw new Error("p not found at index" + index);
232
+ }
233
+ return p;
234
+ }
235
+ getArrIndexForP(p) {
236
+ return this.dictPToArrayOfIndexes[p.simplify().toTex()];
237
+ }
238
+ getArrFrenchStrings(isDisplayingValue) {
239
+ return Object.entries(this.dictPToArrayOfIndexes)
240
+ .filter(([_, arrayOfIndexes]) => isDisplayingValue ? true : arrayOfIndexes.length > 1)
241
+ .map(([tex, arrayOfIndexes]) => {
242
+ return `${[
243
+ ...arrayOfIndexes.map((i) => `p_{E_{${i}}}`),
244
+ ...(isDisplayingValue ? [`${tex}`] : []),
245
+ ].join("=")}`;
246
+ });
247
+ }
248
+ toString() {
249
+ return this.dictPToArrayOfIndexes.toString();
250
+ }
251
+ }
252
+ const getInstruction = (identifiers) => {
253
+ const { indexSituation, eventIds, arrProba, isProbasAreNumbers } = identifiers;
254
+ const situation = arrayOfSituations[indexSituation];
255
+ const finiteProbDistr = FiniteProbDistrConstructor.fromArrProba(arrProba.map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds)));
256
+ let instruction = `${situation.str}`;
257
+ instruction += ` ${situation.strElem}`;
258
+ instruction += ` On a :
259
+ ${finiteProbDistr
260
+ .getArrFrenchStrings(isProbasAreNumbers)
261
+ .map((tex) => `
262
+
263
+ $$
264
+ ${tex}
265
+ $$`)
266
+ .join("")}`;
267
+ instruction += `
268
+ Calcule la probabilité de l'évènement "${eventIds.str}".`;
269
+ return instruction;
270
+ };
271
+ const getAnswerValueNode = (identifiers) => {
272
+ const { eventIds, arrProba } = identifiers;
273
+ const evUnion = EventConstructor.fromIdentifiers(eventIds);
274
+ const finiteProbDistr = FiniteProbDistrConstructor.fromArrProba(arrProba.map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds)));
275
+ const nodeSumSimplified = operatorComposition(AddNode, evUnion
276
+ .getArrElem()
277
+ .map((evElem) => finiteProbDistr.getPForIndex(evElem.index))).simplify({
278
+ //!TODO Sebastien : ne doit pas être nécessaire, à fix
279
+ //nbMaxSteps: 100,
280
+ });
281
+ return nodeSumSimplified;
282
+ };
283
+ const getAnswerNode = (identifiers) => {
284
+ const { eventIds, isProbasAreNumbers } = identifiers;
285
+ const evUnion = EventConstructor.fromIdentifiers(eventIds);
286
+ if (isProbasAreNumbers) {
287
+ return getAnswerValueNode(identifiers);
288
+ }
289
+ else {
290
+ return evUnion.p;
291
+ }
292
+ };
293
+ const getAnswer = (identifiers) => {
294
+ return getAnswerNode(identifiers).toTex();
295
+ };
296
+ const getHint = () => {
297
+ return `Les issues élémentaires sont mutuellement exclusives : Elles ne peuvent pas se produire en même temps.
298
+ Si on prend deux issues élémentaires $E_1$ et $E_2$, alors:
299
+
300
+ $$
301
+ P(E_1 \\cap E_2) = 0
302
+ $$
303
+
304
+ Cela permet de calculer facilement la probabilité de l'union d'évènements élémentaires.`;
305
+ };
306
+ const getCorrection = (identifiers) => {
307
+ const { eventIds, arrProba, isProbasAreNumbers } = identifiers;
308
+ const evUnion = EventConstructor.fromIdentifiers(eventIds);
309
+ let strCorrection = `Les issues élémentaires sont mutuellement exclusives.
310
+ La probabilité de l'évènement "${eventIds.str}" est la somme des probabilités des issues élémentaires dont il est l'union.`;
311
+ strCorrection += `
312
+
313
+ $$
314
+ p_{${evUnion.id}} = ${evUnion
315
+ .getArrElem()
316
+ .map((evElem) => `p_{${evElem.id}}`)
317
+ .join(" + ")}
318
+ $$`;
319
+ if (isProbasAreNumbers) {
320
+ const finiteProbDistr = FiniteProbDistrConstructor.fromArrProba(arrProba.map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds)));
321
+ strCorrection += `
322
+ Or: ${evUnion.getArrElem().map((evElem) => `
323
+ $$
324
+ p_{${evElem.id}} = ${finiteProbDistr.getPForIndex(evElem.index).toTex()}
325
+ $$`).join(`
326
+ `)}`;
327
+ const nodeSumSimplified = operatorComposition(AddNode, evUnion
328
+ .getArrElem()
329
+ .map((evElem) => finiteProbDistr.getPForIndex(evElem.index))).simplify({
330
+ //nbMaxSteps: 100,
331
+ });
332
+ strCorrection += `
333
+ Donc:
334
+
335
+ $$
336
+ p_{${evUnion.id}} = ${evUnion
337
+ .getArrElem()
338
+ .map((evElem) => finiteProbDistr.getPForIndex(evElem.index).toTex())
339
+ .join(" + ")}
340
+ $$
341
+
342
+ $$
343
+ p_{${evUnion.id}} = ${nodeSumSimplified.toTex()}
344
+ $$`;
345
+ }
346
+ return strCorrection;
347
+ };
348
+ const optsDefault = {
349
+ nbElem: [4, 6, 10, 12],
350
+ unionLength: [2, 3, 4, 5],
351
+ isProbasAreNumbers: [true, false],
352
+ };
353
+ const options = [
354
+ {
355
+ id: "nbElem",
356
+ label: "Nombre d'évènements élémentaires",
357
+ type: GeneratorOptionType.multiselect,
358
+ target: GeneratorOptionTarget.generation,
359
+ values: [4, 6, 10, 12],
360
+ defaultValue: optsDefault.nbElem,
361
+ },
362
+ {
363
+ id: "unionLength",
364
+ label: "Longueur de l'union",
365
+ type: GeneratorOptionType.multiselect,
366
+ target: GeneratorOptionTarget.generation,
367
+ values: [2, 3, 4, 5, 6],
368
+ defaultValue: optsDefault.unionLength,
369
+ },
370
+ {
371
+ id: "isProbasAreNumbers",
372
+ label: "Probabilités sous forme de nombres ?",
373
+ type: GeneratorOptionType.multiselect,
374
+ target: GeneratorOptionTarget.generation,
375
+ values: [true, false],
376
+ defaultValue: optsDefault.isProbasAreNumbers,
377
+ },
378
+ ];
379
+ const getKeys = (identifiers) => {
380
+ const { indexSituation, arrProba, isProbasAreNumbers } = identifiers;
381
+ const situation = arrayOfSituations[indexSituation];
382
+ return [
383
+ ...[
384
+ ...new Set(situation.someElem
385
+ .map((event) => {
386
+ if (isProbasAreNumbers) {
387
+ const finiteProbDistr = FiniteProbDistrConstructor.fromArrProba(arrProba.map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds)));
388
+ return finiteProbDistr.getPForIndex(event.index).simplify();
389
+ }
390
+ else {
391
+ return event.p;
392
+ }
393
+ })
394
+ .map((node) => node.toTex())),
395
+ ].map((tex) => {
396
+ return {
397
+ id: "custom",
398
+ label: tex,
399
+ labelType: "tex",
400
+ mathfieldInstructions: {
401
+ method: "write",
402
+ content: tex,
403
+ },
404
+ };
405
+ }),
406
+ ];
407
+ };
408
+ const getPropositions = (n, { answer, ...identifiers }) => {
409
+ const { eventIds, arrProba, isProbasAreNumbers } = identifiers;
410
+ const evUnion = EventConstructor.fromIdentifiers(eventIds);
411
+ const propositions = [];
412
+ addValidProp(propositions, answer);
413
+ if (isProbasAreNumbers) {
414
+ const finiteProbDistr = FiniteProbDistrConstructor.fromArrProba(arrProba.map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds)));
415
+ tryToAddWrongProp(propositions, operatorComposition(MultiplyNode, evUnion
416
+ .getArrElem()
417
+ .map((evElem) => finiteProbDistr.getPForIndex(evElem.index)))
418
+ .simplify({
419
+ //nbMaxSteps: 100,
420
+ })
421
+ .toTex());
422
+ tryToAddWrongProp(propositions, substract(1, operatorComposition(MultiplyNode, evUnion
423
+ .getArrElem()
424
+ .map((evElem) => finiteProbDistr.getPForIndex(evElem.index))))
425
+ .simplify({
426
+ //nbMaxSteps: 100,
427
+ })
428
+ .toTex());
429
+ tryToAddWrongProp(propositions, substract(1, operatorComposition(AddNode, evUnion
430
+ .getArrElem()
431
+ .map((evElem) => finiteProbDistr.getPForIndex(evElem.index))).simplify({
432
+ //nbMaxSteps: 100,
433
+ })).toTex());
434
+ tryToAddWrongProp(propositions, operatorComposition(AddNode, evUnion
435
+ .getArrElem()
436
+ .map((evElem) => multiply(evElem.index, finiteProbDistr.getPForIndex(evElem.index))))
437
+ .simplify({
438
+ //nbMaxSteps: 100,
439
+ })
440
+ .toTex());
441
+ tryToAddWrongProp(propositions, multiply(frac(1, evUnion.getArrElem().length), operatorComposition(AddNode, evUnion
442
+ .getArrElem()
443
+ .map((evElem) => finiteProbDistr.getPForIndex(evElem.index))))
444
+ .simplify({
445
+ //nbMaxSteps: 100,
446
+ })
447
+ .toTex());
448
+ }
449
+ else {
450
+ tryToAddWrongProp(propositions, operatorComposition(MultiplyNode, evUnion.getArrElem().map((evElem) => evElem.p))
451
+ .simplify({
452
+ //nbMaxSteps: 100,
453
+ })
454
+ .toTex());
455
+ tryToAddWrongProp(propositions, substract(1, operatorComposition(MultiplyNode, evUnion.getArrElem().map((evElem) => evElem.p)))
456
+ .simplify({
457
+ //nbMaxSteps: 100,
458
+ })
459
+ .toTex());
460
+ tryToAddWrongProp(propositions, substract(1, evUnion.p).toTex());
461
+ tryToAddWrongProp(propositions, operatorComposition(AddNode, evUnion.getArrElem().map((evElem) => multiply(evElem.index, evElem.p)))
462
+ .simplify({
463
+ //nbMaxSteps: 100,
464
+ })
465
+ .toTex());
466
+ tryToAddWrongProp(propositions, multiply(frac(1, evUnion.getArrElem().length), evUnion.p)
467
+ .simplify({
468
+ //nbMaxSteps: 100,
469
+ })
470
+ .toTex());
471
+ }
472
+ return shuffleProps(propositions, n);
473
+ };
474
+ const getValueNode = (tex, arrProba) => {
475
+ const finiteProbDistr = FiniteProbDistrConstructor.fromArrProba(arrProba.map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds)));
476
+ const arrayOfIndexes = tex.split("+").map((texVar) => {
477
+ if (!texVar.includes("E_{")) {
478
+ return parseInt(texVar.substring(texVar.indexOf("E_") + 2));
479
+ }
480
+ else {
481
+ return parseInt(texVar.substring(texVar.indexOf("E_{") + 3, texVar.indexOf("}}")));
482
+ }
483
+ });
484
+ const arrayOfNodes = arrayOfIndexes.map((i) => finiteProbDistr.getPForIndex(i));
485
+ return operatorComposition(AddNode, arrayOfNodes).simplify({
486
+ //nbMaxSteps: 100,
487
+ });
488
+ };
489
+ const isAnswerValid = (ans, { answer, ...identifiers }) => {
490
+ const { arrProba, isProbasAreNumbers } = identifiers;
491
+ const nodeAnswer = getAnswerValueNode(identifiers);
492
+ let nodeAns;
493
+ if (isProbasAreNumbers) {
494
+ nodeAns = parseAlgebraic(ans);
495
+ }
496
+ else {
497
+ nodeAns = getValueNode(ans, arrProba);
498
+ }
499
+ return substract(nodeAns, nodeAnswer).simplify().evaluate() === 0;
500
+ };
501
+ const getProbaAsSumOfProbasQuestion = (optsIn) => {
502
+ const opts = Object.assign(optsDefault, optsIn) ?? optsDefault;
503
+ const unionLength = random(opts.unionLength);
504
+ const indexSituation = random([...Array(arrayOfSituations.length).keys()].filter((indexSituation) => {
505
+ const situation = arrayOfSituations[indexSituation];
506
+ return situation.someElem.length >= unionLength;
507
+ }));
508
+ const situation = arrayOfSituations[indexSituation];
509
+ const evUnion = situation.getRandomUnionEvent(unionLength);
510
+ const eventIds = evUnion.toIdentifiers();
511
+ const nbUnique = Math.min(randint(3, 7), situation.allElem.length - 1);
512
+ const finiteProbDistr = FiniteProbDistrConstructor.randomDistr(situation.allElem.length, nbUnique);
513
+ const isProbasAreNumbers = random(opts.isProbasAreNumbers);
514
+ const identifiers = {
515
+ indexSituation,
516
+ eventIds,
517
+ arrProba: finiteProbDistr.arrProba.map((node) => node.toIdentifiers()),
518
+ isProbasAreNumbers,
519
+ };
520
+ return getQuestionFromIdentifiers(identifiers, opts);
521
+ };
522
+ const getQuestionFromIdentifiers = (identifiers, options) => {
523
+ const question = {
524
+ instruction: getInstruction(identifiers),
525
+ answer: getAnswer(identifiers),
526
+ keys: getKeys(identifiers),
527
+ answerFormat: "tex",
528
+ identifiers,
529
+ hint: getHint(identifiers),
530
+ correction: getCorrection(identifiers),
531
+ options,
532
+ };
533
+ return question;
534
+ };
535
+ export const probaAsSumOfProbas = {
536
+ id: "probaAsSumOfProbas",
537
+ label: "Calculer la probabilité d’un événement comme somme des probabilités des événements qui le composent",
538
+ isSingleStep: false,
539
+ generator: (nb, opts) => getDistinctQuestions(() => getProbaAsSumOfProbasQuestion(opts), nb),
540
+ options,
541
+ qcmTimer: 60,
542
+ freeTimer: 60,
543
+ getPropositions,
544
+ isAnswerValid,
545
+ subject: "Mathématiques",
546
+ hasHintAndCorrection: true,
547
+ getQuestionFromIdentifiers,
548
+ };
@@ -18,4 +18,6 @@ export * from "./averageLinearity.js";
18
18
  export * from "./calculateMeanFromFrequencies.js";
19
19
  export * from "./cumulativeSum.js";
20
20
  export * from "./getQuartileProportionQuestion.js";
21
+ export * from "./interpretIndicatorsForLists.js";
22
+ export * from "./plausibilityOfAverage.js";
21
23
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/stats1var/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,sCAAsC,CAAC;AACrD,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,iCAAiC,CAAC;AAChD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,uBAAuB,CAAC;AACtC,cAAc,mCAAmC,CAAC;AAClD,cAAc,oBAAoB,CAAC;AACnC,cAAc,oCAAoC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/stats1var/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,sCAAsC,CAAC;AACrD,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,iCAAiC,CAAC;AAChD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,uBAAuB,CAAC;AACtC,cAAc,mCAAmC,CAAC;AAClD,cAAc,oBAAoB,CAAC;AACnC,cAAc,oCAAoC,CAAC;AACnD,cAAc,kCAAkC,CAAC;AACjD,cAAc,4BAA4B,CAAC"}
@@ -18,3 +18,5 @@ export * from "./averageLinearity.js";
18
18
  export * from "./calculateMeanFromFrequencies.js";
19
19
  export * from "./cumulativeSum.js";
20
20
  export * from "./getQuartileProportionQuestion.js";
21
+ export * from "./interpretIndicatorsForLists.js";
22
+ export * from "./plausibilityOfAverage.js";
@@ -0,0 +1,9 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ type Identifiers = {
3
+ dictNameForSerie: Record<string, number[]>;
4
+ answerName: string;
5
+ isLess: boolean;
6
+ };
7
+ export declare const interpretIndicatorsForLists: Exercise<Identifiers>;
8
+ export {};
9
+ //# sourceMappingURL=interpretIndicatorsForLists.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interpretIndicatorsForLists.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/stats1var/interpretIndicatorsForLists.ts"],"names":[],"mappings":"AAAA,OAAO,EAWL,QAAQ,EACT,MAAM,6BAA6B,CAAC;AAMrC,KAAK,WAAW,GAAG;IACjB,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IAC3C,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,OAAO,CAAC;CACjB,CAAC;AA2GF,eAAO,MAAM,2BAA2B,EAAE,QAAQ,CAAC,WAAW,CAiB7D,CAAC"}
@@ -0,0 +1,90 @@
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 { coinFlip } from "../../../../utils/alea/coinFlip.js";
5
+ import { randomMany } from "../../../../utils/alea/random.js";
6
+ const getInstruction = (identifiers) => {
7
+ const { dictNameForSerie, isLess } = identifiers;
8
+ const series = Object.entries(dictNameForSerie);
9
+ return `On considère les séries suivantes :
10
+
11
+ ${series.map(([name, values]) => {
12
+ return `Série ${name} : ${values
13
+ .map((value) => `$${value.frenchify()}$`)
14
+ .join(" ; ")}`;
15
+ }).join(`
16
+
17
+ `)}
18
+
19
+ Quelle série a l'écart-type le plus ${isLess ? `petit` : `grand`} ?`;
20
+ };
21
+ const getPropositions = (_, { answer, ...identifiers }) => {
22
+ const { dictNameForSerie, answerName } = identifiers;
23
+ const propositions = [];
24
+ addValidProp(propositions, `la série $${answerName}$`, "raw");
25
+ Object.keys(dictNameForSerie)
26
+ .toSorted((name1, name2) => name1.localeCompare(name2))
27
+ .forEach((name) => {
28
+ tryToAddWrongProp(propositions, `la série $${name}$`, "raw");
29
+ });
30
+ tryToAddWrongProp(propositions, `aucune des deux car leurs écart-type sont égaux`, "raw");
31
+ return propositions;
32
+ };
33
+ const getHint = () => {
34
+ return `L'écart-type est un indicateur de dispersion.
35
+ Plus il est important, plus les valeurs sont éparpillées.
36
+ Plus il est petit, plus les valeurs sont regroupées autour de la moyenne.`;
37
+ };
38
+ const getCorrection = (identifiers) => {
39
+ const { answerName, isLess } = identifiers;
40
+ const wrongName = answerName === "A" ? "B" : "A";
41
+ return `Ici les deux séries ont une moyenne de $10$
42
+ mais les valeurs de la série $${answerName}$ sont ${isLess ? `moins` : `plus`} éparpillées autour de $10$ que les valeurs de la série $${wrongName}$.
43
+ Ainsi la série $${answerName}$ a l'écart-type le plus ${isLess ? `petit` : `grand`}.`;
44
+ };
45
+ const getInterpretIndicatorsForListsQuestion = () => {
46
+ const a = randint(1, 4);
47
+ const b = randint(2, 5) * a;
48
+ const series = [
49
+ [10 - a, 10, 10, 10 + a],
50
+ [10 - b, 10, 10, 10 + b],
51
+ ];
52
+ const isLess = coinFlip();
53
+ const answerIndexUnshuffled = isLess ? 0 : 1;
54
+ const shuffleArray = randomMany([...Array(series.length).keys()], series.length);
55
+ const shuffledSeries = shuffleArray.map((i) => series[i]);
56
+ const answerIndexShuffled = shuffleArray.indexOf(answerIndexUnshuffled);
57
+ const names = ["A", "B"];
58
+ const dictNameForSerie = Object.fromEntries(names.map((name, i) => [name, shuffledSeries[i]]));
59
+ const answerName = names[answerIndexShuffled];
60
+ return getQuestionFromIdentifiers({
61
+ dictNameForSerie,
62
+ answerName,
63
+ isLess,
64
+ });
65
+ };
66
+ const getQuestionFromIdentifiers = (identifiers) => {
67
+ const question = {
68
+ instruction: getInstruction(identifiers),
69
+ keys: [],
70
+ answerFormat: "tex",
71
+ identifiers,
72
+ hint: getHint(identifiers),
73
+ correction: getCorrection(identifiers),
74
+ };
75
+ return question;
76
+ };
77
+ export const interpretIndicatorsForLists = {
78
+ id: "interpretIndicatorsForLists",
79
+ label: "Interpréter des indicateurs statistiques pour une série statistique",
80
+ isSingleStep: true,
81
+ generator: (nb, opts) => getDistinctQuestions(() => getInterpretIndicatorsForListsQuestion(opts), nb),
82
+ qcmTimer: 60,
83
+ freeTimer: 60,
84
+ getPropositions,
85
+ hasHintAndCorrection: true,
86
+ subject: "Mathématiques",
87
+ getQuestionFromIdentifiers,
88
+ answerType: "QCM",
89
+ isQCM: true,
90
+ };
@@ -0,0 +1,10 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ type Identifiers = {
3
+ a: number;
4
+ values: number[];
5
+ isAboveA: boolean;
6
+ isQuestionIsAboveA: boolean;
7
+ };
8
+ export declare const plausibilityOfAverage: Exercise<Identifiers>;
9
+ export {};
10
+ //# sourceMappingURL=plausibilityOfAverage.d.ts.map