math-exercises 3.0.26 → 3.0.27
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/dataRepresentations/functionGraphReading.js +1 -1
- package/lib/exercises/math/dataRepresentations/index.d.ts +0 -1
- package/lib/exercises/math/dataRepresentations/index.d.ts.map +1 -1
- package/lib/exercises/math/dataRepresentations/index.js +1 -1
- package/lib/exercises/math/derivation/derivative/convexityQuadrinomials.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/convexityQuadrinomials.js +27 -10
- package/lib/exercises/math/derivation/derivative/convexityTrinomials.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/convexityTrinomials.js +21 -10
- package/lib/exercises/math/derivation/derivative/cosCompositionDerivation.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/cosCompositionDerivation.js +38 -11
- package/lib/exercises/math/derivation/derivative/cosSecondDegreeDerivative.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/cosSecondDegreeDerivative.js +40 -13
- package/lib/exercises/math/derivation/derivative/expDerivativeFour.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/expDerivativeFour.js +5 -1
- package/lib/exercises/math/derivation/derivative/expDerivativeOne.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/expDerivativeOne.js +46 -14
- package/lib/exercises/math/derivation/derivative/expDerivativeTwo.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/expDerivativeTwo.js +33 -12
- package/lib/exercises/math/derivation/derivative/firstDegreeDerivative.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/firstDegreeDerivative.js +5 -3
- package/lib/exercises/math/derivation/derivative/inverseFunctionDerivative.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/inverseFunctionDerivative.js +31 -14
- package/lib/exercises/math/derivation/derivative/lnDerivativeTwo.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/lnDerivativeTwo.js +31 -12
- package/lib/exercises/math/derivation/derivative/powerCompositionDerivation.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/powerCompositionDerivation.js +1 -0
- package/lib/exercises/math/derivation/derivative/powerFunctionDerivative.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/powerFunctionDerivative.js +35 -15
- package/lib/exercises/math/derivation/derivative/productDerivative.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/productDerivative.js +43 -16
- package/lib/exercises/math/derivation/derivative/quotientDerivative.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/quotientDerivative.js +0 -2
- package/lib/exercises/math/derivation/derivative/rootFunctionDerivative.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/rootFunctionDerivative.js +0 -2
- package/lib/exercises/math/derivation/derivative/secondDegreeDerivative.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/secondDegreeDerivative.js +16 -15
- package/lib/exercises/math/derivation/derivative/secondDerivativeOfExpoFunction.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/secondDerivativeOfExpoFunction.js +39 -11
- package/lib/exercises/math/derivation/derivative/secondDerivativeOfThirdDegreeFunction.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/secondDerivativeOfThirdDegreeFunction.js +35 -12
- package/lib/exercises/math/derivation/derivative/secondDerivativeOfTrinom.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/secondDerivativeOfTrinom.js +23 -9
- package/lib/exercises/math/derivation/derivative/sqrtCompositionDerivation.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/sqrtCompositionDerivation.js +23 -7
- package/lib/exercises/math/derivation/derivativeNumberCalcul.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivativeNumberCalcul.js +31 -11
- package/lib/exercises/math/powers/powersOfTenToDecimal.d.ts.map +1 -1
- package/lib/exercises/math/powers/powersOfTenToDecimal.js +30 -23
- package/lib/index.d.ts +0 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/tree/nodes/functions/expNode.d.ts +2 -2
- package/lib/tree/nodes/functions/expNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/expNode.js +2 -2
- package/package.json +1 -1
|
@@ -1,20 +1,31 @@
|
|
|
1
1
|
import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
|
|
2
2
|
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
3
|
import { randint } from "../../../../math/utils/random/randint.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
|
|
5
|
+
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
6
|
+
const getInstruction = (identifiers) => {
|
|
7
|
+
const { a } = identifiers;
|
|
8
|
+
return `Déterminer la fonction dérivée $f'$ de la fonction $f$ définie par :
|
|
9
|
+
|
|
10
|
+
$$
|
|
11
|
+
f(x) = \\frac{${a}}{x}
|
|
12
|
+
$$`;
|
|
13
|
+
};
|
|
14
|
+
const getAnswer = (identifiers) => {
|
|
15
|
+
const { a } = identifiers;
|
|
16
|
+
const answer = `${a > 0 ? "-" : ""}\\frac{${Math.abs(a)}}{x^2}`;
|
|
17
|
+
return answer;
|
|
18
|
+
};
|
|
8
19
|
const getInverseFunctionDerivative = () => {
|
|
9
20
|
const a = randint(-19, 20, [0]);
|
|
10
|
-
const
|
|
21
|
+
const identifiers = { a };
|
|
11
22
|
const question = {
|
|
12
|
-
instruction:
|
|
23
|
+
instruction: getInstruction(identifiers),
|
|
13
24
|
startStatement: `f'(x)`,
|
|
14
|
-
answer,
|
|
25
|
+
answer: getAnswer(identifiers),
|
|
15
26
|
keys: ["x"],
|
|
16
27
|
answerFormat: "tex",
|
|
17
|
-
identifiers
|
|
28
|
+
identifiers,
|
|
18
29
|
};
|
|
19
30
|
return question;
|
|
20
31
|
};
|
|
@@ -31,17 +42,21 @@ const getPropositions = (n, { answer, a }) => {
|
|
|
31
42
|
}
|
|
32
43
|
return shuffleProps(propositions, n);
|
|
33
44
|
};
|
|
34
|
-
const isAnswerValid = (ans, { a }) => {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
45
|
+
const isAnswerValid = (ans, { answer, a }) => {
|
|
46
|
+
try {
|
|
47
|
+
const parsed = parseAlgebraic(ans);
|
|
48
|
+
if (!parsed)
|
|
49
|
+
return false;
|
|
50
|
+
return parsed.simplify().toTex() === answer;
|
|
51
|
+
}
|
|
52
|
+
catch (err) {
|
|
53
|
+
return handleVEAError(err);
|
|
54
|
+
}
|
|
38
55
|
};
|
|
39
56
|
export const inverseFunctionDerivative = {
|
|
40
57
|
id: "inverseFunctionDerivative",
|
|
41
58
|
connector: "=",
|
|
42
59
|
label: "Dérivée d'une fonction inverse",
|
|
43
|
-
levels: ["1reESM", "1reSpé", "1reTech", "MathComp", "TermTech"],
|
|
44
|
-
sections: ["Dérivation", "Fonction inverse"],
|
|
45
60
|
isSingleStep: false,
|
|
46
61
|
generator: (nb) => getDistinctQuestions(getInverseFunctionDerivative, nb),
|
|
47
62
|
qcmTimer: 60,
|
|
@@ -49,4 +64,6 @@ export const inverseFunctionDerivative = {
|
|
|
49
64
|
getPropositions,
|
|
50
65
|
isAnswerValid,
|
|
51
66
|
subject: "Mathématiques",
|
|
67
|
+
getAnswer,
|
|
68
|
+
getInstruction,
|
|
52
69
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lnDerivativeTwo.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivative/lnDerivativeTwo.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"lnDerivativeTwo.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivative/lnDerivativeTwo.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAUT,MAAM,6BAA6B,CAAC;AAcrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AA+EF,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,WAAW,CAWjD,CAAC"}
|
|
@@ -8,20 +8,35 @@ import { AddNode } from "../../../../tree/nodes/operators/addNode.js";
|
|
|
8
8
|
import { FractionNode } from "../../../../tree/nodes/operators/fractionNode.js";
|
|
9
9
|
import { MultiplyNode } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
10
10
|
import { VariableNode } from "../../../../tree/nodes/variables/variableNode.js";
|
|
11
|
+
import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
|
|
11
12
|
import { shuffle } from "../../../../utils/alea/shuffle.js";
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const b =
|
|
13
|
+
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
14
|
+
const getInstruction = (identifiers) => {
|
|
15
|
+
const { a, b } = identifiers;
|
|
15
16
|
const myfunction = new AddNode(new MultiplyNode(new NumberNode(a), new LogNode(new VariableNode("x"))), new NumberNode(b));
|
|
17
|
+
return `Déterminer la dérivée de la fonction $f$ définie par :
|
|
18
|
+
|
|
19
|
+
$$
|
|
20
|
+
f(x) = ${myfunction.toTex()}
|
|
21
|
+
$$`;
|
|
22
|
+
};
|
|
23
|
+
const getAnswer = (identifiers) => {
|
|
24
|
+
const { a, b } = identifiers;
|
|
16
25
|
const derivative = new FractionNode(new NumberNode(a), new VariableNode("x"));
|
|
17
26
|
const answer = derivative.toTex();
|
|
27
|
+
return answer;
|
|
28
|
+
};
|
|
29
|
+
const getLnDerivative = () => {
|
|
30
|
+
const a = randint(-9, 10, [0]);
|
|
31
|
+
const b = randint(-9, 10, [0]);
|
|
32
|
+
const identifiers = { a, b };
|
|
18
33
|
const question = {
|
|
19
|
-
instruction:
|
|
34
|
+
instruction: getInstruction(identifiers),
|
|
20
35
|
startStatement: "f'(x)",
|
|
21
|
-
answer,
|
|
36
|
+
answer: getAnswer(identifiers),
|
|
22
37
|
keys: ["x", "lnBrackets", "epower"],
|
|
23
38
|
answerFormat: "tex",
|
|
24
|
-
identifiers
|
|
39
|
+
identifiers,
|
|
25
40
|
};
|
|
26
41
|
return question;
|
|
27
42
|
};
|
|
@@ -37,17 +52,21 @@ const getPropositions = (n, { answer, a, b }) => {
|
|
|
37
52
|
}
|
|
38
53
|
return shuffle(propositions);
|
|
39
54
|
};
|
|
40
|
-
const isAnswerValid = (ans, { a }) => {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
55
|
+
const isAnswerValid = (ans, { answer, a }) => {
|
|
56
|
+
try {
|
|
57
|
+
const parsed = parseAlgebraic(ans);
|
|
58
|
+
if (!parsed)
|
|
59
|
+
return false;
|
|
60
|
+
return parsed.simplify().toTex() === answer;
|
|
61
|
+
}
|
|
62
|
+
catch (err) {
|
|
63
|
+
return handleVEAError(err);
|
|
64
|
+
}
|
|
44
65
|
};
|
|
45
66
|
export const lnDerivativeTwo = {
|
|
46
67
|
id: "lnDerivativeTwo",
|
|
47
68
|
connector: "=",
|
|
48
69
|
label: "Dérivée de $a \\times \\ln(x) + b$",
|
|
49
|
-
levels: ["1reESM", "1reSpé", "1reTech", "MathComp", "TermSpé"],
|
|
50
|
-
sections: ["Dérivation", "Logarithme népérien"],
|
|
51
70
|
isSingleStep: false,
|
|
52
71
|
generator: (nb) => getDistinctQuestions(getLnDerivative, nb),
|
|
53
72
|
getPropositions,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"powerCompositionDerivation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivative/powerCompositionDerivation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAerC,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;
|
|
1
|
+
{"version":3,"file":"powerCompositionDerivation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivative/powerCompositionDerivation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAerC,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAqIF,eAAO,MAAM,0BAA0B,EAAE,QAAQ,CAAC,WAAW,CAmB5D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"powerFunctionDerivative.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivative/powerFunctionDerivative.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"powerFunctionDerivative.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivative/powerFunctionDerivative.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAWT,MAAM,6BAA6B,CAAC;AAWrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AA0HF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,WAAW,CAczD,CAAC"}
|
|
@@ -5,21 +5,36 @@ import { NumberNode } from "../../../../tree/nodes/numbers/numberNode.js";
|
|
|
5
5
|
import { MultiplyNode } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
6
6
|
import { PowerNode } from "../../../../tree/nodes/operators/powerNode.js";
|
|
7
7
|
import { VariableNode } from "../../../../tree/nodes/variables/variableNode.js";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
|
|
9
|
+
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
10
|
+
const getInstruction = (identifiers) => {
|
|
11
|
+
const { a, power } = identifiers;
|
|
11
12
|
const statement = new MultiplyNode(new NumberNode(a), new PowerNode(new VariableNode("x"), new NumberNode(power)));
|
|
13
|
+
return `Déterminer la fonction dérivée $f'$ de la fonction $f$ définie par :
|
|
14
|
+
|
|
15
|
+
$$
|
|
16
|
+
f(x)=${statement.toTex()}
|
|
17
|
+
$$`;
|
|
18
|
+
};
|
|
19
|
+
const getAnswer = (identifiers) => {
|
|
20
|
+
const { a, power } = identifiers;
|
|
12
21
|
const answerStatement = power > 2
|
|
13
22
|
? new MultiplyNode(new NumberNode(a * power), new PowerNode(new VariableNode("x"), new NumberNode(power - 1)))
|
|
14
23
|
: new MultiplyNode(new NumberNode(a * power), new VariableNode("x"));
|
|
15
24
|
const answer = answerStatement.toTex();
|
|
25
|
+
return answer;
|
|
26
|
+
};
|
|
27
|
+
const getPowerFunctionDerivative = () => {
|
|
28
|
+
const a = randint(-9, 10, [0]);
|
|
29
|
+
const power = randint(2, 10);
|
|
30
|
+
const identifiers = { a, power };
|
|
16
31
|
const question = {
|
|
17
|
-
instruction:
|
|
32
|
+
instruction: getInstruction(identifiers),
|
|
18
33
|
startStatement: `f'(x)`,
|
|
19
|
-
answer,
|
|
34
|
+
answer: getAnswer(identifiers),
|
|
20
35
|
keys: ["x"],
|
|
21
36
|
answerFormat: "tex",
|
|
22
|
-
identifiers
|
|
37
|
+
identifiers,
|
|
23
38
|
};
|
|
24
39
|
return question;
|
|
25
40
|
};
|
|
@@ -44,20 +59,23 @@ const getPropositions = (n, { answer, a, power }) => {
|
|
|
44
59
|
}
|
|
45
60
|
return shuffleProps(propositions, n);
|
|
46
61
|
};
|
|
47
|
-
const isAnswerValid = (ans, { a, power }) => {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
62
|
+
const isAnswerValid = (ans, { answer, a, power }) => {
|
|
63
|
+
try {
|
|
64
|
+
const parsed = parseAlgebraic(ans);
|
|
65
|
+
if (!parsed)
|
|
66
|
+
return false;
|
|
67
|
+
return (parsed
|
|
68
|
+
.simplify({ towardsDistribute: true, forbidFactorize: true })
|
|
69
|
+
.toTex() === answer);
|
|
70
|
+
}
|
|
71
|
+
catch (err) {
|
|
72
|
+
return handleVEAError(err);
|
|
73
|
+
}
|
|
54
74
|
};
|
|
55
75
|
export const powerFunctionDerivative = {
|
|
56
76
|
id: "powerFunctionDerivative",
|
|
57
77
|
connector: "=",
|
|
58
78
|
label: "Dérivée d'une fonction monôme",
|
|
59
|
-
levels: ["1reESM", "1reSpé", "1reTech", "MathComp"],
|
|
60
|
-
sections: ["Dérivation"],
|
|
61
79
|
isSingleStep: false,
|
|
62
80
|
generator: (nb) => getDistinctQuestions(getPowerFunctionDerivative, nb),
|
|
63
81
|
getPropositions,
|
|
@@ -65,4 +83,6 @@ export const powerFunctionDerivative = {
|
|
|
65
83
|
qcmTimer: 60,
|
|
66
84
|
freeTimer: 60,
|
|
67
85
|
subject: "Mathématiques",
|
|
86
|
+
getInstruction,
|
|
87
|
+
getAnswer,
|
|
68
88
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"productDerivative.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivative/productDerivative.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,QAAQ,
|
|
1
|
+
{"version":3,"file":"productDerivative.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivative/productDerivative.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,QAAQ,EAUT,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IACjB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB,CAAC;AAoFF,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,WAAW,CAgBnD,CAAC"}
|
|
@@ -2,19 +2,38 @@ import { shuffleProps, tryToAddWrongProp, addValidProp, } from "../../../../exer
|
|
|
2
2
|
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
3
|
import { Polynomial, PolynomialConstructor, } from "../../../../math/polynomials/polynomial.js";
|
|
4
4
|
import { MultiplyNode } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
5
|
+
import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
|
|
6
|
+
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
7
|
+
const getInstruction = (identifiers) => {
|
|
8
|
+
const { poly1Coeffs, poly2Coeffs } = identifiers;
|
|
9
|
+
const poly1 = new Polynomial(poly1Coeffs);
|
|
10
|
+
const poly2 = new Polynomial(poly2Coeffs);
|
|
11
|
+
return `Déterminer la dérivée de la fonction $f$ définie par :
|
|
12
|
+
|
|
13
|
+
$$
|
|
14
|
+
f(x) = ${new MultiplyNode(poly1.toTree(), poly2.toTree()).toTex()}
|
|
15
|
+
$$`;
|
|
16
|
+
};
|
|
17
|
+
const getAnswer = (identifiers) => {
|
|
18
|
+
const { poly1Coeffs, poly2Coeffs } = identifiers;
|
|
19
|
+
const poly1 = new Polynomial(poly1Coeffs);
|
|
20
|
+
const poly2 = new Polynomial(poly2Coeffs);
|
|
21
|
+
const answer = poly1.multiply(poly2).derivate().toTree().toTex();
|
|
22
|
+
return answer;
|
|
23
|
+
};
|
|
5
24
|
const getProductDerivativeQuestion = () => {
|
|
6
25
|
const poly1 = PolynomialConstructor.randomWithLength(3, 2);
|
|
7
26
|
const poly2 = PolynomialConstructor.randomWithLength(3, 2);
|
|
8
|
-
const
|
|
27
|
+
const identifiers = {
|
|
28
|
+
poly1Coeffs: poly1.coefficients,
|
|
29
|
+
poly2Coeffs: poly2.coefficients,
|
|
30
|
+
};
|
|
9
31
|
const question = {
|
|
10
|
-
answer:
|
|
11
|
-
instruction:
|
|
32
|
+
answer: getAnswer(identifiers),
|
|
33
|
+
instruction: getInstruction(identifiers),
|
|
12
34
|
keys: ["x", "xsquare", "xcube"],
|
|
13
35
|
answerFormat: "tex",
|
|
14
|
-
identifiers
|
|
15
|
-
poly1Coeffs: poly1.coefficients,
|
|
16
|
-
poly2Coeffs: poly2.coefficients,
|
|
17
|
-
},
|
|
36
|
+
identifiers,
|
|
18
37
|
};
|
|
19
38
|
return question;
|
|
20
39
|
};
|
|
@@ -31,15 +50,21 @@ const getPropositions = (n, { answer, poly1Coeffs, poly2Coeffs }) => {
|
|
|
31
50
|
}
|
|
32
51
|
return shuffleProps(propositions, n);
|
|
33
52
|
};
|
|
34
|
-
const isAnswerValid = (ans, { poly1Coeffs, poly2Coeffs }) => {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
53
|
+
const isAnswerValid = (ans, { answer, poly1Coeffs, poly2Coeffs }) => {
|
|
54
|
+
try {
|
|
55
|
+
const parsed = parseAlgebraic(ans);
|
|
56
|
+
if (!parsed)
|
|
57
|
+
return false;
|
|
58
|
+
return (parsed
|
|
59
|
+
.simplify({
|
|
60
|
+
towardsDistribute: true,
|
|
61
|
+
forbidFactorize: true,
|
|
62
|
+
})
|
|
63
|
+
.toTex() === answer);
|
|
64
|
+
}
|
|
65
|
+
catch (err) {
|
|
66
|
+
return handleVEAError(err);
|
|
67
|
+
}
|
|
43
68
|
};
|
|
44
69
|
export const productDerivative = {
|
|
45
70
|
id: "productDerivative",
|
|
@@ -54,4 +79,6 @@ export const productDerivative = {
|
|
|
54
79
|
freeTimer: 60,
|
|
55
80
|
isAnswerValid,
|
|
56
81
|
subject: "Mathématiques",
|
|
82
|
+
getAnswer,
|
|
83
|
+
getInstruction,
|
|
57
84
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"quotientDerivative.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivative/quotientDerivative.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,QAAQ,EAUT,MAAM,6BAA6B,CAAC;AAYrC,KAAK,WAAW,GAAG;IACjB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB,CAAC;AAuGF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,
|
|
1
|
+
{"version":3,"file":"quotientDerivative.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivative/quotientDerivative.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,QAAQ,EAUT,MAAM,6BAA6B,CAAC;AAYrC,KAAK,WAAW,GAAG;IACjB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB,CAAC;AAuGF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,CAYpD,CAAC"}
|
|
@@ -88,9 +88,7 @@ export const quotientDerivative = {
|
|
|
88
88
|
id: "quotientDerivative",
|
|
89
89
|
connector: "=",
|
|
90
90
|
label: "Dérivée d'un quotient de polynômes",
|
|
91
|
-
levels: ["1reSpé", "MathComp"],
|
|
92
91
|
isSingleStep: true,
|
|
93
|
-
sections: ["Dérivation"],
|
|
94
92
|
generator: (nb) => getDistinctQuestions(getProductDerivativeQuestion, nb),
|
|
95
93
|
qcmTimer: 60,
|
|
96
94
|
freeTimer: 60,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rootFunctionDerivative.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivative/rootFunctionDerivative.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAoBrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AA+FF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,
|
|
1
|
+
{"version":3,"file":"rootFunctionDerivative.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivative/rootFunctionDerivative.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAoBrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AA+FF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,CAiBxD,CAAC"}
|
|
@@ -100,8 +100,6 @@ export const rootFunctionDerivative = {
|
|
|
100
100
|
id: "rootFunctionDerivative",
|
|
101
101
|
connector: "=",
|
|
102
102
|
label: "Dérivée d'une fonction racine carrée",
|
|
103
|
-
levels: ["1reESM", "1reSpé", "1reTech", "MathComp"],
|
|
104
|
-
sections: ["Dérivation", "Racines carrées"],
|
|
105
103
|
isSingleStep: false,
|
|
106
104
|
generator: (nb) => getDistinctQuestions(getRootFunctionDerivative, nb),
|
|
107
105
|
qcmTimer: 60,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"secondDegreeDerivative.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivative/secondDegreeDerivative.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAMR,YAAY,EAEZ,iBAAiB,EACjB,GAAG,EAGJ,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"secondDegreeDerivative.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivative/secondDegreeDerivative.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAMR,YAAY,EAEZ,iBAAiB,EACjB,GAAG,EAGJ,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IACjB,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB,CAAC;AA8CF,eAAO,MAAM,yBAAyB,EAAE,iBAAiB,CAAC,WAAW,CAgBpE,CAAC;AAEF,eAAO,MAAM,qCAAqC,EAAE,YAAY,CAC9D,WAAW,CA+BZ,CAAC;AACF,eAAO,MAAM,mCAAmC,EAAE,GAAG,CAAC,WAAW,CAehE,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,CAiBxD,CAAC"}
|
|
@@ -4,7 +4,9 @@ import { Polynomial } from "../../../../math/polynomials/polynomial.js";
|
|
|
4
4
|
import { randint } from "../../../../math/utils/random/randint.js";
|
|
5
5
|
import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
6
6
|
import { power } from "../../../../tree/nodes/operators/powerNode.js";
|
|
7
|
+
import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
|
|
7
8
|
import { shuffle } from "../../../../utils/alea/shuffle.js";
|
|
9
|
+
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
8
10
|
const getAnswer = (identifiers) => {
|
|
9
11
|
const polynomial = new Polynomial(identifiers.coefficients);
|
|
10
12
|
const derivative = polynomial.derivate();
|
|
@@ -81,26 +83,23 @@ export const getSecondDegreeDerivativePropositions = (n, { answer, coefficients
|
|
|
81
83
|
}
|
|
82
84
|
return shuffle(propositions);
|
|
83
85
|
};
|
|
84
|
-
export const isSecondDegreeDerivativeAnswerValid = (ans, { coefficients }) => {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
86
|
+
export const isSecondDegreeDerivativeAnswerValid = (ans, { answer, coefficients }) => {
|
|
87
|
+
try {
|
|
88
|
+
const parsed = parseAlgebraic(ans);
|
|
89
|
+
if (!parsed)
|
|
90
|
+
return false;
|
|
91
|
+
return (parsed
|
|
92
|
+
.simplify({ towardsDistribute: true, forbidFactorize: true })
|
|
93
|
+
.toTex() === answer);
|
|
94
|
+
}
|
|
95
|
+
catch (err) {
|
|
96
|
+
return handleVEAError(err);
|
|
97
|
+
}
|
|
89
98
|
};
|
|
90
99
|
export const secondDegreeDerivative = {
|
|
91
100
|
id: "secondDegreeDerivative",
|
|
92
101
|
connector: "=",
|
|
93
102
|
label: "Dérivée d'un polynôme de degré $2$",
|
|
94
|
-
levels: [
|
|
95
|
-
"1reESM",
|
|
96
|
-
"1reSpé",
|
|
97
|
-
"1reTech",
|
|
98
|
-
"MathComp",
|
|
99
|
-
"1rePro",
|
|
100
|
-
"TermPro",
|
|
101
|
-
"TermTech",
|
|
102
|
-
],
|
|
103
|
-
sections: ["Dérivation"],
|
|
104
103
|
isSingleStep: false,
|
|
105
104
|
generator: (nb) => getDistinctQuestions(getSecondDegreeDerivative, nb),
|
|
106
105
|
qcmTimer: 60,
|
|
@@ -111,4 +110,6 @@ export const secondDegreeDerivative = {
|
|
|
111
110
|
getHint,
|
|
112
111
|
getCorrection,
|
|
113
112
|
hasHintAndCorrection: true,
|
|
113
|
+
getInstruction,
|
|
114
|
+
getAnswer,
|
|
114
115
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"secondDerivativeOfExpoFunction.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivative/secondDerivativeOfExpoFunction.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"secondDerivativeOfExpoFunction.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivative/secondDerivativeOfExpoFunction.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAWT,MAAM,6BAA6B,CAAC;AAcrC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AAgFF,eAAO,MAAM,8BAA8B,EAAE,QAAQ,CAAC,WAAW,CAahE,CAAC"}
|
|
@@ -2,19 +2,40 @@ import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../exer
|
|
|
2
2
|
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
3
|
import { Polynomial, PolynomialConstructor, } from "../../../../math/polynomials/polynomial.js";
|
|
4
4
|
import { expUDerivate } from "../../../../math/utils/functions/expUDerivate.js";
|
|
5
|
-
import { expuSecondDerivative } from "../../../../math/utils/functions/expUSecondDerivate.js";
|
|
6
5
|
import { ExpNode } from "../../../../tree/nodes/functions/expNode.js";
|
|
6
|
+
import { AddNode } from "../../../../tree/nodes/operators/addNode.js";
|
|
7
7
|
import { MultiplyNode } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
8
|
+
import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
|
|
9
|
+
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
10
|
+
const getInstruction = (identifiers) => {
|
|
11
|
+
const { coeffs } = identifiers;
|
|
12
|
+
const polynom = new Polynomial(coeffs);
|
|
13
|
+
const funct = new ExpNode(polynom.toTree());
|
|
14
|
+
return `Déterminer la fonction dérivée seconde $f''$ de la fonction $f$ définie par :
|
|
15
|
+
|
|
16
|
+
$$
|
|
17
|
+
f(x)=${funct.toTex()}
|
|
18
|
+
$$`;
|
|
19
|
+
};
|
|
20
|
+
const getAnswer = (identifiers) => {
|
|
21
|
+
const { coeffs } = identifiers;
|
|
22
|
+
const polynom = new Polynomial(coeffs);
|
|
23
|
+
const funct = new ExpNode(polynom.toTree());
|
|
24
|
+
const uDerivated = polynom.derivate().toTree();
|
|
25
|
+
const uSecondDerivated = polynom.secondDerivate();
|
|
26
|
+
return new AddNode(new MultiplyNode(uSecondDerivated.toTree(), funct).simplify(), new MultiplyNode(uDerivated, expUDerivate(funct, polynom)).simplify())
|
|
27
|
+
.simplify({ towardsDistribute: true, forbidFactorize: true })
|
|
28
|
+
.toTex();
|
|
29
|
+
};
|
|
8
30
|
const getSecondDerivativeOfExpoFunctionQuestion = () => {
|
|
9
31
|
const polynom = PolynomialConstructor.randomWithOrder(1, "x");
|
|
10
|
-
const
|
|
11
|
-
const correctAnswer = expuSecondDerivative(funct, polynom);
|
|
32
|
+
const identifiers = { coeffs: polynom.coefficients };
|
|
12
33
|
const question = {
|
|
13
|
-
answer:
|
|
14
|
-
instruction:
|
|
34
|
+
answer: getAnswer(identifiers),
|
|
35
|
+
instruction: getInstruction(identifiers),
|
|
15
36
|
keys: ["epower", "x", "lnBrackets"],
|
|
16
37
|
answerFormat: "tex",
|
|
17
|
-
identifiers
|
|
38
|
+
identifiers,
|
|
18
39
|
};
|
|
19
40
|
return question;
|
|
20
41
|
};
|
|
@@ -27,11 +48,18 @@ const getPropositions = (n, { answer, coeffs }) => {
|
|
|
27
48
|
}
|
|
28
49
|
return shuffleProps(propositions, n);
|
|
29
50
|
};
|
|
30
|
-
const isAnswerValid = (ans, { coeffs }) => {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
51
|
+
const isAnswerValid = (ans, { answer, coeffs }) => {
|
|
52
|
+
try {
|
|
53
|
+
const parsed = parseAlgebraic(ans);
|
|
54
|
+
if (!parsed)
|
|
55
|
+
return false;
|
|
56
|
+
return (parsed
|
|
57
|
+
.simplify({ towardsDistribute: true, forbidFactorize: true })
|
|
58
|
+
.toTex() === answer);
|
|
59
|
+
}
|
|
60
|
+
catch (err) {
|
|
61
|
+
return handleVEAError(err);
|
|
62
|
+
}
|
|
35
63
|
};
|
|
36
64
|
const generateProposition = (coeffs) => {
|
|
37
65
|
const u = new Polynomial(coeffs, "x");
|
package/lib/exercises/math/derivation/derivative/secondDerivativeOfThirdDegreeFunction.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"secondDerivativeOfThirdDegreeFunction.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivative/secondDerivativeOfThirdDegreeFunction.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"secondDerivativeOfThirdDegreeFunction.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivative/secondDerivativeOfThirdDegreeFunction.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAWT,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAqFF,eAAO,MAAM,qCAAqC,EAAE,QAAQ,CAAC,WAAW,CAavE,CAAC"}
|
|
@@ -1,25 +1,39 @@
|
|
|
1
1
|
import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
|
|
2
2
|
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
3
|
import { Polynomial, PolynomialConstructor, } from "../../../../math/polynomials/polynomial.js";
|
|
4
|
+
import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
|
|
5
|
+
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
6
|
+
const getInstruction = (identifiers) => {
|
|
7
|
+
const { a, b, c, d } = identifiers;
|
|
8
|
+
const funct = new Polynomial([d, c, b, a]);
|
|
9
|
+
return `Déterminer la fonction dérivée seconde $f''$ de la fonction $f$ définie par :
|
|
10
|
+
|
|
11
|
+
$$
|
|
12
|
+
f(x)=${funct.toTree().toTex()}
|
|
13
|
+
$$`;
|
|
14
|
+
};
|
|
15
|
+
const getAnswer = (identifiers) => {
|
|
16
|
+
const { a, b, c, d } = identifiers;
|
|
17
|
+
const funct = new Polynomial([d, c, b, a]);
|
|
18
|
+
const correctAnswer = funct.secondDerivate().toTree();
|
|
19
|
+
return correctAnswer.toTex();
|
|
20
|
+
};
|
|
4
21
|
const getSecondDerivativeOfThirdDegreeFunction = () => {
|
|
5
22
|
const funct = PolynomialConstructor.randomWithOrder(3, "x");
|
|
6
23
|
const coefficients = funct.coefficients;
|
|
7
|
-
const correctAnswer = funct.secondDerivate().toTree();
|
|
8
|
-
const instruction = `Déterminer la fonction dérivée seconde $f''$ de la fonction $f$ définie par $f(x)=${funct
|
|
9
|
-
.toTree()
|
|
10
|
-
.toTex()}$.`;
|
|
11
24
|
const coeff = {
|
|
12
25
|
a: coefficients[3],
|
|
13
26
|
b: coefficients[2],
|
|
14
27
|
c: coefficients[1],
|
|
15
28
|
d: coefficients[0],
|
|
16
29
|
};
|
|
30
|
+
const identifiers = { ...coeff };
|
|
17
31
|
const question = {
|
|
18
|
-
answer:
|
|
19
|
-
instruction:
|
|
32
|
+
answer: getAnswer(identifiers),
|
|
33
|
+
instruction: getInstruction(identifiers),
|
|
20
34
|
keys: ["x"],
|
|
21
35
|
answerFormat: "tex",
|
|
22
|
-
identifiers
|
|
36
|
+
identifiers,
|
|
23
37
|
};
|
|
24
38
|
return question;
|
|
25
39
|
};
|
|
@@ -38,20 +52,29 @@ const generateProposition = (a, b, c, d) => {
|
|
|
38
52
|
const thirdProposition = new Polynomial([c, 2 * b, 3 * 2 * a], "x").toTree();
|
|
39
53
|
return [firstPropostion, secondProposition, thirdProposition];
|
|
40
54
|
};
|
|
41
|
-
const isAnswerValid = (ans, { a, b, c, d }) => {
|
|
42
|
-
|
|
43
|
-
|
|
55
|
+
const isAnswerValid = (ans, { answer, a, b, c, d }) => {
|
|
56
|
+
try {
|
|
57
|
+
const parsed = parseAlgebraic(ans);
|
|
58
|
+
if (!parsed)
|
|
59
|
+
return false;
|
|
60
|
+
return (parsed
|
|
61
|
+
.simplify({ towardsDistribute: true, forbidFactorize: true })
|
|
62
|
+
.toTex() === answer);
|
|
63
|
+
}
|
|
64
|
+
catch (err) {
|
|
65
|
+
return handleVEAError(err);
|
|
66
|
+
}
|
|
44
67
|
};
|
|
45
68
|
export const secondDerivativeOfThridDegreeFunction = {
|
|
46
69
|
id: "secondDerivativeOfThirdDegreeFunction",
|
|
47
70
|
label: "Dérivée seconde d'un polynôme de degré $3$",
|
|
48
|
-
levels: ["TermSpé"],
|
|
49
71
|
isSingleStep: true,
|
|
50
|
-
sections: ["Dérivation"],
|
|
51
72
|
generator: (nb) => getDistinctQuestions(getSecondDerivativeOfThirdDegreeFunction, nb),
|
|
52
73
|
qcmTimer: 60,
|
|
53
74
|
freeTimer: 60,
|
|
54
75
|
getPropositions,
|
|
55
76
|
isAnswerValid,
|
|
56
77
|
subject: "Mathématiques",
|
|
78
|
+
getInstruction,
|
|
79
|
+
getAnswer,
|
|
57
80
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"secondDerivativeOfTrinom.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivative/secondDerivativeOfTrinom.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"secondDerivativeOfTrinom.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivative/secondDerivativeOfTrinom.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAWT,MAAM,6BAA6B,CAAC;AAWrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAsEF,eAAO,MAAM,wBAAwB,EAAE,QAAQ,CAAC,WAAW,CAa1D,CAAC"}
|