math-exercises 3.0.177 → 3.0.179

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 (255) hide show
  1. package/lib/exercises/math/derivation/derivative/derivativeEquationSolving1.d.ts +14 -0
  2. package/lib/exercises/math/derivation/derivative/derivativeEquationSolving1.d.ts.map +1 -0
  3. package/lib/exercises/math/derivation/derivative/derivativeEquationSolving1.js +283 -0
  4. package/lib/exercises/math/derivation/derivative/derivativeEquationSolving3.d.ts +15 -0
  5. package/lib/exercises/math/derivation/derivative/derivativeEquationSolving3.d.ts.map +1 -0
  6. package/lib/exercises/math/derivation/derivative/derivativeEquationSolving3.js +296 -0
  7. package/lib/exercises/math/derivation/derivative/exp/expDerivativeOne.js +3 -3
  8. package/lib/exercises/math/derivation/derivative/exp/expDerivativeProductFExp.d.ts +14 -0
  9. package/lib/exercises/math/derivation/derivative/exp/expDerivativeProductFExp.d.ts.map +1 -0
  10. package/lib/exercises/math/derivation/derivative/exp/expDerivativeProductFExp.js +346 -0
  11. package/lib/exercises/math/derivation/derivative/exp/expDerivativeQuotientFExp.d.ts +15 -0
  12. package/lib/exercises/math/derivation/derivative/exp/expDerivativeQuotientFExp.d.ts.map +1 -0
  13. package/lib/exercises/math/derivation/derivative/exp/expDerivativeQuotientFExp.js +435 -0
  14. package/lib/exercises/math/derivation/derivative/valueDerivativeFromFunctionExpression.d.ts +13 -0
  15. package/lib/exercises/math/derivation/derivative/valueDerivativeFromFunctionExpression.d.ts.map +1 -0
  16. package/lib/exercises/math/derivation/derivative/valueDerivativeFromFunctionExpression.js +326 -0
  17. package/lib/exercises/math/derivation/derivativeNumber/signOfDerivativeNumberFromFunctionCurve.d.ts +14 -0
  18. package/lib/exercises/math/derivation/derivativeNumber/signOfDerivativeNumberFromFunctionCurve.d.ts.map +1 -0
  19. package/lib/exercises/math/derivation/derivativeNumber/signOfDerivativeNumberFromFunctionCurve.js +181 -0
  20. package/lib/exercises/math/derivation/derivativeNumber/valueTableImageAndDerivativeFromFunctionExpression.d.ts +10 -0
  21. package/lib/exercises/math/derivation/derivativeNumber/valueTableImageAndDerivativeFromFunctionExpression.d.ts.map +1 -0
  22. package/lib/exercises/math/derivation/derivativeNumber/valueTableImageAndDerivativeFromFunctionExpression.js +272 -0
  23. package/lib/exercises/math/derivation/problems/index.d.ts +5 -0
  24. package/lib/exercises/math/derivation/problems/index.d.ts.map +1 -0
  25. package/lib/exercises/math/derivation/problems/index.js +4 -0
  26. package/lib/exercises/math/derivation/problems/problemMaximizeBoxVolumeFindX.d.ts +8 -0
  27. package/lib/exercises/math/derivation/problems/problemMaximizeBoxVolumeFindX.d.ts.map +1 -0
  28. package/lib/exercises/math/derivation/problems/problemMaximizeBoxVolumeFindX.js +171 -0
  29. package/lib/exercises/math/derivation/problems/problemMaximizeProfitFindProduction.d.ts +15 -0
  30. package/lib/exercises/math/derivation/problems/problemMaximizeProfitFindProduction.d.ts.map +1 -0
  31. package/lib/exercises/math/derivation/problems/problemMaximizeProfitFindProduction.js +328 -0
  32. package/lib/exercises/math/derivation/problems/problemMovementOnLineFindSpeedAtPoint.d.ts +13 -0
  33. package/lib/exercises/math/derivation/problems/problemMovementOnLineFindSpeedAtPoint.d.ts.map +1 -0
  34. package/lib/exercises/math/derivation/problems/problemMovementOnLineFindSpeedAtPoint.js +275 -0
  35. package/lib/exercises/math/derivation/problems/problemProjectileHeightFindAbscissa.d.ts +8 -0
  36. package/lib/exercises/math/derivation/problems/problemProjectileHeightFindAbscissa.d.ts.map +1 -0
  37. package/lib/exercises/math/derivation/problems/problemProjectileHeightFindAbscissa.js +137 -0
  38. package/lib/exercises/math/derivation/tangent/derivativeEquationSolvingByManipulatingLineY.d.ts +10 -0
  39. package/lib/exercises/math/derivation/tangent/derivativeEquationSolvingByManipulatingLineY.d.ts.map +1 -0
  40. package/lib/exercises/math/derivation/tangent/derivativeEquationSolvingByManipulatingLineY.js +478 -0
  41. package/lib/exercises/math/derivation/tangent/derivativeEquationSolvingByManipulatingLineYAndSlope.d.ts +10 -0
  42. package/lib/exercises/math/derivation/tangent/derivativeEquationSolvingByManipulatingLineYAndSlope.d.ts.map +1 -0
  43. package/lib/exercises/math/derivation/tangent/derivativeEquationSolvingByManipulatingLineYAndSlope.js +499 -0
  44. package/lib/exercises/math/derivation/tangent/derivativeEquationSolvingByManipulatingPoint.d.ts +10 -0
  45. package/lib/exercises/math/derivation/tangent/derivativeEquationSolvingByManipulatingPoint.d.ts.map +1 -0
  46. package/lib/exercises/math/derivation/tangent/derivativeEquationSolvingByManipulatingPoint.js +240 -0
  47. package/lib/exercises/math/derivation/tangent/derivativeReadingByManipulatingBuildingTangent.d.ts +12 -0
  48. package/lib/exercises/math/derivation/tangent/derivativeReadingByManipulatingBuildingTangent.d.ts.map +1 -0
  49. package/lib/exercises/math/derivation/tangent/derivativeReadingByManipulatingBuildingTangent.js +436 -0
  50. package/lib/exercises/math/derivation/tangent/derivativeReadingByManipulatingPoint.d.ts +12 -0
  51. package/lib/exercises/math/derivation/tangent/derivativeReadingByManipulatingPoint.d.ts.map +1 -0
  52. package/lib/exercises/math/derivation/tangent/derivativeReadingByManipulatingPoint.js +219 -0
  53. package/lib/exercises/math/derivation/tangent/derivativeReadingByManipulatingSecant.d.ts +13 -0
  54. package/lib/exercises/math/derivation/tangent/derivativeReadingByManipulatingSecant.d.ts.map +1 -0
  55. package/lib/exercises/math/derivation/tangent/derivativeReadingByManipulatingSecant.js +273 -0
  56. package/lib/exercises/math/derivation/tangent/placePointsOfDerivativeFromGraph.d.ts +18 -0
  57. package/lib/exercises/math/derivation/tangent/placePointsOfDerivativeFromGraph.d.ts.map +1 -0
  58. package/lib/exercises/math/derivation/tangent/placePointsOfDerivativeFromGraph.js +295 -0
  59. package/lib/exercises/math/derivation/tangent/tangentEquationFromFunctionExpression.d.ts +13 -0
  60. package/lib/exercises/math/derivation/tangent/tangentEquationFromFunctionExpression.d.ts.map +1 -0
  61. package/lib/exercises/math/derivation/tangent/tangentEquationFromFunctionExpression.js +388 -0
  62. package/lib/exercises/math/derivation/tangent/tangentEquationFromGraph.d.ts +9 -0
  63. package/lib/exercises/math/derivation/tangent/tangentEquationFromGraph.d.ts.map +1 -0
  64. package/lib/exercises/math/derivation/tangent/tangentEquationFromGraph.js +308 -0
  65. package/lib/exercises/math/derivation/variations/findAbscissaOfExtremaFromFunctionExpression.d.ts +14 -0
  66. package/lib/exercises/math/derivation/variations/findAbscissaOfExtremaFromFunctionExpression.d.ts.map +1 -0
  67. package/lib/exercises/math/derivation/variations/findAbscissaOfExtremaFromFunctionExpression.js +439 -0
  68. package/lib/exercises/math/derivation/variations/findExtremaFromFunctionExpression.d.ts +14 -0
  69. package/lib/exercises/math/derivation/variations/findExtremaFromFunctionExpression.d.ts.map +1 -0
  70. package/lib/exercises/math/derivation/variations/findExtremaFromFunctionExpression.js +547 -0
  71. package/lib/exercises/math/derivation/variations/plausibleDerivativeGraphFromFunctionGraphByManipulatingPolynomial.d.ts +15 -0
  72. package/lib/exercises/math/derivation/variations/plausibleDerivativeGraphFromFunctionGraphByManipulatingPolynomial.d.ts.map +1 -0
  73. package/lib/exercises/math/derivation/variations/plausibleDerivativeGraphFromFunctionGraphByManipulatingPolynomial.js +537 -0
  74. package/lib/exercises/math/derivation/variations/plausibleFunctionGraphFromDerivativeGraphByManipulatingPolynomial.d.ts +15 -0
  75. package/lib/exercises/math/derivation/variations/plausibleFunctionGraphFromDerivativeGraphByManipulatingPolynomial.d.ts.map +1 -0
  76. package/lib/exercises/math/derivation/variations/plausibleFunctionGraphFromDerivativeGraphByManipulatingPolynomial.js +639 -0
  77. package/lib/exercises/math/derivation/variations/readExtremaAbscissFromDerivativeCurve.js +1 -1
  78. package/lib/exercises/math/derivation/variations/signVarTableFromFunctionExpression.d.ts +14 -0
  79. package/lib/exercises/math/derivation/variations/signVarTableFromFunctionExpression.d.ts.map +1 -0
  80. package/lib/exercises/math/derivation/variations/signVarTableFromFunctionExpression.js +530 -0
  81. package/lib/exercises/math/derivation/variations/signVarTableProductFExp.d.ts +10 -0
  82. package/lib/exercises/math/derivation/variations/signVarTableProductFExp.d.ts.map +1 -0
  83. package/lib/exercises/math/derivation/variations/signVarTableProductFExp.js +451 -0
  84. package/lib/exercises/math/derivation/variations/signVarTableQuotientFExp.d.ts +11 -0
  85. package/lib/exercises/math/derivation/variations/signVarTableQuotientFExp.d.ts.map +1 -0
  86. package/lib/exercises/math/derivation/variations/signVarTableQuotientFExp.js +514 -0
  87. package/lib/exercises/math/functions/composition/index.d.ts +0 -1
  88. package/lib/exercises/math/functions/composition/index.d.ts.map +1 -1
  89. package/lib/exercises/math/functions/composition/index.js +1 -1
  90. package/lib/exercises/math/functions/exponential/algebraic/index.d.ts +0 -1
  91. package/lib/exercises/math/functions/exponential/algebraic/index.d.ts.map +1 -1
  92. package/lib/exercises/math/functions/exponential/algebraic/index.js +1 -1
  93. package/lib/exercises/math/functions/trinoms/sign/index.d.ts +1 -0
  94. package/lib/exercises/math/functions/trinoms/sign/index.d.ts.map +1 -1
  95. package/lib/exercises/math/functions/trinoms/sign/index.js +1 -0
  96. package/lib/exercises/math/functions/trinoms/sign/signOfProductOfAffineAndTrinom.d.ts +8 -0
  97. package/lib/exercises/math/functions/trinoms/sign/signOfProductOfAffineAndTrinom.d.ts.map +1 -0
  98. package/lib/exercises/math/functions/trinoms/sign/signOfProductOfAffineAndTrinom.js +226 -0
  99. package/lib/exercises/math/geometry/angles/parallelogramFourthAngle.d.ts.map +1 -1
  100. package/lib/exercises/math/geometry/angles/parallelogramFourthAngle.js +10 -10
  101. package/lib/exercises/math/geometry/quadrilaterals/parallelogramAngles.js +8 -8
  102. package/lib/exercises/math/geometry/triangles/similar/isSimilarTrianglesWithAngles.js +6 -6
  103. package/lib/exercises/math/geometry/triangles/triangleThirdAngleValue.js +8 -8
  104. package/lib/exercises/math/geometry/vectors/scalarProduct/alKashi/scalarProductAlKashiAngle.js +1 -1
  105. package/lib/exercises/math/geometry/vectors/scalarProduct/alKashi/scalarProductAlKashiSideLength.js +2 -2
  106. package/lib/exercises/math/geometry/vectors/scalarProduct/angleFromScalarProduct.js +2 -2
  107. package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductOrthoInSquare.d.ts.map +1 -1
  108. package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductOrthoInSquare.js +32 -17
  109. package/lib/exercises/math/probaStat/conditional/conditionalProbaFromTableWithContext.d.ts +13 -0
  110. package/lib/exercises/math/probaStat/conditional/conditionalProbaFromTableWithContext.d.ts.map +1 -0
  111. package/lib/exercises/math/probaStat/conditional/conditionalProbaFromTableWithContext.js +195 -0
  112. package/lib/exercises/math/probaStat/conditional/conditionalProbaWriteFromFrench.d.ts +9 -0
  113. package/lib/exercises/math/probaStat/conditional/conditionalProbaWriteFromFrench.d.ts.map +1 -0
  114. package/lib/exercises/math/probaStat/conditional/conditionalProbaWriteFromFrench.js +220 -0
  115. package/lib/exercises/math/probaStat/conditional/conditionalProbability.d.ts +15 -0
  116. package/lib/exercises/math/probaStat/conditional/conditionalProbability.d.ts.map +1 -0
  117. package/lib/exercises/math/probaStat/conditional/conditionalProbability.js +332 -0
  118. package/lib/exercises/math/probaStat/conditional/fillTableConditionalProbabilitySituation.d.ts +8 -0
  119. package/lib/exercises/math/probaStat/conditional/fillTableConditionalProbabilitySituation.d.ts.map +1 -0
  120. package/lib/exercises/math/probaStat/conditional/fillTableConditionalProbabilitySituation.js +222 -0
  121. package/lib/exercises/math/probaStat/conditional/index.d.ts +5 -0
  122. package/lib/exercises/math/probaStat/conditional/index.d.ts.map +1 -0
  123. package/lib/exercises/math/probaStat/conditional/index.js +4 -0
  124. package/lib/exercises/math/probaStat/index.d.ts +1 -2
  125. package/lib/exercises/math/probaStat/index.d.ts.map +1 -1
  126. package/lib/exercises/math/probaStat/index.js +1 -2
  127. package/lib/exercises/math/probaStat/probaFromTableWithContext.d.ts +1 -0
  128. package/lib/exercises/math/probaStat/probaFromTableWithContext.d.ts.map +1 -1
  129. package/lib/exercises/math/probaStat/probaFromTableWithContext.js +26 -199
  130. package/lib/exercises/math/probaStat/randomVariable/index.d.ts.map +1 -1
  131. package/lib/exercises/math/probaStat/randomVariable/index.js +1 -0
  132. package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationProbabilityLaw.d.ts.map +1 -1
  133. package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationProbabilityLaw.js +6 -2
  134. package/lib/exercises/math/probaStat/randomVariable/utils/randomVariableSituations.d.ts.map +1 -1
  135. package/lib/exercises/math/probaStat/randomVariable/utils/randomVariableSituations.js +6 -5
  136. package/lib/exercises/math/probaStat/trees/buildTreeFromSituation.d.ts.map +1 -1
  137. package/lib/exercises/math/probaStat/trees/buildTreeFromSituation.js +4 -27
  138. package/lib/exercises/math/probaStat/twoEventsSituations.d.ts +29 -0
  139. package/lib/exercises/math/probaStat/twoEventsSituations.d.ts.map +1 -0
  140. package/lib/exercises/math/probaStat/twoEventsSituations.js +145 -0
  141. package/lib/exercises/math/python/index.d.ts +1 -0
  142. package/lib/exercises/math/python/index.d.ts.map +1 -1
  143. package/lib/exercises/math/python/index.js +1 -0
  144. package/lib/exercises/math/python/sequences/pySequenceThresholdInstructionCompletion.d.ts.map +1 -1
  145. package/lib/exercises/math/python/sequences/pySequenceThresholdInstructionCompletion.js +11 -8
  146. package/lib/exercises/math/sequences/arithmetic/arithmeticFindExplicitFormulaFromTwoTerms.d.ts.map +1 -1
  147. package/lib/exercises/math/sequences/arithmetic/arithmeticFindExplicitFormulaFromTwoTerms.js +4 -3
  148. package/lib/exercises/math/sequences/arithmetic/index.d.ts +4 -3
  149. package/lib/exercises/math/sequences/arithmetic/index.d.ts.map +1 -1
  150. package/lib/exercises/math/sequences/arithmetic/index.js +4 -3
  151. package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindExplicitFormulaFromSituation.d.ts.map +1 -1
  152. package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindExplicitFormulaFromSituation.js +3 -2
  153. package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindRankFromSituation.d.ts.map +1 -1
  154. package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindRankFromSituation.js +8 -6
  155. package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindThresholdFromSituation.d.ts.map +1 -1
  156. package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindThresholdFromSituation.js +6 -5
  157. package/lib/exercises/math/sequences/arithmetic/situations/index.d.ts +0 -2
  158. package/lib/exercises/math/sequences/arithmetic/situations/index.d.ts.map +1 -1
  159. package/lib/exercises/math/sequences/arithmetic/situations/index.js +2 -2
  160. package/lib/exercises/math/sequences/arithmetic/sum/arithmeticComputeSumWithDots.d.ts +1 -0
  161. package/lib/exercises/math/sequences/arithmetic/sum/arithmeticComputeSumWithDots.d.ts.map +1 -1
  162. package/lib/exercises/math/sequences/arithmetic/sum/arithmeticComputeSumWithDots.js +65 -14
  163. package/lib/exercises/math/sequences/arithmetic/sum/index.d.ts +0 -1
  164. package/lib/exercises/math/sequences/arithmetic/sum/index.d.ts.map +1 -1
  165. package/lib/exercises/math/sequences/arithmetic/sum/index.js +1 -1
  166. package/lib/exercises/math/sequences/explicitFormulaUsage.d.ts +4 -1
  167. package/lib/exercises/math/sequences/explicitFormulaUsage.d.ts.map +1 -1
  168. package/lib/exercises/math/sequences/explicitFormulaUsage.js +47 -7
  169. package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFromTwoConsecutiveTerms.d.ts +14 -0
  170. package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFromTwoConsecutiveTerms.d.ts.map +1 -0
  171. package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFromTwoConsecutiveTerms.js +291 -0
  172. package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFromTwoTerms.d.ts.map +1 -1
  173. package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFromTwoTerms.js +4 -3
  174. package/lib/exercises/math/sequences/geometric/geometricFindRandomTermFromTwoConsecutiveTerms.d.ts +15 -0
  175. package/lib/exercises/math/sequences/geometric/geometricFindRandomTermFromTwoConsecutiveTerms.d.ts.map +1 -0
  176. package/lib/exercises/math/sequences/geometric/geometricFindRandomTermFromTwoConsecutiveTerms.js +249 -0
  177. package/lib/exercises/math/sequences/geometric/geometricFindRandomTermFromTwoTerms.js +2 -2
  178. package/lib/exercises/math/sequences/geometric/index.d.ts +3 -2
  179. package/lib/exercises/math/sequences/geometric/index.d.ts.map +1 -1
  180. package/lib/exercises/math/sequences/geometric/index.js +6 -2
  181. package/lib/exercises/math/sequences/geometric/situations/geometricFindExplicitFormulaFromSituation.d.ts.map +1 -1
  182. package/lib/exercises/math/sequences/geometric/situations/geometricFindExplicitFormulaFromSituation.js +3 -2
  183. package/lib/exercises/math/sequences/geometric/situations/geometricFindTermFromSituation.js +1 -1
  184. package/lib/exercises/math/sequences/geometric/situations/index.d.ts +0 -1
  185. package/lib/exercises/math/sequences/geometric/situations/index.d.ts.map +1 -1
  186. package/lib/exercises/math/sequences/geometric/situations/index.js +1 -1
  187. package/lib/exercises/math/sequences/geometric/sum/geometricComputeSumWithDots.js +2 -2
  188. package/lib/exercises/math/sequences/graph/placeFirstSequencePoints.js +2 -2
  189. package/lib/exercises/math/sequences/index.d.ts +1 -0
  190. package/lib/exercises/math/sequences/index.d.ts.map +1 -1
  191. package/lib/exercises/math/sequences/index.js +1 -0
  192. package/lib/exercises/math/sequences/recurrenceFormulaUsage.d.ts +5 -1
  193. package/lib/exercises/math/sequences/recurrenceFormulaUsage.d.ts.map +1 -1
  194. package/lib/exercises/math/sequences/recurrenceFormulaUsage.js +89 -9
  195. package/lib/exercises/math/sequences/seqArithmGeom/seqArithmGeomRecurrenceFormulaUsage.d.ts.map +1 -1
  196. package/lib/exercises/math/sequences/seqArithmGeom/seqArithmGeomRecurrenceFormulaUsage.js +5 -9
  197. package/lib/exercises/math/spaceGeometry/sphere/sphereLatLonReading.2d.js +1 -1
  198. package/lib/exercises/math/trigonometry/circle/associatePoint.d.ts.map +1 -1
  199. package/lib/exercises/math/trigonometry/circle/associatePoint.js +55 -6
  200. package/lib/exercises/math/trigonometry/circle/selectQuadrantOnTrigoCircle.d.ts.map +1 -1
  201. package/lib/exercises/math/trigonometry/circle/selectQuadrantOnTrigoCircle.js +5 -6
  202. package/lib/exercises/math/trigonometry/functions/associateAngleSimplification.d.ts.map +1 -1
  203. package/lib/exercises/math/trigonometry/functions/associateAngleSimplification.js +1 -3
  204. package/lib/exercises/math/trigonometry/triangle/trigonometryAngleCalcul.js +2 -2
  205. package/lib/exercises/pc/snellDescartes.js +2 -2
  206. package/lib/exercises/vea/polynomialVEA.d.ts +2 -0
  207. package/lib/exercises/vea/polynomialVEA.d.ts.map +1 -0
  208. package/lib/exercises/vea/polynomialVEA.js +17 -0
  209. package/lib/exercises/vea/valueTableVEA.d.ts +8 -0
  210. package/lib/exercises/vea/valueTableVEA.d.ts.map +1 -0
  211. package/lib/exercises/vea/valueTableVEA.js +12 -0
  212. package/lib/index.d.ts +152 -41
  213. package/lib/index.d.ts.map +1 -1
  214. package/lib/latexTester.d.ts.map +1 -1
  215. package/lib/latexTester.js +9 -6
  216. package/lib/math/polynomials/affine.d.ts +1 -0
  217. package/lib/math/polynomials/affine.d.ts.map +1 -1
  218. package/lib/math/polynomials/affine.js +5 -0
  219. package/lib/math/utils/arithmetic/primeFactors.js +1 -1
  220. package/lib/math/utils/functions/functionComposition.d.ts.map +1 -1
  221. package/lib/math/utils/functions/functionComposition.js +18 -1
  222. package/lib/math/utils/polynomial/polynomialInterpolationUtils.d.ts +19 -0
  223. package/lib/math/utils/polynomial/polynomialInterpolationUtils.d.ts.map +1 -0
  224. package/lib/math/utils/polynomial/polynomialInterpolationUtils.js +53 -0
  225. package/lib/math/utils/polynomial/polynomialUtils.d.ts +37 -0
  226. package/lib/math/utils/polynomial/polynomialUtils.d.ts.map +1 -0
  227. package/lib/math/utils/polynomial/polynomialUtils.js +223 -0
  228. package/lib/math/utils/sequences/situations/seqArithmeticSituations.d.ts +18 -4
  229. package/lib/math/utils/sequences/situations/seqArithmeticSituations.d.ts.map +1 -1
  230. package/lib/math/utils/sequences/situations/seqArithmeticSituations.js +434 -333
  231. package/lib/math/utils/sequences/situations/seqArithmeticUtils.d.ts.map +1 -1
  232. package/lib/math/utils/sequences/situations/seqArithmeticUtils.js +3 -1
  233. package/lib/math/utils/sequences/situations/seqGeometricSituations.d.ts +5 -0
  234. package/lib/math/utils/sequences/situations/seqGeometricSituations.d.ts.map +1 -1
  235. package/lib/math/utils/sequences/situations/seqGeometricSituations.js +58 -25
  236. package/lib/prototypesEnhancement.d.ts +1 -0
  237. package/lib/prototypesEnhancement.d.ts.map +1 -1
  238. package/lib/prototypesEnhancement.js +3 -0
  239. package/lib/tests/pdfs/mdCodeToLatex.d.ts.map +1 -1
  240. package/lib/tests/pdfs/mdCodeToLatex.js +8 -15
  241. package/lib/tests/questionTest.d.ts.map +1 -1
  242. package/lib/tests/questionTest.js +6 -3
  243. package/lib/tree/nodes/geometry/degree.js +1 -1
  244. package/lib/tree/nodes/operators/multiplyNode.d.ts.map +1 -1
  245. package/lib/tree/nodes/operators/multiplyNode.js +1 -1
  246. package/lib/tree/nodes/operators/substractNode.d.ts.map +1 -1
  247. package/lib/tree/nodes/operators/substractNode.js +2 -1
  248. package/lib/tree/parsers/degreeParser.js +2 -2
  249. package/lib/tree/utilities/nodeUtils.d.ts +6 -0
  250. package/lib/tree/utilities/nodeUtils.d.ts.map +1 -0
  251. package/lib/tree/utilities/nodeUtils.js +24 -0
  252. package/lib/utils/strings/prependArticle.d.ts +2 -0
  253. package/lib/utils/strings/prependArticle.d.ts.map +1 -0
  254. package/lib/utils/strings/prependArticle.js +1 -0
  255. package/package.json +1 -1
