math-exercises 3.0.178 → 3.0.180

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 (161) 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/trinoms/sign/signOfProductOfAffineAndTrinom.d.ts.map +1 -1
  87. package/lib/exercises/math/functions/trinoms/sign/signOfProductOfAffineAndTrinom.js +4 -11
  88. package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductOrthoInSquare.d.ts.map +1 -1
  89. package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductOrthoInSquare.js +32 -17
  90. package/lib/exercises/math/probaStat/conditional/conditionalProbaFromTableWithContext.d.ts +13 -0
  91. package/lib/exercises/math/probaStat/conditional/conditionalProbaFromTableWithContext.d.ts.map +1 -0
  92. package/lib/exercises/math/probaStat/conditional/conditionalProbaFromTableWithContext.js +195 -0
  93. package/lib/exercises/math/probaStat/conditional/conditionalProbaWriteFromFrench.d.ts +9 -0
  94. package/lib/exercises/math/probaStat/conditional/conditionalProbaWriteFromFrench.d.ts.map +1 -0
  95. package/lib/exercises/math/probaStat/conditional/conditionalProbaWriteFromFrench.js +220 -0
  96. package/lib/exercises/math/probaStat/conditional/conditionalProbability.d.ts +15 -0
  97. package/lib/exercises/math/probaStat/conditional/conditionalProbability.d.ts.map +1 -0
  98. package/lib/exercises/math/probaStat/conditional/conditionalProbability.js +332 -0
  99. package/lib/exercises/math/probaStat/conditional/fillTableConditionalProbabilitySituation.d.ts +8 -0
  100. package/lib/exercises/math/probaStat/conditional/fillTableConditionalProbabilitySituation.d.ts.map +1 -0
  101. package/lib/exercises/math/probaStat/conditional/fillTableConditionalProbabilitySituation.js +222 -0
  102. package/lib/exercises/math/probaStat/conditional/index.d.ts +5 -0
  103. package/lib/exercises/math/probaStat/conditional/index.d.ts.map +1 -0
  104. package/lib/exercises/math/probaStat/conditional/index.js +4 -0
  105. package/lib/exercises/math/probaStat/index.d.ts +1 -2
  106. package/lib/exercises/math/probaStat/index.d.ts.map +1 -1
  107. package/lib/exercises/math/probaStat/index.js +1 -2
  108. package/lib/exercises/math/probaStat/probaFromTableWithContext.d.ts +1 -0
  109. package/lib/exercises/math/probaStat/probaFromTableWithContext.d.ts.map +1 -1
  110. package/lib/exercises/math/probaStat/probaFromTableWithContext.js +26 -199
  111. package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationProbabilityLaw.d.ts.map +1 -1
  112. package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationProbabilityLaw.js +6 -2
  113. package/lib/exercises/math/probaStat/randomVariable/utils/randomVariableSituations.d.ts.map +1 -1
  114. package/lib/exercises/math/probaStat/randomVariable/utils/randomVariableSituations.js +6 -5
  115. package/lib/exercises/math/probaStat/trees/buildTreeFromSituation.d.ts.map +1 -1
  116. package/lib/exercises/math/probaStat/trees/buildTreeFromSituation.js +4 -27
  117. package/lib/exercises/math/probaStat/twoEventsSituations.d.ts +29 -0
  118. package/lib/exercises/math/probaStat/twoEventsSituations.d.ts.map +1 -0
  119. package/lib/exercises/math/probaStat/twoEventsSituations.js +145 -0
  120. package/lib/exercises/math/sequences/explicitFormulaUsage.d.ts +4 -1
  121. package/lib/exercises/math/sequences/explicitFormulaUsage.d.ts.map +1 -1
  122. package/lib/exercises/math/sequences/explicitFormulaUsage.js +47 -7
  123. package/lib/exercises/math/sequences/geometric/geometricFindRandomTermFromTwoTerms.js +1 -1
  124. package/lib/exercises/math/sequences/recurrenceFormulaUsage.d.ts +5 -1
  125. package/lib/exercises/math/sequences/recurrenceFormulaUsage.d.ts.map +1 -1
  126. package/lib/exercises/math/sequences/recurrenceFormulaUsage.js +89 -9
  127. package/lib/exercises/math/trigonometry/circle/associatePoint.d.ts.map +1 -1
  128. package/lib/exercises/math/trigonometry/circle/associatePoint.js +55 -6
  129. package/lib/exercises/math/trigonometry/circle/selectQuadrantOnTrigoCircle.d.ts.map +1 -1
  130. package/lib/exercises/math/trigonometry/circle/selectQuadrantOnTrigoCircle.js +5 -6
  131. package/lib/exercises/math/trigonometry/functions/associateAngleSimplification.d.ts.map +1 -1
  132. package/lib/exercises/math/trigonometry/functions/associateAngleSimplification.js +1 -3
  133. package/lib/exercises/vea/polynomialVEA.d.ts +2 -0
  134. package/lib/exercises/vea/polynomialVEA.d.ts.map +1 -0
  135. package/lib/exercises/vea/polynomialVEA.js +17 -0
  136. package/lib/exercises/vea/valueTableVEA.d.ts +8 -0
  137. package/lib/exercises/vea/valueTableVEA.d.ts.map +1 -0
  138. package/lib/exercises/vea/valueTableVEA.js +12 -0
  139. package/lib/index.d.ts +27 -11
  140. package/lib/index.d.ts.map +1 -1
  141. package/lib/latexTester.d.ts.map +1 -1
  142. package/lib/latexTester.js +1 -1
  143. package/lib/math/utils/polynomial/polynomialInterpolationUtils.d.ts +19 -0
  144. package/lib/math/utils/polynomial/polynomialInterpolationUtils.d.ts.map +1 -0
  145. package/lib/math/utils/polynomial/polynomialInterpolationUtils.js +53 -0
  146. package/lib/math/utils/polynomial/polynomialUtils.d.ts +37 -0
  147. package/lib/math/utils/polynomial/polynomialUtils.d.ts.map +1 -0
  148. package/lib/math/utils/polynomial/polynomialUtils.js +223 -0
  149. package/lib/math/utils/sequences/situations/seqArithmeticSituations.d.ts.map +1 -1
  150. package/lib/math/utils/sequences/situations/seqArithmeticSituations.js +6 -6
  151. package/lib/tree/nodes/operators/multiplyNode.d.ts.map +1 -1
  152. package/lib/tree/nodes/operators/multiplyNode.js +1 -1
  153. package/lib/tree/nodes/operators/substractNode.d.ts.map +1 -1
  154. package/lib/tree/nodes/operators/substractNode.js +2 -1
  155. package/lib/tree/utilities/nodeUtils.d.ts +6 -0
  156. package/lib/tree/utilities/nodeUtils.d.ts.map +1 -0
  157. package/lib/tree/utilities/nodeUtils.js +24 -0
  158. package/lib/utils/strings/prependArticle.d.ts +2 -0
  159. package/lib/utils/strings/prependArticle.d.ts.map +1 -0
  160. package/lib/utils/strings/prependArticle.js +1 -0
  161. package/package.json +1 -1
