math-exercises 3.0.128 → 3.0.130
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/ordering/compareA10N.d.ts +6 -1
- package/lib/exercises/math/calcul/ordering/compareA10N.d.ts.map +1 -1
- package/lib/exercises/math/calcul/ordering/compareA10N.js +56 -49
- package/lib/exercises/math/calcul/ordering/compareABUsingQuotient.d.ts.map +1 -1
- package/lib/exercises/math/calcul/ordering/compareABUsingQuotient.js +3 -18
- package/lib/exercises/math/calcul/ordering/compareFracABWithFracAPlusCBPlusC.d.ts +4 -1
- package/lib/exercises/math/calcul/ordering/compareFracABWithFracAPlusCBPlusC.d.ts.map +1 -1
- package/lib/exercises/math/calcul/ordering/compareFracABWithFracAPlusCBPlusC.js +34 -10
- package/lib/exercises/math/calcul/ordering/compareFracAndDec.d.ts +2 -6
- package/lib/exercises/math/calcul/ordering/compareFracAndDec.d.ts.map +1 -1
- package/lib/exercises/math/calcul/ordering/compareFracAndDec.js +81 -197
- package/lib/exercises/math/calcul/ordering/compareWithSquareRoots.d.ts.map +1 -1
- package/lib/exercises/math/calcul/ordering/compareWithSquareRoots.js +1 -40
- package/lib/exercises/math/calcul/rounding/estimateAroundPow10NTimesAroundPow10N.d.ts.map +1 -1
- package/lib/exercises/math/calcul/rounding/estimateAroundPow10NTimesAroundPow10N.js +1 -15
- package/lib/exercises/math/calcul/rounding/estimatePow10NPlusPow10MinusN.d.ts.map +1 -1
- package/lib/exercises/math/calcul/rounding/estimatePow10NPlusPow10MinusN.js +1 -13
- package/lib/exercises/math/calculLitteral/equation/equationFromProblem.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/equationFromProblem.js +7 -2
- package/lib/exercises/math/calculLitteral/ordering/compareAMinusB.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/ordering/compareAMinusB.js +1 -4
- package/lib/exercises/math/calculLitteral/ordering/compareFromPiMinusFrac.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/ordering/compareFromPiMinusFrac.js +1 -4
- package/lib/exercises/math/calculLitteral/simplifying/compareATimes0.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/simplifying/compareATimes0.js +27 -46
- package/lib/exercises/math/calculLitteral/simplifying/compareMinusA.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/simplifying/compareMinusA.js +25 -42
- package/lib/exercises/math/conversion/kmPerMinToKmPerHourConversion.js +1 -1
- package/lib/exercises/math/conversion/minutesToHours.d.ts.map +1 -1
- package/lib/exercises/math/conversion/minutesToHours.js +6 -3
- package/lib/exercises/math/conversion/secondsToHours.d.ts.map +1 -1
- package/lib/exercises/math/conversion/secondsToHours.js +6 -3
- package/lib/exercises/math/dataRepresentations/barChartInterpreting.d.ts.map +1 -1
- package/lib/exercises/math/dataRepresentations/barChartInterpreting.js +27 -17
- package/lib/exercises/math/dataRepresentations/scatterPlotCommenting.d.ts.map +1 -1
- package/lib/exercises/math/dataRepresentations/scatterPlotCommenting.js +5 -103
- package/lib/index.d.ts +11 -9
- package/lib/index.d.ts.map +1 -1
- package/lib/tests/questionTest.d.ts.map +1 -1
- package/lib/tests/questionTest.js +4 -2
- package/package.json +1 -1
|
@@ -2,44 +2,38 @@ import { GeneratorOptionTarget, GeneratorOptionType, addValidProp, tryToAddWrong
|
|
|
2
2
|
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
3
|
import { randint } from "../../../../math/utils/random/randint.js";
|
|
4
4
|
import { NodeConstructor, } from "../../../../tree/nodes/nodeConstructor.js";
|
|
5
|
-
import { add } from "../../../../tree/nodes/operators/addNode.js";
|
|
6
5
|
import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
|
|
7
6
|
import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
8
7
|
import { substract } from "../../../../tree/nodes/operators/substractNode.js";
|
|
9
|
-
import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
|
|
10
8
|
import { coinFlip } from "../../../../utils/alea/coinFlip.js";
|
|
11
|
-
import { random
|
|
9
|
+
import { random } from "../../../../utils/alea/random.js";
|
|
12
10
|
import { shuffle } from "../../../../utils/alea/shuffle.js";
|
|
13
11
|
import { permute } from "../../../../utils/arrays/permutations.js";
|
|
14
|
-
const getDecimalFormatTex = (questionParam) => {
|
|
15
|
-
return NodeConstructor.fromIdentifiers(questionParam.nodeIds)
|
|
16
|
-
.evaluate()
|
|
17
|
-
.frenchify();
|
|
18
|
-
};
|
|
19
12
|
const getInstruction = (identifiers, optsIn) => {
|
|
20
|
-
const {
|
|
13
|
+
const { questionParams } = identifiers;
|
|
21
14
|
const opts = Object.assign(optsDefault, optsIn);
|
|
22
15
|
return `Voici trois nombres.
|
|
23
16
|
|
|
24
17
|
${opts.isUseABC
|
|
25
|
-
?
|
|
26
|
-
.
|
|
27
|
-
|
|
28
|
-
|
|
18
|
+
? (() => {
|
|
19
|
+
const entries = questionParams.map((qP) => [qP.letter, qP]);
|
|
20
|
+
return entries
|
|
21
|
+
.toSorted(([letter1], [letter2]) => letter1.localeCompare(letter2))
|
|
22
|
+
.map(([letter, questionParam]) => {
|
|
23
|
+
return `
|
|
29
24
|
|
|
30
25
|
$$
|
|
31
|
-
${
|
|
26
|
+
${letter} = ${questionParam.tex}
|
|
32
27
|
$$
|
|
33
28
|
|
|
34
29
|
`;
|
|
35
|
-
|
|
36
|
-
|
|
30
|
+
})
|
|
31
|
+
.join("");
|
|
32
|
+
})()
|
|
37
33
|
: `
|
|
38
34
|
|
|
39
35
|
$$
|
|
40
|
-
${
|
|
41
|
-
.map((questionParam) => questionParam.tex)
|
|
42
|
-
.join(" ; ")}
|
|
36
|
+
${questionParams.map((questionParam) => questionParam.tex).join(" ; ")}
|
|
43
37
|
$$
|
|
44
38
|
|
|
45
39
|
`}
|
|
@@ -52,116 +46,48 @@ const getHint = () => {
|
|
|
52
46
|
soit les mettre au même dénominateur.`;
|
|
53
47
|
};
|
|
54
48
|
const getCorrection = (identifiers, optsIn) => {
|
|
55
|
-
const {
|
|
56
|
-
const opts =
|
|
57
|
-
const
|
|
58
|
-
questionParam.
|
|
59
|
-
|
|
60
|
-
]));
|
|
61
|
-
const letters = Object.keys(dictTrueNameToQuestionParam).toSorted((s1, s2) => s1.localeCompare(s2));
|
|
62
|
-
const [A, B, C] = letters.map((trueName) => {
|
|
63
|
-
const questionParam = dictTrueNameToQuestionParam[trueName];
|
|
64
|
-
return opts.isUseABC ? questionParam.fakeName : questionParam.tex;
|
|
49
|
+
const { questionParams } = identifiers;
|
|
50
|
+
const opts = optsIn ?? optsDefault;
|
|
51
|
+
const ascOrderedQuestionParams = questionParams.toSorted((questionParam1, questionParam2) => {
|
|
52
|
+
const [node1, node2] = [questionParam1, questionParam2].map((questionParam) => NodeConstructor.fromIdentifiers(questionParam.nodeIds));
|
|
53
|
+
return substract(node1, node2).evaluate();
|
|
65
54
|
});
|
|
66
|
-
return `
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
${letters
|
|
73
|
-
.toSorted((trueName1, trueName2) => {
|
|
74
|
-
const [fakeName1, fakeName2] = [trueName1, trueName2].map((trueName) => dictTrueNameToQuestionParam[trueName].fakeName);
|
|
75
|
-
return fakeName1.localeCompare(fakeName2);
|
|
76
|
-
})
|
|
77
|
-
.map((trueName) => {
|
|
78
|
-
const questionParam = dictTrueNameToQuestionParam[trueName];
|
|
79
|
-
return questionParam.explainTex;
|
|
80
|
-
})
|
|
81
|
-
.join("")}`;
|
|
82
|
-
}
|
|
83
|
-
else {
|
|
84
|
-
return `On a :
|
|
85
|
-
|
|
86
|
-
$$
|
|
87
|
-
${A} = ${sign === +1 ? `` : `-`}\\frac{${a} \\times 20}{5 \\times 20} = ${sign === +1 ? `` : `-`}\\frac{${20 * a}}{100}
|
|
88
|
-
$$
|
|
89
|
-
|
|
90
|
-
De plus :
|
|
91
|
-
|
|
92
|
-
$$
|
|
93
|
-
${A} = ${sign === +1 ? `` : `-`}\\frac{${a} \\times 2}{5 \\times 2} = ${sign === +1 ? `` : `-`}\\frac{${2 * a}}{10}
|
|
94
|
-
$$
|
|
95
|
-
|
|
96
|
-
Ainsi :
|
|
97
|
-
|
|
98
|
-
${(() => {
|
|
99
|
-
if (sign === +1) {
|
|
100
|
-
return `
|
|
101
|
-
|
|
102
|
-
$$
|
|
103
|
-
${dictTrueNameToQuestionParam["C"].tex} > \\frac{${2 * a}}{10} = \\frac{${20 * a}}{100} > ${dictTrueNameToQuestionParam["B"].tex}
|
|
104
|
-
$$
|
|
105
|
-
|
|
106
|
-
`;
|
|
107
|
-
}
|
|
108
|
-
else {
|
|
109
|
-
return `
|
|
110
|
-
|
|
111
|
-
$$
|
|
112
|
-
${dictTrueNameToQuestionParam["B"].tex} > -\\frac{${20 * a}}{100} = -\\frac{${2 * a}}{10} > ${dictTrueNameToQuestionParam["C"].tex}
|
|
113
|
-
$$
|
|
114
|
-
|
|
115
|
-
`;
|
|
116
|
-
}
|
|
117
|
-
})()}
|
|
118
|
-
`;
|
|
119
|
-
}
|
|
120
|
-
})()}
|
|
121
|
-
|
|
55
|
+
return `On a :
|
|
56
|
+
${questionParams
|
|
57
|
+
.toSorted((qp1, qp2) => qp1.letter.localeCompare(qp2.letter))
|
|
58
|
+
.map((questionParam) => questionParam.explainTex.length > 0 &&
|
|
59
|
+
`
|
|
122
60
|
|
|
123
|
-
Or :
|
|
124
|
-
|
|
125
|
-
${(() => {
|
|
126
|
-
if (sign === +1) {
|
|
127
|
-
return `
|
|
128
|
-
|
|
129
61
|
$$
|
|
130
|
-
${
|
|
131
|
-
>
|
|
132
|
-
${getDecimalFormatTex(dictTrueNameToQuestionParam["A"])}
|
|
133
|
-
>
|
|
134
|
-
${getDecimalFormatTex(dictTrueNameToQuestionParam["B"])}
|
|
62
|
+
${questionParam.explainTex}
|
|
135
63
|
$$
|
|
136
64
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
$$
|
|
65
|
+
`)
|
|
66
|
+
.join("")}
|
|
67
|
+
|
|
68
|
+
Le classement par ordre décroissant est donc :
|
|
142
69
|
|
|
143
|
-
`;
|
|
144
|
-
}
|
|
145
|
-
else {
|
|
146
|
-
return `
|
|
147
|
-
|
|
148
70
|
$$
|
|
149
|
-
${
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
>
|
|
153
|
-
${getDecimalFormatTex(dictTrueNameToQuestionParam["C"])}
|
|
71
|
+
${ascOrderedQuestionParams
|
|
72
|
+
.toReversed()
|
|
73
|
+
.map((questionParam) => questionParam.tex)
|
|
74
|
+
.join(">")}
|
|
154
75
|
$$
|
|
155
76
|
|
|
156
|
-
|
|
157
|
-
|
|
77
|
+
${opts.isUseABC
|
|
78
|
+
? `
|
|
79
|
+
|
|
158
80
|
$$
|
|
159
|
-
${
|
|
81
|
+
${ascOrderedQuestionParams
|
|
82
|
+
.toReversed()
|
|
83
|
+
.map((questionParam) => questionParam.letter)
|
|
84
|
+
.join(">")}
|
|
160
85
|
$$
|
|
86
|
+
|
|
87
|
+
`
|
|
88
|
+
: ``}
|
|
161
89
|
|
|
162
|
-
`;
|
|
163
|
-
}
|
|
164
|
-
})()}`;
|
|
90
|
+
`;
|
|
165
91
|
};
|
|
166
92
|
const getPropositions = (_, { answer, ...identifiers }) => {
|
|
167
93
|
const { items } = identifiers;
|
|
@@ -181,19 +107,14 @@ const getAnswer = (identifiers) => {
|
|
|
181
107
|
const answer = items.find((item) => item.isValidAnswer).tex;
|
|
182
108
|
return answer;
|
|
183
109
|
};
|
|
184
|
-
const isAnswerValid = (ans, { answer }) => {
|
|
185
|
-
const [ansNodes, answerNodes] = [ans, answer].map((str) => str.split(">").map((tex) => parseAlgebraic(tex)));
|
|
186
|
-
return (ansNodes.length === 3 &&
|
|
187
|
-
[0, 1, 2].every((i) => ansNodes[i].equals(answerNodes[i])));
|
|
188
|
-
};
|
|
189
110
|
const getKeys = (identifiers, optsIn) => {
|
|
190
|
-
const {
|
|
111
|
+
const { questionParams } = identifiers;
|
|
191
112
|
const opts = Object.assign(optsDefault, optsIn);
|
|
192
113
|
return [
|
|
193
114
|
"sup",
|
|
194
115
|
"inf",
|
|
195
|
-
...
|
|
196
|
-
const tex = opts.isUseABC ? questionParam.
|
|
116
|
+
...questionParams.map((questionParam) => {
|
|
117
|
+
const tex = opts.isUseABC ? questionParam.letter : questionParam.tex;
|
|
197
118
|
return {
|
|
198
119
|
id: "custom",
|
|
199
120
|
label: tex,
|
|
@@ -208,85 +129,60 @@ const getKeys = (identifiers, optsIn) => {
|
|
|
208
129
|
};
|
|
209
130
|
const getCompareFracAndDecQuestion = (optsIn) => {
|
|
210
131
|
const opts = Object.assign(optsDefault, optsIn);
|
|
211
|
-
|
|
132
|
+
function randomSign() {
|
|
133
|
+
return opts.isAllowingNegativeNumbers ? (coinFlip() ? +1 : -1) : +1;
|
|
134
|
+
}
|
|
212
135
|
const a = random([...Array(19).keys()].map((i) => i + 1).filter((i) => i % 5 !== 0));
|
|
213
136
|
const b = randint(1, a - 1);
|
|
214
|
-
const
|
|
215
|
-
const nodes =
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
.toTree(),
|
|
221
|
-
};
|
|
222
|
-
Object.keys(nodes).forEach((letter) => {
|
|
223
|
-
nodes[letter] = multiply(sign, nodes[letter]);
|
|
224
|
-
});
|
|
225
|
-
const dictIsInDecimalFormat = Object.fromEntries(randomMany(["A", "C"], opts.nbDecimalFormat).map((letter) => [
|
|
226
|
-
letter,
|
|
227
|
-
true,
|
|
228
|
-
]));
|
|
137
|
+
const d = randint(Math.floor(a / 10 + 1), 99);
|
|
138
|
+
const nodes = [
|
|
139
|
+
frac(multiply(randomSign(), a).evaluate(), 5),
|
|
140
|
+
frac(multiply(randomSign(), substract(multiply(20, a), b).evaluate()).simplify(), 100),
|
|
141
|
+
multiply(randomSign(), `0,${d}`.unfrenchify().toTree()).simplify(),
|
|
142
|
+
];
|
|
229
143
|
const nbTotal = 4;
|
|
230
144
|
const nbValid = 1;
|
|
231
145
|
const nbInvalid = nbTotal - nbValid;
|
|
232
|
-
const letters =
|
|
146
|
+
const letters = ["A", "B", "C"];
|
|
233
147
|
const shuffledLetters = shuffle(letters);
|
|
234
|
-
const
|
|
235
|
-
const node = nodes[
|
|
236
|
-
const fakeName = shuffledLetters[i];
|
|
148
|
+
const dictLetterToQuestionParam = Object.fromEntries(shuffledLetters.map((letter, i) => {
|
|
149
|
+
const node = nodes[i];
|
|
237
150
|
return [
|
|
238
|
-
|
|
151
|
+
letter,
|
|
239
152
|
{
|
|
240
|
-
|
|
241
|
-
trueName: trueName,
|
|
153
|
+
letter,
|
|
242
154
|
nodeIds: node.toIdentifiers(),
|
|
243
|
-
tex:
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
${
|
|
252
|
-
? ``
|
|
253
|
-
: (() => {
|
|
254
|
-
if (trueName === "A") {
|
|
255
|
-
return `${node.toTex()} =
|
|
256
|
-
${sign === +1 ? `` : `-`}\\frac{${a} \\times 2}{5 \\times 2} =
|
|
257
|
-
${sign === +1 ? `` : `-`}\\frac{${2 * a}}{10} =`;
|
|
258
|
-
}
|
|
259
|
-
else {
|
|
260
|
-
return `${node.toTex()} =`;
|
|
261
|
-
}
|
|
262
|
-
})()}
|
|
263
|
-
${node.evaluate().frenchify()}
|
|
264
|
-
$$
|
|
265
|
-
|
|
266
|
-
`;
|
|
155
|
+
tex: node.toTex(),
|
|
156
|
+
explainTex: `${opts.isUseABC ? `${letter} = ` : ``}${(() => {
|
|
157
|
+
const isPositive = nodes[i].evaluate() >= 0;
|
|
158
|
+
const tex = node.toTex();
|
|
159
|
+
const strEv = node.evaluate().frenchify();
|
|
160
|
+
if (i === 0) {
|
|
161
|
+
return `${node.toTex()} =
|
|
162
|
+
${isPositive ? `` : `-`}\\frac{${a} \\times 2}{5 \\times 2} =
|
|
163
|
+
${isPositive ? `` : `-`}\\frac{${2 * a}}{10} = ${strEv}`;
|
|
267
164
|
}
|
|
268
165
|
else {
|
|
269
|
-
return ``;
|
|
166
|
+
return strEv !== tex ? `${tex} = ${strEv}` : ``;
|
|
270
167
|
}
|
|
271
|
-
})()
|
|
168
|
+
})()}`,
|
|
272
169
|
},
|
|
273
170
|
];
|
|
274
171
|
}));
|
|
275
|
-
const
|
|
276
|
-
questionParam.
|
|
277
|
-
|
|
278
|
-
]));
|
|
279
|
-
const [A, B, C] = letters.map((trueName) => {
|
|
280
|
-
const questionParam = dictTrueNameToQuestionParam[trueName];
|
|
281
|
-
return opts.isUseABC ? questionParam.fakeName : questionParam.tex;
|
|
172
|
+
const ascOrderedQuestionParams = Object.values(dictLetterToQuestionParam).toSorted((questionParam1, questionParam2) => {
|
|
173
|
+
const [node1, node2] = [questionParam1, questionParam2].map((questionParam) => NodeConstructor.fromIdentifiers(questionParam.nodeIds));
|
|
174
|
+
return substract(node1, node2).evaluate();
|
|
282
175
|
});
|
|
283
176
|
const validItems = [
|
|
284
177
|
{
|
|
285
|
-
tex:
|
|
178
|
+
tex: ascOrderedQuestionParams
|
|
179
|
+
.toReversed()
|
|
180
|
+
.map((questionParam) => opts.isUseABC ? questionParam.letter : questionParam.tex)
|
|
181
|
+
.join(">"),
|
|
286
182
|
isValidAnswer: true,
|
|
287
183
|
},
|
|
288
184
|
];
|
|
289
|
-
const invalidItems = permute(
|
|
185
|
+
const invalidItems = permute(ascOrderedQuestionParams.map((questionParam) => opts.isUseABC ? questionParam.letter : questionParam.tex))
|
|
290
186
|
.filter(([D, E, F]) => `{${D}}>{${E}}>{${F}}` !== validItems[0].tex)
|
|
291
187
|
.map(([D, E, F]) => {
|
|
292
188
|
return {
|
|
@@ -300,11 +196,7 @@ $$
|
|
|
300
196
|
...shuffle(invalidItems).slice(0, nbInvalid),
|
|
301
197
|
]);
|
|
302
198
|
return getQuestionFromIdentifiers({
|
|
303
|
-
|
|
304
|
-
a,
|
|
305
|
-
b,
|
|
306
|
-
c,
|
|
307
|
-
dictFakeNameToQuestionParam,
|
|
199
|
+
questionParams: shuffle(ascOrderedQuestionParams),
|
|
308
200
|
items,
|
|
309
201
|
});
|
|
310
202
|
};
|
|
@@ -334,14 +226,6 @@ const options = [
|
|
|
334
226
|
type: GeneratorOptionType.checkbox,
|
|
335
227
|
defaultValue: optsDefault.isUseABC,
|
|
336
228
|
},
|
|
337
|
-
{
|
|
338
|
-
id: "nbDecimalFormat",
|
|
339
|
-
label: "Nombre d'écritures décimales",
|
|
340
|
-
target: GeneratorOptionTarget.generation,
|
|
341
|
-
type: GeneratorOptionType.select,
|
|
342
|
-
values: [1, 2],
|
|
343
|
-
defaultValue: optsDefault.nbDecimalFormat,
|
|
344
|
-
},
|
|
345
229
|
{
|
|
346
230
|
id: "isAllowingNegativeNumbers",
|
|
347
231
|
label: "Permettre les nombres négatifs",
|
|
@@ -359,9 +243,9 @@ export const compareFracAndDec = {
|
|
|
359
243
|
qcmTimer: 60,
|
|
360
244
|
freeTimer: 60,
|
|
361
245
|
getPropositions,
|
|
362
|
-
isAnswerValid,
|
|
363
246
|
subject: "Mathématiques",
|
|
364
247
|
maxAllowedQuestions: 30,
|
|
365
248
|
getQuestionFromIdentifiers,
|
|
366
249
|
hasHintAndCorrection: true,
|
|
250
|
+
answerType: "QCU",
|
|
367
251
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compareWithSquareRoots.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/ordering/compareWithSquareRoots.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"compareWithSquareRoots.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/ordering/compareWithSquareRoots.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAMrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,OAAO,CAAC;CAChB,CAAC;AAsIF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,CAexD,CAAC"}
|
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
|
|
2
2
|
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
3
|
import { randint } from "../../../../math/utils/random/randint.js";
|
|
4
|
-
import { sqrt } from "../../../../tree/nodes/functions/sqrtNode.js";
|
|
5
|
-
import { add } from "../../../../tree/nodes/operators/addNode.js";
|
|
6
|
-
import { substract } from "../../../../tree/nodes/operators/substractNode.js";
|
|
7
|
-
import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
|
|
8
4
|
import { coinFlip } from "../../../../utils/alea/coinFlip.js";
|
|
9
|
-
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
10
5
|
const getInstruction = (identifiers) => {
|
|
11
6
|
const { a, b, isAdd } = identifiers;
|
|
12
7
|
return `Sachant que $\\sqrt{${a}} < \\sqrt{${a + 1}}$,
|
|
@@ -48,44 +43,10 @@ $$
|
|
|
48
43
|
|
|
49
44
|
`;
|
|
50
45
|
};
|
|
51
|
-
const getAnswerNodes = (identifiers) => {
|
|
52
|
-
const { a, b, isAdd } = identifiers;
|
|
53
|
-
const addSub = isAdd ? add : substract;
|
|
54
|
-
const nodeWithA = addSub(b, sqrt(a));
|
|
55
|
-
const nodeWithAPlus1 = addSub(b, sqrt(add(a, 1)));
|
|
56
|
-
return isAdd ? [nodeWithA, nodeWithAPlus1] : [nodeWithAPlus1, nodeWithA];
|
|
57
|
-
};
|
|
58
46
|
const getAnswer = (identifiers) => {
|
|
59
47
|
const { a, b, isAdd } = identifiers;
|
|
60
48
|
return `${b}${isAdd ? "+" : "-"}\\sqrt{${a}}${isAdd ? "<" : ">"}${b}${isAdd ? "+" : "-"}\\sqrt{${a + 1}}`;
|
|
61
49
|
};
|
|
62
|
-
const isAnswerValid = (ans, { answer, ...identifiers }) => {
|
|
63
|
-
function getOrderedNodesFromTex(tex, compSymbol) {
|
|
64
|
-
return tex
|
|
65
|
-
.split(compSymbol)
|
|
66
|
-
.map((str) => parseAlgebraic(str))
|
|
67
|
-
.toSorted(() => (compSymbol === "<" ? +1 : -1));
|
|
68
|
-
}
|
|
69
|
-
try {
|
|
70
|
-
const compSymbol = ans.includes("<")
|
|
71
|
-
? "<"
|
|
72
|
-
: ans.includes(">")
|
|
73
|
-
? ">"
|
|
74
|
-
: undefined;
|
|
75
|
-
if (compSymbol) {
|
|
76
|
-
const [ansNode1, ansNode2] = getOrderedNodesFromTex(ans, compSymbol);
|
|
77
|
-
const [answerNode1, answerNode2] = getAnswerNodes(identifiers);
|
|
78
|
-
return (substract(ansNode1, answerNode1).simplify().evaluate() === 0 &&
|
|
79
|
-
substract(ansNode2, answerNode2).simplify().evaluate() === 0);
|
|
80
|
-
}
|
|
81
|
-
else {
|
|
82
|
-
return false;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
catch (err) {
|
|
86
|
-
return handleVEAError(err);
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
50
|
const getPropositions = (nbProps, { answer, ...identifiers }) => {
|
|
90
51
|
const { a, b, isAdd } = identifiers;
|
|
91
52
|
const propositions = [];
|
|
@@ -140,10 +101,10 @@ export const compareWithSquareRoots = {
|
|
|
140
101
|
qcmTimer: 60,
|
|
141
102
|
freeTimer: 60,
|
|
142
103
|
getPropositions,
|
|
143
|
-
isAnswerValid,
|
|
144
104
|
getAnswer,
|
|
145
105
|
subject: "Mathématiques",
|
|
146
106
|
maxAllowedQuestions: 30,
|
|
147
107
|
getQuestionFromIdentifiers,
|
|
148
108
|
hasHintAndCorrection: true,
|
|
109
|
+
answerType: "QCU",
|
|
149
110
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"estimateAroundPow10NTimesAroundPow10N.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/rounding/estimateAroundPow10NTimesAroundPow10N.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"estimateAroundPow10NTimesAroundPow10N.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/rounding/estimateAroundPow10NTimesAroundPow10N.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAarC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAmEF,eAAO,MAAM,qCAAqC,EAAE,QAAQ,CAAC,WAAW,CAmBvE,CAAC"}
|
|
@@ -3,9 +3,7 @@ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQue
|
|
|
3
3
|
import { randint } from "../../../../math/utils/random/randint.js";
|
|
4
4
|
import { add } from "../../../../tree/nodes/operators/addNode.js";
|
|
5
5
|
import { power } from "../../../../tree/nodes/operators/powerNode.js";
|
|
6
|
-
import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
|
|
7
6
|
import { coinFlip } from "../../../../utils/alea/coinFlip.js";
|
|
8
|
-
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
9
7
|
import { toSeperatedThousands } from "../../../../utils/numberPrototype/toSeparatedThousands.js";
|
|
10
8
|
const toPrettyString = (node) => {
|
|
11
9
|
return toSeperatedThousands("" + node.evaluate().toFixed(0));
|
|
@@ -28,18 +26,6 @@ const getAnswer = (identifiers) => {
|
|
|
28
26
|
const { n } = identifiers;
|
|
29
27
|
return `10^{${2 * n}}`;
|
|
30
28
|
};
|
|
31
|
-
const isAnswerValid = (ans, { answer }) => {
|
|
32
|
-
try {
|
|
33
|
-
const ansNode = parseAlgebraic(ans);
|
|
34
|
-
const answerNode = parseAlgebraic(answer);
|
|
35
|
-
return ansNode
|
|
36
|
-
.simplify({ calculatePowers: true })
|
|
37
|
-
.equals(answerNode.simplify({ calculatePowers: true }));
|
|
38
|
-
}
|
|
39
|
-
catch (err) {
|
|
40
|
-
return handleVEAError(err);
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
29
|
const getPropositions = (nbProps, { answer, ...identifiers }) => {
|
|
44
30
|
const { n } = identifiers;
|
|
45
31
|
const propositions = [];
|
|
@@ -74,10 +60,10 @@ export const estimateAroundPow10NTimesAroundPow10N = {
|
|
|
74
60
|
qcmTimer: 60,
|
|
75
61
|
freeTimer: 60,
|
|
76
62
|
getPropositions,
|
|
77
|
-
isAnswerValid,
|
|
78
63
|
getAnswer,
|
|
79
64
|
subject: "Mathématiques",
|
|
80
65
|
maxAllowedQuestions: 30,
|
|
81
66
|
getQuestionFromIdentifiers,
|
|
82
67
|
hasHintAndCorrection: true,
|
|
68
|
+
answerType: "QCU",
|
|
83
69
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"estimatePow10NPlusPow10MinusN.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/rounding/estimatePow10NPlusPow10MinusN.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"estimatePow10NPlusPow10MinusN.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/rounding/estimatePow10NPlusPow10MinusN.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAMrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AA8EF,eAAO,MAAM,6BAA6B,EAAE,QAAQ,CAAC,WAAW,CAmB/D,CAAC"}
|
|
@@ -2,9 +2,7 @@ import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../exer
|
|
|
2
2
|
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
3
|
import { randint } from "../../../../math/utils/random/randint.js";
|
|
4
4
|
import { power } from "../../../../tree/nodes/operators/powerNode.js";
|
|
5
|
-
import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
|
|
6
5
|
import { random } from "../../../../utils/alea/random.js";
|
|
7
|
-
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
8
6
|
const getInstruction = (identifiers) => {
|
|
9
7
|
const { n, varName } = identifiers;
|
|
10
8
|
const A = varName;
|
|
@@ -34,16 +32,6 @@ const getAnswer = (identifiers) => {
|
|
|
34
32
|
const { n } = identifiers;
|
|
35
33
|
return `10^{${n}}`;
|
|
36
34
|
};
|
|
37
|
-
const isAnswerValid = (ans, { answer }) => {
|
|
38
|
-
try {
|
|
39
|
-
const ansNode = parseAlgebraic(ans);
|
|
40
|
-
const answerNode = parseAlgebraic(answer);
|
|
41
|
-
return ansNode.simplify().equals(answerNode.simplify());
|
|
42
|
-
}
|
|
43
|
-
catch (err) {
|
|
44
|
-
return handleVEAError(err);
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
35
|
const getPropositions = (nbProps, { answer, ...identifiers }) => {
|
|
48
36
|
const { n } = identifiers;
|
|
49
37
|
const propositions = [];
|
|
@@ -80,10 +68,10 @@ export const estimatePow10NPlusPow10MinusN = {
|
|
|
80
68
|
qcmTimer: 60,
|
|
81
69
|
freeTimer: 60,
|
|
82
70
|
getPropositions,
|
|
83
|
-
isAnswerValid,
|
|
84
71
|
getAnswer,
|
|
85
72
|
subject: "Mathématiques",
|
|
86
73
|
maxAllowedQuestions: 30,
|
|
87
74
|
getQuestionFromIdentifiers,
|
|
88
75
|
hasHintAndCorrection: true,
|
|
76
|
+
answerType: "QCU",
|
|
89
77
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"equationFromProblem.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/equation/equationFromProblem.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAKrC,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAKlE,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;
|
|
1
|
+
{"version":3,"file":"equationFromProblem.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/equation/equationFromProblem.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAKrC,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAKlE,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AActE,KAAK,WAAW,GAAG;IACjB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,yBAAyB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC;IACzE,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,EAAE,EAAE,CAAC;IAC1B,YAAY,EAAE,eAAe,CAAC;CAC/B,CAAC;AAmrBF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,WAAW,CAcrD,CAAC"}
|
|
@@ -10,7 +10,6 @@ import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
|
10
10
|
import { substract } from "../../../../tree/nodes/operators/substractNode.js";
|
|
11
11
|
import { random, randomMany } from "../../../../utils/alea/random.js";
|
|
12
12
|
import { isOperatorNode, OperatorIds, } from "../../../../tree/nodes/operators/operatorNode.js";
|
|
13
|
-
import { mdTable } from "../../../../utils/markdown/mdTable.js";
|
|
14
13
|
import { alignTex } from "../../../../utils/latex/alignTex.js";
|
|
15
14
|
class ProblemConstructor {
|
|
16
15
|
static byHydratingSkeleton(skeleton, groupNameToVarNameToValue, mysteryVarPath, shuffleArrays) {
|
|
@@ -291,7 +290,13 @@ const getInstruction = (identifiers) => {
|
|
|
291
290
|
const { problemSkeletonIndex, groupNameToVarNameToValue, mysteryVarPath, shuffleArrays, } = identifiers;
|
|
292
291
|
const skeleton = skeletons[problemSkeletonIndex];
|
|
293
292
|
const problem = ProblemConstructor.byHydratingSkeleton(skeleton, groupNameToVarNameToValue, mysteryVarPath, shuffleArrays);
|
|
294
|
-
return
|
|
293
|
+
return `Voici une situation :
|
|
294
|
+
|
|
295
|
+
$\\ $
|
|
296
|
+
|
|
297
|
+
${problem.frenchStr}
|
|
298
|
+
|
|
299
|
+
$\\ $
|
|
295
300
|
|
|
296
301
|
Parmi les équations suivantes, laquelle modélise cette situation ?`;
|
|
297
302
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compareAMinusB.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/ordering/compareAMinusB.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"compareAMinusB.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/ordering/compareAMinusB.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAOrC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AAqMF,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,WAAW,CAchD,CAAC"}
|
|
@@ -66,9 +66,6 @@ const getAnswer = (identifiers) => {
|
|
|
66
66
|
const { texsAnswer } = identifiers;
|
|
67
67
|
return texsAnswer[0];
|
|
68
68
|
};
|
|
69
|
-
const isAnswerValid = (ans, { texsAnswer }) => {
|
|
70
|
-
return texsAnswer.includes(ans);
|
|
71
|
-
};
|
|
72
69
|
const getCompareAMinusBQuestion = () => {
|
|
73
70
|
const namesPool = ["a", "b", "c", "d", "r", "s", "t", "u", "v"];
|
|
74
71
|
const names = randomMany(namesPool, 2);
|
|
@@ -175,10 +172,10 @@ export const compareAMinusB = {
|
|
|
175
172
|
generator: (nb, opts) => getDistinctQuestions(() => getCompareAMinusBQuestion(opts), nb, 30),
|
|
176
173
|
qcmTimer: 60,
|
|
177
174
|
freeTimer: 60,
|
|
178
|
-
isAnswerValid,
|
|
179
175
|
getPropositions,
|
|
180
176
|
subject: "Mathématiques",
|
|
181
177
|
maxAllowedQuestions: 30,
|
|
182
178
|
getQuestionFromIdentifiers,
|
|
183
179
|
hasHintAndCorrection: true,
|
|
180
|
+
answerType: "QCU",
|
|
184
181
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compareFromPiMinusFrac.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/ordering/compareFromPiMinusFrac.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"compareFromPiMinusFrac.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/ordering/compareFromPiMinusFrac.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AA+IF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,CAexD,CAAC"}
|
|
@@ -50,9 +50,6 @@ const getAnswer = (identifiers) => {
|
|
|
50
50
|
const { texAnswers } = identifiers;
|
|
51
51
|
return texAnswers[0];
|
|
52
52
|
};
|
|
53
|
-
const isAnswerValid = (ans, { texAnswers }) => {
|
|
54
|
-
return texAnswers.includes(ans);
|
|
55
|
-
};
|
|
56
53
|
const getCompareFromPiMinusFracQuestion = () => {
|
|
57
54
|
const fracsPool = [
|
|
58
55
|
frac(31, 10),
|
|
@@ -134,10 +131,10 @@ export const compareFromPiMinusFrac = {
|
|
|
134
131
|
generator: (nb, opts) => getDistinctQuestions(() => getCompareFromPiMinusFracQuestion(opts), nb, 30),
|
|
135
132
|
qcmTimer: 60,
|
|
136
133
|
freeTimer: 60,
|
|
137
|
-
isAnswerValid,
|
|
138
134
|
getPropositions,
|
|
139
135
|
subject: "Mathématiques",
|
|
140
136
|
maxAllowedQuestions: 30,
|
|
141
137
|
getQuestionFromIdentifiers,
|
|
142
138
|
hasHintAndCorrection: true,
|
|
139
|
+
answerType: "QCU",
|
|
143
140
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compareATimes0.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/simplifying/compareATimes0.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAWT,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"compareATimes0.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/simplifying/compareATimes0.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAWT,MAAM,6BAA6B,CAAC;AAKrC,KAAK,IAAI,GAAG;IACV,GAAG,EAAE,MAAM,CAAC;IACZ,aAAa,EAAE,OAAO,CAAC;CACxB,CAAC;AAEF,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,IAAI,EAAE,CAAC;CACf,CAAC;AAqGF,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,WAAW,CAehD,CAAC"}
|