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,639 @@
1
+ import { GeneratorOptionTarget, GeneratorOptionType, } from "../../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { blueMain, greenMain, orange } from "../../../../geogebra/colors.js";
4
+ import { GeogebraConstructor } from "../../../../geogebra/geogebraConstructor.js";
5
+ import { ggbPointsToPoints } from "../../../../geogebra/parsers/ggbPointsToPoints.js";
6
+ import { Point, PointConstructor, } from "../../../../math/geometry/point.js";
7
+ import { createArrNodeCoeffCubic, PointOfFunction, } from "../../../../math/utils/polynomial/polynomialInterpolationUtils.js";
8
+ import { createIntegratedPolynomialNode, createNodeFPolynomialFromRoots, } from "../../../../math/utils/polynomial/polynomialUtils.js";
9
+ import { randfloat } from "../../../../math/utils/random/randfloat.js";
10
+ import { randint } from "../../../../math/utils/random/randint.js";
11
+ import { NodeConstructor, } from "../../../../tree/nodes/nodeConstructor.js";
12
+ import { add } from "../../../../tree/nodes/operators/addNode.js";
13
+ import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
14
+ import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
15
+ import { power } from "../../../../tree/nodes/operators/powerNode.js";
16
+ import { coinFlip } from "../../../../utils/alea/coinFlip.js";
17
+ import { random, randomMany } from "../../../../utils/alea/random.js";
18
+ import { zip } from "../../../../utils/arrays/arrayZip.js";
19
+ import { average } from "../../../../utils/average.js";
20
+ import { joinanded } from "../../../../utils/strings/joinanded.js";
21
+ //control segments allow controlling f(x_i) and f'(x_i)
22
+ //with 2 control segments, this is Hermite's cubic
23
+ function createNodeFCubic(arrNodesCoeff) {
24
+ const nodeVarX = "x".toTree();
25
+ const nodeCubic = arrNodesCoeff.reduce((acc, nodeCoeff, i) => {
26
+ return add(acc, multiply(nodeCoeff, power(nodeVarX, i)));
27
+ }, (0).toTree());
28
+ return nodeCubic;
29
+ }
30
+ function getXMinXMax(arrX, typeF) {
31
+ if (typeF === "degré $3$ monotone") {
32
+ const [x] = arrX;
33
+ return { xMin: x - 4, xMax: x + 4 };
34
+ }
35
+ else {
36
+ if (arrX.length === 0) {
37
+ return { xMin: -5, xMax: +5 };
38
+ }
39
+ else if (arrX.length === 1) {
40
+ const [x] = arrX;
41
+ return { xMin: x - 4, xMax: x + 4 };
42
+ }
43
+ else {
44
+ const xLeft = Math.min(...arrX);
45
+ const xRight = Math.max(...arrX);
46
+ return { xMin: xLeft - 3, xMax: xRight + 3 };
47
+ }
48
+ }
49
+ }
50
+ function getArrXControl(arrX, _typeF) {
51
+ if (arrX.length === 0) {
52
+ return [-3, 3];
53
+ }
54
+ else if (arrX.length === 1) {
55
+ const [x] = arrX;
56
+ return [x - 2, x + 2];
57
+ }
58
+ else if (arrX.length === 2) {
59
+ const [x1, x2] = arrX;
60
+ return [x1 - 1, x2 + 1];
61
+ }
62
+ else {
63
+ throw new Error("Unsupported arrX.length: " + arrX.length);
64
+ }
65
+ }
66
+ function getCoordsFrame(nodeF, xMin, xMax) {
67
+ const stepX = 0.05;
68
+ const arrX = [...Array(Math.floor((xMax - xMin) / stepX)).keys()].map((i) => xMin + i * stepX);
69
+ const yForXMin = nodeF.evaluate({ x: xMin });
70
+ const { yMin, yMax } = arrX.slice(1).reduce((acc, x) => {
71
+ const { yMin, yMax } = acc;
72
+ const y = nodeF.evaluate({ x });
73
+ if (y < yMin) {
74
+ acc.yMin = y;
75
+ }
76
+ else if (y > yMax) {
77
+ acc.yMax = y;
78
+ }
79
+ return acc;
80
+ }, { yMin: yForXMin, yMax: yForXMin });
81
+ return {
82
+ xMin,
83
+ xMax,
84
+ yMin,
85
+ yMax,
86
+ };
87
+ }
88
+ const createFStuff = (typeF) => {
89
+ //f'(x) = a(x-x1)...(x-xn)
90
+ //=> f'(x1) = ... = f'(xn) = 0
91
+ function createRandomArrX(nbX) {
92
+ const poolX = [...Array(11).keys()].map((i) => i - 5);
93
+ return randomMany(poolX, nbX).toSorted((v1, v2) => v1 - v2);
94
+ }
95
+ function createRandomNodeFFromDerivative(nodeDerivative) {
96
+ const nodeC = (randint(-6, 7) / 2.0).toTree();
97
+ return createIntegratedPolynomialNode(nodeDerivative, nodeC);
98
+ }
99
+ function createRandomNodeFFromZerosOfDerivative(arrX) {
100
+ const arrNodeX = arrX.map((x) => x.toTree());
101
+ const nodeDerivativeRaw = createNodeFPolynomialFromRoots((1).toTree(), arrNodeX);
102
+ const nodeFRaw = createRandomNodeFFromDerivative(nodeDerivativeRaw);
103
+ const maxAmplitude = Math.max(...arrX.map((x) => nodeFRaw.evaluate({ x })), 1);
104
+ const a = (((coinFlip() ? -1 : 1) * 1.0) / maxAmplitude) * randfloat(1, 3, 1);
105
+ return multiply(a, nodeFRaw);
106
+ }
107
+ const { arrX, nodeF } = (() => {
108
+ switch (typeF) {
109
+ case "constante": {
110
+ const arrX = [];
111
+ const arrNodeX = arrX.map((x) => x.toTree());
112
+ const nodeDerivative = createNodeFPolynomialFromRoots((0).toTree(), arrNodeX);
113
+ const nodeF = createRandomNodeFFromDerivative(nodeDerivative);
114
+ return { arrX, nodeF };
115
+ }
116
+ case "affine": {
117
+ const arrX = createRandomArrX(0);
118
+ const arrNodeX = arrX.map((x) => x.toTree());
119
+ const a = ((coinFlip() ? -1 : 1) * randint(1, 10)) / 2.0;
120
+ const nodeDerivative = createNodeFPolynomialFromRoots(a.toTree(), arrNodeX);
121
+ const nodeF = createRandomNodeFFromDerivative(nodeDerivative);
122
+ return { arrX, nodeF };
123
+ }
124
+ case "degré $2$": {
125
+ const arrX = createRandomArrX(1);
126
+ const nodeF = createRandomNodeFFromZerosOfDerivative(arrX);
127
+ return { arrX, nodeF };
128
+ }
129
+ case "degré $3$ monotone": {
130
+ const arrX = (() => {
131
+ const [x] = createRandomArrX(1);
132
+ return [x, x];
133
+ })();
134
+ const nodeF = createRandomNodeFFromZerosOfDerivative(arrX);
135
+ return { arrX, nodeF };
136
+ }
137
+ case "degré $3$ non-monotone": {
138
+ const arrX = createRandomArrX(2);
139
+ const nodeF = createRandomNodeFFromZerosOfDerivative(arrX);
140
+ return { arrX, nodeF };
141
+ }
142
+ default:
143
+ throw new Error("Unsupported typeF: " + typeF);
144
+ }
145
+ })();
146
+ return { arrX, nodeF };
147
+ };
148
+ const getInstruction = (identifiers) => {
149
+ const { pointIds } = identifiers;
150
+ return `Soit $f$ une fonction définie sur $\\mathbb{R}$.
151
+ Ci-dessous est tracée en bleu la courbe $\\mathcal C_{f'}$ de sa dérivée $f'$.
152
+
153
+ En manipulant les points ${joinanded(pointIds.map((pointIds) => `$${pointIds.name}$`), ", ", " et ")},
154
+ construire une courbe plausible pour $f$.`;
155
+ };
156
+ const getAnswerArr = (identifiers) => {
157
+ const { nodeIdsF, nodeIdsAbscissa, pointIds, typeF } = identifiers;
158
+ const nodeF = NodeConstructor.fromIdentifiers(nodeIdsF);
159
+ const nodeDerivative = nodeF.derivative();
160
+ const arrNodeX = nodeIdsAbscissa.map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds));
161
+ const arrX = arrNodeX.map((node) => node.evaluate());
162
+ const arrXControl = getArrXControl(arrX, typeF);
163
+ switch (typeF) {
164
+ case "constante":
165
+ case "affine":
166
+ case "degré $2$":
167
+ case "degré $3$ monotone": {
168
+ return zip(pointIds, arrXControl).map(([pointIds, x]) => {
169
+ const valueFunction = nodeF.evaluate({ x });
170
+ const valueDerivative = nodeDerivative.evaluate({ x });
171
+ return {
172
+ point: new Point(pointIds.name, x, valueFunction),
173
+ s: valueDerivative,
174
+ };
175
+ });
176
+ }
177
+ case "degré $3$ non-monotone": {
178
+ return zip(pointIds, arrX).map(([pointIds, x]) => {
179
+ const valueFunction = nodeF.evaluate({ x });
180
+ const valueDerivative = nodeDerivative.evaluate({ x });
181
+ return {
182
+ point: new Point(pointIds.name, x, valueFunction),
183
+ s: valueDerivative,
184
+ };
185
+ });
186
+ }
187
+ default:
188
+ throw new Error("Unsupported typeF: " + typeF);
189
+ }
190
+ };
191
+ const getGGBAnswer = (identifiers) => {
192
+ return getAnswerArr(identifiers).flatMap(({ point, s }) => [
193
+ //slopes
194
+ `s${point.name} = ${s}`,
195
+ //control points
196
+ ...point.toGGBCommand({
197
+ isFixed: true,
198
+ isSelectionnable: true,
199
+ showLabel: true,
200
+ style: 0,
201
+ size: 5,
202
+ }),
203
+ //slope
204
+ `t${point.name}(x) = Function(y(${point.name}) + (s${point.name})(x-x(${point.name})), x(${point.name}) - 2, x(${point.name}) + 2)`,
205
+ `SetColor(t${point.name}, "${orange}")`,
206
+ //point for slope control
207
+ `${point.name}2 = (s${point.name} * 0 + x(${point.name}) + 1, s${point.name} + y(${point.name}))`,
208
+ `SetPointStyle(${point.name}2, 0)`,
209
+ `SetPointSize(${point.name}2, 5)`,
210
+ ]);
211
+ };
212
+ const getHint = () => {
213
+ return `Aux abscisses où la fonction $f$ est croissante, sa dérivée $f'$ est positive.
214
+ Aux abscisses où la fonction $f$ est décroissante, sa dérivée $f'$ est négative.
215
+ Ailleurs, sa dérivée $f'$ est nulle.`;
216
+ };
217
+ const getCorrection = () => {
218
+ return `Dans un premier temps :
219
+ Soit $S$ l'ensemble des abscisses $x$ où la tangente à $C_f$ est horizontale.
220
+ Pour tout $x$ dans $S$, on a $f'(x)=0$.
221
+ Pour chaque $x$ dans $S$, on peut placer un point de contrôle aux coordonées $(x, 0)$.
222
+ Dans un second temps :
223
+ Aux abscisses où la fonction $f$ est croissante, sa dérivée $f'$ est positive.
224
+ Aux abscisses où la fonction $f$ est décroissante, sa dérivée $f'$ est négative.
225
+ On place donc les points de contrôle restants pour garantir cela.`;
226
+ };
227
+ const getCorrectionGGBOptions = (identifiers) => {
228
+ const { nodeIdsAbscissa, nodeIdsF, typeF } = identifiers;
229
+ const nodeF = NodeConstructor.fromIdentifiers(nodeIdsF);
230
+ const nodeDerivative = nodeF.derivative();
231
+ const arrNodeX = nodeIdsAbscissa.map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds));
232
+ const arrX = arrNodeX.map((node) => node.evaluate());
233
+ const commands = [
234
+ `f'(x) = ${nodeDerivative.toMathString()}`,
235
+ `SetColor(f', "${blueMain}")`,
236
+ `SetCaption(f', "$\\mathcal C_{f'}$")`,
237
+ `ShowLabel(f', true)`,
238
+ `f(x) = ${nodeF.toMathString()}`,
239
+ `SetColor(f, "${greenMain}")`,
240
+ `SetCaption(f, "$\\mathcal C_f$")`,
241
+ `ShowLabel(f, true)`,
242
+ ...getGGBAnswer(identifiers),
243
+ ];
244
+ const ggb = new GeogebraConstructor({
245
+ commands,
246
+ yAxis: {
247
+ hideNumbers: true,
248
+ },
249
+ });
250
+ const { xMin, xMax } = getXMinXMax(arrX, typeF);
251
+ const { yMin, yMax } = getCoordsFrame(nodeF, xMin, xMax);
252
+ return ggb.getOptions({
253
+ coords: ggb.getAdaptedCoords({
254
+ xMin,
255
+ xMax,
256
+ yMin: Math.min(yMin, -2),
257
+ yMax,
258
+ }),
259
+ });
260
+ };
261
+ const getStudentGGBOptions = (identifiers) => {
262
+ const { nodeIdsAbscissa, nodeIdsF, pointIds, typeF } = identifiers;
263
+ const nodeF = NodeConstructor.fromIdentifiers(nodeIdsF);
264
+ const arrPoint = pointIds.map((pointIds) => PointConstructor.fromIdentifiers(pointIds));
265
+ const arrNodeX = nodeIdsAbscissa.map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds));
266
+ const arrX = arrNodeX.map((node) => node.evaluate());
267
+ const pof1 = new PointOfFunction("x(A)".toTree(), "y(A)".toTree(), "sA".toTree());
268
+ const pof2 = new PointOfFunction("x(B)".toTree(), "y(B)".toTree(), "sB".toTree());
269
+ const arrNodeCoeff = createArrNodeCoeffCubic(pof1, pof2);
270
+ const nodeFCubic = createNodeFCubic(arrNodeCoeff);
271
+ const commands = [
272
+ `f'(x) = ${nodeF.derivative().toMathString()}`,
273
+ `SetColor(f', "${blueMain}")`,
274
+ `SetCaption(f', "$\\mathcal C_{f'}$")`,
275
+ `ShowLabel(f', true)`,
276
+ //sliders
277
+ //slopeA
278
+ `sA = Slider(-2, 2, 0.2)`,
279
+ `SetValue(sA, 1)`,
280
+ `SetVisibleInView(sA, 1, false)`,
281
+ //slopeB
282
+ `sB = Slider(-2, 2, 0.2)`,
283
+ `SetValue(sB, 1)`,
284
+ `SetVisibleInView(sB, 1, false)`,
285
+ //control points
286
+ ...arrPoint.flatMap((point) => [
287
+ ...point.toGGBCommand({
288
+ isFixed: false,
289
+ isSelectionnable: true,
290
+ showLabel: true,
291
+ style: 0,
292
+ size: 5,
293
+ }),
294
+ //slope
295
+ `t${point.name}(x) = Function(y(${point.name}) + (s${point.name})(x-x(${point.name})), x(${point.name}) - 2, x(${point.name}) + 2)`,
296
+ `SetColor(t${point.name}, "${orange}")`,
297
+ //point for slope control
298
+ `${point.name}2 = (s${point.name} * 0 + x(${point.name}) + 1, s${point.name} + y(${point.name}))`,
299
+ `SetPointStyle(${point.name}2, 0)`,
300
+ `SetPointSize(${point.name}2, 5)`,
301
+ ]),
302
+ //Polynomial
303
+ `pol = ${nodeFCubic.toMathString()}`,
304
+ ];
305
+ const studentGGB = new GeogebraConstructor({
306
+ commands,
307
+ yAxis: {
308
+ hideNumbers: true,
309
+ },
310
+ interactiveObjects: ["A", "B", "sA", "sB"],
311
+ customToolBar: "0",
312
+ });
313
+ const { xMin, xMax } = getXMinXMax(arrX, typeF);
314
+ const { yMin, yMax } = getCoordsFrame(nodeF, xMin, xMax);
315
+ return studentGGB.getOptions({
316
+ coords: studentGGB.getAdaptedCoords({
317
+ xMin,
318
+ xMax,
319
+ yMin: Math.min(yMin, -2),
320
+ yMax,
321
+ }),
322
+ });
323
+ };
324
+ const isGGBAnswerValid = (ggbAns, { ggbAnswer: _ggbAnswer, ...identifiers }) => {
325
+ const { pointIds, nodeIdsAbscissa } = identifiers;
326
+ const [pointADefault, pointBDefault] = pointIds.map((pointIds) => PointConstructor.fromIdentifiers(pointIds));
327
+ //handle cases like (["A=", s1="])
328
+ const ggbAnsRefined = ggbAns.map((strAns) => {
329
+ const [name, value] = strAns.split("=");
330
+ if (value === "") {
331
+ switch (name) {
332
+ case "A":
333
+ return `A=${pointADefault.toMathString()}`;
334
+ case "B":
335
+ return `B=${pointBDefault.toMathString()}`;
336
+ case "sA":
337
+ return `sA=1`;
338
+ case "sB":
339
+ return `sB=1`;
340
+ default:
341
+ throw new Error("Unsupported name: " + name);
342
+ }
343
+ }
344
+ else {
345
+ return strAns;
346
+ }
347
+ });
348
+ const { typeF } = identifiers;
349
+ //parse points
350
+ const [pointA, pointB] = ggbPointsToPoints(ggbAnsRefined);
351
+ //parse slopes
352
+ function parseSlope(nameSlope) {
353
+ const strSlope = ggbAnsRefined.find((str) => str.startsWith(nameSlope));
354
+ const [_name, v] = strSlope.split("=");
355
+ return Number.parseFloat(v);
356
+ }
357
+ const [sA, sB] = [parseSlope("sA"), parseSlope("sB")];
358
+ const [{ point: point1Ans, s: s1Ans }, { point: point2Ans, s: s2Ans }] = [
359
+ { point: pointA, s: sA },
360
+ { point: pointB, s: sB },
361
+ ].toSorted(({ point: point1 }, { point: point2 }) => point1.x.evaluate() - point2.x.evaluate());
362
+ const [{ point: point1Answer, s: s1Answer }, { point: point2Answer, s: s2Answer },] = getAnswerArr(identifiers).toSorted(({ point: point1 }, { point: point2 }) => point1.x.evaluate() - point2.x.evaluate());
363
+ switch (typeF) {
364
+ case "constante": {
365
+ return (s1Ans === 0 &&
366
+ s2Ans === 0 &&
367
+ point1Ans.y.evaluate() === point2Ans.y.evaluate());
368
+ }
369
+ case "affine": {
370
+ const den = point2Ans.x.evaluate() - point1Ans.x.evaluate();
371
+ if (den === 0) {
372
+ return false;
373
+ }
374
+ const s12 = (point2Ans.y.evaluate() - point1Ans.y.evaluate()) / den;
375
+ const isLine = () => s12 === s1Ans && s12 === s2Ans;
376
+ const isSlopeSignOk = () => s1Ans * s1Answer > 0;
377
+ return isSlopeSignOk() && isLine();
378
+ }
379
+ case "degré $2$": {
380
+ const [pof1, pof2] = [
381
+ new PointOfFunction(point1Ans.x, point1Ans.y, s1Ans.toTree()),
382
+ new PointOfFunction(point2Ans.x, point2Ans.y, s2Ans.toTree()),
383
+ ];
384
+ const nodeFAns = createNodeFCubic(createArrNodeCoeffCubic(pof1, pof2));
385
+ const arrNodeX = nodeIdsAbscissa.map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds));
386
+ const arrX = arrNodeX.map((node) => node.evaluate());
387
+ const [x] = arrX;
388
+ const isAlmostZeroAtX = () => Math.abs(nodeFAns.derivative().evaluate({ x })) < 0.1;
389
+ const isSlopeSignsOk = () => s1Ans * s1Answer >= 0 && s2Ans * s2Answer >= 0;
390
+ return isAlmostZeroAtX() && isSlopeSignsOk();
391
+ }
392
+ case "degré $3$ monotone": {
393
+ const [pof1, pof2] = [
394
+ new PointOfFunction(point1Ans.x, point1Ans.y, s1Ans.toTree()),
395
+ new PointOfFunction(point2Ans.x, point2Ans.y, s2Ans.toTree()),
396
+ ];
397
+ const nodeFAns = createNodeFCubic(createArrNodeCoeffCubic(pof1, pof2));
398
+ const nodeFAnsDerivative = nodeFAns.derivative();
399
+ const arrNodeX = nodeIdsAbscissa.map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds));
400
+ const arrX = arrNodeX.map((node) => node.evaluate());
401
+ const [x] = arrX;
402
+ const isAlmostFlatAtX = () => Math.abs(nodeFAnsDerivative.evaluate({ x })) < 0.1;
403
+ const isSlopeSignOk = () => s1Ans * s1Answer > 0;
404
+ return isAlmostFlatAtX() && isSlopeSignOk();
405
+ }
406
+ case "degré $3$ non-monotone": {
407
+ const isBothFlat = () => s1Ans === 0 && s2Ans === 0;
408
+ const isSameOffsetSign = () => {
409
+ const offsetAns = point2Ans.y.evaluate() - point1Ans.y.evaluate();
410
+ const offsetAnswer = point2Answer.y.evaluate() - point1Answer.y.evaluate();
411
+ return offsetAns * offsetAnswer > 0;
412
+ };
413
+ return isBothFlat() && isSameOffsetSign();
414
+ }
415
+ default:
416
+ throw new Error("Unsupported typeF: " + typeF);
417
+ }
418
+ };
419
+ const getPlausibleFunctionGraphFromDerivativeGraphByManipulatingPolynomialQuestion = (optsIn) => {
420
+ const arrayedOptions = optsIn ?? arrayedOptsDefault;
421
+ const typeF = random(arrayedOptions.typeF);
422
+ const [arrX, nodeF] = (() => {
423
+ let arrX;
424
+ let nodeF;
425
+ let isValid = false;
426
+ let counter = -1;
427
+ while (!isValid && counter < 100) {
428
+ counter++;
429
+ const { arrX: arrXCandidate, nodeF: nodeFCandidate } = createFStuff(typeF);
430
+ const isReadable = (arrX, nodeF) => {
431
+ const isInFrame = () => {
432
+ const { xMin, xMax } = getXMinXMax(arrX, typeF);
433
+ const { yMin, yMax } = getCoordsFrame(nodeF, xMin, xMax);
434
+ return frac(yMax - yMin, xMax - xMin).evaluate() <= 0.666;
435
+ };
436
+ const isCurveOk = () => {
437
+ switch (typeF) {
438
+ case "constante":
439
+ case "affine":
440
+ case "degré $3$ monotone":
441
+ return true;
442
+ default: {
443
+ const isWavyEnough = () => {
444
+ return zip(arrX.slice(0, -1), arrX.slice(1)).every(([x1, x2]) => {
445
+ const [y1, y2] = [x1, x2].map((x) => nodeF.evaluate({ x }));
446
+ return Math.abs(y2 - y1) >= 0.777;
447
+ });
448
+ };
449
+ const isWavyAlternate = () => {
450
+ const nodeDerivative = nodeF.derivative();
451
+ const arrXMid = zip(arrX.slice(0, -1), arrX.slice(1)).map(([x1, x2]) => average([x1, x2]));
452
+ const arrXNonZero = [
453
+ arrX[0] - 2,
454
+ ...arrXMid,
455
+ arrX[arrX.length - 1] + 2,
456
+ ];
457
+ return zip(arrXNonZero.slice(0, -1), arrXNonZero.slice(1)).every(([x1, x2]) => {
458
+ const [y1, y2] = [x1, x2].map((x) => nodeDerivative.evaluate({ x }));
459
+ return y1 * y2 < 0;
460
+ });
461
+ };
462
+ return isWavyAlternate() && isWavyEnough();
463
+ }
464
+ }
465
+ };
466
+ return isCurveOk() && isInFrame();
467
+ };
468
+ isValid = isReadable(arrXCandidate, nodeFCandidate);
469
+ if (isValid) {
470
+ arrX = arrXCandidate;
471
+ nodeF = nodeFCandidate;
472
+ }
473
+ }
474
+ if (!isValid) {
475
+ const nodeIdsFDefault = {
476
+ id: 3,
477
+ leftChild: {
478
+ id: 0,
479
+ leftChild: {
480
+ id: 2,
481
+ leftChild: {
482
+ id: 7,
483
+ value: -20,
484
+ },
485
+ rightChild: {
486
+ id: 5,
487
+ leftChild: {
488
+ id: 10,
489
+ name: "x",
490
+ },
491
+ rightChild: {
492
+ id: 7,
493
+ value: 3,
494
+ },
495
+ },
496
+ },
497
+ rightChild: {
498
+ id: 2,
499
+ leftChild: {
500
+ id: 7,
501
+ value: 30,
502
+ },
503
+ rightChild: {
504
+ id: 0,
505
+ leftChild: {
506
+ id: 0,
507
+ leftChild: {
508
+ id: 2,
509
+ leftChild: {
510
+ id: 7,
511
+ value: 3,
512
+ },
513
+ rightChild: {
514
+ id: 5,
515
+ leftChild: {
516
+ id: 10,
517
+ name: "x",
518
+ },
519
+ rightChild: {
520
+ id: 7,
521
+ value: 2,
522
+ },
523
+ },
524
+ },
525
+ rightChild: {
526
+ id: 2,
527
+ leftChild: {
528
+ id: 7,
529
+ value: 20,
530
+ },
531
+ rightChild: {
532
+ id: 10,
533
+ name: "x",
534
+ },
535
+ },
536
+ },
537
+ rightChild: {
538
+ id: 7,
539
+ value: -40,
540
+ },
541
+ },
542
+ },
543
+ },
544
+ rightChild: {
545
+ id: 7,
546
+ value: 600,
547
+ },
548
+ };
549
+ nodeF = NodeConstructor.fromIdentifiers(nodeIdsFDefault);
550
+ arrX = [-2, 5];
551
+ }
552
+ return [arrX, nodeF];
553
+ })();
554
+ const arrXControl = getArrXControl(arrX, typeF);
555
+ const { xMin, xMax } = getXMinXMax(arrX, typeF);
556
+ const { yMin, yMax } = getCoordsFrame(nodeF, xMin, xMax);
557
+ const pointCenter = new Point("O", average([xMin, xMax]), average([yMin, yMax]));
558
+ const pointNames = "ABCDEFGHIJKLMNO".split("");
559
+ const arrPoint = arrXControl.map((_, i) => {
560
+ const sector = i % 4;
561
+ const distance = 1 + Math.floor(i / 4);
562
+ const [factorX, factorY] = (() => {
563
+ switch (sector) {
564
+ case 0:
565
+ return [1, 1];
566
+ case 1:
567
+ return [-1, 1];
568
+ case 2:
569
+ return [-1, -1];
570
+ case 3:
571
+ return [1, -1];
572
+ default:
573
+ throw new Error("Unsupported sector: " + sector);
574
+ }
575
+ })();
576
+ const [x, y] = [factorX, factorY].map((factor) => factor * distance);
577
+ return new Point(pointNames[i], pointCenter.x.evaluate() + x, pointCenter.y.evaluate() + y);
578
+ });
579
+ const identifiers = {
580
+ nodeIdsF: nodeF.toIdentifiers(),
581
+ pointIds: arrPoint.map((point) => point.toIdentifiers()),
582
+ nodeIdsAbscissa: arrX.map((x) => x.toTree().toIdentifiers()),
583
+ typeF,
584
+ };
585
+ return getQuestionFromIdentifiers(identifiers);
586
+ };
587
+ const getQuestionFromIdentifiers = (identifiers, opts) => {
588
+ return {
589
+ ggbAnswer: getGGBAnswer(identifiers),
590
+ instruction: getInstruction(identifiers, opts),
591
+ studentGgbOptions: getStudentGGBOptions(identifiers),
592
+ answerFormat: "tex",
593
+ keys: [],
594
+ hint: getHint(identifiers, opts),
595
+ correction: getCorrection(identifiers, opts),
596
+ correctionGgbOptions: getCorrectionGGBOptions(identifiers, opts),
597
+ identifiers,
598
+ };
599
+ };
600
+ const arrayedOptsDefault = {
601
+ typeF: [
602
+ "constante",
603
+ "affine",
604
+ "degré $2$",
605
+ "degré $3$ monotone",
606
+ "degré $3$ non-monotone",
607
+ ],
608
+ };
609
+ const options = [
610
+ {
611
+ id: "typeF",
612
+ label: "Type de fonction $f$",
613
+ target: GeneratorOptionTarget.generation,
614
+ type: GeneratorOptionType.multiselect,
615
+ values: [
616
+ "constante",
617
+ "affine",
618
+ "degré $2$",
619
+ "degré $3$ monotone",
620
+ "degré $3$ non-monotone",
621
+ ],
622
+ defaultValue: arrayedOptsDefault.typeF,
623
+ },
624
+ ];
625
+ export const plausibleFunctionGraphFromDerivativeGraphByManipulatingPolynomial = {
626
+ id: "plausibleFunctionGraphFromDerivativeGraphByManipulatingPolynomial",
627
+ connector: "=",
628
+ label: "Construire une courbe plausible pour une fonction, à partir de la courbe de sa dérivée",
629
+ isSingleStep: false,
630
+ generator: (nb, opts) => getDistinctQuestions(() => getPlausibleFunctionGraphFromDerivativeGraphByManipulatingPolynomialQuestion(opts), nb),
631
+ options,
632
+ qcmTimer: 60,
633
+ freeTimer: 60,
634
+ isGGBAnswerValid,
635
+ subject: "Mathématiques",
636
+ getQuestionFromIdentifiers,
637
+ hasHintAndCorrection: true,
638
+ answerType: "GGB",
639
+ };
@@ -165,10 +165,10 @@ export const readExtremaAbscissFromDerivativeCurve = {
165
165
  subject: "Mathématiques",
166
166
  getHint,
167
167
  getCorrection,
168
+ hasHintAndCorrection: true,
168
169
  getInstruction,
169
170
  getAnswer,
170
171
  getGGBOptions,
171
172
  hasGeogebra: true,
172
173
  getQuestionFromIdentifiers,
173
- hasHintAndCorrection: true,
174
174
  };
@@ -0,0 +1,14 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ import { NodeIdentifiers } from "../../../../tree/nodes/nodeConstructor.js";
3
+ type Identifiers = {
4
+ nodeIdsF: NodeIdentifiers;
5
+ typeF: string;
6
+ typeRoots: string;
7
+ };
8
+ type Options = {
9
+ typeF: string;
10
+ typeRoots: string;
11
+ };
12
+ export declare const signVarTableFromFunctionExpression: Exercise<Identifiers, Options>;
13
+ export {};
14
+ //# sourceMappingURL=signVarTableFromFunctionExpression.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signVarTableFromFunctionExpression.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/variations/signVarTableFromFunctionExpression.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAYrC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAgM7C,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,eAAe,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAmXF,KAAK,OAAO,GAAG;IACb,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAyCF,eAAO,MAAM,kCAAkC,EAAE,QAAQ,CACvD,WAAW,EACX,OAAO,CAuBR,CAAC"}