math-exercises 2.2.96 → 2.2.98
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/exercises/math/calcul/index.js +1 -0
- package/lib/exercises/math/calcul/sign/index.d.ts +1 -0
- package/lib/exercises/math/calcul/sign/index.d.ts.map +1 -0
- package/lib/exercises/math/calcul/sign/index.js +1 -0
- package/lib/exercises/math/calcul/sign/signFromAx.d.ts +1 -0
- package/lib/exercises/math/calcul/sign/signFromAx.d.ts.map +1 -0
- package/lib/exercises/math/calcul/sign/signFromAx.js +80 -0
- package/lib/exercises/math/calculLitteral/distributivity/doubleDistributivity.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/distributivity/doubleDistributivity.js +85 -32
- package/lib/exercises/math/calculLitteral/distributivity/simpleDistributivity.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/distributivity/simpleDistributivity.js +20 -6
- package/lib/exercises/math/calculLitteral/factorisation/factoType1Exercise.d.ts +1 -0
- package/lib/exercises/math/calculLitteral/factorisation/factoType1Exercise.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/factorisation/factoType1Exercise.js +17 -14
- package/lib/exercises/math/calculLitteral/simplifying/distributeAndSimplify.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/simplifying/distributeAndSimplify.js +3 -1
- package/lib/exercises/math/conversion/aeraConversion.d.ts.map +1 -1
- package/lib/exercises/math/conversion/aeraConversion.js +76 -16
- package/lib/exercises/math/conversion/volumeConversion.d.ts.map +1 -1
- package/lib/exercises/math/conversion/volumeConversion.js +1 -3
- package/lib/exercises/math/dataRepresentations/index.d.ts +2 -0
- package/lib/exercises/math/dataRepresentations/index.d.ts.map +1 -0
- package/lib/exercises/math/dataRepresentations/index.js +17 -0
- package/lib/exercises/math/dataRepresentations/tableReading.d.ts +8 -0
- package/lib/exercises/math/dataRepresentations/tableReading.d.ts.map +1 -0
- package/lib/exercises/math/dataRepresentations/tableReading.js +105 -0
- package/lib/exercises/math/derivation/derivative/constanteDerivative.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/constanteDerivative.js +15 -4
- package/lib/exercises/math/derivation/derivative/thirdDegreeFunctionVariation.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/thirdDegreeFunctionVariation.js +0 -10
- package/lib/exercises/math/functions/affines/signFunction.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/signFunction.js +3 -0
- package/lib/exercises/math/geometry/areas/rectangleArea.d.ts.map +1 -1
- package/lib/exercises/math/geometry/areas/rectangleArea.js +34 -4
- package/lib/exercises/math/index.d.ts +1 -1
- package/lib/exercises/math/index.d.ts.map +1 -1
- package/lib/exercises/math/index.js +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/playground.d.ts +1 -1
- package/lib/playground.d.ts.map +1 -1
- package/lib/playground.js +14 -1
- package/lib/tree/nodes/equations/equalNode.d.ts +2 -0
- package/lib/tree/nodes/equations/equalNode.d.ts.map +1 -1
- package/lib/tree/nodes/equations/equalNode.js +25 -2
- package/lib/tree/nodes/node.d.ts +1 -0
- package/lib/tree/nodes/node.d.ts.map +1 -1
- package/lib/tree/nodes/numbers/numberNode.d.ts.map +1 -1
- package/lib/tree/nodes/numbers/numberNode.js +1 -1
- package/lib/tree/parsers/latexParser.d.ts +1 -1
- package/lib/tree/parsers/polynomialParser.d.ts.map +1 -1
- package/lib/tree/parsers/polynomialParser.js +1 -0
- package/lib/tree/parsers/powerParser.d.ts +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/sign/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=signFromAx.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signFromAx.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/sign/signFromAx.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// import {
|
|
3
|
+
// Exercise,
|
|
4
|
+
// Proposition,
|
|
5
|
+
// QCMGenerator,
|
|
6
|
+
// Question,
|
|
7
|
+
// QuestionGenerator,
|
|
8
|
+
// VEA,
|
|
9
|
+
// addValidProp,
|
|
10
|
+
// shuffleProps,
|
|
11
|
+
// GetAnswer,
|
|
12
|
+
// GetHint,
|
|
13
|
+
// GetCorrection,
|
|
14
|
+
// GetInstruction,
|
|
15
|
+
// GetKeys,
|
|
16
|
+
// tryToAddWrongProp,
|
|
17
|
+
// } from '../../../../exercises/exercise';
|
|
18
|
+
// import { getDistinctQuestions } from '../../../../exercises/utils/getDistinctQuestions';
|
|
19
|
+
// import { handleVEAError } from "../../../../utils/errors/handleVEAError";
|
|
20
|
+
// type Identifiers = {
|
|
21
|
+
// coeff:number;
|
|
22
|
+
// sign: number;
|
|
23
|
+
// };
|
|
24
|
+
// const getPropositions: QCMGenerator<Identifiers> = (n, { answer }) => {
|
|
25
|
+
// const propositions: Proposition[] = [];
|
|
26
|
+
// addValidProp(propositions, answer);
|
|
27
|
+
// tryToAddWrongProp(propositions, `$x$ est négatif`)
|
|
28
|
+
// while (propositions.length < n) {
|
|
29
|
+
// throw Error("QCM not implemented")
|
|
30
|
+
// }
|
|
31
|
+
// return shuffleProps(propositions, n);
|
|
32
|
+
// };
|
|
33
|
+
// const getAnswer : GetAnswer<Identifiers> = (identifiers)=>{
|
|
34
|
+
// }
|
|
35
|
+
// const getInstruction : GetInstruction<Identifiers> = (identifiers)=>{
|
|
36
|
+
// return `On considère un nombre relatif $x$ tel que $${}$ est strictement $${sign}$. Quel est le signe de $x$ ?`
|
|
37
|
+
// }
|
|
38
|
+
// const getHint : GetHint<Identifiers> = (identifiers)=>{
|
|
39
|
+
// }
|
|
40
|
+
// const getCorrection : GetCorrection<Identifiers> = (identifiers)=>{
|
|
41
|
+
// }
|
|
42
|
+
// const getKeys : GetKeys<Identifiers> = (identifiers)=>{
|
|
43
|
+
// return []
|
|
44
|
+
// }
|
|
45
|
+
// const isAnswerValid: VEA<Identifiers> = (ans, {answer})=>{
|
|
46
|
+
// try {
|
|
47
|
+
// throw Error("VEA not implemented")
|
|
48
|
+
// } catch(err){
|
|
49
|
+
// return handleVEAError(err)
|
|
50
|
+
// }
|
|
51
|
+
// }
|
|
52
|
+
// const getSignFromAxQuestion: QuestionGenerator<Identifiers> = (ops)=>{
|
|
53
|
+
// const identifiers: Identifiers = {}
|
|
54
|
+
// const question: Question<Identifiers> = {
|
|
55
|
+
// answer: getAnswer(identifiers),
|
|
56
|
+
// instruction: getInstruction(identifiers),
|
|
57
|
+
// keys: getKeys(identifiers),
|
|
58
|
+
// answerFormat: 'tex',
|
|
59
|
+
// identifiers,
|
|
60
|
+
// hint: getHint(identifiers),
|
|
61
|
+
// correction: getCorrection(identifiers)
|
|
62
|
+
// };
|
|
63
|
+
// return question;
|
|
64
|
+
// }
|
|
65
|
+
// export const signFromAx: Exercise<Identifiers> = {
|
|
66
|
+
// id: 'signFromAx',
|
|
67
|
+
// connector: "",
|
|
68
|
+
// label: undefined,
|
|
69
|
+
// isSingleStep: true,
|
|
70
|
+
// generator: (nb, opts) => getDistinctQuestions(()=>getSignFromAxQuestion(opts), nb),
|
|
71
|
+
// qcmTimer: 60,
|
|
72
|
+
// freeTimer: 60,
|
|
73
|
+
// getPropositions,
|
|
74
|
+
// isAnswerValid,
|
|
75
|
+
// subject: "Mathématiques",
|
|
76
|
+
// getInstruction,
|
|
77
|
+
// getHint,
|
|
78
|
+
// getCorrection,
|
|
79
|
+
// getAnswer,
|
|
80
|
+
// };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"doubleDistributivity.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/distributivity/doubleDistributivity.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"doubleDistributivity.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/distributivity/doubleDistributivity.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,0BAA0B,CAAC;AAYlC,KAAK,WAAW,GAAG;IACjB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,aAAa,EAAE,MAAM,EAAE,CAAC;CACzB,CAAC;AA+JF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAmBtD,CAAC"}
|
|
@@ -10,12 +10,47 @@ const multiplyNode_1 = require("../../../../tree/nodes/operators/multiplyNode");
|
|
|
10
10
|
const operatorComposition_1 = require("../../../../tree/utilities/operatorComposition");
|
|
11
11
|
const alignTex_1 = require("../../../../utils/latex/alignTex");
|
|
12
12
|
const shuffle_1 = require("../../../../utils/alea/shuffle");
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
13
|
+
const handleVEAError_1 = require("../../../../utils/errors/handleVEAError");
|
|
14
|
+
const polynomialParser_1 = require("../../../../tree/parsers/polynomialParser");
|
|
15
|
+
const getStatementNode = (identifiers) => {
|
|
16
|
+
const { affine1Coeffs, affine2Coeffs } = identifiers;
|
|
17
|
+
const affines = [
|
|
18
|
+
new affine_1.Affine(affine1Coeffs[1], affine1Coeffs[0]),
|
|
19
|
+
new affine_1.Affine(affine2Coeffs[1], affine2Coeffs[0]),
|
|
20
|
+
];
|
|
17
21
|
const statementTree = new multiplyNode_1.MultiplyNode(affines[0].toTree(), affines[1].toTree());
|
|
22
|
+
return statementTree;
|
|
23
|
+
};
|
|
24
|
+
const getStartStatement = (identifiers) => {
|
|
25
|
+
return getStatementNode(identifiers).toTex();
|
|
26
|
+
};
|
|
27
|
+
const getInstruction = (identifiers) => {
|
|
28
|
+
return `Développer et réduire :
|
|
29
|
+
|
|
30
|
+
$$
|
|
31
|
+
${getStartStatement(identifiers)}
|
|
32
|
+
$$`;
|
|
33
|
+
};
|
|
34
|
+
const getAnswer = (identifiers) => {
|
|
35
|
+
const { affine1Coeffs, affine2Coeffs } = identifiers;
|
|
36
|
+
const affines = [
|
|
37
|
+
new affine_1.Affine(affine1Coeffs[1], affine1Coeffs[0]),
|
|
38
|
+
new affine_1.Affine(affine2Coeffs[1], affine2Coeffs[0]),
|
|
39
|
+
];
|
|
18
40
|
const answer = affines[0].multiply(affines[1]).toTree().toTex();
|
|
41
|
+
return answer;
|
|
42
|
+
};
|
|
43
|
+
const getHint = (identifiers) => {
|
|
44
|
+
return "Multiplie chaque terme du premier facteur par chaque terme du second facteur, puis regroupe les termes similaires.";
|
|
45
|
+
};
|
|
46
|
+
const getCorrection = (identifiers) => {
|
|
47
|
+
const statementTex = getStartStatement(identifiers);
|
|
48
|
+
const answer = getAnswer(identifiers);
|
|
49
|
+
const { affine1Coeffs, affine2Coeffs } = identifiers;
|
|
50
|
+
const affines = [
|
|
51
|
+
new affine_1.Affine(affine1Coeffs[1], affine1Coeffs[0]),
|
|
52
|
+
new affine_1.Affine(affine2Coeffs[1], affine2Coeffs[0]),
|
|
53
|
+
];
|
|
19
54
|
const subTerms = [
|
|
20
55
|
new multiplyNode_1.MultiplyNode(affines[0].a.toTree(), "x".toTree()),
|
|
21
56
|
affines[0].b.toTree(),
|
|
@@ -28,30 +63,37 @@ const getDoubleDistributivityQuestion = () => {
|
|
|
28
63
|
new multiplyNode_1.MultiplyNode(subTerms[1], subTerms[2], { forceTimesSign: true }),
|
|
29
64
|
new multiplyNode_1.MultiplyNode(subTerms[1], subTerms[3], { forceTimesSign: true }),
|
|
30
65
|
];
|
|
31
|
-
|
|
66
|
+
return `
|
|
67
|
+
${(0, alignTex_1.alignTex)([
|
|
68
|
+
[statementTex, "=", (0, operatorComposition_1.operatorComposition)(addNode_1.AddNode, subMultiplications).toTex()],
|
|
69
|
+
[
|
|
70
|
+
"",
|
|
71
|
+
"=",
|
|
72
|
+
(0, operatorComposition_1.operatorComposition)(addNode_1.AddNode, subMultiplications.map((e) => e.simplify())).toTex(),
|
|
73
|
+
],
|
|
74
|
+
["", "=", answer],
|
|
75
|
+
])}
|
|
76
|
+
|
|
77
|
+
`;
|
|
78
|
+
};
|
|
79
|
+
const getDoubleDistributivityQuestion = () => {
|
|
80
|
+
const affines = affine_1.AffineConstructor.differentRandoms(2, undefined, {
|
|
81
|
+
excludes: [0],
|
|
82
|
+
});
|
|
83
|
+
const statementTree = new multiplyNode_1.MultiplyNode(affines[0].toTree(), affines[1].toTree());
|
|
84
|
+
const identifiers = {
|
|
85
|
+
affine1Coeffs: affines[0].coefficients,
|
|
86
|
+
affine2Coeffs: affines[1].coefficients,
|
|
87
|
+
};
|
|
32
88
|
const question = {
|
|
33
|
-
instruction:
|
|
89
|
+
instruction: getInstruction(identifiers),
|
|
34
90
|
startStatement: statementTree.toTex(),
|
|
35
|
-
answer,
|
|
91
|
+
answer: getAnswer(identifiers),
|
|
36
92
|
keys: ["x"],
|
|
37
93
|
answerFormat: "tex",
|
|
38
|
-
identifiers
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
},
|
|
42
|
-
hint: "Multiplie chaque terme du premier facteur par chaque terme du second facteur, puis regroupe les termes similaires.",
|
|
43
|
-
correction: `
|
|
44
|
-
${(0, alignTex_1.alignTex)([
|
|
45
|
-
[statementTex, "=", (0, operatorComposition_1.operatorComposition)(addNode_1.AddNode, subMultiplications).toTex()],
|
|
46
|
-
[
|
|
47
|
-
"",
|
|
48
|
-
"=",
|
|
49
|
-
(0, operatorComposition_1.operatorComposition)(addNode_1.AddNode, subMultiplications.map((e) => e.simplify())).toTex(),
|
|
50
|
-
],
|
|
51
|
-
["", "=", answer],
|
|
52
|
-
])}
|
|
53
|
-
|
|
54
|
-
`,
|
|
94
|
+
identifiers,
|
|
95
|
+
hint: getHint(identifiers),
|
|
96
|
+
correction: getCorrection(identifiers),
|
|
55
97
|
};
|
|
56
98
|
return question;
|
|
57
99
|
};
|
|
@@ -79,14 +121,21 @@ const getPropositions = (n, { answer, affine1Coeffs, affine2Coeffs }) => {
|
|
|
79
121
|
}
|
|
80
122
|
return (0, shuffle_1.shuffle)(propositions);
|
|
81
123
|
};
|
|
82
|
-
const isAnswerValid = (ans, {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
124
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
125
|
+
try {
|
|
126
|
+
const parsed = (0, polynomialParser_1.polynomialParser)(ans);
|
|
127
|
+
if (!parsed)
|
|
128
|
+
return false;
|
|
129
|
+
return (parsed
|
|
130
|
+
.simplify({
|
|
131
|
+
forbidFactorize: true,
|
|
132
|
+
towardsDistribute: true,
|
|
133
|
+
})
|
|
134
|
+
.toTex() === answer);
|
|
135
|
+
}
|
|
136
|
+
catch (err) {
|
|
137
|
+
return (0, handleVEAError_1.handleVEAError)(err);
|
|
138
|
+
}
|
|
90
139
|
};
|
|
91
140
|
exports.doubleDistributivity = {
|
|
92
141
|
id: "doubleDistri",
|
|
@@ -102,4 +151,8 @@ exports.doubleDistributivity = {
|
|
|
102
151
|
isAnswerValid,
|
|
103
152
|
subject: "Mathématiques",
|
|
104
153
|
hasHintAndCorrection: true,
|
|
154
|
+
getInstruction,
|
|
155
|
+
getAnswer,
|
|
156
|
+
getCorrection,
|
|
157
|
+
getHint,
|
|
105
158
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simpleDistributivity.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/distributivity/simpleDistributivity.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"simpleDistributivity.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/distributivity/simpleDistributivity.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,0BAA0B,CAAC;AAalC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AA0GF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAmBtD,CAAC"}
|
|
@@ -10,6 +10,8 @@ const addNode_1 = require("../../../../tree/nodes/operators/addNode");
|
|
|
10
10
|
const multiplyNode_1 = require("../../../../tree/nodes/operators/multiplyNode");
|
|
11
11
|
const alignTex_1 = require("../../../../utils/latex/alignTex");
|
|
12
12
|
const shuffle_1 = require("../../../../utils/alea/shuffle");
|
|
13
|
+
const handleVEAError_1 = require("../../../../utils/errors/handleVEAError");
|
|
14
|
+
const polynomialParser_1 = require("../../../../tree/parsers/polynomialParser");
|
|
13
15
|
const buildStatement = (identifiers) => {
|
|
14
16
|
const { a, b, coeff } = identifiers;
|
|
15
17
|
const affine = new affine_1.Affine(a, b);
|
|
@@ -18,7 +20,11 @@ const buildStatement = (identifiers) => {
|
|
|
18
20
|
};
|
|
19
21
|
const getInstruction = (identifiers) => {
|
|
20
22
|
const statementTex = buildStatement(identifiers).toTex();
|
|
21
|
-
return `Développer et réduire :
|
|
23
|
+
return `Développer et réduire :
|
|
24
|
+
|
|
25
|
+
$$
|
|
26
|
+
${statementTex}
|
|
27
|
+
$$`;
|
|
22
28
|
};
|
|
23
29
|
const getAnswer = (identifiers) => {
|
|
24
30
|
const { a, b, coeff } = identifiers;
|
|
@@ -75,11 +81,19 @@ const getPropositions = (n, { answer, a, b, coeff }) => {
|
|
|
75
81
|
}
|
|
76
82
|
return (0, shuffle_1.shuffle)(propositions);
|
|
77
83
|
};
|
|
78
|
-
const isAnswerValid = (ans, { a, b, coeff }) => {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
84
|
+
const isAnswerValid = (ans, { answer, a, b, coeff }) => {
|
|
85
|
+
try {
|
|
86
|
+
console.log(ans, answer);
|
|
87
|
+
const parsed = (0, polynomialParser_1.polynomialParser)(ans);
|
|
88
|
+
if (!parsed)
|
|
89
|
+
return false;
|
|
90
|
+
return (parsed
|
|
91
|
+
.simplify({ towardsDistribute: true, forbidFactorize: true })
|
|
92
|
+
.toTex() === answer);
|
|
93
|
+
}
|
|
94
|
+
catch (err) {
|
|
95
|
+
return (0, handleVEAError_1.handleVEAError)(err);
|
|
96
|
+
}
|
|
83
97
|
};
|
|
84
98
|
exports.simpleDistributivity = {
|
|
85
99
|
id: "simpleDistri",
|
|
@@ -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;
|
|
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;IAEjB,aAAa,EAAE,MAAM,EAAE,EAAE,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;IAIlB,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB,CAAC;AAgKF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,CAepD,CAAC"}
|
|
@@ -16,15 +16,14 @@ const random_1 = require("../../../../utils/alea/random");
|
|
|
16
16
|
const shuffle_1 = require("../../../../utils/alea/shuffle");
|
|
17
17
|
const handleVEAError_1 = require("../../../../utils/errors/handleVEAError");
|
|
18
18
|
const getStatementNode = (identifiers) => {
|
|
19
|
-
const { affinesCoeffs, operation } = identifiers;
|
|
19
|
+
const { affinesCoeffs, operation, affinesOrder } = identifiers;
|
|
20
20
|
const affines = affinesCoeffs.map((coeffs) => new affine_1.Affine(coeffs[1], coeffs[0]));
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
];
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
: new substractNode_1.SubstractNode(new multiplyNode_1.MultiplyNode(permut[0][0].toTree(), permut[0][1].toTree()), new multiplyNode_1.MultiplyNode(permut[1][0].toTree(), permut[1][1].toTree()));
|
|
21
|
+
const order = [[], []];
|
|
22
|
+
order[0][affinesOrder[0]] = affines[1];
|
|
23
|
+
order[1][affinesOrder[1]] = affines[2];
|
|
24
|
+
order[0][1 - affinesOrder[0]] = affines[0];
|
|
25
|
+
order[1][1 - affinesOrder[1]] = affines[0];
|
|
26
|
+
const statementTree = (operation === "add" ? addNode_1.add : substractNode_1.substract)(new multiplyNode_1.MultiplyNode(order[0][0].toTree(), order[0][1].toTree()), new multiplyNode_1.MultiplyNode(order[1][0].toTree(), order[1][1].toTree()));
|
|
28
27
|
return statementTree;
|
|
29
28
|
};
|
|
30
29
|
const getInstruction = (identifiers) => {
|
|
@@ -35,7 +34,7 @@ $$
|
|
|
35
34
|
${getStatementNode(identifiers).toTex()}
|
|
36
35
|
$$`;
|
|
37
36
|
};
|
|
38
|
-
const
|
|
37
|
+
const getAnswerNode = (identifiers) => {
|
|
39
38
|
const { affinesCoeffs, operation } = identifiers;
|
|
40
39
|
const factor = new affine_1.Affine(affinesCoeffs[0][1], affinesCoeffs[0][0]);
|
|
41
40
|
const affine2 = new affine_1.Affine(affinesCoeffs[2][1], affinesCoeffs[2][0]);
|
|
@@ -43,10 +42,11 @@ const getAnswer = (identifiers) => {
|
|
|
43
42
|
const secondTerm = (operation === "add"
|
|
44
43
|
? (0, addNode_1.add)(affine1.toTree(), affine2.toTree())
|
|
45
44
|
: (0, substractNode_1.substract)(affine1.toTree(), affine2.toTree())).simplify({ forbidFactorize: true, towardsDistribute: true });
|
|
46
|
-
const sol = (0, multiplyNode_1.multiply)(factor.toTree(), secondTerm).simplify({
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
45
|
+
const sol = (0, multiplyNode_1.multiply)(factor.toTree(), secondTerm).simplify({});
|
|
46
|
+
return sol;
|
|
47
|
+
};
|
|
48
|
+
const getAnswer = (identifiers) => {
|
|
49
|
+
return getAnswerNode(identifiers).toTex();
|
|
50
50
|
};
|
|
51
51
|
const getFactoType1Question = () => {
|
|
52
52
|
const a = (0, randint_1.randint)(-9, 10, [0]);
|
|
@@ -71,6 +71,7 @@ const getFactoType1Question = () => {
|
|
|
71
71
|
[e, f],
|
|
72
72
|
],
|
|
73
73
|
operation,
|
|
74
|
+
affinesOrder: [(0, random_1.random)([0, 1]), (0, random_1.random)([0, 1])],
|
|
74
75
|
};
|
|
75
76
|
const question = {
|
|
76
77
|
instruction: getInstruction(identifiers),
|
|
@@ -113,10 +114,12 @@ const isAnswerValid = (ans, { answer, ...identifiers }) => {
|
|
|
113
114
|
forbidFactorize: true,
|
|
114
115
|
towardsDistribute: true,
|
|
115
116
|
});
|
|
116
|
-
const answerSimp =
|
|
117
|
+
const answerSimp = getAnswerNode(identifiers).simplify({
|
|
117
118
|
towardsDistribute: true,
|
|
118
119
|
forbidFactorize: true,
|
|
119
120
|
});
|
|
121
|
+
// const simp = parsed.simplify({});
|
|
122
|
+
console.log(simp.toTex());
|
|
120
123
|
return simp.toTex() === answerSimp.toTex();
|
|
121
124
|
}
|
|
122
125
|
catch (err) {
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
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;AAmFF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,WAAW,CAcvD,CAAC"}
|
|
@@ -68,7 +68,9 @@ const isAnswerValid = (ans, { answer, firstTermIsAffine, a, b, c, d, e, f, g })
|
|
|
68
68
|
const parsed = (0, polynomialParser_1.polynomialParser)(ans);
|
|
69
69
|
if (!parsed)
|
|
70
70
|
return false;
|
|
71
|
-
return parsed
|
|
71
|
+
return (parsed
|
|
72
|
+
.simplify({ towardsDistribute: true, forbidFactorize: true })
|
|
73
|
+
.toTex() === answer);
|
|
72
74
|
}
|
|
73
75
|
catch (err) {
|
|
74
76
|
return (0, handleVEAError_1.handleVEAError)(err);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aeraConversion.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/conversion/aeraConversion.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"aeraConversion.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/conversion/aeraConversion.ts"],"names":[],"mappings":"AAWA,OAAO,EACL,QAAQ,EAYT,MAAM,gBAAgB,CAAC;AAExB,KAAK,WAAW,GAAG;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,0BAA0B,EAAE,MAAM,CAAC;IACnC,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AA6HF,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,WAAW,CAgBhD,CAAC"}
|
|
@@ -1,32 +1,89 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.aeraConversion = void 0;
|
|
4
|
+
const numberVEA_1 = require("../../../exercises/vea/numberVEA");
|
|
4
5
|
const decimal_1 = require("../../../math/numbers/decimals/decimal");
|
|
5
6
|
const randint_1 = require("../../../math/utils/random/randint");
|
|
7
|
+
const fractionNode_1 = require("../../../tree/nodes/operators/fractionNode");
|
|
8
|
+
const multiplyNode_1 = require("../../../tree/nodes/operators/multiplyNode");
|
|
6
9
|
const shuffle_1 = require("../../../utils/alea/shuffle");
|
|
7
10
|
const doWhile_1 = require("../../../utils/doWhile");
|
|
11
|
+
const alignTex_1 = require("../../../utils/latex/alignTex");
|
|
8
12
|
const exercise_1 = require("../../exercise");
|
|
9
13
|
const getDistinctQuestions_1 = require("../../utils/getDistinctQuestions");
|
|
10
14
|
const units = ["mm", "cm", "dm", "m", "dam", "hm", "km"];
|
|
15
|
+
const getInstruction = (identifiers) => {
|
|
16
|
+
const { randomAera, randomUnitIndex, randomUnitInstructionIndex } = identifiers;
|
|
17
|
+
return `Compléter :
|
|
18
|
+
|
|
19
|
+
$$
|
|
20
|
+
${randomAera.frenchify()}\\ \\textrm{${units[randomUnitIndex]}}^2 = \\ldots \\ \\textrm{${units[randomUnitInstructionIndex]}}^2
|
|
21
|
+
$$`;
|
|
22
|
+
};
|
|
23
|
+
const getHint = (identifiers) => {
|
|
24
|
+
const { randomAera, randomUnitIndex, randomUnitInstructionIndex } = identifiers;
|
|
25
|
+
const unit = units[randomUnitIndex];
|
|
26
|
+
const target = units[randomUnitInstructionIndex];
|
|
27
|
+
const space = randomUnitIndex - randomUnitInstructionIndex;
|
|
28
|
+
return `On rappelle que :
|
|
29
|
+
|
|
30
|
+
$$
|
|
31
|
+
1 \\ \\textrm{${unit}}^2 = ${space > 0
|
|
32
|
+
? Math.pow(10, space * 2)
|
|
33
|
+
: (0, fractionNode_1.frac)(1, Math.pow(10, -(space * 2))).toTex()} \\ \\textrm{${target}}^2
|
|
34
|
+
$$`;
|
|
35
|
+
};
|
|
36
|
+
const getCorrection = (identifiers) => {
|
|
37
|
+
const { randomAera, randomUnitIndex, randomUnitInstructionIndex } = identifiers;
|
|
38
|
+
const unit = units[randomUnitIndex];
|
|
39
|
+
const target = units[randomUnitInstructionIndex];
|
|
40
|
+
const space = randomUnitIndex - randomUnitInstructionIndex;
|
|
41
|
+
const coeff = space > 0
|
|
42
|
+
? Math.pow(10, space * 2).toTree()
|
|
43
|
+
: (0, fractionNode_1.frac)(1, Math.pow(10, -(space * 2)));
|
|
44
|
+
return `On sait que :
|
|
45
|
+
|
|
46
|
+
$$
|
|
47
|
+
1 \\ \\textrm{${unit}}^2 = ${coeff.toTex()} \\ \\textrm{${target}}^2
|
|
48
|
+
$$
|
|
49
|
+
|
|
50
|
+
Il suffit alors de multiplier $${randomAera.frenchify()}$ par $${coeff.toTex()}$ :
|
|
51
|
+
|
|
52
|
+
${(0, alignTex_1.alignTex)([
|
|
53
|
+
[
|
|
54
|
+
`${randomAera.frenchify()} \\textrm{${unit}}^2 `,
|
|
55
|
+
"=",
|
|
56
|
+
`${(0, multiplyNode_1.multiply)(coeff, randomAera).toTex()}\\ \\textrm{${target}}^2`,
|
|
57
|
+
],
|
|
58
|
+
["", "=", `${getAnswer(identifiers)}\\ \\textrm{${target}}^2`],
|
|
59
|
+
])}
|
|
60
|
+
`;
|
|
61
|
+
};
|
|
62
|
+
const getAnswer = (identifiers) => {
|
|
63
|
+
const { randomAera, randomUnitIndex, randomUnitInstructionIndex } = identifiers;
|
|
64
|
+
const randomAeraDec = new decimal_1.Decimal(randomAera);
|
|
65
|
+
const answer = randomAeraDec
|
|
66
|
+
.multiplyByPowerOfTen(2 * (randomUnitIndex - randomUnitInstructionIndex))
|
|
67
|
+
.value.frenchify();
|
|
68
|
+
return answer;
|
|
69
|
+
};
|
|
11
70
|
const getAeraConversion = () => {
|
|
12
71
|
const randomUnitIndex = (0, randint_1.randint)(0, 7);
|
|
13
|
-
const randomUnitInstructionIndex = (0, randint_1.randint)(
|
|
14
|
-
// cette manip a pour but d'éviter des conversion de type km² --> cm² ou le contraire (chiffre trop grand/petit)
|
|
15
|
-
randomUnitIndex - 2 < 0 ? 0 : randomUnitIndex - 2, randomUnitIndex + 2 > 7 ? 7 : randomUnitIndex + 3, [randomUnitIndex]);
|
|
72
|
+
const randomUnitInstructionIndex = (0, randint_1.randint)(Math.max(0, randomUnitIndex - 2), Math.min(7, randomUnitIndex + 3), [randomUnitIndex]);
|
|
16
73
|
const randomAera = (0, doWhile_1.doWhile)(() => decimal_1.DecimalConstructor.random(0, 1000, (0, randint_1.randint)(0, 4)), (x) => x.value === 0);
|
|
17
|
-
const
|
|
74
|
+
const identifiers = {
|
|
75
|
+
randomAera: randomAera.value,
|
|
76
|
+
randomUnitIndex,
|
|
77
|
+
randomUnitInstructionIndex,
|
|
78
|
+
};
|
|
18
79
|
const question = {
|
|
19
|
-
instruction:
|
|
20
|
-
|
|
21
|
-
.replace(".", ",")} \\textrm{${units[randomUnitIndex]}}^2 = \\ldots \\textrm{${units[randomUnitInstructionIndex]}}^2$`,
|
|
22
|
-
answer,
|
|
80
|
+
instruction: getInstruction(identifiers),
|
|
81
|
+
answer: getAnswer(identifiers),
|
|
23
82
|
keys: [],
|
|
24
83
|
answerFormat: "tex",
|
|
25
|
-
identifiers:
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
randomUnitInstructionIndex,
|
|
29
|
-
},
|
|
84
|
+
identifiers: identifiers,
|
|
85
|
+
hint: getHint(identifiers),
|
|
86
|
+
correction: getCorrection(identifiers),
|
|
30
87
|
};
|
|
31
88
|
return question;
|
|
32
89
|
};
|
|
@@ -43,7 +100,7 @@ const getPropositions = (n, { answer, randomAera, randomUnitIndex, randomUnitIns
|
|
|
43
100
|
return (0, shuffle_1.shuffle)(propositions);
|
|
44
101
|
};
|
|
45
102
|
const isAnswerValid = (ans, { answer }) => {
|
|
46
|
-
return ans
|
|
103
|
+
return (0, numberVEA_1.numberVEA)(ans, answer);
|
|
47
104
|
};
|
|
48
105
|
exports.aeraConversion = {
|
|
49
106
|
id: "aeraConversion",
|
|
@@ -51,11 +108,14 @@ exports.aeraConversion = {
|
|
|
51
108
|
getPropositions,
|
|
52
109
|
isAnswerValid,
|
|
53
110
|
label: "Conversion des aires",
|
|
54
|
-
levels: ["6ème", "5ème", "CAP", "2ndPro"],
|
|
55
|
-
sections: ["Conversions"],
|
|
56
111
|
isSingleStep: true,
|
|
57
112
|
generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getAeraConversion, nb),
|
|
58
113
|
qcmTimer: 60,
|
|
59
114
|
freeTimer: 60,
|
|
60
115
|
subject: "Mathématiques",
|
|
116
|
+
getAnswer,
|
|
117
|
+
getInstruction,
|
|
118
|
+
getHint,
|
|
119
|
+
getCorrection,
|
|
120
|
+
hasHintAndCorrection: true,
|
|
61
121
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"volumeConversion.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/conversion/volumeConversion.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,QAAQ,EAQT,MAAM,gBAAgB,CAAC;AAExB,KAAK,WAAW,GAAG;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,0BAA0B,EAAE,MAAM,CAAC;IACnC,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;
|
|
1
|
+
{"version":3,"file":"volumeConversion.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/conversion/volumeConversion.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,QAAQ,EAQT,MAAM,gBAAgB,CAAC;AAExB,KAAK,WAAW,GAAG;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,0BAA0B,EAAE,MAAM,CAAC;IACnC,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AA+DF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,WAAW,CAclD,CAAC"}
|
|
@@ -10,9 +10,7 @@ const getDistinctQuestions_1 = require("../../utils/getDistinctQuestions");
|
|
|
10
10
|
const units = ["mm", "cm", "dm", "m", "dam", "hm", "km"];
|
|
11
11
|
const getVolumeConversion = () => {
|
|
12
12
|
const randomUnitIndex = (0, randint_1.randint)(0, 7);
|
|
13
|
-
const randomUnitInstructionIndex = (0, randint_1.randint)(
|
|
14
|
-
// cette manip a pour but d'éviter des conversion de type km³ --> cm³ ou le contraire (chiffre trop grand/petit)
|
|
15
|
-
randomUnitIndex - 2 < 0 ? 0 : randomUnitIndex - 2, randomUnitIndex + 2 > 6 ? 6 : randomUnitIndex + 2, [randomUnitIndex]);
|
|
13
|
+
const randomUnitInstructionIndex = (0, randint_1.randint)(Math.max(0, randomUnitIndex - 2), Math.min(7, randomUnitIndex + 3), [randomUnitIndex]);
|
|
16
14
|
const randomVolume = (0, doWhile_1.doWhile)(() => decimal_1.DecimalConstructor.random(0, 1000, (0, randint_1.randint)(0, 4)), (x) => x.value === 0);
|
|
17
15
|
const answer = (randomVolume.multiplyByPowerOfTen(3 * (randomUnitIndex - randomUnitInstructionIndex)).value + "").replace(".", ",");
|
|
18
16
|
const question = {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/dataRepresentations/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./tableReading"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tableReading.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/dataRepresentations/tableReading.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,0BAA0B,CAAC;AASlC,KAAK,WAAW,GAAG;IAIjB,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AA4FF,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,WAAW,CAgB9C,CAAC"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.tableReading = void 0;
|
|
4
|
+
const exercise_1 = require("../../../exercises/exercise");
|
|
5
|
+
const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
|
|
6
|
+
const numberVEA_1 = require("../../../exercises/vea/numberVEA");
|
|
7
|
+
const randint_1 = require("../../../math/utils/random/randint");
|
|
8
|
+
const random_1 = require("../../../utils/alea/random");
|
|
9
|
+
const handleVEAError_1 = require("../../../utils/errors/handleVEAError");
|
|
10
|
+
const dollarize_1 = require("../../../utils/latex/dollarize");
|
|
11
|
+
const mdTable_1 = require("../../../utils/markdown/mdTable");
|
|
12
|
+
const getPropositions = (n, { answer, values, caseAsked }) => {
|
|
13
|
+
const propositions = [];
|
|
14
|
+
(0, exercise_1.addValidProp)(propositions, answer);
|
|
15
|
+
while (propositions.length < n) {
|
|
16
|
+
(0, exercise_1.tryToAddWrongProp)(propositions, (0, random_1.random)(values.flat()).frenchify());
|
|
17
|
+
}
|
|
18
|
+
return (0, exercise_1.shuffleProps)(propositions, n);
|
|
19
|
+
};
|
|
20
|
+
const getAnswer = (identifiers) => {
|
|
21
|
+
const { values, caseAsked } = identifiers;
|
|
22
|
+
const flatValues = values.flat();
|
|
23
|
+
return flatValues[caseAsked].frenchify();
|
|
24
|
+
};
|
|
25
|
+
const getInstruction = (identifiers) => {
|
|
26
|
+
const { values, caseAsked } = identifiers;
|
|
27
|
+
let population = caseAsked % 3 === 0
|
|
28
|
+
? "de la $6^e$ A"
|
|
29
|
+
: caseAsked % 3 === 1
|
|
30
|
+
? "de la $6^e$ B"
|
|
31
|
+
: "";
|
|
32
|
+
let caractere = caseAsked < 3
|
|
33
|
+
? "préfèrent le jeu Minecraft"
|
|
34
|
+
: caseAsked < 6
|
|
35
|
+
? "préfèrent le jeu The Legend of Zelda"
|
|
36
|
+
: "ont répondu au sondage";
|
|
37
|
+
return `Un sondage a été réalisé auprès des élèves de deux classes de $6^e$ pour connaître leur jeu vidéo préféré. Voici leurs réponses :
|
|
38
|
+
|
|
39
|
+
${(0, mdTable_1.mdTable)([
|
|
40
|
+
["", "$6^e$ A", "$6^e$ B", "Total"],
|
|
41
|
+
["Minecraft", ...values[0].map(dollarize_1.dollarize)],
|
|
42
|
+
["The Legend of Zelda", ...values[1].map(dollarize_1.dollarize)],
|
|
43
|
+
["Total", ...values[2].map(dollarize_1.dollarize)],
|
|
44
|
+
])}
|
|
45
|
+
|
|
46
|
+
Combien d'élèves ${population} ${caractere} ?
|
|
47
|
+
`;
|
|
48
|
+
};
|
|
49
|
+
// const getHint: GetHint<Identifiers> = (identifiers) => {};
|
|
50
|
+
// const getCorrection: GetCorrection<Identifiers> = (identifiers) => {};
|
|
51
|
+
const getKeys = (identifiers) => {
|
|
52
|
+
return [];
|
|
53
|
+
};
|
|
54
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
55
|
+
try {
|
|
56
|
+
return (0, numberVEA_1.numberVEA)(ans, answer);
|
|
57
|
+
}
|
|
58
|
+
catch (err) {
|
|
59
|
+
return (0, handleVEAError_1.handleVEAError)(err);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
const getTableReadingQuestion = (ops) => {
|
|
63
|
+
const caseAsked = (0, randint_1.randint)(0, 9);
|
|
64
|
+
const totalA = (0, randint_1.randint)(20, 30);
|
|
65
|
+
const totalB = (0, randint_1.randint)(20, 30, [totalA]);
|
|
66
|
+
const case0 = (0, randint_1.randint)(3, totalA - 5);
|
|
67
|
+
const case1 = (0, randint_1.randint)(3, totalB - 5, [case0]);
|
|
68
|
+
const case3 = totalA - case0;
|
|
69
|
+
const case4 = totalB - case1;
|
|
70
|
+
const values = [
|
|
71
|
+
[case0, case1, case0 + case1],
|
|
72
|
+
[case3, case4, case3 + case4],
|
|
73
|
+
[totalA, totalB, totalA + totalB],
|
|
74
|
+
];
|
|
75
|
+
const identifiers = {
|
|
76
|
+
caseAsked,
|
|
77
|
+
values,
|
|
78
|
+
};
|
|
79
|
+
const question = {
|
|
80
|
+
answer: getAnswer(identifiers),
|
|
81
|
+
instruction: getInstruction(identifiers),
|
|
82
|
+
keys: getKeys(identifiers),
|
|
83
|
+
answerFormat: "tex",
|
|
84
|
+
identifiers,
|
|
85
|
+
// hint: getHint(identifiers),
|
|
86
|
+
// correction: getCorrection(identifiers),
|
|
87
|
+
};
|
|
88
|
+
return question;
|
|
89
|
+
};
|
|
90
|
+
exports.tableReading = {
|
|
91
|
+
id: "tableReading",
|
|
92
|
+
connector: "=",
|
|
93
|
+
label: "Lire un tableau à double entrée",
|
|
94
|
+
isSingleStep: true,
|
|
95
|
+
generator: (nb, opts) => (0, getDistinctQuestions_1.getDistinctQuestions)(() => getTableReadingQuestion(opts), nb),
|
|
96
|
+
qcmTimer: 60,
|
|
97
|
+
freeTimer: 60,
|
|
98
|
+
getPropositions,
|
|
99
|
+
isAnswerValid,
|
|
100
|
+
subject: "Mathématiques",
|
|
101
|
+
getInstruction,
|
|
102
|
+
// getHint,
|
|
103
|
+
// getCorrection,
|
|
104
|
+
getAnswer,
|
|
105
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constanteDerivative.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivative/constanteDerivative.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"constanteDerivative.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivative/constanteDerivative.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAMR,YAAY,EAEZ,iBAAiB,EACjB,GAAG,EAIJ,MAAM,0BAA0B,CAAC;AAKlC,KAAK,WAAW,GAAG;IACjB,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAmBF,eAAO,MAAM,sBAAsB,EAAE,iBAAiB,CAAC,WAAW,CAgBjE,CAAC;AAEF,eAAO,MAAM,kCAAkC,EAAE,YAAY,CAAC,WAAW,CAmBxE,CAAC;AACF,eAAO,MAAM,gCAAgC,EAAE,GAAG,CAAC,WAAW,CAE7D,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,WAAW,CAkBrD,CAAC"}
|
|
@@ -11,17 +11,26 @@ const getHint = ({ tex }) => {
|
|
|
11
11
|
const getCorrection = ({ tex }) => {
|
|
12
12
|
return `La fonction $f$ est une fonction constante égale à $${tex}$. Or, la fonction dérivée d'une fonction constante est nulle. Ainsi, pour tout $x\\in \\mathbb{R}$, $f'(x) = 0$.`;
|
|
13
13
|
};
|
|
14
|
+
const getAnswer = () => "0";
|
|
15
|
+
const getInstruction = (identifiers) => {
|
|
16
|
+
const tex = identifiers.tex;
|
|
17
|
+
return `Déterminer la fonction dérivée $f'$ de la fonction $f$ définie par :
|
|
18
|
+
|
|
19
|
+
$$
|
|
20
|
+
f(x) = ${tex}
|
|
21
|
+
$$.`;
|
|
22
|
+
};
|
|
14
23
|
const getConstanteDerivative = () => {
|
|
15
24
|
const c = nombre_1.NombreConstructor.random();
|
|
16
25
|
const tex = c.toTree().toTex();
|
|
17
|
-
const
|
|
26
|
+
const identifiers = { tex };
|
|
18
27
|
const question = {
|
|
19
|
-
instruction:
|
|
28
|
+
instruction: getInstruction(identifiers),
|
|
20
29
|
startStatement: `f'(x)`,
|
|
21
|
-
answer,
|
|
30
|
+
answer: getAnswer(identifiers),
|
|
22
31
|
keys: ["x"],
|
|
23
32
|
answerFormat: "tex",
|
|
24
|
-
identifiers
|
|
33
|
+
identifiers,
|
|
25
34
|
hint: getHint({ tex }),
|
|
26
35
|
correction: getCorrection({ tex }),
|
|
27
36
|
};
|
|
@@ -63,4 +72,6 @@ exports.constanteDerivative = {
|
|
|
63
72
|
getHint,
|
|
64
73
|
getCorrection,
|
|
65
74
|
hasHintAndCorrection: true,
|
|
75
|
+
getAnswer,
|
|
76
|
+
getInstruction,
|
|
66
77
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"thirdDegreeFunctionVariation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivative/thirdDegreeFunctionVariation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAQT,MAAM,0BAA0B,CAAC;AAoBlC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAkHF,eAAO,MAAM,4BAA4B,EAAE,QAAQ,CAAC,WAAW,
|
|
1
|
+
{"version":3,"file":"thirdDegreeFunctionVariation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivative/thirdDegreeFunctionVariation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAQT,MAAM,0BAA0B,CAAC;AAoBlC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAkHF,eAAO,MAAM,4BAA4B,EAAE,QAAQ,CAAC,WAAW,CAa9D,CAAC"}
|
|
@@ -103,16 +103,6 @@ exports.thirdDegreeFunctionVariation = {
|
|
|
103
103
|
id: "thirdDegreeFunctionVariation",
|
|
104
104
|
connector: "=",
|
|
105
105
|
label: "Lecture du signe de la dérivée via les variations d'une fonction",
|
|
106
|
-
levels: [
|
|
107
|
-
"1reESM",
|
|
108
|
-
"1reSpé",
|
|
109
|
-
"1reTech",
|
|
110
|
-
"MathComp",
|
|
111
|
-
"1rePro",
|
|
112
|
-
"TermPro",
|
|
113
|
-
"TermTech",
|
|
114
|
-
],
|
|
115
|
-
sections: ["Dérivation"],
|
|
116
106
|
isSingleStep: true,
|
|
117
107
|
generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getThirdDegreeFunctionVariation, nb),
|
|
118
108
|
qcmTimer: 60,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signFunction.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/affines/signFunction.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,0BAA0B,CAAC;AAoBlC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,cAAc,EAAE,OAAO,CAAC;CACzB,CAAC;AAgIF,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,WAAW,
|
|
1
|
+
{"version":3,"file":"signFunction.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/affines/signFunction.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,0BAA0B,CAAC;AAoBlC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,cAAc,EAAE,OAAO,CAAC;CACzB,CAAC;AAgIF,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,WAAW,CAqB9C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rectangleArea.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/areas/rectangleArea.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"rectangleArea.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/areas/rectangleArea.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,0BAA0B,CAAC;AAIlC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAqEF,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,WAAW,CAmB/C,CAAC"}
|
|
@@ -6,18 +6,43 @@ const getDistinctQuestions_1 = require("../../../../exercises/utils/getDistinctQ
|
|
|
6
6
|
const randint_1 = require("../../../../math/utils/random/randint");
|
|
7
7
|
const shuffle_1 = require("../../../../utils/alea/shuffle");
|
|
8
8
|
const getKeys = (identifiers) => ["cm", "cm2"];
|
|
9
|
+
const getInstruction = (identifiers) => {
|
|
10
|
+
const { length, width } = identifiers;
|
|
11
|
+
return `Calculer l'aire d'un rectangle de $${length}$ cm de longueur et de $${width}$ cm de largeur.`;
|
|
12
|
+
};
|
|
13
|
+
const getAnswer = (identifiers) => {
|
|
14
|
+
const { length, width } = identifiers;
|
|
15
|
+
const answer = length * width + "";
|
|
16
|
+
const answerTex = answer + "\\text{cm}^2";
|
|
17
|
+
return answerTex;
|
|
18
|
+
};
|
|
19
|
+
const getHint = (identifiers) => {
|
|
20
|
+
return "Pour déterminer l'aire d'un rectangle, on multiplie sa longeur par sa largeur.";
|
|
21
|
+
};
|
|
22
|
+
const getCorrection = (identifiers) => {
|
|
23
|
+
const { length, width } = identifiers;
|
|
24
|
+
return `L'aire d'un rectangle est le produit de sa largeur et de sa longueur.
|
|
25
|
+
|
|
26
|
+
Ici, on a donc :
|
|
27
|
+
|
|
28
|
+
$$
|
|
29
|
+
\\mathcal{A} = ${length} \\times ${width} = ${length * width} \\text{cm}^2
|
|
30
|
+
$$
|
|
31
|
+
|
|
32
|
+
`;
|
|
33
|
+
};
|
|
9
34
|
const getRectangleArea = () => {
|
|
10
35
|
const length = (0, randint_1.randint)(3, 13);
|
|
11
36
|
const width = (0, randint_1.randint)(1, length);
|
|
12
|
-
const answer = length * width + "";
|
|
13
|
-
const answerTex = answer + "\\text{cm}^2";
|
|
14
37
|
const identifiers = { length, width };
|
|
15
38
|
const question = {
|
|
16
|
-
instruction:
|
|
17
|
-
answer:
|
|
39
|
+
instruction: getInstruction(identifiers),
|
|
40
|
+
answer: getAnswer(identifiers),
|
|
18
41
|
answerFormat: "tex",
|
|
19
42
|
keys: getKeys(identifiers),
|
|
20
43
|
identifiers,
|
|
44
|
+
hint: getHint(identifiers),
|
|
45
|
+
correction: getCorrection(identifiers),
|
|
21
46
|
};
|
|
22
47
|
return question;
|
|
23
48
|
};
|
|
@@ -47,4 +72,9 @@ exports.rectangleArea = {
|
|
|
47
72
|
isAnswerValid,
|
|
48
73
|
subject: "Mathématiques",
|
|
49
74
|
getKeys,
|
|
75
|
+
getInstruction,
|
|
76
|
+
getAnswer,
|
|
77
|
+
getHint,
|
|
78
|
+
getCorrection,
|
|
79
|
+
hasHintAndCorrection: true,
|
|
50
80
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/exercises/math/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/exercises/math/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,uBAAuB,CAAC"}
|
|
@@ -36,4 +36,4 @@ __exportStar(require("./squareRoots"), exports);
|
|
|
36
36
|
__exportStar(require("./trigonometry"), exports);
|
|
37
37
|
__exportStar(require("./python"), exports);
|
|
38
38
|
__exportStar(require("./sampling"), exports);
|
|
39
|
-
__exportStar(require("./
|
|
39
|
+
__exportStar(require("./dataRepresentations"), exports);
|
package/lib/index.d.ts
CHANGED
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAG1D,OAAO,yBAAyB,CAAC;AAEjC,QAAA,MAAM,aAAa
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAG1D,OAAO,yBAAyB,CAAC;AAEjC,QAAA,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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E,QAAQ,EAAE,CAAC"}
|
package/lib/playground.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const playground: () =>
|
|
1
|
+
export declare const playground: () => false | undefined;
|
|
2
2
|
//# sourceMappingURL=playground.d.ts.map
|
package/lib/playground.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"playground.d.ts","sourceRoot":"","sources":["../src/playground.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"playground.d.ts","sourceRoot":"","sources":["../src/playground.ts"],"names":[],"mappings":"AA8DA,eAAO,MAAM,UAAU,yBAgBtB,CAAC"}
|
package/lib/playground.js
CHANGED
|
@@ -2,7 +2,20 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.playground = void 0;
|
|
4
4
|
const nodeConstructor_1 = require("./tree/nodes/nodeConstructor");
|
|
5
|
-
const
|
|
5
|
+
const latexParser_1 = require("./tree/parsers/latexParser");
|
|
6
|
+
const playground = () => {
|
|
7
|
+
const answer = "\\left(-5x-7\\right)^2";
|
|
8
|
+
const ans = "\\left(-5x-7\\right)^2";
|
|
9
|
+
const parsed = (0, latexParser_1.parseAlgebraic)(ans);
|
|
10
|
+
if (!parsed)
|
|
11
|
+
return false;
|
|
12
|
+
console.log(parsed
|
|
13
|
+
.simplify({
|
|
14
|
+
towardsDistribute: true,
|
|
15
|
+
forbidFactorize: true,
|
|
16
|
+
})
|
|
17
|
+
.toTex());
|
|
18
|
+
};
|
|
6
19
|
exports.playground = playground;
|
|
7
20
|
const logIdentifiers = () => {
|
|
8
21
|
const ids = '{"xA":-3,"yA":-2,"yPrimeA":{"id":31,"child":{"id":3,"leftChild":{"id":7,"value":3},"rightChild":{"id":7,"value":2}}},"trinomCoeffs":[0.3888888888888889,0.833333333333333,-3]}';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Affine } from "../../../math/polynomials/affine";
|
|
1
2
|
import { AlgebraicNode } from "../algebraicNode";
|
|
2
3
|
import { Node, NodeIds, NodeOptions, NodeType } from "../node";
|
|
3
4
|
import { NodeIdentifiers } from "../nodeConstructor";
|
|
@@ -27,4 +28,5 @@ export declare class EqualNode implements Node {
|
|
|
27
28
|
shuffle(): EqualNode;
|
|
28
29
|
reverse(): EqualNode;
|
|
29
30
|
}
|
|
31
|
+
export declare const firstDegreeEquationResolutionTex: (affineLeft: Affine, affineRight: Affine) => void;
|
|
30
32
|
//# sourceMappingURL=equalNode.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"equalNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/equations/equalNode.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"equalNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/equations/equalNode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AAEvD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC/D,OAAO,EAAmB,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAEtE,eAAO,MAAM,KAAK,MACb,aAAa,GAAG,MAAM,GAAG,MAAM,KAC/B,aAAa,GAAG,MAAM,GAAG,MAAM,cAOnC,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,EAAE,EAAE,OAAO,CAAC,KAAK,CAAC;IAClB,SAAS,EAAE,eAAe,CAAC;IAC3B,UAAU,EAAE,eAAe,CAAC;IAC5B,IAAI,CAAC,EAAE,WAAW,CAAC;CACpB,CAAC;AAEF,8BAAsB,oBAAoB;IACxC,MAAM,CAAC,eAAe,CAAC,WAAW,EAAE,oBAAoB,GAAG,SAAS;CAOrE;AAED,eAAO,MAAM,WAAW,SAAU,IAAI,sBACL,CAAC;AAElC,qBAAa,SAAU,YAAW,IAAI;IACpC,SAAS,EAAE,IAAI,CAAC;IAChB,UAAU,EAAE,IAAI,CAAC;IACjB,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,IAAI,EAAE,QAAQ,CAAC;gBACH,SAAS,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,WAAW;IAOjE,aAAa,IAAI,oBAAoB;IAQrC,iBAAiB,CAAC,IAAI,CAAC,EAAE,WAAW;IAmBpC,cAAc,CAAC,IAAI,CAAC,EAAE,WAAW,GAAG,MAAM,EAAE;IAM5C,YAAY,IAAI,MAAM;IAGtB,KAAK,IAAI,MAAM;IAIf,QAAQ;IAIR,OAAO;IAIP,OAAO;CAUR;AAED,eAAO,MAAM,gCAAgC,eAC/B,MAAM,eACL,MAAM,SAuBpB,CAAC"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.EqualNode = exports.isEqualNode = exports.EqualNodeConstructor = exports.equal = void 0;
|
|
4
|
-
// import { equal } from "mathjs";
|
|
3
|
+
exports.firstDegreeEquationResolutionTex = exports.EqualNode = exports.isEqualNode = exports.EqualNodeConstructor = exports.equal = void 0;
|
|
5
4
|
const coinFlip_1 = require("../../../utils/alea/coinFlip");
|
|
6
5
|
const node_1 = require("../node");
|
|
7
6
|
const nodeConstructor_1 = require("../nodeConstructor");
|
|
@@ -71,3 +70,27 @@ class EqualNode {
|
|
|
71
70
|
}
|
|
72
71
|
}
|
|
73
72
|
exports.EqualNode = EqualNode;
|
|
73
|
+
const firstDegreeEquationResolutionTex = (affineLeft, affineRight) => {
|
|
74
|
+
//ax(+-b) = (+-c)(x)(+-d)
|
|
75
|
+
// const b = affine.b;
|
|
76
|
+
// const a = affine.a;
|
|
77
|
+
// if (a === 1 && b === 0)
|
|
78
|
+
// return new InequationNode([affine.toTree(), right], [order]).toTex();
|
|
79
|
+
// const steps: string[][] = [[affine.toTex(), order, right.toTex()]];
|
|
80
|
+
// if (b !== 0)
|
|
81
|
+
// steps.push([
|
|
82
|
+
// affine.add(-b).toTex(),
|
|
83
|
+
// order,
|
|
84
|
+
// substract(right, b).simplify().toTex(),
|
|
85
|
+
// ]);
|
|
86
|
+
// if (a !== 1) {
|
|
87
|
+
// if (a < 0) order = new InequationSymbol(order).reversed();
|
|
88
|
+
// steps.push([
|
|
89
|
+
// affine.variable,
|
|
90
|
+
// order,
|
|
91
|
+
// frac(substract(right, b), a).simplify().toTex(),
|
|
92
|
+
// ]);
|
|
93
|
+
// }
|
|
94
|
+
// return alignTex(steps, true);
|
|
95
|
+
};
|
|
96
|
+
exports.firstDegreeEquationResolutionTex = firstDegreeEquationResolutionTex;
|
package/lib/tree/nodes/node.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../../src/tree/nodes/node.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../../src/tree/nodes/node.ts"],"names":[],"mappings":"AAGA,oBAAY,QAAQ;IAClB,MAAM,IAAA;IACN,QAAQ,IAAA;IACR,QAAQ,IAAA;IACR,QAAQ,IAAA;IACR,QAAQ,IAAA;IACR,UAAU,IAAA;IACV,KAAK,IAAA;IACL,MAAM,IAAA;IACN,QAAQ,IAAA;IACR,OAAO,IAAA;IACP,MAAM,KAAA;IACN,GAAG,KAAA;IACH,MAAM,KAAA;IACN,KAAK,KAAA;CACN;AACD,MAAM,MAAM,WAAW,GAAG;IACxB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,4BAA4B,CAAC,EAAE,OAAO,CAAC;IACvC,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,4BAA4B,CAAC,EAAE,OAAO,CAAC;IACvC,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,YAAY,CAAC,EAAE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EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,QAAQ,CAAmB;IACjC,SAAS,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,WAAW,CAAC;gBAEjB,KAAK,EAAE,MAAM,EACb,GAAG,CAAC,EAAE,MAAM,EACZ,UAAU,CAAC,EAAE,MAAM,EACnB,IAAI,CAAC,EAAE,WAAW;IASpB,YAAY,IAAI,MAAM;IAGtB,KAAK,CAAC,OAAO,CAAC,EAAE,YAAY,GAAG,MAAM;IAQrC,QAAQ;IAGR,aAAa;;;;IAMb,cAAc;IAOd,iBAAiB;IAGjB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAGtC,QAAQ,CAAC,IAAI,CAAC,EAAE,eAAe;IAQ/B,MAAM,CAAC,IAAI,EAAE,aAAa;IAG1B,oBAAoB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC;IAGxD,UAAU,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS;CAGxC"}
|
|
@@ -35,7 +35,7 @@ class NumberNode {
|
|
|
35
35
|
toTex(options) {
|
|
36
36
|
const opts = this.opts?.toTexOptions ?? options;
|
|
37
37
|
const color = opts?.color;
|
|
38
|
-
return (0, colorize_1.colorize)(`${this.tex}`, color);
|
|
38
|
+
return (0, colorize_1.colorize)(`${this.tex}${options?.unit ? `\\text{ ${options.unit}}` : ""}`, color);
|
|
39
39
|
}
|
|
40
40
|
toMathjs() {
|
|
41
41
|
return this.toMathString();
|
|
@@ -6,6 +6,6 @@ type ParserOptions = {
|
|
|
6
6
|
allowStartingPower?: boolean;
|
|
7
7
|
};
|
|
8
8
|
export declare const parseAlgebraic: (latex: string, opts?: ParserOptions) => AlgebraicNode;
|
|
9
|
-
export declare const parseLatex: (latex: string) => AlgebraicNode |
|
|
9
|
+
export declare const parseLatex: (latex: string) => AlgebraicNode | InequationNode | EqualNode;
|
|
10
10
|
export {};
|
|
11
11
|
//# sourceMappingURL=latexParser.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"polynomialParser.d.ts","sourceRoot":"","sources":["../../../src/tree/parsers/polynomialParser.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AASvD,KAAK,IAAI,GAAG;IACV,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;
|
|
1
|
+
{"version":3,"file":"polynomialParser.d.ts","sourceRoot":"","sources":["../../../src/tree/parsers/polynomialParser.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AASvD,KAAK,IAAI,GAAG;IACV,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAIF,eAAO,MAAM,gBAAgB,QAAS,MAAM,SAAS,IAAI,8OAkCxD,CAAC"}
|
|
@@ -10,6 +10,7 @@ const latexParser_1 = require("./latexParser");
|
|
|
10
10
|
const monomParser_1 = require("./monomParser");
|
|
11
11
|
const numberParser_1 = require("./numberParser");
|
|
12
12
|
//!parses polynomes sous forme développée
|
|
13
|
+
//! ne surtout pas transformer ça en un parse généraliste (qui pourrait parse une forme factorisée par exemple)
|
|
13
14
|
//minDegree = 0, max = undefined
|
|
14
15
|
const polynomialParser = (ans, opts) => {
|
|
15
16
|
try {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const powerParser: (ans: string) => false | import("../nodes/
|
|
1
|
+
export declare const powerParser: (ans: string) => false | import("../nodes/operators/powerNode").PowerNode | import("../nodes/functions/sqrtNode").SqrtNode | import("../nodes/operators/fractionNode").FractionNode;
|
|
2
2
|
//# sourceMappingURL=powerParser.d.ts.map
|