math-exercises 3.0.125 → 3.0.127

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 +231 -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 +123 -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 +149 -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 +368 -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 +454 -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 +86 -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 +180 -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 +231 -248
  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 +11 -0
  97. package/lib/exercises/math/conversion/kmPerMinToKmPerHourConversion.d.ts.map +1 -0
  98. package/lib/exercises/math/conversion/kmPerMinToKmPerHourConversion.js +116 -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 +243 -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 +53 -0
  109. package/lib/exercises/math/dataRepresentations/barChartInterpreting.d.ts.map +1 -0
  110. package/lib/exercises/math/dataRepresentations/barChartInterpreting.js +533 -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 +140 -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 +194 -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 +117 -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 +118 -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 +223 -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 +16 -0
  162. package/lib/exercises/math/functions/affines/representationOfAffine.d.ts.map +1 -0
  163. package/lib/exercises/math/functions/affines/representationOfAffine.js +275 -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 +235 -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 +65 -88
  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 +221 -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 +29 -0
  207. package/lib/exercises/math/probaStat/probaAsSumOfProbas.d.ts.map +1 -0
  208. package/lib/exercises/math/probaStat/probaAsSumOfProbas.js +547 -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 +89 -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 +152 -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 +351 -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,223 @@
1
+ import { GeneratorOptionTarget, GeneratorOptionType, } from "../../../../exercises/exercise.js";
2
+ import { isGGBLine } from "../../../../exercises/utils/geogebra/isGGBLine.js";
3
+ import { isGGBPoint } from "../../../../exercises/utils/geogebra/isGGBPoint.js";
4
+ import { toolBarConstructor } from "../../../../exercises/utils/geogebra/toolBarConstructor.js";
5
+ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
6
+ import { deleteObjectNamesFromAnswer } from "../../../../geogebra/deleteObjectNamesFromAnswer.js";
7
+ import { GeogebraConstructor } from "../../../../geogebra/geogebraConstructor.js";
8
+ import { approxEqual } from "../../../../geogebra/parsers/approxEqual.js";
9
+ import { Point } from "../../../../math/geometry/point.js";
10
+ import { ProgCalcConstructor, } from "../../../../math/progCalc/progCalc.js";
11
+ import { randint } from "../../../../math/utils/random/randint.js";
12
+ import { substract } from "../../../../tree/nodes/operators/substractNode.js";
13
+ import { random } from "../../../../utils/alea/random.js";
14
+ import { arrayEqual } from "../../../../utils/arrays/arrayEqual.js";
15
+ const getInstruction = (identifiers) => {
16
+ const { progCalcIds, funcName } = identifiers;
17
+ const progCalc = ProgCalcConstructor.fromIdentifiers(progCalcIds);
18
+ return `La fonction $ ${funcName} $ est définie par le programme de calcul suivant :
19
+
20
+ ${progCalc.getArrOfFrenchStrings().map((str) => `> ${str}`).join(`
21
+
22
+ `)}
23
+
24
+ Dans le repère, tracer la représentation de la fonction $ ${funcName} $.`;
25
+ };
26
+ const getHint = (identifiers) => {
27
+ const { funcName } = identifiers;
28
+ return `
29
+ Exécute le programme de calcul en partant d'une valeur $x$ de ton choix.
30
+
31
+ Cela te donnera la valeur de $ ${funcName}(x) $.
32
+
33
+ Le point de coordonnées $ (x;${funcName}(x)) $ appartient à la droite qu'il faut tracer.
34
+ `;
35
+ };
36
+ const getCorrection = (identifiers) => {
37
+ const { funcName, progCalcIds } = identifiers;
38
+ const progCalc = ProgCalcConstructor.fromIdentifiers(progCalcIds);
39
+ const nodeProgCalc = progCalc.toTree("x".toTree());
40
+ const nodeXA = (0).toTree();
41
+ const nodeYA = progCalc.apply(nodeXA).simplify();
42
+ const nodeXB = (1).toTree();
43
+ const nodeYB = progCalc.apply(nodeXB).simplify();
44
+ return `Si on exécute le programme de calcul avec $x$, on obtient:
45
+
46
+ $$
47
+ ${funcName}(x) =
48
+ ${nodeProgCalc.toTex({
49
+ allowMinusAnywhereInFraction: true,
50
+ allowDoubleMinus: true,
51
+ forceTimesSign: true,
52
+ forceParenthesis: true,
53
+ })} = ${nodeProgCalc
54
+ .simplify({
55
+ forbidFactorize: true,
56
+ towardsDistribute: true,
57
+ forceDistributeFractions: true,
58
+ })
59
+ .toTex()}
60
+ $$
61
+
62
+ On reconnaît l'expression d'une fonction affine.
63
+ On va donc tracer une droite.
64
+
65
+ Si on exécute le programme de calcul avec la valeur $ ${nodeXA.toTex()} $, on obtient $ ${nodeYA.toTex()} $.
66
+ La droite passe donc par le point de coordonnées $(${nodeXA.toTex()};${nodeYA.toTex()})$.
67
+
68
+ Si on exécute le programme de calcul avec la valeur $ ${nodeXB.toTex()} $, on obtient $ ${nodeYB.toTex()} $.
69
+ La droite passe donc par le point de coordonnées $(${nodeXB.toTex()};${nodeYB.toTex()})$.
70
+
71
+ On place donc les deux points de coordonnées $(${nodeXA.toTex()};${nodeYA.toTex()})$ et $(${nodeXB.toTex()};${nodeYB.toTex()})$,
72
+ puis on trace la droite passant par ces deux points.
73
+ `;
74
+ };
75
+ const getStudentGGBOptions = (identifiers) => {
76
+ const { progCalcIds } = identifiers;
77
+ const progCalc = ProgCalcConstructor.fromIdentifiers(progCalcIds);
78
+ const xMin = 0;
79
+ const xMax = 1;
80
+ const xA = xMin;
81
+ const yA = progCalc.apply(xA.toTree()).evaluate();
82
+ const xB = xMax;
83
+ const yB = progCalc.apply(xB.toTree()).evaluate();
84
+ const studentGGB = new GeogebraConstructor({
85
+ isGridSimple: true,
86
+ customToolBar: toolBarConstructor({
87
+ join: true,
88
+ }),
89
+ });
90
+ const yMax = Math.max(yA, yB, 0);
91
+ const yMin = Math.min(yA, yB, 0);
92
+ return studentGGB.getOptions({
93
+ coords: studentGGB.getAdaptedCoords({
94
+ xMin,
95
+ xMax,
96
+ yMin,
97
+ yMax,
98
+ }),
99
+ });
100
+ };
101
+ const getGGBAnswer = (identifiers) => {
102
+ const { progCalcIds } = identifiers;
103
+ const progCalc = ProgCalcConstructor.fromIdentifiers(progCalcIds);
104
+ const xA = 0;
105
+ const yA = progCalc.apply(xA.toTree()).evaluate();
106
+ const xB = 1;
107
+ const yB = progCalc.apply(xB.toTree()).evaluate();
108
+ return [`(${xA},${yA})`, `(${xB},${yB})`, `Line[A, B]`];
109
+ };
110
+ const isGGBAnswerValid = (ans, { ggbAnswer, progCalcIds }) => {
111
+ const studentAnswer = deleteObjectNamesFromAnswer(ans);
112
+ if (arrayEqual(studentAnswer, ggbAnswer))
113
+ return true;
114
+ if (studentAnswer.length !== 3)
115
+ return false;
116
+ if (!isGGBPoint(studentAnswer[0]) ||
117
+ !isGGBPoint(studentAnswer[1]) ||
118
+ !isGGBLine(studentAnswer[2]))
119
+ return false;
120
+ const A = getPoint(studentAnswer[0], "A");
121
+ const B = getPoint(studentAnswer[1], "B");
122
+ const a = (B.getYnumber() - A.getYnumber()) / (B.getXnumber() - A.getXnumber());
123
+ const b = A.getYnumber() - a * A.getXnumber();
124
+ const progCalc = ProgCalcConstructor.fromIdentifiers(progCalcIds);
125
+ const correctB = progCalc.apply((0).toTree()).evaluate();
126
+ const correctA = substract(progCalc.apply((1).toTree()), correctB).evaluate();
127
+ return approxEqual(a, correctA, 1) && approxEqual(b, correctB, 1);
128
+ };
129
+ const getPoint = (command, pointName) => {
130
+ const splitted = command.split(",");
131
+ const x = +splitted[0].replace("(", "");
132
+ const y = +splitted[1].replace(")", "");
133
+ return new Point(pointName, x.toTree(), y.toTree());
134
+ };
135
+ const getDrawAffineFromProgCalcQuestion = (opts) => {
136
+ const nbSteps = opts?.nbSteps ?? optsDefault.nbSteps;
137
+ const isSingleUseOperators = opts?.isSingleUseOperators ?? optsDefault.isSingleUseOperators;
138
+ const arrOpGenAddsub = [
139
+ {
140
+ operator: "add",
141
+ createParam: () => randint(-10, 11, [0]),
142
+ },
143
+ {
144
+ operator: "subtract",
145
+ createParam: () => randint(-10, 11, [0]),
146
+ },
147
+ ];
148
+ const arrOpGenMuldiv = [
149
+ {
150
+ operator: "opposite",
151
+ createParam: () => undefined,
152
+ },
153
+ {
154
+ operator: "multiply",
155
+ createParam: () => randint(-10, 11, [0, 1]),
156
+ },
157
+ {
158
+ operator: "divide",
159
+ createParam: () => randint(-10, 11, [0, 1]),
160
+ },
161
+ ];
162
+ const arrOpGenConfigAll = [...arrOpGenAddsub, ...arrOpGenMuldiv];
163
+ //ensure that there is at least 1 addsub and 1 muldiv operation
164
+ const opGenConfigAddsub = random(arrOpGenAddsub);
165
+ const opGenConfigMuldiv = random(arrOpGenMuldiv);
166
+ const arrOpGenConfigMandatory = [opGenConfigAddsub, opGenConfigMuldiv];
167
+ const progCalc = ProgCalcConstructor.randomWithMandatory(nbSteps, isSingleUseOperators, arrOpGenConfigMandatory, arrOpGenConfigAll);
168
+ const identifiers = {
169
+ progCalcIds: progCalc.toIdentifiers(),
170
+ funcName: random(["f", "g", "h"]),
171
+ };
172
+ return getQuestionFromIdentifiers(identifiers, opts);
173
+ };
174
+ const getQuestionFromIdentifiers = (identifiers) => {
175
+ return {
176
+ ggbAnswer: getGGBAnswer(identifiers),
177
+ instruction: getInstruction(identifiers),
178
+ studentGgbOptions: getStudentGGBOptions(identifiers),
179
+ identifiers,
180
+ hint: getHint(identifiers),
181
+ correction: getCorrection(identifiers),
182
+ };
183
+ };
184
+ const optsDefault = {
185
+ nbSteps: 2,
186
+ isSingleUseOperators: true,
187
+ };
188
+ const options = [
189
+ {
190
+ id: "nbSteps",
191
+ label: "Nombre d'étapes de transformation",
192
+ defaultValue: optsDefault.nbSteps,
193
+ values: [2, 3, 4, 5],
194
+ target: GeneratorOptionTarget.generation,
195
+ type: GeneratorOptionType.select,
196
+ },
197
+ {
198
+ id: "isSingleUseOperators",
199
+ label: "Opérateurs à usage unique",
200
+ defaultValue: optsDefault.isSingleUseOperators,
201
+ values: [true, false],
202
+ target: GeneratorOptionTarget.generation,
203
+ type: GeneratorOptionType.select,
204
+ },
205
+ ];
206
+ export const drawAffineFromProgCalc = {
207
+ id: "drawAffineFromProgCalc",
208
+ label: "Tracer la représentation graphique d'une fonction affine à partir d'un programme de calcul",
209
+ isSingleStep: true,
210
+ generator: (nb, opts) => getDistinctQuestions(() => getDrawAffineFromProgCalcQuestion(opts), nb),
211
+ options,
212
+ ggbTimer: 60,
213
+ isGGBAnswerValid,
214
+ subject: "Mathématiques",
215
+ getHint,
216
+ getInstruction,
217
+ getCorrection,
218
+ getGGBAnswer,
219
+ getStudentGGBOptions,
220
+ answerType: "GGB",
221
+ getQuestionFromIdentifiers,
222
+ hasHintAndCorrection: true,
223
+ };
@@ -12,7 +12,14 @@ export * from "./affineAdjustmentComplete.js";
12
12
  export * from "./affineMeanValue.js";
