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,32 +1,56 @@
1
+ import { GeneratorOptionTarget, GeneratorOptionType, } from "../../../../exercises/exercise.js";
1
2
  import { toolBarConstructor } from "../../../../exercises/utils/geogebra/toolBarConstructor.js";
2
3
  import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
4
  import { GeogebraConstructor } from "../../../../geogebra/geogebraConstructor.js";
5
+ import { GeogebraParser } from "../../../../geogebra/parsers/geogebraParser.js";
4
6
  import { ggbPointToCoords } from "../../../../geogebra/parsers/ggbPointToCoords.js";
5
7
  import { parseGGBPoints } from "../../../../geogebra/parsers/parseGGBPoints.js";
6
8
  import { Point } from "../../../../math/geometry/point.js";
7
9
  import { NumberType } from "../../../../math/numbers/nombre.js";
8
- import { randfloat } from "../../../../math/utils/random/randfloat.js";
10
+ import { dividersOf } from "../../../../math/utils/arithmetic/dividersOf.js";
9
11
  import { randint } from "../../../../math/utils/random/randint.js";
10
12
  import { round } from "../../../../math/utils/round.js";
11
- import { FractionNode } from "../../../../tree/nodes/operators/fractionNode.js";
12
- import { MultiplyNode } from "../../../../tree/nodes/operators/multiplyNode.js";
13
+ import { NodeConstructor, } from "../../../../tree/nodes/nodeConstructor.js";
14
+ import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
15
+ import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
13
16
  import { random } from "../../../../utils/alea/random.js";
