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
@@ -1 +1 @@
1
- {"version":3,"file":"volumeConversion.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/conversion/volumeConversion.ts"],"names":[],"mappings":"AAUA,OAAO,EACL,QAAQ,EAcT,MAAM,mBAAmB,CAAC;AAE3B,KAAK,WAAW,GAAG;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,0BAA0B,EAAE,MAAM,CAAC;IACnC,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAgIF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,WAAW,CAclD,CAAC"}
1
+ {"version":3,"file":"volumeConversion.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/conversion/volumeConversion.ts"],"names":[],"mappings":"AAYA,OAAO,EACL,QAAQ,EAcT,MAAM,mBAAmB,CAAC;AAE3B,KAAK,WAAW,GAAG;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,0BAA0B,EAAE,MAAM,CAAC;IACnC,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAwIF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,WAAW,CAclD,CAAC"}
@@ -2,6 +2,8 @@ import { Decimal, DecimalConstructor, } from "../../../math/numbers/decimals/dec
2
2
  import { randint } from "../../../math/utils/random/randint.js";
3
3
  import { frac } from "../../../tree/nodes/operators/fractionNode.js";
4
4
  import { multiply } from "../../../tree/nodes/operators/multiplyNode.js";
5
+ import { substract } from "../../../tree/nodes/operators/substractNode.js";
6
+ import { parseAlgebraic } from "../../../tree/parsers/latexParser.js";
5
7
  import { shuffle } from "../../../utils/alea/shuffle.js";
6
8
  import { doWhile } from "../../../utils/doWhile.js";
7
9
  import { alignTex } from "../../../utils/latex/alignTex.js";
