math-exercises 3.0.25 → 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/calculLitteral/equation/equationType1Exercise.js +1 -1
- package/lib/exercises/math/dataRepresentations/functionGraphReading.d.ts +3 -1
- package/lib/exercises/math/dataRepresentations/functionGraphReading.d.ts.map +1 -1
- package/lib/exercises/math/dataRepresentations/functionGraphReading.js +57 -20
- package/lib/exercises/math/dataRepresentations/index.d.ts +1 -1
- package/lib/exercises/math/dataRepresentations/index.d.ts.map +1 -1
- package/lib/exercises/math/dataRepresentations/index.js +2 -2
- package/lib/exercises/math/dataRepresentations/testGen.d.ts.map +1 -1
- package/lib/exercises/math/dataRepresentations/testGen.js +11 -0
- 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/percent/findTVA.js +1 -1
- 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 +6 -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
|
@@ -91,7 +91,7 @@ const isAnswerValid = (ans, { a, b }) => {
|
|
|
91
91
|
export const equationType1Exercise = {
|
|
92
92
|
id: "equa1",
|
|
93
93
|
connector: "\\iff",
|
|
94
|
-
label: "
|
|
94
|
+
label: "Résoudre une équation du type $x+a = b$",
|
|
95
95
|
levels: ["4ème", "3ème", "2nde", "CAP", "2ndPro", "1rePro", "1reTech"],
|
|
96
96
|
sections: ["Équations"],
|
|
97
97
|
isSingleStep: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"functionGraphReading.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/dataRepresentations/functionGraphReading.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"functionGraphReading.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/dataRepresentations/functionGraphReading.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;AAerC,KAAK,WAAW,GAAG;IACjB,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AA4HF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAiBtD,CAAC;;AAEF,UAAU;AACV;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsGE"}
|
|
@@ -1,40 +1,60 @@
|
|
|
1
|
-
import { addValidProp, shuffleProps, } from "../../../exercises/exercise.js";
|
|
1
|
+
import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../exercises/exercise.js";
|
|
2
2
|
import { getDistinctQuestions } from "../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { randomColor } from "../../../geogebra/colors.js";
|
|
3
4
|
import { GeogebraConstructor } from "../../../geogebra/geogebraConstructor.js";
|
|
5
|
+
import { approxEqual } from "../../../geogebra/parsers/approxEqual.js";
|
|
4
6
|
import { Affine } from "../../../math/polynomials/affine.js";
|
|
5
7
|
import { randint } from "../../../math/utils/random/randint.js";
|
|
6
8
|
import { round } from "../../../math/utils/round.js";
|
|
7
|
-
|
|
9
|
+
import { valueParser } from "../../../tree/parsers/valueParser.js";
|
|
10
|
+
import { coinFlip } from "../../../utils/alea/coinFlip.js";
|
|
11
|
+
import { handleVEAError } from "../../../utils/errors/handleVEAError.js";
|
|
12
|
+
const getPropositions = (n, { answer, a, b, yValue, isAskingX }) => {
|
|
8
13
|
const propositions = [];
|
|
9
14
|
addValidProp(propositions, answer);
|
|
10
15
|
while (propositions.length < n) {
|
|
11
|
-
|
|
16
|
+
if (isAskingX)
|
|
17
|
+
tryToAddWrongProp(propositions, randint(4, 60) + "");
|
|
18
|
+
else
|
|
19
|
+
tryToAddWrongProp(propositions, 100 * randint(20, 60) + "");
|
|
12
20
|
}
|
|
13
21
|
return shuffleProps(propositions, n);
|
|
14
22
|
};
|
|
15
23
|
const getAnswer = (identifiers) => {
|
|
16
|
-
const { a, b, yValue } = identifiers;
|
|
17
|
-
|
|
24
|
+
const { a, b, yValue, xValue, isAskingX } = identifiers;
|
|
25
|
+
if (isAskingX) {
|
|
26
|
+
return round((yValue - b) / a, 0).frenchify();
|
|
27
|
+
}
|
|
28
|
+
else
|
|
29
|
+
return round(a * xValue + b, 0).frenchify();
|
|
18
30
|
};
|
|
19
31
|
const getInstruction = (identifiers) => {
|
|
20
|
-
const { yValue, a, b } = identifiers;
|
|
32
|
+
const { yValue, a, b, isAskingX, xValue } = identifiers;
|
|
21
33
|
return `La droite $(d_1)$ modélise l'évolution du coût total d'un voyage scolaire en fonction du nombre de participants.
|
|
22
34
|
|
|
23
|
-
|
|
35
|
+
${isAskingX
|
|
36
|
+
? `Si le coût total du voyage est de $${yValue}€$, quel est le nombre de participants ?`
|
|
37
|
+
: `Si le nombre de participants est $${xValue}$, quel est le coût total du voyage ?`}`;
|
|
24
38
|
};
|
|
25
39
|
// const getHint: GetHint<Identifiers> = (identifiers) => {};
|
|
26
40
|
// const getCorrection: GetCorrection<Identifiers> = (identifiers) => {};
|
|
27
41
|
const getGGBOptions = (identifiers) => {
|
|
28
|
-
const { a, b, yValue } = identifiers;
|
|
42
|
+
const { a, b, yValue, isAskingX, xValue } = identifiers;
|
|
29
43
|
const affine = new Affine(a, b);
|
|
30
|
-
const
|
|
44
|
+
const x = xValue ?? (yValue - b) / a;
|
|
45
|
+
const y = yValue ?? a * xValue + b;
|
|
46
|
+
const xText = 4;
|
|
47
|
+
const yText = a * xText + b;
|
|
48
|
+
const color = randomColor();
|
|
31
49
|
const ggb = new GeogebraConstructor({
|
|
32
50
|
commands: [
|
|
33
51
|
`f = Function(${a}*x+${b}, 0, 1000)`,
|
|
34
|
-
`
|
|
35
|
-
`
|
|
52
|
+
`SetColor(f, "${color}")`,
|
|
53
|
+
`T = Text("$(d_1)$", (${xText},${yText}), true, true)`,
|
|
54
|
+
`SetColor(T, "${color}")`,
|
|
36
55
|
`Text("Nombre \\ de \\ participants", (x(Corner(2)),50), true, true, -1)`,
|
|
37
56
|
`Text("Coût \\ en \\ €", (1, y(Corner(4))), true, true)`,
|
|
57
|
+
// `(${xValue},${yValue})`,
|
|
38
58
|
],
|
|
39
59
|
forbidShiftDragZoom: false,
|
|
40
60
|
gridDistance: [2, 500],
|
|
@@ -52,26 +72,43 @@ const getGGBOptions = (identifiers) => {
|
|
|
52
72
|
fontSize: 14,
|
|
53
73
|
});
|
|
54
74
|
const xMin = -2;
|
|
55
|
-
const xMax =
|
|
75
|
+
const xMax = x + 6;
|
|
56
76
|
const xDelta = xMax - xMin;
|
|
57
77
|
const yMin = -100;
|
|
58
|
-
const yMax = Math.max(
|
|
78
|
+
const yMax = Math.max(y + 500, xDelta);
|
|
59
79
|
return ggb.getOptions({
|
|
60
|
-
coords: [-1,
|
|
80
|
+
coords: [-1, x + 6, -100, y + 500],
|
|
61
81
|
});
|
|
62
82
|
};
|
|
63
83
|
const getKeys = (identifiers) => {
|
|
64
84
|
return [];
|
|
65
85
|
};
|
|
66
|
-
const isAnswerValid = (ans, { answer }) => {
|
|
67
|
-
|
|
86
|
+
const isAnswerValid = (ans, { answer, isAskingX }) => {
|
|
87
|
+
try {
|
|
88
|
+
const nbAnswer = answer.unfrenchify();
|
|
89
|
+
const parsed = valueParser(ans);
|
|
90
|
+
if (parsed === false)
|
|
91
|
+
return false;
|
|
92
|
+
return approxEqual(parsed, nbAnswer, isAskingX ? 1 : 200);
|
|
93
|
+
}
|
|
94
|
+
catch (err) {
|
|
95
|
+
return handleVEAError(err);
|
|
96
|
+
}
|
|
68
97
|
};
|
|
69
98
|
const getFunctionGraphReadingQuestion = (opts) => {
|
|
70
99
|
const b = randint(0, 2000);
|
|
71
100
|
const randPoint = [2 * randint(5, 20), 3000 + 500 * randint(1, 7)];
|
|
72
|
-
const
|
|
73
|
-
|
|
74
|
-
|
|
101
|
+
const isAskingX = coinFlip();
|
|
102
|
+
let yValue;
|
|
103
|
+
let xValue;
|
|
104
|
+
const a = (randPoint[1] - b) / randPoint[0];
|
|
105
|
+
if (isAskingX) {
|
|
106
|
+
yValue = randPoint[1];
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
xValue = randPoint[0];
|
|
110
|
+
}
|
|
111
|
+
const identifiers = { a, b, yValue, isAskingX, xValue };
|
|
75
112
|
const question = {
|
|
76
113
|
answer: getAnswer(identifiers),
|
|
77
114
|
instruction: getInstruction(identifiers),
|
|
@@ -86,7 +123,7 @@ const getFunctionGraphReadingQuestion = (opts) => {
|
|
|
86
123
|
};
|
|
87
124
|
export const functionGraphReading = {
|
|
88
125
|
id: "functionGraphReading",
|
|
89
|
-
label: "",
|
|
126
|
+
label: "Lire et interpréter la courbe d'une fonction",
|
|
90
127
|
isSingleStep: true,
|
|
91
128
|
generator: (nb, opts) => getDistinctQuestions(() => getFunctionGraphReadingQuestion(opts), nb),
|
|
92
129
|
qcmTimer: 60,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/dataRepresentations/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/dataRepresentations/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAElC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,sBAAsB,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export * from "./tableReading.js";
|
|
2
2
|
// export * from "./barChartReading.js";
|
|
3
|
-
|
|
3
|
+
export * from "./functionGraphReading.js";
|
|
4
4
|
export * from "./pieChartReading.js";
|
|
5
|
-
export * from "./testGen.js";
|
|
5
|
+
// export * from "./testGen.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testGen.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/dataRepresentations/testGen.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAKrC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,OAAO,CAAC;CACxB,CAAC;
|
|
1
|
+
{"version":3,"file":"testGen.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/dataRepresentations/testGen.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAKrC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,OAAO,CAAC;CACxB,CAAC;AA8DF,eAAO,MAAM,OAAO,EAAE,QAAQ,CAAC,WAAW,CAkBzC,CAAC"}
|
|
@@ -33,6 +33,12 @@ const isAnswerValid = (ans, { answer }) => {
|
|
|
33
33
|
return handleVEAError(err);
|
|
34
34
|
}
|
|
35
35
|
};
|
|
36
|
+
const getHint = (identifiers) => {
|
|
37
|
+
return "voici l'indice";
|
|
38
|
+
};
|
|
39
|
+
const getCorrection = (identifiers) => {
|
|
40
|
+
return "voici la correction";
|
|
41
|
+
};
|
|
36
42
|
const getTestGenQuestion = (ops) => {
|
|
37
43
|
const identifiers = {
|
|
38
44
|
rand: Math.random(),
|
|
@@ -43,6 +49,8 @@ const getTestGenQuestion = (ops) => {
|
|
|
43
49
|
instruction: getInstruction(identifiers),
|
|
44
50
|
keys: getKeys(identifiers),
|
|
45
51
|
answerFormat: "tex",
|
|
52
|
+
hint: getHint(identifiers),
|
|
53
|
+
correction: getCorrection(identifiers),
|
|
46
54
|
identifiers,
|
|
47
55
|
};
|
|
48
56
|
return question;
|
|
@@ -61,4 +69,7 @@ export const testGen = {
|
|
|
61
69
|
getAnswer,
|
|
62
70
|
isQCM: true,
|
|
63
71
|
answerType: "QCM",
|
|
72
|
+
hasHintAndCorrection: true,
|
|
73
|
+
getHint,
|
|
74
|
+
getCorrection,
|
|
64
75
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convexityQuadrinomials.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivative/convexityQuadrinomials.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"convexityQuadrinomials.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivative/convexityQuadrinomials.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAWT,MAAM,6BAA6B,CAAC;AAoBrC,KAAK,WAAW,GAAG;IACjB,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AAqIF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,CAcxD,CAAC"}
|
|
@@ -11,13 +11,24 @@ import { IntervalNode } from "../../../../tree/nodes/sets/intervalNode.js";
|
|
|
11
11
|
import { intervalParser } from "../../../../tree/parsers/intervalParser.js";
|
|
12
12
|
import { coinFlip } from "../../../../utils/alea/coinFlip.js";
|
|
13
13
|
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const
|
|
14
|
+
const getInstruction = (identifiers) => {
|
|
15
|
+
const { askConvex, quadcoeffs } = identifiers;
|
|
16
|
+
const quadrinomial = new Polynomial(quadcoeffs);
|
|
17
|
+
const questionType = askConvex ? "convexe" : "concave";
|
|
18
|
+
return `Soit la fonction $f$ définie par :
|
|
19
|
+
|
|
20
|
+
$$
|
|
21
|
+
f(x) = ${quadrinomial.toTex()}
|
|
22
|
+
$$
|
|
23
|
+
|
|
24
|
+
Sur quelle intervalle $f$ est-elle ${questionType} ?`;
|
|
25
|
+
};
|
|
26
|
+
const getAnswer = (identifiers) => {
|
|
27
|
+
const { askConvex, quadcoeffs } = identifiers;
|
|
28
|
+
const quadrinomial = new Polynomial(quadcoeffs);
|
|
17
29
|
const secondderivative = quadrinomial.derivate().derivate();
|
|
18
30
|
const seconddcoeffs = secondderivative.coefficients;
|
|
19
31
|
const inflexionPoint = new FractionNode(new MultiplyNode(seconddcoeffs[0].toTree(), new NumberNode(-1)), seconddcoeffs[1].toTree()).simplify();
|
|
20
|
-
const askConvex = coinFlip();
|
|
21
32
|
let interval;
|
|
22
33
|
if (askConvex) {
|
|
23
34
|
interval =
|
|
@@ -31,13 +42,19 @@ const getConvexityQuadrinomialsQuestion = () => {
|
|
|
31
42
|
? new IntervalNode(inflexionPoint, PlusInfinityNode, ClosureType.OO).toTex()
|
|
32
43
|
: new IntervalNode(MinusInfinityNode, inflexionPoint, ClosureType.OO).toTex();
|
|
33
44
|
}
|
|
34
|
-
|
|
45
|
+
return interval;
|
|
46
|
+
};
|
|
47
|
+
const getConvexityQuadrinomialsQuestion = () => {
|
|
48
|
+
const quadrinomial = PolynomialConstructor.randomWithOrder(3);
|
|
49
|
+
const quadcoeffs = quadrinomial.coefficients;
|
|
50
|
+
const askConvex = coinFlip();
|
|
51
|
+
const identifiers = { askConvex, quadcoeffs };
|
|
35
52
|
const question = {
|
|
36
|
-
answer:
|
|
37
|
-
instruction:
|
|
53
|
+
answer: getAnswer(identifiers),
|
|
54
|
+
instruction: getInstruction(identifiers),
|
|
38
55
|
keys: ["rbracket", "lbracket", "semicolon", "infty", "reals"],
|
|
39
56
|
answerFormat: "tex",
|
|
40
|
-
identifiers
|
|
57
|
+
identifiers,
|
|
41
58
|
};
|
|
42
59
|
return question;
|
|
43
60
|
};
|
|
@@ -72,9 +89,7 @@ const isAnswerValid = (ans, { answer, askConvex, quadcoeffs }) => {
|
|
|
72
89
|
export const convexityQuadrinomials = {
|
|
73
90
|
id: "convexityQuadrinomials",
|
|
74
91
|
label: "Convexité des fonctions polynomiales de degré $3$",
|
|
75
|
-
levels: ["TermSpé"],
|
|
76
92
|
isSingleStep: true,
|
|
77
|
-
sections: ["Dérivation"],
|
|
78
93
|
generator: (nb) => getDistinctQuestions(getConvexityQuadrinomialsQuestion, nb),
|
|
79
94
|
qcmTimer: 60,
|
|
80
95
|
freeTimer: 60,
|
|
@@ -82,4 +97,6 @@ export const convexityQuadrinomials = {
|
|
|
82
97
|
getPropositions,
|
|
83
98
|
isAnswerValid,
|
|
84
99
|
subject: "Mathématiques",
|
|
100
|
+
getAnswer,
|
|
101
|
+
getInstruction,
|
|
85
102
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convexityTrinomials.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivative/convexityTrinomials.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"convexityTrinomials.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivative/convexityTrinomials.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAWT,MAAM,6BAA6B,CAAC;AAIrC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AA0CF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,WAAW,CAarD,CAAC"}
|
|
@@ -1,15 +1,30 @@
|
|
|
1
1
|
import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
|
|
2
2
|
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
3
|
import { TrinomConstructor } from "../../../../math/polynomials/trinom.js";
|
|
4
|
+
const getInstruction = (identifiers) => {
|
|
5
|
+
const trinom = TrinomConstructor.fromCoeffs(identifiers.coeffs);
|
|
6
|
+
return `Soit la fonction $f$ définie par :
|
|
7
|
+
|
|
8
|
+
$$
|
|
9
|
+
f(x) = ${trinom.toTex()}
|
|
10
|
+
$$
|
|
11
|
+
|
|
12
|
+
Sur $\\mathbb{R}$, $f$ est :`;
|
|
13
|
+
};
|
|
14
|
+
const getAnswer = (identifiers) => {
|
|
15
|
+
const trinom = TrinomConstructor.fromCoeffs(identifiers.coeffs);
|
|
16
|
+
const isConvex = trinom.a > 0 ? "Convexe" : "Concave";
|
|
17
|
+
return isConvex;
|
|
18
|
+
};
|
|
4
19
|
const getConvexityTrinomialsQuestion = () => {
|
|
5
20
|
const trinom = TrinomConstructor.random();
|
|
6
|
-
const
|
|
21
|
+
const identifiers = { coeffs: trinom.coefficients };
|
|
7
22
|
const question = {
|
|
8
|
-
answer:
|
|
9
|
-
instruction:
|
|
23
|
+
answer: getAnswer(identifiers),
|
|
24
|
+
instruction: getInstruction(identifiers),
|
|
10
25
|
keys: [],
|
|
11
26
|
answerFormat: "raw",
|
|
12
|
-
identifiers
|
|
27
|
+
identifiers,
|
|
13
28
|
};
|
|
14
29
|
return question;
|
|
15
30
|
};
|
|
@@ -22,20 +37,16 @@ const getPropositions = (n, { answer }) => {
|
|
|
22
37
|
tryToAddWrongProp(propositions, "On ne peut pas savoir", "raw");
|
|
23
38
|
return shuffleProps(propositions, n);
|
|
24
39
|
};
|
|
25
|
-
const isAnswerValid = (ans, { answer }) => {
|
|
26
|
-
throw Error("VEA not implemented");
|
|
27
|
-
};
|
|
28
40
|
export const convexityTrinomials = {
|
|
29
41
|
id: "convexityTrinomials",
|
|
30
42
|
label: "Déterminer la convexité d'un trinôme",
|
|
31
|
-
levels: ["TermSpé"],
|
|
32
43
|
isSingleStep: true,
|
|
33
|
-
sections: ["Dérivation"],
|
|
34
44
|
generator: (nb) => getDistinctQuestions(getConvexityTrinomialsQuestion, nb),
|
|
35
45
|
qcmTimer: 60,
|
|
36
46
|
freeTimer: 60,
|
|
37
47
|
answerType: "QCU",
|
|
38
48
|
getPropositions,
|
|
39
|
-
isAnswerValid,
|
|
40
49
|
subject: "Mathématiques",
|
|
50
|
+
getAnswer,
|
|
51
|
+
getInstruction,
|
|
41
52
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cosCompositionDerivation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivative/cosCompositionDerivation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"cosCompositionDerivation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivative/cosCompositionDerivation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAWT,MAAM,6BAA6B,CAAC;AAarC,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAmFF,eAAO,MAAM,wBAAwB,EAAE,QAAQ,CAAC,WAAW,CAc1D,CAAC"}
|
|
@@ -5,16 +5,33 @@ import { CosNode } from "../../../../tree/nodes/functions/cosNode.js";
|
|
|
5
5
|
import { OppositeNode } from "../../../../tree/nodes/functions/oppositeNode.js";
|
|
6
6
|
import { SinNode } from "../../../../tree/nodes/functions/sinNode.js";
|
|
7
7
|
import { MultiplyNode } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
|
|
9
|
+
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
10
|
+
const getInstruction = (identifiers) => {
|
|
11
|
+
const { affineA, affineB } = identifiers;
|
|
12
|
+
const affine = new Affine(affineA, affineB);
|
|
10
13
|
const fct = new CosNode(affine.toTree());
|
|
14
|
+
return `Déterminer la dérivée de la fonction $f$ définie par :
|
|
15
|
+
|
|
16
|
+
$$
|
|
17
|
+
f(x) = ${fct.toTex()}
|
|
18
|
+
$$`;
|
|
19
|
+
};
|
|
20
|
+
const getAnswer = (identifiers) => {
|
|
21
|
+
const { affineA, affineB } = identifiers;
|
|
22
|
+
const affine = new Affine(affineA, affineB);
|
|
11
23
|
const deriv = new MultiplyNode((-affine.a).toTree(), new SinNode(affine.toTree()));
|
|
24
|
+
return deriv.toTex();
|
|
25
|
+
};
|
|
26
|
+
const getCosCompositionDerivationQuestion = () => {
|
|
27
|
+
const affine = AffineConstructor.random(undefined, { excludes: [0] });
|
|
28
|
+
const identifiers = { affineA: affine.a, affineB: affine.b };
|
|
12
29
|
const question = {
|
|
13
|
-
answer:
|
|
14
|
-
instruction:
|
|
30
|
+
answer: getAnswer(identifiers),
|
|
31
|
+
instruction: getInstruction(identifiers),
|
|
15
32
|
keys: ["x", "sin", "cos", "tan"],
|
|
16
33
|
answerFormat: "tex",
|
|
17
|
-
identifiers
|
|
34
|
+
identifiers,
|
|
18
35
|
};
|
|
19
36
|
return question;
|
|
20
37
|
};
|
|
@@ -33,22 +50,32 @@ const getPropositions = (n, { answer, affineA, affineB }) => {
|
|
|
33
50
|
return shuffleProps(propositions, n);
|
|
34
51
|
};
|
|
35
52
|
const isAnswerValid = (ans, { answer, affineA, affineB }) => {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
53
|
+
try {
|
|
54
|
+
const parsed = parseAlgebraic(ans);
|
|
55
|
+
if (!parsed)
|
|
56
|
+
return false;
|
|
57
|
+
return (parsed
|
|
58
|
+
.simplify({
|
|
59
|
+
towardsDistribute: true,
|
|
60
|
+
forbidFactorize: true,
|
|
61
|
+
})
|
|
62
|
+
.toTex() === answer);
|
|
63
|
+
}
|
|
64
|
+
catch (err) {
|
|
65
|
+
return handleVEAError(err);
|
|
66
|
+
}
|
|
40
67
|
};
|
|
41
68
|
export const cosCompositionDerivation = {
|
|
42
69
|
id: "cosCompositionDerivation",
|
|
43
70
|
connector: "=",
|
|
44
71
|
label: "Dérivée de $\\cos(ax+b)$",
|
|
45
|
-
levels: ["1reSpé"],
|
|
46
72
|
isSingleStep: true,
|
|
47
|
-
sections: ["Dérivation"],
|
|
48
73
|
generator: (nb) => getDistinctQuestions(getCosCompositionDerivationQuestion, nb),
|
|
49
74
|
qcmTimer: 60,
|
|
50
75
|
freeTimer: 60,
|
|
51
76
|
getPropositions,
|
|
52
77
|
isAnswerValid,
|
|
53
78
|
subject: "Mathématiques",
|
|
79
|
+
getAnswer,
|
|
80
|
+
getInstruction,
|
|
54
81
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cosSecondDegreeDerivative.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivative/cosSecondDegreeDerivative.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"cosSecondDegreeDerivative.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivative/cosSecondDegreeDerivative.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAWT,MAAM,6BAA6B,CAAC;AAerC,KAAK,WAAW,GAAG;IACjB,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB,CAAC;AA+HF,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,WAAW,CAa3D,CAAC"}
|
|
@@ -8,19 +8,36 @@ import { AddNode } from "../../../../tree/nodes/operators/addNode.js";
|
|
|
8
8
|
import { MultiplyNode } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
9
9
|
import { PowerNode } from "../../../../tree/nodes/operators/powerNode.js";
|
|
10
10
|
import { VariableNode } from "../../../../tree/nodes/variables/variableNode.js";
|
|
11
|
+
import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
|
|
12
|
+
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
13
|
+
const getInstruction = (identifiers) => {
|
|
14
|
+
const { affinecoeffs } = identifiers;
|
|
15
|
+
const affine = AffineConstructor.fromCoeffs(affinecoeffs);
|
|
16
|
+
const func = new CosNode(affine.toTree().simplify({ forbidFactorize: true })).toTex();
|
|
17
|
+
return `Calculez la dérivée seconde de la fonction $f$ définie par :
|
|
18
|
+
|
|
19
|
+
$$
|
|
20
|
+
f(x) = ${func}
|
|
21
|
+
$$`;
|
|
22
|
+
};
|
|
23
|
+
const getAnswer = (identifiers) => {
|
|
24
|
+
const { affinecoeffs } = identifiers;
|
|
25
|
+
const affine = AffineConstructor.fromCoeffs(affinecoeffs);
|
|
26
|
+
const ans = new MultiplyNode(new MultiplyNode(new PowerNode(affinecoeffs[1].toTree(), new NumberNode(2)), new NumberNode(-1)), new CosNode(affine.toTree().simplify({ forbidFactorize: true })))
|
|
27
|
+
.simplify({ forbidFactorize: true })
|
|
28
|
+
.toTex();
|
|
29
|
+
return ans;
|
|
30
|
+
};
|
|
11
31
|
const getCosSecondDegreeDerivativeQuestion = () => {
|
|
12
32
|
const affine = AffineConstructor.random();
|
|
13
33
|
const affinecoeffs = affine.coefficients;
|
|
14
|
-
const
|
|
15
|
-
.simplify()
|
|
16
|
-
.toTex();
|
|
17
|
-
const func = new CosNode(affine.toTree().simplify({ forbidFactorize: true })).toTex();
|
|
34
|
+
const identifiers = { affinecoeffs };
|
|
18
35
|
const question = {
|
|
19
|
-
answer:
|
|
20
|
-
instruction:
|
|
36
|
+
answer: getAnswer(identifiers),
|
|
37
|
+
instruction: getInstruction(identifiers),
|
|
21
38
|
keys: ["x", "sin", "cos", "tan"],
|
|
22
39
|
answerFormat: "tex",
|
|
23
|
-
identifiers
|
|
40
|
+
identifiers,
|
|
24
41
|
};
|
|
25
42
|
return question;
|
|
26
43
|
};
|
|
@@ -56,21 +73,31 @@ const getPropositions = (n, { answer, affinecoeffs }) => {
|
|
|
56
73
|
return shuffleProps(propositions, n);
|
|
57
74
|
};
|
|
58
75
|
const isAnswerValid = (ans, { answer, affinecoeffs }) => {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
76
|
+
try {
|
|
77
|
+
const parsed = parseAlgebraic(ans);
|
|
78
|
+
if (!parsed)
|
|
79
|
+
return false;
|
|
80
|
+
return (parsed
|
|
81
|
+
.simplify({
|
|
82
|
+
towardsDistribute: true,
|
|
83
|
+
forbidFactorize: true,
|
|
84
|
+
})
|
|
85
|
+
.toTex() === answer);
|
|
86
|
+
}
|
|
87
|
+
catch (err) {
|
|
88
|
+
return handleVEAError(err);
|
|
89
|
+
}
|
|
63
90
|
};
|
|
64
91
|
export const cosSecondDegreeDerivative = {
|
|
65
92
|
id: "cosSecondDegreeDerivative",
|
|
66
93
|
label: "Dérivée seconde de $\\cos(u)$",
|
|
67
|
-
levels: ["TermSpé"],
|
|
68
94
|
isSingleStep: true,
|
|
69
|
-
sections: ["Dérivation"],
|
|
70
95
|
generator: (nb) => getDistinctQuestions(getCosSecondDegreeDerivativeQuestion, nb),
|
|
71
96
|
qcmTimer: 60,
|
|
72
97
|
freeTimer: 60,
|
|
73
98
|
getPropositions,
|
|
74
99
|
isAnswerValid,
|
|
75
100
|
subject: "Mathématiques",
|
|
101
|
+
getAnswer,
|
|
102
|
+
getInstruction,
|
|
76
103
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expDerivativeFour.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivative/expDerivativeFour.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAWT,MAAM,6BAA6B,CAAC;AASrC,KAAK,WAAW,GAAG;IACjB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,aAAa,EAAE,MAAM,EAAE,CAAC;CACzB,CAAC;
|
|
1
|
+
{"version":3,"file":"expDerivativeFour.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivative/expDerivativeFour.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAWT,MAAM,6BAA6B,CAAC;AASrC,KAAK,WAAW,GAAG;IACjB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,aAAa,EAAE,MAAM,EAAE,CAAC;CACzB,CAAC;AAgFF,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,WAAW,CAgBnD,CAAC"}
|
|
@@ -11,7 +11,11 @@ const getInstruction = (identifiers) => {
|
|
|
11
11
|
const affine2 = new Affine(affine2Coeffs[1], affine2Coeffs[0]);
|
|
12
12
|
const exp = new ExpNode(affine2.toTree());
|
|
13
13
|
const fct = new MultiplyNode(affine1.toTree(), exp);
|
|
14
|
-
return `Déterminer la dérivée de la fonction $f
|
|
14
|
+
return `Déterminer la dérivée de la fonction $f$ définie par :
|
|
15
|
+
|
|
16
|
+
$$
|
|
17
|
+
f(x) = ${fct.toTex()}
|
|
18
|
+
$$`;
|
|
15
19
|
};
|
|
16
20
|
const getAnswer = (identifiers) => {
|
|
17
21
|
const { affine1Coeffs, affine2Coeffs } = identifiers;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expDerivativeOne.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivative/expDerivativeOne.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"expDerivativeOne.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivative/expDerivativeOne.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;CACX,CAAC;AAsFF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,WAAW,CAalD,CAAC"}
|
|
@@ -6,20 +6,37 @@ import { randint } from "../../../../math/utils/random/randint.js";
|
|
|
6
6
|
import { ExpNode } from "../../../../tree/nodes/functions/expNode.js";
|
|
7
7
|
import { NumberNode } from "../../../../tree/nodes/numbers/numberNode.js";
|
|
8
8
|
import { MultiplyNode } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
|
|
10
|
+
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
11
|
+
const getInstruction = (identifiers) => {
|
|
12
|
+
const { a, b } = identifiers;
|
|
13
|
+
const affine = new Polynomial([b, a]);
|
|
14
|
+
const myfunction = new ExpNode(affine.toTree());
|
|
15
|
+
return `Déterminer la dérivée de la fonction $f$ définie par :
|
|
16
|
+
|
|
17
|
+
$$
|
|
18
|
+
f(x) = ${myfunction.toTex()}
|
|
19
|
+
$$`;
|
|
20
|
+
};
|
|
21
|
+
const getAnswer = (identifiers) => {
|
|
22
|
+
const { a, b } = identifiers;
|
|
12
23
|
const affine = new Polynomial([b, a]);
|
|
13
24
|
const myfunction = new ExpNode(affine.toTree());
|
|
14
25
|
const derivative = new MultiplyNode(new NumberNode(a), myfunction);
|
|
15
26
|
const answer = derivative.toTex();
|
|
27
|
+
return answer;
|
|
28
|
+
};
|
|
29
|
+
const getExpDerivative = () => {
|
|
30
|
+
const a = randint(-9, 10, [0]);
|
|
31
|
+
const b = randint(-9, 10);
|
|
32
|
+
const identifiers = { a, b };
|
|
16
33
|
const question = {
|
|
17
|
-
instruction:
|
|
34
|
+
instruction: getInstruction(identifiers),
|
|
18
35
|
startStatement: "f'(x)",
|
|
19
|
-
answer,
|
|
36
|
+
answer: getAnswer(identifiers),
|
|
20
37
|
keys: ["x", "epower", "exp"],
|
|
21
38
|
answerFormat: "tex",
|
|
22
|
-
identifiers
|
|
39
|
+
identifiers,
|
|
23
40
|
};
|
|
24
41
|
return question;
|
|
25
42
|
};
|
|
@@ -36,19 +53,32 @@ const getPropositions = (n, { answer, a, b }) => {
|
|
|
36
53
|
tryToAddWrongProp(propositions, new MultiplyNode(new NumberNode(randint(-9, 10)), myfunction).toTex());
|
|
37
54
|
return shuffleProps(propositions, n);
|
|
38
55
|
};
|
|
39
|
-
const isAnswerValid = (ans, { a, b }) => {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
56
|
+
const isAnswerValid = (ans, { answer, a, b }) => {
|
|
57
|
+
try {
|
|
58
|
+
const parsed = parseAlgebraic(ans);
|
|
59
|
+
if (!parsed)
|
|
60
|
+
return false;
|
|
61
|
+
console.log(parsed
|
|
62
|
+
.simplify({
|
|
63
|
+
towardsDistribute: true,
|
|
64
|
+
forbidFactorize: true,
|
|
65
|
+
})
|
|
66
|
+
.toTex());
|
|
67
|
+
return (parsed
|
|
68
|
+
.simplify({
|
|
69
|
+
towardsDistribute: true,
|
|
70
|
+
forbidFactorize: true,
|
|
71
|
+
})
|
|
72
|
+
.toTex() === answer);
|
|
73
|
+
}
|
|
74
|
+
catch (err) {
|
|
75
|
+
return handleVEAError(err);
|
|
76
|
+
}
|
|
45
77
|
};
|
|
46
78
|
export const expDerivativeOne = {
|
|
47
79
|
id: "expDerivativeOne",
|
|
48
80
|
connector: "=",
|
|
49
81
|
label: "Dérivée de $\\exp(ax + b)$",
|
|
50
|
-
levels: ["1reESM", "1reSpé", "1reTech", "MathComp", "TermSpé"],
|
|
51
|
-
sections: ["Dérivation", "Exponentielle"],
|
|
52
82
|
isSingleStep: false,
|
|
53
83
|
generator: (nb) => getDistinctQuestions(getExpDerivative, nb),
|
|
54
84
|
qcmTimer: 60,
|
|
@@ -56,4 +86,6 @@ export const expDerivativeOne = {
|
|
|
56
86
|
getPropositions,
|
|
57
87
|
isAnswerValid,
|
|
58
88
|
subject: "Mathématiques",
|
|
89
|
+
getAnswer,
|
|
90
|
+
getInstruction,
|
|
59
91
|
};
|