math-exercises 3.0.172 → 3.0.174

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 (230) hide show
  1. package/lib/exercises/math/functions/trinoms/devForm/variationsFromAlgebricForm.d.ts.map +1 -1
  2. package/lib/exercises/math/functions/trinoms/devForm/variationsFromAlgebricForm.js +12 -0
  3. package/lib/exercises/math/functions/trinoms/parabole/index.d.ts +2 -0
  4. package/lib/exercises/math/functions/trinoms/parabole/index.d.ts.map +1 -1
  5. package/lib/exercises/math/functions/trinoms/parabole/index.js +2 -0
  6. package/lib/exercises/math/functions/trinoms/parabole/parabolaVarTable.d.ts +8 -0
  7. package/lib/exercises/math/functions/trinoms/parabole/parabolaVarTable.d.ts.map +1 -0
  8. package/lib/exercises/math/functions/trinoms/parabole/parabolaVarTable.js +106 -0
  9. package/lib/exercises/math/functions/trinoms/parabole/paraboleSolveGraphEquation.d.ts +14 -0
  10. package/lib/exercises/math/functions/trinoms/parabole/paraboleSolveGraphEquation.d.ts.map +1 -0
  11. package/lib/exercises/math/functions/trinoms/parabole/paraboleSolveGraphEquation.js +186 -0
  12. package/lib/exercises/math/functions/trinoms/roots/rootsFromDevForm.d.ts.map +1 -1
  13. package/lib/exercises/math/functions/trinoms/roots/rootsFromDevForm.js +0 -1
  14. package/lib/exercises/math/functions/trinoms/summitAndCanonical/extremumTypeFromAlgebricForm.d.ts +6 -2
  15. package/lib/exercises/math/functions/trinoms/summitAndCanonical/extremumTypeFromAlgebricForm.d.ts.map +1 -1
  16. package/lib/exercises/math/functions/trinoms/summitAndCanonical/extremumTypeFromAlgebricForm.js +98 -13
  17. package/lib/exercises/math/geometry/lines/index.d.ts +1 -0
  18. package/lib/exercises/math/geometry/lines/index.d.ts.map +1 -1
  19. package/lib/exercises/math/geometry/lines/index.js +1 -0
  20. package/lib/exercises/math/geometry/lines/readLineNormalVectorOnGraph.d.ts +13 -0
  21. package/lib/exercises/math/geometry/lines/readLineNormalVectorOnGraph.d.ts.map +1 -0
  22. package/lib/exercises/math/geometry/lines/readLineNormalVectorOnGraph.js +195 -0
  23. package/lib/exercises/math/probaStat/randomVariable/index.d.ts +1 -0
  24. package/lib/exercises/math/probaStat/randomVariable/index.d.ts.map +1 -1
  25. package/lib/exercises/math/probaStat/randomVariable/index.js +1 -0
  26. package/lib/exercises/math/probaStat/randomVariable/missingValueInRandomVariableProbabilityLaw.d.ts +9 -0
  27. package/lib/exercises/math/probaStat/randomVariable/missingValueInRandomVariableProbabilityLaw.d.ts.map +1 -0
  28. package/lib/exercises/math/probaStat/randomVariable/missingValueInRandomVariableProbabilityLaw.js +119 -0
  29. package/lib/exercises/math/probaStat/trees/buildTreeFromSituation.d.ts +2 -0
  30. package/lib/exercises/math/probaStat/trees/buildTreeFromSituation.d.ts.map +1 -0
  31. package/lib/exercises/math/probaStat/trees/buildTreeFromSituation.js +68 -0
  32. package/lib/exercises/math/probaStat/trees/fillProbaTreeWithComplementaryProbabilities.d.ts +15 -0
  33. package/lib/exercises/math/probaStat/trees/fillProbaTreeWithComplementaryProbabilities.d.ts.map +1 -0
  34. package/lib/exercises/math/probaStat/trees/fillProbaTreeWithComplementaryProbabilities.js +206 -0
  35. package/lib/exercises/math/probaStat/trees/probaTreeSituations.d.ts +2 -0
  36. package/lib/exercises/math/probaStat/trees/probaTreeSituations.d.ts.map +1 -0
  37. package/lib/exercises/math/probaStat/trees/probaTreeSituations.js +108 -0
  38. package/lib/exercises/math/probaStat/trees/probabilityTree.d.ts +25 -0
  39. package/lib/exercises/math/probaStat/trees/probabilityTree.d.ts.map +1 -0
  40. package/lib/exercises/math/probaStat/trees/probabilityTree.js +625 -0
  41. package/lib/exercises/math/probaStat/trees/treeInAnswer.d.ts +9 -0
  42. package/lib/exercises/math/probaStat/trees/treeInAnswer.d.ts.map +1 -0
  43. package/lib/exercises/math/probaStat/trees/treeInAnswer.js +107 -0
  44. package/lib/exercises/math/python/sequences/index.d.ts +8 -0
  45. package/lib/exercises/math/python/sequences/index.d.ts.map +1 -0
  46. package/lib/exercises/math/python/sequences/index.js +7 -0
  47. package/lib/exercises/math/python/sequences/pySequenceFactorialInstructionFalseOneOut.d.ts +11 -0
  48. package/lib/exercises/math/python/sequences/pySequenceFactorialInstructionFalseOneOut.d.ts.map +1 -0
  49. package/lib/exercises/math/python/sequences/pySequenceFactorialInstructionFalseOneOut.js +274 -0
  50. package/lib/exercises/math/python/sequences/pySequenceFirstTermsListInstructionCompletion.d.ts +12 -0
  51. package/lib/exercises/math/python/sequences/pySequenceFirstTermsListInstructionCompletion.d.ts.map +1 -0
  52. package/lib/exercises/math/python/sequences/pySequenceFirstTermsListInstructionCompletion.js +368 -0
  53. package/lib/exercises/math/python/sequences/pySequenceFirstTermsSumInstructionCompletion.d.ts +13 -0
  54. package/lib/exercises/math/python/sequences/pySequenceFirstTermsSumInstructionCompletion.d.ts.map +1 -0
  55. package/lib/exercises/math/python/sequences/pySequenceFirstTermsSumInstructionCompletion.js +254 -0
  56. package/lib/exercises/math/python/sequences/pySequenceProgramReading.d.ts +14 -0
  57. package/lib/exercises/math/python/sequences/pySequenceProgramReading.d.ts.map +1 -0
  58. package/lib/exercises/math/python/sequences/pySequenceProgramReading.js +365 -0
  59. package/lib/exercises/math/python/sequences/pySequenceTermForLoopInstructionCompletion.d.ts +11 -0
  60. package/lib/exercises/math/python/sequences/pySequenceTermForLoopInstructionCompletion.d.ts.map +1 -0
  61. package/lib/exercises/math/python/sequences/pySequenceTermForLoopInstructionCompletion.js +298 -0
  62. package/lib/exercises/math/python/sequences/pySequenceTermFromFunctionCallInstructionCompletion.d.ts +12 -0
  63. package/lib/exercises/math/python/sequences/pySequenceTermFromFunctionCallInstructionCompletion.d.ts.map +1 -0
  64. package/lib/exercises/math/python/sequences/pySequenceTermFromFunctionCallInstructionCompletion.js +408 -0
  65. package/lib/exercises/math/python/sequences/pySequenceThresholdInstructionCompletion.d.ts +17 -0
  66. package/lib/exercises/math/python/sequences/pySequenceThresholdInstructionCompletion.d.ts.map +1 -0
  67. package/lib/exercises/math/python/sequences/pySequenceThresholdInstructionCompletion.js +498 -0
  68. package/lib/exercises/math/sequences/arithmetic/arithmeticFindExplicitFormulaFromTwoTerms.d.ts +12 -0
  69. package/lib/exercises/math/sequences/arithmetic/arithmeticFindExplicitFormulaFromTwoTerms.d.ts.map +1 -0
  70. package/lib/exercises/math/sequences/arithmetic/arithmeticFindExplicitFormulaFromTwoTerms.js +191 -0
  71. package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindExplicitFormulaFromSituation.d.ts +14 -0
  72. package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindExplicitFormulaFromSituation.d.ts.map +1 -0
  73. package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindExplicitFormulaFromSituation.js +153 -0
  74. package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindRankFromSituation.d.ts +15 -0
  75. package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindRankFromSituation.d.ts.map +1 -0
  76. package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindRankFromSituation.js +184 -0
  77. package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindRecurrenceFormulaFromSituation.d.ts +14 -0
  78. package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindRecurrenceFormulaFromSituation.d.ts.map +1 -0
  79. package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindRecurrenceFormulaFromSituation.js +210 -0
  80. package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindTermFromSituation.d.ts +15 -0
  81. package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindTermFromSituation.d.ts.map +1 -0
  82. package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindTermFromSituation.js +161 -0
  83. package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindThresholdFromSituation.d.ts +17 -0
  84. package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindThresholdFromSituation.d.ts.map +1 -0
  85. package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindThresholdFromSituation.js +188 -0
  86. package/lib/exercises/math/sequences/arithmetic/situations/index.d.ts +6 -0
  87. package/lib/exercises/math/sequences/arithmetic/situations/index.d.ts.map +1 -0
  88. package/lib/exercises/math/sequences/arithmetic/situations/index.js +5 -0
  89. package/lib/exercises/math/sequences/arithmetic/sum/arithmeticComputeSumWithDots.d.ts +15 -0
  90. package/lib/exercises/math/sequences/arithmetic/sum/arithmeticComputeSumWithDots.d.ts.map +1 -0
  91. package/lib/exercises/math/sequences/arithmetic/sum/arithmeticComputeSumWithDots.js +233 -0
  92. package/lib/exercises/math/sequences/arithmetic/sum/arithmeticFirstTermsSum.d.ts +13 -0
  93. package/lib/exercises/math/sequences/arithmetic/sum/arithmeticFirstTermsSum.d.ts.map +1 -0
  94. package/lib/exercises/math/sequences/arithmetic/sum/arithmeticFirstTermsSum.js +111 -0
  95. package/lib/exercises/math/sequences/arithmetic/sum/arithmeticFirstTermsSumThreshold.d.ts +13 -0
  96. package/lib/exercises/math/sequences/arithmetic/sum/arithmeticFirstTermsSumThreshold.d.ts.map +1 -0
  97. package/lib/exercises/math/sequences/arithmetic/sum/arithmeticFirstTermsSumThreshold.js +216 -0
  98. package/lib/exercises/math/sequences/arithmetic/sum/firstIntegersSum.d.ts +7 -0
  99. package/lib/exercises/math/sequences/arithmetic/sum/firstIntegersSum.d.ts.map +1 -0
  100. package/lib/exercises/math/sequences/arithmetic/sum/firstIntegersSum.js +94 -0
  101. package/lib/exercises/math/sequences/arithmetic/sum/index.d.ts +5 -0
  102. package/lib/exercises/math/sequences/arithmetic/sum/index.d.ts.map +1 -0
  103. package/lib/exercises/math/sequences/arithmetic/sum/index.js +4 -0
  104. package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormula.js +1 -1
  105. package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFirstRankOne.js +1 -1
  106. package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFirstTermRandom.d.ts +4 -1
  107. package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFirstTermRandom.d.ts.map +1 -1
  108. package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFirstTermRandom.js +66 -24
  109. package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFromTwoTerms.d.ts +14 -0
  110. package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFromTwoTerms.d.ts.map +1 -0
  111. package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFromTwoTerms.js +301 -0
  112. package/lib/exercises/math/sequences/geometric/geometricFindRandomTermFromTwoTerms.d.ts +15 -0
  113. package/lib/exercises/math/sequences/geometric/geometricFindRandomTermFromTwoTerms.d.ts.map +1 -0
  114. package/lib/exercises/math/sequences/geometric/geometricFindRandomTermFromTwoTerms.js +260 -0
  115. package/lib/exercises/math/sequences/geometric/situations/geometricFindExplicitFormulaFromSituation.d.ts +14 -0
  116. package/lib/exercises/math/sequences/geometric/situations/geometricFindExplicitFormulaFromSituation.d.ts.map +1 -0
  117. package/lib/exercises/math/sequences/geometric/situations/geometricFindExplicitFormulaFromSituation.js +186 -0
  118. package/lib/exercises/math/sequences/geometric/situations/geometricFindRankFromSituation.d.ts +15 -0
  119. package/lib/exercises/math/sequences/geometric/situations/geometricFindRankFromSituation.d.ts.map +1 -0
  120. package/lib/exercises/math/sequences/geometric/situations/geometricFindRankFromSituation.js +142 -0
  121. package/lib/exercises/math/sequences/geometric/situations/geometricFindRecurrenceFormulaFromSituation.d.ts +14 -0
  122. package/lib/exercises/math/sequences/geometric/situations/geometricFindRecurrenceFormulaFromSituation.d.ts.map +1 -0
  123. package/lib/exercises/math/sequences/geometric/situations/geometricFindRecurrenceFormulaFromSituation.js +205 -0
  124. package/lib/exercises/math/sequences/geometric/situations/geometricFindTermFromSituation.d.ts +15 -0
  125. package/lib/exercises/math/sequences/geometric/situations/geometricFindTermFromSituation.d.ts.map +1 -0
  126. package/lib/exercises/math/sequences/geometric/situations/geometricFindTermFromSituation.js +208 -0
  127. package/lib/exercises/math/sequences/geometric/situations/geometricFindThresholdFromSituation.d.ts +17 -0
  128. package/lib/exercises/math/sequences/geometric/situations/geometricFindThresholdFromSituation.d.ts.map +1 -0
  129. package/lib/exercises/math/sequences/geometric/situations/geometricFindThresholdFromSituation.js +152 -0
  130. package/lib/exercises/math/sequences/geometric/situations/index.d.ts +4 -0
  131. package/lib/exercises/math/sequences/geometric/situations/index.d.ts.map +1 -0
  132. package/lib/exercises/math/sequences/geometric/situations/index.js +5 -0
  133. package/lib/exercises/math/sequences/geometric/sum/geometricComputeSumWithDots.d.ts +15 -0
  134. package/lib/exercises/math/sequences/geometric/sum/geometricComputeSumWithDots.d.ts.map +1 -0
  135. package/lib/exercises/math/sequences/geometric/sum/geometricComputeSumWithDots.js +248 -0
  136. package/lib/exercises/math/sequences/geometric/sum/geometricFirstTermsGeneralSum.d.ts +14 -0
  137. package/lib/exercises/math/sequences/geometric/sum/geometricFirstTermsGeneralSum.d.ts.map +1 -0
  138. package/lib/exercises/math/sequences/geometric/sum/geometricFirstTermsGeneralSum.js +126 -0
  139. package/lib/exercises/math/sequences/geometric/sum/geometricFirstTermsSum.d.ts +8 -0
  140. package/lib/exercises/math/sequences/geometric/sum/geometricFirstTermsSum.d.ts.map +1 -0
  141. package/lib/exercises/math/sequences/geometric/sum/geometricFirstTermsSum.js +91 -0
  142. package/lib/exercises/math/sequences/geometric/sum/index.d.ts +4 -0
  143. package/lib/exercises/math/sequences/geometric/sum/index.d.ts.map +1 -0
  144. package/lib/exercises/math/sequences/geometric/sum/index.js +3 -0
  145. package/lib/exercises/math/sequences/seqArithmGeom/index.d.ts +2 -0
  146. package/lib/exercises/math/sequences/seqArithmGeom/index.d.ts.map +1 -0
  147. package/lib/exercises/math/sequences/seqArithmGeom/index.js +1 -0
  148. package/lib/exercises/math/sequences/seqArithmGeom/seqArithmGeomRecurrenceFormulaUsage.d.ts +14 -0
  149. package/lib/exercises/math/sequences/seqArithmGeom/seqArithmGeomRecurrenceFormulaUsage.d.ts.map +1 -0
  150. package/lib/exercises/math/sequences/seqArithmGeom/seqArithmGeomRecurrenceFormulaUsage.js +202 -0
  151. package/lib/exercises/math/trigonometry/circle/index.d.ts +1 -0
  152. package/lib/exercises/math/trigonometry/circle/index.d.ts.map +1 -1
  153. package/lib/exercises/math/trigonometry/circle/index.js +1 -0
  154. package/lib/exercises/math/trigonometry/circle/selectQuadrantOnTrigoCircle.d.ts +2 -0
  155. package/lib/exercises/math/trigonometry/circle/selectQuadrantOnTrigoCircle.d.ts.map +1 -0
  156. package/lib/exercises/math/trigonometry/circle/selectQuadrantOnTrigoCircle.js +94 -0
  157. package/lib/exercises/math/trigonometry/circle/trigoFunctionsFundamentalEquation.d.ts +10 -0
  158. package/lib/exercises/math/trigonometry/circle/trigoFunctionsFundamentalEquation.d.ts.map +1 -0
  159. package/lib/exercises/math/trigonometry/circle/trigoFunctionsFundamentalEquation.js +223 -0
  160. package/lib/exercises/math/trigonometry/functions/basicEquationCos.d.ts.map +1 -1
  161. package/lib/exercises/math/trigonometry/functions/basicEquationCos.js +2 -1
  162. package/lib/exercises/math/trigonometry/functions/cosInequationMainInterval.d.ts +10 -0
  163. package/lib/exercises/math/trigonometry/functions/cosInequationMainInterval.d.ts.map +1 -0
  164. package/lib/exercises/math/trigonometry/functions/cosInequationMainInterval.js +208 -0
  165. package/lib/exercises/math/trigonometry/functions/equationSinOnRandomInterval.d.ts +0 -6
  166. package/lib/exercises/math/trigonometry/functions/equationSinOnRandomInterval.d.ts.map +1 -1
  167. package/lib/exercises/math/trigonometry/functions/equationSinOnRandomInterval.js +162 -99
  168. package/lib/exercises/math/trigonometry/functions/index.d.ts +3 -0
  169. package/lib/exercises/math/trigonometry/functions/index.d.ts.map +1 -1
  170. package/lib/exercises/math/trigonometry/functions/index.js +3 -0
  171. package/lib/exercises/math/trigonometry/functions/readPeriodicityOnFunctionGraph.d.ts +12 -0
  172. package/lib/exercises/math/trigonometry/functions/readPeriodicityOnFunctionGraph.d.ts.map +1 -0
  173. package/lib/exercises/math/trigonometry/functions/readPeriodicityOnFunctionGraph.js +159 -0
  174. package/lib/exercises/math/trigonometry/functions/sinInequationMainInterval.d.ts +10 -0
  175. package/lib/exercises/math/trigonometry/functions/sinInequationMainInterval.d.ts.map +1 -0
  176. package/lib/exercises/math/trigonometry/functions/sinInequationMainInterval.js +224 -0
  177. package/lib/exercises/math/trigonometry/trigoFundamentalEquation.js +1 -1
  178. package/lib/exercises/options/optionFirstTermRankOne.d.ts +16 -0
  179. package/lib/exercises/options/optionFirstTermRankOne.d.ts.map +1 -0
  180. package/lib/exercises/options/optionFirstTermRankOne.js +17 -0
  181. package/lib/exercises/options/optionIsUsePythonDef.d.ts +16 -0
  182. package/lib/exercises/options/optionIsUsePythonDef.d.ts.map +1 -0
  183. package/lib/exercises/options/optionIsUsePythonDef.js +17 -0
  184. package/lib/exercises/options/optionIsWithSuperfluousData.d.ts +16 -0
  185. package/lib/exercises/options/optionIsWithSuperfluousData.d.ts.map +1 -0
  186. package/lib/exercises/options/optionIsWithSuperfluousData.js +17 -0
  187. package/lib/exercises/utils/geogebra/toGGBCommandsProps.d.ts +1 -0
  188. package/lib/exercises/utils/geogebra/toGGBCommandsProps.d.ts.map +1 -1
  189. package/lib/exercises/vea/colinearVectorVEA.d.ts +2 -0
  190. package/lib/exercises/vea/colinearVectorVEA.d.ts.map +1 -0
  191. package/lib/exercises/vea/colinearVectorVEA.js +11 -0
  192. package/lib/exercises/vea/treeTableVEA.d.ts +2 -0
  193. package/lib/exercises/vea/treeTableVEA.d.ts.map +1 -0
  194. package/lib/exercises/vea/treeTableVEA.js +7 -0
  195. package/lib/exercises/vea/varLineVEA.d.ts.map +1 -1
  196. package/lib/exercises/vea/varLineVEA.js +5 -2
  197. package/lib/index.d.ts +44 -3
  198. package/lib/index.d.ts.map +1 -1
  199. package/lib/math/geometry/line.d.ts +1 -1
  200. package/lib/math/geometry/line.d.ts.map +1 -1
  201. package/lib/math/geometry/line.js +3 -3
  202. package/lib/math/geometry/point.d.ts +1 -1
  203. package/lib/math/geometry/point.d.ts.map +1 -1
  204. package/lib/math/geometry/point.js +4 -1
  205. package/lib/math/utils/sequences/situations/seqArithmeticSituations.d.ts +53 -0
  206. package/lib/math/utils/sequences/situations/seqArithmeticSituations.d.ts.map +1 -0
  207. package/lib/math/utils/sequences/situations/seqArithmeticSituations.js +1928 -0
  208. package/lib/math/utils/sequences/situations/seqArithmeticUtils.d.ts +15 -0
  209. package/lib/math/utils/sequences/situations/seqArithmeticUtils.d.ts.map +1 -0
  210. package/lib/math/utils/sequences/situations/seqArithmeticUtils.js +136 -0
  211. package/lib/math/utils/sequences/situations/seqGeometricSituations.d.ts +42 -0
  212. package/lib/math/utils/sequences/situations/seqGeometricSituations.d.ts.map +1 -0
  213. package/lib/math/utils/sequences/situations/seqGeometricSituations.js +932 -0
  214. package/lib/math/utils/sequences/situations/seqGeometricUtils.d.ts +12 -0
  215. package/lib/math/utils/sequences/situations/seqGeometricUtils.d.ts.map +1 -0
  216. package/lib/math/utils/sequences/situations/seqGeometricUtils.js +90 -0
  217. package/lib/tests/exosTest.d.ts.map +1 -1
  218. package/lib/tests/exosTest.js +0 -2
  219. package/lib/tree/nodes/inequations/inequationNode.d.ts +1 -0
  220. package/lib/tree/nodes/inequations/inequationNode.d.ts.map +1 -1
  221. package/lib/tree/nodes/inequations/inequationNode.js +16 -0
  222. package/lib/tree/nodes/operators/binomialCoefficientNode.d.ts +3 -3
  223. package/lib/tree/nodes/operators/binomialCoefficientNode.d.ts.map +1 -1
  224. package/lib/tree/nodes/operators/binomialCoefficientNode.js +6 -3
  225. package/lib/tree/parsers/vectorParser.d.ts.map +1 -1
  226. package/lib/tree/parsers/vectorParser.js +8 -0
  227. package/lib/utils/latex/poundify.d.ts +2 -0
  228. package/lib/utils/latex/poundify.d.ts.map +1 -0
  229. package/lib/utils/latex/poundify.js +3 -0
  230. package/package.json +1 -1
