math-exercises 3.0.32 → 3.0.34
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 +2 -1
- package/lib/exercises/exercise.d.ts.map +1 -1
- package/lib/exercises/exercise.js +18 -2
- package/lib/exercises/math/calcul/addAndSub.d.ts.map +1 -1
- package/lib/exercises/math/calcul/addAndSub.js +35 -17
- 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/conversion/hoursToSecond.d.ts +9 -0
- package/lib/exercises/math/conversion/hoursToSecond.d.ts.map +1 -0
- package/lib/exercises/math/conversion/hoursToSecond.js +94 -0
- package/lib/exercises/math/conversion/index.d.ts +1 -0
- package/lib/exercises/math/conversion/index.d.ts.map +1 -1
- package/lib/exercises/math/conversion/index.js +1 -0
- package/lib/exercises/math/dataRepresentations/pieChartReading.d.ts.map +1 -1
- package/lib/exercises/math/dataRepresentations/pieChartReading.js +14 -3
- package/lib/exercises/math/derivation/derivative/thirdDegreeFunctionVariation.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/thirdDegreeFunctionVariation.js +41 -8
- package/lib/exercises/math/derivation/tangent/derivativeNumberReading.d.ts.map +1 -1
- package/lib/exercises/math/derivation/tangent/derivativeNumberReading.js +3 -1
- package/lib/exercises/math/derivation/tangent/derivativeTangentEquationReading.d.ts.map +1 -1
- package/lib/exercises/math/derivation/tangent/derivativeTangentEquationReading.js +3 -1
- package/lib/exercises/math/derivation/tangent/tangentEquations.d.ts.map +1 -1
- package/lib/exercises/math/derivation/tangent/tangentEquations.js +95 -26
- 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/functions/trinoms/equation/solveSecondDegreeEquationByFactorisation.d.ts.map +1 -1
- package/lib/exercises/math/functions/trinoms/equation/solveSecondDegreeEquationFromCano.js +2 -2
- package/lib/exercises/math/functions/trinoms/factoForm/factorizedFormFromRoots.d.ts.map +1 -1
- package/lib/exercises/math/functions/trinoms/factoForm/factorizedFormFromRoots.js +39 -16
- package/lib/exercises/math/functions/trinoms/roots/niceRootsFromDevForm.d.ts.map +1 -1
- package/lib/exercises/math/functions/trinoms/roots/niceRootsFromDevForm.js +35 -16
- package/lib/exercises/math/functions/trinoms/roots/rootsFromDevForm.d.ts.map +1 -1
- package/lib/exercises/math/functions/trinoms/roots/rootsFromDevForm.js +31 -8
- package/lib/exercises/math/functions/trinoms/roots/rootsFromFactorizedForm.d.ts.map +1 -1
- package/lib/exercises/math/functions/trinoms/roots/rootsFromFactorizedForm.js +7 -5
- 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/percent/applyPercent.d.ts.map +1 -1
- package/lib/exercises/math/percent/applyPercent.js +8 -9
- package/lib/exercises/math/percent/averageEvolutionRate.d.ts.map +1 -1
- package/lib/exercises/math/percent/averageEvolutionRate.js +3 -3
- package/lib/exercises/math/percent/findStartValueAfterEvolution.d.ts.map +1 -1
- package/lib/exercises/math/percent/findStartValueAfterEvolution.js +4 -2
- package/lib/exercises/math/percent/percentWritings.js +1 -1
- 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 +15 -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/nodes/numbers/percentNode.d.ts +1 -1
- package/lib/tree/nodes/numbers/percentNode.d.ts.map +1 -1
- package/lib/tree/nodes/numbers/percentNode.js +5 -4
- package/lib/tree/parsers/latexParser.d.ts.map +1 -1
- package/lib/tree/parsers/latexParser.js +21 -4
- package/package.json +2 -1
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { KeyId } from "../types/keyIds.js";
|
|
2
2
|
import { KeyProps } from "../types/keyProps.js";
|
|
3
|
+
export declare const propWhile: (propositions: Proposition[], n: number, doStuff: () => void) => void;
|
|
3
4
|
export declare const addValidProp: (props: Proposition[], statement: string, format?: "tex" | "raw") => void;
|
|
4
5
|
export declare const addWrongProp: (props: Proposition[], statement: string, format?: "tex" | "raw") => void;
|
|
5
6
|
export declare const tryToAddWrongProp: (props: Proposition[], statement: string, format?: "tex" | "raw") => void;
|
|
6
|
-
export declare const shuffleProps: (props: Proposition[], n: number) => Proposition[];
|
|
7
|
+
export declare const shuffleProps: (props: Proposition[], n: number, validAnswersCount?: number) => Proposition[];
|
|
7
8
|
export declare enum GeneratorOptionTarget {
|
|
8
9
|
generation = "generation",
|
|
9
10
|
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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Aa,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"}
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
import { shuffle } from "../utils/alea/shuffle.js";
|
|
2
2
|
import { uuid } from "uuidv4";
|
|
3
|
+
export const propWhile = (propositions, n, doStuff) => {
|
|
4
|
+
let i = 0;
|
|
5
|
+
while (propositions.length < n) {
|
|
6
|
+
if (i > 1000)
|
|
7
|
+
throw new Error("Prop Loop infinite");
|
|
8
|
+
doStuff();
|
|
9
|
+
i++;
|
|
10
|
+
}
|
|
11
|
+
};
|
|
3
12
|
export const addValidProp = (props, statement, format = "tex") => {
|
|
4
13
|
props.push({
|
|
5
14
|
id: uuid(),
|
|
@@ -26,8 +35,15 @@ export const tryToAddWrongProp = (props, statement, format = "tex") => {
|
|
|
26
35
|
});
|
|
27
36
|
}
|
|
28
37
|
};
|
|
29
|
-
export const shuffleProps = (props, n) => {
|
|
30
|
-
|
|
38
|
+
export const shuffleProps = (props, n, validAnswersCount) => {
|
|
39
|
+
if (validAnswersCount) {
|
|
40
|
+
return shuffle([
|
|
41
|
+
...props.slice(0, validAnswersCount),
|
|
42
|
+
...shuffle(props.slice(validAnswersCount)).slice(0, n - 1),
|
|
43
|
+
]);
|
|
44
|
+
}
|
|
45
|
+
else
|
|
46
|
+
return shuffle([props[0], ...shuffle(props.slice(1)).slice(0, n - 1)]);
|
|
31
47
|
};
|
|
32
48
|
export var GeneratorOptionTarget;
|
|
33
49
|
(function (GeneratorOptionTarget) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addAndSub.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/calcul/addAndSub.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"addAndSub.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/calcul/addAndSub.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,QAAQ,EAWT,MAAM,mBAAmB,CAAC;AAgD3B,KAAK,WAAW,GAAG;IAAE,OAAO,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC;AAkBzC,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,WAAW,CAcnD,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { getDistinctQuestions } from "../../../exercises/utils/getDistinctQuestions.js";
|
|
2
|
+
import { numberVEA } from "../../../exercises/vea/numberVEA.js";
|
|
2
3
|
import { randint } from "../../../math/utils/random/randint.js";
|
|
3
4
|
import { NumberNode } from "../../../tree/nodes/numbers/numberNode.js";
|
|
4
5
|
import { AddNode } from "../../../tree/nodes/operators/addNode.js";
|
|
@@ -7,26 +8,44 @@ import { addValidProp, tryToAddWrongProp, } from "../../exercise.js";
|
|
|
7
8
|
/**
|
|
8
9
|
* a±b±c±d
|
|
9
10
|
*/
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const numbers = [];
|
|
13
|
-
for (let i = 0; i < nbOperations + 1; i++) {
|
|
14
|
-
numbers.push(randint(-15, 15, [0]));
|
|
15
|
-
}
|
|
11
|
+
const getStatementNode = (identifiers) => {
|
|
12
|
+
const { numbers } = identifiers;
|
|
16
13
|
const allNumbersNodes = numbers.map((nb) => new NumberNode(nb));
|
|
17
14
|
let statementTree = new AddNode(allNumbersNodes[0], allNumbersNodes[1]);
|
|
18
15
|
for (let i = 2; i < allNumbersNodes.length; i++) {
|
|
19
16
|
statementTree = new AddNode(statementTree, allNumbersNodes[i]);
|
|
20
17
|
}
|
|
18
|
+
return statementTree;
|
|
19
|
+
};
|
|
20
|
+
const getStartStatement = (identifiers) => {
|
|
21
|
+
return getStatementNode(identifiers).toTex();
|
|
22
|
+
};
|
|
23
|
+
const getInstruction = (identifiers) => {
|
|
24
|
+
return `Calculer :
|
|
25
|
+
|
|
26
|
+
$$
|
|
27
|
+
${getStartStatement(identifiers)}
|
|
28
|
+
$$`;
|
|
29
|
+
};
|
|
30
|
+
const getAnswer = (identifiers) => {
|
|
31
|
+
const { numbers } = identifiers;
|
|
21
32
|
const answer = numbers.reduce((a, b) => a + b) + "";
|
|
22
|
-
|
|
33
|
+
return answer;
|
|
34
|
+
};
|
|
35
|
+
const getAddAndSubQuestions = () => {
|
|
36
|
+
const nbOperations = randint(2, 4);
|
|
37
|
+
const numbers = [];
|
|
38
|
+
for (let i = 0; i < nbOperations + 1; i++) {
|
|
39
|
+
numbers.push(randint(-15, 15, [0]));
|
|
40
|
+
}
|
|
41
|
+
const identifiers = { numbers };
|
|
23
42
|
const question = {
|
|
24
|
-
instruction:
|
|
25
|
-
startStatement:
|
|
26
|
-
answer,
|
|
43
|
+
instruction: getInstruction(identifiers),
|
|
44
|
+
startStatement: getStartStatement(identifiers),
|
|
45
|
+
answer: getAnswer(identifiers),
|
|
27
46
|
keys: [],
|
|
28
47
|
answerFormat: "tex",
|
|
29
|
-
identifiers
|
|
48
|
+
identifiers,
|
|
30
49
|
};
|
|
31
50
|
return question;
|
|
32
51
|
};
|
|
@@ -40,17 +59,13 @@ const getPropositions = (n, { answer }) => {
|
|
|
40
59
|
}
|
|
41
60
|
return shuffle(propositions);
|
|
42
61
|
};
|
|
43
|
-
const isAnswerValid = (
|
|
44
|
-
|
|
45
|
-
const texs = answerTree.toAllValidTexs();
|
|
46
|
-
return texs.includes(studentAns);
|
|
62
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
63
|
+
return numberVEA(ans, answer);
|
|
47
64
|
};
|
|
48
65
|
export const addAndSubExercise = {
|
|
49
66
|
id: "addAndSub",
|
|
50
67
|
connector: "=",
|
|
51
68
|
label: "Additions et soustractions de nombres entiers",
|
|
52
|
-
levels: ["6ème", "5ème"],
|
|
53
|
-
sections: ["Calculs"],
|
|
54
69
|
isSingleStep: true,
|
|
55
70
|
generator: (nb) => getDistinctQuestions(getAddAndSubQuestions, nb),
|
|
56
71
|
qcmTimer: 60,
|
|
@@ -58,4 +73,7 @@ export const addAndSubExercise = {
|
|
|
58
73
|
getPropositions,
|
|
59
74
|
isAnswerValid,
|
|
60
75
|
subject: "Mathématiques",
|
|
76
|
+
getInstruction,
|
|
77
|
+
getAnswer,
|
|
78
|
+
getStartStatement,
|
|
61
79
|
};
|
|
@@ -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
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hoursToSecond.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/conversion/hoursToSecond.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAMrC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAyFF,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,WAAW,CAiB/C,CAAC"}
|