math-exercises 3.0.25 → 3.0.26
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/calculLitteral/equation/equationType1Exercise.js +1 -1
- package/lib/exercises/math/dataRepresentations/functionGraphReading.d.ts +3 -1
- package/lib/exercises/math/dataRepresentations/functionGraphReading.d.ts.map +1 -1
- package/lib/exercises/math/dataRepresentations/functionGraphReading.js +57 -20
- package/lib/exercises/math/dataRepresentations/index.d.ts +1 -0
- package/lib/exercises/math/dataRepresentations/index.d.ts.map +1 -1
- package/lib/exercises/math/dataRepresentations/index.js +1 -1
- package/lib/exercises/math/dataRepresentations/testGen.d.ts.map +1 -1
- package/lib/exercises/math/dataRepresentations/testGen.js +11 -0
- package/lib/exercises/math/percent/findTVA.js +1 -1
- package/lib/index.d.ts +6 -0
- package/lib/index.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -91,7 +91,7 @@ const isAnswerValid = (ans, { a, b }) => {
|
|
|
91
91
|
export const equationType1Exercise = {
|
|
92
92
|
id: "equa1",
|
|
93
93
|
connector: "\\iff",
|
|
94
|
-
label: "
|
|
94
|
+
label: "Résoudre une équation du type $x+a = b$",
|
|
95
95
|
levels: ["4ème", "3ème", "2nde", "CAP", "2ndPro", "1rePro", "1reTech"],
|
|
96
96
|
sections: ["Équations"],
|
|
97
97
|
isSingleStep: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"functionGraphReading.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/dataRepresentations/functionGraphReading.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"functionGraphReading.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/dataRepresentations/functionGraphReading.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;AAerC,KAAK,WAAW,GAAG;IACjB,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AA4HF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAiBtD,CAAC;;AAEF,UAAU;AACV;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsGE"}
|
|
@@ -1,40 +1,60 @@
|
|
|
1
|
-
import { addValidProp, shuffleProps, } from "../../../exercises/exercise.js";
|
|
1
|
+
import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../exercises/exercise.js";
|
|
2
2
|
import { getDistinctQuestions } from "../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { randomColor } from "../../../geogebra/colors.js";
|
|
3
4
|
import { GeogebraConstructor } from "../../../geogebra/geogebraConstructor.js";
|
|
5
|
+
import { approxEqual } from "../../../geogebra/parsers/approxEqual.js";
|
|
4
6
|
import { Affine } from "../../../math/polynomials/affine.js";
|
|
5
7
|
import { randint } from "../../../math/utils/random/randint.js";
|
|
6
8
|
import { round } from "../../../math/utils/round.js";
|
|
7
|
-
|
|
9
|
+
import { valueParser } from "../../../tree/parsers/valueParser.js";
|
|
10
|
+
import { coinFlip } from "../../../utils/alea/coinFlip.js";
|
|
11
|
+
import { handleVEAError } from "../../../utils/errors/handleVEAError.js";
|
|
12
|
+
const getPropositions = (n, { answer, a, b, yValue, isAskingX }) => {
|
|
8
13
|
const propositions = [];
|
|
9
14
|
addValidProp(propositions, answer);
|
|
10
15
|
while (propositions.length < n) {
|
|
11
|
-
|
|
16
|
+
if (isAskingX)
|
|
17
|
+
tryToAddWrongProp(propositions, randint(4, 60) + "");
|
|
18
|
+
else
|
|
19
|
+
tryToAddWrongProp(propositions, 100 * randint(20, 60) + "");
|
|
12
20
|
}
|
|
13
21
|
return shuffleProps(propositions, n);
|
|
14
22
|
};
|
|
15
23
|
const getAnswer = (identifiers) => {
|
|
16
|
-
const { a, b, yValue } = identifiers;
|
|
17
|
-
|
|
24
|
+
const { a, b, yValue, xValue, isAskingX } = identifiers;
|
|
25
|
+
if (isAskingX) {
|
|
26
|
+
return round((yValue - b) / a, 0).frenchify();
|
|
27
|
+
}
|
|
28
|
+
else
|
|
29
|
+
return round(a * xValue + b, 0).frenchify();
|
|
18
30
|
};
|
|
19
31
|
const getInstruction = (identifiers) => {
|
|
20
|
-
const { yValue, a, b } = identifiers;
|
|
32
|
+
const { yValue, a, b, isAskingX, xValue } = identifiers;
|
|
21
33
|
return `La droite $(d_1)$ modélise l'évolution du coût total d'un voyage scolaire en fonction du nombre de participants.
|
|
22
34
|
|
|
23
|
-
|
|
35
|
+
${isAskingX
|
|
36
|
+
? `Si le coût total du voyage est de $${yValue}€$, quel est le nombre de participants ?`
|
|
37
|
+
: `Si le nombre de participants est $${xValue}$, quel est le coût total du voyage ?`}`;
|
|
24
38
|
};
|
|
25
39
|
// const getHint: GetHint<Identifiers> = (identifiers) => {};
|
|
26
40
|
// const getCorrection: GetCorrection<Identifiers> = (identifiers) => {};
|
|
27
41
|
const getGGBOptions = (identifiers) => {
|
|
28
|
-
const { a, b, yValue } = identifiers;
|
|
42
|
+
const { a, b, yValue, isAskingX, xValue } = identifiers;
|
|
29
43
|
const affine = new Affine(a, b);
|
|
30
|
-
const
|
|
44
|
+
const x = xValue ?? (yValue - b) / a;
|
|
45
|
+
const y = yValue ?? a * xValue + b;
|
|
46
|
+
const xText = 4;
|
|
47
|
+
const yText = a * xText + b;
|
|
48
|
+
const color = randomColor();
|
|
31
49
|
const ggb = new GeogebraConstructor({
|
|
32
50
|
commands: [
|
|
33
51
|
`f = Function(${a}*x+${b}, 0, 1000)`,
|
|
34
|
-
`
|
|
35
|
-
`
|
|
52
|
+
`SetColor(f, "${color}")`,
|
|
53
|
+
`T = Text("$(d_1)$", (${xText},${yText}), true, true)`,
|
|
54
|
+
`SetColor(T, "${color}")`,
|
|
36
55
|
`Text("Nombre \\ de \\ participants", (x(Corner(2)),50), true, true, -1)`,
|
|
37
56
|
`Text("Coût \\ en \\ €", (1, y(Corner(4))), true, true)`,
|
|
57
|
+
// `(${xValue},${yValue})`,
|
|
38
58
|
],
|
|
39
59
|
forbidShiftDragZoom: false,
|
|
40
60
|
gridDistance: [2, 500],
|
|
@@ -52,26 +72,43 @@ const getGGBOptions = (identifiers) => {
|
|
|
52
72
|
fontSize: 14,
|
|
53
73
|
});
|
|
54
74
|
const xMin = -2;
|
|
55
|
-
const xMax =
|
|
75
|
+
const xMax = x + 6;
|
|
56
76
|
const xDelta = xMax - xMin;
|
|
57
77
|
const yMin = -100;
|
|
58
|
-
const yMax = Math.max(
|
|
78
|
+
const yMax = Math.max(y + 500, xDelta);
|
|
59
79
|
return ggb.getOptions({
|
|
60
|
-
coords: [-1,
|
|
80
|
+
coords: [-1, x + 6, -100, y + 500],
|
|
61
81
|
});
|
|
62
82
|
};
|
|
63
83
|
const getKeys = (identifiers) => {
|
|
64
84
|
return [];
|
|
65
85
|
};
|
|
66
|
-
const isAnswerValid = (ans, { answer }) => {
|
|
67
|
-
|
|
86
|
+
const isAnswerValid = (ans, { answer, isAskingX }) => {
|
|
87
|
+
try {
|
|
88
|
+
const nbAnswer = answer.unfrenchify();
|
|
89
|
+
const parsed = valueParser(ans);
|
|
90
|
+
if (parsed === false)
|
|
91
|
+
return false;
|
|
92
|
+
return approxEqual(parsed, nbAnswer, isAskingX ? 1 : 200);
|
|
93
|
+
}
|
|
94
|
+
catch (err) {
|
|
95
|
+
return handleVEAError(err);
|
|
96
|
+
}
|
|
68
97
|
};
|
|
69
98
|
const getFunctionGraphReadingQuestion = (opts) => {
|
|
70
99
|
const b = randint(0, 2000);
|
|
71
100
|
const randPoint = [2 * randint(5, 20), 3000 + 500 * randint(1, 7)];
|
|
72
|
-
const
|
|
73
|
-
|
|
74
|
-
|
|
101
|
+
const isAskingX = coinFlip();
|
|
102
|
+
let yValue;
|
|
103
|
+
let xValue;
|
|
104
|
+
const a = (randPoint[1] - b) / randPoint[0];
|
|
105
|
+
if (isAskingX) {
|
|
106
|
+
yValue = randPoint[1];
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
xValue = randPoint[0];
|
|
110
|
+
}
|
|
111
|
+
const identifiers = { a, b, yValue, isAskingX, xValue };
|
|
75
112
|
const question = {
|
|
76
113
|
answer: getAnswer(identifiers),
|
|
77
114
|
instruction: getInstruction(identifiers),
|
|
@@ -86,7 +123,7 @@ const getFunctionGraphReadingQuestion = (opts) => {
|
|
|
86
123
|
};
|
|
87
124
|
export const functionGraphReading = {
|
|
88
125
|
id: "functionGraphReading",
|
|
89
|
-
label: "",
|
|
126
|
+
label: "Lire le graphique d'une fonction",
|
|
90
127
|
isSingleStep: true,
|
|
91
128
|
generator: (nb, opts) => getDistinctQuestions(() => getFunctionGraphReadingQuestion(opts), nb),
|
|
92
129
|
qcmTimer: 60,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/dataRepresentations/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/dataRepresentations/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAElC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,sBAAsB,CAAC;AACrC,cAAc,cAAc,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testGen.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/dataRepresentations/testGen.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAKrC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,OAAO,CAAC;CACxB,CAAC;
|
|
1
|
+
{"version":3,"file":"testGen.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/dataRepresentations/testGen.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAKrC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,OAAO,CAAC;CACxB,CAAC;AA8DF,eAAO,MAAM,OAAO,EAAE,QAAQ,CAAC,WAAW,CAkBzC,CAAC"}
|
|
@@ -33,6 +33,12 @@ const isAnswerValid = (ans, { answer }) => {
|
|
|
33
33
|
return handleVEAError(err);
|
|
34
34
|
}
|
|
35
35
|
};
|
|
36
|
+
const getHint = (identifiers) => {
|
|
37
|
+
return "voici l'indice";
|
|
38
|
+
};
|
|
39
|
+
const getCorrection = (identifiers) => {
|
|
40
|
+
return "voici la correction";
|
|
41
|
+
};
|
|
36
42
|
const getTestGenQuestion = (ops) => {
|
|
37
43
|
const identifiers = {
|
|
38
44
|
rand: Math.random(),
|
|
@@ -43,6 +49,8 @@ const getTestGenQuestion = (ops) => {
|
|
|
43
49
|
instruction: getInstruction(identifiers),
|
|
44
50
|
keys: getKeys(identifiers),
|
|
45
51
|
answerFormat: "tex",
|
|
52
|
+
hint: getHint(identifiers),
|
|
53
|
+
correction: getCorrection(identifiers),
|
|
46
54
|
identifiers,
|
|
47
55
|
};
|
|
48
56
|
return question;
|
|
@@ -61,4 +69,7 @@ export const testGen = {
|
|
|
61
69
|
getAnswer,
|
|
62
70
|
isQCM: true,
|
|
63
71
|
answerType: "QCM",
|
|
72
|
+
hasHintAndCorrection: true,
|
|
73
|
+
getHint,
|
|
74
|
+
getCorrection,
|
|
64
75
|
};
|
|
@@ -20,7 +20,7 @@ const getAnswer = ({ ht, ttc, tva }) => {
|
|
|
20
20
|
return tva.frenchify() + "\\%";
|
|
21
21
|
};
|
|
22
22
|
const getInstruction = ({ ht, ttc }) => {
|
|
23
|
-
return `Le prix HT d'un objet est $${ht.frenchify()}€$ et son prix TTC est $${ttc.frenchify()}€$. Quel est le taux de TVA ? (arrondir au
|
|
23
|
+
return `Le prix HT d'un objet est $${ht.frenchify()}€$ et son prix TTC est $${ttc.frenchify()}€$. Quel est le taux de TVA ? (arrondir au dixième de pourcentage)`;
|
|
24
24
|
};
|
|
25
25
|
const getHint = (identifiers) => {
|
|
26
26
|
return `Le taux de TVA est donnée par :
|
package/lib/index.d.ts
CHANGED
|
@@ -1885,6 +1885,12 @@ declare const mathExercises: (Exercise<{
|
|
|
1885
1885
|
}, {}> | Exercise<{
|
|
1886
1886
|
values: number[][];
|
|
1887
1887
|
caseAsked: number;
|
|
1888
|
+
}, {}> | Exercise<{
|
|
1889
|
+
isAskingX: boolean;
|
|
1890
|
+
xValue?: number;
|
|
1891
|
+
yValue?: number;
|
|
1892
|
+
a: number;
|
|
1893
|
+
b: number;
|
|
1888
1894
|
}, {}> | Exercise<{
|
|
1889
1895
|
points: number[][];
|
|
1890
1896
|
labels: string[];
|
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;AAG7D,OAAO,4BAA4B,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/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;AAG7D,OAAO,4BAA4B,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,QAAA,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;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