math-exercises 3.0.171 → 3.0.173

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 (418) hide show
  1. package/lib/exercises/math/derivation/variations/signVarTable3dDegree.js +38 -10
  2. package/lib/exercises/math/derivation/variations/signVarTableFromDerivativeGraph.d.ts.map +1 -1
  3. package/lib/exercises/math/derivation/variations/signVarTableFromDerivativeGraph.js +7 -4
  4. package/lib/exercises/math/derivation/variations/signVarTableFromGraph.d.ts.map +1 -1
  5. package/lib/exercises/math/derivation/variations/signVarTableFromGraph.js +2 -3
  6. package/lib/exercises/math/functions/trinoms/devForm/variationsFromAlgebricForm.d.ts.map +1 -1
  7. package/lib/exercises/math/functions/trinoms/devForm/variationsFromAlgebricForm.js +12 -0
  8. package/lib/exercises/math/functions/trinoms/parabole/index.d.ts +2 -0
  9. package/lib/exercises/math/functions/trinoms/parabole/index.d.ts.map +1 -1
  10. package/lib/exercises/math/functions/trinoms/parabole/index.js +2 -0
  11. package/lib/exercises/math/functions/trinoms/parabole/parabolaVarTable.d.ts +8 -0
  12. package/lib/exercises/math/functions/trinoms/parabole/parabolaVarTable.d.ts.map +1 -0
  13. package/lib/exercises/math/functions/trinoms/parabole/parabolaVarTable.js +106 -0
  14. package/lib/exercises/math/functions/trinoms/parabole/paraboleSolveGraphEquation.d.ts +14 -0
  15. package/lib/exercises/math/functions/trinoms/parabole/paraboleSolveGraphEquation.d.ts.map +1 -0
  16. package/lib/exercises/math/functions/trinoms/parabole/paraboleSolveGraphEquation.js +186 -0
  17. package/lib/exercises/math/functions/trinoms/summitAndCanonical/extremumTypeFromAlgebricForm.d.ts +6 -2
  18. package/lib/exercises/math/functions/trinoms/summitAndCanonical/extremumTypeFromAlgebricForm.d.ts.map +1 -1
  19. package/lib/exercises/math/functions/trinoms/summitAndCanonical/extremumTypeFromAlgebricForm.js +98 -13
  20. package/lib/exercises/math/functions/variations/partialVarTableFromGraph.d.ts.map +1 -1
  21. package/lib/exercises/math/functions/variations/partialVarTableFromGraph.js +2 -1
  22. package/lib/exercises/math/functions/variations/varTableFromGraph.d.ts.map +1 -1
  23. package/lib/exercises/math/functions/variations/varTableFromGraph.js +2 -1
  24. package/lib/exercises/math/functions/variations/varTableFromSentences.d.ts.map +1 -1
  25. package/lib/exercises/math/functions/variations/varTableFromSentences.js +2 -1
  26. package/lib/exercises/math/geometry/circles/circleCenterAndRadiusFromEquation.d.ts.map +1 -1
  27. package/lib/exercises/math/geometry/circles/circleCenterAndRadiusFromEquation.js +0 -2
  28. package/lib/exercises/math/geometry/lines/index.d.ts +1 -0
  29. package/lib/exercises/math/geometry/lines/index.d.ts.map +1 -1
  30. package/lib/exercises/math/geometry/lines/index.js +1 -0
  31. package/lib/exercises/math/geometry/lines/readLineNormalVectorOnGraph.d.ts +13 -0
  32. package/lib/exercises/math/geometry/lines/readLineNormalVectorOnGraph.d.ts.map +1 -0
  33. package/lib/exercises/math/geometry/lines/readLineNormalVectorOnGraph.js +195 -0
  34. package/lib/exercises/math/geometry/vectors/scalarProduct/alKashi/scalarProductAlKashiAngle.d.ts.map +1 -1
  35. package/lib/exercises/math/geometry/vectors/scalarProduct/alKashi/scalarProductAlKashiAngle.js +64 -60
  36. package/lib/exercises/math/geometry/vectors/scalarProduct/alKashi/scalarProductAlKashiBH.d.ts +1 -0
  37. package/lib/exercises/math/geometry/vectors/scalarProduct/alKashi/scalarProductAlKashiBH.d.ts.map +1 -1
  38. package/lib/exercises/math/geometry/vectors/scalarProduct/alKashi/scalarProductAlKashiBH.js +173 -47
  39. package/lib/exercises/math/geometry/vectors/scalarProduct/alKashi/scalarProductAlKashiSideLength.d.ts.map +1 -1
  40. package/lib/exercises/math/geometry/vectors/scalarProduct/alKashi/scalarProductAlKashiSideLength.js +112 -46
  41. package/lib/exercises/math/geometry/vectors/scalarProduct/alg/scalarProductInOrthonormalBasisIJ.d.ts.map +1 -1
  42. package/lib/exercises/math/geometry/vectors/scalarProduct/alg/scalarProductInOrthonormalBasisIJ.js +6 -0
  43. package/lib/exercises/math/geometry/vectors/scalarProduct/alg/scalarProductLamdbaULambdaV.d.ts.map +1 -1
  44. package/lib/exercises/math/geometry/vectors/scalarProduct/alg/scalarProductLamdbaULambdaV.js +60 -82
  45. package/lib/exercises/math/geometry/vectors/scalarProduct/angleFromScalarProduct.d.ts.map +1 -1
  46. package/lib/exercises/math/geometry/vectors/scalarProduct/angleFromScalarProduct.js +92 -6
  47. package/lib/exercises/math/geometry/vectors/scalarProduct/index.d.ts +6 -1
  48. package/lib/exercises/math/geometry/vectors/scalarProduct/index.d.ts.map +1 -1
  49. package/lib/exercises/math/geometry/vectors/scalarProduct/index.js +6 -1
  50. package/lib/exercises/math/geometry/vectors/scalarProduct/orth/scalarProductIsOrthogonalVecsBasisIJ.d.ts.map +1 -1
  51. package/lib/exercises/math/geometry/vectors/scalarProduct/orth/scalarProductIsOrthogonalVecsBasisIJ.js +6 -0
  52. package/lib/exercises/math/geometry/vectors/scalarProduct/orth/scalarProductIsOrthogonalVecsUsingCoords.js +1 -1
  53. package/lib/exercises/math/geometry/vectors/scalarProduct/orth/scalarProductIsPointOnCircle.d.ts.map +1 -1
  54. package/lib/exercises/math/geometry/vectors/scalarProduct/orth/scalarProductIsPointOnCircle.js +15 -5
  55. package/lib/exercises/math/geometry/vectors/scalarProduct/orth/scalarProductIsPointOnPerpendicularBisector.d.ts.map +1 -1
  56. package/lib/exercises/math/geometry/vectors/scalarProduct/orth/scalarProductIsPointOnPerpendicularBisector.js +18 -14
  57. package/lib/exercises/math/geometry/vectors/scalarProduct/orth/scalarProductIsRightTriangleUsingPointCoords.d.ts.map +1 -1
  58. package/lib/exercises/math/geometry/vectors/scalarProduct/orth/scalarProductIsRightTriangleUsingPointCoords.js +15 -5
  59. package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductComputeBH.d.ts.map +1 -1
  60. package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductComputeBH.js +38 -4
  61. package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductOfVectsOnGrid1.d.ts.map +1 -1
  62. package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductOfVectsOnGrid1.js +77 -26
  63. package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductParallelogramDiagonalPlus.d.ts.map +1 -1
  64. package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductParallelogramDiagonalPlus.js +6 -7
  65. package/lib/exercises/math/probaStat/basicProbas/calculateProbaFromProbaLaw.js +1 -1
  66. package/lib/exercises/math/probaStat/probaFromTableWithContext.d.ts.map +1 -1
  67. package/lib/exercises/math/probaStat/probaFromTableWithContext.js +3 -16
  68. package/lib/exercises/math/probaStat/randomVariable/decideWhichGameIsLessRisky.d.ts +14 -0
  69. package/lib/exercises/math/probaStat/randomVariable/decideWhichGameIsLessRisky.d.ts.map +1 -0
  70. package/lib/exercises/math/probaStat/randomVariable/decideWhichGameIsLessRisky.js +167 -0
  71. package/lib/exercises/math/probaStat/randomVariable/findValueForFairRandomVariable.d.ts.map +1 -1
  72. package/lib/exercises/math/probaStat/randomVariable/findValueForFairRandomVariable.js +29 -56
  73. package/lib/exercises/math/probaStat/randomVariable/index.d.ts +8 -0
  74. package/lib/exercises/math/probaStat/randomVariable/index.d.ts.map +1 -1
  75. package/lib/exercises/math/probaStat/randomVariable/index.js +9 -0
  76. package/lib/exercises/math/probaStat/randomVariable/isTableProbabilityLaw.d.ts.map +1 -1
  77. package/lib/exercises/math/probaStat/randomVariable/isTableProbabilityLaw.js +6 -6
  78. package/lib/exercises/math/probaStat/randomVariable/missingValueInRandomVariableProbabilityLaw.d.ts +9 -0
  79. package/lib/exercises/math/probaStat/randomVariable/missingValueInRandomVariableProbabilityLaw.d.ts.map +1 -0
  80. package/lib/exercises/math/probaStat/randomVariable/missingValueInRandomVariableProbabilityLaw.js +119 -0
  81. package/lib/exercises/math/probaStat/randomVariable/randomVariableAverage.js +1 -1
  82. package/lib/exercises/math/probaStat/randomVariable/randomVariableFindMissingProbabilityInLaw.d.ts +9 -0
  83. package/lib/exercises/math/probaStat/randomVariable/randomVariableFindMissingProbabilityInLaw.d.ts.map +1 -0
  84. package/lib/exercises/math/probaStat/randomVariable/randomVariableFindMissingProbabilityInLaw.js +116 -0
  85. package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationAverage.d.ts +11 -0
  86. package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationAverage.d.ts.map +1 -0
  87. package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationAverage.js +112 -0
  88. package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationComputeProbability.d.ts +9 -0
  89. package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationComputeProbability.d.ts.map +1 -0
  90. package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationComputeProbability.js +176 -0
  91. package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationIsGameFavorable.d.ts +8 -0
  92. package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationIsGameFavorable.d.ts.map +1 -0
  93. package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationIsGameFavorable.js +94 -0
  94. package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationProbabilityLaw.d.ts +9 -0
  95. package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationProbabilityLaw.d.ts.map +1 -0
  96. package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationProbabilityLaw.js +162 -0
  97. package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationStandardDeviation.d.ts +8 -0
  98. package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationStandardDeviation.d.ts.map +1 -0
  99. package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationStandardDeviation.js +133 -0
  100. package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationValues.d.ts +8 -0
  101. package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationValues.d.ts.map +1 -0
  102. package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationValues.js +211 -0
  103. package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationVariance.d.ts +8 -0
  104. package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationVariance.d.ts.map +1 -0
  105. package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationVariance.js +113 -0
  106. package/lib/exercises/math/probaStat/randomVariable/randomVariableStandardDeviation.js +1 -1
  107. package/lib/exercises/math/probaStat/randomVariable/randomVariableVariance.js +1 -1
  108. package/lib/exercises/math/probaStat/randomVariable/utils/buildVAOfGivenAverage.d.ts +31 -0
  109. package/lib/exercises/math/probaStat/randomVariable/utils/buildVAOfGivenAverage.d.ts.map +1 -0
  110. package/lib/exercises/math/probaStat/randomVariable/utils/buildVAOfGivenAverage.js +192 -0
  111. package/lib/exercises/math/probaStat/randomVariable/utils/randomVariableSituations.d.ts +40 -11
  112. package/lib/exercises/math/probaStat/randomVariable/utils/randomVariableSituations.d.ts.map +1 -1
  113. package/lib/exercises/math/probaStat/randomVariable/utils/randomVariableSituations.js +172 -30
  114. package/lib/exercises/math/probaStat/stats1var/medianWithList.d.ts.map +1 -1
  115. package/lib/exercises/math/probaStat/stats1var/medianWithList.js +16 -2
  116. package/lib/exercises/math/python/sequences/index.d.ts +8 -0
  117. package/lib/exercises/math/python/sequences/index.d.ts.map +1 -0
  118. package/lib/exercises/math/python/sequences/index.js +7 -0
  119. package/lib/exercises/math/python/sequences/pySequenceFactorialInstructionFalseOneOut.d.ts +11 -0
  120. package/lib/exercises/math/python/sequences/pySequenceFactorialInstructionFalseOneOut.d.ts.map +1 -0
  121. package/lib/exercises/math/python/sequences/pySequenceFactorialInstructionFalseOneOut.js +274 -0
  122. package/lib/exercises/math/python/sequences/pySequenceFirstTermsListInstructionCompletion.d.ts +12 -0
  123. package/lib/exercises/math/python/sequences/pySequenceFirstTermsListInstructionCompletion.d.ts.map +1 -0
  124. package/lib/exercises/math/python/sequences/pySequenceFirstTermsListInstructionCompletion.js +368 -0
  125. package/lib/exercises/math/python/sequences/pySequenceFirstTermsSumInstructionCompletion.d.ts +13 -0
  126. package/lib/exercises/math/python/sequences/pySequenceFirstTermsSumInstructionCompletion.d.ts.map +1 -0
  127. package/lib/exercises/math/python/sequences/pySequenceFirstTermsSumInstructionCompletion.js +254 -0
  128. package/lib/exercises/math/python/sequences/pySequenceProgramReading.d.ts +14 -0
  129. package/lib/exercises/math/python/sequences/pySequenceProgramReading.d.ts.map +1 -0
  130. package/lib/exercises/math/python/sequences/pySequenceProgramReading.js +365 -0
  131. package/lib/exercises/math/python/sequences/pySequenceTermForLoopInstructionCompletion.d.ts +11 -0
  132. package/lib/exercises/math/python/sequences/pySequenceTermForLoopInstructionCompletion.d.ts.map +1 -0
  133. package/lib/exercises/math/python/sequences/pySequenceTermForLoopInstructionCompletion.js +298 -0
  134. package/lib/exercises/math/python/sequences/pySequenceTermFromFunctionCallInstructionCompletion.d.ts +12 -0
  135. package/lib/exercises/math/python/sequences/pySequenceTermFromFunctionCallInstructionCompletion.d.ts.map +1 -0
  136. package/lib/exercises/math/python/sequences/pySequenceTermFromFunctionCallInstructionCompletion.js +408 -0
  137. package/lib/exercises/math/python/sequences/pySequenceThresholdInstructionCompletion.d.ts +17 -0
  138. package/lib/exercises/math/python/sequences/pySequenceThresholdInstructionCompletion.d.ts.map +1 -0
  139. package/lib/exercises/math/python/sequences/pySequenceThresholdInstructionCompletion.js +498 -0
  140. package/lib/exercises/math/sequences/arithmetic/arithmeticFindExplicitFormulaFromTwoTerms.d.ts +12 -0
  141. package/lib/exercises/math/sequences/arithmetic/arithmeticFindExplicitFormulaFromTwoTerms.d.ts.map +1 -0
  142. package/lib/exercises/math/sequences/arithmetic/arithmeticFindExplicitFormulaFromTwoTerms.js +191 -0
  143. package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindExplicitFormulaFromSituation.d.ts +14 -0
  144. package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindExplicitFormulaFromSituation.d.ts.map +1 -0
  145. package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindExplicitFormulaFromSituation.js +153 -0
  146. package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindRankFromSituation.d.ts +15 -0
  147. package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindRankFromSituation.d.ts.map +1 -0
  148. package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindRankFromSituation.js +184 -0
  149. package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindRecurrenceFormulaFromSituation.d.ts +14 -0
  150. package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindRecurrenceFormulaFromSituation.d.ts.map +1 -0
  151. package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindRecurrenceFormulaFromSituation.js +210 -0
  152. package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindTermFromSituation.d.ts +15 -0
  153. package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindTermFromSituation.d.ts.map +1 -0
  154. package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindTermFromSituation.js +161 -0
  155. package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindThresholdFromSituation.d.ts +17 -0
  156. package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindThresholdFromSituation.d.ts.map +1 -0
  157. package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindThresholdFromSituation.js +188 -0
  158. package/lib/exercises/math/sequences/arithmetic/situations/index.d.ts +6 -0
  159. package/lib/exercises/math/sequences/arithmetic/situations/index.d.ts.map +1 -0
  160. package/lib/exercises/math/sequences/arithmetic/situations/index.js +5 -0
  161. package/lib/exercises/math/sequences/arithmetic/sum/arithmeticComputeSumWithDots.d.ts +15 -0
  162. package/lib/exercises/math/sequences/arithmetic/sum/arithmeticComputeSumWithDots.d.ts.map +1 -0
  163. package/lib/exercises/math/sequences/arithmetic/sum/arithmeticComputeSumWithDots.js +233 -0
  164. package/lib/exercises/math/sequences/arithmetic/sum/arithmeticFirstTermsSum.d.ts +13 -0
  165. package/lib/exercises/math/sequences/arithmetic/sum/arithmeticFirstTermsSum.d.ts.map +1 -0
  166. package/lib/exercises/math/sequences/arithmetic/sum/arithmeticFirstTermsSum.js +111 -0
  167. package/lib/exercises/math/sequences/arithmetic/sum/arithmeticFirstTermsSumThreshold.d.ts +13 -0
  168. package/lib/exercises/math/sequences/arithmetic/sum/arithmeticFirstTermsSumThreshold.d.ts.map +1 -0
  169. package/lib/exercises/math/sequences/arithmetic/sum/arithmeticFirstTermsSumThreshold.js +216 -0
  170. package/lib/exercises/math/sequences/arithmetic/sum/firstIntegersSum.d.ts +7 -0
  171. package/lib/exercises/math/sequences/arithmetic/sum/firstIntegersSum.d.ts.map +1 -0
  172. package/lib/exercises/math/sequences/arithmetic/sum/firstIntegersSum.js +94 -0
  173. package/lib/exercises/math/sequences/arithmetic/sum/index.d.ts +5 -0
  174. package/lib/exercises/math/sequences/arithmetic/sum/index.d.ts.map +1 -0
  175. package/lib/exercises/math/sequences/arithmetic/sum/index.js +4 -0
  176. package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFromTwoTerms.d.ts +14 -0
  177. package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFromTwoTerms.d.ts.map +1 -0
  178. package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFromTwoTerms.js +301 -0
  179. package/lib/exercises/math/sequences/geometric/geometricFindRandomTermFromTwoTerms.d.ts +15 -0
  180. package/lib/exercises/math/sequences/geometric/geometricFindRandomTermFromTwoTerms.d.ts.map +1 -0
  181. package/lib/exercises/math/sequences/geometric/geometricFindRandomTermFromTwoTerms.js +260 -0
  182. package/lib/exercises/math/sequences/geometric/situations/geometricFindExplicitFormulaFromSituation.d.ts +14 -0
  183. package/lib/exercises/math/sequences/geometric/situations/geometricFindExplicitFormulaFromSituation.d.ts.map +1 -0
  184. package/lib/exercises/math/sequences/geometric/situations/geometricFindExplicitFormulaFromSituation.js +186 -0
  185. package/lib/exercises/math/sequences/geometric/situations/geometricFindRankFromSituation.d.ts +15 -0
  186. package/lib/exercises/math/sequences/geometric/situations/geometricFindRankFromSituation.d.ts.map +1 -0
  187. package/lib/exercises/math/sequences/geometric/situations/geometricFindRankFromSituation.js +142 -0
  188. package/lib/exercises/math/sequences/geometric/situations/geometricFindRecurrenceFormulaFromSituation.d.ts +14 -0
  189. package/lib/exercises/math/sequences/geometric/situations/geometricFindRecurrenceFormulaFromSituation.d.ts.map +1 -0
  190. package/lib/exercises/math/sequences/geometric/situations/geometricFindRecurrenceFormulaFromSituation.js +205 -0
  191. package/lib/exercises/math/sequences/geometric/situations/geometricFindTermFromSituation.d.ts +15 -0
  192. package/lib/exercises/math/sequences/geometric/situations/geometricFindTermFromSituation.d.ts.map +1 -0
  193. package/lib/exercises/math/sequences/geometric/situations/geometricFindTermFromSituation.js +208 -0
  194. package/lib/exercises/math/sequences/geometric/situations/geometricFindThresholdFromSituation.d.ts +17 -0
  195. package/lib/exercises/math/sequences/geometric/situations/geometricFindThresholdFromSituation.d.ts.map +1 -0
  196. package/lib/exercises/math/sequences/geometric/situations/geometricFindThresholdFromSituation.js +152 -0
  197. package/lib/exercises/math/sequences/geometric/situations/index.d.ts +4 -0
  198. package/lib/exercises/math/sequences/geometric/situations/index.d.ts.map +1 -0
  199. package/lib/exercises/math/sequences/geometric/situations/index.js +5 -0
  200. package/lib/exercises/math/sequences/geometric/sum/geometricComputeSumWithDots.d.ts +15 -0
  201. package/lib/exercises/math/sequences/geometric/sum/geometricComputeSumWithDots.d.ts.map +1 -0
  202. package/lib/exercises/math/sequences/geometric/sum/geometricComputeSumWithDots.js +248 -0
  203. package/lib/exercises/math/sequences/geometric/sum/geometricFirstTermsGeneralSum.d.ts +14 -0
  204. package/lib/exercises/math/sequences/geometric/sum/geometricFirstTermsGeneralSum.d.ts.map +1 -0
  205. package/lib/exercises/math/sequences/geometric/sum/geometricFirstTermsGeneralSum.js +126 -0
  206. package/lib/exercises/math/sequences/geometric/sum/geometricFirstTermsSum.d.ts +8 -0
  207. package/lib/exercises/math/sequences/geometric/sum/geometricFirstTermsSum.d.ts.map +1 -0
  208. package/lib/exercises/math/sequences/geometric/sum/geometricFirstTermsSum.js +91 -0
  209. package/lib/exercises/math/sequences/geometric/sum/index.d.ts +4 -0
  210. package/lib/exercises/math/sequences/geometric/sum/index.d.ts.map +1 -0
  211. package/lib/exercises/math/sequences/geometric/sum/index.js +3 -0
  212. package/lib/exercises/math/sequences/seqArithmGeom/index.d.ts +2 -0
  213. package/lib/exercises/math/sequences/seqArithmGeom/index.d.ts.map +1 -0
  214. package/lib/exercises/math/sequences/seqArithmGeom/index.js +1 -0
  215. package/lib/exercises/math/sequences/seqArithmGeom/seqArithmGeomRecurrenceFormulaUsage.d.ts +14 -0
  216. package/lib/exercises/math/sequences/seqArithmGeom/seqArithmGeomRecurrenceFormulaUsage.d.ts.map +1 -0
  217. package/lib/exercises/math/sequences/seqArithmGeom/seqArithmGeomRecurrenceFormulaUsage.js +202 -0
  218. package/lib/exercises/math/trigonometry/circle/placeAssociateAngleOnCircle.d.ts.map +1 -1
  219. package/lib/exercises/math/trigonometry/circle/placeAssociateAngleOnCircle.js +0 -2
  220. package/lib/exercises/options/optionFirstTermRankOne.d.ts +16 -0
  221. package/lib/exercises/options/optionFirstTermRankOne.d.ts.map +1 -0
  222. package/lib/exercises/options/optionFirstTermRankOne.js +17 -0
  223. package/lib/exercises/options/optionIsUsePythonDef.d.ts +16 -0
  224. package/lib/exercises/options/optionIsUsePythonDef.d.ts.map +1 -0
  225. package/lib/exercises/options/optionIsUsePythonDef.js +17 -0
  226. package/lib/exercises/options/optionIsWithSuperfluousData.d.ts +16 -0
  227. package/lib/exercises/options/optionIsWithSuperfluousData.d.ts.map +1 -0
  228. package/lib/exercises/options/optionIsWithSuperfluousData.js +17 -0
  229. package/lib/exercises/utils/geogebra/toGGBCommandsProps.d.ts +1 -0
  230. package/lib/exercises/utils/geogebra/toGGBCommandsProps.d.ts.map +1 -1
  231. package/lib/exercises/vea/colinearVectorVEA.d.ts +2 -0
  232. package/lib/exercises/vea/colinearVectorVEA.d.ts.map +1 -0
  233. package/lib/exercises/vea/colinearVectorVEA.js +11 -0
  234. package/lib/exercises/vea/rationalVEA.d.ts.map +1 -1
  235. package/lib/exercises/vea/rationalVEA.js +7 -3
  236. package/lib/exercises/vea/varLineVEA.d.ts.map +1 -1
  237. package/lib/exercises/vea/varLineVEA.js +7 -3
  238. package/lib/exercises/vea/varSignTableVEA.d.ts +8 -0
  239. package/lib/exercises/vea/varSignTableVEA.d.ts.map +1 -1
  240. package/lib/exercises/vea/varSignTableVEA.js +8 -0
  241. package/lib/exercises/vea/xTableLineVEA.d.ts +1 -0
  242. package/lib/exercises/vea/xTableLineVEA.d.ts.map +1 -1
  243. package/lib/exercises/vea/xTableLineVEA.js +1 -0
  244. package/lib/index.d.ts +104 -5
  245. package/lib/index.d.ts.map +1 -1
  246. package/lib/latexTester.d.ts.map +1 -1
  247. package/lib/latexTester.js +3 -1
  248. package/lib/math/geometry/angle.d.ts +2 -0
  249. package/lib/math/geometry/angle.d.ts.map +1 -1
  250. package/lib/math/geometry/angle.js +17 -0
  251. package/lib/math/geometry/line.d.ts +1 -1
  252. package/lib/math/geometry/line.d.ts.map +1 -1
  253. package/lib/math/geometry/line.js +3 -3
  254. package/lib/math/geometry/point.d.ts +1 -1
  255. package/lib/math/geometry/point.d.ts.map +1 -1
  256. package/lib/math/geometry/point.js +4 -1
  257. package/lib/math/geometry/segment.js +1 -1
  258. package/lib/math/numbers/reals/real.d.ts.map +1 -1
  259. package/lib/math/numbers/reals/real.js +4 -0
  260. package/lib/math/probability/randomVariable.d.ts +2 -1
  261. package/lib/math/probability/randomVariable.d.ts.map +1 -1
  262. package/lib/math/probability/randomVariable.js +7 -1
  263. package/lib/math/utils/arithmetic/primeFactors.d.ts +1 -1
  264. package/lib/math/utils/arithmetic/primeFactors.d.ts.map +1 -1
  265. package/lib/math/utils/arithmetic/primeFactors.js +23 -9
  266. package/lib/math/utils/sequences/situations/seqArithmeticSituations.d.ts +53 -0
  267. package/lib/math/utils/sequences/situations/seqArithmeticSituations.d.ts.map +1 -0
  268. package/lib/math/utils/sequences/situations/seqArithmeticSituations.js +1928 -0
  269. package/lib/math/utils/sequences/situations/seqArithmeticUtils.d.ts +15 -0
  270. package/lib/math/utils/sequences/situations/seqArithmeticUtils.d.ts.map +1 -0
  271. package/lib/math/utils/sequences/situations/seqArithmeticUtils.js +136 -0
  272. package/lib/math/utils/sequences/situations/seqGeometricSituations.d.ts +42 -0
  273. package/lib/math/utils/sequences/situations/seqGeometricSituations.d.ts.map +1 -0
  274. package/lib/math/utils/sequences/situations/seqGeometricSituations.js +932 -0
  275. package/lib/math/utils/sequences/situations/seqGeometricUtils.d.ts +12 -0
  276. package/lib/math/utils/sequences/situations/seqGeometricUtils.d.ts.map +1 -0
  277. package/lib/math/utils/sequences/situations/seqGeometricUtils.js +90 -0
  278. package/lib/tests/pdfs/mdTableToLatexTabular.js +1 -1
  279. package/lib/tree/nodes/algebraicNode.d.ts +1 -0
  280. package/lib/tree/nodes/algebraicNode.d.ts.map +1 -1
  281. package/lib/tree/nodes/complex/complexNode.d.ts +1 -0
  282. package/lib/tree/nodes/complex/complexNode.d.ts.map +1 -1
  283. package/lib/tree/nodes/complex/complexNode.js +3 -0
  284. package/lib/tree/nodes/equations/equalNode.d.ts +1 -0
  285. package/lib/tree/nodes/equations/equalNode.d.ts.map +1 -1
  286. package/lib/tree/nodes/equations/equalNode.js +3 -0
  287. package/lib/tree/nodes/equations/equationSolutionNode.d.ts +1 -0
  288. package/lib/tree/nodes/equations/equationSolutionNode.d.ts.map +1 -1
  289. package/lib/tree/nodes/equations/equationSolutionNode.js +3 -0
  290. package/lib/tree/nodes/equations/multiEqualNode.d.ts +1 -0
  291. package/lib/tree/nodes/equations/multiEqualNode.d.ts.map +1 -1
  292. package/lib/tree/nodes/equations/multiEqualNode.js +3 -0
  293. package/lib/tree/nodes/equations/notEqualNode.d.ts +1 -0
  294. package/lib/tree/nodes/equations/notEqualNode.d.ts.map +1 -1
  295. package/lib/tree/nodes/equations/notEqualNode.js +3 -0
  296. package/lib/tree/nodes/functions/absNode.d.ts +1 -0
  297. package/lib/tree/nodes/functions/absNode.d.ts.map +1 -1
  298. package/lib/tree/nodes/functions/absNode.js +7 -0
  299. package/lib/tree/nodes/functions/arcSinNode.d.ts +1 -0
  300. package/lib/tree/nodes/functions/arcSinNode.d.ts.map +1 -1
  301. package/lib/tree/nodes/functions/arcSinNode.js +7 -0
  302. package/lib/tree/nodes/functions/arccosNode.d.ts +1 -0
  303. package/lib/tree/nodes/functions/arccosNode.d.ts.map +1 -1
  304. package/lib/tree/nodes/functions/arccosNode.js +7 -0
  305. package/lib/tree/nodes/functions/arctanNode.d.ts +1 -0
  306. package/lib/tree/nodes/functions/arctanNode.d.ts.map +1 -1
  307. package/lib/tree/nodes/functions/arctanNode.js +7 -0
  308. package/lib/tree/nodes/functions/cosNode.d.ts +1 -0
  309. package/lib/tree/nodes/functions/cosNode.d.ts.map +1 -1
  310. package/lib/tree/nodes/functions/cosNode.js +7 -0
  311. package/lib/tree/nodes/functions/expNode.d.ts +1 -0
  312. package/lib/tree/nodes/functions/expNode.d.ts.map +1 -1
  313. package/lib/tree/nodes/functions/expNode.js +7 -0
  314. package/lib/tree/nodes/functions/factorialNode.d.ts +30 -0
  315. package/lib/tree/nodes/functions/factorialNode.d.ts.map +1 -0
  316. package/lib/tree/nodes/functions/factorialNode.js +79 -0
  317. package/lib/tree/nodes/functions/functionNode.d.ts +2 -1
  318. package/lib/tree/nodes/functions/functionNode.d.ts.map +1 -1
  319. package/lib/tree/nodes/functions/functionNode.js +1 -0
  320. package/lib/tree/nodes/functions/integralNode.d.ts +1 -0
  321. package/lib/tree/nodes/functions/integralNode.d.ts.map +1 -1
  322. package/lib/tree/nodes/functions/integralNode.js +7 -0
  323. package/lib/tree/nodes/functions/log10Node.d.ts +1 -0
  324. package/lib/tree/nodes/functions/log10Node.d.ts.map +1 -1
  325. package/lib/tree/nodes/functions/log10Node.js +7 -0
  326. package/lib/tree/nodes/functions/logNode.d.ts +1 -0
  327. package/lib/tree/nodes/functions/logNode.d.ts.map +1 -1
  328. package/lib/tree/nodes/functions/logNode.js +9 -0
  329. package/lib/tree/nodes/functions/oppositeNode.d.ts +1 -0
  330. package/lib/tree/nodes/functions/oppositeNode.d.ts.map +1 -1
  331. package/lib/tree/nodes/functions/oppositeNode.js +7 -0
  332. package/lib/tree/nodes/functions/sinNode.d.ts +1 -0
  333. package/lib/tree/nodes/functions/sinNode.d.ts.map +1 -1
  334. package/lib/tree/nodes/functions/sinNode.js +7 -0
  335. package/lib/tree/nodes/functions/sqrtNode.d.ts +1 -0
  336. package/lib/tree/nodes/functions/sqrtNode.d.ts.map +1 -1
  337. package/lib/tree/nodes/functions/sqrtNode.js +7 -0
  338. package/lib/tree/nodes/functions/tanNode.d.ts +1 -0
  339. package/lib/tree/nodes/functions/tanNode.d.ts.map +1 -1
  340. package/lib/tree/nodes/functions/tanNode.js +7 -0
  341. package/lib/tree/nodes/geometry/degree.d.ts +1 -0
  342. package/lib/tree/nodes/geometry/degree.d.ts.map +1 -1
  343. package/lib/tree/nodes/geometry/degree.js +7 -0
  344. package/lib/tree/nodes/geometry/lengthNode.d.ts +1 -0
  345. package/lib/tree/nodes/geometry/lengthNode.d.ts.map +1 -1
  346. package/lib/tree/nodes/geometry/lengthNode.js +7 -0
  347. package/lib/tree/nodes/geometry/pointNode.d.ts +1 -0
  348. package/lib/tree/nodes/geometry/pointNode.d.ts.map +1 -1
  349. package/lib/tree/nodes/geometry/pointNode.js +7 -0
  350. package/lib/tree/nodes/geometry/vectorNode.d.ts +1 -0
  351. package/lib/tree/nodes/geometry/vectorNode.d.ts.map +1 -1
  352. package/lib/tree/nodes/geometry/vectorNode.js +7 -0
  353. package/lib/tree/nodes/inequations/inequationNode.d.ts +1 -0
  354. package/lib/tree/nodes/inequations/inequationNode.d.ts.map +1 -1
  355. package/lib/tree/nodes/inequations/inequationNode.js +7 -0
  356. package/lib/tree/nodes/inequations/inequationSolutionNode.d.ts +1 -0
  357. package/lib/tree/nodes/inequations/inequationSolutionNode.d.ts.map +1 -1
  358. package/lib/tree/nodes/inequations/inequationSolutionNode.js +7 -0
  359. package/lib/tree/nodes/node.d.ts +2 -1
  360. package/lib/tree/nodes/node.d.ts.map +1 -1
  361. package/lib/tree/nodes/node.js +2 -0
  362. package/lib/tree/nodes/nodeConstructor.d.ts.map +1 -1
  363. package/lib/tree/nodes/nodeConstructor.js +4 -0
  364. package/lib/tree/nodes/numbers/percentNode.d.ts +1 -0
  365. package/lib/tree/nodes/numbers/percentNode.d.ts.map +1 -1
  366. package/lib/tree/nodes/numbers/percentNode.js +7 -0
  367. package/lib/tree/nodes/operators/addNode.d.ts +1 -0
  368. package/lib/tree/nodes/operators/addNode.d.ts.map +1 -1
  369. package/lib/tree/nodes/operators/addNode.js +7 -0
  370. package/lib/tree/nodes/operators/binomialCoefficientNode.d.ts +4 -3
  371. package/lib/tree/nodes/operators/binomialCoefficientNode.d.ts.map +1 -1
  372. package/lib/tree/nodes/operators/binomialCoefficientNode.js +24 -5
  373. package/lib/tree/nodes/operators/divideNode.d.ts +1 -0
  374. package/lib/tree/nodes/operators/divideNode.d.ts.map +1 -1
  375. package/lib/tree/nodes/operators/divideNode.js +7 -0
  376. package/lib/tree/nodes/operators/fractionNode.d.ts +1 -0
  377. package/lib/tree/nodes/operators/fractionNode.d.ts.map +1 -1
  378. package/lib/tree/nodes/operators/fractionNode.js +7 -0
  379. package/lib/tree/nodes/operators/limitNode.d.ts +1 -0
  380. package/lib/tree/nodes/operators/limitNode.d.ts.map +1 -1
  381. package/lib/tree/nodes/operators/limitNode.js +7 -0
  382. package/lib/tree/nodes/operators/multiplyNode.d.ts +1 -0
  383. package/lib/tree/nodes/operators/multiplyNode.d.ts.map +1 -1
  384. package/lib/tree/nodes/operators/multiplyNode.js +7 -0
  385. package/lib/tree/nodes/operators/powerNode.d.ts +1 -0
  386. package/lib/tree/nodes/operators/powerNode.d.ts.map +1 -1
  387. package/lib/tree/nodes/operators/powerNode.js +7 -0
  388. package/lib/tree/nodes/operators/substractNode.d.ts +1 -0
  389. package/lib/tree/nodes/operators/substractNode.d.ts.map +1 -1
  390. package/lib/tree/nodes/operators/substractNode.js +7 -0
  391. package/lib/tree/nodes/polynomials/monomNode.d.ts +1 -0
  392. package/lib/tree/nodes/polynomials/monomNode.d.ts.map +1 -1
  393. package/lib/tree/nodes/polynomials/monomNode.js +7 -0
  394. package/lib/tree/nodes/polynomials/trinomNode.d.ts +1 -0
  395. package/lib/tree/nodes/polynomials/trinomNode.d.ts.map +1 -1
  396. package/lib/tree/nodes/polynomials/trinomNode.js +7 -0
  397. package/lib/tree/nodes/sets/belongsNode.d.ts +1 -0
  398. package/lib/tree/nodes/sets/belongsNode.d.ts.map +1 -1
  399. package/lib/tree/nodes/sets/belongsNode.js +7 -0
  400. package/lib/tree/nodes/sets/discreteSetNode.d.ts +1 -0
  401. package/lib/tree/nodes/sets/discreteSetNode.d.ts.map +1 -1
  402. package/lib/tree/nodes/sets/discreteSetNode.js +7 -0
  403. package/lib/tree/nodes/sets/intervalNode.d.ts +1 -0
  404. package/lib/tree/nodes/sets/intervalNode.d.ts.map +1 -1
  405. package/lib/tree/nodes/sets/intervalNode.js +7 -0
  406. package/lib/tree/nodes/sets/unionIntervalNode.d.ts +1 -0
  407. package/lib/tree/nodes/sets/unionIntervalNode.d.ts.map +1 -1
  408. package/lib/tree/nodes/sets/unionIntervalNode.js +7 -0
  409. package/lib/tree/nodes/variables/variableNode.d.ts +1 -0
  410. package/lib/tree/nodes/variables/variableNode.d.ts.map +1 -1
  411. package/lib/tree/nodes/variables/variableNode.js +7 -0
  412. package/lib/tree/parsers/vectorParser.d.ts.map +1 -1
  413. package/lib/tree/parsers/vectorParser.js +8 -0
  414. package/lib/tree/utilities/nodeShuffler.d.ts.map +1 -1
  415. package/lib/tree/utilities/nodeShuffler.js +3 -0
  416. package/lib/tree/utilities/nodeSimplifier.d.ts.map +1 -1
  417. package/lib/tree/utilities/nodeSimplifier.js +3 -0
  418. package/package.json +1 -1
