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.
- 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/composition/index.d.ts +0 -1
- package/lib/exercises/math/functions/composition/index.d.ts.map +1 -1
- package/lib/exercises/math/functions/composition/index.js +1 -1
- package/lib/exercises/math/functions/exponential/algebraic/index.d.ts +0 -1
- package/lib/exercises/math/functions/exponential/algebraic/index.d.ts.map +1 -1
- package/lib/exercises/math/functions/exponential/algebraic/index.js +1 -1
- 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/geometric/index.d.ts +0 -3
- package/lib/exercises/math/sequences/geometric/index.d.ts.map +1 -1
- package/lib/exercises/math/sequences/geometric/index.js +3 -3
- package/lib/exercises/math/sequences/geometric/situations/index.d.ts +0 -1
- package/lib/exercises/math/sequences/geometric/situations/index.d.ts.map +1 -1
- package/lib/exercises/math/sequences/geometric/situations/index.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 -47
- 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,308 @@
|
|
|
1
|
+
import { addValidProp, propWhile, shuffleProps, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { blueMain, greenMain, orange, pinkMain, } from "../../../../geogebra/colors.js";
|
|
4
|
+
import { GeogebraConstructor } from "../../../../geogebra/geogebraConstructor.js";
|
|
5
|
+
import { Point } from "../../../../math/geometry/point.js";
|
|
6
|
+
import { nodeBySubstitutingVar } from "../../../../math/utils/functions/functionComposition.js";
|
|
7
|
+
import { randint } from "../../../../math/utils/random/randint.js";
|
|
8
|
+
import { NodeConstructor, } from "../../../../tree/nodes/nodeConstructor.js";
|
|
9
|
+
import { add } from "../../../../tree/nodes/operators/addNode.js";
|
|
10
|
+
import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
11
|
+
import { substract } from "../../../../tree/nodes/operators/substractNode.js";
|
|
12
|
+
import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
|
|
13
|
+
import { shuffle } from "../../../../utils/alea/shuffle.js";
|
|
14
|
+
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
15
|
+
import { alignTex } from "../../../../utils/latex/alignTex.js";
|
|
16
|
+
function createNodeFPolynomial(nodeA, arrNodeRoot) {
|
|
17
|
+
const nodeX = "x".toTree();
|
|
18
|
+
const nodePolynomial = arrNodeRoot.reduce((acc, nodeCoeff) => {
|
|
19
|
+
return multiply(acc, substract(nodeX, nodeCoeff));
|
|
20
|
+
}, nodeA);
|
|
21
|
+
return nodePolynomial;
|
|
22
|
+
}
|
|
23
|
+
const getInstruction = (identifiers) => {
|
|
24
|
+
const { nodeIdsXAsked } = identifiers;
|
|
25
|
+
const nodeXAsked = NodeConstructor.fromIdentifiers(nodeIdsXAsked);
|
|
26
|
+
return `Les courbes représentatives d'une fonction $f$ (en bleu) et de sa dérivée (en rose) sont tracées ci-dessous.
|
|
27
|
+
|
|
28
|
+
Déterminer l'équation de la tangente à la courbe de $f$ au point d'abscisse $${nodeXAsked.toTex()}$.`;
|
|
29
|
+
};
|
|
30
|
+
const getAnswerNode = (identifiers) => {
|
|
31
|
+
const { nodeIdsXAsked, nodeIdsF } = identifiers;
|
|
32
|
+
const nodeXAsked = NodeConstructor.fromIdentifiers(nodeIdsXAsked);
|
|
33
|
+
const nodeF = NodeConstructor.fromIdentifiers(nodeIdsF);
|
|
34
|
+
const nodeDerivative = nodeF.derivative().simplify();
|
|
35
|
+
const nodeValueImage = nodeBySubstitutingVar(nodeF, nodeXAsked, "x".toTree()).simplify();
|
|
36
|
+
const nodeValueDerivative = nodeBySubstitutingVar(nodeDerivative, nodeXAsked, "x".toTree()).simplify();
|
|
37
|
+
const nodeX = "x".toTree();
|
|
38
|
+
const nodeT = add(multiply(nodeValueDerivative, substract(nodeX, nodeXAsked)), nodeValueImage);
|
|
39
|
+
return nodeT;
|
|
40
|
+
};
|
|
41
|
+
const getAnswer = (identifiers) => {
|
|
42
|
+
return `y = ${getAnswerNode(identifiers)
|
|
43
|
+
.simplify({ towardsDistribute: true, forbidFactorize: true })
|
|
44
|
+
.toTex()}`;
|
|
45
|
+
};
|
|
46
|
+
const getHint = () => {
|
|
47
|
+
return `Si $f$ est une fonction dérivable en $a$, alors l'équation de la tangente à la courbe de $f$ au point d'abscisse $a$ est donné par:
|
|
48
|
+
|
|
49
|
+
$$
|
|
50
|
+
y = f'(a)(x-a)+f(a)
|
|
51
|
+
$$`;
|
|
52
|
+
};
|
|
53
|
+
const getCorrection = (identifiers) => {
|
|
54
|
+
const { nodeIdsXAsked, nodeIdsF } = identifiers;
|
|
55
|
+
const nodeXAsked = NodeConstructor.fromIdentifiers(nodeIdsXAsked);
|
|
56
|
+
const nodeF = NodeConstructor.fromIdentifiers(nodeIdsF);
|
|
57
|
+
const nodeDerivative = nodeF.derivative().simplify();
|
|
58
|
+
const nodeValueImage = nodeBySubstitutingVar(nodeF, nodeXAsked, "x".toTree()).simplify();
|
|
59
|
+
const nodeValueDerivative = nodeBySubstitutingVar(nodeDerivative, nodeXAsked, "x".toTree()).simplify();
|
|
60
|
+
const nodeT = getAnswerNode(identifiers);
|
|
61
|
+
return `L'équation de la tangente à la courbe de $f$ au point d'abscisse $a$ est donné par:
|
|
62
|
+
|
|
63
|
+
$$
|
|
64
|
+
y = f'(a)(x-a)+f(a)
|
|
65
|
+
$$
|
|
66
|
+
|
|
67
|
+
Ici, pour $a=${nodeXAsked.toTex()}$, on lit graphiquement :
|
|
68
|
+
|
|
69
|
+
$$
|
|
70
|
+
f'(${nodeXAsked.toTex()}) = ${nodeValueDerivative.toTex()}
|
|
71
|
+
$$
|
|
72
|
+
|
|
73
|
+
$$
|
|
74
|
+
f(${nodeXAsked.toTex()}) = ${nodeValueImage.toTex()}
|
|
75
|
+
$$
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
L'équation de la tangente en $${nodeXAsked.toTex()}$ est donc :
|
|
79
|
+
|
|
80
|
+
${alignTex([
|
|
81
|
+
["y", "=", nodeT.toTex()],
|
|
82
|
+
[
|
|
83
|
+
"",
|
|
84
|
+
"=",
|
|
85
|
+
nodeT.simplify({ towardsDistribute: true, forbidFactorize: true }).toTex(),
|
|
86
|
+
],
|
|
87
|
+
])}
|
|
88
|
+
`;
|
|
89
|
+
};
|
|
90
|
+
const getCorrectionGGBOptions = (identifiers) => {
|
|
91
|
+
const { nodeIdsXAsked, nodeIdsF } = identifiers;
|
|
92
|
+
const nodeXAsked = NodeConstructor.fromIdentifiers(nodeIdsXAsked);
|
|
93
|
+
const nodeF = NodeConstructor.fromIdentifiers(nodeIdsF);
|
|
94
|
+
const nodeDerivative = nodeF.derivative().simplify();
|
|
95
|
+
const nodeValueImage = nodeBySubstitutingVar(nodeF, nodeXAsked, "x".toTree()).simplify();
|
|
96
|
+
const nodeValueDerivative = nodeBySubstitutingVar(nodeDerivative, nodeXAsked, "x".toTree()).simplify();
|
|
97
|
+
const nodeTangent = getAnswerNode(identifiers).simplify();
|
|
98
|
+
const pointPAbscissa = new Point("Pab", nodeXAsked.evaluate(), 0);
|
|
99
|
+
const pointPf = new Point("Pf", nodeXAsked.evaluate(), nodeValueImage.evaluate());
|
|
100
|
+
const pointPfPrime = new Point("PfPrime", nodeXAsked.evaluate(), nodeValueDerivative.evaluate());
|
|
101
|
+
const ggb = new GeogebraConstructor({
|
|
102
|
+
commands: [
|
|
103
|
+
//function
|
|
104
|
+
`f(x) = ${nodeF.toMathString()}`,
|
|
105
|
+
`SetColor(f, "${blueMain}")`,
|
|
106
|
+
//derivative (chunks)
|
|
107
|
+
`fPrime(x) = ${nodeDerivative.toMathString()}`,
|
|
108
|
+
`SetColor(fPrime, "${pinkMain}")`,
|
|
109
|
+
//point on function
|
|
110
|
+
...pointPf.toGGBCommand({ showLabel: false, color: orange }),
|
|
111
|
+
//point on derivative
|
|
112
|
+
...pointPfPrime.toGGBCommand({ showLabel: false, color: orange }),
|
|
113
|
+
//tangent
|
|
114
|
+
`t(x) = ${nodeTangent.toMathString()}`,
|
|
115
|
+
`SetColor(t, "${greenMain}")`,
|
|
116
|
+
],
|
|
117
|
+
});
|
|
118
|
+
const points = [pointPAbscissa, pointPf, pointPfPrime];
|
|
119
|
+
const xAsked = nodeXAsked.evaluate();
|
|
120
|
+
const xMin = xAsked - 3;
|
|
121
|
+
const xMax = xAsked + 3;
|
|
122
|
+
const yMin = Math.min(...points.map((p) => p.y.evaluate())) - 1;
|
|
123
|
+
const yMax = Math.max(...points.map((p) => p.y.evaluate())) + 1;
|
|
124
|
+
return ggb.getOptions({
|
|
125
|
+
coords: [xMin, xMax, yMin, yMax],
|
|
126
|
+
});
|
|
127
|
+
};
|
|
128
|
+
const getGGBOptions = (identifiers) => {
|
|
129
|
+
const { nodeIdsXAsked, nodeIdsF } = identifiers;
|
|
130
|
+
const nodeXAsked = NodeConstructor.fromIdentifiers(nodeIdsXAsked);
|
|
131
|
+
const nodeF = NodeConstructor.fromIdentifiers(nodeIdsF);
|
|
132
|
+
const nodeDerivative = nodeF.derivative().simplify();
|
|
133
|
+
const nodeValueImage = nodeBySubstitutingVar(nodeF, nodeXAsked, "x".toTree()).simplify();
|
|
134
|
+
const nodeValueDerivative = nodeBySubstitutingVar(nodeDerivative, nodeXAsked, "x".toTree()).simplify();
|
|
135
|
+
const pointPAbscissa = new Point("Pab", nodeXAsked.evaluate(), 0);
|
|
136
|
+
const pointPf = new Point("Pf", nodeXAsked.evaluate(), nodeValueImage.evaluate());
|
|
137
|
+
const pointPfPrime = new Point("PfPrime", nodeXAsked.evaluate(), nodeValueDerivative.evaluate());
|
|
138
|
+
const ggb = new GeogebraConstructor({
|
|
139
|
+
commands: [
|
|
140
|
+
//function
|
|
141
|
+
`f(x) = ${nodeF.toMathString()}`,
|
|
142
|
+
`SetColor(f, "${blueMain}")`,
|
|
143
|
+
//derivative (chunks)
|
|
144
|
+
`fPrime(x) = ${nodeDerivative.toMathString()}`,
|
|
145
|
+
`SetColor(fPrime, "${pinkMain}")`,
|
|
146
|
+
],
|
|
147
|
+
});
|
|
148
|
+
const points = [pointPAbscissa, pointPf, pointPfPrime];
|
|
149
|
+
const xAsked = nodeXAsked.evaluate();
|
|
150
|
+
const xMin = xAsked - 3;
|
|
151
|
+
const xMax = xAsked + 3;
|
|
152
|
+
const yMin = Math.min(...points.map((p) => p.y.evaluate())) - 1;
|
|
153
|
+
const yMax = Math.max(...points.map((p) => p.y.evaluate())) + 1;
|
|
154
|
+
return ggb.getOptions({
|
|
155
|
+
coords: [xMin, xMax, yMin, yMax],
|
|
156
|
+
});
|
|
157
|
+
};
|
|
158
|
+
const getPropositions = (n, { answer, ...identifiers }) => {
|
|
159
|
+
const { nodeIdsXAsked, nodeIdsF } = identifiers;
|
|
160
|
+
const nodeXAsked = NodeConstructor.fromIdentifiers(nodeIdsXAsked);
|
|
161
|
+
const nodeF = NodeConstructor.fromIdentifiers(nodeIdsF);
|
|
162
|
+
const nodeDerivative = nodeF.derivative().simplify();
|
|
163
|
+
const nodeValueImage = nodeBySubstitutingVar(nodeF, nodeXAsked, "x".toTree()).simplify();
|
|
164
|
+
const nodeValueDerivative = nodeBySubstitutingVar(nodeDerivative, nodeXAsked, "x".toTree()).simplify();
|
|
165
|
+
//mandatory
|
|
166
|
+
const propositionsMandatory = [];
|
|
167
|
+
addValidProp(propositionsMandatory, answer);
|
|
168
|
+
//student: y=f'(a)x + f(a)
|
|
169
|
+
{
|
|
170
|
+
const nodeX = "x".toTree();
|
|
171
|
+
const nodeTWrong = add(multiply(nodeValueDerivative, nodeX), nodeValueImage);
|
|
172
|
+
const texWrong = `y = ${nodeTWrong
|
|
173
|
+
.simplify({ towardsDistribute: true, forbidFactorize: true })
|
|
174
|
+
.toTex()}`;
|
|
175
|
+
tryToAddWrongProp(propositionsMandatory, texWrong);
|
|
176
|
+
}
|
|
177
|
+
//filler
|
|
178
|
+
const propositionsFiller = [];
|
|
179
|
+
//student: y=f(a)(x-a) + f'(a)
|
|
180
|
+
//student: y=f'(a)(x-f(a)) + f(a)
|
|
181
|
+
//student: y=f(a)(x-f'(a)) + f'(a)
|
|
182
|
+
//etc.
|
|
183
|
+
{
|
|
184
|
+
[
|
|
185
|
+
[nodeXAsked, nodeValueDerivative, nodeValueDerivative],
|
|
186
|
+
[nodeXAsked, nodeValueImage, nodeValueImage],
|
|
187
|
+
[nodeXAsked, nodeValueDerivative, nodeValueImage],
|
|
188
|
+
[nodeXAsked, nodeValueDerivative, nodeXAsked],
|
|
189
|
+
[nodeXAsked, nodeValueImage, nodeXAsked],
|
|
190
|
+
[nodeValueImage, nodeValueImage, nodeValueDerivative],
|
|
191
|
+
].forEach(([nodeXAskedWrong, nodeValueImageWrong, nodeValueDerivativeWrong]) => {
|
|
192
|
+
const nodeX = "x".toTree();
|
|
193
|
+
const nodeTWrong = add(multiply(nodeValueDerivativeWrong, substract(nodeX, nodeXAskedWrong)), nodeValueImageWrong);
|
|
194
|
+
const texWrong = `y = ${nodeTWrong
|
|
195
|
+
.simplify({ towardsDistribute: true, forbidFactorize: true })
|
|
196
|
+
.toTex()}`;
|
|
197
|
+
tryToAddWrongProp(propositionsFiller, texWrong);
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
propWhile(propositionsFiller, n, () => {
|
|
201
|
+
const identifiersWrong = createRandomIdentifiers();
|
|
202
|
+
tryToAddWrongProp(propositionsFiller, getAnswer(identifiersWrong));
|
|
203
|
+
});
|
|
204
|
+
return shuffle([
|
|
205
|
+
...propositionsMandatory,
|
|
206
|
+
...shuffleProps(propositionsFiller.filter((propositionFiller) => !propositionsMandatory
|
|
207
|
+
.map((proposition) => proposition.statement)
|
|
208
|
+
.includes(propositionFiller.statement)), n - propositionsMandatory.length),
|
|
209
|
+
]);
|
|
210
|
+
};
|
|
211
|
+
const isAnswerValid = (ans, { answer, ...identifiers }) => {
|
|
212
|
+
try {
|
|
213
|
+
const ansRefined = (() => {
|
|
214
|
+
const arrComponents = ans.split("=");
|
|
215
|
+
if (arrComponents.length === 1) {
|
|
216
|
+
return arrComponents[0];
|
|
217
|
+
}
|
|
218
|
+
else {
|
|
219
|
+
return arrComponents[1];
|
|
220
|
+
}
|
|
221
|
+
})();
|
|
222
|
+
const nodeAns = parseAlgebraic(ansRefined);
|
|
223
|
+
const nodeAnswer = getAnswerNode(identifiers).simplify();
|
|
224
|
+
return substract(nodeAns, nodeAnswer).evaluate({ x: 1 }) === 0;
|
|
225
|
+
}
|
|
226
|
+
catch (err) {
|
|
227
|
+
return handleVEAError(err);
|
|
228
|
+
}
|
|
229
|
+
};
|
|
230
|
+
const createRandomIdentifiers = () => {
|
|
231
|
+
//q(x) = a(x-x1)(x-x2)(x-x3)(x-x4)(x-x5)
|
|
232
|
+
//q'(x)= a(1)(x-x2)(x-x3)(x-x4)(x-x5) + a(x-x1)(1)(x-x3)(x-x4)(x-x5) + a(x-x1)(x-x2)(1)(x-x4)(x-x5) + a(x-x1)(x-x2)(x-x3)(1)(x-x5) + a(x-x1)(x-x2)(x-x3)(x-x4)(1)
|
|
233
|
+
//we need to have roots "really close" to xAsked so that q(xAsked) and q'(xAsked) are "easy numbers"
|
|
234
|
+
//expl: around 4
|
|
235
|
+
//q(x) = a(x-3)(x-3)(x-5)(x-5)(x-6)
|
|
236
|
+
//q(4) = -2a
|
|
237
|
+
//q'(x)= a(1)(x-3)(x-5)(x-5)(x-6) + a(x-3)(1)(x-5)(x-5)(x-6) + a(x-3)(x-3)(1)(x-5)(x-6) + a(x-3)(x-3)(x-5)(1)(x-6) + a(x-3)(x-3)(x-5)(x-5)(1)
|
|
238
|
+
//q'(4)= (-2a) + (-2a) + (2a) + (2a) + a
|
|
239
|
+
//q'(4)= a
|
|
240
|
+
const xAsked = randint(-5, 6);
|
|
241
|
+
const nodeA = randint(-4, 5, [0]).toTree();
|
|
242
|
+
// const [x1, x2, x3, x4, x5] = [
|
|
243
|
+
// xAsked - 1,
|
|
244
|
+
// xAsked - 1,
|
|
245
|
+
// xAsked + 1,
|
|
246
|
+
// xAsked + 1,
|
|
247
|
+
// xAsked + 2,
|
|
248
|
+
// ];
|
|
249
|
+
const [x1, x2, x3, x4, x5] = (() => {
|
|
250
|
+
const rand = randint(0, 6);
|
|
251
|
+
switch (rand) {
|
|
252
|
+
case 0:
|
|
253
|
+
return [xAsked - 0.5, xAsked + 0.5, xAsked - 1, xAsked + 1, xAsked + 1];
|
|
254
|
+
case 1:
|
|
255
|
+
return [xAsked - 0.5, xAsked + 0.5, xAsked - 1, xAsked + 1, xAsked - 1];
|
|
256
|
+
case 2:
|
|
257
|
+
return [xAsked - 0.5, xAsked + 0.5, xAsked - 1, xAsked + 1, xAsked + 2];
|
|
258
|
+
case 3:
|
|
259
|
+
return [xAsked - 0.5, xAsked + 0.5, xAsked - 1, xAsked + 1, xAsked - 2];
|
|
260
|
+
case 4:
|
|
261
|
+
return [xAsked - 1, xAsked + 1, xAsked - 1, xAsked + 1, xAsked - 0.5];
|
|
262
|
+
case 5:
|
|
263
|
+
return [xAsked - 1, xAsked + 1, xAsked - 1, xAsked + 1, xAsked + 0.5];
|
|
264
|
+
default:
|
|
265
|
+
throw new Error("Unsupported rand: " + rand);
|
|
266
|
+
}
|
|
267
|
+
})();
|
|
268
|
+
const arrNodeRoot = [x1, x2, x3, x4, x5].map((x) => x.toTree());
|
|
269
|
+
const nodeQuintic = createNodeFPolynomial(nodeA, arrNodeRoot);
|
|
270
|
+
// const nodeQuadratic = nodeQuintic.derivative();
|
|
271
|
+
const identifiers = {
|
|
272
|
+
nodeIdsXAsked: xAsked.toTree().toIdentifiers(),
|
|
273
|
+
nodeIdsF: nodeQuintic.toIdentifiers(),
|
|
274
|
+
};
|
|
275
|
+
return identifiers;
|
|
276
|
+
};
|
|
277
|
+
const getTangentEquationFromGraphQuestion = () => {
|
|
278
|
+
const identifiers = createRandomIdentifiers();
|
|
279
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
280
|
+
};
|
|
281
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
282
|
+
const question = {
|
|
283
|
+
answer: getAnswer(identifiers),
|
|
284
|
+
instruction: getInstruction(identifiers),
|
|
285
|
+
keys: ["y", "x", "equal"],
|
|
286
|
+
answerFormat: "tex",
|
|
287
|
+
identifiers,
|
|
288
|
+
hint: getHint(identifiers),
|
|
289
|
+
correction: getCorrection(identifiers),
|
|
290
|
+
correctionGgbOptions: getCorrectionGGBOptions(identifiers),
|
|
291
|
+
ggbOptions: getGGBOptions(identifiers),
|
|
292
|
+
};
|
|
293
|
+
return question;
|
|
294
|
+
};
|
|
295
|
+
export const tangentEquationFromGraph = {
|
|
296
|
+
id: "tangentEquationFromGraph",
|
|
297
|
+
label: "Déterminer l'équation d'une tangente en un point donné, à partir de la courbe d'une fonction et de celle de sa dérivée",
|
|
298
|
+
isSingleStep: true,
|
|
299
|
+
generator: (nb) => getDistinctQuestions(getTangentEquationFromGraphQuestion, nb),
|
|
300
|
+
qcmTimer: 60,
|
|
301
|
+
freeTimer: 60,
|
|
302
|
+
getPropositions,
|
|
303
|
+
isAnswerValid,
|
|
304
|
+
subject: "Mathématiques",
|
|
305
|
+
hasHintAndCorrection: true,
|
|
306
|
+
getQuestionFromIdentifiers,
|
|
307
|
+
hasGeogebra: true,
|
|
308
|
+
};
|
package/lib/exercises/math/derivation/variations/findAbscissaOfExtremaFromFunctionExpression.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { NodeIdentifiers } from "../../../../tree/nodes/nodeConstructor.js";
|
|
3
|
+
type Identifiers = {
|
|
4
|
+
nodeIdsF: NodeIdentifiers;
|
|
5
|
+
typeF: string;
|
|
6
|
+
typeRoots: string;
|
|
7
|
+
};
|
|
8
|
+
type Options = {
|
|
9
|
+
typeF: string;
|
|
10
|
+
typeRoots: string;
|
|
11
|
+
};
|
|
12
|
+
export declare const findAbscissaOfExtremaFromFunctionExpression: Exercise<Identifiers, Options>;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=findAbscissaOfExtremaFromFunctionExpression.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"findAbscissaOfExtremaFromFunctionExpression.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/variations/findAbscissaOfExtremaFromFunctionExpression.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAiBT,MAAM,6BAA6B,CAAC;AAOrC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AA4R7C,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,eAAe,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAiNF,KAAK,OAAO,GAAG;IACb,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAyCF,eAAO,MAAM,2CAA2C,EAAE,QAAQ,CAChE,WAAW,EACX,OAAO,CAqBR,CAAC"}
|