math-exercises 3.0.125 → 3.0.126

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (291) hide show
  1. package/lib/exercises/math/calcul/fractions/fractionsSumsPrimeDenominators.d.ts.map +1 -1
  2. package/lib/exercises/math/calcul/fractions/fractionsSumsPrimeDenominators.js +61 -1
  3. package/lib/exercises/math/calcul/mentalCaluls/index.d.ts +1 -0
  4. package/lib/exercises/math/calcul/mentalCaluls/index.d.ts.map +1 -1
  5. package/lib/exercises/math/calcul/mentalCaluls/index.js +1 -0
  6. package/lib/exercises/math/calcul/mentalCaluls/mentalProgramSolve.d.ts +15 -0
  7. package/lib/exercises/math/calcul/mentalCaluls/mentalProgramSolve.d.ts.map +1 -0
  8. package/lib/exercises/math/calcul/mentalCaluls/mentalProgramSolve.js +217 -0
  9. package/lib/exercises/math/calcul/ordering/compareA10N.d.ts +16 -0
  10. package/lib/exercises/math/calcul/ordering/compareA10N.d.ts.map +1 -0
  11. package/lib/exercises/math/calcul/ordering/compareA10N.js +327 -0
  12. package/lib/exercises/math/calcul/ordering/compareABUsingQuotient.d.ts +8 -0
  13. package/lib/exercises/math/calcul/ordering/compareABUsingQuotient.d.ts.map +1 -0
  14. package/lib/exercises/math/calcul/ordering/compareABUsingQuotient.js +221 -0
  15. package/lib/exercises/math/calcul/ordering/compareFracABWithFracAPlusCBPlusC.d.ts +9 -0
  16. package/lib/exercises/math/calcul/ordering/compareFracABWithFracAPlusCBPlusC.d.ts.map +1 -0
  17. package/lib/exercises/math/calcul/ordering/compareFracABWithFracAPlusCBPlusC.js +135 -0
  18. package/lib/exercises/math/calcul/ordering/compareFracAndDec.d.ts +29 -0
  19. package/lib/exercises/math/calcul/ordering/compareFracAndDec.d.ts.map +1 -0
  20. package/lib/exercises/math/calcul/ordering/compareFracAndDec.js +367 -0
  21. package/lib/exercises/math/calcul/ordering/comparePowersOfFracs.d.ts +12 -0
  22. package/lib/exercises/math/calcul/ordering/comparePowersOfFracs.d.ts.map +1 -0
  23. package/lib/exercises/math/calcul/ordering/comparePowersOfFracs.js +164 -0
  24. package/lib/exercises/math/calcul/ordering/compareWithSquareRoots.d.ts +9 -0
  25. package/lib/exercises/math/calcul/ordering/compareWithSquareRoots.d.ts.map +1 -0
  26. package/lib/exercises/math/calcul/ordering/compareWithSquareRoots.js +140 -0
  27. package/lib/exercises/math/calcul/ordering/index.d.ts +6 -0
  28. package/lib/exercises/math/calcul/ordering/index.d.ts.map +1 -1
  29. package/lib/exercises/math/calcul/ordering/index.js +6 -0
  30. package/lib/exercises/math/calcul/rounding/estimateAroundPow10NTimesAroundPow10N.d.ts +9 -0
  31. package/lib/exercises/math/calcul/rounding/estimateAroundPow10NTimesAroundPow10N.d.ts.map +1 -0
  32. package/lib/exercises/math/calcul/rounding/estimateAroundPow10NTimesAroundPow10N.js +84 -0
  33. package/lib/exercises/math/calcul/rounding/estimatePow10NPlusPow10MinusN.d.ts +8 -0
  34. package/lib/exercises/math/calcul/rounding/estimatePow10NPlusPow10MinusN.d.ts.map +1 -0
  35. package/lib/exercises/math/calcul/rounding/estimatePow10NPlusPow10MinusN.js +90 -0
  36. package/lib/exercises/math/calcul/rounding/index.d.ts +2 -0
  37. package/lib/exercises/math/calcul/rounding/index.d.ts.map +1 -1
  38. package/lib/exercises/math/calcul/rounding/index.js +2 -0
  39. package/lib/exercises/math/calculLitteral/equation/equationFromProblem.d.ts +13 -0
  40. package/lib/exercises/math/calculLitteral/equation/equationFromProblem.d.ts.map +1 -0
  41. package/lib/exercises/math/calculLitteral/equation/equationFromProblem.js +414 -0
  42. package/lib/exercises/math/calculLitteral/equation/index.d.ts +1 -0
  43. package/lib/exercises/math/calculLitteral/equation/index.d.ts.map +1 -1
  44. package/lib/exercises/math/calculLitteral/equation/index.js +1 -0
  45. package/lib/exercises/math/calculLitteral/factorisation/factorizeAX2PlusBX.d.ts +10 -0
  46. package/lib/exercises/math/calculLitteral/factorisation/factorizeAX2PlusBX.d.ts.map +1 -0
  47. package/lib/exercises/math/calculLitteral/factorisation/factorizeAX2PlusBX.js +70 -0
  48. package/lib/exercises/math/calculLitteral/factorisation/index.d.ts +1 -0
  49. package/lib/exercises/math/calculLitteral/factorisation/index.d.ts.map +1 -1
  50. package/lib/exercises/math/calculLitteral/factorisation/index.js +1 -0
  51. package/lib/exercises/math/calculLitteral/index.d.ts +2 -0
  52. package/lib/exercises/math/calculLitteral/index.d.ts.map +1 -1
  53. package/lib/exercises/math/calculLitteral/index.js +2 -0
  54. package/lib/exercises/math/calculLitteral/isolate/index.d.ts +2 -1
  55. package/lib/exercises/math/calculLitteral/isolate/index.d.ts.map +1 -1
  56. package/lib/exercises/math/calculLitteral/isolate/index.js +2 -1
  57. package/lib/exercises/math/calculLitteral/isolate/isolateUInInvXPlusInvYEqualsInvU.d.ts +8 -0
  58. package/lib/exercises/math/calculLitteral/isolate/isolateUInInvXPlusInvYEqualsInvU.d.ts.map +1 -0
  59. package/lib/exercises/math/calculLitteral/isolate/isolateUInInvXPlusInvYEqualsInvU.js +107 -0
  60. package/lib/exercises/math/calculLitteral/isolate/isolateXInInvXPlusInvYEqualsInvU.d.ts +7 -0
  61. package/lib/exercises/math/calculLitteral/isolate/isolateXInInvXPlusInvYEqualsInvU.d.ts.map +1 -0
  62. package/lib/exercises/math/calculLitteral/isolate/isolateXInInvXPlusInvYEqualsInvU.js +80 -0
  63. package/lib/exercises/math/calculLitteral/ordering/compareAMinusB.d.ts +10 -0
  64. package/lib/exercises/math/calculLitteral/ordering/compareAMinusB.d.ts.map +1 -0
  65. package/lib/exercises/math/calculLitteral/ordering/compareAMinusB.js +182 -0
  66. package/lib/exercises/math/calculLitteral/ordering/compareFromPiMinusFrac.d.ts +9 -0
  67. package/lib/exercises/math/calculLitteral/ordering/compareFromPiMinusFrac.d.ts.map +1 -0
  68. package/lib/exercises/math/calculLitteral/ordering/compareFromPiMinusFrac.js +144 -0
  69. package/lib/exercises/math/calculLitteral/ordering/index.d.ts +3 -0
  70. package/lib/exercises/math/calculLitteral/ordering/index.d.ts.map +1 -0
  71. package/lib/exercises/math/calculLitteral/ordering/index.js +2 -0
  72. package/lib/exercises/math/calculLitteral/simplifying/compareATimes0.d.ts +11 -0
  73. package/lib/exercises/math/calculLitteral/simplifying/compareATimes0.d.ts.map +1 -0
  74. package/lib/exercises/math/calculLitteral/simplifying/compareATimes0.js +120 -0
  75. package/lib/exercises/math/calculLitteral/simplifying/compareFracXA.d.ts +8 -0
  76. package/lib/exercises/math/calculLitteral/simplifying/compareFracXA.d.ts.map +1 -0
  77. package/lib/exercises/math/calculLitteral/simplifying/compareFracXA.js +67 -0
  78. package/lib/exercises/math/calculLitteral/simplifying/compareMinusA.d.ts +11 -0
  79. package/lib/exercises/math/calculLitteral/simplifying/compareMinusA.d.ts.map +1 -0
  80. package/lib/exercises/math/calculLitteral/simplifying/compareMinusA.js +114 -0
  81. package/lib/exercises/math/calculLitteral/simplifying/index.d.ts +5 -0
  82. package/lib/exercises/math/calculLitteral/simplifying/index.d.ts.map +1 -1
  83. package/lib/exercises/math/calculLitteral/simplifying/index.js +5 -0
  84. package/lib/exercises/math/calculLitteral/simplifying/pickSameAsAPercentOfB.d.ts +13 -0
  85. package/lib/exercises/math/calculLitteral/simplifying/pickSameAsAPercentOfB.d.ts.map +1 -0
  86. package/lib/exercises/math/calculLitteral/simplifying/pickSameAsAPercentOfB.js +125 -0
  87. package/lib/exercises/math/calculLitteral/simplifying/pickSameAsInverseOfFracAB.d.ts +14 -0
  88. package/lib/exercises/math/calculLitteral/simplifying/pickSameAsInverseOfFracAB.d.ts.map +1 -0
  89. package/lib/exercises/math/calculLitteral/simplifying/pickSameAsInverseOfFracAB.js +148 -0
  90. package/lib/exercises/math/calculLitteral/writing/writeLitExpFromFrenchExp.d.ts +5 -27
  91. package/lib/exercises/math/calculLitteral/writing/writeLitExpFromFrenchExp.d.ts.map +1 -1
  92. package/lib/exercises/math/calculLitteral/writing/writeLitExpFromFrenchExp.js +178 -241
  93. package/lib/exercises/math/conversion/index.d.ts +4 -0
  94. package/lib/exercises/math/conversion/index.d.ts.map +1 -1
  95. package/lib/exercises/math/conversion/index.js +4 -0
  96. package/lib/exercises/math/conversion/kmPerMinToKmPerHourConversion.d.ts +8 -0
  97. package/lib/exercises/math/conversion/kmPerMinToKmPerHourConversion.d.ts.map +1 -0
  98. package/lib/exercises/math/conversion/kmPerMinToKmPerHourConversion.js +98 -0
  99. package/lib/exercises/math/conversion/minutesToHours.d.ts +10 -0
  100. package/lib/exercises/math/conversion/minutesToHours.d.ts.map +1 -0
  101. package/lib/exercises/math/conversion/minutesToHours.js +150 -0
  102. package/lib/exercises/math/conversion/prefixToNumber.d.ts +15 -0
  103. package/lib/exercises/math/conversion/prefixToNumber.d.ts.map +1 -0
  104. package/lib/exercises/math/conversion/prefixToNumber.js +233 -0
  105. package/lib/exercises/math/conversion/secondsToHours.d.ts +10 -0
  106. package/lib/exercises/math/conversion/secondsToHours.d.ts.map +1 -0
  107. package/lib/exercises/math/conversion/secondsToHours.js +150 -0
  108. package/lib/exercises/math/dataRepresentations/barChartInterpreting.d.ts +50 -0
  109. package/lib/exercises/math/dataRepresentations/barChartInterpreting.d.ts.map +1 -0
  110. package/lib/exercises/math/dataRepresentations/barChartInterpreting.js +517 -0
  111. package/lib/exercises/math/dataRepresentations/boxPlotInterpreting.d.ts +7 -0
  112. package/lib/exercises/math/dataRepresentations/boxPlotInterpreting.d.ts.map +1 -0
  113. package/lib/exercises/math/dataRepresentations/boxPlotInterpreting.js +223 -0
  114. package/lib/exercises/math/dataRepresentations/cartesianGraphExtremaReading.d.ts +10 -0
  115. package/lib/exercises/math/dataRepresentations/cartesianGraphExtremaReading.d.ts.map +1 -0
  116. package/lib/exercises/math/dataRepresentations/cartesianGraphExtremaReading.js +139 -0
  117. package/lib/exercises/math/dataRepresentations/dataToGraphGraphToData.d.ts +8 -0
  118. package/lib/exercises/math/dataRepresentations/dataToGraphGraphToData.d.ts.map +1 -0
  119. package/lib/exercises/math/dataRepresentations/dataToGraphGraphToData.js +133 -0
  120. package/lib/exercises/math/dataRepresentations/graphReading.d.ts +8 -0
  121. package/lib/exercises/math/dataRepresentations/graphReading.d.ts.map +1 -0
  122. package/lib/exercises/math/dataRepresentations/graphReading.js +136 -0
  123. package/lib/exercises/math/dataRepresentations/halfPieChartCommenting.d.ts +18 -0
  124. package/lib/exercises/math/dataRepresentations/halfPieChartCommenting.d.ts.map +1 -0
  125. package/lib/exercises/math/dataRepresentations/halfPieChartCommenting.js +228 -0
  126. package/lib/exercises/math/dataRepresentations/halfPieChartReading.d.ts +8 -0
  127. package/lib/exercises/math/dataRepresentations/halfPieChartReading.d.ts.map +1 -0
  128. package/lib/exercises/math/dataRepresentations/halfPieChartReading.js +213 -0
  129. package/lib/exercises/math/dataRepresentations/histogramReading.d.ts +9 -0
  130. package/lib/exercises/math/dataRepresentations/histogramReading.d.ts.map +1 -0
  131. package/lib/exercises/math/dataRepresentations/histogramReading.js +163 -0
  132. package/lib/exercises/math/dataRepresentations/index.d.ts +10 -0
  133. package/lib/exercises/math/dataRepresentations/index.d.ts.map +1 -1
  134. package/lib/exercises/math/dataRepresentations/index.js +10 -0
  135. package/lib/exercises/math/dataRepresentations/plausibleGraph.d.ts +9 -0
  136. package/lib/exercises/math/dataRepresentations/plausibleGraph.d.ts.map +1 -0
  137. package/lib/exercises/math/dataRepresentations/plausibleGraph.js +145 -0
  138. package/lib/exercises/math/dataRepresentations/scatterPlotCommenting.d.ts +9 -0
  139. package/lib/exercises/math/dataRepresentations/scatterPlotCommenting.d.ts.map +1 -0
  140. package/lib/exercises/math/dataRepresentations/scatterPlotCommenting.js +308 -0
  141. package/lib/exercises/math/derivation/derivative/exp/expDerivativeFour.d.ts.map +1 -1
  142. package/lib/exercises/math/derivation/derivative/exp/expDerivativeFour.js +5 -6
  143. package/lib/exercises/math/functions/affines/coordsOfPointOnAffineFindX.d.ts +8 -0
  144. package/lib/exercises/math/functions/affines/coordsOfPointOnAffineFindX.d.ts.map +1 -0
  145. package/lib/exercises/math/functions/affines/coordsOfPointOnAffineFindX.js +103 -0
  146. package/lib/exercises/math/functions/affines/coordsOfPointOnAffineFindY.d.ts +8 -0
  147. package/lib/exercises/math/functions/affines/coordsOfPointOnAffineFindY.d.ts.map +1 -0
  148. package/lib/exercises/math/functions/affines/coordsOfPointOnAffineFindY.js +100 -0
  149. package/lib/exercises/math/functions/affines/drawAffineFromPointAndLeadingCoeff.d.ts +16 -0
  150. package/lib/exercises/math/functions/affines/drawAffineFromPointAndLeadingCoeff.d.ts.map +1 -0
  151. package/lib/exercises/math/functions/affines/drawAffineFromPointAndLeadingCoeff.js +215 -0
  152. package/lib/exercises/math/functions/affines/drawAffineFromProgCalc.d.ts +13 -0
  153. package/lib/exercises/math/functions/affines/drawAffineFromProgCalc.d.ts.map +1 -0
  154. package/lib/exercises/math/functions/affines/drawAffineFromProgCalc.js +206 -0
  155. package/lib/exercises/math/functions/affines/index.d.ts +7 -0
  156. package/lib/exercises/math/functions/affines/index.d.ts.map +1 -1
  157. package/lib/exercises/math/functions/affines/index.js +7 -0
  158. package/lib/exercises/math/functions/affines/recognizeExprAffine.d.ts +20 -0
  159. package/lib/exercises/math/functions/affines/recognizeExprAffine.d.ts.map +1 -0
  160. package/lib/exercises/math/functions/affines/recognizeExprAffine.js +284 -0
  161. package/lib/exercises/math/functions/affines/representationOfAffine.d.ts +13 -0
  162. package/lib/exercises/math/functions/affines/representationOfAffine.d.ts.map +1 -0
  163. package/lib/exercises/math/functions/affines/representationOfAffine.js +184 -0
  164. package/lib/exercises/math/functions/basics/coordsOfPointOnCurveFindY.d.ts +14 -0
  165. package/lib/exercises/math/functions/basics/coordsOfPointOnCurveFindY.d.ts.map +1 -0
  166. package/lib/exercises/math/functions/basics/coordsOfPointOnCurveFindY.js +216 -0
  167. package/lib/exercises/math/functions/basics/index.d.ts +1 -0
  168. package/lib/exercises/math/functions/basics/index.d.ts.map +1 -1
  169. package/lib/exercises/math/functions/basics/index.js +1 -0
  170. package/lib/exercises/math/functions/composition/functionComposition.d.ts +8 -0
  171. package/lib/exercises/math/functions/composition/functionComposition.d.ts.map +1 -0
  172. package/lib/exercises/math/functions/composition/functionComposition.js +238 -0
  173. package/lib/exercises/math/functions/composition/index.d.ts +2 -0
  174. package/lib/exercises/math/functions/composition/index.d.ts.map +1 -0
  175. package/lib/exercises/math/functions/composition/index.js +1 -0
  176. package/lib/exercises/math/functions/index.d.ts +1 -0
  177. package/lib/exercises/math/functions/index.d.ts.map +1 -1
  178. package/lib/exercises/math/functions/index.js +1 -0
  179. package/lib/exercises/math/geometry/angles/anglesUsingIsParallel.d.ts +23 -0
  180. package/lib/exercises/math/geometry/angles/anglesUsingIsParallel.d.ts.map +1 -0
  181. package/lib/exercises/math/geometry/angles/anglesUsingIsParallel.js +448 -0
  182. package/lib/exercises/math/geometry/angles/index.js +2 -0
  183. package/lib/exercises/math/geometry/angles/isParallelUsingAngles.d.ts +23 -0
  184. package/lib/exercises/math/geometry/angles/isParallelUsingAngles.d.ts.map +1 -0
  185. package/lib/exercises/math/geometry/angles/isParallelUsingAngles.js +402 -0
  186. package/lib/exercises/math/geometry/cartesian/placeAbscissOnSemiLine.d.ts +9 -6
  187. package/lib/exercises/math/geometry/cartesian/placeAbscissOnSemiLine.d.ts.map +1 -1
  188. package/lib/exercises/math/geometry/cartesian/placeAbscissOnSemiLine.js +140 -60
  189. package/lib/exercises/math/geometry/convexity/convexityQuadrinomialsGeo.js +1 -1
  190. package/lib/exercises/math/geometry/vectors/colinearity/colinearityFromPicture.d.ts.map +1 -1
  191. package/lib/exercises/math/geometry/vectors/colinearity/colinearityFromPicture.js +121 -104
  192. package/lib/exercises/math/geometry/vectors/vectorRepresentative.d.ts.map +1 -1
  193. package/lib/exercises/math/geometry/vectors/vectorRepresentative.js +3 -2
  194. package/lib/exercises/math/probaStat/basicProbas/index.d.ts +1 -0
  195. package/lib/exercises/math/probaStat/basicProbas/index.d.ts.map +1 -1
  196. package/lib/exercises/math/probaStat/basicProbas/index.js +1 -0
  197. package/lib/exercises/math/probaStat/basicProbas/possibleValuesForProba.d.ts +0 -1
  198. package/lib/exercises/math/probaStat/basicProbas/possibleValuesForProba.d.ts.map +1 -1
  199. package/lib/exercises/math/probaStat/basicProbas/possibleValuesForProba.js +42 -80
  200. package/lib/exercises/math/probaStat/conditionalProbaWriteFromFrench.d.ts +9 -0
  201. package/lib/exercises/math/probaStat/conditionalProbaWriteFromFrench.d.ts.map +1 -0
  202. package/lib/exercises/math/probaStat/conditionalProbaWriteFromFrench.js +217 -0
  203. package/lib/exercises/math/probaStat/index.d.ts +2 -0
  204. package/lib/exercises/math/probaStat/index.d.ts.map +1 -1
  205. package/lib/exercises/math/probaStat/index.js +2 -0
  206. package/lib/exercises/math/probaStat/probaAsSumOfProbas.d.ts +30 -0
  207. package/lib/exercises/math/probaStat/probaAsSumOfProbas.d.ts.map +1 -0
  208. package/lib/exercises/math/probaStat/probaAsSumOfProbas.js +548 -0
  209. package/lib/exercises/math/probaStat/stats1var/index.d.ts +2 -0
  210. package/lib/exercises/math/probaStat/stats1var/index.d.ts.map +1 -1
  211. package/lib/exercises/math/probaStat/stats1var/index.js +2 -0
  212. package/lib/exercises/math/probaStat/stats1var/interpretIndicatorsForLists.d.ts +9 -0
  213. package/lib/exercises/math/probaStat/stats1var/interpretIndicatorsForLists.d.ts.map +1 -0
  214. package/lib/exercises/math/probaStat/stats1var/interpretIndicatorsForLists.js +90 -0
  215. package/lib/exercises/math/probaStat/stats1var/plausibilityOfAverage.d.ts +10 -0
  216. package/lib/exercises/math/probaStat/stats1var/plausibilityOfAverage.d.ts.map +1 -0
  217. package/lib/exercises/math/probaStat/stats1var/plausibilityOfAverage.js +151 -0
  218. package/lib/exercises/pc/electricity/calculateUEqualsRI.d.ts +7 -0
  219. package/lib/exercises/pc/electricity/calculateUEqualsRI.d.ts.map +1 -0
  220. package/lib/exercises/pc/electricity/calculateUEqualsRI.js +73 -0
  221. package/lib/exercises/pc/electricity/index.d.ts +1 -0
  222. package/lib/exercises/pc/electricity/index.d.ts.map +1 -1
  223. package/lib/exercises/pc/electricity/index.js +1 -0
  224. package/lib/exercises/pc/index.d.ts +1 -0
  225. package/lib/exercises/pc/index.d.ts.map +1 -1
  226. package/lib/exercises/pc/index.js +1 -0
  227. package/lib/exercises/pc/moleculeFormula.d.ts.map +1 -1
  228. package/lib/exercises/pc/moleculeFormula.js +4 -3
  229. package/lib/exercises/pc/optics/index.d.ts +2 -0
  230. package/lib/exercises/pc/optics/index.d.ts.map +1 -0
  231. package/lib/exercises/pc/optics/index.js +1 -0
  232. package/lib/exercises/pc/optics/lensFormula.d.ts +21 -0
  233. package/lib/exercises/pc/optics/lensFormula.d.ts.map +1 -0
  234. package/lib/exercises/pc/optics/lensFormula.js +415 -0
  235. package/lib/exercises/pc/weight/calculateWeight.d.ts +8 -1
  236. package/lib/exercises/pc/weight/calculateWeight.d.ts.map +1 -1
  237. package/lib/exercises/pc/weight/calculateWeight.js +113 -38
  238. package/lib/geogebra/parsers/geogebraParser.d.ts +4 -0
  239. package/lib/geogebra/parsers/geogebraParser.d.ts.map +1 -1
  240. package/lib/geogebra/parsers/geogebraParser.js +17 -0
  241. package/lib/index.d.ts +346 -12
  242. package/lib/index.d.ts.map +1 -1
  243. package/lib/latexTester.d.ts.map +1 -1
  244. package/lib/latexTester.js +1 -0
  245. package/lib/math/geometry/CloudPoints.d.ts +10 -0
  246. package/lib/math/geometry/CloudPoints.d.ts.map +1 -1
  247. package/lib/math/geometry/CloudPoints.js +119 -0
  248. package/lib/math/geometry/line.d.ts +1 -0
  249. package/lib/math/geometry/line.d.ts.map +1 -1
  250. package/lib/math/geometry/line.js +10 -2
  251. package/lib/math/geometry/vector.d.ts +1 -0
  252. package/lib/math/geometry/vector.d.ts.map +1 -1
  253. package/lib/math/geometry/vector.js +12 -0
  254. package/lib/math/progCalc/progCalc.d.ts +46 -0
  255. package/lib/math/progCalc/progCalc.d.ts.map +1 -0
  256. package/lib/math/progCalc/progCalc.js +239 -0
  257. package/lib/math/utils/latex/realize.d.ts +12 -0
  258. package/lib/math/utils/latex/realize.d.ts.map +1 -0
  259. package/lib/math/utils/latex/realize.js +43 -0
  260. package/lib/pc/constants/molecularChemistry/molecule.d.ts +2 -0
  261. package/lib/pc/constants/molecularChemistry/molecule.d.ts.map +1 -1
  262. package/lib/pc/constants/molecularChemistry/molecule.js +52 -0
  263. package/lib/tests/questionTest.d.ts.map +1 -1
  264. package/lib/tests/questionTest.js +1 -1
  265. package/lib/tests/singleExo.test.js +3 -3
  266. package/lib/tree/nodes/algebraicNode.d.ts.map +1 -1
  267. package/lib/tree/nodes/operators/addNode.d.ts +4 -2
  268. package/lib/tree/nodes/operators/addNode.d.ts.map +1 -1
  269. package/lib/tree/nodes/operators/addNode.js +8 -17
  270. package/lib/tree/nodes/operators/fractionNode.d.ts +1 -1
  271. package/lib/tree/nodes/operators/fractionNode.d.ts.map +1 -1
  272. package/lib/tree/nodes/operators/fractionNode.js +5 -1
  273. package/lib/tree/nodes/operators/multiplyNode.d.ts +4 -2
  274. package/lib/tree/nodes/operators/multiplyNode.d.ts.map +1 -1
  275. package/lib/tree/nodes/operators/multiplyNode.js +8 -17
  276. package/lib/tree/nodes/operators/operatorNode.d.ts +3 -3
  277. package/lib/tree/nodes/operators/operatorNode.d.ts.map +1 -1
  278. package/lib/tree/nodes/variables/variableNode.d.ts +1 -1
  279. package/lib/tree/nodes/variables/variableNode.d.ts.map +1 -1
  280. package/lib/tree/utilities/nodeShuffler.d.ts +12 -0
  281. package/lib/tree/utilities/nodeShuffler.d.ts.map +1 -0
  282. package/lib/tree/utilities/nodeShuffler.js +123 -0
  283. package/lib/utils/arrays/getAllPicks.d.ts +2 -0
  284. package/lib/utils/arrays/getAllPicks.d.ts.map +1 -0
  285. package/lib/utils/arrays/getAllPicks.js +17 -0
  286. package/lib/utils/errors/handleVEAError.d.ts +1 -1
  287. package/lib/utils/errors/handleVEAError.d.ts.map +1 -1
  288. package/lib/utils/strings/decapitalize.d.ts +2 -0
  289. package/lib/utils/strings/decapitalize.d.ts.map +1 -0
  290. package/lib/utils/strings/decapitalize.js +3 -0
  291. package/package.json +1 -1
