math-exercises 2.2.86 → 2.2.87
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/decimals/multiplyDecimalByTens.js +1 -1
- package/lib/exercises/math/calcul/rounding/rounding.js +2 -2
- package/lib/exercises/math/calculLitteral/factorisation/factoType1Exercise.d.ts +4 -0
- package/lib/exercises/math/calculLitteral/factorisation/factoType1Exercise.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/factorisation/factoType1Exercise.js +60 -28
- package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType0.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType0.js +2 -0
- package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType1.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType1.js +2 -0
- package/lib/exercises/math/derivation/derivative/convexityQuadrinomials.js +1 -1
- package/lib/exercises/math/derivation/derivative/expDerivativeThree.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/expDerivativeThree.js +0 -2
- package/lib/exercises/math/derivation/derivative/quotientDerivative.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/quotientDerivative.js +0 -13
- package/lib/exercises/math/derivation/derivative/secondDegreeDerivative.js +1 -1
- package/lib/exercises/math/derivation/derivative/secondDerivativeOfThirdDegreeFunction.js +1 -1
- package/lib/exercises/math/derivation/derivative/thirdDegreeDerivative.js +1 -1
- package/lib/exercises/math/functions/absolute/absolueValueAffineEquation.js +3 -3
- package/lib/exercises/math/functions/affines/signFunction.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/signFunction.js +2 -0
- package/lib/exercises/math/functions/basics/imageFunction.d.ts +1 -0
- package/lib/exercises/math/functions/basics/imageFunction.d.ts.map +1 -1
- package/lib/exercises/math/functions/basics/imageFunction.js +69 -15
- package/lib/exercises/math/geometry/parametric/extractPointFromParametricLine.d.ts.map +1 -1
- package/lib/exercises/math/geometry/parametric/extractPointFromParametricLine.js +1 -0
- package/lib/exercises/math/geometry/parametric/extractVectorFromParametricLine.d.ts.map +1 -1
- package/lib/exercises/math/geometry/parametric/extractVectorFromParametricLine.js +1 -0
- package/lib/exercises/math/geometry/parametric/pointFromParametricLine.d.ts.map +1 -1
- package/lib/exercises/math/geometry/parametric/pointFromParametricLine.js +1 -0
- package/lib/exercises/math/geometry/vectors/vectorNormCalculation.js +1 -1
- package/lib/exercises/math/percent/evolutionToCM.d.ts.map +1 -1
- package/lib/exercises/math/percent/evolutionToCM.js +39 -13
- package/lib/exercises/math/powers/powersDivision.js +1 -1
- package/lib/exercises/math/powers/powersOfTenToDecimal.js +1 -1
- package/lib/exercises/math/powers/powersPower.js +1 -1
- package/lib/exercises/math/powers/powersProduct.js +1 -1
- package/lib/exercises/math/python/conditionIf.js +1 -1
- package/lib/exercises/math/python/forLoop.js +1 -1
- package/lib/exercises/math/python/inOutCalcul.js +1 -1
- package/lib/exercises/math/python/pyForLoop1Exercise.js +1 -1
- package/lib/exercises/math/python/pyNestedForLoopExercise.js +1 -1
- package/lib/exercises/math/python/pyWhileLoop1Exercise.js +1 -1
- package/lib/exercises/math/python/whileLoop.js +1 -1
- package/lib/exercises/pc/pH.js +3 -3
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/latexTester.d.ts +2 -0
- package/lib/latexTester.d.ts.map +1 -0
- package/lib/latexTester.js +164 -0
- package/lib/playground.d.ts.map +1 -1
- package/lib/playground.js +11 -1
- package/lib/tree/nodes/inequations/inequationNode.js +1 -1
- package/lib/tree/nodes/operators/addNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/addNode.js +9 -0
- package/lib/tree/nodes/operators/multiplyNode.d.ts +1 -0
- package/lib/tree/nodes/operators/multiplyNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/multiplyNode.js +3 -0
- package/lib/utils/latex/alignTex.d.ts.map +1 -1
- package/lib/utils/latex/alignTex.js +2 -4
- package/package.json +1 -1
|
@@ -58,7 +58,7 @@ const isAnswerValid = (ans, { answer }) => {
|
|
|
58
58
|
exports.multiplyDecimalByTens = {
|
|
59
59
|
id: "multiplyDecimalByTens",
|
|
60
60
|
connector: "=",
|
|
61
|
-
label: "Multiplier/diviser un décimal par une puissance de 10",
|
|
61
|
+
label: "Multiplier/diviser un décimal par une puissance de $10$",
|
|
62
62
|
levels: [],
|
|
63
63
|
isSingleStep: true,
|
|
64
64
|
sections: [],
|
|
@@ -42,10 +42,10 @@ const getRoundQuestions = (opts) => {
|
|
|
42
42
|
correction: `Le chiffre des ${ranks[precisionAsked + 1]}s est $${figureToLookAt}$.
|
|
43
43
|
|
|
44
44
|
${figureToLookAt < 5
|
|
45
|
-
? `Puisque
|
|
45
|
+
? `Puisque $${figureToLookAt}$ est inférieur à $5$, on arrondit ${ranksWithAu[precisionAsked]} inférieur.
|
|
46
46
|
|
|
47
47
|
Ainsi, en arrondissant ${ranksWithAu[precisionAsked]}, on a $${decTex} \\approx ${answer}$`
|
|
48
|
-
: `Puisque
|
|
48
|
+
: `Puisque $${figureToLookAt}$ est supérieur à $5$, on arrondit ${ranksWithAu[precisionAsked]} supérieur.
|
|
49
49
|
|
|
50
50
|
Ainsi, en arrondissant ${ranksWithAu[precisionAsked]}, on a
|
|
51
51
|
|
|
@@ -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,
|
|
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;AAclC;;;GAGG;AACH,KAAK,WAAW,GAAG;IACjB,aAAa,EAAE,MAAM,EAAE,EAAE,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAoJF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,CAapD,CAAC"}
|
|
@@ -7,44 +7,73 @@ exports.factoType1Exercise = void 0;
|
|
|
7
7
|
const exercise_1 = require("../../../../exercises/exercise");
|
|
8
8
|
const getDistinctQuestions_1 = require("../../../../exercises/utils/getDistinctQuestions");
|
|
9
9
|
const affine_1 = require("../../../../math/polynomials/affine");
|
|
10
|
+
const randint_1 = require("../../../../math/utils/random/randint");
|
|
10
11
|
const addNode_1 = require("../../../../tree/nodes/operators/addNode");
|
|
11
12
|
const multiplyNode_1 = require("../../../../tree/nodes/operators/multiplyNode");
|
|
12
13
|
const substractNode_1 = require("../../../../tree/nodes/operators/substractNode");
|
|
14
|
+
const latexParser_1 = require("../../../../tree/parsers/latexParser");
|
|
13
15
|
const random_1 = require("../../../../utils/alea/random");
|
|
14
16
|
const shuffle_1 = require("../../../../utils/alea/shuffle");
|
|
15
17
|
//TODO fix { "affinesCoeffs": [ [ -2, 8 ], [ -5, 4 ], [ 0, -8 ] ], "operation": "substract" } donne trop de moins
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
+
const getStatementNode = (identifiers) => {
|
|
19
|
+
const { affinesCoeffs, operation } = identifiers;
|
|
20
|
+
const affines = affinesCoeffs.map((coeffs) => new affine_1.Affine(coeffs[1], coeffs[0]));
|
|
18
21
|
const permut = [
|
|
19
22
|
(0, shuffle_1.shuffle)([affines[0], affines[1]]),
|
|
20
23
|
(0, shuffle_1.shuffle)([affines[0], affines[2]]),
|
|
21
24
|
];
|
|
22
|
-
const operation = (0, random_1.random)(["add", "substract"]);
|
|
23
25
|
const statementTree = operation === "add"
|
|
24
26
|
? new addNode_1.AddNode(new multiplyNode_1.MultiplyNode(permut[0][0].toTree(), permut[0][1].toTree()), new multiplyNode_1.MultiplyNode(permut[1][0].toTree(), permut[1][1].toTree()))
|
|
25
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()));
|
|
26
|
-
|
|
27
|
-
|
|
28
|
+
return statementTree;
|
|
29
|
+
};
|
|
30
|
+
const getInstruction = (identifiers) => {
|
|
31
|
+
const { affinesCoeffs, operation } = identifiers;
|
|
32
|
+
return `Factoriser et réduire :
|
|
33
|
+
|
|
34
|
+
$$
|
|
35
|
+
${getStatementNode(identifiers).toTex()}
|
|
36
|
+
$$`;
|
|
37
|
+
};
|
|
38
|
+
const getAnswer = (identifiers) => {
|
|
39
|
+
const { affinesCoeffs, operation } = identifiers;
|
|
40
|
+
const affine1 = new affine_1.Affine(affinesCoeffs[0][1], affinesCoeffs[0][0]);
|
|
41
|
+
const affine2 = new affine_1.Affine(affinesCoeffs[1][1], affinesCoeffs[1][0]);
|
|
28
42
|
const answerTree = affine2.coefficients[0] === 0
|
|
29
43
|
? affine1.coefficients[0] === 0
|
|
30
44
|
? affine1.multiply(affine2).toTree()
|
|
31
45
|
: new multiplyNode_1.MultiplyNode(affine2.toTree(), affine1.toTree())
|
|
32
46
|
: new multiplyNode_1.MultiplyNode(affine1.toTree(), affine2.toTree());
|
|
33
|
-
const answer = answerTree.toTex();
|
|
47
|
+
const answer = answerTree.simplify().toTex();
|
|
48
|
+
return answer;
|
|
49
|
+
};
|
|
50
|
+
const getFactoType1Question = () => {
|
|
51
|
+
const a = (0, randint_1.randint)(-9, 10, [0]);
|
|
52
|
+
const b = (0, randint_1.randint)(-9, 10, [0]);
|
|
53
|
+
const operation = (0, random_1.random)(["add", "substract"]);
|
|
54
|
+
let c, d;
|
|
55
|
+
let e, f;
|
|
56
|
+
do {
|
|
57
|
+
c = (0, randint_1.randint)(-9, 10, [0]);
|
|
58
|
+
d = (0, randint_1.randint)(-9, 10, [0]);
|
|
59
|
+
e = (0, randint_1.randint)(-9, 10, [0]);
|
|
60
|
+
f = (0, randint_1.randint)(-9, 10, [0]);
|
|
61
|
+
} while (c / a === d / b || e / a === f / b);
|
|
62
|
+
const identifiers = {
|
|
63
|
+
affinesCoeffs: [
|
|
64
|
+
[a, b],
|
|
65
|
+
[c, d],
|
|
66
|
+
[e, f],
|
|
67
|
+
],
|
|
68
|
+
operation,
|
|
69
|
+
};
|
|
34
70
|
const question = {
|
|
35
|
-
instruction:
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
${statementTree.toTex()}
|
|
39
|
-
$$`,
|
|
40
|
-
startStatement: statementTree.toTex(),
|
|
41
|
-
answer,
|
|
71
|
+
instruction: getInstruction(identifiers),
|
|
72
|
+
startStatement: getStatementNode(identifiers).toTex(),
|
|
73
|
+
answer: getAnswer(identifiers),
|
|
42
74
|
keys: ["x"],
|
|
43
75
|
answerFormat: "tex",
|
|
44
|
-
identifiers
|
|
45
|
-
affinesCoeffs: affines.map((affine) => affine.coefficients),
|
|
46
|
-
operation,
|
|
47
|
-
},
|
|
76
|
+
identifiers,
|
|
48
77
|
};
|
|
49
78
|
return question;
|
|
50
79
|
};
|
|
@@ -67,17 +96,20 @@ const getPropositions = (n, { answer, affinesCoeffs, operation }) => {
|
|
|
67
96
|
}
|
|
68
97
|
return (0, shuffle_1.shuffle)(propositions);
|
|
69
98
|
};
|
|
70
|
-
const isAnswerValid = (ans, { affinesCoeffs, operation }) => {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
99
|
+
const isAnswerValid = (ans, { affinesCoeffs, operation, answer }) => {
|
|
100
|
+
try {
|
|
101
|
+
const parsed = (0, latexParser_1.parseAlgebraic)(ans);
|
|
102
|
+
if (!parsed)
|
|
103
|
+
return false;
|
|
104
|
+
if (!(0, multiplyNode_1.isMultiplyNode)(parsed))
|
|
105
|
+
return false;
|
|
106
|
+
const simp = parsed.simplify();
|
|
107
|
+
const reversed = parsed.toReversed().simplify();
|
|
108
|
+
return simp.toTex() === answer || reversed.toTex() === answer;
|
|
109
|
+
}
|
|
110
|
+
catch (err) {
|
|
111
|
+
return false;
|
|
112
|
+
}
|
|
81
113
|
};
|
|
82
114
|
exports.factoType1Exercise = {
|
|
83
115
|
id: "facto1",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"firstDegreeInequationsType0.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/inequations/firstDegreeInequationsType0.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,0BAA0B,CAAC;AAIlC,OAAO,EACL,gBAAgB,EAGjB,MAAM,mCAAmC,CAAC;AAe3C,cAAc;AAEd,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,QAAQ,EAAE,gBAAgB,CAAC;CAC5B,CAAC;
|
|
1
|
+
{"version":3,"file":"firstDegreeInequationsType0.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/inequations/firstDegreeInequationsType0.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,0BAA0B,CAAC;AAIlC,OAAO,EACL,gBAAgB,EAGjB,MAAM,mCAAmC,CAAC;AAe3C,cAAc;AAEd,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,QAAQ,EAAE,gBAAgB,CAAC;CAC5B,CAAC;AA6JF,KAAK,OAAO,GAAG;IACb,wBAAwB,EAAE,MAAM,CAAC;CAClC,CAAC;AAGF,eAAO,MAAM,2BAA2B,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAqBtE,CAAC"}
|
|
@@ -23,7 +23,9 @@ const getCorrection = (identifiers, opts) => {
|
|
|
23
23
|
const answer = getAnswer(identifiers, opts);
|
|
24
24
|
return `On isole $x$ à gauche en ${identifiers.b > 0 ? "soustrayant" : "additionnant"} les deux côtés de l'inéquation par $${Math.abs(identifiers.b)}$:
|
|
25
25
|
|
|
26
|
+
$$
|
|
26
27
|
${(0, inequationNode_1.firstDegreeInequationResolutionTex)(new affine_1.Affine(1, identifiers.b), identifiers.ineqType, identifiers.c.toTree())}
|
|
28
|
+
$$
|
|
27
29
|
|
|
28
30
|
${isInterval
|
|
29
31
|
? `On traduit ensuite cette inéquation en intervalle :
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"firstDegreeInequationsType1.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/inequations/firstDegreeInequationsType1.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,0BAA0B,CAAC;AAIlC,OAAO,EACL,gBAAgB,EAGjB,MAAM,mCAAmC,CAAC;AAc3C,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,QAAQ,EAAE,gBAAgB,CAAC;CAC5B,CAAC;
|
|
1
|
+
{"version":3,"file":"firstDegreeInequationsType1.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/inequations/firstDegreeInequationsType1.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,0BAA0B,CAAC;AAIlC,OAAO,EACL,gBAAgB,EAGjB,MAAM,mCAAmC,CAAC;AAc3C,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,QAAQ,EAAE,gBAAgB,CAAC;CAC5B,CAAC;AAgLF,KAAK,OAAO,GAAG;IACb,wBAAwB,EAAE,MAAM,CAAC;CAClC,CAAC;AAGF,eAAO,MAAM,2BAA2B,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAsBtE,CAAC"}
|
|
@@ -25,7 +25,9 @@ const getCorrection = (identifiers, opts) => {
|
|
|
25
25
|
const answer = getAnswer(identifiers, opts);
|
|
26
26
|
return `On isole $x$ à gauche en divisant les deux côtés de l'inéquation par $${identifiers.a}$:
|
|
27
27
|
|
|
28
|
+
$$
|
|
28
29
|
${(0, inequationNode_1.firstDegreeInequationResolutionTex)(new affine_1.Affine(a, 0), ineqType, b.toTree())}
|
|
30
|
+
$$
|
|
29
31
|
|
|
30
32
|
${identifiers.a < 0
|
|
31
33
|
? `On a changé le sens de l'inéquation, car $${a}$ est négatif.`
|
|
@@ -73,7 +73,7 @@ const isAnswerValid = (ans, { answer, askConvex, quadcoeffs }) => {
|
|
|
73
73
|
};
|
|
74
74
|
exports.convexityQuadrinomials = {
|
|
75
75
|
id: "convexityQuadrinomials",
|
|
76
|
-
label: "Convexité des fonctions polynomiales de degré 3",
|
|
76
|
+
label: "Convexité des fonctions polynomiales de degré $3$",
|
|
77
77
|
levels: ["TermSpé"],
|
|
78
78
|
isSingleStep: true,
|
|
79
79
|
sections: ["Dérivation"],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expDerivativeThree.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivative/expDerivativeThree.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAWT,MAAM,0BAA0B,CAAC;AAUlC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;
|
|
1
|
+
{"version":3,"file":"expDerivativeThree.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivative/expDerivativeThree.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAWT,MAAM,0BAA0B,CAAC;AAUlC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAqFF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,CAepD,CAAC"}
|
|
@@ -50,11 +50,9 @@ const getPropositions = (n, { answer, a, b }) => {
|
|
|
50
50
|
};
|
|
51
51
|
const isAnswerValid = (ans, { a, b, answer }) => {
|
|
52
52
|
try {
|
|
53
|
-
console.log(ans, answer);
|
|
54
53
|
const parsed = (0, latexParser_1.parseAlgebraic)(ans);
|
|
55
54
|
if (!parsed)
|
|
56
55
|
return false;
|
|
57
|
-
console.log(parsed.simplify().toTex());
|
|
58
56
|
return parsed.simplify().toTex() === answer;
|
|
59
57
|
}
|
|
60
58
|
catch (err) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"quotientDerivative.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivative/quotientDerivative.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,QAAQ,EAUT,MAAM,0BAA0B,CAAC;AAWlC,KAAK,WAAW,GAAG;IACjB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB,CAAC;
|
|
1
|
+
{"version":3,"file":"quotientDerivative.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivative/quotientDerivative.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,QAAQ,EAUT,MAAM,0BAA0B,CAAC;AAWlC,KAAK,WAAW,GAAG;IACjB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB,CAAC;AAuGF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,CAcpD,CAAC"}
|
|
@@ -71,17 +71,6 @@ const getPropositions = (n, { answer, poly1Coeffs, poly2Coeffs }) => {
|
|
|
71
71
|
return (0, exercise_1.shuffleProps)(propositions, n);
|
|
72
72
|
};
|
|
73
73
|
const isAnswerValid = (ans, { answer, poly1Coeffs, poly2Coeffs }) => {
|
|
74
|
-
// const poly1 = new Polynomial(poly1Coeffs);
|
|
75
|
-
// const poly2 = new Polynomial(poly2Coeffs);
|
|
76
|
-
// const answerNum = poly1
|
|
77
|
-
// .derivate()
|
|
78
|
-
// .multiply(poly2)
|
|
79
|
-
// .add(poly1.opposite().multiply(poly2.derivate()))
|
|
80
|
-
// .toTree({ forbidPowerToProduct: true });
|
|
81
|
-
// const answerDenum = new PowerNode(poly2.toTree(), new NumberNode(2));
|
|
82
|
-
// const answer = new FractionNode(answerNum, answerDenum);
|
|
83
|
-
// const texs = answer.toAllValidTexs();
|
|
84
|
-
// return texs.includes(ans);
|
|
85
74
|
try {
|
|
86
75
|
const parsed = (0, latexParser_1.parseAlgebraic)(ans);
|
|
87
76
|
const simp = parsed
|
|
@@ -91,8 +80,6 @@ const isAnswerValid = (ans, { answer, poly1Coeffs, poly2Coeffs }) => {
|
|
|
91
80
|
const simpAnswer = parsedAnswer
|
|
92
81
|
.simplify({ keepPowers: true, forbidFactorize: true })
|
|
93
82
|
.toTex();
|
|
94
|
-
console.log(answer);
|
|
95
|
-
console.log(simp);
|
|
96
83
|
return simp === simpAnswer;
|
|
97
84
|
}
|
|
98
85
|
catch (err) {
|
|
@@ -94,7 +94,7 @@ exports.isSecondDegreeDerivativeAnswerValid = isSecondDegreeDerivativeAnswerVali
|
|
|
94
94
|
exports.secondDegreeDerivative = {
|
|
95
95
|
id: "secondDegreeDerivative",
|
|
96
96
|
connector: "=",
|
|
97
|
-
label: "Dérivée d'un polynôme de degré 2",
|
|
97
|
+
label: "Dérivée d'un polynôme de degré $2$",
|
|
98
98
|
levels: [
|
|
99
99
|
"1reESM",
|
|
100
100
|
"1reSpé",
|
|
@@ -47,7 +47,7 @@ const isAnswerValid = (ans, { a, b, c, d }) => {
|
|
|
47
47
|
};
|
|
48
48
|
exports.secondDerivativeOfThridDegreeFunction = {
|
|
49
49
|
id: "secondDerivativeOfThirdDegreeFunction",
|
|
50
|
-
label: "Dérivée seconde d'un polynôme de degré 3",
|
|
50
|
+
label: "Dérivée seconde d'un polynôme de degré $3$",
|
|
51
51
|
levels: ["TermSpé"],
|
|
52
52
|
isSingleStep: true,
|
|
53
53
|
sections: ["Dérivation"],
|
|
@@ -111,7 +111,7 @@ exports.isThirdDegreeDerivativeAnswerValid = isThirdDegreeDerivativeAnswerValid;
|
|
|
111
111
|
exports.thirdDegreeDerivative = {
|
|
112
112
|
id: "thirdDegreeDerivative",
|
|
113
113
|
connector: "=",
|
|
114
|
-
label: "Dérivée d'un polynôme de degré 3",
|
|
114
|
+
label: "Dérivée d'un polynôme de degré $3$",
|
|
115
115
|
levels: [
|
|
116
116
|
"1reESM",
|
|
117
117
|
"1reSpé",
|
|
@@ -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;AAmBlC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,cAAc,EAAE,OAAO,CAAC;CACzB,CAAC;
|
|
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;AAmBlC,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,CAe9C,CAAC"}
|
|
@@ -31,7 +31,9 @@ const getCorrection = (identifiers) => {
|
|
|
31
31
|
const order = askingPositive ? "\\ge" : "\\le";
|
|
32
32
|
return `On résout l'inéquation :
|
|
33
33
|
|
|
34
|
+
$$
|
|
34
35
|
${(0, inequationNode_1.firstDegreeInequationResolutionTex)(affine, order, (0).toTree())}
|
|
36
|
+
$$
|
|
35
37
|
|
|
36
38
|
On en conclut que $f$ est ${identifiers.askingPositive ? "positive" : "négative"} sur l'intervalle :
|
|
37
39
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"imageFunction.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/basics/imageFunction.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"imageFunction.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/basics/imageFunction.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,0BAA0B,CAAC;AASlC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,OAAO,CAAC;CACf,CAAC;AAqGF,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,WAAW,CAkB/C,CAAC"}
|
|
@@ -5,8 +5,51 @@ const exercise_1 = require("../../../../exercises/exercise");
|
|
|
5
5
|
const getDistinctQuestions_1 = require("../../../../exercises/utils/getDistinctQuestions");
|
|
6
6
|
const polynomial_1 = require("../../../../math/polynomials/polynomial");
|
|
7
7
|
const randint_1 = require("../../../../math/utils/random/randint");
|
|
8
|
+
const latexParser_1 = require("../../../../tree/parsers/latexParser");
|
|
8
9
|
const coinFlip_1 = require("../../../../utils/alea/coinFlip");
|
|
9
10
|
const shuffle_1 = require("../../../../utils/alea/shuffle");
|
|
11
|
+
const alignTex_1 = require("../../../../utils/latex/alignTex");
|
|
12
|
+
const getInstruction = (identifiers) => {
|
|
13
|
+
const { rand, poly1, poly2, xValue, flip } = identifiers;
|
|
14
|
+
const polynome1 = new polynomial_1.Polynomial(poly1);
|
|
15
|
+
const polynome2 = new polynomial_1.Polynomial(poly2);
|
|
16
|
+
const statement = `Soit $f(x) = ${(rand ? polynome1 : polynome2)
|
|
17
|
+
.toTree()
|
|
18
|
+
.toTex()}$.
|
|
19
|
+
|
|
20
|
+
Calculer ${flip ? `l'image de $${xValue}$ par $f$.` : `$f(${xValue})$.`}`;
|
|
21
|
+
return statement;
|
|
22
|
+
};
|
|
23
|
+
const getAnswer = (identifiers) => {
|
|
24
|
+
const { rand, poly1, poly2, xValue } = identifiers;
|
|
25
|
+
const polynome1 = new polynomial_1.Polynomial(poly1);
|
|
26
|
+
const polynome2 = new polynomial_1.Polynomial(poly2);
|
|
27
|
+
const answer = rand
|
|
28
|
+
? polynome1.calculate(xValue) + ""
|
|
29
|
+
: polynome2.calculate(xValue) + "";
|
|
30
|
+
return answer;
|
|
31
|
+
};
|
|
32
|
+
const getHint = (identifiers) => {
|
|
33
|
+
return `Remplace $x$ par $${identifiers.xValue}$ dans l'expression de $f$.`;
|
|
34
|
+
};
|
|
35
|
+
const getCorrection = (identifiers) => {
|
|
36
|
+
const answer = getAnswer(identifiers);
|
|
37
|
+
const { rand, poly1, poly2, xValue, flip } = identifiers;
|
|
38
|
+
const polynome1 = new polynomial_1.Polynomial(poly1).toTree();
|
|
39
|
+
const polynome2 = new polynomial_1.Polynomial(poly2).toTree();
|
|
40
|
+
return `On remplace $x$ par $${identifiers.xValue}$ dans l'expression de $f$ :
|
|
41
|
+
|
|
42
|
+
${(0, alignTex_1.alignTex)([
|
|
43
|
+
[
|
|
44
|
+
`f\\left(${identifiers.xValue}\\right)`,
|
|
45
|
+
"=",
|
|
46
|
+
rand
|
|
47
|
+
? polynome1.toDetailedEvaluation({ x: xValue.toTree() }).toTex()
|
|
48
|
+
: polynome2.toDetailedEvaluation({ x: xValue.toTree() }).toTex(),
|
|
49
|
+
],
|
|
50
|
+
["", "=", answer],
|
|
51
|
+
])}`;
|
|
52
|
+
};
|
|
10
53
|
const getImageFunction = () => {
|
|
11
54
|
const rand = (0, coinFlip_1.coinFlip)();
|
|
12
55
|
const polynome1 = new polynomial_1.Polynomial([(0, randint_1.randint)(-9, 10), (0, randint_1.randint)(-5, 6, [0])]);
|
|
@@ -17,24 +60,22 @@ const getImageFunction = () => {
|
|
|
17
60
|
]);
|
|
18
61
|
const xValue = (0, randint_1.randint)(-9, 10);
|
|
19
62
|
const flip = (0, coinFlip_1.coinFlip)();
|
|
20
|
-
const
|
|
21
|
-
.
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
63
|
+
const identifiers = {
|
|
64
|
+
poly1: polynome1.coefficients,
|
|
65
|
+
poly2: polynome2.coefficients,
|
|
66
|
+
rand,
|
|
67
|
+
xValue,
|
|
68
|
+
flip,
|
|
69
|
+
};
|
|
26
70
|
const question = {
|
|
27
|
-
instruction:
|
|
71
|
+
instruction: getInstruction(identifiers),
|
|
28
72
|
startStatement: `f(${xValue})`,
|
|
29
|
-
answer:
|
|
73
|
+
answer: getAnswer(identifiers),
|
|
30
74
|
keys: [],
|
|
75
|
+
hint: getHint(identifiers),
|
|
76
|
+
correction: getCorrection(identifiers),
|
|
31
77
|
answerFormat: "tex",
|
|
32
|
-
identifiers
|
|
33
|
-
poly1: polynome1.coefficients,
|
|
34
|
-
poly2: polynome2.coefficients,
|
|
35
|
-
rand,
|
|
36
|
-
xValue,
|
|
37
|
-
},
|
|
78
|
+
identifiers,
|
|
38
79
|
};
|
|
39
80
|
return question;
|
|
40
81
|
};
|
|
@@ -48,7 +89,15 @@ const getPropositions = (n, { answer }) => {
|
|
|
48
89
|
return (0, shuffle_1.shuffle)(propositions);
|
|
49
90
|
};
|
|
50
91
|
const isAnswerValid = (ans, { answer }) => {
|
|
51
|
-
|
|
92
|
+
try {
|
|
93
|
+
const parsed = (0, latexParser_1.parseAlgebraic)(ans);
|
|
94
|
+
if (!parsed)
|
|
95
|
+
return false;
|
|
96
|
+
return parsed.simplify().toTex() === answer;
|
|
97
|
+
}
|
|
98
|
+
catch (err) {
|
|
99
|
+
return false;
|
|
100
|
+
}
|
|
52
101
|
};
|
|
53
102
|
exports.imageFunction = {
|
|
54
103
|
id: "imageFunction",
|
|
@@ -63,4 +112,9 @@ exports.imageFunction = {
|
|
|
63
112
|
getPropositions,
|
|
64
113
|
isAnswerValid,
|
|
65
114
|
subject: "Mathématiques",
|
|
115
|
+
getAnswer,
|
|
116
|
+
getCorrection,
|
|
117
|
+
getHint,
|
|
118
|
+
hasHintAndCorrection: true,
|
|
119
|
+
getInstruction,
|
|
66
120
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extractPointFromParametricLine.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/parametric/extractPointFromParametricLine.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,0BAA0B,CAAC;AASlC,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AAwHF,eAAO,MAAM,8BAA8B,EAAE,QAAQ,CAAC,WAAW,
|
|
1
|
+
{"version":3,"file":"extractPointFromParametricLine.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/parametric/extractPointFromParametricLine.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,0BAA0B,CAAC;AASlC,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AAwHF,eAAO,MAAM,8BAA8B,EAAE,QAAQ,CAAC,WAAW,CAkBhE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extractVectorFromParametricLine.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/parametric/extractVectorFromParametricLine.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,0BAA0B,CAAC;AAUlC,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AA6GF,eAAO,MAAM,+BAA+B,EAAE,QAAQ,CAAC,WAAW,
|
|
1
|
+
{"version":3,"file":"extractVectorFromParametricLine.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/parametric/extractVectorFromParametricLine.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,0BAA0B,CAAC;AAUlC,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AA6GF,eAAO,MAAM,+BAA+B,EAAE,QAAQ,CAAC,WAAW,CAiBjE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pointFromParametricLine.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/parametric/pointFromParametricLine.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,0BAA0B,CAAC;AAiBlC,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAqFF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,WAAW,
|
|
1
|
+
{"version":3,"file":"pointFromParametricLine.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/parametric/pointFromParametricLine.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,0BAA0B,CAAC;AAiBlC,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAqFF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,WAAW,CAmBzD,CAAC"}
|
|
@@ -16,7 +16,7 @@ const getAnswer = (identifiers) => {
|
|
|
16
16
|
return correctAnswer.simplify().toTex();
|
|
17
17
|
};
|
|
18
18
|
const getHint = (identifiers) => {
|
|
19
|
-
return `La norme d'un vecteur est la racine carrée de la somme des carrés de ses coordonnées. En d'autres termes, la norme du vecteur $$\\overrightarrow{u}\\begin{pmatrix}x\\\\y\\end{pmatrix}$$ est :
|
|
19
|
+
return `La norme d'un vecteur est la racine carrée de la somme des carrés de ses coordonnées. En d'autres termes, la norme du vecteur $$\\overrightarrow{u}\\begin{pmatrix}x \\\\ y \\end{pmatrix}$$ est :
|
|
20
20
|
|
|
21
21
|
$$
|
|
22
22
|
\\lVert \\overrightarrow u \\rVert = \\sqrt{x^2+y^2}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"evolutionToCM.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/percent/evolutionToCM.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,QAAQ,
|
|
1
|
+
{"version":3,"file":"evolutionToCM.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/percent/evolutionToCM.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,QAAQ,EAYT,MAAM,0BAA0B,CAAC;AAQlC,KAAK,WAAW,GAAG;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAkGF,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,WAAW,CAkB/C,CAAC"}
|
|
@@ -6,28 +6,50 @@ const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQues
|
|
|
6
6
|
const randint_1 = require("../../../math/utils/random/randint");
|
|
7
7
|
const round_1 = require("../../../math/utils/round");
|
|
8
8
|
const numberParser_1 = require("../../../tree/parsers/numberParser");
|
|
9
|
-
const
|
|
10
|
-
const evolution =
|
|
9
|
+
const getInstruction = (identifiers) => {
|
|
10
|
+
const evolution = identifiers.evolution;
|
|
11
|
+
const isHausse = evolution > 0;
|
|
12
|
+
return `Quel est le coefficient multiplicateur associé à une ${isHausse ? "hausse" : "baisse"} de $${isHausse ? evolution : evolution.toString().slice(1)}\\%$ ?`;
|
|
13
|
+
};
|
|
14
|
+
const getAnswer = (identifiers) => {
|
|
15
|
+
const evolution = identifiers.evolution;
|
|
11
16
|
const isHausse = evolution > 0;
|
|
12
17
|
const CM = ((0, round_1.round)(1 + evolution / 100, 2) + "").replaceAll(".", ",");
|
|
13
18
|
const answer = CM;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
return answer;
|
|
20
|
+
};
|
|
21
|
+
const getHint = (identifiers) => {
|
|
22
|
+
const evolution = identifiers.evolution;
|
|
23
|
+
const isHausse = evolution > 0;
|
|
24
|
+
return `Le coefficient multiplicateur associé à une ${isHausse ? "hausse" : "baisse"} de $t\\%$ est donné par $${isHausse ? "1+\\frac{t}{100}" : "1-\\frac{t}{100}"}$.
|
|
25
|
+
`;
|
|
26
|
+
};
|
|
27
|
+
const getCorrection = (identifiers) => {
|
|
28
|
+
const evolution = identifiers.evolution;
|
|
29
|
+
const isHausse = evolution > 0;
|
|
30
|
+
const CM = ((0, round_1.round)(1 + evolution / 100, 2) + "").replaceAll(".", ",");
|
|
31
|
+
return `Le coefficient multiplicateur associé à une ${isHausse ? "hausse" : "baisse"} de $t\\%$ est donné par $${isHausse ? "1+\\frac{t}{100}" : "1-\\frac{t}{100}"}$.
|
|
23
32
|
|
|
24
|
-
Ici, on a $t = ${Math.abs(evolution)}
|
|
33
|
+
Ici, on a $t = ${Math.abs(evolution)}\\%$, donc le coefficient multiplicateur vaut :
|
|
25
34
|
|
|
26
35
|
$$
|
|
27
36
|
1${isHausse ? "+" : "-"}\\frac{${Math.abs(evolution)}}{100} = ${CM}
|
|
28
37
|
$$
|
|
29
38
|
|
|
30
|
-
|
|
39
|
+
`;
|
|
40
|
+
};
|
|
41
|
+
const getEvolutionToCmQuestion = () => {
|
|
42
|
+
const evolution = (0, randint_1.randint)(-99, 101, [0]);
|
|
43
|
+
const isHausse = evolution > 0;
|
|
44
|
+
const identifiers = { evolution };
|
|
45
|
+
const question = {
|
|
46
|
+
answer: getAnswer(identifiers),
|
|
47
|
+
instruction: getInstruction(identifiers),
|
|
48
|
+
keys: ["percent"],
|
|
49
|
+
answerFormat: "tex",
|
|
50
|
+
identifiers,
|
|
51
|
+
hint: getHint(identifiers),
|
|
52
|
+
correction: getCorrection(identifiers),
|
|
31
53
|
};
|
|
32
54
|
return question;
|
|
33
55
|
};
|
|
@@ -60,4 +82,8 @@ exports.evolutionToCM = {
|
|
|
60
82
|
isAnswerValid,
|
|
61
83
|
subject: "Mathématiques",
|
|
62
84
|
hasHintAndCorrection: true,
|
|
85
|
+
getCorrection,
|
|
86
|
+
getInstruction,
|
|
87
|
+
getAnswer,
|
|
88
|
+
getHint,
|
|
63
89
|
};
|
|
@@ -116,7 +116,7 @@ exports.powersDivision = {
|
|
|
116
116
|
exports.powersOfTenDivision = {
|
|
117
117
|
id: "powersOfTenDivision",
|
|
118
118
|
connector: "=",
|
|
119
|
-
label: "Division de puissances de 10",
|
|
119
|
+
label: "Division de puissances de $10$",
|
|
120
120
|
levels: ["4ème", "3ème", "2nde"],
|
|
121
121
|
sections: ["Puissances"],
|
|
122
122
|
isSingleStep: true,
|
|
@@ -46,7 +46,7 @@ const isAnswerValid = (ans, { answer }) => {
|
|
|
46
46
|
exports.powersOfTenToDecimal = {
|
|
47
47
|
id: "powersOfTenToDecimal",
|
|
48
48
|
connector: "=",
|
|
49
|
-
label: "Ecriture décimale d'une puissance de 10",
|
|
49
|
+
label: "Ecriture décimale d'une puissance de $10$",
|
|
50
50
|
levels: [
|
|
51
51
|
"5ème",
|
|
52
52
|
"4ème",
|
|
@@ -108,7 +108,7 @@ const isAnswerValid = (ans, { a, b, c }) => {
|
|
|
108
108
|
exports.powersOfTenProduct = {
|
|
109
109
|
id: "powersOfTenProduct",
|
|
110
110
|
connector: "=",
|
|
111
|
-
label: "Multiplication de puissances de 10",
|
|
111
|
+
label: "Multiplication de puissances de $10$",
|
|
112
112
|
levels: [
|
|
113
113
|
"4ème",
|
|
114
114
|
"3ème",
|
|
@@ -131,7 +131,7 @@ const isAnswerValid = (ans, { exercise }) => {
|
|
|
131
131
|
};
|
|
132
132
|
exports.pythonForLoop1Exercise = {
|
|
133
133
|
id: "pyForLoop1Exercise",
|
|
134
|
-
label: "Boucles for 1",
|
|
134
|
+
label: "Boucles for $1$",
|
|
135
135
|
levels: ["2nde"],
|
|
136
136
|
isSingleStep: true,
|
|
137
137
|
sections: ["Python"],
|
|
@@ -101,7 +101,7 @@ const generateType17Instruction = (a, b, op) => {
|
|
|
101
101
|
};
|
|
102
102
|
exports.pyWhileLoop1Exercise = {
|
|
103
103
|
id: "pyWhileLoop1Exercise",
|
|
104
|
-
label: "Boucles while 1",
|
|
104
|
+
label: "Boucles while $1$",
|
|
105
105
|
levels: ["2nde"],
|
|
106
106
|
isSingleStep: true,
|
|
107
107
|
sections: ["Python"],
|
package/lib/exercises/pc/pH.js
CHANGED
|
@@ -15,9 +15,9 @@ const getpH = () => {
|
|
|
15
15
|
const answer = (0, frenchify_1.frenchify)((0, round_1.round)(-Math.log10(concentrationHydrogene), 1));
|
|
16
16
|
const hint = "Utilisez la formule du pH : $\\text{pH} = -\\log[H^+]$.";
|
|
17
17
|
const correction = `Pour calculer le pH, on utilise la formule $\\text{pH} = -\\log[H^+]$ :
|
|
18
|
-
\
|
|
19
|
-
\
|
|
20
|
-
\
|
|
18
|
+
\n$1$. La concentration en ions hydrogène est $${randomNumber} \\times 10^{-${randomTenPower}}$ mol/L.
|
|
19
|
+
\n$2$. En appliquant la formule, on obtient $\\text{pH} = -\\log(${randomNumber} \\times 10^{-${randomTenPower}})$.
|
|
20
|
+
\n$3$. Le résultat est $${answer}$.`;
|
|
21
21
|
const question = {
|
|
22
22
|
instruction,
|
|
23
23
|
startStatement: `pH`,
|
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":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"latexTester.d.ts","sourceRoot":"","sources":["../src/latexTester.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,UAAW,MAAM,2CA+FxC,CAAC"}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.latexTester = void 0;
|
|
4
|
+
const latexTester = (latex, isDefaultInMathMode = false) => {
|
|
5
|
+
let inDollarMode = isDefaultInMathMode ?? false;
|
|
6
|
+
let inDoubleDollarMode = isDefaultInMathMode ?? false;
|
|
7
|
+
let commandModeCount = 0;
|
|
8
|
+
let leftRightCount = 0;
|
|
9
|
+
let inArray = false;
|
|
10
|
+
for (let i = 0; i < latex.length; i++) {
|
|
11
|
+
const prevChar = latex[i - 1];
|
|
12
|
+
const char = latex[i];
|
|
13
|
+
const nextChar = latex[i + 1];
|
|
14
|
+
if (char === "$") {
|
|
15
|
+
if (isDefaultInMathMode)
|
|
16
|
+
throw new Error("Dollar in default math mode");
|
|
17
|
+
if (nextChar === "$") {
|
|
18
|
+
if (inDollarMode)
|
|
19
|
+
throw new Error("Double dollar instead of single");
|
|
20
|
+
inDoubleDollarMode = !inDoubleDollarMode;
|
|
21
|
+
i++;
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
if (inDoubleDollarMode)
|
|
25
|
+
throw new Error("Single dollar instead of double");
|
|
26
|
+
inDollarMode = !inDollarMode;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
//check si nombre dans latex
|
|
31
|
+
if (!isNaN(Number(char)) &&
|
|
32
|
+
char !== " " &&
|
|
33
|
+
char !== "\n" &&
|
|
34
|
+
char !== "\t") {
|
|
35
|
+
if (!inDollarMode && !inDoubleDollarMode) {
|
|
36
|
+
throw new Error(`Number not in math mode, ${char}, ${latex}`);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
//check si charactere spécial
|
|
40
|
+
if (mustEscapeCharacters.includes(char) && prevChar !== "\\") {
|
|
41
|
+
throw new Error("Must escape character");
|
|
42
|
+
}
|
|
43
|
+
//check si in math
|
|
44
|
+
if (mustBeInMath.includes(char) && !inDollarMode && !inDoubleDollarMode) {
|
|
45
|
+
throw new Error(`Must be in math mode, ${char}, ${latex}`);
|
|
46
|
+
}
|
|
47
|
+
//check si commande bien fermé
|
|
48
|
+
if (char === "{" && prevChar !== "\\") {
|
|
49
|
+
commandModeCount++;
|
|
50
|
+
}
|
|
51
|
+
if (char === "}" && prevChar !== "\\") {
|
|
52
|
+
commandModeCount--;
|
|
53
|
+
}
|
|
54
|
+
const substring = latex.substring(i);
|
|
55
|
+
if ((inDollarMode || inDoubleDollarMode) && char === "\n") {
|
|
56
|
+
let isEmptyLine = true;
|
|
57
|
+
for (let j = i + 1; j < latex.length; j++) {
|
|
58
|
+
if (latex[j] === "\n")
|
|
59
|
+
break;
|
|
60
|
+
if (latex[j] !== " " && latex[j] !== "\t") {
|
|
61
|
+
isEmptyLine = false;
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
if (isEmptyLine)
|
|
66
|
+
throw new Error(`New emtpy line in math mode, ${latex}`);
|
|
67
|
+
}
|
|
68
|
+
//check si command existe
|
|
69
|
+
const cmdMatch = substring.match(/^\\[a-zA-Z]+/);
|
|
70
|
+
if (cmdMatch?.length) {
|
|
71
|
+
const cmd = cmdMatch[0];
|
|
72
|
+
if (!validCmds.includes(cmd))
|
|
73
|
+
throw new Error(`Command not valid, ${cmd}`);
|
|
74
|
+
if (cmd === "\\left") {
|
|
75
|
+
leftRightCount++;
|
|
76
|
+
}
|
|
77
|
+
if (cmd === "\\right") {
|
|
78
|
+
leftRightCount--;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
//!Todo check si whitespace after double dollar
|
|
82
|
+
//!TODO Check si a^b^c ou a_b_c
|
|
83
|
+
//!Todo check si &, tabularnewline et hline sont bien dans tableaux
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
if (!isDefaultInMathMode && (inDollarMode || inDoubleDollarMode))
|
|
87
|
+
throw new Error(`Math mode not finished`);
|
|
88
|
+
if (leftRightCount !== 0)
|
|
89
|
+
throw new Error("Left right not balanced");
|
|
90
|
+
if (commandModeCount !== 0)
|
|
91
|
+
throw new Error(`Command not closed : ${latex}`);
|
|
92
|
+
return true;
|
|
93
|
+
};
|
|
94
|
+
exports.latexTester = latexTester;
|
|
95
|
+
const mustEscapeCharacters = ["%", "`"];
|
|
96
|
+
const mustBeInMath = ["%", "#", "_", "~", "^"];
|
|
97
|
+
const mustBeInArrays = ["&", "\\tabularnewline", "\\hline"];
|
|
98
|
+
const validCmds = [
|
|
99
|
+
"\\frac",
|
|
100
|
+
"\\exp",
|
|
101
|
+
"\\cos",
|
|
102
|
+
"\\arccos",
|
|
103
|
+
"\\sin",
|
|
104
|
+
"\\arcsin",
|
|
105
|
+
"\\tan",
|
|
106
|
+
"\\arctan",
|
|
107
|
+
"\\sqrt",
|
|
108
|
+
"\\log",
|
|
109
|
+
"\\ln",
|
|
110
|
+
"\\lim",
|
|
111
|
+
"\\in",
|
|
112
|
+
"\\belongs",
|
|
113
|
+
"\\text",
|
|
114
|
+
"\\int",
|
|
115
|
+
"\\circ",
|
|
116
|
+
"\\overrightarrow",
|
|
117
|
+
"\\le",
|
|
118
|
+
"\\ge",
|
|
119
|
+
"\\leq",
|
|
120
|
+
"\\geq",
|
|
121
|
+
"\\pi",
|
|
122
|
+
"\\infty",
|
|
123
|
+
"\\binom",
|
|
124
|
+
"\\left",
|
|
125
|
+
"\\right",
|
|
126
|
+
"\\alpha",
|
|
127
|
+
"\\beta",
|
|
128
|
+
"\\Delta",
|
|
129
|
+
"\\delta",
|
|
130
|
+
"\\theta",
|
|
131
|
+
"\\sigma",
|
|
132
|
+
"\\Theta",
|
|
133
|
+
"\\pm",
|
|
134
|
+
"\\times",
|
|
135
|
+
"\\div",
|
|
136
|
+
"\\cdot",
|
|
137
|
+
"\\ldots",
|
|
138
|
+
"\\begin",
|
|
139
|
+
"\\end",
|
|
140
|
+
"\\\\",
|
|
141
|
+
"\\arraystretch",
|
|
142
|
+
"\\def",
|
|
143
|
+
"\\tabularnewline",
|
|
144
|
+
"\\approx",
|
|
145
|
+
"\\lbrace",
|
|
146
|
+
"\\rbrace",
|
|
147
|
+
"\\varnothing",
|
|
148
|
+
"\\iff",
|
|
149
|
+
"\\neq",
|
|
150
|
+
"\\widehat",
|
|
151
|
+
"\\cup",
|
|
152
|
+
"\\cap",
|
|
153
|
+
"\\mathbb",
|
|
154
|
+
"\\to",
|
|
155
|
+
"\\newline",
|
|
156
|
+
"\\lVert",
|
|
157
|
+
"\\rVert",
|
|
158
|
+
"\\hline",
|
|
159
|
+
"\\mathrm",
|
|
160
|
+
"\\overline",
|
|
161
|
+
"\\quad",
|
|
162
|
+
"\\qquad",
|
|
163
|
+
"\\rightarrow",
|
|
164
|
+
];
|
package/lib/playground.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"playground.d.ts","sourceRoot":"","sources":["../src/playground.ts"],"names":[],"mappings":"AAwDA,eAAO,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"playground.d.ts","sourceRoot":"","sources":["../src/playground.ts"],"names":[],"mappings":"AAwDA,eAAO,MAAM,UAAU,YAStB,CAAC"}
|
package/lib/playground.js
CHANGED
|
@@ -2,7 +2,17 @@
|
|
|
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 latexTester_1 = require("./latexTester");
|
|
6
|
+
const playground = () => {
|
|
7
|
+
const a = `
|
|
8
|
+
ijfezo
|
|
9
|
+
$$
|
|
10
|
+
\\frac{3^{2x+2}}{3}
|
|
11
|
+
$$
|
|
12
|
+
ad
|
|
13
|
+
`;
|
|
14
|
+
console.log((0, latexTester_1.latexTester)(a));
|
|
15
|
+
};
|
|
6
16
|
exports.playground = playground;
|
|
7
17
|
const logIdentifiers = () => {
|
|
8
18
|
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]}';
|
|
@@ -148,6 +148,6 @@ const firstDegreeInequationResolutionTex = (affine, order, right) => {
|
|
|
148
148
|
(0, fractionNode_1.frac)((0, substractNode_1.substract)(right, b), a).simplify().toTex(),
|
|
149
149
|
]);
|
|
150
150
|
}
|
|
151
|
-
return (0, alignTex_1.alignTex)(steps);
|
|
151
|
+
return (0, alignTex_1.alignTex)(steps, true);
|
|
152
152
|
};
|
|
153
153
|
exports.firstDegreeInequationResolutionTex = firstDegreeInequationResolutionTex;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/operators/addNode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EACL,uBAAuB,EACvB,WAAW,EAGZ,MAAM,gBAAgB,CAAC;AAKxB,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"addNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/operators/addNode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EACL,uBAAuB,EACvB,WAAW,EAGZ,MAAM,gBAAgB,CAAC;AAKxB,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAYlE,wBAAgB,SAAS,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,IAAI,OAAO,CAE/C;AAED,eAAO,MAAM,GAAG,MACX,aAAa,GAAG,MAAM,GAAG,MAAM,KAC/B,aAAa,GAAG,MAAM,GAAG,MAAM,YAOnC,CAAC;AAEF,qBAAa,OAAQ,YAAW,uBAAuB;IACrD,EAAE,EAAE,WAAW,CAAC;IAChB,SAAS,EAAE,aAAa,CAAC;IACzB,UAAU,EAAE,aAAa,CAAC;IAC1B,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,SAAS,EAAE,OAAO,CAAC;gBAEjB,SAAS,EAAE,aAAa,EACxB,UAAU,EAAE,aAAa,EACzB,IAAI,CAAC,EAAE,WAAW;IASpB,OAAO,aAGL;IAEF,YAAY,IAAI,MAAM;IAItB,iBAAiB,CAAC,IAAI,CAAC,EAAE,WAAW,GAAG,aAAa,EAAE;IAoCtD,SAAS,IAAI,MAAM,EAAE;IAIrB,cAAc,CAAC,IAAI,CAAC,EAAE,WAAW,GAAG,MAAM,EAAE;IAK5C,KAAK,CAAC,OAAO,CAAC,EAAE,YAAY,GAAG,MAAM;IAerC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAMtC,QAAQ,CAAC,IAAI,CAAC,EAAE,eAAe,GAAG,aAAa;IA4I/C,aAAa;;;;;;;;;IAOb,MAAM,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO;IAUpC,oBAAoB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC;IAMxD,UAAU,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,aAAa;CAMxD"}
|
|
@@ -188,6 +188,15 @@ class AddNode {
|
|
|
188
188
|
i--;
|
|
189
189
|
j--;
|
|
190
190
|
}
|
|
191
|
+
//!ca a l'air bien mais faut vérifier pour tous les exos...
|
|
192
|
+
// else if (isNumberNode(left) && isNumberNode(right)) {
|
|
193
|
+
// const pgcd = gcd(left.value, right.value);
|
|
194
|
+
// if (pgcd !== 1) {
|
|
195
|
+
// factors.push(pgcd.toTree());
|
|
196
|
+
// aSubExternals.splice(i, 1, new NumberNode(left.value / pgcd));
|
|
197
|
+
// bSubExternals.splice(j, 1, new NumberNode(right.value / pgcd));
|
|
198
|
+
// }
|
|
199
|
+
// }
|
|
191
200
|
}
|
|
192
201
|
}
|
|
193
202
|
//si aucun facteur on return
|
|
@@ -13,6 +13,7 @@ export declare class MultiplyNode implements CommutativeOperatorNode {
|
|
|
13
13
|
isNumeric: boolean;
|
|
14
14
|
constructor(leftChild: AlgebraicNode, rightChild: AlgebraicNode, opts?: NodeOptions);
|
|
15
15
|
shuffle: () => void;
|
|
16
|
+
toReversed: () => MultiplyNode;
|
|
16
17
|
toMathString(): string;
|
|
17
18
|
toTex(options?: ToTexOptions): string;
|
|
18
19
|
toAllTexs(): string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multiplyNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/operators/multiplyNode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EACL,uBAAuB,EACvB,WAAW,EAEZ,MAAM,gBAAgB,CAAC;AAYxB,OAAO,EACL,aAAa,EACb,eAAe,EAEhB,MAAM,kBAAkB,CAAC;AAU1B,wBAAgB,cAAc,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,IAAI,YAAY,CAEzD;AAED,eAAO,MAAM,QAAQ,MAChB,aAAa,GAAG,MAAM,GAAG,MAAM,KAC/B,aAAa,GAAG,MAAM,GAAG,MAAM,SAC3B,WAAW,iBAOnB,CAAC;AACF,eAAO,MAAM,iBAAiB,QAAS,aAAa,EAAE,SAYrD,CAAC;AACF,qBAAa,YAAa,YAAW,uBAAuB;IAC1D,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,EAAE,EAAE,WAAW,CAAC;IAChB,SAAS,EAAE,aAAa,CAAC;IACzB,UAAU,EAAE,aAAa,CAAC;IAC1B,IAAI,EAAE,QAAQ,CAAC;IACf,SAAS,EAAE,OAAO,CAAC;gBAEjB,SAAS,EAAE,aAAa,EACxB,UAAU,EAAE,aAAa,EACzB,IAAI,CAAC,EAAE,WAAW;IAUpB,OAAO,aAGL;
|
|
1
|
+
{"version":3,"file":"multiplyNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/operators/multiplyNode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EACL,uBAAuB,EACvB,WAAW,EAEZ,MAAM,gBAAgB,CAAC;AAYxB,OAAO,EACL,aAAa,EACb,eAAe,EAEhB,MAAM,kBAAkB,CAAC;AAU1B,wBAAgB,cAAc,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,IAAI,YAAY,CAEzD;AAED,eAAO,MAAM,QAAQ,MAChB,aAAa,GAAG,MAAM,GAAG,MAAM,KAC/B,aAAa,GAAG,MAAM,GAAG,MAAM,SAC3B,WAAW,iBAOnB,CAAC;AACF,eAAO,MAAM,iBAAiB,QAAS,aAAa,EAAE,SAYrD,CAAC;AACF,qBAAa,YAAa,YAAW,uBAAuB;IAC1D,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,EAAE,EAAE,WAAW,CAAC;IAChB,SAAS,EAAE,aAAa,CAAC;IACzB,UAAU,EAAE,aAAa,CAAC;IAC1B,IAAI,EAAE,QAAQ,CAAC;IACf,SAAS,EAAE,OAAO,CAAC;gBAEjB,SAAS,EAAE,aAAa,EACxB,UAAU,EAAE,aAAa,EACzB,IAAI,CAAC,EAAE,WAAW;IAUpB,OAAO,aAGL;IACF,UAAU,qBAER;IACF,YAAY,IAAI,MAAM;IAItB,KAAK,CAAC,OAAO,CAAC,EAAE,YAAY,GAAG,MAAM;IAgFrC,SAAS;IAkDT,iBAAiB,CAAC,IAAI,CAAC,EAAE,WAAW,GAAG,YAAY,EAAE;IAyFrD,cAAc,CAAC,IAAI,CAAC,EAAE,WAAW,GAAG,MAAM,EAAE;IAG5C,aAAa;;;;;;;;;IAYb,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAItC,IAAI;IAGJ,cAAc;IACd,QAAQ,CAAC,IAAI,CAAC,EAAE,eAAe,GAAG,aAAa;IAqK/C,MAAM,CAAC,IAAI,EAAE,aAAa;IAU1B,oBAAoB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC;IAQxD,UAAU,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,aAAa;CAMxD"}
|
|
@@ -49,6 +49,9 @@ class MultiplyNode {
|
|
|
49
49
|
if ((0, coinFlip_1.coinFlip)())
|
|
50
50
|
[this.leftChild, this.rightChild] = [this.rightChild, this.leftChild];
|
|
51
51
|
};
|
|
52
|
+
this.toReversed = () => {
|
|
53
|
+
return new MultiplyNode(this.rightChild, this.leftChild, this.opts);
|
|
54
|
+
};
|
|
52
55
|
this.id = operatorNode_1.OperatorIds.multiply;
|
|
53
56
|
this.leftChild = leftChild;
|
|
54
57
|
this.rightChild = rightChild;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alignTex.d.ts","sourceRoot":"","sources":["../../../src/utils/latex/alignTex.ts"],"names":[],"mappings":"AAAA,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,GAAG,MAAM,EAAE,YAAY,UAAQ,
|
|
1
|
+
{"version":3,"file":"alignTex.d.ts","sourceRoot":"","sources":["../../../src/utils/latex/alignTex.ts"],"names":[],"mappings":"AAAA,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,GAAG,MAAM,EAAE,YAAY,UAAQ,UAatE"}
|
|
@@ -9,12 +9,10 @@ function alignTex(arr, noLatexSigns = false) {
|
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
11
|
alignements += "l";
|
|
12
|
-
const aligned = `${!noLatexSigns ? "
|
|
13
|
-
\\def\\arraystretch{1.8}
|
|
12
|
+
const aligned = `${!noLatexSigns ? "$$\n" : ""}\\def\\arraystretch{1.8}
|
|
14
13
|
\\begin{array}{${alignements}}
|
|
15
14
|
${typeof arr === "string" ? arr : arr.map((el) => el.join("&")).join(` \\\\ `)}
|
|
16
|
-
\\end{array}
|
|
17
|
-
${!noLatexSigns ? "$$" : ""}`;
|
|
15
|
+
\\end{array}${!noLatexSigns ? "\n$$\n" : ""}`;
|
|
18
16
|
return aligned;
|
|
19
17
|
}
|
|
20
18
|
exports.alignTex = alignTex;
|