13
13
  export * from "./affineExpressionFromTwoImages.js";
14
14
  export * from "./affineFromExercise.js";
15
+ export * from "./drawAffineFromLitExp.js";
16
+ export * from "./recognizeExprAffine.js";
15
17
  export * from "./drawAffineFrom2Points.js";
16
18
  export * from "./recognizeAffineGraph.js";
17
19
  export * from "./drawAffineFromLitExp.js";
20
+ export * from "./coordsOfPointOnAffineFindX.js";
21
+ export * from "./coordsOfPointOnAffineFindY.js";
22
+ export * from "./representationOfAffine.js";
23
+ export * from "./drawAffineFromPointAndLeadingCoeff.js";
24
+ export * from "./drawAffineFromProgCalc.js";
18
25
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/affines/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,iCAAiC,CAAC;AAChD,cAAc,iCAAiC,CAAC;AAChD,cAAc,mBAAmB,CAAC;AAClC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,uBAAuB,CAAC;AACtC,cAAc,iCAAiC,CAAC;AAChD,cAAc,oCAAoC,CAAC;AACnD,cAAc,uBAAuB,CAAC;AACtC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,sBAAsB,CAAC;AACrC,cAAc,oCAAoC,CAAC;AACnD,cAAc,yBAAyB,CAAC;AACxC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/affines/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,iCAAiC,CAAC;AAChD,cAAc,iCAAiC,CAAC;AAChD,cAAc,mBAAmB,CAAC;AAClC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,uBAAuB,CAAC;AACtC,cAAc,iCAAiC,CAAC;AAChD,cAAc,oCAAoC,CAAC;AACnD,cAAc,uBAAuB,CAAC;AACtC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,sBAAsB,CAAC;AACrC,cAAc,oCAAoC,CAAC;AACnD,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iCAAiC,CAAC;AAChD,cAAc,iCAAiC,CAAC;AAChD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,yCAAyC,CAAC;AACxD,cAAc,6BAA6B,CAAC"}
@@ -12,6 +12,13 @@ export * from "./affineAdjustmentComplete.js";
12
12
  export * from "./affineMeanValue.js";
