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.
- package/lib/exercises/math/derivation/derivative/derivativeEquationSolving1.d.ts +14 -0
- package/lib/exercises/math/derivation/derivative/derivativeEquationSolving1.d.ts.map +1 -0
- package/lib/exercises/math/derivation/derivative/derivativeEquationSolving1.js +283 -0
- package/lib/exercises/math/derivation/derivative/derivativeEquationSolving3.d.ts +15 -0
- package/lib/exercises/math/derivation/derivative/derivativeEquationSolving3.d.ts.map +1 -0
- package/lib/exercises/math/derivation/derivative/derivativeEquationSolving3.js +296 -0
- package/lib/exercises/math/derivation/derivative/exp/expDerivativeOne.js +3 -3
- package/lib/exercises/math/derivation/derivative/exp/expDerivativeProductFExp.d.ts +14 -0
- package/lib/exercises/math/derivation/derivative/exp/expDerivativeProductFExp.d.ts.map +1 -0
- package/lib/exercises/math/derivation/derivative/exp/expDerivativeProductFExp.js +346 -0
- package/lib/exercises/math/derivation/derivative/exp/expDerivativeQuotientFExp.d.ts +15 -0
- package/lib/exercises/math/derivation/derivative/exp/expDerivativeQuotientFExp.d.ts.map +1 -0
- package/lib/exercises/math/derivation/derivative/exp/expDerivativeQuotientFExp.js +435 -0
- package/lib/exercises/math/derivation/derivative/valueDerivativeFromFunctionExpression.d.ts +13 -0
- package/lib/exercises/math/derivation/derivative/valueDerivativeFromFunctionExpression.d.ts.map +1 -0
- package/lib/exercises/math/derivation/derivative/valueDerivativeFromFunctionExpression.js +326 -0
- package/lib/exercises/math/derivation/derivativeNumber/signOfDerivativeNumberFromFunctionCurve.d.ts +14 -0
- package/lib/exercises/math/derivation/derivativeNumber/signOfDerivativeNumberFromFunctionCurve.d.ts.map +1 -0
- package/lib/exercises/math/derivation/derivativeNumber/signOfDerivativeNumberFromFunctionCurve.js +181 -0
- package/lib/exercises/math/derivation/derivativeNumber/valueTableImageAndDerivativeFromFunctionExpression.d.ts +10 -0
- package/lib/exercises/math/derivation/derivativeNumber/valueTableImageAndDerivativeFromFunctionExpression.d.ts.map +1 -0
- package/lib/exercises/math/derivation/derivativeNumber/valueTableImageAndDerivativeFromFunctionExpression.js +272 -0
- package/lib/exercises/math/derivation/problems/index.d.ts +5 -0
- package/lib/exercises/math/derivation/problems/index.d.ts.map +1 -0
- package/lib/exercises/math/derivation/problems/index.js +4 -0
- package/lib/exercises/math/derivation/problems/problemMaximizeBoxVolumeFindX.d.ts +8 -0
- package/lib/exercises/math/derivation/problems/problemMaximizeBoxVolumeFindX.d.ts.map +1 -0
- package/lib/exercises/math/derivation/problems/problemMaximizeBoxVolumeFindX.js +171 -0
- package/lib/exercises/math/derivation/problems/problemMaximizeProfitFindProduction.d.ts +15 -0
- package/lib/exercises/math/derivation/problems/problemMaximizeProfitFindProduction.d.ts.map +1 -0
- package/lib/exercises/math/derivation/problems/problemMaximizeProfitFindProduction.js +328 -0
- package/lib/exercises/math/derivation/problems/problemMovementOnLineFindSpeedAtPoint.d.ts +13 -0
- package/lib/exercises/math/derivation/problems/problemMovementOnLineFindSpeedAtPoint.d.ts.map +1 -0
- package/lib/exercises/math/derivation/problems/problemMovementOnLineFindSpeedAtPoint.js +275 -0
- package/lib/exercises/math/derivation/problems/problemProjectileHeightFindAbscissa.d.ts +8 -0
- package/lib/exercises/math/derivation/problems/problemProjectileHeightFindAbscissa.d.ts.map +1 -0
- package/lib/exercises/math/derivation/problems/problemProjectileHeightFindAbscissa.js +137 -0
- package/lib/exercises/math/derivation/tangent/derivativeEquationSolvingByManipulatingLineY.d.ts +10 -0
- package/lib/exercises/math/derivation/tangent/derivativeEquationSolvingByManipulatingLineY.d.ts.map +1 -0
- package/lib/exercises/math/derivation/tangent/derivativeEquationSolvingByManipulatingLineY.js +478 -0
- package/lib/exercises/math/derivation/tangent/derivativeEquationSolvingByManipulatingLineYAndSlope.d.ts +10 -0
- package/lib/exercises/math/derivation/tangent/derivativeEquationSolvingByManipulatingLineYAndSlope.d.ts.map +1 -0
- package/lib/exercises/math/derivation/tangent/derivativeEquationSolvingByManipulatingLineYAndSlope.js +499 -0
- package/lib/exercises/math/derivation/tangent/derivativeEquationSolvingByManipulatingPoint.d.ts +10 -0
- package/lib/exercises/math/derivation/tangent/derivativeEquationSolvingByManipulatingPoint.d.ts.map +1 -0
- package/lib/exercises/math/derivation/tangent/derivativeEquationSolvingByManipulatingPoint.js +240 -0
- package/lib/exercises/math/derivation/tangent/derivativeReadingByManipulatingBuildingTangent.d.ts +12 -0
- package/lib/exercises/math/derivation/tangent/derivativeReadingByManipulatingBuildingTangent.d.ts.map +1 -0
- package/lib/exercises/math/derivation/tangent/derivativeReadingByManipulatingBuildingTangent.js +436 -0
- package/lib/exercises/math/derivation/tangent/derivativeReadingByManipulatingPoint.d.ts +12 -0
- package/lib/exercises/math/derivation/tangent/derivativeReadingByManipulatingPoint.d.ts.map +1 -0
- package/lib/exercises/math/derivation/tangent/derivativeReadingByManipulatingPoint.js +219 -0
- package/lib/exercises/math/derivation/tangent/derivativeReadingByManipulatingSecant.d.ts +13 -0
- package/lib/exercises/math/derivation/tangent/derivativeReadingByManipulatingSecant.d.ts.map +1 -0
- package/lib/exercises/math/derivation/tangent/derivativeReadingByManipulatingSecant.js +273 -0
- package/lib/exercises/math/derivation/tangent/placePointsOfDerivativeFromGraph.d.ts +18 -0
- package/lib/exercises/math/derivation/tangent/placePointsOfDerivativeFromGraph.d.ts.map +1 -0
- package/lib/exercises/math/derivation/tangent/placePointsOfDerivativeFromGraph.js +295 -0
- package/lib/exercises/math/derivation/tangent/tangentEquationFromFunctionExpression.d.ts +13 -0
- package/lib/exercises/math/derivation/tangent/tangentEquationFromFunctionExpression.d.ts.map +1 -0
- package/lib/exercises/math/derivation/tangent/tangentEquationFromFunctionExpression.js +388 -0
- package/lib/exercises/math/derivation/tangent/tangentEquationFromGraph.d.ts +9 -0
- package/lib/exercises/math/derivation/tangent/tangentEquationFromGraph.d.ts.map +1 -0
- package/lib/exercises/math/derivation/tangent/tangentEquationFromGraph.js +308 -0
- package/lib/exercises/math/derivation/variations/findAbscissaOfExtremaFromFunctionExpression.d.ts +14 -0
- package/lib/exercises/math/derivation/variations/findAbscissaOfExtremaFromFunctionExpression.d.ts.map +1 -0
- package/lib/exercises/math/derivation/variations/findAbscissaOfExtremaFromFunctionExpression.js +439 -0
- package/lib/exercises/math/derivation/variations/findExtremaFromFunctionExpression.d.ts +14 -0
- package/lib/exercises/math/derivation/variations/findExtremaFromFunctionExpression.d.ts.map +1 -0
- package/lib/exercises/math/derivation/variations/findExtremaFromFunctionExpression.js +547 -0
- package/lib/exercises/math/derivation/variations/plausibleDerivativeGraphFromFunctionGraphByManipulatingPolynomial.d.ts +15 -0
- package/lib/exercises/math/derivation/variations/plausibleDerivativeGraphFromFunctionGraphByManipulatingPolynomial.d.ts.map +1 -0
- package/lib/exercises/math/derivation/variations/plausibleDerivativeGraphFromFunctionGraphByManipulatingPolynomial.js +537 -0
- package/lib/exercises/math/derivation/variations/plausibleFunctionGraphFromDerivativeGraphByManipulatingPolynomial.d.ts +15 -0
- package/lib/exercises/math/derivation/variations/plausibleFunctionGraphFromDerivativeGraphByManipulatingPolynomial.d.ts.map +1 -0
- package/lib/exercises/math/derivation/variations/plausibleFunctionGraphFromDerivativeGraphByManipulatingPolynomial.js +639 -0
- package/lib/exercises/math/derivation/variations/signVarTableFromFunctionExpression.d.ts +14 -0
- package/lib/exercises/math/derivation/variations/signVarTableFromFunctionExpression.d.ts.map +1 -0
- package/lib/exercises/math/derivation/variations/signVarTableFromFunctionExpression.js +530 -0
- package/lib/exercises/math/derivation/variations/signVarTableProductFExp.d.ts +10 -0
- package/lib/exercises/math/derivation/variations/signVarTableProductFExp.d.ts.map +1 -0
- package/lib/exercises/math/derivation/variations/signVarTableProductFExp.js +451 -0
- package/lib/exercises/math/derivation/variations/signVarTableQuotientFExp.d.ts +11 -0
- package/lib/exercises/math/derivation/variations/signVarTableQuotientFExp.d.ts.map +1 -0
- package/lib/exercises/math/derivation/variations/signVarTableQuotientFExp.js +514 -0
- package/lib/exercises/math/functions/trinoms/sign/signOfProductOfAffineAndTrinom.d.ts.map +1 -1
- package/lib/exercises/math/functions/trinoms/sign/signOfProductOfAffineAndTrinom.js +4 -11
- package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductOrthoInSquare.d.ts.map +1 -1
- package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductOrthoInSquare.js +32 -17
- package/lib/exercises/math/probaStat/conditional/conditionalProbaFromTableWithContext.d.ts +13 -0
- package/lib/exercises/math/probaStat/conditional/conditionalProbaFromTableWithContext.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/conditional/conditionalProbaFromTableWithContext.js +195 -0
- package/lib/exercises/math/probaStat/conditional/conditionalProbaWriteFromFrench.d.ts +9 -0
- package/lib/exercises/math/probaStat/conditional/conditionalProbaWriteFromFrench.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/conditional/conditionalProbaWriteFromFrench.js +220 -0
- package/lib/exercises/math/probaStat/conditional/conditionalProbability.d.ts +15 -0
- package/lib/exercises/math/probaStat/conditional/conditionalProbability.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/conditional/conditionalProbability.js +332 -0
- package/lib/exercises/math/probaStat/conditional/fillTableConditionalProbabilitySituation.d.ts +8 -0
- package/lib/exercises/math/probaStat/conditional/fillTableConditionalProbabilitySituation.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/conditional/fillTableConditionalProbabilitySituation.js +222 -0
- package/lib/exercises/math/probaStat/conditional/index.d.ts +5 -0
- package/lib/exercises/math/probaStat/conditional/index.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/conditional/index.js +4 -0
- package/lib/exercises/math/probaStat/index.d.ts +1 -2
- package/lib/exercises/math/probaStat/index.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/index.js +1 -2
- package/lib/exercises/math/probaStat/probaFromTableWithContext.d.ts +1 -0
- package/lib/exercises/math/probaStat/probaFromTableWithContext.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/probaFromTableWithContext.js +26 -199
- package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationProbabilityLaw.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationProbabilityLaw.js +6 -2
- package/lib/exercises/math/probaStat/randomVariable/utils/randomVariableSituations.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/randomVariable/utils/randomVariableSituations.js +6 -5
- package/lib/exercises/math/probaStat/trees/buildTreeFromSituation.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/trees/buildTreeFromSituation.js +4 -27
- package/lib/exercises/math/probaStat/twoEventsSituations.d.ts +29 -0
- package/lib/exercises/math/probaStat/twoEventsSituations.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/twoEventsSituations.js +145 -0
- package/lib/exercises/math/sequences/explicitFormulaUsage.d.ts +4 -1
- package/lib/exercises/math/sequences/explicitFormulaUsage.d.ts.map +1 -1
- package/lib/exercises/math/sequences/explicitFormulaUsage.js +47 -7
- package/lib/exercises/math/sequences/geometric/geometricFindRandomTermFromTwoTerms.js +1 -1
- package/lib/exercises/math/sequences/recurrenceFormulaUsage.d.ts +5 -1
- package/lib/exercises/math/sequences/recurrenceFormulaUsage.d.ts.map +1 -1
- package/lib/exercises/math/sequences/recurrenceFormulaUsage.js +89 -9
- package/lib/exercises/math/trigonometry/circle/associatePoint.d.ts.map +1 -1
- package/lib/exercises/math/trigonometry/circle/associatePoint.js +55 -6
- package/lib/exercises/math/trigonometry/circle/selectQuadrantOnTrigoCircle.d.ts.map +1 -1
- package/lib/exercises/math/trigonometry/circle/selectQuadrantOnTrigoCircle.js +5 -6
- package/lib/exercises/math/trigonometry/functions/associateAngleSimplification.d.ts.map +1 -1
- package/lib/exercises/math/trigonometry/functions/associateAngleSimplification.js +1 -3
- package/lib/exercises/vea/polynomialVEA.d.ts +2 -0
- package/lib/exercises/vea/polynomialVEA.d.ts.map +1 -0
- package/lib/exercises/vea/polynomialVEA.js +17 -0
- package/lib/exercises/vea/valueTableVEA.d.ts +8 -0
- package/lib/exercises/vea/valueTableVEA.d.ts.map +1 -0
- package/lib/exercises/vea/valueTableVEA.js +12 -0
- package/lib/index.d.ts +27 -11
- package/lib/index.d.ts.map +1 -1
- package/lib/latexTester.d.ts.map +1 -1
- package/lib/latexTester.js +1 -1
- package/lib/math/utils/polynomial/polynomialInterpolationUtils.d.ts +19 -0
- package/lib/math/utils/polynomial/polynomialInterpolationUtils.d.ts.map +1 -0
- package/lib/math/utils/polynomial/polynomialInterpolationUtils.js +53 -0
- package/lib/math/utils/polynomial/polynomialUtils.d.ts +37 -0
- package/lib/math/utils/polynomial/polynomialUtils.d.ts.map +1 -0
- package/lib/math/utils/polynomial/polynomialUtils.js +223 -0
- package/lib/math/utils/sequences/situations/seqArithmeticSituations.d.ts.map +1 -1
- package/lib/math/utils/sequences/situations/seqArithmeticSituations.js +6 -6
- package/lib/tree/nodes/operators/multiplyNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/multiplyNode.js +1 -1
- package/lib/tree/nodes/operators/substractNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/substractNode.js +2 -1
- package/lib/tree/utilities/nodeUtils.d.ts +6 -0
- package/lib/tree/utilities/nodeUtils.d.ts.map +1 -0
- package/lib/tree/utilities/nodeUtils.js +24 -0
- package/lib/utils/strings/prependArticle.d.ts +2 -0
- package/lib/utils/strings/prependArticle.d.ts.map +1 -0
- package/lib/utils/strings/prependArticle.js +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
import { addValidProp, tryToAddWrongProp, propWhile, shuffleProps, GeneratorOptionTarget, GeneratorOptionType, } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { AffineConstructor } from "../../../../math/polynomials/affine.js";
|
|
4
|
+
import { PolynomialConstructor } from "../../../../math/polynomials/polynomial.js";
|
|
5
|
+
import { TrinomConstructor } from "../../../../math/polynomials/trinom.js";
|
|
6
|
+
import { nodeBySubstitutingVar } from "../../../../math/utils/functions/functionComposition.js";
|
|
7
|
+
import { randint } from "../../../../math/utils/random/randint.js";
|
|
8
|
+
import { sqrt } from "../../../../tree/nodes/functions/sqrtNode.js";
|
|
9
|
+
import { NodeConstructor, } from "../../../../tree/nodes/nodeConstructor.js";
|
|
10
|
+
import { frac, isFractionNode, } from "../../../../tree/nodes/operators/fractionNode.js";
|
|
11
|
+
import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
12
|
+
import { power, square } from "../../../../tree/nodes/operators/powerNode.js";
|
|
13
|
+
import { substract } from "../../../../tree/nodes/operators/substractNode.js";
|
|
14
|
+
import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
|
|
15
|
+
import { NodeShuffler } from "../../../../tree/utilities/nodeShuffler.js";
|
|
16
|
+
import { random } from "../../../../utils/alea/random.js";
|
|
17
|
+
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
18
|
+
import { alignTex } from "../../../../utils/latex/alignTex.js";
|
|
19
|
+
const getNodeFForTypeF = (typeF) => {
|
|
20
|
+
const nodeVarX = "x".toTree();
|
|
21
|
+
switch (typeF) {
|
|
22
|
+
case "$k$":
|
|
23
|
+
return randint(-10, 11).toTree();
|
|
24
|
+
case "$x$":
|
|
25
|
+
return nodeVarX;
|
|
26
|
+
case "$x^2$":
|
|
27
|
+
return square(nodeVarX);
|
|
28
|
+
case "$x^n \\ (n>=3)$":
|
|
29
|
+
return power(nodeVarX, randint(3, 6));
|
|
30
|
+
case "$\\frac{1}{x}$":
|
|
31
|
+
return frac(1, nodeVarX);
|
|
32
|
+
case "$\\frac{1}{x^n} \\ (n>=2)$":
|
|
33
|
+
return frac(1, power(nodeVarX, randint(3, 6)));
|
|
34
|
+
case "$\\sqrt{x}$":
|
|
35
|
+
return sqrt(nodeVarX);
|
|
36
|
+
case "polynôme (degré $1$)":
|
|
37
|
+
return AffineConstructor.random().toTree();
|
|
38
|
+
case "polynôme (degré $2$)":
|
|
39
|
+
return TrinomConstructor.random().toTree();
|
|
40
|
+
case "polynôme (degré $3$)":
|
|
41
|
+
return PolynomialConstructor.randomWithOrder(3).toTree();
|
|
42
|
+
case "$\\frac{ax+b}{cx+d}$": {
|
|
43
|
+
const [nodeNum, nodeDen] = AffineConstructor.differentRandoms(2).map((affine) => affine.toTree());
|
|
44
|
+
return frac(nodeNum, nodeDen);
|
|
45
|
+
}
|
|
46
|
+
case "$(ax+b)\\sqrt{x}$": {
|
|
47
|
+
const nodeAffine = AffineConstructor.random().toTree();
|
|
48
|
+
return multiply(nodeAffine, sqrt(nodeVarX));
|
|
49
|
+
}
|
|
50
|
+
default:
|
|
51
|
+
throw new Error("Unsupported typeF: " + typeF);
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
const getRandomNodeXAskedForTypeF = (typeF) => {
|
|
55
|
+
switch (typeF) {
|
|
56
|
+
case "$\\frac{1}{x}$":
|
|
57
|
+
case "$\\frac{1}{x^n} \\ (n>=2)$":
|
|
58
|
+
return randint(-5, 6, [0]).toTree();
|
|
59
|
+
case "$\\sqrt{x}$":
|
|
60
|
+
case "$(ax+b)\\sqrt{x}$":
|
|
61
|
+
return randint(1, 6).toTree();
|
|
62
|
+
default:
|
|
63
|
+
return randint(-5, 6).toTree();
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
const getPrettyDerivativeNode = (nodeF) => {
|
|
67
|
+
const nodeDerivativeRaw = nodeF.derivative().simplify();
|
|
68
|
+
if (isFractionNode(nodeDerivativeRaw)) {
|
|
69
|
+
const nodeNumSimplified = nodeDerivativeRaw.leftChild.simplify({
|
|
70
|
+
towardsDistribute: true,
|
|
71
|
+
forbidFactorize: true,
|
|
72
|
+
});
|
|
73
|
+
const nodeDenSimplified = nodeDerivativeRaw.rightChild.simplify();
|
|
74
|
+
return frac(nodeNumSimplified, nodeDenSimplified);
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
return nodeDerivativeRaw;
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
const getInstruction = (identifiers) => {
|
|
81
|
+
const { nodeIdsXAsked, nodeIdsF } = identifiers;
|
|
82
|
+
const [nodeXAsked, nodeF] = [nodeIdsXAsked, nodeIdsF].map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds));
|
|
83
|
+
return `Soit $f$ une fonction telle que, pour tout $x$ dans l'ensemble de dérivation de $f$ :
|
|
84
|
+
|
|
85
|
+
$$
|
|
86
|
+
f(x) = ${nodeF.toTex()}
|
|
87
|
+
$$
|
|
88
|
+
|
|
89
|
+
Déterminer $f'(${nodeXAsked.toTex()})$.`;
|
|
90
|
+
};
|
|
91
|
+
const getAnswerNode = (identifiers) => {
|
|
92
|
+
const { nodeIdsXAsked, nodeIdsF } = identifiers;
|
|
93
|
+
const [nodeXAsked, nodeF] = [nodeIdsXAsked, nodeIdsF].map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds));
|
|
94
|
+
const nodeDerivative = getPrettyDerivativeNode(nodeF);
|
|
95
|
+
return nodeBySubstitutingVar(nodeDerivative, nodeXAsked, "x".toTree()).simplify();
|
|
96
|
+
};
|
|
97
|
+
const getAnswer = (identifiers) => {
|
|
98
|
+
return getAnswerNode(identifiers).toTex();
|
|
99
|
+
};
|
|
100
|
+
const getHint = (identifiers) => {
|
|
101
|
+
const { typeF } = identifiers;
|
|
102
|
+
switch (typeF) {
|
|
103
|
+
case "$k$":
|
|
104
|
+
return `Soit $k$ un réel. La dérivée de $x \\mapsto k$ est $x \\mapsto 0$.`;
|
|
105
|
+
case "$x$":
|
|
106
|
+
return `La dérivée de $x \\mapsto x$ est $x \\mapsto 1$.`;
|
|
107
|
+
case "$x^2$":
|
|
108
|
+
return `La dérivée de $x \\mapsto x^2$ est $x \\mapsto 2x$.`;
|
|
109
|
+
case "$x^n \\ (n>=3)$":
|
|
110
|
+
return `Soit $n$ un entier tel que $n \\geq 3$. La dérivée de $x \\mapsto x^n$ est $x \\mapsto nx^{n-1}$.`;
|
|
111
|
+
case "$\\frac{1}{x}$":
|
|
112
|
+
return `Soit $n$ un entier. La dérivée de $x \\mapsto \\frac{1}{x}$ est $x \\mapsto -\\frac{1}{x^2}$.`;
|
|
113
|
+
case "$\\frac{1}{x^n} \\ (n>=2)$":
|
|
114
|
+
return `Soit $n$ un entier tel que $n \\geq 2$. La dérivée de $x \\mapsto \\frac{1}{x^n}$ est $x \\mapsto \\frac{-n}{x^{n+1}}$.`;
|
|
115
|
+
case "$\\sqrt{x}$":
|
|
116
|
+
return `La dérivée de $x \\mapsto \\sqrt{x}$ est $x \\mapsto \\frac{1}{2\\sqrt{x}}$.`;
|
|
117
|
+
case "polynôme (degré $1$)":
|
|
118
|
+
return `Soient $a$ et $b$ deux réels. La dérivée de $x \\mapsto ax+b$ est $x \\mapsto a$.`;
|
|
119
|
+
case "polynôme (degré $2$)":
|
|
120
|
+
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$.`;
|
|
121
|
+
case "polynôme (degré $3$)":
|
|
122
|
+
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$.`;
|
|
123
|
+
case "$\\frac{ax+b}{cx+d}$":
|
|
124
|
+
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}$.`;
|
|
125
|
+
case "$(ax+b)\\sqrt{x}$":
|
|
126
|
+
return `Soient $a$ et $b$ deux réels. La dérivée de $x \\mapsto (ax+b)\\sqrt{x}$ est $x \\mapsto a\\sqrt{x}+(ax+b)\\frac{1}{2\\sqrt{x}}$.`;
|
|
127
|
+
default:
|
|
128
|
+
throw new Error("Unsupported typeF: " + typeF);
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
const getCorrection = (identifiers) => {
|
|
132
|
+
const { nodeIdsXAsked, nodeIdsF } = identifiers;
|
|
133
|
+
const [nodeXAsked, nodeF] = [nodeIdsXAsked, nodeIdsF].map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds));
|
|
134
|
+
const nodeDerivative = getPrettyDerivativeNode(nodeF);
|
|
135
|
+
const nodeValueDerivative = getAnswerNode(identifiers);
|
|
136
|
+
return `
|
|
137
|
+
Pour $x$ dans l'ensemble de dérivation de $f$, on calcule :
|
|
138
|
+
|
|
139
|
+
${alignTex([
|
|
140
|
+
[`f'(x)`, "=", nodeF.derivative().toTex()],
|
|
141
|
+
[`f'(x)`, "=", nodeDerivative.toTex()],
|
|
142
|
+
])}
|
|
143
|
+
|
|
144
|
+
Donc :
|
|
145
|
+
|
|
146
|
+
$$
|
|
147
|
+
f'(${nodeXAsked.toTex()}) = ${nodeValueDerivative.simplify().toTex()}
|
|
148
|
+
$$
|
|
149
|
+
|
|
150
|
+
`;
|
|
151
|
+
};
|
|
152
|
+
const getPropositions = (n, { answer, ...identifiers }) => {
|
|
153
|
+
const propositions = [];
|
|
154
|
+
addValidProp(propositions, answer);
|
|
155
|
+
const { nodeIdsXAsked, nodeIdsF } = identifiers;
|
|
156
|
+
const [nodeXAsked, nodeF] = [nodeIdsXAsked, nodeIdsF].map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds));
|
|
157
|
+
const nodeDerivative = getPrettyDerivativeNode(nodeF);
|
|
158
|
+
function tryToAddWrongPropWithSuccess(propositions, tex, format) {
|
|
159
|
+
const nbPropsBefore = propositions.length;
|
|
160
|
+
tryToAddWrongProp(propositions, tex, format);
|
|
161
|
+
const nbPropsAfter = propositions.length;
|
|
162
|
+
return nbPropsAfter !== nbPropsBefore;
|
|
163
|
+
}
|
|
164
|
+
propWhile(propositions, n, () => {
|
|
165
|
+
if (!tryToAddWrongPropWithSuccess(propositions, (() => {
|
|
166
|
+
const nodeFShuffled = NodeShuffler.deepShuffle(nodeF);
|
|
167
|
+
const identifiersWrong = {
|
|
168
|
+
...identifiers,
|
|
169
|
+
nodeIdsF: nodeFShuffled.toIdentifiers(),
|
|
170
|
+
};
|
|
171
|
+
return getAnswer(identifiersWrong);
|
|
172
|
+
})())) {
|
|
173
|
+
if (!tryToAddWrongPropWithSuccess(propositions, (() => {
|
|
174
|
+
const nodeDerivativeShuffled = NodeShuffler.deepShuffle(nodeDerivative);
|
|
175
|
+
const nodeWrong = nodeBySubstitutingVar(nodeDerivativeShuffled, nodeXAsked, "x".toTree()).simplify();
|
|
176
|
+
return nodeWrong.simplify().toTex();
|
|
177
|
+
})())) {
|
|
178
|
+
try {
|
|
179
|
+
tryToAddWrongPropWithSuccess(propositions, (() => {
|
|
180
|
+
const typeF = random(arrayedOptsDefault.typeF);
|
|
181
|
+
const identifiersWrong = createRandomIdentifiers(typeF);
|
|
182
|
+
return getAnswer(identifiersWrong);
|
|
183
|
+
})());
|
|
184
|
+
}
|
|
185
|
+
catch (_) {
|
|
186
|
+
tryToAddWrongProp(propositions, randint(-20, 20).frenchify());
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
return shuffleProps(propositions, n);
|
|
192
|
+
};
|
|
193
|
+
const getKeys = () => {
|
|
194
|
+
return [];
|
|
195
|
+
};
|
|
196
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
197
|
+
try {
|
|
198
|
+
const nodeAns = parseAlgebraic(ans);
|
|
199
|
+
const nodeAnswer = parseAlgebraic(answer);
|
|
200
|
+
const isValid = substract(nodeAns, nodeAnswer).evaluate() === 0;
|
|
201
|
+
return isValid;
|
|
202
|
+
}
|
|
203
|
+
catch (err) {
|
|
204
|
+
return handleVEAError(err);
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
const createRandomIdentifiers = (typeF) => {
|
|
208
|
+
const nodeF = getNodeFForTypeF(typeF);
|
|
209
|
+
const nodeXAsked = getRandomNodeXAskedForTypeF(typeF);
|
|
210
|
+
const identifiers = {
|
|
211
|
+
nodeIdsXAsked: nodeXAsked.toIdentifiers(),
|
|
212
|
+
nodeIdsF: nodeF.toIdentifiers(),
|
|
213
|
+
typeF,
|
|
214
|
+
};
|
|
215
|
+
return identifiers;
|
|
216
|
+
};
|
|
217
|
+
const getValueDerivativeFromFunctionExpressionQuestion = (optsIn) => {
|
|
218
|
+
const arrayedOptions = optsIn ?? arrayedOptsDefault;
|
|
219
|
+
const typeF = random(arrayedOptions.typeF);
|
|
220
|
+
let identifiers;
|
|
221
|
+
let isValid = false;
|
|
222
|
+
let counter = -1;
|
|
223
|
+
while (!isValid && counter < 100) {
|
|
224
|
+
counter++;
|
|
225
|
+
const identifiersCandidate = createRandomIdentifiers(typeF);
|
|
226
|
+
const isExploding = (identifiers) => {
|
|
227
|
+
const { nodeIdsXAsked, nodeIdsF } = identifiers;
|
|
228
|
+
const [nodeXAsked, nodeF] = [nodeIdsXAsked, nodeIdsF].map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds));
|
|
229
|
+
const nodeDerivative = getPrettyDerivativeNode(nodeF);
|
|
230
|
+
let isExploding = false;
|
|
231
|
+
try {
|
|
232
|
+
const _nodeValueFunction = nodeBySubstitutingVar(nodeF, nodeXAsked, "x".toTree()).simplify();
|
|
233
|
+
const _nodeValueDerivative = nodeBySubstitutingVar(nodeDerivative, nodeXAsked, "x".toTree()).simplify();
|
|
234
|
+
}
|
|
235
|
+
catch (_) {
|
|
236
|
+
isExploding = true;
|
|
237
|
+
}
|
|
238
|
+
return isExploding;
|
|
239
|
+
};
|
|
240
|
+
isValid = !isExploding(identifiersCandidate);
|
|
241
|
+
if (isValid) {
|
|
242
|
+
identifiers = identifiersCandidate;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
if (!isValid) {
|
|
246
|
+
const identifiersDefault = {
|
|
247
|
+
nodeIdsXAsked: {
|
|
248
|
+
id: 7,
|
|
249
|
+
value: 3,
|
|
250
|
+
},
|
|
251
|
+
nodeIdsF: {
|
|
252
|
+
id: 10,
|
|
253
|
+
name: "x",
|
|
254
|
+
},
|
|
255
|
+
typeF: "$x$",
|
|
256
|
+
};
|
|
257
|
+
identifiers = identifiersDefault;
|
|
258
|
+
}
|
|
259
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
260
|
+
};
|
|
261
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
262
|
+
return {
|
|
263
|
+
answer: getAnswer(identifiers),
|
|
264
|
+
instruction: getInstruction(identifiers),
|
|
265
|
+
keys: getKeys(identifiers),
|
|
266
|
+
answerFormat: "tex",
|
|
267
|
+
identifiers,
|
|
268
|
+
hint: getHint(identifiers),
|
|
269
|
+
correction: getCorrection(identifiers),
|
|
270
|
+
};
|
|
271
|
+
};
|
|
272
|
+
const arrayedOptsDefault = {
|
|
273
|
+
typeF: [
|
|
274
|
+
"$k$",
|
|
275
|
+
"$x$",
|
|
276
|
+
"$x^2$",
|
|
277
|
+
"$x^n \\ (n>=3)$",
|
|
278
|
+
"$\\frac{1}{x}$",
|
|
279
|
+
"$\\frac{1}{x^n} \\ (n>=2)$",
|
|
280
|
+
"$\\sqrt{x}$",
|
|
281
|
+
"polynôme (degré $1$)",
|
|
282
|
+
"polynôme (degré $2$)",
|
|
283
|
+
"polynôme (degré $3$)",
|
|
284
|
+
"$\\frac{ax+b}{cx+d}$",
|
|
285
|
+
"$(ax+b)\\sqrt{x}$",
|
|
286
|
+
],
|
|
287
|
+
};
|
|
288
|
+
const options = [
|
|
289
|
+
{
|
|
290
|
+
id: "typeF",
|
|
291
|
+
label: "Type de fonction",
|
|
292
|
+
target: GeneratorOptionTarget.generation,
|
|
293
|
+
type: GeneratorOptionType.multiselect,
|
|
294
|
+
values: [
|
|
295
|
+
"$k$",
|
|
296
|
+
"$x$",
|
|
297
|
+
"$x^2$",
|
|
298
|
+
"$x^n \\ (n>=3)$",
|
|
299
|
+
"$\\frac{1}{x}$",
|
|
300
|
+
"$\\frac{1}{x^n} \\ (n>=2)$",
|
|
301
|
+
"$\\sqrt{x}$",
|
|
302
|
+
"polynôme (degré $1$)",
|
|
303
|
+
"polynôme (degré $2$)",
|
|
304
|
+
"polynôme (degré $3$)",
|
|
305
|
+
"$\\frac{ax+b}{cx+d}$",
|
|
306
|
+
"$(ax+b)\\sqrt{x}$",
|
|
307
|
+
],
|
|
308
|
+
defaultValue: arrayedOptsDefault.typeF,
|
|
309
|
+
},
|
|
310
|
+
];
|
|
311
|
+
export const valueDerivativeFromFunctionExpression = {
|
|
312
|
+
id: "valueDerivativeFromFunctionExpression",
|
|
313
|
+
connector: "=",
|
|
314
|
+
label: "Déterminer $f'(a)$ à partir de l'expression d'une fonction",
|
|
315
|
+
isSingleStep: true,
|
|
316
|
+
generator: (nb, opts) => getDistinctQuestions(() => getValueDerivativeFromFunctionExpressionQuestion(opts), nb),
|
|
317
|
+
options,
|
|
318
|
+
subject: "Mathématiques",
|
|
319
|
+
getInstruction,
|
|
320
|
+
getHint,
|
|
321
|
+
getCorrection,
|
|
322
|
+
isAnswerValid,
|
|
323
|
+
getPropositions,
|
|
324
|
+
getQuestionFromIdentifiers,
|
|
325
|
+
hasHintAndCorrection: true,
|
|
326
|
+
};
|
package/lib/exercises/math/derivation/derivativeNumber/signOfDerivativeNumberFromFunctionCurve.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise.js";
|
|
2
|
+
type Identifiers = {
|
|
3
|
+
a: number;
|
|
4
|
+
x1: number;
|
|
5
|
+
x2: number;
|
|
6
|
+
x3: number;
|
|
7
|
+
xAsked: number;
|
|
8
|
+
};
|
|
9
|
+
type Options = {
|
|
10
|
+
notationType: string;
|
|
11
|
+
};
|
|
12
|
+
export declare const signOfDerivativeNumberFromFunctionCurve: Exercise<Identifiers, Options>;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=signOfDerivativeNumberFromFunctionCurve.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signOfDerivativeNumberFromFunctionCurve.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivativeNumber/signOfDerivativeNumberFromFunctionCurve.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AA0DrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAmKF,KAAK,OAAO,GAAG;IACb,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAeF,eAAO,MAAM,uCAAuC,EAAE,QAAQ,CAC5D,WAAW,EACX,OAAO,CAwBR,CAAC"}
|
package/lib/exercises/math/derivation/derivativeNumber/signOfDerivativeNumberFromFunctionCurve.js
ADDED
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import { GeneratorOptionType, GeneratorOptionTarget, addValidProp, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { blueMain, orange, purpleMain } from "../../../../geogebra/colors.js";
|
|
4
|
+
import { GeogebraConstructor } from "../../../../geogebra/geogebraConstructor.js";
|
|
5
|
+
import { randfloat } from "../../../../math/utils/random/randfloat.js";
|
|
6
|
+
import { randint } from "../../../../math/utils/random/randint.js";
|
|
7
|
+
import { abs } from "../../../../tree/nodes/functions/absNode.js";
|
|
8
|
+
import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
9
|
+
import { substract } from "../../../../tree/nodes/operators/substractNode.js";
|
|
10
|
+
import { shuffle } from "../../../../utils/alea/shuffle.js";
|
|
11
|
+
const getNodeDerivative = (a, x1, x2, x3) => {
|
|
12
|
+
const nodeX = "x".toTree();
|
|
13
|
+
const nodeF = multiply(a, multiply(substract(nodeX, x1), multiply(substract(nodeX, x2), substract(nodeX, x3))));
|
|
14
|
+
const nodeDerivative = nodeF.derivative();
|
|
15
|
+
return nodeDerivative;
|
|
16
|
+
};
|
|
17
|
+
const getGGBCoords = (a, x1, x2, x3, xAsked) => {
|
|
18
|
+
const func = (x) => a * (x - x1) * (x - x2) * (x - x3);
|
|
19
|
+
const xMin = Math.min(x1, x2, x3, xAsked);
|
|
20
|
+
const xMax = Math.max(x1, x2, x3, xAsked);
|
|
21
|
+
const [yMin, yMax] = (() => {
|
|
22
|
+
const root1 = (2 * (x1 + x2 + x3) -
|
|
23
|
+
Math.sqrt(4 * (x1 + x2 + x3) ** 2 - 12 * (x1 * x2 + x1 * x3 + x2 * x3))) /
|
|
24
|
+
6;
|
|
25
|
+
const root2 = (2 * (x1 + x2 + x3) +
|
|
26
|
+
Math.sqrt(4 * (x1 + x2 + x3) ** 2 - 12 * (x1 * x2 + x1 * x3 + x2 * x3))) /
|
|
27
|
+
6;
|
|
28
|
+
const [fx1, fx2, fxAsked] = [func(root1), func(root2), func(xAsked)];
|
|
29
|
+
const yMin = Math.min(fx1, fx2, fxAsked);
|
|
30
|
+
const yMax = Math.max(fx1, fx2, fxAsked);
|
|
31
|
+
return [yMin, yMax];
|
|
32
|
+
})();
|
|
33
|
+
return [xMin, xMax, yMin, yMax];
|
|
34
|
+
};
|
|
35
|
+
const getInstruction = (identifiers, optsIn) => {
|
|
36
|
+
const { xAsked } = identifiers;
|
|
37
|
+
const opts = optsIn ?? optsDefault;
|
|
38
|
+
const strOfDerivativeNumber = opts.notationType === "Nombre dérivé de $f$ en $a$"
|
|
39
|
+
? `du nombre dérivé de $f$ en $${xAsked}$`
|
|
40
|
+
: `de $f'(${xAsked})$`;
|
|
41
|
+
return `On donne la représentation graphique d'une fonction $f$ définie sur $\\mathbb{R}$.
|
|
42
|
+
|
|
43
|
+
Quel est le signe ${strOfDerivativeNumber} ?
|
|
44
|
+
`;
|
|
45
|
+
};
|
|
46
|
+
const getAnswer = (identifiers) => {
|
|
47
|
+
const { a, xAsked: x, x1, x2, x3 } = identifiers;
|
|
48
|
+
return getNodeDerivative(a, x1, x2, x3).evaluate({ x }) > 0 ? "+" : "-";
|
|
49
|
+
};
|
|
50
|
+
const getHint = (identifiers) => {
|
|
51
|
+
const { xAsked } = identifiers;
|
|
52
|
+
return `Le nombre dérivé de $f$ en $${xAsked}$, aussi noté $f'(${xAsked})$, est le coefficient directeur la tangente à la courbe représentative de $f$ au point d'abscisse $${xAsked}$.`;
|
|
53
|
+
};
|
|
54
|
+
const getCorrection = (identifiers, _optsIn) => {
|
|
55
|
+
const answerFromIdentifiers = getAnswer(identifiers);
|
|
56
|
+
const { xAsked } = identifiers;
|
|
57
|
+
return `Le nombre dérivé de $f$ en $${xAsked}$, aussi noté $f'(${xAsked})$, est le coefficient directeur la tangente à la courbe représentative de $f$ au point d'abscisse $${xAsked}$.
|
|
58
|
+
|
|
59
|
+
Si on trace la tangente à la courbe représentative de $f$ au point d'abscisse $${xAsked}$, on observe que la pente est ${{ "+": "positive", "-": "négative" }[answerFromIdentifiers]}.
|
|
60
|
+
|
|
61
|
+
On a donc $f'(${xAsked}) ${{ "+": ">", "-": "<" }[answerFromIdentifiers]} 0$.`;
|
|
62
|
+
};
|
|
63
|
+
const getCorrectionGGBOptions = (identifiers) => {
|
|
64
|
+
const { a, x1, x2, x3, xAsked } = identifiers;
|
|
65
|
+
const answerFromIdentifiers = getAnswer(identifiers);
|
|
66
|
+
const ggb = new GeogebraConstructor({
|
|
67
|
+
commands: [
|
|
68
|
+
//function
|
|
69
|
+
`f(x) = ${a}*(x-${x1})*(x-${x2})*(x-${x3})`,
|
|
70
|
+
`SetColor(f, "${blueMain}")`,
|
|
71
|
+
//tangent
|
|
72
|
+
`t(x) = f(${xAsked}) + f'(${xAsked})(x-${xAsked})`,
|
|
73
|
+
`SetColor(t, "${{ "+": orange, "-": purpleMain }[answerFromIdentifiers]}")`,
|
|
74
|
+
],
|
|
75
|
+
lockedAxesRatio: false,
|
|
76
|
+
gridDistance: false,
|
|
77
|
+
xAxis: {
|
|
78
|
+
steps: 1,
|
|
79
|
+
},
|
|
80
|
+
});
|
|
81
|
+
const [xMin, xMax, yMin, yMax] = getGGBCoords(a, x1, x2, x3, xAsked);
|
|
82
|
+
return ggb.getOptions({
|
|
83
|
+
coords: [xMin - 2, xMax + 2, yMin - 2, yMax + 2],
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
const getGGBOptions = (identifiers) => {
|
|
87
|
+
const { a, x1, x2, x3, xAsked } = identifiers;
|
|
88
|
+
const ggb = new GeogebraConstructor({
|
|
89
|
+
commands: [
|
|
90
|
+
//function
|
|
91
|
+
`f(x) = ${a}*(x-${x1})*(x-${x2})*(x-${x3})`,
|
|
92
|
+
`SetColor(f, "${blueMain}")`,
|
|
93
|
+
],
|
|
94
|
+
lockedAxesRatio: false,
|
|
95
|
+
gridDistance: false,
|
|
96
|
+
xAxis: {
|
|
97
|
+
steps: 1,
|
|
98
|
+
},
|
|
99
|
+
});
|
|
100
|
+
const [xMin, xMax, yMin, yMax] = getGGBCoords(a, x1, x2, x3, xAsked);
|
|
101
|
+
return ggb.getOptions({
|
|
102
|
+
coords: [xMin - 2, xMax + 2, yMin - 2, yMax + 2],
|
|
103
|
+
});
|
|
104
|
+
};
|
|
105
|
+
const getPropositions = (_, { answer, ...identifiers }) => {
|
|
106
|
+
const propositions = [];
|
|
107
|
+
const answerFromIdentifiers = getAnswer(identifiers);
|
|
108
|
+
["+", "-"].forEach((texProp) => {
|
|
109
|
+
if (texProp === answerFromIdentifiers) {
|
|
110
|
+
addValidProp(propositions, texProp);
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
tryToAddWrongProp(propositions, texProp);
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
return propositions;
|
|
117
|
+
};
|
|
118
|
+
const getSignOfDerivativeNumberFromFunctionCurveQuestion = (optsIn) => {
|
|
119
|
+
const opts = optsIn ?? optsDefault;
|
|
120
|
+
const x1 = randint(-9, 10);
|
|
121
|
+
const x2 = randint(-9, 10, [x1]);
|
|
122
|
+
const x3 = randint(-9, 10, [x1, x2]);
|
|
123
|
+
const sorted = [x1, x2, x3].sort((a, b) => a - b);
|
|
124
|
+
const a = randfloat(-1, 1, 4, [0]);
|
|
125
|
+
const nodeDerivative = getNodeDerivative(a, x1, x2, x3);
|
|
126
|
+
const poolXCandidate = [...Array(15).keys()].map((i) => i - 7);
|
|
127
|
+
const xAsked = shuffle(poolXCandidate).find((x) => abs(nodeDerivative.evaluate({ x })).evaluate() > 0.666);
|
|
128
|
+
const identifiers = {
|
|
129
|
+
a,
|
|
130
|
+
x1: sorted[0],
|
|
131
|
+
x2: sorted[1],
|
|
132
|
+
x3: sorted[2],
|
|
133
|
+
xAsked,
|
|
134
|
+
};
|
|
135
|
+
return getQuestionFromIdentifiers(identifiers, opts);
|
|
136
|
+
};
|
|
137
|
+
const getQuestionFromIdentifiers = (identifiers, opts) => {
|
|
138
|
+
return {
|
|
139
|
+
instruction: getInstruction(identifiers, opts),
|
|
140
|
+
answer: getAnswer(identifiers, opts),
|
|
141
|
+
answerFormat: "tex",
|
|
142
|
+
identifiers,
|
|
143
|
+
hint: getHint(identifiers, opts),
|
|
144
|
+
correction: getCorrection(identifiers, opts),
|
|
145
|
+
correctionGgbOptions: getCorrectionGGBOptions(identifiers, opts),
|
|
146
|
+
ggbOptions: getGGBOptions(identifiers, opts),
|
|
147
|
+
options: opts,
|
|
148
|
+
};
|
|
149
|
+
};
|
|
150
|
+
const optsDefault = {
|
|
151
|
+
notationType: "$f'(a)$",
|
|
152
|
+
};
|
|
153
|
+
const options = [
|
|
154
|
+
{
|
|
155
|
+
id: "notationType",
|
|
156
|
+
label: "",
|
|
157
|
+
type: GeneratorOptionType.select,
|
|
158
|
+
target: GeneratorOptionTarget.instruction,
|
|
159
|
+
values: ["Nombre dérivé de $f$ en $a$", "$f'(a)$"],
|
|
160
|
+
defaultValue: optsDefault.notationType,
|
|
161
|
+
},
|
|
162
|
+
];
|
|
163
|
+
export const signOfDerivativeNumberFromFunctionCurve = {
|
|
164
|
+
id: "signOfDerivativeNumberFromFunctionCurve",
|
|
165
|
+
label: "Donner le signe de $f'(a)$ à partir de la représentation graphique de $f$",
|
|
166
|
+
isSingleStep: true,
|
|
167
|
+
generator: (nb, opts) => getDistinctQuestions(() => getSignOfDerivativeNumberFromFunctionCurveQuestion(opts), nb),
|
|
168
|
+
options,
|
|
169
|
+
qcmTimer: 60,
|
|
170
|
+
freeTimer: 60,
|
|
171
|
+
subject: "Mathématiques",
|
|
172
|
+
getHint,
|
|
173
|
+
getCorrection,
|
|
174
|
+
getInstruction,
|
|
175
|
+
getGGBOptions,
|
|
176
|
+
hasGeogebra: true,
|
|
177
|
+
getQuestionFromIdentifiers,
|
|
178
|
+
hasHintAndCorrection: true,
|
|
179
|
+
answerType: "QCU",
|
|
180
|
+
getPropositions,
|
|
181
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { NodeIdentifiers } from "../../../../tree/nodes/nodeConstructor.js";
|
|
3
|
+
type Identifiers = {
|
|
4
|
+
arrNodeIdsX: NodeIdentifiers[];
|
|
5
|
+
nodeIdsF: NodeIdentifiers;
|
|
6
|
+
initTable: string[][];
|
|
7
|
+
};
|
|
8
|
+
export declare const valueTableImageAndDerivativeFromFunctionExpression: Exercise<Identifiers>;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=valueTableImageAndDerivativeFromFunctionExpression.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"valueTableImageAndDerivativeFromFunctionExpression.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivativeNumber/valueTableImageAndDerivativeFromFunctionExpression.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,6BAA6B,CAAC;AAOrC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AA4B7C,KAAK,WAAW,GAAG;IACjB,WAAW,EAAE,eAAe,EAAE,CAAC;IAC/B,QAAQ,EAAE,eAAe,CAAC;IAC1B,SAAS,EAAE,MAAM,EAAE,EAAE,CAAC;CACvB,CAAC;AAoRF,eAAO,MAAM,kDAAkD,EAAE,QAAQ,CAAC,WAAW,CAsBlF,CAAC"}
|