math-exercises 3.0.146 → 3.0.147
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/functions/affines/affineExpressionReading.d.ts +6 -1
- package/lib/exercises/math/functions/affines/affineExpressionReading.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/affineExpressionReading.js +166 -52
- package/lib/exercises/math/functions/affines/drawAffineFromLitExp.d.ts +5 -1
- package/lib/exercises/math/functions/affines/drawAffineFromLitExp.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/drawAffineFromLitExp.js +59 -17
- package/lib/exercises/math/functions/basics/graphicInequation.js +1 -1
- package/lib/exercises/math/functions/index.d.ts +1 -0
- package/lib/exercises/math/functions/index.d.ts.map +1 -1
- package/lib/exercises/math/functions/index.js +1 -0
- package/lib/exercises/math/functions/linear/index.d.ts +3 -0
- package/lib/exercises/math/functions/linear/index.d.ts.map +1 -0
- package/lib/exercises/math/functions/linear/index.js +2 -0
- package/lib/exercises/math/functions/linear/linearFromExercise.d.ts +9 -0
- package/lib/exercises/math/functions/linear/linearFromExercise.d.ts.map +1 -0
- package/lib/exercises/math/functions/linear/linearFromExercise.js +355 -0
- package/lib/exercises/math/functions/linear/linearFromPercentageEvolution.d.ts +8 -0
- package/lib/exercises/math/functions/linear/linearFromPercentageEvolution.d.ts.map +1 -0
- package/lib/exercises/math/functions/linear/linearFromPercentageEvolution.js +233 -0
- package/lib/exercises/math/functions/trinoms/devForm/coefficientsIdentification.d.ts.map +1 -1
- package/lib/exercises/math/functions/trinoms/devForm/coefficientsIdentification.js +2 -5
- package/lib/index.d.ts +18 -3
- package/lib/index.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import { Exercise } from "../../../../exercises/exercise.js";
|
|
2
|
+
type Options = {
|
|
3
|
+
isLinear: boolean;
|
|
4
|
+
};
|
|
2
5
|
type Identifiers = {
|
|
6
|
+
isLinear: boolean;
|
|
3
7
|
b: number;
|
|
4
8
|
secondPoint: number[];
|
|
5
9
|
};
|
|
6
|
-
export declare const affineExpressionReading: Exercise<Identifiers>;
|
|
10
|
+
export declare const affineExpressionReading: Exercise<Identifiers, Options>;
|
|
11
|
+
export declare const linearExpressionReading: Exercise<Identifiers, Options>;
|
|
7
12
|
export {};
|
|
8
13
|
//# sourceMappingURL=affineExpressionReading.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"affineExpressionReading.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/affines/affineExpressionReading.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"affineExpressionReading.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/affines/affineExpressionReading.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAiBT,MAAM,6BAA6B,CAAC;AAmBrC,KAAK,OAAO,GAAG;IACb,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,OAAO,CAAC;IAClB,CAAC,EAAE,MAAM,CAAC;IACV,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB,CAAC;AAiTF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAkBlE,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAmBlE,CAAC"}
|
|
@@ -6,6 +6,7 @@ import { Rational } from "../../../../math/numbers/rationals/rational.js";
|
|
|
6
6
|
import { AffineConstructor } from "../../../../math/polynomials/affine.js";
|
|
7
7
|
import { randint } from "../../../../math/utils/random/randint.js";
|
|
8
8
|
import { EqualNode } from "../../../../tree/nodes/equations/equalNode.js";
|
|
9
|
+
import { opposite } from "../../../../tree/nodes/functions/oppositeNode.js";
|
|
9
10
|
import { NumberNode } from "../../../../tree/nodes/numbers/numberNode.js";
|
|
10
11
|
import { AddNode } from "../../../../tree/nodes/operators/addNode.js";
|
|
11
12
|
import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
|
|
@@ -14,8 +15,16 @@ import { substract } from "../../../../tree/nodes/operators/substractNode.js";
|
|
|
14
15
|
import { VariableNode } from "../../../../tree/nodes/variables/variableNode.js";
|
|
15
16
|
import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
|
|
16
17
|
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
17
|
-
const
|
|
18
|
-
|
|
18
|
+
const rebuildIdentifiers = (oldIds) => {
|
|
19
|
+
const newIds = Object.assign({}, oldIds, {
|
|
20
|
+
isLinear: false,
|
|
21
|
+
});
|
|
22
|
+
return newIds;
|
|
23
|
+
};
|
|
24
|
+
const getInstruction = (_, opts) => {
|
|
25
|
+
return `Ci-dessous est tracée la courbe représentative d'une fonction ${opts?.isLinear ? "linéaire" : "affine"} $f$.
|
|
26
|
+
Déterminer graphiquement l'expression algébrique de $f(x)$.
|
|
27
|
+
(Écrire la réponse sous la forme "$f(x)=$...")`;
|
|
19
28
|
};
|
|
20
29
|
const getGGBOptions = (identifiers) => {
|
|
21
30
|
const { b, secondPoint } = identifiers;
|
|
@@ -35,8 +44,25 @@ const getGGBOptions = (identifiers) => {
|
|
|
35
44
|
coords: ggb.getAdaptedCoords({ xMin, xMax, yMin, yMax }),
|
|
36
45
|
});
|
|
37
46
|
};
|
|
38
|
-
const getHint = () => {
|
|
39
|
-
|
|
47
|
+
const getHint = (_, opts) => {
|
|
48
|
+
if (opts?.isLinear) {
|
|
49
|
+
return `L'expression algébrique d'une fonction linéaire est de la forme :
|
|
50
|
+
|
|
51
|
+
$$
|
|
52
|
+
f(x) = ax
|
|
53
|
+
$$
|
|
54
|
+
|
|
55
|
+
$a$ est le coefficient directeur. Pour le lire, repère un point $A(x_A;y_A)$ de la droite, qui n'est pas l'origine.
|
|
56
|
+
|
|
57
|
+
Alors :
|
|
58
|
+
|
|
59
|
+
$$
|
|
60
|
+
a = \\frac{y_A}{x_A}
|
|
61
|
+
$$
|
|
62
|
+
`;
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
return `L'expression algébrique d'une fonction affine est de la forme :
|
|
40
66
|
|
|
41
67
|
$$
|
|
42
68
|
f(x) = ax+b
|
|
@@ -49,10 +75,33 @@ $a$ est le coefficient directeur. Pour le déterminer, on repère deux points $A
|
|
|
49
75
|
$$
|
|
50
76
|
a = \\frac{y_B-y_A}{x_B-x_A}
|
|
51
77
|
$$`;
|
|
78
|
+
}
|
|
52
79
|
};
|
|
53
|
-
const getCorrection = (identifiers) => {
|
|
80
|
+
const getCorrection = (identifiers, opts) => {
|
|
54
81
|
const { b, secondPoint } = identifiers;
|
|
55
|
-
|
|
82
|
+
if (opts?.isLinear) {
|
|
83
|
+
return `La droite passe par l'origine. La fonction est donc une fonction linéaire. $f$ est donc de la forme :
|
|
84
|
+
|
|
85
|
+
$$
|
|
86
|
+
f(x) = ax
|
|
87
|
+
$$
|
|
88
|
+
|
|
89
|
+
Pour trouver $a$, on repère que le point de coordonnées $(${secondPoint[0].frenchify()};${secondPoint[1].frenchify()})$ appartient à la droite.
|
|
90
|
+
|
|
91
|
+
On a donc :
|
|
92
|
+
|
|
93
|
+
$$
|
|
94
|
+
a = ${frac(secondPoint[1], secondPoint[0]).toSimplificationTex()}
|
|
95
|
+
$$
|
|
96
|
+
|
|
97
|
+
L'expression algébrique de la fonction $f$ est donc :
|
|
98
|
+
|
|
99
|
+
$$
|
|
100
|
+
${getAnswer(identifiers)}
|
|
101
|
+
$$`;
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
return `On lit graphiquement que l'ordonnée à l'origine est $${b}$ : c'est l'ordonnée du point d'abscisse $0$ appartenant à la droite.
|
|
56
105
|
|
|
57
106
|
Pour trouver $a$, on repère que la droite passe par le point de coordonnées $(${secondPoint[0]};${secondPoint[1]})$. On a alors :
|
|
58
107
|
|
|
@@ -65,6 +114,7 @@ L'expression algébrique de la fonction $f$ est donc :
|
|
|
65
114
|
$$
|
|
66
115
|
${getAnswer(identifiers)}
|
|
67
116
|
$$`;
|
|
117
|
+
}
|
|
68
118
|
};
|
|
69
119
|
const getAnswer = (identifiers) => {
|
|
70
120
|
const { b, secondPoint } = identifiers;
|
|
@@ -74,51 +124,68 @@ const getAnswer = (identifiers) => {
|
|
|
74
124
|
const answer = new EqualNode(new VariableNode("f(x)"), new AddNode(new MultiplyNode(leadingCoeff, new VariableNode("x")), new NumberNode(b)).simplify({ forceDistributeFractions: true, forbidFactorize: true })).toTex();
|
|
75
125
|
return answer;
|
|
76
126
|
};
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
wrongAs.
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
127
|
+
const getPropositions = (n, { answer, b, secondPoint, isLinear }) => {
|
|
128
|
+
// if (opts?.isLinear) {
|
|
129
|
+
if (isLinear) {
|
|
130
|
+
const a = new Rational(secondPoint[1] - b, secondPoint[0])
|
|
131
|
+
.simplify()
|
|
132
|
+
.toTree();
|
|
133
|
+
const propositions = [];
|
|
134
|
+
addValidProp(propositions, answer);
|
|
135
|
+
const wrongSecondPoints = [-1, 0, 1].flatMap((offsetX) => [-1, 0, 1]
|
|
136
|
+
.filter((offsetY) => offsetX !== 0 && offsetY !== 0 && secondPoint[0] + offsetX !== 0)
|
|
137
|
+
.map((offsetY) => {
|
|
138
|
+
return [secondPoint[0] + offsetX, secondPoint[1] + offsetY];
|
|
139
|
+
}));
|
|
140
|
+
const wrongAs = [
|
|
141
|
+
frac(1, a).simplify(),
|
|
142
|
+
opposite(a),
|
|
143
|
+
frac(1, opposite(a)),
|
|
144
|
+
...wrongSecondPoints.map((secondPoint) => {
|
|
145
|
+
const leadingCoeff = new Rational(secondPoint[1], secondPoint[0])
|
|
146
|
+
.simplify()
|
|
147
|
+
.toTree();
|
|
148
|
+
return leadingCoeff;
|
|
149
|
+
}),
|
|
150
|
+
];
|
|
151
|
+
const fx = new VariableNode("f(x)");
|
|
152
|
+
const x = new VariableNode("x");
|
|
153
|
+
wrongAs.forEach((coeff) => {
|
|
154
|
+
tryToAddWrongProp(propositions, new EqualNode(fx, new MultiplyNode(coeff, x).simplify({
|
|
155
|
+
forceDistributeFractions: true,
|
|
156
|
+
forbidFactorize: true,
|
|
157
|
+
})).toTex());
|
|
158
|
+
});
|
|
159
|
+
propWhile(propositions, n, () => {
|
|
160
|
+
tryToAddWrongProp(propositions, new EqualNode(fx, AffineConstructor.random().toTree()).toTex());
|
|
161
|
+
});
|
|
162
|
+
return shuffleProps(propositions, n);
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
const propositions = [];
|
|
166
|
+
addValidProp(propositions, answer);
|
|
167
|
+
const wrongAs = [];
|
|
168
|
+
if (secondPoint[1] - b !== 0)
|
|
169
|
+
wrongAs.push(new Rational(secondPoint[0], secondPoint[1] - b).simplify().toTree());
|
|
170
|
+
if (secondPoint[0] !== 0)
|
|
171
|
+
wrongAs.push(new Rational(secondPoint[1] + b, secondPoint[0]).simplify().toTree());
|
|
172
|
+
if (secondPoint[1] + b !== 0)
|
|
173
|
+
wrongAs.push(new Rational(secondPoint[0], secondPoint[1] + b).simplify().toTree());
|
|
174
|
+
if (b !== 0)
|
|
175
|
+
wrongAs.push(new Rational(secondPoint[1] - secondPoint[0], b).simplify().toTree());
|
|
176
|
+
const fx = new VariableNode("f(x)");
|
|
177
|
+
const x = new VariableNode("x");
|
|
178
|
+
wrongAs.forEach((coeff) => {
|
|
179
|
+
tryToAddWrongProp(propositions, new EqualNode(fx, new AddNode(new MultiplyNode(coeff, x), new NumberNode(b)).simplify({
|
|
180
|
+
forceDistributeFractions: true,
|
|
181
|
+
forbidFactorize: true,
|
|
182
|
+
})).toTex());
|
|
183
|
+
});
|
|
184
|
+
propWhile(propositions, n, () => {
|
|
185
|
+
tryToAddWrongProp(propositions, new EqualNode(fx, AffineConstructor.random().toTree()).toTex());
|
|
186
|
+
});
|
|
187
|
+
return shuffleProps(propositions, n);
|
|
188
|
+
}
|
|
122
189
|
};
|
|
123
190
|
const isAnswerValid = (ans, { answer }) => {
|
|
124
191
|
try {
|
|
@@ -140,12 +207,58 @@ const isAnswerValid = (ans, { answer }) => {
|
|
|
140
207
|
return handleVEAError(err);
|
|
141
208
|
}
|
|
142
209
|
};
|
|
210
|
+
const getAffineExpressionReadingQuestion = (opts) => {
|
|
211
|
+
const isLinear = opts?.isLinear ?? false;
|
|
212
|
+
let b;
|
|
213
|
+
let secondPoint;
|
|
214
|
+
if (opts?.isLinear) {
|
|
215
|
+
b = 0;
|
|
216
|
+
secondPoint = [randint(-5, 6, [0]), randint(-5, 6, [0])];
|
|
217
|
+
}
|
|
218
|
+
else {
|
|
219
|
+
b = randint(-5, 6);
|
|
220
|
+
secondPoint = [randint(-5, 6, [0]), randint(-5, 6)];
|
|
221
|
+
}
|
|
222
|
+
const identifiers = { b, secondPoint, isLinear };
|
|
223
|
+
//[0,b] et [x,y]
|
|
224
|
+
//a = (y-b)/x
|
|
225
|
+
return getQuestionFromIdentifiers(identifiers, opts);
|
|
226
|
+
};
|
|
227
|
+
const getQuestionFromIdentifiers = (identifiers, opts) => {
|
|
228
|
+
const question = {
|
|
229
|
+
answer: getAnswer(identifiers, opts),
|
|
230
|
+
instruction: getInstruction(identifiers, opts),
|
|
231
|
+
keys: ["fx", "equal", "x"],
|
|
232
|
+
ggbOptions: getGGBOptions(identifiers, opts),
|
|
233
|
+
answerFormat: "tex",
|
|
234
|
+
identifiers,
|
|
235
|
+
hint: getHint(identifiers, opts),
|
|
236
|
+
correction: getCorrection(identifiers, opts),
|
|
237
|
+
options: opts,
|
|
238
|
+
};
|
|
239
|
+
return question;
|
|
240
|
+
};
|
|
143
241
|
export const affineExpressionReading = {
|
|
144
242
|
id: "affineExpressionReading",
|
|
145
243
|
connector: "=",
|
|
146
244
|
label: "Lire graphiquement l'expression d'une fonction affine",
|
|
147
245
|
isSingleStep: true,
|
|
148
|
-
generator: (nb) => getDistinctQuestions(getAffineExpressionReadingQuestion, nb),
|
|
246
|
+
generator: (nb) => getDistinctQuestions(() => getAffineExpressionReadingQuestion({ isLinear: false }), nb),
|
|
247
|
+
qcmTimer: 60,
|
|
248
|
+
freeTimer: 60,
|
|
249
|
+
getPropositions,
|
|
250
|
+
isAnswerValid,
|
|
251
|
+
hasGeogebra: true,
|
|
252
|
+
subject: "Mathématiques",
|
|
253
|
+
getQuestionFromIdentifiers,
|
|
254
|
+
hasHintAndCorrection: true,
|
|
255
|
+
};
|
|
256
|
+
export const linearExpressionReading = {
|
|
257
|
+
id: "linearExpressionReading",
|
|
258
|
+
connector: "=",
|
|
259
|
+
label: "Lire graphiquement l'expression d'une fonction linéaire",
|
|
260
|
+
isSingleStep: true,
|
|
261
|
+
generator: (nb) => getDistinctQuestions(() => getAffineExpressionReadingQuestion({ isLinear: true }), nb),
|
|
149
262
|
qcmTimer: 60,
|
|
150
263
|
freeTimer: 60,
|
|
151
264
|
getPropositions,
|
|
@@ -154,4 +267,5 @@ export const affineExpressionReading = {
|
|
|
154
267
|
subject: "Mathématiques",
|
|
155
268
|
getQuestionFromIdentifiers,
|
|
156
269
|
hasHintAndCorrection: true,
|
|
270
|
+
rebuildIdentifiers: rebuildIdentifiers,
|
|
157
271
|
};
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { Exercise } from "../../../../exercises/exercise.js";
|
|
2
|
+
type Options = {
|
|
3
|
+
isLinear: boolean;
|
|
4
|
+
};
|
|
2
5
|
type Identifiers = {
|
|
3
6
|
correctA: number;
|
|
4
7
|
correctB: number;
|
|
5
8
|
nameFunc: string;
|
|
6
9
|
};
|
|
7
|
-
export declare const drawAffineFromLitExp: Exercise<Identifiers>;
|
|
10
|
+
export declare const drawAffineFromLitExp: Exercise<Identifiers, Options>;
|
|
11
|
+
export declare const drawLinearFromLitExp: Exercise<Identifiers, Options>;
|
|
8
12
|
export {};
|
|
9
13
|
//# sourceMappingURL=drawAffineFromLitExp.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drawAffineFromLitExp.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/affines/drawAffineFromLitExp.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,6BAA6B,CAAC;AAarC,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;
|
|
1
|
+
{"version":3,"file":"drawAffineFromLitExp.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/affines/drawAffineFromLitExp.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,6BAA6B,CAAC;AAarC,KAAK,OAAO,GAAG;IACb,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAkJF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAqB/D,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAwB/D,CAAC"}
|
|
@@ -18,18 +18,31 @@ $$
|
|
|
18
18
|
${nameFunc}(x) = ${affine.toTex()}
|
|
19
19
|
$$`;
|
|
20
20
|
};
|
|
21
|
-
const getHint = () => {
|
|
22
|
-
|
|
21
|
+
const getHint = (identifiers, opts) => {
|
|
22
|
+
const { nameFunc } = identifiers;
|
|
23
|
+
if (opts?.isLinear) {
|
|
24
|
+
return `Calcule combien vaut $${nameFunc}(0)$, $${nameFunc}(1)$ et place les points correspondants. Puis trace la droite.`;
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
return `Détermine un premier point par lequel passe la droite en utilisant l'ordonnée à l'origine de la droite. Puis à l'aide du coefficient directeur, détermine un second point à partir du premier point.`;
|
|
28
|
+
}
|
|
23
29
|
};
|
|
24
|
-
const getCorrection = (identifiers) => {
|
|
30
|
+
const getCorrection = (identifiers, opts) => {
|
|
25
31
|
const { correctA, correctB } = identifiers;
|
|
26
32
|
const affine = new Affine(correctA, correctB);
|
|
27
|
-
return
|
|
28
|
-
|
|
33
|
+
return `${(() => {
|
|
34
|
+
if (opts?.isLinear) {
|
|
35
|
+
return `On a affaire à une fonction linéaire.`;
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
return `Le terme constant dans l'expression $ ${affine.toTex()} $ est $${correctB}$.`;
|
|
39
|
+
}
|
|
40
|
+
})()}
|
|
41
|
+
L'ordonnée à l'origine de la droite est donc $${correctB}$.
|
|
29
42
|
La droite passe par le point de coordonnées $(0;${correctB})$.
|
|
30
43
|
|
|
31
44
|
Le nombre qui multiplie $x$ dans l'expression $ ${affine.toTex()} $ est $${correctA}$.
|
|
32
|
-
Le coefficient directeur de $d$ est par conséquent $${correctA}$. Donc, à partir du point $(0;${correctB})$, si l'on augmente l'abscisse de $1$ unité, l'ordonnée ${correctA < 0 ? "diminue" : "augmente"} de $${correctA}$ unité(s). La droite passe donc par le point de coordonnées $(1; ${correctB + correctA})$.
|
|
45
|
+
Le coefficient directeur de $d$ est par conséquent $${correctA}$. Donc, à partir du point $(0;${correctB})$, si l'on augmente l'abscisse de $1$ unité, l'ordonnée ${correctA < 0 ? "diminue" : "augmente"} de $${Math.abs(correctA)}$ unité(s). La droite passe donc par le point de coordonnées $(1; ${correctB + correctA})$.
|
|
33
46
|
|
|
34
47
|
On place donc les deux points de coordonnées $(0; ${correctB})$ et $(1; ${correctB + correctA})$, puis on trace la droite passant par ces deux points.`;
|
|
35
48
|
};
|
|
@@ -83,27 +96,56 @@ const getPoint = (command, pointName) => {
|
|
|
83
96
|
const y = +splitted[1].replace(")", "");
|
|
84
97
|
return new Point(pointName, x.toTree(), y.toTree());
|
|
85
98
|
};
|
|
86
|
-
const getDrawAffineFromLitExpQuestion = () => {
|
|
87
|
-
|
|
99
|
+
const getDrawAffineFromLitExpQuestion = (opts) => {
|
|
100
|
+
let affine;
|
|
101
|
+
if (opts?.isLinear) {
|
|
102
|
+
affine = AffineConstructor.random({ min: -5, max: 5 }, { min: 0, max: 0 });
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
affine = AffineConstructor.random({ min: -3, max: 3 });
|
|
106
|
+
}
|
|
88
107
|
const nameFunc = random(["f", "g", "h"]);
|
|
89
108
|
const identifiers = { correctA: affine.a, correctB: affine.b, nameFunc };
|
|
90
|
-
return getQuestionFromIdentifiers(identifiers);
|
|
109
|
+
return getQuestionFromIdentifiers(identifiers, opts);
|
|
91
110
|
};
|
|
92
|
-
const getQuestionFromIdentifiers = (identifiers) => {
|
|
111
|
+
const getQuestionFromIdentifiers = (identifiers, opts) => {
|
|
93
112
|
return {
|
|
94
|
-
ggbAnswer: getGGBAnswer(identifiers),
|
|
95
|
-
instruction: getInstruction(identifiers),
|
|
96
|
-
studentGgbOptions: getStudentGGBOptions(identifiers),
|
|
113
|
+
ggbAnswer: getGGBAnswer(identifiers, opts),
|
|
114
|
+
instruction: getInstruction(identifiers, opts),
|
|
115
|
+
studentGgbOptions: getStudentGGBOptions(identifiers, opts),
|
|
97
116
|
identifiers,
|
|
98
|
-
hint: getHint(identifiers),
|
|
99
|
-
correction: getCorrection(identifiers),
|
|
117
|
+
hint: getHint(identifiers, opts),
|
|
118
|
+
correction: getCorrection(identifiers, opts),
|
|
119
|
+
options: opts,
|
|
100
120
|
};
|
|
101
121
|
};
|
|
102
122
|
export const drawAffineFromLitExp = {
|
|
103
123
|
id: "drawAffineFromLitExp",
|
|
104
|
-
label: "Tracer une fonction affine via son expression algébrique",
|
|
124
|
+
label: "Tracer la représentation graphique d'une fonction affine via son expression algébrique",
|
|
105
125
|
isSingleStep: true,
|
|
106
|
-
generator: (nb
|
|
126
|
+
generator: (nb) => getDistinctQuestions(() => getDrawAffineFromLitExpQuestion({ isLinear: false }), nb),
|
|
127
|
+
ggbTimer: 60,
|
|
128
|
+
isGGBAnswerValid,
|
|
129
|
+
subject: "Mathématiques",
|
|
130
|
+
getHint,
|
|
131
|
+
getInstruction,
|
|
132
|
+
getCorrection,
|
|
133
|
+
getGGBAnswer,
|
|
134
|
+
getStudentGGBOptions,
|
|
135
|
+
answerType: "GGB",
|
|
136
|
+
getQuestionFromIdentifiers,
|
|
137
|
+
hasHintAndCorrection: true,
|
|
138
|
+
};
|
|
139
|
+
export const drawLinearFromLitExp = {
|
|
140
|
+
id: "drawLinearFromLitExp",
|
|
141
|
+
label: "Tracer la représentation graphique d'une fonction linéaire via son expression algébrique",
|
|
142
|
+
isSingleStep: true,
|
|
143
|
+
generator: (nb) =>
|
|
144
|
+
// getDistinctQuestions(
|
|
145
|
+
// () => getDrawAffineFromLitExpQuestion({ isLinear: true }),
|
|
146
|
+
// nb,
|
|
147
|
+
// ),
|
|
148
|
+
[...Array(nb).keys()].map(() => getDrawAffineFromLitExpQuestion({ isLinear: true })),
|
|
107
149
|
ggbTimer: 60,
|
|
108
150
|
isGGBAnswerValid,
|
|
109
151
|
subject: "Mathématiques",
|
|
@@ -121,7 +121,7 @@ const getHint = (identifiers) => {
|
|
|
121
121
|
: isStrict
|
|
122
122
|
? "strictement inférieure"
|
|
123
123
|
: "inférieure";
|
|
124
|
-
return `
|
|
124
|
+
return `Lis toutes les valeurs de $x$ pour lesquelles $f(x)$ est ${word} à $${yValue.frenchify()}$.`;
|
|
125
125
|
};
|
|
126
126
|
const getCorrection = (identifiers) => {
|
|
127
127
|
//trace droit y = y, lit x sous
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/functions/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/functions/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/linear/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,oCAAoC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise.js";
|
|
2
|
+
type Identifiers = {
|
|
3
|
+
situationIndex: number;
|
|
4
|
+
x1: number;
|
|
5
|
+
y1: number;
|
|
6
|
+
};
|
|
7
|
+
export declare const linearFromExercise: Exercise<Identifiers>;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=linearFromExercise.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"linearFromExercise.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/linear/linearFromExercise.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAsCrC,KAAK,WAAW,GAAG;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAuWF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,CAkBpD,CAAC"}
|
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
import { addValidProp, shuffleProps, tryToAddWrongProp, propWhile, } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { randfloat } from "../../../../math/utils/random/randfloat.js";
|
|
4
|
+
import { randint } from "../../../../math/utils/random/randint.js";
|
|
5
|
+
import { round } from "../../../../math/utils/round.js";
|
|
6
|
+
import { add } from "../../../../tree/nodes/operators/addNode.js";
|
|
7
|
+
import { frac, isFractionNode, } from "../../../../tree/nodes/operators/fractionNode.js";
|
|
8
|
+
import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
9
|
+
import { VariableNode } from "../../../../tree/nodes/variables/variableNode.js";
|
|
10
|
+
import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
|
|
11
|
+
import { random } from "../../../../utils/alea/random.js";
|
|
12
|
+
import { shuffle } from "../../../../utils/alea/shuffle.js";
|
|
13
|
+
const getRandomValues = (funcX1, funcY1, funcIsValid, defaultDict) => {
|
|
14
|
+
let counter = -1;
|
|
15
|
+
let isValid = false;
|
|
16
|
+
while (!isValid && counter < 100) {
|
|
17
|
+
counter++;
|
|
18
|
+
const x1 = funcX1();
|
|
19
|
+
const y1 = funcY1(x1);
|
|
20
|
+
console.log("{x1,y1}", { x1, y1 });
|
|
21
|
+
isValid = funcIsValid(x1, y1);
|
|
22
|
+
if (isValid) {
|
|
23
|
+
return { x1, y1 };
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return defaultDict;
|
|
27
|
+
};
|
|
28
|
+
const situations = [
|
|
29
|
+
//électricité
|
|
30
|
+
{
|
|
31
|
+
instruction: (x1, y1) => `Sabine a payé $${y1.frenchify()} \\ \\textrm{€}$ pour une consommation de $${x1.frenchify()} \\ \\textrm{kWh}$ d'électricité.
|
|
32
|
+
Quel aurait été le montant de sa facture (en $\\textrm{€}$) pour une consommation de $x \\ \\textrm{kWh}$ ?`,
|
|
33
|
+
hint: `Quel calcul permet de trouver le montant de la facture pour une consommation de $1 \\ \\textrm{kWh}$ ?
|
|
34
|
+
|
|
35
|
+
Inspire toi de ce calcul pour déterminer le montant de la facture pour $x \\ \\textrm{kWh}$.`,
|
|
36
|
+
correction: (x1, y1) => {
|
|
37
|
+
const nodeA = frac(y1, x1);
|
|
38
|
+
const nodeASimplified = nodeA.simplify();
|
|
39
|
+
const texASimplified = nodeASimplified.toTex();
|
|
40
|
+
const texADecimal = nodeA.simplify({ fractionsToDecimal: true }).toTex();
|
|
41
|
+
return `On modélise cette situation par une situation de proportionnalité.
|
|
42
|
+
|
|
43
|
+
$$
|
|
44
|
+
${nodeA.toSimplificationTex()} ${texADecimal !== texASimplified ? `= ${texADecimal}` : ""}
|
|
45
|
+
$$
|
|
46
|
+
|
|
47
|
+
Pour $1 \\ \\textrm{kWh}$, Sabine paye $${texADecimal} \\ \\textrm{€}$.
|
|
48
|
+
|
|
49
|
+
La facture en $\\textrm{€}$ pour $x \\ \\textrm{kWh}$ est $${texADecimal}x$.`;
|
|
50
|
+
},
|
|
51
|
+
roundTo: 2,
|
|
52
|
+
randValues: (roundTo) => {
|
|
53
|
+
const a = randfloat(0.05, 0.25, 2);
|
|
54
|
+
const funcX1 = () => randint(1500, 5000);
|
|
55
|
+
const funcY1 = (x1) => a * x1;
|
|
56
|
+
const funcIsValid = (_, y1) => round(y1, roundTo) === y1;
|
|
57
|
+
return getRandomValues(funcX1, funcY1, funcIsValid, {
|
|
58
|
+
x1: 2000,
|
|
59
|
+
y1: 2000 * 0.2,
|
|
60
|
+
});
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
//fautes d'orthographe
|
|
64
|
+
{
|
|
65
|
+
instruction: (x1, y1) => `En $${x1.frenchify()}$ phrases, Marjorie a fait $${y1.frenchify()}$ fautes d'orthographe.
|
|
66
|
+
Quel sera le nombre vraisemblable de fautes qu'elle fera en $x$ phrases ?`,
|
|
67
|
+
hint: `Quel calcul permet de trouver le nombre de fautes dans $1$ phrase ?
|
|
68
|
+
|
|
69
|
+
Inspire toi de ce calcul pour déterminer le nombre de fautes en $x$ phrases.`,
|
|
70
|
+
correction: (x1, y1) => {
|
|
71
|
+
const nodeA = frac(y1, x1);
|
|
72
|
+
const nodeASimplified = nodeA.simplify();
|
|
73
|
+
const texASimplified = nodeASimplified.toTex();
|
|
74
|
+
const texSimplification = nodeA.toSimplificationTex();
|
|
75
|
+
return `On modélise cette situation par une situation de proportionnalité.
|
|
76
|
+
|
|
77
|
+
${(() => {
|
|
78
|
+
if (texSimplification.includes("=")) {
|
|
79
|
+
return `
|
|
80
|
+
|
|
81
|
+
$$
|
|
82
|
+
${texSimplification}
|
|
83
|
+
$$
|
|
84
|
+
|
|
85
|
+
`;
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
return ``;
|
|
89
|
+
}
|
|
90
|
+
})()}
|
|
91
|
+
|
|
92
|
+
En $1$ phrase, Marjorie fait $${texASimplified}$ fautes.
|
|
93
|
+
|
|
94
|
+
Le nombre de fautes vraisemblablement attendu en $x$ phrases est $${texASimplified}x$.`;
|
|
95
|
+
},
|
|
96
|
+
roundTo: -1,
|
|
97
|
+
randValues: (_) => {
|
|
98
|
+
const a = randint(2, 13);
|
|
99
|
+
const funcX1 = () => randint(2, 6);
|
|
100
|
+
const funcY1 = (x1) => a * x1;
|
|
101
|
+
const funcIsValid = () => true;
|
|
102
|
+
return getRandomValues(funcX1, funcY1, funcIsValid, {
|
|
103
|
+
x1: 2,
|
|
104
|
+
y1: 11,
|
|
105
|
+
});
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
//volume d'air inspiré
|
|
109
|
+
{
|
|
110
|
+
instruction: (x1, y1) => `En $${x1.frenchify()} \\ \\textrm{h}$, Julia a inspiré $${y1.frenchify()} \\ \\textrm{L}$ d'air.
|
|
111
|
+
Quel est le volume d'air qu'elle inspire en $x \\ \\textrm{h}$ ?`,
|
|
112
|
+
hint: `Quel calcul permet de trouver le volume inspiré en $1 \\ \\textrm{h}$ ?
|
|
113
|
+
|
|
114
|
+
Inspire toi de ce calcul pour déterminer le volume inspiré en $x \\ \\textrm{h}$.`,
|
|
115
|
+
correction: (x1, y1) => {
|
|
116
|
+
const nodeA = frac(y1, x1);
|
|
117
|
+
const nodeASimplified = nodeA.simplify();
|
|
118
|
+
const texASimplified = nodeASimplified.toTex();
|
|
119
|
+
const texSimplification = nodeA.toSimplificationTex();
|
|
120
|
+
return `On modélise cette situation par une situation de proportionnalité.
|
|
121
|
+
|
|
122
|
+
${(() => {
|
|
123
|
+
if (texSimplification.includes("=")) {
|
|
124
|
+
return `
|
|
125
|
+
|
|
126
|
+
$$
|
|
127
|
+
${texSimplification}
|
|
128
|
+
$$
|
|
129
|
+
|
|
130
|
+
`;
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
return ``;
|
|
134
|
+
}
|
|
135
|
+
})()}
|
|
136
|
+
|
|
137
|
+
En $1 \\ \\textrm{h}$, Julia inspire $${texASimplified} \\ \\textrm{L}$ d'air.
|
|
138
|
+
|
|
139
|
+
Le volume d'air vraisemblablement inspiré en litres en $x \\ \\textrm{h}$ est $${texASimplified}x$.`;
|
|
140
|
+
},
|
|
141
|
+
roundTo: 0,
|
|
142
|
+
randValues: (_) => {
|
|
143
|
+
const a = randint(400, 500);
|
|
144
|
+
const funcX1 = () => 24;
|
|
145
|
+
const funcY1 = (x1) => a * x1;
|
|
146
|
+
const funcIsValid = () => true;
|
|
147
|
+
return getRandomValues(funcX1, funcY1, funcIsValid, {
|
|
148
|
+
x1: 24,
|
|
149
|
+
y1: 13045,
|
|
150
|
+
});
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
//safran
|
|
154
|
+
{
|
|
155
|
+
instruction: (x1, y1) => `Pour $${x1.frenchify()} \\ \\textrm{g}$ de safran, Justin a payé $${y1.frenchify()} \\ \\textrm{€}$.
|
|
156
|
+
Quel est le prix en $\\textrm{€}$ pour $x \\ \\textrm{g}$ ?`,
|
|
157
|
+
hint: `Quel calcul permet de trouver le prix pour $1 \\ \\textrm{g}$ ?
|
|
158
|
+
|
|
159
|
+
Inspire toi de ce calcul pour déterminer le prix pour $x \\ \\textrm{€}$.`,
|
|
160
|
+
correction: (x1, y1) => {
|
|
161
|
+
const nodeA = frac(y1, x1);
|
|
162
|
+
const nodeASimplified = nodeA.simplify();
|
|
163
|
+
const texASimplified = nodeASimplified.toTex();
|
|
164
|
+
const texADecimal = nodeA.simplify({ fractionsToDecimal: true }).toTex();
|
|
165
|
+
return `On modélise cette situation par une situation de proportionnalité.
|
|
166
|
+
|
|
167
|
+
$$
|
|
168
|
+
${nodeA.toSimplificationTex()} ${texADecimal !== texASimplified ? `= ${texADecimal}` : ""}
|
|
169
|
+
$$
|
|
170
|
+
|
|
171
|
+
Pour $1 \\ \\textrm{g}$, le prix est de $${texADecimal} \\ \\textrm{€}$.
|
|
172
|
+
|
|
173
|
+
Le prix en $\\textrm{€}$ pour $x \\ \\textrm{g}$ est $${texADecimal}x$.`;
|
|
174
|
+
},
|
|
175
|
+
roundTo: 2,
|
|
176
|
+
randValues: (roundTo) => {
|
|
177
|
+
const a = randint(10, 46);
|
|
178
|
+
const funcX1 = () => round(randint(2, 201) * 0.05, 2);
|
|
179
|
+
const funcY1 = (x1) => a * x1;
|
|
180
|
+
const funcIsValid = (_, y1) => round(y1, roundTo) === y1;
|
|
181
|
+
return getRandomValues(funcX1, funcY1, funcIsValid, {
|
|
182
|
+
x1: 0.35,
|
|
183
|
+
y1: 5.6,
|
|
184
|
+
});
|
|
185
|
+
},
|
|
186
|
+
},
|
|
187
|
+
//autoroute
|
|
188
|
+
{
|
|
189
|
+
instruction: (_, y1) => `Sur l'autoroute, Anton roule à une vitesse constante de $${y1.frenchify()} \\ \\textrm{km/h}$.
|
|
190
|
+
Quelle est la distance parcourue en $\\textrm{km}$ pour $x \\ \\textrm{h}$ ?`,
|
|
191
|
+
hint: `Quel calcul permet de trouver la distance parcourue en $1 \\ \\textrm{h}$ ?
|
|
192
|
+
|
|
193
|
+
Inspire toi de ce calcul pour déterminer la distance parcourue en $x \\ \\textrm{h}$.`,
|
|
194
|
+
correction: (x1, y1) => {
|
|
195
|
+
const nodeA = frac(y1, x1);
|
|
196
|
+
const texADecimal = nodeA.simplify({ fractionsToDecimal: true }).toTex();
|
|
197
|
+
return `On modélise cette situation par une situation de proportionnalité.
|
|
198
|
+
|
|
199
|
+
En $1 \\ \\textrm{h}$, Anton parcourt $${texADecimal} \\ \\textrm{km}$.
|
|
200
|
+
|
|
201
|
+
La distance parcourue en $\\textrm{km}$ en $x \\ \\textrm{h}$ est $${texADecimal}x$.`;
|
|
202
|
+
},
|
|
203
|
+
roundTo: 2,
|
|
204
|
+
randValues: (roundTo) => {
|
|
205
|
+
const a = randint(80, 130);
|
|
206
|
+
const funcX1 = () => 1;
|
|
207
|
+
const funcY1 = (x1) => a * x1;
|
|
208
|
+
const funcIsValid = (_, y1) => round(y1, roundTo) === y1;
|
|
209
|
+
return getRandomValues(funcX1, funcY1, funcIsValid, {
|
|
210
|
+
x1: 1,
|
|
211
|
+
y1: 101,
|
|
212
|
+
});
|
|
213
|
+
},
|
|
214
|
+
},
|
|
215
|
+
//fientes de pigeon
|
|
216
|
+
{
|
|
217
|
+
instruction: (_, y1) => `Dans un village de France, l'église reçoit $${y1.frenchify()} \\ \\textrm{g}$ de fientes de pigeon chaque semaine.
|
|
218
|
+
Quel est la masse de fientes de pigeon en $\\textrm{g}$ pour $x$ jours ?`,
|
|
219
|
+
hint: `Quel calcul permet de trouver la masse reçue en $1$ jour ?
|
|
220
|
+
|
|
221
|
+
Inspire toi de ce calcul pour déterminer la masse reçue en $x \\ \\textrm{h}$.`,
|
|
222
|
+
correction: (x1, y1) => {
|
|
223
|
+
const nodeA = frac(y1, x1);
|
|
224
|
+
const texADecimal = nodeA.simplify({ fractionsToDecimal: true }).toTex();
|
|
225
|
+
return `On modélise cette situation par une situation de proportionnalité.
|
|
226
|
+
|
|
227
|
+
En $1$ jour, l'église reçoit $${texADecimal} \\ \\textrm{g}$.
|
|
228
|
+
|
|
229
|
+
La masse reçue en $\\textrm{g}$ en $x$ jours est $${texADecimal}x$.`;
|
|
230
|
+
},
|
|
231
|
+
roundTo: 0,
|
|
232
|
+
randValues: (roundTo) => {
|
|
233
|
+
const a = randint(10, 120);
|
|
234
|
+
const funcX1 = () => 7;
|
|
235
|
+
const funcY1 = (x1) => a * x1;
|
|
236
|
+
const funcIsValid = (_, y1) => round(y1, roundTo) === y1;
|
|
237
|
+
return getRandomValues(funcX1, funcY1, funcIsValid, {
|
|
238
|
+
x1: 30,
|
|
239
|
+
y1: 7,
|
|
240
|
+
});
|
|
241
|
+
},
|
|
242
|
+
},
|
|
243
|
+
];
|
|
244
|
+
const getInstruction = (identifiers) => {
|
|
245
|
+
const { situationIndex, x1, y1 } = identifiers;
|
|
246
|
+
const situation = situations[situationIndex];
|
|
247
|
+
return situation.instruction(x1, y1);
|
|
248
|
+
};
|
|
249
|
+
const getAnswerNode = (identifiers) => {
|
|
250
|
+
const { x1, y1 } = identifiers;
|
|
251
|
+
const nodeA = frac(y1, x1).simplify();
|
|
252
|
+
return multiply(nodeA, new VariableNode("x"));
|
|
253
|
+
};
|
|
254
|
+
const getAnswer = (identifiers) => {
|
|
255
|
+
return getAnswerNode(identifiers).toTex();
|
|
256
|
+
};
|
|
257
|
+
const getHint = (identifiers) => {
|
|
258
|
+
const { situationIndex } = identifiers;
|
|
259
|
+
const situation = situations[situationIndex];
|
|
260
|
+
return situation.hint;
|
|
261
|
+
};
|
|
262
|
+
const getCorrection = (identifiers) => {
|
|
263
|
+
const { situationIndex, x1, y1 } = identifiers;
|
|
264
|
+
const situation = situations[situationIndex];
|
|
265
|
+
return situation.correction(x1, y1);
|
|
266
|
+
};
|
|
267
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
268
|
+
return parseAlgebraic(ans)
|
|
269
|
+
.simplify()
|
|
270
|
+
.equals(parseAlgebraic(answer).simplify());
|
|
271
|
+
};
|
|
272
|
+
const getPropositions = (n, { answer, ...identifiers }) => {
|
|
273
|
+
const propositions = [];
|
|
274
|
+
const { x1, y1 } = identifiers;
|
|
275
|
+
addValidProp(propositions, answer);
|
|
276
|
+
//wrong frac
|
|
277
|
+
const fractionNodeWrong = frac(x1, y1).simplify();
|
|
278
|
+
tryToAddWrongProp(propositions, multiply(fractionNodeWrong, new VariableNode("x")).toTex());
|
|
279
|
+
//terror (around answer or around wrong)
|
|
280
|
+
const nodeRight = frac(y1, x1).simplify();
|
|
281
|
+
const [xS, yS] = (() => {
|
|
282
|
+
if (isFractionNode(nodeRight)) {
|
|
283
|
+
const fractionNodeRight = nodeRight;
|
|
284
|
+
return [
|
|
285
|
+
fractionNodeRight.leftChild.evaluate(),
|
|
286
|
+
fractionNodeRight.rightChild.evaluate(),
|
|
287
|
+
];
|
|
288
|
+
}
|
|
289
|
+
else {
|
|
290
|
+
return [nodeRight.evaluate(), 1];
|
|
291
|
+
}
|
|
292
|
+
})();
|
|
293
|
+
[
|
|
294
|
+
random([
|
|
295
|
+
//around right
|
|
296
|
+
frac(Math.max(1, yS + randint(-10, 11, [0])), xS).simplify(),
|
|
297
|
+
//around wrong
|
|
298
|
+
frac(Math.max(1, xS + randint(-10, 11, [0])), yS).simplify(),
|
|
299
|
+
]),
|
|
300
|
+
].forEach((fractionNodeWrong) => {
|
|
301
|
+
tryToAddWrongProp(propositions, multiply(fractionNodeWrong, new VariableNode("x")).toTex());
|
|
302
|
+
});
|
|
303
|
+
const wrongPropsFiller = shuffle([
|
|
304
|
+
//linear (l'âge du capitaine)
|
|
305
|
+
multiply(x1, new VariableNode("x")).toTex(),
|
|
306
|
+
multiply(y1, new VariableNode("x")).toTex(),
|
|
307
|
+
//affine (l'âge du capitaine)
|
|
308
|
+
add(x1, multiply(y1, new VariableNode("x"))).toTex(),
|
|
309
|
+
add(y1, multiply(x1, new VariableNode("x"))).toTex(),
|
|
310
|
+
]);
|
|
311
|
+
function* genFuncWrongPropFiller() {
|
|
312
|
+
yield* wrongPropsFiller;
|
|
313
|
+
return "Done";
|
|
314
|
+
}
|
|
315
|
+
const generateWrongPropsFiller = genFuncWrongPropFiller();
|
|
316
|
+
propWhile(propositions, n, () => {
|
|
317
|
+
tryToAddWrongProp(propositions, generateWrongPropsFiller.next().value);
|
|
318
|
+
});
|
|
319
|
+
return shuffleProps(propositions, n);
|
|
320
|
+
};
|
|
321
|
+
const getLinearFromExerciseQuestion = () => {
|
|
322
|
+
const situationIndex = randint(0, situations.length);
|
|
323
|
+
const situation = situations[situationIndex];
|
|
324
|
+
const { x1, y1 } = situation.randValues(situation.roundTo);
|
|
325
|
+
const identifiers = { situationIndex, x1, y1 };
|
|
326
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
327
|
+
};
|
|
328
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
329
|
+
return {
|
|
330
|
+
answer: getAnswer(identifiers),
|
|
331
|
+
instruction: getInstruction(identifiers),
|
|
332
|
+
keys: ["x"],
|
|
333
|
+
answerFormat: "tex",
|
|
334
|
+
identifiers,
|
|
335
|
+
hint: getHint(identifiers),
|
|
336
|
+
correction: getCorrection(identifiers),
|
|
337
|
+
};
|
|
338
|
+
};
|
|
339
|
+
export const linearFromExercise = {
|
|
340
|
+
id: "linearFromExercise",
|
|
341
|
+
label: "Modéliser une situation de proportionnalité par une fonction linéaire",
|
|
342
|
+
isSingleStep: true,
|
|
343
|
+
generator: (nb, opts) => getDistinctQuestions(() => getLinearFromExerciseQuestion(opts), nb),
|
|
344
|
+
qcmTimer: 60,
|
|
345
|
+
freeTimer: 60,
|
|
346
|
+
getPropositions,
|
|
347
|
+
isAnswerValid,
|
|
348
|
+
subject: "Mathématiques",
|
|
349
|
+
getInstruction,
|
|
350
|
+
getHint,
|
|
351
|
+
getCorrection,
|
|
352
|
+
getAnswer,
|
|
353
|
+
getQuestionFromIdentifiers,
|
|
354
|
+
hasHintAndCorrection: true,
|
|
355
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise.js";
|
|
2
|
+
type Identifiers = {
|
|
3
|
+
situationIndex: number;
|
|
4
|
+
numP: number;
|
|
5
|
+
};
|
|
6
|
+
export declare const linearFromPercentageEvolution: Exercise<Identifiers>;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=linearFromPercentageEvolution.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"linearFromPercentageEvolution.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/linear/linearFromPercentageEvolution.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAYrC,KAAK,WAAW,GAAG;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAyRF,eAAO,MAAM,6BAA6B,EAAE,QAAQ,CAAC,WAAW,CAoB/D,CAAC"}
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { randint } from "../../../../math/utils/random/randint.js";
|
|
4
|
+
import { add } from "../../../../tree/nodes/operators/addNode.js";
|
|
5
|
+
import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
|
|
6
|
+
import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
7
|
+
import { VariableNode } from "../../../../tree/nodes/variables/variableNode.js";
|
|
8
|
+
import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
|
|
9
|
+
import { coinFlip } from "../../../../utils/alea/coinFlip.js";
|
|
10
|
+
import { random } from "../../../../utils/alea/random.js";
|
|
11
|
+
import { alignTex } from "../../../../utils/latex/alignTex.js";
|
|
12
|
+
const situations = [
|
|
13
|
+
//+
|
|
14
|
+
//électricité
|
|
15
|
+
{
|
|
16
|
+
instruction: (numP) => `Pour Sabine, le prix du $\\textrm{kWh}$ a augmenté de $${numP} \\ \\%$.
|
|
17
|
+
On appelle $x$ le prix du $\\textrm{kWh}$ avant l'augmentation et $f$ la fonction qui, à $x$, associe son prix après l'augmentation.
|
|
18
|
+
Exprimer $f(x)$ en fonction de $x$.`,
|
|
19
|
+
hint: `Suppose que Sabine payait $100 \\ \\textrm{€}$ et que sa consommation d'électricité reste la même. Quel est le prix qu'elle paiera après l'augmentation ?
|
|
20
|
+
Inspire toi de ce calcul pour déterminer l'expression de $f(x)$.`,
|
|
21
|
+
correction: `L'ancien prix est $x$. Le nouveau prix est $f(x)$.`,
|
|
22
|
+
randValues: () => {
|
|
23
|
+
const numP = randint(4, 350);
|
|
24
|
+
return { numP };
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
//-
|
|
28
|
+
//industriel
|
|
29
|
+
{
|
|
30
|
+
instruction: (numP) => `Dans la nouvelle recette de biscuit d'un industriel, la masse de sucre a baissé de $${Math.abs(numP)} \\ \\%$.
|
|
31
|
+
On appelle $x$ la masse de sucre dans l'ancienne recette et $f$ la fonction qui, à $x$, associe la masse de sucre dans la nouvelle recette.
|
|
32
|
+
Exprimer $f(x)$ en fonction de $x$.`,
|
|
33
|
+
hint: `Suppose qu'un biscuit contenait $100 \\ \\textrm{g}$ de sucre avant, combien en contient-il maintenant ?
|
|
34
|
+
|
|
35
|
+
Inspire toi de ce calcul pour déterminer l'expression de $f(x)$.`,
|
|
36
|
+
correction: `L'ancienne masse est $x$. La nouvelle masse est $f(x)$.`,
|
|
37
|
+
randValues: () => {
|
|
38
|
+
const numP = -randint(20, 61);
|
|
39
|
+
return { numP };
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
//+ ou -
|
|
43
|
+
//casque
|
|
44
|
+
{
|
|
45
|
+
instruction: (numP) => `Erika a un nouveau casque sans fil. L'autonomie, par rapport à l'ancien casque, a ${numP < 0 ? "diminué" : "augmenté"} de $${Math.abs(numP)} \\ \\%$.
|
|
46
|
+
On appelle $x$ l'autonomie de l'ancien casque et $f$ la fonction qui, à $x$, associe l'autonomie du nouveau casque.
|
|
47
|
+
Exprimer $f(x)$ en fonction de $x$.`,
|
|
48
|
+
hint: `Suppose que l'autonomie de l'ancien casque était de $100 \\ \\textrm{h}$, quelle est celle du nouveau casque ?
|
|
49
|
+
|
|
50
|
+
Inspire toi de ce calcul pour déterminer l'expression de $f(x)$.`,
|
|
51
|
+
correction: `L'ancienne autonomie est $x$. La nouvelle autonomie est $f(x)$.`,
|
|
52
|
+
randValues: () => {
|
|
53
|
+
const numP = coinFlip() ? randint(-50, -15) : randint(15, 50);
|
|
54
|
+
return { numP };
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
//rpg
|
|
58
|
+
{
|
|
59
|
+
instruction: (numP) => `Dans un jeu vidéo, Maelle a changé l'équipement de son personnage. La caractéristique "vitesse", par rapport à l'ancien équipement a ${numP < 0 ? "diminué" : "augmenté"} de $${Math.abs(numP)} \\ \\%$.
|
|
60
|
+
On appelle $x$ la vitesse précédente et $f$ la fonction qui, à $x$, associe la nouvelle vitesse.
|
|
61
|
+
Exprimer $f(x)$ en fonction de $x$.`,
|
|
62
|
+
hint: `Suppose que l'ancienne vitesse était $100$, quelle est la nouvelle vitesse ?
|
|
63
|
+
|
|
64
|
+
Inspire toi de ce calcul pour déterminer l'expression de $f(x)$.`,
|
|
65
|
+
correction: `L'ancienne vitesse est $x$. La nouvelle vitesse est $f(x)$.`,
|
|
66
|
+
randValues: () => {
|
|
67
|
+
const numP = coinFlip() ? randint(-50, -15) : randint(15, 50);
|
|
68
|
+
return { numP };
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
//course à pied
|
|
72
|
+
{
|
|
73
|
+
instruction: (numP) => `Vladimir s'entraîne à la course à pied. Par rapport à la séance précédente, son chrono au $10 \\ \\textrm{km}$ a ${numP < 0 ? "diminué" : "augmenté"} de $${Math.abs(numP)} \\ \\%$.
|
|
74
|
+
On appelle $x$ la durée précédente et $f$ la fonction qui, à $x$, associe la nouvelle durée.
|
|
75
|
+
Exprimer $f(x)$ en fonction de $x$.`,
|
|
76
|
+
hint: `Suppose que l'ancienne durée était $10$ min, quelle est la nouvelle durée ?
|
|
77
|
+
|
|
78
|
+
Inspire toi de ce calcul pour déterminer l'expression de $f(x)$.`,
|
|
79
|
+
correction: `L'ancienne durée est $x$. La nouvelle durée est $f(x)$.`,
|
|
80
|
+
randValues: () => {
|
|
81
|
+
const numP = coinFlip() ? randint(-50, -15) : randint(15, 50);
|
|
82
|
+
return { numP };
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
//livre
|
|
86
|
+
{
|
|
87
|
+
instruction: (numP) => `Un illustre écrivain sort un nouveau livre. Par rapport au dernier livre, le nombre de pages a ${numP < 0 ? "diminué" : "augmenté"} de $${Math.abs(numP)} \\ \\%$.
|
|
88
|
+
On appelle $x$ le nombre de pages du livre précédent et $f$ la fonction qui, à $x$, associe le nombre de pages du nouveau livre.
|
|
89
|
+
Exprimer $f(x)$ en fonction de $x$.`,
|
|
90
|
+
hint: `Suppose que l'ancien nombre de pages était $100$, quelle est le nouveau nombre de pages ?
|
|
91
|
+
|
|
92
|
+
Inspire toi de ce calcul pour déterminer l'expression de $f(x)$.`,
|
|
93
|
+
correction: `L'ancien nombre de pages est $x$. Le nouveau nombre de pages est $f(x)$.`,
|
|
94
|
+
randValues: () => {
|
|
95
|
+
const numP = coinFlip() ? randint(-50, -15) : randint(15, 50);
|
|
96
|
+
return { numP };
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
];
|
|
100
|
+
const getInstruction = (identifiers) => {
|
|
101
|
+
const { situationIndex, numP } = identifiers;
|
|
102
|
+
const situation = situations[situationIndex];
|
|
103
|
+
return situation.instruction(numP);
|
|
104
|
+
};
|
|
105
|
+
const getAnswerNode = (identifiers) => {
|
|
106
|
+
const { numP } = identifiers;
|
|
107
|
+
const nodeFactor = add(1, frac(numP, 100));
|
|
108
|
+
const nodeFactorSimplifiedDecimal = nodeFactor.simplify({
|
|
109
|
+
fractionsToDecimal: true,
|
|
110
|
+
});
|
|
111
|
+
const nodeExprSimplified = multiply(nodeFactorSimplifiedDecimal, new VariableNode("x"));
|
|
112
|
+
return nodeExprSimplified;
|
|
113
|
+
};
|
|
114
|
+
const getAnswer = (identifiers) => {
|
|
115
|
+
return getAnswerNode(identifiers).toTex();
|
|
116
|
+
};
|
|
117
|
+
const getHint = (identifiers) => {
|
|
118
|
+
const { situationIndex } = identifiers;
|
|
119
|
+
const situation = situations[situationIndex];
|
|
120
|
+
return situation.hint;
|
|
121
|
+
};
|
|
122
|
+
const getCorrection = (identifiers) => {
|
|
123
|
+
const { situationIndex, numP } = identifiers;
|
|
124
|
+
const situation = situations[situationIndex];
|
|
125
|
+
const texCorrection = situation.correction;
|
|
126
|
+
const nodeFractionP = frac(numP, 100);
|
|
127
|
+
const nodeFactor = add(1, nodeFractionP);
|
|
128
|
+
const nodeFactorSimplified = nodeFactor.simplify();
|
|
129
|
+
const texFactorDecimal = nodeFactorSimplified
|
|
130
|
+
.simplify({ fractionsToDecimal: true })
|
|
131
|
+
.toTex();
|
|
132
|
+
const nodeExpr = multiply(nodeFactor, new VariableNode("x"));
|
|
133
|
+
return `${texCorrection}
|
|
134
|
+
|
|
135
|
+
${alignTex([
|
|
136
|
+
["f(x)", "=", nodeExpr.toTex()],
|
|
137
|
+
["", "=", `${texFactorDecimal} x`],
|
|
138
|
+
])}
|
|
139
|
+
|
|
140
|
+
La fonction $f$ est donc une fonction linéaire de coefficient $${texFactorDecimal}$.`;
|
|
141
|
+
};
|
|
142
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
143
|
+
return parseAlgebraic(ans)
|
|
144
|
+
.simplify()
|
|
145
|
+
.equals(parseAlgebraic(answer).simplify());
|
|
146
|
+
};
|
|
147
|
+
const getPropositions = (n, { answer, ...identifiers }) => {
|
|
148
|
+
const propositions = [];
|
|
149
|
+
const { numP } = identifiers;
|
|
150
|
+
addValidProp(propositions, answer);
|
|
151
|
+
//(1+numP/100) -> numP/100
|
|
152
|
+
tryToAddWrongProp(propositions, multiply(frac(numP, 100).simplify({
|
|
153
|
+
fractionsToDecimal: true,
|
|
154
|
+
}), new VariableNode("x")).toTex());
|
|
155
|
+
//mult
|
|
156
|
+
tryToAddWrongProp(propositions, multiply(numP, new VariableNode("x")).toTex());
|
|
157
|
+
//terror (around answer or around wrong)
|
|
158
|
+
const numP10Around = (() => {
|
|
159
|
+
if (numP % 10 === 0) {
|
|
160
|
+
return numP / 10;
|
|
161
|
+
}
|
|
162
|
+
else {
|
|
163
|
+
return numP * 10;
|
|
164
|
+
}
|
|
165
|
+
})();
|
|
166
|
+
if (coinFlip()) {
|
|
167
|
+
tryToAddWrongProp(propositions, multiply(frac(100 + numP10Around, 100).simplify({
|
|
168
|
+
fractionsToDecimal: true,
|
|
169
|
+
}), new VariableNode("x")).toTex());
|
|
170
|
+
}
|
|
171
|
+
else {
|
|
172
|
+
tryToAddWrongProp(propositions, multiply(frac(numP10Around, 100).simplify({
|
|
173
|
+
fractionsToDecimal: true,
|
|
174
|
+
}), new VariableNode("x")).toTex());
|
|
175
|
+
}
|
|
176
|
+
//forgets x
|
|
177
|
+
//terror 2 (around answer or around wrong)
|
|
178
|
+
if (coinFlip()) {
|
|
179
|
+
const fractionNode = random([
|
|
180
|
+
frac(100 + numP, 100),
|
|
181
|
+
frac(100 + numP10Around, 100),
|
|
182
|
+
]);
|
|
183
|
+
tryToAddWrongProp(propositions, fractionNode
|
|
184
|
+
.simplify({
|
|
185
|
+
fractionsToDecimal: true,
|
|
186
|
+
})
|
|
187
|
+
.toTex());
|
|
188
|
+
}
|
|
189
|
+
else {
|
|
190
|
+
const fractionNode = random([frac(numP, 100), frac(numP10Around, 100)]);
|
|
191
|
+
tryToAddWrongProp(propositions, fractionNode
|
|
192
|
+
.simplify({
|
|
193
|
+
fractionsToDecimal: true,
|
|
194
|
+
})
|
|
195
|
+
.toTex());
|
|
196
|
+
}
|
|
197
|
+
return shuffleProps(propositions, n);
|
|
198
|
+
};
|
|
199
|
+
const getLinearFromPercentageEvolutionQuestion = () => {
|
|
200
|
+
const situationIndex = randint(0, situations.length);
|
|
201
|
+
const situation = situations[situationIndex];
|
|
202
|
+
const { numP } = situation.randValues();
|
|
203
|
+
const identifiers = { situationIndex, numP };
|
|
204
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
205
|
+
};
|
|
206
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
207
|
+
return {
|
|
208
|
+
answer: getAnswer(identifiers),
|
|
209
|
+
instruction: getInstruction(identifiers),
|
|
210
|
+
keys: ["x"],
|
|
211
|
+
answerFormat: "tex",
|
|
212
|
+
identifiers,
|
|
213
|
+
hint: getHint(identifiers),
|
|
214
|
+
correction: getCorrection(identifiers),
|
|
215
|
+
};
|
|
216
|
+
};
|
|
217
|
+
export const linearFromPercentageEvolution = {
|
|
218
|
+
id: "linearFromPercentageEvolution",
|
|
219
|
+
label: "Modéliser une évolution en pourcentage par une fonction linéaire",
|
|
220
|
+
isSingleStep: true,
|
|
221
|
+
generator: (nb, opts) => getDistinctQuestions(() => getLinearFromPercentageEvolutionQuestion(opts), nb),
|
|
222
|
+
qcmTimer: 60,
|
|
223
|
+
freeTimer: 60,
|
|
224
|
+
getPropositions,
|
|
225
|
+
isAnswerValid,
|
|
226
|
+
subject: "Mathématiques",
|
|
227
|
+
getInstruction,
|
|
228
|
+
getHint,
|
|
229
|
+
getCorrection,
|
|
230
|
+
getAnswer,
|
|
231
|
+
getQuestionFromIdentifiers,
|
|
232
|
+
hasHintAndCorrection: true,
|
|
233
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coefficientsIdentification.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/devForm/coefficientsIdentification.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAMrC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAQ7C,KAAK,WAAW,GAAG;IACjB,YAAY,EAAE,eAAe,CAAC;IAC9B,YAAY,EAAE,eAAe,CAAC;IAC9B,YAAY,EAAE,eAAe,CAAC;IAC9B,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;
|
|
1
|
+
{"version":3,"file":"coefficientsIdentification.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/devForm/coefficientsIdentification.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAMrC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAQ7C,KAAK,WAAW,GAAG;IACjB,YAAY,EAAE,eAAe,CAAC;IAC9B,YAAY,EAAE,eAAe,CAAC;IAC9B,YAAY,EAAE,eAAe,CAAC;IAC9B,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AA2IF,eAAO,MAAM,0BAA0B,EAAE,QAAQ,CAAC,WAAW,CAc5D,CAAC"}
|
|
@@ -7,9 +7,9 @@ import { NodeConstructor, } from "../../../../../tree/nodes/nodeConstructor.js";
|
|
|
7
7
|
import { isFractionNode } from "../../../../../tree/nodes/operators/fractionNode.js";
|
|
8
8
|
import { multiply } from "../../../../../tree/nodes/operators/multiplyNode.js";
|
|
9
9
|
import { square } from "../../../../../tree/nodes/operators/powerNode.js";
|
|
10
|
-
import { parseAlgebraic } from "../../../../../tree/parsers/latexParser.js";
|
|
11
10
|
import { random } from "../../../../../utils/alea/random.js";
|
|
12
11
|
import { handleVEAError } from "../../../../../utils/errors/handleVEAError.js";
|
|
12
|
+
import { rationalVEA } from "../../../../../exercises/vea/rationalVEA.js";
|
|
13
13
|
const getPropositions = (n, { answer, aIdentifiers, bIdentifiers, cIdentifiers, isAsking }) => {
|
|
14
14
|
const propositions = [];
|
|
15
15
|
addValidProp(propositions, answer);
|
|
@@ -71,10 +71,7 @@ const getKeys = () => {
|
|
|
71
71
|
};
|
|
72
72
|
const isAnswerValid = (ans, { answer }) => {
|
|
73
73
|
try {
|
|
74
|
-
|
|
75
|
-
if (!parsed)
|
|
76
|
-
return false;
|
|
77
|
-
return parsed.simplify().toTex() === answer;
|
|
74
|
+
return rationalVEA(ans, answer);
|
|
78
75
|
}
|
|
79
76
|
catch (err) {
|
|
80
77
|
return handleVEAError(err);
|
package/lib/index.d.ts
CHANGED
|
@@ -1045,9 +1045,12 @@ declare const mathExercises: (Exercise<{
|
|
|
1045
1045
|
b: number;
|
|
1046
1046
|
askingPositive: boolean;
|
|
1047
1047
|
}, Record<string, string | boolean | string[]>> | Exercise<{
|
|
1048
|
+
isLinear: boolean;
|
|
1048
1049
|
b: number;
|
|
1049
1050
|
secondPoint: number[];
|
|
1050
|
-
},
|
|
1051
|
+
}, {
|
|
1052
|
+
isLinear: boolean;
|
|
1053
|
+
}> | Exercise<{
|
|
1051
1054
|
b: number;
|
|
1052
1055
|
secondPoint: number[];
|
|
1053
1056
|
}, Record<string, string | boolean | string[]>> | Exercise<{
|
|
@@ -1084,7 +1087,9 @@ declare const mathExercises: (Exercise<{
|
|
|
1084
1087
|
correctA: number;
|
|
1085
1088
|
correctB: number;
|
|
1086
1089
|
nameFunc: string;
|
|
1087
|
-
},
|
|
1090
|
+
}, {
|
|
1091
|
+
isLinear: boolean;
|
|
1092
|
+
}> | Exercise<{
|
|
1088
1093
|
items: {
|
|
1089
1094
|
fName: string;
|
|
1090
1095
|
tex: string;
|
|
@@ -1593,6 +1598,13 @@ declare const mathExercises: (Exercise<{
|
|
|
1593
1598
|
tex: string;
|
|
1594
1599
|
isValid: boolean;
|
|
1595
1600
|
}[];
|
|
1601
|
+
}, Record<string, string | boolean | string[]>> | Exercise<{
|
|
1602
|
+
situationIndex: number;
|
|
1603
|
+
x1: number;
|
|
1604
|
+
y1: number;
|
|
1605
|
+
}, Record<string, string | boolean | string[]>> | Exercise<{
|
|
1606
|
+
situationIndex: number;
|
|
1607
|
+
numP: number;
|
|
1596
1608
|
}, Record<string, string | boolean | string[]>> | Exercise<{
|
|
1597
1609
|
coin: boolean;
|
|
1598
1610
|
radius: number;
|
|
@@ -3575,9 +3587,12 @@ declare const pcExercises: (Exercise<{
|
|
|
3575
3587
|
equaDiffIdentifiers: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
|
|
3576
3588
|
isSolution: boolean;
|
|
3577
3589
|
}, Record<string, string | boolean | string[]>> | Exercise<{
|
|
3590
|
+
isLinear: boolean;
|
|
3578
3591
|
b: number;
|
|
3579
3592
|
secondPoint: number[];
|
|
3580
|
-
},
|
|
3593
|
+
}, {
|
|
3594
|
+
isLinear: boolean;
|
|
3595
|
+
}> | Exercise<{
|
|
3581
3596
|
tenthPower: number;
|
|
3582
3597
|
}, Record<string, string | boolean | string[]>> | Exercise<{
|
|
3583
3598
|
a: number;
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,KAAK,aAAa,MAAM,2BAA2B,CAAC;AAE3D,OAAO,4BAA4B,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,QAAA,MAAM,aAAa
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,KAAK,aAAa,MAAM,2BAA2B,CAAC;AAE3D,OAAO,4BAA4B,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,QAAA,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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