@@ -0,0 +1,18 @@
1
+ import { Exercise } from "../../../exercises/exercise.js";
2
+ type Identifiers = {
3
+ points: number[][];
4
+ parties: Party[];
5
+ alliances: Alliance[];
6
+ };
7
+ type Party = {
8
+ name: string;
9
+ color: string;
10
+ p: number;
11
+ };
12
+ type Alliance = {
13
+ parties: Party[];
14
+ p: number;
15
+ };
16
+ export declare const halfPieChartCommenting: Exercise<Identifiers>;
17
+ export {};
18
+ //# sourceMappingURL=halfPieChartCommenting.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"halfPieChartCommenting.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/dataRepresentations/halfPieChartCommenting.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAmBrC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC;IACnB,OAAO,EAAE,KAAK,EAAE,CAAC;IACjB,SAAS,EAAE,QAAQ,EAAE,CAAC;CACvB,CAAC;AAEF,KAAK,KAAK,GAAG;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAEF,KAAK,QAAQ,GAAG;IACd,OAAO,EAAE,KAAK,EAAE,CAAC;IACjB,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AA6PF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,CAmBxD,CAAC"}
@@ -0,0 +1,228 @@
1
+ import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../exercises/utils/getDistinctQuestions.js";
3
+ import { blueDark, blueExtraDark, colorWithOpacity, greenMain, orange, pinkLight, red, } from "../../../geogebra/colors.js";
4
+ import { GeogebraConstructor } from "../../../geogebra/geogebraConstructor.js";
5
+ import { Point } from "../../../math/geometry/point.js";
6
+ import { randint } from "../../../math/utils/random/randint.js";
7
+ import { round } from "../../../math/utils/round.js";
8
+ import { randomMany } from "../../../utils/alea/random.js";
9
+ import { decapitalize } from "../../../utils/strings/decapitalize.js";
10
+ import { getLetter } from "../../../utils/strings/getLetter.js";
11
+ const allParties = [
12
+ ["Parti rouge", red],
13
+ ["Parti vert", greenMain],
14
+ ["Parti rose", pinkLight],
15
+ ["Parti orange", orange],
16
+ ["Parti gris", "#C0C0C0"],
17
+ ["Parti bleu", blueDark],
18
+ ["Parti bleu foncé", blueExtraDark],
19
+ ["Parti brun", "#8B4513"],
20
+ ];
21
+ const getNameForAlliance = (alliance) => {
22
+ if (alliance.parties.length > 1) {
23
+ const frColors = alliance.parties.map((party) => party.name.slice(6));
24
+ return `Coalition ${frColors.join("-")}`;
25
+ }
26
+ else {
27
+ return alliance.parties[0].name;
28
+ }
29
+ };
30
+ const getPropositions = (n, { alliances }) => {
31
+ const propositions = [];
32
+ alliances.forEach((alliance) => {
33
+ const name = getNameForAlliance(alliance);
34
+ if (alliance.p > 0.5) {
35
+ addValidProp(propositions, name, "raw");
36
+ }
37
+ else {
38
+ tryToAddWrongProp(propositions, name, "raw");
39
+ }
40
+ });
41
+ return shuffleProps(propositions, n);
42
+ };
43
+ const getInstruction = () => {
44
+ return `Voici le diagramme semi-circulaire indiquant la composition d'un parlement.
45
+
46
+ Parmi les partis et coalitions proposés, lesquels détiennent la majorité absolue ?`;
47
+ };
48
+ const getHint = () => {
49
+ return `Pour avoir une majorité absolue, un parti ou une coalition doit détenir plus de $50\\%$ des sièges.
50
+
51
+ On voit que les coalitions se font entre partis adjacents sur l'hémicycle.`;
52
+ };
53
+ const getCorrection = (identifiers) => {
54
+ const { alliances } = identifiers;
55
+ return `Pour avoir une majorité absolue, un parti ou une coalition doit détenir plus de $50\\%$ des sièges.
56
+
57
+ C'est-à-dire que le parti ou la coalition doit être représenté(e) par plus d'un quart de disque.
58
+
59
+ C'est le cas pour ${(() => {
60
+ const alliancesWithMajority = alliances.filter((alliance) => alliance.p > 0.5);
61
+ const names = alliancesWithMajority.map((alliance) => {
62
+ const laLe = alliance.parties.length > 1 ? "la" : "le";
63
+ return `${laLe} ${decapitalize(getNameForAlliance(alliance))}`;
64
+ });
65
+ return `${names.length > 1 ? `${names.slice(0, -1).join(", ")} et` : ``} ${names.slice(-1)}`;
66
+ })()}
67
+ .`;
68
+ };
69
+ const getGGBOptions = (identifiers) => {
70
+ const { points, parties } = identifiers;
71
+ const labels = parties.map((party) => party.name);
72
+ const colors = parties.map((party) => party.color);
73
+ const pointsObj = points.map((p, i) => new Point(getLetter(i, true), p[0], p[1]));
74
+ const getMidPoint = (nextPoint, prevPoint) => {
75
+ const [xA, yA] = prevPoint;
76
+ const angleA = Math.atan2(yA, xA);
77
+ const [xB, yB] = nextPoint;
78
+ const angleB = Math.atan2(yB, xB);
79
+ // const angleM = (angleA + angleB) / 2;
80
+ const angleM = angleA +
81
+ Math.atan2(Math.sin(angleB - angleA), Math.cos(angleB - angleA)) / 2;
82
+ return [0.8 * Math.cos(angleM), 1.2 * Math.sin(angleM)];
83
+ };
84
+ const ggb = new GeogebraConstructor({
85
+ commands: [
86
+ `C = CircularSector((0,0), (1,0), (-1,0))`,
87
+ `SetFixed(C, true)`,
88
+ `SetLineThickness(C, 1)`,
89
+ // `SetVisibleInView(C, 1, false)`,
90
+ // ...pointsObj.flatMap((p) => p.toGGBCommand()),
91
+ ...pointsObj.slice(0, -1).flatMap((p, i) => {
92
+ const midPoint = getMidPoint(points[(i + 1 + points.length) % points.length], points[i]);
93
+ return [
94
+ `C_${i} = CircularSector((0,0), ${pointsObj[(i + 1 + pointsObj.length) % pointsObj.length].toMathString()}, ${p.toMathString()})`,
95
+ `SetFixed(C_${i}, true)`,
96
+ `SetColor(C_${i}, "${colorWithOpacity(colors[i], 80)}")`,
97
+ `SetLineThickness(C_${i}, 0)`,
98
+ // `SetCaption(C_${i}, "$\\tiny \\text{${labels[i]}}$")`,
99
+ // `ShowLabel(C_${i}, true)`,
100
+ // `Text("$\\tiny \\text{${labels[i]
101
+ // .split(" ")
102
+ // .join("\\\\")}}$", (${getMidPoint(
103
+ // points[(i + 1 + points.length) % points.length],
104
+ // points[i],
105
+ // ).join(",")}), true, true, 1, 0)`,
106
+ `Text("$\\tiny \\text{${labels[i]}}$", (${[
107
+ midPoint[0],
108
+ midPoint[1],
109
+ ].join(",")}), true, true, 0, 0)`,
110
+ ];
111
+ }),
112
+ ],
113
+ hideAxes: true,
114
+ hideGrid: true,
115
+ forbidShiftDragZoom: true,
116
+ });
117
+ return ggb.getOptions({
118
+ coords: [-1.0, 1.0, -0.2, 1.4],
119
+ });
120
+ };
121
+ const getHalfPieChartReadingQuestion = () => {
122
+ let question;
123
+ let counter = 0;
124
+ const counterMax = 100;
125
+ while (counter < counterMax && !question) {
126
+ try {
127
+ question = getHalfPieChartReadingQuestionCandidate();
128
+ }
129
+ catch (_) {
130
+ continue;
131
+ }
132
+ counter++;
133
+ }
134
+ if (counter === counterMax) {
135
+ throw new Error("should-throw whileLoop: counter === counterMax");
136
+ }
137
+ return question;
138
+ };
139
+ const getHalfPieChartReadingQuestionCandidate = () => {
140
+ const nbPartiesPicked = randint(4, 7);
141
+ const getPointFromPrev = (prevPoint, degAngle) => {
142
+ const radAngle = -(degAngle * Math.PI) / 180;
143
+ return [
144
+ round(prevPoint[0] * Math.cos(radAngle) - prevPoint[1] * Math.sin(radAngle), 6),
145
+ round(prevPoint[0] * Math.sin(radAngle) + prevPoint[1] * Math.cos(radAngle), 6),
146
+ ];
147
+ };
148
+ const angles = [randint(9, 100)];
149
+ for (let i = 0; i < nbPartiesPicked - 1; i++) {
150
+ const remaining = 180 - angles.reduce((acc, curr) => acc + curr);
151
+ if (i === nbPartiesPicked - 2)
152
+ angles.push(remaining);
153
+ else
154
+ angles.push(randint(15, Math.min(50, remaining - 15)));
155
+ }
156
+ const points = [[-1, 0]];
157
+ for (let i = 0; i < angles.length; i++) {
158
+ points.push(getPointFromPrev(points[i], angles[i]));
159
+ }
160
+ const parties = randomMany(allParties.map(([label, color], i) => [i, label, color]), nbPartiesPicked)
161
+ .toSorted(([i1], [i2]) => i1 - i2)
162
+ .map(([_, label, color], i) => {
163
+ return { name: label, color, p: angles[i] / 180 };
164
+ });
165
+ const nbPartiesInAllianceMin = 1;
166
+ const nbPartiesInAllianceMax = nbPartiesPicked - 1;
167
+ const alliancePool = [];
168
+ for (let i = 0; i < nbPartiesPicked; i++) {
169
+ for (let j = nbPartiesInAllianceMin; j < nbPartiesInAllianceMax && i + j <= nbPartiesPicked; j++) {
170
+ const allianceParties = parties.slice(i, i + j);
171
+ const alliance = {
172
+ parties: allianceParties,
173
+ p: allianceParties.reduce((acc, party) => acc + party.p, 0),
174
+ };
175
+ alliancePool.push(alliance);
176
+ }
177
+ }
178
+ const nbAlliances = 4;
179
+ let alliances = [];
180
+ let isAtLeastOneMajority = false;
181
+ let counter = 0;
182
+ const counterMax = 100;
183
+ while (counter < counterMax && !isAtLeastOneMajority) {
184
+ alliances = randomMany(alliancePool, nbAlliances);
185
+ isAtLeastOneMajority = alliances.some((alliance) => alliance.p > 0.5);
186
+ counter++;
187
+ }
188
+ if (counter === counterMax) {
189
+ throw new Error("should-throw whileLoop: counter === counterMax");
190
+ }
191
+ const identifiers = {
192
+ points,
193
+ parties,
194
+ alliances,
195
+ };
196
+ return getQuestionFromIdentifiers(identifiers);
197
+ };
198
+ const getQuestionFromIdentifiers = (identifiers) => {
199
+ const question = {
200
+ instruction: getInstruction(identifiers),
201
+ keys: [],
202
+ answerFormat: "tex",
203
+ identifiers,
204
+ hint: getHint(identifiers),
205
+ correction: getCorrection(identifiers),
206
+ ggbOptions: getGGBOptions(identifiers),
207
+ };
208
+ return question;
209
+ };
210
+ export const halfPieChartCommenting = {
211
+ id: "halfPieChartCommenting",
212
+ label: "Commenter un diagramme semi-circulaire",
213
+ isSingleStep: true,
214
+ generator: (nb, opts) => getDistinctQuestions(() => getHalfPieChartReadingQuestion(opts), nb),
215
+ qcmTimer: 60,
216
+ freeTimer: 60,
217
+ getPropositions,
218
+ subject: "Mathématiques",
219
+ getHint,
220
+ getCorrection,
221
+ hasHintAndCorrection: true,
222
+ getInstruction,
223
+ getGGBOptions,
224
+ hasGeogebra: true,
225
+ getQuestionFromIdentifiers,
226
+ answerType: "QCM",
227
+ isQCM: true,
228
+ };
@@ -0,0 +1,8 @@
1
+ import { Exercise } from "../../../exercises/exercise.js";
2
+ type Identifiers = {
3
+ points: number[][];
4
+ labels: string[];
5
+ };
6
+ export declare const halfPieChartReading: Exercise<Identifiers>;
7
+ export {};
8
+ //# sourceMappingURL=halfPieChartReading.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"halfPieChartReading.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/dataRepresentations/halfPieChartReading.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAiBT,MAAM,6BAA6B,CAAC;AAuBrC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC;IACnB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AAsOF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,WAAW,CAmBrD,CAAC"}
@@ -0,0 +1,213 @@
1
+ import { addValidProp, shuffleProps, tryToAddWrongProp, propWhile, } from "../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../exercises/utils/getDistinctQuestions.js";
3
+ import { blueExtraDark, colorWithOpacity, greenDark, orange, pinkDark, purpleDark, red, } from "../../../geogebra/colors.js";
4
+ import { GeogebraConstructor } from "../../../geogebra/geogebraConstructor.js";
5
+ import { Angle } from "../../../math/geometry/angle.js";
6
+ import { Point } from "../../../math/geometry/point.js";
7
+ import { randfloat } from "../../../math/utils/random/randfloat.js";
8
+ import { randint } from "../../../math/utils/random/randint.js";
9
+ import { round } from "../../../math/utils/round.js";
10
+ import { parseAlgebraic } from "../../../tree/parsers/latexParser.js";
11
+ import { percentParser } from "../../../tree/parsers/percentParser.js";
12
+ import { handleVEAError } from "../../../utils/errors/handleVEAError.js";
13
+ import { approxOrEqual } from "../../../utils/latex/approxOrEqual.js";
14
+ import { getLetter } from "../../../utils/strings/getLetter.js";
15
+ const getPropositions = (n, { answer, ...identifiers }) => {
16
+ const propositions = [];
17
+ addValidProp(propositions, answer);
18
+ const { points } = identifiers;
19
+ const pointsObj = points.map((p, i) => new Point(getLetter(i, true), p[0], p[1]));
20
+ const angle = new Angle([pointsObj[1], new Point("O", 0, 0), pointsObj[0]]);
21
+ const angleValue = angle.evaluate();
22
+ tryToAddWrongProp(propositions, angleValue.frenchify() + "\\%");
23
+ tryToAddWrongProp(propositions, `${round(100 / (points.length - 1), 1)}\\%`);
24
+ tryToAddWrongProp(propositions, round((angleValue * 100) / 180, 2).frenchify() + "\\%");
25
+ propWhile(propositions, n, () => {
26
+ tryToAddWrongProp(propositions, randfloat(8, 80, 2).frenchify() + "\\%");
27
+ });
28
+ return shuffleProps(propositions, n);
29
+ };
30
+ const getAnswer = (identifiers) => {
31
+ const { points } = identifiers;
32
+ const pointsObj = points.map((p, i) => new Point(getLetter(i, true), p[0], p[1]));
33
+ const angle = new Angle([pointsObj[1], new Point("O", 0, 0), pointsObj[0]]);
34
+ const angleValue = angle.evaluate();
35
+ return round((angleValue * 100) / 180, 2).frenchify() + "\\%";
36
+ };
37
+ const getInstruction = () => {
38
+ return `Ci-dessous est donnée la répartition des communications effectuées par des lycéens avec leur téléphone portable.
39
+
40
+ Quelle proportion des communications effectuées, les communications audio représentent-elles ?
41
+
42
+ Arrondir au centième de pourcentage.`;
43
+ };
44
+ const getHint = (identifiers) => {
45
+ const { points } = identifiers;
46
+ const pointsObj = points.map((p, i) => new Point(getLetter(i, true), p[0], p[1]));
47
+ const angle = new Angle([pointsObj[1], new Point("O", 0, 0), pointsObj[0]]);
48
+ const angleValue = angle.evaluate();
49
+ return `Dans un diagramme circulaire, une proportion de $100\\%$ représente $180^{\\circ}$.
50
+
51
+ On utilise donc un produit en croix pour déterminer la proportion représentée par $${angleValue}^{\\circ}$.`;
52
+ };
53
+ const getCorrection = (identifiers) => {
54
+ const { points } = identifiers;
55
+ const pointsObj = points.map((p, i) => new Point(getLetter(i, true), p[0], p[1]));
56
+ const angle = new Angle([pointsObj[1], new Point("O", 0, 0), pointsObj[0]]);
57
+ const angleValue = angle.evaluate();
58
+ return `Dans un diagramme circulaire, une proportion de $100\\%$ représente $180^{\\circ}$.
59
+
60
+ On utilise donc un produit en croix pour déterminer la proportion représentée par $${angleValue}^{\\circ}$ :
61
+
62
+ $$
63
+ ${angleValue} \\times \\frac{100}{180} ${approxOrEqual((angleValue * 100) / 180, 2).join("")}
64
+ $$
65
+
66
+ Les communications audio représentent donc $${getAnswer(identifiers)}$ des communications effectuées.`;
67
+ };
68
+ const getGGBOptions = (identifiers) => {
69
+ const { points, labels } = identifiers;
70
+ const pointsObj = points.map((p, i) => new Point(getLetter(i, true), p[0], p[1]));
71
+ // const reversedPoints = pointsObj.reverse();
72
+ const colors = [greenDark, orange, pinkDark, purpleDark, red];
73
+ const angle = new Angle([pointsObj[1], new Point("O", 0, 0), pointsObj[0]]);
74
+ const getMidPoint = (nextPoint, prevPoint) => {
75
+ const [xA, yA] = prevPoint;
76
+ const angleA = Math.atan2(yA, xA);
77
+ const [xB, yB] = nextPoint;
78
+ const angleB = Math.atan2(yB, xB);
79
+ // const angleM = (angleA + angleB) / 2;
80
+ const angleM = angleA +
81
+ Math.atan2(Math.sin(angleB - angleA), Math.cos(angleB - angleA)) / 2;
82
+ return [1.2 * Math.cos(angleM), 1.2 * Math.sin(angleM)];
83
+ };
84
+ const ggb = new GeogebraConstructor({
85
+ commands: [
86
+ `C = CircularSector((0,0), (1,0), (-1,0))`,
87
+ `SetFixed(C, true)`,
88
+ `SetLineThickness(C, 1)`,
89
+ // `SetVisibleInView(C, 1, false)`,
90
+ // ...pointsObj.flatMap((p) => p.toGGBCommand()),
91
+ ...pointsObj.slice(0, -1).flatMap((p, i) => {
92
+ const midPoint = getMidPoint(points[(i + 1 + points.length) % points.length], points[i]);
93
+ return [
94
+ `C_${i} = CircularSector((0,0), ${pointsObj[(i + 1 + pointsObj.length) % pointsObj.length].toMathString()}, ${p.toMathString()})`,
95
+ `SetFixed(C_${i}, true)`,
96
+ `SetColor(C_${i}, "${colorWithOpacity(colors[i], 80)}")`,
97
+ `SetLineThickness(C_${i}, 0)`,
98
+ // `SetCaption(C_${i}, "$\\tiny \\text{${labels[i]}}$")`,
99
+ // `ShowLabel(C_${i}, true)`,
100
+ // `Text("$\\tiny \\text{${labels[i]
101
+ // .split(" ")
102
+ // .join("\\\\")}}$", (${getMidPoint(
103
+ // points[(i + 1 + points.length) % points.length],
104
+ // points[i],
105
+ // ).join(",")}), true, true, 1, 0)`,
106
+ `Text("$\\tiny \\text{${labels[i].split(" ").join("\\\\")}}$", (${[
107
+ midPoint[0] + (i === 0 ? 0.3 : 0),
108
+ midPoint[1],
109
+ ].join(",")}), true, true, 0, 0)`,
110
+ ];
111
+ }),
112
+ ...angle.toCommands({
113
+ showValue: points[1][0] === 1 ? false : true,
114
+ pointsAreNotBuilt: true,
115
+ thickness: 1,
116
+ color: blueExtraDark,
117
+ }),
118
+ ],
119
+ hideAxes: true,
120
+ hideGrid: true,
121
+ forbidShiftDragZoom: true,
122
+ });
123
+ return ggb.getOptions({
124
+ coords: [-1.0, 1.0, -0.2, 1.4],
125
+ });
126
+ };
127
+ const getKeys = () => {
128
+ return ["percent"];
129
+ };
130
+ const isAnswerValid = (ans, { answer }) => {
131
+ try {
132
+ //!à factoriser
133
+ //!pb est que parseAlgebraic ne gère pas encore les %
134
+ let parsed;
135
+ if (ans.includes("%")) {
136
+ parsed = percentParser(ans);
137
+ return parsed === answer;
138
+ }
139
+ else {
140
+ parsed = parseAlgebraic(ans);
141
+ const nbAns = answer.replace("\\%", "").unfrenchify();
142
+ return Math.abs(parsed.evaluate() - nbAns / 100) < 0.0001;
143
+ }
144
+ }
145
+ catch (err) {
146
+ return handleVEAError(err);
147
+ }
148
+ };
149
+ const getHalfPieChartReadingQuestion = () => {
150
+ const labels = [
151
+ "communications audio",
152
+ "communications vidéo",
153
+ "messagerie électronique",
154
+ "autre",
155
+ "messages SMS",
156
+ ];
157
+ const getPointFromPrev = (prevPoint, degAngle) => {
158
+ const radAngle = -(degAngle * Math.PI) / 180;
159
+ return [
160
+ round(prevPoint[0] * Math.cos(radAngle) - prevPoint[1] * Math.sin(radAngle), 6),
161
+ round(prevPoint[0] * Math.sin(radAngle) + prevPoint[1] * Math.cos(radAngle), 6),
162
+ ];
163
+ };
164
+ const angles = [5 * randint(6, 15)];
165
+ for (let i = 0; i < labels.length - 1; i++) {
166
+ const remaining = 180 - angles.reduce((acc, curr) => acc + curr);
167
+ if (i === labels.length - 2)
168
+ angles.push(remaining);
169
+ else
170
+ angles.push(randint(15, Math.min(50, remaining - 15)));
171
+ }
172
+ const points = [[-1, 0]];
173
+ for (let i = 0; i < angles.length; i++) {
174
+ points.push(getPointFromPrev(points[i], angles[i]));
175
+ }
176
+ const identifiers = {
177
+ labels,
178
+ points,
179
+ };
180
+ return getQuestionFromIdentifiers(identifiers);
181
+ };
182
+ const getQuestionFromIdentifiers = (identifiers) => {
183
+ const question = {
184
+ answer: getAnswer(identifiers),
185
+ instruction: getInstruction(identifiers),
186
+ keys: getKeys(identifiers),
187
+ answerFormat: "tex",
188
+ identifiers,
189
+ hint: getHint(identifiers),
190
+ correction: getCorrection(identifiers),
191
+ ggbOptions: getGGBOptions(identifiers),
192
+ };
193
+ return question;
194
+ };
195
+ export const halfPieChartReading = {
196
+ id: "halfPieChartReading",
197
+ label: "Convertir un angle en pourcentage dans un diagramme semi-circulaire",
198
+ isSingleStep: true,
199
+ generator: (nb, opts) => getDistinctQuestions(() => getHalfPieChartReadingQuestion(opts), nb),
200
+ qcmTimer: 60,
201
+ freeTimer: 60,
202
+ getPropositions,
203
+ isAnswerValid,
204
+ subject: "Mathématiques",
205
+ getHint,
206
+ getCorrection,
207
+ hasHintAndCorrection: true,
208
+ getInstruction,
209
+ getAnswer,
210
+ getGGBOptions,
211
+ hasGeogebra: true,
212
+ getQuestionFromIdentifiers,
213
+ };
@@ -0,0 +1,9 @@
1
+ import { Exercise } from "../../../exercises/exercise.js";
2
+ type Identifiers = {
3
+ bounds: number[];
4
+ data: number[];
5
+ itemAsked: number;
6
+ };
7
+ export declare const histogramReading: Exercise<Identifiers>;
8
+ export {};
9
+ //# sourceMappingURL=histogramReading.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"histogramReading.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/dataRepresentations/histogramReading.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAWrC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAoLF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,WAAW,CAmBlD,CAAC"}
@@ -0,0 +1,163 @@
1
+ import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../exercises/utils/getDistinctQuestions.js";
3
+ import { numberVEA } from "../../../exercises/vea/numberVEA.js";
4
+ import { GeogebraConstructor } from "../../../geogebra/geogebraConstructor.js";
5
+ import { frenchify } from "../../../math/utils/latex/frenchify.js";
6
+ import { randint } from "../../../math/utils/random/randint.js";
7
+ import { frac } from "../../../tree/nodes/operators/fractionNode.js";
8
+ import { substract } from "../../../tree/nodes/operators/substractNode.js";
9
+ import { random } from "../../../utils/alea/random.js";
10
+ import { alignTex } from "../../../utils/latex/alignTex.js";
11
+ const getPropositions = (n, { answer, ...identifiers }) => {
12
+ const propositions = [];
13
+ const { data } = identifiers;
14
+ addValidProp(propositions, answer);
15
+ while (propositions.length < n) {
16
+ tryToAddWrongProp(propositions, random(data).frenchify());
17
+ }
18
+ return shuffleProps(propositions, n);
19
+ };
20
+ const getAnswer = (identifiers) => {
21
+ const { data, itemAsked } = identifiers;
22
+ return data[itemAsked].frenchify();
23
+ };
24
+ const getInstruction = (identifiers) => {
25
+ const { bounds, itemAsked } = identifiers;
26
+ const labels = bounds.map(frenchify);
27
+ return `Un producteur trie sa récolte de pommes selon leur diamètre. L'histogramme ci-dessous représente ses résultats.
28
+
29
+ Combien de pommes de diamètre entre $${labels[itemAsked]}$ et $${labels[itemAsked + 1]}\\ \\textrm{cm}$ le producteur a-t-il récoltées ?
30
+ `;
31
+ };
32
+ const getHint = () => {
33
+ return `Dans un histogramme, l'effectif d'une classe est donné par l'aire du rectangle
34
+ compris entre les deux bornes de la classe.`;
35
+ };
36
+ const getCorrection = (identifiers) => {
37
+ const { bounds, data, itemAsked } = identifiers;
38
+ const labels = bounds.map(frenchify);
39
+ const upperBound = bounds[itemAsked + 1];
40
+ const lowerBound = bounds[itemAsked];
41
+ const nodeWidth = substract(upperBound, lowerBound).simplify();
42
+ const nodeHeight = frac(data[itemAsked], nodeWidth).simplify();
43
+ const isLastClass = itemAsked == data.length;
44
+ return `Ici la classe est [$${labels[itemAsked]}$;$${labels[itemAsked + 1]}$${isLastClass ? "]" : "["}.
45
+ Pour trouver l'effectif, on calcule l'aire du rectangle pour cette classe,
46
+ autrement dit le produit largeur $\\times$ hauteur.
47
+ La largeur est l'étendue de la classe.
48
+ ${alignTex(`${upperBound} - ${lowerBound} = ${nodeWidth.toTex()}`)}
49
+ Pour la hauteur, on lit $${nodeHeight.toTex()}$.
50
+ ${alignTex(`${nodeWidth.toTex()} \\times ${nodeHeight.toTex()} = ${data[itemAsked]}`)}
51
+ Le producteur produit $${data[itemAsked]}$ pommes de diamètre entre $${lowerBound.frenchify()}$ et $${upperBound.frenchify()}\\ \\textrm{cm}$.
52
+ `;
53
+ };
54
+ const getGGBOptions = (identifiers) => {
55
+ const { bounds, data } = identifiers;
56
+ const heights = [];
57
+ for (let i = 0; i < data.length; i++) {
58
+ const width = bounds[i + 1] - bounds[i];
59
+ const height = data[i] / width;
60
+ heights.push(height);
61
+ }
62
+ const offsetX = -bounds[0] + 1;
63
+ const offsettedBounds = bounds.map((bound) => bound + offsetX);
64
+ // const xMin = offsettedBounds[0];
65
+ const xMax = offsettedBounds[offsettedBounds.length - 1];
66
+ const heightMin = 0;
67
+ const heightMax = Math.max(...heights);
68
+ const commands = [
69
+ `B = Histogram({${offsettedBounds}}, {${heights.join(",")}})`,
70
+ ...bounds.map((bound, i) => `Text("\\footnotesize ${bound.frenchify()}", (${offsettedBounds[i]}, 50), true, true, 0, -1)`),
71
+ `Text("\\footnotesize Diamètre\\ (en \\ cm)", (3, -300), true, true, 0, -1)`,
72
+ `ShowLabel(B,false)`,
73
+ `SetColor(B, "#FE0045AB")`,
74
+ ];
75
+ const ggb = new GeogebraConstructor({
76
+ commands,
77
+ gridDistance: [10000, 50],
78
+ fontSize: 16,
79
+ lockedAxesRatio: false,
80
+ xAxis: {
81
+ hideNumbers: true,
82
+ showPositive: true,
83
+ // hidden: true,
84
+ },
85
+ yAxis: {
86
+ showPositive: true,
87
+ label: "$\\footnotesize Pommes/cm$",
88
+ steps: 100,
89
+ },
90
+ });
91
+ return ggb.getOptions({
92
+ coords: ggb.getAdaptedCoords({
93
+ xMin: -1,
94
+ xMax: xMax + 1,
95
+ yMin: heightMin - 1000,
96
+ yMax: heightMax + 300,
97
+ }),
98
+ });
99
+ };
100
+ const getKeys = () => {
101
+ return [];
102
+ };
103
+ const isAnswerValid = (ans, { answer }) => {
104
+ return numberVEA(ans, answer);
105
+ };
106
+ const getHistogramReadingQuestion = () => {
107
+ const data = [];
108
+ const bounds = [11.5, 12, 13.5, 15, 15.5, 16, 16.2];
109
+ for (let i = 0; i < bounds.length - 1; i++) {
110
+ const nodeWidth = substract(bounds[i + 1], bounds[i]);
111
+ let dataI;
112
+ let isHeightAnInteger;
113
+ do {
114
+ dataI =
115
+ 50 *
116
+ randint(1, i < 3 ? 18 : 20, //pour ne pas que les 2 premieres barres touchent le label de l'axe
117
+ data.map((d) => d / 50));
118
+ isHeightAnInteger = !frac(dataI, nodeWidth)
119
+ .simplify()
120
+ .toTex()
121
+ .includes("frac");
122
+ } while (!isHeightAnInteger);
123
+ data.push(dataI);
124
+ }
125
+ const itemAsked = randint(0, bounds.length - 1);
126
+ const identifiers = {
127
+ bounds,
128
+ data,
129
+ itemAsked,
130
+ };
131
+ return getQuestionFromIdentifiers(identifiers);
132
+ };
133
+ const getQuestionFromIdentifiers = (identifiers) => {
134
+ return {
135
+ answer: getAnswer(identifiers),
136
+ instruction: getInstruction(identifiers),
137
+ keys: getKeys(identifiers),
138
+ answerFormat: "tex",
139
+ identifiers,
140
+ hint: getHint(identifiers),
141
+ correction: getCorrection(identifiers),
142
+ ggbOptions: getGGBOptions(identifiers),
143
+ };
144
+ };
145
+ export const histogramReading = {
146
+ id: "histogramReading",
147
+ label: "Lire les effectifs sur un histogramme",
148
+ isSingleStep: true,
149
+ generator: (nb, opts) => getDistinctQuestions(() => getHistogramReadingQuestion(opts), nb),
150
+ qcmTimer: 60,
151
+ freeTimer: 60,
152
+ getPropositions,
153
+ isAnswerValid,
154
+ subject: "Mathématiques",
155
+ getHint,
156
+ getCorrection,
157
+ getInstruction,
158
+ getAnswer,
159
+ getGGBOptions,
160
+ hasGeogebra: true,
161
+ getQuestionFromIdentifiers,
162
+ hasHintAndCorrection: true,
163
+ };
@@ -2,7 +2,17 @@ export * from "./tableReading.js";
2
2
  export * from "./barChartReading.js";
3
3
  export * from "./functionGraphReading.js";
4
4
  export * from "./pieChartReading.js";
5
+ export * from "./histogramReading.js";
5
6
  export * from "./boxPlotReadingPercentages.js";
6
7
  export * from "./boxPlotReading.js";
7
8
  export * from "./compareBoxPlot.js";
9
+ export * from "./barChartInterpreting.js";
10
+ export * from "./dataToGraphGraphToData.js";
11
+ export * from "./cartesianGraphExtremaReading.js";
12
+ export * from "./scatterPlotCommenting.js";
13
+ export * from "./boxPlotInterpreting.js";
14
+ export * from "./graphReading.js";
15
+ export * from "./plausibleGraph.js";
16
+ export * from "./halfPieChartReading.js";
17
+ export * from "./halfPieChartCommenting.js";
8
18
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/dataRepresentations/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,sBAAsB,CAAC;AACrC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/dataRepresentations/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,mCAAmC,CAAC;AAClD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,0BAA0B,CAAC;AACzC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC"}