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,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
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"probaFromTableNoContext.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/probaStat/probaFromTableNoContext.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;AAYrC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC;AA2TF,KAAK,OAAO,GAAG;IAEb,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B,CAAC;AAmBF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAgBlE,CAAC"}
1
+ {"version":3,"file":"probaFromTableNoContext.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/probaStat/probaFromTableNoContext.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;AAarC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC;AA2TF,KAAK,OAAO,GAAG;IAEb,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B,CAAC;AA+BF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAgBlE,CAAC"}
@@ -3,6 +3,7 @@ import { getDistinctQuestions } from "../../../exercises/utils/getDistinctQuesti
3
3
  import { Rational } from "../../../math/numbers/rationals/rational.js";
4
4
  import { randint } from "../../../math/utils/random/randint.js";
5
5
  import { frac } from "../../../tree/nodes/operators/fractionNode.js";
6
+ import { substract } from "../../../tree/nodes/operators/substractNode.js";
6
7
  import { rationalParser } from "../../../tree/parsers/rationalParser.js";
7
8
  import { random } from "../../../utils/alea/random.js";
8
9
  import { handleVEAError } from "../../../utils/errors/handleVEAError.js";
@@ -248,12 +249,19 @@ const options = [
248
249
  type: GeneratorOptionType.checkbox,
249
250
  },
250
251
  ];
251
- const isAnswerValid = (ans, { answer }) => {
252
+ const isAnswerValid = (ans, { answer, ...identifiers }) => {
252
253
  try {
253
254
  const parsed = rationalParser(ans);
254
255
  if (!parsed)
255
256
  return false;
256
- return parsed.simplify().toTex() === answer;
257
+ return (parsed.simplify().toTex() === answer ||
258
+ (() => {
259
+ const { probaFrac } = identifiers;
260
+ const answerNode = new Rational(probaFrac[0], probaFrac[1])
261
+ .simplify()
262
+ .toTree();
263
+ return substract(parsed.simplify(), answerNode).evaluate() === 0;
264
+ })());
257
265
  }
258
266
  catch (err) {
259
267
  return handleVEAError(err);
@@ -1 +1 @@
1
- {"version":3,"file":"probaFromTableWithContext.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/probaStat/probaFromTableWithContext.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAYrC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC;AAwRF,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,WAAW,CAkB3D,CAAC"}
1
+ {"version":3,"file":"probaFromTableWithContext.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/probaStat/probaFromTableWithContext.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAYrC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC;AAyRF,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,WAAW,CAkB3D,CAAC"}
@@ -34,7 +34,8 @@ ${mdTable([
34
34
  ])}
35
35
 
36
36
  On choisit un élève au hasard. Quelle est la probabilité de tomber sur ${event} ?
37
- `;
37
+
38
+ Donner la valeur exacte.`;
38
39
  };
39
40
  const getAnswer = (identifiers) => {
40
41
  const { probaFrac } = identifiers;
@@ -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"}