math-exercises 3.0.139 → 3.0.141
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/arithmetics/euclideanDivision.d.ts.map +1 -1
- package/lib/exercises/math/calcul/arithmetics/euclideanDivision.js +65 -8
- package/lib/exercises/math/calcul/arithmetics/findRightPrimeDecomposition.d.ts.map +1 -1
- package/lib/exercises/math/calcul/arithmetics/findRightPrimeDecomposition.js +3 -6
- package/lib/exercises/math/calcul/arithmetics/index.d.ts +3 -0
- package/lib/exercises/math/calcul/arithmetics/index.d.ts.map +1 -1
- package/lib/exercises/math/calcul/arithmetics/index.js +3 -1
- package/lib/exercises/math/calcul/arithmetics/primeNumbersAffirmations.d.ts +8 -0
- package/lib/exercises/math/calcul/arithmetics/primeNumbersAffirmations.d.ts.map +1 -0
- package/lib/exercises/math/calcul/arithmetics/primeNumbersAffirmations.js +128 -0
- package/lib/exercises/math/calcul/proportionality/fourthProportionalFromProblem.d.ts +8 -0
- package/lib/exercises/math/calcul/proportionality/fourthProportionalFromProblem.d.ts.map +1 -0
- package/lib/exercises/math/calcul/proportionality/fourthProportionalFromProblem.js +392 -0
- package/lib/exercises/math/calcul/proportionality/index.d.ts +2 -0
- package/lib/exercises/math/calcul/proportionality/index.d.ts.map +1 -1
- package/lib/exercises/math/calcul/proportionality/index.js +2 -0
- package/lib/exercises/math/calcul/proportionality/isProportionalFromProblem.d.ts +8 -0
- package/lib/exercises/math/calcul/proportionality/isProportionalFromProblem.d.ts.map +1 -0
- package/lib/exercises/math/calcul/proportionality/isProportionalFromProblem.js +349 -0
- package/lib/exercises/math/calculLitteral/equation/isEqualityTrue.js +4 -4
- package/lib/exercises/math/dataRepresentations/index.js +1 -0
- package/lib/exercises/math/dataRepresentations/placePointsFromDataTable.d.ts +12 -0
- package/lib/exercises/math/dataRepresentations/placePointsFromDataTable.d.ts.map +1 -0
- package/lib/exercises/math/dataRepresentations/placePointsFromDataTable.js +175 -0
- package/lib/exercises/math/functions/affines/index.d.ts +2 -0
- package/lib/exercises/math/functions/affines/index.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/index.js +2 -0
- package/lib/exercises/math/functions/affines/placePointsFromAffine.d.ts +8 -0
- package/lib/exercises/math/functions/affines/placePointsFromAffine.d.ts.map +1 -0
- package/lib/exercises/math/functions/affines/placePointsFromAffine.js +135 -0
- package/lib/exercises/math/functions/affines/recognizeAffinePointsFromPoints.d.ts +10 -0
- package/lib/exercises/math/functions/affines/recognizeAffinePointsFromPoints.d.ts.map +1 -0
- package/lib/exercises/math/functions/affines/recognizeAffinePointsFromPoints.js +208 -0
- package/lib/exercises/math/functions/basics/index.d.ts +1 -0
- package/lib/exercises/math/functions/basics/index.d.ts.map +1 -1
- package/lib/exercises/math/functions/basics/index.js +1 -0
- package/lib/exercises/math/functions/basics/placePointsFromValueTable.d.ts +8 -0
- package/lib/exercises/math/functions/basics/placePointsFromValueTable.d.ts.map +1 -0
- package/lib/exercises/math/functions/basics/placePointsFromValueTable.js +128 -0
- package/lib/exercises/math/geometry/pythagore/isTriangleRight.d.ts.map +1 -1
- package/lib/exercises/math/geometry/pythagore/isTriangleRight.js +19 -9
- package/lib/exercises/utils/data/boxXY.d.ts +7 -0
- package/lib/exercises/utils/data/boxXY.d.ts.map +1 -0
- package/lib/exercises/utils/data/boxXY.js +16 -0
- package/lib/exercises/utils/data/isBoxable.d.ts +2 -0
- package/lib/exercises/utils/data/isBoxable.d.ts.map +1 -0
- package/lib/exercises/utils/data/isBoxable.js +5 -0
- package/lib/exercises/utils/data/randomDataTable.d.ts +11 -0
- package/lib/exercises/utils/data/randomDataTable.d.ts.map +1 -0
- package/lib/exercises/utils/data/randomDataTable.js +65 -0
- package/lib/index.d.ts +21 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/math/utils/random/randfloat.d.ts +1 -0
- package/lib/math/utils/random/randfloat.d.ts.map +1 -1
- package/lib/math/utils/random/randfloat.js +35 -0
- package/lib/utils/arrays/transpose.d.ts +2 -0
- package/lib/utils/arrays/transpose.d.ts.map +1 -0
- package/lib/utils/arrays/transpose.js +10 -0
- package/package.json +1 -1
|
@@ -0,0 +1,392 @@
|
|
|
1
|
+
import { addValidProp, tryToAddWrongProp, shuffleProps, } 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 { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
8
|
+
import { power } from "../../../../tree/nodes/operators/powerNode.js";
|
|
9
|
+
import { substract } from "../../../../tree/nodes/operators/substractNode.js";
|
|
10
|
+
import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
|
|
11
|
+
import { probaFlip } from "../../../../utils/alea/probaFlip.js";
|
|
12
|
+
import { random } from "../../../../utils/alea/random.js";
|
|
13
|
+
import { alignTex } from "../../../../utils/latex/alignTex.js";
|
|
14
|
+
import { mdTable } from "../../../../utils/markdown/mdTable.js";
|
|
15
|
+
const getStrRoundTo = (roundTo) => {
|
|
16
|
+
switch (roundTo) {
|
|
17
|
+
case 1:
|
|
18
|
+
return `arrondie à $1$ décimale`;
|
|
19
|
+
default:
|
|
20
|
+
return `arrondie à $${roundTo}$ décimales`;
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
const situations = [
|
|
24
|
+
//standard1: [a |--> b,c |--> ?],[a |--> ?,c |--> d]
|
|
25
|
+
{
|
|
26
|
+
roundTo: 1,
|
|
27
|
+
instruction: (values, roundTo) => `Un tuyau oxydé fuit. Il sort de la fuite $${values[1][0].frenchify()}$ $\\textrm{mL}$ d'eau toutes les $${values[0][0].frenchify()}$ $\\textrm{min}$.
|
|
28
|
+
Quelle quantité d'eau va-t-il fuire pendant $${values[0][1].frenchify()}$ $\\textrm{min}$ (en $\\textrm{mL}$ ${getStrRoundTo(roundTo)}) ?`,
|
|
29
|
+
answer: (values, roundTo) => round(values[1][1], roundTo).frenchify(),
|
|
30
|
+
propositions: (values, roundTo) => {
|
|
31
|
+
const propositions = [];
|
|
32
|
+
const valueAnswer = values[1][1];
|
|
33
|
+
addValidProp(propositions, valueAnswer.frenchify());
|
|
34
|
+
//moreOrLessMult
|
|
35
|
+
const arrMoreOrLessMult = [0.7, 0.8, 0.9, 1.1, 1.2, 1.3];
|
|
36
|
+
arrMoreOrLessMult.forEach((coeffDistortion) => {
|
|
37
|
+
const valueMoreOrLess = round(multiply(valueAnswer, coeffDistortion).evaluate(), roundTo);
|
|
38
|
+
tryToAddWrongProp(propositions, valueMoreOrLess.frenchify());
|
|
39
|
+
});
|
|
40
|
+
//moreOrLessAdd
|
|
41
|
+
const arrMoreOrLessAdd = [5, 10, 15, 20, 25, 30].flatMap((v) => [v, -v]);
|
|
42
|
+
arrMoreOrLessAdd.forEach((offset) => {
|
|
43
|
+
const valueMoreOrLess = round(add(valueAnswer, offset).evaluate(), roundTo);
|
|
44
|
+
const isCloseEnoughToAnswer = Math.abs((valueMoreOrLess - valueAnswer) / valueAnswer) <= 0.3;
|
|
45
|
+
if (isCloseEnoughToAnswer) {
|
|
46
|
+
tryToAddWrongProp(propositions, valueMoreOrLess.frenchify());
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
//terror (== moreOrLessAdd(roundTo))
|
|
50
|
+
{
|
|
51
|
+
let valueTerrorSrc;
|
|
52
|
+
if (probaFlip(0.3)) {
|
|
53
|
+
valueTerrorSrc = valueAnswer;
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
const valuesSoFar = propositions.map((proposition) => parseAlgebraic(proposition.statement).evaluate());
|
|
57
|
+
valueTerrorSrc = random(valuesSoFar);
|
|
58
|
+
}
|
|
59
|
+
[power(10, -roundTo)]
|
|
60
|
+
.flatMap((microOffset) => [microOffset, -microOffset])
|
|
61
|
+
.forEach((microOffset) => {
|
|
62
|
+
const valueTerrorDst = round(add(valueTerrorSrc, microOffset).evaluate(), roundTo);
|
|
63
|
+
tryToAddWrongProp(propositions, valueTerrorDst.frenchify());
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
return propositions.filter((proposition) => proposition.statement !== "NaN");
|
|
67
|
+
},
|
|
68
|
+
hint: (_) => {
|
|
69
|
+
return `Tu peux commencer par nommer $x$ la quantité d'eau que tu recherches, et dresser un tableau correspondant à la situation.
|
|
70
|
+
Il est sous-entendu que la situation est une situation de proportionnalité ; Il y a donc une égalité que tu peux écrire.`;
|
|
71
|
+
},
|
|
72
|
+
correction: (values, _) => {
|
|
73
|
+
return `On va noter $x$ le volume d'eau recherché.
|
|
74
|
+
On peut dresser le tableau suivant:
|
|
75
|
+
${mdTable([
|
|
76
|
+
["Robinet", ...values[0].map(() => "")],
|
|
77
|
+
[
|
|
78
|
+
"durée ($\\textrm{min}$)",
|
|
79
|
+
...values[0].map((value) => `$${value.frenchify()}$`),
|
|
80
|
+
],
|
|
81
|
+
[
|
|
82
|
+
"volume d'eau ($\\textrm{mL}$)",
|
|
83
|
+
...values[1].map((value, i) => i === 1 ? "$x$" : `$${value.frenchify()}$`),
|
|
84
|
+
],
|
|
85
|
+
])}
|
|
86
|
+
|
|
87
|
+
Il est sous-entendu que l'on a affaire à une situation de proportionnalité.
|
|
88
|
+
On peut donc écrire l'égalité des produits en croix :
|
|
89
|
+
|
|
90
|
+
$$
|
|
91
|
+
${values[0][0].frenchify()} \\times x = ${values[1][0].frenchify()} \\times ${values[0][1].frenchify()}
|
|
92
|
+
$$
|
|
93
|
+
|
|
94
|
+
On résout l'équation :
|
|
95
|
+
|
|
96
|
+
${alignTex([
|
|
97
|
+
[
|
|
98
|
+
`x`,
|
|
99
|
+
"=",
|
|
100
|
+
`\\frac{${values[1][0].frenchify()} \\times ${values[0][1].frenchify()}}{${values[0][0].frenchify()}}`,
|
|
101
|
+
],
|
|
102
|
+
[`x`, "\\approx", `${values[1][1].frenchify()}`],
|
|
103
|
+
])}
|
|
104
|
+
|
|
105
|
+
La quantité d'eau recherchée est $${values[1][1].frenchify()}$ $\\textrm{mL}$.`;
|
|
106
|
+
},
|
|
107
|
+
randValues: (roundTo) => {
|
|
108
|
+
const nbValues = 2;
|
|
109
|
+
const stepA = 5;
|
|
110
|
+
const valuesA = [...Array(nbValues).keys()]
|
|
111
|
+
.reduce((acc) => [
|
|
112
|
+
...acc,
|
|
113
|
+
randint(1, 19, acc.map((v) => v / stepA)) * stepA,
|
|
114
|
+
], [])
|
|
115
|
+
.toSorted((a, b) => a - b);
|
|
116
|
+
const coeff = randfloat(0.4, 0.7, 2);
|
|
117
|
+
const valuesB = valuesA.map((valueA) => round(valueA * coeff, roundTo));
|
|
118
|
+
return [valuesA, valuesB];
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
//standard2: [a |--> b,? |--> d],[? |--> b,c |--> d]
|
|
122
|
+
{
|
|
123
|
+
roundTo: 2,
|
|
124
|
+
instruction: (values, roundTo) => `Pour une fête de village, Imane prépare des spaghetti à la sauce tomate.
|
|
125
|
+
Sur son téléphone, la recette prévoit $${values[1][0].frenchify()}$ $\\textrm{kg}$ de sauce pour $${values[0][0].frenchify()}$ $\\textrm{kg}$ de pâtes.
|
|
126
|
+
Sachant qu'elle a déjà préparé $${values[1][1].frenchify()}$ $\\textrm{kg}$ de sauce, quelle quantité de pâtes (en $\\textrm{kg}$ ${getStrRoundTo(roundTo)}) faut-il qu'elle fasse cuire ?`,
|
|
127
|
+
answer: (values, roundTo) => round(values[0][1], roundTo).frenchify(),
|
|
128
|
+
propositions: (values, roundTo) => {
|
|
129
|
+
const propositions = [];
|
|
130
|
+
const valueAnswer = values[0][1];
|
|
131
|
+
addValidProp(propositions, valueAnswer.frenchify());
|
|
132
|
+
//moreOrLessMult
|
|
133
|
+
const arrMoreOrLessMult = [0.7, 0.8, 0.9, 1.1, 1.2, 1.3];
|
|
134
|
+
arrMoreOrLessMult.forEach((coeffDistortion) => {
|
|
135
|
+
const valueMoreOrLess = round(multiply(valueAnswer, coeffDistortion).evaluate(), roundTo);
|
|
136
|
+
tryToAddWrongProp(propositions, valueMoreOrLess.frenchify());
|
|
137
|
+
});
|
|
138
|
+
//moreOrLessAdd
|
|
139
|
+
const arrMoreOrLessAdd = [5, 10, 15, 20, 25, 30].flatMap((v) => [v, -v]);
|
|
140
|
+
arrMoreOrLessAdd.forEach((offset) => {
|
|
141
|
+
const valueMoreOrLess = round(add(valueAnswer, offset).evaluate(), roundTo);
|
|
142
|
+
const isCloseEnoughToAnswer = Math.abs((valueMoreOrLess - valueAnswer) / valueAnswer) <= 0.3;
|
|
143
|
+
if (isCloseEnoughToAnswer) {
|
|
144
|
+
tryToAddWrongProp(propositions, valueMoreOrLess.frenchify());
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
//terror (== moreOrLessAdd(roundTo))
|
|
148
|
+
{
|
|
149
|
+
let valueTerrorSrc;
|
|
150
|
+
if (probaFlip(0.3)) {
|
|
151
|
+
valueTerrorSrc = valueAnswer;
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
const valuesSoFar = propositions.map((proposition) => parseAlgebraic(proposition.statement).evaluate());
|
|
155
|
+
valueTerrorSrc = random(valuesSoFar);
|
|
156
|
+
}
|
|
157
|
+
[power(10, -roundTo)]
|
|
158
|
+
.flatMap((microOffset) => [microOffset, -microOffset])
|
|
159
|
+
.forEach((microOffset) => {
|
|
160
|
+
const valueTerrorDst = round(add(valueTerrorSrc, microOffset).evaluate(), roundTo);
|
|
161
|
+
tryToAddWrongProp(propositions, valueTerrorDst.frenchify());
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
return propositions.filter((proposition) => proposition.statement !== "NaN");
|
|
165
|
+
},
|
|
166
|
+
hint: (_) => {
|
|
167
|
+
return `Tu peux commencer par nommer $x$ la quantité de pâtes que tu recherches, et dresser un tableau correspondant à la situation.
|
|
168
|
+
Imane utilise une recette. C'est une situation de proportionnalité et il y a donc une égalité que tu peux écrire.`;
|
|
169
|
+
},
|
|
170
|
+
correction: (values, _) => {
|
|
171
|
+
return `On va noter $x$ la quantité de pâtes recherchée.
|
|
172
|
+
On peut dresser le tableau suivant:
|
|
173
|
+
${mdTable([
|
|
174
|
+
["Recette", ...values[0].map(() => "")],
|
|
175
|
+
[
|
|
176
|
+
"pâtes ($\\textrm{kg}$)",
|
|
177
|
+
...values[0].map((value, i) => i === 1 ? "$x$" : `$${value.frenchify()}$`),
|
|
178
|
+
],
|
|
179
|
+
[
|
|
180
|
+
"sauce tomate ($\\textrm{kg}$)",
|
|
181
|
+
...values[1].map((value) => `$${value.frenchify()}$`),
|
|
182
|
+
],
|
|
183
|
+
])}
|
|
184
|
+
|
|
185
|
+
Il est sous-entendu que l'on a affaire à une situation de proportionnalité.
|
|
186
|
+
On peut donc écrire l'égalité des produits en croix :
|
|
187
|
+
|
|
188
|
+
$$
|
|
189
|
+
${values[0][0].frenchify()} \\times ${values[1][1].frenchify()} = ${values[1][0].frenchify()} \\times x
|
|
190
|
+
$$
|
|
191
|
+
|
|
192
|
+
On résout l'équation :
|
|
193
|
+
|
|
194
|
+
${alignTex([
|
|
195
|
+
[
|
|
196
|
+
`\\frac{${values[0][0].frenchify()} \\times ${values[1][1].frenchify()}}{${values[1][0].frenchify()}}`,
|
|
197
|
+
"=",
|
|
198
|
+
`x`,
|
|
199
|
+
],
|
|
200
|
+
[`${values[0][1].frenchify()}`, "\\approx", `x`],
|
|
201
|
+
])}
|
|
202
|
+
|
|
203
|
+
La quantité de pâtes recherchée est $${values[0][1].frenchify()}$ $\\textrm{kg}$.`;
|
|
204
|
+
},
|
|
205
|
+
randValues: (roundTo) => {
|
|
206
|
+
const nbValues = 2;
|
|
207
|
+
const valuesA = [...Array(nbValues).keys()].reduce((acc, i) => {
|
|
208
|
+
if (i === 0) {
|
|
209
|
+
return [randint(5, 15)];
|
|
210
|
+
}
|
|
211
|
+
else {
|
|
212
|
+
return [...acc, randfloat(5, 15, roundTo, acc)];
|
|
213
|
+
}
|
|
214
|
+
}, []);
|
|
215
|
+
const coeff = randfloat(1.1, 3.7, 2);
|
|
216
|
+
const valuesB = valuesA.map((valueA) => round(valueA * coeff, roundTo));
|
|
217
|
+
return [valuesA, valuesB];
|
|
218
|
+
},
|
|
219
|
+
},
|
|
220
|
+
//crypto: [a |--> b, crypto(n*a) |--> ?] //todo? (par exemple, "toute une journée")
|
|
221
|
+
//with compound unit
|
|
222
|
+
{
|
|
223
|
+
roundTo: 2,
|
|
224
|
+
instruction: (values, roundTo) => `Tatiana contemple une statue en bronze dans un musée.
|
|
225
|
+
Sur le cartouche qui accompagne l'oeuvre, il est indiqué que la masse volumique du bronze utilisé est de $${values[1][0].frenchify()}$ $\\textrm{kg}/\\textrm{m}^3$
|
|
226
|
+
et que la masse de la statue est $${values[1][1].frenchify()}$ $\\textrm{kg}$.
|
|
227
|
+
Quel est le volume de bronze de la statue (en $\\textrm{m}^3$ ${getStrRoundTo(roundTo)}) ?`,
|
|
228
|
+
answer: (values, roundTo) => round(values[0][1], roundTo).frenchify(),
|
|
229
|
+
propositions: (values, roundTo) => {
|
|
230
|
+
const propositions = [];
|
|
231
|
+
const valueAnswer = values[0][1];
|
|
232
|
+
addValidProp(propositions, valueAnswer.frenchify());
|
|
233
|
+
//moreOrLessMult
|
|
234
|
+
const arrMoreOrLessMult = [0.7, 0.8, 0.9, 1.1, 1.2, 1.3];
|
|
235
|
+
arrMoreOrLessMult.forEach((coeffDistortion) => {
|
|
236
|
+
const valueMoreOrLess = round(multiply(valueAnswer, coeffDistortion).evaluate(), roundTo);
|
|
237
|
+
tryToAddWrongProp(propositions, valueMoreOrLess.frenchify());
|
|
238
|
+
});
|
|
239
|
+
//moreOrLessAdd
|
|
240
|
+
const arrMoreOrLessAdd = [5, 10, 15, 20, 25, 30].flatMap((v) => [v, -v]);
|
|
241
|
+
arrMoreOrLessAdd.forEach((offset) => {
|
|
242
|
+
const valueMoreOrLess = round(add(valueAnswer, offset).evaluate(), roundTo);
|
|
243
|
+
const isCloseEnoughToAnswer = Math.abs((valueMoreOrLess - valueAnswer) / valueAnswer) <= 0.3;
|
|
244
|
+
if (isCloseEnoughToAnswer) {
|
|
245
|
+
tryToAddWrongProp(propositions, valueMoreOrLess.frenchify());
|
|
246
|
+
}
|
|
247
|
+
});
|
|
248
|
+
//terror (== moreOrLessAdd(roundTo))
|
|
249
|
+
{
|
|
250
|
+
let valueTerrorSrc;
|
|
251
|
+
if (probaFlip(0.3)) {
|
|
252
|
+
valueTerrorSrc = valueAnswer;
|
|
253
|
+
}
|
|
254
|
+
else {
|
|
255
|
+
const valuesSoFar = propositions.map((proposition) => parseAlgebraic(proposition.statement).evaluate());
|
|
256
|
+
valueTerrorSrc = random(valuesSoFar);
|
|
257
|
+
}
|
|
258
|
+
[power(10, -roundTo)]
|
|
259
|
+
.flatMap((microOffset) => [microOffset, -microOffset])
|
|
260
|
+
.forEach((microOffset) => {
|
|
261
|
+
const valueTerrorDst = round(add(valueTerrorSrc, microOffset).evaluate(), roundTo);
|
|
262
|
+
tryToAddWrongProp(propositions, valueTerrorDst.frenchify());
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
return propositions.filter((proposition) => proposition.statement !== "NaN");
|
|
266
|
+
},
|
|
267
|
+
hint: (values) => {
|
|
268
|
+
return `Tu peux commencer par nommer $x$ le volume que tu recherches.
|
|
269
|
+
Si la masse volumique est de $${values[1][0].frenchify()}$ $\\textrm{kg}/\\textrm{m}^3$ alors $1$ $\\textrm{m}^3$ de bronze aura une masse de $${values[1][0].frenchify()}$ $kg$.
|
|
270
|
+
Tu peux donc dresser un tableau avec ces données.
|
|
271
|
+
L'unité $\\textrm{kg}/\\textrm{m}^3$ est un quotient. Il y a proportionnalité entre la masse et le volume et il y a donc une égalité que tu peux écrire.`;
|
|
272
|
+
},
|
|
273
|
+
correction: (values, _) => {
|
|
274
|
+
return `On va noter $x$ le volume recherché.
|
|
275
|
+
On peut dresser le tableau suivant:
|
|
276
|
+
${mdTable([
|
|
277
|
+
["Statue", ...values[0].map(() => "")],
|
|
278
|
+
[
|
|
279
|
+
"volume ($\\textrm{m}^3$)",
|
|
280
|
+
...values[0].map((value, i) => i === 1 ? "$x$" : `$${value.frenchify()}$`),
|
|
281
|
+
],
|
|
282
|
+
[
|
|
283
|
+
"masse ($\\textrm{kg}$)",
|
|
284
|
+
...values[1].map((value) => `$${value.frenchify()}$`),
|
|
285
|
+
],
|
|
286
|
+
])}
|
|
287
|
+
|
|
288
|
+
Il est manifeste que l'on a affaire à une situation de proportionnalité.
|
|
289
|
+
On peut donc écrire l'égalité des produits en croix :
|
|
290
|
+
|
|
291
|
+
$$
|
|
292
|
+
${values[0][0].frenchify()} \\times ${values[1][1].frenchify()} = ${values[1][0].frenchify()} \\times x
|
|
293
|
+
$$
|
|
294
|
+
|
|
295
|
+
On résout l'équation :
|
|
296
|
+
|
|
297
|
+
${alignTex([
|
|
298
|
+
[
|
|
299
|
+
`\\frac{${values[0][0].frenchify()} \\times ${values[1][1].frenchify()}}{${values[1][0].frenchify()}}`,
|
|
300
|
+
"=",
|
|
301
|
+
`x`,
|
|
302
|
+
],
|
|
303
|
+
[`${values[0][1].frenchify()}`, "\\approx", `x`],
|
|
304
|
+
])}
|
|
305
|
+
|
|
306
|
+
Le volume de bronze de la statue est $${values[0][1].frenchify()}$ $\\textrm{m}^3$.`;
|
|
307
|
+
},
|
|
308
|
+
randValues: (roundTo) => {
|
|
309
|
+
const nbValues = 2;
|
|
310
|
+
const valuesA = [...Array(nbValues).keys()].reduce((acc, i) => {
|
|
311
|
+
if (i === 0) {
|
|
312
|
+
return [1];
|
|
313
|
+
}
|
|
314
|
+
else {
|
|
315
|
+
return [...acc, randfloat(0.2, 4, roundTo, acc)];
|
|
316
|
+
}
|
|
317
|
+
}, []);
|
|
318
|
+
const coeff = randfloat(8400, 8900, 2);
|
|
319
|
+
const valuesB = valuesA.map((valueA) => round(valueA * coeff, roundTo));
|
|
320
|
+
return [valuesA, valuesB];
|
|
321
|
+
},
|
|
322
|
+
},
|
|
323
|
+
];
|
|
324
|
+
const getPropositions = (n, { answer, ...identifiers }) => {
|
|
325
|
+
const { situationIndex, values } = identifiers;
|
|
326
|
+
const situation = situations[situationIndex];
|
|
327
|
+
return shuffleProps(situation.propositions(values, situation.roundTo), n);
|
|
328
|
+
};
|
|
329
|
+
const getAnswer = (identifiers) => {
|
|
330
|
+
const { situationIndex, values } = identifiers;
|
|
331
|
+
const situation = situations[situationIndex];
|
|
332
|
+
return situation.answer(values, situation.roundTo);
|
|
333
|
+
};
|
|
334
|
+
const getInstruction = (identifiers) => {
|
|
335
|
+
const { situationIndex, values } = identifiers;
|
|
336
|
+
const situation = situations[situationIndex];
|
|
337
|
+
return situation.instruction(values, situation.roundTo);
|
|
338
|
+
};
|
|
339
|
+
const getHint = (identifiers) => {
|
|
340
|
+
const { situationIndex, values } = identifiers;
|
|
341
|
+
const situation = situations[situationIndex];
|
|
342
|
+
return situation.hint(values);
|
|
343
|
+
};
|
|
344
|
+
const getCorrection = (identifiers) => {
|
|
345
|
+
const { situationIndex, values } = identifiers;
|
|
346
|
+
const situation = situations[situationIndex];
|
|
347
|
+
return situation.correction(values, situation.roundTo);
|
|
348
|
+
};
|
|
349
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
350
|
+
try {
|
|
351
|
+
const [nodeAns, nodeAnswer] = [ans, answer].map((str) => parseAlgebraic(str));
|
|
352
|
+
return substract(nodeAns, nodeAnswer).simplify().evaluate() === 0;
|
|
353
|
+
}
|
|
354
|
+
catch (_) {
|
|
355
|
+
return false;
|
|
356
|
+
}
|
|
357
|
+
};
|
|
358
|
+
const getFourthProportionalFromProblemQuestion = () => {
|
|
359
|
+
const situationIndex = randint(0, situations.length);
|
|
360
|
+
const situation = situations[situationIndex];
|
|
361
|
+
const values = situation.randValues(situation.roundTo);
|
|
362
|
+
const identifiers = { situationIndex, values };
|
|
363
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
364
|
+
};
|
|
365
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
366
|
+
return {
|
|
367
|
+
answer: getAnswer(identifiers),
|
|
368
|
+
instruction: getInstruction(identifiers),
|
|
369
|
+
keys: [],
|
|
370
|
+
answerFormat: "tex",
|
|
371
|
+
identifiers,
|
|
372
|
+
hint: getHint(identifiers),
|
|
373
|
+
correction: getCorrection(identifiers),
|
|
374
|
+
};
|
|
375
|
+
};
|
|
376
|
+
export const fourthProportionalFromProblem = {
|
|
377
|
+
id: "fourthProportionalFromProblem",
|
|
378
|
+
label: "Calculer une quatrième proportionnelle à partir d'un énoncé",
|
|
379
|
+
isSingleStep: true,
|
|
380
|
+
generator: (nb, opts) => getDistinctQuestions(() => getFourthProportionalFromProblemQuestion(opts), nb),
|
|
381
|
+
qcmTimer: 60,
|
|
382
|
+
freeTimer: 60,
|
|
383
|
+
getPropositions,
|
|
384
|
+
subject: "Mathématiques",
|
|
385
|
+
getInstruction,
|
|
386
|
+
getHint,
|
|
387
|
+
getCorrection,
|
|
388
|
+
getAnswer,
|
|
389
|
+
getQuestionFromIdentifiers,
|
|
390
|
+
hasHintAndCorrection: true,
|
|
391
|
+
isAnswerValid,
|
|
392
|
+
};
|
|
@@ -6,4 +6,6 @@ export * from "./isTableProportionalNonInteger.js";
|
|
|
6
6
|
export * from "./findCoeffInProportionalTableNonIntegers.js";
|
|
7
7
|
export * from "./isTableProportional.js";
|
|
8
8
|
export * from "./rectangleSideAfterReduction.js";
|
|
9
|
+
export * from "./isProportionalFromProblem.js";
|
|
10
|
+
export * from "./fourthProportionalFromProblem.js";
|
|
9
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/proportionality/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,sCAAsC,CAAC;AACrD,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oCAAoC,CAAC;AACnD,cAAc,8CAA8C,CAAC;AAC7D,cAAc,0BAA0B,CAAC;AACzC,cAAc,kCAAkC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/proportionality/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,sCAAsC,CAAC;AACrD,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oCAAoC,CAAC;AACnD,cAAc,8CAA8C,CAAC;AAC7D,cAAc,0BAA0B,CAAC;AACzC,cAAc,kCAAkC,CAAC;AACjD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oCAAoC,CAAC"}
|
|
@@ -6,3 +6,5 @@ export * from "./isTableProportionalNonInteger.js";
|
|
|
6
6
|
export * from "./findCoeffInProportionalTableNonIntegers.js";
|
|
7
7
|
export * from "./isTableProportional.js";
|
|
8
8
|
export * from "./rectangleSideAfterReduction.js";
|
|
9
|
+
export * from "./isProportionalFromProblem.js";
|
|
10
|
+
export * from "./fourthProportionalFromProblem.js";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise.js";
|
|
2
|
+
type Identifiers = {
|
|
3
|
+
situationIndex: number;
|
|
4
|
+
values: number[][];
|
|
5
|
+
};
|
|
6
|
+
export declare const isProportionalFromProblem: Exercise<Identifiers>;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=isProportionalFromProblem.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isProportionalFromProblem.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/proportionality/isProportionalFromProblem.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAWT,MAAM,6BAA6B,CAAC;AAiBrC,KAAK,WAAW,GAAG;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC;CACpB,CAAC;AA0aF,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,WAAW,CAiB3D,CAAC"}
|