@@ -0,0 +1,408 @@
1
+ import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
2
+ import { getOptionFirstTermRankOneStuff, } from "../../../../exercises/options/optionFirstTermRankOne.js";
3
+ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
4
+ import { Trinom } from "../../../../math/polynomials/trinom.js";
5
+ import { randfloat } from "../../../../math/utils/random/randfloat.js";
6
+ import { randint } from "../../../../math/utils/random/randint.js";
7
+ import { add } from "../../../../tree/nodes/operators/addNode.js";
8
+ import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
9
+ import { substract } from "../../../../tree/nodes/operators/substractNode.js";
10
+ import { coinFlip } from "../../../../utils/alea/coinFlip.js";
11
+ import { random } from "../../../../utils/alea/random.js";
12
+ import { alignTex } from "../../../../utils/latex/alignTex.js";
13
+ const codify = (strPython) => {
14
+ return `\`\`\`python
15
+ ${strPython}
16
+ \`\`\``;
17
+ };
18
+ const codifyChunk = (strPython) => {
19
+ return `\`${strPython}\``;
20
+ };
21
+ const createStrPythonForNodeFX = (nodeUNext) => {
22
+ return nodeUNext
23
+ .toMathString()
24
+ .replaceAll("u_{n}", "x")
25
+ .replaceAll("^", "**");
26
+ };
27
+ const createNodeUNext = (coeffs) => {
28
+ const nodeUn = "u_{n}".toTree();
29
+ let nodeUNext;
30
+ const [c, b, a] = coeffs;
31
+ if (a !== undefined) {
32
+ //trinom recur
33
+ const trinom = new Trinom(a, b, c, { variable: nodeUn.toTex() });
34
+ nodeUNext = trinom.toTree();
35
+ }
36
+ else if (b !== undefined) {
37
+ if (c !== 0) {
38
+ //arithmetico-geometric (=== affine recur)
39
+ nodeUNext = add(multiply(b, nodeUn), c);
40
+ }
41
+ else {
42
+ //geometric
43
+ nodeUNext = multiply(b, nodeUn);
44
+ }
45
+ }
46
+ else {
47
+ //arithmetic
48
+ nodeUNext = add(nodeUn, c);
49
+ }
50
+ return nodeUNext;
51
+ };
52
+ const getStrPythonProgramComplete = (identifiers, opts) => {
53
+ const identifiersTweaked = {
54
+ ...identifiers,
55
+ keyIncomplete: "",
56
+ };
57
+ return getStrPythonProgramIncomplete(identifiersTweaked, opts);
58
+ };
59
+ const getStrPythonProgramIncomplete = (identifiers, opts) => {
60
+ const { firstValue, keyIncomplete } = identifiers;
61
+ const { strFXReturn, strForLoop, strUEquals, strTermeUN } = Object.fromEntries(Object.entries(getDictStrCompletion(identifiers, opts)).map(([key, str]) => (key === keyIncomplete ? [key, "..."] : [key, str])));
62
+ return `def f(x):
63
+ ${strFXReturn}
64
+
65
+ def terme_u(n):
66
+ u = ${firstValue}
67
+ ${strForLoop}
68
+ ${strUEquals}
69
+ return u
70
+
71
+ print(${strTermeUN})
72
+ `;
73
+ };
74
+ const getDictStrCompletion = (identifiers, opts) => {
75
+ const firstRank = opts.firstTermRankOne ? 1 : 0;
76
+ const { rankAsked, coeffs } = identifiers;
77
+ const nodeUNext = createNodeUNext(coeffs);
78
+ return {
79
+ strFXReturn: `return ${createStrPythonForNodeFX(nodeUNext)}`,
80
+ strForLoop: `for i in range(${substract("n".toTree(), firstRank)
81
+ .simplify()
82
+ .toTex()}):`,
83
+ strUEquals: `u = f(u)`,
84
+ strTermeUN: `terme_u(${rankAsked})`,
85
+ };
86
+ };
87
+ const getInstruction = (identifiers, optsIn) => {
88
+ const opts = optsIn ?? optsDefault;
89
+ const firstRank = opts.firstTermRankOne ? 1 : 0;
90
+ const { firstValue, rankAsked, coeffs } = identifiers;
91
+ const nodeUNext = createNodeUNext(coeffs);
92
+ return `On considère la suite $(u_{n})$ définie par
93
+
94
+ ${alignTex([
95
+ [`u_{${firstRank}}`, "=", `${firstValue.frenchify()}`],
96
+ [`u_{n+1}`, "=", `${nodeUNext.toTex()}`],
97
+ ])}
98
+
99
+ Par quoi faut-il remplacer les pointillés dans le programme suivant pour calculer $u_{${rankAsked}}$ ?
100
+
101
+ ${codify(getStrPythonProgramIncomplete(identifiers, opts))}
102
+
103
+ `;
104
+ };
105
+ const getAnswer = (identifiers, optsIn) => {
106
+ const opts = optsIn ?? optsDefault;
107
+ const { keyIncomplete } = identifiers;
108
+ const dictStrCompletion = getDictStrCompletion(identifiers, opts);
109
+ return codifyChunk(dictStrCompletion[keyIncomplete]);
110
+ };
111
+ const getHint = (identifiers) => {
112
+ const { keyIncomplete } = identifiers;
113
+ switch (keyIncomplete) {
114
+ case "strFXReturn":
115
+ return `La fonction $f$ implémente la formule de récurrence. Attention, l'argument de la fonction $f$ est nommé $x$ et pas $u$.`;
116
+ case "strForLoop":
117
+ return `Écris une boucle avec le bon nombre d'itérations`;
118
+ case "strUEquals":
119
+ return `Quel est la variable que retourne la fonction ${codifyChunk("terme_u")} ?
120
+ À chaque itération, on doit lui affecter une nouvelle valeur (celle que l'on crée en utilisant la formule de récurrence).`;
121
+ case "strTermeUN":
122
+ return `Utilise un appel de fonction avec le(s) bon(s) paramètre(s).`;
123
+ default:
124
+ throw new Error("Unsupported keyIncomplete: " + keyIncomplete);
125
+ }
126
+ };
127
+ const getCorrection = (identifiers, optsIn) => {
128
+ const opts = optsIn ?? optsDefault;
129
+ const { rankAsked } = identifiers;
130
+ return `Voici le programme complet pour afficher $u_{${rankAsked}}$
131
+
132
+ ${codify(getStrPythonProgramComplete(identifiers, opts))}
133
+
134
+ `;
135
+ };
136
+ const getPropositions = (n, { answer, ...identifiers }, optsIn) => {
137
+ const opts = optsIn ?? optsDefault;
138
+ const _firstRank = opts.firstTermRankOne ? 1 : 0;
139
+ const firstRankWrong = opts.firstTermRankOne ? 0 : 1;
140
+ const propositions = [];
141
+ addValidProp(propositions, answer, "raw");
142
+ const { coeffs, rankAsked, keyIncomplete } = identifiers;
143
+ switch (keyIncomplete) {
144
+ case "strFXReturn":
145
+ {
146
+ const nodeUNext = createNodeUNext(coeffs);
147
+ //student: forgets to add return
148
+ {
149
+ const strWrong = `${createStrPythonForNodeFX(nodeUNext)}`;
150
+ tryToAddWrongProp(propositions, codifyChunk(strWrong), "raw");
151
+ }
152
+ //students: x -> u
153
+ {
154
+ {
155
+ const strWrong = `return ${createStrPythonForNodeFX(nodeUNext)}`.replaceAll("x", "u");
156
+ tryToAddWrongProp(propositions, codifyChunk(strWrong), "raw");
157
+ }
158
+ {
159
+ const strWrong = `${createStrPythonForNodeFX(nodeUNext)}`.replaceAll("x", "u");
160
+ tryToAddWrongProp(propositions, codifyChunk(strWrong), "raw");
161
+ }
162
+ }
163
+ //students: x -> u(n)
164
+ {
165
+ {
166
+ const strWrong = `return ${createStrPythonForNodeFX(nodeUNext)}`.replaceAll("x", "u(n)");
167
+ tryToAddWrongProp(propositions, codifyChunk(strWrong), "raw");
168
+ }
169
+ {
170
+ const strWrong = `${createStrPythonForNodeFX(nodeUNext)}`.replaceAll("x", "u(n)");
171
+ tryToAddWrongProp(propositions, codifyChunk(strWrong), "raw");
172
+ }
173
+ }
174
+ //students: x -> terme_u(x)
175
+ {
176
+ {
177
+ const strWrong = `return ${createStrPythonForNodeFX(nodeUNext)}`.replaceAll("x", "terme_u(x)");
178
+ tryToAddWrongProp(propositions, codifyChunk(strWrong), "raw");
179
+ }
180
+ {
181
+ const strWrong = `${createStrPythonForNodeFX(nodeUNext)}`.replaceAll("x", "terme_u(x)");
182
+ tryToAddWrongProp(propositions, codifyChunk(strWrong), "raw");
183
+ }
184
+ }
185
+ }
186
+ break;
187
+ case "strForLoop":
188
+ {
189
+ //student: firstRankWrong
190
+ {
191
+ const strWrong = `for i in range(${substract("n".toTree(), firstRankWrong)
192
+ .simplify()
193
+ .toTex()}):`;
194
+ tryToAddWrongProp(propositions, codifyChunk(strWrong), "raw");
195
+ }
196
+ {
197
+ const strWrong = `for i in range(${add("n".toTree(), 1)
198
+ .simplify()
199
+ .toTex()}):`;
200
+ tryToAddWrongProp(propositions, codifyChunk(strWrong), "raw");
201
+ }
202
+ {
203
+ const strWrong = `for i in range(${Math.floor(rankAsked / 10)}):`;
204
+ tryToAddWrongProp(propositions, codifyChunk(strWrong), "raw");
205
+ }
206
+ //student: forgets to add :
207
+ {
208
+ {
209
+ const strWrong = `for i in range(${substract("n".toTree(), firstRankWrong)
210
+ .simplify()
211
+ .toTex()})`;
212
+ tryToAddWrongProp(propositions, codifyChunk(strWrong), "raw");
213
+ }
214
+ {
215
+ const strWrong = `for i in range(${add("n".toTree(), 1)
216
+ .simplify()
217
+ .toTex()})`;
218
+ tryToAddWrongProp(propositions, codifyChunk(strWrong), "raw");
219
+ }
220
+ {
221
+ const strWrong = `for i in range(${Math.floor(rankAsked / 10)})`;
222
+ tryToAddWrongProp(propositions, codifyChunk(strWrong), "raw");
223
+ }
224
+ }
225
+ }
226
+ break;
227
+ case "strUEquals":
228
+ {
229
+ const nodeUNext = createNodeUNext(coeffs);
230
+ //student: something with i
231
+ {
232
+ const strWrong = `u = f(i)`;
233
+ tryToAddWrongProp(propositions, codifyChunk(strWrong), "raw");
234
+ }
235
+ //student: u is a list
236
+ {
237
+ const strWrong = `u[i+1] = f(u[i])`;
238
+ tryToAddWrongProp(propositions, codifyChunk(strWrong), "raw");
239
+ }
240
+ // fait une tambouille avec i
241
+ {
242
+ const strProgramChunk = codifyChunk(`u = ${createStrPythonForNodeFX(nodeUNext).replaceAll("x", "i")}`);
243
+ tryToAddWrongProp(propositions, strProgramChunk, "raw");
244
+ }
245
+ // fait une tambouille avec n
246
+ {
247
+ const strProgramChunk = codifyChunk(`u(n+1) = f(u(n))`);
248
+ tryToAddWrongProp(propositions, strProgramChunk, "raw");
249
+ }
250
+ //terror: forgets to assign
251
+ {
252
+ const strWrong = random([`f(u)`, `f(i)`, `f(u[i])`, `f(u(n))`]);
253
+ tryToAddWrongProp(propositions, codifyChunk(strWrong), "raw");
254
+ }
255
+ }
256
+ break;
257
+ case "strTermeUN":
258
+ {
259
+ //student: rankAsked - 1
260
+ {
261
+ const strWrong = `terme_u(${rankAsked - 1})`;
262
+ tryToAddWrongProp(propositions, codifyChunk(strWrong), "raw");
263
+ }
264
+ //student: rankAsked + 1
265
+ {
266
+ const strWrong = `terme_u(${rankAsked + 1})`;
267
+ tryToAddWrongProp(propositions, codifyChunk(strWrong), "raw");
268
+ }
269
+ //student: u_n(rankAsked)
270
+ {
271
+ const strWrong = `u_n(${rankAsked})`;
272
+ tryToAddWrongProp(propositions, codifyChunk(strWrong), "raw");
273
+ if (coinFlip()) {
274
+ if (coinFlip()) {
275
+ const strWrong = `u_n(${rankAsked - 1})`;
276
+ tryToAddWrongProp(propositions, codifyChunk(strWrong), "raw");
277
+ }
278
+ else {
279
+ const strWrong = `u_n(${rankAsked + 1})`;
280
+ tryToAddWrongProp(propositions, codifyChunk(strWrong), "raw");
281
+ }
282
+ }
283
+ }
284
+ //student: u(rankAsked)
285
+ {
286
+ const strWrong = `u(${rankAsked})`;
287
+ tryToAddWrongProp(propositions, codifyChunk(strWrong), "raw");
288
+ if (coinFlip()) {
289
+ if (coinFlip()) {
290
+ const strWrong = `u(${rankAsked - 1})`;
291
+ tryToAddWrongProp(propositions, codifyChunk(strWrong), "raw");
292
+ }
293
+ else {
294
+ const strWrong = `u(${rankAsked + 1})`;
295
+ tryToAddWrongProp(propositions, codifyChunk(strWrong), "raw");
296
+ }
297
+ }
298
+ }
299
+ //student: u[rankAsked]
300
+ {
301
+ const strWrong = `u[${rankAsked}]`;
302
+ tryToAddWrongProp(propositions, codifyChunk(strWrong), "raw");
303
+ if (coinFlip()) {
304
+ if (coinFlip()) {
305
+ const strWrong = `u[${rankAsked - 1}]`;
306
+ tryToAddWrongProp(propositions, codifyChunk(strWrong), "raw");
307
+ }
308
+ else {
309
+ const strWrong = `u[${rankAsked + 1}]`;
310
+ tryToAddWrongProp(propositions, codifyChunk(strWrong), "raw");
311
+ }
312
+ }
313
+ }
314
+ //terror: ...(i)
315
+ {
316
+ const strWrong = random([`terme_u(i)`, `u_n(i)`, `u(i)`, `u[i]`]);
317
+ tryToAddWrongProp(propositions, codifyChunk(strWrong), "raw");
318
+ }
319
+ }
320
+ break;
321
+ default:
322
+ throw new Error("Unsupported keyIncomplete: " + keyIncomplete);
323
+ }
324
+ return shuffleProps(propositions, n);
325
+ };
326
+ const createRandomIdentifiers = (_opts) => {
327
+ const firstValue = randint(-10, 10);
328
+ const rankAsked = randint(500, 1001);
329
+ const coeffs = [];
330
+ const rand = randint(0, 4);
331
+ switch (rand) {
332
+ case 0:
333
+ {
334
+ //arithmetic
335
+ const c = randint(-10, 10, [0]);
336
+ coeffs.push(c);
337
+ }
338
+ break;
339
+ case 1:
340
+ {
341
+ //geometric
342
+ const c = 0;
343
+ const b = randfloat(-10, 10, 2, [0]);
344
+ coeffs.push(...[c, b]);
345
+ }
346
+ break;
347
+ case 2:
348
+ {
349
+ //arithmetico-geometric (=== affine recur)
350
+ const c = randint(-10, 10, [0]);
351
+ const b = randfloat(-10, 10, 2, [0]);
352
+ coeffs.push(...[c, b]);
353
+ }
354
+ break;
355
+ case 3:
356
+ {
357
+ //trinom recur
358
+ const c = randint(-10, 10, [0]);
359
+ const b = randfloat(-10, 10, 2, [0]);
360
+ const a = randint(-2, 3, [0]);
361
+ coeffs.push(...[c, b, a]);
362
+ }
363
+ break;
364
+ }
365
+ const keyIncomplete = random([
366
+ "strFXReturn",
367
+ "strForLoop",
368
+ "strUEquals",
369
+ "strTermeUN",
370
+ ]);
371
+ const identifiers = { firstValue, rankAsked, coeffs, keyIncomplete };
372
+ return identifiers;
373
+ };
374
+ const getPySequenceTermFromFunctionCallInstructionCompletionQuestion = (optsIn) => {
375
+ const opts = optsIn ?? optsDefault;
376
+ const identifiers = createRandomIdentifiers(opts);
377
+ return getQuestionFromIdentifiers(identifiers, opts);
378
+ };
379
+ const getQuestionFromIdentifiers = (identifiers, opts) => {
380
+ const question = {
381
+ answer: getAnswer(identifiers, opts),
382
+ instruction: getInstruction(identifiers, opts),
383
+ keys: [],
384
+ answerFormat: "tex",
385
+ identifiers,
386
+ hint: getHint(identifiers, opts),
387
+ correction: getCorrection(identifiers, opts),
388
+ options: opts,
389
+ };
390
+ return question;
391
+ };
392
+ const { optsDefaultFirstTermRankOne, generatorOptionFirstTermRankOne } = getOptionFirstTermRankOneStuff(false);
393
+ const optsDefault = Object.assign({}, optsDefaultFirstTermRankOne);
394
+ const options = [generatorOptionFirstTermRankOne];
395
+ export const pySequenceTermFromFunctionCallInstructionCompletion = {
396
+ id: "pySequenceTermFromFunctionCallInstructionCompletion",
397
+ label: "Compléter un algorithme de calcul de terme à l'aide d'une boucle \"for\" (avec fonction)",
398
+ isSingleStep: true,
399
+ generator: (nb, opts) => getDistinctQuestions(() => getPySequenceTermFromFunctionCallInstructionCompletionQuestion(opts), nb),
400
+ options,
401
+ qcmTimer: 60,
402
+ freeTimer: 60,
403
+ getPropositions,
404
+ subject: "Mathématiques",
405
+ getQuestionFromIdentifiers,
406
+ hasHintAndCorrection: true,
407
+ answerType: "QCU",
408
+ };
@@ -0,0 +1,17 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ import { OptionFirstTermRankOne } from "../../../../exercises/options/optionFirstTermRankOne.js";
3
+ import { OptionIsUsePythonDef } from "../../../../exercises/options/optionIsUsePythonDef.js";
4
+ import { NodeIdentifiers } from "../../../../tree/nodes/nodeConstructor.js";
5
+ type Identifiers = {
6
+ valueThreshold: number;
7
+ valueLimit: number;
8
+ nodeIdsDistanceMax: NodeIdentifiers;
9
+ keyIncomplete: string;
10
+ };
11
+ type Options = OptionFirstTermRankOne & OptionIsUsePythonDef & {
12
+ isUsePythonList: boolean;
13
+ typeSequence: string;
14
+ };
15
+ export declare const pySequenceThresholdInstructionCompletion: Exercise<Identifiers, Options>;
16
+ export {};
17
+ //# sourceMappingURL=pySequenceThresholdInstructionCompletion.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pySequenceThresholdInstructionCompletion.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/python/sequences/pySequenceThresholdInstructionCompletion.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAgBT,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAEL,sBAAsB,EACvB,MAAM,mDAAmD,CAAC;AAC3D,OAAO,EAEL,oBAAoB,EACrB,MAAM,iDAAiD,CAAC;AAKzD,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAkB7C,KAAK,WAAW,GAAG;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,kBAAkB,EAAE,eAAe,CAAC;IACpC,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC;AAykBF,KAAK,OAAO,GAAG,sBAAsB,GACnC,oBAAoB,GAAG;IACrB,eAAe,EAAE,OAAO,CAAC;IACzB,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAoCJ,eAAO,MAAM,wCAAwC,EAAE,QAAQ,CAC7D,WAAW,EACX,OAAO,CAkBR,CAAC"}