math-exercises 3.0.5 → 3.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/exercises/exercise.d.ts +1 -1
- package/lib/exercises/exercise.d.ts.map +1 -1
- package/lib/exercises/math/calcul/mentalCaluls/mentalMultiplicationsNoRelative.d.ts.map +1 -1
- package/lib/exercises/math/calcul/mentalCaluls/mentalMultiplicationsNoRelative.js +30 -32
- package/lib/exercises/math/calcul/ordering/decimalOrdering.d.ts.map +1 -1
- package/lib/exercises/math/calcul/ordering/decimalOrdering.js +3 -1
- package/lib/exercises/math/calcul/ordering/decimalOrderingNoRelatives.d.ts.map +1 -1
- package/lib/exercises/math/calcul/ordering/decimalOrderingNoRelatives.js +3 -1
- package/lib/exercises/math/calculLitteral/distributivity/doubleDistributivityWithCoeff.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/distributivity/doubleDistributivityWithCoeff.js +0 -2
- package/lib/exercises/math/calculLitteral/equation/equationType1Exercise.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/equationType1Exercise.js +2 -3
- package/lib/exercises/math/calculLitteral/equation/fractionEquation.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/fractionEquation.js +66 -26
- package/lib/exercises/math/calculLitteral/factorisation/factorizeCanonicalFormWithSqrt.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/factorisation/factorizeCanonicalFormWithSqrt.js +60 -28
- package/lib/exercises/math/dataRepresentations/barChartReading.d.ts.map +1 -1
- package/lib/exercises/math/dataRepresentations/barChartReading.js +63 -7
- package/lib/exercises/math/derivation/derivative/lnDerivativeOne.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/lnDerivativeOne.js +7 -1
- package/lib/exercises/math/derivation/derivative/sinCompositionDerivation.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/sinCompositionDerivation.js +22 -7
- package/lib/exercises/math/derivation/derivative/sinSecondDegreeDerivative.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/sinSecondDegreeDerivative.js +23 -8
- package/lib/exercises/math/functions/affines/affineExpressionFromTwoImages.js +1 -1
- package/lib/exercises/math/functions/basics/imageFunction.d.ts.map +1 -1
- package/lib/exercises/math/functions/basics/imageFunction.js +20 -12
- package/lib/exercises/math/functions/basics/imageFunctionGeogebra.d.ts.map +1 -1
- package/lib/exercises/math/functions/basics/imageFunctionGeogebra.js +0 -1
- package/lib/exercises/math/functions/trinoms/solveSecondDegreeEquationFromCano.d.ts.map +1 -1
- package/lib/exercises/math/functions/trinoms/solveSecondDegreeEquationFromCano.js +22 -9
- package/lib/exercises/math/geometry/parametric/extractPointFromParametricLine.d.ts.map +1 -1
- package/lib/exercises/math/geometry/parametric/extractPointFromParametricLine.js +2 -1
- package/lib/exercises/math/geometry/vectors/vectorNormCalculation.js +1 -1
- package/lib/exercises/math/percent/applyPercent.d.ts.map +1 -1
- package/lib/exercises/math/percent/applyPercent.js +65 -52
- package/lib/exercises/math/percent/evolutionToCM.d.ts.map +1 -1
- package/lib/exercises/math/percent/evolutionToCM.js +0 -2
- package/lib/exercises/math/percent/findProportion.d.ts.map +1 -1
- package/lib/exercises/math/percent/findProportion.js +35 -17
- package/lib/exercises/math/percent/findStartValueAfterEvolution.d.ts.map +1 -1
- package/lib/exercises/math/percent/findStartValueAfterEvolution.js +1 -0
- package/lib/exercises/math/percent/findTVA.d.ts.map +1 -1
- package/lib/exercises/math/percent/findTVA.js +1 -0
- package/lib/exercises/math/percent/globalPercent.d.ts.map +1 -1
- package/lib/exercises/math/percent/globalPercent.js +50 -32
- package/lib/exercises/math/probaStat/diceBasicProbas.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/diceBasicProbas.js +1 -1
- package/lib/exercises/math/probaStat/probaFromTableNoContext.d.ts +1 -3
- package/lib/exercises/math/probaStat/probaFromTableNoContext.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/probaFromTableNoContext.js +15 -12
- package/lib/exercises/math/probaStat/probaFromTableWithContext.d.ts +1 -3
- package/lib/exercises/math/probaStat/probaFromTableWithContext.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/probaFromTableWithContext.js +13 -11
- package/lib/exercises/math/sequences/arithmetic/arithmeticFindExplicitFormula.d.ts.map +1 -1
- package/lib/exercises/math/sequences/arithmetic/arithmeticFindExplicitFormula.js +0 -6
- package/lib/exercises/math/squareRoots/simpifySquareRoot.d.ts.map +1 -1
- package/lib/exercises/math/squareRoots/simpifySquareRoot.js +26 -6
- package/lib/exercises/math/squareRoots/squareRootEquation.d.ts.map +1 -1
- package/lib/exercises/math/squareRoots/squareRootEquation.js +19 -4
- package/lib/exercises/math/trigonometry/mainRemarkableValues.d.ts.map +1 -1
- package/lib/exercises/math/trigonometry/mainRemarkableValues.js +48 -23
- package/lib/exercises/math/trigonometry/remarkableValues.d.ts +2 -0
- package/lib/exercises/math/trigonometry/remarkableValues.d.ts.map +1 -1
- package/lib/exercises/math/trigonometry/remarkableValues.js +54 -25
- package/lib/index.d.ts +3 -6
- package/lib/index.d.ts.map +1 -1
- package/lib/latexTester.d.ts.map +1 -1
- package/lib/latexTester.js +6 -0
- package/lib/math/polynomials/trinom.d.ts +2 -0
- package/lib/math/polynomials/trinom.d.ts.map +1 -1
- package/lib/math/polynomials/trinom.js +12 -0
- package/lib/pc/constants/molecularChemistry/molecule.js +0 -1
- package/lib/pc/constants/molecularChemistry/reaction.d.ts.map +1 -1
- package/lib/pc/constants/molecularChemistry/reaction.js +0 -3
- package/lib/pc/measure/measure.d.ts.map +1 -1
- package/lib/pc/measure/measure.js +0 -2
- package/lib/playground.d.ts.map +1 -1
- package/lib/tests/pdfExo.test.js +2 -2
- package/lib/tests/pdfs/buildPDFForExercise.d.ts.map +1 -1
- package/lib/tests/pdfs/buildPDFForExercise.js +7 -3
- package/lib/tests/questionTest.d.ts.map +1 -1
- package/lib/tests/questionTest.js +2 -2
- package/lib/tests/singleExo.test.js +2 -2
- package/lib/tree/nodes/algebraicNode.d.ts +1 -0
- package/lib/tree/nodes/algebraicNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/cosNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/cosNode.js +5 -2
- package/lib/tree/nodes/functions/sinNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/sinNode.js +5 -2
- package/lib/tree/nodes/sets/unionIntervalNode.d.ts.map +1 -1
- package/lib/tree/nodes/sets/unionIntervalNode.js +2 -2
- package/lib/tree/parsers/latexParser.d.ts.map +1 -1
- package/lib/tree/parsers/latexParser.js +10 -0
- package/package.json +3 -1
|
@@ -4,49 +4,67 @@ import { getDistinctQuestions } from "../../utils/getDistinctQuestions.js";
|
|
|
4
4
|
import { shuffle } from "../../../utils/alea/shuffle.js";
|
|
5
5
|
import { round } from "../../../math/utils/round.js";
|
|
6
6
|
import { percentParser } from "../../../tree/parsers/percentParser.js";
|
|
7
|
-
const
|
|
8
|
-
const tab = ["hausse", "baisse"];
|
|
9
|
-
let ans = 1;
|
|
7
|
+
const getInstruction = (identifiers) => {
|
|
10
8
|
let instruction = "Le prix d'un article subit une ";
|
|
9
|
+
identifiers.evolutions.forEach((evolution, i) => {
|
|
10
|
+
const type = evolution[0] === "-" ? "baisse" : "hausse";
|
|
11
|
+
if (i === 0)
|
|
12
|
+
instruction += `${type} de $${evolution.substring(1)}\\%$`;
|
|
13
|
+
else
|
|
14
|
+
instruction += `, puis une ${type} de $${evolution.substring(1)}\\%$`;
|
|
15
|
+
});
|
|
16
|
+
instruction += `.
|
|
17
|
+
|
|
18
|
+
Déterminer le taux d'évolution global du prix de cet article (arrondir au centième de pourcentage).`;
|
|
19
|
+
return instruction;
|
|
20
|
+
};
|
|
21
|
+
const getAnswer = (identifiers) => {
|
|
22
|
+
const { evolutions } = identifiers;
|
|
23
|
+
const cms = evolutions.map((e) => 1 + Number(e) / 100);
|
|
24
|
+
const prod = cms.reduce((acc, curr) => acc * curr, 1);
|
|
25
|
+
const answer = round((prod - 1) * 100, 2).frenchify() + "\\%";
|
|
26
|
+
return answer;
|
|
27
|
+
};
|
|
28
|
+
const getHint = (identifiers) => {
|
|
29
|
+
return "Transforme chaque taux d'évolution en coefficient multiplicateur, puis multiplie ces coefficients multiplicateurs entre eux pour obtenir le coefficient multiplicateur global. Transforme alors ce CM global en taux d'évolution.";
|
|
30
|
+
};
|
|
31
|
+
const getCorrection = (identifiers) => {
|
|
32
|
+
const { evolutions } = identifiers;
|
|
33
|
+
const answer = getAnswer(identifiers);
|
|
34
|
+
return `On transforme les taux d'évolution en coefficients multiplicateurs puis on les multiplie entre eux :
|
|
35
|
+
|
|
36
|
+
$$
|
|
37
|
+
${evolutions
|
|
38
|
+
.map((e) => round(1 + Number(e) / 100, 2).frenchify())
|
|
39
|
+
.join(" \\times ")} = ${round(evolutions.reduce((acc, curr) => acc * round(1 + Number(curr) / 100, 2), 1), 4).frenchify()}
|
|
40
|
+
$$
|
|
41
|
+
|
|
42
|
+
Enfin, on transforme ce CM global en taux d'évolution :
|
|
43
|
+
|
|
44
|
+
$$
|
|
45
|
+
(${round(evolutions.reduce((acc, curr) => acc * round(1 + Number(curr) / 100, 2), 1), 4).frenchify()} - 1)\\times 100 = ${answer.replace("\\%", "")}
|
|
46
|
+
$$
|
|
47
|
+
|
|
48
|
+
Le taux d'évolution global est donc de $${answer}$.
|
|
49
|
+
`;
|
|
50
|
+
};
|
|
51
|
+
const getGlobalPercentQuestion = () => {
|
|
11
52
|
const indice = randint(2, 4);
|
|
12
53
|
const evolutions = [];
|
|
13
54
|
for (let i = 0; i < indice; i++) {
|
|
14
55
|
const randPercent = randint(1, 50);
|
|
15
56
|
let a = randint(0, 2);
|
|
16
|
-
instruction += `${tab[a]} de $${randPercent}\\%$`;
|
|
17
57
|
evolutions.push((a === 0 ? "+" : "-") + randPercent);
|
|
18
|
-
if (i + 1 < indice)
|
|
19
|
-
instruction += ", puis une ";
|
|
20
|
-
if (a == 0)
|
|
21
|
-
ans *= 1 + randPercent / 100;
|
|
22
|
-
else
|
|
23
|
-
ans *= 1 - randPercent / 100;
|
|
24
58
|
}
|
|
25
|
-
|
|
26
|
-
instruction +=
|
|
27
|
-
". \nDéterminer le taux d'évolution global du prix de cet article (arrondir au centième de pourcentage).";
|
|
28
|
-
const answer = `${(ans + "").replace(".", ",")}\\%`;
|
|
59
|
+
const identifiers = { evolutions };
|
|
29
60
|
const question = {
|
|
30
|
-
instruction,
|
|
31
|
-
answer,
|
|
61
|
+
instruction: getInstruction(identifiers),
|
|
62
|
+
answer: getAnswer(identifiers),
|
|
32
63
|
keys: ["percent"],
|
|
33
64
|
answerFormat: "tex",
|
|
34
|
-
identifiers
|
|
35
|
-
hint:
|
|
36
|
-
correction:
|
|
37
|
-
|
|
38
|
-
$$${evolutions
|
|
39
|
-
.map((e) => round(1 + Number(e) / 100, 2).frenchify())
|
|
40
|
-
.join(" \\times ")} = ${round(evolutions.reduce((acc, curr) => acc * round(1 + Number(curr) / 100, 2), 1), 4).frenchify()}
|
|
41
|
-
$$
|
|
42
|
-
|
|
43
|
-
Enfin, on transforme ce CM global en taux d'évolution :
|
|
44
|
-
|
|
45
|
-
$$(${round(evolutions.reduce((acc, curr) => acc * round(1 + Number(curr) / 100, 2), 1), 4).frenchify()} - 1)\\times 100 = ${answer.replace("\\%", "")}
|
|
46
|
-
$$
|
|
47
|
-
|
|
48
|
-
Le taux d'évolution global est donc de $${answer}$.
|
|
49
|
-
`,
|
|
65
|
+
identifiers,
|
|
66
|
+
hint: getHint(identifiers),
|
|
67
|
+
correction: getCorrection(identifiers),
|
|
50
68
|
};
|
|
51
69
|
return question;
|
|
52
70
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diceBasicProbas.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/probaStat/diceBasicProbas.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"diceBasicProbas.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/probaStat/diceBasicProbas.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAQrC,KAAK,WAAW,GAAG;IACjB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,cAAc,EAAE,OAAO,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAwIF,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,WAAW,CAgBjD,CAAC"}
|
|
@@ -54,7 +54,7 @@ const getInstruction = (identifiers) => {
|
|
|
54
54
|
const target = isParityQuestion
|
|
55
55
|
? `un nombre ${isEvenQuestion ? "pair" : "impair"}`
|
|
56
56
|
: `la face $${faceAsked}$`;
|
|
57
|
-
return `On lance un dé équilibré à $${nbFaces}$ faces.
|
|
57
|
+
return `On lance un dé équilibré à $${nbFaces}$ faces.
|
|
58
58
|
|
|
59
59
|
Quelle est la probabilité d'obtenir ${target} ?`;
|
|
60
60
|
};
|
|
@@ -8,9 +8,7 @@ type Identifiers = {
|
|
|
8
8
|
type: string;
|
|
9
9
|
probaFrac: number[];
|
|
10
10
|
};
|
|
11
|
-
type Options = {
|
|
12
|
-
allowNonIrreductible?: boolean;
|
|
13
|
-
};
|
|
11
|
+
type Options = {};
|
|
14
12
|
export declare const probaFromTableNoContext: Exercise<Identifiers, Options>;
|
|
15
13
|
export {};
|
|
16
14
|
//# sourceMappingURL=probaFromTableNoContext.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"probaFromTableNoContext.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/probaStat/probaFromTableNoContext.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"probaFromTableNoContext.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/probaStat/probaFromTableNoContext.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAYrC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC;AA4IF,KAAK,OAAO,GAAG,EAEd,CAAC;AAgBF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAiBlE,CAAC"}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../exercises/exercise.js";
|
|
2
|
-
import { allowNonIrreductibleOption } from "../../../exercises/options/allowNonIrreductibleFractions.js";
|
|
3
2
|
import { getDistinctQuestions } from "../../../exercises/utils/getDistinctQuestions.js";
|
|
4
3
|
import { Rational } from "../../../math/numbers/rationals/rational.js";
|
|
5
4
|
import { randint } from "../../../math/utils/random/randint.js";
|
|
6
|
-
import { FractionNode } from "../../../tree/nodes/operators/fractionNode.js";
|
|
7
5
|
import { rationalParser } from "../../../tree/parsers/rationalParser.js";
|
|
8
6
|
import { random } from "../../../utils/alea/random.js";
|
|
7
|
+
import { handleVEAError } from "../../../utils/errors/handleVEAError.js";
|
|
9
8
|
import { dollarize } from "../../../utils/latex/dollarize.js";
|
|
10
9
|
import { mdTable } from "../../../utils/markdown/mdTable.js";
|
|
11
10
|
const getInstruction = ({ aBarreCapB, aBarreCapBBarre, aCapB, aCapBBarre, event, probaFrac, type, }) => {
|
|
@@ -33,6 +32,14 @@ ${mdTable([
|
|
|
33
32
|
Calculer la probabilité $${event}$.
|
|
34
33
|
`;
|
|
35
34
|
};
|
|
35
|
+
const getAnswer = (identifiers) => {
|
|
36
|
+
const { probaFrac } = identifiers;
|
|
37
|
+
const answer = new Rational(probaFrac[0], probaFrac[1])
|
|
38
|
+
.simplify()
|
|
39
|
+
.toTree()
|
|
40
|
+
.toTex();
|
|
41
|
+
return answer;
|
|
42
|
+
};
|
|
36
43
|
const getProbaFromTableNoContextQuestion = () => {
|
|
37
44
|
const aCapB = randint(1, 20);
|
|
38
45
|
const aCapBBarre = randint(1, 20, [aCapB]);
|
|
@@ -83,7 +90,6 @@ const getProbaFromTableNoContextQuestion = () => {
|
|
|
83
90
|
["P_{\\overline B}(\\overline A)", [aBarreCapBBarre, bBarreTotal]],
|
|
84
91
|
]);
|
|
85
92
|
}
|
|
86
|
-
const answer = new Rational(proba[0], proba[1]).simplify().toTree().toTex();
|
|
87
93
|
const identifiers = {
|
|
88
94
|
aBarreCapB,
|
|
89
95
|
aBarreCapBBarre,
|
|
@@ -94,7 +100,7 @@ const getProbaFromTableNoContextQuestion = () => {
|
|
|
94
100
|
probaFrac: proba,
|
|
95
101
|
};
|
|
96
102
|
const question = {
|
|
97
|
-
answer,
|
|
103
|
+
answer: getAnswer(identifiers),
|
|
98
104
|
instruction: getInstruction(identifiers),
|
|
99
105
|
keys: [],
|
|
100
106
|
answerFormat: "tex",
|
|
@@ -114,19 +120,16 @@ const getPropositions = (n, { answer, aBarreCapB, aBarreCapBBarre, aCapB, aCapBB
|
|
|
114
120
|
}
|
|
115
121
|
return shuffleProps(propositions, n);
|
|
116
122
|
};
|
|
117
|
-
const options = [allowNonIrreductibleOption];
|
|
123
|
+
// const options: GeneratorOption[] = [allowNonIrreductibleOption];
|
|
118
124
|
const isAnswerValid = (ans, { answer, probaFrac }, options) => {
|
|
119
|
-
|
|
125
|
+
try {
|
|
120
126
|
const parsed = rationalParser(ans);
|
|
121
127
|
if (!parsed)
|
|
122
128
|
return false;
|
|
123
129
|
return parsed.simplify().toTex() === answer;
|
|
124
130
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
.simplify()
|
|
128
|
-
.toAllValidTexs();
|
|
129
|
-
return fracTexs.includes(ans);
|
|
131
|
+
catch (err) {
|
|
132
|
+
return handleVEAError(err);
|
|
130
133
|
}
|
|
131
134
|
};
|
|
132
135
|
export const probaFromTableNoContext = {
|
|
@@ -143,5 +146,5 @@ export const probaFromTableNoContext = {
|
|
|
143
146
|
isAnswerValid,
|
|
144
147
|
subject: "Mathématiques",
|
|
145
148
|
getInstruction,
|
|
146
|
-
options,
|
|
149
|
+
// options,
|
|
147
150
|
};
|
|
@@ -8,9 +8,7 @@ type Identifiers = {
|
|
|
8
8
|
type: string;
|
|
9
9
|
probaFrac: number[];
|
|
10
10
|
};
|
|
11
|
-
type Options = {
|
|
12
|
-
allowNonIrreductible?: boolean;
|
|
13
|
-
};
|
|
11
|
+
type Options = {};
|
|
14
12
|
export declare const probaFromTableWithContext: Exercise<Identifiers, Options>;
|
|
15
13
|
export {};
|
|
16
14
|
//# sourceMappingURL=probaFromTableWithContext.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"probaFromTableWithContext.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/probaStat/probaFromTableWithContext.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"probaFromTableWithContext.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/probaStat/probaFromTableWithContext.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAYrC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC;AAoJF,KAAK,OAAO,GAAG,EAEd,CAAC;AAgBF,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAkBpE,CAAC"}
|
|
@@ -3,9 +3,9 @@ import { allowNonIrreductibleOption } from "../../../exercises/options/allowNonI
|
|
|
3
3
|
import { getDistinctQuestions } from "../../../exercises/utils/getDistinctQuestions.js";
|
|
4
4
|
import { Rational } from "../../../math/numbers/rationals/rational.js";
|
|
5
5
|
import { randint } from "../../../math/utils/random/randint.js";
|
|
6
|
-
import { FractionNode } from "../../../tree/nodes/operators/fractionNode.js";
|
|
7
6
|
import { rationalParser } from "../../../tree/parsers/rationalParser.js";
|
|
8
7
|
import { random } from "../../../utils/alea/random.js";
|
|
8
|
+
import { handleVEAError } from "../../../utils/errors/handleVEAError.js";
|
|
9
9
|
import { dollarize } from "../../../utils/latex/dollarize.js";
|
|
10
10
|
import { mdTable } from "../../../utils/markdown/mdTable.js";
|
|
11
11
|
const getInstruction = ({ aBarreCapB, aBarreCapBBarre, aCapB, aCapBBarre, event, probaFrac, type, }) => {
|
|
@@ -36,6 +36,14 @@ ${mdTable([
|
|
|
36
36
|
On choisit un élève au hasard. Quelle est la probabilité de tomber sur ${event} ?
|
|
37
37
|
`;
|
|
38
38
|
};
|
|
39
|
+
const getAnswer = (identifiers) => {
|
|
40
|
+
const { probaFrac } = identifiers;
|
|
41
|
+
const answer = new Rational(probaFrac[0], probaFrac[1])
|
|
42
|
+
.simplify()
|
|
43
|
+
.toTree()
|
|
44
|
+
.toTex();
|
|
45
|
+
return answer;
|
|
46
|
+
};
|
|
39
47
|
const getProbaFromTableWithContextQuestion = () => {
|
|
40
48
|
const aCapB = randint(1, 20);
|
|
41
49
|
const aCapBBarre = randint(1, 20);
|
|
@@ -91,7 +99,6 @@ const getProbaFromTableWithContextQuestion = () => {
|
|
|
91
99
|
]);
|
|
92
100
|
break;
|
|
93
101
|
}
|
|
94
|
-
const answer = new Rational(proba[0], proba[1]).simplify().toTree().toTex();
|
|
95
102
|
const identifiers = {
|
|
96
103
|
aBarreCapB,
|
|
97
104
|
aBarreCapBBarre,
|
|
@@ -102,7 +109,7 @@ const getProbaFromTableWithContextQuestion = () => {
|
|
|
102
109
|
probaFrac: proba,
|
|
103
110
|
};
|
|
104
111
|
const question = {
|
|
105
|
-
answer,
|
|
112
|
+
answer: getAnswer(identifiers),
|
|
106
113
|
instruction: getInstruction(identifiers),
|
|
107
114
|
keys: [],
|
|
108
115
|
answerFormat: "tex",
|
|
@@ -124,26 +131,21 @@ const getPropositions = (n, { answer, aBarreCapB, aBarreCapBBarre, aCapB, aCapBB
|
|
|
124
131
|
};
|
|
125
132
|
const options = [allowNonIrreductibleOption];
|
|
126
133
|
const isAnswerValid = (ans, { answer, probaFrac }, options) => {
|
|
127
|
-
|
|
134
|
+
try {
|
|
128
135
|
const parsed = rationalParser(ans);
|
|
129
136
|
if (!parsed)
|
|
130
137
|
return false;
|
|
131
138
|
return parsed.simplify().toTex() === answer;
|
|
132
139
|
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
.simplify()
|
|
136
|
-
.toAllValidTexs();
|
|
137
|
-
return fracTexs.includes(ans);
|
|
140
|
+
catch (err) {
|
|
141
|
+
return handleVEAError(err);
|
|
138
142
|
}
|
|
139
143
|
};
|
|
140
144
|
export const probaFromTableWithContext = {
|
|
141
145
|
id: "probaFromTableWithContext",
|
|
142
146
|
connector: "=",
|
|
143
147
|
label: "Utiliser un tableau à double entrée pour calculer une probabilité (avec contexte)",
|
|
144
|
-
levels: ["1rePro", "1reSpé", "1reTech", "1reESM", "2ndPro"],
|
|
145
148
|
isSingleStep: true,
|
|
146
|
-
sections: ["Probabilités"],
|
|
147
149
|
generator: (nb, options) => getDistinctQuestions(() => getProbaFromTableWithContextQuestion(options), nb),
|
|
148
150
|
qcmTimer: 60,
|
|
149
151
|
freeTimer: 60,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arithmeticFindExplicitFormula.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/arithmetic/arithmeticFindExplicitFormula.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAWrC,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;
|
|
1
|
+
{"version":3,"file":"arithmeticFindExplicitFormula.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/arithmetic/arithmeticFindExplicitFormula.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAWrC,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAsIF,eAAO,MAAM,6BAA6B,EAAE,QAAQ,CAAC,WAAW,CAoB/D,CAAC"}
|
|
@@ -80,12 +80,6 @@ const isAnswerValid = (ans, { answer, reason, firstValue }, opts) => {
|
|
|
80
80
|
const parsed = parseAlgebraic(formated);
|
|
81
81
|
if (!parsed)
|
|
82
82
|
return false;
|
|
83
|
-
console.log(parsed
|
|
84
|
-
.simplify({
|
|
85
|
-
towardsDistribute: true,
|
|
86
|
-
forbidFactorize: true,
|
|
87
|
-
})
|
|
88
|
-
.toTex());
|
|
89
83
|
return (parsed
|
|
90
84
|
.simplify({
|
|
91
85
|
towardsDistribute: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simpifySquareRoot.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/squareRoots/simpifySquareRoot.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"simpifySquareRoot.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/squareRoots/simpifySquareRoot.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,QAAQ,EAWT,MAAM,mBAAmB,CAAC;AAE3B,KAAK,WAAW,GAAG;IACjB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AA4DF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,CAepD,CAAC"}
|
|
@@ -2,20 +2,38 @@ import { SquareRoot, SquareRootConstructor, } from "../../../math/numbers/reals/
|
|
|
2
2
|
import { shuffle } from "../../../utils/alea/shuffle.js";
|
|
3
3
|
import { addValidProp, tryToAddWrongProp, } from "../../exercise.js";
|
|
4
4
|
import { getDistinctQuestions } from "../../utils/getDistinctQuestions.js";
|
|
5
|
+
const getStatementNode = (identifiers) => {
|
|
6
|
+
const squareRoot = new SquareRoot(identifiers.sqrtOperand);
|
|
7
|
+
return squareRoot.toTree();
|
|
8
|
+
};
|
|
9
|
+
const getStartStatement = (identifiers) => {
|
|
10
|
+
return getStatementNode(identifiers).toTex();
|
|
11
|
+
};
|
|
12
|
+
const getInstruction = (identifiers) => {
|
|
13
|
+
return `Simplifier :
|
|
14
|
+
|
|
15
|
+
$$
|
|
16
|
+
${getStartStatement(identifiers)}
|
|
17
|
+
$$`;
|
|
18
|
+
};
|
|
19
|
+
const getAnswer = (identifiers) => {
|
|
20
|
+
const squareRoot = new SquareRoot(identifiers.sqrtOperand);
|
|
21
|
+
const answer = squareRoot.simplify().toTree().toTex();
|
|
22
|
+
return answer;
|
|
23
|
+
};
|
|
5
24
|
const getSimplifySquareRoot = () => {
|
|
6
25
|
const squareRoot = SquareRootConstructor.randomSimplifiable({
|
|
7
26
|
allowPerfectSquare: false,
|
|
8
27
|
maxSquare: 11,
|
|
9
28
|
});
|
|
10
|
-
const
|
|
11
|
-
const answer = squareRoot.simplify().toTree().toTex();
|
|
29
|
+
const identifiers = { sqrtOperand: squareRoot.operand };
|
|
12
30
|
const question = {
|
|
13
|
-
instruction:
|
|
14
|
-
startStatement:
|
|
15
|
-
answer,
|
|
31
|
+
instruction: getInstruction(identifiers),
|
|
32
|
+
startStatement: getStartStatement(identifiers),
|
|
33
|
+
answer: getAnswer(identifiers),
|
|
16
34
|
keys: [],
|
|
17
35
|
answerFormat: "tex",
|
|
18
|
-
identifiers
|
|
36
|
+
identifiers,
|
|
19
37
|
};
|
|
20
38
|
return question;
|
|
21
39
|
};
|
|
@@ -49,4 +67,6 @@ export const simplifySquareRoot = {
|
|
|
49
67
|
getPropositions,
|
|
50
68
|
isAnswerValid,
|
|
51
69
|
subject: "Mathématiques",
|
|
70
|
+
getAnswer,
|
|
71
|
+
getInstruction,
|
|
52
72
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"squareRootEquation.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/squareRoots/squareRootEquation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"squareRootEquation.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/squareRoots/squareRootEquation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAUT,MAAM,6BAA6B,CAAC;AAWrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAwDF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,CAgBpD,CAAC"}
|
|
@@ -5,15 +5,28 @@ import { EquationSolutionNode } from "../../../tree/nodes/equations/equationSolu
|
|
|
5
5
|
import { NumberNode } from "../../../tree/nodes/numbers/numberNode.js";
|
|
6
6
|
import { DiscreteSetNode, EmptySet, } from "../../../tree/nodes/sets/discreteSetNode.js";
|
|
7
7
|
import { shuffle } from "../../../utils/alea/shuffle.js";
|
|
8
|
+
const getInstruction = (identifiers) => {
|
|
9
|
+
const { k } = identifiers;
|
|
10
|
+
return `Résoudre l'équation suivante :
|
|
11
|
+
|
|
12
|
+
$$
|
|
13
|
+
\\sqrt{x} = ${k}
|
|
14
|
+
$$`;
|
|
15
|
+
};
|
|
16
|
+
const getAnswer = (identifiers) => {
|
|
17
|
+
const { k } = identifiers;
|
|
18
|
+
const answer = k < 0 ? "S=\\varnothing" : `S=\\left\\{${k ** 2}\\right\\}`;
|
|
19
|
+
return answer;
|
|
20
|
+
};
|
|
8
21
|
const getSquareRootEquationQuestion = () => {
|
|
9
22
|
const k = Math.random() < 0.2 ? randint(-20, 0) : randint(0, 11);
|
|
10
|
-
const
|
|
23
|
+
const identifiers = { k };
|
|
11
24
|
const question = {
|
|
12
|
-
answer:
|
|
13
|
-
instruction:
|
|
25
|
+
answer: getAnswer(identifiers),
|
|
26
|
+
instruction: getInstruction(identifiers),
|
|
14
27
|
keys: ["S", "equal", "lbrace", "semicolon", "rbrace", "varnothing"],
|
|
15
28
|
answerFormat: "tex",
|
|
16
|
-
identifiers
|
|
29
|
+
identifiers,
|
|
17
30
|
};
|
|
18
31
|
return question;
|
|
19
32
|
};
|
|
@@ -49,4 +62,6 @@ export const squareRootEquation = {
|
|
|
49
62
|
getPropositions,
|
|
50
63
|
isAnswerValid,
|
|
51
64
|
subject: "Mathématiques",
|
|
65
|
+
getInstruction,
|
|
66
|
+
getAnswer,
|
|
52
67
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mainRemarkableValues.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/trigonometry/mainRemarkableValues.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mainRemarkableValues.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/trigonometry/mainRemarkableValues.ts"],"names":[],"mappings":"AASA,OAAO,EACL,QAAQ,EAYT,MAAM,mBAAmB,CAAC;AAE3B,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,OAAO,CAAC;CAChB,CAAC;AAqFF,eAAO,MAAM,4BAA4B,EAAE,QAAQ,CAAC,WAAW,CAe9D,CAAC"}
|
|
@@ -1,26 +1,47 @@
|
|
|
1
1
|
import { remarkableTrigoValues } from "../../../math/trigonometry/remarkableValues.js";
|
|
2
2
|
import { randint } from "../../../math/utils/random/randint.js";
|
|
3
|
+
import { cos } from "../../../tree/nodes/functions/cosNode.js";
|
|
4
|
+
import { sin } from "../../../tree/nodes/functions/sinNode.js";
|
|
5
|
+
import { parseAlgebraic } from "../../../tree/parsers/latexParser.js";
|
|
3
6
|
import { coinFlip } from "../../../utils/alea/coinFlip.js";
|
|
4
7
|
import { shuffle } from "../../../utils/alea/shuffle.js";
|
|
8
|
+
import { handleVEAError } from "../../../utils/errors/handleVEAError.js";
|
|
5
9
|
import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../exercise.js";
|
|
6
10
|
import { getDistinctQuestions } from "../../utils/getDistinctQuestions.js";
|
|
11
|
+
const getStatementNode = (identifiers) => {
|
|
12
|
+
const { isCos, valueIndex } = identifiers;
|
|
13
|
+
const remarkableValue = remarkableTrigoValues[valueIndex];
|
|
14
|
+
const statement = isCos
|
|
15
|
+
? cos(remarkableValue.angle)
|
|
16
|
+
: sin(remarkableValue.angle);
|
|
17
|
+
return statement;
|
|
18
|
+
};
|
|
19
|
+
const getStartStatement = (identifiers) => {
|
|
20
|
+
return getStatementNode(identifiers).toTex();
|
|
21
|
+
};
|
|
22
|
+
const getInstruction = (identifiers) => {
|
|
23
|
+
return `Donner la valeur exacte de :
|
|
24
|
+
|
|
25
|
+
$$
|
|
26
|
+
${getStartStatement(identifiers)}
|
|
27
|
+
$$`;
|
|
28
|
+
};
|
|
29
|
+
const getAnswer = (identifiers) => {
|
|
30
|
+
const { isCos, valueIndex } = identifiers;
|
|
31
|
+
const remarkableValue = remarkableTrigoValues[valueIndex];
|
|
32
|
+
return isCos ? remarkableValue.cos.toTex() : remarkableValue.sin.toTex();
|
|
33
|
+
};
|
|
7
34
|
const getMainRemarkableValues = () => {
|
|
8
35
|
const isCos = coinFlip();
|
|
9
36
|
const valueIndex = randint(0, remarkableTrigoValues.length);
|
|
10
|
-
const
|
|
11
|
-
const answer = isCos
|
|
12
|
-
? remarkableValue.cos.toTex()
|
|
13
|
-
: remarkableValue.sin.toTex();
|
|
14
|
-
const statement = isCos
|
|
15
|
-
? `\\cos\\left(${remarkableValue.angle.toTex()}\\right)`
|
|
16
|
-
: `\\sin\\left(${remarkableValue.angle.toTex()}\\right)`;
|
|
37
|
+
const identifiers = { valueIndex, isCos };
|
|
17
38
|
const question = {
|
|
18
|
-
instruction:
|
|
19
|
-
startStatement:
|
|
20
|
-
answer:
|
|
39
|
+
instruction: getInstruction(identifiers),
|
|
40
|
+
startStatement: getStartStatement(identifiers),
|
|
41
|
+
answer: getAnswer(identifiers),
|
|
21
42
|
keys: ["pi", "cos", "sin"],
|
|
22
43
|
answerFormat: "tex",
|
|
23
|
-
identifiers
|
|
44
|
+
identifiers,
|
|
24
45
|
};
|
|
25
46
|
return question;
|
|
26
47
|
};
|
|
@@ -29,12 +50,12 @@ const getPropositions = (n, { answer }) => {
|
|
|
29
50
|
addValidProp(propositions, answer);
|
|
30
51
|
const values = [
|
|
31
52
|
"-1",
|
|
32
|
-
"-\\frac{\\sqrt
|
|
33
|
-
"-\\frac{\\sqrt
|
|
53
|
+
"-\\frac{\\sqrt{3}}{2}",
|
|
54
|
+
"-\\frac{\\sqrt{2}}{2}",
|
|
34
55
|
"-\\frac{1}{2}",
|
|
35
56
|
"0",
|
|
36
|
-
"\\frac{\\sqrt
|
|
37
|
-
"\\frac{\\sqrt
|
|
57
|
+
"\\frac{\\sqrt{3}}{2}",
|
|
58
|
+
"\\frac{\\sqrt{2}}{2}",
|
|
38
59
|
"\\frac{1}{2}",
|
|
39
60
|
"1",
|
|
40
61
|
];
|
|
@@ -44,14 +65,18 @@ const getPropositions = (n, { answer }) => {
|
|
|
44
65
|
});
|
|
45
66
|
return shuffleProps(propositions, n);
|
|
46
67
|
};
|
|
47
|
-
const isAnswerValid = (ans, { valueIndex, isCos }) => {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
68
|
+
const isAnswerValid = (ans, { answer, valueIndex, isCos }) => {
|
|
69
|
+
try {
|
|
70
|
+
const parsed = parseAlgebraic(ans);
|
|
71
|
+
if (!parsed)
|
|
72
|
+
return false;
|
|
73
|
+
return (parsed
|
|
74
|
+
.simplify({ forbidTrigo: true, decimalToFractions: true })
|
|
75
|
+
.toTex() === answer);
|
|
76
|
+
}
|
|
77
|
+
catch (err) {
|
|
78
|
+
return handleVEAError(err);
|
|
79
|
+
}
|
|
55
80
|
};
|
|
56
81
|
export const mainRemarkableValuesExercise = {
|
|
57
82
|
id: "mainRemarkableValues",
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { NodeIdentifiers } from "../../../tree/nodes/nodeConstructor.js";
|
|
1
2
|
import { Exercise } from "../../exercise.js";
|
|
2
3
|
type Identifiers = {
|
|
3
4
|
mainValue: number;
|
|
4
5
|
isCos: boolean;
|
|
6
|
+
angleIdentifiers: NodeIdentifiers;
|
|
5
7
|
};
|
|
6
8
|
export declare const remarkableValuesExercise: Exercise<Identifiers>;
|
|
7
9
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remarkableValues.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/trigonometry/remarkableValues.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"remarkableValues.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/trigonometry/remarkableValues.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;AAM7C,OAAO,EACL,QAAQ,EAWT,MAAM,mBAAmB,CAAC;AA2C3B,KAAK,WAAW,GAAG;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,OAAO,CAAC;IACf,gBAAgB,EAAE,eAAe,CAAC;CACnC,CAAC;AA4CF,eAAO,MAAM,wBAAwB,EAAE,QAAQ,CAAC,WAAW,CAe1D,CAAC"}
|