math-exercises 3.0.141 → 3.0.144
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/exercises/math/calcul/arithmetics/divisibiltyCriteria.d.ts.map +1 -1
- package/lib/exercises/math/calcul/arithmetics/divisibiltyCriteria.js +10 -7
- package/lib/exercises/math/calcul/arithmetics/findLeftoverInContext.d.ts +9 -0
- package/lib/exercises/math/calcul/arithmetics/findLeftoverInContext.d.ts.map +1 -0
- package/lib/exercises/math/calcul/arithmetics/findLeftoverInContext.js +111 -0
- package/lib/exercises/math/calcul/arithmetics/index.d.ts +1 -0
- package/lib/exercises/math/calcul/arithmetics/index.d.ts.map +1 -1
- package/lib/exercises/math/calcul/arithmetics/index.js +1 -0
- package/lib/exercises/math/calcul/fractions/fractionEquality.d.ts +10 -0
- package/lib/exercises/math/calcul/fractions/fractionEquality.d.ts.map +1 -0
- package/lib/exercises/math/calcul/fractions/fractionEquality.js +123 -0
- package/lib/exercises/math/calcul/fractions/index.d.ts +1 -0
- package/lib/exercises/math/calcul/fractions/index.d.ts.map +1 -1
- package/lib/exercises/math/calcul/fractions/index.js +1 -0
- package/lib/exercises/math/calcul/proportionality/isProportionalFromProblem.js +3 -3
- package/lib/exercises/math/calcul/proportionality/rectangleSideAfterReduction.d.ts.map +1 -1
- package/lib/exercises/math/calcul/proportionality/rectangleSideAfterReduction.js +10 -1
- package/lib/exercises/math/calculLitteral/equation/equa4.js +1 -1
- package/lib/exercises/math/calculLitteral/equation/equationFromFrenchDescription.d.ts +10 -0
- package/lib/exercises/math/calculLitteral/equation/equationFromFrenchDescription.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/equation/equationFromFrenchDescription.js +142 -0
- package/lib/exercises/math/calculLitteral/equation/equationFromSentenceExercise.js +3 -3
- package/lib/exercises/math/calculLitteral/equation/equationSimpleSquare.d.ts +4 -1
- package/lib/exercises/math/calculLitteral/equation/equationSimpleSquare.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/equationSimpleSquare.js +32 -9
- package/lib/exercises/math/calculLitteral/equation/index.d.ts +3 -0
- package/lib/exercises/math/calculLitteral/equation/index.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/index.js +3 -0
- package/lib/exercises/math/calculLitteral/equation/proportionEquation.d.ts +11 -0
- package/lib/exercises/math/calculLitteral/equation/proportionEquation.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/equation/proportionEquation.js +152 -0
- package/lib/exercises/math/calculLitteral/equation/solveByFactorizingWithIdRmq3.d.ts +12 -0
- package/lib/exercises/math/calculLitteral/equation/solveByFactorizingWithIdRmq3.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/equation/solveByFactorizingWithIdRmq3.js +197 -0
- package/lib/exercises/math/calculLitteral/factorisation/factoType2.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/factorisation/factoType2.js +30 -4
- package/lib/exercises/math/calculLitteral/factorisation/factoType3.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/factorisation/factoType3.js +30 -4
- package/lib/exercises/math/calculLitteral/factorisation/factoType4.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/factorisation/factoType4.js +30 -5
- package/lib/exercises/math/calculLitteral/ordering/compareAMinusB.js +1 -1
- package/lib/exercises/math/functions/affines/affineAdjustment.js +1 -1
- package/lib/exercises/math/geometry/areas/rightTriangleArea.d.ts.map +1 -1
- package/lib/exercises/math/geometry/areas/rightTriangleArea.js +41 -0
- package/lib/exercises/math/powers/powersOfTenMixOperations.js +1 -1
- package/lib/index.d.ts +27 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/tree/nodes/equations/equalNode.d.ts.map +1 -1
- package/lib/tree/nodes/equations/equalNode.js +4 -2
- package/lib/utils/strings/randomFirstname.d.ts +5 -0
- package/lib/utils/strings/randomFirstname.d.ts.map +1 -0
- package/lib/utils/strings/randomFirstname.js +41 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"divisibiltyCriteria.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/arithmetics/divisibiltyCriteria.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,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,EAcT,MAAM,6BAA6B,CAAC;AAKrC,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AA+FF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,WAAW,CAerD,CAAC"}
|
|
@@ -2,18 +2,21 @@ import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../exer
|
|
|
2
2
|
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
3
|
import { primes } from "../../../../math/numbers/integer/primes.js";
|
|
4
4
|
import { random } from "../../../../utils/alea/random.js";
|
|
5
|
-
const getPropositions = (n, { answer, divisor }) => {
|
|
5
|
+
const getPropositions = (n, { answer, divisor, nb }) => {
|
|
6
6
|
const propositions = [];
|
|
7
7
|
addValidProp(propositions, answer);
|
|
8
|
-
if (divisor !==
|
|
8
|
+
if (divisor !== 2 && nb % 2 !== 0)
|
|
9
9
|
tryToAddWrongProp(propositions, "2");
|
|
10
|
-
if (divisor !==
|
|
10
|
+
if (divisor !== 3 && nb % 3 !== 0)
|
|
11
11
|
tryToAddWrongProp(propositions, "3");
|
|
12
|
-
if (divisor !== 5)
|
|
12
|
+
if (divisor !== 5 && nb % 5 !== 0)
|
|
13
13
|
tryToAddWrongProp(propositions, "5");
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
if (divisor !== 6 && nb % 6 !== 0)
|
|
15
|
+
tryToAddWrongProp(propositions, "6");
|
|
16
|
+
if (divisor !== 9 && nb % 9 !== 0)
|
|
17
|
+
tryToAddWrongProp(propositions, "9");
|
|
18
|
+
if (divisor !== 10 && nb % 10 !== 0)
|
|
19
|
+
tryToAddWrongProp(propositions, "10");
|
|
17
20
|
return shuffleProps(propositions, n);
|
|
18
21
|
};
|
|
19
22
|
const getAnswer = (identifiers) => {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise.js";
|
|
2
|
+
type Identifiers = {
|
|
3
|
+
situation: number;
|
|
4
|
+
total: number;
|
|
5
|
+
divisor: number;
|
|
6
|
+
};
|
|
7
|
+
export declare const findLeftoverInContext: Exercise<Identifiers>;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=findLeftoverInContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"findLeftoverInContext.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/arithmetics/findLeftoverInContext.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAQrC,KAAK,WAAW,GAAG;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAmHF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,WAAW,CAkBvD,CAAC"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { addValidProp, shuffleProps, propWhile, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { numberVEA } from "../../../../exercises/vea/numberVEA.js";
|
|
4
|
+
import { randint } from "../../../../math/utils/random/randint.js";
|
|
5
|
+
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
6
|
+
import { pluralize } from "../../../../utils/strings/pluralize.js";
|
|
7
|
+
import { randomFirstname } from "../../../../utils/strings/randomFirstname.js";
|
|
8
|
+
const getPropositions = (n, { answer, divisor, total }) => {
|
|
9
|
+
const propositions = [];
|
|
10
|
+
addValidProp(propositions, answer);
|
|
11
|
+
tryToAddWrongProp(propositions, Math.floor(total / divisor).frenchify());
|
|
12
|
+
propWhile(propositions, n, () => {
|
|
13
|
+
tryToAddWrongProp(propositions, Math.max(0, (total % divisor) + randint(-3, 3, [0])).frenchify());
|
|
14
|
+
});
|
|
15
|
+
return shuffleProps(propositions, n);
|
|
16
|
+
};
|
|
17
|
+
const getAnswer = (identifiers) => {
|
|
18
|
+
return (identifiers.total % identifiers.divisor).frenchify();
|
|
19
|
+
};
|
|
20
|
+
const getInstruction = (identifiers) => {
|
|
21
|
+
const { divisor, situation, total } = identifiers;
|
|
22
|
+
switch (situation) {
|
|
23
|
+
case 0:
|
|
24
|
+
return `J'ai $${total}$ bonbons. Si je les range dans des sachets de $${divisor}$ bonbons, combien de bonbons ne seront pas dans un sachet ?`;
|
|
25
|
+
case 1:
|
|
26
|
+
return `Une bibliothèque possède $${total}$ livres à stocker dans des boîtes. Chaque boîte doit contenir $${divisor}$ livres. Combien de livres resteront hors des boîtes ?`;
|
|
27
|
+
case 2: {
|
|
28
|
+
const pre = randomFirstname();
|
|
29
|
+
return `${pre.name} possède $${total}$ billes. ${pre.isFeminine ? "Elle" : "Il"} veux remplir des tubes de $${divisor}$ billes chacun. Combien de billes ne seront pas dans un tube ?`;
|
|
30
|
+
}
|
|
31
|
+
case 3:
|
|
32
|
+
return `Un magasin reçoit $${total}$ cartes promotionnelles. Il veut les regrouper en paquets de $${divisor}$ cartes. Combien de cartes ne seront pas dans un paquet ?`;
|
|
33
|
+
case 4:
|
|
34
|
+
default:
|
|
35
|
+
return `J'ai récolté $${total}$ pommes. Je veux les ranger dans des paniers de $${divisor}$ pommes chacun. Combien de pommes ne seront pas dans un panier ?`;
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
const getHint = (identifiers) => {
|
|
39
|
+
return `Écris la division euclidienne de $${identifiers.total}$ par $${identifiers.divisor}$.`;
|
|
40
|
+
};
|
|
41
|
+
const getCorrection = (identifiers) => {
|
|
42
|
+
const { total, divisor, situation } = identifiers;
|
|
43
|
+
const answer = getAnswer(identifiers);
|
|
44
|
+
const objectType = ["bonbon", "livre", "bille", "carte", "pomme"][situation];
|
|
45
|
+
const contentType = ["sachet", "boîte", "tube", "paquet", "panier"][situation];
|
|
46
|
+
const quotient = Math.floor(total / divisor);
|
|
47
|
+
const leftover = total % divisor;
|
|
48
|
+
return `On écrit la division euclidienne de $${identifiers.total}$ par $${identifiers.divisor}$ :
|
|
49
|
+
|
|
50
|
+
$$
|
|
51
|
+
${total} = ${divisor} \\times ${quotient} + ${leftover}
|
|
52
|
+
$$
|
|
53
|
+
|
|
54
|
+
Le reste est $${answer}$.
|
|
55
|
+
|
|
56
|
+
On peut donc faire $${quotient}$ ${pluralize(contentType, quotient)} de $${divisor}$ ${pluralize(objectType, divisor)}, et il va rester $${answer}$ ${pluralize(objectType, total % divisor)}.`;
|
|
57
|
+
};
|
|
58
|
+
const getKeys = () => {
|
|
59
|
+
return [];
|
|
60
|
+
};
|
|
61
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
62
|
+
try {
|
|
63
|
+
return numberVEA(ans, answer);
|
|
64
|
+
}
|
|
65
|
+
catch (err) {
|
|
66
|
+
return handleVEAError(err);
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
const getFindLeftoverInContextQuestion = () => {
|
|
70
|
+
let total = 0;
|
|
71
|
+
let divisor = 0;
|
|
72
|
+
do {
|
|
73
|
+
total = randint(30, 100);
|
|
74
|
+
divisor = randint(3, 20);
|
|
75
|
+
} while (total % divisor === 0);
|
|
76
|
+
const identifiers = {
|
|
77
|
+
situation: randint(0, 5),
|
|
78
|
+
divisor,
|
|
79
|
+
total,
|
|
80
|
+
};
|
|
81
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
82
|
+
};
|
|
83
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
84
|
+
return {
|
|
85
|
+
answer: getAnswer(identifiers),
|
|
86
|
+
instruction: getInstruction(identifiers),
|
|
87
|
+
keys: getKeys(identifiers),
|
|
88
|
+
answerFormat: "tex",
|
|
89
|
+
identifiers,
|
|
90
|
+
hint: getHint(identifiers),
|
|
91
|
+
correction: getCorrection(identifiers),
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
export const findLeftoverInContext = {
|
|
95
|
+
id: "findLeftoverInContext",
|
|
96
|
+
connector: "=",
|
|
97
|
+
label: "Déterminer le reste d'une division euclidienne dans un contexte",
|
|
98
|
+
isSingleStep: true,
|
|
99
|
+
generator: (nb, opts) => getDistinctQuestions(() => getFindLeftoverInContextQuestion(opts), nb),
|
|
100
|
+
qcmTimer: 60,
|
|
101
|
+
freeTimer: 60,
|
|
102
|
+
getPropositions,
|
|
103
|
+
isAnswerValid,
|
|
104
|
+
subject: "Mathématiques",
|
|
105
|
+
getInstruction,
|
|
106
|
+
getHint,
|
|
107
|
+
getCorrection,
|
|
108
|
+
getAnswer,
|
|
109
|
+
getQuestionFromIdentifiers,
|
|
110
|
+
hasHintAndCorrection: true,
|
|
111
|
+
};
|
|
@@ -16,4 +16,5 @@ export * from "./findPrimeInList.js";
|
|
|
16
16
|
export * from "./findRightPrimeDecomposition.js";
|
|
17
17
|
export * from "./primeNumberIdentification.js";
|
|
18
18
|
export * from "./primeNumbersAffirmations.js";
|
|
19
|
+
export * from "./findLeftoverInContext.js";
|
|
19
20
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/arithmetics/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iCAAiC,CAAC;AAChD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kCAAkC,CAAC;AACjD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,+BAA+B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/arithmetics/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iCAAiC,CAAC;AAChD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kCAAkC,CAAC;AACjD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,4BAA4B,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise.js";
|
|
2
|
+
type Identifiers = {
|
|
3
|
+
num1: number;
|
|
4
|
+
num2: number;
|
|
5
|
+
denum1: number;
|
|
6
|
+
denum2: number;
|
|
7
|
+
};
|
|
8
|
+
export declare const fractionEquality: Exercise<Identifiers>;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=fractionEquality.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fractionEquality.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/fractionEquality.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAOrC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAqHF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,WAAW,CAiBlD,CAAC"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { addValidProp, shuffleProps, tryToAddWrongProp,
|
|
2
|
+
// GeneratorOption,
|
|
3
|
+
// GeneratorOptionTarget,
|
|
4
|
+
// GeneratorOptionType,
|
|
5
|
+
} from "../../../../exercises/exercise.js";
|
|
6
|
+
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
7
|
+
import { randint } from "../../../../math/utils/random/randint.js";
|
|
8
|
+
import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
|
|
9
|
+
import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
10
|
+
import { coinFlip } from "../../../../utils/alea/coinFlip.js";
|
|
11
|
+
const getPropositions = (n, { answer, ...identifiers }) => {
|
|
12
|
+
const propositions = [];
|
|
13
|
+
const { denum1, denum2, num1, num2 } = identifiers;
|
|
14
|
+
addValidProp(propositions, num1 * denum2 === num2 * denum1 ? "Oui" : "Non", "raw");
|
|
15
|
+
tryToAddWrongProp(propositions, "Oui", "raw");
|
|
16
|
+
tryToAddWrongProp(propositions, "Non", "raw");
|
|
17
|
+
return shuffleProps(propositions, n);
|
|
18
|
+
};
|
|
19
|
+
const getAnswer = (identifiers) => {
|
|
20
|
+
const { denum1, denum2, num1, num2 } = identifiers;
|
|
21
|
+
return num1 * denum2 === num2 * denum1 ? "Oui" : "Non";
|
|
22
|
+
};
|
|
23
|
+
const getInstruction = (identifiers) => {
|
|
24
|
+
const { denum1, denum2, num1, num2 } = identifiers;
|
|
25
|
+
return `L'égalité suivante est-elle vraie ?
|
|
26
|
+
|
|
27
|
+
$$
|
|
28
|
+
${frac(num1, denum1).toTex()} = ${frac(num2, denum2).toTex()}
|
|
29
|
+
$$`;
|
|
30
|
+
};
|
|
31
|
+
const getHint = () => {
|
|
32
|
+
return `Deux fractions $\\frac{a}{b}$ et $\\frac{c}{d}$ sont égales si et seulement si :
|
|
33
|
+
|
|
34
|
+
$$
|
|
35
|
+
a\\times d = b\\times c
|
|
36
|
+
$$`;
|
|
37
|
+
};
|
|
38
|
+
const getCorrection = (identifiers) => {
|
|
39
|
+
const { denum1, denum2, num1, num2 } = identifiers;
|
|
40
|
+
const equal = num1 * denum2 === num2 * denum1;
|
|
41
|
+
return `Deux fractions $\\frac{a}{b}$ et $\\frac{c}{d}$ sont égales si et seulement si :
|
|
42
|
+
|
|
43
|
+
$$
|
|
44
|
+
a\\times d = b\\times c
|
|
45
|
+
$$
|
|
46
|
+
|
|
47
|
+
Ici, on a :
|
|
48
|
+
|
|
49
|
+
- $${multiply(num1, denum2).toSimplificationTex()}$
|
|
50
|
+
|
|
51
|
+
- $${multiply(num2, denum1).toSimplificationTex()}$
|
|
52
|
+
|
|
53
|
+
${equal
|
|
54
|
+
? `Les deux fractions sont donc bien égales.`
|
|
55
|
+
: `Les deux fractions ne sont donc pas égales.`}
|
|
56
|
+
`;
|
|
57
|
+
};
|
|
58
|
+
const getFractionEqualityQuestion = () => {
|
|
59
|
+
const isEqual = coinFlip();
|
|
60
|
+
let num1 = randint(2, 11);
|
|
61
|
+
let denum1 = randint(2, 11, [num1]);
|
|
62
|
+
let num2;
|
|
63
|
+
let denum2;
|
|
64
|
+
const ratio = randint(2, 7);
|
|
65
|
+
if (isEqual) {
|
|
66
|
+
num2 = num1 * ratio;
|
|
67
|
+
denum2 = denum1 * ratio;
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
num2 = num1 * ratio + randint(-1, 2, [0]);
|
|
71
|
+
denum2 = denum1 * ratio + randint(-1, 2, [0]);
|
|
72
|
+
}
|
|
73
|
+
if (coinFlip())
|
|
74
|
+
[num1, denum1, num2, denum2] = [num2, denum2, num1, denum1];
|
|
75
|
+
const identifiers = {
|
|
76
|
+
num1,
|
|
77
|
+
num2,
|
|
78
|
+
denum1,
|
|
79
|
+
denum2,
|
|
80
|
+
};
|
|
81
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
82
|
+
};
|
|
83
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
84
|
+
return {
|
|
85
|
+
answer: getAnswer(identifiers),
|
|
86
|
+
instruction: getInstruction(identifiers),
|
|
87
|
+
keys: [],
|
|
88
|
+
answerFormat: "raw",
|
|
89
|
+
identifiers,
|
|
90
|
+
hint: getHint(identifiers),
|
|
91
|
+
correction: getCorrection(identifiers),
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
// type Options = {
|
|
95
|
+
// numberType: string[];
|
|
96
|
+
// };
|
|
97
|
+
// const options: GeneratorOption[] = [
|
|
98
|
+
// {
|
|
99
|
+
// id: "numberType",
|
|
100
|
+
// label: "Type de nombres",
|
|
101
|
+
// target: GeneratorOptionTarget.generation,
|
|
102
|
+
// type: GeneratorOptionType.multiselect,
|
|
103
|
+
// defaultValue: ["Entier", "Décimal"],
|
|
104
|
+
// values: ["Entier", "Décimal"],
|
|
105
|
+
// },
|
|
106
|
+
// ];
|
|
107
|
+
export const fractionEquality = {
|
|
108
|
+
id: "fractionEquality",
|
|
109
|
+
label: "Vérifier une égalité du type $\\frac{a}{b} = \\frac{c}{d}$",
|
|
110
|
+
isSingleStep: true,
|
|
111
|
+
generator: (nb, opts) => getDistinctQuestions(() => getFractionEqualityQuestion(opts), nb),
|
|
112
|
+
qcmTimer: 60,
|
|
113
|
+
freeTimer: 60,
|
|
114
|
+
getPropositions,
|
|
115
|
+
subject: "Mathématiques",
|
|
116
|
+
getInstruction,
|
|
117
|
+
getHint,
|
|
118
|
+
getCorrection,
|
|
119
|
+
getAnswer,
|
|
120
|
+
getQuestionFromIdentifiers,
|
|
121
|
+
hasHintAndCorrection: true,
|
|
122
|
+
answerType: "QCU",
|
|
123
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/index.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAC;AAChD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,iCAAiC,CAAC;AAChD,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,6CAA6C,CAAC;AAC5D,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oCAAoC,CAAC;AACnD,cAAc,yCAAyC,CAAC;AACxD,cAAc,qCAAqC,CAAC;AACpD,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC;AACpC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/index.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAC;AAChD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,iCAAiC,CAAC;AAChD,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,6CAA6C,CAAC;AAC5D,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oCAAoC,CAAC;AACnD,cAAc,yCAAyC,CAAC;AACxD,cAAc,qCAAqC,CAAC;AACpD,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC;AACpC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC"}
|
|
@@ -286,10 +286,10 @@ const getPropositions = (_, { answer, ...identifiers }) => {
|
|
|
286
286
|
const answerFromIdentifiers = getAnswer(identifiers);
|
|
287
287
|
["Oui", "Non"].forEach((strProp) => {
|
|
288
288
|
if (strProp === answerFromIdentifiers) {
|
|
289
|
-
addValidProp(propositions, strProp);
|
|
289
|
+
addValidProp(propositions, strProp, "raw");
|
|
290
290
|
}
|
|
291
291
|
else {
|
|
292
|
-
tryToAddWrongProp(propositions, strProp);
|
|
292
|
+
tryToAddWrongProp(propositions, strProp, "raw");
|
|
293
293
|
}
|
|
294
294
|
});
|
|
295
295
|
return propositions;
|
|
@@ -324,7 +324,7 @@ const getQuestionFromIdentifiers = (identifiers) => {
|
|
|
324
324
|
answer: getAnswer(identifiers),
|
|
325
325
|
instruction: getInstruction(identifiers),
|
|
326
326
|
keys: [],
|
|
327
|
-
answerFormat: "
|
|
327
|
+
answerFormat: "raw",
|
|
328
328
|
identifiers,
|
|
329
329
|
hint: getHint(identifiers),
|
|
330
330
|
correction: getCorrection(identifiers),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rectangleSideAfterReduction.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/proportionality/rectangleSideAfterReduction.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"rectangleSideAfterReduction.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/proportionality/rectangleSideAfterReduction.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAgBT,MAAM,6BAA6B,CAAC;AASrC,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,MAAM,EAAE,CAAC;CAGnB,CAAC;AA4PF,eAAO,MAAM,2BAA2B,EAAE,QAAQ,CAAC,WAAW,CAoB7D,CAAC"}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import { addValidProp, shuffleProps, tryToAddWrongProp, propWhile,
|
|
1
|
+
import { addValidProp, shuffleProps, tryToAddWrongProp, propWhile,
|
|
2
|
+
// GetHint,
|
|
3
|
+
// GetCorrection,
|
|
4
|
+
} from "../../../../exercises/exercise.js";
|
|
2
5
|
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
6
|
import { numberVEA } from "../../../../exercises/vea/numberVEA.js";
|
|
4
7
|
import { randfloat } from "../../../../math/utils/random/randfloat.js";
|
|
@@ -135,6 +138,12 @@ const isAnswerValid = (ans, { answer }) => {
|
|
|
135
138
|
return handleVEAError(err);
|
|
136
139
|
}
|
|
137
140
|
};
|
|
141
|
+
// const getHint: GetHint<Identifiers> = (identifiers) => {
|
|
142
|
+
// return ``;
|
|
143
|
+
// };
|
|
144
|
+
// const getCorrection: GetCorrection<Identifiers> = (identifiers) => {
|
|
145
|
+
// return ``;
|
|
146
|
+
// };
|
|
138
147
|
const getRectangleSideAfterReductionQuestion = () => {
|
|
139
148
|
const askedSize = randint(0, 4);
|
|
140
149
|
let a;
|
|
@@ -87,7 +87,7 @@ const isAnswerValid = (ans, { a, b, c, d }) => {
|
|
|
87
87
|
export const equationType4Exercise = {
|
|
88
88
|
id: "equa4",
|
|
89
89
|
connector: "\\iff",
|
|
90
|
-
label: "Résoudre une équation du type
|
|
90
|
+
label: "Résoudre une équation du type $ax+b=cx+d$",
|
|
91
91
|
isSingleStep: false,
|
|
92
92
|
generator: (nb) => getDistinctQuestions(getEquationType4ExerciseQuestion, nb),
|
|
93
93
|
qcmTimer: 60,
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise.js";
|
|
2
|
+
type Identifiers = {
|
|
3
|
+
a: number;
|
|
4
|
+
b: number;
|
|
5
|
+
c: number;
|
|
6
|
+
d: number;
|
|
7
|
+
};
|
|
8
|
+
export declare const equationFromFrenchDescription: Exercise<Identifiers>;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=equationFromFrenchDescription.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"equationFromFrenchDescription.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/equation/equationFromFrenchDescription.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAWrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAiJF,eAAO,MAAM,6BAA6B,EAAE,QAAQ,CAAC,WAAW,CAoB/D,CAAC"}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { addValidProp, shuffleProps, propWhile, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { rationalVEA } from "../../../../exercises/vea/rationalVEA.js";
|
|
4
|
+
import { randint } from "../../../../math/utils/random/randint.js";
|
|
5
|
+
import { equationResolutionTex } from "../../../../tree/nodes/equations/equalNode.js";
|
|
6
|
+
import { add } from "../../../../tree/nodes/operators/addNode.js";
|
|
7
|
+
import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
|
|
8
|
+
import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
9
|
+
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
10
|
+
const getPropositions = (n, { answer, a, b, c, d }) => {
|
|
11
|
+
const propositions = [];
|
|
12
|
+
addValidProp(propositions, answer);
|
|
13
|
+
const sol = frac(d - b, a - c).simplify();
|
|
14
|
+
propWhile(propositions, n, () => {
|
|
15
|
+
tryToAddWrongProp(propositions, add(sol, randint(-3, 4, [0]))
|
|
16
|
+
.simplify()
|
|
17
|
+
.toTex());
|
|
18
|
+
});
|
|
19
|
+
return shuffleProps(propositions, n);
|
|
20
|
+
};
|
|
21
|
+
const getAnswer = (identifiers) => {
|
|
22
|
+
const { a, b, c, d } = identifiers;
|
|
23
|
+
return frac(d - b, a - c)
|
|
24
|
+
.simplify()
|
|
25
|
+
.toTex();
|
|
26
|
+
};
|
|
27
|
+
const getInstruction = (identifiers) => {
|
|
28
|
+
const { a, b, c, d } = identifiers;
|
|
29
|
+
const bWord = b > 0 ? "ajoute" : "soustrait";
|
|
30
|
+
const bFullWord = b > 0 ? "m'ajoute" : "me soustrait";
|
|
31
|
+
const dWord = d > 0 ? "ajouté" : "soustrait";
|
|
32
|
+
const multiplyWords = ["double", "triple", "quadruple"];
|
|
33
|
+
return `Je suis un nombre.
|
|
34
|
+
|
|
35
|
+
${a === 1
|
|
36
|
+
? `Si on ${bFullWord} $${Math.abs(b)}$,`
|
|
37
|
+
: `Si on me multiple par $${a}$, puis qu'on ${bWord} $${Math.abs(b)}$ au résultat,`} on trouve mon ${multiplyWords[c - 2]} auquel on a ${dWord} $${Math.abs(d)}$.
|
|
38
|
+
|
|
39
|
+
Qui suis-je ?
|
|
40
|
+
`;
|
|
41
|
+
};
|
|
42
|
+
const getHint = () => {
|
|
43
|
+
return `Note $x$ le nombre recherché, puis écris l'équation correspondant à la situation donnée dans l'énoncé.`;
|
|
44
|
+
};
|
|
45
|
+
const getCorrection = (identifiers) => {
|
|
46
|
+
const { a, b, c, d } = identifiers;
|
|
47
|
+
const bWord = b > 0 ? "ajoute" : "soustrait";
|
|
48
|
+
// const bFullWord = b > 0 ? "m'ajoute" : "me soustrait";
|
|
49
|
+
const dWord = d > 0 ? "ajouté" : "soustrait";
|
|
50
|
+
const multiplyWords = ["double", "triple", "quadruple"];
|
|
51
|
+
return `On note $x$ le nombre recherché.
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
${a === 1
|
|
55
|
+
? `Le nombre auquel on ${bWord} $${Math.abs(b)}$`
|
|
56
|
+
: `Le nombre multiplé par $${a}$, auquel on ${bWord} $${Math.abs(b)}$`} vaut :
|
|
57
|
+
|
|
58
|
+
$$
|
|
59
|
+
${add(multiply(a, "x"), b)
|
|
60
|
+
.simplify({ towardsDistribute: true, forbidFactorize: true })
|
|
61
|
+
.toTex()}
|
|
62
|
+
$$
|
|
63
|
+
|
|
64
|
+
Le ${multiplyWords[c - 2]} du nombre auquel on a ${dWord} $${Math.abs(d)}$ vaut :
|
|
65
|
+
|
|
66
|
+
$$
|
|
67
|
+
${add(multiply(c, "x"), d)
|
|
68
|
+
.simplify({ towardsDistribute: true, forbidFactorize: true })
|
|
69
|
+
.toTex()}
|
|
70
|
+
$$
|
|
71
|
+
|
|
72
|
+
On peut donc écrire l'équation :
|
|
73
|
+
|
|
74
|
+
$$
|
|
75
|
+
${add(multiply(a, "x"), b)
|
|
76
|
+
.simplify({ towardsDistribute: true, forbidFactorize: true })
|
|
77
|
+
.toTex()} = ${add(multiply(c, "x"), d)
|
|
78
|
+
.simplify({ towardsDistribute: true, forbidFactorize: true })
|
|
79
|
+
.toTex()}
|
|
80
|
+
$$
|
|
81
|
+
|
|
82
|
+
On résout l'équation :
|
|
83
|
+
|
|
84
|
+
$$
|
|
85
|
+
${equationResolutionTex(a.toTree(), b.toTree(), c.toTree(), d.toTree())}
|
|
86
|
+
$$
|
|
87
|
+
|
|
88
|
+
Le nombre recherché est donc $${getAnswer(identifiers)}$.
|
|
89
|
+
`;
|
|
90
|
+
};
|
|
91
|
+
const getKeys = () => {
|
|
92
|
+
return [];
|
|
93
|
+
};
|
|
94
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
95
|
+
try {
|
|
96
|
+
return rationalVEA(ans, answer, {
|
|
97
|
+
allowDecimal: true,
|
|
98
|
+
allowNonIrreductible: true,
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
catch (err) {
|
|
102
|
+
return handleVEAError(err);
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
const getEquationFromFrenchDescriptionQuestion = () => {
|
|
106
|
+
// pas 1 pour c
|
|
107
|
+
//
|
|
108
|
+
const c = randint(2, 5);
|
|
109
|
+
const a = randint(1, 6, [c]);
|
|
110
|
+
const b = randint(-10, 10, [0]);
|
|
111
|
+
const d = randint(-10, 10, [0]);
|
|
112
|
+
const identifiers = { a, b, c, d };
|
|
113
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
114
|
+
};
|
|
115
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
116
|
+
return {
|
|
117
|
+
answer: getAnswer(identifiers),
|
|
118
|
+
instruction: getInstruction(identifiers),
|
|
119
|
+
keys: getKeys(identifiers),
|
|
120
|
+
answerFormat: "tex",
|
|
121
|
+
identifiers,
|
|
122
|
+
hint: getHint(identifiers),
|
|
123
|
+
correction: getCorrection(identifiers),
|
|
124
|
+
};
|
|
125
|
+
};
|
|
126
|
+
export const equationFromFrenchDescription = {
|
|
127
|
+
id: "equationFromFrenchDescription",
|
|
128
|
+
label: "Modéliser et résoudre une équation décrite en français",
|
|
129
|
+
isSingleStep: true,
|
|
130
|
+
generator: (nb, opts) => getDistinctQuestions(() => getEquationFromFrenchDescriptionQuestion(opts), nb),
|
|
131
|
+
qcmTimer: 60,
|
|
132
|
+
freeTimer: 60,
|
|
133
|
+
getPropositions,
|
|
134
|
+
isAnswerValid,
|
|
135
|
+
subject: "Mathématiques",
|
|
136
|
+
getInstruction,
|
|
137
|
+
getHint,
|
|
138
|
+
getCorrection,
|
|
139
|
+
getAnswer,
|
|
140
|
+
getQuestionFromIdentifiers,
|
|
141
|
+
hasHintAndCorrection: true,
|
|
142
|
+
};
|
|
@@ -22,14 +22,14 @@ const getInstruction = (identifiers) => {
|
|
|
22
22
|
switch (type) {
|
|
23
23
|
case 1:
|
|
24
24
|
return (instruction +
|
|
25
|
-
|
|
25
|
+
`>${flip ? `Le double` : `La moitié`} du nombre à trouver vaut $${resultNb}$.`);
|
|
26
26
|
case 2:
|
|
27
27
|
return (instruction +
|
|
28
|
-
|
|
28
|
+
`>${flip ? `La somme` : `La différence`} du nombre à trouver et de $${randAdd}$ a pour résultat $${resultNb}$.`);
|
|
29
29
|
case 3:
|
|
30
30
|
default:
|
|
31
31
|
return (instruction +
|
|
32
|
-
|
|
32
|
+
`>${flip ? `Le double` : `La moitié`} du nombre à trouver ${flip ? op2 : op2 + "e"} de $${randAdd}$ vaut $${resultNb}$.`);
|
|
33
33
|
}
|
|
34
34
|
};
|
|
35
35
|
const getAnswerNode = (identifiers) => {
|
|
@@ -2,6 +2,9 @@ import { Exercise } from "../../../../exercises/exercise.js";
|
|
|
2
2
|
type Identifiers = {
|
|
3
3
|
randNbr: number;
|
|
4
4
|
};
|
|
5
|
-
|
|
5
|
+
type Options = {
|
|
6
|
+
solutionType: string[];
|
|
7
|
+
};
|
|
8
|
+
export declare const equationSimpleSquare: Exercise<Identifiers, Options>;
|
|
6
9
|
export {};
|
|
7
10
|
//# sourceMappingURL=equationSimpleSquare.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"equationSimpleSquare.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/equation/equationSimpleSquare.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"equationSimpleSquare.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/equation/equationSimpleSquare.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAmBT,MAAM,6BAA6B,CAAC;AAwBrC,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAgLF,KAAK,OAAO,GAAG;IACb,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB,CAAC;AAqBF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAgB/D,CAAC"}
|