math-exercises 2.2.90 → 2.2.91
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/calculLitteral/equation/choseOperationToSolveEquation.js +13 -6
- package/lib/exercises/math/calculLitteral/equation/equationSimpleSquare.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/equationSimpleSquare.js +68 -68
- package/lib/exercises/math/calculLitteral/equation/equationType1Exercise.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/equationType1Exercise.js +59 -22
- package/lib/exercises/math/calculLitteral/equation/equationType2Exercise.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/equationType2Exercise.js +65 -34
- package/lib/exercises/math/calculLitteral/equation/equationType3Exercise.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/equationType3Exercise.js +54 -22
- package/lib/exercises/math/calculLitteral/equation/equationType4Exercise.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/equationType4Exercise.js +35 -15
- package/lib/exercises/math/calculLitteral/equation/firstDegreeEquation.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/firstDegreeEquation.js +51 -29
- package/lib/exercises/math/calculLitteral/equation/firstDegreeEquationIntType1.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/firstDegreeEquationIntType1.js +48 -21
- package/lib/exercises/math/calculLitteral/equation/firstDegreeEquationIntType2.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/firstDegreeEquationIntType2.js +44 -22
- package/lib/exercises/math/calculLitteral/equation/firstDegreeEquationIntType3.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/firstDegreeEquationIntType3.js +22 -8
- package/lib/exercises/math/calculLitteral/factorisation/factoType1Exercise.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/factorisation/factoType1Exercise.js +27 -16
- package/lib/exercises/math/combinatory/ballsCounting.d.ts.map +1 -1
- package/lib/exercises/math/combinatory/ballsCounting.js +44 -18
- package/lib/exercises/math/functions/affines/affineAdjustment.d.ts +0 -4
- package/lib/exercises/math/functions/affines/affineAdjustment.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/affineAdjustment.js +27 -27
- package/lib/exercises/math/functions/affines/affineAdjustmentComplete.d.ts +0 -5
- package/lib/exercises/math/functions/affines/affineAdjustmentComplete.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/affineAdjustmentComplete.js +45 -62
- package/lib/exercises/math/functions/affines/affineAdjustmentRsquared.d.ts +0 -1
- package/lib/exercises/math/functions/affines/affineAdjustmentRsquared.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/affineAdjustmentRsquared.js +32 -48
- package/lib/exercises/math/matrices/productCell.js +1 -1
- package/lib/exercises/math/probaStat/probaFromTableWithContext.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/interquartilesList.js +1 -1
- package/lib/exercises/math/probaStat/stats1var/interquartilesTable.js +1 -1
- package/lib/exercises/math/probaStat/stats1var/standardDeviationList.js +2 -2
- package/lib/exercises/math/probaStat/stats1var/standardDeviationTable.js +2 -2
- package/lib/exercises/math/probaStat/stats1var/varianceList.js +1 -1
- package/lib/exercises/math/probaStat/stats1var/varianceTable.js +1 -1
- package/lib/index.d.ts +0 -10
- package/lib/index.d.ts.map +1 -1
- package/lib/math/geometry/CloudPoints.js +2 -2
- package/lib/math/probability/binomial.js +1 -1
- package/lib/math/utils/round.d.ts.map +1 -1
- package/lib/math/utils/round.js +19 -5
- package/lib/math/utils/stats/covariance.d.ts +4 -0
- package/lib/math/utils/stats/covariance.d.ts.map +1 -0
- package/lib/math/utils/stats/covariance.js +26 -0
- package/lib/math/utils/stats/generateAffineCloud.d.ts +5 -0
- package/lib/math/utils/stats/generateAffineCloud.d.ts.map +1 -0
- package/lib/math/utils/stats/generateAffineCloud.js +23 -0
- package/lib/math/utils/stats/leastSquares.d.ts +5 -0
- package/lib/math/utils/stats/leastSquares.d.ts.map +1 -0
- package/lib/math/utils/stats/leastSquares.js +19 -0
- package/lib/math/utils/stats/quartiles.d.ts +3 -0
- package/lib/math/utils/stats/quartiles.d.ts.map +1 -0
- package/lib/math/utils/stats/quartiles.js +47 -0
- package/lib/math/utils/stats/rSquared.d.ts +2 -0
- package/lib/math/utils/stats/rSquared.d.ts.map +1 -0
- package/lib/math/utils/stats/rSquared.js +17 -0
- package/lib/math/utils/stats/standardDeviation.d.ts +3 -0
- package/lib/math/utils/stats/standardDeviation.d.ts.map +1 -0
- package/lib/math/utils/stats/standardDeviation.js +13 -0
- package/lib/math/utils/stats/sum.d.ts +8 -0
- package/lib/math/utils/stats/sum.d.ts.map +1 -0
- package/lib/math/utils/stats/sum.js +17 -0
- package/lib/math/utils/stats/variance.d.ts +5 -0
- package/lib/math/utils/stats/variance.d.ts.map +1 -0
- package/lib/math/utils/stats/variance.js +35 -0
- package/lib/playground.d.ts.map +1 -1
- package/lib/tree/nodes/operators/limitNode.d.ts +1 -1
- package/lib/tree/parsers/discreteSetParser.d.ts.map +1 -1
- package/lib/tree/parsers/discreteSetParser.js +3 -0
- package/package.json +1 -1
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
// } from "../../../../tree/nodes/nodeConstructor";
|
|
29
29
|
// type Identifiers = {
|
|
30
30
|
// equaIdentifiers: EqualNodeIdentifiers;
|
|
31
|
+
// type: number
|
|
31
32
|
// };
|
|
32
33
|
// const getPropositions: QCMGenerator<Identifiers> = (n, { answer }) => {
|
|
33
34
|
// const propositions: Proposition[] = [];
|
|
@@ -71,22 +72,28 @@
|
|
|
71
72
|
// switch (type) {
|
|
72
73
|
// case 1:
|
|
73
74
|
// //ax = b tous entiers
|
|
74
|
-
// a = randint(
|
|
75
|
-
//
|
|
76
|
-
// case 2:
|
|
75
|
+
// a = randint(2, 10);
|
|
76
|
+
// b = randint(2, 10)
|
|
77
77
|
// break;
|
|
78
|
+
// case 2 :
|
|
79
|
+
// // ax + b = c tous entiers
|
|
80
|
+
// break;
|
|
78
81
|
// case 3:
|
|
82
|
+
// //ax-b = c tous entiers
|
|
79
83
|
// break;
|
|
80
84
|
// case 4:
|
|
81
|
-
//
|
|
85
|
+
// //x/a = b tous entiers
|
|
86
|
+
// break;
|
|
82
87
|
// case 5:
|
|
83
|
-
//
|
|
88
|
+
// //x+a = b
|
|
89
|
+
// break;
|
|
84
90
|
// case 6:
|
|
91
|
+
// //x-a = b
|
|
85
92
|
// break;
|
|
86
93
|
// case 7:
|
|
87
94
|
// break;
|
|
88
95
|
// }
|
|
89
|
-
// const identifiers: Identifiers = {};
|
|
96
|
+
// const identifiers: Identifiers = {type, };
|
|
90
97
|
// const question: Question<Identifiers> = {
|
|
91
98
|
// answer: getAnswer(identifiers),
|
|
92
99
|
// instruction: getInstruction(identifiers),
|
|
@@ -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,EAaT,MAAM,0BAA0B,CAAC;AA2BlC,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AA+JF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAkBtD,CAAC"}
|
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.equationSimpleSquare = void 0;
|
|
4
4
|
const exercise_1 = require("../../../../exercises/exercise");
|
|
5
5
|
const getDistinctQuestions_1 = require("../../../../exercises/utils/getDistinctQuestions");
|
|
6
|
-
const equationKeys_1 = require("../../../../exercises/utils/keys/equationKeys");
|
|
7
6
|
const rational_1 = require("../../../../math/numbers/rationals/rational");
|
|
8
7
|
const real_1 = require("../../../../math/numbers/reals/real");
|
|
9
8
|
const randint_1 = require("../../../../math/utils/random/randint");
|
|
@@ -15,6 +14,7 @@ const coinFlip_1 = require("../../../../utils/alea/coinFlip");
|
|
|
15
14
|
const diceFlip_1 = require("../../../../utils/alea/diceFlip");
|
|
16
15
|
const isInt_1 = require("../../../../utils/isInt");
|
|
17
16
|
const random_1 = require("../../../../utils/alea/random");
|
|
17
|
+
const discreteSetParser_1 = require("../../../../tree/parsers/discreteSetParser");
|
|
18
18
|
const squares = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12].map((el) => el ** 2);
|
|
19
19
|
const higherFactor = (n) => {
|
|
20
20
|
for (let i = Math.floor(Math.sqrt(n)); i > 0; i--)
|
|
@@ -22,65 +22,77 @@ const higherFactor = (n) => {
|
|
|
22
22
|
return i;
|
|
23
23
|
return 1;
|
|
24
24
|
};
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
25
|
+
const getInstruction = (identifiers) => {
|
|
26
|
+
const { randNbr } = identifiers;
|
|
27
|
+
return `Résoudre l'équation :
|
|
28
|
+
|
|
29
|
+
$$
|
|
30
|
+
x^2 = ${randNbr}
|
|
31
|
+
$$`;
|
|
32
|
+
};
|
|
33
|
+
const getHint = (identifiers) => {
|
|
34
|
+
return `L'équation $x^2 = k$ :
|
|
35
|
+
|
|
36
|
+
- n'admet pas de solution si $k<0$,
|
|
37
|
+
- admet une solution si $k=0$, qui est $0$
|
|
38
|
+
- admet deux solutions si $k>0$, qui sont $-\\sqrt{k}$ et $\\sqrt{k}$
|
|
39
|
+
`;
|
|
40
|
+
};
|
|
41
|
+
const getAnswer = (identifiers) => {
|
|
42
|
+
const { randNbr } = identifiers;
|
|
36
43
|
let solutionsSet;
|
|
37
|
-
let simplifiedRoot;
|
|
38
44
|
if (randNbr < 0) {
|
|
39
45
|
solutionsSet = new discreteSetNode_1.DiscreteSetNode([]);
|
|
40
46
|
}
|
|
41
|
-
else if (
|
|
42
|
-
|
|
43
|
-
solutionsSet = new discreteSetNode_1.DiscreteSetNode([new numberNode_1.NumberNode(0)]);
|
|
44
|
-
else
|
|
45
|
-
solutionsSet = new discreteSetNode_1.DiscreteSetNode([
|
|
46
|
-
new numberNode_1.NumberNode(-sqrt),
|
|
47
|
-
new numberNode_1.NumberNode(+sqrt),
|
|
48
|
-
]);
|
|
47
|
+
else if (randNbr === 0) {
|
|
48
|
+
solutionsSet = new discreteSetNode_1.DiscreteSetNode([new numberNode_1.NumberNode(0)]);
|
|
49
49
|
}
|
|
50
50
|
else {
|
|
51
51
|
const tree = new real_1.SquareRoot(randNbr).simplify().toTree();
|
|
52
52
|
solutionsSet = new discreteSetNode_1.DiscreteSetNode([new oppositeNode_1.OppositeNode(tree), tree]);
|
|
53
53
|
}
|
|
54
54
|
const answer = new equationSolutionNode_1.EquationSolutionNode(solutionsSet).toTex();
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
hint: `L'équation $x^2 = k$ :
|
|
62
|
-
|
|
63
|
-
- n'admet pas de solution si $k<0$,
|
|
64
|
-
- admet une solution si $k=0$, qui est $0$
|
|
65
|
-
- admet deux solutions si $k>0$, qui sont $-\\sqrt{k}$ et $\\sqrt{k}$
|
|
66
|
-
`,
|
|
67
|
-
correction: `
|
|
55
|
+
return answer;
|
|
56
|
+
};
|
|
57
|
+
const getCorrection = (identifiers) => {
|
|
58
|
+
const { randNbr } = identifiers;
|
|
59
|
+
const answer = getAnswer(identifiers);
|
|
60
|
+
return `
|
|
68
61
|
${randNbr < 0
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
62
|
+
? `L'équation $x^2 = ${randNbr}$ n'admet pas de solution, car $${randNbr}$ est négatif. Ainsi, $${answer}$.`
|
|
63
|
+
: randNbr === 0
|
|
64
|
+
? `L'équation $x^2 = 0$ admet une unique solution : $0$. En effet, $0$ est le seul nombre qui au carré est égal à $0$. Ainsi, $${answer}$.`
|
|
65
|
+
: `Puisque $${randNbr}>0$, l'équation $x^2 = ${randNbr}$ admet deux solutions : $-\\sqrt{${randNbr}}$ et $\\sqrt{${randNbr}}$.
|
|
73
66
|
|
|
74
67
|
${new real_1.SquareRoot(randNbr).isSimplifiable()
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
68
|
+
? `Or, $\\sqrt{${randNbr}}=${new real_1.SquareRoot(randNbr)
|
|
69
|
+
.simplify()
|
|
70
|
+
.toTree()
|
|
71
|
+
.toTex()}$.`
|
|
72
|
+
: ""}
|
|
80
73
|
|
|
81
74
|
Ainsi, $${answer}$.
|
|
82
75
|
`}
|
|
83
|
-
|
|
76
|
+
`;
|
|
77
|
+
};
|
|
78
|
+
const getEquationSimpleSquare = () => {
|
|
79
|
+
let randNbr;
|
|
80
|
+
const rand = (0, diceFlip_1.diceFlip)(10);
|
|
81
|
+
if (rand === 1)
|
|
82
|
+
randNbr = (0, randint_1.randint)(-20, 0);
|
|
83
|
+
else if (rand < 6)
|
|
84
|
+
randNbr = (0, random_1.random)(squares);
|
|
85
|
+
else
|
|
86
|
+
randNbr = (0, randint_1.randint)(2, 100);
|
|
87
|
+
const identifiers = { randNbr };
|
|
88
|
+
const question = {
|
|
89
|
+
instruction: getInstruction(identifiers),
|
|
90
|
+
answer: getAnswer(identifiers),
|
|
91
|
+
keys: ["S", "equal", "lbrace", "semicolon", "rbrace", "varnothing"],
|
|
92
|
+
answerFormat: "tex",
|
|
93
|
+
identifiers,
|
|
94
|
+
hint: getHint(identifiers),
|
|
95
|
+
correction: getCorrection(identifiers),
|
|
84
96
|
};
|
|
85
97
|
return question;
|
|
86
98
|
};
|
|
@@ -121,32 +133,16 @@ const getPropositions = (n, { answer, randNbr }) => {
|
|
|
121
133
|
}
|
|
122
134
|
return (0, exercise_1.shuffleProps)(propositions, n);
|
|
123
135
|
};
|
|
124
|
-
const isAnswerValid = (ans, { randNbr }) => {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
136
|
+
const isAnswerValid = (ans, { answer, randNbr }) => {
|
|
137
|
+
try {
|
|
138
|
+
const parsed = (0, discreteSetParser_1.discreteSetParser)(ans);
|
|
139
|
+
if (!parsed)
|
|
140
|
+
return false;
|
|
141
|
+
return "S=" + parsed.simplify().toTex() === answer;
|
|
128
142
|
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
new equationSolutionNode_1.EquationSolutionNode(new discreteSetNode_1.DiscreteSetNode([new numberNode_1.NumberNode(0)])),
|
|
132
|
-
];
|
|
133
|
-
}
|
|
134
|
-
// else if (randNbr === 1) {
|
|
135
|
-
// answerTrees = [
|
|
136
|
-
// new EquationSolutionNode(new DiscreteSetNode([new NumberNode(1)])),
|
|
137
|
-
// ];
|
|
138
|
-
// }
|
|
139
|
-
else {
|
|
140
|
-
const sqrt = new real_1.SquareRoot(randNbr);
|
|
141
|
-
const sqrtTree = sqrt.toTree();
|
|
142
|
-
answerTrees.push(new equationSolutionNode_1.EquationSolutionNode(new discreteSetNode_1.DiscreteSetNode([new oppositeNode_1.OppositeNode(sqrtTree), sqrtTree])));
|
|
143
|
-
if (sqrt.isSimplifiable()) {
|
|
144
|
-
const simplified = sqrt.simplify().toTree();
|
|
145
|
-
answerTrees.push(new equationSolutionNode_1.EquationSolutionNode(new discreteSetNode_1.DiscreteSetNode([new oppositeNode_1.OppositeNode(simplified), simplified])));
|
|
146
|
-
}
|
|
143
|
+
catch (err) {
|
|
144
|
+
return false;
|
|
147
145
|
}
|
|
148
|
-
const texs = answerTrees.flatMap((tree) => tree.toAllValidTexs());
|
|
149
|
-
return texs.includes(ans);
|
|
150
146
|
};
|
|
151
147
|
exports.equationSimpleSquare = {
|
|
152
148
|
id: "equationSimpleSquare",
|
|
@@ -162,4 +158,8 @@ exports.equationSimpleSquare = {
|
|
|
162
158
|
isAnswerValid,
|
|
163
159
|
subject: "Mathématiques",
|
|
164
160
|
hasHintAndCorrection: true,
|
|
161
|
+
getAnswer,
|
|
162
|
+
getCorrection,
|
|
163
|
+
getInstruction,
|
|
164
|
+
getHint,
|
|
165
165
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"equationType1Exercise.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/equation/equationType1Exercise.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"equationType1Exercise.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/equation/equationType1Exercise.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,0BAA0B,CAAC;AAclC;;GAEG;AACH,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAmGF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,WAAW,CAoBvD,CAAC"}
|
|
@@ -12,33 +12,65 @@ const equalNode_1 = require("../../../../tree/nodes/equations/equalNode");
|
|
|
12
12
|
const alignTex_1 = require("../../../../utils/latex/alignTex");
|
|
13
13
|
const addNode_1 = require("../../../../tree/nodes/operators/addNode");
|
|
14
14
|
const equationVEA_1 = require("../../../../exercises/vea/equationVEA");
|
|
15
|
-
const
|
|
16
|
-
const b =
|
|
17
|
-
const a = (0, randint_1.randint)(-10, 11, [0]);
|
|
18
|
-
const solution = b - a;
|
|
15
|
+
const getInstruction = (identifiers) => {
|
|
16
|
+
const { a, b } = identifiers;
|
|
19
17
|
const affine = new affine_1.Affine(1, a).toTree();
|
|
20
18
|
const tree = new equalNode_1.EqualNode(affine, new numberNode_1.NumberNode(b));
|
|
19
|
+
const statementTree = tree.toTex();
|
|
20
|
+
return `Résoudre :
|
|
21
|
+
|
|
22
|
+
$$
|
|
23
|
+
${statementTree}
|
|
24
|
+
$$`;
|
|
25
|
+
};
|
|
26
|
+
const getAnswer = (identifiers) => {
|
|
27
|
+
const { a, b } = identifiers;
|
|
28
|
+
const solution = b - a;
|
|
21
29
|
const answer = `x=${solution}`;
|
|
30
|
+
return answer;
|
|
31
|
+
};
|
|
32
|
+
const getHint = (identifiers) => {
|
|
33
|
+
const { a, b } = identifiers;
|
|
34
|
+
return `Il faut isoler $x$ à gauche. Pour cela, effectue l'opération des deux côtés de l'équation qui permet de supprimer le terme $${a < 0 ? "" : "+"}${a}$.`;
|
|
35
|
+
};
|
|
36
|
+
const getCorrection = (identifiers) => {
|
|
37
|
+
const { a, b } = identifiers;
|
|
38
|
+
const affine = new affine_1.Affine(1, a).toTree();
|
|
39
|
+
const tree = new equalNode_1.EqualNode(affine, new numberNode_1.NumberNode(b));
|
|
22
40
|
const statementTree = tree.toTex();
|
|
41
|
+
const answer = getAnswer(identifiers);
|
|
42
|
+
return `Pour isoler $x$ à gauche, on effectue l'opération $${a > 0 ? `$-${a}$` : `+${Math.abs(a)}`}$ des deux côtés de l'équation :
|
|
43
|
+
|
|
44
|
+
${(0, alignTex_1.alignTex)([
|
|
45
|
+
[
|
|
46
|
+
`${statementTree}`,
|
|
47
|
+
"\\iff",
|
|
48
|
+
new equalNode_1.EqualNode(new addNode_1.AddNode(affine, new numberNode_1.NumberNode(-a)), new addNode_1.AddNode(b.toTree(), new numberNode_1.NumberNode(-a))).toTex(),
|
|
49
|
+
],
|
|
50
|
+
["", "\\iff", answer],
|
|
51
|
+
])}
|
|
52
|
+
`;
|
|
53
|
+
};
|
|
54
|
+
const getStartStatement = (identifiers) => {
|
|
55
|
+
const { a, b } = identifiers;
|
|
56
|
+
const affine = new affine_1.Affine(1, a).toTree();
|
|
57
|
+
const tree = new equalNode_1.EqualNode(affine, new numberNode_1.NumberNode(b));
|
|
58
|
+
const statementTree = tree.toTex();
|
|
59
|
+
return statementTree;
|
|
60
|
+
};
|
|
61
|
+
const getEquationType1ExerciseQuestion = () => {
|
|
62
|
+
const b = (0, randint_1.randint)(-10, 11);
|
|
63
|
+
const a = (0, randint_1.randint)(-10, 11, [0]);
|
|
64
|
+
const identifiers = { a, b };
|
|
23
65
|
const question = {
|
|
24
|
-
instruction:
|
|
25
|
-
startStatement:
|
|
26
|
-
answer,
|
|
66
|
+
instruction: getInstruction(identifiers),
|
|
67
|
+
startStatement: getStartStatement(identifiers),
|
|
68
|
+
answer: getAnswer(identifiers),
|
|
27
69
|
keys: equationKeys_1.equationKeys,
|
|
28
70
|
answerFormat: "tex",
|
|
29
|
-
identifiers
|
|
30
|
-
hint:
|
|
31
|
-
correction:
|
|
32
|
-
|
|
33
|
-
${(0, alignTex_1.alignTex)([
|
|
34
|
-
[
|
|
35
|
-
`${statementTree}`,
|
|
36
|
-
"\\iff",
|
|
37
|
-
new equalNode_1.EqualNode(new addNode_1.AddNode(affine, new numberNode_1.NumberNode(-a)), new addNode_1.AddNode(b.toTree(), new numberNode_1.NumberNode(-a))).toTex(),
|
|
38
|
-
],
|
|
39
|
-
["", "\\iff", answer],
|
|
40
|
-
])}
|
|
41
|
-
`,
|
|
71
|
+
identifiers,
|
|
72
|
+
hint: getHint(identifiers),
|
|
73
|
+
correction: getCorrection(identifiers),
|
|
42
74
|
};
|
|
43
75
|
return question;
|
|
44
76
|
};
|
|
@@ -46,10 +78,10 @@ const getPropositions = (n, { answer, a, b }) => {
|
|
|
46
78
|
const propositions = [];
|
|
47
79
|
(0, exercise_1.addValidProp)(propositions, answer);
|
|
48
80
|
const solution = b - a;
|
|
49
|
-
(0, exercise_1.tryToAddWrongProp)(propositions, `x
|
|
81
|
+
(0, exercise_1.tryToAddWrongProp)(propositions, `x=${b + a}`);
|
|
50
82
|
while (propositions.length < n) {
|
|
51
83
|
const wrongAnswer = solution + (0, randint_1.randint)(-3, 4, [0]);
|
|
52
|
-
(0, exercise_1.tryToAddWrongProp)(propositions, `x
|
|
84
|
+
(0, exercise_1.tryToAddWrongProp)(propositions, `x=${wrongAnswer}`);
|
|
53
85
|
}
|
|
54
86
|
return (0, shuffle_1.shuffle)(propositions);
|
|
55
87
|
};
|
|
@@ -71,4 +103,9 @@ exports.equationType1Exercise = {
|
|
|
71
103
|
isAnswerValid,
|
|
72
104
|
subject: "Mathématiques",
|
|
73
105
|
hasHintAndCorrection: true,
|
|
106
|
+
getCorrection,
|
|
107
|
+
getHint,
|
|
108
|
+
getInstruction,
|
|
109
|
+
getAnswer,
|
|
110
|
+
getStartStatement,
|
|
74
111
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"equationType2Exercise.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/equation/equationType2Exercise.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"equationType2Exercise.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/equation/equationType2Exercise.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAiBT,MAAM,0BAA0B,CAAC;AAsBlC,OAAO,EAEL,eAAe,EAEhB,MAAM,kCAAkC,CAAC;AAM1C;;GAEG;AAGH,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,eAAe,CAAC;IACnB,CAAC,EAAE,eAAe,CAAC;IACnB,QAAQ,EAAE,OAAO,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAuIF,KAAK,OAAO,GAAG;IACb,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB,CAAC;AAaF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAqBhE,CAAC"}
|
|
@@ -18,15 +18,60 @@ const nodeConstructor_1 = require("../../../../tree/nodes/nodeConstructor");
|
|
|
18
18
|
const substractNode_1 = require("../../../../tree/nodes/operators/substractNode");
|
|
19
19
|
const addNode_1 = require("../../../../tree/nodes/operators/addNode");
|
|
20
20
|
const equationVEA_1 = require("../../../../exercises/vea/equationVEA");
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
};
|
|
21
|
+
const getInstruction = (identifiers) => {
|
|
22
|
+
return `Résoudre :
|
|
23
|
+
|
|
24
|
+
$$
|
|
25
|
+
${getStatementNode(identifiers).toTex()}
|
|
26
|
+
$$`;
|
|
27
|
+
};
|
|
28
|
+
const getAnswer = (identifiers) => {
|
|
29
|
+
const { a, b, isXRight, aNumberType } = identifiers;
|
|
30
|
+
const aTree = (0, nodeConstructor_1.reifyAlgebraic)(a);
|
|
31
|
+
const bTree = (0, nodeConstructor_1.reifyAlgebraic)(b);
|
|
32
|
+
const solution = (0, fractionNode_1.frac)(bTree, aTree).simplify();
|
|
33
|
+
const answer = new equalNode_1.EqualNode(new variableNode_1.VariableNode("x"), solution).toTex();
|
|
34
|
+
return answer;
|
|
35
|
+
};
|
|
36
|
+
const getHint = (identifiers) => {
|
|
37
|
+
const { a, b, isXRight, aNumberType } = identifiers;
|
|
38
|
+
const aTree = (0, nodeConstructor_1.reifyAlgebraic)(a);
|
|
39
|
+
const bTree = (0, nodeConstructor_1.reifyAlgebraic)(b);
|
|
40
|
+
return `Il faut isoler $x$ à ${isXRight ? "droite" : "gauche"}. Pour cela, effectue l'opération des deux côtés de l'équation qui permet de supprimer la multiplication par $${aTree.toTex()}$.`;
|
|
41
|
+
};
|
|
42
|
+
const getCorrection = (identifiers) => {
|
|
43
|
+
const { a, b, isXRight, aNumberType } = identifiers;
|
|
44
|
+
const aTree = (0, nodeConstructor_1.reifyAlgebraic)(a);
|
|
45
|
+
const bTree = (0, nodeConstructor_1.reifyAlgebraic)(b);
|
|
46
|
+
const affine = new generalAffine_1.GeneralAffine(aTree, 0).toTree();
|
|
47
|
+
const equalTree = new equalNode_1.EqualNode(affine, bTree);
|
|
48
|
+
const tree = isXRight ? equalTree.reverse() : equalTree;
|
|
49
|
+
const answer = getAnswer(identifiers);
|
|
50
|
+
return `Pour isoler $x$ à ${isXRight ? "droite" : "gauche"}, on divise les deux côtés de l'équation par $${aTree.toTex()}$ :
|
|
51
|
+
|
|
52
|
+
${(0, alignTex_1.alignTex)([
|
|
53
|
+
[
|
|
54
|
+
`${tree.toTex()}`,
|
|
55
|
+
"\\iff",
|
|
56
|
+
isXRight
|
|
57
|
+
? (0, equalNode_1.equal)((0, fractionNode_1.frac)(bTree, aTree), (0, fractionNode_1.frac)(affine, aTree)).toTex()
|
|
58
|
+
: (0, equalNode_1.equal)((0, fractionNode_1.frac)(affine, aTree), (0, fractionNode_1.frac)(bTree, aTree)).toTex(),
|
|
59
|
+
],
|
|
60
|
+
["", "\\iff", answer],
|
|
61
|
+
])}
|
|
62
|
+
`;
|
|
63
|
+
};
|
|
64
|
+
const getStatementNode = (identifiers) => {
|
|
65
|
+
const { a, b, isXRight, aNumberType } = identifiers;
|
|
66
|
+
const aTree = (0, nodeConstructor_1.reifyAlgebraic)(a);
|
|
67
|
+
const bTree = (0, nodeConstructor_1.reifyAlgebraic)(b);
|
|
68
|
+
const affine = new generalAffine_1.GeneralAffine(aTree, 0).toTree();
|
|
69
|
+
const equalTree = new equalNode_1.EqualNode(affine, bTree);
|
|
70
|
+
const tree = isXRight ? equalTree.reverse() : equalTree;
|
|
71
|
+
return tree;
|
|
72
|
+
};
|
|
73
|
+
const getStartStatement = (identifiers) => {
|
|
74
|
+
return getStatementNode(identifiers).toTex();
|
|
30
75
|
};
|
|
31
76
|
const getEquationType2ExerciseQuestion = (opts) => {
|
|
32
77
|
const types = opts?.aNumberType ?? ["Entier"];
|
|
@@ -35,13 +80,7 @@ const getEquationType2ExerciseQuestion = (opts) => {
|
|
|
35
80
|
const a = type === "Entier"
|
|
36
81
|
? (0, randint_1.randint)(-9, 10, [0, 1]).toTree()
|
|
37
82
|
: rational_1.RationalConstructor.randomIrreductibleWithSign().toTree();
|
|
38
|
-
const solution = (0, fractionNode_1.frac)(b, a).simplify();
|
|
39
|
-
const affine = new generalAffine_1.GeneralAffine(a, 0).toTree();
|
|
40
83
|
const isXRight = (0, coinFlip_1.coinFlip)();
|
|
41
|
-
const equalTree = new equalNode_1.EqualNode(affine, b);
|
|
42
|
-
const tree = isXRight ? equalTree.reverse() : equalTree;
|
|
43
|
-
const answer = new equalNode_1.EqualNode(new variableNode_1.VariableNode("x"), solution).toTex();
|
|
44
|
-
const statementTex = tree.toTex();
|
|
45
84
|
const identifiers = {
|
|
46
85
|
a: a.toIdentifiers(),
|
|
47
86
|
b: b.toIdentifiers(),
|
|
@@ -49,26 +88,14 @@ const getEquationType2ExerciseQuestion = (opts) => {
|
|
|
49
88
|
aNumberType: type,
|
|
50
89
|
};
|
|
51
90
|
const question = {
|
|
52
|
-
instruction:
|
|
53
|
-
startStatement:
|
|
54
|
-
answer,
|
|
91
|
+
instruction: getInstruction(identifiers),
|
|
92
|
+
startStatement: getStartStatement(identifiers),
|
|
93
|
+
answer: getAnswer(identifiers),
|
|
55
94
|
keys: equationKeys_1.equationKeys,
|
|
56
95
|
answerFormat: "tex",
|
|
57
|
-
identifiers
|
|
58
|
-
hint:
|
|
59
|
-
correction:
|
|
60
|
-
|
|
61
|
-
${(0, alignTex_1.alignTex)([
|
|
62
|
-
[
|
|
63
|
-
`${statementTex}`,
|
|
64
|
-
"\\iff",
|
|
65
|
-
isXRight
|
|
66
|
-
? (0, equalNode_1.equal)((0, fractionNode_1.frac)(b, a), (0, fractionNode_1.frac)(affine, a)).toTex()
|
|
67
|
-
: (0, equalNode_1.equal)((0, fractionNode_1.frac)(affine, a), (0, fractionNode_1.frac)(b, a)).toTex(),
|
|
68
|
-
],
|
|
69
|
-
["", "\\iff", answer],
|
|
70
|
-
])}
|
|
71
|
-
`,
|
|
96
|
+
identifiers,
|
|
97
|
+
hint: getHint(identifiers),
|
|
98
|
+
correction: getCorrection(identifiers),
|
|
72
99
|
};
|
|
73
100
|
return question;
|
|
74
101
|
};
|
|
@@ -117,5 +144,9 @@ exports.equationType2Exercise = {
|
|
|
117
144
|
subject: "Mathématiques",
|
|
118
145
|
hasHintAndCorrection: true,
|
|
119
146
|
options,
|
|
120
|
-
|
|
147
|
+
getCorrection,
|
|
148
|
+
getHint,
|
|
149
|
+
getInstruction,
|
|
150
|
+
getAnswer,
|
|
151
|
+
getStartStatement,
|
|
121
152
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"equationType3Exercise.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/equation/equationType3Exercise.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"equationType3Exercise.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/equation/equationType3Exercise.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,0BAA0B,CAAC;AAelC;;GAEG;AACH,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAgGF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,WAAW,CAqBvD,CAAC"}
|
|
@@ -15,36 +15,63 @@ const alignTex_1 = require("../../../../utils/latex/alignTex");
|
|
|
15
15
|
const multiplyNode_1 = require("../../../../tree/nodes/operators/multiplyNode");
|
|
16
16
|
const fractionNode_1 = require("../../../../tree/nodes/operators/fractionNode");
|
|
17
17
|
const equationVEA_1 = require("../../../../exercises/vea/equationVEA");
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
const a = (0, randint_1.randint)(-10, 11, [0, 1]);
|
|
21
|
-
const c = (0, randint_1.randint)(-10, 11);
|
|
18
|
+
const getStatementNode = (identifiers) => {
|
|
19
|
+
const { a, b, c } = identifiers;
|
|
22
20
|
const affine = new affine_1.Affine(a, b).toTree();
|
|
23
|
-
const solution = new rational_1.Rational(c - b, a).simplify();
|
|
24
21
|
const statementTree = new equalNode_1.EqualNode(affine, new numberNode_1.NumberNode(c));
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
22
|
+
return statementTree;
|
|
23
|
+
};
|
|
24
|
+
const getInstruction = (identifiers) => {
|
|
25
|
+
return `Résoudre :
|
|
26
|
+
|
|
27
|
+
$$
|
|
28
|
+
${getStatementNode(identifiers).toTex()}
|
|
29
|
+
$$`;
|
|
30
|
+
};
|
|
31
|
+
const getHint = (identifiers) => {
|
|
32
|
+
return "Isolez le terme $x$ dans la partie gauche de l'équation.";
|
|
33
|
+
};
|
|
34
|
+
const getCorrection = (identifiers) => {
|
|
35
|
+
const { a, b, c } = identifiers;
|
|
36
|
+
const statementTex = getStatementNode(identifiers).toTex();
|
|
37
|
+
const answer = getAnswer(identifiers);
|
|
38
|
+
return `Commencer par soustraire $${b}$ des deux côtés de l'équation pour
|
|
32
39
|
l'éliminer du côté gauche. Ensuite, diviser les deux côtés de l'équation par
|
|
33
40
|
$${a}$ pour isoler $x$, ce qui donne :
|
|
34
41
|
|
|
35
42
|
${(0, alignTex_1.alignTex)([
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
[
|
|
44
|
+
statementTex,
|
|
45
|
+
"\\iff",
|
|
46
|
+
new equalNode_1.EqualNode(new multiplyNode_1.MultiplyNode(a.toTree(), new variableNode_1.VariableNode("x")), (c - b).toTree()).toTex(),
|
|
47
|
+
],
|
|
48
|
+
["", "\\iff", answer],
|
|
49
|
+
])}`;
|
|
50
|
+
};
|
|
51
|
+
const getStartStatement = (identifiers) => {
|
|
52
|
+
return getStatementNode(identifiers).toTex();
|
|
53
|
+
};
|
|
54
|
+
const getAnswer = (identifiers) => {
|
|
55
|
+
const { a, b, c } = identifiers;
|
|
56
|
+
const solution = new rational_1.Rational(c - b, a).simplify();
|
|
57
|
+
const answerTree = new equalNode_1.EqualNode(new variableNode_1.VariableNode("x"), solution.toTree());
|
|
58
|
+
const answer = answerTree.toTex();
|
|
59
|
+
return answer;
|
|
60
|
+
};
|
|
61
|
+
const getEquationType3ExerciseQuestion = () => {
|
|
62
|
+
const b = (0, randint_1.randint)(-10, 11, [0]);
|
|
63
|
+
const a = (0, randint_1.randint)(-10, 11, [0, 1]);
|
|
64
|
+
const c = (0, randint_1.randint)(-10, 11);
|
|
65
|
+
const identifiers = { a, b, c };
|
|
66
|
+
const question = {
|
|
67
|
+
instruction: getInstruction(identifiers),
|
|
68
|
+
hint: getHint(identifiers),
|
|
69
|
+
correction: getCorrection(identifiers),
|
|
70
|
+
startStatement: getStartStatement(identifiers),
|
|
71
|
+
answer: getAnswer(identifiers),
|
|
45
72
|
keys: equationKeys_1.equationKeys,
|
|
46
73
|
answerFormat: "tex",
|
|
47
|
-
identifiers
|
|
74
|
+
identifiers,
|
|
48
75
|
};
|
|
49
76
|
return question;
|
|
50
77
|
};
|
|
@@ -77,4 +104,9 @@ exports.equationType3Exercise = {
|
|
|
77
104
|
isAnswerValid,
|
|
78
105
|
subject: "Mathématiques",
|
|
79
106
|
hasHintAndCorrection: true,
|
|
107
|
+
getAnswer,
|
|
108
|
+
getInstruction,
|
|
109
|
+
getCorrection,
|
|
110
|
+
getHint,
|
|
111
|
+
getStartStatement,
|
|
80
112
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"equationType4Exercise.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/equation/equationType4Exercise.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"equationType4Exercise.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/equation/equationType4Exercise.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAWT,MAAM,0BAA0B,CAAC;AAelC;;GAEG;AAEH,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;AA+FF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,WAAW,CAgBvD,CAAC"}
|
|
@@ -12,29 +12,47 @@ const variableNode_1 = require("../../../../tree/nodes/variables/variableNode");
|
|
|
12
12
|
const shuffle_1 = require("../../../../utils/alea/shuffle");
|
|
13
13
|
const equationVEA_1 = require("../../../../exercises/vea/equationVEA");
|
|
14
14
|
const fractionNode_1 = require("../../../../tree/nodes/operators/fractionNode");
|
|
15
|
+
const getStatementNode = (identifiers) => {
|
|
16
|
+
const { a, b, c, d } = identifiers;
|
|
17
|
+
const affines = [new affine_1.Affine(a, b), new affine_1.Affine(c, d)];
|
|
18
|
+
const statementTree = new equalNode_1.EqualNode(affines[0].toTree(), affines[1].toTree());
|
|
19
|
+
return statementTree;
|
|
20
|
+
};
|
|
21
|
+
const getInstruction = (identifiers) => {
|
|
22
|
+
return `Résoudre :
|
|
23
|
+
|
|
24
|
+
$$
|
|
25
|
+
${getStatementNode(identifiers).toTex()}
|
|
26
|
+
$$`;
|
|
27
|
+
};
|
|
28
|
+
const getStartStatement = (identifiers) => {
|
|
29
|
+
return getStatementNode(identifiers).toTex();
|
|
30
|
+
};
|
|
31
|
+
const getAnswer = (identifiers) => {
|
|
32
|
+
const { a, b, c, d } = identifiers;
|
|
33
|
+
const solution = new rational_1.Rational(d - b, a - c).simplify();
|
|
34
|
+
const answerTree = new equalNode_1.EqualNode(new variableNode_1.VariableNode("x"), solution.toTree());
|
|
35
|
+
const answer = answerTree.toTex();
|
|
36
|
+
return answer;
|
|
37
|
+
};
|
|
15
38
|
const getEquationType4ExerciseQuestion = () => {
|
|
16
39
|
const a = (0, randint_1.randint)(-10, 11, [0, 1]);
|
|
17
40
|
const b = (0, randint_1.randint)(-10, 11, [0]);
|
|
18
41
|
const c = (0, randint_1.randint)(-10, 11, [0, a]);
|
|
19
42
|
const d = (0, randint_1.randint)(-10, 11, [0]);
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
43
|
+
const identifiers = {
|
|
44
|
+
a,
|
|
45
|
+
b,
|
|
46
|
+
c,
|
|
47
|
+
d,
|
|
48
|
+
};
|
|
26
49
|
const question = {
|
|
27
|
-
instruction:
|
|
28
|
-
startStatement:
|
|
29
|
-
answer,
|
|
50
|
+
instruction: getInstruction(identifiers),
|
|
51
|
+
startStatement: getStartStatement(identifiers),
|
|
52
|
+
answer: getAnswer(identifiers),
|
|
30
53
|
keys: equationKeys_1.equationKeys,
|
|
31
54
|
answerFormat: "tex",
|
|
32
|
-
identifiers
|
|
33
|
-
a: a,
|
|
34
|
-
b: b,
|
|
35
|
-
c: c,
|
|
36
|
-
d: d,
|
|
37
|
-
},
|
|
55
|
+
identifiers,
|
|
38
56
|
// hint: `Commence par regrouper les termes en $x$ d'un même côté de l'équation. Puis, isole $x$ en effectuant les bonnes opérations.`,
|
|
39
57
|
// correction: `On isole $x$ à gauche en soustrayant par $${b}$ puis en divisant par $${a}$ :
|
|
40
58
|
// ${alignTex([
|
|
@@ -80,4 +98,6 @@ exports.equationType4Exercise = {
|
|
|
80
98
|
getPropositions,
|
|
81
99
|
isAnswerValid,
|
|
82
100
|
subject: "Mathématiques",
|
|
101
|
+
getInstruction,
|
|
102
|
+
getAnswer,
|
|
83
103
|
};
|