math-exercises 3.0.178 → 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 (173) 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/signVarTableFromFunctionExpression.d.ts +14 -0
  78. package/lib/exercises/math/derivation/variations/signVarTableFromFunctionExpression.d.ts.map +1 -0
  79. package/lib/exercises/math/derivation/variations/signVarTableFromFunctionExpression.js +530 -0
  80. package/lib/exercises/math/derivation/variations/signVarTableProductFExp.d.ts +10 -0
  81. package/lib/exercises/math/derivation/variations/signVarTableProductFExp.d.ts.map +1 -0
  82. package/lib/exercises/math/derivation/variations/signVarTableProductFExp.js +451 -0
  83. package/lib/exercises/math/derivation/variations/signVarTableQuotientFExp.d.ts +11 -0
  84. package/lib/exercises/math/derivation/variations/signVarTableQuotientFExp.d.ts.map +1 -0
  85. package/lib/exercises/math/derivation/variations/signVarTableQuotientFExp.js +514 -0
  86. package/lib/exercises/math/functions/composition/index.d.ts +0 -1
  87. package/lib/exercises/math/functions/composition/index.d.ts.map +1 -1
  88. package/lib/exercises/math/functions/composition/index.js +1 -1
  89. package/lib/exercises/math/functions/exponential/algebraic/index.d.ts +0 -1
  90. package/lib/exercises/math/functions/exponential/algebraic/index.d.ts.map +1 -1
  91. package/lib/exercises/math/functions/exponential/algebraic/index.js +1 -1
  92. package/lib/exercises/math/functions/trinoms/sign/signOfProductOfAffineAndTrinom.d.ts.map +1 -1
  93. package/lib/exercises/math/functions/trinoms/sign/signOfProductOfAffineAndTrinom.js +4 -11
  94. package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductOrthoInSquare.d.ts.map +1 -1
  95. package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductOrthoInSquare.js +32 -17
  96. package/lib/exercises/math/probaStat/conditional/conditionalProbaFromTableWithContext.d.ts +13 -0
  97. package/lib/exercises/math/probaStat/conditional/conditionalProbaFromTableWithContext.d.ts.map +1 -0
  98. package/lib/exercises/math/probaStat/conditional/conditionalProbaFromTableWithContext.js +195 -0
  99. package/lib/exercises/math/probaStat/conditional/conditionalProbaWriteFromFrench.d.ts +9 -0
  100. package/lib/exercises/math/probaStat/conditional/conditionalProbaWriteFromFrench.d.ts.map +1 -0
  101. package/lib/exercises/math/probaStat/conditional/conditionalProbaWriteFromFrench.js +220 -0
  102. package/lib/exercises/math/probaStat/conditional/conditionalProbability.d.ts +15 -0
  103. package/lib/exercises/math/probaStat/conditional/conditionalProbability.d.ts.map +1 -0
  104. package/lib/exercises/math/probaStat/conditional/conditionalProbability.js +332 -0
  105. package/lib/exercises/math/probaStat/conditional/fillTableConditionalProbabilitySituation.d.ts +8 -0
  106. package/lib/exercises/math/probaStat/conditional/fillTableConditionalProbabilitySituation.d.ts.map +1 -0
  107. package/lib/exercises/math/probaStat/conditional/fillTableConditionalProbabilitySituation.js +222 -0
  108. package/lib/exercises/math/probaStat/conditional/index.d.ts +5 -0
  109. package/lib/exercises/math/probaStat/conditional/index.d.ts.map +1 -0
  110. package/lib/exercises/math/probaStat/conditional/index.js +4 -0
  111. package/lib/exercises/math/probaStat/index.d.ts +1 -2
  112. package/lib/exercises/math/probaStat/index.d.ts.map +1 -1
  113. package/lib/exercises/math/probaStat/index.js +1 -2
  114. package/lib/exercises/math/probaStat/probaFromTableWithContext.d.ts +1 -0
  115. package/lib/exercises/math/probaStat/probaFromTableWithContext.d.ts.map +1 -1
  116. package/lib/exercises/math/probaStat/probaFromTableWithContext.js +26 -199
  117. package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationProbabilityLaw.d.ts.map +1 -1
  118. package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationProbabilityLaw.js +6 -2
  119. package/lib/exercises/math/probaStat/randomVariable/utils/randomVariableSituations.d.ts.map +1 -1
  120. package/lib/exercises/math/probaStat/randomVariable/utils/randomVariableSituations.js +6 -5
  121. package/lib/exercises/math/probaStat/trees/buildTreeFromSituation.d.ts.map +1 -1
  122. package/lib/exercises/math/probaStat/trees/buildTreeFromSituation.js +4 -27
  123. package/lib/exercises/math/probaStat/twoEventsSituations.d.ts +29 -0
  124. package/lib/exercises/math/probaStat/twoEventsSituations.d.ts.map +1 -0
  125. package/lib/exercises/math/probaStat/twoEventsSituations.js +145 -0
  126. package/lib/exercises/math/sequences/explicitFormulaUsage.d.ts +4 -1
  127. package/lib/exercises/math/sequences/explicitFormulaUsage.d.ts.map +1 -1
  128. package/lib/exercises/math/sequences/explicitFormulaUsage.js +47 -7
  129. package/lib/exercises/math/sequences/geometric/geometricFindRandomTermFromTwoTerms.js +1 -1
  130. package/lib/exercises/math/sequences/geometric/index.d.ts +0 -3
  131. package/lib/exercises/math/sequences/geometric/index.d.ts.map +1 -1
  132. package/lib/exercises/math/sequences/geometric/index.js +3 -3
  133. package/lib/exercises/math/sequences/geometric/situations/index.d.ts +0 -1
  134. package/lib/exercises/math/sequences/geometric/situations/index.d.ts.map +1 -1
  135. package/lib/exercises/math/sequences/geometric/situations/index.js +1 -1
  136. package/lib/exercises/math/sequences/recurrenceFormulaUsage.d.ts +5 -1
  137. package/lib/exercises/math/sequences/recurrenceFormulaUsage.d.ts.map +1 -1
  138. package/lib/exercises/math/sequences/recurrenceFormulaUsage.js +89 -9
  139. package/lib/exercises/math/trigonometry/circle/associatePoint.d.ts.map +1 -1
  140. package/lib/exercises/math/trigonometry/circle/associatePoint.js +55 -6
  141. package/lib/exercises/math/trigonometry/circle/selectQuadrantOnTrigoCircle.d.ts.map +1 -1
  142. package/lib/exercises/math/trigonometry/circle/selectQuadrantOnTrigoCircle.js +5 -6
  143. package/lib/exercises/math/trigonometry/functions/associateAngleSimplification.d.ts.map +1 -1
  144. package/lib/exercises/math/trigonometry/functions/associateAngleSimplification.js +1 -3
  145. package/lib/exercises/vea/polynomialVEA.d.ts +2 -0
  146. package/lib/exercises/vea/polynomialVEA.d.ts.map +1 -0
  147. package/lib/exercises/vea/polynomialVEA.js +17 -0
  148. package/lib/exercises/vea/valueTableVEA.d.ts +8 -0
  149. package/lib/exercises/vea/valueTableVEA.d.ts.map +1 -0
  150. package/lib/exercises/vea/valueTableVEA.js +12 -0
  151. package/lib/index.d.ts +27 -47
  152. package/lib/index.d.ts.map +1 -1
  153. package/lib/latexTester.d.ts.map +1 -1
  154. package/lib/latexTester.js +1 -1
  155. package/lib/math/utils/polynomial/polynomialInterpolationUtils.d.ts +19 -0
  156. package/lib/math/utils/polynomial/polynomialInterpolationUtils.d.ts.map +1 -0
  157. package/lib/math/utils/polynomial/polynomialInterpolationUtils.js +53 -0
  158. package/lib/math/utils/polynomial/polynomialUtils.d.ts +37 -0
  159. package/lib/math/utils/polynomial/polynomialUtils.d.ts.map +1 -0
  160. package/lib/math/utils/polynomial/polynomialUtils.js +223 -0
  161. package/lib/math/utils/sequences/situations/seqArithmeticSituations.d.ts.map +1 -1
  162. package/lib/math/utils/sequences/situations/seqArithmeticSituations.js +6 -6
  163. package/lib/tree/nodes/operators/multiplyNode.d.ts.map +1 -1
  164. package/lib/tree/nodes/operators/multiplyNode.js +1 -1
  165. package/lib/tree/nodes/operators/substractNode.d.ts.map +1 -1
  166. package/lib/tree/nodes/operators/substractNode.js +2 -1
  167. package/lib/tree/utilities/nodeUtils.d.ts +6 -0
  168. package/lib/tree/utilities/nodeUtils.d.ts.map +1 -0
  169. package/lib/tree/utilities/nodeUtils.js +24 -0
  170. package/lib/utils/strings/prependArticle.d.ts +2 -0
  171. package/lib/utils/strings/prependArticle.d.ts.map +1 -0
  172. package/lib/utils/strings/prependArticle.js +1 -0
  173. package/package.json +1 -1
