math-exercises 3.0.144 → 3.0.146
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/exercise.d.ts +1 -0
- package/lib/exercises/exercise.d.ts.map +1 -1
- package/lib/exercises/math/calcul/addAndSub.d.ts.map +1 -1
- package/lib/exercises/math/calcul/addAndSub.js +20 -1
- package/lib/exercises/math/calcul/arithmetics/euclideanDivision.js +1 -1
- package/lib/exercises/math/calcul/index.d.ts +1 -0
- package/lib/exercises/math/calcul/index.d.ts.map +1 -1
- package/lib/exercises/math/calcul/index.js +1 -0
- package/lib/exercises/math/calcul/mentalCaluls/index.d.ts +2 -0
- package/lib/exercises/math/calcul/mentalCaluls/index.d.ts.map +1 -1
- package/lib/exercises/math/calcul/mentalCaluls/index.js +2 -0
- package/lib/exercises/math/calcul/mentalCaluls/mentalAddAndSub.d.ts.map +1 -1
- package/lib/exercises/math/calcul/mentalCaluls/mentalAddAndSub.js +22 -0
- package/lib/exercises/math/calcul/mentalCaluls/mentalFractionageOfInteger.d.ts +9 -0
- package/lib/exercises/math/calcul/mentalCaluls/mentalFractionageOfInteger.d.ts.map +1 -0
- package/lib/exercises/math/calcul/mentalCaluls/mentalFractionageOfInteger.js +152 -0
- package/lib/exercises/math/calcul/mentalCaluls/mentalFractionageOfQuantity.d.ts +15 -0
- package/lib/exercises/math/calcul/mentalCaluls/mentalFractionageOfQuantity.d.ts.map +1 -0
- package/lib/exercises/math/calcul/mentalCaluls/mentalFractionageOfQuantity.js +412 -0
- package/lib/exercises/math/calcul/mentalCaluls/mentalProgramSolve.d.ts.map +1 -1
- package/lib/exercises/math/calcul/mentalCaluls/mentalProgramSolve.js +6 -8
- package/lib/exercises/math/calcul/proportionality/isTableProportionalNonInteger.d.ts.map +1 -1
- package/lib/exercises/math/calcul/proportionality/isTableProportionalNonInteger.js +37 -7
- package/lib/exercises/math/calcul/ratio/index.d.ts +2 -0
- package/lib/exercises/math/calcul/ratio/index.d.ts.map +1 -0
- package/lib/exercises/math/calcul/ratio/index.js +2 -0
- package/lib/exercises/math/calcul/ratio/partUsingRatio.d.ts +14 -0
- package/lib/exercises/math/calcul/ratio/partUsingRatio.d.ts.map +1 -0
- package/lib/exercises/math/calcul/ratio/partUsingRatio.js +388 -0
- package/lib/exercises/math/calcul/ratio/ratioFromParts.d.ts +10 -0
- package/lib/exercises/math/calcul/ratio/ratioFromParts.d.ts.map +1 -0
- package/lib/exercises/math/calcul/ratio/ratioFromParts.js +198 -0
- package/lib/exercises/math/calculLitteral/equation/equationFromSentenceExercise.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/equationFromSentenceExercise.js +50 -0
- package/lib/exercises/math/calculLitteral/simplifying/compareMinusA.js +1 -1
- package/lib/exercises/math/index.d.ts +1 -0
- package/lib/exercises/math/index.d.ts.map +1 -1
- package/lib/exercises/math/index.js +1 -0
- package/lib/exercises/math/probaStat/basicProbas/index.d.ts +1 -0
- package/lib/exercises/math/probaStat/basicProbas/index.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/basicProbas/index.js +1 -0
- package/lib/exercises/math/probaStat/basicProbas/rangeBasicProbas.d.ts +10 -0
- package/lib/exercises/math/probaStat/basicProbas/rangeBasicProbas.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/basicProbas/rangeBasicProbas.js +113 -0
- package/lib/exercises/math/probaStat/index.d.ts +1 -0
- package/lib/exercises/math/probaStat/index.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/index.js +1 -0
- package/lib/exercises/math/probaStat/stats1var/etendueTable.d.ts +8 -0
- package/lib/exercises/math/probaStat/stats1var/etendueTable.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/stats1var/etendueTable.js +89 -0
- package/lib/exercises/math/probaStat/stats1var/index.d.ts +1 -0
- package/lib/exercises/math/probaStat/stats1var/index.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/index.js +1 -0
- package/lib/exercises/math/probaStat/twoStepExperiments/countIssuesTwoStepExperiment.d.ts +8 -0
- package/lib/exercises/math/probaStat/twoStepExperiments/countIssuesTwoStepExperiment.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/twoStepExperiments/countIssuesTwoStepExperiment.js +244 -0
- package/lib/exercises/math/probaStat/twoStepExperiments/index.d.ts +3 -0
- package/lib/exercises/math/probaStat/twoStepExperiments/index.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/twoStepExperiments/index.js +2 -0
- package/lib/exercises/math/probaStat/twoStepExperiments/twoStepExperimentProbas.d.ts +8 -0
- package/lib/exercises/math/probaStat/twoStepExperiments/twoStepExperimentProbas.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/twoStepExperiments/twoStepExperimentProbas.js +452 -0
- package/lib/exercises/math/python/pythonWhileStatementOperationCompletion.d.ts.map +1 -1
- package/lib/exercises/math/python/pythonWhileStatementOperationCompletion.js +3 -0
- package/lib/exercises/math/scratch/index.d.ts +2 -0
- package/lib/exercises/math/scratch/index.d.ts.map +1 -0
- package/lib/exercises/math/scratch/index.js +1 -0
- package/lib/exercises/math/scratch/scratchLoopStepsCount.d.ts +8 -0
- package/lib/exercises/math/scratch/scratchLoopStepsCount.d.ts.map +1 -0
- package/lib/exercises/math/scratch/scratchLoopStepsCount.js +85 -0
- package/lib/exercises/math/scratch/testScratch.d.ts +8 -0
- package/lib/exercises/math/scratch/testScratch.d.ts.map +1 -0
- package/lib/exercises/math/scratch/testScratch.js +79 -0
- package/lib/exercises/math/trigonometry/index.d.ts +3 -0
- package/lib/exercises/math/trigonometry/index.d.ts.map +1 -1
- package/lib/exercises/math/trigonometry/index.js +3 -0
- package/lib/exercises/math/trigonometry/trigonometrySideName.d.ts +13 -0
- package/lib/exercises/math/trigonometry/trigonometrySideName.d.ts.map +1 -0
- package/lib/exercises/math/trigonometry/trigonometrySideName.js +189 -0
- package/lib/exercises/math/trigonometry/trigonometrySohcahtoaCalcul.d.ts +13 -0
- package/lib/exercises/math/trigonometry/trigonometrySohcahtoaCalcul.d.ts.map +1 -0
- package/lib/exercises/math/trigonometry/trigonometrySohcahtoaCalcul.js +290 -0
- package/lib/exercises/math/trigonometry/trigonometrySohcahtoaUse.d.ts +18 -0
- package/lib/exercises/math/trigonometry/trigonometrySohcahtoaUse.d.ts.map +1 -0
- package/lib/exercises/math/trigonometry/trigonometrySohcahtoaUse.js +386 -0
- package/lib/index.d.ts +58 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/latexTester.d.ts.map +1 -1
- package/lib/latexTester.js +5 -0
- package/lib/math/geometry/triangles/triangle.d.ts +1 -0
- package/lib/math/geometry/triangles/triangle.d.ts.map +1 -1
- package/lib/math/geometry/triangles/triangle.js +1 -0
- package/lib/math/numbers/fractions/isDecimalFraction.d.ts +3 -0
- package/lib/math/numbers/fractions/isDecimalFraction.d.ts.map +1 -0
- package/lib/math/numbers/fractions/isDecimalFraction.js +14 -0
- package/lib/math/polynomials/polynomial.js +1 -1
- package/lib/types/keyIds.d.ts +1 -1
- package/lib/types/keyIds.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,412 @@
|
|
|
1
|
+
import { GeneratorOptionTarget, GeneratorOptionType, addValidProp, propWhile, shuffleProps, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { rationalVEA } from "../../../../exercises/vea/rationalVEA.js";
|
|
4
|
+
import { isDecimalFraction } from "../../../../math/numbers/fractions/isDecimalFraction.js";
|
|
5
|
+
import { dividersOf } from "../../../../math/utils/arithmetic/dividersOf.js";
|
|
6
|
+
import { randint } from "../../../../math/utils/random/randint.js";
|
|
7
|
+
import { NodeConstructor, } from "../../../../tree/nodes/nodeConstructor.js";
|
|
8
|
+
import { frac, isFractionNode, } from "../../../../tree/nodes/operators/fractionNode.js";
|
|
9
|
+
import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
10
|
+
import { random, randomMany } from "../../../../utils/alea/random.js";
|
|
11
|
+
import { alignTex } from "../../../../utils/latex/alignTex.js";
|
|
12
|
+
const getFractionNode = (fractionNodeFunc, defaultNode) => {
|
|
13
|
+
let fractionNode;
|
|
14
|
+
let counter = -1;
|
|
15
|
+
let isValid = false;
|
|
16
|
+
while (!isValid && counter < 100) {
|
|
17
|
+
counter++;
|
|
18
|
+
const fractionNodeCandidate = fractionNodeFunc().simplify();
|
|
19
|
+
isValid = isFractionNode(fractionNodeCandidate);
|
|
20
|
+
// &&(fractionNodeCandidate as FractionNode).leftChild.evaluate() !== 1;
|
|
21
|
+
if (isValid) {
|
|
22
|
+
fractionNode = fractionNodeCandidate;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return fractionNode ?? defaultNode;
|
|
26
|
+
};
|
|
27
|
+
const createRandomSituation = (funcStrFrenchUnitFrom, funcStrFrenchUnitFromOf, strFrenchUnitTo, strUnitTo, coeff, maxDivider, funcA, funcFractionNode) => {
|
|
28
|
+
return {
|
|
29
|
+
instruction: (nodeIdsFrac, a) => {
|
|
30
|
+
const fractionNode = NodeConstructor.fromIdentifiers(nodeIdsFrac);
|
|
31
|
+
return `Combien vaut $${fractionNode.toTex()}$ ${funcStrFrenchUnitFromOf(a)}, en ${strFrenchUnitTo}s ?`;
|
|
32
|
+
},
|
|
33
|
+
hint: (nodeIdsFrac, a) => {
|
|
34
|
+
const fractionNode = NodeConstructor.fromIdentifiers(nodeIdsFrac);
|
|
35
|
+
const nodeDen = fractionNode.rightChild;
|
|
36
|
+
if (coeff !== 1) {
|
|
37
|
+
return `Cherche d'abord combien de fois $${nodeDen.toTex()}$ il y a dans $${coeff.frenchify()}$.`;
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
return `Cherche d'abord combien fait $${a.frenchify()}$ divisé par $${nodeDen.toTex()}$.`;
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
correction: (nodeIdsFrac, a, coeff) => {
|
|
44
|
+
const fractionNode = NodeConstructor.fromIdentifiers(nodeIdsFrac);
|
|
45
|
+
const b = a * coeff;
|
|
46
|
+
const nodeNum = fractionNode.leftChild;
|
|
47
|
+
const nodeDen = fractionNode.rightChild;
|
|
48
|
+
const node1OverDen = frac(1, nodeDen);
|
|
49
|
+
const nodeCoeffOverDen = frac(coeff, nodeDen);
|
|
50
|
+
const nodeAOverDen = frac(a, nodeDen);
|
|
51
|
+
const answerNode = multiply(fractionNode, b).simplify();
|
|
52
|
+
const num = nodeNum.evaluate();
|
|
53
|
+
return `${(() => {
|
|
54
|
+
if (coeff !== 1) {
|
|
55
|
+
return `Dans ${funcStrFrenchUnitFrom(a)}, il y a $${a.frenchify()} \\times ${coeff.frenchify()}$ ${strFrenchUnitTo}s.`;
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
return ``;
|
|
59
|
+
}
|
|
60
|
+
})()}
|
|
61
|
+
|
|
62
|
+
Prendre la fraction d'un nombre, c'est le multiplier par cette fraction.
|
|
63
|
+
|
|
64
|
+
${(() => {
|
|
65
|
+
if (num === 1) {
|
|
66
|
+
if (coeff !== 1) {
|
|
67
|
+
return `
|
|
68
|
+
|
|
69
|
+
${alignTex([
|
|
70
|
+
[
|
|
71
|
+
`${fractionNode.toTex()} \\times (${a.frenchify()} \\times ${coeff.frenchify()})`,
|
|
72
|
+
"=",
|
|
73
|
+
`${a.frenchify()} \\times ${nodeCoeffOverDen.toTex()}`,
|
|
74
|
+
],
|
|
75
|
+
[``, "=", `${a.frenchify()} \\times ${nodeCoeffOverDen.simplify().toTex()}`],
|
|
76
|
+
[``, "=", `${answerNode.toTex()}`],
|
|
77
|
+
])}
|
|
78
|
+
|
|
79
|
+
`;
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
return `
|
|
83
|
+
|
|
84
|
+
${alignTex([
|
|
85
|
+
[
|
|
86
|
+
`${fractionNode.toTex()} \\times ${a.frenchify()}`,
|
|
87
|
+
"=",
|
|
88
|
+
`${nodeAOverDen.toTex()}`,
|
|
89
|
+
],
|
|
90
|
+
[``, "=", `${answerNode.toTex()}`],
|
|
91
|
+
])}
|
|
92
|
+
|
|
93
|
+
`;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
if (coeff !== 1) {
|
|
98
|
+
return `
|
|
99
|
+
|
|
100
|
+
${alignTex([
|
|
101
|
+
[
|
|
102
|
+
`${fractionNode.toTex()} \\times (${a.frenchify()} \\times ${coeff.frenchify()})`,
|
|
103
|
+
"=",
|
|
104
|
+
`${nodeNum.toTex()} \\times ${node1OverDen.toTex()} \\times ${a.frenchify()} \\times ${coeff.frenchify()}`,
|
|
105
|
+
],
|
|
106
|
+
[
|
|
107
|
+
``,
|
|
108
|
+
"=",
|
|
109
|
+
`${nodeNum.toTex()} \\times ${a.frenchify()} \\times ${nodeCoeffOverDen.toTex()}`,
|
|
110
|
+
],
|
|
111
|
+
[
|
|
112
|
+
``,
|
|
113
|
+
"=",
|
|
114
|
+
`${(num * a).frenchify()} \\times ${nodeCoeffOverDen.simplify().toTex()}`,
|
|
115
|
+
],
|
|
116
|
+
[``, "=", `${answerNode.toTex()}`],
|
|
117
|
+
])}
|
|
118
|
+
|
|
119
|
+
`;
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
return `
|
|
123
|
+
|
|
124
|
+
${alignTex([
|
|
125
|
+
[
|
|
126
|
+
`${fractionNode.toTex()} \\times ${a.frenchify()}`,
|
|
127
|
+
"=",
|
|
128
|
+
`${nodeNum.toTex()} \\times ${node1OverDen.toTex()} \\times ${a.frenchify()}`,
|
|
129
|
+
],
|
|
130
|
+
[``, "=", `${nodeNum.toTex()} \\times ${nodeAOverDen.toTex()}`],
|
|
131
|
+
[``, "=", `${num.frenchify()} \\times ${nodeAOverDen.simplify().toTex()}`],
|
|
132
|
+
[``, "=", `${answerNode.toTex()}`],
|
|
133
|
+
])}
|
|
134
|
+
|
|
135
|
+
`;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
})()}
|
|
139
|
+
|
|
140
|
+
La quantité recherchée est $${answerNode.toTex()} \\ \\textrm{${strUnitTo}}$.
|
|
141
|
+
`;
|
|
142
|
+
},
|
|
143
|
+
propositions: (nodeIdsFrac, a, coeff, n) => {
|
|
144
|
+
const propositions = [];
|
|
145
|
+
const fractionNode = NodeConstructor.fromIdentifiers(nodeIdsFrac);
|
|
146
|
+
const b = a * coeff;
|
|
147
|
+
const nodeNum = fractionNode.leftChild;
|
|
148
|
+
const nodeDen = fractionNode.rightChild;
|
|
149
|
+
const nodeBOverDen = frac(b, nodeDen);
|
|
150
|
+
const answerNode = multiply(fractionNode, b).simplify();
|
|
151
|
+
addValidProp(propositions, answerNode.toTex());
|
|
152
|
+
//num * b
|
|
153
|
+
tryToAddWrongProp(propositions, multiply(nodeNum, b).simplify().toTex());
|
|
154
|
+
//b / den
|
|
155
|
+
tryToAddWrongProp(propositions, frac(b, nodeDen).simplify().toTex());
|
|
156
|
+
//frac times a
|
|
157
|
+
const nodeFracTimesA = multiply(fractionNode, a).simplify();
|
|
158
|
+
if (isDecimalFraction(nodeFracTimesA)) {
|
|
159
|
+
tryToAddWrongProp(propositions, nodeFracTimesA.simplify({ fractionsToDecimal: true }).toTex());
|
|
160
|
+
}
|
|
161
|
+
//around answer
|
|
162
|
+
const valueAnswer = answerNode.evaluate();
|
|
163
|
+
//in tables
|
|
164
|
+
const numbersOneToTen = [...Array(10).keys()].map((i) => i + 1);
|
|
165
|
+
const tableNumbersSortedAsc = [
|
|
166
|
+
...new Set(numbersOneToTen.flatMap((n1) => numbersOneToTen.map((n2) => n1 * n2))),
|
|
167
|
+
].toSorted((n1, n2) => n1 - n2);
|
|
168
|
+
const tableNumbersCloseToAnswer = tableNumbersSortedAsc.filter((n) => Math.abs(valueAnswer - n) <= 10);
|
|
169
|
+
randomMany(tableNumbersCloseToAnswer, Math.min(5, tableNumbersCloseToAnswer.length)).forEach((n) => {
|
|
170
|
+
tryToAddWrongProp(propositions, n.frenchify());
|
|
171
|
+
});
|
|
172
|
+
//fuzzy
|
|
173
|
+
const node60OverDen = frac(60, nodeDen).simplify();
|
|
174
|
+
const offsetFuzzy = !isFractionNode(node60OverDen)
|
|
175
|
+
? node60OverDen.evaluate()
|
|
176
|
+
: nodeBOverDen.evaluate();
|
|
177
|
+
propWhile(propositions, n, () => {
|
|
178
|
+
tryToAddWrongProp(propositions, Math.max(1, valueAnswer + randint(-5, 5, [0]) * offsetFuzzy).frenchify());
|
|
179
|
+
});
|
|
180
|
+
return shuffleProps(propositions, n);
|
|
181
|
+
},
|
|
182
|
+
randValues: () => {
|
|
183
|
+
const a = funcA();
|
|
184
|
+
const fractionNode = getFractionNode(() => funcFractionNode(a, coeff, maxDivider), frac(5, 12));
|
|
185
|
+
return {
|
|
186
|
+
nodeIdsFrac: fractionNode.toIdentifiers(),
|
|
187
|
+
a,
|
|
188
|
+
coeff,
|
|
189
|
+
};
|
|
190
|
+
},
|
|
191
|
+
};
|
|
192
|
+
};
|
|
193
|
+
const situationsDict = {
|
|
194
|
+
durée: [
|
|
195
|
+
createRandomSituation((a) => (a === 1 ? `un jour` : `$${a}$ jours`), (a) => (a === 1 ? `de jour` : `de $${a}$ jours`), "heure", "h", 24, 12, () => randint(2, 11), (_, coeff, maxDivider) => {
|
|
196
|
+
const denPool = dividersOf(coeff).filter((v) =>
|
|
197
|
+
// v !== 1 &&
|
|
198
|
+
v <= maxDivider);
|
|
199
|
+
const den = random(denPool);
|
|
200
|
+
const num = randint(1, den);
|
|
201
|
+
return frac(num, den);
|
|
202
|
+
}),
|
|
203
|
+
createRandomSituation((a) => (a === 1 ? `une heure` : `$${a}$ heures`), (a) => (a === 1 ? `d'heure` : `de $${a}$ heures`), "minute", "min", 60, 15, () => randint(2, 11), (_, coeff, maxDivider) => {
|
|
204
|
+
const denPool = dividersOf(coeff).filter((v) =>
|
|
205
|
+
// v !== 1 &&
|
|
206
|
+
v <= maxDivider);
|
|
207
|
+
const den = random(denPool);
|
|
208
|
+
const num = randint(1, den);
|
|
209
|
+
return frac(num, den);
|
|
210
|
+
}),
|
|
211
|
+
createRandomSituation((a) => (a === 1 ? `une minute` : `$${a}$ minutes`), (a) => (a === 1 ? `de minute` : `de $${a}$ minutes`), "seconde", "s", 60, 15, () => randint(2, 11), (_, coeff, maxDivider) => {
|
|
212
|
+
const denPool = dividersOf(coeff).filter((v) =>
|
|
213
|
+
// v !== 1 &&
|
|
214
|
+
v <= maxDivider);
|
|
215
|
+
const den = random(denPool);
|
|
216
|
+
const num = randint(1, den);
|
|
217
|
+
return frac(num, den);
|
|
218
|
+
}),
|
|
219
|
+
],
|
|
220
|
+
masse: [
|
|
221
|
+
createRandomSituation((a) => `une tablette de chocolat de $${a.frenchify()}$ grammes`, (a) => `d'une tablette de chocolat de $${a.frenchify()}$ grammes`, "gramme", "g", 1, 20, () => {
|
|
222
|
+
return random([
|
|
223
|
+
90, 100, 120, 140, 150, 160, 180, 200, 210, 220, 240, 260,
|
|
224
|
+
]);
|
|
225
|
+
}, (a, _, maxDivider) => {
|
|
226
|
+
const denPool = dividersOf(a).filter((v) =>
|
|
227
|
+
// v !== 1 &&
|
|
228
|
+
v <= maxDivider);
|
|
229
|
+
const den = random(denPool);
|
|
230
|
+
const num = randint(1, den);
|
|
231
|
+
return frac(num, den);
|
|
232
|
+
}),
|
|
233
|
+
createRandomSituation((a) => `une motte de beurre de $${a.frenchify()}$ grammes`, (a) => `d'une motte de beurre de $${a.frenchify()}$ grammes`, "gramme", "g", 1, 20, () => {
|
|
234
|
+
return random([
|
|
235
|
+
260, 270, 280, 300, 320, 330, 340, 350, 360, 380, 390, 400, 420, 440,
|
|
236
|
+
450, 460, 480, 490, 500, 510, 520, 540, 550, 560, 570, 580, 600, 620,
|
|
237
|
+
630, 640, 650, 660, 680, 690, 700, 720, 740, 750, 760, 770, 780, 800,
|
|
238
|
+
]);
|
|
239
|
+
}, (a, _, maxDivider) => {
|
|
240
|
+
const denPool = dividersOf(a).filter((v) =>
|
|
241
|
+
// v !== 1 &&
|
|
242
|
+
v <= maxDivider);
|
|
243
|
+
const den = random(denPool);
|
|
244
|
+
const num = randint(1, den);
|
|
245
|
+
return frac(num, den);
|
|
246
|
+
}),
|
|
247
|
+
createRandomSituation((a) => `une botte de foin de de $${a.frenchify()} \\ \\textrm{kg}`, (a) => `d'une botte de foin de de $${a.frenchify()} \\ \\textrm{kg}$`, "kilogramme", "kg", 1, 20, () => {
|
|
248
|
+
return random([
|
|
249
|
+
60, 80, 90, 100, 120, 140, 150, 160, 180, 200, 210, 220, 240, 260,
|
|
250
|
+
270, 280, 300, 320, 330, 340, 350, 360, 380, 390, 400, 420, 440, 450,
|
|
251
|
+
]);
|
|
252
|
+
}, (a, _, maxDivider) => {
|
|
253
|
+
const denPool = dividersOf(a).filter((v) =>
|
|
254
|
+
// v !== 1 &&
|
|
255
|
+
v <= maxDivider);
|
|
256
|
+
const den = random(denPool);
|
|
257
|
+
const num = randint(1, den);
|
|
258
|
+
return frac(num, den);
|
|
259
|
+
}),
|
|
260
|
+
],
|
|
261
|
+
longueur: [
|
|
262
|
+
createRandomSituation((a) => `une planche de $${a.frenchify()}$ centimètres`, (a) => `d'une planche de $${a.frenchify()}$ centimètres`, "centimètre", "cm", 1, 20, () => {
|
|
263
|
+
return random([
|
|
264
|
+
90, 100, 120, 140, 150, 160, 180, 200, 210, 220, 240, 260, 270, 280,
|
|
265
|
+
300, 320, 330, 340, 350, 360, 380, 390, 400,
|
|
266
|
+
]);
|
|
267
|
+
}, (a, _, maxDivider) => {
|
|
268
|
+
const denPool = dividersOf(a).filter((v) =>
|
|
269
|
+
// v !== 1 &&
|
|
270
|
+
v <= maxDivider);
|
|
271
|
+
const den = random(denPool);
|
|
272
|
+
const num = randint(1, den);
|
|
273
|
+
return frac(num, den);
|
|
274
|
+
}),
|
|
275
|
+
createRandomSituation((a) => `une piste de $${a.frenchify()}$ mètres`, (a) => `d'une piste de $${a.frenchify()}$ mètres`, "mètre", "m", 1, 20, () => {
|
|
276
|
+
return random([
|
|
277
|
+
1200, 1300, 1400, 1500, 1600, 1700, 1800, 1900, 2000, 2100, 2200,
|
|
278
|
+
2300, 2400, 2500, 2600, 2700, 2800, 2900, 3000, 3100, 3200, 3300,
|
|
279
|
+
3400, 3500, 3600,
|
|
280
|
+
]);
|
|
281
|
+
}, (a, _, maxDivider) => {
|
|
282
|
+
const denPool = dividersOf(a).filter((v) =>
|
|
283
|
+
// v !== 1 &&
|
|
284
|
+
v <= maxDivider);
|
|
285
|
+
const den = random(denPool);
|
|
286
|
+
const num = randint(1, den);
|
|
287
|
+
return frac(num, den);
|
|
288
|
+
}),
|
|
289
|
+
],
|
|
290
|
+
valeur: [
|
|
291
|
+
createRandomSituation((a) => `un crédit de $${a.frenchify()} \\ \\textrm{€}$`, (a) => `d'un crédit de $${a.frenchify()} \\ \\textrm{€}$`, "euro", "€", 1, 20, () => {
|
|
292
|
+
return random([
|
|
293
|
+
90000, 100000, 120000, 140000, 150000, 160000, 180000, 200000, 210000,
|
|
294
|
+
220000, 240000, 260000, 270000, 280000, 300000, 320000, 330000,
|
|
295
|
+
340000, 350000, 360000, 380000, 390000, 400000, 420000, 440000,
|
|
296
|
+
450000, 460000, 480000, 490000, 500000, 510000, 520000, 540000,
|
|
297
|
+
550000, 560000, 570000, 580000, 600000,
|
|
298
|
+
]);
|
|
299
|
+
}, (a, _, maxDivider) => {
|
|
300
|
+
const denPool = dividersOf(a).filter((v) =>
|
|
301
|
+
// v !== 1 &&
|
|
302
|
+
v <= maxDivider);
|
|
303
|
+
const den = random(denPool);
|
|
304
|
+
const num = randint(1, den);
|
|
305
|
+
return frac(num, den);
|
|
306
|
+
}),
|
|
307
|
+
createRandomSituation((a) => `une facture de $${a.frenchify()} \\ \\textrm{€}$`, (a) => `d'une facture de $${a.frenchify()} \\ \\textrm{€}$`, "euro", "€", 1, 20, () => {
|
|
308
|
+
return random([
|
|
309
|
+
100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300,
|
|
310
|
+
1400, 1500, 1600, 1700, 1800, 1900,
|
|
311
|
+
]);
|
|
312
|
+
}, (a, _, maxDivider) => {
|
|
313
|
+
const denPool = dividersOf(a).filter((v) =>
|
|
314
|
+
// v !== 1 &&
|
|
315
|
+
v <= maxDivider);
|
|
316
|
+
const den = random(denPool);
|
|
317
|
+
const num = randint(1, den);
|
|
318
|
+
return frac(num, den);
|
|
319
|
+
}),
|
|
320
|
+
],
|
|
321
|
+
};
|
|
322
|
+
const getInstruction = (identifiers) => {
|
|
323
|
+
const { quantityType, situationIndex, nodeIdsFrac, a } = identifiers;
|
|
324
|
+
const situations = situationsDict[quantityType];
|
|
325
|
+
const situation = situations[situationIndex];
|
|
326
|
+
return situation.instruction(nodeIdsFrac, a);
|
|
327
|
+
};
|
|
328
|
+
const getAnswerNode = (identifiers) => {
|
|
329
|
+
const { nodeIdsFrac, coeff, a } = identifiers;
|
|
330
|
+
const fractionNode = NodeConstructor.fromIdentifiers(nodeIdsFrac);
|
|
331
|
+
const b = a * coeff;
|
|
332
|
+
const answerNode = multiply(fractionNode, b).simplify();
|
|
333
|
+
return answerNode;
|
|
334
|
+
};
|
|
335
|
+
const getAnswer = (identifiers) => {
|
|
336
|
+
return getAnswerNode(identifiers).toTex();
|
|
337
|
+
};
|
|
338
|
+
const getHint = (identifiers) => {
|
|
339
|
+
const { quantityType, situationIndex, nodeIdsFrac, a } = identifiers;
|
|
340
|
+
const situations = situationsDict[quantityType];
|
|
341
|
+
const situation = situations[situationIndex];
|
|
342
|
+
return situation.hint(nodeIdsFrac, a);
|
|
343
|
+
};
|
|
344
|
+
const getCorrection = (identifiers) => {
|
|
345
|
+
const { quantityType, situationIndex, nodeIdsFrac, a, coeff } = identifiers;
|
|
346
|
+
const situations = situationsDict[quantityType];
|
|
347
|
+
const situation = situations[situationIndex];
|
|
348
|
+
return situation.correction(nodeIdsFrac, a, coeff);
|
|
349
|
+
};
|
|
350
|
+
const getPropositions = (n, { answer, ...identifiers }) => {
|
|
351
|
+
const { quantityType, situationIndex, nodeIdsFrac, a, coeff } = identifiers;
|
|
352
|
+
const situations = situationsDict[quantityType];
|
|
353
|
+
const situation = situations[situationIndex];
|
|
354
|
+
return situation.propositions(nodeIdsFrac, a, coeff, n);
|
|
355
|
+
};
|
|
356
|
+
const isAnswerValid = (studentAns, { answer }) => {
|
|
357
|
+
return rationalVEA(studentAns, answer, {
|
|
358
|
+
allowNonIrreductible: true,
|
|
359
|
+
allowDecimal: true,
|
|
360
|
+
});
|
|
361
|
+
};
|
|
362
|
+
const getMentalFractionageOfQuantity = (optsIn) => {
|
|
363
|
+
const opts = optsIn ?? optsDefault;
|
|
364
|
+
const quantityType = random(opts.quantityTypes);
|
|
365
|
+
const situations = situationsDict[quantityType];
|
|
366
|
+
const situationIndex = randint(0, situationsDict[quantityType].length);
|
|
367
|
+
const situation = situations[situationIndex];
|
|
368
|
+
const { a, coeff, nodeIdsFrac } = situation.randValues();
|
|
369
|
+
const identifiers = { quantityType, situationIndex, a, coeff, nodeIdsFrac };
|
|
370
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
371
|
+
};
|
|
372
|
+
const getQuestionFromIdentifiers = (identifiers, opts) => {
|
|
373
|
+
const question = {
|
|
374
|
+
instruction: getInstruction(identifiers, opts),
|
|
375
|
+
hint: getHint(identifiers, opts),
|
|
376
|
+
correction: getCorrection(identifiers, opts),
|
|
377
|
+
answer: getAnswer(identifiers, opts),
|
|
378
|
+
keys: [],
|
|
379
|
+
answerFormat: "tex",
|
|
380
|
+
identifiers,
|
|
381
|
+
options: opts,
|
|
382
|
+
};
|
|
383
|
+
return question;
|
|
384
|
+
};
|
|
385
|
+
const options = [
|
|
386
|
+
{
|
|
387
|
+
id: "quantityTypes",
|
|
388
|
+
label: "Types de quantités",
|
|
389
|
+
type: GeneratorOptionType.multiselect,
|
|
390
|
+
target: GeneratorOptionTarget.generation,
|
|
391
|
+
values: ["durée", "masse", "longueur", "valeur"],
|
|
392
|
+
defaultValue: ["durée", "masse", "longueur", "valeur"],
|
|
393
|
+
},
|
|
394
|
+
];
|
|
395
|
+
const optsDefault = {
|
|
396
|
+
quantityTypes: ["durée", "masse", "longueur", "valeur"],
|
|
397
|
+
};
|
|
398
|
+
export const mentalFractionageOfQuantity = {
|
|
399
|
+
id: "mentalFractionageOfQuantity",
|
|
400
|
+
connector: "=",
|
|
401
|
+
label: "Prendre la fraction d'une quantité",
|
|
402
|
+
isSingleStep: true,
|
|
403
|
+
generator: (nb, opts) => getDistinctQuestions(() => getMentalFractionageOfQuantity(opts), nb),
|
|
404
|
+
options,
|
|
405
|
+
qcmTimer: 60,
|
|
406
|
+
freeTimer: 60,
|
|
407
|
+
getPropositions,
|
|
408
|
+
isAnswerValid,
|
|
409
|
+
subject: "Mathématiques",
|
|
410
|
+
getQuestionFromIdentifiers,
|
|
411
|
+
hasHintAndCorrection: true,
|
|
412
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mentalProgramSolve.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/mentalCaluls/mentalProgramSolve.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAiBT,MAAM,6BAA6B,CAAC;AAIrC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAI7C,OAAO,EAGL,mBAAmB,EACpB,MAAM,iCAAiC,CAAC;AA4BzC,KAAK,WAAW,GAAG;IACjB,qBAAqB,EAAE,eAAe,CAAC;IACvC,WAAW,EAAE,mBAAmB,CAAC;CAClC,CAAC;
|
|
1
|
+
{"version":3,"file":"mentalProgramSolve.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/mentalCaluls/mentalProgramSolve.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAiBT,MAAM,6BAA6B,CAAC;AAIrC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAI7C,OAAO,EAGL,mBAAmB,EACpB,MAAM,iCAAiC,CAAC;AA4BzC,KAAK,WAAW,GAAG;IACjB,qBAAqB,EAAE,eAAe,CAAC;IACvC,WAAW,EAAE,mBAAmB,CAAC;CAClC,CAAC;AAiOF,KAAK,OAAO,GAAG;IACb,UAAU,EAAE,QAAQ,GAAG,SAAS,CAAC;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAiCF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAyB7D,CAAC"}
|
|
@@ -81,12 +81,10 @@ const getInstruction = (identifiers, opts) => {
|
|
|
81
81
|
const progCalc = ProgCalcConstructor.fromIdentifiers(progCalcIds);
|
|
82
82
|
const nodeFinalNumber = progCalc.apply(nodeStartingNumber).simplify();
|
|
83
83
|
const strOpening = `Voici un programme de calcul :`;
|
|
84
|
-
const strChooseANumber = `Choisir un nombre
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
${str}`);
|
|
84
|
+
const strChooseANumber = `Choisir un nombre`;
|
|
85
|
+
const arrStrProgCalc = progCalc
|
|
86
|
+
.getArrOfFrenchStrings()
|
|
87
|
+
.map((str) => `> ${str}\n> \n`);
|
|
90
88
|
const strProgCalc = arrStrProgCalc.reduce((acc, str) => acc + str);
|
|
91
89
|
const strFinalNumber = opts?.numberType == "Entier"
|
|
92
90
|
? nodeFinalNumber.evaluate().frenchify()
|
|
@@ -98,8 +96,8 @@ ${str}`);
|
|
|
98
96
|
return `
|
|
99
97
|
${strOpening}
|
|
100
98
|
|
|
101
|
-
${strChooseANumber}
|
|
102
|
-
|
|
99
|
+
> ${strChooseANumber}
|
|
100
|
+
>
|
|
103
101
|
${strProgCalc}
|
|
104
102
|
|
|
105
103
|
${strQuestion}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isTableProportionalNonInteger.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/proportionality/isTableProportionalNonInteger.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"isTableProportionalNonInteger.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/proportionality/isTableProportionalNonInteger.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAiBT,MAAM,6BAA6B,CAAC;AAMrC,OAAO,EAEL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;AAU7C,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,eAAe,CAAC;IAC1B,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,eAAe,EAAE,OAAO,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAmEF,KAAK,OAAO,GAAG;IACb,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,iBAAiB,EAAE,MAAM,EAAE,CAAC;CAC7B,CAAC;AAqGF,eAAO,MAAM,6BAA6B,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAmBxE,CAAC"}
|
|
@@ -3,8 +3,9 @@ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQue
|
|
|
3
3
|
import { RationalConstructor } from "../../../../math/numbers/rationals/rational.js";
|
|
4
4
|
import { randfloat } from "../../../../math/utils/random/randfloat.js";
|
|
5
5
|
import { randint } from "../../../../math/utils/random/randint.js";
|
|
6
|
-
import { NodeConstructor, } from "../../../../tree/nodes/nodeConstructor.js";
|
|
6
|
+
import { NodeConstructor, reifyAlgebraic, } from "../../../../tree/nodes/nodeConstructor.js";
|
|
7
7
|
import { add } from "../../../../tree/nodes/operators/addNode.js";
|
|
8
|
+
import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
|
|
8
9
|
import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
9
10
|
import { coinFlip } from "../../../../utils/alea/coinFlip.js";
|
|
10
11
|
import { random } from "../../../../utils/alea/random.js";
|
|
@@ -32,8 +33,38 @@ ${mdTable([xTexs.map((v) => dollarize(v)), yTexs.map((v) => dollarize(v))])}
|
|
|
32
33
|
|
|
33
34
|
`;
|
|
34
35
|
};
|
|
35
|
-
|
|
36
|
-
|
|
36
|
+
const getHint = () => {
|
|
37
|
+
return `Pour passer de la ligne du haut à la ligne du bas, multiplie-t-on toujours par le même nombre ? Si oui, alors c'est un tableau de proportionnalité.`;
|
|
38
|
+
};
|
|
39
|
+
const getCorrection = (identifiers) => {
|
|
40
|
+
const { xValues, yValues, isProportionnal } = identifiers;
|
|
41
|
+
const xs = xValues.map((n) => reifyAlgebraic(n));
|
|
42
|
+
const ys = yValues.map((n) => reifyAlgebraic(n));
|
|
43
|
+
return `On divise les nombres de la deuxième ligne par les nombres de la première ligne. Si on obtient toujours le même résultat, alors c'est un tableau de proportionnalité.
|
|
44
|
+
|
|
45
|
+
- $${ys[0].toTex()}\\div ${xs[0].toTex()} = ${frac(ys[0], xs[0])
|
|
46
|
+
.simplify({
|
|
47
|
+
fractionsToDecimal: true,
|
|
48
|
+
})
|
|
49
|
+
.toTex()}$
|
|
50
|
+
|
|
51
|
+
- $${ys[1].toTex()}\\div ${xs[1].toTex()} = ${frac(ys[1], xs[1])
|
|
52
|
+
.simplify({
|
|
53
|
+
fractionsToDecimal: true,
|
|
54
|
+
})
|
|
55
|
+
.toTex()}$
|
|
56
|
+
|
|
57
|
+
- $${ys[2].toTex()}\\div ${xs[2].toTex()} = ${frac(ys[2], xs[2])
|
|
58
|
+
.simplify({
|
|
59
|
+
fractionsToDecimal: true,
|
|
60
|
+
})
|
|
61
|
+
.toTex()}$
|
|
62
|
+
|
|
63
|
+
${isProportionnal
|
|
64
|
+
? "Puisque tous les résultats sont égaux, c'est bien un tableau de proportionnalité."
|
|
65
|
+
: "Puisque les résultats ne sont pas tous égaux, ce n'est pas un tableau de proportionnalité."}
|
|
66
|
+
`;
|
|
67
|
+
};
|
|
37
68
|
const getKeys = () => {
|
|
38
69
|
return [];
|
|
39
70
|
};
|
|
@@ -85,8 +116,8 @@ const getQuestionFromIdentifiers = (identifiers, opts) => {
|
|
|
85
116
|
keys: getKeys(identifiers),
|
|
86
117
|
answerFormat: "raw",
|
|
87
118
|
identifiers,
|
|
88
|
-
|
|
89
|
-
|
|
119
|
+
hint: getHint(identifiers),
|
|
120
|
+
correction: getCorrection(identifiers),
|
|
90
121
|
style: {
|
|
91
122
|
tableHasNoHeader: true,
|
|
92
123
|
},
|
|
@@ -128,8 +159,7 @@ export const isTableProportionalNonInteger = {
|
|
|
128
159
|
freeTimer: 60,
|
|
129
160
|
getPropositions,
|
|
130
161
|
subject: "Mathématiques",
|
|
131
|
-
|
|
132
|
-
// getCorrection,
|
|
162
|
+
hasHintAndCorrection: true,
|
|
133
163
|
getAnswer,
|
|
134
164
|
answerType: "QCU",
|
|
135
165
|
options,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/ratio/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise.js";
|
|
2
|
+
type Identifiers = {
|
|
3
|
+
ratioType: string;
|
|
4
|
+
situationIndex: number;
|
|
5
|
+
total: number;
|
|
6
|
+
ratio: number[];
|
|
7
|
+
indexPart: number;
|
|
8
|
+
};
|
|
9
|
+
type Options = {
|
|
10
|
+
ratioTypes: string[];
|
|
11
|
+
};
|
|
12
|
+
export declare const partUsingRatio: Exercise<Identifiers, Options>;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=partUsingRatio.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"partUsingRatio.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/ratio/partUsingRatio.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAgBT,MAAM,6BAA6B,CAAC;AA0BrC,KAAK,WAAW,GAAG;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AA2aF,KAAK,OAAO,GAAG;IACb,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AAiBF,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAkBzD,CAAC"}
|