math-exercises 3.0.37 → 3.0.38
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/calcul/fractions/fractionsSumsMultiplesDenominators.d.ts +4 -1
- package/lib/exercises/math/calcul/fractions/fractionsSumsMultiplesDenominators.d.ts.map +1 -1
- package/lib/exercises/math/calcul/fractions/fractionsSumsMultiplesDenominators.js +71 -16
- package/lib/exercises/math/calculLitteral/simplifying/reduceExpression.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/simplifying/reduceExpression.js +11 -57
- package/lib/exercises/math/functions/affines/algebricExpressionOfAffine.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/algebricExpressionOfAffine.js +48 -5
- package/lib/exercises/math/functions/integral/integralAffines.d.ts.map +1 -1
- package/lib/exercises/math/functions/integral/integralAffines.js +31 -15
- package/lib/exercises/math/functions/integral/integralTrinomials.d.ts.map +1 -1
- package/lib/exercises/math/functions/integral/integralTrinomials.js +31 -16
- package/lib/exercises/math/geometry/cartesian/distanceBetweenTwoPoints.d.ts.map +1 -1
- package/lib/exercises/math/geometry/cartesian/distanceBetweenTwoPoints.js +66 -18
- package/lib/exercises/math/geometry/cartesian/midpoint.d.ts.map +1 -1
- package/lib/exercises/math/geometry/cartesian/midpoint.js +45 -3
- package/lib/exercises/math/geometry/cartesian/placeAbscissOnSemiLine.d.ts.map +1 -1
- package/lib/exercises/math/geometry/cartesian/placeAbscissOnSemiLine.js +0 -1
- package/lib/exercises/math/geometry/pythagore/pythagoreCalcul.js +1 -1
- package/lib/exercises/math/geometry/thales/thalesCalcul.js +1 -1
- package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductViaCoords.d.ts.map +1 -1
- package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductViaCoords.js +68 -15
- package/lib/exercises/math/sequences/arithmetic/recognizeReasonFromFirstTerms.d.ts.map +1 -1
- package/lib/exercises/math/sequences/arithmetic/recognizeReasonFromFirstTerms.js +36 -5
- package/lib/exercises/math/sequences/geometric/geometricRecognizeReasonFromFirstTerms.d.ts.map +1 -1
- package/lib/exercises/math/sequences/geometric/geometricRecognizeReasonFromFirstTerms.js +36 -5
- package/lib/exercises/math/trigonometry/associatePoint.d.ts.map +1 -1
- package/lib/exercises/math/trigonometry/associatePoint.js +5 -2
- package/lib/exercises/math/trigonometry/mainRemarkableValues.js +1 -1
- package/lib/exercises/math/trigonometry/remarkableValues.js +2 -2
- package/lib/index.d.ts +3 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/math/geometry/point.d.ts +2 -0
- package/lib/math/geometry/point.d.ts.map +1 -1
- package/lib/math/geometry/point.js +10 -0
- package/lib/math/trigonometry/remarkableValue.d.ts +1 -4
- package/lib/math/trigonometry/remarkableValue.d.ts.map +1 -1
- package/lib/math/trigonometry/remarkableValue.js +5 -6
- package/lib/playground.d.ts.map +1 -1
- package/lib/playground.js +3 -0
- package/package.json +1 -1
|
@@ -5,6 +5,9 @@ type Identifiers = {
|
|
|
5
5
|
denom1: number;
|
|
6
6
|
denom2: number;
|
|
7
7
|
};
|
|
8
|
-
|
|
8
|
+
type Options = {
|
|
9
|
+
allowNonIrreductible?: boolean;
|
|
10
|
+
};
|
|
11
|
+
export declare const fractionsSumsMultiplesDenominators: Exercise<Identifiers, Options>;
|
|
9
12
|
export {};
|
|
10
13
|
//# sourceMappingURL=fractionsSumsMultiplesDenominators.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fractionsSumsMultiplesDenominators.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/fractionsSumsMultiplesDenominators.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"fractionsSumsMultiplesDenominators.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/fractionsSumsMultiplesDenominators.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAiBT,MAAM,6BAA6B,CAAC;AAgBrC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,KAAK,OAAO,GAAG;IACb,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC,CAAC;AA2JF,eAAO,MAAM,kCAAkC,EAAE,QAAQ,CACvD,WAAW,EACX,OAAO,CAsBR,CAAC"}
|
|
@@ -2,10 +2,69 @@ import { addValidProp, shuffleProps, tryToAddWrongProp, GeneratorOptionTarget, G
|
|
|
2
2
|
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
3
|
import { Rational, RationalConstructor, } from "../../../../math/numbers/rationals/rational.js";
|
|
4
4
|
import { randint } from "../../../../math/utils/random/randint.js";
|
|
5
|
-
import {
|
|
5
|
+
import { round } from "../../../../math/utils/round.js";
|
|
6
|
+
import { add, AddNode } from "../../../../tree/nodes/operators/addNode.js";
|
|
7
|
+
import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
|
|
8
|
+
import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
6
9
|
import { rationalParser } from "../../../../tree/parsers/rationalParser.js";
|
|
7
10
|
import { coinFlip } from "../../../../utils/alea/coinFlip.js";
|
|
8
11
|
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
12
|
+
import { alignTex } from "../../../../utils/latex/alignTex.js";
|
|
13
|
+
const getInstruction = (identifiers, opts) => {
|
|
14
|
+
const { num1, num2, denom1, denom2 } = identifiers;
|
|
15
|
+
const ratio1 = new Rational(num1, denom1);
|
|
16
|
+
const ratio2 = new Rational(num2, denom2);
|
|
17
|
+
const statement = new AddNode(ratio1.toTree(), ratio2.toTree()).toTex();
|
|
18
|
+
return `Calculer ${opts?.allowNonIrreductible
|
|
19
|
+
? ""
|
|
20
|
+
: "et donner le résultat sous la forme la plus simplifiée possible"} :
|
|
21
|
+
|
|
22
|
+
$$
|
|
23
|
+
${statement}
|
|
24
|
+
$$`;
|
|
25
|
+
};
|
|
26
|
+
const getAnswer = (identifiers) => {
|
|
27
|
+
const { num1, num2, denom1, denom2 } = identifiers;
|
|
28
|
+
const ratio1 = new Rational(num1, denom1);
|
|
29
|
+
const ratio2 = new Rational(num2, denom2);
|
|
30
|
+
const answer = ratio1.add(ratio2).toTree().toTex();
|
|
31
|
+
return answer;
|
|
32
|
+
};
|
|
33
|
+
const getHint = (identifiers) => {
|
|
34
|
+
const { num1, num2, denom1, denom2 } = identifiers;
|
|
35
|
+
return `Pour additionner deux fractions, il faut les réduire au même dénominateur. Quel est le plus petit multiple commun entre $${denom1}$ et $${denom2}$ ?`;
|
|
36
|
+
};
|
|
37
|
+
const getCorrection = (identifiers) => {
|
|
38
|
+
const { num1, num2, denom1, denom2 } = identifiers;
|
|
39
|
+
const orderedDenums = [denom1, denom2].sort((a, b) => a - b);
|
|
40
|
+
const orderedNums = denom1 > denom2 ? [num2, num1] : [num1, num2];
|
|
41
|
+
const coeff = round(orderedDenums[1] / orderedDenums[0], 0);
|
|
42
|
+
return `Pour additionner deux fractions, il faut les réduire au même dénominateur.
|
|
43
|
+
|
|
44
|
+
Puisque $${orderedDenums[0]}\\times ${coeff} = ${orderedDenums[1]}$, on peut mettre la fraction $${frac(orderedNums[0], orderedDenums[0]).toTex()}$ sur $${orderedDenums[1]}$ :
|
|
45
|
+
|
|
46
|
+
$$
|
|
47
|
+
${multiply(frac(orderedNums[0], orderedDenums[0]), frac(coeff, coeff)).toTex()} = ${frac(orderedNums[0] * coeff, orderedDenums[1]).toTex()}
|
|
48
|
+
$$
|
|
49
|
+
|
|
50
|
+
On peut alors additionner les deux fractions :
|
|
51
|
+
|
|
52
|
+
${alignTex([
|
|
53
|
+
["", add(frac(num1, denom1), frac(num2, denom2)).toTex()],
|
|
54
|
+
[
|
|
55
|
+
"=",
|
|
56
|
+
add(denom1 > denom2
|
|
57
|
+
? frac(num1, denom1)
|
|
58
|
+
: frac(orderedNums[0] * coeff, orderedDenums[1]), denom1 > denom2
|
|
59
|
+
? frac(orderedNums[0] * coeff, orderedDenums[1])
|
|
60
|
+
: frac(num2, denom2)).toTex(),
|
|
61
|
+
],
|
|
62
|
+
[
|
|
63
|
+
"=",
|
|
64
|
+
frac(orderedNums[0] * coeff + orderedNums[1], orderedDenums[1]).toSimplificationString(),
|
|
65
|
+
],
|
|
66
|
+
])}`;
|
|
67
|
+
};
|
|
9
68
|
const getFractionsSumsMultiplesDenominatorsQuestion = (opts) => {
|
|
10
69
|
let denom1 = randint(2, 10);
|
|
11
70
|
let denom2 = denom1 * randint(2, 10);
|
|
@@ -13,22 +72,15 @@ const getFractionsSumsMultiplesDenominatorsQuestion = (opts) => {
|
|
|
13
72
|
[denom1, denom2] = [denom2, denom1];
|
|
14
73
|
const num1 = randint(1, 10, [denom1]);
|
|
15
74
|
const num2 = randint(1, 10, [denom2]);
|
|
16
|
-
const
|
|
17
|
-
const ratio2 = new Rational(num2, denom2);
|
|
18
|
-
const statement = new AddNode(ratio1.toTree(), ratio2.toTree()).toTex();
|
|
19
|
-
const answer = ratio1.add(ratio2).toTree().toTex();
|
|
75
|
+
const identifiers = { num1, num2, denom1, denom2 };
|
|
20
76
|
const question = {
|
|
21
|
-
answer,
|
|
22
|
-
instruction:
|
|
23
|
-
? ""
|
|
24
|
-
: "et donner le résultat sous la forme la plus simplifiée possible"} :
|
|
25
|
-
|
|
26
|
-
$$
|
|
27
|
-
${statement}
|
|
28
|
-
$$`,
|
|
77
|
+
answer: getAnswer(identifiers, opts),
|
|
78
|
+
instruction: getInstruction(identifiers, opts),
|
|
29
79
|
keys: [],
|
|
30
80
|
answerFormat: "tex",
|
|
31
|
-
identifiers
|
|
81
|
+
identifiers,
|
|
82
|
+
hint: getHint(identifiers, opts),
|
|
83
|
+
correction: getCorrection(identifiers, opts),
|
|
32
84
|
};
|
|
33
85
|
return question;
|
|
34
86
|
};
|
|
@@ -74,9 +126,7 @@ export const fractionsSumsMultiplesDenominators = {
|
|
|
74
126
|
id: "fractionsSumsMultiplesDenominators",
|
|
75
127
|
connector: "=",
|
|
76
128
|
label: "Sommes de fractions (avec dénominateurs multiples l'un de l'autre)",
|
|
77
|
-
levels: [],
|
|
78
129
|
isSingleStep: true,
|
|
79
|
-
sections: [],
|
|
80
130
|
generator: (nb, opts) => getDistinctQuestions(() => getFractionsSumsMultiplesDenominatorsQuestion(opts), nb),
|
|
81
131
|
qcmTimer: 60,
|
|
82
132
|
freeTimer: 60,
|
|
@@ -84,4 +134,9 @@ export const fractionsSumsMultiplesDenominators = {
|
|
|
84
134
|
isAnswerValid,
|
|
85
135
|
subject: "Mathématiques",
|
|
86
136
|
options,
|
|
137
|
+
getInstruction,
|
|
138
|
+
getAnswer,
|
|
139
|
+
getHint,
|
|
140
|
+
getCorrection,
|
|
141
|
+
hasHintAndCorrection: true,
|
|
87
142
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reduceExpression.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/simplifying/reduceExpression.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"reduceExpression.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/simplifying/reduceExpression.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAiBrC,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,MAAM,CAAC;IAOjB,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC;IAGnB,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB,CAAC;AAqKF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,WAAW,CAelD,CAAC"}
|
|
@@ -38,11 +38,7 @@ const getStatementNode = (identifiers) => {
|
|
|
38
38
|
return multiply(c, square(variable));
|
|
39
39
|
}));
|
|
40
40
|
const shuffled = order.map((i) => nodes[i]);
|
|
41
|
-
// const polynome1 = new Polynomial(polynome1Coeffs, variable);
|
|
42
|
-
// const polynome2 = new Polynomial(polynome2Coeffs, variable);
|
|
43
41
|
return operatorComposition(AddNode, shuffled);
|
|
44
|
-
// const statement = new AddNode(polynome1.toTree(), polynome2.toTree());
|
|
45
|
-
// return statement.deepShuffle({ nodeIdsToShuffle: [OperatorIds.add] });
|
|
46
42
|
};
|
|
47
43
|
const getStartStatement = (identifiers) => {
|
|
48
44
|
return getStatementNode(identifiers).toTex();
|
|
@@ -63,6 +59,17 @@ $$
|
|
|
63
59
|
${getStartStatement(identifiers)}
|
|
64
60
|
$$`;
|
|
65
61
|
};
|
|
62
|
+
const getHint = (identifiers) => {
|
|
63
|
+
const { coeffs, order, variable } = identifiers;
|
|
64
|
+
return `Additionne les termes en $${variable}^2$ entre eux, puis les termes en $${variable}$ entre eux, et enfin les nombres entre eux.`;
|
|
65
|
+
};
|
|
66
|
+
// const getCorrection: GetCorrection<Identifiers> = (identifiers) => {
|
|
67
|
+
// const { coeffs, order, variable } = identifiers;
|
|
68
|
+
// return `On additionne les termes en $${variable}^2$ entre eux, puis les termes en $${variable}$ entre eux, et enfin les nombres entre eux.
|
|
69
|
+
// - ${coeffs[2].length<2 ? `` : ``}
|
|
70
|
+
// -
|
|
71
|
+
// - `
|
|
72
|
+
// };
|
|
66
73
|
const getReduceExpression = () => {
|
|
67
74
|
const rand = randint(0, 7);
|
|
68
75
|
let polynome1;
|
|
@@ -83,59 +90,8 @@ const getReduceExpression = () => {
|
|
|
83
90
|
}
|
|
84
91
|
}
|
|
85
92
|
const order = shuffle(Array.from({ length: nbTerms }, (_, i) => i));
|
|
86
|
-
// switch (rand) {
|
|
87
|
-
// case 0: // ax + b + cx + d
|
|
88
|
-
// polynome1 = new Polynomial([randint(-9, 10, [0]), randint(-9, 10, [0])]);
|
|
89
|
-
// polynome2 = new Polynomial([randint(-5, 6, [0]), randint(-5, 6, [0])]);
|
|
90
|
-
// break;
|
|
91
|
-
// case 1: //ax+b + cx
|
|
92
|
-
// polynome1 = new Polynomial([randint(-9, 10, [0]), randint(-9, 10, [0])]);
|
|
93
|
-
// polynome2 = new Polynomial([0, randint(-5, 6, [0])]);
|
|
94
|
-
// break;
|
|
95
|
-
// case 2: //ax+b+c
|
|
96
|
-
// polynome1 = new Polynomial([randint(-9, 10, [0]), randint(-9, 10, [0])]);
|
|
97
|
-
// polynome2 = new Polynomial([randint(-5, 6, [0])]);
|
|
98
|
-
// break;
|
|
99
|
-
// case 3: //ax^2+bx+c + ax^2+bx
|
|
100
|
-
// polynome1 = new Polynomial([
|
|
101
|
-
// randint(-9, 10),
|
|
102
|
-
// randint(-9, 10),
|
|
103
|
-
// randint(-9, 10, [0]),
|
|
104
|
-
// ]);
|
|
105
|
-
// polynome2 = new Polynomial([0, randint(-5, 6), randint(-5, 6, [0])]);
|
|
106
|
-
// break;
|
|
107
|
-
// case 4: //ax^2+bx+c + ax^2
|
|
108
|
-
// polynome1 = new Polynomial([
|
|
109
|
-
// randint(-9, 10),
|
|
110
|
-
// randint(-9, 10),
|
|
111
|
-
// randint(-9, 10, [0]),
|
|
112
|
-
// ]);
|
|
113
|
-
// polynome2 = new Polynomial([0, 0, randint(-5, 6, [0])]);
|
|
114
|
-
// break;
|
|
115
|
-
// case 5: //ax^2+bx+c + ax
|
|
116
|
-
// polynome1 = new Polynomial([
|
|
117
|
-
// randint(-9, 10),
|
|
118
|
-
// randint(-9, 10),
|
|
119
|
-
// randint(-9, 10, [0]),
|
|
120
|
-
// ]);
|
|
121
|
-
// polynome2 = new Polynomial([0, randint(-5, 6, [0])]);
|
|
122
|
-
// break;
|
|
123
|
-
// case 6: //ax^2 +bx+c + c
|
|
124
|
-
// polynome1 = new Polynomial([
|
|
125
|
-
// randint(-9, 10),
|
|
126
|
-
// randint(-9, 10),
|
|
127
|
-
// randint(-9, 10, [0]),
|
|
128
|
-
// ]);
|
|
129
|
-
// polynome2 = new Polynomial([randint(-5, 6, [0])]);
|
|
130
|
-
// break;
|
|
131
|
-
// default:
|
|
132
|
-
// throw Error("something went wrong");
|
|
133
|
-
// }
|
|
134
93
|
const variable = random(["x", "n", "a", "y", "t"]);
|
|
135
94
|
const identifiers = {
|
|
136
|
-
// rand,
|
|
137
|
-
// polynome1Coeffs: polynome1.coefficients,
|
|
138
|
-
// polynome2Coeffs: polynome2.coefficients,
|
|
139
95
|
coeffs,
|
|
140
96
|
variable,
|
|
141
97
|
order,
|
|
@@ -196,8 +152,6 @@ export const reduceExpression = {
|
|
|
196
152
|
connector: "=",
|
|
197
153
|
isSingleStep: false,
|
|
198
154
|
label: "Réduire une expression",
|
|
199
|
-
levels: ["4ème", "3ème", "2nde", "CAP", "2ndPro"],
|
|
200
|
-
sections: ["Calcul littéral"],
|
|
201
155
|
generator: (nb) => getDistinctQuestions(getReduceExpression, nb),
|
|
202
156
|
qcmTimer: 60,
|
|
203
157
|
freeTimer: 60,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"algebricExpressionOfAffine.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/affines/algebricExpressionOfAffine.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"algebricExpressionOfAffine.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/affines/algebricExpressionOfAffine.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAQrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAqGF,eAAO,MAAM,0BAA0B,EAAE,QAAQ,CAAC,WAAW,CAgB5D,CAAC"}
|
|
@@ -4,16 +4,56 @@ import { Affine, AffineConstructor } from "../../../../math/polynomials/affine.j
|
|
|
4
4
|
import { randint } from "../../../../math/utils/random/randint.js";
|
|
5
5
|
import { polynomialParser } from "../../../../tree/parsers/polynomialParser.js";
|
|
6
6
|
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
7
|
+
const getInstruction = (identifiers) => {
|
|
8
|
+
const { a, b } = identifiers;
|
|
9
|
+
return `Soit une fonction affine $f$ dont le coefficient directeur vaut $${a}$ et l'ordonnée à l'origine vaut $${b}$.
|
|
10
|
+
|
|
11
|
+
Écrire l'expression algébrique de $f(x)$.`;
|
|
12
|
+
};
|
|
13
|
+
const getAnswer = (identifiers) => {
|
|
14
|
+
const f = new Affine(identifiers.a, identifiers.b);
|
|
15
|
+
return f.toTex();
|
|
16
|
+
};
|
|
17
|
+
const getHint = (identifiers) => {
|
|
18
|
+
return `L'expression algébrique d'une fonction affine est :
|
|
19
|
+
|
|
20
|
+
$$
|
|
21
|
+
f(x) = ax+b
|
|
22
|
+
$$
|
|
23
|
+
|
|
24
|
+
où $a$ est le coefficient directeur et $b$ l'ordonnée à l'origine.`;
|
|
25
|
+
};
|
|
26
|
+
const getCorrection = (identifiers) => {
|
|
27
|
+
const { a, b } = identifiers;
|
|
28
|
+
return `L'expression algébrique d'une fonction affine est :
|
|
29
|
+
|
|
30
|
+
$$
|
|
31
|
+
f(x) = ax+b
|
|
32
|
+
$$
|
|
33
|
+
|
|
34
|
+
où $a$ est le coefficient directeur et $b$ l'ordonnée à l'origine.
|
|
35
|
+
|
|
36
|
+
Ici, $a = ${a}$ et $b = ${b}$.
|
|
37
|
+
|
|
38
|
+
Donc, l'expression algébrique de $f$ est :
|
|
39
|
+
|
|
40
|
+
$$
|
|
41
|
+
f(x)=${getAnswer(identifiers)}
|
|
42
|
+
$$`;
|
|
43
|
+
};
|
|
7
44
|
const getAlgebricExpressionOfAffineQuestion = () => {
|
|
8
45
|
const f = AffineConstructor.random();
|
|
9
46
|
const a = f.a;
|
|
10
47
|
const b = f.b;
|
|
48
|
+
const identifiers = { a, b };
|
|
11
49
|
const question = {
|
|
12
|
-
answer:
|
|
13
|
-
instruction:
|
|
50
|
+
answer: getAnswer(identifiers),
|
|
51
|
+
instruction: getInstruction(identifiers),
|
|
14
52
|
keys: ["x"],
|
|
15
53
|
answerFormat: "tex",
|
|
16
|
-
identifiers
|
|
54
|
+
identifiers,
|
|
55
|
+
hint: getHint(identifiers),
|
|
56
|
+
correction: getCorrection(identifiers),
|
|
17
57
|
};
|
|
18
58
|
return question;
|
|
19
59
|
};
|
|
@@ -52,13 +92,16 @@ const generatePropositions = (a, b) => {
|
|
|
52
92
|
export const algebricExpressionOfAffine = {
|
|
53
93
|
id: "algebricExpressionOfAffine",
|
|
54
94
|
label: "Écrire l'expression algébrique d'une fonction affine",
|
|
55
|
-
levels: ["2nde"],
|
|
56
95
|
isSingleStep: true,
|
|
57
|
-
sections: ["Fonctions affines"],
|
|
58
96
|
generator: (nb) => getDistinctQuestions(getAlgebricExpressionOfAffineQuestion, nb),
|
|
59
97
|
qcmTimer: 60,
|
|
60
98
|
freeTimer: 60,
|
|
61
99
|
getPropositions,
|
|
62
100
|
isAnswerValid,
|
|
63
101
|
subject: "Mathématiques",
|
|
102
|
+
getAnswer,
|
|
103
|
+
getInstruction,
|
|
104
|
+
getHint,
|
|
105
|
+
getCorrection,
|
|
106
|
+
hasHintAndCorrection: true,
|
|
64
107
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"integralAffines.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/integral/integralAffines.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"integralAffines.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/integral/integralAffines.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAWT,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC;AA6FF,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,WAAW,CAajD,CAAC"}
|
|
@@ -1,31 +1,47 @@
|
|
|
1
1
|
import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
|
|
2
2
|
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { numberVEA } from "../../../../exercises/vea/numberVEA.js";
|
|
3
4
|
import { Trinom, TrinomConstructor } from "../../../../math/polynomials/trinom.js";
|
|
4
5
|
import { randint } from "../../../../math/utils/random/randint.js";
|
|
5
6
|
import { IntegralNode } from "../../../../tree/nodes/functions/integralNode.js";
|
|
7
|
+
const getInstruction = (identifiers) => {
|
|
8
|
+
const { lowerBound, upperBound, trinomial } = identifiers;
|
|
9
|
+
const trinom = new Trinom(trinomial[0], trinomial[1], trinomial[2]);
|
|
10
|
+
const affine = trinom.derivate();
|
|
11
|
+
const integral = new IntegralNode(affine.toTree(), lowerBound.toTree(), upperBound.toTree(), "x").toTex();
|
|
12
|
+
return `Calculer :
|
|
13
|
+
|
|
14
|
+
$$
|
|
15
|
+
${integral}
|
|
16
|
+
$$`;
|
|
17
|
+
};
|
|
18
|
+
const getAnswer = (identifiers) => {
|
|
19
|
+
const { lowerBound, upperBound, trinomial } = identifiers;
|
|
20
|
+
const trinom = new Trinom(trinomial[0], trinomial[1], trinomial[2]);
|
|
21
|
+
const answer = (trinom.calculate(upperBound) - trinom.calculate(lowerBound))
|
|
22
|
+
.toTree()
|
|
23
|
+
.toTex();
|
|
24
|
+
return answer;
|
|
25
|
+
};
|
|
6
26
|
const getIntegralAffinesQuestion = () => {
|
|
7
27
|
const trinomial = TrinomConstructor.random();
|
|
8
|
-
const affine = trinomial.derivate();
|
|
9
28
|
let lowerBound = randint(-5, 5);
|
|
10
29
|
let upperBound = randint(-5, 5);
|
|
11
30
|
while (lowerBound >= upperBound) {
|
|
12
31
|
lowerBound = randint(-5, 5);
|
|
13
32
|
upperBound = randint(-5, 5);
|
|
14
33
|
}
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
.
|
|
34
|
+
const identifiers = {
|
|
35
|
+
lowerBound,
|
|
36
|
+
upperBound,
|
|
37
|
+
trinomial: [trinomial.a, trinomial.b, trinomial.c],
|
|
38
|
+
};
|
|
19
39
|
const question = {
|
|
20
|
-
answer:
|
|
21
|
-
instruction:
|
|
40
|
+
answer: getAnswer(identifiers),
|
|
41
|
+
instruction: getInstruction(identifiers),
|
|
22
42
|
keys: [],
|
|
23
43
|
answerFormat: "tex",
|
|
24
|
-
identifiers
|
|
25
|
-
lowerBound,
|
|
26
|
-
upperBound,
|
|
27
|
-
trinomial: [trinomial.a, trinomial.b, trinomial.c],
|
|
28
|
-
},
|
|
44
|
+
identifiers,
|
|
29
45
|
};
|
|
30
46
|
return question;
|
|
31
47
|
};
|
|
@@ -52,18 +68,18 @@ const getPropositions = (n, { answer, lowerBound, upperBound, trinomial }) => {
|
|
|
52
68
|
return shuffleProps(propositions, n);
|
|
53
69
|
};
|
|
54
70
|
const isAnswerValid = (ans, { answer }) => {
|
|
55
|
-
return ans
|
|
71
|
+
return numberVEA(ans, answer);
|
|
56
72
|
};
|
|
57
73
|
export const integralAffines = {
|
|
58
74
|
id: "integralAffines",
|
|
59
75
|
label: "Calcul d'intégrales de fonctions affines",
|
|
60
|
-
levels: ["TermSpé"],
|
|
61
76
|
isSingleStep: true,
|
|
62
|
-
sections: ["Intégration"],
|
|
63
77
|
generator: (nb) => getDistinctQuestions(getIntegralAffinesQuestion, nb),
|
|
64
78
|
qcmTimer: 60,
|
|
65
79
|
freeTimer: 60,
|
|
66
80
|
getPropositions,
|
|
67
81
|
isAnswerValid,
|
|
68
82
|
subject: "Mathématiques",
|
|
83
|
+
getAnswer,
|
|
84
|
+
getInstruction,
|
|
69
85
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"integralTrinomials.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/integral/integralTrinomials.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"integralTrinomials.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/integral/integralTrinomials.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAWT,MAAM,6BAA6B,CAAC;AAYrC,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB,CAAC;AAoGF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,CAapD,CAAC"}
|
|
@@ -1,8 +1,28 @@
|
|
|
1
1
|
import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
|
|
2
2
|
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { numberVEA } from "../../../../exercises/vea/numberVEA.js";
|
|
3
4
|
import { Polynomial, } from "../../../../math/polynomials/polynomial.js";
|
|
4
5
|
import { randint } from "../../../../math/utils/random/randint.js";
|
|
5
6
|
import { IntegralNode } from "../../../../tree/nodes/functions/integralNode.js";
|
|
7
|
+
const getInstruction = (identifiers) => {
|
|
8
|
+
const { lowerBound, upperBound, quadrinomial } = identifiers;
|
|
9
|
+
const quadrinomial1 = new Polynomial(quadrinomial);
|
|
10
|
+
const trinomial = quadrinomial1.derivate();
|
|
11
|
+
const integral = new IntegralNode(trinomial.toTree(), lowerBound.toTree(), upperBound.toTree(), "x").toTex();
|
|
12
|
+
return `Calculer :
|
|
13
|
+
|
|
14
|
+
$$
|
|
15
|
+
${integral}
|
|
16
|
+
$$`;
|
|
17
|
+
};
|
|
18
|
+
const getAnswer = (identifiers) => {
|
|
19
|
+
const { lowerBound, upperBound, quadrinomial } = identifiers;
|
|
20
|
+
const quadrinomial1 = new Polynomial(quadrinomial);
|
|
21
|
+
const answer = (quadrinomial1.calculate(upperBound) - quadrinomial1.calculate(lowerBound))
|
|
22
|
+
.toTree()
|
|
23
|
+
.toTex();
|
|
24
|
+
return answer;
|
|
25
|
+
};
|
|
6
26
|
const getIntegralTrinomialsQuestion = () => {
|
|
7
27
|
const quadCoeffs = [
|
|
8
28
|
randint(-5, 5),
|
|
@@ -10,28 +30,23 @@ const getIntegralTrinomialsQuestion = () => {
|
|
|
10
30
|
randint(-2, 3),
|
|
11
31
|
randint(-5, 5, [0]),
|
|
12
32
|
];
|
|
13
|
-
const quadrinomial = new Polynomial(quadCoeffs);
|
|
14
|
-
const trinomial = quadrinomial.derivate();
|
|
15
33
|
let lowerBound = randint(-3, 4);
|
|
16
34
|
let upperBound = randint(-3, 4);
|
|
17
35
|
while (lowerBound >= upperBound) {
|
|
18
36
|
lowerBound = randint(-3, 4);
|
|
19
37
|
upperBound = randint(-3, 4);
|
|
20
38
|
}
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
39
|
+
const identifiers = {
|
|
40
|
+
lowerBound,
|
|
41
|
+
upperBound,
|
|
42
|
+
quadrinomial: quadCoeffs,
|
|
43
|
+
};
|
|
25
44
|
const question = {
|
|
26
|
-
answer:
|
|
27
|
-
instruction:
|
|
45
|
+
answer: getAnswer(identifiers),
|
|
46
|
+
instruction: getInstruction(identifiers),
|
|
28
47
|
keys: [],
|
|
29
48
|
answerFormat: "tex",
|
|
30
|
-
identifiers
|
|
31
|
-
lowerBound,
|
|
32
|
-
upperBound,
|
|
33
|
-
quadrinomial: quadrinomial.coefficients,
|
|
34
|
-
},
|
|
49
|
+
identifiers,
|
|
35
50
|
};
|
|
36
51
|
return question;
|
|
37
52
|
};
|
|
@@ -58,18 +73,18 @@ const getPropositions = (n, { answer, lowerBound, upperBound, quadrinomial }) =>
|
|
|
58
73
|
return shuffleProps(propositions, n);
|
|
59
74
|
};
|
|
60
75
|
const isAnswerValid = (ans, { answer }) => {
|
|
61
|
-
return ans
|
|
76
|
+
return numberVEA(ans, answer);
|
|
62
77
|
};
|
|
63
78
|
export const integralTrinomials = {
|
|
64
79
|
id: "integralTrinomials",
|
|
65
80
|
label: "Calcul d'intégrales de fonctions trinômes",
|
|
66
|
-
levels: ["TermSpé"],
|
|
67
81
|
isSingleStep: true,
|
|
68
|
-
sections: ["Intégration"],
|
|
69
82
|
generator: (nb) => getDistinctQuestions(getIntegralTrinomialsQuestion, nb),
|
|
70
83
|
qcmTimer: 60,
|
|
71
84
|
freeTimer: 60,
|
|
72
85
|
getPropositions,
|
|
73
86
|
isAnswerValid,
|
|
74
87
|
subject: "Mathématiques",
|
|
88
|
+
getAnswer,
|
|
89
|
+
getInstruction,
|
|
75
90
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"distanceBetweenTwoPoints.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/cartesian/distanceBetweenTwoPoints.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"distanceBetweenTwoPoints.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/cartesian/distanceBetweenTwoPoints.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAerC,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AAsKF,eAAO,MAAM,wBAAwB,EAAE,QAAQ,CAAC,WAAW,CAiB1D,CAAC"}
|
|
@@ -4,25 +4,70 @@ import { Point } from "../../../../math/geometry/point.js";
|
|
|
4
4
|
import { SquareRoot, } from "../../../../math/numbers/reals/real.js";
|
|
5
5
|
import { distinctRandTupleInt } from "../../../../math/utils/random/randTupleInt.js";
|
|
6
6
|
import { round } from "../../../../math/utils/round.js";
|
|
7
|
-
import { SqrtNode } from "../../../../tree/nodes/functions/sqrtNode.js";
|
|
8
7
|
import { NumberNode } from "../../../../tree/nodes/numbers/numberNode.js";
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
|
|
9
|
+
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
10
|
+
import { alignTex } from "../../../../utils/latex/alignTex.js";
|
|
11
|
+
const getInstruction = (identifiers) => {
|
|
12
|
+
const { coords1, coords2 } = identifiers;
|
|
13
|
+
let A = new Point("A", new NumberNode(coords1[0]), new NumberNode(coords1[1]));
|
|
14
|
+
let B = new Point("B", new NumberNode(coords2[0]), new NumberNode(coords2[1]));
|
|
15
|
+
return `Dans un repère orthonormé, soit deux points $${A.toTexWithCoords()}$ et $${B.toTexWithCoords()}$.
|
|
16
|
+
|
|
17
|
+
Calculer la distance $AB$.`;
|
|
18
|
+
};
|
|
19
|
+
const getAnswer = (identifiers) => {
|
|
20
|
+
const { coords1, coords2 } = identifiers;
|
|
11
21
|
let A = new Point("A", new NumberNode(coords1[0]), new NumberNode(coords1[1]));
|
|
12
22
|
let B = new Point("B", new NumberNode(coords2[0]), new NumberNode(coords2[1]));
|
|
13
23
|
const answer = new SquareRoot(round(A.distanceTo(B) ** 2, 0))
|
|
14
24
|
.simplify()
|
|
15
25
|
.toTree()
|
|
16
26
|
.toTex();
|
|
27
|
+
return answer;
|
|
28
|
+
};
|
|
29
|
+
const getHint = (identifiers) => {
|
|
30
|
+
const A = new Point("A", "x_A".toTree(), "y_A".toTree());
|
|
31
|
+
const B = new Point("B", "x_B".toTree(), "y_B".toTree());
|
|
32
|
+
return `Dans un repère orthonormé, la distance entre deux points $${A.toTexWithCoords()}$ et $${B.toTexWithCoords()}$ est :
|
|
33
|
+
|
|
34
|
+
$$
|
|
35
|
+
AB = ${A.distanceToNode(B).toTex()}
|
|
36
|
+
$$
|
|
37
|
+
`;
|
|
38
|
+
};
|
|
39
|
+
const getCorrection = (identifiers) => {
|
|
40
|
+
const { coords1, coords2 } = identifiers;
|
|
41
|
+
let A = new Point("A", new NumberNode(coords1[0]), new NumberNode(coords1[1]));
|
|
42
|
+
let B = new Point("B", new NumberNode(coords2[0]), new NumberNode(coords2[1]));
|
|
43
|
+
const Ax = new Point("A", "x_A".toTree(), "y_A".toTree());
|
|
44
|
+
const Bx = new Point("B", "x_B".toTree(), "y_B".toTree());
|
|
45
|
+
return `Dans un repère orthonormé, la distance entre deux points $${Ax.toTexWithCoords()}$ et $${Bx.toTexWithCoords()}$ est :
|
|
46
|
+
|
|
47
|
+
$$
|
|
48
|
+
AB = ${Ax.distanceToNode(Bx).toTex()}
|
|
49
|
+
$$
|
|
50
|
+
|
|
51
|
+
Ici, on a donc :
|
|
52
|
+
|
|
53
|
+
${alignTex([
|
|
54
|
+
["AB", "=", A.distanceToNode(B).toTex()],
|
|
55
|
+
["", "=", getAnswer(identifiers)],
|
|
56
|
+
])}
|
|
57
|
+
`;
|
|
58
|
+
};
|
|
59
|
+
const getDistanceBetweenTwoPoints = () => {
|
|
60
|
+
const [coords1, coords2] = distinctRandTupleInt(2, 2, { from: -9, to: 10 });
|
|
61
|
+
const identifiers = { coords1, coords2 };
|
|
17
62
|
const question = {
|
|
18
|
-
instruction:
|
|
19
|
-
|
|
20
|
-
Calculer la distance $AB$.`,
|
|
63
|
+
instruction: getInstruction(identifiers),
|
|
21
64
|
startStatement: "AB",
|
|
22
|
-
answer,
|
|
65
|
+
answer: getAnswer(identifiers),
|
|
23
66
|
keys: [],
|
|
24
67
|
answerFormat: "tex",
|
|
25
|
-
identifiers
|
|
68
|
+
identifiers,
|
|
69
|
+
hint: getHint(identifiers),
|
|
70
|
+
correction: getCorrection(identifiers),
|
|
26
71
|
};
|
|
27
72
|
return question;
|
|
28
73
|
};
|
|
@@ -69,21 +114,19 @@ const getPropositions = (n, { answer, coords1, coords2 }) => {
|
|
|
69
114
|
}
|
|
70
115
|
return shuffleProps(propositions, n);
|
|
71
116
|
};
|
|
72
|
-
const isAnswerValid = (ans, { coords1, coords2 }) => {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
117
|
+
const isAnswerValid = (ans, { answer, coords1, coords2 }) => {
|
|
118
|
+
try {
|
|
119
|
+
const parsed = parseAlgebraic(ans);
|
|
120
|
+
return parsed.simplify().toTex() === answer;
|
|
121
|
+
}
|
|
122
|
+
catch (err) {
|
|
123
|
+
return handleVEAError(err);
|
|
124
|
+
}
|
|
80
125
|
};
|
|
81
126
|
export const distanceBetweenTwoPoints = {
|
|
82
127
|
id: "distanceBetweenTwoPoints",
|
|
83
128
|
connector: "=",
|
|
84
129
|
label: "Distance entre deux points",
|
|
85
|
-
levels: ["2nde", "1reESM"],
|
|
86
|
-
sections: ["Géométrie cartésienne"],
|
|
87
130
|
isSingleStep: false,
|
|
88
131
|
generator: (nb) => getDistinctQuestions(getDistanceBetweenTwoPoints, nb),
|
|
89
132
|
qcmTimer: 60,
|
|
@@ -91,4 +134,9 @@ export const distanceBetweenTwoPoints = {
|
|
|
91
134
|
getPropositions,
|
|
92
135
|
isAnswerValid,
|
|
93
136
|
subject: "Mathématiques",
|
|
137
|
+
getAnswer,
|
|
138
|
+
getInstruction,
|
|
139
|
+
getCorrection,
|
|
140
|
+
getHint,
|
|
141
|
+
hasHintAndCorrection: true,
|
|
94
142
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"midpoint.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/cartesian/midpoint.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"midpoint.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/cartesian/midpoint.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAWrC,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AA2IF,eAAO,MAAM,QAAQ,EAAE,QAAQ,CAAC,WAAW,CAgB1C,CAAC"}
|