math-exercises 1.2.1 → 1.2.3
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/package.json +1 -1
- package/src/exercises/calcul/addAndSub.ts +0 -1
- package/src/exercises/calcul/fractions/fractionAndIntegerDivision.js +1 -1
- package/src/exercises/calcul/fractions/fractionAndIntegerProduct.js +1 -1
- package/src/exercises/calcul/fractions/fractionAndIntegerSum.js +1 -1
- package/src/exercises/calcul/operationsPriorities.js +24 -6
- package/src/exercises/calcul/operationsPriorities.ts +24 -6
- package/src/exercises/calculLitteral/distributivity/allIdentities.js +1 -1
- package/src/exercises/calculLitteral/distributivity/allIdentities.ts +1 -1
- package/src/exercises/calculLitteral/distributivity/doubleDistributivity.js +1 -1
- package/src/exercises/calculLitteral/distributivity/firstIdentity.js +1 -1
- package/src/exercises/calculLitteral/distributivity/secondIdentity.js +1 -1
- package/src/exercises/calculLitteral/distributivity/simpleDistributivity.js +1 -1
- package/src/exercises/calculLitteral/distributivity/thirdIdentity.js +1 -1
- package/src/exercises/calculLitteral/equation/equationType1Exercise.js +1 -1
- package/src/exercises/calculLitteral/equation/equationType1Exercise.ts +1 -1
- package/src/exercises/calculLitteral/equation/equationType2Exercise.js +1 -1
- package/src/exercises/calculLitteral/equation/equationType2Exercise.ts +1 -1
- package/src/exercises/calculLitteral/factorisation/factoType1Exercise.js +1 -1
- package/src/exercises/powers/powersDivision.js +2 -2
- package/src/exercises/powers/powersPower.js +1 -1
- package/src/exercises/powers/powersProduct.js +1 -1
- package/src/exercises/powers/scientificToDecimal.js +1 -1
- package/src/index.js +0 -5
- package/src/index.ts +5 -2
- package/src/tree/latexParser/latexParse.js +1 -7
- package/src/tree/latexParser/latexParse.ts +1 -7
package/package.json
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { randint } from "../../mathutils/random/randint";
|
|
2
|
-
import { Interval } from "../../sets/intervals/intervals";
|
|
3
2
|
import { latexParse } from "../../tree/latexParser/latexParse";
|
|
4
3
|
import { NumberNode } from "../../tree/nodes/numbers/numberNode";
|
|
5
4
|
import { AddNode } from "../../tree/nodes/operators/addNode";
|
|
@@ -12,7 +12,7 @@ exports.fractionAndIntegerDivision = {
|
|
|
12
12
|
id: "fractionAndIntegerDivision",
|
|
13
13
|
connector: "=",
|
|
14
14
|
instruction: "Calculer la forme irréductible :",
|
|
15
|
-
label: "
|
|
15
|
+
label: "Division d'un entier et d'une fraction",
|
|
16
16
|
levels: ["4", "3", "2", "1"],
|
|
17
17
|
isSingleStep: false,
|
|
18
18
|
section: "Fractions",
|
|
@@ -11,7 +11,7 @@ exports.fractionAndIntegerProduct = {
|
|
|
11
11
|
id: "fractionAndIntegerProduct",
|
|
12
12
|
connector: "=",
|
|
13
13
|
instruction: "Calculer la forme irréductible :",
|
|
14
|
-
label: "
|
|
14
|
+
label: "Produit d'un entier et d'une fraction",
|
|
15
15
|
levels: ["4", "3", "2", "1"],
|
|
16
16
|
isSingleStep: false,
|
|
17
17
|
section: "Fractions",
|
|
@@ -11,7 +11,7 @@ exports.fractionAndIntegerSum = {
|
|
|
11
11
|
id: "fractionAndIntegerSum",
|
|
12
12
|
connector: "=",
|
|
13
13
|
instruction: "Calculer la forme irréductible :",
|
|
14
|
-
label: "
|
|
14
|
+
label: "Somme d'un entier et d'une fraction",
|
|
15
15
|
levels: ["4", "3", "2", "1"],
|
|
16
16
|
isSingleStep: false,
|
|
17
17
|
section: "Fractions",
|
|
@@ -41,7 +41,10 @@ function getPriorityQuestions() {
|
|
|
41
41
|
new addNode_1.AddNode(new multiplyNode_1.MultiplyNode(new numberNode_1.NumberNode(a), new numberNode_1.NumberNode(b)), new addNode_1.AddNode(new numberNode_1.NumberNode(c), new numberNode_1.NumberNode(d))).shuffle()
|
|
42
42
|
: //a*b middle
|
|
43
43
|
new addNode_1.AddNode(new addNode_1.AddNode(new numberNode_1.NumberNode(c), new multiplyNode_1.MultiplyNode(new numberNode_1.NumberNode(a), new numberNode_1.NumberNode(b))), new numberNode_1.NumberNode(d));
|
|
44
|
-
answer = a * b + c + d
|
|
44
|
+
answer = (a * b + c + d).toString();
|
|
45
|
+
console.log("type", type);
|
|
46
|
+
console.log("statement", statement);
|
|
47
|
+
console.log("answer", answer);
|
|
45
48
|
break;
|
|
46
49
|
case 2: // a/b ±c±d
|
|
47
50
|
_c = [1, 2, 3].map(function (el) { return (0, randint_1.randint)(-10, 11, [0]); }), b = _c[0], c = _c[1], d = _c[2];
|
|
@@ -51,33 +54,48 @@ function getPriorityQuestions() {
|
|
|
51
54
|
new addNode_1.AddNode(new divideNode_1.DivideNode(new numberNode_1.NumberNode(a), new numberNode_1.NumberNode(b)), new addNode_1.AddNode(new numberNode_1.NumberNode(c), new numberNode_1.NumberNode(d))).shuffle()
|
|
52
55
|
: //a/b middle
|
|
53
56
|
new addNode_1.AddNode(new addNode_1.AddNode(new numberNode_1.NumberNode(c), new divideNode_1.DivideNode(new numberNode_1.NumberNode(a), new numberNode_1.NumberNode(b))), new numberNode_1.NumberNode(d));
|
|
54
|
-
answer = a / b + c + d
|
|
57
|
+
answer = (a / b + c + d).toString();
|
|
58
|
+
console.log("type", type);
|
|
59
|
+
console.log("statement", statement);
|
|
60
|
+
console.log("answer", answer);
|
|
55
61
|
break;
|
|
56
62
|
case 3: // a*b ± c*d
|
|
57
63
|
_d = [1, 2, 3, 4].map(function (el) { return (0, randint_1.randint)(-10, 11); }), a = _d[0], b = _d[1], c = _d[2], d = _d[3];
|
|
58
64
|
statement = new addNode_1.AddNode(new multiplyNode_1.MultiplyNode(new numberNode_1.NumberNode(a), new numberNode_1.NumberNode(b)), new multiplyNode_1.MultiplyNode(new numberNode_1.NumberNode(c), new numberNode_1.NumberNode(d)));
|
|
59
|
-
answer = a * b + c * d
|
|
65
|
+
answer = (a * b + c * d).toString();
|
|
66
|
+
console.log("type", type);
|
|
67
|
+
console.log("statement", statement);
|
|
68
|
+
console.log("answer", answer);
|
|
60
69
|
break;
|
|
61
70
|
case 4: // a*b ± c/d
|
|
62
71
|
_e = [1, 2].map(function (el) { return (0, randint_1.randint)(-10, 11); }), a = _e[0], b = _e[1];
|
|
63
72
|
d = (0, randint_1.randint)(-10, 11, [0]);
|
|
64
73
|
c = d * (0, randint_1.randint)(0, 11);
|
|
65
74
|
statement = new addNode_1.AddNode(new multiplyNode_1.MultiplyNode(new numberNode_1.NumberNode(a), new numberNode_1.NumberNode(b)), new divideNode_1.DivideNode(new numberNode_1.NumberNode(c), new numberNode_1.NumberNode(d))).shuffle();
|
|
66
|
-
answer = a * b + c / d
|
|
75
|
+
answer = (a * b + c / d).toString();
|
|
76
|
+
console.log("type", type);
|
|
77
|
+
console.log("statement", statement);
|
|
78
|
+
console.log("answer", answer);
|
|
67
79
|
break;
|
|
68
80
|
case 5: // a/b ± c/d
|
|
69
81
|
_f = [1, 2].map(function (el) { return (0, randint_1.randint)(-10, 11, [0]); }), b = _f[0], d = _f[1];
|
|
70
82
|
a = b * (0, randint_1.randint)(0, 11);
|
|
71
83
|
c = d * (0, randint_1.randint)(0, 11);
|
|
72
84
|
statement = new addNode_1.AddNode(new divideNode_1.DivideNode(new numberNode_1.NumberNode(a), new numberNode_1.NumberNode(b)), new divideNode_1.DivideNode(new numberNode_1.NumberNode(c), new numberNode_1.NumberNode(d)));
|
|
73
|
-
answer = a / b + c / d
|
|
85
|
+
answer = (a / b + c / d).toString();
|
|
86
|
+
console.log("type", type);
|
|
87
|
+
console.log("statement", statement);
|
|
88
|
+
console.log("answer", answer);
|
|
74
89
|
break;
|
|
75
90
|
case 5: // a*b*c ± d
|
|
76
91
|
_g = [1, 2].map(function (el) { return (0, randint_1.randint)(-10, 11, [0]); }), b = _g[0], d = _g[1];
|
|
77
92
|
a = b * (0, randint_1.randint)(0, 11);
|
|
78
93
|
c = d * (0, randint_1.randint)(0, 11);
|
|
79
94
|
statement = new addNode_1.AddNode(new multiplyNode_1.MultiplyNode(new multiplyNode_1.MultiplyNode(new numberNode_1.NumberNode(a), new numberNode_1.NumberNode(b)), new numberNode_1.NumberNode(c)), new numberNode_1.NumberNode(d)).shuffle();
|
|
80
|
-
answer =
|
|
95
|
+
answer = a * b * c + d + "";
|
|
96
|
+
console.log("type", type);
|
|
97
|
+
console.log("statement", statement.toString());
|
|
98
|
+
console.log("answer", answer);
|
|
81
99
|
break;
|
|
82
100
|
}
|
|
83
101
|
var question = {
|
|
@@ -52,7 +52,10 @@ export function getPriorityQuestions(): Question {
|
|
|
52
52
|
new AddNode(new NumberNode(c), new MultiplyNode(new NumberNode(a), new NumberNode(b))),
|
|
53
53
|
new NumberNode(d)
|
|
54
54
|
);
|
|
55
|
-
answer = a * b + c + d
|
|
55
|
+
answer = (a * b + c + d).toString();
|
|
56
|
+
console.log("type", type);
|
|
57
|
+
console.log("statement", statement);
|
|
58
|
+
console.log("answer", answer);
|
|
56
59
|
break;
|
|
57
60
|
case 2: // a/b ±c±d
|
|
58
61
|
[b, c, d] = [1, 2, 3].map((el) => randint(-10, 11, [0]));
|
|
@@ -68,7 +71,10 @@ export function getPriorityQuestions(): Question {
|
|
|
68
71
|
new AddNode(new NumberNode(c), new DivideNode(new NumberNode(a), new NumberNode(b))),
|
|
69
72
|
new NumberNode(d)
|
|
70
73
|
);
|
|
71
|
-
answer = a / b + c + d
|
|
74
|
+
answer = (a / b + c + d).toString();
|
|
75
|
+
console.log("type", type);
|
|
76
|
+
console.log("statement", statement);
|
|
77
|
+
console.log("answer", answer);
|
|
72
78
|
break;
|
|
73
79
|
case 3: // a*b ± c*d
|
|
74
80
|
[a, b, c, d] = [1, 2, 3, 4].map((el) => randint(-10, 11));
|
|
@@ -76,7 +82,10 @@ export function getPriorityQuestions(): Question {
|
|
|
76
82
|
new MultiplyNode(new NumberNode(a), new NumberNode(b)),
|
|
77
83
|
new MultiplyNode(new NumberNode(c), new NumberNode(d))
|
|
78
84
|
);
|
|
79
|
-
answer = a * b + c * d
|
|
85
|
+
answer = (a * b + c * d).toString();
|
|
86
|
+
console.log("type", type);
|
|
87
|
+
console.log("statement", statement);
|
|
88
|
+
console.log("answer", answer);
|
|
80
89
|
break;
|
|
81
90
|
case 4: // a*b ± c/d
|
|
82
91
|
[a, b] = [1, 2].map((el) => randint(-10, 11));
|
|
@@ -86,7 +95,10 @@ export function getPriorityQuestions(): Question {
|
|
|
86
95
|
new MultiplyNode(new NumberNode(a), new NumberNode(b)),
|
|
87
96
|
new DivideNode(new NumberNode(c), new NumberNode(d))
|
|
88
97
|
).shuffle();
|
|
89
|
-
answer = a * b + c / d
|
|
98
|
+
answer = (a * b + c / d).toString();
|
|
99
|
+
console.log("type", type);
|
|
100
|
+
console.log("statement", statement);
|
|
101
|
+
console.log("answer", answer);
|
|
90
102
|
break;
|
|
91
103
|
case 5: // a/b ± c/d
|
|
92
104
|
[b, d] = [1, 2].map((el) => randint(-10, 11, [0]));
|
|
@@ -96,7 +108,10 @@ export function getPriorityQuestions(): Question {
|
|
|
96
108
|
new DivideNode(new NumberNode(a), new NumberNode(b)),
|
|
97
109
|
new DivideNode(new NumberNode(c), new NumberNode(d))
|
|
98
110
|
);
|
|
99
|
-
answer = a / b + c / d
|
|
111
|
+
answer = (a / b + c / d).toString();
|
|
112
|
+
console.log("type", type);
|
|
113
|
+
console.log("statement", statement);
|
|
114
|
+
console.log("answer", answer);
|
|
100
115
|
break;
|
|
101
116
|
case 5: // a*b*c ± d
|
|
102
117
|
[b, d] = [1, 2].map((el) => randint(-10, 11, [0]));
|
|
@@ -106,7 +121,10 @@ export function getPriorityQuestions(): Question {
|
|
|
106
121
|
new MultiplyNode(new MultiplyNode(new NumberNode(a), new NumberNode(b)), new NumberNode(c)),
|
|
107
122
|
new NumberNode(d)
|
|
108
123
|
).shuffle();
|
|
109
|
-
answer =
|
|
124
|
+
answer = a * b * c + d + "";
|
|
125
|
+
console.log("type", type);
|
|
126
|
+
console.log("statement", statement.toString());
|
|
127
|
+
console.log("answer", answer);
|
|
110
128
|
break;
|
|
111
129
|
}
|
|
112
130
|
|
|
@@ -13,7 +13,7 @@ exports.allIdentities = {
|
|
|
13
13
|
label: "Identités remarquables (toutes)",
|
|
14
14
|
levels: ["3", "2"],
|
|
15
15
|
isSingleStep: false,
|
|
16
|
-
section: "Calcul
|
|
16
|
+
section: "Calcul littéral",
|
|
17
17
|
generator: function (nb) { return (0, getDistinctQuestions_1.getDistinctQuestions)(getAllIdentitiesQuestion, nb); }
|
|
18
18
|
};
|
|
19
19
|
function getAllIdentitiesQuestion() {
|
|
@@ -12,7 +12,7 @@ export const allIdentities: Exercise = {
|
|
|
12
12
|
label: "Identités remarquables (toutes)",
|
|
13
13
|
levels: ["3", "2"],
|
|
14
14
|
isSingleStep: false,
|
|
15
|
-
section: "Calcul
|
|
15
|
+
section: "Calcul littéral",
|
|
16
16
|
generator: (nb: number) => getDistinctQuestions(getAllIdentitiesQuestion, nb),
|
|
17
17
|
};
|
|
18
18
|
|
|
@@ -15,7 +15,7 @@ exports.doubleDistributivity = {
|
|
|
15
15
|
label: "Distributivité double",
|
|
16
16
|
levels: ["3", "2"],
|
|
17
17
|
isSingleStep: false,
|
|
18
|
-
section: "Calcul
|
|
18
|
+
section: "Calcul littéral",
|
|
19
19
|
generator: function (nb) { return (0, getDistinctQuestions_1.getDistinctQuestions)(getDoubleDistributivityQuestion, nb); }
|
|
20
20
|
};
|
|
21
21
|
function getDoubleDistributivityQuestion() {
|
|
@@ -16,7 +16,7 @@ exports.firstIdentity = {
|
|
|
16
16
|
label: "Identité remarquable $(a+b)^2$",
|
|
17
17
|
levels: ["3", "2"],
|
|
18
18
|
isSingleStep: false,
|
|
19
|
-
section: "Calcul
|
|
19
|
+
section: "Calcul littéral",
|
|
20
20
|
generator: function (nb) { return (0, getDistinctQuestions_1.getDistinctQuestions)(getFirstIdentityQuestion, nb); }
|
|
21
21
|
};
|
|
22
22
|
function getFirstIdentityQuestion() {
|
|
@@ -16,7 +16,7 @@ exports.secondIdentity = {
|
|
|
16
16
|
label: "Identité remarquable $(a-b)^2$",
|
|
17
17
|
levels: ["3", "2"],
|
|
18
18
|
isSingleStep: false,
|
|
19
|
-
section: "Calcul
|
|
19
|
+
section: "Calcul littéral",
|
|
20
20
|
generator: function (nb) { return (0, getDistinctQuestions_1.getDistinctQuestions)(getSecondIdentityQuestion, nb); }
|
|
21
21
|
};
|
|
22
22
|
function getSecondIdentityQuestion() {
|
|
@@ -16,7 +16,7 @@ exports.simpleDistributivity = {
|
|
|
16
16
|
label: "Distributivité simple",
|
|
17
17
|
levels: ["3", "2"],
|
|
18
18
|
isSingleStep: false,
|
|
19
|
-
section: "Calcul
|
|
19
|
+
section: "Calcul littéral",
|
|
20
20
|
generator: function (nb) { return (0, getDistinctQuestions_1.getDistinctQuestions)(getSimpleDistributivityQuestion, nb); }
|
|
21
21
|
};
|
|
22
22
|
function getSimpleDistributivityQuestion() {
|
|
@@ -15,7 +15,7 @@ exports.thirdIdentity = {
|
|
|
15
15
|
label: "Identité remarquable $(a+b)(a-b)$",
|
|
16
16
|
levels: ["3", "2"],
|
|
17
17
|
isSingleStep: false,
|
|
18
|
-
section: "Calcul
|
|
18
|
+
section: "Calcul littéral",
|
|
19
19
|
generator: function (nb) { return (0, getDistinctQuestions_1.getDistinctQuestions)(getThirdIdentityQuestion, nb); }
|
|
20
20
|
};
|
|
21
21
|
function getThirdIdentityQuestion() {
|
|
@@ -18,7 +18,7 @@ exports.equationType1Exercise = {
|
|
|
18
18
|
label: "Equations $x+a = b$",
|
|
19
19
|
levels: ["4", "3", "2"],
|
|
20
20
|
section: "Calcul littéral",
|
|
21
|
-
isSingleStep:
|
|
21
|
+
isSingleStep: true,
|
|
22
22
|
generator: function (nb) { return (0, getDistinctQuestions_1.getDistinctQuestions)(getEquationType1ExerciseQuestion, nb); }
|
|
23
23
|
};
|
|
24
24
|
function getEquationType1ExerciseQuestion() {
|
|
@@ -17,7 +17,7 @@ export const equationType1Exercise: Exercise = {
|
|
|
17
17
|
label: "Equations $x+a = b$",
|
|
18
18
|
levels: ["4", "3", "2"],
|
|
19
19
|
section: "Calcul littéral",
|
|
20
|
-
isSingleStep:
|
|
20
|
+
isSingleStep: true,
|
|
21
21
|
generator: (nb: number) => getDistinctQuestions(getEquationType1ExerciseQuestion, nb),
|
|
22
22
|
};
|
|
23
23
|
|
|
@@ -20,7 +20,7 @@ exports.equationType2Exercise = {
|
|
|
20
20
|
label: "Equations $ax=b$",
|
|
21
21
|
levels: ["4", "3", "2"],
|
|
22
22
|
section: "Calcul littéral",
|
|
23
|
-
isSingleStep:
|
|
23
|
+
isSingleStep: true,
|
|
24
24
|
generator: function (nb) { return (0, getDistinctQuestions_1.getDistinctQuestions)(getEquationType2ExerciseQuestion, nb); }
|
|
25
25
|
};
|
|
26
26
|
function getEquationType2ExerciseQuestion() {
|
|
@@ -20,7 +20,7 @@ export const equationType2Exercise: Exercise = {
|
|
|
20
20
|
label: "Equations $ax=b$",
|
|
21
21
|
levels: ["4", "3", "2"],
|
|
22
22
|
section: "Calcul littéral",
|
|
23
|
-
isSingleStep:
|
|
23
|
+
isSingleStep: true,
|
|
24
24
|
generator: (nb: number) => getDistinctQuestions(getEquationType2ExerciseQuestion, nb),
|
|
25
25
|
};
|
|
26
26
|
|
|
@@ -19,7 +19,7 @@ exports.factoType1Exercise = {
|
|
|
19
19
|
isSingleStep: false,
|
|
20
20
|
label: "Factorisation du type $(ax+b)(cx+d) \\pm (ax+b)(ex+f)$",
|
|
21
21
|
levels: ["3", "2"],
|
|
22
|
-
section: "Calcul
|
|
22
|
+
section: "Calcul littéral",
|
|
23
23
|
generator: function (nb) { return (0, getDistinctQuestions_1.getDistinctQuestions)(getFactoType1Question, nb); }
|
|
24
24
|
};
|
|
25
25
|
function getFactoType1Question() {
|
|
@@ -15,7 +15,7 @@ exports.powersDivision = {
|
|
|
15
15
|
id: "powersDivision",
|
|
16
16
|
connector: "=",
|
|
17
17
|
instruction: "Calculer :",
|
|
18
|
-
label: "
|
|
18
|
+
label: "Division de puissances",
|
|
19
19
|
levels: ["4", "3", "2", "1"],
|
|
20
20
|
section: "Puissances",
|
|
21
21
|
isSingleStep: true,
|
|
@@ -25,7 +25,7 @@ exports.powersOfTenDivision = {
|
|
|
25
25
|
id: "powersOfTenDivision",
|
|
26
26
|
connector: "=",
|
|
27
27
|
instruction: "Calculer :",
|
|
28
|
-
label: "
|
|
28
|
+
label: "Division de puissances de 10",
|
|
29
29
|
levels: ["4", "3", "2", "1"],
|
|
30
30
|
section: "Puissances",
|
|
31
31
|
isSingleStep: true,
|
|
@@ -14,7 +14,7 @@ exports.powersOfTenPower = {
|
|
|
14
14
|
id: "powersOfTenPower",
|
|
15
15
|
connector: "=",
|
|
16
16
|
instruction: "Calculer :",
|
|
17
|
-
label: "Puissance
|
|
17
|
+
label: "Puissance d'une puissance de 10 ",
|
|
18
18
|
levels: ["4", "3", "2", "1"],
|
|
19
19
|
section: "Puissances",
|
|
20
20
|
isSingleStep: true,
|
|
@@ -17,7 +17,7 @@ exports.powersOfTenProduct = {
|
|
|
17
17
|
instruction: "Calculer :",
|
|
18
18
|
label: "Multiplication de puissances de 10",
|
|
19
19
|
levels: ["4", "3", "2", "1"],
|
|
20
|
-
section: "
|
|
20
|
+
section: "Puissances",
|
|
21
21
|
isSingleStep: true,
|
|
22
22
|
generator: function (nb) { return (0, getDistinctQuestions_1.getDistinctQuestions)(function () { return getPowersProductQuestion(true); }, nb); }
|
|
23
23
|
};
|
|
@@ -16,7 +16,7 @@ exports.scientificToDecimal = {
|
|
|
16
16
|
id: "scientificToDecimal",
|
|
17
17
|
connector: "=",
|
|
18
18
|
instruction: "Donner l'écriture décimale de :",
|
|
19
|
-
label: "Ecriture décimale de $a\\times 10^x",
|
|
19
|
+
label: "Ecriture décimale de $a\\times 10^x$",
|
|
20
20
|
levels: ["5", "4", "3", "2"],
|
|
21
21
|
section: "Puissances",
|
|
22
22
|
isSingleStep: true,
|
package/src/index.js
CHANGED
|
@@ -3,8 +3,3 @@ exports.__esModule = true;
|
|
|
3
3
|
exports.exercises = void 0;
|
|
4
4
|
var exercises_1 = require("./exercises/exercises");
|
|
5
5
|
exports.exercises = exercises_1.exercises;
|
|
6
|
-
var scientificToDecimal_1 = require("./exercises/powers/scientificToDecimal");
|
|
7
|
-
// exercises.forEach((exo) => {
|
|
8
|
-
// console.log(exo.instruction, exo.generator(10));
|
|
9
|
-
// });
|
|
10
|
-
console.log(scientificToDecimal_1.scientificToDecimal);
|
package/src/index.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
import { operationsPriorities } from "./exercises/calcul/operationsPriorities";
|
|
1
2
|
import { exercises } from "./exercises/exercises";
|
|
2
|
-
import {
|
|
3
|
+
import { latexParse } from "./tree/latexParser/latexParse";
|
|
4
|
+
import { NumberNode } from "./tree/nodes/numbers/numberNode";
|
|
5
|
+
import { MultiplyNode } from "./tree/nodes/operators/multiplyNode";
|
|
3
6
|
|
|
4
|
-
console.log(scientificToDecimal.generator(10));
|
|
5
7
|
// exercises.forEach((exo) => {
|
|
6
8
|
// console.log(exo.instruction, exo.generator(10));
|
|
7
9
|
// });
|
|
10
|
+
|
|
8
11
|
export { exercises };
|
|
@@ -62,13 +62,7 @@ function latexParse(node) {
|
|
|
62
62
|
}
|
|
63
63
|
if (needBrackets)
|
|
64
64
|
rightTex = "(".concat(rightTex, ")");
|
|
65
|
-
|
|
66
|
-
var showTimesSign = !isNaN(+rightTex[0]);
|
|
67
|
-
if (rightChild.type === node_1.NodeType.operator) {
|
|
68
|
-
var operatorRightChild = rightChild;
|
|
69
|
-
showTimesSign || (showTimesSign = [operatorNode_1.OperatorIds.fraction].includes(operatorRightChild.id));
|
|
70
|
-
}
|
|
71
|
-
return "".concat(leftTex).concat(showTimesSign ? "\\div " : "").concat(rightTex);
|
|
65
|
+
return "".concat(leftTex, " \\div ").concat(rightTex);
|
|
72
66
|
}
|
|
73
67
|
case operatorNode_1.OperatorIds.fraction: {
|
|
74
68
|
return "\\frac{".concat(leftTex, "}{").concat(rightTex, "}");
|
|
@@ -65,13 +65,7 @@ export function latexParse(node: Node): string {
|
|
|
65
65
|
}
|
|
66
66
|
if (needBrackets) rightTex = `(${rightTex})`;
|
|
67
67
|
|
|
68
|
-
|
|
69
|
-
let showTimesSign = !isNaN(+rightTex[0]);
|
|
70
|
-
if (rightChild.type === NodeType.operator) {
|
|
71
|
-
const operatorRightChild = rightChild as OperatorNode;
|
|
72
|
-
showTimesSign ||= [OperatorIds.fraction].includes(operatorRightChild.id);
|
|
73
|
-
}
|
|
74
|
-
return `${leftTex}${showTimesSign ? "\\div " : ""}${rightTex}`;
|
|
68
|
+
return `${leftTex} \\div ${rightTex}`;
|
|
75
69
|
}
|
|
76
70
|
|
|
77
71
|
case OperatorIds.fraction: {
|