@@ -0,0 +1,499 @@
1
+ import { addValidProp, propWhile, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { SetVEA } from "../../../../exercises/vea/setVEA.js";
4
+ import { blueMain, greenMain, orange, red } from "../../../../geogebra/colors.js";
5
+ import { GeogebraConstructor } from "../../../../geogebra/geogebraConstructor.js";
6
+ import { nodeBySubstitutingVar } from "../../../../math/utils/functions/functionComposition.js";
7
+ import { createIntegratedPolynomialNode, createNodeFPolynomialFromRoots, getArrNodeCoeffOfPolynomialNode, } from "../../../../math/utils/polynomial/polynomialUtils.js";
8
+ import { randfloat } from "../../../../math/utils/random/randfloat.js";
9
+ import { randint } from "../../../../math/utils/random/randint.js";
10
+ import { NodeConstructor, } from "../../../../tree/nodes/nodeConstructor.js";
11
+ import { add } from "../../../../tree/nodes/operators/addNode.js";
12
+ import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
13
+ import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
14
+ import { substract } from "../../../../tree/nodes/operators/substractNode.js";
15
+ import { DiscreteSetNode } from "../../../../tree/nodes/sets/discreteSetNode.js";
16
+ import { discreteSetParser } from "../../../../tree/parsers/discreteSetParser.js";
17
+ import { coinFlip } from "../../../../utils/alea/coinFlip.js";
18
+ import { randomMany } from "../../../../utils/alea/random.js";
19
+ import { shuffle } from "../../../../utils/alea/shuffle.js";
20
+ import { zip } from "../../../../utils/arrays/arrayZip.js";
21
+ import { alignTex } from "../../../../utils/latex/alignTex.js";
22
+ function getCoordsFrame(nodeF, xMin, xMax) {
23
+ const stepX = 0.05;
24
+ const arrX = [...Array(Math.floor((xMax - xMin) / stepX)).keys()].map((i) => xMin + i * stepX);
25
+ const yForXMin = nodeF.evaluate({ x: xMin });
26
+ const { yMin, yMax } = arrX.slice(1).reduce((acc, x) => {
27
+ const { yMin, yMax } = acc;
28
+ const y = nodeF.evaluate({ x });
29
+ if (y < yMin) {
30
+ acc.yMin = y;
31
+ }
32
+ else if (y > yMax) {
33
+ acc.yMax = y;
34
+ }
35
+ return acc;
36
+ }, { yMin: yForXMin, yMax: yForXMin });
37
+ return {
38
+ xMin,
39
+ xMax,
40
+ yMin,
41
+ yMax,
42
+ };
43
+ }
44
+ function getNodeYIntercept(nodeF, nodeXAsked, nodeDerivative = nodeF.derivative()) {
45
+ const nodeValueImage = nodeBySubstitutingVar(nodeF, nodeXAsked, "x".toTree()).simplify();
46
+ const nodeValueDerivative = nodeBySubstitutingVar(nodeDerivative, nodeXAsked, "x".toTree()).simplify();
47
+ const nodeX = "x".toTree();
48
+ const nodeT = add(multiply(nodeValueDerivative, substract(nodeX, nodeXAsked)), nodeValueImage);
49
+ const [nodeYIntercept] = getArrNodeCoeffOfPolynomialNode(nodeT);
50
+ return nodeYIntercept;
51
+ }
52
+ const getInstruction = (identifiers) => {
53
+ const { nodeIdsSlope } = identifiers;
54
+ const nodeSlope = NodeConstructor.fromIdentifiers(nodeIdsSlope);
55
+ return `Ci-dessous est tracée la courbe $\\mathcal C_f$ de la fonction $f$.
56
+
57
+ En manipulant le point $A$ et le point $B$
58
+ on peut changer l'ordonnée à l'origine et la pente de la droite $(AB)$.
59
+
60
+ Résoudre l'équation $f'(x) = ${nodeSlope.toTex()}$ sur l'intervalle visible.`;
61
+ };
62
+ const getAnswerNode = (identifiers) => {
63
+ const { nodeIdsAbscissa } = identifiers;
64
+ const arrNodeX = nodeIdsAbscissa.map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds));
65
+ const nodeSet = new DiscreteSetNode(arrNodeX);
66
+ return nodeSet;
67
+ };
68
+ const getAnswer = (identifiers) => {
69
+ return `S=${getAnswerNode(identifiers).toTex()}`;
70
+ };
71
+ const getHint = (identifiers) => {
72
+ const { nodeIdsSlope } = identifiers;
73
+ const nodeSlope = NodeConstructor.fromIdentifiers(nodeIdsSlope);
74
+ return `Le nombre dérivé de $f$ en $x$, aussi noté $f'(x)$, est le coefficient directeur la tangente à la courbe représentative de $f$ au point d'abscisse $x$.
75
+
76
+ Résoudre l'équation $f'(x) = k$,
77
+ c'est trouver toutes les abscisses $x$
78
+ pour lesquelles le coefficient directeur la tangente à la courbe représentative de $f$ vaut $k$.
79
+
80
+ Ici, on a $k = ${nodeSlope.toTex()}$.
81
+
82
+ La première étape consiste à faire en sorte que la pente de la droite $(AB)$ soit égale à $${nodeSlope.toTex()}$ :
83
+ monte ou descend le point $B$ jusqu'à ce que la valeur de la pente affichée corresponde à $${nodeSlope.toTex()}$.
84
+ `;
85
+ };
86
+ const getCorrection = (identifiers) => {
87
+ const { nodeIdsAbscissa, nodeIdsSlope } = identifiers;
88
+ const arrNodeX = nodeIdsAbscissa.map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds));
89
+ const nodeSlope = NodeConstructor.fromIdentifiers(nodeIdsSlope);
90
+ return `Le nombre dérivé de $f$ en $x$, aussi noté $f'(x)$, est le coefficient directeur la tangente à la courbe représentative de $f$ au point d'abscisse $x$.
91
+
92
+ La première étape consiste à faire en sorte que la pente de la droite $(AB)$ soit égale à $${nodeSlope.toTex()}$ :
93
+ on monte ou descend le point $B$ jusqu'à ce que la valeur de la pente affichée corresponde à $${nodeSlope.toTex()}$.
94
+
95
+ En manipulant le point $A$, on observe que :
96
+
97
+ ${alignTex(arrNodeX.map((nodeX) => {
98
+ return [`f'(${nodeX.toTex()})`, "=", `${nodeSlope.toTex()}`];
99
+ }))}
100
+
101
+ La solution de l'équation est donc :
102
+
103
+ $$
104
+ ${getAnswer(identifiers)}
105
+ $$`;
106
+ };
107
+ const getCorrectionGGBOptions = (identifiers) => {
108
+ const { nodeIdsAbscissa, nodeIdsSlope, nodeIdsF } = identifiers;
109
+ const arrNodeX = nodeIdsAbscissa.map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds));
110
+ const [nodeSlope, nodeF] = [nodeIdsSlope, nodeIdsF].map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds));
111
+ const slope = nodeSlope.evaluate();
112
+ const arrX = arrNodeX.map((node) => node.evaluate());
113
+ const commands = [
114
+ `f(x) = ${nodeF.toMathString()}`,
115
+ `SetColor(f, "${blueMain}")`,
116
+ `SetCaption(f, "$\\mathcal C_f$")`,
117
+ `ShowLabel(f, true)`,
118
+ //solution
119
+ ...arrX.flatMap((x, i) => {
120
+ const image = nodeF.evaluate({
121
+ x,
122
+ });
123
+ return [
124
+ //tangent
125
+ `t${i}(x) = ${image} + (x-${x}) (${slope})`,
126
+ `SetColor(t${i}, "${orange}")`,
127
+ //curve point
128
+ `B${i} = (${x},${image})`,
129
+ `SetPointStyle(B${i}, 1)`,
130
+ //arrow
131
+ `v${i} = Vector(B${i}, Point({${x},0}))`,
132
+ `SetColor(v${i}, "${greenMain}")`,
133
+ //point
134
+ `C${i} = (${x},0)`,
135
+ `SetPointStyle(C${i}, 1)`,
136
+ `SetColor(C${i}, "${greenMain}")`,
137
+ `SetCaption(C${i}, "$${x.frenchify()}$")`,
138
+ `ShowLabel(C${i}, true)`,
139
+ ];
140
+ }),
141
+ ];
142
+ const xMin = Math.min(...arrX) - 2;
143
+ const xMax = Math.max(...arrX) + 2;
144
+ const { yMin, yMax } = getCoordsFrame(nodeF, xMin, xMax);
145
+ const ggb = new GeogebraConstructor({
146
+ commands,
147
+ });
148
+ return ggb.getOptions({
149
+ coords: ggb.getAdaptedCoords({
150
+ xMin,
151
+ xMax,
152
+ yMin: Math.min(yMin, -2),
153
+ yMax,
154
+ }),
155
+ });
156
+ };
157
+ const getGGBOptions = (identifiers) => {
158
+ const { nodeIdsAbscissa, nodeIdsSlope, nodeIdsF } = identifiers;
159
+ const arrNodeX = nodeIdsAbscissa.map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds));
160
+ const [nodeSlope, nodeF] = [nodeIdsSlope, nodeIdsF].map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds));
161
+ const arrX = arrNodeX.map((node) => node.evaluate());
162
+ const nodeDerivative = nodeF.derivative();
163
+ const arrNodeYIntercept = arrNodeX.map((nodeXAsked) => getNodeYIntercept(nodeF, nodeXAsked, nodeDerivative));
164
+ const xMin = Math.min(...arrX) - 2;
165
+ const xMax = Math.max(...arrX) + 2;
166
+ const { yMin, yMax } = getCoordsFrame(nodeF, xMin, xMax);
167
+ const [minSliderA, maxSliderA] = [-50, 50];
168
+ const stepSliderA = 0.01;
169
+ const valueSliderAInitial = randfloat(yMin, yMax, 1, [
170
+ ...arrNodeYIntercept.map((nodeY) => nodeY.evaluate()),
171
+ ]);
172
+ const [minSliderB, maxSliderB] = [-50, 50];
173
+ const stepSliderB = 0.1;
174
+ const valueSliderBInitial = randfloat(yMin, yMax, 1, [nodeSlope.evaluate()]);
175
+ const commands = [
176
+ `f(x) = ${nodeF.toMathString()}`,
177
+ `SetColor(f, "${blueMain}")`,
178
+ `SetCaption(f, "$\\mathcal C_f$")`,
179
+ `ShowLabel(f, true)`,
180
+ `SetColor(f, "${blueMain}")`,
181
+ //moving point A
182
+ `a = Slider(${minSliderA}, ${maxSliderA}, ${stepSliderA})`,
183
+ `SetValue(a, ${valueSliderAInitial})`,
184
+ `SetVisibleInView(a, 1, false)`,
185
+ `A = (0,a)`,
186
+ "SetPointStyle(A, 0)",
187
+ "SetPointSize(A,5)",
188
+ `ShowLabel(A,true)`,
189
+ //moving point B
190
+ `b = Slider(${minSliderB}, ${maxSliderB}, ${stepSliderB})`,
191
+ `SetValue(b, ${valueSliderBInitial})`,
192
+ `SetVisibleInView(b, 1, false)`,
193
+ `B = (1,b+a)`, //order matters here: in ggb, the slider which is first found is the one that is modified when moving point
194
+ "SetPointStyle(B, 0)",
195
+ "SetPointSize(B,5)",
196
+ `ShowLabel(B,true)`,
197
+ //"tangent"
198
+ `lineAB = Line(A,B)`,
199
+ `SetColor(lineAB, "${red}")`,
200
+ `s = Slope(lineAB)`,
201
+ ];
202
+ const ggb = new GeogebraConstructor({
203
+ commands,
204
+ });
205
+ return ggb.getOptions({
206
+ coords: ggb.getAdaptedCoords({
207
+ xMin,
208
+ xMax,
209
+ yMin: Math.min(yMin, -2),
210
+ yMax,
211
+ }),
212
+ });
213
+ };
214
+ const getPropositions = (n, { answer, ..._identifiers }) => {
215
+ const propositions = [];
216
+ addValidProp(propositions, answer);
217
+ propWhile(propositions, n, () => {
218
+ const identifiersWrong = createRandomIdentifiers();
219
+ tryToAddWrongProp(propositions, getAnswer(identifiersWrong));
220
+ });
221
+ return shuffle(propositions);
222
+ };
223
+ const isAnswerValid = (ans, { answer, ...identifiers }, _optsIn) => {
224
+ const answerNode = getAnswerNode(identifiers);
225
+ const arrNodeAnswer = answerNode.elements;
226
+ const parsed = discreteSetParser(ans);
227
+ if (!parsed) {
228
+ return false;
229
+ }
230
+ const arrAns = parsed.elements;
231
+ return SetVEA.isArrayOfNodesValid(arrAns, arrNodeAnswer);
232
+ };
233
+ const createRandomIdentifiers = () => {
234
+ const nbX = randint(2, 4);
235
+ const arrX = (() => {
236
+ function createRandomArrX() {
237
+ const poolX = [...Array(11).keys()].map((i) => i - 5);
238
+ return randomMany(poolX, nbX).toSorted((v1, v2) => v1 - v2);
239
+ }
240
+ let arrX = [];
241
+ let isValid = false;
242
+ let counter = -1;
243
+ while (!isValid && counter < 100) {
244
+ counter++;
245
+ const arrXCandidate = createRandomArrX();
246
+ const isSeparatedNicely = () => zip(arrXCandidate.slice(0, -1), arrXCandidate.slice(1))
247
+ .map(([x1, x2]) => x2 - x1)
248
+ .find((elt) => elt === 1) === undefined;
249
+ isValid = isSeparatedNicely();
250
+ if (isValid) {
251
+ arrX = arrXCandidate;
252
+ }
253
+ }
254
+ if (!isValid) {
255
+ switch (nbX) {
256
+ case 0:
257
+ return [-3];
258
+ case 1:
259
+ return [-2, 3];
260
+ case 2:
261
+ return [-4, 2, 5];
262
+ }
263
+ }
264
+ return arrX;
265
+ })();
266
+ const arrNodeX = arrX.map((x) => x.toTree());
267
+ //f'(x) = a(x-x1)...(x-xn) + k
268
+ //=> f'(x1) = ... = f'(xn) = k
269
+ const nodeA = frac(coinFlip() ? -1 : +1, 5 * nbX);
270
+ const maxSlopeAbs = 1.5;
271
+ const nodeK = randfloat(-maxSlopeAbs, maxSlopeAbs, 1, [0]).toTree();
272
+ const nodeDerivative = add(createNodeFPolynomialFromRoots(nodeA, arrNodeX), nodeK);
273
+ const nodeC = randint(-3, 3).toTree();
274
+ const nodeF = createIntegratedPolynomialNode(nodeDerivative, nodeC);
275
+ const identifiers = {
276
+ nodeIdsSlope: nodeK.toIdentifiers(),
277
+ nodeIdsF: nodeF.toIdentifiers(),
278
+ nodeIdsAbscissa: arrNodeX.map((node) => node.toIdentifiers()),
279
+ };
280
+ return identifiers;
281
+ };
282
+ const getDerivativeEquationSolvingByManipulatingLineYAndSlopeQuestion = (opts) => {
283
+ let identifiers;
284
+ let isValid = false;
285
+ let counter = -1;
286
+ while (!isValid && counter < 100) {
287
+ counter++;
288
+ const identifiersCandidate = createRandomIdentifiers();
289
+ const isReadable = (identifiers) => {
290
+ const { nodeIdsAbscissa, nodeIdsF } = identifiers;
291
+ const arrNodeX = nodeIdsAbscissa.map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds));
292
+ const nodeF = NodeConstructor.fromIdentifiers(nodeIdsF);
293
+ const arrX = arrNodeX.map((node) => node.evaluate());
294
+ const xMin = Math.min(...arrX) - 2;
295
+ const xMax = Math.max(...arrX) + 2;
296
+ const { yMin, yMax } = getCoordsFrame(nodeF, xMin, xMax);
297
+ return frac(yMax - yMin, xMax - xMin).evaluate() <= 0.888;
298
+ };
299
+ const isDerivativeOk = (identifiers) => {
300
+ const { nodeIdsAbscissa, nodeIdsSlope, nodeIdsF } = identifiers;
301
+ const arrNodeX = nodeIdsAbscissa.map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds));
302
+ const [nodeSlope, nodeF] = [nodeIdsSlope, nodeIdsF].map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds));
303
+ const nodeDerivative = nodeF.derivative().simplify();
304
+ return arrNodeX.every((nodeX) => nodeDerivative.evaluate({ x: nodeX.evaluate() }) ===
305
+ nodeSlope.evaluate());
306
+ };
307
+ const isYInterceptsOk = (identifiers) => {
308
+ const { nodeIdsAbscissa, nodeIdsSlope, nodeIdsF } = identifiers;
309
+ const arrNodeX = nodeIdsAbscissa.map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds));
310
+ const [nodeSlope, nodeF] = [nodeIdsSlope, nodeIdsF].map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds));
311
+ const slope = nodeSlope.evaluate();
312
+ const nodeDerivative = nodeF.derivative().simplify();
313
+ const arrNodeYIntercept = arrNodeX.map((nodeX) => getNodeYIntercept(nodeF, nodeX, nodeDerivative));
314
+ const arrYInterceptSorted = arrNodeYIntercept
315
+ .map((node) => node.evaluate())
316
+ .toSorted((y1, y2) => y1 - y2);
317
+ const isReachableYIntercepts = () => {
318
+ const arrX = arrNodeX.map((node) => node.evaluate());
319
+ const xMin = Math.min(...arrX) - 1;
320
+ const xMax = Math.max(...arrX) + 1;
321
+ const { yMin, yMax } = getCoordsFrame(nodeF, xMin, xMax);
322
+ return arrYInterceptSorted.every((yIntercept) => yMin < yIntercept && yIntercept < yMax);
323
+ };
324
+ const isDistinctYIntercepts = () => {
325
+ return zip(arrYInterceptSorted.slice(0, -1), arrYInterceptSorted.slice(1)).every(([y1, y2]) => y2 - y1 > 0.666 * Math.abs(slope));
326
+ };
327
+ return isReachableYIntercepts() && isDistinctYIntercepts();
328
+ };
329
+ isValid =
330
+ isReadable(identifiersCandidate) &&
331
+ isDerivativeOk(identifiersCandidate) &&
332
+ isYInterceptsOk(identifiersCandidate);
333
+ if (isValid) {
334
+ identifiers = identifiersCandidate;
335
+ }
336
+ }
337
+ if (!isValid) {
338
+ //copié-collé depuis le dashboard::viewer
339
+ const identifiersDefault = {
340
+ nodeIdsSlope: {
341
+ id: 7,
342
+ value: -0.2,
343
+ },
344
+ nodeIdsF: {
345
+ id: 3,
346
+ leftChild: {
347
+ id: 0,
348
+ leftChild: {
349
+ id: 2,
350
+ leftChild: {
351
+ id: 7,
352
+ value: 2025,
353
+ },
354
+ rightChild: {
355
+ id: 5,
356
+ leftChild: {
357
+ id: 10,
358
+ name: "x",
359
+ },
360
+ rightChild: {
361
+ id: 7,
362
+ value: 4,
363
+ },
364
+ },
365
+ },
366
+ rightChild: {
367
+ id: 2,
368
+ leftChild: {
369
+ id: 7,
370
+ value: 60,
371
+ },
372
+ rightChild: {
373
+ id: 0,
374
+ leftChild: {
375
+ id: 2,
376
+ leftChild: {
377
+ id: 7,
378
+ value: -225,
379
+ },
380
+ rightChild: {
381
+ id: 5,
382
+ leftChild: {
383
+ id: 10,
384
+ name: "x",
385
+ },
386
+ rightChild: {
387
+ id: 7,
388
+ value: 3,
389
+ },
390
+ },
391
+ },
392
+ rightChild: {
393
+ id: 2,
394
+ leftChild: {
395
+ id: 7,
396
+ value: 9,
397
+ },
398
+ rightChild: {
399
+ id: 0,
400
+ leftChild: {
401
+ id: 2,
402
+ leftChild: {
403
+ id: 7,
404
+ value: -30,
405
+ },
406
+ rightChild: {
407
+ id: 5,
408
+ leftChild: {
409
+ id: 10,
410
+ name: "x",
411
+ },
412
+ rightChild: {
413
+ id: 7,
414
+ value: 2,
415
+ },
416
+ },
417
+ },
418
+ rightChild: {
419
+ id: 2,
420
+ leftChild: {
421
+ id: 7,
422
+ value: 15,
423
+ },
424
+ rightChild: {
425
+ id: 0,
426
+ leftChild: {
427
+ id: 2,
428
+ leftChild: {
429
+ id: 7,
430
+ value: 17,
431
+ },
432
+ rightChild: {
433
+ id: 10,
434
+ name: "x",
435
+ },
436
+ },
437
+ rightChild: {
438
+ id: 7,
439
+ value: -30,
440
+ },
441
+ },
442
+ },
443
+ },
444
+ },
445
+ },
446
+ },
447
+ },
448
+ rightChild: {
449
+ id: 7,
450
+ value: 121500,
451
+ },
452
+ },
453
+ nodeIdsAbscissa: [
454
+ {
455
+ id: 7,
456
+ value: -2,
457
+ },
458
+ {
459
+ id: 7,
460
+ value: 2,
461
+ },
462
+ {
463
+ id: 7,
464
+ value: 5,
465
+ },
466
+ ],
467
+ };
468
+ identifiers = identifiersDefault;
469
+ }
470
+ return getQuestionFromIdentifiers(identifiers, opts);
471
+ };
472
+ const getQuestionFromIdentifiers = (identifiers, opts) => {
473
+ return {
474
+ instruction: getInstruction(identifiers, opts),
475
+ answer: getAnswer(identifiers),
476
+ ggbOptions: getGGBOptions(identifiers),
477
+ answerFormat: "tex",
478
+ keys: ["S", "equal", "lbrace", "semicolon", "rbrace"],
479
+ hint: getHint(identifiers, opts),
480
+ correction: getCorrection(identifiers, opts),
481
+ correctionGgbOptions: getCorrectionGGBOptions(identifiers, opts),
482
+ identifiers,
483
+ };
484
+ };
485
+ export const derivativeEquationSolvingByManipulatingLineYAndSlope = {
486
+ id: "derivativeEquationSolvingByManipulatingLineYAndSlope",
487
+ connector: "=",
488
+ label: `Résoudre une équation du type "$f'(x) = k$" par la manipulation d'une droite de coefficient directeur réglable`,
489
+ isSingleStep: false,
490
+ generator: (nb) => getDistinctQuestions(getDerivativeEquationSolvingByManipulatingLineYAndSlopeQuestion, nb),
491
+ qcmTimer: 60,
492
+ freeTimer: 60,
493
+ getPropositions,
494
+ isAnswerValid,
495
+ subject: "Mathématiques",
496
+ getQuestionFromIdentifiers,
497
+ hasHintAndCorrection: true,
498
+ hasGeogebra: true,
499
+ };
@@ -0,0 +1,10 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ import { NodeIdentifiers } from "../../../../tree/nodes/nodeConstructor.js";
3
+ type Identifiers = {
4
+ x: number;
5
+ k: number;
6
+ nodeIds: NodeIdentifiers[];
7
+ };
8
+ export declare const derivativeEquationSolvingByManipulatingPoint: Exercise<Identifiers>;
9
+ export {};
10
+ //# sourceMappingURL=derivativeEquationSolvingByManipulatingPoint.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"derivativeEquationSolvingByManipulatingPoint.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/tangent/derivativeEquationSolvingByManipulatingPoint.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AASrC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAW7C,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,OAAO,EAAE,eAAe,EAAE,CAAC;CAC5B,CAAC;AA+QF,eAAO,MAAM,4CAA4C,EAAE,QAAQ,CAAC,WAAW,CAmB5E,CAAC"}