@@ -0,0 +1,291 @@
1
+ import { addValidProp, tryToAddWrongProp, propWhile, } from "../../../../exercises/exercise.js";
2
+ import { getOptionFirstTermRankOneStuff, } from "../../../../exercises/options/optionFirstTermRankOne.js";
3
+ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
4
+ import { randfloat } from "../../../../math/utils/random/randfloat.js";
5
+ import { randint } from "../../../../math/utils/random/randint.js";
6
+ import { round } from "../../../../math/utils/round.js";
7
+ import { EqualNode, isEqualNode, } from "../../../../tree/nodes/equations/equalNode.js";
8
+ import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
9
+ import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
10
+ import { power } from "../../../../tree/nodes/operators/powerNode.js";
11
+ import { substract } from "../../../../tree/nodes/operators/substractNode.js";
12
+ import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
13
+ import { coinFlip } from "../../../../utils/alea/coinFlip.js";
14
+ import { random } from "../../../../utils/alea/random.js";
15
+ import { shuffle } from "../../../../utils/alea/shuffle.js";
16
+ import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
17
+ import { alignTex } from "../../../../utils/latex/alignTex.js";
18
+ const getInstruction = (identifiers) => {
19
+ const { rank1, value1, rank2, value2 } = identifiers;
20
+ return `Soit $u$ une suite géométrique telle que $u_{${rank1.frenchify()}} = ${value1.frenchify()}$ et $u_{${rank2.frenchify()}} = ${value2.frenchify()}$.
21
+
22
+ Donner l'expression de $u_n$ en fonction de $n$.`;
23
+ };
24
+ const getAnswerStuff = (identifiers, opts) => {
25
+ const firstRank = opts.firstTermRankOne ? 1 : 0;
26
+ const { rank1, value1, rank2, value2, precisionInitial, precisionReason } = identifiers;
27
+ const reason = round(power(frac(value2, value1), frac(1, substract(rank2, rank1))).evaluate(), precisionReason);
28
+ const valueFirstRank = round(frac(value1, power(reason, rank1 - firstRank)).evaluate(), precisionInitial);
29
+ const nodeFormula = multiply(valueFirstRank, power(reason, substract("n".toTree(), firstRank).simplify()));
30
+ const equalNode = new EqualNode("u_n".toTree(), nodeFormula);
31
+ return {
32
+ initial: valueFirstRank,
33
+ reason,
34
+ answerNode: equalNode,
35
+ };
36
+ };
37
+ const getAnswer = (identifiers, optsIn) => {
38
+ const opts = optsIn ?? optsDefault;
39
+ return getAnswerStuff(identifiers, opts).answerNode.toTex();
40
+ };
41
+ const getHint = (_, optsIn) => {
42
+ const opts = optsIn ?? optsDefault;
43
+ const firstRank = opts?.firstTermRankOne ? 1 : 0;
44
+ return `Commence par déterminer la raison $q$ de la suite $u$.
45
+
46
+ Puis, utilise cette raison et un des termes connus de la suite pour déterminer $u_{${firstRank}}$.`;
47
+ };
48
+ const getCorrection = (identifiers, optsIn) => {
49
+ const opts = optsIn ?? optsDefault;
50
+ const firstRank = opts?.firstTermRankOne ? 1 : 0;
51
+ const { rank1, value1, rank2, value2 } = identifiers;
52
+ const closest = Math.abs(firstRank - rank1) < Math.abs(firstRank - rank2) ? rank1 : rank2;
53
+ const diff = firstRank - closest;
54
+ const closestValue = closest === rank1 ? value1 : value2;
55
+ const { reason, answerNode } = getAnswerStuff(identifiers, opts);
56
+ return `On commence par déterminer la raison $q$ de la suite $u$.
57
+
58
+ On a :
59
+
60
+ ${alignTex([
61
+ [
62
+ `u_{${rank1}}`,
63
+ "=",
64
+ `u_{${firstRank}} \\times q^{${rank1.frenchify()} - ${firstRank.frenchify()}}`,
65
+ ],
66
+ [
67
+ `u_{${rank2}}`,
68
+ "=",
69
+ `u_{${firstRank}} \\times q^{${rank2.frenchify()} - ${firstRank.frenchify()}}`,
70
+ ],
71
+ ])}
72
+
73
+ On forme le quotient :
74
+
75
+ ${alignTex([
76
+ [
77
+ `\\frac{u_{${rank2}}}{u_{${rank1}}}`,
78
+ "=",
79
+ `q^{${rank2.frenchify()} - ${rank1.frenchify()}}`,
80
+ ],
81
+ [
82
+ `\\frac{${value2.frenchify()}}{${value1.frenchify()}}`,
83
+ "=",
84
+ `q^{${(rank2 - rank1).frenchify()}}`,
85
+ ],
86
+ [`${reason.frenchify()}`, "=", `q`],
87
+ ])}
88
+
89
+ On peut alors déterminer $u_{${firstRank.frenchify()}}$ en utilisant $u_{${closest.frenchify()}}$ et $q$. En effet, on a :
90
+
91
+ ${alignTex([
92
+ [
93
+ `u_{${firstRank.frenchify()}}`,
94
+ "=",
95
+ `\\frac{u_{${closest.frenchify()}}}{q^{${(-diff).frenchify()}}}`,
96
+ ],
97
+ ["", "=", frac(closestValue, power(reason, -diff)).toTex()],
98
+ ["", "=", multiply(closestValue, power(reason, diff)).evaluate().frPretty(1)],
99
+ ])}
100
+
101
+ On a donc :
102
+
103
+ ${(() => {
104
+ const texFormulaAbstract = firstRank === 0 ? "u_0 \\times q^{n}" : "u_1 \\times q^{n-1}";
105
+ return alignTex([
106
+ ["u_n", "=", texFormulaAbstract],
107
+ ["", "=", answerNode.rightChild.toTex()],
108
+ ]);
109
+ })()}
110
+
111
+ `;
112
+ };
113
+ const getPropositions = (n, { answer, ..._identifiers }, optsIn) => {
114
+ const opts = optsIn ?? optsDefault;
115
+ // const firstRank = opts?.firstTermRankOne ? 1 : 0;
116
+ const propositions = [];
117
+ addValidProp(propositions, answer);
118
+ propWhile(propositions, n, () => {
119
+ const identifiersWrong = createRandomIdentifiersCurated(opts);
120
+ const texWrong = getAnswer(identifiersWrong, opts);
121
+ tryToAddWrongProp(propositions, texWrong);
122
+ });
123
+ return shuffle(propositions);
124
+ };
125
+ const isAnswerValid = (ans, { answer, ...identifiers }, optsIn) => {
126
+ const opts = optsIn ?? optsDefault;
127
+ try {
128
+ //TODO faire fonctionner parseAlgebraic("u_n=3+2n") (token _ not implemented)
129
+ const nodeAnswer = getAnswerStuff(identifiers, opts).answerNode;
130
+ if (!ans.includes("=")) {
131
+ // return false;
132
+ ans = nodeAnswer.leftChild.toTex() + "=" + ans;
133
+ }
134
+ // const nodeAns = parseAlgebraic(ans);
135
+ const nodeAns = (() => {
136
+ const [lhs, rhs] = ans.split("=");
137
+ const nodeLhs = lhs.toTree();
138
+ const nodeRhs = parseAlgebraic(rhs);
139
+ return new EqualNode(nodeLhs, nodeRhs);
140
+ })();
141
+ if (!isEqualNode(nodeAns)) {
142
+ return false;
143
+ }
144
+ const isValidLhs = () => nodeAns.leftChild.toTex() === nodeAnswer.leftChild.toTex();
145
+ const isValidRhs = () => {
146
+ const nodeAnsRhs = nodeAns.rightChild;
147
+ const nodeAnswerRhs = nodeAnswer.rightChild;
148
+ return [0, 1, 2, 10].every((n) => {
149
+ return (substract(nodeAnsRhs.evaluate({ n }), nodeAnswerRhs.evaluate({ n })).evaluate() === 0);
150
+ });
151
+ };
152
+ return isValidLhs() && isValidRhs();
153
+ }
154
+ catch (e) {
155
+ handleVEAError(e);
156
+ return false;
157
+ }
158
+ };
159
+ const createRandomIdentifiersRaw = (opts) => {
160
+ const firstRank = opts?.firstTermRankOne ? 1 : 0;
161
+ const isDivergent = coinFlip();
162
+ const isReasonNegative = coinFlip();
163
+ const signReason = isReasonNegative ? -1 : +1;
164
+ function createGeometricDivergent() {
165
+ const precisionInitial = 1;
166
+ const initial = randfloat(1, 10, precisionInitial, [1]);
167
+ const precisionReason = 0;
168
+ const reason = signReason * randint(2, 10);
169
+ return [initial, precisionInitial, reason, precisionReason];
170
+ }
171
+ function createGeometricConvergent() {
172
+ const poolReasonStuff = [
173
+ {
174
+ q: 0.5,
175
+ precision: 1,
176
+ invQ: 2,
177
+ },
178
+ {
179
+ q: 0.25,
180
+ precision: 2,
181
+ invQ: 4,
182
+ },
183
+ {
184
+ q: 0.2,
185
+ precision: 1,
186
+ invQ: 5,
187
+ },
188
+ {
189
+ q: 0.1,
190
+ precision: 1,
191
+ invQ: 10,
192
+ },
193
+ {
194
+ q: 0.05,
195
+ precision: 2,
196
+ invQ: 20,
197
+ },
198
+ ];
199
+ const { q, invQ, precision: precisionReason } = random(poolReasonStuff);
200
+ const reason = signReason * q;
201
+ const precisionInitial = 0;
202
+ const initial = round(randint(10, 100) * Math.pow(invQ, 8), precisionInitial);
203
+ return [initial, precisionInitial, reason, precisionReason];
204
+ }
205
+ const [initial, precisionInitial, reason, precisionReason] = (() => {
206
+ if (isDivergent) {
207
+ return createGeometricDivergent();
208
+ }
209
+ else {
210
+ return createGeometricConvergent();
211
+ }
212
+ })();
213
+ const rank1 = randint(firstRank + 1, 5);
214
+ const rank2 = rank1 + randint(1, 5);
215
+ function valueForRank(initial, reason, rank) {
216
+ return initial * Math.pow(reason, rank);
217
+ }
218
+ const [value1, value2] = [rank1, rank2].map((rank) => round(valueForRank(initial, reason, rank), 6));
219
+ const identifiers = {
220
+ rank1,
221
+ value1,
222
+ rank2,
223
+ value2,
224
+ precisionInitial,
225
+ precisionReason,
226
+ };
227
+ return identifiers;
228
+ };
229
+ const createRandomIdentifiersCurated = (opts) => {
230
+ let identifiers;
231
+ let isValid = false;
232
+ let counter = -1;
233
+ while (!isValid && counter < 100) {
234
+ counter++;
235
+ const identifiersCandidate = createRandomIdentifiersRaw(opts);
236
+ const answer = getAnswer(identifiersCandidate, opts);
237
+ isValid = !answer.includes("NaN");
238
+ if (isValid) {
239
+ identifiers = identifiersCandidate;
240
+ }
241
+ }
242
+ if (!isValid) {
243
+ //2.5 * 2^n
244
+ const identifiersDefault = {
245
+ rank1: 2,
246
+ value1: 10,
247
+ rank2: 5,
248
+ value2: 40,
249
+ precisionInitial: 1,
250
+ precisionReason: 0,
251
+ };
252
+ identifiers = identifiersDefault;
253
+ }
254
+ return identifiers;
255
+ };
256
+ const getGeometricFindExplicitFormulaFromTwoConsecutiveTermsQuestion = (optsIn) => {
257
+ const opts = optsIn ?? optsDefault;
258
+ const identifiers = createRandomIdentifiersCurated(opts);
259
+ return getQuestionFromIdentifiers(identifiers, opts);
260
+ };
261
+ const getQuestionFromIdentifiers = (identifiers, opts) => {
262
+ const question = {
263
+ answer: getAnswer(identifiers, opts),
264
+ instruction: getInstruction(identifiers, opts),
265
+ keys: ["un", "equal", "n"],
266
+ answerFormat: "tex",
267
+ identifiers,
268
+ hint: getHint(identifiers, opts),
269
+ correction: getCorrection(identifiers, opts),
270
+ options: opts,
271
+ };
272
+ return question;
273
+ };
274
+ const { optsDefaultFirstTermRankOne, generatorOptionFirstTermRankOne } = getOptionFirstTermRankOneStuff(false);
275
+ const optsDefault = Object.assign({}, optsDefaultFirstTermRankOne);
276
+ const options = [generatorOptionFirstTermRankOne];
277
+ export const geometricFindExplicitFormulaFromTwoConsecutiveTerms = {
278
+ id: "geometricFindExplicitFormulaFromTwoConsecutiveTerms",
279
+ connector: "=",
280
+ label: "Connaissant deux termes consécutifs d'une suite géométrique, en donner une formule générale",
281
+ isSingleStep: true,
282
+ generator: (nb, opts) => getDistinctQuestions(() => getGeometricFindExplicitFormulaFromTwoConsecutiveTermsQuestion(opts), nb),
283
+ options,
284
+ qcmTimer: 60,
285
+ freeTimer: 60,
286
+ getPropositions,
287
+ isAnswerValid,
288
+ subject: "Mathématiques",
289
+ getQuestionFromIdentifiers,
290
+ hasHintAndCorrection: true,
291
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"geometricFindExplicitFormulaFromTwoTerms.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/geometric/geometricFindExplicitFormulaFromTwoTerms.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAEL,sBAAsB,EACvB,MAAM,mDAAmD,CAAC;AAoB3D,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,gBAAgB,EAAE,MAAM,CAAC;IACzB,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC;AAkWF,KAAK,OAAO,GAAG,sBAAsB,CAAC;AAMtC,eAAO,MAAM,wCAAwC,EAAE,QAAQ,CAC7D,WAAW,EACX,OAAO,CAoBR,CAAC"}
1
+ {"version":3,"file":"geometricFindExplicitFormulaFromTwoTerms.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/geometric/geometricFindExplicitFormulaFromTwoTerms.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAEL,sBAAsB,EACvB,MAAM,mDAAmD,CAAC;AAoB3D,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,gBAAgB,EAAE,MAAM,CAAC;IACzB,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC;AAsWF,KAAK,OAAO,GAAG,sBAAsB,CAAC;AAMtC,eAAO,MAAM,wCAAwC,EAAE,QAAQ,CAC7D,WAAW,EACX,OAAO,CAoBR,CAAC"}
@@ -136,10 +136,12 @@ const getPropositions = (n, { answer, ..._identifiers }, optsIn) => {
136
136
  const isAnswerValid = (ans, { answer, ...identifiers }, optsIn) => {
137
137
  const opts = optsIn ?? optsDefault;
138
138
  try {
139
+ //TODO faire fonctionner parseAlgebraic("u_n=3+2n") (token _ not implemented)
140
+ const nodeAnswer = getAnswerStuff(identifiers, opts).answerNode;
139
141
  if (!ans.includes("=")) {
140
- return false;
142
+ // return false;
143
+ ans = nodeAnswer.leftChild.toTex() + "=" + ans;
141
144
  }
142
- //TODO faire fonctionner parseAlgebraic("u_n=3+2n") (token _ not implemented)
143
145
  // const nodeAns = parseAlgebraic(ans);
144
146
  const nodeAns = (() => {
145
147
  const [lhs, rhs] = ans.split("=");
@@ -150,7 +152,6 @@ const isAnswerValid = (ans, { answer, ...identifiers }, optsIn) => {
150
152
  if (!isEqualNode(nodeAns)) {
151
153
  return false;
152
154
  }
153
- const nodeAnswer = getAnswerStuff(identifiers, opts).answerNode;
154
155
  const isValidLhs = () => nodeAns.leftChild.toTex() === nodeAnswer.leftChild.toTex();
155
156
  const isValidRhs = () => {
156
157
  const nodeAnsRhs = nodeAns.rightChild;
@@ -0,0 +1,15 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ import { OptionFirstTermRankOne } from "../../../../exercises/options/optionFirstTermRankOne.js";
3
+ type Identifiers = {
4
+ rank1: number;
5
+ value1: number;
6
+ rank2: number;
7
+ value2: number;
8
+ precisionInitial: number;
9
+ precisionReason: number;
10
+ rankAsked: number;
11
+ };
12
+ type Options = OptionFirstTermRankOne;
13
+ export declare const geometricFindRandomTermFromTwoConsecutiveTerms: Exercise<Identifiers, Options>;
14
+ export {};
15
+ //# sourceMappingURL=geometricFindRandomTermFromTwoConsecutiveTerms.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"geometricFindRandomTermFromTwoConsecutiveTerms.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/geometric/geometricFindRandomTermFromTwoConsecutiveTerms.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAEL,sBAAsB,EACvB,MAAM,mDAAmD,CAAC;AAe3D,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,gBAAgB,EAAE,MAAM,CAAC;IACzB,eAAe,EAAE,MAAM,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AA6RF,KAAK,OAAO,GAAG,sBAAsB,CAAC;AAMtC,eAAO,MAAM,8CAA8C,EAAE,QAAQ,CACnE,WAAW,EACX,OAAO,CAoBR,CAAC"}
@@ -0,0 +1,249 @@
1
+ import { addValidProp, tryToAddWrongProp, propWhile, } from "../../../../exercises/exercise.js";
2
+ import { getOptionFirstTermRankOneStuff, } from "../../../../exercises/options/optionFirstTermRankOne.js";
3
+ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
4
+ import { numberVEA } from "../../../../exercises/vea/numberVEA.js";
5
+ import { randfloat } from "../../../../math/utils/random/randfloat.js";
6
+ import { randint } from "../../../../math/utils/random/randint.js";
7
+ import { round } from "../../../../math/utils/round.js";
8
+ import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
9
+ import { power } from "../../../../tree/nodes/operators/powerNode.js";
10
+ import { substract } from "../../../../tree/nodes/operators/substractNode.js";
11
+ import { coinFlip } from "../../../../utils/alea/coinFlip.js";
12
+ import { random } from "../../../../utils/alea/random.js";
13
+ import { shuffle } from "../../../../utils/alea/shuffle.js";
14
+ import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
15
+ import { alignTex } from "../../../../utils/latex/alignTex.js";
16
+ const getInstruction = (identifiers) => {
17
+ const { rank1, value1, rank2, value2, rankAsked } = identifiers;
18
+ return `Soit $u$ une suite géométrique telle que $u_{${rank1.frenchify()}} = ${value1.frenchify()}$ et $u_{${rank2.frenchify()}} = ${value2.frenchify()}$.
19
+
20
+ Que vaut $u_{${rankAsked}}$ ?`;
21
+ };
22
+ const getAnswerStuff = (identifiers, _opts) => {
23
+ const { rank1, value1, rank2, value2, precisionInitial, precisionReason, rankAsked, } = identifiers;
24
+ const reason = round(power(frac(value2, value1), frac(1, substract(rank2, rank1))).evaluate(), precisionReason);
25
+ const valueAsked = round(frac(value1, power(reason, rank1 - rankAsked)).evaluate(), precisionInitial);
26
+ return {
27
+ reason,
28
+ answerNode: valueAsked.toTree(),
29
+ };
30
+ };
31
+ const getAnswer = (identifiers, optsIn) => {
32
+ const opts = optsIn ?? optsDefault;
33
+ return getAnswerStuff(identifiers, opts).answerNode.toTex();
34
+ };
35
+ const getHint = (identifiers, _optsIn) => {
36
+ const { rankAsked } = identifiers;
37
+ return `Commence par déterminer la raison $q$ de la suite $u$.
38
+
39
+ Puis, utilise cette raison et un des termes connus de la suite pour déterminer $u_{${rankAsked}}$.`;
40
+ };
41
+ const getCorrection = (identifiers, optsIn) => {
42
+ const opts = optsIn ?? optsDefault;
43
+ const firstRank = opts?.firstTermRankOne ? 1 : 0;
44
+ const { rank1, value1, rank2, value2, rankAsked } = identifiers;
45
+ const diff = rankAsked - rank1;
46
+ const { reason, answerNode } = getAnswerStuff(identifiers, opts);
47
+ return `On commence par déterminer la raison $q$ de la suite $u$.
48
+
49
+ On a :
50
+
51
+ ${alignTex([
52
+ [
53
+ `u_{${rank1}}`,
54
+ "=",
55
+ `u_{${firstRank}} \\times q^{${rank1.frenchify()} - ${firstRank.frenchify()}}`,
56
+ ],
57
+ [
58
+ `u_{${rank2}}`,
59
+ "=",
60
+ `u_{${firstRank}} \\times q^{${rank2.frenchify()} - ${firstRank.frenchify()}}`,
61
+ ],
62
+ ])}
63
+
64
+ On forme le quotient :
65
+
66
+ ${alignTex([
67
+ [
68
+ `\\frac{u_{${rank2}}}{u_{${rank1}}}`,
69
+ "=",
70
+ `q^{${rank2.frenchify()} - ${rank1.frenchify()}}`,
71
+ ],
72
+ [
73
+ `\\frac{${value2.frenchify()}}{${value1.frenchify()}}`,
74
+ "=",
75
+ `q^{${(rank2 - rank1).frenchify()}}`,
76
+ ],
77
+ [`${reason.frenchify()}`, "=", `q`],
78
+ ])}
79
+
80
+ On peut alors déterminer $u_{${rankAsked.frenchify()}}$ en utilisant $u_{${rank1.frenchify()}}$ et $q$. En effet, on a :
81
+
82
+ ${alignTex([
83
+ [
84
+ `u_{${rankAsked.frenchify()}}`,
85
+ "=",
86
+ `\\frac{u_{${rank1.frenchify()}}}{q^{${(-diff).frenchify()}}}`,
87
+ ],
88
+ ["", "=", frac(value1, power(reason, -diff)).toTex()],
89
+ ["", "=", answerNode.toTex()],
90
+ ])}
91
+
92
+ `;
93
+ };
94
+ const getPropositions = (n, { answer, ..._identifiers }, optsIn) => {
95
+ const opts = optsIn ?? optsDefault;
96
+ // const firstRank = opts?.firstTermRankOne ? 1 : 0;
97
+ const propositions = [];
98
+ addValidProp(propositions, answer);
99
+ propWhile(propositions, n, () => {
100
+ const identifiersWrong = createRandomIdentifiersCurated(opts);
101
+ const texWrong = getAnswer(identifiersWrong, opts);
102
+ tryToAddWrongProp(propositions, texWrong);
103
+ });
104
+ return shuffle(propositions);
105
+ };
106
+ const isAnswerValid = (ans, { answer }) => {
107
+ try {
108
+ return numberVEA(ans, answer);
109
+ }
110
+ catch (err) {
111
+ return handleVEAError(err);
112
+ }
113
+ };
114
+ const createRandomIdentifiersRaw = (opts) => {
115
+ const firstRank = opts?.firstTermRankOne ? 1 : 0;
116
+ const isDivergent = coinFlip();
117
+ const isReasonNegative = coinFlip();
118
+ const signReason = isReasonNegative ? -1 : +1;
119
+ function createGeometricDivergent() {
120
+ const precisionInitial = 1;
121
+ const initial = randfloat(1, 10, precisionInitial, [1]);
122
+ const precisionReason = 0;
123
+ const reason = signReason * randint(2, 10);
124
+ return [initial, precisionInitial, reason, precisionReason];
125
+ }
126
+ function createGeometricConvergent() {
127
+ const poolReasonStuff = [
128
+ {
129
+ q: 0.5,
130
+ precision: 1,
131
+ invQ: 2,
132
+ },
133
+ {
134
+ q: 0.25,
135
+ precision: 2,
136
+ invQ: 4,
137
+ },
138
+ {
139
+ q: 0.2,
140
+ precision: 1,
141
+ invQ: 5,
142
+ },
143
+ {
144
+ q: 0.1,
145
+ precision: 1,
146
+ invQ: 10,
147
+ },
148
+ {
149
+ q: 0.05,
150
+ precision: 2,
151
+ invQ: 20,
152
+ },
153
+ ];
154
+ const { q, invQ, precision: precisionReason } = random(poolReasonStuff);
155
+ const reason = signReason * q;
156
+ const precisionInitial = 0;
157
+ const initial = round(randint(10, 100) * Math.pow(invQ, 8), precisionInitial);
158
+ return [initial, precisionInitial, reason, precisionReason];
159
+ }
160
+ const [initial, precisionInitial, reason, precisionReason] = (() => {
161
+ if (isDivergent) {
162
+ return createGeometricDivergent();
163
+ }
164
+ else {
165
+ return createGeometricConvergent();
166
+ }
167
+ })();
168
+ const rank1 = randint(firstRank + 1, 5);
169
+ const rank2 = rank1 + 1;
170
+ const rankAsked = randint(2, 9, [rank1, rank2]);
171
+ function valueForRank(initial, reason, rank) {
172
+ return initial * Math.pow(reason, rank);
173
+ }
174
+ const [value1, value2] = [rank1, rank2].map((rank) => round(valueForRank(initial, reason, rank), 4));
175
+ const identifiers = {
176
+ rank1,
177
+ value1,
178
+ rank2,
179
+ value2,
180
+ precisionInitial,
181
+ precisionReason,
182
+ rankAsked,
183
+ };
184
+ return identifiers;
185
+ };
186
+ const createRandomIdentifiersCurated = (opts) => {
187
+ let identifiers;
188
+ let isValid = false;
189
+ let counter = -1;
190
+ while (!isValid && counter < 100) {
191
+ counter++;
192
+ const identifiersCandidate = createRandomIdentifiersRaw(opts);
193
+ const answer = getAnswer(identifiersCandidate, opts);
194
+ isValid = !answer.includes("NaN");
195
+ if (isValid) {
196
+ identifiers = identifiersCandidate;
197
+ }
198
+ }
199
+ if (!isValid) {
200
+ //2.5 * 2^n
201
+ const identifiersDefault = {
202
+ rank1: 2,
203
+ value1: 10,
204
+ rank2: 5,
205
+ value2: 40,
206
+ precisionInitial: 1,
207
+ precisionReason: 0,
208
+ rankAsked: 9,
209
+ };
210
+ identifiers = identifiersDefault;
211
+ }
212
+ return identifiers;
213
+ };
214
+ const getGeometricFindRandomTermFromTwoConsecutiveTermsQuestion = (optsIn) => {
215
+ const opts = optsIn ?? optsDefault;
216
+ const identifiers = createRandomIdentifiersCurated(opts);
217
+ return getQuestionFromIdentifiers(identifiers, opts);
218
+ };
219
+ const getQuestionFromIdentifiers = (identifiers, opts) => {
220
+ const question = {
221
+ answer: getAnswer(identifiers, opts),
222
+ instruction: getInstruction(identifiers, opts),
223
+ keys: ["un", "equal", "n"],
224
+ answerFormat: "tex",
225
+ identifiers,
226
+ hint: getHint(identifiers, opts),
227
+ correction: getCorrection(identifiers, opts),
228
+ options: opts,
229
+ };
230
+ return question;
231
+ };
232
+ const { optsDefaultFirstTermRankOne, generatorOptionFirstTermRankOne } = getOptionFirstTermRankOneStuff(false);
233
+ const optsDefault = Object.assign({}, optsDefaultFirstTermRankOne);
234
+ const options = [generatorOptionFirstTermRankOne];
235
+ export const geometricFindRandomTermFromTwoConsecutiveTerms = {
236
+ id: "geometricFindRandomTermFromTwoConsecutiveTerms",
237
+ connector: "=",
238
+ label: "Connaissant deux termes consécutifs d'une suite géométrique, en donner une formule générale",
239
+ isSingleStep: true,
240
+ generator: (nb, opts) => getDistinctQuestions(() => getGeometricFindRandomTermFromTwoConsecutiveTermsQuestion(opts), nb),
241
+ options,
242
+ qcmTimer: 60,
243
+ freeTimer: 60,
244
+ getPropositions,
245
+ isAnswerValid,
246
+ subject: "Mathématiques",
247
+ getQuestionFromIdentifiers,
248
+ hasHintAndCorrection: true,
249
+ };
@@ -177,7 +177,7 @@ const createRandomIdentifiersRaw = (opts) => {
177
177
  }
178
178
  })();
179
179
  const rank1 = randint(firstRank + 1, 5);
180
- const rank2 = rank1 + randint(1, 5);
180
+ const rank2 = rank1 + randint(2, 5);
181
181
  const rankAsked = randint(2, 9, [rank1, rank2]);
182
182
  function valueForRank(initial, reason, rank) {
183
183
  return initial * Math.pow(reason, rank);
@@ -246,7 +246,7 @@ const options = [generatorOptionFirstTermRankOne];
246
246
  export const geometricFindRandomTermFromTwoTerms = {
247
247
  id: "geometricFindRandomTermFromTwoTerms",
248
248
  connector: "=",
249
- label: "Connaissant deux termes d'une suite géométrique, en donner une formule générale",
249
+ label: "Connaissant deux termes d'une suite géométrique, en calculer un troisième",
250
250
  isSingleStep: true,
251
251
  generator: (nb, opts) => getDistinctQuestions(() => getGeometricFindRandomTermFromTwoTermsQuestion(opts), nb),
252
252
  options,
@@ -2,13 +2,14 @@ export * from "./geometricExplicitFormulaUsage.js";
2
2
  export * from "./geometricFindExplicitFormula.js";
3
3
  export * from "./geometricFindExplicitFormulaFirstRankOne.js";
4
4
  export * from "./geometricFindReason.js";
5
- export * from "./geometricFirstTermsSum.js";
6
5
  export * from "./geometricReasonUsage.js";
7
6
  export * from "./geometricRecurrenceFormulaUsage.js";
8
7
  export * from "./geometricFindExplicitFormulaFirstTermRandom.js";
9
8
  export * from "./geometricFindTerm.js";
10
9
  export * from "./geometricFindTermFirstRankOne.js";
11
10
  export * from "./geometricRecognizeReasonFromFirstTerms.js";
12
- export * from "./geometricFirstTermsGeneralSum.js";
13
11
  export * from "./geometricVariations.js";
12
+ export * from "./geometricFindRandomTermFromTwoTerms.js";
13
+ export * from "./sum/index.js";
14
+ export * from "./situations/index.js";
14
15
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/geometric/index.ts"],"names":[],"mappings":"AAAA,cAAc,oCAAoC,CAAC;AACnD,cAAc,mCAAmC,CAAC;AAClD,cAAc,+CAA+C,CAAC;AAE9D,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,sCAAsC,CAAC;AACrD,cAAc,kDAAkD,CAAC;AACjE,cAAc,wBAAwB,CAAC;AACvC,cAAc,oCAAoC,CAAC;AAEnD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,oCAAoC,CAAC;AACnD,cAAc,0BAA0B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/geometric/index.ts"],"names":[],"mappings":"AAAA,cAAc,oCAAoC,CAAC;AACnD,cAAc,mCAAmC,CAAC;AAClD,cAAc,+CAA+C,CAAC;AAE9D,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,sCAAsC,CAAC;AACrD,cAAc,kDAAkD,CAAC;AACjE,cAAc,wBAAwB,CAAC;AACvC,cAAc,oCAAoC,CAAC;AAEnD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,0BAA0B,CAAC;AAIzC,cAAc,0CAA0C,CAAC;AAGzD,cAAc,gBAAgB,CAAC;AAE/B,cAAc,uBAAuB,CAAC"}
@@ -2,12 +2,16 @@ export * from "./geometricExplicitFormulaUsage.js";
2
2
  export * from "./geometricFindExplicitFormula.js";
3
3
  export * from "./geometricFindExplicitFormulaFirstRankOne.js";
4
4
  export * from "./geometricFindReason.js";
5
- export * from "./geometricFirstTermsSum.js";
6
5
  export * from "./geometricReasonUsage.js";
7
6
  export * from "./geometricRecurrenceFormulaUsage.js";
8
7
  export * from "./geometricFindExplicitFormulaFirstTermRandom.js";
9
8
  export * from "./geometricFindTerm.js";
10
9
  export * from "./geometricFindTermFirstRankOne.js";
11
10
  export * from "./geometricRecognizeReasonFromFirstTerms.js";
12
- export * from "./geometricFirstTermsGeneralSum.js";
13
11
  export * from "./geometricVariations.js";
12
+ // export * from "./geometricFindExplicitFormulaFromTwoTerms.js";
13
+ // export * from "./geometricFindExplicitFormulaFromTwoConsecutiveTerms.js";
14
+ export * from "./geometricFindRandomTermFromTwoTerms.js";
15
+ // export * from "./geometricFindRandomTermFromTwoConsecutiveTerms.js";
16
+ export * from "./sum/index.js";
17
+ export * from "./situations/index.js";
@@ -1 +1 @@
1
- {"version":3,"file":"geometricFindExplicitFormulaFromSituation.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/sequences/geometric/situations/geometricFindExplicitFormulaFromSituation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAEL,sBAAsB,EACvB,MAAM,mDAAmD,CAAC;AAC3D,OAAO,EAEL,2BAA2B,EAC5B,MAAM,wDAAwD,CAAC;AAIhE,OAAO,EAEL,iCAAiC,EAElC,MAAM,iEAAiE,CAAC;AAiBzE,KAAK,WAAW,GAAG;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,iCAAiC,CAAC;CACrD,CAAC;AA8OF,KAAK,OAAO,GAAG,sBAAsB,GAAG,2BAA2B,CAAC;AAcpE,eAAO,MAAM,yCAAyC,EAAE,QAAQ,CAC9D,WAAW,EACX,OAAO,CAoBR,CAAC"}
1
+ {"version":3,"file":"geometricFindExplicitFormulaFromSituation.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/sequences/geometric/situations/geometricFindExplicitFormulaFromSituation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAEL,sBAAsB,EACvB,MAAM,mDAAmD,CAAC;AAC3D,OAAO,EAEL,2BAA2B,EAC5B,MAAM,wDAAwD,CAAC;AAIhE,OAAO,EAEL,iCAAiC,EAElC,MAAM,iEAAiE,CAAC;AAiBzE,KAAK,WAAW,GAAG;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,iCAAiC,CAAC;CACrD,CAAC;AAiPF,KAAK,OAAO,GAAG,sBAAsB,GAAG,2BAA2B,CAAC;AAcpE,eAAO,MAAM,yCAAyC,EAAE,QAAQ,CAC9D,WAAW,EACX,OAAO,CAoBR,CAAC"}