14
- const getInstruction = ({ abscissTex }) => {
15
- return `Placer le point d'abscisse $${abscissTex}$ sur la demi-droite graduée ci-dessous :`;
17
+ const getInstruction = ({ abscissType, absciss2, }) => {
18
+ const absciss2Node = NodeConstructor.fromIdentifiers(absciss2);
19
+ return `Placer le point d'abscisse $${abscissType === NumberType.Decimal
20
+ ? round(absciss2Node.evaluate(), 1).frenchify()
21
+ : absciss2Node.toTex()}$ sur la demi-droite graduée ci-dessous :`;
16
22
  };
17
23
  // const getHint: GetHint<Identifiers> = (identifiers) => {};
18
24
  // const getCorrection: GetCorrection<Identifiers> = (identifiers) => {};
19
- const getGGBAnswer = ({ coeff }) => {
20
- return [`(${coeff},0)`];
25
+ const getGGBAnswer = ({ absciss2 }) => {
26
+ const nodeAbciss2 = NodeConstructor.fromIdentifiers(absciss2);
27
+ return [`(${nodeAbciss2.evaluate()},0)`];
21
28
  };
22
- const getStudentGGBOptions = ({ oneUnitTex, abscissType, }) => {
29
+ const getStudentGGBOptions = ({ abscissType, absciss1, axisUnit, absciss2, }) => {
30
+ const [axisUnitNode, absciss1Node, absciss2Node] = [
31
+ axisUnit,
32
+ absciss1,
33
+ absciss2,
34
+ ].map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds));
35
+ const [valueAxisUnit, valueAbsciss1, valueAbsciss2] = [
36
+ axisUnitNode,
37
+ absciss1Node,
38
+ absciss2Node,
39
+ ].map((node) => node.evaluate());
40
+ const xMin = Math.min(Math.min(0, valueAbsciss1), valueAbsciss2);
41
+ const xMax = Math.max(Math.max(0, valueAbsciss1), valueAbsciss2);
42
+ const yxRatio = 0.5;
43
+ const yMax = yxRatio * (xMax - xMin);
44
+ const yMin = -yMax;
23
45
  const O = new Point("O", (0).toTree(), (0).toTree());
24
- const I = new Point("I", (1).toTree(), (0).toTree());
46
+ const I = new Point("I", absciss1Node, (0).toTree());
25
47
  const commands = [
26
48
  ...O.toGGBCommand(),
27
- `Text("\\footnotesize 0", (0, -0.5), false, true, 0, 0)`,
49
+ `Text("\\footnotesize 0", (0, ${yMin / 4}), false, true, 0, 0)`,
28
50
  ...I.toGGBCommand(),
29
- `Text("\\footnotesize ${oneUnitTex}", (1, ${abscissType === NumberType.Rational ? -1 : -0.5}), false, true, 0, 0)`,
51
+ `Text("\\footnotesize ${abscissType === NumberType.Decimal
52
+ ? round(absciss1Node.evaluate(), 1).frenchify()
53
+ : absciss1Node.toTex()}", (${valueAbsciss1}, ${abscissType === NumberType.Rational ? yMin / 2 : yMin / 4}), false, true, 0, 0)`,
30
54
  ];
31
55
  const ggb = new GeogebraConstructor({
32
56
  commands,
@@ -36,7 +60,7 @@ const getStudentGGBOptions = ({ oneUnitTex, abscissType, }) => {
36
60
  hideGrid: true,
37
61
  xAxis: {
38
62
  hideNumbers: true,
39
- steps: 1,
63
+ steps: valueAxisUnit,
40
64
  showPositive: true,
41
65
  },
42
66
  yAxis: {
@@ -46,70 +70,102 @@ const getStudentGGBOptions = ({ oneUnitTex, abscissType, }) => {
46
70
  forbidShiftDragZoom: true,
47
71
  });
48
72
  return ggb.getOptions({
49
- coords: [-1, 10, -2, 2],
73
+ coords: ggb.getAdaptedCoords({
74
+ xMin,
75
+ xMax,
76
+ yMin,
77
+ yMax,
78
+ }),
79
+ // coords: [xMin, xMax, yMin, yMax],
50
80
  });
51
81
  };
52
- const isGGBAnswerValid = (ans, { coeff }) => {
82
+ const isGGBAnswerValid = (ans, { absciss2, axisUnit }) => {
83
+ const [absciss2Node, axisUnitNode] = [absciss2, axisUnit].map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds));
84
+ const commands = ans;
85
+ const dictObj = new GeogebraParser(commands).objectDict();
86
+ console.log("dictObj:", dictObj);
87
+ const strPointA = dictObj["A"];
88
+ if (!strPointA) {
89
+ return false;
90
+ }
91
+ const coordsA = ggbPointToCoords(strPointA);
53
92
  const points = parseGGBPoints(ans).map((p) => ggbPointToCoords(p));
54
- return (points.length === 1 &&
55
- Math.abs(points[0].y) < 0.5 &&
56
- Math.abs(points[0].x - coeff) < 0.1);
93
+ return (points.length === 3 && //O,I,A
94
+ Math.abs(coordsA.y) < 0.5 * axisUnitNode.evaluate() &&
95
+ Math.abs(coordsA.x - absciss2Node.evaluate()) <
96
+ 0.1 * axisUnitNode.evaluate());
57
97
  };
58
- const getPlaceAbscissOnSemiLineQuestion = () => {
59
- const abscissType = random([
60
- NumberType.Integer,
61
- NumberType.Rational,
62
- NumberType.Decimal,
63
- ]);
64
- let absciss, axisUnit, oneUnitTex, abscissTex, coeff;
98
+ const getPlaceAbscissOnSemiLineQuestion = (optsIn) => {
99
+ const arrayedOptions = optsIn ?? optsDefault;
100
+ const opts = {
101
+ questionType: random(arrayedOptions.questionType),
102
+ numberType: random(arrayedOptions.numberType),
103
+ };
104
+ const abscissType = (() => {
105
+ switch (opts.numberType) {
106
+ case "Entiers":
107
+ return NumberType.Integer;
108
+ case "Rationnels":
109
+ return NumberType.Rational;
110
+ case "Décimaux":
111
+ return NumberType.Decimal;
112
+ }
113
+ })();
114
+ //[ [1/2, 2/2, 3/2], [1/3,2/3,3/3,4/3,5/3], ...]
115
+ function fracFamilyList() {
116
+ const maxDen = 5;
117
+ return [...Array(maxDen - 2).keys()]
118
+ .map((index) => index + 2)
119
+ .map((den) => [...Array(den === 2 ? 3 * den - 1 : 2 * den - 1).keys()]
120
+ .map((index) => index + 1)
121
+ .filter((num) => opts.questionType === "éviter le comptage"
122
+ ? num !== 1 && num !== den
123
+ : true)
124
+ .map((num) => frac(num, den)));
125
+ }
126
+ const fracList = random(fracFamilyList());
127
+ const den = fracList[0].rightChild;
128
+ const factor1 = random(fracList);
129
+ const factor2 = random(fracList, [factor1]);
130
+ let referenceNum;
131
+ let absciss1Node;
132
+ let absciss2Node;
65
133
  switch (abscissType) {
66
134
  case NumberType.Integer:
67
- axisUnit = randint(1, 10);
68
- coeff = randint(2, 10);
69
- absciss = axisUnit * coeff;
70
- oneUnitTex = axisUnit.frenchify();
71
- abscissTex = absciss.frenchify();
135
+ {
136
+ referenceNum = multiply(randint(1, 13), den);
137
+ absciss1Node = multiply(referenceNum, factor1).simplify();
138
+ absciss2Node = multiply(referenceNum, factor2).simplify();
139
+ }
72
140
  break;
73
- case NumberType.Rational: {
74
- const randomFrac = random([
75
- [1, 2],
76
- [1, 3],
77
- [2, 3],
78
- [1, 4],
79
- [3, 4],
80
- [1, 5],
81
- [2, 5],
82
- [3, 5],
83
- [4, 5],
84
- ]);
85
- axisUnit = randomFrac[0] / randomFrac[1];
86
- const oneUnit = new FractionNode(randomFrac[0].toTree(), randomFrac[1].toTree());
87
- oneUnitTex = oneUnit.toTex();
88
- coeff = randint(2, 10);
89
- absciss = axisUnit * coeff;
90
- abscissTex = new MultiplyNode(oneUnit, coeff.toTree()).simplify().toTex();
141
+ case NumberType.Rational:
142
+ {
143
+ referenceNum = random([...Array(19).keys()]
144
+ .map((index) => index + 1)
145
+ .filter((num) => !dividersOf(num).includes(den.evaluate()))).toTree();
146
+ absciss1Node = frac(multiply(referenceNum, factor1.leftChild).simplify(), factor1.rightChild);
147
+ absciss2Node = frac(multiply(referenceNum, factor2.leftChild).simplify(), factor2.rightChild);
148
+ }
91
149
  break;
92
- }
93
150
  case NumberType.Decimal:
94
151
  default:
95
- axisUnit = randfloat(0, 5, 1);
96
- coeff = randint(2, 10);
97
- absciss = round(axisUnit * coeff, 2);
98
- oneUnitTex = axisUnit.frenchify();
99
- abscissTex = absciss.frenchify();
152
+ {
153
+ referenceNum = frac(multiply(randint(1, 13 * 10), den), 10);
154
+ absciss1Node = multiply(referenceNum, factor1).simplify();
155
+ absciss2Node = multiply(referenceNum, factor2).simplify();
156
+ }
100
157
  break;
101
158
  }
159
+ const axisUnitNode = frac(referenceNum, den).simplify();
102
160
  const identifiers = {
103
- absciss,
104
- abscissTex,
105
161
  abscissType,
106
- axisUnit,
107
- coeff,
108
- oneUnitTex,
162
+ axisUnit: axisUnitNode.toIdentifiers(),
163
+ absciss1: absciss1Node.toIdentifiers(),
164
+ absciss2: absciss2Node.toIdentifiers(),
109
165
  };
110
166
  return getQuestionFromIdentifiers(identifiers);
111
167
  };
112
- const getQuestionFromIdentifiers = (identifiers) => {
168
+ const getQuestionFromIdentifiers = (identifiers, opts) => {
113
169
  const question = {
114
170
  ggbAnswer: getGGBAnswer(identifiers),
115
171
  instruction: getInstruction(identifiers),
@@ -117,14 +173,38 @@ const getQuestionFromIdentifiers = (identifiers) => {
117
173
  identifiers,
118
174
  // hint: getHint(identifiers),
119
175
  // correction: getCorrection(identifiers),
176
+ options: opts,
120
177
  };
121
178
  return question;
122
179
  };
180
+ const optsDefault = {
181
+ questionType: ["standard", "éviter le comptage"],
182
+ numberType: ["Entiers", "Rationnels", "Décimaux"],
183
+ };
184
+ const options = [
185
+ {
186
+ id: "questionType",
187
+ label: "Type de question",
188
+ target: GeneratorOptionTarget.generation,
189
+ type: GeneratorOptionType.multiselect,
190
+ values: ["standard", "éviter le comptage"],
191
+ defaultValue: optsDefault.questionType,
192
+ },
193
+ {
194
+ id: "numberType",
195
+ label: "Type de nombres",
196
+ target: GeneratorOptionTarget.generation,
197
+ type: GeneratorOptionType.multiselect,
198
+ values: ["Entiers", "Rationnels", "Décimaux"],
199
+ defaultValue: optsDefault.numberType,
200
+ },
201
+ ];
123
202
  export const placeAbscissOnSemiLine = {
124
203
  id: "placeAbscissOnSemiLine",
125
204
  label: "Placer un point d'abscisse donnée sur une demi-droite graduée",
126
205
  isSingleStep: true,
127
- generator: (nb) => getDistinctQuestions(getPlaceAbscissOnSemiLineQuestion, nb),
206
+ generator: (nb, opts) => getDistinctQuestions(() => getPlaceAbscissOnSemiLineQuestion(opts), nb),
207
+ options,
128
208
  ggbTimer: 60,
129
209
  isGGBAnswerValid,
130
210
  subject: "Mathématiques",
@@ -43,7 +43,7 @@ function generateEvenInflexionPoint() {
43
43
  const getInstruction = (identifiers) => {
44
44
  const { askConvex } = identifiers;
45
45
  const questionType = askConvex ? "convexe" : "concave";
46
- const instruction = `Ci-dessous est tracée la courbe représentative $\\mathcal C_f$ d'une fonction $f$. Sur quel intervalle $f$ est-elle ${questionType} ?`;
46
+ const instruction = `Ci-dessous est tracée la courbe représentative $\\mathcal C_f$ d'une fonction $f$. Sur quel intervalle $f$ est-elle strictement ${questionType} ?`;
47
47
  return instruction;
48
48
  };
49
49
  const getAnswer = (identifiers) => {
@@ -1 +1 @@
1
- {"version":3,"file":"circleCircumference.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/perimeters/circleCircumference.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAMrC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAoGF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,WAAW,CAcrD,CAAC"}
1
+ {"version":3,"file":"circleCircumference.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/perimeters/circleCircumference.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAQrC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AA2GF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,WAAW,CAcrD,CAAC"}
@@ -2,6 +2,8 @@ import { addValidProp, tryToAddWrongProp, propWhile, } from "../../../../exercis
2
2
  import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
3
  import { randint } from "../../../../math/utils/random/randint.js";
4
4
  import { round } from "../../../../math/utils/round.js";
5
+ import { substract } from "../../../../tree/nodes/operators/substractNode.js";
6
+ import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
5
7
  import { coinFlip } from "../../../../utils/alea/coinFlip.js";
6
8
  import { shuffle } from "../../../../utils/alea/shuffle.js";
7
9
  const getInstruction = (identifiers) => {
@@ -10,14 +12,15 @@ const getInstruction = (identifiers) => {
10
12
  ? "rayon " + `$${radius}\\ \\textrm{cm}$`
11
13
  : "diamètre " + `$${diametre} \\ \\textrm{cm}$`} (arrondir au centième de $\\textrm{cm}$).`;
12
14
  };
13
- const getAnswer = (identifiers) => {
15
+ const getAnswerNode = (identifiers) => {
14
16
  const { coin, radius, diametre } = identifiers;
15
17
  const answerNb = coin
16
18
  ? round(2 * Math.PI * radius, 2)
17
19
  : round(Math.PI * diametre, 2);
18
- const answer = answerNb.frenchify();
19
- const answerTex = answer + "\\text{cm}";
20
- return answerTex;
20
+ return answerNb.toTree();
21
+ };
22
+ const getAnswer = (identifiers) => {
23
+ return `${getAnswerNode(identifiers).toTex()} \\text{cm}`;
21
24
  };
22
25
  const getHint = () => {
23
26
  return `Le périmètre d'un cercle de rayon $r$ est donné par :
@@ -79,9 +82,14 @@ const getPropositions = (n, { answer }) => {
79
82
  });
80
83
  return shuffle(propositions);
81
84
  };
82
- const isAnswerValid = (ans, { answer }) => {
83
- const texs = [answer, answer.split("\\text")[0]];
84
- return texs.includes(ans);
85
+ const isAnswerValid = (ans, { answer, ...identifiers }) => {
86
+ if (ans.includes("\\text{cm}^2")) {
87
+ return false;
88
+ }
89
+ const refinedAns = ans.replace("\\text{cm}", "");
90
+ const ansNode = parseAlgebraic(refinedAns);
91
+ const answerNode = getAnswerNode(identifiers);
92
+ return substract(ansNode, answerNode).evaluate() === 0;
85
93
  };
86
94
  export const circleCircumference = {
87
95
  id: "circleCircumference",
@@ -1 +1 @@
1
- {"version":3,"file":"basicShapesNaming.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/shapes/basicShapesNaming.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAgBT,MAAM,6BAA6B,CAAC;AAGrC,OAAO,EAGL,eAAe,EAChB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAGL,cAAc,EACf,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAEL,kBAAkB,EACnB,MAAM,gCAAgC,CAAC;AAKxC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,kBAAkB,GAAG,cAAc,GAAG,eAAe,CAAC;CAC/D,CAAC;AAiKF,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,WAAW,CAenD,CAAC"}
1
+ {"version":3,"file":"basicShapesNaming.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/shapes/basicShapesNaming.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAgBT,MAAM,6BAA6B,CAAC;AAGrC,OAAO,EAGL,eAAe,EAChB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAGL,cAAc,EACf,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAEL,kBAAkB,EACnB,MAAM,gCAAgC,CAAC;AAKxC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,kBAAkB,GAAG,cAAc,GAAG,eAAe,CAAC;CAC/D,CAAC;AAmKF,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,WAAW,CAenD,CAAC"}
@@ -31,7 +31,7 @@ const getAnswer = (identifiers) => {
31
31
  break;
32
32
  case 3: //droite
33
33
  default:
34
- return obj.toTexNoLeftRight();
34
+ return `(${obj.toTexNoLeftRight()})`;
35
35
  break;
36
36
  }
37
37
  };
@@ -105,12 +105,14 @@ const getBasicShapesNamingQuestion = () => {
105
105
  const type = randint(1, 4);
106
106
  let objIds;
107
107
  switch (type) {
108
- case 1: { //segment
108
+ case 1: {
109
+ //segment
109
110
  const segment = SegmentConstructor.random();
110
111
  objIds = segment.toIdentifiers();
111
112
  break;
112
113
  }
113
- case 2: { //demi-droite
114
+ case 2: {
115
+ //demi-droite
114
116
  const ray = RayConstructor.random();
115
117
  objIds = ray.toIdentifiers();
116
118
  break;
@@ -1 +1 @@
1
- {"version":3,"file":"colinearityFromPicture.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/geometry/vectors/colinearity/colinearityFromPicture.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAGL,gBAAgB,EACjB,MAAM,8BAA8B,CAAC;AAOtC,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,gBAAgB,EAAE,CAAC;IAC7B,SAAS,EAAE,gBAAgB,EAAE,CAAC;CAC/B,CAAC;AA+NF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,CAkBxD,CAAC"}
1
+ {"version":3,"file":"colinearityFromPicture.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/geometry/vectors/colinearity/colinearityFromPicture.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAGL,gBAAgB,EACjB,MAAM,8BAA8B,CAAC;AAOtC,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,gBAAgB,EAAE,CAAC;IAC7B,SAAS,EAAE,gBAAgB,EAAE,CAAC;CAC/B,CAAC;AA+OF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,CAkBxD,CAAC"}
@@ -60,126 +60,143 @@ const isAnswerValid = () => {
60
60
  }
61
61
  };
62
62
  const getColinearityFromPictureQuestion = () => {
63
- const points = [];
64
- let letterIndex = 65; //"A"
65
- for (let j = 0; j < 4; j++) {
66
- for (let i = 0; i < 3; i++) {
67
- points.push(new Point(String.fromCharCode(letterIndex), i, j));
68
- letterIndex++;
63
+ let firstVec, secondVec;
64
+ let isGenerationOk = false;
65
+ const generate = () => {
66
+ const points = [];
67
+ let letterIndex = 65; //"A"
68
+ for (let j = 0; j < 4; j++) {
69
+ for (let i = 0; i < 3; i++) {
70
+ points.push(new Point(String.fromCharCode(letterIndex), i, j));
71
+ letterIndex++;
72
+ }
69
73
  }
70
- }
71
- //!mama mia
72
- //pardon au moi du futur
73
- //en gros l'idée est qu'on construit deux paires de coordonnées de vecteurs colinéaires (ou non colinéaires) puis on boucle à l'infini sur les points pour trouver des points correspondants aux coordonnées des vecteurs choisis
74
- let firstVecCoords, secondVecCoords;
75
- const isColinear = coinFlip();
76
- if (isColinear) {
77
- const choices = [
78
- [
79
- [1, 0],
80
- [2, 0],
81
- ],
82
- [
83
- [0, 1],
84
- [0, 2],
85
- [0, 3],
86
- ],
87
- [
88
- [1, 1],
89
- [2, 2],
90
- ],
91
- [[2, 1]],
92
- [[1, 2]],
93
- [[1, 3]],
94
- ];
95
- const choice = random(choices);
96
- const firstVecIndex = randint(0, choice.length);
97
- firstVecCoords = choice[firstVecIndex];
98
- if (choice.length === 1) {
99
- firstVecCoords = choice[0];
100
- secondVecCoords = choice[0];
74
+ //!mama mia
75
+ //pardon au moi du futur
76
+ //en gros l'idée est qu'on construit deux paires de coordonnées de vecteurs colinéaires (ou non colinéaires) puis on boucle à l'infini sur les points pour trouver des points correspondants aux coordonnées des vecteurs choisis
77
+ let firstVecCoords, secondVecCoords;
78
+ const isColinear = coinFlip();
79
+ if (isColinear) {
80
+ const choices = [
81
+ [
82
+ [1, 0],
83
+ [2, 0],
84
+ ],
85
+ [
86
+ [0, 1],
87
+ [0, 2],
88
+ [0, 3],
89
+ ],
90
+ [
91
+ [1, 1],
92
+ [2, 2],
93
+ ],
94
+ [[2, 1]],
95
+ [[1, 2]],
96
+ [[1, 3]],
97
+ ];
98
+ const choice = random(choices);
99
+ const firstVecIndex = randint(0, choice.length);
100
+ firstVecCoords = choice[firstVecIndex];
101
+ if (choice.length === 1) {
102
+ firstVecCoords = choice[0];
103
+ secondVecCoords = choice[0];
104
+ const reverseFirst = coinFlip();
105
+ if (reverseFirst)
106
+ firstVecCoords = firstVecCoords.map((e) => -e);
107
+ else
108
+ secondVecCoords = secondVecCoords.map((e) => -e);
109
+ }
110
+ else {
111
+ const secondVecIndex = randint(0, choice.length);
112
+ secondVecCoords = choice[secondVecIndex];
113
+ const mustReverseOne = secondVecIndex === firstVecIndex;
114
+ const willReverse = mustReverseOne || coinFlip();
115
+ if (willReverse) {
116
+ const reverseFirst = coinFlip();
117
+ if (reverseFirst)
118
+ firstVecCoords = firstVecCoords.map((e) => -e);
119
+ else
120
+ secondVecCoords = secondVecCoords.map((e) => -e);
121
+ }
122
+ }
123
+ }
124
+ else {
125
+ //choix précédents + (2,3)
126
+ const choices = [
127
+ [
128
+ [1, 0],
129
+ [2, 0],
130
+ ],
131
+ [
132
+ [0, 1],
133
+ [0, 2],
134
+ [0, 3],
135
+ ],
136
+ [
137
+ [1, 1],
138
+ [2, 2],
139
+ ],
140
+ [[2, 1]],
141
+ [[1, 2]],
142
+ [[1, 3]],
143
+ [[2, 3]],
144
+ ];
145
+ const firstChoiceIndex = randint(0, choices.length);
146
+ const secondChoiceIndex = randint(0, choices.length, [firstChoiceIndex]);
147
+ firstVecCoords = random(choices[firstChoiceIndex]);
148
+ secondVecCoords = random(choices[secondChoiceIndex]);
101
149
  const reverseFirst = coinFlip();
102
150
  if (reverseFirst)
103
151
  firstVecCoords = firstVecCoords.map((e) => -e);
104
152
  else
105
153
  secondVecCoords = secondVecCoords.map((e) => -e);
106
154
  }
107
- else {
108
- const secondVecIndex = randint(0, choice.length);
109
- secondVecCoords = choice[secondVecIndex];
110
- const mustReverseOne = secondVecIndex === firstVecIndex;
111
- const willReverse = mustReverseOne || coinFlip();
112
- if (willReverse) {
113
- const reverseFirst = coinFlip();
114
- if (reverseFirst)
115
- firstVecCoords = firstVecCoords.map((e) => -e);
116
- else
117
- secondVecCoords = secondVecCoords.map((e) => -e);
155
+ // let firstVec, secondVec;
156
+ let counter = 0;
157
+ while (true) {
158
+ counter++;
159
+ if (counter > 1000)
160
+ throw new Error("Too many iterations in colFromPic");
161
+ const A = random(points);
162
+ const B = random(points);
163
+ if (B.x.evaluate() - A.x.evaluate() === firstVecCoords[0] &&
164
+ B.y.evaluate() - A.y.evaluate() === firstVecCoords[1]) {
165
+ firstVec = [A.toIdentifiers(), B.toIdentifiers()];
166
+ break;
118
167
  }
119
168
  }
120
- }
121
- else {
122
- //choix précédents + (2,3)
123
- const choices = [
124
- [
125
- [1, 0],
126
- [2, 0],
127
- ],
128
- [
129
- [0, 1],
130
- [0, 2],
131
- [0, 3],
132
- ],
133
- [
134
- [1, 1],
135
- [2, 2],
136
- ],
137
- [[2, 1]],
138
- [[1, 2]],
139
- [[1, 3]],
140
- [[2, 3]],
141
- ];
142
- const firstChoiceIndex = randint(0, choices.length);
143
- const secondChoiceIndex = randint(0, choices.length, [firstChoiceIndex]);
144
- firstVecCoords = random(choices[firstChoiceIndex]);
145
- secondVecCoords = random(choices[secondChoiceIndex]);
146
- const reverseFirst = coinFlip();
147
- if (reverseFirst)
148
- firstVecCoords = firstVecCoords.map((e) => -e);
149
- else
150
- secondVecCoords = secondVecCoords.map((e) => -e);
151
- }
152
- let firstVec, secondVec;
169
+ let cnt = 0;
170
+ while (true) {
171
+ //!FIIIX
172
+ cnt++;
173
+ if (cnt > 1000)
174
+ throw new Error("Too many iterations in colFromPic");
175
+ const C = random(points);
176
+ const D = random(points);
177
+ if (D.x.evaluate() - C.x.evaluate() === secondVecCoords[0] &&
178
+ D.y.evaluate() - C.y.evaluate() === secondVecCoords[1]) {
179
+ secondVec = [C.toIdentifiers(), D.toIdentifiers()];
180
+ break;
181
+ }
182
+ }
183
+ };
153
184
  let counter = 0;
154
- while (true) {
185
+ while (!isGenerationOk) {
155
186
  counter++;
156
- if (counter > 1000)
187
+ if (counter > 100)
157
188
  throw new Error("Too many iterations in colFromPic");
158
- const A = random(points);
159
- const B = random(points);
160
- if (B.x.evaluate() - A.x.evaluate() === firstVecCoords[0] &&
161
- B.y.evaluate() - A.y.evaluate() === firstVecCoords[1]) {
162
- firstVec = [A.toIdentifiers(), B.toIdentifiers()];
163
- break;
189
+ try {
190
+ generate();
191
+ isGenerationOk = true;
164
192
  }
165
- }
166
- let cnt = 0;
167
- while (true) {
168
- //!FIIIX
169
- cnt++;
170
- if (cnt > 1000)
171
- throw new Error("Too many iterations in colFromPic");
172
- const C = random(points);
173
- const D = random(points);
174
- if (D.x.evaluate() - C.x.evaluate() === secondVecCoords[0] &&
175
- D.y.evaluate() - C.y.evaluate() === secondVecCoords[1]) {
176
- secondVec = [C.toIdentifiers(), D.toIdentifiers()];
177
- break;
193
+ catch (_err) {
194
+ isGenerationOk = false;
178
195
  }
179
196
  }
180
197
  const identifiers = {
181
- firstVec,
182
- secondVec,
198
+ firstVec: firstVec,
199
+ secondVec: secondVec,
183
200
  };
184
201
  return getQuestionFromIdentifiers(identifiers);
185
202
  };
@@ -1 +1 @@
1
- {"version":3,"file":"vectorRepresentative.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/vectors/vectorRepresentative.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAUT,MAAM,6BAA6B,CAAC;AASrC,KAAK,WAAW,GAAG;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB,CAAC;AAiMF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAiBtD,CAAC"}
1
+ {"version":3,"file":"vectorRepresentative.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/vectors/vectorRepresentative.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAUT,MAAM,6BAA6B,CAAC;AASrC,KAAK,WAAW,GAAG;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB,CAAC;AAkMF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAiBtD,CAAC"}
@@ -24,11 +24,12 @@ const getPropositions = (_n, { vec, vecsProposed }) => {
24
24
  const vector = VectorConstructor.fromPoints(points.find((p) => p.name === vec[0]), points.find((p) => p.name === vec[1]));
25
25
  for (let i = 0; i < vecsProposed.length; i++) {
26
26
  const vecProp = VectorConstructor.fromPoints(points.find((p) => p.name === vecsProposed[i][0]), points.find((p) => p.name === vecsProposed[i][1]));
27
+ const tex = `\\overrightarrow{${vecsProposed[i]}}`;
27
28
  if (vector.equals(vecProp)) {
28
- addValidProp(propositions, vecsProposed[i]);
29
+ addValidProp(propositions, tex);
29
30
  }
30
31
  else {
31
- addWrongProp(propositions, vecsProposed[i]);
32
+ addWrongProp(propositions, tex);
32
33
  }
33
34
  }
34
35
  return propositions;