math-exercises 3.0.32 → 3.0.33
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 -1
- package/lib/exercises/exercise.d.ts.map +1 -1
- package/lib/exercises/exercise.js +9 -2
- package/lib/exercises/math/calcul/arithmetics/commonDivisorsList.d.ts.map +1 -1
- package/lib/exercises/math/calcul/arithmetics/commonDivisorsList.js +35 -13
- package/lib/exercises/math/calcul/arithmetics/divisibiltyCriteria.d.ts.map +1 -1
- package/lib/exercises/math/calcul/arithmetics/divisibiltyCriteria.js +1 -4
- package/lib/exercises/math/calcul/arithmetics/primeNumbers.d.ts +5 -2
- package/lib/exercises/math/calcul/arithmetics/primeNumbers.d.ts.map +1 -1
- package/lib/exercises/math/calcul/arithmetics/primeNumbers.js +125 -48
- package/lib/exercises/math/calculLitteral/distributivity/canonicalFormDevelopment.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/distributivity/canonicalFormDevelopment.js +57 -20
- package/lib/exercises/math/functions/affines/leadingCoefficient.d.ts +4 -1
- package/lib/exercises/math/functions/affines/leadingCoefficient.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/leadingCoefficient.js +21 -7
- package/lib/exercises/math/functions/affines/leadingCoefficientCalculV1.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/leadingCoefficientCalculV1.js +63 -18
- package/lib/exercises/math/functions/affines/leadingCoefficientCalculV2.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/leadingCoefficientCalculV2.js +1 -1
- package/lib/exercises/math/functions/parity/parityFromGraph.d.ts.map +1 -1
- package/lib/exercises/math/functions/parity/parityFromGraph.js +0 -4
- package/lib/exercises/math/geometry/triangles/index.d.ts +1 -0
- package/lib/exercises/math/geometry/triangles/index.d.ts.map +1 -1
- package/lib/exercises/math/geometry/triangles/index.js +1 -1
- package/lib/exercises/math/geometry/triangles/triangleNature.d.ts +1 -0
- package/lib/exercises/math/geometry/triangles/triangleNature.d.ts.map +1 -1
- package/lib/exercises/math/geometry/triangles/triangleNature.js +57 -18
- package/lib/exercises/math/trigonometry/mainAngleMeasure.d.ts.map +1 -1
- package/lib/exercises/math/trigonometry/mainAngleMeasure.js +0 -1
- package/lib/index.d.ts +11 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/math/geometry/angle.d.ts +1 -0
- package/lib/math/geometry/angle.d.ts.map +1 -1
- package/lib/math/geometry/spaceVector.d.ts.map +1 -1
- package/lib/math/geometry/spaceVector.js +2 -2
- package/lib/math/geometry/triangles/equilateralTriangle.d.ts +1 -0
- package/lib/math/geometry/triangles/equilateralTriangle.d.ts.map +1 -1
- package/lib/math/geometry/triangles/equilateralTriangle.js +6 -0
- package/lib/math/geometry/triangles/isoceleTriangle.d.ts +3 -1
- package/lib/math/geometry/triangles/isoceleTriangle.d.ts.map +1 -1
- package/lib/math/geometry/triangles/isoceleTriangle.js +7 -2
- package/lib/playground.d.ts.map +1 -1
- package/lib/playground.js +3 -1
- package/lib/tests/megaExosTest.d.ts +3 -0
- package/lib/tests/megaExosTest.d.ts.map +1 -0
- package/lib/tests/megaExosTest.js +6 -0
- package/lib/tests/megaml.test.d.ts +2 -0
- package/lib/tests/megaml.test.d.ts.map +1 -0
- package/lib/tests/megaml.test.js +10 -0
- package/lib/tests/questionTest.js +1 -1
- package/lib/tree/parsers/latexParser.d.ts.map +1 -1
- package/lib/tree/parsers/latexParser.js +10 -4
- package/package.json +2 -1
|
@@ -3,7 +3,7 @@ import { KeyProps } from "../types/keyProps.js";
|
|
|
3
3
|
export declare const addValidProp: (props: Proposition[], statement: string, format?: "tex" | "raw") => void;
|
|
4
4
|
export declare const addWrongProp: (props: Proposition[], statement: string, format?: "tex" | "raw") => void;
|
|
5
5
|
export declare const tryToAddWrongProp: (props: Proposition[], statement: string, format?: "tex" | "raw") => void;
|
|
6
|
-
export declare const shuffleProps: (props: Proposition[], n: number) => Proposition[];
|
|
6
|
+
export declare const shuffleProps: (props: Proposition[], n: number, validAnswersCount?: number) => Proposition[];
|
|
7
7
|
export declare enum GeneratorOptionTarget {
|
|
8
8
|
generation = "generation",
|
|
9
9
|
vea = "vea",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exercise.d.ts","sourceRoot":"","sources":["../../src/exercises/exercise.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAInD,eAAO,MAAM,YAAY,UAChB,WAAW,EAAE,aACT,MAAM,WACT,KAAK,GAAG,KAAK,SAQtB,CAAC;AACF,eAAO,MAAM,YAAY,UAChB,WAAW,EAAE,aACT,MAAM,WACT,KAAK,GAAG,KAAK,SAQtB,CAAC;AACF,eAAO,MAAM,iBAAiB,UACrB,WAAW,EAAE,aACT,MAAM,WACT,KAAK,GAAG,KAAK,SAUtB,CAAC;AAEF,eAAO,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"exercise.d.ts","sourceRoot":"","sources":["../../src/exercises/exercise.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAInD,eAAO,MAAM,YAAY,UAChB,WAAW,EAAE,aACT,MAAM,WACT,KAAK,GAAG,KAAK,SAQtB,CAAC;AACF,eAAO,MAAM,YAAY,UAChB,WAAW,EAAE,aACT,MAAM,WACT,KAAK,GAAG,KAAK,SAQtB,CAAC;AACF,eAAO,MAAM,iBAAiB,UACrB,WAAW,EAAE,aACT,MAAM,WACT,KAAK,GAAG,KAAK,SAUtB,CAAC;AAEF,eAAO,MAAM,YAAY,UAChB,WAAW,EAAE,KACjB,MAAM,sBACW,MAAM,kBAQ3B,CAAC;AAEF,oBAAY,qBAAqB;IAC/B,UAAU,eAAe;IACzB,GAAG,QAAQ;IACX,GAAG,QAAQ;IACX,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M,CAAC;QAAC,KAAK,EAAE,OAAO,CAAA;KAAE,CAAC;CAC3E;AAED,MAAM,MAAM,SAAS,GACjB,MAAM,GACN,MAAM,GACN,MAAM,GACN,MAAM,GACN,MAAM,GACN,SAAS,GACT,QAAQ,GACR,QAAQ,GACR,SAAS,GACT,UAAU,GACV,SAAS,GACT,UAAU,GACV,KAAK,GACL,QAAQ,GACR,QAAQ,GACR,SAAS,CAAC;AAEd,MAAM,MAAM,WAAW,GACnB,OAAO,GACP,cAAc,GACd,iBAAiB,GACjB,SAAS,GACT,8BAA8B,GAC9B,aAAa,GACb,YAAY,GACZ,SAAS,GACT,0BAA0B,GAC1B,WAAW,GACX,2BAA2B,GAC3B,eAAe,GACf,eAAe,GACf,kBAAkB,GAClB,WAAW,GACX,mBAAmB,GACnB,wBAAwB,GACxB,WAAW,GACX,uBAAuB,GACvB,uBAAuB,GACvB,aAAa,GACb,aAAa,GACb,SAAS,GACT,qBAAqB,GACrB,oBAAoB,GACpB,UAAU,GACV,mBAAmB,GACnB,YAAY,GACZ,cAAc,GACd,YAAY,GACZ,cAAc,GACd,kBAAkB,GAClB,kBAAkB,GAClB,QAAQ,GACR,YAAY,GACZ,QAAQ,GACR,iBAAiB,GACjB,cAAc,GACd,cAAc,GACd,QAAQ,GACR,UAAU,GACV,uBAAuB,GACvB,oBAAoB,GACpB,eAAe,GACf,gBAAgB,GAChB,UAAU,CAAC;AAEf,MAAM,MAAM,SAAS,GACjB,mBAAmB,GACnB,sBAAsB,GACtB,QAAQ,GACR,kBAAkB,GAClB,WAAW,GACX,SAAS,GACT,cAAc,GACd,+CAA+C,GAC/C,OAAO,GACP,KAAK,GACL,wBAAwB,GACxB,SAAS,GACT,KAAK,GACL,aAAa,GACb,4BAA4B,GAC5B,oBAAoB,GACpB,WAAW,GACX,iBAAiB,GACjB,SAAS,CAAC"}
|
|
@@ -26,8 +26,15 @@ export const tryToAddWrongProp = (props, statement, format = "tex") => {
|
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
28
|
};
|
|
29
|
-
export const shuffleProps = (props, n) => {
|
|
30
|
-
|
|
29
|
+
export const shuffleProps = (props, n, validAnswersCount) => {
|
|
30
|
+
if (validAnswersCount) {
|
|
31
|
+
return shuffle([
|
|
32
|
+
...props.slice(0, validAnswersCount),
|
|
33
|
+
...shuffle(props.slice(validAnswersCount)).slice(0, n - 1),
|
|
34
|
+
]);
|
|
35
|
+
}
|
|
36
|
+
else
|
|
37
|
+
return shuffle([props[0], ...shuffle(props.slice(1)).slice(0, n - 1)]);
|
|
31
38
|
};
|
|
32
39
|
export var GeneratorOptionTarget;
|
|
33
40
|
(function (GeneratorOptionTarget) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commonDivisorsList.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/arithmetics/commonDivisorsList.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"commonDivisorsList.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/arithmetics/commonDivisorsList.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AASrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAwGF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,CAkBpD,CAAC"}
|
|
@@ -6,22 +6,28 @@ import { isPrime } from "../../../../math/utils/arithmetic/isPrime.js";
|
|
|
6
6
|
import { randint } from "../../../../math/utils/random/randint.js";
|
|
7
7
|
import { coinFlip } from "../../../../utils/alea/coinFlip.js";
|
|
8
8
|
import { doWhile } from "../../../../utils/doWhile.js";
|
|
9
|
-
const
|
|
10
|
-
const a
|
|
11
|
-
|
|
9
|
+
const getInstruction = (identifiers) => {
|
|
10
|
+
const { a, b } = identifiers;
|
|
11
|
+
return `Donner la liste des diviseurs communs à $${a}$ et $${b}$ (séparer les valeurs par des point-virgules).`;
|
|
12
|
+
};
|
|
13
|
+
const getAnswer = (identifiers) => {
|
|
14
|
+
const { a, b } = identifiers;
|
|
12
15
|
const divisorsA = dividersOf(a);
|
|
13
16
|
const divisorsB = dividersOf(b);
|
|
14
17
|
const res = [];
|
|
15
18
|
divisorsA.forEach((n) => divisorsB.includes(n) && res.push(n));
|
|
16
19
|
res.sort((a, b) => a - b);
|
|
17
20
|
const answer = res.join(";");
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
return answer;
|
|
22
|
+
};
|
|
23
|
+
const getHint = (identifiers) => {
|
|
24
|
+
return `Détermine la liste des diviseurs de chaque nombre, puis identifie ceux qu'ils ont en commun.`;
|
|
25
|
+
};
|
|
26
|
+
const getCorrection = (identifiers) => {
|
|
27
|
+
const { a, b } = identifiers;
|
|
28
|
+
const divisorsA = dividersOf(a);
|
|
29
|
+
const divisorsB = dividersOf(b);
|
|
30
|
+
return `Les diviseurs de $${a}$ sont :
|
|
25
31
|
|
|
26
32
|
$$
|
|
27
33
|
${divisorsA.join(";")}
|
|
@@ -36,10 +42,22 @@ $$
|
|
|
36
42
|
Les diviseurs communs à $${a}$ et $${b}$ sont donc :
|
|
37
43
|
|
|
38
44
|
$$
|
|
39
|
-
${
|
|
45
|
+
${getAnswer(identifiers)}
|
|
40
46
|
$$
|
|
41
|
-
|
|
42
|
-
|
|
47
|
+
`;
|
|
48
|
+
};
|
|
49
|
+
const getCommonDivisorsListQuestion = () => {
|
|
50
|
+
const a = doWhile(() => randint(30, 150), (x) => isPrime(x));
|
|
51
|
+
const b = doWhile(() => randint(30, 150), (x) => x === a || gcd(a, x) === 1);
|
|
52
|
+
const identifiers = { a, b };
|
|
53
|
+
const question = {
|
|
54
|
+
answer: getAnswer(identifiers),
|
|
55
|
+
instruction: getInstruction(identifiers),
|
|
56
|
+
keys: ["semicolon"],
|
|
57
|
+
answerFormat: "tex",
|
|
58
|
+
hint: getHint(identifiers),
|
|
59
|
+
correction: getCorrection(identifiers),
|
|
60
|
+
identifiers,
|
|
43
61
|
};
|
|
44
62
|
return question;
|
|
45
63
|
};
|
|
@@ -82,4 +100,8 @@ export const commonDivisorsList = {
|
|
|
82
100
|
isAnswerValid,
|
|
83
101
|
subject: "Mathématiques",
|
|
84
102
|
hasHintAndCorrection: true,
|
|
103
|
+
getHint,
|
|
104
|
+
getInstruction,
|
|
105
|
+
getAnswer,
|
|
106
|
+
getCorrection,
|
|
85
107
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"divisibiltyCriteria.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/arithmetics/divisibiltyCriteria.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;AAKrC,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;
|
|
1
|
+
{"version":3,"file":"divisibiltyCriteria.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/arithmetics/divisibiltyCriteria.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;AAKrC,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAuFF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,WAAW,CAmBrD,CAAC"}
|
|
@@ -57,9 +57,6 @@ const getCorrection = ({ nb, divisor }) => {
|
|
|
57
57
|
const getKeys = (identifiers) => {
|
|
58
58
|
return [];
|
|
59
59
|
};
|
|
60
|
-
const isAnswerValid = (ans, { answer }) => {
|
|
61
|
-
return ans === answer;
|
|
62
|
-
};
|
|
63
60
|
const getDivisibiltyCriteriaQuestion = () => {
|
|
64
61
|
/**
|
|
65
62
|
* 2x
|
|
@@ -94,11 +91,11 @@ export const divisibiltyCriteria = {
|
|
|
94
91
|
freeTimer: 60,
|
|
95
92
|
ggbTimer: 60,
|
|
96
93
|
getPropositions,
|
|
97
|
-
isAnswerValid,
|
|
98
94
|
subject: "Mathématiques",
|
|
99
95
|
getHint,
|
|
100
96
|
getCorrection,
|
|
101
97
|
getAnswer,
|
|
98
|
+
getInstruction,
|
|
102
99
|
hasHintAndCorrection: true,
|
|
103
100
|
answerType: "QCU",
|
|
104
101
|
getKeys,
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { Exercise } from "../../../exercise.js";
|
|
2
2
|
type Identifiers = {
|
|
3
|
-
|
|
3
|
+
nb: number;
|
|
4
4
|
};
|
|
5
|
-
|
|
5
|
+
type Options = {
|
|
6
|
+
usePowers?: boolean;
|
|
7
|
+
};
|
|
8
|
+
export declare const primeNumbers: Exercise<Identifiers, Options>;
|
|
6
9
|
export {};
|
|
7
10
|
//# sourceMappingURL=primeNumbers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"primeNumbers.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/arithmetics/primeNumbers.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"primeNumbers.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/arithmetics/primeNumbers.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,QAAQ,EAgBT,MAAM,sBAAsB,CAAC;AAuB9B,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AA+JF,KAAK,OAAO,GAAG;IACb,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAWF,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAkBvD,CAAC"}
|
|
@@ -1,18 +1,60 @@
|
|
|
1
1
|
import { randint } from "../../../../math/utils/random/randint.js";
|
|
2
|
-
import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../exercise.js";
|
|
2
|
+
import { GeneratorOptionTarget, GeneratorOptionType, addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../exercise.js";
|
|
3
3
|
import { getDistinctQuestions } from "../../../utils/getDistinctQuestions.js";
|
|
4
|
-
import {
|
|
5
|
-
import { MultiplyNode } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
6
|
-
import {
|
|
4
|
+
import { isNumberNode, } from "../../../../tree/nodes/numbers/numberNode.js";
|
|
5
|
+
import { isMultiplyNode, MultiplyNode, } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
6
|
+
import { isPowerNode, power, } from "../../../../tree/nodes/operators/powerNode.js";
|
|
7
7
|
import { operatorComposition } from "../../../../tree/utilities/operatorComposition.js";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
9
|
+
import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
|
|
10
|
+
import { isPrime } from "../../../../math/utils/arithmetic/isPrime.js";
|
|
11
|
+
import { isInt } from "../../../../utils/isInt.js";
|
|
12
|
+
import { primeDecomposition } from "../../../../math/utils/arithmetic/primeDecomposition.js";
|
|
13
|
+
const rebuildIdentifiers = (oldIds) => {
|
|
14
|
+
if (oldIds.nb)
|
|
15
|
+
return oldIds;
|
|
16
|
+
return {
|
|
17
|
+
nb: oldIds.chosenNumbers.reduce((acc, curr) => acc * curr),
|
|
18
|
+
};
|
|
19
|
+
};
|
|
14
20
|
const primes = [2, 3, 5, 7, 11];
|
|
15
|
-
const
|
|
21
|
+
const getStatementNode = (identifiers) => {
|
|
22
|
+
const { nb } = identifiers;
|
|
23
|
+
return nb.toTree();
|
|
24
|
+
};
|
|
25
|
+
const getStartStatement = (identifiers, opts) => {
|
|
26
|
+
return getStatementNode(identifiers).toTex();
|
|
27
|
+
};
|
|
28
|
+
const getInstruction = (identifiers, opts) => {
|
|
29
|
+
return `Donner la décomposition en nombres premiers de :
|
|
30
|
+
|
|
31
|
+
$$
|
|
32
|
+
${getStartStatement(identifiers)}
|
|
33
|
+
$$`;
|
|
34
|
+
};
|
|
35
|
+
const getAnswer = (identifiers, opts) => {
|
|
36
|
+
const { nb } = identifiers;
|
|
37
|
+
const decomp = primeDecomposition(nb);
|
|
38
|
+
const usePowers = opts?.usePowers;
|
|
39
|
+
let nodes = [];
|
|
40
|
+
if (usePowers) {
|
|
41
|
+
for (const d of decomp) {
|
|
42
|
+
if (d.power === 1)
|
|
43
|
+
nodes.push(d.value.toTree());
|
|
44
|
+
else
|
|
45
|
+
nodes.push(power(d.value, d.power));
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
for (const d of decomp) {
|
|
50
|
+
for (let i = 0; i < d.power; i++) {
|
|
51
|
+
nodes.push(d.value.toTree());
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return operatorComposition(MultiplyNode, nodes).toTex();
|
|
56
|
+
};
|
|
57
|
+
const getPrimeNumbers = (opts) => {
|
|
16
58
|
const rand = randint(3, 5);
|
|
17
59
|
let chosenNumbers = [];
|
|
18
60
|
let elevenCount = 0;
|
|
@@ -24,28 +66,28 @@ const getPrimeNumbers = () => {
|
|
|
24
66
|
temp = randint(0, 5);
|
|
25
67
|
chosenNumbers.push(primes[temp]);
|
|
26
68
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
const numberNodes = chosenNumbers.map((nb) => new NumberNode(nb));
|
|
30
|
-
let tree = new MultiplyNode(numberNodes[numberNodes.length - 2], numberNodes[numberNodes.length - 1]);
|
|
31
|
-
for (let i = numberNodes.length - 3; i > -1; i--) {
|
|
32
|
-
tree = new MultiplyNode(numberNodes[i], tree);
|
|
33
|
-
}
|
|
34
|
-
let answer = tree.toTex();
|
|
69
|
+
// chosenNumbers = chosenNumbers.sort((a, b) => a - b);
|
|
70
|
+
const identifiers = { nb: chosenNumbers.reduce((acc, curr) => acc * curr) };
|
|
35
71
|
const question = {
|
|
36
|
-
instruction:
|
|
37
|
-
startStatement:
|
|
38
|
-
answer,
|
|
72
|
+
instruction: getInstruction(identifiers, opts),
|
|
73
|
+
startStatement: getStartStatement(identifiers, opts),
|
|
74
|
+
answer: getAnswer(identifiers, opts),
|
|
39
75
|
keys: [],
|
|
40
76
|
answerFormat: "tex",
|
|
41
|
-
identifiers
|
|
77
|
+
identifiers,
|
|
42
78
|
};
|
|
43
79
|
return question;
|
|
44
80
|
};
|
|
45
|
-
const getPropositions = (n, { answer,
|
|
81
|
+
const getPropositions = (n, { answer, nb }, opts) => {
|
|
46
82
|
const propositions = [];
|
|
47
83
|
addValidProp(propositions, answer);
|
|
48
|
-
const
|
|
84
|
+
const decomp = primeDecomposition(nb);
|
|
85
|
+
const wrongFactors = [];
|
|
86
|
+
for (const d of decomp) {
|
|
87
|
+
for (let i = 0; i < d.power; i++) {
|
|
88
|
+
wrongFactors.push(d.value);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
49
91
|
while (propositions.length < n) {
|
|
50
92
|
let wrongFactor, newFactor, randomIndex, wrongAnswer;
|
|
51
93
|
randomIndex = randint(0, wrongFactors.length);
|
|
@@ -56,6 +98,7 @@ const getPropositions = (n, { answer, chosenNumbers }) => {
|
|
|
56
98
|
newFactor = primes[temp];
|
|
57
99
|
}
|
|
58
100
|
wrongFactors[randomIndex] = newFactor;
|
|
101
|
+
wrongFactors.sort((a, b) => a - b);
|
|
59
102
|
wrongAnswer = `${wrongFactors[0]}`;
|
|
60
103
|
for (let j = 1; j < wrongFactors.length; j++) {
|
|
61
104
|
wrongAnswer += `\\times` + wrongFactors[j];
|
|
@@ -64,40 +107,74 @@ const getPropositions = (n, { answer, chosenNumbers }) => {
|
|
|
64
107
|
}
|
|
65
108
|
return shuffleProps(propositions, n);
|
|
66
109
|
};
|
|
67
|
-
const isAnswerValid = (ans, {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
if (
|
|
72
|
-
return;
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
110
|
+
const isAnswerValid = (ans, { answer, nb }, opts) => {
|
|
111
|
+
try {
|
|
112
|
+
//? aucune idée de comment, mais les élèves envoient parfois des espaces
|
|
113
|
+
const parsed = parseAlgebraic(ans.replaceAll("\\ ", ""));
|
|
114
|
+
if (!isMultiplyNode(parsed))
|
|
115
|
+
return false;
|
|
116
|
+
const externals = [];
|
|
117
|
+
const recur = (node) => {
|
|
118
|
+
if (isMultiplyNode(node)) {
|
|
119
|
+
recur(node.leftChild);
|
|
120
|
+
recur(node.rightChild);
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
externals.push(node);
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
recur(parsed);
|
|
127
|
+
const nbs = [];
|
|
128
|
+
for (const node of externals) {
|
|
129
|
+
if (isNumberNode(node)) {
|
|
130
|
+
if (!isPrime(node.value))
|
|
131
|
+
return false;
|
|
132
|
+
nbs.push(node.value);
|
|
133
|
+
}
|
|
134
|
+
else if (isPowerNode(node)) {
|
|
135
|
+
if (!isNumberNode(node.leftChild) || !isPrime(node.leftChild.value)) {
|
|
136
|
+
return false;
|
|
137
|
+
}
|
|
138
|
+
if (!isNumberNode(node.rightChild) || !isInt(node.rightChild.value))
|
|
139
|
+
return false;
|
|
140
|
+
for (let i = 0; i < node.rightChild.value; i++) {
|
|
141
|
+
nbs.push(node.leftChild.value);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
return false;
|
|
146
|
+
}
|
|
83
147
|
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
148
|
+
return nbs.reduce((acc, curr) => acc * curr) === nb;
|
|
149
|
+
}
|
|
150
|
+
catch (err) {
|
|
151
|
+
return handleVEAError(err);
|
|
152
|
+
}
|
|
88
153
|
};
|
|
154
|
+
const options = [
|
|
155
|
+
{
|
|
156
|
+
id: "usePowers",
|
|
157
|
+
label: "Utiliser des puissances",
|
|
158
|
+
target: GeneratorOptionTarget.answer,
|
|
159
|
+
type: GeneratorOptionType.checkbox,
|
|
160
|
+
defaultValue: false,
|
|
161
|
+
},
|
|
162
|
+
];
|
|
89
163
|
export const primeNumbers = {
|
|
90
164
|
id: "primeNumbers",
|
|
91
165
|
connector: "=",
|
|
92
166
|
label: "Décomposition en nombres premiers",
|
|
93
|
-
levels: ["5ème", "4ème", "3ème", "2nde"],
|
|
94
|
-
sections: ["Arithmétique"],
|
|
95
167
|
isSingleStep: false,
|
|
96
|
-
generator: (nb) => getDistinctQuestions(getPrimeNumbers, nb, 30),
|
|
168
|
+
generator: (nb, opts) => getDistinctQuestions(() => getPrimeNumbers(opts), nb, 30),
|
|
97
169
|
qcmTimer: 60,
|
|
98
170
|
freeTimer: 60,
|
|
99
171
|
getPropositions,
|
|
100
172
|
isAnswerValid,
|
|
101
173
|
subject: "Mathématiques",
|
|
102
174
|
maxAllowedQuestions: 30,
|
|
175
|
+
getInstruction,
|
|
176
|
+
getAnswer,
|
|
177
|
+
getStartStatement,
|
|
178
|
+
options,
|
|
179
|
+
rebuildIdentifiers,
|
|
103
180
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"canonicalFormDevelopment.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/distributivity/canonicalFormDevelopment.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"canonicalFormDevelopment.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/distributivity/canonicalFormDevelopment.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AA2FF,eAAO,MAAM,wBAAwB,EAAE,QAAQ,CAAC,WAAW,CAmB1D,CAAC"}
|
|
@@ -4,33 +4,57 @@ import { Affine } from "../../../../math/polynomials/affine.js";
|
|
|
4
4
|
import { TrinomConstructor } from "../../../../math/polynomials/trinom.js";
|
|
5
5
|
import { AddNode } from "../../../../tree/nodes/operators/addNode.js";
|
|
6
6
|
import { MultiplyNode } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
7
|
+
import { polynomialParser } from "../../../../tree/parsers/polynomialParser.js";
|
|
8
|
+
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
7
9
|
import { alignTex } from "../../../../utils/latex/alignTex.js";
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
+
const getInstruction = (identifiers) => {
|
|
11
|
+
const { coeffs } = identifiers;
|
|
12
|
+
const trinom = TrinomConstructor.fromCoeffs(coeffs);
|
|
13
|
+
const cano = trinom.getCanonicalForm();
|
|
14
|
+
return `Développer et réduire :
|
|
15
|
+
|
|
16
|
+
$$
|
|
17
|
+
${cano.toTex()}
|
|
18
|
+
$$`;
|
|
19
|
+
};
|
|
20
|
+
const getAnswer = (identifiers) => {
|
|
21
|
+
const { coeffs } = identifiers;
|
|
22
|
+
const trinom = TrinomConstructor.fromCoeffs(coeffs);
|
|
10
23
|
const answer = trinom.toTree().toTex();
|
|
24
|
+
return answer;
|
|
25
|
+
};
|
|
26
|
+
const getHint = (identifiers) => {
|
|
27
|
+
return "Développe d'abord le terme qui est au carré en te servant d'une identité remarquable.";
|
|
28
|
+
};
|
|
29
|
+
const getCorrection = (identifiers) => {
|
|
30
|
+
const { coeffs } = identifiers;
|
|
31
|
+
const trinom = TrinomConstructor.fromCoeffs(coeffs);
|
|
11
32
|
const cano = trinom.getCanonicalForm();
|
|
12
33
|
const a = trinom.a;
|
|
13
34
|
const alpha = trinom.getAlpha();
|
|
14
35
|
const beta = trinom.getBeta();
|
|
36
|
+
return `On a :
|
|
37
|
+
|
|
38
|
+
${alignTex([
|
|
39
|
+
["", cano.toTex()],
|
|
40
|
+
[
|
|
41
|
+
"=",
|
|
42
|
+
new AddNode(new MultiplyNode(a.toTree(), new Affine(1, -alpha).square().toTree()), beta.toTree()).toTex(),
|
|
43
|
+
],
|
|
44
|
+
["=", getAnswer(identifiers)],
|
|
45
|
+
])}`;
|
|
46
|
+
};
|
|
47
|
+
const getCanonicalFormDevelopmentQuestion = () => {
|
|
48
|
+
const trinom = TrinomConstructor.randomCanonical();
|
|
49
|
+
const identifiers = { coeffs: trinom.coefficients };
|
|
15
50
|
const question = {
|
|
16
|
-
answer,
|
|
17
|
-
instruction:
|
|
51
|
+
answer: getAnswer(identifiers),
|
|
52
|
+
instruction: getInstruction(identifiers),
|
|
18
53
|
keys: ["x"],
|
|
19
54
|
answerFormat: "tex",
|
|
20
|
-
identifiers
|
|
21
|
-
hint:
|
|
22
|
-
correction:
|
|
23
|
-
|
|
24
|
-
${alignTex([
|
|
25
|
-
[
|
|
26
|
-
cano.toTex(),
|
|
27
|
-
"=",
|
|
28
|
-
new AddNode(new MultiplyNode(a.toTree(), new Affine(1, -alpha).square().toTree()), beta.toTree()).toTex(),
|
|
29
|
-
],
|
|
30
|
-
["", "=", answer],
|
|
31
|
-
])}
|
|
32
|
-
|
|
33
|
-
`,
|
|
55
|
+
identifiers,
|
|
56
|
+
hint: getHint(identifiers),
|
|
57
|
+
correction: getCorrection(identifiers),
|
|
34
58
|
};
|
|
35
59
|
return question;
|
|
36
60
|
};
|
|
@@ -43,8 +67,17 @@ const getPropositions = (n, { answer }) => {
|
|
|
43
67
|
return shuffleProps(propositions, n);
|
|
44
68
|
};
|
|
45
69
|
const isAnswerValid = (ans, { answer, coeffs }) => {
|
|
46
|
-
|
|
47
|
-
|
|
70
|
+
try {
|
|
71
|
+
const parsed = polynomialParser(ans);
|
|
72
|
+
if (!parsed)
|
|
73
|
+
return false;
|
|
74
|
+
return (parsed
|
|
75
|
+
.simplify({ towardsDistribute: true, forbidFactorize: true })
|
|
76
|
+
.toTex() === answer);
|
|
77
|
+
}
|
|
78
|
+
catch (err) {
|
|
79
|
+
return handleVEAError(err);
|
|
80
|
+
}
|
|
48
81
|
};
|
|
49
82
|
export const canonicalFormDevelopment = {
|
|
50
83
|
id: "canonicalFormDevelopment",
|
|
@@ -60,4 +93,8 @@ export const canonicalFormDevelopment = {
|
|
|
60
93
|
isAnswerValid,
|
|
61
94
|
subject: "Mathématiques",
|
|
62
95
|
hasHintAndCorrection: true,
|
|
96
|
+
getInstruction,
|
|
97
|
+
getAnswer,
|
|
98
|
+
getHint,
|
|
99
|
+
getCorrection,
|
|
63
100
|
};
|
|
@@ -5,6 +5,9 @@ type Identifiers = {
|
|
|
5
5
|
xB: number;
|
|
6
6
|
yB: number;
|
|
7
7
|
};
|
|
8
|
-
|
|
8
|
+
type Options = {
|
|
9
|
+
functionType?: string;
|
|
10
|
+
};
|
|
11
|
+
export declare const leadingCoefficient: Exercise<Identifiers, Options>;
|
|
9
12
|
export {};
|
|
10
13
|
//# sourceMappingURL=leadingCoefficient.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"leadingCoefficient.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/affines/leadingCoefficient.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"leadingCoefficient.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/affines/leadingCoefficient.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAYrC,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAiFF,KAAK,OAAO,GAAG;IACb,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAYF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAiB7D,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { addValidProp, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
|
|
1
|
+
import { GeneratorOptionTarget, GeneratorOptionType, addValidProp, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
|
|
2
2
|
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
3
|
import { rationalVEA } from "../../../../exercises/vea/rationalVEA.js";
|
|
4
4
|
import { randomColor } from "../../../../geogebra/colors.js";
|
|
@@ -35,9 +35,14 @@ const getGGBOptions = (identifiers) => {
|
|
|
35
35
|
coords: ggb.getAdaptedCoords({ xMin, xMax, yMin, yMax }),
|
|
36
36
|
});
|
|
37
37
|
};
|
|
38
|
-
const getLeadingCoefficientQuestion = () => {
|
|
38
|
+
const getLeadingCoefficientQuestion = (opts) => {
|
|
39
39
|
let xA, yA, xB, yB;
|
|
40
|
-
|
|
40
|
+
if (opts?.functionType === "Linéaires") {
|
|
41
|
+
xA = 0;
|
|
42
|
+
yA = 0;
|
|
43
|
+
}
|
|
44
|
+
else
|
|
45
|
+
[xA, yA] = [1, 2].map((el) => randint(-5, 6));
|
|
41
46
|
xB = xA > 0 ? randint(xA - 4, 6, [xA]) : randint(-4, xA + 5, [xA]); // l'écart entre les deux points ne soit pas grand
|
|
42
47
|
yB = yA > 0 ? randint(yA - 4, 6) : randint(-4, yA + 5);
|
|
43
48
|
const identifiers = { xA, xB, yA, yB };
|
|
@@ -65,14 +70,22 @@ const getPropositions = (n, { answer, xA, xB, yA, yB }) => {
|
|
|
65
70
|
const isAnswerValid = (ans, { answer, xA, xB, yA, yB }) => {
|
|
66
71
|
return rationalVEA(ans, answer);
|
|
67
72
|
};
|
|
73
|
+
const options = [
|
|
74
|
+
{
|
|
75
|
+
id: "functionType",
|
|
76
|
+
label: "Type de fonctions",
|
|
77
|
+
target: GeneratorOptionTarget.generation,
|
|
78
|
+
type: GeneratorOptionType.select,
|
|
79
|
+
values: ["Affines", "Linéaires", "Les deux"],
|
|
80
|
+
defaultValue: ["Les deux"],
|
|
81
|
+
},
|
|
82
|
+
];
|
|
68
83
|
export const leadingCoefficient = {
|
|
69
84
|
id: "leadingCoefficient",
|
|
70
85
|
connector: "=",
|
|
71
|
-
label: "Lire le coefficient directeur",
|
|
72
|
-
levels: ["3ème", "2nde", "1reESM", "2ndPro", "1rePro", "1reTech"],
|
|
86
|
+
label: "Lire le coefficient directeur d'une droite",
|
|
73
87
|
isSingleStep: false,
|
|
74
|
-
|
|
75
|
-
generator: (nb) => getDistinctQuestions(getLeadingCoefficientQuestion, nb),
|
|
88
|
+
generator: (nb, opts) => getDistinctQuestions(() => getLeadingCoefficientQuestion(opts), nb),
|
|
76
89
|
qcmTimer: 60,
|
|
77
90
|
freeTimer: 60,
|
|
78
91
|
getPropositions,
|
|
@@ -82,4 +95,5 @@ export const leadingCoefficient = {
|
|
|
82
95
|
getAnswer,
|
|
83
96
|
getInstruction,
|
|
84
97
|
getGGBOptions,
|
|
98
|
+
options,
|
|
85
99
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"leadingCoefficientCalculV1.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/affines/leadingCoefficientCalculV1.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"leadingCoefficientCalculV1.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/affines/leadingCoefficientCalculV1.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAOrC,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AA0GF,eAAO,MAAM,0BAA0B,EAAE,QAAQ,CAAC,WAAW,CAe5D,CAAC"}
|