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,328 @@
|
|
|
1
|
+
import { addValidProp, tryToAddWrongProp, propWhile, GeneratorOptionTarget, GeneratorOptionType, } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { numberVEA } from "../../../../exercises/vea/numberVEA.js";
|
|
4
|
+
import { blueMain, orange, red } from "../../../../geogebra/colors.js";
|
|
5
|
+
import { GeogebraConstructor } from "../../../../geogebra/geogebraConstructor.js";
|
|
6
|
+
import { Point } from "../../../../math/geometry/point.js";
|
|
7
|
+
import { nodeBySubstitutingVar } from "../../../../math/utils/functions/functionComposition.js";
|
|
8
|
+
import { createArrNodeCoeffCubic, PointOfFunction, PointOfFunctionConstructor, } from "../../../../math/utils/polynomial/polynomialInterpolationUtils.js";
|
|
9
|
+
import { createNodeFPolynomialFromCoeffs, createNodeFPolynomialFromRoots, getAnswerStuffSolveSecondDegreePolynomial, getArrNodeCoeffOfPolynomialNode, getTexSolveSecondDegreeEquation, } from "../../../../math/utils/polynomial/polynomialUtils.js";
|
|
10
|
+
import { randfloat } from "../../../../math/utils/random/randfloat.js";
|
|
11
|
+
import { randint } from "../../../../math/utils/random/randint.js";
|
|
12
|
+
import { round } from "../../../../math/utils/round.js";
|
|
13
|
+
import { NodeConstructor, } from "../../../../tree/nodes/nodeConstructor.js";
|
|
14
|
+
import { coinFlip } from "../../../../utils/alea/coinFlip.js";
|
|
15
|
+
import { probaFlip } from "../../../../utils/alea/probaFlip.js";
|
|
16
|
+
import { random } from "../../../../utils/alea/random.js";
|
|
17
|
+
import { shuffle } from "../../../../utils/alea/shuffle.js";
|
|
18
|
+
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
19
|
+
const getInstruction = (identifiers) => {
|
|
20
|
+
const { nodeIdsF, boundPHigh } = identifiers;
|
|
21
|
+
const nodeF = NodeConstructor.fromIdentifiers(nodeIdsF);
|
|
22
|
+
return `On note $b(p)$ le bénéfice journalier (en $\\textrm{€}$) d'une entreprise en fonction du nombre d'objets $p$ qu'elle produit ce même jour.
|
|
23
|
+
L'entreprise peut produire au maximum $${boundPHigh.frenchify()}$ produits par jour.
|
|
24
|
+
|
|
25
|
+
On a :
|
|
26
|
+
|
|
27
|
+
$$
|
|
28
|
+
b(p) = ${nodeBySubstitutingVar(nodeF, "p".toTree(), "x".toTree()).toTex()}
|
|
29
|
+
$$
|
|
30
|
+
|
|
31
|
+
Déterminer pour quelle production $p$ elle réalise son bénéfice maximal.`;
|
|
32
|
+
};
|
|
33
|
+
const getAnswerStuff = (identifiers) => {
|
|
34
|
+
const { nodeIdsF, boundPHigh } = identifiers;
|
|
35
|
+
const nodeF = NodeConstructor.fromIdentifiers(nodeIdsF);
|
|
36
|
+
const nodeDerivative = nodeF.derivative();
|
|
37
|
+
const { nodePolynomial, arrNodeX } = getAnswerStuffSolveSecondDegreePolynomial(nodeDerivative);
|
|
38
|
+
const points = (() => {
|
|
39
|
+
const arrX = arrNodeX.map((node) => node.evaluate());
|
|
40
|
+
return [...arrX, boundPHigh].map((x, i) => new Point(`P${i}`, x, nodeF.evaluate({ x })));
|
|
41
|
+
})();
|
|
42
|
+
return { nodePolynomial, arrNodeX, points };
|
|
43
|
+
};
|
|
44
|
+
const getAnswerNode = (identifiers) => {
|
|
45
|
+
const { boundPHigh } = identifiers;
|
|
46
|
+
const { points } = getAnswerStuff(identifiers);
|
|
47
|
+
const pointsWithPossibleX = points.filter((point) => point.x.evaluate() <= boundPHigh);
|
|
48
|
+
const pointsWithPossibleXSortedYDesc = pointsWithPossibleX.toSorted(({ y: nodeY1 }, { y: nodeY2 }) => nodeY2.evaluate() - nodeY1.evaluate());
|
|
49
|
+
const nodeInteger = round(pointsWithPossibleXSortedYDesc[0].x.evaluate(), 0).toTree();
|
|
50
|
+
return nodeInteger;
|
|
51
|
+
};
|
|
52
|
+
const getAnswer = (identifiers) => {
|
|
53
|
+
return getAnswerNode(identifiers).toTex();
|
|
54
|
+
};
|
|
55
|
+
const getHint = () => {
|
|
56
|
+
return `Recherche les extrémums de la fonction $b$. Déduis-en la production pour laquelle le bénéfice est maximal. Attention, la production est limitée.`;
|
|
57
|
+
};
|
|
58
|
+
const getCorrection = (identifiers) => {
|
|
59
|
+
const { nodeIdsF, typeF, boundPHigh } = identifiers;
|
|
60
|
+
const nodeF = NodeConstructor.fromIdentifiers(nodeIdsF);
|
|
61
|
+
const nodeDerivative = nodeF.derivative();
|
|
62
|
+
switch (typeF) {
|
|
63
|
+
case "polynôme (degré $2$)": {
|
|
64
|
+
return `Le maximum théorique est atteint à l'abscisse $p_M$ telle que $b'(p_M) = 0$.
|
|
65
|
+
|
|
66
|
+
$b$ est continue et dérivable. On calcule :
|
|
67
|
+
|
|
68
|
+
$$
|
|
69
|
+
b'(p) = ${nodeBySubstitutingVar(nodeDerivative.simplify(), "p".toTree(), "x".toTree()).toTex()}
|
|
70
|
+
$$
|
|
71
|
+
|
|
72
|
+
On résout $b'(p)=0$ :
|
|
73
|
+
|
|
74
|
+
${getTexSolveSecondDegreeEquation(nodeDerivative, {
|
|
75
|
+
nodeVar: "p".toTree(),
|
|
76
|
+
isShouldApprox: true,
|
|
77
|
+
})}
|
|
78
|
+
|
|
79
|
+
On a trouvé un extrémum.
|
|
80
|
+
C'est un maximum car le signe du coefficient de $p^2$ est négatif.
|
|
81
|
+
|
|
82
|
+
Il faut faire attention à ce que $p$ est, en réalité, compris entre $0$ et $${boundPHigh}$.
|
|
83
|
+
|
|
84
|
+
Le maximum est donc atteint à l'abscisse $${getAnswer(identifiers)}$.`;
|
|
85
|
+
}
|
|
86
|
+
case "polynôme (degré $3$)": {
|
|
87
|
+
const [_nodeD, _nodeC, _nodeB, nodeA] = getArrNodeCoeffOfPolynomialNode(nodeF);
|
|
88
|
+
const isX3CoeffPositive = nodeA.evaluate() > 0;
|
|
89
|
+
return `Le maximum théorique est atteint à l'abscisse $p_M$ telle que $b'(p_M) = 0$.
|
|
90
|
+
|
|
91
|
+
$b$ est continue et dérivable. On calcule :
|
|
92
|
+
|
|
93
|
+
$$
|
|
94
|
+
b'(p) = ${nodeBySubstitutingVar(nodeDerivative.simplify(), "p".toTree(), "x".toTree()).toTex()}
|
|
95
|
+
$$
|
|
96
|
+
|
|
97
|
+
On résout $b'(p)=0$ :
|
|
98
|
+
|
|
99
|
+
${getTexSolveSecondDegreeEquation(nodeDerivative, {
|
|
100
|
+
nodeVar: "p".toTree(),
|
|
101
|
+
isShouldApprox: true,
|
|
102
|
+
})}
|
|
103
|
+
|
|
104
|
+
Dans $b(p)$, le coefficient en $p^3$ est ${isX3CoeffPositive ? "positif" : "négatif"}.
|
|
105
|
+
Donc les extrémums seront rangés dans cet ordre sur l'axe des abscisses :
|
|
106
|
+
${isX3CoeffPositive
|
|
107
|
+
? `maximum local puis minimum local`
|
|
108
|
+
: `minimum local puis maximum local`}
|
|
109
|
+
|
|
110
|
+
Il faut faire attention à ce que $p$ est, en réalité, compris entre $0$ et $${boundPHigh}$.
|
|
111
|
+
|
|
112
|
+
Le maximum est donc atteint à l'abscisse $${getAnswer(identifiers)}$.`;
|
|
113
|
+
}
|
|
114
|
+
default:
|
|
115
|
+
throw new Error("Unsupported typeF: " + typeF);
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
const getCorrectionGGBOptions = (identifiers) => {
|
|
119
|
+
const { nodeIdsF, pofIds, boundPHigh } = identifiers;
|
|
120
|
+
const nodeF = NodeConstructor.fromIdentifiers(nodeIdsF);
|
|
121
|
+
const arrPOF = pofIds.map((pofIds) => PointOfFunctionConstructor.fromIdentifiers(pofIds));
|
|
122
|
+
const pointBoundPHigh = new Point("P", boundPHigh, nodeF.evaluate({ x: boundPHigh }));
|
|
123
|
+
const { points } = getAnswerStuff(identifiers);
|
|
124
|
+
const maxX = Math.max(...points.map((point) => point.x.evaluate()));
|
|
125
|
+
const maxY = Math.max(...points.map((point) => point.y.evaluate()));
|
|
126
|
+
const ggb = new GeogebraConstructor({
|
|
127
|
+
commands: [
|
|
128
|
+
//function
|
|
129
|
+
`f(x) = ${nodeF.toMathString()}`,
|
|
130
|
+
`SetColor(f, "${blueMain}")`,
|
|
131
|
+
`SetCaption(f, "$\\mathcal C_b$")`,
|
|
132
|
+
`ShowLabel(f, true)`,
|
|
133
|
+
//points with tangents
|
|
134
|
+
...arrPOF.flatMap((pof, i) => {
|
|
135
|
+
const a = pof.nodeAbscissa.evaluate();
|
|
136
|
+
const u = pof.nodeValue.evaluate();
|
|
137
|
+
const v = pof.nodeDerivative.evaluate();
|
|
138
|
+
return [
|
|
139
|
+
`t${i}(x) = Function(${u} + ${v}(x-${a}), ${a} - 2, ${a} + 2)`,
|
|
140
|
+
`SetColor(t${i}, "${orange}")`,
|
|
141
|
+
`P${i} = Point({${a}, ${u}})`,
|
|
142
|
+
`SetFixed(P${i}, false, false)`,
|
|
143
|
+
`SetColor(P${i}, "${orange}")`,
|
|
144
|
+
];
|
|
145
|
+
}),
|
|
146
|
+
//maxP
|
|
147
|
+
`lMax = Line((${boundPHigh}, 0), (${boundPHigh}, 1))`,
|
|
148
|
+
`SetColor(lMax, "${red}")`,
|
|
149
|
+
`SetCaption(lMax, "$x = ${boundPHigh}$")`,
|
|
150
|
+
`ShowLabel(lMax, true)`,
|
|
151
|
+
//maxP
|
|
152
|
+
...pointBoundPHigh.toGGBCommand({
|
|
153
|
+
isFixed: true,
|
|
154
|
+
isSelectionnable: true,
|
|
155
|
+
showLabel: false,
|
|
156
|
+
style: 1,
|
|
157
|
+
size: 5,
|
|
158
|
+
color: orange,
|
|
159
|
+
}),
|
|
160
|
+
],
|
|
161
|
+
lockedAxesRatio: maxX / maxY,
|
|
162
|
+
});
|
|
163
|
+
return ggb.getOptions({
|
|
164
|
+
coords: ggb.getCoordsForPoints([
|
|
165
|
+
...arrPOF.map((pof, i) => new Point(`P${i}`, pof.nodeAbscissa, pof.nodeValue)),
|
|
166
|
+
pointBoundPHigh,
|
|
167
|
+
]),
|
|
168
|
+
});
|
|
169
|
+
};
|
|
170
|
+
const getPropositions = (n, { answer, ...identifiers }) => {
|
|
171
|
+
const { typeF } = identifiers;
|
|
172
|
+
const propositions = [];
|
|
173
|
+
addValidProp(propositions, answer);
|
|
174
|
+
propWhile(propositions, n, () => {
|
|
175
|
+
const identifierWrong = createRandomIdentifiers(typeF);
|
|
176
|
+
tryToAddWrongProp(propositions, getAnswer(identifierWrong));
|
|
177
|
+
});
|
|
178
|
+
return shuffle(propositions);
|
|
179
|
+
};
|
|
180
|
+
const getKeys = () => {
|
|
181
|
+
return [];
|
|
182
|
+
};
|
|
183
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
184
|
+
try {
|
|
185
|
+
return numberVEA(ans, answer);
|
|
186
|
+
}
|
|
187
|
+
catch (err) {
|
|
188
|
+
return handleVEAError(err);
|
|
189
|
+
}
|
|
190
|
+
};
|
|
191
|
+
const createRandomIdentifiers = (typeF) => {
|
|
192
|
+
const baseP = randint(100, 500);
|
|
193
|
+
// const height = randint(200, 5000);
|
|
194
|
+
const basePOver3 = Math.floor(baseP / 3);
|
|
195
|
+
const isXForMaxGreaterThanBoundPHigh = probaFlip(0.24);
|
|
196
|
+
const [nodeF, boundPHigh, arrPOF] = (() => {
|
|
197
|
+
switch (typeF) {
|
|
198
|
+
case "polynôme (degré $2$)": {
|
|
199
|
+
//roots
|
|
200
|
+
const a = basePOver3;
|
|
201
|
+
const b = (() => {
|
|
202
|
+
const bCandidate = Math.floor(2 * basePOver3);
|
|
203
|
+
//ensure b-a %2 === 0
|
|
204
|
+
return (bCandidate - a) % 2 === 0 ? bCandidate : bCandidate + 1;
|
|
205
|
+
})();
|
|
206
|
+
const xForMax = (a + b) / 2;
|
|
207
|
+
const arrNodeX = [a, b].map((v) => v.toTree());
|
|
208
|
+
// const nodeU = opposite(frac(multiply(4, height), power(b - a, 2)));
|
|
209
|
+
const nodeU = (-1).toTree();
|
|
210
|
+
const nodeF = createNodeFPolynomialFromRoots(nodeU, arrNodeX);
|
|
211
|
+
const boundPHigh = isXForMaxGreaterThanBoundPHigh
|
|
212
|
+
? randint(a + 1, xForMax)
|
|
213
|
+
: randint(xForMax + 1, 2 * xForMax);
|
|
214
|
+
const pof1 = new PointOfFunction(xForMax.toTree(), nodeF.evaluate({ x: xForMax }).toTree(), (0).toTree());
|
|
215
|
+
return [nodeF, boundPHigh, [pof1]];
|
|
216
|
+
}
|
|
217
|
+
case "polynôme (degré $3$)": {
|
|
218
|
+
//hermite
|
|
219
|
+
const [pof1, pof2, maxP] = (() => {
|
|
220
|
+
const isX3CoeffPositive = coinFlip();
|
|
221
|
+
if (isX3CoeffPositive) {
|
|
222
|
+
const x1 = basePOver3;
|
|
223
|
+
const x2 = (() => {
|
|
224
|
+
const x2Candidate = x1 + basePOver3;
|
|
225
|
+
//ensure x2-x1 %2 === 0
|
|
226
|
+
return (x2Candidate - x1) % 2 === 0
|
|
227
|
+
? x2Candidate
|
|
228
|
+
: x2Candidate + 1;
|
|
229
|
+
})();
|
|
230
|
+
const height = (((x2 - x1) ^ 2) / 4) * 1000;
|
|
231
|
+
const low = -height * randfloat(0.8, 1.2, 3);
|
|
232
|
+
const pof1 = new PointOfFunction(x1.toTree(), height.toTree(), (0).toTree());
|
|
233
|
+
const pof2 = new PointOfFunction(x2.toTree(), low.toTree(), (0).toTree());
|
|
234
|
+
const xForMax = x1;
|
|
235
|
+
const xForMin = x2;
|
|
236
|
+
const boundPHigh = isXForMaxGreaterThanBoundPHigh
|
|
237
|
+
? randint(xForMax - 20, xForMax)
|
|
238
|
+
: randint(Math.floor((xForMax + xForMin) / 2), xForMin + 30);
|
|
239
|
+
return [pof1, pof2, boundPHigh];
|
|
240
|
+
}
|
|
241
|
+
else {
|
|
242
|
+
//ensure p(0) < pMax
|
|
243
|
+
const x1 = randint(-basePOver3, basePOver3);
|
|
244
|
+
const x2 = (() => {
|
|
245
|
+
const x2Candidate = x1 + basePOver3;
|
|
246
|
+
//ensure x2-x1 %2 === 0
|
|
247
|
+
return (x2Candidate - x1) % 2 === 0
|
|
248
|
+
? x2Candidate
|
|
249
|
+
: x2Candidate + 1;
|
|
250
|
+
})();
|
|
251
|
+
const height = (((x2 - x1) ^ 2) / 4) * 1000;
|
|
252
|
+
const low = -height * randfloat(0.8, 1.2, 3);
|
|
253
|
+
const pof1 = new PointOfFunction(x1.toTree(), low.toTree(), (0).toTree());
|
|
254
|
+
const pof2 = new PointOfFunction(x2.toTree(), height.toTree(), (0).toTree());
|
|
255
|
+
const _xForMin = x1;
|
|
256
|
+
const xForMax = x2;
|
|
257
|
+
const boundPHigh = isXForMaxGreaterThanBoundPHigh
|
|
258
|
+
? randint(xForMax - 20, xForMax)
|
|
259
|
+
: randint(Math.floor((xForMax + baseP) / 2), baseP);
|
|
260
|
+
return [pof1, pof2, boundPHigh];
|
|
261
|
+
}
|
|
262
|
+
})();
|
|
263
|
+
const arrNodeCoeff = createArrNodeCoeffCubic(pof1, pof2);
|
|
264
|
+
const nodeF = createNodeFPolynomialFromCoeffs(arrNodeCoeff);
|
|
265
|
+
return [nodeF, maxP, [pof1, pof2]];
|
|
266
|
+
}
|
|
267
|
+
default:
|
|
268
|
+
throw new Error("Unsupported typeF: " + typeF);
|
|
269
|
+
}
|
|
270
|
+
})();
|
|
271
|
+
//rounding
|
|
272
|
+
const arrNodeCoeffRounded = getArrNodeCoeffOfPolynomialNode(nodeF).map((node) => round(node.evaluate(), 2).toTree());
|
|
273
|
+
const nodeFRoundedExpanded = createNodeFPolynomialFromCoeffs(arrNodeCoeffRounded);
|
|
274
|
+
const identifiers = {
|
|
275
|
+
nodeIdsF: nodeFRoundedExpanded.toIdentifiers(),
|
|
276
|
+
pofIds: arrPOF.map((pof) => pof.toIdentifiers()),
|
|
277
|
+
boundPHigh,
|
|
278
|
+
typeF,
|
|
279
|
+
};
|
|
280
|
+
return identifiers;
|
|
281
|
+
};
|
|
282
|
+
const getProblemMaximizeProfitFindProductionQuestion = (optsIn) => {
|
|
283
|
+
const arrayedOptions = optsIn ?? arrayedOptsDefault;
|
|
284
|
+
const typeF = random(arrayedOptions.typeF);
|
|
285
|
+
const identifiers = createRandomIdentifiers(typeF);
|
|
286
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
287
|
+
};
|
|
288
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
289
|
+
return {
|
|
290
|
+
answer: getAnswer(identifiers),
|
|
291
|
+
instruction: getInstruction(identifiers),
|
|
292
|
+
keys: getKeys(identifiers),
|
|
293
|
+
answerFormat: "tex",
|
|
294
|
+
identifiers,
|
|
295
|
+
hint: getHint(identifiers),
|
|
296
|
+
correction: getCorrection(identifiers),
|
|
297
|
+
correctionGgbOptions: getCorrectionGGBOptions(identifiers),
|
|
298
|
+
};
|
|
299
|
+
};
|
|
300
|
+
const arrayedOptsDefault = {
|
|
301
|
+
typeF: ["polynôme (degré $2$)", "polynôme (degré $3$)"],
|
|
302
|
+
};
|
|
303
|
+
const options = [
|
|
304
|
+
{
|
|
305
|
+
id: "typeF",
|
|
306
|
+
label: "Type de fonction",
|
|
307
|
+
target: GeneratorOptionTarget.generation,
|
|
308
|
+
type: GeneratorOptionType.multiselect,
|
|
309
|
+
values: ["polynôme (degré $2$)", "polynôme (degré $3$)"],
|
|
310
|
+
defaultValue: arrayedOptsDefault.typeF,
|
|
311
|
+
},
|
|
312
|
+
];
|
|
313
|
+
export const problemMaximizeProfitFindProduction = {
|
|
314
|
+
id: "problemMaximizeProfitFindProduction",
|
|
315
|
+
connector: "=",
|
|
316
|
+
label: "Déterminer la production qui maximise le bénéfice",
|
|
317
|
+
isSingleStep: true,
|
|
318
|
+
generator: (nb, opts) => getDistinctQuestions(() => getProblemMaximizeProfitFindProductionQuestion(opts), nb),
|
|
319
|
+
options,
|
|
320
|
+
subject: "Mathématiques",
|
|
321
|
+
getInstruction,
|
|
322
|
+
getHint,
|
|
323
|
+
getCorrection,
|
|
324
|
+
isAnswerValid,
|
|
325
|
+
getPropositions,
|
|
326
|
+
getQuestionFromIdentifiers,
|
|
327
|
+
hasHintAndCorrection: true,
|
|
328
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { NodeIdentifiers } from "../../../../tree/nodes/nodeConstructor.js";
|
|
3
|
+
type Identifiers = {
|
|
4
|
+
nodeIdsF: NodeIdentifiers;
|
|
5
|
+
nodeIdsValueFunction: NodeIdentifiers;
|
|
6
|
+
typeF: string;
|
|
7
|
+
};
|
|
8
|
+
type Options = {
|
|
9
|
+
typeF: string;
|
|
10
|
+
};
|
|
11
|
+
export declare const problemMovementOnLineFindSpeedAtPoint: Exercise<Identifiers, Options>;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=problemMovementOnLineFindSpeedAtPoint.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"problemMovementOnLineFindSpeedAtPoint.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/problems/problemMovementOnLineFindSpeedAtPoint.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAiBT,MAAM,6BAA6B,CAAC;AASrC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AA0E7C,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,eAAe,CAAC;IAC1B,oBAAoB,EAAE,eAAe,CAAC;IACtC,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAwOF,KAAK,OAAO,GAAG;IACb,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAoCF,eAAO,MAAM,qCAAqC,EAAE,QAAQ,CAC1D,WAAW,EACX,OAAO,CAqBR,CAAC"}
|
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
import { addValidProp, tryToAddWrongProp, propWhile, GeneratorOptionTarget, GeneratorOptionType, } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { AffineConstructor } from "../../../../math/polynomials/affine.js";
|
|
4
|
+
import { nodeBySubstitutingVar } from "../../../../math/utils/functions/functionComposition.js";
|
|
5
|
+
import { getArrNodeCoeffOfPolynomialNode } from "../../../../math/utils/polynomial/polynomialUtils.js";
|
|
6
|
+
import { randint } from "../../../../math/utils/random/randint.js";
|
|
7
|
+
import { round } from "../../../../math/utils/round.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 } 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 { random } from "../../../../utils/alea/random.js";
|
|
16
|
+
import { shuffle } from "../../../../utils/alea/shuffle.js";
|
|
17
|
+
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
18
|
+
import { alignTex } from "../../../../utils/latex/alignTex.js";
|
|
19
|
+
/*
|
|
20
|
+
What is f'(a) if f(x)=... and f(a)=... ?
|
|
21
|
+
1. compute a
|
|
22
|
+
2. compute f'(x)
|
|
23
|
+
3. compute f'(a)
|
|
24
|
+
*/
|
|
25
|
+
const nodeVarTify = (node) => {
|
|
26
|
+
const nodeVarX = "x".toTree();
|
|
27
|
+
const nodeVarT = "t".toTree();
|
|
28
|
+
return nodeBySubstitutingVar(node, nodeVarT, nodeVarX);
|
|
29
|
+
};
|
|
30
|
+
const getNodeFForTypeF = (typeF) => {
|
|
31
|
+
const nodeVarX = "x".toTree();
|
|
32
|
+
switch (typeF) {
|
|
33
|
+
case "polynôme (degré $1$)":
|
|
34
|
+
return AffineConstructor.random().toTree();
|
|
35
|
+
case "$\\frac{k}{t}$": {
|
|
36
|
+
const k = randint(-10, 11, [0]);
|
|
37
|
+
return frac(k, nodeVarX);
|
|
38
|
+
}
|
|
39
|
+
case "$\\frac{at+b}{ct+d}$": {
|
|
40
|
+
const [nodeNum, nodeDen] = AffineConstructor.differentRandoms(2).map((affine) => affine.toTree());
|
|
41
|
+
return frac(nodeNum, nodeDen);
|
|
42
|
+
}
|
|
43
|
+
case "$k\\sqrt{t}$": {
|
|
44
|
+
const k = randint(-10, 11, [0]);
|
|
45
|
+
return multiply(k, sqrt(nodeVarX));
|
|
46
|
+
}
|
|
47
|
+
default:
|
|
48
|
+
throw new Error("Unsupported typeF: " + typeF);
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
const getPrettyDerivativeNode = (nodeF) => {
|
|
52
|
+
const nodeDerivativeRaw = nodeF.derivative().simplify();
|
|
53
|
+
if (isFractionNode(nodeDerivativeRaw)) {
|
|
54
|
+
const nodeNumSimplified = nodeDerivativeRaw.leftChild.simplify({
|
|
55
|
+
towardsDistribute: true,
|
|
56
|
+
forbidFactorize: true,
|
|
57
|
+
});
|
|
58
|
+
const nodeDenSimplified = nodeDerivativeRaw.rightChild.simplify();
|
|
59
|
+
return frac(nodeNumSimplified, nodeDenSimplified);
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
return nodeDerivativeRaw;
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
const getInstruction = (identifiers) => {
|
|
66
|
+
const { nodeIdsValueFunction, nodeIdsF } = identifiers;
|
|
67
|
+
const [nodeValueFunction, nodeF] = [nodeIdsValueFunction, nodeIdsF].map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds));
|
|
68
|
+
return `Un solide a une trajectoire rectiligne.
|
|
69
|
+
Soit $x$ la fonction qui donne sa position en fonction du temps $t$ :
|
|
70
|
+
|
|
71
|
+
$$
|
|
72
|
+
x(t) = ${nodeVarTify(nodeF).toTex()}
|
|
73
|
+
$$
|
|
74
|
+
|
|
75
|
+
Déterminer la vitesse instantanée du solide à la position $x=${nodeValueFunction.toTex()}$ (donner une valeur approchée à $2$ décimales près)`;
|
|
76
|
+
};
|
|
77
|
+
const getAnswerStuff = (identifiers) => {
|
|
78
|
+
const { nodeIdsValueFunction, nodeIdsF, typeF } = identifiers;
|
|
79
|
+
const [nodeValueFunction, nodeF] = [nodeIdsValueFunction, nodeIdsF].map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds));
|
|
80
|
+
const nodeAbscissa = (() => {
|
|
81
|
+
switch (typeF) {
|
|
82
|
+
case "polynôme (degré $1$)": {
|
|
83
|
+
const [nodeB, nodeA] = getArrNodeCoeffOfPolynomialNode(nodeF);
|
|
84
|
+
return frac(substract(nodeValueFunction, nodeB), nodeA);
|
|
85
|
+
}
|
|
86
|
+
case "$\\frac{k}{t}$": {
|
|
87
|
+
const nodeK = nodeF.leftChild;
|
|
88
|
+
return frac(nodeK, nodeValueFunction);
|
|
89
|
+
}
|
|
90
|
+
case "$\\frac{at+b}{ct+d}$": {
|
|
91
|
+
const [nodeB, nodeA] = getArrNodeCoeffOfPolynomialNode(nodeF.leftChild);
|
|
92
|
+
const [nodeD, nodeC] = getArrNodeCoeffOfPolynomialNode(nodeF.rightChild);
|
|
93
|
+
return frac(substract(multiply(nodeValueFunction, nodeD), nodeB), substract(nodeA, multiply(nodeValueFunction, nodeC)));
|
|
94
|
+
}
|
|
95
|
+
case "$k\\sqrt{t}$": {
|
|
96
|
+
const nodeK = nodeF.leftChild;
|
|
97
|
+
return frac(power(nodeValueFunction, 2), power(nodeK, 2));
|
|
98
|
+
}
|
|
99
|
+
default:
|
|
100
|
+
throw new Error("Unsupported typeF: " + typeF);
|
|
101
|
+
}
|
|
102
|
+
})();
|
|
103
|
+
const nodeDerivative = getPrettyDerivativeNode(nodeF);
|
|
104
|
+
const nodeValueDerivative = nodeBySubstitutingVar(nodeDerivative, nodeAbscissa, "x".toTree()).simplify();
|
|
105
|
+
return { nodeAbscissa, nodeDerivative, nodeValueDerivative };
|
|
106
|
+
};
|
|
107
|
+
const getAnswerNode = (identifiers) => {
|
|
108
|
+
return getAnswerStuff(identifiers).nodeValueDerivative;
|
|
109
|
+
};
|
|
110
|
+
const getAnswer = (identifiers) => {
|
|
111
|
+
return round(getAnswerNode(identifiers).evaluate(), 2).frenchify();
|
|
112
|
+
};
|
|
113
|
+
const getHint = (identifiers) => {
|
|
114
|
+
const { typeF } = identifiers;
|
|
115
|
+
switch (typeF) {
|
|
116
|
+
case "polynôme (degré $1$)":
|
|
117
|
+
return `Soient $a$ et $b$ deux réels. La dérivée de $t \\mapsto at+b$ est $t \\mapsto a$.`;
|
|
118
|
+
case "$\\frac{k}{t}$":
|
|
119
|
+
return `Soit $n$ un entier. La dérivée de $t \\mapsto \\frac{k}{t}$ est $t \\mapsto -\\frac{k}{t^2}$.`;
|
|
120
|
+
case "$\\frac{at+b}{ct+d}$":
|
|
121
|
+
return `Soient $a$, $b$, $c$ et $d$ quatre réels. La dérivée de $t \\mapsto \\frac{at+b}{ct+d}$ est $t \\mapsto \\frac{a(ct+d)-(at+b)c}{(ct+d)^2}$.`;
|
|
122
|
+
case "$k\\sqrt{t}$":
|
|
123
|
+
return `La dérivée de $t \\mapsto k\\sqrt{t}$ est $t \\mapsto \\frac{k}{2\\sqrt{t}}$.`;
|
|
124
|
+
default:
|
|
125
|
+
throw new Error("Unsupported typeF: " + typeF);
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
const getCorrection = (identifiers) => {
|
|
129
|
+
const { nodeIdsValueFunction, nodeIdsF } = identifiers;
|
|
130
|
+
const [nodeValueFunction, nodeF] = [nodeIdsValueFunction, nodeIdsF].map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds));
|
|
131
|
+
const { nodeAbscissa, nodeDerivative, nodeValueDerivative } = getAnswerStuff(identifiers);
|
|
132
|
+
return `Premièrement, il faut déterminer à quel instant $t_{cible}$ correspond $x=${nodeValueFunction.toTex()}$.
|
|
133
|
+
Il faut donc résoudre :
|
|
134
|
+
|
|
135
|
+
$$
|
|
136
|
+
${nodeVarTify(nodeF).toTex()} = ${nodeValueFunction.toTex()}
|
|
137
|
+
$$
|
|
138
|
+
|
|
139
|
+
On trouve :
|
|
140
|
+
|
|
141
|
+
${alignTex([
|
|
142
|
+
...[
|
|
143
|
+
...new Set([
|
|
144
|
+
nodeAbscissa.toTex(),
|
|
145
|
+
(() => {
|
|
146
|
+
try {
|
|
147
|
+
return nodeAbscissa.simplify();
|
|
148
|
+
}
|
|
149
|
+
catch (_) {
|
|
150
|
+
return nodeAbscissa;
|
|
151
|
+
}
|
|
152
|
+
})().toTex(),
|
|
153
|
+
]),
|
|
154
|
+
].map((tex, i) => [i === 0 ? `t_{cible}` : ``, "=", tex]),
|
|
155
|
+
])}
|
|
156
|
+
|
|
157
|
+
Il ne reste plus qu'à calculer la vitesse instantanée au temps $t_{cible}$ :
|
|
158
|
+
|
|
159
|
+
On calcule la dérivée de $x$ :
|
|
160
|
+
|
|
161
|
+
${alignTex([
|
|
162
|
+
[`v(t)`, "=", `\\frac{dx(t)}{dt}`],
|
|
163
|
+
[``, "=", `x'(t)`],
|
|
164
|
+
[``, "=", nodeVarTify(nodeDerivative).toTex()],
|
|
165
|
+
])}
|
|
166
|
+
|
|
167
|
+
On a donc :
|
|
168
|
+
|
|
169
|
+
${alignTex([
|
|
170
|
+
[`v(t_{cible})`, "=", nodeValueDerivative.toTex()],
|
|
171
|
+
[``, `\\approx`, round(nodeValueDerivative.evaluate(), 2).frenchify()],
|
|
172
|
+
])}
|
|
173
|
+
|
|
174
|
+
`;
|
|
175
|
+
};
|
|
176
|
+
const getPropositions = (n, { answer, ...identifiers }) => {
|
|
177
|
+
const { typeF } = identifiers;
|
|
178
|
+
const propositions = [];
|
|
179
|
+
addValidProp(propositions, answer);
|
|
180
|
+
propWhile(propositions, n, () => {
|
|
181
|
+
const identifierWrong = createRandomIdentifiers(typeF);
|
|
182
|
+
tryToAddWrongProp(propositions, getAnswer(identifierWrong));
|
|
183
|
+
});
|
|
184
|
+
return shuffle(propositions);
|
|
185
|
+
};
|
|
186
|
+
const getKeys = () => {
|
|
187
|
+
return [];
|
|
188
|
+
};
|
|
189
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
190
|
+
try {
|
|
191
|
+
const nodeAns = parseAlgebraic(ans);
|
|
192
|
+
const nodeAnswer = parseAlgebraic(answer);
|
|
193
|
+
const isValid = substract(nodeAns, nodeAnswer).evaluate() === 0;
|
|
194
|
+
return isValid;
|
|
195
|
+
}
|
|
196
|
+
catch (err) {
|
|
197
|
+
return handleVEAError(err);
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
const createRandomIdentifiers = (typeF) => {
|
|
201
|
+
const nodeF = getNodeFForTypeF(typeF);
|
|
202
|
+
// const nodeXAsked = getRandomNodeXAskedForTypeF(typeF);
|
|
203
|
+
const nodeAbscissa = randint(5, 15).toTree();
|
|
204
|
+
const nodeValueFunctionRaw = nodeBySubstitutingVar(nodeF, nodeAbscissa, "x".toTree());
|
|
205
|
+
const nodeValueFunction = (() => {
|
|
206
|
+
try {
|
|
207
|
+
return nodeValueFunctionRaw.simplify();
|
|
208
|
+
}
|
|
209
|
+
catch (_) {
|
|
210
|
+
return nodeValueFunctionRaw;
|
|
211
|
+
}
|
|
212
|
+
})();
|
|
213
|
+
const identifiers = {
|
|
214
|
+
nodeIdsValueFunction: nodeValueFunction.toIdentifiers(),
|
|
215
|
+
nodeIdsF: nodeF.toIdentifiers(),
|
|
216
|
+
typeF,
|
|
217
|
+
};
|
|
218
|
+
return identifiers;
|
|
219
|
+
};
|
|
220
|
+
const getProblemMovementOnLineFindSpeedAtPointQuestion = (optsIn) => {
|
|
221
|
+
const arrayedOptions = optsIn ?? arrayedOptsDefault;
|
|
222
|
+
const typeF = random(arrayedOptions.typeF);
|
|
223
|
+
const identifiers = createRandomIdentifiers(typeF);
|
|
224
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
225
|
+
};
|
|
226
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
227
|
+
return {
|
|
228
|
+
answer: getAnswer(identifiers),
|
|
229
|
+
instruction: getInstruction(identifiers),
|
|
230
|
+
keys: getKeys(identifiers),
|
|
231
|
+
answerFormat: "tex",
|
|
232
|
+
identifiers,
|
|
233
|
+
hint: getHint(identifiers),
|
|
234
|
+
correction: getCorrection(identifiers),
|
|
235
|
+
};
|
|
236
|
+
};
|
|
237
|
+
const arrayedOptsDefault = {
|
|
238
|
+
typeF: [
|
|
239
|
+
"polynôme (degré $1$)",
|
|
240
|
+
"$\\frac{k}{t}$",
|
|
241
|
+
"$\\frac{at+b}{ct+d}$",
|
|
242
|
+
"$k\\sqrt{t}$",
|
|
243
|
+
],
|
|
244
|
+
};
|
|
245
|
+
const options = [
|
|
246
|
+
{
|
|
247
|
+
id: "typeF",
|
|
248
|
+
label: "Type de fonction",
|
|
249
|
+
target: GeneratorOptionTarget.generation,
|
|
250
|
+
type: GeneratorOptionType.multiselect,
|
|
251
|
+
values: [
|
|
252
|
+
"polynôme (degré $1$)",
|
|
253
|
+
"$\\frac{k}{t}$",
|
|
254
|
+
"$\\frac{at+b}{ct+d}$",
|
|
255
|
+
"$k\\sqrt{t}$",
|
|
256
|
+
],
|
|
257
|
+
defaultValue: arrayedOptsDefault.typeF,
|
|
258
|
+
},
|
|
259
|
+
];
|
|
260
|
+
export const problemMovementOnLineFindSpeedAtPoint = {
|
|
261
|
+
id: "problemMovementOnLineFindSpeedAtPoint",
|
|
262
|
+
connector: "=",
|
|
263
|
+
label: "Lors d'un déplacement rectiligne, $x(t)$ étant donnée, déterminer une vitesse instantanée en un point",
|
|
264
|
+
isSingleStep: true,
|
|
265
|
+
generator: (nb, opts) => getDistinctQuestions(() => getProblemMovementOnLineFindSpeedAtPointQuestion(opts), nb),
|
|
266
|
+
options,
|
|
267
|
+
subject: "Mathématiques",
|
|
268
|
+
getInstruction,
|
|
269
|
+
getHint,
|
|
270
|
+
getCorrection,
|
|
271
|
+
isAnswerValid,
|
|
272
|
+
getPropositions,
|
|
273
|
+
getQuestionFromIdentifiers,
|
|
274
|
+
hasHintAndCorrection: true,
|
|
275
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { NodeIdentifiers } from "../../../../tree/nodes/nodeConstructor.js";
|
|
3
|
+
type Identifiers = {
|
|
4
|
+
nodeIdsF: NodeIdentifiers;
|
|
5
|
+
};
|
|
6
|
+
export declare const problemProjectileHeightFindAbscissa: Exercise<Identifiers>;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=problemProjectileHeightFindAbscissa.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"problemProjectileHeightFindAbscissa.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/problems/problemProjectileHeightFindAbscissa.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAerC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAO7C,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,eAAe,CAAC;CAC3B,CAAC;AAoIF,eAAO,MAAM,mCAAmC,EAAE,QAAQ,CAAC,WAAW,CAmBrE,CAAC"}
|