math-exercises 3.0.187 → 3.0.188
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/exp/expDerivativeProductFExp.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/exp/expDerivativeProductFExp.js +22 -6
- package/lib/exercises/math/derivation/derivative/exp/expDerivativeQuotientFExp.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/exp/expDerivativeQuotientFExp.js +16 -8
- package/lib/exercises/math/derivation/derivativeNumber/derivativeNumberAndImageReading.d.ts +9 -0
- package/lib/exercises/math/derivation/derivativeNumber/derivativeNumberAndImageReading.d.ts.map +1 -0
- package/lib/exercises/math/derivation/derivativeNumber/derivativeNumberAndImageReading.js +155 -0
- package/lib/exercises/math/derivation/derivativeNumber/index.d.ts +1 -0
- package/lib/exercises/math/derivation/derivativeNumber/index.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivativeNumber/index.js +1 -0
- package/lib/exercises/math/derivation/problems/problemMaximizeBoxVolumeFindX.d.ts.map +1 -1
- package/lib/exercises/math/derivation/problems/problemMaximizeBoxVolumeFindX.js +80 -29
- package/lib/exercises/math/derivation/problems/problemMaximizeProfitFindProduction.d.ts.map +1 -1
- package/lib/exercises/math/derivation/problems/problemMaximizeProfitFindProduction.js +30 -2
- package/lib/exercises/math/derivation/problems/problemMovementOnLineFindSpeedAtPoint.d.ts.map +1 -1
- package/lib/exercises/math/derivation/problems/problemMovementOnLineFindSpeedAtPoint.js +59 -16
- package/lib/exercises/math/derivation/tangent/tangentEquationFromFunctionExpression.d.ts.map +1 -1
- package/lib/exercises/math/derivation/tangent/tangentEquationFromFunctionExpression.js +23 -9
- package/lib/exercises/math/derivation/variations/findAbscissaOfExtremaFromFunctionExpression.d.ts.map +1 -1
- package/lib/exercises/math/derivation/variations/findAbscissaOfExtremaFromFunctionExpression.js +2 -7
- package/lib/exercises/math/derivation/variations/findExtremaFromFunctionExpression.d.ts.map +1 -1
- package/lib/exercises/math/derivation/variations/findExtremaFromFunctionExpression.js +2 -7
- package/lib/exercises/math/functions/sign/equationFromSignTable.d.ts +1 -0
- package/lib/exercises/math/functions/sign/equationFromSignTable.d.ts.map +1 -1
- package/lib/exercises/math/functions/sign/equationFromSignTable.js +60 -33
- package/lib/exercises/math/functions/sign/partialSignTableFromGraph.d.ts +6 -4
- package/lib/exercises/math/functions/sign/partialSignTableFromGraph.d.ts.map +1 -1
- package/lib/exercises/math/functions/sign/partialSignTableFromGraph.js +160 -63
- package/lib/exercises/math/functions/sign/readSignTable.d.ts +4 -1
- package/lib/exercises/math/functions/sign/readSignTable.d.ts.map +1 -1
- package/lib/exercises/math/functions/sign/readSignTable.js +32 -9
- package/lib/exercises/math/functions/sign/signTableFromGraph.d.ts +6 -4
- package/lib/exercises/math/functions/sign/signTableFromGraph.d.ts.map +1 -1
- package/lib/exercises/math/functions/sign/signTableFromGraph.js +160 -57
- package/lib/exercises/math/percent/evolutions/averageEvolutionRateFromStartAndEndValue.d.ts +9 -0
- package/lib/exercises/math/percent/evolutions/averageEvolutionRateFromStartAndEndValue.d.ts.map +1 -0
- package/lib/exercises/math/percent/evolutions/averageEvolutionRateFromStartAndEndValue.js +135 -0
- package/lib/exercises/math/percent/evolutions/index.d.ts +1 -0
- package/lib/exercises/math/percent/evolutions/index.d.ts.map +1 -1
- package/lib/exercises/math/percent/evolutions/index.js +1 -0
- package/lib/exercises/math/powers/equationOnePlusTPowerN.d.ts +9 -0
- package/lib/exercises/math/powers/equationOnePlusTPowerN.d.ts.map +1 -0
- package/lib/exercises/math/powers/equationOnePlusTPowerN.js +118 -0
- package/lib/exercises/math/powers/estimateNthRoot.d.ts +13 -0
- package/lib/exercises/math/powers/estimateNthRoot.d.ts.map +1 -0
- package/lib/exercises/math/powers/estimateNthRoot.js +126 -0
- package/lib/exercises/math/powers/index.d.ts +3 -0
- package/lib/exercises/math/powers/index.d.ts.map +1 -1
- package/lib/exercises/math/powers/index.js +3 -0
- package/lib/exercises/math/powers/solveNthRootEquation.d.ts +9 -0
- package/lib/exercises/math/powers/solveNthRootEquation.d.ts.map +1 -0
- package/lib/exercises/math/powers/solveNthRootEquation.js +111 -0
- package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindRecurrenceFormulaFromSituation.d.ts.map +1 -1
- package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindRecurrenceFormulaFromSituation.js +2 -2
- package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFromTwoConsecutiveTerms.js +1 -1
- package/lib/exercises/math/sequences/geometric/geometricFindRandomTermFromTwoConsecutiveTerms.js +1 -1
- package/lib/exercises/vea/percentVEA.d.ts +6 -1
- package/lib/exercises/vea/percentVEA.d.ts.map +1 -1
- package/lib/exercises/vea/percentVEA.js +15 -1
- package/lib/index.d.ts +34 -9
- package/lib/index.d.ts.map +1 -1
- package/lib/math/utils/sequences/situations/seqArithmeticSituations.d.ts.map +1 -1
- package/lib/math/utils/sequences/situations/seqArithmeticSituations.js +5 -8
- package/lib/math/utils/sequences/situations/seqArithmeticUtils.d.ts +1 -1
- package/lib/math/utils/sequences/situations/seqArithmeticUtils.d.ts.map +1 -1
- package/lib/math/utils/sequences/situations/seqArithmeticUtils.js +1 -3
- package/lib/math/utils/sequences/situations/seqGeometricSituations.d.ts.map +1 -1
- package/lib/math/utils/sequences/situations/seqGeometricSituations.js +8 -10
- package/lib/tests/questionTest.d.ts.map +1 -1
- package/lib/tests/questionTest.js +8 -0
- package/lib/tree/nodes/sets/closure.d.ts +1 -0
- package/lib/tree/nodes/sets/closure.d.ts.map +1 -1
- package/lib/tree/nodes/sets/closure.js +12 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expDerivativeProductFExp.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/derivation/derivative/exp/expDerivativeProductFExp.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAiBT,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"expDerivativeProductFExp.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/derivation/derivative/exp/expDerivativeProductFExp.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAiBT,MAAM,6BAA6B,CAAC;AAgErC,KAAK,WAAW,GAAG;IAEjB,OAAO,EAAE,MAAM,EAAE,CAAC;IAGlB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AAuVF,KAAK,OAAO,GAAG;IACb,KAAK,EAAE,MAAM,CAAC;IACd,yBAAyB,EAAE,OAAO,CAAC;IAGnC,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AA4BF,eAAO,MAAM,wBAAwB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAwBnE,CAAC;AAEF,eAAO,MAAM,8BAA8B,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAwBzE,CAAC"}
|
|
@@ -6,8 +6,9 @@ import { randint } from "../../../../../math/utils/random/randint.js";
|
|
|
6
6
|
import { exp, ExpNode } from "../../../../../tree/nodes/functions/expNode.js";
|
|
7
7
|
import { add, AddNode } from "../../../../../tree/nodes/operators/addNode.js";
|
|
8
8
|
import { isMultiplyNode, multiply, MultiplyNode, } from "../../../../../tree/nodes/operators/multiplyNode.js";
|
|
9
|
-
import { substract } from "../../../../../tree/nodes/operators/substractNode.js";
|
|
10
9
|
import { parseAlgebraic } from "../../../../../tree/parsers/latexParser.js";
|
|
10
|
+
import { NodeComparator } from "../../../../../tree/utilities/nodeComparator.js";
|
|
11
|
+
import { NodeRewriter } from "../../../../../tree/utilities/nodeRewriter.js";
|
|
11
12
|
const simplifyMore = (node) => {
|
|
12
13
|
if (isMultiplyNode(node)) {
|
|
13
14
|
const nodeLeft = node.leftChild;
|
|
@@ -234,12 +235,22 @@ const isAnswerValid = (ans, { answer }, optsIn) => {
|
|
|
234
235
|
}
|
|
235
236
|
}
|
|
236
237
|
const nodeAnswer = parseAlgebraic(answer);
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
238
|
+
const isEquivalentFound = () => {
|
|
239
|
+
const arrNodeAnswerEquivalent = NodeRewriter.getArrNodeEquivalent(nodeAnswer);
|
|
240
|
+
const isEquivalentViaSub = () => arrNodeAnswerEquivalent.some((nodeAnswerRefined) => {
|
|
241
|
+
const isEqual = NodeComparator.isEqualViaSub(nodeAns, nodeAnswerRefined);
|
|
242
|
+
return isEqual;
|
|
243
|
+
});
|
|
244
|
+
const isEquivalentViaFrac = () => arrNodeAnswerEquivalent.some((nodeAnswerRefined) => {
|
|
245
|
+
const isEqual = NodeComparator.isEqualViaFrac(nodeAns, nodeAnswerRefined);
|
|
246
|
+
return isEqual;
|
|
247
|
+
});
|
|
248
|
+
return isEquivalentViaSub() || isEquivalentViaFrac();
|
|
249
|
+
};
|
|
250
|
+
const isValid = isEquivalentFound();
|
|
251
|
+
return isValid;
|
|
240
252
|
};
|
|
241
|
-
const
|
|
242
|
-
const opts = optsIn ?? optsDefault;
|
|
253
|
+
const createRandomIdentifiers = (opts) => {
|
|
243
254
|
const { typeF, typeExpG } = opts;
|
|
244
255
|
const coeffsF = (() => {
|
|
245
256
|
switch (typeF) {
|
|
@@ -265,6 +276,11 @@ const getExpDerivativeProductFExpQuestion = (optsIn) => {
|
|
|
265
276
|
coeffsF,
|
|
266
277
|
coeffsG,
|
|
267
278
|
};
|
|
279
|
+
return identifiers;
|
|
280
|
+
};
|
|
281
|
+
const getExpDerivativeProductFExpQuestion = (optsIn) => {
|
|
282
|
+
const opts = optsIn ?? optsDefault;
|
|
283
|
+
const identifiers = createRandomIdentifiers(opts);
|
|
268
284
|
return getQuestionFromIdentifiers(identifiers, opts);
|
|
269
285
|
};
|
|
270
286
|
const getQuestionFromIdentifiers = (identifiers, opts) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expDerivativeQuotientFExp.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/derivation/derivative/exp/expDerivativeQuotientFExp.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAiBT,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"expDerivativeQuotientFExp.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/derivation/derivative/exp/expDerivativeQuotientFExp.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAiBT,MAAM,6BAA6B,CAAC;AAsGrC,KAAK,WAAW,GAAG;IAEjB,OAAO,EAAE,MAAM,EAAE,CAAC;IAGlB,OAAO,EAAE,MAAM,EAAE,CAAC;IAElB,WAAW,EAAE,OAAO,CAAC;CACtB,CAAC;AA4YF,KAAK,OAAO,GAAG;IACb,KAAK,EAAE,MAAM,CAAC;IACd,yBAAyB,EAAE,OAAO,CAAC;IAGnC,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AA4BF,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAwBpE,CAAC;AAEF,eAAO,MAAM,+BAA+B,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAyB1E,CAAC"}
|
|
@@ -4,13 +4,14 @@ import { AffineConstructor } from "../../../../../math/polynomials/affine.js";
|
|
|
4
4
|
import { TrinomConstructor } from "../../../../../math/polynomials/trinom.js";
|
|
5
5
|
import { randint } from "../../../../../math/utils/random/randint.js";
|
|
6
6
|
import { exp, ExpNode } from "../../../../../tree/nodes/functions/expNode.js";
|
|
7
|
-
import { PiNode } from "../../../../../tree/nodes/numbers/piNode.js";
|
|
8
7
|
import { add, AddNode } from "../../../../../tree/nodes/operators/addNode.js";
|
|
9
8
|
import { frac, FractionNode, isFractionNode, } from "../../../../../tree/nodes/operators/fractionNode.js";
|
|
10
9
|
import { isMultiplyNode, multiply, MultiplyNode, } from "../../../../../tree/nodes/operators/multiplyNode.js";
|
|
11
10
|
import { power } from "../../../../../tree/nodes/operators/powerNode.js";
|
|
12
11
|
import { substract } from "../../../../../tree/nodes/operators/substractNode.js";
|
|
13
12
|
import { parseAlgebraic } from "../../../../../tree/parsers/latexParser.js";
|
|
13
|
+
import { NodeComparator } from "../../../../../tree/utilities/nodeComparator.js";
|
|
14
|
+
import { NodeRewriter } from "../../../../../tree/utilities/nodeRewriter.js";
|
|
14
15
|
import { coinFlip } from "../../../../../utils/alea/coinFlip.js";
|
|
15
16
|
const simplifyMoreProduct = (node) => {
|
|
16
17
|
if (isMultiplyNode(node)) {
|
|
@@ -317,13 +318,20 @@ const isAnswerValid = (ans, { answer }, optsIn) => {
|
|
|
317
318
|
}
|
|
318
319
|
}
|
|
319
320
|
const nodeAnswer = parseAlgebraic(answer);
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
321
|
+
const isEquivalentFound = () => {
|
|
322
|
+
const arrNodeAnswerEquivalent = NodeRewriter.getArrNodeEquivalent(nodeAnswer);
|
|
323
|
+
const isEquivalentViaSub = () => arrNodeAnswerEquivalent.some((nodeAnswerRefined) => {
|
|
324
|
+
const isEqual = NodeComparator.isEqualViaSub(nodeAns, nodeAnswerRefined);
|
|
325
|
+
return isEqual;
|
|
326
|
+
});
|
|
327
|
+
const isEquivalentViaFrac = () => arrNodeAnswerEquivalent.some((nodeAnswerRefined) => {
|
|
328
|
+
const isEqual = NodeComparator.isEqualViaFrac(nodeAns, nodeAnswerRefined);
|
|
329
|
+
return isEqual;
|
|
330
|
+
});
|
|
331
|
+
return isEquivalentViaSub() || isEquivalentViaFrac();
|
|
332
|
+
};
|
|
333
|
+
const isValid = isEquivalentFound();
|
|
334
|
+
return isValid;
|
|
327
335
|
};
|
|
328
336
|
const getExpDerivativeQuotientFExpQuestion = (optsIn) => {
|
|
329
337
|
const opts = optsIn ?? optsDefault;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise.js";
|
|
2
|
+
type Identifiers = {
|
|
3
|
+
A: number[];
|
|
4
|
+
B: number[];
|
|
5
|
+
coeffs: number[];
|
|
6
|
+
};
|
|
7
|
+
export declare const derivativeNumberAndImageReading: Exercise<Identifiers>;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=derivativeNumberAndImageReading.d.ts.map
|
package/lib/exercises/math/derivation/derivativeNumber/derivativeNumberAndImageReading.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"derivativeNumberAndImageReading.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivativeNumber/derivativeNumberAndImageReading.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAUT,MAAM,6BAA6B,CAAC;AAWrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,EAAE,CAAC;IACZ,CAAC,EAAE,MAAM,EAAE,CAAC;IACZ,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AAkJF,eAAO,MAAM,+BAA+B,EAAE,QAAQ,CAAC,WAAW,CAejE,CAAC"}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
2
|
+
import { valueTableVEA } from "../../../../exercises/vea/valueTableVEA.js";
|
|
3
|
+
import { blueMain, orange } from "../../../../geogebra/colors.js";
|
|
4
|
+
import { GeogebraConstructor } from "../../../../geogebra/geogebraConstructor.js";
|
|
5
|
+
import { Integer } from "../../../../math/numbers/integer/integer.js";
|
|
6
|
+
import { Rational } from "../../../../math/numbers/rationals/rational.js";
|
|
7
|
+
import { Polynomial } from "../../../../math/polynomials/polynomial.js";
|
|
8
|
+
import { randint } from "../../../../math/utils/random/randint.js";
|
|
9
|
+
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
10
|
+
const getInstruction = (identifiers) => {
|
|
11
|
+
const { A } = identifiers;
|
|
12
|
+
const xA = A[0];
|
|
13
|
+
return `Ci-dessous sont tracées la courbe $\\mathcal C_f$ de la fonction $f$ et la tangente à cette courbe au point d'abscisse $${xA}$.
|
|
14
|
+
|
|
15
|
+
Déterminer $f(${xA})$ et $f'(${xA})$.`;
|
|
16
|
+
};
|
|
17
|
+
const getAnswerTable = (identifiers) => {
|
|
18
|
+
const { A, B } = identifiers;
|
|
19
|
+
const xA = A[0];
|
|
20
|
+
const xB = B[0];
|
|
21
|
+
const yA = A[1];
|
|
22
|
+
const yB = B[1];
|
|
23
|
+
const pente = new Rational(yB - yA, xB - xA).simplify();
|
|
24
|
+
const penteTree = pente.toTree();
|
|
25
|
+
const deriv = penteTree.toTex();
|
|
26
|
+
return [
|
|
27
|
+
[`$f(${xA})$`, yA.frenchify()],
|
|
28
|
+
[`$f'(${xA})$`, deriv],
|
|
29
|
+
];
|
|
30
|
+
};
|
|
31
|
+
const getGGBOptions = (identifiers) => {
|
|
32
|
+
const { A, B } = identifiers;
|
|
33
|
+
const xA = A[0];
|
|
34
|
+
const xB = B[0];
|
|
35
|
+
const yA = A[1];
|
|
36
|
+
const yB = B[1];
|
|
37
|
+
const pente = new Rational(yB - yA, xB - xA).simplify();
|
|
38
|
+
const origin = pente
|
|
39
|
+
.opposite()
|
|
40
|
+
.multiply(new Integer(xA))
|
|
41
|
+
.add(new Integer(yA));
|
|
42
|
+
const penteTree = pente.toTree();
|
|
43
|
+
const originTree = origin.toTree();
|
|
44
|
+
const penteString = penteTree.toMathString();
|
|
45
|
+
const originString = originTree.toMathString();
|
|
46
|
+
const polynome = new Polynomial(identifiers.coeffs);
|
|
47
|
+
const commands = [
|
|
48
|
+
`f(x) = ${polynome.toMathString()}`,
|
|
49
|
+
`SetColor(f, "${blueMain}")`,
|
|
50
|
+
`SetCaption(f, "$\\mathcal C_f$")`,
|
|
51
|
+
`ShowLabel(f, true)`,
|
|
52
|
+
`g(x) = (${penteString}) * x + (${originString})`,
|
|
53
|
+
`SetColor(g, "${orange}")`,
|
|
54
|
+
`A = (${xA},${yA})`,
|
|
55
|
+
"SetFixed(A, true, false)",
|
|
56
|
+
"SetPointStyle(A, 1)",
|
|
57
|
+
];
|
|
58
|
+
const xMin = Math.min(xA, xB);
|
|
59
|
+
const yMin = Math.min(yA, yB);
|
|
60
|
+
const xMax = Math.max(xA, xB);
|
|
61
|
+
const yMax = Math.max(yA, yB);
|
|
62
|
+
const ggb = new GeogebraConstructor({
|
|
63
|
+
commands,
|
|
64
|
+
});
|
|
65
|
+
return ggb.getOptions({
|
|
66
|
+
coords: [xMin - 5, xMax + 5, yMin - 5, yMax + 5],
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
const getHint = () => {
|
|
70
|
+
return `- $f(a)$ est l'image de $a$ par la fonction $f$.
|
|
71
|
+
|
|
72
|
+
- $f'(a)$ est le nombre dérivé de $f$ en $a$ : c'est le coefficient directeur de la tangente à la courbe de $f$ au point d'abscisse $a$.`;
|
|
73
|
+
};
|
|
74
|
+
const getCorrection = (identifiers) => {
|
|
75
|
+
const { A, B } = identifiers;
|
|
76
|
+
const xA = A[0];
|
|
77
|
+
const xB = B[0];
|
|
78
|
+
const yA = A[1];
|
|
79
|
+
const yB = B[1];
|
|
80
|
+
const pente = new Rational(yB - yA, xB - xA).simplify();
|
|
81
|
+
const penteTree = pente.toTree();
|
|
82
|
+
const deriv = penteTree.toTex();
|
|
83
|
+
return `On commence par lire $f(${xA})$ : c'est l'image par $f$ de $${xA}$. On lit donc graphiquement :
|
|
84
|
+
|
|
85
|
+
$$
|
|
86
|
+
f(${xA}) = ${yA.frenchify()}
|
|
87
|
+
$$
|
|
88
|
+
|
|
89
|
+
Puis, on lit $f'(${xA})$ : c'est le nombre dérivé de $f$ en $a$, c'est à dire le coefficient directeur de la tangente à la courbe de $f$ au point d'abscisse $a$. On lit donc graphiquement :
|
|
90
|
+
|
|
91
|
+
$$
|
|
92
|
+
f'(${xA}) = ${deriv}
|
|
93
|
+
$$
|
|
94
|
+
`;
|
|
95
|
+
};
|
|
96
|
+
const getDerivativeNumberReading = () => {
|
|
97
|
+
const [xA, yA] = [1, 2].map((_el) => randint(-5, 6));
|
|
98
|
+
const xB = xA > 0 ? randint(xA - 4, 6, [xA]) : randint(-4, xA + 5, [xA]); // l'écart entre les deux points ne soit pas grand
|
|
99
|
+
const yB = yA > 0 ? randint(yA - 4, 6) : randint(-4, yA + 5);
|
|
100
|
+
const pente = new Rational(yB - yA, xB - xA).simplify();
|
|
101
|
+
const penteValue = pente.value;
|
|
102
|
+
const [a, b] = [
|
|
103
|
+
(3 * randint(-100, 100, [0])) / 100,
|
|
104
|
+
(2 * randint(-4, 5)) / 100,
|
|
105
|
+
];
|
|
106
|
+
const c = penteValue - a * Math.pow(xA, 2) - b * xA;
|
|
107
|
+
const d = yA - (a / 3) * Math.pow(xA, 3) - (b / 2) * Math.pow(xA, 2) - xA * c;
|
|
108
|
+
const identifiers = {
|
|
109
|
+
A: [xA, yA],
|
|
110
|
+
B: [xB, yB],
|
|
111
|
+
coeffs: [d, c, b / 2, a / 3],
|
|
112
|
+
};
|
|
113
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
114
|
+
};
|
|
115
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
116
|
+
const xA = identifiers.A[0];
|
|
117
|
+
const question = {
|
|
118
|
+
instruction: getInstruction(identifiers),
|
|
119
|
+
answerTable: getAnswerTable(identifiers),
|
|
120
|
+
ggbOptions: getGGBOptions(identifiers),
|
|
121
|
+
answerFormat: "tex",
|
|
122
|
+
keys: [],
|
|
123
|
+
identifiers,
|
|
124
|
+
hint: getHint(identifiers),
|
|
125
|
+
correction: getCorrection(identifiers),
|
|
126
|
+
initTable: [
|
|
127
|
+
[`$f(${xA})$`, ""],
|
|
128
|
+
[`$f'(${xA})$`, ""],
|
|
129
|
+
],
|
|
130
|
+
};
|
|
131
|
+
return question;
|
|
132
|
+
};
|
|
133
|
+
const isAnswerTableValid = (ans, { answerTable }) => {
|
|
134
|
+
try {
|
|
135
|
+
return valueTableVEA(ans, answerTable);
|
|
136
|
+
}
|
|
137
|
+
catch (err) {
|
|
138
|
+
return handleVEAError(err);
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
export const derivativeNumberAndImageReading = {
|
|
142
|
+
id: "derivativeNumberAndImageReading",
|
|
143
|
+
connector: "=",
|
|
144
|
+
label: "Lire graphiquement $f'(a)$ et $f(a)$",
|
|
145
|
+
isSingleStep: false,
|
|
146
|
+
generator: (nb) => getDistinctQuestions(getDerivativeNumberReading, nb),
|
|
147
|
+
qcmTimer: 60,
|
|
148
|
+
freeTimer: 60,
|
|
149
|
+
isAnswerTableValid,
|
|
150
|
+
hasGeogebra: true,
|
|
151
|
+
subject: "Mathématiques",
|
|
152
|
+
getQuestionFromIdentifiers,
|
|
153
|
+
answerType: "valueTable",
|
|
154
|
+
hasHintAndCorrection: true,
|
|
155
|
+
};
|
|
@@ -6,4 +6,5 @@ export * from "./expressFAPlusH.js";
|
|
|
6
6
|
export * from "./findAverageRateLimit.js";
|
|
7
7
|
export * from "./signOfDerivativeNumberFromFunctionCurve.js";
|
|
8
8
|
export * from "./valueTableImageAndDerivativeFromFunctionExpression.js";
|
|
9
|
+
export * from "./derivativeNumberAndImageReading.js";
|
|
9
10
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivativeNumber/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oCAAoC,CAAC;AACnD,cAAc,uCAAuC,CAAC;AACtD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8CAA8C,CAAC;AAC7D,cAAc,yDAAyD,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivativeNumber/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oCAAoC,CAAC;AACnD,cAAc,uCAAuC,CAAC;AACtD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8CAA8C,CAAC;AAC7D,cAAc,yDAAyD,CAAC;AACxE,cAAc,sCAAsC,CAAC"}
|
|
@@ -6,3 +6,4 @@ export * from "./expressFAPlusH.js";
|
|
|
6
6
|
export * from "./findAverageRateLimit.js";
|
|
7
7
|
export * from "./signOfDerivativeNumberFromFunctionCurve.js";
|
|
8
8
|
export * from "./valueTableImageAndDerivativeFromFunctionExpression.js";
|
|
9
|
+
export * from "./derivativeNumberAndImageReading.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"problemMaximizeBoxVolumeFindX.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/problems/problemMaximizeBoxVolumeFindX.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"problemMaximizeBoxVolumeFindX.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/problems/problemMaximizeBoxVolumeFindX.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAkCrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAmPF,eAAO,MAAM,6BAA6B,EAAE,QAAQ,CAAC,WAAW,CAiB/D,CAAC"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { addValidProp, tryToAddWrongProp, propWhile, } from "../../../../exercises/exercise.js";
|
|
2
2
|
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
3
|
import { SetVEA } from "../../../../exercises/vea/setVEA.js";
|
|
4
|
+
import { blueLight } from "../../../../geogebra/colors.js";
|
|
5
|
+
import { GeogebraConstructor } from "../../../../geogebra/geogebraConstructor.js";
|
|
6
|
+
import { Point } from "../../../../math/geometry/point.js";
|
|
4
7
|
import { createNodeFPolynomialFromCoeffs, getAnswerStuffSolveSecondDegreePolynomial, getArrNodeCoeffOfPolynomialNode, getTexSolveSecondDegreeEquation, } from "../../../../math/utils/polynomial/polynomialUtils.js";
|
|
5
8
|
import { round } from "../../../../math/utils/round.js";
|
|
6
9
|
import { EquationSolutionNode } from "../../../../tree/nodes/equations/equationSolutionNode.js";
|
|
@@ -11,7 +14,6 @@ import { DiscreteSetNode } from "../../../../tree/nodes/sets/discreteSetNode.js"
|
|
|
11
14
|
import { discreteSetParser } from "../../../../tree/parsers/discreteSetParser.js";
|
|
12
15
|
import { randomMany } from "../../../../utils/alea/random.js";
|
|
13
16
|
import { shuffle } from "../../../../utils/alea/shuffle.js";
|
|
14
|
-
import { alignTex } from "../../../../utils/latex/alignTex.js";
|
|
15
17
|
const getNodeF = (a, b) => {
|
|
16
18
|
const nodeVarX = "x".toTree();
|
|
17
19
|
return multiply(multiply(substract(a, multiply(2, nodeVarX)), substract(b, multiply(2, nodeVarX))), nodeVarX);
|
|
@@ -42,61 +44,69 @@ const getAnswerNode = (identifiers) => {
|
|
|
42
44
|
const getAnswer = (identifiers) => {
|
|
43
45
|
return getAnswerNode(identifiers).toTex();
|
|
44
46
|
};
|
|
45
|
-
const getHint = () => {
|
|
47
|
+
const getHint = (identifiers) => {
|
|
48
|
+
const { a, b } = identifiers;
|
|
46
49
|
return `Le volume de la boîte peut être calculé avec la formule :
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
Ici, la largeur
|
|
55
|
-
la longueur
|
|
56
|
-
et la profondeur
|
|
50
|
+
|
|
51
|
+
$$
|
|
52
|
+
V = l \\times L \\times h
|
|
53
|
+
$$
|
|
54
|
+
|
|
55
|
+
avec $l$ la longueur, $L$ la largeur et $h$ la profondeur.
|
|
56
|
+
|
|
57
|
+
Ici, la largeur vaut $${a.frenchify()}-2x$,
|
|
58
|
+
la longueur vaut $${b.frenchify()}-2x$
|
|
59
|
+
et la profondeur vaut $x$.
|
|
60
|
+
|
|
61
|
+
Pour déterminer les valeurs maximales de $V$,
|
|
62
|
+
on cherche les extremums locaux de $V$,
|
|
63
|
+
c'est-à-dire les valeurs de $x$ pour lesquelles $V'(x)=0$.
|
|
64
|
+
|
|
65
|
+
`;
|
|
57
66
|
};
|
|
58
67
|
const getCorrection = (identifiers) => {
|
|
59
68
|
const { a, b } = identifiers;
|
|
60
|
-
const
|
|
69
|
+
const nodeFRaw = getNodeF(a, b);
|
|
70
|
+
const nodeF = createNodeFPolynomialFromCoeffs(getArrNodeCoeffOfPolynomialNode(nodeFRaw));
|
|
61
71
|
const nodeDerivative = nodeF.derivative();
|
|
62
72
|
const nodeDerivativeExpanded = (() => {
|
|
63
73
|
const arrNodeCoeff = getArrNodeCoeffOfPolynomialNode(nodeDerivative);
|
|
64
74
|
return createNodeFPolynomialFromCoeffs(arrNodeCoeff);
|
|
65
75
|
})();
|
|
66
76
|
const nodeMaxBound = frac(a, 2);
|
|
67
|
-
return `On calcule le volume en fonction de $x
|
|
77
|
+
return `On calcule le volume en fonction de $x$.
|
|
78
|
+
|
|
79
|
+
Ici, la largeur vaut $${a.frenchify()}-2x$,
|
|
80
|
+
la longueur vaut $${b.frenchify()}-2x$
|
|
81
|
+
et la profondeur vaut $x$.
|
|
82
|
+
|
|
83
|
+
Donc :
|
|
68
84
|
|
|
69
85
|
$$
|
|
70
|
-
V(x) = ${
|
|
86
|
+
V(x) = ${nodeFRaw.toTex()}
|
|
71
87
|
$$
|
|
72
88
|
|
|
73
89
|
$x$ est compris entre $0$ et $${[
|
|
74
90
|
...new Set([nodeMaxBound.toTex(), nodeMaxBound.simplify().toTex()]),
|
|
75
91
|
].join("=")}$.
|
|
76
92
|
|
|
77
|
-
On
|
|
93
|
+
On cherche à maximiser $V$.
|
|
94
|
+
$V$ est continue et dérivable. On calcule :
|
|
78
95
|
|
|
79
96
|
$$
|
|
80
|
-
V(
|
|
97
|
+
V(x) = ${nodeF.toTex()}
|
|
81
98
|
$$
|
|
82
99
|
|
|
83
|
-
et pour $x$ différent de $0$ et de $${nodeMaxBound.simplify().toTex()}$ :
|
|
84
|
-
|
|
85
100
|
$$
|
|
86
|
-
V(x)
|
|
101
|
+
V'(x) = ${nodeDerivativeExpanded.toTex()}
|
|
87
102
|
$$
|
|
88
103
|
|
|
89
|
-
On cherche à maximiser $V$.
|
|
90
|
-
$V$ est continue et dérivable. On calcule :
|
|
91
|
-
|
|
92
|
-
${alignTex([
|
|
93
|
-
[`V'(x)`, "=", nodeDerivative.toTex()],
|
|
94
|
-
[``, "=", nodeDerivativeExpanded.toTex()],
|
|
95
|
-
])}
|
|
96
|
-
|
|
97
104
|
On résout $V'(x)=0$ :
|
|
98
105
|
|
|
99
|
-
${getTexSolveSecondDegreeEquation(nodeDerivativeExpanded
|
|
106
|
+
${getTexSolveSecondDegreeEquation(nodeDerivativeExpanded, {
|
|
107
|
+
nodeVar: "x".toTree(),
|
|
108
|
+
isShouldApprox: true,
|
|
109
|
+
})}
|
|
100
110
|
|
|
101
111
|
On ne garde que les valeurs de $x$ qui sont possibles (c'est-à-dire entre $0$ et $${nodeMaxBound
|
|
102
112
|
.simplify()
|
|
@@ -108,6 +118,45 @@ $$
|
|
|
108
118
|
|
|
109
119
|
`;
|
|
110
120
|
};
|
|
121
|
+
const getGGBOptions = () => {
|
|
122
|
+
const w = 9;
|
|
123
|
+
const h = 5;
|
|
124
|
+
const z = 1;
|
|
125
|
+
const pointTL1 = new Point("PTL1", 0, h);
|
|
126
|
+
const pointBR1 = new Point("PBR1", w, 0);
|
|
127
|
+
const pointTL2 = new Point("PTL2", z, h - z);
|
|
128
|
+
const pointBR2 = new Point("PBR2", w - z, z);
|
|
129
|
+
const commands = [
|
|
130
|
+
//rect1
|
|
131
|
+
`r1 = Polygon((${pointTL1.x.toMathString()}, ${pointBR1.y.toMathString()}), (${pointTL1.x.toMathString()}, ${pointTL1.y.toMathString()}), (${pointBR1.x.toMathString()}, ${pointTL1.y.toMathString()}), (${pointBR1.x.toMathString()}, ${pointBR1.y.toMathString()}))`,
|
|
132
|
+
//rect2 main
|
|
133
|
+
`r2M = Polygon((${pointTL2.x.toMathString()}, ${pointBR2.y.toMathString()}), (${pointTL2.x.toMathString()}, ${pointTL2.y.toMathString()}), (${pointBR2.x.toMathString()}, ${pointTL2.y.toMathString()}), (${pointBR2.x.toMathString()}, ${pointBR2.y.toMathString()}))`,
|
|
134
|
+
`SetLineStyle(r2M, 3)`,
|
|
135
|
+
`SetColor(r2M, "${blueLight}")`,
|
|
136
|
+
//rect2 R
|
|
137
|
+
`r2R = Polygon((${pointBR2.x.toMathString()}, ${pointBR2.y.toMathString()}), (${pointBR2.x.toMathString()}, ${pointTL2.y.toMathString()}), (${pointBR2.x.evaluate() + z}, ${pointTL2.y.toMathString()}), (${pointBR2.x.evaluate() + z}, ${pointBR2.y.toMathString()}))`,
|
|
138
|
+
`SetColor(r2R, "${blueLight}")`,
|
|
139
|
+
//rect2 B
|
|
140
|
+
`r2B = Polygon((${pointTL2.x.toMathString()}, ${pointBR2.y.toMathString()}), (${pointBR2.x.toMathString()}, ${pointBR2.y.toMathString()}), (${pointBR2.x.toMathString()}, ${pointBR2.y.evaluate() - z}), (${pointTL2.x.toMathString()}, ${pointBR2.y.evaluate() - z}))`,
|
|
141
|
+
`SetColor(r2B, "${blueLight}")`,
|
|
142
|
+
//rect2 L
|
|
143
|
+
`r2L = Polygon((${pointTL2.x.evaluate() - z}, ${pointBR2.y.toMathString()}), (${pointTL2.x.evaluate() - z}, ${pointTL2.y.toMathString()}), (${pointTL2.x.evaluate()}, ${pointTL2.y.toMathString()}), (${pointTL2.x.evaluate()}, ${pointBR2.y.toMathString()}))`,
|
|
144
|
+
`SetColor(r2L, "${blueLight}")`,
|
|
145
|
+
//rect2 T
|
|
146
|
+
`r2T = Polygon((${pointTL2.x.toMathString()}, ${pointTL2.y.toMathString()}), (${pointTL2.x.toMathString()}, ${pointTL2.y.evaluate() + z}), (${pointBR2.x.evaluate()}, ${pointTL2.y.evaluate() + z}), (${pointBR2.x.evaluate()}, ${pointTL2.y.toMathString()}))`,
|
|
147
|
+
`SetColor(r2T, "${blueLight}")`,
|
|
148
|
+
];
|
|
149
|
+
const ggb = new GeogebraConstructor({
|
|
150
|
+
commands,
|
|
151
|
+
forbidShiftDragZoom: true,
|
|
152
|
+
hideAxes: true,
|
|
153
|
+
hideGrid: true,
|
|
154
|
+
fontSize: 20,
|
|
155
|
+
});
|
|
156
|
+
return ggb.getOptions({
|
|
157
|
+
coords: [-2, w + 2, -2, h + 2],
|
|
158
|
+
});
|
|
159
|
+
};
|
|
111
160
|
const getPropositions = (n, { answer }) => {
|
|
112
161
|
const propositions = [];
|
|
113
162
|
addValidProp(propositions, answer);
|
|
@@ -152,6 +201,7 @@ const getQuestionFromIdentifiers = (identifiers) => {
|
|
|
152
201
|
identifiers,
|
|
153
202
|
hint: getHint(identifiers),
|
|
154
203
|
correction: getCorrection(identifiers),
|
|
204
|
+
ggbOptions: getGGBOptions(identifiers),
|
|
155
205
|
};
|
|
156
206
|
};
|
|
157
207
|
export const problemMaximizeBoxVolumeFindX = {
|
|
@@ -168,4 +218,5 @@ export const problemMaximizeBoxVolumeFindX = {
|
|
|
168
218
|
getPropositions,
|
|
169
219
|
getQuestionFromIdentifiers,
|
|
170
220
|
hasHintAndCorrection: true,
|
|
221
|
+
hasGeogebra: true,
|
|
171
222
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"problemMaximizeProfitFindProduction.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/problems/problemMaximizeProfitFindProduction.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;AAOrC,OAAO,EAIL,0BAA0B,EAC3B,MAAM,6DAA6D,CAAC;AAYrE,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAQ7C,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,eAAe,CAAC;IAC1B,MAAM,EAAE,0BAA0B,EAAE,CAAC;IACrC,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;
|
|
1
|
+
{"version":3,"file":"problemMaximizeProfitFindProduction.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/problems/problemMaximizeProfitFindProduction.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;AAOrC,OAAO,EAIL,0BAA0B,EAC3B,MAAM,6DAA6D,CAAC;AAYrE,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAQ7C,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,eAAe,CAAC;IAC1B,MAAM,EAAE,0BAA0B,EAAE,CAAC;IACrC,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAqaF,KAAK,OAAO,GAAG;IACb,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAsBF,eAAO,MAAM,mCAAmC,EAAE,QAAQ,CACxD,WAAW,EACX,OAAO,CAoBR,CAAC"}
|
|
@@ -173,7 +173,9 @@ const getPropositions = (n, { answer, ...identifiers }) => {
|
|
|
173
173
|
addValidProp(propositions, answer);
|
|
174
174
|
propWhile(propositions, n, () => {
|
|
175
175
|
const identifierWrong = createRandomIdentifiers(typeF);
|
|
176
|
-
|
|
176
|
+
if (isIdentifiersQCPassed(identifierWrong)) {
|
|
177
|
+
tryToAddWrongProp(propositions, getAnswer(identifierWrong));
|
|
178
|
+
}
|
|
177
179
|
});
|
|
178
180
|
return shuffle(propositions);
|
|
179
181
|
};
|
|
@@ -279,10 +281,36 @@ const createRandomIdentifiers = (typeF) => {
|
|
|
279
281
|
};
|
|
280
282
|
return identifiers;
|
|
281
283
|
};
|
|
284
|
+
const isIdentifiersQCPassed = (identifiers) => {
|
|
285
|
+
const isExploding = (identifiers) => {
|
|
286
|
+
try {
|
|
287
|
+
getCorrection(identifiers);
|
|
288
|
+
return false;
|
|
289
|
+
}
|
|
290
|
+
catch (_) {
|
|
291
|
+
return true;
|
|
292
|
+
}
|
|
293
|
+
};
|
|
294
|
+
return !isExploding(identifiers);
|
|
295
|
+
};
|
|
282
296
|
const getProblemMaximizeProfitFindProductionQuestion = (optsIn) => {
|
|
283
297
|
const arrayedOptions = optsIn ?? arrayedOptsDefault;
|
|
284
298
|
const typeF = random(arrayedOptions.typeF);
|
|
285
|
-
|
|
299
|
+
let identifiers;
|
|
300
|
+
let counter = -1;
|
|
301
|
+
let isValid = false;
|
|
302
|
+
while (!isValid && counter < 100) {
|
|
303
|
+
counter++;
|
|
304
|
+
const identifiersCandidate = createRandomIdentifiers(typeF);
|
|
305
|
+
isValid = isIdentifiersQCPassed(identifiersCandidate);
|
|
306
|
+
if (isValid) {
|
|
307
|
+
identifiers = identifiersCandidate;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
if (!isValid) {
|
|
311
|
+
const identifiersDefault = createRandomIdentifiers("polynôme (degré $2$)");
|
|
312
|
+
identifiers = identifiersDefault;
|
|
313
|
+
}
|
|
286
314
|
return getQuestionFromIdentifiers(identifiers);
|
|
287
315
|
};
|
|
288
316
|
const getQuestionFromIdentifiers = (identifiers) => {
|
package/lib/exercises/math/derivation/problems/problemMovementOnLineFindSpeedAtPoint.d.ts.map
CHANGED
|
@@ -1 +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;
|
|
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;AA0RF,KAAK,OAAO,GAAG;IACb,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAoCF,eAAO,MAAM,qCAAqC,EAAE,QAAQ,CAC1D,WAAW,EACX,OAAO,CAqBR,CAAC"}
|
|
@@ -101,7 +101,8 @@ const getAnswerStuff = (identifiers) => {
|
|
|
101
101
|
}
|
|
102
102
|
})();
|
|
103
103
|
const nodeDerivative = getPrettyDerivativeNode(nodeF);
|
|
104
|
-
const
|
|
104
|
+
const nodeValueDerivativeRaw = nodeBySubstitutingVar(nodeDerivative, nodeAbscissa, "x".toTree());
|
|
105
|
+
const nodeValueDerivative = nodeValueDerivativeRaw.simplify();
|
|
105
106
|
return { nodeAbscissa, nodeDerivative, nodeValueDerivative };
|
|
106
107
|
};
|
|
107
108
|
const getAnswerNode = (identifiers) => {
|
|
@@ -111,19 +112,33 @@ const getAnswer = (identifiers) => {
|
|
|
111
112
|
return round(getAnswerNode(identifiers).evaluate(), 2).frenchify();
|
|
112
113
|
};
|
|
113
114
|
const getHint = (identifiers) => {
|
|
114
|
-
const {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
115
|
+
const { nodeIdsValueFunction, nodeIdsF } = identifiers;
|
|
116
|
+
const [nodeValueFunction, nodeF] = [nodeIdsValueFunction, nodeIdsF].map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds));
|
|
117
|
+
return `Premièrement, il faut déterminer à quel instant $t_{cible}$ correspond $x=${nodeValueFunction.toTex()}$.
|
|
118
|
+
Il faut donc résoudre :
|
|
119
|
+
|
|
120
|
+
$$
|
|
121
|
+
x(t_{cible}) = ${nodeBySubstitutingVar(nodeF, "t_{cible}".toTree(), "x".toTree()).toTex()} = ${nodeValueFunction.toTex()}
|
|
122
|
+
$$
|
|
123
|
+
|
|
124
|
+
Ensuite, il ne reste plus qu'à calculer la vitesse instantanée au temps $t_{cible}$,
|
|
125
|
+
c'est-à-dire $x'(t_{cible})$.
|
|
126
|
+
|
|
127
|
+
Rappel : ${(() => {
|
|
128
|
+
const { typeF } = identifiers;
|
|
129
|
+
switch (typeF) {
|
|
130
|
+
case "polynôme (degré $1$)":
|
|
131
|
+
return `Soient $a$ et $b$ deux réels. La dérivée de $t \\mapsto at+b$ est $t \\mapsto a$.`;
|
|
132
|
+
case "$\\frac{k}{t}$":
|
|
133
|
+
return `Soit $n$ un entier. La dérivée de $t \\mapsto \\frac{k}{t}$ est $t \\mapsto -\\frac{k}{t^2}$.`;
|
|
134
|
+
case "$\\frac{at+b}{ct+d}$":
|
|
135
|
+
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}$.`;
|
|
136
|
+
case "$k\\sqrt{t}$":
|
|
137
|
+
return `La dérivée de $t \\mapsto k\\sqrt{t}$ est $t \\mapsto \\frac{k}{2\\sqrt{t}}$.`;
|
|
138
|
+
default:
|
|
139
|
+
throw new Error("Unsupported typeF: " + typeF);
|
|
140
|
+
}
|
|
141
|
+
})()}`;
|
|
127
142
|
};
|
|
128
143
|
const getCorrection = (identifiers) => {
|
|
129
144
|
const { nodeIdsValueFunction, nodeIdsF } = identifiers;
|
|
@@ -179,7 +194,9 @@ const getPropositions = (n, { answer, ...identifiers }) => {
|
|
|
179
194
|
addValidProp(propositions, answer);
|
|
180
195
|
propWhile(propositions, n, () => {
|
|
181
196
|
const identifierWrong = createRandomIdentifiers(typeF);
|
|
182
|
-
|
|
197
|
+
if (isIdentifiersQCPassed(identifierWrong)) {
|
|
198
|
+
tryToAddWrongProp(propositions, getAnswer(identifierWrong));
|
|
199
|
+
}
|
|
183
200
|
});
|
|
184
201
|
return shuffle(propositions);
|
|
185
202
|
};
|
|
@@ -217,10 +234,36 @@ const createRandomIdentifiers = (typeF) => {
|
|
|
217
234
|
};
|
|
218
235
|
return identifiers;
|
|
219
236
|
};
|
|
237
|
+
const isIdentifiersQCPassed = (identifiers) => {
|
|
238
|
+
const isExploding = (identifiers) => {
|
|
239
|
+
try {
|
|
240
|
+
getAnswer(identifiers);
|
|
241
|
+
return false;
|
|
242
|
+
}
|
|
243
|
+
catch (_) {
|
|
244
|
+
return true;
|
|
245
|
+
}
|
|
246
|
+
};
|
|
247
|
+
return !isExploding(identifiers);
|
|
248
|
+
};
|
|
220
249
|
const getProblemMovementOnLineFindSpeedAtPointQuestion = (optsIn) => {
|
|
221
250
|
const arrayedOptions = optsIn ?? arrayedOptsDefault;
|
|
222
251
|
const typeF = random(arrayedOptions.typeF);
|
|
223
|
-
|
|
252
|
+
let identifiers;
|
|
253
|
+
let counter = -1;
|
|
254
|
+
let isValid = false;
|
|
255
|
+
while (!isValid && counter < 100) {
|
|
256
|
+
counter++;
|
|
257
|
+
const identifiersCandidate = createRandomIdentifiers(typeF);
|
|
258
|
+
isValid = isIdentifiersQCPassed(identifiersCandidate);
|
|
259
|
+
if (isValid) {
|
|
260
|
+
identifiers = identifiersCandidate;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
if (!isValid) {
|
|
264
|
+
const identifiersDefault = createRandomIdentifiers("polynôme (degré $1$)");
|
|
265
|
+
identifiers = identifiersDefault;
|
|
266
|
+
}
|
|
224
267
|
return getQuestionFromIdentifiers(identifiers);
|
|
225
268
|
};
|
|
226
269
|
const getQuestionFromIdentifiers = (identifiers) => {
|
package/lib/exercises/math/derivation/tangent/tangentEquationFromFunctionExpression.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tangentEquationFromFunctionExpression.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/tangent/tangentEquationFromFunctionExpression.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;AAUrC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAgF7C,KAAK,WAAW,GAAG;IACjB,aAAa,EAAE,eAAe,CAAC;IAC/B,QAAQ,EAAE,eAAe,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;
|
|
1
|
+
{"version":3,"file":"tangentEquationFromFunctionExpression.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/tangent/tangentEquationFromFunctionExpression.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;AAUrC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAgF7C,KAAK,WAAW,GAAG;IACjB,aAAa,EAAE,eAAe,CAAC;IAC/B,QAAQ,EAAE,eAAe,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAqXF,KAAK,OAAO,GAAG;IACb,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAgDF,eAAO,MAAM,qCAAqC,EAAE,QAAQ,CAC1D,WAAW,EACX,OAAO,CAqBR,CAAC"}
|