@@ -0,0 +1,1928 @@
1
+ import { add } from "../../../../tree/nodes/operators/addNode.js";
2
+ import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
3
+ import { substract } from "../../../../tree/nodes/operators/substractNode.js";
4
+ import { alignTex } from "../../../../utils/latex/alignTex.js";
5
+ import { randfloat } from "../../random/randfloat.js";
6
+ import { randint } from "../../random/randint.js";
7
+ import { round } from "../../round.js";
8
+ import { firstDegreeInequationResolutionTex } from "../../../../tree/nodes/inequations/inequationNode.js";
9
+ import { Affine } from "../../../../math/polynomials/affine.js";
10
+ import { seqArithmeticUtils } from "./seqArithmeticUtils.js";
11
+ const getStrFactor = (firstRank) => {
12
+ return firstRank === 0 ? "n" : "(n-1)";
13
+ };
14
+ //decoration
15
+ const createSituationArithmeticFromTemplate = (templateSituationsArithmetic) => {
16
+ const { variationFindExplicitFormula, variationFindRecurrenceFormula, variationFindRandomTerm, variationFindRank, variationFindThreshold, } = templateSituationsArithmetic;
17
+ return Object.assign({}, templateSituationsArithmetic, {
18
+ variationFindExplicitFormula: Object.assign({}, variationFindExplicitFormula, {
19
+ getCorrectionStuff: (initial, reason, firstRank, ...otherArgs) => {
20
+ const { str: strRaw } = variationFindExplicitFormula.getCorrectionStuff(initial, reason, firstRank, ...otherArgs);
21
+ const str = `${strRaw}
22
+
23
+ $$
24
+ ${seqArithmeticUtils
25
+ .getAnswerNodeExplicitFormula(initial, reason, firstRank)
26
+ .toTex()}
27
+ $$
28
+
29
+ `;
30
+ return { str };
31
+ },
32
+ }),
33
+ variationFindRecurrenceFormula: Object.assign({}, variationFindRecurrenceFormula, {
34
+ getCorrectionStuff: (initial, reason, firstRank, ...otherArgs) => {
35
+ const { str: strRaw, rank1, rank2, } = variationFindRecurrenceFormula.getCorrectionStuff(initial, reason, firstRank, ...otherArgs);
36
+ const str = `${strRaw}
37
+
38
+ $$
39
+ u_{${rank2.frenchify()}} = u_{${rank1.frenchify()}} + (${reason.frenchify()})
40
+ $$
41
+
42
+ La relation de récurrence est, pour $n \\geq ${firstRank.frenchify()}$ :
43
+
44
+ $$
45
+ ${seqArithmeticUtils
46
+ .getAnswerNodeRecurrenceFormula(initial, reason, firstRank)
47
+ .toTex()}
48
+ $$
49
+
50
+ `;
51
+ return { str, rank1, rank2 };
52
+ },
53
+ }),
54
+ variationFindRandomTerm: Object.assign({}, variationFindRandomTerm, {
55
+ getCorrectionStuff: (initial, reason, firstRank, ...otherArgs) => {
56
+ const [rankAsked] = otherArgs;
57
+ const { str: strRaw } = variationFindRandomTerm.getCorrectionStuff(initial, reason, firstRank, ...otherArgs);
58
+ const answerNode = variationFindRandomTerm.getAnswerNode(initial, reason, firstRank, ...otherArgs);
59
+ const str = `${strRaw}
60
+
61
+ Le terme général est :
62
+
63
+ $$
64
+ ${seqArithmeticUtils
65
+ .getAnswerNodeExplicitFormula(initial, reason, firstRank)
66
+ .toTex()}
67
+ $$
68
+
69
+ En particulier :
70
+
71
+ ${alignTex([
72
+ [`u_{${rankAsked}}`, "=", answerNode.toTex()],
73
+ ["", "=", answerNode.simplify().toTex()],
74
+ ])}
75
+
76
+ `;
77
+ return { str };
78
+ },
79
+ }),
80
+ variationFindRank: Object.assign({}, variationFindRank, {
81
+ getCorrectionStuff: (initial, reason, firstRank, ...otherArgs) => {
82
+ const [valueAsked] = otherArgs;
83
+ const { str: strRaw } = variationFindRank.getCorrectionStuff(initial, reason, firstRank, ...otherArgs);
84
+ const answerNode = variationFindRank.getAnswerNode(initial, reason, firstRank, ...otherArgs);
85
+ const str = `${strRaw}
86
+
87
+ On note $p$ le rang recherché. On a :
88
+
89
+ ${alignTex([
90
+ [`u_p`, "=", valueAsked.frenchify()],
91
+ [
92
+ `${add(initial, multiply(reason, "p".toTree())).toTex()}`,
93
+ "=",
94
+ valueAsked.frenchify(),
95
+ ],
96
+ ])}
97
+
98
+ On résout l'équation :
99
+
100
+ ${alignTex([
101
+ [`p`, "=", answerNode.toTex()],
102
+ ["", "=", answerNode.simplify().toTex()],
103
+ ])}
104
+
105
+
106
+ `;
107
+ return { str };
108
+ },
109
+ }),
110
+ variationFindThreshold: Object.assign({}, variationFindThreshold, {
111
+ getCorrectionStuff: (initial, reason, firstRank, ...otherArgs) => {
112
+ const [valueThreshold, inequationSymbol] = otherArgs;
113
+ const { str: strRaw } = variationFindThreshold.getCorrectionStuff(initial, reason, firstRank, ...otherArgs);
114
+ const answerNode = variationFindThreshold.getAnswerNode(initial, reason, firstRank, ...otherArgs);
115
+ const str = `${strRaw}
116
+
117
+ On note $p$ le rang recherché. On a :
118
+
119
+ ${alignTex([
120
+ [`u_p`, inequationSymbol.symbol, valueThreshold.frenchify()],
121
+ [
122
+ `${add(initial, multiply(reason, substract("p".toTree(), firstRank).simplify())).toTex()}`,
123
+ inequationSymbol.symbol,
124
+ valueThreshold.frenchify(),
125
+ ],
126
+ ])}
127
+
128
+ On résout l'inéquation :
129
+
130
+ $$
131
+ ${(() => {
132
+ if (firstRank === 0) {
133
+ return firstDegreeInequationResolutionTex(new Affine(reason, initial, "p"), inequationSymbol.symbol, valueThreshold.toTree());
134
+ }
135
+ else {
136
+ return firstDegreeInequationResolutionTex(new Affine(reason, initial - reason, "p"), inequationSymbol.symbol, valueThreshold.toTree());
137
+ }
138
+ })()}
139
+ $$
140
+
141
+ Le rang $p$ recherché est donc $${answerNode.toTex()}$.
142
+
143
+ `;
144
+ return { str };
145
+ },
146
+ }),
147
+ });
148
+ };
149
+ //raw material
150
+ const templatesSituationsArithmetic = [
151
+ //---------------------------------------------------------
152
+ //POSITIVE REASON
153
+ //---------------------------------------------------------
154
+ //plante
155
+ {
156
+ randInitial: () => randint(2, 20),
157
+ randReason: () => randfloat(0, 4, 2, [0]),
158
+ randThreshold: (initial, reason, firstRank) => seqArithmeticUtils.randThreshold(initial, reason, firstRank, 2),
159
+ randSuperfluousData: () => {
160
+ const rand = randint(0, 2);
161
+ const values = [];
162
+ switch (rand) {
163
+ case 0:
164
+ {
165
+ const wateringPeriodInDays = randint(2, 10);
166
+ values.push(wateringPeriodInDays);
167
+ }
168
+ break;
169
+ case 1:
170
+ {
171
+ const potDiameterInCm = randint(14, 46);
172
+ values.push(potDiameterInCm);
173
+ }
174
+ break;
175
+ }
176
+ return {
177
+ rand,
178
+ values,
179
+ };
180
+ },
181
+ getStrSituation: (initial, reason, firstRank, superfluousData) => {
182
+ if (superfluousData === undefined) {
183
+ return `On suppose qu'une plante, d'une hauteur initiale (jour $${firstRank.frenchify()}$) de $${initial.frenchify()}\\ \\textrm{cm}$,
184
+ croît chaque jour de $${reason.frenchify()}\\ \\textrm{cm}$.
185
+ On note $u_n$ la hauteur de la plante relevée le jour $n$, en $\\textrm{cm}$.`;
186
+ }
187
+ else {
188
+ switch (superfluousData.rand) {
189
+ case 0:
190
+ {
191
+ const [wateringPeriodInDays] = superfluousData.values;
192
+ return `On suppose qu'une plante, d'une hauteur initiale (jour $${firstRank.frenchify()}$) de $${initial.frenchify()}\\ \\textrm{cm}$ et
193
+ arrosée en moyenne tous les $${wateringPeriodInDays.frenchify()}$ jours,
194
+ croît chaque jour de $${reason.frenchify()}\\ \\textrm{cm}$.
195
+ On note $u_n$ la hauteur de la plante relevée le jour $n$, en $\\textrm{cm}$.`;
196
+ }
197
+ break;
198
+ case 1:
199
+ {
200
+ const [potDiameterInCm] = superfluousData.values;
201
+ return `On suppose qu'on a mis une plante dans un pot de diamètre $${potDiameterInCm.frenchify()} \\ \\textrm{cm}$.
202
+ La plante a alors une hauteur initiale (jour $${firstRank.frenchify()}$) de $${initial.frenchify()}\\ \\textrm{cm}$.
203
+ La plante croît chaque jour de $${reason.frenchify()}\\ \\textrm{cm}$.
204
+ On note $u_n$ la hauteur de la plante relevée le jour $n$, en $\\textrm{cm}$.`;
205
+ }
206
+ break;
207
+ default:
208
+ throw new Error("Unsupported superfluousData.rand: " + superfluousData.rand);
209
+ }
210
+ }
211
+ },
212
+ variationFindExplicitFormula: {
213
+ getAnswerNode: seqArithmeticUtils.getAnswerNodeExplicitFormula,
214
+ getHint: (firstRank) => `Quel calcul permet de trouver la hauteur de la plante au bout de $10$ jours ?
215
+
216
+ Inspire toi de ce calcul pour déterminer la hauteur de la plante au bout de $${getStrFactor(firstRank)}$ jours.`,
217
+ getCorrectionStuff: (initial, reason, _firstRank) => {
218
+ return {
219
+ str: `Chaque jour, la plante gagne $${reason.frenchify()}\\ \\textrm{cm}$.
220
+ La hauteur de la plante relevée chaque jour, en $\\textrm{cm}$, est donc une suite arithmétique de premier terme $${initial.frenchify()}$ et de raison $${reason.frenchify()}$.`,
221
+ };
222
+ },
223
+ },
224
+ variationFindRecurrenceFormula: {
225
+ getAnswerNode: seqArithmeticUtils.getAnswerNodeRecurrenceFormula,
226
+ getHint: (_firstRank) => `Si tu connais la hauteur de la plante le jour $10$, comment fais-tu pour calculer la hauteur de la plante le jour $11$ ?
227
+
228
+ Déduis-en comment calculer $u_{n+1}$ à partir de $u_n$.`,
229
+ getCorrectionStuff: (_initial, reason, firstRank) => {
230
+ const target1 = 10;
231
+ const target2 = 11;
232
+ const [rank1, rank2] = [target1, target2].map((target) => target + firstRank);
233
+ return {
234
+ str: `Chaque jour, la plante gagne $${reason.frenchify()}\\ \\textrm{cm}$.
235
+ Par exemple, la hauteur de la plante le jour $${target2.frenchify()}$ est égale à celle du jour $${target1.frenchify()}$ augmentée de $${reason.frenchify()}\\ \\textrm{cm}$.`,
236
+ rank1,
237
+ rank2,
238
+ };
239
+ },
240
+ },
241
+ variationFindRandomTerm: {
242
+ getAnswerNode: (initial, reason, firstRank, ...otherArgs) => {
243
+ const [rankAsked] = otherArgs;
244
+ return seqArithmeticUtils.getAnswerNodeRandomTerm(initial, reason, firstRank, rankAsked);
245
+ },
246
+ getHint: (firstRank, ...otherArgs) => {
247
+ const [rankAsked] = otherArgs;
248
+ const target = rankAsked - firstRank;
249
+ return `Quelle est la nature de la suite $u_n$ ?
250
+
251
+ Utilise le terme général de $u_n$ pour déterminer la hauteur de la plante au bout de $${target.frenchify()}$ jours.`;
252
+ },
253
+ getCorrectionStuff: (initial, reason, _firstRank) => {
254
+ return {
255
+ str: `Chaque jour, la plante gagne $${reason.frenchify()}\\ \\textrm{cm}$.
256
+ La hauteur de la plante relevée chaque jour, en $\\textrm{cm}$, est donc une suite arithmétique de premier terme $${initial.frenchify()}$ et de raison $${reason.frenchify()}$.`,
257
+ };
258
+ },
259
+ },
260
+ variationFindRank: {
261
+ getStrQuestion: (_initial, _reason, _firstRank, ...otherArgs) => {
262
+ const [valueAsked] = otherArgs;
263
+ return `Quel jour la plante aura-t-elle atteint une hauteur de $${round(valueAsked, 2).frenchify()} \\ \\textrm{cm}$ ?`;
264
+ },
265
+ getAnswerNode: (initial, reason, firstRank, ...otherArgs) => {
266
+ const [valueAsked] = otherArgs;
267
+ return seqArithmeticUtils.getAnswerNodeRandomRank(initial, reason, firstRank, valueAsked);
268
+ },
269
+ getHint: (_firstRank, ...otherArgs) => {
270
+ const [valueAsked] = otherArgs;
271
+ return `Quelle est la nature de la suite $u_n$ ?
272
+
273
+ Utilise le terme général de $u_n$ pour déterminer quand $u_n = ${valueAsked.frenchify()}$.`;
274
+ },
275
+ getCorrectionStuff: (initial, reason, _firstRank) => {
276
+ return {
277
+ str: `Chaque jour, la plante gagne $${reason.frenchify()}\\ \\textrm{cm}$.
278
+ La hauteur de la plante relevée chaque jour, en $\\textrm{cm}$, est donc une suite arithmétique de premier terme $${initial.frenchify()}$ et de raison $${reason.frenchify()}$.`,
279
+ };
280
+ },
281
+ },
282
+ variationFindThreshold: {
283
+ getStrQuestion: (_initial, _reason, _firstRank, ...otherArgs) => {
284
+ const [valueThreshold, inequationSymbol] = otherArgs;
285
+ const isStrict = inequationSymbol.symbol === "<" || inequationSymbol.symbol === ">";
286
+ switch (inequationSymbol.symbol) {
287
+ case "<":
288
+ case "\\le":
289
+ return `Quel sera le dernier jour où la hauteur de la plante sera ${isStrict ? "strictement" : ""} plus petite que $${valueThreshold.frenchify()} \\ \\textrm{cm}$ ?`;
290
+ case ">":
291
+ case "\\ge":
292
+ return `Quel sera le premier jour où la hauteur de la plante sera ${isStrict ? "strictement" : ""} plus grande que $${valueThreshold.frenchify()} \\ \\textrm{cm}$ ?`;
293
+ }
294
+ },
295
+ getAnswerNode: (initial, reason, firstRank, ...otherArgs) => {
296
+ const [valueThreshold, inequationSymbol] = otherArgs;
297
+ return seqArithmeticUtils.getAnswerNodeThresholdRank(initial, reason, firstRank, valueThreshold, inequationSymbol);
298
+ },
299
+ getHint: (_firstRank, ...otherArgs) => {
300
+ const [valueThreshold, inequationSymbol, reason] = otherArgs;
301
+ const inequationSymbolForRank = reason < 0 ? inequationSymbol.toReversed() : inequationSymbol;
302
+ const texP = (() => {
303
+ switch (inequationSymbolForRank.symbol) {
304
+ case "<":
305
+ case "\\le":
306
+ return "le plus grand entier";
307
+ case ">":
308
+ case "\\ge":
309
+ return "le plus petit entier";
310
+ }
311
+ })();
312
+ return `Quelle est la nature de la suite $u_n$ ?
313
+
314
+ Utilise le terme général de $(u_n)$ pour déterminer ${texP} $p$ tel que $u_p ${inequationSymbol.symbol} ${valueThreshold.frenchify()}$.`;
315
+ },
316
+ getCorrectionStuff: (initial, reason, _firstRank) => {
317
+ return {
318
+ str: `Chaque jour, la plante gagne $${reason.frenchify()}\\ \\textrm{cm}$.
319
+ La hauteur de la plante relevée chaque jour, en $\\textrm{cm}$, est donc une suite arithmétique de premier terme $${initial.frenchify()}$ et de raison $${reason.frenchify()}$.`,
320
+ };
321
+ },
322
+ },
323
+ },
324
+ //taxi
325
+ {
326
+ randInitial: () => randint(10, 20),
327
+ randReason: () => randfloat(0, 0.5, 2, [0]),
328
+ randThreshold: (initial, reason, firstRank) => seqArithmeticUtils.randThreshold(initial, reason, firstRank, 2),
329
+ randSuperfluousData: () => {
330
+ const rand = randint(0, 2);
331
+ const values = [];
332
+ switch (rand) {
333
+ case 0:
334
+ {
335
+ const fuelConsumptionPer100Km = randint(10, 20);
336
+ values.push(fuelConsumptionPer100Km);
337
+ }
338
+ break;
339
+ case 1:
340
+ {
341
+ const distanceToNextCityInKm = randint(6, 46);
342
+ values.push(distanceToNextCityInKm);
343
+ }
344
+ break;
345
+ }
346
+ return {
347
+ rand,
348
+ values,
349
+ };
350
+ },
351
+ getStrSituation: (initial, reason, firstRank, superfluousData) => {
352
+ if (superfluousData === undefined) {
353
+ return `Une compagnie de taxis propose un tarif qui inclut un montant fixe de $${initial.frenchify()}\\ \\textrm{€}$
354
+ et un montant variable de $${reason.frenchify()}\\ \\textrm{€}$ par kilomètre parcouru.
355
+ On note $u_n$ le prix payé (en $\\textrm{€}$) pour $${getStrFactor(firstRank)} \\ \\textrm{km}$ parcourus.`;
356
+ }
357
+ else {
358
+ switch (superfluousData.rand) {
359
+ case 0:
360
+ {
361
+ const [fuelConsumptionPer100Km] = superfluousData.values;
362
+ return `Une compagnie de taxis propose un tarif qui inclut un montant fixe de $${initial.frenchify()}\\ \\textrm{€}$
363
+ et un montant variable de $${reason.frenchify()}\\ \\textrm{€}$ par kilomètre parcouru.
364
+ Le taxi consomme $${fuelConsumptionPer100Km.frenchify()} \\ \\textrm{L}$ d'essence tous les 100 kilomètres.
365
+ On note $u_n$ le prix payé (en $\\textrm{€}$) pour $${getStrFactor(firstRank)} \\ \\textrm{km}$ parcourus.`;
366
+ }
367
+ break;
368
+ case 1:
369
+ {
370
+ const [distanceToNextCityInKm] = superfluousData.values;
371
+ return `Une compagnie de taxis propose un tarif qui inclut un montant fixe de $${initial.frenchify()}\\ \\textrm{€}$
372
+ et un montant variable de $${reason.frenchify()}\\ \\textrm{€}$ par kilomètre parcouru.
373
+ La distance à la ville la plus proche est de $${distanceToNextCityInKm.frenchify()} \\ \\textrm{km}$.
374
+ On note $u_n$ le prix payé (en $\\textrm{€}$) pour $${getStrFactor(firstRank)} \\ \\textrm{km}$ parcourus.`;
375
+ }
376
+ break;
377
+ default:
378
+ throw new Error("Unsupported superfluousData.rand: " + superfluousData.rand);
379
+ }
380
+ }
381
+ },
382
+ variationFindExplicitFormula: {
383
+ getAnswerNode: seqArithmeticUtils.getAnswerNodeExplicitFormula,
384
+ getHint: (firstRank) => `Quel calcul permet de trouver le prix payé pour $10 \\ \\textrm{km}$ ?
385
+
386
+ Inspire toi de ce calcul pour déterminer la hauteur de la plante au bout de $${getStrFactor(firstRank)} \\ \\textrm{km}$.`,
387
+ getCorrectionStuff: (initial, reason, _firstRank) => {
388
+ return {
389
+ str: `Pour chaque kilomètre supplémentaire, la facture augmente de $${reason.frenchify()}\\ \\textrm{€}$.
390
+ La facture est donc une suite arithmétique de premier terme $${initial.frenchify()}$ et de raison $${reason.frenchify()}$.`,
391
+ };
392
+ },
393
+ },
394
+ variationFindRecurrenceFormula: {
395
+ getAnswerNode: seqArithmeticUtils.getAnswerNodeRecurrenceFormula,
396
+ getHint: (_firstRank) => `Si tu connais la facture pour $10 \\ \\textrm{km}$, comment fais-tu pour calculer la facture pour $11 \\ \\textrm{km}$ ?
397
+
398
+ Déduis-en comment calculer $u_{n+1}$ à partir de $u_n$.`,
399
+ getCorrectionStuff: (_initial, reason, firstRank) => {
400
+ const target1 = 10;
401
+ const target2 = 11;
402
+ const [rank1, rank2] = [target1, target2].map((target) => target + firstRank);
403
+ return {
404
+ str: `Pour chaque kilomètre supplémentaire, la facture augmente de $${reason.frenchify()}\\ \\textrm{€}$.
405
+ Par exemple, la facture pour $${target2.frenchify()} \\ \\textrm{km}$ est égale à celle de $${target1.frenchify()} \\ \\textrm{km}$ augmentée de $${reason.frenchify()}\\ \\textrm{€}$.`,
406
+ rank1,
407
+ rank2,
408
+ };
409
+ },
410
+ },
411
+ variationFindRandomTerm: {
412
+ getAnswerNode: (initial, reason, firstRank, ...otherArgs) => {
413
+ const [rankAsked] = otherArgs;
414
+ return seqArithmeticUtils.getAnswerNodeRandomTerm(initial, reason, firstRank, rankAsked);
415
+ },
416
+ getHint: (firstRank, ...otherArgs) => {
417
+ const [rankAsked] = otherArgs;
418
+ const target = rankAsked - firstRank;
419
+ return `Quelle est la nature de la suite $u_n$ ?
420
+
421
+ Utilise le terme général de $u_n$ pour déterminer la facture pour $${target.frenchify()} \\ \\textrm{km}$.`;
422
+ },
423
+ getCorrectionStuff: (initial, reason, _firstRank) => {
424
+ return {
425
+ str: `Pour chaque kilomètre supplémentaire, la facture augmente de $${reason.frenchify()}\\ \\textrm{€}$.
426
+ La facture est donc une suite arithmétique de premier terme $${initial.frenchify()}$ et de raison $${reason.frenchify()}$.`,
427
+ };
428
+ },
429
+ },
430
+ variationFindRank: {
431
+ getStrQuestion: (_initial, _reason, _firstRank, ...otherArgs) => {
432
+ const [valueAsked] = otherArgs;
433
+ return `Quel est le rang $p$ pour lequel $u_{p} = ${round(valueAsked, 2).frenchify()} \\ \\textrm{€}$ ?`;
434
+ },
435
+ getAnswerNode: (initial, reason, firstRank, ...otherArgs) => {
436
+ const [valueAsked] = otherArgs;
437
+ return seqArithmeticUtils.getAnswerNodeRandomRank(initial, reason, firstRank, valueAsked);
438
+ },
439
+ getHint: (_firstRank, ...otherArgs) => {
440
+ const [valueAsked] = otherArgs;
441
+ return `Quelle est la nature de la suite $(u_n)$ ?
442
+
443
+ Utilise le terme général de $(u_n)$ pour déterminer quand $u_p = ${valueAsked.frenchify()}$.`;
444
+ },
445
+ getCorrectionStuff: (initial, reason, _firstRank) => {
446
+ return {
447
+ str: `Pour chaque kilomètre supplémentaire, la facture augmente de $${reason.frenchify()}\\ \\textrm{€}$.
448
+ La facture est donc une suite arithmétique de premier terme $${initial.frenchify()}$ et de raison $${reason.frenchify()}$.`,
449
+ };
450
+ },
451
+ },
452
+ variationFindThreshold: {
453
+ getStrQuestion: (_initial, _reason, _firstRank, ...otherArgs) => {
454
+ const [valueThreshold, inequationSymbol] = otherArgs;
455
+ const isStrict = inequationSymbol.symbol === "<" || inequationSymbol.symbol === ">";
456
+ switch (inequationSymbol.symbol) {
457
+ case "<":
458
+ case "\\le":
459
+ return `Quel est le plus grand rang $p$ où $u_{p}$ est ${isStrict ? "strictement" : ""} plus petit que $${valueThreshold.frenchify()} \\ \\textrm{€}$ ?`;
460
+ case ">":
461
+ case "\\ge":
462
+ return `Quel est le plus petit rang $p$ où $u_{p}$ est ${isStrict ? "strictement" : ""} plus grand que $${valueThreshold.frenchify()} \\ \\textrm{€}$ ?`;
463
+ }
464
+ },
465
+ getAnswerNode: (initial, reason, firstRank, ...otherArgs) => {
466
+ const [valueThreshold, inequationSymbol] = otherArgs;
467
+ return seqArithmeticUtils.getAnswerNodeThresholdRank(initial, reason, firstRank, valueThreshold, inequationSymbol);
468
+ },
469
+ getHint: (_firstRank, ...otherArgs) => {
470
+ const [valueThreshold, inequationSymbol, reason] = otherArgs;
471
+ const inequationSymbolForRank = reason < 0 ? inequationSymbol.toReversed() : inequationSymbol;
472
+ const texP = (() => {
473
+ switch (inequationSymbolForRank.symbol) {
474
+ case "<":
475
+ case "\\le":
476
+ return "le plus grand entier";
477
+ case ">":
478
+ case "\\ge":
479
+ return "le plus petit entier";
480
+ }
481
+ })();
482
+ return `Quelle est la nature de la suite $u_n$ ?
483
+
484
+ Utilise le terme général de $(u_n)$ pour déterminer ${texP} $p$ tel que $u_p ${inequationSymbol.symbol} ${valueThreshold.frenchify()}$.`;
485
+ },
486
+ getCorrectionStuff: (initial, reason, _firstRank) => {
487
+ return {
488
+ str: `Pour chaque kilomètre supplémentaire, la facture augmente de $${reason.frenchify()}\\ \\textrm{€}$.
489
+ La facture est donc une suite arithmétique de premier terme $${initial.frenchify()}$ et de raison $${reason.frenchify()}$.`,
490
+ };
491
+ },
492
+ },
493
+ },
494
+ //électricité
495
+ {
496
+ randInitial: () => randint(10, 20),
497
+ randReason: () => randfloat(0, 0.5, 2, [0]),
498
+ randThreshold: (initial, reason, firstRank) => seqArithmeticUtils.randThreshold(initial, reason, firstRank, 2),
499
+ randSuperfluousData: () => {
500
+ const rand = randint(0, 2);
501
+ const values = [];
502
+ switch (rand) {
503
+ case 0:
504
+ {
505
+ const fridgeConsumptionPerMonth = randfloat(0.85, 0.95) * 30;
506
+ values.push(fridgeConsumptionPerMonth);
507
+ }
508
+ break;
509
+ case 1:
510
+ {
511
+ const internetBill = randint(10, 30);
512
+ values.push(internetBill);
513
+ }
514
+ break;
515
+ }
516
+ return {
517
+ rand,
518
+ values,
519
+ };
520
+ },
521
+ getStrSituation: (initial, reason, firstRank, superfluousData) => {
522
+ if (superfluousData === undefined) {
523
+ return `Pour l’électricité de sa maison, Jimmy paye
524
+ un abonnement fixe de $${initial.frenchify()}\\ \\textrm{€}$
525
+ puis il paye $${reason.frenchify()}\\ \\textrm{€}$ par kWh consommé.
526
+ On note $u_n$ la facture (en $\\textrm{€}$) pour $${getStrFactor(firstRank)} \\ \\textrm{kWh}$ consommés.`;
527
+ }
528
+ else {
529
+ switch (superfluousData.rand) {
530
+ case 0:
531
+ {
532
+ const [fridgeConsumptionPerMonth] = superfluousData.values;
533
+ return `Pour l’électricité de sa maison, Jimmy paye
534
+ un abonnement fixe de $${initial.frenchify()}\\ \\textrm{€}$
535
+ puis il paye $${reason.frenchify()}\\ \\textrm{€}$ par kWh consommé.
536
+ Son refrigétateur consomme $${fridgeConsumptionPerMonth.frenchify()} \\ \\textrm{kWh}$ tous les mois.
537
+ On note $u_n$ la facture (en $\\textrm{€}$) pour $${getStrFactor(firstRank)} \\ \\textrm{kWh}$ consommés.`;
538
+ }
539
+ break;
540
+ case 1:
541
+ {
542
+ const [internetBill] = superfluousData.values;
543
+ return `Pour l’électricité de sa maison, Jimmy paye
544
+ un abonnement fixe de $${initial.frenchify()}\\ \\textrm{€}$
545
+ puis il paye $${reason.frenchify()}\\ \\textrm{€}$ par kWh consommé.
546
+ Jimmy paye $${internetBill.frenchify()}\\ \\textrm{€}$ tous les mois pour son abonnement internet.
547
+ On note $u_n$ la facture (en $\\textrm{€}$) pour $${getStrFactor(firstRank)} \\ \\textrm{kWh}$ consommés.`;
548
+ }
549
+ break;
550
+ default:
551
+ throw new Error("Unsupported superfluousData.rand: " + superfluousData.rand);
552
+ }
553
+ }
554
+ },
555
+ variationFindExplicitFormula: {
556
+ getAnswerNode: seqArithmeticUtils.getAnswerNodeExplicitFormula,
557
+ getHint: (firstRank) => `Quel calcul permet de trouver le prix payé pour $10 \\ \\textrm{kWh}$ ?
558
+
559
+ Inspire toi de ce calcul pour déterminer le prix à payer pour $${getStrFactor(firstRank)} \\ \\textrm{kWh}$.`,
560
+ getCorrectionStuff: (initial, reason, _firstRank) => {
561
+ return {
562
+ str: `Pour chaque $\\textrm{kWh}$ supplémentaire, la facture augmente de $${reason.frenchify()}\\ \\textrm{€}$.
563
+ La facture est donc une suite arithmétique de premier terme $${initial.frenchify()}$ et de raison $${reason.frenchify()}$.`,
564
+ };
565
+ },
566
+ },
567
+ variationFindRecurrenceFormula: {
568
+ getAnswerNode: seqArithmeticUtils.getAnswerNodeRecurrenceFormula,
569
+ getHint: (_firstRank) => `Si tu connais la facture pour $10 \\ \\textrm{kWh}$, comment fais-tu pour calculer la facture pour $11 \\ \\textrm{kWh}$ ?
570
+
571
+ Déduis-en comment calculer $u_{n+1}$ à partir de $u_n$.`,
572
+ getCorrectionStuff: (_initial, reason, firstRank) => {
573
+ const target1 = 10;
574
+ const target2 = 11;
575
+ const [rank1, rank2] = [target1, target2].map((target) => target + firstRank);
576
+ return {
577
+ str: `Pour chaque $\\textrm{kWh}$ supplémentaire, la facture augmente de $${reason.frenchify()}\\ \\textrm{€}$.
578
+ Par exemple, la facture pour $${target2.frenchify()} \\ \\textrm{kWh}$ est égale à celle de $${target1.frenchify()} \\ \\textrm{kWh}$ augmentée de $${reason.frenchify()}\\ \\textrm{€}$.`,
579
+ rank1,
580
+ rank2,
581
+ };
582
+ },
583
+ },
584
+ variationFindRandomTerm: {
585
+ getAnswerNode: (initial, reason, firstRank, ...otherArgs) => {
586
+ const [rankAsked] = otherArgs;
587
+ return seqArithmeticUtils.getAnswerNodeRandomTerm(initial, reason, firstRank, rankAsked);
588
+ },
589
+ getHint: (firstRank, ...otherArgs) => {
590
+ const [rankAsked] = otherArgs;
591
+ const target = rankAsked - firstRank;
592
+ return `Quelle est la nature de la suite $u_n$ ?
593
+
594
+ Utilise le terme général de $u_n$ pour déterminer la facture pour $${target.frenchify()} \\ \\textrm{kWh}$.`;
595
+ },
596
+ getCorrectionStuff: (initial, reason, _firstRank) => {
597
+ return {
598
+ str: `Pour chaque $\\textrm{kWh}$ supplémentaire, la facture augmente de $${reason.frenchify()}\\ \\textrm{€}$.
599
+ La facture est donc une suite arithmétique de premier terme $${initial.frenchify()}$ et de raison $${reason.frenchify()}$.`,
600
+ };
601
+ },
602
+ },
603
+ variationFindRank: {
604
+ getStrQuestion: (_initial, _reason, _firstRank, ...otherArgs) => {
605
+ const [valueAsked] = otherArgs;
606
+ return `Quel est le rang $p$ pour lequel $u_{p} = ${round(valueAsked, 2).frenchify()} \\ \\textrm{€}$ ?`;
607
+ },
608
+ getAnswerNode: (initial, reason, firstRank, ...otherArgs) => {
609
+ const [valueAsked] = otherArgs;
610
+ return seqArithmeticUtils.getAnswerNodeRandomRank(initial, reason, firstRank, valueAsked);
611
+ },
612
+ getHint: (_firstRank, ...otherArgs) => {
613
+ const [valueAsked] = otherArgs;
614
+ return `Quelle est la nature de la suite $(u_n)$ ?
615
+
616
+ Utilise le terme général de $(u_n)$ pour déterminer quand $u_p = ${valueAsked.frenchify()}$.`;
617
+ },
618
+ getCorrectionStuff: (initial, reason, _firstRank) => {
619
+ return {
620
+ str: `Pour chaque $\\textrm{kWh}$ supplémentaire, la facture augmente de $${reason.frenchify()}\\ \\textrm{€}$.
621
+ La facture est donc une suite arithmétique de premier terme $${initial.frenchify()}$ et de raison $${reason.frenchify()}$.`,
622
+ };
623
+ },
624
+ },
625
+ variationFindThreshold: {
626
+ getStrQuestion: (_initial, _reason, _firstRank, ...otherArgs) => {
627
+ const [valueThreshold, inequationSymbol] = otherArgs;
628
+ const isStrict = inequationSymbol.symbol === "<" || inequationSymbol.symbol === ">";
629
+ switch (inequationSymbol.symbol) {
630
+ case "<":
631
+ case "\\le":
632
+ return `Quel est le plus grand rang $p$ où $u_{p}$ est ${isStrict ? "strictement" : ""} plus petit que $${valueThreshold.frenchify()} \\ \\textrm{€}$ ?`;
633
+ case ">":
634
+ case "\\ge":
635
+ return `Quel est le plus petit rang $p$ où $u_{p}$ est ${isStrict ? "strictement" : ""} plus grand que $${valueThreshold.frenchify()} \\ \\textrm{€}$ ?`;
636
+ }
637
+ },
638
+ getAnswerNode: (initial, reason, firstRank, ...otherArgs) => {
639
+ const [valueThreshold, inequationSymbol] = otherArgs;
640
+ return seqArithmeticUtils.getAnswerNodeThresholdRank(initial, reason, firstRank, valueThreshold, inequationSymbol);
641
+ },
642
+ getHint: (_firstRank, ...otherArgs) => {
643
+ const [valueThreshold, inequationSymbol, reason] = otherArgs;
644
+ const inequationSymbolForRank = reason < 0 ? inequationSymbol.toReversed() : inequationSymbol;
645
+ const texP = (() => {
646
+ switch (inequationSymbolForRank.symbol) {
647
+ case "<":
648
+ case "\\le":
649
+ return "le plus grand entier";
650
+ case ">":
651
+ case "\\ge":
652
+ return "le plus petit entier";
653
+ }
654
+ })();
655
+ return `Quelle est la nature de la suite $u_n$ ?
656
+
657
+ Utilise le terme général de $(u_n)$ pour déterminer ${texP} $p$ tel que $u_p ${inequationSymbol.symbol} ${valueThreshold.frenchify()}$.`;
658
+ },
659
+ getCorrectionStuff: (initial, reason, _firstRank) => {
660
+ return {
661
+ str: `Pour chaque $\\textrm{kWh}$ supplémentaire, la facture augmente de $${reason.frenchify()}\\ \\textrm{€}$.
662
+ La facture est donc une suite arithmétique de premier terme $${initial.frenchify()}$ et de raison $${reason.frenchify()}$.`,
663
+ };
664
+ },
665
+ },
666
+ },
667
+ //Dany
668
+ {
669
+ randInitial: () => randint(0, 10),
670
+ randReason: () => randfloat(0.5, 1, 2),
671
+ randThreshold: (initial, reason, firstRank) => seqArithmeticUtils.randThreshold(initial, reason, firstRank, 2),
672
+ randSuperfluousData: () => {
673
+ const rand = randint(0, 2);
674
+ const values = [];
675
+ switch (rand) {
676
+ case 0:
677
+ {
678
+ const fuelConsumptionPer100Km = randint(10, 20);
679
+ values.push(fuelConsumptionPer100Km);
680
+ }
681
+ break;
682
+ case 1:
683
+ {
684
+ const distanceToNextBreakInKm = randint(150, 300);
685
+ values.push(distanceToNextBreakInKm);
686
+ }
687
+ break;
688
+ }
689
+ return {
690
+ rand,
691
+ values,
692
+ };
693
+ },
694
+ getStrSituation: (initial, reason, firstRank, superfluousData) => {
695
+ if (superfluousData === undefined) {
696
+ return `Dany décide de partir au Sud de la France.
697
+ Il part de Valenciennes où il fait $${initial.frenchify()} \\ \\textrm{°C}$.
698
+ La température ambiante augmente de $${reason.frenchify()}\\ \\textrm{°C}$ à chaque centaine de $\\textrm{km}$ vers le Sud.
699
+ On note $u_n$ la température ambiante (en $\\textrm{°C}$) pour $${getStrFactor(firstRank)}$ centaines de $\\textrm{km}$ parcourus vers le Sud.`;
700
+ }
701
+ else {
702
+ switch (superfluousData.rand) {
703
+ case 0:
704
+ {
705
+ const [fuelConsumptionPer100Km] = superfluousData.values;
706
+ return `Dany décide de partir au Sud de la France. Il part de Valenciennes où il fait $${initial.frenchify()} \\ \\textrm{°C}$.
707
+ La température ambiante augmente de $${reason.frenchify()}\\ \\textrm{°C}$ à chaque centaine de $\\textrm{km}$ vers le Sud.
708
+ Sa voiture consomme $${fuelConsumptionPer100Km.frenchify()} \\ \\textrm{L}$ d'essence tous les 100 kilomètres.
709
+ On note $u_n$ la température ambiante (en $\\textrm{°C}$) pour $${getStrFactor(firstRank)}$ centaines de $\\textrm{km}$ parcourus vers le Sud.`;
710
+ }
711
+ break;
712
+ case 1:
713
+ {
714
+ const [distanceToNextBreakInKm] = superfluousData.values;
715
+ return `Dany décide de partir au Sud de la France. Il part de Valenciennes où il fait $${initial.frenchify()} \\ \\textrm{°C}$.
716
+ La température ambiante augmente de $${reason.frenchify()}\\ \\textrm{°C}$ à chaque centaine de $\\textrm{km}$ vers le Sud.
717
+ Il fait une pause en moyenne tous les $${distanceToNextBreakInKm.frenchify()}$ kilomètres.
718
+ On note $u_n$ la température ambiante (en $\\textrm{°C}$) pour $${getStrFactor(firstRank)}$ centaines de $\\textrm{km}$ parcourus vers le Sud.`;
719
+ }
720
+ break;
721
+ default:
722
+ throw new Error("Unsupported superfluousData.rand: " + superfluousData.rand);
723
+ }
724
+ }
725
+ },
726
+ variationFindExplicitFormula: {
727
+ getAnswerNode: seqArithmeticUtils.getAnswerNodeExplicitFormula,
728
+ getHint: (firstRank) => `Quel calcul permet de trouver la température pour $2$ centaines de $\\textrm{km}$ parcourus ?
729
+
730
+ Inspire toi de ce calcul pour déterminer la température pour $${getStrFactor(firstRank)}$ centaines de $\\textrm{km}$ parcourus.`,
731
+ getCorrectionStuff: (initial, reason, firstRank) => {
732
+ return {
733
+ str: `Pour chaque centaine de $\\textrm{km}$ parcourue, la température augmente de $${reason.frenchify()} \\ \\textrm{°C}$.
734
+ Au bout de $${getStrFactor(firstRank)}$ centaines de $\\textrm{km}$, la température augmente donc de $${getStrFactor(firstRank)} \\times ${reason.frenchify()} \\ \\textrm{°C}$.
735
+
736
+ Au départ, la température est de $${initial.frenchify()} \\ \\textrm{°C}$.
737
+
738
+ La température, en $\\textrm{°C}$, est donc une suite arithmétique de premier terme $${initial.frenchify()}$ et de raison $${reason.frenchify()}$.`,
739
+ };
740
+ },
741
+ },
742
+ variationFindRecurrenceFormula: {
743
+ getAnswerNode: seqArithmeticUtils.getAnswerNodeRecurrenceFormula,
744
+ getHint: (_firstRank) => `Si tu connais la température ambiante pour $300 \\ \\textrm{km}$ parcourus, comment fais-tu pour calculer la température ambiante pour $400 \\ \\textrm{km}$ parcourus ?
745
+
746
+ Déduis-en comment calculer $u_{n+1}$ à partir de $u_n$.`,
747
+ getCorrectionStuff: (_initial, reason, firstRank) => {
748
+ const target1 = 300;
749
+ const target2 = 400;
750
+ const [rank1, rank2] = [target1, target2].map((target) => target / 100 + firstRank);
751
+ return {
752
+ str: `Pour chaque centaine de $\\textrm{km}$ supplémentaire, la température augmente de $${reason.frenchify()}\\ \\textrm{°C}$.
753
+ Par exemple, la température après $${target2.frenchify()} \\ \\textrm{km}$ parcourus est égale à celle après $${target1.frenchify()} \\ \\textrm{km}$ augmentée de $${reason.frenchify()}\\ \\textrm{°C}$.`,
754
+ rank1,
755
+ rank2,
756
+ };
757
+ },
758
+ },
759
+ variationFindRandomTerm: {
760
+ getAnswerNode: (initial, reason, firstRank, ...otherArgs) => {
761
+ const [rankAsked] = otherArgs;
762
+ return seqArithmeticUtils.getAnswerNodeRandomTerm(initial, reason, firstRank, rankAsked);
763
+ },
764
+ getHint: (firstRank, ...otherArgs) => {
765
+ const [rankAsked] = otherArgs;
766
+ const target = (rankAsked - firstRank) * 100;
767
+ return `Quelle est la nature de la suite $u_n$ ?
768
+
769
+ Utilise le terme général de $u_n$ pour déterminer la température pour $${target.frenchify()} \\ \\textrm{km}$ parcourus.`;
770
+ },
771
+ getCorrectionStuff: (initial, reason, _firstRank) => {
772
+ return {
773
+ str: `Pour chaque centaine de $\\textrm{km}$ supplémentaire, la température ambiante augmente de $${reason.frenchify()}\\ \\textrm{°C}$.
774
+ La température ambiante est donc une suite arithmétique de premier terme $${initial.frenchify()}$ et de raison $${reason.frenchify()}$.`,
775
+ };
776
+ },
777
+ },
778
+ variationFindRank: {
779
+ getStrQuestion: (_initial, _reason, _firstRank, ...otherArgs) => {
780
+ const [valueAsked] = otherArgs;
781
+ return `Quel est le rang $p$ pour lequel $u_{p} = ${round(valueAsked, 2).frenchify()} \\ \\textrm{€}$ ?`;
782
+ },
783
+ getAnswerNode: (initial, reason, firstRank, ...otherArgs) => {
784
+ const [valueAsked] = otherArgs;
785
+ return seqArithmeticUtils.getAnswerNodeRandomRank(initial, reason, firstRank, valueAsked);
786
+ },
787
+ getHint: (_firstRank, ...otherArgs) => {
788
+ const [valueAsked] = otherArgs;
789
+ return `Quelle est la nature de la suite $(u_n)$ ?
790
+
791
+ Utilise le terme général de $(u_n)$ pour déterminer quand $u_p = ${valueAsked.frenchify()}$.`;
792
+ },
793
+ getCorrectionStuff: (initial, reason, _firstRank) => {
794
+ return {
795
+ str: `Pour chaque centaine de $\\textrm{km}$ supplémentaire, la température ambiante augmente de $${reason.frenchify()}\\ \\textrm{°C}$.
796
+ La température ambiante est donc une suite arithmétique de premier terme $${initial.frenchify()}$ et de raison $${reason.frenchify()}$.`,
797
+ };
798
+ },
799
+ },
800
+ variationFindThreshold: {
801
+ getStrQuestion: (_initial, _reason, _firstRank, ...otherArgs) => {
802
+ const [valueThreshold, inequationSymbol] = otherArgs;
803
+ const isStrict = inequationSymbol.symbol === "<" || inequationSymbol.symbol === ">";
804
+ switch (inequationSymbol.symbol) {
805
+ case "<":
806
+ case "\\le":
807
+ return `Quel est le plus grand rang $p$ où $u_{p}$ est ${isStrict ? "strictement" : ""} plus petit que $${valueThreshold.frenchify()} \\ \\textrm{°C}$ ?`;
808
+ case ">":
809
+ case "\\ge":
810
+ return `Quel est le plus petit rang $p$ où $u_{p}$ est ${isStrict ? "strictement" : ""} plus grand que $${valueThreshold.frenchify()} \\ \\textrm{°C}$ ?`;
811
+ }
812
+ },
813
+ getAnswerNode: (initial, reason, firstRank, ...otherArgs) => {
814
+ const [valueThreshold, inequationSymbol] = otherArgs;
815
+ return seqArithmeticUtils.getAnswerNodeThresholdRank(initial, reason, firstRank, valueThreshold, inequationSymbol);
816
+ },
817
+ getHint: (_firstRank, ...otherArgs) => {
818
+ const [valueThreshold, inequationSymbol, reason] = otherArgs;
819
+ const inequationSymbolForRank = reason < 0 ? inequationSymbol.toReversed() : inequationSymbol;
820
+ const texP = (() => {
821
+ switch (inequationSymbolForRank.symbol) {
822
+ case "<":
823
+ case "\\le":
824
+ return "le plus grand entier";
825
+ case ">":
826
+ case "\\ge":
827
+ return "le plus petit entier";
828
+ }
829
+ })();
830
+ return `Quelle est la nature de la suite $u_n$ ?
831
+
832
+ Utilise le terme général de $(u_n)$ pour déterminer ${texP} $p$ tel que $u_p ${inequationSymbol.symbol} ${valueThreshold.frenchify()}$.`;
833
+ },
834
+ getCorrectionStuff: (initial, reason, _firstRank) => {
835
+ return {
836
+ str: `Pour chaque centaine de $\\textrm{km}$ supplémentaire, la température ambiante augmente de $${reason.frenchify()}\\ \\textrm{°C}$.
837
+ La température ambiante est donc une suite arithmétique de premier terme $${initial.frenchify()}$ et de raison $${reason.frenchify()}$.`,
838
+ };
839
+ },
840
+ },
841
+ },
842
+ //Emma
843
+ {
844
+ randInitial: () => randint(12, 17) * 100,
845
+ randReason: () => randfloat(20, 50, 2),
846
+ randThreshold: (initial, reason, firstRank) => seqArithmeticUtils.randThreshold(initial, reason, firstRank, 2),
847
+ randSuperfluousData: () => {
848
+ const rand = randint(0, 2);
849
+ const values = [];
850
+ switch (rand) {
851
+ case 0:
852
+ {
853
+ const ageWhenHired = randint(20, 40);
854
+ values.push(ageWhenHired);
855
+ }
856
+ break;
857
+ case 1:
858
+ {
859
+ const salaryOfCoworker = randint(1500, 3600);
860
+ values.push(salaryOfCoworker);
861
+ }
862
+ break;
863
+ }
864
+ return {
865
+ rand,
866
+ values,
867
+ };
868
+ },
869
+ getStrSituation: (initial, reason, firstRank, superfluousData) => {
870
+ if (superfluousData === undefined) {
871
+ return `Emma est salariée. Son salaire net était
872
+ de $${initial.frenchify()}\\ \\textrm{€}$ à son entrée dans l'entreprise,
873
+ et augmente de $${reason.frenchify()}$ € tous les ans.
874
+ On note $u_n$ son salaire net (en $\\textrm{€}$) quand elle aura $${getStrFactor(firstRank)}$ années d'ancienneté.`;
875
+ }
876
+ else {
877
+ switch (superfluousData.rand) {
878
+ case 0:
879
+ {
880
+ const [ageWhenHired] = superfluousData.values;
881
+ return `Emma est salariée.
882
+ Son salaire net était de $${initial.frenchify()}\\ \\textrm{€}$ à son entrée dans l'entreprise.
883
+ Elle avait alors $${ageWhenHired.frenchify()}$ ans.
884
+ Son salaire augmente de $${reason.frenchify()}\\ \\textrm{€}$ tous les ans.
885
+
886
+ On note $u_n$ son salaire net (en $\\textrm{€}$) quand elle aura $${getStrFactor(firstRank)}$ années d'ancienneté.`;
887
+ }
888
+ break;
889
+ case 1:
890
+ {
891
+ const [salaryOfCoworker] = superfluousData.values;
892
+ return `Emma est salariée.
893
+ Son salaire net était de $${initial.frenchify()}\\ \\textrm{€}$ à son entrée dans l'entreprise.
894
+ Sa collègue Flora gagnait alors $${salaryOfCoworker.frenchify()} \\ \\textrm{€}$.
895
+ Son salaire augmente de $${reason.frenchify()} \\ \\textrm{€}$ tous les ans.
896
+
897
+ On note $u_n$ son salaire net (en $\\textrm{€}$) quand elle aura $${getStrFactor(firstRank)}$ années d'ancienneté.`;
898
+ }
899
+ break;
900
+ default:
901
+ throw new Error("Unsupported superfluousData.rand: " + superfluousData.rand);
902
+ }
903
+ }
904
+ },
905
+ variationFindExplicitFormula: {
906
+ getAnswerNode: seqArithmeticUtils.getAnswerNodeExplicitFormula,
907
+ getHint: (firstRank) => `Quel calcul permet de trouver son salaire net pour $10$ années d'ancienneté ?
908
+
909
+ Inspire toi de ce calcul pour déterminer son salaire net pour $${getStrFactor(firstRank)}$ années d'ancienneté.
910
+ `,
911
+ getCorrectionStuff: (initial, reason, firstRank) => {
912
+ return {
913
+ str: `Chaque année, son salaire net augmente de $${reason.frenchify()}\\ \\textrm{€}$.
914
+ Au bout de $${getStrFactor(firstRank)}$ années, son salaire net aura augmenté de $${getStrFactor(firstRank)} \\times ${reason.frenchify()}\\ \\textrm{€}$.
915
+
916
+ Au départ, son salaire net était de $${initial.frenchify()}\\ \\textrm{€}$.
917
+
918
+ Le salaire d'Emma, en $\\textrm{€}$, est donc une suite arithmétique de premier terme $${initial.frenchify()}$ et de raison $${reason.frenchify()}$.`,
919
+ };
920
+ },
921
+ },
922
+ variationFindRecurrenceFormula: {
923
+ getAnswerNode: seqArithmeticUtils.getAnswerNodeRecurrenceFormula,
924
+ getHint: (_firstRank) => `Si tu connais le salaire d'Emma pour $10$ ans d'ancienneté, comment fais-tu pour calculer son salaire pour $11$ ans d'ancienneté ?
925
+
926
+ Déduis-en comment calculer $u_{n+1}$ à partir de $u_n$.`,
927
+ getCorrectionStuff: (_initial, reason, firstRank) => {
928
+ const target1 = 10;
929
+ const target2 = 11;
930
+ const [rank1, rank2] = [target1, target2].map((target) => target + firstRank);
931
+ return {
932
+ str: `Pour chaque année supplémentaire, le salaire d'Emma augmente de $${reason.frenchify()}\\ \\textrm{€}$.
933
+ Par exemple, son salaire pour $${target2.frenchify()}$ ans d'ancienneté est égal à celui pour $${target1.frenchify()}$ ans augmenté de $${reason.frenchify()}\\ \\textrm{€}$.`,
934
+ rank1,
935
+ rank2,
936
+ };
937
+ },
938
+ },
939
+ variationFindRandomTerm: {
940
+ getAnswerNode: (initial, reason, firstRank, ...otherArgs) => {
941
+ const [rankAsked] = otherArgs;
942
+ return seqArithmeticUtils.getAnswerNodeRandomTerm(initial, reason, firstRank, rankAsked);
943
+ },
944
+ getHint: (firstRank, ...otherArgs) => {
945
+ const [rankAsked] = otherArgs;
946
+ const target = (rankAsked - firstRank) * 100;
947
+ return `Quelle est la nature de la suite $u_n$ ?
948
+
949
+ Utilise le terme général de $u_n$ pour déterminer le salaire d'Emma pour $${target.frenchify()}$ ans d'ancienneté.`;
950
+ },
951
+ getCorrectionStuff: (initial, reason, _firstRank) => {
952
+ return {
953
+ str: `Pour chaque année supplémentaire, le salaire d'Emma augmente de $${reason.frenchify()}\\ \\textrm{€}$.
954
+ Par exemple, son salaire pour $11$ ans d'ancienneté est égal à celui pour $10$ ans augmenté de $${reason.frenchify()}\\ \\textrm{€}$.
955
+
956
+ Au départ, son salaire net était de $${initial.frenchify()}\\ \\textrm{€}$.
957
+
958
+ Le salaire d'Emma, en $\\textrm{€}$, est donc une suite arithmétique de premier terme $${initial.frenchify()}$ et de raison $${reason.frenchify()}$.`,
959
+ };
960
+ },
961
+ },
962
+ variationFindRank: {
963
+ getStrQuestion: (_initial, _reason, _firstRank, ...otherArgs) => {
964
+ const [valueAsked] = otherArgs;
965
+ return `Quel est le rang $p$ pour lequel $u_{p} = ${round(valueAsked, 2).frenchify()} \\ \\textrm{€}$ ?`;
966
+ },
967
+ getAnswerNode: (initial, reason, firstRank, ...otherArgs) => {
968
+ const [valueAsked] = otherArgs;
969
+ return seqArithmeticUtils.getAnswerNodeRandomRank(initial, reason, firstRank, valueAsked);
970
+ },
971
+ getHint: (_firstRank, ...otherArgs) => {
972
+ const [valueAsked] = otherArgs;
973
+ return `Quelle est la nature de la suite $(u_n)$ ?
974
+
975
+ Utilise le terme général de $(u_n)$ pour déterminer quand $u_p = ${valueAsked.frenchify()}$.`;
976
+ },
977
+ getCorrectionStuff: (initial, reason, _firstRank) => {
978
+ return {
979
+ str: `Pour chaque année supplémentaire, le salaire d'Emma augmente de $${reason.frenchify()}\\ \\textrm{€}$.
980
+ Le salaire d'Emma, en $\\textrm{€}$, est donc une suite arithmétique de premier terme $${initial.frenchify()}$ et de raison $${reason.frenchify()}$.`,
981
+ };
982
+ },
983
+ },
984
+ variationFindThreshold: {
985
+ getStrQuestion: (_initial, _reason, _firstRank, ...otherArgs) => {
986
+ const [valueThreshold, inequationSymbol] = otherArgs;
987
+ const isStrict = inequationSymbol.symbol === "<" || inequationSymbol.symbol === ">";
988
+ switch (inequationSymbol.symbol) {
989
+ case "<":
990
+ case "\\le":
991
+ return `Quel est le plus grand rang $p$ où $u_{p}$ est ${isStrict ? "strictement" : ""} plus petit que $${valueThreshold.frenchify()} \\ \\textrm{€}$ ?`;
992
+ case ">":
993
+ case "\\ge":
994
+ return `Quel est le plus petit rang $p$ où $u_{p}$ est ${isStrict ? "strictement" : ""} plus grand que $${valueThreshold.frenchify()} \\ \\textrm{€}$ ?`;
995
+ }
996
+ },
997
+ getAnswerNode: (initial, reason, firstRank, ...otherArgs) => {
998
+ const [valueThreshold, inequationSymbol] = otherArgs;
999
+ return seqArithmeticUtils.getAnswerNodeThresholdRank(initial, reason, firstRank, valueThreshold, inequationSymbol);
1000
+ },
1001
+ getHint: (_firstRank, ...otherArgs) => {
1002
+ const [valueThreshold, inequationSymbol, reason] = otherArgs;
1003
+ const inequationSymbolForRank = reason < 0 ? inequationSymbol.toReversed() : inequationSymbol;
1004
+ const texP = (() => {
1005
+ switch (inequationSymbolForRank.symbol) {
1006
+ case "<":
1007
+ case "\\le":
1008
+ return "le plus grand entier";
1009
+ case ">":
1010
+ case "\\ge":
1011
+ return "le plus petit entier";
1012
+ }
1013
+ })();
1014
+ return `Quelle est la nature de la suite $u_n$ ?
1015
+
1016
+ Utilise le terme général de $(u_n)$ pour déterminer ${texP} $p$ tel que $u_p ${inequationSymbol.symbol} ${valueThreshold.frenchify()}$.`;
1017
+ },
1018
+ getCorrectionStuff: (initial, reason, _firstRank) => {
1019
+ return {
1020
+ str: `Pour chaque année supplémentaire, le salaire d'Emma augmente de $${reason.frenchify()}\\ \\textrm{€}$.
1021
+ Le salaire d'Emma, en $\\textrm{€}$, est donc une suite arithmétique de premier terme $${initial.frenchify()}$ et de raison $${reason.frenchify()}$.`,
1022
+ };
1023
+ },
1024
+ },
1025
+ },
1026
+ //---------------------------------------------------------
1027
+ //NEGATIVE REASON
1028
+ //---------------------------------------------------------
1029
+ //Salaire de l'été vs loisirs hebdomadaires
1030
+ {
1031
+ randInitial: () => randint(5, 13) * 100,
1032
+ randReason: () => -randint(20, 100),
1033
+ randThreshold: (initial, reason, firstRank) => seqArithmeticUtils.randThreshold(initial, reason, firstRank, 0),
1034
+ randSuperfluousData: () => {
1035
+ const rand = randint(0, 2);
1036
+ const values = [];
1037
+ switch (rand) {
1038
+ case 0:
1039
+ {
1040
+ const numberOfFriends = randint(2, 7);
1041
+ values.push(numberOfFriends);
1042
+ }
1043
+ break;
1044
+ case 1:
1045
+ {
1046
+ const pocketMoneyOfFriend = randint(10, 50);
1047
+ values.push(pocketMoneyOfFriend);
1048
+ }
1049
+ break;
1050
+ }
1051
+ return {
1052
+ rand,
1053
+ values,
1054
+ };
1055
+ },
1056
+ getStrSituation: (initial, reason, firstRank, superfluousData) => {
1057
+ if (superfluousData === undefined) {
1058
+ return `Manon a gagné un peu d'argent cet été. Début septembre, elle a $${initial.frenchify()}\\ \\textrm{€}$ d'économies.
1059
+ Chaque semaine, elle dépense en moyenne $${(-reason).frenchify()}\\ \\textrm{€}$ pour ses loisirs.
1060
+ On note $u_n$ le montant de ses économies (en $\\textrm{€}$), $${getStrFactor(firstRank)}$ semaines après le début de septembre.`;
1061
+ }
1062
+ else {
1063
+ switch (superfluousData.rand) {
1064
+ case 0:
1065
+ {
1066
+ const [numberOfFriends] = superfluousData.values;
1067
+ return `Manon a gagné un peu d'argent cet été. Début septembre, elle a $${initial.frenchify()}\\ \\textrm{€}$ d'économies.
1068
+ Elle sort souvent avec ses $${numberOfFriends}$ amis.
1069
+ Chaque semaine, elle dépense en moyenne $${(-reason).frenchify()}\\ \\textrm{€}$ pour ses loisirs.
1070
+ On note $u_n$ le montant de ses économies (en $\\textrm{€}$), $${getStrFactor(firstRank)}$ semaines après le début de septembre.`;
1071
+ }
1072
+ break;
1073
+ case 1:
1074
+ {
1075
+ const [pocketMoneyOfFriend] = superfluousData.values;
1076
+ return `Manon a gagné un peu d'argent cet été. Début septembre, elle a $${initial.frenchify()}\\ \\textrm{€}$ d'économies.
1077
+ Chaque semaine, elle dépense en moyenne $${(-reason).frenchify()}\\ \\textrm{€}$ pour ses loisirs.
1078
+ Sa meilleure amie à $${pocketMoneyOfFriend}\\ \\textrm{€}$ d'argent de poche toutes les semaines.
1079
+ On note $u_n$ le montant de ses économies (en $\\textrm{€}$), $${getStrFactor(firstRank)}$ semaines après le début de septembre.`;
1080
+ }
1081
+ break;
1082
+ default:
1083
+ throw new Error("Unsupported superfluousData.rand: " + superfluousData.rand);
1084
+ }
1085
+ }
1086
+ },
1087
+ variationFindExplicitFormula: {
1088
+ getAnswerNode: seqArithmeticUtils.getAnswerNodeExplicitFormula,
1089
+ getHint: (firstRank) => `Quel calcul permet de trouver le montant de ses économies $10$ semaines après le début de septembre ?
1090
+
1091
+ Inspire toi de ce calcul pour déterminer le montant de ses économies $${getStrFactor(firstRank)}$ semaines après le début de septembre.
1092
+ `,
1093
+ getCorrectionStuff: (initial, reason, firstRank) => {
1094
+ return {
1095
+ str: `Chaque semaine, ses économies diminuent de $${(-reason).frenchify()}\\ \\textrm{€}$.
1096
+ Au bout de $${getStrFactor(firstRank)}$ semaines, ses économies auront diminué de $${getStrFactor(firstRank)} \\times ${(-reason).frenchify()}\\ \\textrm{€}$.
1097
+
1098
+ Au départ, le montant de ses économies était de $${initial.frenchify()}\\ \\textrm{€}$.
1099
+
1100
+ Le montant des économies de Manon, en $\\textrm{€}$, est donc une suite arithmétique de premier terme $${initial.frenchify()}$ et de raison $${reason.frenchify()}$.`,
1101
+ };
1102
+ },
1103
+ },
1104
+ variationFindRecurrenceFormula: {
1105
+ getAnswerNode: seqArithmeticUtils.getAnswerNodeRecurrenceFormula,
1106
+ getHint: (_firstRank) => `Si tu connais le montant des économies de Manon après $10$ semaines de dépenses, comment fais-tu pour calculer ses économies après $11$ semaines de dépenses ?
1107
+
1108
+ Déduis-en comment calculer $u_{n+1}$ à partir de $u_n$.`,
1109
+ getCorrectionStuff: (_initial, reason, firstRank) => {
1110
+ const target1 = 10;
1111
+ const target2 = 11;
1112
+ const [rank1, rank2] = [target1, target2].map((target) => target + firstRank);
1113
+ return {
1114
+ str: `Après chaque semaine de dépenses supplémentaire, les économies de Manon diminuent de $${(-reason).frenchify()}\\ \\textrm{€}$.
1115
+ Par exemple, le montant de ses économies après $${target2.frenchify()}$ semaines est égal à celui pour $${target1.frenchify()}$ semaines diminué de $${(-reason).frenchify()}\\ \\textrm{€}$.`,
1116
+ rank1,
1117
+ rank2,
1118
+ };
1119
+ },
1120
+ },
1121
+ variationFindRandomTerm: {
1122
+ getAnswerNode: (initial, reason, firstRank, ...otherArgs) => {
1123
+ const [rankAsked] = otherArgs;
1124
+ return seqArithmeticUtils.getAnswerNodeRandomTerm(initial, reason, firstRank, rankAsked);
1125
+ },
1126
+ getHint: (firstRank, ...otherArgs) => {
1127
+ const [rankAsked] = otherArgs;
1128
+ const target = rankAsked - firstRank;
1129
+ return `Quelle est la nature de la suite $u_n$ ?
1130
+
1131
+ Utilise le terme général de $u_n$ pour déterminer le montant des économies de Manon $${target.frenchify()}$ semaines après le début de septembre.`;
1132
+ },
1133
+ getCorrectionStuff: (initial, reason, _firstRank, ..._otherArgs) => {
1134
+ const target1 = 10;
1135
+ const target2 = 11;
1136
+ return {
1137
+ str: `Après chaque semaine de dépenses supplémentaire, les économies de Manon diminuent de $${(-reason).frenchify()}\\ \\textrm{€}$.
1138
+ Par exemple, le montant de ses économies après $${target2.frenchify()}$ semaines est égal à celui pour $${target1.frenchify()}$ semaines diminué de $${(-reason).frenchify()}\\ \\textrm{€}$.
1139
+
1140
+ Le montant des économies de Manon, en $\\textrm{€}$, est donc une suite arithmétique de premier terme $${initial.frenchify()}$ et de raison $${reason.frenchify()}$.`,
1141
+ };
1142
+ },
1143
+ },
1144
+ variationFindRank: {
1145
+ getStrQuestion: (_initial, _reason, _firstRank, ...otherArgs) => {
1146
+ const [valueAsked] = otherArgs;
1147
+ return `Quel est le rang $p$ pour lequel $u_{p} = ${round(valueAsked, 2).frenchify()} \\ \\textrm{€}$ ?`;
1148
+ },
1149
+ getAnswerNode: (initial, reason, firstRank, ...otherArgs) => {
1150
+ const [valueAsked] = otherArgs;
1151
+ return seqArithmeticUtils.getAnswerNodeRandomRank(initial, reason, firstRank, valueAsked);
1152
+ },
1153
+ getHint: (_firstRank, ...otherArgs) => {
1154
+ const [valueAsked] = otherArgs;
1155
+ return `Quelle est la nature de la suite $(u_n)$ ?
1156
+
1157
+ Utilise le terme général de $(u_n)$ pour déterminer quand $u_p = ${valueAsked.frenchify()}$.`;
1158
+ },
1159
+ getCorrectionStuff: (initial, reason, _firstRank) => {
1160
+ return {
1161
+ str: `Après chaque semaine de dépenses supplémentaire, les économies de Manon diminuent de $${(-reason).frenchify()}\\ \\textrm{€}$.
1162
+ Le montant des économies de Manon, en $\\textrm{€}$, est donc une suite arithmétique de premier terme $${initial.frenchify()}$ et de raison $${reason.frenchify()}$.`,
1163
+ };
1164
+ },
1165
+ },
1166
+ variationFindThreshold: {
1167
+ getStrQuestion: (_initial, _reason, _firstRank, ...otherArgs) => {
1168
+ const [valueThreshold, inequationSymbol] = otherArgs;
1169
+ const isStrict = inequationSymbol.symbol === "<" || inequationSymbol.symbol === ">";
1170
+ switch (inequationSymbol.symbol) {
1171
+ case "<":
1172
+ case "\\le":
1173
+ return `Quel est le plus grand rang $p$ où $u_{p}$ est ${isStrict ? "strictement" : ""} plus petit que $${valueThreshold.frenchify()} \\ \\textrm{€}$ ?`;
1174
+ case ">":
1175
+ case "\\ge":
1176
+ return `Quel est le plus petit rang $p$ où $u_{p}$ est ${isStrict ? "strictement" : ""} plus grand que $${valueThreshold.frenchify()} \\ \\textrm{€}$ ?`;
1177
+ }
1178
+ },
1179
+ getAnswerNode: (initial, reason, firstRank, ...otherArgs) => {
1180
+ const [valueThreshold, inequationSymbol] = otherArgs;
1181
+ return seqArithmeticUtils.getAnswerNodeThresholdRank(initial, reason, firstRank, valueThreshold, inequationSymbol);
1182
+ },
1183
+ getHint: (_firstRank, ...otherArgs) => {
1184
+ const [valueThreshold, inequationSymbol, reason] = otherArgs;
1185
+ const inequationSymbolForRank = reason < 0 ? inequationSymbol.toReversed() : inequationSymbol;
1186
+ const texP = (() => {
1187
+ switch (inequationSymbolForRank.symbol) {
1188
+ case "<":
1189
+ case "\\le":
1190
+ return "le plus grand entier";
1191
+ case ">":
1192
+ case "\\ge":
1193
+ return "le plus petit entier";
1194
+ }
1195
+ })();
1196
+ return `Quelle est la nature de la suite $u_n$ ?
1197
+
1198
+ Utilise le terme général de $(u_n)$ pour déterminer ${texP} $p$ tel que $u_p ${inequationSymbol.symbol} ${valueThreshold.frenchify()}$.`;
1199
+ },
1200
+ getCorrectionStuff: (initial, reason, _firstRank) => {
1201
+ return {
1202
+ str: `Après chaque semaine de dépenses supplémentaire, les économies de Manon diminuent de $${(-reason).frenchify()}\\ \\textrm{€}$.
1203
+ Le montant des économies de Manon, en $\\textrm{€}$, est donc une suite arithmétique de premier terme $${initial.frenchify()}$ et de raison $${reason.frenchify()}$.`,
1204
+ };
1205
+ },
1206
+ },
1207
+ },
1208
+ //Score de quiz
1209
+ {
1210
+ randInitial: () => randint(10, 21) * 1000,
1211
+ randReason: () => -randint(1, 6) * 100,
1212
+ randThreshold: (initial, reason, firstRank) => seqArithmeticUtils.randThreshold(initial, reason, firstRank, 0),
1213
+ randSuperfluousData: () => {
1214
+ const rand = randint(0, 2);
1215
+ const values = [];
1216
+ switch (rand) {
1217
+ case 0:
1218
+ {
1219
+ const roundedMeanDuration = randint(2, 7);
1220
+ values.push(roundedMeanDuration);
1221
+ }
1222
+ break;
1223
+ case 1:
1224
+ {
1225
+ const indexOfQuestion = randint(1, 21);
1226
+ values.push(indexOfQuestion);
1227
+ }
1228
+ break;
1229
+ }
1230
+ return {
1231
+ rand,
1232
+ values,
1233
+ };
1234
+ },
1235
+ getStrSituation: (initial, reason, firstRank, superfluousData) => {
1236
+ if (superfluousData === undefined) {
1237
+ return `Pablo joue à un jeu de quiz. Pour chaque question, le score commence à $${initial.frenchify()}$ points.
1238
+ Puis il décroît de $${(-reason).frenchify()}$ points pour chaque seconde qui s'écoule avant que le joueur réponde correctement.
1239
+ On note $u_n$ le score si l'on répond correctement $${getStrFactor(firstRank)}$ secondes après le début de la question.`;
1240
+ }
1241
+ else {
1242
+ switch (superfluousData.rand) {
1243
+ case 0:
1244
+ {
1245
+ const [roundedMeanDuration] = superfluousData.values;
1246
+ return `Pablo joue à un jeu de quiz. Pour chaque question, le score commence à $${initial.frenchify()}$ points.
1247
+ Puis il décroît de $${(-reason).frenchify()}$ points pour chaque seconde qui s'écoule avant que le joueur réponde correctement.
1248
+ Pablo met, la plupart du temps, $${roundedMeanDuration} \\ \\textrm{s}$ pour répondre.
1249
+ On note $u_n$ le score si l'on répond correctement $${getStrFactor(firstRank)}$ secondes après le début de la question.`;
1250
+ }
1251
+ break;
1252
+ case 1:
1253
+ {
1254
+ const [indexOfQuestion] = superfluousData.values;
1255
+ return `Pablo joue à un jeu de quiz. Pour chaque question, le score commence à $${initial.frenchify()}$ points.
1256
+ Puis il décroît de $${(-reason).frenchify()}$ points pour chaque seconde qui s'écoule avant que le joueur réponde correctement.
1257
+ Pablo est actuellement à la question numéro $${indexOfQuestion}$.
1258
+ On note $u_n$ le score si l'on répond correctement $${getStrFactor(firstRank)}$ secondes après le début de la question.`;
1259
+ }
1260
+ break;
1261
+ default:
1262
+ throw new Error("Unsupported superfluousData.rand: " + superfluousData.rand);
1263
+ }
1264
+ }
1265
+ },
1266
+ variationFindExplicitFormula: {
1267
+ getAnswerNode: seqArithmeticUtils.getAnswerNodeExplicitFormula,
1268
+ getHint: (firstRank) => `Quel calcul permet de trouver le score pour une durée de réponse de $10 \\ \\textrm{s}$ ?
1269
+
1270
+ Inspire toi de ce calcul pour déterminer le score pour une durée de réponse de $${getStrFactor(firstRank)} \\ \\textrm{s}$.
1271
+ `,
1272
+ getCorrectionStuff: (initial, reason, firstRank) => {
1273
+ return {
1274
+ str: `Chaque seconde, le score diminue de $${-reason.frenchify()}$ points.
1275
+ Au bout de $${getStrFactor(firstRank)}$ secondes, le score aura diminué de $${getStrFactor(firstRank)} \\times ${-reason.frenchify()}$ points.
1276
+
1277
+ Au départ, le score est de $${initial.frenchify()}$ points.
1278
+
1279
+ Le score est donc une suite arithmétique de premier terme $${initial.frenchify()}$ et de raison $${reason.frenchify()}$.`,
1280
+ };
1281
+ },
1282
+ },
1283
+ variationFindRecurrenceFormula: {
1284
+ getAnswerNode: seqArithmeticUtils.getAnswerNodeRecurrenceFormula,
1285
+ getHint: (_firstRank) => `Si tu connais le score $10$ secondes après le début, comment fais-tu pour calculer le score $11$ secondes après le début ?
1286
+
1287
+ Déduis-en comment calculer $u_{n+1}$ à partir de $u_n$.`,
1288
+ getCorrectionStuff: (_initial, reason, firstRank) => {
1289
+ const target1 = 10;
1290
+ const target2 = 11;
1291
+ const [rank1, rank2] = [target1, target2].map((target) => target + firstRank);
1292
+ return {
1293
+ str: `Chaque seconde, le score diminue de $${-reason.frenchify()}$ points.
1294
+ Par exemple, le score après $${target2.frenchify()} \\ \\textrm{s}$ est égal à celui après $${target1.frenchify()} \\ \\textrm{s}$ diminué de $${(-reason).frenchify()}$ points.`,
1295
+ rank1,
1296
+ rank2,
1297
+ };
1298
+ },
1299
+ },
1300
+ variationFindRandomTerm: {
1301
+ getAnswerNode: (initial, reason, firstRank, ...otherArgs) => {
1302
+ const [rankAsked] = otherArgs;
1303
+ return seqArithmeticUtils.getAnswerNodeRandomTerm(initial, reason, firstRank, rankAsked);
1304
+ },
1305
+ getHint: (firstRank, ...otherArgs) => {
1306
+ const [rankAsked] = otherArgs;
1307
+ const target = rankAsked - firstRank;
1308
+ return `Quelle est la nature de la suite $u_n$ ?
1309
+
1310
+ Utilise le terme général de $u_n$ pour déterminer le score $${target.frenchify()}$ secondes après le début de la question.`;
1311
+ },
1312
+ getCorrectionStuff: (initial, reason, firstRank, ..._otherArgs) => {
1313
+ return {
1314
+ str: `Chaque seconde, le score diminue de $${-reason.frenchify()}$ points.
1315
+ Au bout de $${getStrFactor(firstRank)}$ secondes, le score aura diminué de $${getStrFactor(firstRank)} \\times ${-reason.frenchify()}$ points.
1316
+
1317
+ Au départ, le score est de $${initial.frenchify()}$ points.
1318
+
1319
+ Le score est donc une suite arithmétique de premier terme $${initial.frenchify()}$ et de raison $${reason.frenchify()}$.`,
1320
+ };
1321
+ },
1322
+ },
1323
+ variationFindRank: {
1324
+ getStrQuestion: (_initial, _reason, _firstRank, ...otherArgs) => {
1325
+ const [valueAsked] = otherArgs;
1326
+ return `Quel est le rang $p$ pour lequel $u_{p} = ${round(valueAsked, 2).frenchify()}$ points ?`;
1327
+ },
1328
+ getAnswerNode: (initial, reason, firstRank, ...otherArgs) => {
1329
+ const [valueAsked] = otherArgs;
1330
+ return seqArithmeticUtils.getAnswerNodeRandomRank(initial, reason, firstRank, valueAsked);
1331
+ },
1332
+ getHint: (_firstRank, ...otherArgs) => {
1333
+ const [valueAsked] = otherArgs;
1334
+ return `Quelle est la nature de la suite $(u_n)$ ?
1335
+
1336
+ Utilise le terme général de $(u_n)$ pour déterminer quand $u_p = ${valueAsked.frenchify()}$.`;
1337
+ },
1338
+ getCorrectionStuff: (initial, reason, _firstRank) => {
1339
+ return {
1340
+ str: `Chaque seconde, le score diminue de $${-reason.frenchify()}$ points.
1341
+ Le score est donc une suite arithmétique de premier terme $${initial.frenchify()}$ et de raison $${reason.frenchify()}$.`,
1342
+ };
1343
+ },
1344
+ },
1345
+ variationFindThreshold: {
1346
+ getStrQuestion: (_initial, _reason, _firstRank, ...otherArgs) => {
1347
+ const [valueThreshold, inequationSymbol] = otherArgs;
1348
+ const isStrict = inequationSymbol.symbol === "<" || inequationSymbol.symbol === ">";
1349
+ switch (inequationSymbol.symbol) {
1350
+ case "<":
1351
+ case "\\le":
1352
+ return `Quel est le plus grand rang $p$ où $u_{p}$ est ${isStrict ? "strictement" : ""} plus petit que $${valueThreshold.frenchify()}$ points ?`;
1353
+ case ">":
1354
+ case "\\ge":
1355
+ return `Quel est le plus petit rang $p$ où $u_{p}$ est ${isStrict ? "strictement" : ""} plus grand que $${valueThreshold.frenchify()}$ points ?`;
1356
+ }
1357
+ },
1358
+ getAnswerNode: (initial, reason, firstRank, ...otherArgs) => {
1359
+ const [valueThreshold, inequationSymbol] = otherArgs;
1360
+ return seqArithmeticUtils.getAnswerNodeThresholdRank(initial, reason, firstRank, valueThreshold, inequationSymbol);
1361
+ },
1362
+ getHint: (_firstRank, ...otherArgs) => {
1363
+ const [valueThreshold, inequationSymbol, reason] = otherArgs;
1364
+ const inequationSymbolForRank = reason < 0 ? inequationSymbol.toReversed() : inequationSymbol;
1365
+ const texP = (() => {
1366
+ switch (inequationSymbolForRank.symbol) {
1367
+ case "<":
1368
+ case "\\le":
1369
+ return "le plus grand entier";
1370
+ case ">":
1371
+ case "\\ge":
1372
+ return "le plus petit entier";
1373
+ }
1374
+ })();
1375
+ return `Quelle est la nature de la suite $u_n$ ?
1376
+
1377
+ Utilise le terme général de $(u_n)$ pour déterminer ${texP} $p$ tel que $u_p ${inequationSymbol.symbol} ${valueThreshold.frenchify()}$.`;
1378
+ },
1379
+ getCorrectionStuff: (initial, reason, _firstRank) => {
1380
+ return {
1381
+ str: `Chaque seconde, le score diminue de $${-reason.frenchify()}$ points.
1382
+ Le score est donc une suite arithmétique de premier terme $${initial.frenchify()}$ et de raison $${reason.frenchify()}$.`,
1383
+ };
1384
+ },
1385
+ },
1386
+ },
1387
+ //Niveau de charge de la batterie
1388
+ {
1389
+ randInitial: () => randfloat(70, 100, 2),
1390
+ randReason: () => -randfloat(0, 4, 2, [0]),
1391
+ randThreshold: (initial, reason, firstRank) => seqArithmeticUtils.randThreshold(initial, reason, firstRank, 0),
1392
+ randSuperfluousData: () => {
1393
+ const rand = randint(0, 2);
1394
+ const values = [];
1395
+ switch (rand) {
1396
+ case 0:
1397
+ {
1398
+ const roundedMeanDuration = randint(2, 7);
1399
+ values.push(roundedMeanDuration);
1400
+ }
1401
+ break;
1402
+ case 1:
1403
+ {
1404
+ const thresholdBatteryLow = randint(5, 21);
1405
+ values.push(thresholdBatteryLow);
1406
+ }
1407
+ break;
1408
+ }
1409
+ return {
1410
+ rand,
1411
+ values,
1412
+ };
1413
+ },
1414
+ getStrSituation: (initial, reason, firstRank, superfluousData) => {
1415
+ if (superfluousData === undefined) {
1416
+ return `Daryl utilise un phare à batterie sur son chantier, qu'il laisse allumé.
1417
+ Quand il a commencé la journée, le niveau de charge de la batterie était de $${initial.frenchify()} \\%$.
1418
+ Le niveau décroît chaque heure de $${(-reason).frenchify()} \\%$.
1419
+ On note $u_n$ le niveau de charge après $${getStrFactor(firstRank)} \\ \\textrm{h}$.`;
1420
+ }
1421
+ else {
1422
+ switch (superfluousData.rand) {
1423
+ case 0:
1424
+ {
1425
+ const [roundedMeanDuration] = superfluousData.values;
1426
+ return `Daryl utilise un phare à batterie sur son chantier, qu'il laisse allumé.
1427
+ Quand il a commencé la journée, le niveau de charge de la batterie était de $${initial.frenchify()} \\%$.
1428
+ La plupart du temps, Daryl utilise le phare $${roundedMeanDuration} \\ \\textrm{h}$.
1429
+ Le niveau décroît chaque heure de $${(-reason).frenchify()} \\%$.
1430
+ On note $u_n$ le niveau de charge après $${getStrFactor(firstRank)} \\ \\textrm{h}$.`;
1431
+ }
1432
+ break;
1433
+ case 1:
1434
+ {
1435
+ const [thresholdBatteryLow] = superfluousData.values;
1436
+ return `Daryl utilise un phare à batterie sur son chantier, qu'il laisse allumé.
1437
+ Quand il a commencé la journée, le niveau de charge de la batterie était de $${initial.frenchify()} \\%$.
1438
+ Le niveau décroît chaque heure de $${(-reason).frenchify()} \\%$.
1439
+ Un signal sonore est émis quand le niveau de charge passe en dessous de $${thresholdBatteryLow.frenchify()} \\%$.
1440
+ On note $u_n$ le niveau de charge après $${getStrFactor(firstRank)} \\ \\textrm{h}$.`;
1441
+ }
1442
+ break;
1443
+ default:
1444
+ throw new Error("Unsupported superfluousData.rand: " + superfluousData.rand);
1445
+ }
1446
+ }
1447
+ },
1448
+ variationFindExplicitFormula: {
1449
+ getAnswerNode: seqArithmeticUtils.getAnswerNodeExplicitFormula,
1450
+ getHint: (firstRank) => `Quel calcul permet de trouver le niveau de charge après de $4 \\ \\textrm{h}$ d'utilisation ?
1451
+
1452
+ Inspire toi de ce calcul pour déterminer le niveau de charge pour une durée d'utilisation de $${getStrFactor(firstRank)} \\ \\textrm{h}$.
1453
+ `,
1454
+ getCorrectionStuff: (initial, reason, firstRank) => {
1455
+ return {
1456
+ str: `Chaque heure, le niveau de charge diminue de $${-reason.frenchify()} \\%$.
1457
+ Au bout de $${getStrFactor(firstRank)} \\ \\textrm{h}$, le niveau aura diminué de $${getStrFactor(firstRank)} \\times ${-reason.frenchify()} \\%$.
1458
+
1459
+ Au départ, le niveau est de $${initial.frenchify()} \\%$.
1460
+
1461
+ Le niveau de charge est donc une suite arithmétique de premier terme $${initial.frenchify()}$ et de raison $${reason.frenchify()}$.`,
1462
+ };
1463
+ },
1464
+ },
1465
+ variationFindRecurrenceFormula: {
1466
+ getAnswerNode: seqArithmeticUtils.getAnswerNodeRecurrenceFormula,
1467
+ getHint: (_firstRank) => `Si tu connais le niveau $4$ heures après le début, comment fais-tu pour calculer le niveau $5$ heures après le début ?
1468
+
1469
+ Déduis-en comment calculer $u_{n+1}$ à partir de $u_n$.`,
1470
+ getCorrectionStuff: (_initial, reason, firstRank) => {
1471
+ const target1 = 4;
1472
+ const target2 = 5;
1473
+ const [rank1, rank2] = [target1, target2].map((target) => target + firstRank);
1474
+ return {
1475
+ str: `Chaque heure, le niveau de charge diminue de $${-reason.frenchify()} \\%$.
1476
+ Par exemple, le niveau après $${target2.frenchify()} \\ \\textrm{h}$ d'utilisation est égal à celui après $${target1.frenchify()} \\ \\textrm{h}$ d'utilisation diminué de $${(-reason).frenchify()} \\%$.`,
1477
+ rank1,
1478
+ rank2,
1479
+ };
1480
+ },
1481
+ },
1482
+ variationFindRandomTerm: {
1483
+ getAnswerNode: (initial, reason, firstRank, ...otherArgs) => {
1484
+ const [rankAsked] = otherArgs;
1485
+ return seqArithmeticUtils.getAnswerNodeRandomTerm(initial, reason, firstRank, rankAsked);
1486
+ },
1487
+ getHint: (firstRank, ...otherArgs) => {
1488
+ const [rankAsked] = otherArgs;
1489
+ const target = rankAsked - firstRank;
1490
+ return `Quelle est la nature de la suite $u_n$ ?
1491
+
1492
+ Utilise le terme général de $u_n$ pour déterminer le niveau de charge après $${target.frenchify()} \\ \\textrm{h}$ d'utilisation.`;
1493
+ },
1494
+ getCorrectionStuff: (initial, reason, firstRank, ..._otherArgs) => {
1495
+ return {
1496
+ str: `Chaque heure, le niveau de charge diminue de $${-reason.frenchify()} \\%$.
1497
+ Au bout de $${getStrFactor(firstRank)} \\ \\textrm{h}$, le niveau aura diminué de $${getStrFactor(firstRank)} \\times ${-reason.frenchify()} \\%$.
1498
+
1499
+ Au départ, le niveau est de $${initial.frenchify()} \\%$.
1500
+
1501
+ Le niveau de charge est donc une suite arithmétique de premier terme $${initial.frenchify()}$ et de raison $${reason.frenchify()}$.`,
1502
+ };
1503
+ },
1504
+ },
1505
+ variationFindRank: {
1506
+ getStrQuestion: (_initial, _reason, _firstRank, ...otherArgs) => {
1507
+ const [valueAsked] = otherArgs;
1508
+ return `Quel est le rang $p$ pour lequel $u_{p} = ${round(valueAsked, 2).frenchify()} \\%$ ?`;
1509
+ },
1510
+ getAnswerNode: (initial, reason, firstRank, ...otherArgs) => {
1511
+ const [valueAsked] = otherArgs;
1512
+ return seqArithmeticUtils.getAnswerNodeRandomRank(initial, reason, firstRank, valueAsked);
1513
+ },
1514
+ getHint: (_firstRank, ...otherArgs) => {
1515
+ const [valueAsked] = otherArgs;
1516
+ return `Quelle est la nature de la suite $(u_n)$ ?
1517
+
1518
+ Utilise le terme général de $(u_n)$ pour déterminer quand $u_p = ${valueAsked.frenchify()}$.`;
1519
+ },
1520
+ getCorrectionStuff: (initial, reason, _firstRank) => {
1521
+ return {
1522
+ str: `Chaque heure, le niveau de charge diminue de $${-reason.frenchify()} \\%$.
1523
+ Le niveau de charge est donc une suite arithmétique de premier terme $${initial.frenchify()}$ et de raison $${reason.frenchify()}$.`,
1524
+ };
1525
+ },
1526
+ },
1527
+ variationFindThreshold: {
1528
+ getStrQuestion: (_initial, _reason, _firstRank, ...otherArgs) => {
1529
+ const [valueThreshold, inequationSymbol] = otherArgs;
1530
+ const isStrict = inequationSymbol.symbol === "<" || inequationSymbol.symbol === ">";
1531
+ switch (inequationSymbol.symbol) {
1532
+ case "<":
1533
+ case "\\le":
1534
+ return `Quel est le plus grand rang $p$ où $u_{p}$ est ${isStrict ? "strictement" : ""} plus petit que $${valueThreshold.frenchify()} \\%$ ?`;
1535
+ case ">":
1536
+ case "\\ge":
1537
+ return `Quel est le plus petit rang $p$ où $u_{p}$ est ${isStrict ? "strictement" : ""} plus grand que $${valueThreshold.frenchify()} \\%$ ?`;
1538
+ }
1539
+ },
1540
+ getAnswerNode: (initial, reason, firstRank, ...otherArgs) => {
1541
+ const [valueThreshold, inequationSymbol] = otherArgs;
1542
+ return seqArithmeticUtils.getAnswerNodeThresholdRank(initial, reason, firstRank, valueThreshold, inequationSymbol);
1543
+ },
1544
+ getHint: (_firstRank, ...otherArgs) => {
1545
+ const [valueThreshold, inequationSymbol, reason] = otherArgs;
1546
+ const inequationSymbolForRank = reason < 0 ? inequationSymbol.toReversed() : inequationSymbol;
1547
+ const texP = (() => {
1548
+ switch (inequationSymbolForRank.symbol) {
1549
+ case "<":
1550
+ case "\\le":
1551
+ return "le plus grand entier";
1552
+ case ">":
1553
+ case "\\ge":
1554
+ return "le plus petit entier";
1555
+ }
1556
+ })();
1557
+ return `Quelle est la nature de la suite $u_n$ ?
1558
+
1559
+ Utilise le terme général de $(u_n)$ pour déterminer ${texP} $p$ tel que $u_p ${inequationSymbol.symbol} ${valueThreshold.frenchify()}$.`;
1560
+ },
1561
+ getCorrectionStuff: (initial, reason, _firstRank) => {
1562
+ return {
1563
+ str: `Chaque heure, le niveau de charge diminue de $${-reason.frenchify()} \\%$.
1564
+ Le niveau de charge est donc une suite arithmétique de premier terme $${initial.frenchify()}$ et de raison $${reason.frenchify()}$.`,
1565
+ };
1566
+ },
1567
+ },
1568
+ },
1569
+ //Buffet et amuse-bouches
1570
+ {
1571
+ randInitial: () => randint(30, 60) * 100,
1572
+ randReason: () => -randint(8, 17) * 10,
1573
+ randThreshold: (initial, reason, firstRank) => seqArithmeticUtils.randThreshold(initial, reason, firstRank, 0),
1574
+ randSuperfluousData: () => {
1575
+ const rand = randint(0, 2);
1576
+ const values = [];
1577
+ switch (rand) {
1578
+ case 0:
1579
+ {
1580
+ const numberOfPeople = randint(20, 70) * 10;
1581
+ values.push(numberOfPeople);
1582
+ }
1583
+ break;
1584
+ case 1:
1585
+ {
1586
+ const nbOfGlassesPerMinute = randint(10, 21) * 10;
1587
+ values.push(nbOfGlassesPerMinute);
1588
+ }
1589
+ break;
1590
+ }
1591
+ return {
1592
+ rand,
1593
+ values,
1594
+ };
1595
+ },
1596
+ getStrSituation: (initial, reason, firstRank, superfluousData) => {
1597
+ if (superfluousData === undefined) {
1598
+ return `Un gigantesque buffet est organisé. Au départ, sur les tables de service, il y a $${initial.frenchify()}$ amuse-bouches.
1599
+ $${(-reason).frenchify()}$ amuse-bouches sont mangés toutes les minutes.
1600
+ On note $u_n$ le nombre d'amuse-bouches restant après $${getStrFactor(firstRank)} \\ \\textrm{min}$.`;
1601
+ }
1602
+ else {
1603
+ switch (superfluousData.rand) {
1604
+ case 0:
1605
+ {
1606
+ const [numberOfPeople] = superfluousData.values;
1607
+ return `Un gigantesque buffet est organisé. Au départ, sur les tables de service, il y a $${initial.frenchify()}$ amuse-bouches.
1608
+ $${(-reason).frenchify()}$ amuse-bouches sont mangés toutes les minutes.
1609
+ Il y a en tout $${numberOfPeople.frenchify()}$ convives.
1610
+ On note $u_n$ le nombre d'amuse-bouches restant après $${getStrFactor(firstRank)} \\ \\textrm{min}$.`;
1611
+ }
1612
+ break;
1613
+ case 1:
1614
+ {
1615
+ const [nbOfGlassesPerMinute] = superfluousData.values;
1616
+ return `Un gigantesque buffet est organisé. Au départ, sur les tables de service, il y a $${initial.frenchify()}$ amuse-bouches.
1617
+ $${nbOfGlassesPerMinute.frenchify()}$ verres sont servis toutes les minutes.
1618
+ $${(-reason).frenchify()}$ amuse-bouches sont mangés toutes les minutes.
1619
+ On note $u_n$ le nombre d'amuse-bouches restant après $${getStrFactor(firstRank)} \\ \\textrm{min}$.`;
1620
+ }
1621
+ break;
1622
+ default:
1623
+ throw new Error("Unsupported superfluousData.rand: " + superfluousData.rand);
1624
+ }
1625
+ }
1626
+ },
1627
+ variationFindExplicitFormula: {
1628
+ getAnswerNode: seqArithmeticUtils.getAnswerNodeExplicitFormula,
1629
+ getHint: (firstRank) => `Quel calcul permet de trouver le nombre d'amuse-bouches restant après $4 \\ \\textrm{min}$ ?
1630
+
1631
+ Inspire toi de ce calcul pour déterminer le nombre d'amuse-bouches restant après $${getStrFactor(firstRank)} \\ \\textrm{min}$.
1632
+ `,
1633
+ getCorrectionStuff: (initial, reason, firstRank) => {
1634
+ return {
1635
+ str: `Chaque minute, le nombre d'amuse-bouches diminue de $${-reason.frenchify()}$.
1636
+ Au bout de $${getStrFactor(firstRank)} \\ \\textrm{min}$, le nombre d'amuse-bouches aura diminué de $${getStrFactor(firstRank)} \\times ${-reason.frenchify()}$.
1637
+
1638
+ Au départ, il y en a $${initial.frenchify()}$.
1639
+
1640
+ Le nombre d'amuse-bouches est donc une suite arithmétique de premier terme $${initial.frenchify()}$ et de raison $${reason.frenchify()}$.`,
1641
+ };
1642
+ },
1643
+ },
1644
+ variationFindRecurrenceFormula: {
1645
+ getAnswerNode: seqArithmeticUtils.getAnswerNodeRecurrenceFormula,
1646
+ getHint: (_firstRank) => `Si tu connais le nombre d'amuse-bouches $4$ minutes après le début, comment fais-tu pour calculer le nombre d'amuse-bouches $5$ minutes après le début ?
1647
+
1648
+ Déduis-en comment calculer $u_{n+1}$ à partir de $u_n$.`,
1649
+ getCorrectionStuff: (_initial, reason, firstRank) => {
1650
+ const target1 = 4;
1651
+ const target2 = 5;
1652
+ const [rank1, rank2] = [target1, target2].map((target) => target + firstRank);
1653
+ return {
1654
+ str: `Chaque minute, le nombre d'amuse-bouches diminue de $${-reason.frenchify()}$.
1655
+ Par exemple, le nombre d'amuse-bouches restant après $${target2.frenchify()} \\ \\textrm{min}$ est égal à celui après $${target1.frenchify()} \\ \\textrm{min}$ d'utilisation diminué de $${(-reason).frenchify()}$.`,
1656
+ rank1,
1657
+ rank2,
1658
+ };
1659
+ },
1660
+ },
1661
+ variationFindRandomTerm: {
1662
+ getAnswerNode: (initial, reason, firstRank, ...otherArgs) => {
1663
+ const [rankAsked] = otherArgs;
1664
+ return seqArithmeticUtils.getAnswerNodeRandomTerm(initial, reason, firstRank, rankAsked);
1665
+ },
1666
+ getHint: (firstRank, ...otherArgs) => {
1667
+ const [rankAsked] = otherArgs;
1668
+ const target = rankAsked - firstRank;
1669
+ return `Quelle est la nature de la suite $u_n$ ?
1670
+
1671
+ Utilise le terme général de $u_n$ pour déterminer le nombre d'amuse-bouches restant après $${target.frenchify()} \\ \\textrm{min}$ de buffet.`;
1672
+ },
1673
+ getCorrectionStuff: (initial, reason, firstRank, ..._otherArgs) => {
1674
+ return {
1675
+ str: `Chaque minute, le nombre d'amuse-bouches diminue de $${-reason.frenchify()}$.
1676
+ Au bout de $${getStrFactor(firstRank)} \\ \\textrm{min}$, le nombre d'amuse-bouches aura diminué de $${getStrFactor(firstRank)} \\times ${-reason.frenchify()}$.
1677
+
1678
+ Au départ, il y en a $${initial.frenchify()}$.
1679
+
1680
+ Le nombre d'amuse-bouches est donc une suite arithmétique de premier terme $${initial.frenchify()}$ et de raison $${reason.frenchify()}$.`,
1681
+ };
1682
+ },
1683
+ },
1684
+ variationFindRank: {
1685
+ getStrQuestion: (_initial, _reason, _firstRank, ...otherArgs) => {
1686
+ const [valueAsked] = otherArgs;
1687
+ return `Quel est le rang $p$ pour lequel $u_{p} = ${round(valueAsked, 2).frenchify()}$ ?`;
1688
+ },
1689
+ getAnswerNode: (initial, reason, firstRank, ...otherArgs) => {
1690
+ const [valueAsked] = otherArgs;
1691
+ return seqArithmeticUtils.getAnswerNodeRandomRank(initial, reason, firstRank, valueAsked);
1692
+ },
1693
+ getHint: (_firstRank, ...otherArgs) => {
1694
+ const [valueAsked] = otherArgs;
1695
+ return `Quelle est la nature de la suite $(u_n)$ ?
1696
+
1697
+ Utilise le terme général de $(u_n)$ pour déterminer quand $u_p = ${valueAsked.frenchify()}$.`;
1698
+ },
1699
+ getCorrectionStuff: (initial, reason, _firstRank) => {
1700
+ return {
1701
+ str: `Chaque minute, le nombre d'amuse-bouches diminue de $${-reason.frenchify()}$.
1702
+ Le nombre d'amuse-bouches est donc une suite arithmétique de premier terme $${initial.frenchify()}$ et de raison $${reason.frenchify()}$.`,
1703
+ };
1704
+ },
1705
+ },
1706
+ variationFindThreshold: {
1707
+ getStrQuestion: (_initial, _reason, _firstRank, ...otherArgs) => {
1708
+ const [valueThreshold, inequationSymbol] = otherArgs;
1709
+ const isStrict = inequationSymbol.symbol === "<" || inequationSymbol.symbol === ">";
1710
+ switch (inequationSymbol.symbol) {
1711
+ case "<":
1712
+ case "\\le":
1713
+ return `Quel est le plus grand rang $p$ où $u_{p}$ est ${isStrict ? "strictement" : ""} plus petit que $${valueThreshold.frenchify()} \\ \\textrm{€}$ ?`;
1714
+ case ">":
1715
+ case "\\ge":
1716
+ return `Quel est le plus petit rang $p$ où $u_{p}$ est ${isStrict ? "strictement" : ""} plus grand que $${valueThreshold.frenchify()} \\ \\textrm{€}$ ?`;
1717
+ }
1718
+ },
1719
+ getAnswerNode: (initial, reason, firstRank, ...otherArgs) => {
1720
+ const [valueThreshold, inequationSymbol] = otherArgs;
1721
+ return seqArithmeticUtils.getAnswerNodeThresholdRank(initial, reason, firstRank, valueThreshold, inequationSymbol);
1722
+ },
1723
+ getHint: (_firstRank, ...otherArgs) => {
1724
+ const [valueThreshold, inequationSymbol, reason] = otherArgs;
1725
+ const inequationSymbolForRank = reason < 0 ? inequationSymbol.toReversed() : inequationSymbol;
1726
+ const texP = (() => {
1727
+ switch (inequationSymbolForRank.symbol) {
1728
+ case "<":
1729
+ case "\\le":
1730
+ return "le plus grand entier";
1731
+ case ">":
1732
+ case "\\ge":
1733
+ return "le plus petit entier";
1734
+ }
1735
+ })();
1736
+ return `Quelle est la nature de la suite $u_n$ ?
1737
+
1738
+ Utilise le terme général de $(u_n)$ pour déterminer ${texP} $p$ tel que $u_p ${inequationSymbol.symbol} ${valueThreshold.frenchify()}$.`;
1739
+ },
1740
+ getCorrectionStuff: (initial, reason, _firstRank) => {
1741
+ return {
1742
+ str: `Chaque minute, le nombre d'amuse-bouches diminue de $${-reason.frenchify()}$.
1743
+ Le nombre d'amuse-bouches est donc une suite arithmétique de premier terme $${initial.frenchify()}$ et de raison $${reason.frenchify()}$.`,
1744
+ };
1745
+ },
1746
+ },
1747
+ },
1748
+ //Locket Rig
1749
+ {
1750
+ randInitial: () => randint(210, 300) * 1000,
1751
+ randReason: () => -randint(8, 17) * 1000,
1752
+ randThreshold: (initial, reason, firstRank) => seqArithmeticUtils.randThreshold(initial, reason, firstRank, 0),
1753
+ randSuperfluousData: () => {
1754
+ const rand = randint(0, 2);
1755
+ const values = [];
1756
+ switch (rand) {
1757
+ case 0:
1758
+ {
1759
+ const numberOfPlayersOfNordFight = randint(500, 1700) * 1000;
1760
+ values.push(numberOfPlayersOfNordFight);
1761
+ }
1762
+ break;
1763
+ case 1:
1764
+ {
1765
+ const nbOfSpectatorsAtPhysicalEvent = randint(2, 11) * 1000;
1766
+ values.push(nbOfSpectatorsAtPhysicalEvent);
1767
+ }
1768
+ break;
1769
+ }
1770
+ return {
1771
+ rand,
1772
+ values,
1773
+ };
1774
+ },
1775
+ getStrSituation: (initial, reason, firstRank, superfluousData) => {
1776
+ if (superfluousData === undefined) {
1777
+ return `L'année de la sortie du jeu vidéo Locket Rig, ce même jeu avait $${initial.frenchify()}$ joueurs réguliers.
1778
+ Tous les ans, $${(-reason).frenchify()}$ joueurs arrêtent de jouer régulièrement à Locket Rig.
1779
+ On note $u_n$ le nombre de joueurs réguliers de Locket Rig $${getStrFactor(firstRank)}$ années après sa sortie.`;
1780
+ }
1781
+ else {
1782
+ switch (superfluousData.rand) {
1783
+ case 0:
1784
+ {
1785
+ const [numberOfPlayersOfNordFight] = superfluousData.values;
1786
+ return `L'année de la sortie du jeu vidéo Locket Rig, ce même jeu avait $${initial.frenchify()}$ joueurs réguliers.
1787
+ Tous les ans, $${(-reason).frenchify()}$ joueurs arrêtent de jouer régulièrement à Locket Rig.
1788
+ Actuellement, $${numberOfPlayersOfNordFight.frenchify()}$ jouent régulièrement au jeu vidéo Nord Fight.
1789
+ On note $u_n$ le nombre de joueurs réguliers de Locket Rig $${getStrFactor(firstRank)}$ années après sa sortie.`;
1790
+ }
1791
+ break;
1792
+ case 1:
1793
+ {
1794
+ const [nbOfSpectatorsAtPhysicalEvent] = superfluousData.values;
1795
+ return `L'année de la sortie du jeu vidéo Locket Rig, ce même jeu avait $${initial.frenchify()}$ joueurs réguliers.
1796
+ Il y avait $${nbOfSpectatorsAtPhysicalEvent.frenchify()}$ spectateurs au premier tournoi organisé dans une grande salle de concert.
1797
+ Tous les ans, $${(-reason).frenchify()}$ joueurs arrêtent de jouer régulièrement à Locket Rig.
1798
+ On note $u_n$ le nombre de joueurs réguliers de Locket Rig $${getStrFactor(firstRank)}$ années après sa sortie.`;
1799
+ }
1800
+ break;
1801
+ default:
1802
+ throw new Error("Unsupported superfluousData.rand: " + superfluousData.rand);
1803
+ }
1804
+ }
1805
+ },
1806
+ variationFindExplicitFormula: {
1807
+ getAnswerNode: seqArithmeticUtils.getAnswerNodeExplicitFormula,
1808
+ getHint: (firstRank) => `Quel calcul permet de trouver le nombre de joueurs $4$ années après la sortie ?
1809
+
1810
+ Inspire toi de ce calcul pour déterminer le nombre de joueurs $${getStrFactor(firstRank)}$ années après la sortie.
1811
+ `,
1812
+ getCorrectionStuff: (initial, reason, firstRank) => {
1813
+ return {
1814
+ str: `Chaque année, le nombre de joueurs diminue de $${-reason.frenchify()}$.
1815
+ Au bout de $${getStrFactor(firstRank)}$ années, le nombre de joueurs aura diminué de $${getStrFactor(firstRank)} \\times ${-reason.frenchify()}$.
1816
+
1817
+ Au départ, il y en avait $${initial.frenchify()}$.
1818
+
1819
+ Le nombre de joueurs réguliers de Locket Rig est donc une suite arithmétique de premier terme $${initial.frenchify()}$ et de raison $${reason.frenchify()}$.`,
1820
+ };
1821
+ },
1822
+ },
1823
+ variationFindRecurrenceFormula: {
1824
+ getAnswerNode: seqArithmeticUtils.getAnswerNodeRecurrenceFormula,
1825
+ getHint: (_firstRank) => `Si tu connais le nombre de joueurs $4$ années après la sortie, comment fais-tu pour calculer le nombre de joueurs $5$ années après la sortie ?
1826
+
1827
+ Déduis-en comment calculer $u_{n+1}$ à partir de $u_n$.`,
1828
+ getCorrectionStuff: (_initial, reason, firstRank) => {
1829
+ const target1 = 4;
1830
+ const target2 = 5;
1831
+ const [rank1, rank2] = [target1, target2].map((target) => target + firstRank);
1832
+ return {
1833
+ str: `Chaque année, le nombre de joueurs diminue de $${-reason.frenchify()}$.
1834
+ Par exemple, le nombre de joueurs restant après $${target2.frenchify()}$ années est égal à celui après $${target1.frenchify()}$ années diminué de $${(-reason).frenchify()}$.`,
1835
+ rank1,
1836
+ rank2,
1837
+ };
1838
+ },
1839
+ },
1840
+ variationFindRandomTerm: {
1841
+ getAnswerNode: (initial, reason, firstRank, ...otherArgs) => {
1842
+ const [rankAsked] = otherArgs;
1843
+ return seqArithmeticUtils.getAnswerNodeRandomTerm(initial, reason, firstRank, rankAsked);
1844
+ },
1845
+ getHint: (firstRank, ...otherArgs) => {
1846
+ const [rankAsked] = otherArgs;
1847
+ const target = rankAsked - firstRank;
1848
+ return `Quelle est la nature de la suite $u_n$ ?
1849
+
1850
+ Utilise le terme général de $u_n$ pour déterminer le nombre de joueurs restant après $${target.frenchify()}$ années.`;
1851
+ },
1852
+ getCorrectionStuff: (initial, reason, firstRank, ..._otherArgs) => {
1853
+ return {
1854
+ str: `Chaque année, le nombre de joueurs diminue de $${-reason.frenchify()}$.
1855
+ Au bout de $${getStrFactor(firstRank)}$ années, le nombre de joueurs aura diminué de $${getStrFactor(firstRank)} \\times ${-reason.frenchify()}$.
1856
+
1857
+ Au départ, il y en avait $${initial.frenchify()}$.
1858
+
1859
+ Le nombre de joueurs réguliers de Locket Rig est donc une suite arithmétique de premier terme $${initial.frenchify()}$ et de raison $${reason.frenchify()}$.`,
1860
+ };
1861
+ },
1862
+ },
1863
+ variationFindRank: {
1864
+ getStrQuestion: (_initial, _reason, _firstRank, ...otherArgs) => {
1865
+ const [valueAsked] = otherArgs;
1866
+ return `Quel est le rang $p$ pour lequel $u_{p} = ${round(valueAsked, 2).frenchify()}$ ?`;
1867
+ },
1868
+ getAnswerNode: (initial, reason, firstRank, ...otherArgs) => {
1869
+ const [valueAsked] = otherArgs;
1870
+ return seqArithmeticUtils.getAnswerNodeRandomRank(initial, reason, firstRank, valueAsked);
1871
+ },
1872
+ getHint: (_firstRank, ...otherArgs) => {
1873
+ const [valueAsked] = otherArgs;
1874
+ return `Quelle est la nature de la suite $(u_n)$ ?
1875
+
1876
+ Utilise le terme général de $(u_n)$ pour déterminer quand $u_p = ${valueAsked.frenchify()}$.`;
1877
+ },
1878
+ getCorrectionStuff: (initial, reason, _firstRank) => {
1879
+ return {
1880
+ str: `Chaque année, le nombre de joueurs diminue de $${-reason.frenchify()}$.
1881
+ Le nombre de joueurs réguliers de Locket Rig est donc une suite arithmétique de premier terme $${initial.frenchify()}$ et de raison $${reason.frenchify()}$.`,
1882
+ };
1883
+ },
1884
+ },
1885
+ variationFindThreshold: {
1886
+ getStrQuestion: (_initial, _reason, _firstRank, ...otherArgs) => {
1887
+ const [valueThreshold, inequationSymbol] = otherArgs;
1888
+ const isStrict = inequationSymbol.symbol === "<" || inequationSymbol.symbol === ">";
1889
+ switch (inequationSymbol.symbol) {
1890
+ case "<":
1891
+ case "\\le":
1892
+ return `Quel est le plus grand rang $p$ où $u_{p}$ est ${isStrict ? "strictement" : ""} plus petit que $${valueThreshold.frenchify()} \\ \\textrm{€}$ ?`;
1893
+ case ">":
1894
+ case "\\ge":
1895
+ return `Quel est le plus petit rang $p$ où $u_{p}$ est ${isStrict ? "strictement" : ""} plus grand que $${valueThreshold.frenchify()} \\ \\textrm{€}$ ?`;
1896
+ }
1897
+ },
1898
+ getAnswerNode: (initial, reason, firstRank, ...otherArgs) => {
1899
+ const [valueThreshold, inequationSymbol] = otherArgs;
1900
+ return seqArithmeticUtils.getAnswerNodeThresholdRank(initial, reason, firstRank, valueThreshold, inequationSymbol);
1901
+ },
1902
+ getHint: (_firstRank, ...otherArgs) => {
1903
+ const [valueThreshold, inequationSymbol, reason] = otherArgs;
1904
+ const inequationSymbolForRank = reason < 0 ? inequationSymbol.toReversed() : inequationSymbol;
1905
+ const texP = (() => {
1906
+ switch (inequationSymbolForRank.symbol) {
1907
+ case "<":
1908
+ case "\\le":
1909
+ return "le plus grand entier";
1910
+ case ">":
1911
+ case "\\ge":
1912
+ return "le plus petit entier";
1913
+ }
1914
+ })();
1915
+ return `Quelle est la nature de la suite $u_n$ ?
1916
+
1917
+ Utilise le terme général de $(u_n)$ pour déterminer ${texP} $p$ tel que $u_p ${inequationSymbol.symbol} ${valueThreshold.frenchify()}$.`;
1918
+ },
1919
+ getCorrectionStuff: (initial, reason, _firstRank) => {
1920
+ return {
1921
+ str: `Chaque année, le nombre de joueurs diminue de $${-reason.frenchify()}$.
1922
+ Le nombre de joueurs réguliers de Locket Rig est donc une suite arithmétique de premier terme $${initial.frenchify()}$ et de raison $${reason.frenchify()}$.`,
1923
+ };
1924
+ },
1925
+ },
1926
+ },
1927
+ ];
1928
+ export const situationsArithmetic = templatesSituationsArithmetic.map(createSituationArithmeticFromTemplate);