@@ -0,0 +1,14 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ import { NodeIdentifiers } from "../../../../tree/nodes/nodeConstructor.js";
3
+ type Identifiers = {
4
+ nodeIdsSlope: NodeIdentifiers;
5
+ nodeIdsF: NodeIdentifiers;
6
+ typeF: string;
7
+ nodeIdsRoots: NodeIdentifiers[];
8
+ };
9
+ type Options = {
10
+ typeF: string;
11
+ };
12
+ export declare const derivativeEquationSolving1: Exercise<Identifiers, Options>;
13
+ export {};
14
+ //# sourceMappingURL=derivativeEquationSolving1.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"derivativeEquationSolving1.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivative/derivativeEquationSolving1.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAgBT,MAAM,6BAA6B,CAAC;AAYrC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AA6B7C,KAAK,WAAW,GAAG;IACjB,YAAY,EAAE,eAAe,CAAC;IAC9B,QAAQ,EAAE,eAAe,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,eAAe,EAAE,CAAC;CACjC,CAAC;AA6SF,KAAK,OAAO,GAAG;IACb,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAoCF,eAAO,MAAM,0BAA0B,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAerE,CAAC"}
@@ -0,0 +1,283 @@
1
+ import { GeneratorOptionTarget, GeneratorOptionType, 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 { createIntegratedPolynomialNode, createNodeFPolynomialFromRoots, } from "../../../../math/utils/polynomial/polynomialUtils.js";
5
+ import { randint } from "../../../../math/utils/random/randint.js";
6
+ import { EquationSolutionNode } from "../../../../tree/nodes/equations/equationSolutionNode.js";
7
+ import { opposite } from "../../../../tree/nodes/functions/oppositeNode.js";
8
+ import { sqrt } from "../../../../tree/nodes/functions/sqrtNode.js";
9
+ import { NodeConstructor, } from "../../../../tree/nodes/nodeConstructor.js";
10
+ import { add } from "../../../../tree/nodes/operators/addNode.js";
11
+ import { frac, isFractionNode, } from "../../../../tree/nodes/operators/fractionNode.js";
12
+ import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
13
+ import { power } from "../../../../tree/nodes/operators/powerNode.js";
14
+ import { DiscreteSetNode } from "../../../../tree/nodes/sets/discreteSetNode.js";
15
+ import { discreteSetParser } from "../../../../tree/parsers/discreteSetParser.js";
16
+ import { random, randomMany } from "../../../../utils/alea/random.js";
17
+ import { shuffle } from "../../../../utils/alea/shuffle.js";
18
+ import { alignTex } from "../../../../utils/latex/alignTex.js";
19
+ const getPrettyDerivativeNode = (nodeF) => {
20
+ const nodeDerivativeRaw = nodeF.derivative().simplify();
21
+ if (isFractionNode(nodeDerivativeRaw)) {
22
+ const nodeNumSimplified = nodeDerivativeRaw.leftChild.simplify({
23
+ towardsDistribute: true,
24
+ forbidFactorize: true,
25
+ });
26
+ const nodeDenSimplified = nodeDerivativeRaw.rightChild.simplify();
27
+ return frac(nodeNumSimplified, nodeDenSimplified);
28
+ }
29
+ else {
30
+ return nodeDerivativeRaw;
31
+ }
32
+ };
33
+ const getInstruction = (identifiers) => {
34
+ const { nodeIdsSlope, nodeIdsF } = identifiers;
35
+ const [nodeSlope, nodeF] = [nodeIdsSlope, nodeIdsF].map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds));
36
+ return `Voici l'expression d'une fonction $f$ :
37
+
38
+ $$
39
+ f(x) = ${nodeF.toTex()}
40
+ $$
41
+
42
+ Déterminer les abscisses des points où le coefficient directeur de la tangente à la courbe représentative de $f$ vaut $${nodeSlope.toTex()}$.`;
43
+ };
44
+ const getAnswerNode = (identifiers) => {
45
+ const { nodeIdsRoots } = identifiers;
46
+ const arrNodeRoot = nodeIdsRoots.map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds));
47
+ const nodeSolution = new EquationSolutionNode(new DiscreteSetNode(arrNodeRoot));
48
+ return nodeSolution;
49
+ };
50
+ const getAnswer = (identifiers) => {
51
+ return getAnswerNode(identifiers).toTex();
52
+ };
53
+ const getHint = (identifiers) => {
54
+ const { nodeIdsSlope, typeF } = identifiers;
55
+ const [nodeSlope] = [nodeIdsSlope].map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds));
56
+ return `Si $f$ est une fonction dérivable en $x$, alors la pente de la tangente en $x$ est $f'(x)$.
57
+
58
+ Il faut donc résoudre l'équation :
59
+
60
+ $$
61
+ f'(x) = ${nodeSlope.toTex()}
62
+ $$
63
+
64
+ Rappel :
65
+
66
+ ${(() => {
67
+ switch (typeF) {
68
+ case "polynôme (degré $2$)":
69
+ return `Soient $a$, $b$ et $c$ trois réels. La dérivée de $x \\mapsto ax^2+bx+c$ est $x \\mapsto 2ax+b$.`;
70
+ case "polynôme (degré $3$)":
71
+ return `Soient $a$, $b$, $c$ et $d$ quatre réels. La dérivée de $x \\mapsto ax^3+bx^2+cx+d$ est $x \\mapsto 3ax^2+2bx+c$.`;
72
+ case "$\\frac{k}{x}$":
73
+ return `Soit $n$ un entier. La dérivée de $x \\mapsto \\frac{k}{x}$ est $x \\mapsto -\\frac{k}{x^2}$.`;
74
+ case "$\\frac{ax+b}{cx+d}$":
75
+ return `Soient $a$, $b$, $c$ et $d$ quatre réels. La dérivée de $x \\mapsto \\frac{ax+b}{cx+d}$ est $x \\mapsto \\frac{a(cx+d)-(ax+b)c}{(cx+d)^2}$.`;
76
+ case "$k\\sqrt{x}$":
77
+ return `La dérivée de $x \\mapsto k\\sqrt{x}$ est $x \\mapsto \\frac{k}{2\\sqrt{x}}$.`;
78
+ case "$ax\\sqrt{x}$":
79
+ return `Soient $a$ et $b$ deux réels. La dérivée de $x \\mapsto ax\\sqrt{x}$ est $x \\mapsto a\\sqrt{x}+(ax)\\frac{1}{2\\sqrt{x}}$.`;
80
+ default:
81
+ throw new Error("Unsupported typeF: " + typeF);
82
+ }
83
+ })()}
84
+
85
+ `;
86
+ };
87
+ const getCorrection = (identifiers) => {
88
+ const { nodeIdsSlope, nodeIdsF } = identifiers;
89
+ const [nodeSlope, nodeF] = [nodeIdsSlope, nodeIdsF].map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds));
90
+ const nodeDerivative = getPrettyDerivativeNode(nodeF);
91
+ return `Si $f$ est une fonction dérivable en $x$, alors la pente de la tangente en $x$ est $f'(x)$.
92
+
93
+ Il faut donc résoudre l'équation :
94
+
95
+ $$
96
+ f'(x) = ${nodeSlope.toTex()}
97
+ $$
98
+
99
+ On calcule :
100
+
101
+ ${alignTex([
102
+ ...[
103
+ ...new Set([
104
+ nodeF
105
+ .derivative()
106
+ .simplify({ towardsDistribute: true, forbidFactorize: true })
107
+ .toTex(),
108
+ nodeDerivative.toTex(),
109
+ ]),
110
+ ].map((tex) => [`f'(x)`, "=", tex]),
111
+ ])}
112
+
113
+ On veut donc résoudre l'équation :
114
+
115
+ $$
116
+ ${nodeDerivative.toTex()} = ${nodeSlope.toTex()}
117
+ $$
118
+
119
+ On résout :
120
+
121
+ $$
122
+ ${getAnswer(identifiers)}
123
+ $$
124
+
125
+ `;
126
+ };
127
+ const getPropositions = (n, { answer, ...identifiers }) => {
128
+ const { typeF } = identifiers;
129
+ const propositions = [];
130
+ addValidProp(propositions, answer);
131
+ propWhile(propositions, n, () => {
132
+ const identifierWrong = createRandomIdentifiers(typeF);
133
+ tryToAddWrongProp(propositions, getAnswer(identifierWrong));
134
+ });
135
+ return shuffle(propositions);
136
+ };
137
+ const isAnswerValid = (ans, { answer, ...identifiers }, _optsIn) => {
138
+ const answerNode = getAnswerNode(identifiers);
139
+ const arrNodeAnswer = answerNode.solutionsSet.elements;
140
+ const parsed = discreteSetParser(ans);
141
+ if (!parsed) {
142
+ return false;
143
+ }
144
+ const arrAns = parsed.elements;
145
+ return SetVEA.isArrayOfNodesValid(arrAns, arrNodeAnswer);
146
+ };
147
+ const createRandomIdentifiers = (typeF) => {
148
+ const [nodeF, nodeSlope, arrNodeRoot] = (() => {
149
+ const nodeVarX = "x".toTree();
150
+ switch (typeF) {
151
+ case "polynôme (degré $2$)": {
152
+ //P'(x) - s = a(x-x1)
153
+ //P'(x) = a(x-x1) + s
154
+ const nodeA = randint(-9, 10, [0]).toTree();
155
+ const nodeX1 = randint(-5, 6, [0]).toTree();
156
+ const nodeS = randint(-9, 10, [0]).toTree();
157
+ const nodeDerivative = add(createNodeFPolynomialFromRoots(nodeA, [nodeX1]), nodeS);
158
+ const nodeC = randint(-3, 3).toTree();
159
+ const nodeF = createIntegratedPolynomialNode(nodeDerivative, nodeC).simplify({ towardsDistribute: true, forbidFactorize: true });
160
+ return [nodeF, nodeS, [nodeX1]];
161
+ }
162
+ case "polynôme (degré $3$)": {
163
+ //P'(x) - s = a(x-x1)(x-x2)
164
+ //P'(x) = a(x-x1)(x-x2) + s
165
+ const nodeA = randint(-9, 10, [0]).toTree();
166
+ const [nodeX1, nodeX2] = randomMany([...Array(11).keys()].map((i) => i - 5), 2).map((v) => v.toTree());
167
+ const nodeS = randint(-9, 10, [0]).toTree();
168
+ const nodeDerivative = add(createNodeFPolynomialFromRoots(nodeA, [nodeX1, nodeX2]), nodeS);
169
+ const nodeC = randint(-3, 3).toTree();
170
+ const nodeF = createIntegratedPolynomialNode(nodeDerivative, nodeC).simplify({ towardsDistribute: true, forbidFactorize: true });
171
+ return [nodeF, nodeS, [nodeX1, nodeX2]];
172
+ }
173
+ case "$\\frac{k}{x}$": {
174
+ //P'(x) = s <=> -k/x^2 = s <=> x^2=(-k)/s (=> ks <0)
175
+ const nodeS = randint(-9, 10, [0]).toTree();
176
+ const nodeK = multiply(-randint(1, 5, [0]), nodeS).simplify();
177
+ const nodeF = frac(nodeK, nodeVarX).simplify();
178
+ const nodeX1 = sqrt(opposite(frac(nodeK, nodeS).simplify())).simplify();
179
+ const nodeX2 = opposite(nodeX1);
180
+ return [nodeF, nodeS, [nodeX1, nodeX2]];
181
+ }
182
+ // case "$\\frac{ax+b}{cx+d}$": {
183
+ // //P'(x) = s <=> (a(cx+d)-c(ax+b))/(cx+d)^2 = s
184
+ // // <=> a(cx+d)-c(ax+b) = s(cx+d)^2
185
+ // //
186
+ // // const [nodeNum, nodeDen] = AffineConstructor.differentRandoms(2).map(
187
+ // // (affine) => affine.toTree(),
188
+ // // );
189
+ // // return frac(nodeNum, nodeDen);
190
+ // return [nodeF, nodeS];
191
+ // }
192
+ case "$k\\sqrt{x}$": {
193
+ //P'(x) = s <=> k/(2sqrt(x)) = s
194
+ // <=> 2sqrt(x) = k/s (=> ks > 0)
195
+ // => 4x=k^2/s^2
196
+ // => x=(1/4)(k^2/s^2)
197
+ const nodeS = randint(-9, 10, [0]).toTree();
198
+ const nodeK = multiply(randint(1, 5, [0]), nodeS).simplify();
199
+ const nodeF = multiply(nodeK, sqrt(nodeVarX)).simplify();
200
+ const nodeX1 = frac(1, multiply(4, power(frac(nodeK, nodeS), 2))).simplify();
201
+ return [nodeF, nodeS, [nodeX1]];
202
+ }
203
+ case "$ax\\sqrt{x}$": {
204
+ //P'(x) = s <=> (a)sqrt(x) + ax/(2sqrt(x)) = s
205
+ // => 2(a)(sqrt(x)) = s (=> sa>0)
206
+ // => x = (s/2a)^2
207
+ const nodeA = randint(-9, 10, [0]).toTree();
208
+ const nodeS = multiply(-randint(1, 5, [0]), nodeA).simplify();
209
+ const nodeF = multiply(multiply(nodeA, nodeVarX), sqrt(nodeVarX)).simplify();
210
+ const nodeX1 = power(frac(nodeS, multiply(2, nodeA)), 2).simplify();
211
+ return [nodeF, nodeS, [nodeX1]];
212
+ }
213
+ default:
214
+ throw new Error("Unsupported typeF: " + typeF);
215
+ }
216
+ })();
217
+ const identifiers = {
218
+ nodeIdsSlope: nodeSlope.toIdentifiers(),
219
+ nodeIdsF: nodeF.toIdentifiers(),
220
+ typeF,
221
+ nodeIdsRoots: arrNodeRoot.map((node) => node.toIdentifiers()),
222
+ };
223
+ return identifiers;
224
+ };
225
+ const getDerivativeEquationSolving1Question = (optsIn) => {
226
+ const arrayedOptions = optsIn ?? arrayedOptsDefault;
227
+ const typeF = random(arrayedOptions.typeF);
228
+ const identifiers = createRandomIdentifiers(typeF);
229
+ return getQuestionFromIdentifiers(identifiers);
230
+ };
231
+ const getQuestionFromIdentifiers = (identifiers, opts) => {
232
+ return {
233
+ instruction: getInstruction(identifiers, opts),
234
+ answer: getAnswer(identifiers),
235
+ answerFormat: "tex",
236
+ keys: ["S", "equal", "lbrace", "semicolon", "rbrace"],
237
+ hint: getHint(identifiers, opts),
238
+ correction: getCorrection(identifiers, opts),
239
+ identifiers,
240
+ };
241
+ };
242
+ const arrayedOptsDefault = {
243
+ typeF: [
244
+ "polynôme (degré $2$)",
245
+ "polynôme (degré $3$)",
246
+ "$\\frac{k}{x}$",
247
+ // "$\\frac{ax+b}{cx+d}$",
248
+ "$k\\sqrt{x}$",
249
+ "$ax\\sqrt{x}$",
250
+ ],
251
+ };
252
+ const options = [
253
+ {
254
+ id: "typeF",
255
+ label: "Type de fonction",
256
+ target: GeneratorOptionTarget.generation,
257
+ type: GeneratorOptionType.multiselect,
258
+ values: [
259
+ "polynôme (degré $2$)",
260
+ "polynôme (degré $3$)",
261
+ "$\\frac{k}{x}$",
262
+ // "$\\frac{ax+b}{cx+d}$",
263
+ "$k\\sqrt{x}$",
264
+ "$ax\\sqrt{x}$",
265
+ ],
266
+ defaultValue: arrayedOptsDefault.typeF,
267
+ },
268
+ ];
269
+ export const derivativeEquationSolving1 = {
270
+ id: "derivativeEquationSolving1",
271
+ connector: "=",
272
+ label: `Résoudre une équation avec la dérivée ($1$)`,
273
+ isSingleStep: false,
274
+ generator: (nb, opts) => getDistinctQuestions(() => getDerivativeEquationSolving1Question(opts), nb),
275
+ options,
276
+ qcmTimer: 60,
277
+ freeTimer: 60,
278
+ getPropositions,
279
+ isAnswerValid,
280
+ subject: "Mathématiques",
281
+ getQuestionFromIdentifiers,
282
+ hasHintAndCorrection: true,
283
+ };
@@ -0,0 +1,15 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ import { NodeIdentifiers } from "../../../../tree/nodes/nodeConstructor.js";
3
+ type Identifiers = {
4
+ nodeIdsSlope: NodeIdentifiers;
5
+ nodeIdsF: NodeIdentifiers;
6
+ typeF: string;
7
+ nodeIdsRoots: NodeIdentifiers[];
8
+ indexRootGiven: number;
9
+ };
10
+ type Options = {
11
+ typeF: string;
12
+ };
13
+ export declare const derivativeEquationSolving3: Exercise<Identifiers, Options>;
14
+ export {};
15
+ //# sourceMappingURL=derivativeEquationSolving3.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"derivativeEquationSolving3.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivative/derivativeEquationSolving3.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAgBT,MAAM,6BAA6B,CAAC;AAarC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AA6B7C,KAAK,WAAW,GAAG;IACjB,YAAY,EAAE,eAAe,CAAC;IAC9B,QAAQ,EAAE,eAAe,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,eAAe,EAAE,CAAC;IAChC,cAAc,EAAE,MAAM,CAAC;CACxB,CAAC;AA6TF,KAAK,OAAO,GAAG;IACb,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAoCF,eAAO,MAAM,0BAA0B,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAerE,CAAC"}
@@ -0,0 +1,296 @@
1
+ import { GeneratorOptionTarget, GeneratorOptionType, 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 { nodeBySubstitutingVar } from "../../../../math/utils/functions/functionComposition.js";
5
+ import { createIntegratedPolynomialNode, createNodeFPolynomialFromRoots, } from "../../../../math/utils/polynomial/polynomialUtils.js";
6
+ import { randint } from "../../../../math/utils/random/randint.js";
7
+ import { EquationSolutionNode } from "../../../../tree/nodes/equations/equationSolutionNode.js";
8
+ import { opposite } from "../../../../tree/nodes/functions/oppositeNode.js";
9
+ import { sqrt } from "../../../../tree/nodes/functions/sqrtNode.js";
10
+ import { NodeConstructor, } from "../../../../tree/nodes/nodeConstructor.js";
11
+ import { add } from "../../../../tree/nodes/operators/addNode.js";
12
+ import { frac, isFractionNode, } from "../../../../tree/nodes/operators/fractionNode.js";
13
+ import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
14
+ import { power } from "../../../../tree/nodes/operators/powerNode.js";
15
+ import { DiscreteSetNode } from "../../../../tree/nodes/sets/discreteSetNode.js";
16
+ import { discreteSetParser } from "../../../../tree/parsers/discreteSetParser.js";
17
+ import { random, randomMany } from "../../../../utils/alea/random.js";
18
+ import { shuffle } from "../../../../utils/alea/shuffle.js";
19
+ import { alignTex } from "../../../../utils/latex/alignTex.js";
20
+ const getPrettyDerivativeNode = (nodeF) => {
21
+ const nodeDerivativeRaw = nodeF.derivative().simplify();
22
+ if (isFractionNode(nodeDerivativeRaw)) {
23
+ const nodeNumSimplified = nodeDerivativeRaw.leftChild.simplify({
24
+ towardsDistribute: true,
25
+ forbidFactorize: true,
26
+ });
27
+ const nodeDenSimplified = nodeDerivativeRaw.rightChild.simplify();
28
+ return frac(nodeNumSimplified, nodeDenSimplified);
29
+ }
30
+ else {
31
+ return nodeDerivativeRaw;
32
+ }
33
+ };
34
+ const getInstruction = (identifiers) => {
35
+ const { nodeIdsF, nodeIdsRoots, indexRootGiven } = identifiers;
36
+ const [nodeF, nodeXGiven] = [nodeIdsF, nodeIdsRoots[indexRootGiven]].map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds));
37
+ return `Voici l'expression d'une fonction $f$ :
38
+
39
+ $$
40
+ f(x) = ${nodeF.toTex()}
41
+ $$
42
+
43
+ Déterminer les abscisses des points où la tangente est parallèle à la tangente en $${nodeXGiven.toTex()}$.`;
44
+ };
45
+ const getAnswerNode = (identifiers) => {
46
+ const { nodeIdsRoots } = identifiers;
47
+ const arrNodeRoot = nodeIdsRoots.map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds));
48
+ const nodeSolution = new EquationSolutionNode(new DiscreteSetNode(arrNodeRoot));
49
+ return nodeSolution;
50
+ };
51
+ const getAnswer = (identifiers) => {
52
+ return getAnswerNode(identifiers).toTex();
53
+ };
54
+ const getHint = (identifiers) => {
55
+ const { nodeIdsSlope, typeF } = identifiers;
56
+ const [nodeSlope] = [nodeIdsSlope].map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds));
57
+ return `Si $f$ est une fonction dérivable en $x$, alors la pente de la tangente en $x$ est $f'(x)$.
58
+
59
+ Il faut donc résoudre l'équation :
60
+
61
+ $$
62
+ f'(x) = ${nodeSlope.toTex()}
63
+ $$
64
+
65
+ Rappel :
66
+
67
+ ${(() => {
68
+ switch (typeF) {
69
+ case "polynôme (degré $2$)":
70
+ return `Soient $a$, $b$ et $c$ trois réels. La dérivée de $x \\mapsto ax^2+bx+c$ est $x \\mapsto 2ax+b$.`;
71
+ case "polynôme (degré $3$)":
72
+ return `Soient $a$, $b$, $c$ et $d$ quatre réels. La dérivée de $x \\mapsto ax^3+bx^2+cx+d$ est $x \\mapsto 3ax^2+2bx+c$.`;
73
+ case "$\\frac{k}{x}$":
74
+ return `Soit $n$ un entier. La dérivée de $x \\mapsto \\frac{k}{x}$ est $x \\mapsto -\\frac{k}{x^2}$.`;
75
+ case "$\\frac{ax+b}{cx+d}$":
76
+ return `Soient $a$, $b$, $c$ et $d$ quatre réels. La dérivée de $x \\mapsto \\frac{ax+b}{cx+d}$ est $x \\mapsto \\frac{a(cx+d)-(ax+b)c}{(cx+d)^2}$.`;
77
+ case "$k\\sqrt{x}$":
78
+ return `La dérivée de $x \\mapsto k\\sqrt{x}$ est $x \\mapsto \\frac{k}{2\\sqrt{x}}$.`;
79
+ case "$ax\\sqrt{x}$":
80
+ return `Soient $a$ et $b$ deux réels. La dérivée de $x \\mapsto ax\\sqrt{x}$ est $x \\mapsto a\\sqrt{x}+(ax)\\frac{1}{2\\sqrt{x}}$.`;
81
+ default:
82
+ throw new Error("Unsupported typeF: " + typeF);
83
+ }
84
+ })()}
85
+
86
+ `;
87
+ };
88
+ const getCorrection = (identifiers) => {
89
+ const { nodeIdsSlope, nodeIdsF, nodeIdsRoots, indexRootGiven } = identifiers;
90
+ const [nodeSlope, nodeF, nodeXGiven] = [
91
+ nodeIdsSlope,
92
+ nodeIdsF,
93
+ nodeIdsRoots[indexRootGiven],
94
+ ].map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds));
95
+ const nodeDerivative = getPrettyDerivativeNode(nodeF);
96
+ const nodeValueDerivative = nodeBySubstitutingVar(nodeDerivative, nodeXGiven, "x".toTree()).simplify();
97
+ return `On cherche d'abord la valeur de la pente en $${nodeXGiven.toTex()}$.
98
+
99
+ On calcule :
100
+
101
+ ${alignTex([
102
+ ...[
103
+ ...new Set([
104
+ nodeF
105
+ .derivative()
106
+ .simplify({ towardsDistribute: true, forbidFactorize: true })
107
+ .toTex(),
108
+ nodeDerivative.toTex(),
109
+ ]),
110
+ ].map((tex) => [`f'(x)`, "=", tex]),
111
+ ])}
112
+
113
+ On a donc :
114
+
115
+ $$
116
+ f'(${nodeXGiven.toTex()}) = ${nodeValueDerivative.toTex()}
117
+ $$
118
+
119
+ Les tangentes qui sont parallèles à la tangente en $${nodeXGiven.toTex()}$ ont toutes une pente qui vaut $${nodeValueDerivative.toTex()}$.
120
+
121
+
122
+ Si $f$ est une fonction dérivable en $x$, alors la pente de la tangente en $x$ est $f'(x)$.
123
+
124
+ Il faut donc résoudre l'équation :
125
+
126
+ ${alignTex([
127
+ [`f'(x)`, "=", nodeSlope.toTex()],
128
+ [nodeDerivative.toTex(), "=", nodeSlope.toTex()],
129
+ ])}
130
+
131
+ On résout :
132
+
133
+ $$
134
+ ${getAnswer(identifiers)}
135
+ $$
136
+
137
+ `;
138
+ };
139
+ const getPropositions = (n, { answer, ...identifiers }) => {
140
+ const { typeF } = identifiers;
141
+ const propositions = [];
142
+ addValidProp(propositions, answer);
143
+ propWhile(propositions, n, () => {
144
+ const identifierWrong = createRandomIdentifiers(typeF);
145
+ tryToAddWrongProp(propositions, getAnswer(identifierWrong));
146
+ });
147
+ return shuffle(propositions);
148
+ };
149
+ const isAnswerValid = (ans, { answer, ...identifiers }, _optsIn) => {
150
+ const answerNode = getAnswerNode(identifiers);
151
+ const arrNodeAnswer = answerNode.solutionsSet.elements;
152
+ const parsed = discreteSetParser(ans);
153
+ if (!parsed) {
154
+ return false;
155
+ }
156
+ const arrAns = parsed.elements;
157
+ return SetVEA.isArrayOfNodesValid(arrAns, arrNodeAnswer);
158
+ };
159
+ const createRandomIdentifiers = (typeF) => {
160
+ const [nodeF, nodeSlope, arrNodeRoot] = (() => {
161
+ const nodeVarX = "x".toTree();
162
+ switch (typeF) {
163
+ case "polynôme (degré $2$)": {
164
+ //P'(x) - s = a(x-x1)
165
+ //P'(x) = a(x-x1) + s
166
+ const nodeA = randint(-9, 10, [0]).toTree();
167
+ const nodeX1 = randint(-5, 6, [0]).toTree();
168
+ const nodeS = randint(-9, 10, [0]).toTree();
169
+ const nodeDerivative = add(createNodeFPolynomialFromRoots(nodeA, [nodeX1]), nodeS);
170
+ const nodeC = randint(-3, 3).toTree();
171
+ const nodeF = createIntegratedPolynomialNode(nodeDerivative, nodeC).simplify({ towardsDistribute: true, forbidFactorize: true });
172
+ return [nodeF, nodeS, [nodeX1]];
173
+ }
174
+ case "polynôme (degré $3$)": {
175
+ //P'(x) - s = a(x-x1)(x-x2)
176
+ //P'(x) = a(x-x1)(x-x2) + s
177
+ const nodeA = randint(-9, 10, [0]).toTree();
178
+ const [nodeX1, nodeX2] = randomMany([...Array(11).keys()].map((i) => i - 5), 2).map((v) => v.toTree());
179
+ const nodeS = randint(-9, 10, [0]).toTree();
180
+ const nodeDerivative = add(createNodeFPolynomialFromRoots(nodeA, [nodeX1, nodeX2]), nodeS);
181
+ const nodeC = randint(-3, 3).toTree();
182
+ const nodeF = createIntegratedPolynomialNode(nodeDerivative, nodeC).simplify({ towardsDistribute: true, forbidFactorize: true });
183
+ return [nodeF, nodeS, [nodeX1, nodeX2]];
184
+ }
185
+ case "$\\frac{k}{x}$": {
186
+ //P'(x) = s <=> -k/x^2 = s <=> x^2=(-k)/s (=> ks <0)
187
+ const nodeS = randint(-9, 10, [0]).toTree();
188
+ const nodeK = multiply(-randint(1, 5, [0]), nodeS).simplify();
189
+ const nodeF = frac(nodeK, nodeVarX).simplify();
190
+ const nodeX1 = sqrt(opposite(frac(nodeK, nodeS).simplify())).simplify();
191
+ const nodeX2 = opposite(nodeX1);
192
+ return [nodeF, nodeS, [nodeX1, nodeX2]];
193
+ }
194
+ // case "$\\frac{ax+b}{cx+d}$": {
195
+ // //P'(x) = s <=> (a(cx+d)-c(ax+b))/(cx+d)^2 = s
196
+ // // <=> a(cx+d)-c(ax+b) = s(cx+d)^2
197
+ // //
198
+ // // const [nodeNum, nodeDen] = AffineConstructor.differentRandoms(2).map(
199
+ // // (affine) => affine.toTree(),
200
+ // // );
201
+ // // return frac(nodeNum, nodeDen);
202
+ // return [nodeF, nodeS];
203
+ // }
204
+ case "$k\\sqrt{x}$": {
205
+ //P'(x) = s <=> k/(2sqrt(x)) = s
206
+ // <=> 2sqrt(x) = k/s (=> ks > 0)
207
+ // => 4x=k^2/s^2
208
+ // => x=(1/4)(k^2/s^2)
209
+ const nodeS = randint(-9, 10, [0]).toTree();
210
+ const nodeK = multiply(randint(1, 5, [0]), nodeS).simplify();
211
+ const nodeF = multiply(nodeK, sqrt(nodeVarX)).simplify();
212
+ const nodeX1 = frac(1, multiply(4, power(frac(nodeK, nodeS), 2))).simplify();
213
+ return [nodeF, nodeS, [nodeX1]];
214
+ }
215
+ case "$ax\\sqrt{x}$": {
216
+ //P'(x) = s <=> (a)sqrt(x) + ax/(2sqrt(x)) = s
217
+ // => 2(a)(sqrt(x)) = s (=> sa>0)
218
+ // => x = (s/2a)^2
219
+ const nodeA = randint(-9, 10, [0]).toTree();
220
+ const nodeS = multiply(-randint(1, 5, [0]), nodeA).simplify();
221
+ const nodeF = multiply(multiply(nodeA, nodeVarX), sqrt(nodeVarX)).simplify();
222
+ const nodeX1 = power(frac(nodeS, multiply(2, nodeA)), 2).simplify();
223
+ return [nodeF, nodeS, [nodeX1]];
224
+ }
225
+ default:
226
+ throw new Error("Unsupported typeF: " + typeF);
227
+ }
228
+ })();
229
+ const identifiers = {
230
+ nodeIdsSlope: nodeSlope.toIdentifiers(),
231
+ nodeIdsF: nodeF.toIdentifiers(),
232
+ typeF,
233
+ nodeIdsRoots: arrNodeRoot.map((node) => node.toIdentifiers()),
234
+ indexRootGiven: randint(0, arrNodeRoot.length),
235
+ };
236
+ return identifiers;
237
+ };
238
+ const getDerivativeEquationSolving3Question = (optsIn) => {
239
+ const arrayedOptions = optsIn ?? arrayedOptsDefault;
240
+ const typeF = random(arrayedOptions.typeF);
241
+ const identifiers = createRandomIdentifiers(typeF);
242
+ return getQuestionFromIdentifiers(identifiers);
243
+ };
244
+ const getQuestionFromIdentifiers = (identifiers, opts) => {
245
+ return {
246
+ instruction: getInstruction(identifiers, opts),
247
+ answer: getAnswer(identifiers),
248
+ answerFormat: "tex",
249
+ keys: ["S", "equal", "lbrace", "semicolon", "rbrace"],
250
+ hint: getHint(identifiers, opts),
251
+ correction: getCorrection(identifiers, opts),
252
+ identifiers,
253
+ };
254
+ };
255
+ const arrayedOptsDefault = {
256
+ typeF: [
257
+ "polynôme (degré $2$)",
258
+ "polynôme (degré $3$)",
259
+ "$\\frac{k}{x}$",
260
+ // "$\\frac{ax+b}{cx+d}$",
261
+ "$k\\sqrt{x}$",
262
+ "$ax\\sqrt{x}$",
263
+ ],
264
+ };
265
+ const options = [
266
+ {
267
+ id: "typeF",
268
+ label: "Type de fonction",
269
+ target: GeneratorOptionTarget.generation,
270
+ type: GeneratorOptionType.multiselect,
271
+ values: [
272
+ "polynôme (degré $2$)",
273
+ "polynôme (degré $3$)",
274
+ "$\\frac{k}{x}$",
275
+ // "$\\frac{ax+b}{cx+d}$",
276
+ "$k\\sqrt{x}$",
277
+ "$ax\\sqrt{x}$",
278
+ ],
279
+ defaultValue: arrayedOptsDefault.typeF,
280
+ },
281
+ ];
282
+ export const derivativeEquationSolving3 = {
283
+ id: "derivativeEquationSolving3",
284
+ connector: "=",
285
+ label: `Résoudre une équation avec la dérivée ($3$)`,
286
+ isSingleStep: false,
287
+ generator: (nb, opts) => getDistinctQuestions(() => getDerivativeEquationSolving3Question(opts), nb),
288
+ options,
289
+ qcmTimer: 60,
290
+ freeTimer: 60,
291
+ getPropositions,
292
+ isAnswerValid,
293
+ subject: "Mathématiques",
294
+ getQuestionFromIdentifiers,
295
+ hasHintAndCorrection: true,
296
+ };
@@ -32,7 +32,7 @@ const getHint = (identifiers) => {
32
32
  return `Si $v$ est une fonction dérivable alors :