@@ -99,7 +101,11 @@ const getPropositions = (n, { answer, randomUnitIndex, randomUnitInstructionInde
99
101
  return shuffle(propositions);
100
102
  };
101
103
  const isAnswerValid = (ans, { answer }) => {
102
- return ans === answer;
104
+ return (ans === answer ||
105
+ (() => {
106
+ const [nodeAns, nodeAnswer] = [ans, answer].map((tex) => parseAlgebraic(tex));
107
+ return substract(nodeAns, nodeAnswer).evaluate() === 0;
108
+ })());
103
109
  };
104
110
  export const volumeConversion = {
105
111
  id: "volumeConversion",
@@ -0,0 +1,50 @@
1
+ import { Exercise } from "../../../exercises/exercise.js";
2
+ type Identifiers = {
3
+ barChart: BarChart;
4
+ itemAsked: AskedItem;
5
+ questionStr: string;
6
+ answerStr: string;
7
+ displayType: "horizMulti" | "vertStacked";
8
+ };
9
+ type AskedItem = {
10
+ type: "xForCategory" | "categoryForX";
11
+ isLess: boolean;
12
+ ordinal: number;
13
+ index: number;
14
+ };
15
+ type ColorStyle = {
16
+ type: "color";
17
+ color: string;
18
+ frStr: string;
19
+ };
20
+ type FillStyle = {
21
+ type: "fill";
22
+ fill: number;
23
+ frStr: string;
24
+ };
25
+ type CategoryProps = {
26
+ name: string;
27
+ frStr: string;
28
+ };
29
+ type CategoryStyle = ColorStyle | FillStyle;
30
+ type Category = {
31
+ props: CategoryProps;
32
+ style: CategoryStyle;
33
+ };
34
+ type BarProps = {
35
+ label: string;
36
+ frStr: string;
37
+ };
38
+ type Bar = {
39
+ props: BarProps;
40
+ data: number[];
41
+ };
42
+ type BarChart = {
43
+ description: string;
44
+ axisLabels: string[];
45
+ bars: Bar[];
46
+ categories: Category[];
47
+ };
48
+ export declare const barChartInterpreting: Exercise<Identifiers>;
49
+ export {};
50
+ //# sourceMappingURL=barChartInterpreting.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"barChartInterpreting.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/dataRepresentations/barChartInterpreting.ts"],"names":[],"mappings":"AAAA,OAAO,EAaL,QAAQ,EAET,MAAM,6BAA6B,CAAC;AAiBrC,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,QAAQ,CAAC;IACnB,SAAS,EAAE,SAAS,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,YAAY,GAAG,aAAa,CAAC;CAC3C,CAAC;AAEF,KAAK,SAAS,GAAG;IACf,IAAI,EAAE,cAAc,GAAG,cAAc,CAAC;IACtC,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,KAAK,UAAU,GAAG;IAChB,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,KAAK,SAAS,GAAG;IACf,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,KAAK,aAAa,GAAG;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,KAAK,aAAa,GAAG,UAAU,GAAG,SAAS,CAAC;AAE5C,KAAK,QAAQ,GAAG;IACd,KAAK,EAAE,aAAa,CAAC;IACrB,KAAK,EAAE,aAAa,CAAC;CACtB,CAAC;AAEF,KAAK,QAAQ,GAAG;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,KAAK,GAAG,GAAG;IACT,KAAK,EAAE,QAAQ,CAAC;IAChB,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB,CAAC;AAEF,KAAK,QAAQ,GAAG;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,IAAI,EAAE,GAAG,EAAE,CAAC;IACZ,UAAU,EAAE,QAAQ,EAAE,CAAC;CACxB,CAAC;AAisBF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAetD,CAAC"}
@@ -0,0 +1,517 @@
1
+ import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../exercises/exercise.js";
2
+ import { random, randomMany } from "../../../utils/alea/random.js";
3
+ import { randfloat } from "../../../math/utils/random/randfloat.js";
4
+ import { blueMain, greenMain, orange, purpleDark, red, } from "../../../geogebra/colors.js";
5
+ import { coinFlip } from "../../../utils/alea/coinFlip.js";
6
+ import { probaLawFlip } from "../../../utils/alea/probaLawFlip.js";
7
+ import { getDistinctQuestions } from "../../../exercises/utils/getDistinctQuestions.js";
8
+ import { randint } from "../../../math/utils/random/randint.js";
9
+ import { GeogebraConstructor } from "../../../geogebra/geogebraConstructor.js";
10
+ import { capitalize } from "../../../utils/strings/capitalize.js";
11
+ class BarChartConstructor {
12
+ static stylesPools = {
13
+ color: [
14
+ {
15
+ type: "color",
16
+ color: red,
17
+ frStr: "rouge",
18
+ },
19
+ {
20
+ type: "color",
21
+ color: orange,
22
+ frStr: "orange",
23
+ },
24
+ {
25
+ type: "color",
26
+ color: purpleDark,
27
+ frStr: "violet",
28
+ },
29
+ {
30
+ type: "color",
31
+ color: blueMain,
32
+ frStr: "bleu",
33
+ },
34
+ {
35
+ type: "color",
36
+ color: greenMain,
37
+ frStr: "vert",
38
+ },
39
+ ],
40
+ fill: [
41
+ {
42
+ type: "fill",
43
+ fill: 1,
44
+ frStr: "hachures simples",
45
+ },
46
+ {
47
+ type: "fill",
48
+ fill: 2,
49
+ frStr: "hachures croisées",
50
+ },
51
+ {
52
+ type: "fill",
53
+ fill: 5,
54
+ frStr: "nid d'abeille",
55
+ },
56
+ {
57
+ type: "fill",
58
+ fill: 4,
59
+ frStr: "petits points",
60
+ },
61
+ {
62
+ type: "fill",
63
+ fill: 3,
64
+ frStr: "échiquier",
65
+ },
66
+ ],
67
+ };
68
+ static randomFromSkeleton(skeleton, nbBars, nbCateg, styleType) {
69
+ const categoryIndexes = randomMany([...Array(skeleton.categoryProps.length).keys()], nbCateg);
70
+ const dictIsUsingCategory = Object.fromEntries(categoryIndexes.map((i) => [i, true]));
71
+ const bars = this.createRandomBars(nbBars, dictIsUsingCategory, skeleton.barProps, skeleton.referenceData, skeleton.evoRanges).toSorted((bar1, bar2) => bar1.props.label.localeCompare(bar2.props.label));
72
+ const categories = this.createRandomCategories(dictIsUsingCategory, skeleton.categoryProps, styleType);
73
+ return {
74
+ description: skeleton.description,
75
+ axisLabels: skeleton.axisLabels,
76
+ bars,
77
+ categories,
78
+ };
79
+ }
80
+ static createRandomBars(nbBars, dictIsUsingCategory, barPropsPool, referenceDataIn, evoRangesIn) {
81
+ const barProps = randomMany(barPropsPool, nbBars);
82
+ function createRandomDataByPerturbatingData(data, evoRanges) {
83
+ return data.map((nb, i) => {
84
+ const evoRange = evoRanges[i];
85
+ return nb * randfloat(evoRange.min, evoRange.max);
86
+ });
87
+ }
88
+ const evoRanges = evoRangesIn.filter((_, categIndex) => dictIsUsingCategory[categIndex]);
89
+ let referenceData = referenceDataIn.filter((_, categIndex) => dictIsUsingCategory[categIndex]);
90
+ const datas = [];
91
+ for (let i = 0; i < nbBars; i++) {
92
+ const data = createRandomDataByPerturbatingData(referenceData, evoRanges);
93
+ datas.push(data);
94
+ referenceData = data;
95
+ }
96
+ return [...Array(nbBars).keys()].map((i) => {
97
+ return {
98
+ props: barProps[i],
99
+ data: datas[i],
100
+ };
101
+ });
102
+ }
103
+ static createRandomCategories(dictIsUsingCategory, categoryPropsPool, styleType) {
104
+ const nbCategUsed = Object.keys(dictIsUsingCategory).length;
105
+ const styles = randomMany(this.stylesPools[styleType], nbCategUsed);
106
+ return categoryPropsPool
107
+ .filter((_, i) => dictIsUsingCategory[i])
108
+ .map((props, i) => {
109
+ const style = styles[i];
110
+ return {
111
+ props,
112
+ style,
113
+ };
114
+ });
115
+ }
116
+ }
117
+ const frenchOrdinals = [``, "deuxième", "troisième", "quatrième"];
118
+ const arrayOfBarChartSkeleton = [
119
+ {
120
+ description: `Le diagramme en barres ci-contre donne la production d'électricité, en TWh (téraWatt-heure) selon son origine.`,
121
+ questionXForCategFunc(categName, isLess, ordinal) {
122
+ return `Quelle était l'année où la production d'électricité d'origine ${categName.toLocaleLowerCase()} était
123
+ la ${ordinal > 0 ? `${frenchOrdinals[ordinal]} la` : ``} ${isLess ? `moins` : `plus`} importante de toutes ces années ?`;
124
+ },
125
+ answerXForCategFunc(categName, isLess, ordinal) {
126
+ return `l'année où la production d'électricité d'origine ${categName.toLocaleLowerCase()} était
127
+ la ${ordinal > 0 ? `${frenchOrdinals[ordinal]} la` : ``} ${isLess ? `moins` : `plus`} importante de toutes ces années`;
128
+ },
129
+ questionCategForXFunc(barLabel, isLess, ordinal) {
130
+ return `Quelle était l'origine de production d'électricité
131
+ la ${ordinal > 0 ? `${frenchOrdinals[ordinal]} la` : ``} ${isLess ? `moins` : `plus`} importante pour l'année $${barLabel}$ ?`;
132
+ },
133
+ answerCategForXFunc(barLabel, isLess, ordinal) {
134
+ return `la production d'électricité
135
+ la ${ordinal > 0 ? `${frenchOrdinals[ordinal]} la` : ``} ${isLess ? `moins` : `plus`} importante pour l'année $${barLabel}$`;
136
+ },
137
+ axisLabels: ["Année", "Production d'électricité (en TWh)"],
138
+ categoryProps: (() => {
139
+ const categoryNames = [
140
+ "Nucléaire",
141
+ "Thermique",
142
+ "Hydraulique",
143
+ "Solaire",
144
+ "Éolienne",
145
+ ];
146
+ return categoryNames.map((name) => {
147
+ return {
148
+ name,
149
+ frStr: `la production d'électricité d'origine ${name.toLocaleLowerCase()}`,
150
+ };
151
+ });
152
+ })(),
153
+ barProps: (() => {
154
+ const labels = [...Array(30).keys()].map((i) => `${1995 + i}`);
155
+ return labels.map((label) => {
156
+ return {
157
+ label,
158
+ frStr: `l'année $${label}$`,
159
+ };
160
+ });
161
+ })(),
162
+ referenceData: [500, 450, 400, 350, 300],
163
+ evoRanges: [
164
+ { min: 0.95, max: 1.05 },
165
+ { min: 0.9, max: 1.1 },
166
+ { min: 0.8, max: 1.2 },
167
+ { min: 0.7, max: 1.3 },
168
+ { min: 0.7, max: 1.3 },
169
+ ],
170
+ },
171
+ ];
172
+ const getInstruction = (identifiers) => {
173
+ const { barChart, questionStr } = identifiers;
174
+ return `${barChart.description}
175
+
176
+ ${questionStr}
177
+
178
+ Légende :
179
+
180
+ ${barChart.categories
181
+ .map((category) => {
182
+ return `${category.props.name} (${category.style.frStr})
183
+
184
+ `;
185
+ })
186
+ .join("")}
187
+ `;
188
+ };
189
+ const getAnswerCategory = (barChart, itemAsked) => {
190
+ const bar = barChart.bars[itemAsked.index];
191
+ const categIndex = bar.data
192
+ .map((data, i) => {
193
+ return { data: data, categIndex: i };
194
+ })
195
+ .toSorted((obj1, obj2) => (itemAsked.isLess ? +1 : -1) * (obj1.data - obj2.data))[itemAsked.ordinal].categIndex;
196
+ return barChart.categories[categIndex];
197
+ };
198
+ const getAnswerBar = (barChart, itemAsked) => {
199
+ const categIndex = itemAsked.index;
200
+ const barIndex = barChart.bars
201
+ .map((bar) => bar.data[categIndex])
202
+ .map((data, i) => {
203
+ return { data: data, barIndex: i };
204
+ })
205
+ .toSorted((obj1, obj2) => (itemAsked.isLess ? +1 : -1) * (obj1.data - obj2.data))[itemAsked.ordinal].barIndex;
206
+ return barChart.bars[barIndex];
207
+ };
208
+ const getAnswer = (identifiers) => {
209
+ const { barChart, itemAsked } = identifiers;
210
+ switch (itemAsked.type) {
211
+ case "categoryForX":
212
+ return getAnswerCategory(barChart, itemAsked).props.name;
213
+ case "xForCategory":
214
+ return getAnswerBar(barChart, itemAsked).props.label;
215
+ }
216
+ };
217
+ const getPropositions = (n, { answer, ...identifiers }) => {
218
+ const { barChart, itemAsked } = identifiers;
219
+ const propositions = [];
220
+ switch (itemAsked.type) {
221
+ case "categoryForX":
222
+ {
223
+ addValidProp(propositions, answer, "raw");
224
+ barChart.categories.forEach((categ) => {
225
+ tryToAddWrongProp(propositions, categ.props.name, "raw");
226
+ });
227
+ }
228
+ break;
229
+ case "xForCategory":
230
+ {
231
+ addValidProp(propositions, answer, "raw");
232
+ barChart.bars.forEach((bar) => {
233
+ tryToAddWrongProp(propositions, bar.props.label, "raw");
234
+ });
235
+ }
236
+ break;
237
+ }
238
+ return shuffleProps(propositions, n);
239
+ };
240
+ const getHint = (identifiers) => {
241
+ const { barChart, itemAsked } = identifiers;
242
+ switch (itemAsked.type) {
243
+ case "categoryForX": {
244
+ const bar = barChart.bars[itemAsked.index];
245
+ return `Concentre-toi sur ${bar.props.frStr}.`;
246
+ }
247
+ case "xForCategory": {
248
+ const category = barChart.categories[itemAsked.index];
249
+ return `Concentre-toi sur les barres ${category.style.type === "color"
250
+ ? `en ${category.style.frStr}`
251
+ : `en style ${category.style.frStr}`}.`;
252
+ }
253
+ }
254
+ };
255
+ const getCorrection = (identifiers) => {
256
+ const { barChart, itemAsked, answerStr } = identifiers;
257
+ switch (itemAsked.type) {
258
+ case "categoryForX": {
259
+ const answerCategory = getAnswerCategory(barChart, itemAsked);
260
+ return `On cherche ${answerStr}.
261
+ ${capitalize(answerStr)} est ${answerCategory.props.frStr}.`;
262
+ }
263
+ case "xForCategory": {
264
+ const category = barChart.categories[itemAsked.index];
265
+ const answerBar = getAnswerBar(barChart, itemAsked);
266
+ return `Comme ${category.props.frStr} est indiquée ${category.style.type === "color"
267
+ ? `en ${category.style.frStr}`
268
+ : `en style ${category.style.frStr}`} sur le diagramme , on cherche ${answerStr}.
269
+ ${capitalize(answerStr)} est ${answerBar.props.frStr}.`;
270
+ }
271
+ }
272
+ };
273
+ const getGGBOptionsHorizMulti = (identifiers) => {
274
+ const { barChart } = identifiers;
275
+ const nbTotalBar = barChart.bars.length;
276
+ const nbTotalCateg = barChart.categories.length;
277
+ const yMax = Math.max(...barChart.bars.flatMap((bar) => bar.data));
278
+ const xMax = 3.0 * yMax;
279
+ function getXRangeForCategory(barIndex, categIndex) {
280
+ const xRangeBar = {
281
+ min: (xMax * (2 * barIndex + 1)) / (2 * nbTotalBar + 2),
282
+ max: (xMax * (2 * barIndex + 2)) / (2 * nbTotalBar + 2),
283
+ };
284
+ const progressMin = categIndex / (nbTotalCateg + 1);
285
+ const progressMax = (categIndex + 1) / (nbTotalCateg + 1);
286
+ return {
287
+ min: xRangeBar.min + progressMin * (xRangeBar.max - xRangeBar.min),
288
+ max: xRangeBar.min + progressMax * (xRangeBar.max - xRangeBar.min),
289
+ };
290
+ }
291
+ function createBarChartCommandsForCategory(barChart, categIndex) {
292
+ const arrayXRange = barChart.bars.map((_, barIndex) => getXRangeForCategory(barIndex, categIndex));
293
+ const arrayX = arrayXRange.map((xRange) => xRange.min);
294
+ const arrayY = barChart.bars.map((bar) => bar.data[categIndex]);
295
+ const categ = barChart.categories[categIndex];
296
+ const style = categ.style;
297
+ const B = `B_${categIndex}`;
298
+ const barChartCommand = [
299
+ `${B} = BarChart({${arrayX.join(",")}}, {${arrayY.join(",")}}, ${xMax / ((2 * nbTotalBar + 2) * (nbTotalCateg + 1))})`,
300
+ `ShowLabel(${B},false)`,
301
+ style.type === "color"
302
+ ? `SetColor(${B}, "${barChart.categories[categIndex].style.color}")`
303
+ : `SetDecoration(${B}, ${barChart.categories[categIndex].style.fill})`,
304
+ ];
305
+ return barChartCommand;
306
+ }
307
+ const commands = [
308
+ //offsetted barCharts
309
+ ...barChart.categories.flatMap((_, categIndex) => createBarChartCommandsForCategory(barChart, categIndex)),
310
+ //bar labels
311
+ ...barChart.bars.map((bar, barIndex) => `Text("\\footnotesize ${bar.props.label}", (${(xMax * (2 * barIndex + 1)) / (2 * nbTotalBar + 2)}, ${-yMax / 500}), true, true, 0, -1)`),
312
+ ];
313
+ const ggb = new GeogebraConstructor({
314
+ commands,
315
+ gridDistance: [xMax, yMax],
316
+ fontSize: 16,
317
+ lockedAxesRatio: 4 / 3,
318
+ xAxis: {
319
+ hideNumbers: true,
320
+ steps: 10 * xMax,
321
+ showPositive: true,
322
+ label: barChart.axisLabels[0],
323
+ },
324
+ yAxis: {
325
+ showPositive: true,
326
+ label: barChart.axisLabels[1],
327
+ // steps: 100,
328
+ },
329
+ });
330
+ return ggb.getOptions({
331
+ coords: ggb.getAdaptedCoords({
332
+ xMin: 0,
333
+ xMax: xMax,
334
+ yMin: 0,
335
+ yMax: yMax,
336
+ }),
337
+ });
338
+ };
339
+ const getGGBOptionsVertStacked = (identifiers) => {
340
+ const { barChart } = identifiers;
341
+ const nbTotalBar = barChart.bars.length;
342
+ const arrayOfBarHeights = barChart.bars.map((bar) => bar.data.reduce((acc, data) => acc + data, 0));
343
+ const yMax = Math.max(...arrayOfBarHeights);
344
+ const xMax = 3.0 * yMax;
345
+ const xPadding = 0.1 * xMax;
346
+ const xMargin = xPadding;
347
+ const barWidth = (xMax - 2 * xMargin - (nbTotalBar - 1) * xPadding) / nbTotalBar;
348
+ function getXRangeForBarIndex(barIndex) {
349
+ const xMin = xMargin + barIndex * (xPadding + barWidth);
350
+ return {
351
+ min: xMin,
352
+ max: xMin + barWidth,
353
+ };
354
+ }
355
+ function getYRangeForCategory(barIndex, categIndex) {
356
+ const slice = barChart.bars[barIndex].data.slice(0, categIndex);
357
+ const yMinForCateg = slice.reduce((acc, data) => acc + data, 0);
358
+ const yMaxForCateg = yMinForCateg + barChart.bars[barIndex].data[categIndex];
359
+ return {
360
+ min: yMinForCateg,
361
+ max: yMaxForCateg,
362
+ };
363
+ }
364
+ function createCommandsForBar(barChart, barIndex) {
365
+ //const bar = barChart.bars[barIndex];
366
+ const commands = barChart.categories.flatMap((categ, categIndex) => {
367
+ const xRange = getXRangeForBarIndex(barIndex);
368
+ const yRange = getYRangeForCategory(barIndex, categIndex);
369
+ const style = categ.style;
370
+ const B = `B_{${barIndex}${categIndex}}`;
371
+ const barChartCommand = [
372
+ `${B} = Polygon((${xRange.min}, ${yRange.min}), (${xRange.min}, ${yRange.max}),(${xRange.max}, ${yRange.max}),(${xRange.max}, ${yRange.min}))`,
373
+ `ShowLabel(${B},false)`,
374
+ style.type === "color"
375
+ ? `SetColor(${B}, "${barChart.categories[categIndex].style.color}")`
376
+ : `SetDecoration(${B}, ${barChart.categories[categIndex].style.fill})`,
377
+ ];
378
+ return barChartCommand;
379
+ });
380
+ return commands;
381
+ }
382
+ const commands = [
383
+ //stacked bars
384
+ ...barChart.bars.flatMap((_, barIndex) => createCommandsForBar(barChart, barIndex)),
385
+ //bar labels
386
+ ...barChart.bars.map((bar, barIndex) => `Text("\\footnotesize ${bar.props.label}", (${getXRangeForBarIndex(barIndex).min}, ${-yMax / 500}), true, true, 0, -1)`),
387
+ ];
388
+ const ggb = new GeogebraConstructor({
389
+ commands,
390
+ gridDistance: [xMax, yMax],
391
+ fontSize: 16,
392
+ lockedAxesRatio: 4 / 3,
393
+ xAxis: {
394
+ hideNumbers: true,
395
+ steps: 10 * xMax,
396
+ showPositive: true,
397
+ label: barChart.axisLabels[0],
398
+ },
399
+ yAxis: {
400
+ showPositive: true,
401
+ label: barChart.axisLabels[1],
402
+ // steps: 100,
403
+ },
404
+ });
405
+ return ggb.getOptions({
406
+ coords: ggb.getAdaptedCoords({
407
+ xMin: 0,
408
+ xMax: xMax,
409
+ yMin: 0,
410
+ yMax: yMax,
411
+ }),
412
+ });
413
+ };
414
+ const getGGBOptions = (identifiers) => {
415
+ const { displayType } = identifiers;
416
+ switch (displayType) {
417
+ case "horizMulti":
418
+ return getGGBOptionsHorizMulti(identifiers);
419
+ case "vertStacked":
420
+ return getGGBOptionsVertStacked(identifiers);
421
+ }
422
+ };
423
+ const getBarChartInterpretingQuestion = () => {
424
+ const styleType = coinFlip() ? "color" : "fill";
425
+ const displayType = coinFlip() ? "horizMulti" : "vertStacked";
426
+ let nbBars;
427
+ let nbCateg;
428
+ switch (displayType) {
429
+ case "horizMulti":
430
+ {
431
+ nbBars = 3;
432
+ nbCateg = 3;
433
+ }
434
+ break;
435
+ case "vertStacked":
436
+ {
437
+ nbBars = 5;
438
+ nbCateg = 3;
439
+ }
440
+ break;
441
+ }
442
+ const barChartSkeleton = random(arrayOfBarChartSkeleton);
443
+ const barChart = BarChartConstructor.randomFromSkeleton(barChartSkeleton, nbBars, nbCateg, styleType);
444
+ const itemAsked = random([
445
+ // {
446
+ // type: "xForCategory",
447
+ // isLess: coinFlip(),
448
+ // ordinal: probaLawFlip([
449
+ // [0, 0.7],
450
+ // [1, 0.3],
451
+ // ]),
452
+ // index: randint(0, nbCateg),
453
+ // },
454
+ {
455
+ type: "categoryForX",
456
+ isLess: coinFlip(),
457
+ ordinal: probaLawFlip([
458
+ [0, 0.7],
459
+ [1, 0.3],
460
+ ]),
461
+ index: randint(0, nbBars),
462
+ },
463
+ ]);
464
+ function questionStrForItemAsked(itemAsked) {
465
+ switch (itemAsked.type) {
466
+ case "xForCategory":
467
+ return barChartSkeleton.questionXForCategFunc(barChart.categories[itemAsked.index].props.name, itemAsked.isLess, itemAsked.ordinal);
468
+ case "categoryForX":
469
+ return barChartSkeleton.questionCategForXFunc(barChart.bars[itemAsked.index].props.label, itemAsked.isLess, itemAsked.ordinal);
470
+ }
471
+ }
472
+ const questionStr = questionStrForItemAsked(itemAsked);
473
+ function answerStrForItemAsked(itemAsked) {
474
+ switch (itemAsked.type) {
475
+ case "xForCategory":
476
+ return barChartSkeleton.answerXForCategFunc(barChart.categories[itemAsked.index].props.name, itemAsked.isLess, itemAsked.ordinal);
477
+ case "categoryForX":
478
+ return barChartSkeleton.answerCategForXFunc(barChart.bars[itemAsked.index].props.label, itemAsked.isLess, itemAsked.ordinal);
479
+ }
480
+ }
481
+ const answerStr = answerStrForItemAsked(itemAsked);
482
+ return getQuestionFromIdentifiers({
483
+ barChart,
484
+ itemAsked,
485
+ questionStr,
486
+ answerStr,
487
+ displayType,
488
+ });
489
+ };
490
+ const getQuestionFromIdentifiers = (identifiers) => {
491
+ const question = {
492
+ answer: getAnswer(identifiers),
493
+ instruction: getInstruction(identifiers),
494
+ keys: [],
495
+ answerFormat: "tex",
496
+ identifiers,
497
+ hint: getHint(identifiers),
498
+ correction: getCorrection(identifiers),
499
+ ggbOptions: getGGBOptions(identifiers),
500
+ };
501
+ return question;
502
+ };
503
+ export const barChartInterpreting = {
504
+ id: "barChartInterpreting",
505
+ label: "Interpréter un diagramme en bâtons",
506
+ isSingleStep: true,
507
+ generator: (nb, opts) => getDistinctQuestions(() => getBarChartInterpretingQuestion(opts), nb),
508
+ qcmTimer: 60,
509
+ freeTimer: 60,
510
+ getPropositions,
511
+ hasHintAndCorrection: true,
512
+ subject: "Mathématiques",
513
+ getQuestionFromIdentifiers,
514
+ hasGeogebra: true,
515
+ answerType: "QCM",
516
+ isQCM: true,
517
+ };
@@ -0,0 +1,7 @@
1
+ import { Exercise } from "../../../exercises/exercise.js";
2
+ type Identifiers = {
3
+ quartiles: number[];
4
+ };
5
+ export declare const boxPlotInterpreting: Exercise<Identifiers>;
6
+ export {};
7
+ //# sourceMappingURL=boxPlotInterpreting.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"boxPlotInterpreting.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/dataRepresentations/boxPlotInterpreting.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAYrC,KAAK,WAAW,GAAG;IACjB,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC;AAgRF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,WAAW,CAmBrD,CAAC"}