13
13
  export * from "./affineExpressionFromTwoImages.js";
14
14
  export * from "./affineFromExercise.js";
15
+ export * from "./drawAffineFromLitExp.js";
16
+ export * from "./recognizeExprAffine.js";
15
17
  export * from "./drawAffineFrom2Points.js";
16
18
  export * from "./recognizeAffineGraph.js";
17
19
  export * from "./drawAffineFromLitExp.js";
20
+ export * from "./coordsOfPointOnAffineFindX.js";
21
+ export * from "./coordsOfPointOnAffineFindY.js";
22
+ export * from "./representationOfAffine.js";
23
+ export * from "./drawAffineFromPointAndLeadingCoeff.js";
24
+ export * from "./drawAffineFromProgCalc.js";
@@ -0,0 +1,20 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ type ItemType = {
3
+ fName: string;
4
+ tex: string;
5
+ fType: string;
6
+ a: number | undefined;
7
+ b: number | undefined;
8
+ };
9
+ type AskedType = "affine" | "linear";
10
+ type Identifiers = {
11
+ items: ItemType[];
12
+ askedType: AskedType;
13
+ };
14
+ type Options = {
15
+ askedType: AskedType;
16
+ };
17
+ export declare const recognizeExprAffine: Exercise<Identifiers, Options>;
18
+ export declare const recognizeExprLinear: Exercise<Identifiers, Options>;
19
+ export {};
20
+ //# sourceMappingURL=recognizeExprAffine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recognizeExprAffine.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/affines/recognizeExprAffine.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAWT,MAAM,6BAA6B,CAAC;AA2BrC,KAAK,QAAQ,GAAG;IACd,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACtB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACvB,CAAC;AAEF,KAAK,SAAS,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAErC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,SAAS,EAAE,SAAS,CAAC;CACtB,CAAC;AAkSF,KAAK,OAAO,GAAG;IACb,SAAS,EAAE,SAAS,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAoB9D,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAoB9D,CAAC"}
@@ -0,0 +1,284 @@
1
+ import { addValidProp, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { AffineConstructor } from "../../../../math/polynomials/affine.js";
4
+ import { TrinomConstructor } from "../../../../math/polynomials/trinom.js";
5
+ import { randint } from "../../../../math/utils/random/randint.js";
6
+ import { add } from "../../../../tree/nodes/operators/addNode.js";
7
+ import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
8
+ import { NodeShuffler } from "../../../../tree/utilities/nodeShuffler.js";
9
+ import { coinFlip } from "../../../../utils/alea/coinFlip.js";
10
+ import { probaLawFlip } from "../../../../utils/alea/probaLawFlip.js";
11
+ import { shuffle } from "../../../../utils/alea/shuffle.js";
12
+ const getStringCommaCommaAnd = (strings, stringComma = ", ", stringAnd = " et ") => {
13
+ return strings.slice(0, -1).length > 0
14
+ ? [strings.slice(0, -1).join(stringComma), ...strings.slice(-1)].join(stringAnd)
15
+ : strings[0];
16
+ };
17
+ const fNames = ["f", "g", "h", "i"];
18
+ const getInstruction = (identifiers) => {
19
+ const { askedType } = identifiers;
20
+ return `Parmi les fonctions suivantes, laquelle ou lesquelles sont des fonctions ${(() => {
21
+ switch (askedType) {
22
+ case "affine":
23
+ return "affines";
24
+ case "linear":
25
+ return "linéaires";
26
+ }
27
+ })()} ?`;
28
+ };
29
+ const getHint = (identifiers) => {
30
+ const { askedType } = identifiers;
31
+ switch (askedType) {
32
+ case "affine":
33
+ return `L'expression d'une fonction affine est de la forme $ax+b$,
34
+ avec $a$ et $b$ des nombres réels.`;
35
+ case "linear":
36
+ return `L'expression d'une fonction linéaire est de la forme $ax$,
37
+ avec $a$ un nombre réel.`;
38
+ }
39
+ };
40
+ const getCorrection = (identifiers) => {
41
+ const { items, askedType } = identifiers;
42
+ const affines = items.filter((item) => item.fType === askedType);
43
+ const affineFNames = affines.map((item) => `$${item.fName}$`);
44
+ const affinesTex = affines.map((item) => {
45
+ return `$${item.fName}(x) = ${item.tex}$`;
46
+ });
47
+ switch (askedType) {
48
+ case "affine": {
49
+ return `${getStringCommaCommaAnd(affinesTex)} ${affinesTex.length > 1 ? `sont des expressions` : `est une expression`} de la forme $ax+b$,
50
+ avec $a$ et $b$ des nombres réels.
51
+
52
+ ${affines.map((item) => {
53
+ return `Pour $${item.fName}(x)$, $a=${item.a}$ et $b=${item.b}$.`;
54
+ }).join(`
55
+
56
+ `)}
57
+
58
+ ${affinesTex.length > 1
59
+ ? `Les fonctions affines sont`
60
+ : `La fonction affine est`} ${getStringCommaCommaAnd(affineFNames)}.`;
61
+ }
62
+ case "linear":
63
+ return `${getStringCommaCommaAnd(affinesTex)} ${affinesTex.length > 1 ? `sont des expressions` : `est une expression`} de la forme $ax$,
64
+ avec $a$ un nombre réel.
65
+
66
+ ${affines.map((item) => {
67
+ return `Pour $${item.fName}(x)$, $a=${item.a}$.`;
68
+ }).join(`
69
+
70
+ `)}
71
+
72
+ ${affinesTex.length > 1
73
+ ? `Les fonctions linéaires sont`
74
+ : `La fonction linéaire est`} ${getStringCommaCommaAnd(affineFNames)}.`;
75
+ }
76
+ };
77
+ const getPropositions = (_, { answer, ...identifiers }) => {
78
+ const { items, askedType } = identifiers;
79
+ const propositions = [];
80
+ items.forEach((item, _) => {
81
+ const tex = `${item.fName}(x) = ${item.tex}`;
82
+ if (item.fType === askedType) {
83
+ addValidProp(propositions, tex);
84
+ }
85
+ else {
86
+ tryToAddWrongProp(propositions, tex);
87
+ }
88
+ });
89
+ return propositions;
90
+ };
91
+ const getRecognizeExprAffineQuestion = (opts) => {
92
+ const askedType = opts.askedType;
93
+ const nbTotal = 4;
94
+ const createAffineNodeObj = (affineType, fType) => {
95
+ switch (affineType) {
96
+ case "affine": {
97
+ const a = randint(-10, 11, [0]);
98
+ const b = randint(-10, 11, [0]);
99
+ return {
100
+ node: AffineConstructor.fromCoeffs([b, a]).toTree(),
101
+ a,
102
+ b,
103
+ fType,
104
+ };
105
+ }
106
+ case "linear": {
107
+ const a = randint(-10, 11, [0]);
108
+ const b = 0;
109
+ return {
110
+ node: AffineConstructor.fromCoeffs([b, a]).toTree(),
111
+ a,
112
+ b,
113
+ fType,
114
+ };
115
+ }
116
+ case "constant": {
117
+ const a = 0;
118
+ const b = randint(-10, 11, [0]);
119
+ return {
120
+ node: b.toTree(),
121
+ a,
122
+ b,
123
+ fType,
124
+ };
125
+ }
126
+ }
127
+ };
128
+ const createNonAffineFuncNode = (nonAffineType) => {
129
+ switch (nonAffineType) {
130
+ case "trinomA": {
131
+ const a = randint(-10, 11, [0]);
132
+ return TrinomConstructor.fromCoeffs([0, 0, a]).toTree();
133
+ }
134
+ case "trinomAC": {
135
+ const a = randint(-10, 11, [0]);
136
+ const c = randint(-10, 11, [0]);
137
+ return TrinomConstructor.fromCoeffs([c, 0, a]).toTree();
138
+ }
139
+ case "inv": {
140
+ const a = randint(-10, 11, [0]);
141
+ return frac(a, "x".toTree());
142
+ }
143
+ case "invPlusB": {
144
+ const a = randint(-10, 11, [0]);
145
+ const b = randint(-10, 11, [0]);
146
+ const aInvX = frac(a, "x".toTree());
147
+ return add(aInvX, b);
148
+ }
149
+ }
150
+ };
151
+ let affinesObj;
152
+ let arrayOfFillerObj;
153
+ switch (askedType) {
154
+ case "affine":
155
+ {
156
+ const nbAffineMore = probaLawFlip([
157
+ [0, 0.7],
158
+ [1, 0.25],
159
+ [2, 0.04],
160
+ [3, 0.01],
161
+ ]);
162
+ affinesObj = [
163
+ createAffineNodeObj("affine", "affine"),
164
+ ...[...Array(nbAffineMore).keys()].map((_) => {
165
+ return createAffineNodeObj(probaLawFlip([
166
+ ["affine", 0.5],
167
+ ["linear", 0.45],
168
+ ["constant", 0.05],
169
+ ]), "affine");
170
+ }),
171
+ ];
172
+ const nbFiller = nbTotal - (nbAffineMore + 1);
173
+ arrayOfFillerObj = [...Array(nbFiller).keys()].map((_) => {
174
+ const fType = probaLawFlip([
175
+ ["trinomA", 0.35],
176
+ ["trinomAC", 0.35],
177
+ ["inv", 0.15],
178
+ ["invPlusB", 0.15],
179
+ ]);
180
+ return { node: createNonAffineFuncNode(fType), fType };
181
+ });
182
+ }
183
+ break;
184
+ case "linear":
185
+ {
186
+ const nbLinearMore = probaLawFlip([
187
+ [0, 0.7],
188
+ [1, 0.25],
189
+ [2, 0.04],
190
+ [3, 0.01],
191
+ ]);
192
+ affinesObj = [
193
+ createAffineNodeObj("linear", "linear"),
194
+ ...[...Array(nbLinearMore).keys()].map((_) => {
195
+ return createAffineNodeObj("linear", "linear");
196
+ }),
197
+ ];
198
+ const nbFiller = nbTotal - (nbLinearMore + 1);
199
+ arrayOfFillerObj = [...Array(nbFiller).keys()].map((_) => {
200
+ if (coinFlip()) {
201
+ const fType = probaLawFlip([
202
+ ["affine", 0.55],
203
+ ["constant", 0.45],
204
+ ]);
205
+ return {
206
+ node: createAffineNodeObj(fType, fType).node,
207
+ fType,
208
+ };
209
+ }
210
+ else {
211
+ const fType = probaLawFlip([
212
+ ["trinomA", 0.35],
213
+ ["trinomAC", 0.35],
214
+ ["inv", 0.15],
215
+ ["invPlusB", 0.15],
216
+ ]);
217
+ return {
218
+ node: createNonAffineFuncNode(fType),
219
+ fType,
220
+ };
221
+ }
222
+ });
223
+ }
224
+ break;
225
+ }
226
+ const shuffledArray = shuffle([...affinesObj, ...arrayOfFillerObj]);
227
+ const items = shuffledArray.map(({ node, fType, a, b }, i) => {
228
+ const tex = coinFlip()
229
+ ? node.toTex()
230
+ : NodeShuffler.deepShuffle(node).toTex();
231
+ return {
232
+ tex: tex,
233
+ fType,
234
+ fName: fNames[i],
235
+ a,
236
+ b,
237
+ };
238
+ });
239
+ const identifiers = { items, askedType };
240
+ return getQuestionFromIdentifiers(identifiers);
241
+ };
242
+ const getQuestionFromIdentifiers = (identifiers) => {
243
+ const question = {
244
+ instruction: getInstruction(identifiers),
245
+ keys: [],
246
+ answerFormat: "tex",
247
+ identifiers,
248
+ hint: getHint(identifiers),
249
+ correction: getCorrection(identifiers),
250
+ };
251
+ return question;
252
+ };
253
+ export const recognizeExprAffine = {
254
+ id: "recognizeExprAffine",
255
+ label: "Reconnaître l’expression d’une fonction affine",
256
+ isSingleStep: true,
257
+ generator: (nb) => getDistinctQuestions(() => getRecognizeExprAffineQuestion({
258
+ askedType: "affine",
259
+ }), nb),
260
+ qcmTimer: 60,
261
+ freeTimer: 60,
262
+ getPropositions,
263
+ subject: "Mathématiques",
264
+ getQuestionFromIdentifiers,
265
+ hasHintAndCorrection: true,
266
+ answerType: "QCM",
267
+ isQCM: true,
268
+ };
269
+ export const recognizeExprLinear = {
270
+ id: "recognizeExprLinear",
271
+ label: "Reconnaître l’expression d’une fonction linéaire",
272
+ isSingleStep: true,
273
+ generator: (nb) => getDistinctQuestions(() => getRecognizeExprAffineQuestion({
274
+ askedType: "linear",
275
+ }), nb),
276
+ qcmTimer: 60,
277
+ freeTimer: 60,
278
+ getPropositions,
279
+ subject: "Mathématiques",
280
+ getQuestionFromIdentifiers,
281
+ hasHintAndCorrection: true,
282
+ answerType: "QCM",
283
+ isQCM: true,
284
+ };
@@ -0,0 +1,16 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ import { PointIdentifiers } from "../../../../math/geometry/point.js";
3
+ type Item = {
4
+ tex: string;
5
+ isValid: boolean;
6
+ point?: PointIdentifiers | undefined;
7
+ isPointValid?: boolean;
8
+ };
9
+ type Identifiers = {
10
+ fName: string;
11
+ coeffs: number[];
12
+ items: Item[];
13
+ };
14
+ export declare const representationOfAffine: Exercise<Identifiers>;
15
+ export {};
16
+ //# sourceMappingURL=representationOfAffine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"representationOfAffine.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/affines/representationOfAffine.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAWT,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAGL,gBAAgB,EACjB,MAAM,8BAA8B,CAAC;AAWtC,KAAK,IAAI,GAAG;IACV,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,gBAAgB,GAAG,SAAS,CAAC;IACrC,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,CAAC;AAEF,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,KAAK,EAAE,IAAI,EAAE,CAAC;CACf,CAAC;AAmWF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,CAexD,CAAC"}