33
33
 
34
34
  $$
35
- (e^{v(x)})'(x) = v'(x) \\times e^{v(x)}
35
+ (e^{v(x)})' = v'(x) \\times e^{v(x)}
36
36
  $$
37
37
 
38
38
  Ici, on a :
@@ -51,7 +51,7 @@ const getCorrection = (identifiers) => {
51
51
  return `Si $v$ est une fonction dérivable alors :
52
52
 
53
53
  $$
54
- (e^{(v(x)})'(x) = v'(x) \\times e^{v(x)}
54
+ (e^{v(x)})' = v'(x) \\times e^{v(x)}
55
55
  $$
56
56
 
57
57
  Ici, on a :
@@ -67,7 +67,7 @@ $$
67
67
  Donc :
68
68
 
69
69
  $$
70
- (e^{${texAffine}})'(x) = ${texDeriv} e^{${texAffine}}
70
+ (e^{${texAffine}})' = ${texDeriv} e^{${texAffine}}
71
71
  $$
72
72
 
73
73
  `;
@@ -0,0 +1,14 @@
1
+ import { Exercise } from "../../../../../exercises/exercise.js";
2
+ type Identifiers = {
3
+ coeffsF: number[];
4
+ coeffsG: number[];
5
+ };
6
+ type Options = {
7
+ typeF: string;
8
+ isRequireFactorizedAnswer: boolean;
9
+ typeExpG: string;
10
+ };
11
+ export declare const expDerivativeProductFExp: Exercise<Identifiers, Options>;
12
+ export declare const expDerivativeProductFExpAffine: Exercise<Identifiers, Options>;
13
+ export {};
14
+ //# sourceMappingURL=expDerivativeProductFExp.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"expDerivativeProductFExp.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/derivation/derivative/exp/expDerivativeProductFExp.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAiBT,MAAM,6BAA6B,CAAC;AA+DrC,KAAK,WAAW,GAAG;IAEjB,OAAO,EAAE,MAAM,EAAE,CAAC;IAGlB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AA4TF,KAAK,OAAO,GAAG;IACb,KAAK,EAAE,MAAM,CAAC;IACd,yBAAyB,EAAE,OAAO,CAAC;IAGnC,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AA4BF,eAAO,MAAM,wBAAwB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAwBnE,CAAC;AAEF,eAAO,MAAM,8BAA8B,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAwBzE,CAAC"}