math-exercises 3.0.90 → 3.0.92
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/commonDivisorsList.js +1 -1
- package/lib/exercises/math/calcul/arithmetics/isMultipleOrDivisor.d.ts.map +1 -1
- package/lib/exercises/math/calcul/arithmetics/isMultipleOrDivisor.js +3 -8
- package/lib/exercises/math/calcul/arithmetics/ppcmCalcul.d.ts.map +1 -1
- package/lib/exercises/math/calcul/arithmetics/ppcmCalcul.js +43 -4
- package/lib/exercises/math/calcul/arithmetics/primeNumbers.d.ts.map +1 -1
- package/lib/exercises/math/calcul/arithmetics/primeNumbers.js +11 -12
- package/lib/exercises/math/calcul/fractions/fractionAndIntegerSum.d.ts.map +1 -1
- package/lib/exercises/math/calcul/fractions/fractionAndIntegerSum.js +6 -2
- package/lib/exercises/math/calcul/fractions/fractionsMix.d.ts +12 -0
- package/lib/exercises/math/calcul/fractions/fractionsMix.d.ts.map +1 -0
- package/lib/exercises/math/calcul/fractions/fractionsMix.js +221 -0
- package/lib/exercises/math/calcul/fractions/fractionsOperations.js +1 -1
- package/lib/exercises/math/calcul/fractions/fractionsSubstraction.js +1 -1
- package/lib/exercises/math/calcul/fractions/fractionsSum.d.ts.map +1 -1
- package/lib/exercises/math/calcul/fractions/fractionsSum.js +3 -1
- 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/fractions/simplifyFractionWithPrimeFactorization.d.ts +4 -1
- package/lib/exercises/math/calcul/fractions/simplifyFractionWithPrimeFactorization.d.ts.map +1 -1
- package/lib/exercises/math/calcul/fractions/simplifyFractionWithPrimeFactorization.js +29 -11
- package/lib/exercises/math/calcul/fractions/simplifyToFraction.js +1 -1
- package/lib/exercises/math/calcul/proportionality/scaleCalculation.d.ts.map +1 -1
- package/lib/exercises/math/calcul/proportionality/scaleCalculation.js +4 -2
- package/lib/exercises/math/calcul/proportionality/scaleUsage.d.ts.map +1 -1
- package/lib/exercises/math/calcul/proportionality/scaleUsage.js +6 -4
- package/lib/exercises/math/calcul/sign/absoluteNumber.d.ts.map +1 -1
- package/lib/exercises/math/calcul/sign/absoluteNumber.js +7 -4
- package/lib/exercises/math/calculLitteral/inequations/inequationsSign.d.ts +1 -0
- package/lib/exercises/math/calculLitteral/inequations/inequationsSign.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/inequations/inequationsSign.js +16 -10
- package/lib/exercises/math/calculLitteral/inequations/isInequalityTrue.d.ts +1 -0
- package/lib/exercises/math/calculLitteral/inequations/isInequalityTrue.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/inequations/isInequalityTrue.js +36 -11
- package/lib/exercises/math/derivation/variations/index.d.ts +1 -0
- package/lib/exercises/math/derivation/variations/index.d.ts.map +1 -1
- package/lib/exercises/math/derivation/variations/index.js +1 -0
- package/lib/exercises/math/derivation/variations/variationArrowAmount.d.ts +10 -0
- package/lib/exercises/math/derivation/variations/variationArrowAmount.d.ts.map +1 -0
- package/lib/exercises/math/derivation/variations/variationArrowAmount.js +188 -0
- package/lib/exercises/math/functions/basics/graphicInequation.d.ts.map +1 -1
- package/lib/exercises/math/functions/basics/graphicInequation.js +9 -0
- package/lib/exercises/math/functions/basics/graphicInequationAffine.d.ts.map +1 -1
- package/lib/exercises/math/functions/basics/graphicInequationAffine.js +28 -6
- package/lib/exercises/math/functions/sign/affineSignTable.d.ts.map +1 -1
- package/lib/exercises/math/functions/sign/affineSignTable.js +1 -5
- package/lib/exercises/math/functions/sign/equationFromSignTable.d.ts +11 -0
- package/lib/exercises/math/functions/sign/equationFromSignTable.d.ts.map +1 -0
- package/lib/exercises/math/functions/sign/equationFromSignTable.js +222 -0
- package/lib/exercises/math/functions/sign/index.d.ts +2 -0
- package/lib/exercises/math/functions/sign/index.d.ts.map +1 -1
- package/lib/exercises/math/functions/sign/index.js +2 -0
- package/lib/exercises/math/functions/sign/partialSignTableFromGraph.d.ts +12 -0
- package/lib/exercises/math/functions/sign/partialSignTableFromGraph.d.ts.map +1 -0
- package/lib/exercises/math/functions/sign/partialSignTableFromGraph.js +152 -0
- package/lib/exercises/math/functions/sqrt/squareRootCalculation.d.ts.map +1 -1
- package/lib/exercises/math/functions/sqrt/squareRootCalculation.js +3 -1
- package/lib/exercises/math/functions/square/squareImageInterval.d.ts.map +1 -1
- package/lib/exercises/math/functions/square/squareImageInterval.js +34 -2
- package/lib/exercises/math/functions/variations/compareImagesInVarTable.js +2 -2
- package/lib/exercises/math/geometry/vectors/scalarProduct/findCoordinatesToOrthogonalize.js +1 -1
- package/lib/exercises/math/geometry/volumes/volumeOfPyramidWithSquareOrRectBase.js +1 -1
- package/lib/exercises/math/geometry/volumes/volumeOfPyramidWithTriangleBase.js +1 -1
- package/lib/exercises/math/geometry/volumes/volumeOfPyramidWithTriangleRectBase.js +1 -1
- package/lib/exercises/math/percent/evolutions/findRightCalculForPriceEvolution.d.ts.map +1 -1
- package/lib/exercises/math/percent/evolutions/findRightCalculForPriceEvolution.js +1 -1
- package/lib/exercises/math/percent/index.d.ts +1 -0
- package/lib/exercises/math/percent/index.d.ts.map +1 -1
- package/lib/exercises/math/percent/index.js +1 -0
- package/lib/exercises/math/percent/percentOfPercentOfNumber.d.ts +9 -0
- package/lib/exercises/math/percent/percentOfPercentOfNumber.d.ts.map +1 -0
- package/lib/exercises/math/percent/percentOfPercentOfNumber.js +98 -0
- package/lib/exercises/math/sets/nameOfNumberSets.d.ts.map +1 -1
- package/lib/exercises/math/sets/nameOfNumberSets.js +2 -1
- package/lib/exercises/math/sets/subsetsOfKnownSets.d.ts.map +1 -1
- package/lib/exercises/math/sets/subsetsOfKnownSets.js +4 -3
- package/lib/exercises/math/tests/index.d.ts +1 -1
- package/lib/exercises/math/tests/index.d.ts.map +1 -1
- package/lib/exercises/math/tests/index.js +1 -1
- package/lib/index.d.ts +33 -7
- package/lib/index.d.ts.map +1 -1
- package/lib/math/inequations/inequation.d.ts +1 -0
- package/lib/math/inequations/inequation.d.ts.map +1 -1
- package/lib/math/inequations/inequation.js +21 -0
- package/lib/math/numbers/rationals/rational.d.ts +0 -1
- package/lib/math/numbers/rationals/rational.d.ts.map +1 -1
- package/lib/math/numbers/rationals/rational.js +0 -3
- package/lib/tree/parsers/discreteSetParser.d.ts +7 -0
- package/lib/tree/parsers/discreteSetParser.d.ts.map +1 -1
- package/lib/tree/parsers/discreteSetParser.js +7 -0
- package/package.json +1 -1
|
@@ -8,7 +8,7 @@ import { coinFlip } from "../../../../utils/alea/coinFlip.js";
|
|
|
8
8
|
import { doWhile } from "../../../../utils/doWhile.js";
|
|
9
9
|
const getInstruction = (identifiers) => {
|
|
10
10
|
const { a, b } = identifiers;
|
|
11
|
-
return `Donner la liste des diviseurs communs à $${a}$ et $${b}$ (séparer les valeurs par des
|
|
11
|
+
return `Donner la liste des diviseurs communs à $${a}$ et $${b}$ (séparer les valeurs par des points-virgules).`;
|
|
12
12
|
};
|
|
13
13
|
const getAnswer = (identifiers) => {
|
|
14
14
|
const { a, b } = identifiers;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isMultipleOrDivisor.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/arithmetics/isMultipleOrDivisor.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAIrC,OAAO,EACL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;AAM7C,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,eAAe,CAAC;IACnB,CAAC,EAAE,eAAe,CAAC;CACpB,CAAC;
|
|
1
|
+
{"version":3,"file":"isMultipleOrDivisor.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/arithmetics/isMultipleOrDivisor.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAIrC,OAAO,EACL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;AAM7C,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,eAAe,CAAC;IACnB,CAAC,EAAE,eAAe,CAAC;CACpB,CAAC;AAmHF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,WAAW,CAkBrD,CAAC"}
|
|
@@ -38,14 +38,9 @@ const getInstruction = (identifiers) => {
|
|
|
38
38
|
};
|
|
39
39
|
const getHint = (identifiers) => {
|
|
40
40
|
const { a, b } = identifiers;
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
return `Un nombre $n$ est un multiple d'un nombre $k$ si on peut l'écrire sous la forme $n = k \\times m$ avec $m \\in \\mathbb{N}$.`;
|
|
45
|
-
}
|
|
46
|
-
else {
|
|
47
|
-
return `Un nombre $n$ est un diviseur d'un nombre $k$ si on peut écrire $k$ sous la forme $k=n \\times m$ avec $m \\in \\mathbb{N}$.`;
|
|
48
|
-
}
|
|
41
|
+
return `Un nombre $n$ est un multiple d'un nombre $k$ si on peut l'écrire sous la forme $n = k \\times m$ avec $m \\in \\mathbb{N}$.
|
|
42
|
+
|
|
43
|
+
Un nombre $n$ est un diviseur d'un nombre $k$ si on peut écrire $k$ sous la forme $k=n \\times m$ avec $m \\in \\mathbb{N}$.`;
|
|
49
44
|
};
|
|
50
45
|
const getCorrection = (identifiers) => {
|
|
51
46
|
const { a, b } = identifiers;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ppcmCalcul.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/arithmetics/ppcmCalcul.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"ppcmCalcul.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/arithmetics/ppcmCalcul.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAqHF,eAAO,MAAM,UAAU,EAAE,QAAQ,CAAC,WAAW,CAc5C,CAAC"}
|
|
@@ -4,6 +4,7 @@ import { numberVEA } from "../../../../exercises/vea/numberVEA.js";
|
|
|
4
4
|
import { gcd } from "../../../../math/utils/arithmetic/gcd.js";
|
|
5
5
|
import { lcm } from "../../../../math/utils/arithmetic/lcm.js";
|
|
6
6
|
import { randint } from "../../../../math/utils/random/randint.js";
|
|
7
|
+
import { round } from "../../../../math/utils/round.js";
|
|
7
8
|
import { coinFlip } from "../../../../utils/alea/coinFlip.js";
|
|
8
9
|
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
9
10
|
const getPropositions = (n, { answer, ...identifiers }) => {
|
|
@@ -27,10 +28,41 @@ const getInstruction = (identifiers) => {
|
|
|
27
28
|
return `Déterminer le PPCM (plus petit commun multiple) des nombres $${a}$ et $${b}$.`;
|
|
28
29
|
};
|
|
29
30
|
const getHint = (identifiers) => {
|
|
30
|
-
|
|
31
|
+
const { a, b } = identifiers;
|
|
32
|
+
return `Dresse la liste des multiples de $${a}$, et celle des multiples de $${b}$. Puis, identifie le plus petit multiple qu'ils ont en commun.`;
|
|
31
33
|
};
|
|
32
34
|
const getCorrection = (identifiers) => {
|
|
33
|
-
|
|
35
|
+
const { a, b } = identifiers;
|
|
36
|
+
const sorted = [a, b].sort((c, d) => c - d);
|
|
37
|
+
const isMultiple = gcd(a, b) === sorted[0];
|
|
38
|
+
if (isMultiple) {
|
|
39
|
+
return `$${sorted[1]}$ est un multiple de $${sorted[0]}$, car :
|
|
40
|
+
|
|
41
|
+
$$
|
|
42
|
+
${sorted[1]} = ${sorted[0]} \\times ${round(sorted[1] / sorted[0], 0)}
|
|
43
|
+
$$
|
|
44
|
+
|
|
45
|
+
Le plus petit commun multiple de $${a}$ et $${b}$ est donc $${sorted[1]}$.`;
|
|
46
|
+
}
|
|
47
|
+
const ppcm = lcm(a, b);
|
|
48
|
+
const aIndex = round(ppcm / a, 0);
|
|
49
|
+
const bIndex = round(ppcm / b, 0);
|
|
50
|
+
const aMultiples = [];
|
|
51
|
+
const bMultiples = [];
|
|
52
|
+
for (let i = 1; i <= aIndex; i++) {
|
|
53
|
+
aMultiples.push(a * i);
|
|
54
|
+
}
|
|
55
|
+
for (let i = 1; i <= bIndex; i++) {
|
|
56
|
+
bMultiples.push(b * i);
|
|
57
|
+
}
|
|
58
|
+
return `On dresse la liste des multiples de $${a}$, et celle des multiples de $${b}$, jusqu'à obtenir un multiple commun :
|
|
59
|
+
|
|
60
|
+
- ${aMultiples.map((e) => `$${e}$`).join(" ; ")}
|
|
61
|
+
|
|
62
|
+
- ${bMultiples.map((e) => `$${e}$`).join(" ; ")}
|
|
63
|
+
|
|
64
|
+
Le plus petit commun multiple de $${a}$ et $${b}$ est donc $${ppcm}$.
|
|
65
|
+
`;
|
|
34
66
|
};
|
|
35
67
|
const getKeys = (identifiers) => {
|
|
36
68
|
return [];
|
|
@@ -47,10 +79,17 @@ const getPpcmCalculQuestion = (ops) => {
|
|
|
47
79
|
const areCoPrimes = coinFlip();
|
|
48
80
|
let a;
|
|
49
81
|
let b;
|
|
82
|
+
let aIndex = 0;
|
|
83
|
+
let bIndex = 0;
|
|
50
84
|
do {
|
|
51
85
|
a = randint(2, 40);
|
|
52
86
|
b = randint(2, 40, [a]);
|
|
53
|
-
|
|
87
|
+
const ppcm = lcm(a, b);
|
|
88
|
+
aIndex = round(ppcm / a, 0);
|
|
89
|
+
bIndex = round(ppcm / b, 0);
|
|
90
|
+
} while ((areCoPrimes ? gcd(a, b) !== 1 : gcd(a, b) === 1) ||
|
|
91
|
+
aIndex > 10 ||
|
|
92
|
+
bIndex > 10);
|
|
54
93
|
const identifiers = {
|
|
55
94
|
a,
|
|
56
95
|
b,
|
|
@@ -80,5 +119,5 @@ export const ppcmCalcul = {
|
|
|
80
119
|
isAnswerValid,
|
|
81
120
|
subject: "Mathématiques",
|
|
82
121
|
getQuestionFromIdentifiers,
|
|
83
|
-
|
|
122
|
+
hasHintAndCorrection: true,
|
|
84
123
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"primeNumbers.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/arithmetics/primeNumbers.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,QAAQ,EAkBT,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"primeNumbers.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/arithmetics/primeNumbers.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,QAAQ,EAkBT,MAAM,sBAAsB,CAAC;AA2B9B,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAyMF,KAAK,OAAO,GAAG;IACb,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAWF,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAiBvD,CAAC"}
|
|
@@ -12,6 +12,7 @@ import { isInt } from "../../../../utils/isInt.js";
|
|
|
12
12
|
import { primeDecomposition } from "../../../../math/utils/arithmetic/primeDecomposition.js";
|
|
13
13
|
import { divide } from "../../../../tree/nodes/operators/divideNode.js";
|
|
14
14
|
import { alignTex } from "../../../../utils/latex/alignTex.js";
|
|
15
|
+
import { random } from "../../../../utils/alea/random.js";
|
|
15
16
|
const rebuildIdentifiers = (oldIds) => {
|
|
16
17
|
if (oldIds.nb)
|
|
17
18
|
return oldIds;
|
|
@@ -57,19 +58,17 @@ const getAnswer = (identifiers, opts) => {
|
|
|
57
58
|
return operatorComposition(MultiplyNode, nodes).toTex();
|
|
58
59
|
};
|
|
59
60
|
const getPrimeNumbers = (opts) => {
|
|
60
|
-
const rand = randint(
|
|
61
|
-
let
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
let
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
chosenNumbers.push(primes[temp]);
|
|
70
|
-
}
|
|
61
|
+
const rand = randint(2, 5);
|
|
62
|
+
let nb = 0;
|
|
63
|
+
do {
|
|
64
|
+
let chosenNumbers = [];
|
|
65
|
+
for (let i = 0; i < rand; i++) {
|
|
66
|
+
chosenNumbers.push(random(primes));
|
|
67
|
+
nb = chosenNumbers.reduce((acc, curr) => acc * curr);
|
|
68
|
+
}
|
|
69
|
+
} while (nb > 100 && rand > 3);
|
|
71
70
|
// chosenNumbers = chosenNumbers.sort((a, b) => a - b);
|
|
72
|
-
const identifiers = { nb
|
|
71
|
+
const identifiers = { nb };
|
|
73
72
|
return getQuestionFromIdentifiers(identifiers, opts);
|
|
74
73
|
};
|
|
75
74
|
const getHint = (identifiers) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fractionAndIntegerSum.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/fractionAndIntegerSum.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAmBrC,KAAK,WAAW,GAAG;IACjB,cAAc,EAAE,OAAO,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC5B,CAAC;
|
|
1
|
+
{"version":3,"file":"fractionAndIntegerSum.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/fractionAndIntegerSum.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAmBrC,KAAK,WAAW,GAAG;IACjB,cAAc,EAAE,OAAO,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC5B,CAAC;AAqJF,KAAK,OAAO,GAAG;IACb,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC,CAAC;AAcF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAgBhE,CAAC"}
|
|
@@ -102,9 +102,13 @@ const getPropositions = (n, { answer, integer, rational }) => {
|
|
|
102
102
|
addValidProp(propositions, answer);
|
|
103
103
|
const integerObj = new Integer(integer);
|
|
104
104
|
const rationalObj = new Rational(rational[0], rational[1]);
|
|
105
|
-
tryToAddWrongProp(propositions, new Rational(integerObj.value + rationalObj.num, rationalObj.denum)
|
|
105
|
+
tryToAddWrongProp(propositions, new Rational(integerObj.value + rationalObj.num, rationalObj.denum)
|
|
106
|
+
.toTree()
|
|
107
|
+
.toTex());
|
|
106
108
|
if (integerObj.value + rationalObj.denum !== 0)
|
|
107
|
-
tryToAddWrongProp(propositions, new Rational(integerObj.value + rationalObj.num, integerObj.value + rationalObj.denum)
|
|
109
|
+
tryToAddWrongProp(propositions, new Rational(integerObj.value + rationalObj.num, integerObj.value + rationalObj.denum)
|
|
110
|
+
.toTree()
|
|
111
|
+
.toTex());
|
|
108
112
|
while (propositions.length < n) {
|
|
109
113
|
const rational = RationalConstructor.randomIrreductible();
|
|
110
114
|
const wrongAnswerTree = rational.add(integerObj).toTree();
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise.js";
|
|
2
|
+
type Identifiers = {
|
|
3
|
+
type: number;
|
|
4
|
+
a: number;
|
|
5
|
+
b: number;
|
|
6
|
+
c: number;
|
|
7
|
+
d: number;
|
|
8
|
+
e: number;
|
|
9
|
+
};
|
|
10
|
+
export declare const fractionsMix: Exercise<Identifiers>;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=fractionsMix.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fractionsMix.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/fractionsMix.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAYrC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AA4OF,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,WAAW,CAkB9C,CAAC"}
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { rationalVEA } from "../../../../exercises/vea/rationalVEA.js";
|
|
4
|
+
import { RationalConstructor } from "../../../../math/numbers/rationals/rational.js";
|
|
5
|
+
import { gcd } from "../../../../math/utils/arithmetic/gcd.js";
|
|
6
|
+
import { randint } from "../../../../math/utils/random/randint.js";
|
|
7
|
+
import { add } from "../../../../tree/nodes/operators/addNode.js";
|
|
8
|
+
import { divide } from "../../../../tree/nodes/operators/divideNode.js";
|
|
9
|
+
import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
|
|
10
|
+
import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
11
|
+
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
12
|
+
// a/db +- c/b
|
|
13
|
+
// a/b * b/c * c/d * d/e
|
|
14
|
+
// a / (b/c)
|
|
15
|
+
// a + (b/c)/(d/c)
|
|
16
|
+
const getPropositions = (n, { answer }) => {
|
|
17
|
+
const propositions = [];
|
|
18
|
+
addValidProp(propositions, answer);
|
|
19
|
+
while (propositions.length < n) {
|
|
20
|
+
tryToAddWrongProp(propositions, RationalConstructor.randomIrreductible().toTree().toTex());
|
|
21
|
+
}
|
|
22
|
+
return shuffleProps(propositions, n);
|
|
23
|
+
};
|
|
24
|
+
const getStatement = (identifiers) => {
|
|
25
|
+
const { type, a, b, c, d, e } = identifiers;
|
|
26
|
+
switch (type) {
|
|
27
|
+
case 0:
|
|
28
|
+
// a/db +- c/b
|
|
29
|
+
return add(frac(a, d * b), frac(c, b));
|
|
30
|
+
case 1:
|
|
31
|
+
// a/b * b/c * c/d * d/e
|
|
32
|
+
return multiply(multiply(frac(a, b), frac(b, c)), multiply(frac(c, d), frac(d, e)));
|
|
33
|
+
case 2:
|
|
34
|
+
// a / (b/c)
|
|
35
|
+
return frac(a, frac(b, c));
|
|
36
|
+
case 3:
|
|
37
|
+
default:
|
|
38
|
+
// a + (b/c)/(d/c)
|
|
39
|
+
return add(a, divide(frac(b, c), frac(d, c)));
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
const getAnswer = (identifiers) => {
|
|
43
|
+
const statement = getStatement(identifiers);
|
|
44
|
+
return statement.simplify().toTex();
|
|
45
|
+
};
|
|
46
|
+
const getInstruction = (identifiers) => {
|
|
47
|
+
return `Écrire sous la forme d'une fraction irréductible :
|
|
48
|
+
|
|
49
|
+
$$
|
|
50
|
+
${getStatement(identifiers).toTex()}
|
|
51
|
+
$$`;
|
|
52
|
+
};
|
|
53
|
+
const getHint = (identifiers) => {
|
|
54
|
+
const { type, a, b, c, d, e } = identifiers;
|
|
55
|
+
switch (type) {
|
|
56
|
+
case 0:
|
|
57
|
+
// a/db +- c/b
|
|
58
|
+
return `Met les fractions au même dénominateur, puis additionne les numérateurs.`;
|
|
59
|
+
case 1:
|
|
60
|
+
// a/b * b/c * c/d * d/e
|
|
61
|
+
return `Utilise la propriété :
|
|
62
|
+
|
|
63
|
+
$$
|
|
64
|
+
\\frac{k\\times a}{k\\times b} = \\frac{a}{b}
|
|
65
|
+
$$`;
|
|
66
|
+
case 2:
|
|
67
|
+
// a / (b/c)
|
|
68
|
+
return `Diviser par une fraction revient à multiplier par son inverse :
|
|
69
|
+
|
|
70
|
+
$$
|
|
71
|
+
k \\div \\frac{a}{b} = k \\times \\frac{b}{a}
|
|
72
|
+
$$`;
|
|
73
|
+
case 3:
|
|
74
|
+
default:
|
|
75
|
+
return `Diviser par une fraction revient à multiplier par son inverse :
|
|
76
|
+
|
|
77
|
+
$$
|
|
78
|
+
k \\div \\frac{a}{b} = k \\times \\frac{b}{a}
|
|
79
|
+
$$`;
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
const getCorrection = (identifiers) => {
|
|
83
|
+
const { type, a, b, c, d, e } = identifiers;
|
|
84
|
+
const statement = getStatement(identifiers);
|
|
85
|
+
const answer = getAnswer(identifiers);
|
|
86
|
+
switch (type) {
|
|
87
|
+
case 0:
|
|
88
|
+
// a/db +- c/b
|
|
89
|
+
return `On met les fractions au même dénominateur :
|
|
90
|
+
|
|
91
|
+
$$
|
|
92
|
+
${frac(Math.abs(c), b).toTex()}=${frac(d * Math.abs(c), b * d).toTex()}
|
|
93
|
+
$$
|
|
94
|
+
|
|
95
|
+
On a donc :
|
|
96
|
+
|
|
97
|
+
$$
|
|
98
|
+
${statement.toTex()} = ${frac(add(a, c * d), d * b).toTex()} = ${answer}
|
|
99
|
+
$$`;
|
|
100
|
+
case 1:
|
|
101
|
+
// a/b * b/c * c/d * d/e
|
|
102
|
+
return `On peut simplifier par les nombres apparaissant aux numérateurs et aux dénominateurs :
|
|
103
|
+
|
|
104
|
+
$$
|
|
105
|
+
${multiply(multiply(frac(a, b.toTree({ toTexOptions: { cancel: true } })), frac(b.toTree({ toTexOptions: { cancel: true } }), c.toTree({ toTexOptions: { cancel: true } }))), multiply(frac(c.toTree({ toTexOptions: { cancel: true } }), d.toTree({ toTexOptions: { cancel: true } })), frac(d.toTree({ toTexOptions: { cancel: true } }), e))).toTex()} = ${frac(a, e).toSimplificationTex()}
|
|
106
|
+
$$`;
|
|
107
|
+
case 2:
|
|
108
|
+
// a / (b/c)
|
|
109
|
+
return `Diviser par une fraction revient à multiplier par son inverse :
|
|
110
|
+
|
|
111
|
+
$$
|
|
112
|
+
${statement.toTex()} = ${multiply(a, frac(c, b)).toTex({
|
|
113
|
+
forceNoSimplification: true,
|
|
114
|
+
})} = ${frac(a * c, b).toSimplificationTex()}
|
|
115
|
+
$$`;
|
|
116
|
+
case 3:
|
|
117
|
+
default:
|
|
118
|
+
const simpDenum = d / gcd(d, b);
|
|
119
|
+
return `Diviser par une fraction revient à multiplier par son inverse :
|
|
120
|
+
|
|
121
|
+
$$
|
|
122
|
+
${divide(frac(b, c), frac(d, c)).toTex()} = ${multiply(frac(b, c), frac(c, d)).toTex({ forceNoSimplification: true })} = ${frac(b, d).toSimplificationTex()}
|
|
123
|
+
$$
|
|
124
|
+
|
|
125
|
+
On a donc :
|
|
126
|
+
|
|
127
|
+
$$
|
|
128
|
+
${statement.toTex()} = ${add(frac(a * simpDenum, simpDenum), frac(b, d).simplify()).toTex()}=${answer}
|
|
129
|
+
$$`;
|
|
130
|
+
// a + (b/c)/(d/c)
|
|
131
|
+
// return add(a, divide(frac(b, c), frac(d, c)));
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
const getKeys = (identifiers) => {
|
|
135
|
+
return [];
|
|
136
|
+
};
|
|
137
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
138
|
+
try {
|
|
139
|
+
return rationalVEA(ans, answer, { allowNonIrreductible: false });
|
|
140
|
+
}
|
|
141
|
+
catch (err) {
|
|
142
|
+
return handleVEAError(err);
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
const getFractionsMixQuestion = (ops) => {
|
|
146
|
+
let a = 0;
|
|
147
|
+
let b = 0;
|
|
148
|
+
let c = 0;
|
|
149
|
+
let d = 0;
|
|
150
|
+
let e = 0;
|
|
151
|
+
const type = randint(0, 4);
|
|
152
|
+
switch (type) {
|
|
153
|
+
case 0:
|
|
154
|
+
// a/db +- c/b
|
|
155
|
+
a = randint(1, 10);
|
|
156
|
+
b = randint(2, 10);
|
|
157
|
+
c = randint(-9, 10, [0]);
|
|
158
|
+
d = randint(2, 10);
|
|
159
|
+
break;
|
|
160
|
+
case 1:
|
|
161
|
+
// a/b * b/c * c/d * d/e
|
|
162
|
+
a = randint(1, 10);
|
|
163
|
+
b = randint(2, 10, [a]);
|
|
164
|
+
c = randint(2, 10, [b]);
|
|
165
|
+
d = randint(2, 10, [c]);
|
|
166
|
+
e = randint(2, 10, [d]);
|
|
167
|
+
break;
|
|
168
|
+
case 2:
|
|
169
|
+
// a / (b/c)
|
|
170
|
+
a = randint(1, 10);
|
|
171
|
+
b = randint(1, 10);
|
|
172
|
+
c = randint(2, 10);
|
|
173
|
+
break;
|
|
174
|
+
case 3:
|
|
175
|
+
default:
|
|
176
|
+
// a + (b/c)/(d/c)
|
|
177
|
+
a = randint(1, 10);
|
|
178
|
+
b = randint(1, 10);
|
|
179
|
+
c = randint(2, 10);
|
|
180
|
+
d = randint(1, 10, [c]);
|
|
181
|
+
break;
|
|
182
|
+
}
|
|
183
|
+
const identifiers = {
|
|
184
|
+
type,
|
|
185
|
+
a,
|
|
186
|
+
b,
|
|
187
|
+
c,
|
|
188
|
+
d,
|
|
189
|
+
e,
|
|
190
|
+
};
|
|
191
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
192
|
+
};
|
|
193
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
194
|
+
return {
|
|
195
|
+
answer: getAnswer(identifiers),
|
|
196
|
+
instruction: getInstruction(identifiers),
|
|
197
|
+
keys: getKeys(identifiers),
|
|
198
|
+
answerFormat: "tex",
|
|
199
|
+
identifiers,
|
|
200
|
+
hint: getHint(identifiers),
|
|
201
|
+
correction: getCorrection(identifiers),
|
|
202
|
+
};
|
|
203
|
+
};
|
|
204
|
+
export const fractionsMix = {
|
|
205
|
+
id: "fractionsMix",
|
|
206
|
+
connector: "=",
|
|
207
|
+
label: "Calculs variés avec des fractions",
|
|
208
|
+
isSingleStep: true,
|
|
209
|
+
generator: (nb, opts) => getDistinctQuestions(() => getFractionsMixQuestion(opts), nb),
|
|
210
|
+
qcmTimer: 60,
|
|
211
|
+
freeTimer: 60,
|
|
212
|
+
getPropositions,
|
|
213
|
+
isAnswerValid,
|
|
214
|
+
subject: "Mathématiques",
|
|
215
|
+
getInstruction,
|
|
216
|
+
getHint,
|
|
217
|
+
getCorrection,
|
|
218
|
+
getAnswer,
|
|
219
|
+
getQuestionFromIdentifiers,
|
|
220
|
+
hasHintAndCorrection: true,
|
|
221
|
+
};
|
|
@@ -23,7 +23,7 @@ const getAnswer = (identifiers) => {
|
|
|
23
23
|
};
|
|
24
24
|
const getInstruction = (identifiers) => {
|
|
25
25
|
const statement = NodeConstructor.fromIdentifiers(identifiers.statementIdentifiers);
|
|
26
|
-
return
|
|
26
|
+
return `Écrire sous la forme d'une fraction irréductible :
|
|
27
27
|
|
|
28
28
|
$$
|
|
29
29
|
${statement.toTex({ forceTimesSign: true })}
|
|
@@ -26,7 +26,7 @@ const getPropositions = (n, { answer, frac1, frac2 }) => {
|
|
|
26
26
|
allowDivideByZero: true,
|
|
27
27
|
}).toTex());
|
|
28
28
|
while (propositions.length < n) {
|
|
29
|
-
tryToAddWrongProp(propositions, RationalConstructor.randomIrreductible().toTex());
|
|
29
|
+
tryToAddWrongProp(propositions, RationalConstructor.randomIrreductible().toTree().toTex());
|
|
30
30
|
}
|
|
31
31
|
return shuffleProps(propositions, n);
|
|
32
32
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fractionsSum.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/fractionsSum.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAiBT,MAAM,6BAA6B,CAAC;AAgBrC,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC;AAEF,KAAK,OAAO,GAAG;IACb,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC,CAAC;
|
|
1
|
+
{"version":3,"file":"fractionsSum.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/fractionsSum.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAiBT,MAAM,6BAA6B,CAAC;AAgBrC,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC;AAEF,KAAK,OAAO,GAAG;IACb,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC,CAAC;AA2SF,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAevD,CAAC"}
|
|
@@ -199,7 +199,9 @@ const getFractionsSum = (opts) => {
|
|
|
199
199
|
const getPropositions = (n, { answer, rational, rational2 }) => {
|
|
200
200
|
const propositions = [];
|
|
201
201
|
addValidProp(propositions, answer);
|
|
202
|
-
tryToAddWrongProp(propositions, new Rational(rational[0] + rational2[0], rational[1] + rational2[1])
|
|
202
|
+
tryToAddWrongProp(propositions, new Rational(rational[0] + rational2[0], rational[1] + rational2[1])
|
|
203
|
+
.toTree()
|
|
204
|
+
.toTex());
|
|
203
205
|
while (propositions.length < n) {
|
|
204
206
|
const incorrectRational = RationalConstructor.randomIrreductible();
|
|
205
207
|
const incorrectRational2 = RationalConstructor.randomIrreductible();
|
|
@@ -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,oBAAoB,CAAC;AACnC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,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,oBAAoB,CAAC;AACnC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,mBAAmB,CAAC"}
|
|
@@ -3,6 +3,9 @@ type Identifiers = {
|
|
|
3
3
|
num: number;
|
|
4
4
|
denum: number;
|
|
5
5
|
};
|
|
6
|
-
|
|
6
|
+
type Options = {
|
|
7
|
+
withoutGivenPrimeFactors?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export declare const simplifyFractionWithPrimeFactorization: Exercise<Identifiers, Options>;
|
|
7
10
|
export {};
|
|
8
11
|
//# sourceMappingURL=simplifyFractionWithPrimeFactorization.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simplifyFractionWithPrimeFactorization.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/simplifyFractionWithPrimeFactorization.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"simplifyFractionWithPrimeFactorization.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/simplifyFractionWithPrimeFactorization.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;AAcrC,KAAK,WAAW,GAAG;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AACF,KAAK,OAAO,GAAG;IACb,wBAAwB,CAAC,EAAE,OAAO,CAAC;CACpC,CAAC;AAiIF,eAAO,MAAM,sCAAsC,EAAE,QAAQ,CAC3D,WAAW,EACX,OAAO,CAwBR,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
|
|
1
|
+
import { addValidProp, shuffleProps, tryToAddWrongProp, GeneratorOptionTarget, GeneratorOptionType, } from "../../../../exercises/exercise.js";
|
|
2
2
|
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
3
|
import { RationalConstructor } from "../../../../math/numbers/rationals/rational.js";
|
|
4
4
|
import { gcd } from "../../../../math/utils/arithmetic/gcd.js";
|
|
@@ -13,7 +13,7 @@ const getPropositions = (n, { answer, ...identifiers }) => {
|
|
|
13
13
|
const propositions = [];
|
|
14
14
|
addValidProp(propositions, answer);
|
|
15
15
|
while (propositions.length < n) {
|
|
16
|
-
tryToAddWrongProp(propositions, RationalConstructor.randomIrreductible().toTex());
|
|
16
|
+
tryToAddWrongProp(propositions, RationalConstructor.randomIrreductible().toTree().toTex());
|
|
17
17
|
}
|
|
18
18
|
return shuffleProps(propositions, n);
|
|
19
19
|
};
|
|
@@ -21,14 +21,22 @@ const getAnswer = (identifiers) => {
|
|
|
21
21
|
const { num, denum } = identifiers;
|
|
22
22
|
return frac(num, denum).simplify().toTex();
|
|
23
23
|
};
|
|
24
|
-
const getInstruction = (identifiers) => {
|
|
24
|
+
const getInstruction = (identifiers, opts) => {
|
|
25
25
|
const { num, denum } = identifiers;
|
|
26
|
+
if (opts?.withoutGivenPrimeFactors) {
|
|
27
|
+
return `En décomposant le numérateur et le dénominateur en produit de facteurs premiers, simplifier la fraction :
|
|
28
|
+
|
|
29
|
+
$$
|
|
30
|
+
${frac(num, denum).toTex()}
|
|
31
|
+
$$
|
|
32
|
+
`;
|
|
33
|
+
}
|
|
26
34
|
return `On donne la décomposition en produit de facteurs premiers des nombres suivants:
|
|
27
35
|
|
|
28
36
|
- $${num} = ${new NumberNode(num).toPrimeDecomposition().toTex()}$
|
|
29
37
|
- $${denum} = ${new NumberNode(denum).toPrimeDecomposition().toTex()}$
|
|
30
38
|
|
|
31
|
-
|
|
39
|
+
Simplifier la fraction $${frac(num, denum).toTex()}$.
|
|
32
40
|
`;
|
|
33
41
|
};
|
|
34
42
|
const getHint = (identifiers) => {
|
|
@@ -62,7 +70,7 @@ ${alignTex([
|
|
|
62
70
|
const isAnswerValid = (ans, { answer }) => {
|
|
63
71
|
return ans === answer;
|
|
64
72
|
};
|
|
65
|
-
const getSimplifyFractionWithPrimeFactorizationQuestion = (
|
|
73
|
+
const getSimplifyFractionWithPrimeFactorizationQuestion = (opts) => {
|
|
66
74
|
let num = 0;
|
|
67
75
|
let denum = 0;
|
|
68
76
|
do {
|
|
@@ -72,19 +80,28 @@ const getSimplifyFractionWithPrimeFactorizationQuestion = (ops) => {
|
|
|
72
80
|
isPrime(denum) ||
|
|
73
81
|
[1, denum].includes(gcd(num, denum)));
|
|
74
82
|
const identifiers = { num, denum };
|
|
75
|
-
return getQuestionFromIdentifiers(identifiers);
|
|
83
|
+
return getQuestionFromIdentifiers(identifiers, opts);
|
|
76
84
|
};
|
|
77
|
-
const getQuestionFromIdentifiers = (identifiers) => {
|
|
85
|
+
const getQuestionFromIdentifiers = (identifiers, opts) => {
|
|
78
86
|
return {
|
|
79
|
-
answer: getAnswer(identifiers),
|
|
80
|
-
instruction: getInstruction(identifiers),
|
|
87
|
+
answer: getAnswer(identifiers, opts),
|
|
88
|
+
instruction: getInstruction(identifiers, opts),
|
|
81
89
|
keys: [],
|
|
82
90
|
answerFormat: "tex",
|
|
83
91
|
identifiers,
|
|
84
|
-
hint: getHint(identifiers),
|
|
85
|
-
correction: getCorrection(identifiers),
|
|
92
|
+
hint: getHint(identifiers, opts),
|
|
93
|
+
correction: getCorrection(identifiers, opts),
|
|
86
94
|
};
|
|
87
95
|
};
|
|
96
|
+
const options = [
|
|
97
|
+
{
|
|
98
|
+
id: "withoutGivenPrimeFactors",
|
|
99
|
+
label: "Ne pas donner la décomposition en produit de facteurs premiers dans l'énoncé",
|
|
100
|
+
target: GeneratorOptionTarget.instruction,
|
|
101
|
+
type: GeneratorOptionType.checkbox,
|
|
102
|
+
defaultValue: false,
|
|
103
|
+
},
|
|
104
|
+
];
|
|
88
105
|
export const simplifyFractionWithPrimeFactorization = {
|
|
89
106
|
id: "simplifyFractionWithPrimeFactorization",
|
|
90
107
|
label: "Simplifier une fraction en utilisant la décomposition en nombres premiers",
|
|
@@ -102,4 +119,5 @@ export const simplifyFractionWithPrimeFactorization = {
|
|
|
102
119
|
getQuestionFromIdentifiers,
|
|
103
120
|
hasHintAndCorrection: true,
|
|
104
121
|
shouldHaveCalculator: false,
|
|
122
|
+
options,
|
|
105
123
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scaleCalculation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/proportionality/scaleCalculation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAQrC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,OAAO,CAAC;IAEtB,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;
|
|
1
|
+
{"version":3,"file":"scaleCalculation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/proportionality/scaleCalculation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAQrC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,OAAO,CAAC;IAEtB,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAiIF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,WAAW,CAelD,CAAC"}
|
|
@@ -27,7 +27,7 @@ const getInstruction = (identifiers) => {
|
|
|
27
27
|
};
|
|
28
28
|
const getAnswer = (identifiers) => {
|
|
29
29
|
const { scale, isSmallScale, fakeDistance } = identifiers;
|
|
30
|
-
const answer = new Rational(1, scale).toTex();
|
|
30
|
+
const answer = new Rational(1, scale).toTree().toTex();
|
|
31
31
|
return answer;
|
|
32
32
|
};
|
|
33
33
|
const getHint = (identifiers) => {
|
|
@@ -95,7 +95,9 @@ const getPropositions = (n, { answer, scale, isSmallScale }) => {
|
|
|
95
95
|
const propositions = [];
|
|
96
96
|
addValidProp(propositions, answer);
|
|
97
97
|
while (propositions.length < n) {
|
|
98
|
-
tryToAddWrongProp(propositions, new Rational(1, isSmallScale ? randint(1, 5) * 10 : randint(5, 100) * 1000)
|
|
98
|
+
tryToAddWrongProp(propositions, new Rational(1, isSmallScale ? randint(1, 5) * 10 : randint(5, 100) * 1000)
|
|
99
|
+
.toTree()
|
|
100
|
+
.toTex());
|
|
99
101
|
}
|
|
100
102
|
return shuffleProps(propositions, n);
|
|
101
103
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scaleUsage.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/proportionality/scaleUsage.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,OAAO,CAAC;IACtB,WAAW,EAAE,OAAO,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;
|
|
1
|
+
{"version":3,"file":"scaleUsage.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/proportionality/scaleUsage.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,OAAO,CAAC;IACtB,WAAW,EAAE,OAAO,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAoJF,eAAO,MAAM,UAAU,EAAE,QAAQ,CAAC,WAAW,CAa5C,CAAC"}
|