math-exercises 2.2.95 → 2.2.96
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/distributivity/firstIdentity.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/distributivity/firstIdentity.js +82 -34
- package/lib/exercises/math/calculLitteral/distributivity/secondIdentity.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/distributivity/secondIdentity.js +86 -36
- package/lib/exercises/math/calculLitteral/distributivity/thirdIdentity.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/distributivity/thirdIdentity.js +82 -32
- package/lib/exercises/math/calculLitteral/factorisation/factoType1Exercise.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/factorisation/factoType1Exercise.js +1 -0
- package/lib/exercises/math/calculLitteral/simplifying/distributeAndSimplify.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/simplifying/distributeAndSimplify.js +38 -16
- package/lib/exercises/math/calculLitteral/simplifying/reduceExpression.d.ts +3 -3
- package/lib/exercises/math/calculLitteral/simplifying/reduceExpression.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/simplifying/reduceExpression.js +171 -75
- package/lib/exercises/math/dataReading/index.d.ts +2 -0
- package/lib/exercises/math/dataReading/index.d.ts.map +1 -0
- package/lib/exercises/math/dataReading/index.js +17 -0
- package/lib/exercises/math/dataReading/tableReading.d.ts +8 -0
- package/lib/exercises/math/dataReading/tableReading.d.ts.map +1 -0
- package/lib/exercises/math/dataReading/tableReading.js +105 -0
- package/lib/exercises/math/derivation/derivative/powerCompositionDerivation.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/powerCompositionDerivation.js +75 -11
- package/lib/exercises/math/functions/affines/affineExpressionFromTwoImages.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/affineExpressionFromTwoImages.js +0 -1
- package/lib/exercises/math/functions/affines/affineExpressionReading.d.ts.map +1 -1
- package/lib/exercises/math/index.d.ts +1 -0
- package/lib/exercises/math/index.d.ts.map +1 -1
- package/lib/exercises/math/index.js +1 -0
- package/lib/exercises/math/probaStat/diceBasicProbas.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/diceBasicProbas.js +72 -20
- package/lib/exercises/vea/rationalVEA.js +1 -1
- package/lib/index.d.ts +6 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/tree/nodes/algebraicNode.d.ts +1 -0
- package/lib/tree/nodes/algebraicNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/addNode.d.ts +2 -1
- package/lib/tree/nodes/operators/addNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/addNode.js +21 -3
- package/lib/tree/nodes/operators/fractionNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/multiplyNode.d.ts +2 -1
- package/lib/tree/nodes/operators/multiplyNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/multiplyNode.js +12 -0
- package/lib/tree/nodes/operators/operatorNode.d.ts +5 -0
- package/lib/tree/nodes/operators/operatorNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/operatorNode.js +5 -1
- package/lib/tree/nodes/polynomials/monomNode.d.ts +2 -6
- package/lib/tree/nodes/polynomials/monomNode.d.ts.map +1 -1
- package/lib/tree/nodes/polynomials/monomNode.js +102 -94
- package/lib/tree/parsers/affineParser.d.ts +1 -1
- package/lib/tree/parsers/affineParser.d.ts.map +1 -1
- package/lib/tree/parsers/affineParser.js +16 -21
- package/lib/tree/parsers/polynomialParser.d.ts +5 -1
- package/lib/tree/parsers/polynomialParser.d.ts.map +1 -1
- package/lib/tree/parsers/polynomialParser.js +3 -3
- package/lib/tree/parsers/purifyLatex.d.ts +1 -1
- package/lib/tree/parsers/purifyLatex.js +1 -1
- package/lib/utils/alea/shuffle.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"firstIdentity.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/distributivity/firstIdentity.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"firstIdentity.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/distributivity/firstIdentity.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAOR,YAAY,EAEZ,iBAAiB,EACjB,GAAG,EAGJ,MAAM,0BAA0B,CAAC;AAelC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AA2EF,eAAO,MAAM,wBAAwB,EAAE,iBAAiB,CAAC,WAAW,CAwBnE,CAAC;AAEF,eAAO,MAAM,4BAA4B,EAAE,YAAY,CAAC,WAAW,CAkClE,CAAC;AAEF,eAAO,MAAM,0BAA0B,EAAE,GAAG,CAAC,WAAW,CAgBvD,CAAC;AAMF,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,WAAW,CAmB/C,CAAC"}
|
|
@@ -11,34 +11,42 @@ const multiplyNode_1 = require("../../../../tree/nodes/operators/multiplyNode");
|
|
|
11
11
|
const powerNode_1 = require("../../../../tree/nodes/operators/powerNode");
|
|
12
12
|
const alignTex_1 = require("../../../../utils/latex/alignTex");
|
|
13
13
|
const shuffle_1 = require("../../../../utils/alea/shuffle");
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
max: 11,
|
|
21
|
-
});
|
|
14
|
+
const handleVEAError_1 = require("../../../../utils/errors/handleVEAError");
|
|
15
|
+
const latexParser_1 = require("../../../../tree/parsers/latexParser");
|
|
16
|
+
const substractNode_1 = require("../../../../tree/nodes/operators/substractNode");
|
|
17
|
+
const getStatementNode = (identifiers) => {
|
|
18
|
+
const { a, b } = identifiers;
|
|
19
|
+
const affine = new affine_1.Affine(a, b);
|
|
22
20
|
const statementTree = new powerNode_1.PowerNode(affine.toTree(), new numberNode_1.NumberNode(2));
|
|
23
|
-
|
|
21
|
+
return statementTree;
|
|
22
|
+
};
|
|
23
|
+
const getStartStatement = (identifiers) => {
|
|
24
|
+
return getStatementNode(identifiers).toTex();
|
|
25
|
+
};
|
|
26
|
+
const getInstruction = (identifiers) => {
|
|
27
|
+
return `Développer et réduire :
|
|
28
|
+
|
|
29
|
+
$$
|
|
30
|
+
${getStartStatement(identifiers)}
|
|
31
|
+
$$`;
|
|
32
|
+
};
|
|
33
|
+
const getHint = (identifiers) => {
|
|
34
|
+
const affine = new affine_1.Affine(identifiers.a, identifiers.b);
|
|
24
35
|
const aMonom = new multiplyNode_1.MultiplyNode(affine.a.toTree(), "x".toTree());
|
|
25
|
-
|
|
26
|
-
const question = {
|
|
27
|
-
instruction: `Développer et réduire : $${statementTex}$`,
|
|
28
|
-
startStatement: statementTex,
|
|
29
|
-
answer,
|
|
30
|
-
keys: ["x"],
|
|
31
|
-
answerFormat: "tex",
|
|
32
|
-
identifiers: { a: affine.a, b: affine.b },
|
|
33
|
-
hint: `Utilise l'identité remarquable :
|
|
36
|
+
return `Utilise l'identité remarquable :
|
|
34
37
|
|
|
35
38
|
$$
|
|
36
39
|
(a+b)^2 = a^2 + 2ab+b^2
|
|
37
40
|
$$
|
|
38
41
|
|
|
39
|
-
en prenant $a=${aMonom.toTex()}$ et $b=${affine.b}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
+
en prenant $a=${aMonom.toTex()}$ et $b=${affine.b}$.`;
|
|
43
|
+
};
|
|
44
|
+
const getCorrection = (identifiers) => {
|
|
45
|
+
const affine = new affine_1.Affine(identifiers.a, identifiers.b);
|
|
46
|
+
const statementTex = getStartStatement(identifiers);
|
|
47
|
+
const answer = getAnswer(identifiers);
|
|
48
|
+
const aMonom = new multiplyNode_1.MultiplyNode(affine.a.toTree(), "x".toTree());
|
|
49
|
+
return `On utilise l'identité remarquable :
|
|
42
50
|
|
|
43
51
|
$$
|
|
44
52
|
(a+b)^2 = a^2 + 2ab+b^2
|
|
@@ -46,15 +54,41 @@ $$
|
|
|
46
54
|
|
|
47
55
|
en prenant $a=${aMonom.toTex()}$ et $b=${affine.b}$.
|
|
48
56
|
|
|
57
|
+
Cela donne donc :
|
|
58
|
+
|
|
49
59
|
${(0, alignTex_1.alignTex)([
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
60
|
+
[
|
|
61
|
+
statementTex,
|
|
62
|
+
"=",
|
|
63
|
+
new addNode_1.AddNode(new addNode_1.AddNode(new powerNode_1.SquareNode(aMonom), new multiplyNode_1.MultiplyNode((2).toTree(), new multiplyNode_1.MultiplyNode(aMonom, affine.b.toTree()))), new powerNode_1.SquareNode(affine.b.toTree())).toTex(),
|
|
64
|
+
],
|
|
65
|
+
["", "=", answer],
|
|
66
|
+
])}
|
|
67
|
+
`;
|
|
68
|
+
};
|
|
69
|
+
const getAnswer = (identifiers) => {
|
|
70
|
+
const affine = new affine_1.Affine(identifiers.a, identifiers.b);
|
|
71
|
+
const answer = affine.multiply(affine).toTree().toTex();
|
|
72
|
+
return answer;
|
|
73
|
+
};
|
|
74
|
+
const getFirstIdentityQuestion = () => {
|
|
75
|
+
const affine = affine_1.AffineConstructor.random({
|
|
76
|
+
min: 1,
|
|
77
|
+
max: 11,
|
|
78
|
+
}, {
|
|
79
|
+
min: 1,
|
|
80
|
+
max: 11,
|
|
81
|
+
});
|
|
82
|
+
const identifiers = { a: affine.a, b: affine.b };
|
|
83
|
+
const question = {
|
|
84
|
+
instruction: getInstruction(identifiers),
|
|
85
|
+
startStatement: getStartStatement(identifiers),
|
|
86
|
+
answer: getAnswer(identifiers),
|
|
87
|
+
keys: ["x"],
|
|
88
|
+
answerFormat: "tex",
|
|
89
|
+
identifiers,
|
|
90
|
+
hint: getHint(identifiers),
|
|
91
|
+
correction: getCorrection(identifiers),
|
|
58
92
|
};
|
|
59
93
|
return question;
|
|
60
94
|
};
|
|
@@ -78,11 +112,20 @@ const getFirstIdentityPropositions = (n, { answer, a, b }) => {
|
|
|
78
112
|
return (0, shuffle_1.shuffle)(propositions);
|
|
79
113
|
};
|
|
80
114
|
exports.getFirstIdentityPropositions = getFirstIdentityPropositions;
|
|
81
|
-
const isFirstIdentityAnswerValid = (ans, { a, b }) => {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
115
|
+
const isFirstIdentityAnswerValid = (ans, { answer, a, b }) => {
|
|
116
|
+
try {
|
|
117
|
+
const parsed = (0, latexParser_1.parseAlgebraic)(ans);
|
|
118
|
+
if (!parsed)
|
|
119
|
+
return false;
|
|
120
|
+
if (!(0, addNode_1.isAddNode)(parsed) && !(0, substractNode_1.isSubstractNode)(parsed))
|
|
121
|
+
return false;
|
|
122
|
+
return (parsed
|
|
123
|
+
.simplify({ forbidFactorize: true, towardsDistribute: true })
|
|
124
|
+
.toTex() === answer);
|
|
125
|
+
}
|
|
126
|
+
catch (err) {
|
|
127
|
+
return (0, handleVEAError_1.handleVEAError)(err);
|
|
128
|
+
}
|
|
86
129
|
};
|
|
87
130
|
exports.isFirstIdentityAnswerValid = isFirstIdentityAnswerValid;
|
|
88
131
|
const tests = () => {
|
|
@@ -102,4 +145,9 @@ exports.firstIdentity = {
|
|
|
102
145
|
isAnswerValid: exports.isFirstIdentityAnswerValid,
|
|
103
146
|
subject: "Mathématiques",
|
|
104
147
|
hasHintAndCorrection: true,
|
|
148
|
+
getAnswer,
|
|
149
|
+
getInstruction,
|
|
150
|
+
getCorrection,
|
|
151
|
+
getHint,
|
|
152
|
+
getStartStatement,
|
|
105
153
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"secondIdentity.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/distributivity/secondIdentity.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"secondIdentity.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/distributivity/secondIdentity.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAOR,YAAY,EAEZ,iBAAiB,EACjB,GAAG,EAGJ,MAAM,0BAA0B,CAAC;AAiBlC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAiFF,eAAO,MAAM,yBAAyB,EAAE,iBAAiB,CAAC,WAAW,CAuBpE,CAAC;AAEF,eAAO,MAAM,6BAA6B,EAAE,YAAY,CAAC,WAAW,CAqCnE,CAAC;AAEF,eAAO,MAAM,2BAA2B,EAAE,GAAG,CAAC,WAAW,CAgBxD,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,WAAW,CAkBhD,CAAC"}
|
|
@@ -12,35 +12,54 @@ const powerNode_1 = require("../../../../tree/nodes/operators/powerNode");
|
|
|
12
12
|
const substractNode_1 = require("../../../../tree/nodes/operators/substractNode");
|
|
13
13
|
const alignTex_1 = require("../../../../utils/latex/alignTex");
|
|
14
14
|
const shuffle_1 = require("../../../../utils/alea/shuffle");
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
min: -10,
|
|
21
|
-
max: 0,
|
|
22
|
-
});
|
|
15
|
+
const latexParser_1 = require("../../../../tree/parsers/latexParser");
|
|
16
|
+
const handleVEAError_1 = require("../../../../utils/errors/handleVEAError");
|
|
17
|
+
const getStatementNode = (identifiers) => {
|
|
18
|
+
const { a, b } = identifiers;
|
|
19
|
+
const affine = new affine_1.Affine(a, b);
|
|
23
20
|
const statementTree = new powerNode_1.PowerNode(affine.toTree(), new numberNode_1.NumberNode(2));
|
|
24
|
-
|
|
21
|
+
return statementTree;
|
|
22
|
+
};
|
|
23
|
+
const getStartStatement = (identifiers) => {
|
|
24
|
+
const statementTree = getStatementNode(identifiers);
|
|
25
|
+
const statementTex = statementTree.toTex();
|
|
26
|
+
return statementTex;
|
|
27
|
+
};
|
|
28
|
+
const getInstruction = (identifiers) => {
|
|
29
|
+
const { a, b } = identifiers;
|
|
30
|
+
return `Développer et réduire :
|
|
31
|
+
|
|
32
|
+
$$
|
|
33
|
+
${getStartStatement(identifiers)}
|
|
34
|
+
$$`;
|
|
35
|
+
};
|
|
36
|
+
const getHint = (identifiers) => {
|
|
37
|
+
const { a, b } = identifiers;
|
|
38
|
+
const affine = new affine_1.Affine(a, b);
|
|
25
39
|
const aMonom = new multiplyNode_1.MultiplyNode(affine.a.toTree(), "x".toTree());
|
|
26
40
|
const bPositive = -affine.b;
|
|
27
|
-
|
|
28
|
-
const question = {
|
|
29
|
-
instruction: `Développer et réduire : $${statementTex}$`,
|
|
30
|
-
startStatement: statementTex,
|
|
31
|
-
answer,
|
|
32
|
-
keys: ["x"],
|
|
33
|
-
answerFormat: "tex",
|
|
34
|
-
identifiers: { a: affine.a, b: affine.b },
|
|
35
|
-
hint: `Utilise l'identité remarquable
|
|
41
|
+
return `Utilise l'identité remarquable
|
|
36
42
|
|
|
37
43
|
$$
|
|
38
44
|
(a-b)^2 = a^2 - 2ab+b^2
|
|
39
45
|
$$
|
|
40
46
|
|
|
41
|
-
en prenant $a=${aMonom.toTex()}$ et $b=${bPositive}
|
|
42
|
-
|
|
43
|
-
|
|
47
|
+
en prenant $a=${aMonom.toTex()}$ et $b=${bPositive}$`;
|
|
48
|
+
};
|
|
49
|
+
const getAnswer = (identifiers) => {
|
|
50
|
+
const { a, b } = identifiers;
|
|
51
|
+
const affine = new affine_1.Affine(a, b);
|
|
52
|
+
const answer = affine.multiply(affine).toTree().toTex();
|
|
53
|
+
return answer;
|
|
54
|
+
};
|
|
55
|
+
const getCorrection = (identifiers) => {
|
|
56
|
+
const { a, b } = identifiers;
|
|
57
|
+
const affine = new affine_1.Affine(a, b);
|
|
58
|
+
const aMonom = new multiplyNode_1.MultiplyNode(affine.a.toTree(), "x".toTree());
|
|
59
|
+
const bPositive = -affine.b;
|
|
60
|
+
const statementTex = getStartStatement(identifiers);
|
|
61
|
+
const answer = getAnswer(identifiers);
|
|
62
|
+
return `On utilise l'identité remarquable
|
|
44
63
|
|
|
45
64
|
$$
|
|
46
65
|
(a-b)^2 = a^2 - 2ab+b^2
|
|
@@ -49,14 +68,33 @@ $$
|
|
|
49
68
|
en prenant $a=${aMonom.toTex()}$ et $b=${bPositive}$ :
|
|
50
69
|
|
|
51
70
|
${(0, alignTex_1.alignTex)([
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
71
|
+
[
|
|
72
|
+
statementTex,
|
|
73
|
+
"=",
|
|
74
|
+
new addNode_1.AddNode(new substractNode_1.SubstractNode(new powerNode_1.SquareNode(aMonom), new multiplyNode_1.MultiplyNode((2).toTree(), new multiplyNode_1.MultiplyNode(aMonom, bPositive.toTree()))), new powerNode_1.SquareNode(bPositive.toTree())).toTex(),
|
|
75
|
+
],
|
|
76
|
+
["", "=", answer],
|
|
77
|
+
])}
|
|
78
|
+
`;
|
|
79
|
+
};
|
|
80
|
+
const getSecondIdentityQuestion = () => {
|
|
81
|
+
const affine = affine_1.AffineConstructor.random({
|
|
82
|
+
min: 1,
|
|
83
|
+
max: 11,
|
|
84
|
+
}, {
|
|
85
|
+
min: -10,
|
|
86
|
+
max: 0,
|
|
87
|
+
});
|
|
88
|
+
const identifiers = { a: affine.a, b: affine.b };
|
|
89
|
+
const question = {
|
|
90
|
+
instruction: getInstruction(identifiers),
|
|
91
|
+
startStatement: getStartStatement(identifiers),
|
|
92
|
+
answer: getAnswer(identifiers),
|
|
93
|
+
keys: ["x"],
|
|
94
|
+
answerFormat: "tex",
|
|
95
|
+
identifiers,
|
|
96
|
+
hint: getHint(identifiers),
|
|
97
|
+
correction: getCorrection(identifiers),
|
|
60
98
|
};
|
|
61
99
|
return question;
|
|
62
100
|
};
|
|
@@ -82,19 +120,26 @@ const getSecondIdentityPropositions = (n, { answer, a, b }) => {
|
|
|
82
120
|
return (0, shuffle_1.shuffle)(propositions);
|
|
83
121
|
};
|
|
84
122
|
exports.getSecondIdentityPropositions = getSecondIdentityPropositions;
|
|
85
|
-
const isSecondIdentityAnswerValid = (ans, { a, b }) => {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
123
|
+
const isSecondIdentityAnswerValid = (ans, { a, b, answer }) => {
|
|
124
|
+
try {
|
|
125
|
+
const parsed = (0, latexParser_1.parseAlgebraic)(ans);
|
|
126
|
+
if (!parsed)
|
|
127
|
+
return false;
|
|
128
|
+
if (!(0, addNode_1.isAddNode)(parsed) && !(0, substractNode_1.isSubstractNode)(parsed))
|
|
129
|
+
return false;
|
|
130
|
+
return (parsed
|
|
131
|
+
.simplify({ forbidFactorize: true, towardsDistribute: true })
|
|
132
|
+
.toTex() === answer);
|
|
133
|
+
}
|
|
134
|
+
catch (err) {
|
|
135
|
+
return (0, handleVEAError_1.handleVEAError)(err);
|
|
136
|
+
}
|
|
90
137
|
};
|
|
91
138
|
exports.isSecondIdentityAnswerValid = isSecondIdentityAnswerValid;
|
|
92
139
|
exports.secondIdentity = {
|
|
93
140
|
id: "idRmq2",
|
|
94
141
|
connector: "=",
|
|
95
142
|
label: "Identité remarquable $(a-b)^2$",
|
|
96
|
-
levels: ["3ème", "2nde"],
|
|
97
|
-
sections: ["Calcul littéral"],
|
|
98
143
|
isSingleStep: false,
|
|
99
144
|
generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(exports.getSecondIdentityQuestion, nb),
|
|
100
145
|
getPropositions: exports.getSecondIdentityPropositions,
|
|
@@ -103,4 +148,9 @@ exports.secondIdentity = {
|
|
|
103
148
|
freeTimer: 60,
|
|
104
149
|
subject: "Mathématiques",
|
|
105
150
|
hasHintAndCorrection: true,
|
|
151
|
+
getInstruction,
|
|
152
|
+
getCorrection,
|
|
153
|
+
getHint,
|
|
154
|
+
getAnswer,
|
|
155
|
+
getStartStatement,
|
|
106
156
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"thirdIdentity.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/distributivity/thirdIdentity.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"thirdIdentity.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/distributivity/thirdIdentity.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAOR,YAAY,EAEZ,iBAAiB,EACjB,GAAG,EAGJ,MAAM,0BAA0B,CAAC;AAiBlC,KAAK,WAAW,GAAG;IACjB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,aAAa,EAAE,MAAM,EAAE,CAAC;CACzB,CAAC;AAoEF,eAAO,MAAM,wBAAwB,EAAE,iBAAiB,CAAC,WAAW,CAkBnE,CAAC;AAEF,eAAO,MAAM,4BAA4B,EAAE,YAAY,CAAC,WAAW,CA2BlE,CAAC;AAEF,eAAO,MAAM,0BAA0B,EAAE,GAAG,CAAC,WAAW,CAgBvD,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,WAAW,CAiB/C,CAAC"}
|
|
@@ -9,32 +9,54 @@ const powerNode_1 = require("../../../../tree/nodes/operators/powerNode");
|
|
|
9
9
|
const substractNode_1 = require("../../../../tree/nodes/operators/substractNode");
|
|
10
10
|
const alignTex_1 = require("../../../../utils/latex/alignTex");
|
|
11
11
|
const shuffle_1 = require("../../../../utils/alea/shuffle");
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
const latexParser_1 = require("../../../../tree/parsers/latexParser");
|
|
13
|
+
const addNode_1 = require("../../../../tree/nodes/operators/addNode");
|
|
14
|
+
const handleVEAError_1 = require("../../../../utils/errors/handleVEAError");
|
|
15
|
+
const getStatementNode = (identifiers) => {
|
|
16
|
+
const { affine1Coeffs, affine2Coeffs } = identifiers;
|
|
17
|
+
const affine = new affine_1.Affine(affine1Coeffs[1], affine1Coeffs[0]);
|
|
18
|
+
const affine2 = new affine_1.Affine(affine2Coeffs[1], affine2Coeffs[0]);
|
|
15
19
|
const statementTree = new multiplyNode_1.MultiplyNode(affine.toTree(), affine2.toTree());
|
|
20
|
+
return statementTree;
|
|
21
|
+
};
|
|
22
|
+
const getStartStatement = (identifiers) => {
|
|
23
|
+
return getStatementNode(identifiers).toTex();
|
|
24
|
+
};
|
|
25
|
+
const getInstruction = (identifiers) => {
|
|
26
|
+
return `Développer et réduire :
|
|
27
|
+
|
|
28
|
+
$$
|
|
29
|
+
${getStartStatement(identifiers)}
|
|
30
|
+
$$`;
|
|
31
|
+
};
|
|
32
|
+
const getAnswer = (identifiers) => {
|
|
33
|
+
const { affine1Coeffs, affine2Coeffs } = identifiers;
|
|
34
|
+
const affine = new affine_1.Affine(affine1Coeffs[1], affine1Coeffs[0]);
|
|
35
|
+
const affine2 = new affine_1.Affine(affine2Coeffs[1], affine2Coeffs[0]);
|
|
16
36
|
const answer = affine.multiply(affine2).toTree().toTex();
|
|
37
|
+
return answer;
|
|
38
|
+
};
|
|
39
|
+
const getHint = (identifiers) => {
|
|
40
|
+
const { affine1Coeffs, affine2Coeffs } = identifiers;
|
|
41
|
+
const affine = new affine_1.Affine(affine1Coeffs[1], affine1Coeffs[0]);
|
|
17
42
|
const aMonom = new multiplyNode_1.MultiplyNode(affine.a.toTree(), "x".toTree());
|
|
18
43
|
const bPositive = Math.abs(affine.b);
|
|
19
|
-
|
|
20
|
-
const question = {
|
|
21
|
-
instruction: `Développer et réduire : $${statementTex}$`,
|
|
22
|
-
startStatement: statementTex,
|
|
23
|
-
answer,
|
|
24
|
-
keys: ["x"],
|
|
25
|
-
answerFormat: "tex",
|
|
26
|
-
identifiers: {
|
|
27
|
-
affine1Coeffs: affine.coefficients,
|
|
28
|
-
affine2Coeffs: affine2.coefficients,
|
|
29
|
-
},
|
|
30
|
-
hint: `Utilise l'identité remarquable
|
|
44
|
+
return `Utilise l'identité remarquable
|
|
31
45
|
|
|
32
46
|
$$
|
|
33
47
|
(a-b)(a+b) = a^2 - b^2
|
|
34
48
|
$$
|
|
35
49
|
|
|
36
|
-
en prenant $a=${aMonom.toTex()}$ et $b=${bPositive}
|
|
37
|
-
|
|
50
|
+
en prenant $a=${aMonom.toTex()}$ et $b=${bPositive}$`;
|
|
51
|
+
};
|
|
52
|
+
const getCorrection = (identifiers) => {
|
|
53
|
+
const { affine1Coeffs, affine2Coeffs } = identifiers;
|
|
54
|
+
const affine = new affine_1.Affine(affine1Coeffs[1], affine1Coeffs[0]);
|
|
55
|
+
const aMonom = new multiplyNode_1.MultiplyNode(affine.a.toTree(), "x".toTree());
|
|
56
|
+
const bPositive = Math.abs(affine.b);
|
|
57
|
+
const statementTex = getStartStatement(identifiers);
|
|
58
|
+
const answer = getAnswer(identifiers);
|
|
59
|
+
return `
|
|
38
60
|
On utilise l'identité remarquable
|
|
39
61
|
|
|
40
62
|
$$
|
|
@@ -44,13 +66,30 @@ $$
|
|
|
44
66
|
en prenant $a=${aMonom.toTex()}$ et $b=${bPositive}$.
|
|
45
67
|
|
|
46
68
|
${(0, alignTex_1.alignTex)([
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
69
|
+
[
|
|
70
|
+
statementTex,
|
|
71
|
+
"=",
|
|
72
|
+
new substractNode_1.SubstractNode(new powerNode_1.SquareNode(aMonom), new powerNode_1.SquareNode(bPositive.toTree())).toTex(),
|
|
73
|
+
],
|
|
74
|
+
["", "=", answer],
|
|
75
|
+
])}`;
|
|
76
|
+
};
|
|
77
|
+
const getThirdIdentityQuestion = () => {
|
|
78
|
+
const affine = affine_1.AffineConstructor.random(undefined, { excludes: [0] });
|
|
79
|
+
const affine2 = new affine_1.Affine(affine.a, -affine.b);
|
|
80
|
+
const identifiers = {
|
|
81
|
+
affine1Coeffs: affine.coefficients,
|
|
82
|
+
affine2Coeffs: affine2.coefficients,
|
|
83
|
+
};
|
|
84
|
+
const question = {
|
|
85
|
+
instruction: getInstruction(identifiers),
|
|
86
|
+
startStatement: getStartStatement(identifiers),
|
|
87
|
+
answer: getAnswer(identifiers),
|
|
88
|
+
keys: ["x"],
|
|
89
|
+
answerFormat: "tex",
|
|
90
|
+
identifiers,
|
|
91
|
+
hint: getHint(identifiers),
|
|
92
|
+
correction: getCorrection(identifiers),
|
|
54
93
|
};
|
|
55
94
|
return question;
|
|
56
95
|
};
|
|
@@ -74,20 +113,26 @@ const getThirdIdentityPropositions = (n, { answer, affine1Coeffs, affine2Coeffs
|
|
|
74
113
|
return (0, shuffle_1.shuffle)(propositions);
|
|
75
114
|
};
|
|
76
115
|
exports.getThirdIdentityPropositions = getThirdIdentityPropositions;
|
|
77
|
-
const isThirdIdentityAnswerValid = (ans, { affine1Coeffs, affine2Coeffs }) => {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
116
|
+
const isThirdIdentityAnswerValid = (ans, { answer, affine1Coeffs, affine2Coeffs }) => {
|
|
117
|
+
try {
|
|
118
|
+
const parsed = (0, latexParser_1.parseAlgebraic)(ans);
|
|
119
|
+
if (!parsed)
|
|
120
|
+
return false;
|
|
121
|
+
if (!(0, addNode_1.isAddNode)(parsed) && !(0, substractNode_1.isSubstractNode)(parsed))
|
|
122
|
+
return false;
|
|
123
|
+
return (parsed
|
|
124
|
+
.simplify({ forbidFactorize: true, towardsDistribute: true })
|
|
125
|
+
.toTex() === answer);
|
|
126
|
+
}
|
|
127
|
+
catch (err) {
|
|
128
|
+
return (0, handleVEAError_1.handleVEAError)(err);
|
|
129
|
+
}
|
|
83
130
|
};
|
|
84
131
|
exports.isThirdIdentityAnswerValid = isThirdIdentityAnswerValid;
|
|
85
132
|
exports.thirdIdentity = {
|
|
86
133
|
id: "idRmq3",
|
|
87
134
|
connector: "=",
|
|
88
135
|
label: "Identité remarquable $(a+b)(a-b)$",
|
|
89
|
-
levels: ["3ème", "2nde"],
|
|
90
|
-
sections: ["Calcul littéral"],
|
|
91
136
|
isSingleStep: false,
|
|
92
137
|
generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(exports.getThirdIdentityQuestion, nb),
|
|
93
138
|
getPropositions: exports.getThirdIdentityPropositions,
|
|
@@ -96,4 +141,9 @@ exports.thirdIdentity = {
|
|
|
96
141
|
freeTimer: 60,
|
|
97
142
|
subject: "Mathématiques",
|
|
98
143
|
hasHintAndCorrection: true,
|
|
144
|
+
getInstruction,
|
|
145
|
+
getCorrection,
|
|
146
|
+
getHint,
|
|
147
|
+
getAnswer,
|
|
148
|
+
getStartStatement,
|
|
99
149
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factoType1Exercise.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/factorisation/factoType1Exercise.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,QAAQ,EAUT,MAAM,0BAA0B,CAAC;AAmBlC;;;GAGG;AACH,KAAK,WAAW,GAAG;IACjB,aAAa,EAAE,MAAM,EAAE,EAAE,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;
|
|
1
|
+
{"version":3,"file":"factoType1Exercise.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/factorisation/factoType1Exercise.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,QAAQ,EAUT,MAAM,0BAA0B,CAAC;AAmBlC;;;GAGG;AACH,KAAK,WAAW,GAAG;IACjB,aAAa,EAAE,MAAM,EAAE,EAAE,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAiKF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,CAepD,CAAC"}
|
|
@@ -103,6 +103,7 @@ const getPropositions = (n, { answer, affinesCoeffs, operation }) => {
|
|
|
103
103
|
};
|
|
104
104
|
const isAnswerValid = (ans, { answer, ...identifiers }) => {
|
|
105
105
|
try {
|
|
106
|
+
console.log(ans, answer);
|
|
106
107
|
const parsed = (0, latexParser_1.parseAlgebraic)(ans);
|
|
107
108
|
if (!parsed)
|
|
108
109
|
return false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"distributeAndSimplify.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/simplifying/distributeAndSimplify.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"distributeAndSimplify.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/simplifying/distributeAndSimplify.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,0BAA0B,CAAC;AAUlC,KAAK,WAAW,GAAG;IACjB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,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;AA+EF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,WAAW,CAcvD,CAAC"}
|
|
@@ -7,9 +7,32 @@ const affine_1 = require("../../../../math/polynomials/affine");
|
|
|
7
7
|
const randint_1 = require("../../../../math/utils/random/randint");
|
|
8
8
|
const addNode_1 = require("../../../../tree/nodes/operators/addNode");
|
|
9
9
|
const multiplyNode_1 = require("../../../../tree/nodes/operators/multiplyNode");
|
|
10
|
+
const polynomialParser_1 = require("../../../../tree/parsers/polynomialParser");
|
|
10
11
|
const coinFlip_1 = require("../../../../utils/alea/coinFlip");
|
|
12
|
+
const handleVEAError_1 = require("../../../../utils/errors/handleVEAError");
|
|
11
13
|
//[a]|[b*(cx+d)] +- e*(fx+g)]
|
|
12
14
|
// c & f > 0
|
|
15
|
+
const getStatementNode = (identifiers) => {
|
|
16
|
+
const { firstTermIsAffine, a, b, c, d, e, f, g } = identifiers;
|
|
17
|
+
const statement = new addNode_1.AddNode(firstTermIsAffine
|
|
18
|
+
? new multiplyNode_1.MultiplyNode(b.toTree(), new affine_1.Affine(c, d).toTree())
|
|
19
|
+
: a.toTree(), new multiplyNode_1.MultiplyNode(e.toTree(), new affine_1.Affine(f, g).toTree()));
|
|
20
|
+
return statement;
|
|
21
|
+
};
|
|
22
|
+
const getInstruction = (identifiers) => {
|
|
23
|
+
return `Développer et réduire :
|
|
24
|
+
|
|
25
|
+
$$
|
|
26
|
+
${getStatementNode(identifiers).toTex()}
|
|
27
|
+
$$`;
|
|
28
|
+
};
|
|
29
|
+
const getAnswer = (identifiers) => {
|
|
30
|
+
const { firstTermIsAffine, a, b, c, d, e, f, g } = identifiers;
|
|
31
|
+
const answer = firstTermIsAffine
|
|
32
|
+
? new affine_1.Affine(b * c + e * f, b * d + e * g).toTree().toTex()
|
|
33
|
+
: new affine_1.Affine(e * f, a + e * g).toTree().toTex();
|
|
34
|
+
return answer;
|
|
35
|
+
};
|
|
13
36
|
const getDistributeAndSimplifyQuestion = () => {
|
|
14
37
|
const firstTermIsAffine = (0, coinFlip_1.coinFlip)();
|
|
15
38
|
const a = (0, randint_1.randint)(-5, 6, [0]);
|
|
@@ -22,18 +45,13 @@ const getDistributeAndSimplifyQuestion = () => {
|
|
|
22
45
|
f = (0, randint_1.randint)(1, 6);
|
|
23
46
|
} while (b * c + e * f === 0);
|
|
24
47
|
const g = (0, randint_1.randint)(-5, 6, [0]);
|
|
25
|
-
const
|
|
26
|
-
? new multiplyNode_1.MultiplyNode(b.toTree(), new affine_1.Affine(c, d).toTree())
|
|
27
|
-
: a.toTree(), new multiplyNode_1.MultiplyNode(e.toTree(), new affine_1.Affine(f, g).toTree())).simplify();
|
|
28
|
-
const answer = firstTermIsAffine
|
|
29
|
-
? new affine_1.Affine(b * c + e * f, b * d + e * g).toTree().toTex()
|
|
30
|
-
: new affine_1.Affine(e * f, a + e * g).toTree().toTex();
|
|
48
|
+
const identifiers = { firstTermIsAffine, a, b, c, d, e, f, g };
|
|
31
49
|
const question = {
|
|
32
|
-
answer,
|
|
33
|
-
instruction:
|
|
50
|
+
answer: getAnswer(identifiers),
|
|
51
|
+
instruction: getInstruction(identifiers),
|
|
34
52
|
keys: ["x"],
|
|
35
53
|
answerFormat: "tex",
|
|
36
|
-
identifiers
|
|
54
|
+
identifiers,
|
|
37
55
|
};
|
|
38
56
|
return question;
|
|
39
57
|
};
|
|
@@ -46,23 +64,27 @@ const getPropositions = (n, { answer }) => {
|
|
|
46
64
|
return (0, exercise_1.shuffleProps)(propositions, n);
|
|
47
65
|
};
|
|
48
66
|
const isAnswerValid = (ans, { answer, firstTermIsAffine, a, b, c, d, e, f, g }) => {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
67
|
+
try {
|
|
68
|
+
const parsed = (0, polynomialParser_1.polynomialParser)(ans);
|
|
69
|
+
if (!parsed)
|
|
70
|
+
return false;
|
|
71
|
+
return parsed.simplify().toTex() === answer;
|
|
72
|
+
}
|
|
73
|
+
catch (err) {
|
|
74
|
+
return (0, handleVEAError_1.handleVEAError)(err);
|
|
75
|
+
}
|
|
54
76
|
};
|
|
55
77
|
exports.distributeAndSimplify = {
|
|
56
78
|
id: "distributeAndSimplify",
|
|
57
79
|
connector: "=",
|
|
58
80
|
label: "Développer et réduire une expression",
|
|
59
|
-
levels: ["4ème", "3ème", "2nde"],
|
|
60
81
|
isSingleStep: true,
|
|
61
|
-
sections: ["Calcul littéral"],
|
|
62
82
|
generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getDistributeAndSimplifyQuestion, nb),
|
|
63
83
|
qcmTimer: 60,
|
|
64
84
|
freeTimer: 60,
|
|
65
85
|
getPropositions,
|
|
66
86
|
isAnswerValid,
|
|
67
87
|
subject: "Mathématiques",
|
|
88
|
+
getAnswer,
|
|
89
|
+
getInstruction,
|
|
68
90
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Exercise } from "../../../../exercises/exercise";
|
|
2
2
|
type Identifiers = {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
variable: string;
|
|
4
|
+
coeffs: number[][];
|
|
5
|
+
order: number[];
|
|
6
6
|
};
|
|
7
7
|
export declare const reduceExpression: Exercise<Identifiers>;
|
|
8
8
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reduceExpression.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/simplifying/reduceExpression.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"reduceExpression.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/simplifying/reduceExpression.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,0BAA0B,CAAC;AAkBlC,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,MAAM,CAAC;IAOjB,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC;IAGnB,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB,CAAC;AA+MF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,WAAW,CAgBlD,CAAC"}
|