math-exercises 1.2.10 → 1.3.0
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/README.md +63 -0
- package/lib/exercises/calcul/addAndSub.js +8 -9
- package/lib/exercises/calcul/fractions/fractionAndIntegerDivision.js +7 -8
- package/lib/exercises/calcul/fractions/fractionAndIntegerProduct.js +9 -9
- package/lib/exercises/calcul/fractions/fractionAndIntegerSum.js +7 -8
- package/lib/exercises/calcul/fractions/fractionsDivision.js +8 -9
- package/lib/exercises/calcul/fractions/fractionsProduct.js +8 -9
- package/lib/exercises/calcul/fractions/fractionsSum.js +8 -9
- package/lib/exercises/calcul/fractions/simplifyFraction.js +2 -3
- package/lib/exercises/calcul/operations/operationsPriorities.js +25 -15
- package/lib/exercises/calcul/rounding/rounding.js +33 -34
- package/lib/exercises/calculLitteral/distributivity/doubleDistributivity.js +9 -10
- package/lib/exercises/calculLitteral/distributivity/firstIdentity.js +9 -10
- package/lib/exercises/calculLitteral/distributivity/secondIdentity.js +10 -11
- package/lib/exercises/calculLitteral/distributivity/simpleDistributivity.js +9 -10
- package/lib/exercises/calculLitteral/distributivity/thirdIdentity.js +9 -10
- package/lib/exercises/calculLitteral/equation/equationType1Exercise.js +9 -10
- package/lib/exercises/calculLitteral/equation/equationType2Exercise.js +11 -12
- package/lib/exercises/calculLitteral/equation/equationType3Exercise.js +11 -12
- package/lib/exercises/calculLitteral/equation/equationType4Exercise.js +12 -13
- package/lib/exercises/calculLitteral/factorisation/factoType1Exercise.js +11 -12
- package/lib/exercises/geometry/cartesian/midpoint.js +1 -1
- package/lib/exercises/geometry/vectors/scalarProductViaCoords.js +9 -10
- package/lib/exercises/powers/powersDivision.js +14 -15
- package/lib/exercises/powers/powersOfTenToDecimal.js +6 -7
- package/lib/exercises/powers/powersPower.js +12 -13
- package/lib/exercises/powers/powersProduct.js +14 -15
- package/lib/exercises/powers/scientificToDecimal.js +8 -9
- package/lib/exercises/squareRoots/simpifySquareRoot.js +8 -9
- package/lib/exercises/utils/getDistinctQuestions.js +1 -2
- package/lib/geometry/point.js +4 -4
- package/lib/geometry/vector.js +3 -3
- package/lib/index.js +4 -5
- package/lib/tree/nodes/functions/oppositeNode.js +16 -3
- package/lib/tree/nodes/functions/sqrtNode.js +6 -3
- package/lib/tree/nodes/numbers/numberNode.js +1 -1
- package/lib/tree/nodes/operators/addNode.js +7 -3
- package/lib/tree/nodes/operators/divideNode.js +20 -3
- package/lib/tree/nodes/operators/equalNode.js +6 -3
- package/lib/tree/nodes/operators/fractionNode.js +6 -3
- package/lib/tree/nodes/operators/multiplyNode.js +26 -3
- package/lib/tree/nodes/operators/operatorNode.js +3 -3
- package/lib/tree/nodes/operators/powerNode.js +23 -3
- package/lib/tree/nodes/operators/substractNode.js +14 -3
- package/lib/tree/nodes/variables/variableNode.js +9 -6
- package/lib/tree/parsers/derivateParser.js +61 -59
- package/lib/tree/parsers/latexParser.js +109 -116
- package/lib/tree/parsers/simplify.js +51 -0
- package/package.json +5 -2
|
@@ -5,29 +5,28 @@ const integer_1 = require("../../../numbers/integer/integer");
|
|
|
5
5
|
const affine_1 = require("../../../polynomials/affine");
|
|
6
6
|
const discreteSet_1 = require("../../../sets/discreteSet");
|
|
7
7
|
const intervals_1 = require("../../../sets/intervals/intervals");
|
|
8
|
-
const latexParser_1 = require("../../../tree/parsers/latexParser");
|
|
9
8
|
const numberNode_1 = require("../../../tree/nodes/numbers/numberNode");
|
|
10
9
|
const powerNode_1 = require("../../../tree/nodes/operators/powerNode");
|
|
11
10
|
const getDistinctQuestions_1 = require("../../utils/getDistinctQuestions");
|
|
12
11
|
exports.secondIdentity = {
|
|
13
|
-
id:
|
|
14
|
-
connector:
|
|
15
|
-
instruction:
|
|
16
|
-
label:
|
|
17
|
-
levels: [
|
|
12
|
+
id: 'idRmq2',
|
|
13
|
+
connector: '=',
|
|
14
|
+
instruction: 'Développer et réduire :',
|
|
15
|
+
label: 'Identité remarquable $(a-b)^2$',
|
|
16
|
+
levels: ['3', '2'],
|
|
18
17
|
isSingleStep: false,
|
|
19
|
-
section:
|
|
18
|
+
section: 'Calcul littéral',
|
|
20
19
|
generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getSecondIdentityQuestion, nb),
|
|
21
20
|
};
|
|
22
21
|
function getSecondIdentityQuestion() {
|
|
23
|
-
const intervalA = new intervals_1.Interval(
|
|
24
|
-
const intervalB = new intervals_1.Interval(
|
|
22
|
+
const intervalA = new intervals_1.Interval('[[0; 10]]').difference(new discreteSet_1.DiscreteSet([new integer_1.Integer(0)]));
|
|
23
|
+
const intervalB = new intervals_1.Interval('[[-10; 0]]').difference(new discreteSet_1.DiscreteSet([new integer_1.Integer(0)]));
|
|
25
24
|
const affine = affine_1.AffineConstructor.random(intervalA, intervalB);
|
|
26
25
|
const statementTree = new powerNode_1.PowerNode(affine.toTree(), new numberNode_1.NumberNode(2));
|
|
27
26
|
const answerTree = affine.multiply(affine).toTree();
|
|
28
27
|
return {
|
|
29
|
-
startStatement:
|
|
30
|
-
answer:
|
|
28
|
+
startStatement: statementTree.toTex(),
|
|
29
|
+
answer: answerTree.toTex(),
|
|
31
30
|
};
|
|
32
31
|
}
|
|
33
32
|
exports.getSecondIdentityQuestion = getSecondIdentityQuestion;
|
|
@@ -5,29 +5,28 @@ const integer_1 = require("../../../numbers/integer/integer");
|
|
|
5
5
|
const affine_1 = require("../../../polynomials/affine");
|
|
6
6
|
const discreteSet_1 = require("../../../sets/discreteSet");
|
|
7
7
|
const intervals_1 = require("../../../sets/intervals/intervals");
|
|
8
|
-
const latexParser_1 = require("../../../tree/parsers/latexParser");
|
|
9
8
|
const numberNode_1 = require("../../../tree/nodes/numbers/numberNode");
|
|
10
9
|
const multiplyNode_1 = require("../../../tree/nodes/operators/multiplyNode");
|
|
11
10
|
const getDistinctQuestions_1 = require("../../utils/getDistinctQuestions");
|
|
12
11
|
exports.simpleDistributivity = {
|
|
13
|
-
id:
|
|
14
|
-
connector:
|
|
15
|
-
instruction:
|
|
16
|
-
label:
|
|
17
|
-
levels: [
|
|
12
|
+
id: 'simpleDistri',
|
|
13
|
+
connector: '=',
|
|
14
|
+
instruction: 'Développer et réduire :',
|
|
15
|
+
label: 'Distributivité simple',
|
|
16
|
+
levels: ['3', '2'],
|
|
18
17
|
isSingleStep: false,
|
|
19
|
-
section:
|
|
18
|
+
section: 'Calcul littéral',
|
|
20
19
|
generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getSimpleDistributivityQuestion, nb),
|
|
21
20
|
};
|
|
22
21
|
function getSimpleDistributivityQuestion() {
|
|
23
|
-
const interval = new intervals_1.Interval(
|
|
22
|
+
const interval = new intervals_1.Interval('[[-10; 10]]').difference(new discreteSet_1.DiscreteSet([new integer_1.Integer(0)]));
|
|
24
23
|
const affine = affine_1.AffineConstructor.random(interval, interval);
|
|
25
24
|
const coeff = interval.getRandomElement();
|
|
26
25
|
const statementTree = new multiplyNode_1.MultiplyNode(new numberNode_1.NumberNode(coeff.value), affine.toTree());
|
|
27
26
|
const answerTree = affine.times(coeff.value).toTree();
|
|
28
27
|
return {
|
|
29
|
-
startStatement:
|
|
30
|
-
answer:
|
|
28
|
+
startStatement: statementTree.toTex(),
|
|
29
|
+
answer: answerTree.toTex(),
|
|
31
30
|
};
|
|
32
31
|
}
|
|
33
32
|
exports.getSimpleDistributivityQuestion = getSimpleDistributivityQuestion;
|
|
@@ -5,28 +5,27 @@ const integer_1 = require("../../../numbers/integer/integer");
|
|
|
5
5
|
const affine_1 = require("../../../polynomials/affine");
|
|
6
6
|
const discreteSet_1 = require("../../../sets/discreteSet");
|
|
7
7
|
const intervals_1 = require("../../../sets/intervals/intervals");
|
|
8
|
-
const latexParser_1 = require("../../../tree/parsers/latexParser");
|
|
9
8
|
const multiplyNode_1 = require("../../../tree/nodes/operators/multiplyNode");
|
|
10
9
|
const getDistinctQuestions_1 = require("../../utils/getDistinctQuestions");
|
|
11
10
|
exports.thirdIdentity = {
|
|
12
|
-
id:
|
|
13
|
-
connector:
|
|
14
|
-
instruction:
|
|
15
|
-
label:
|
|
16
|
-
levels: [
|
|
11
|
+
id: 'idRmq3',
|
|
12
|
+
connector: '=',
|
|
13
|
+
instruction: 'Développer et réduire :',
|
|
14
|
+
label: 'Identité remarquable $(a+b)(a-b)$',
|
|
15
|
+
levels: ['3', '2'],
|
|
17
16
|
isSingleStep: false,
|
|
18
|
-
section:
|
|
17
|
+
section: 'Calcul littéral',
|
|
19
18
|
generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getThirdIdentityQuestion, nb),
|
|
20
19
|
};
|
|
21
20
|
function getThirdIdentityQuestion() {
|
|
22
|
-
const interval = new intervals_1.Interval(
|
|
21
|
+
const interval = new intervals_1.Interval('[[-10; 10]]').difference(new discreteSet_1.DiscreteSet([new integer_1.Integer(0)]));
|
|
23
22
|
const affine = affine_1.AffineConstructor.random(interval, interval);
|
|
24
23
|
const affine2 = new affine_1.Affine(affine.a, -affine.b);
|
|
25
24
|
const statementTree = new multiplyNode_1.MultiplyNode(affine.toTree(), affine2.toTree());
|
|
26
25
|
const answerTree = affine.multiply(affine2).toTree();
|
|
27
26
|
return {
|
|
28
|
-
startStatement:
|
|
29
|
-
answer:
|
|
27
|
+
startStatement: statementTree.toTex(),
|
|
28
|
+
answer: answerTree.toTex(),
|
|
30
29
|
};
|
|
31
30
|
}
|
|
32
31
|
exports.getThirdIdentityQuestion = getThirdIdentityQuestion;
|
|
@@ -5,32 +5,31 @@ const integer_1 = require("../../../numbers/integer/integer");
|
|
|
5
5
|
const affine_1 = require("../../../polynomials/affine");
|
|
6
6
|
const discreteSet_1 = require("../../../sets/discreteSet");
|
|
7
7
|
const intervals_1 = require("../../../sets/intervals/intervals");
|
|
8
|
-
const latexParser_1 = require("../../../tree/parsers/latexParser");
|
|
9
8
|
const equalNode_1 = require("../../../tree/nodes/operators/equalNode");
|
|
10
9
|
const getDistinctQuestions_1 = require("../../utils/getDistinctQuestions");
|
|
11
10
|
/**
|
|
12
11
|
* type x+a=b
|
|
13
12
|
*/
|
|
14
13
|
exports.equationType1Exercise = {
|
|
15
|
-
id:
|
|
16
|
-
connector:
|
|
17
|
-
instruction:
|
|
18
|
-
label:
|
|
19
|
-
levels: [
|
|
20
|
-
section:
|
|
14
|
+
id: 'equa1',
|
|
15
|
+
connector: '\\iff',
|
|
16
|
+
instruction: 'Résoudre : ',
|
|
17
|
+
label: 'Equations $x+a = b$',
|
|
18
|
+
levels: ['4', '3', '2'],
|
|
19
|
+
section: 'Calcul littéral',
|
|
21
20
|
isSingleStep: true,
|
|
22
21
|
generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getEquationType1ExerciseQuestion, nb),
|
|
23
22
|
};
|
|
24
23
|
function getEquationType1ExerciseQuestion() {
|
|
25
|
-
const interval = new intervals_1.Interval(
|
|
26
|
-
const intervalStar = new intervals_1.Interval(
|
|
24
|
+
const interval = new intervals_1.Interval('[[-10; 10]]');
|
|
25
|
+
const intervalStar = new intervals_1.Interval('[[-10; 10]]').difference(new discreteSet_1.DiscreteSet([new integer_1.Integer(0)]));
|
|
27
26
|
const b = interval.getRandomElement();
|
|
28
27
|
const a = intervalStar.getRandomElement();
|
|
29
28
|
const solution = b.value - a.value;
|
|
30
29
|
const affine = new affine_1.Affine(1, a.value).toTree();
|
|
31
30
|
const tree = new equalNode_1.EqualNode(affine, b.toTree());
|
|
32
31
|
const question = {
|
|
33
|
-
startStatement:
|
|
32
|
+
startStatement: tree.toTex(),
|
|
34
33
|
answer: `x = ${solution}`,
|
|
35
34
|
};
|
|
36
35
|
return question;
|
|
@@ -6,7 +6,6 @@ const rational_1 = require("../../../numbers/rationals/rational");
|
|
|
6
6
|
const affine_1 = require("../../../polynomials/affine");
|
|
7
7
|
const discreteSet_1 = require("../../../sets/discreteSet");
|
|
8
8
|
const intervals_1 = require("../../../sets/intervals/intervals");
|
|
9
|
-
const latexParser_1 = require("../../../tree/parsers/latexParser");
|
|
10
9
|
const equalNode_1 = require("../../../tree/nodes/operators/equalNode");
|
|
11
10
|
const variableNode_1 = require("../../../tree/nodes/variables/variableNode");
|
|
12
11
|
const getDistinctQuestions_1 = require("../../utils/getDistinctQuestions");
|
|
@@ -14,27 +13,27 @@ const getDistinctQuestions_1 = require("../../utils/getDistinctQuestions");
|
|
|
14
13
|
* type ax=b
|
|
15
14
|
*/
|
|
16
15
|
exports.equationType2Exercise = {
|
|
17
|
-
id:
|
|
18
|
-
connector:
|
|
19
|
-
instruction:
|
|
20
|
-
label:
|
|
21
|
-
levels: [
|
|
22
|
-
section:
|
|
16
|
+
id: 'equa2',
|
|
17
|
+
connector: '\\iff',
|
|
18
|
+
instruction: 'Résoudre : ',
|
|
19
|
+
label: 'Equations $ax=b$',
|
|
20
|
+
levels: ['4', '3', '2'],
|
|
21
|
+
section: 'Calcul littéral',
|
|
23
22
|
isSingleStep: true,
|
|
24
23
|
generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getEquationType2ExerciseQuestion, nb),
|
|
25
24
|
};
|
|
26
25
|
function getEquationType2ExerciseQuestion() {
|
|
27
|
-
const interval = new intervals_1.Interval(
|
|
28
|
-
const intervalStar = new intervals_1.Interval(
|
|
26
|
+
const interval = new intervals_1.Interval('[[-10; 10]]');
|
|
27
|
+
const intervalStar = new intervals_1.Interval('[[-10; 10]]').difference(new discreteSet_1.DiscreteSet([new integer_1.Integer(0)]));
|
|
29
28
|
const b = interval.getRandomElement();
|
|
30
29
|
const a = intervalStar.getRandomElement();
|
|
31
30
|
const solution = new rational_1.Rational(b.value, a.value).simplify();
|
|
32
31
|
const affine = new affine_1.Affine(a.value, 0).toTree();
|
|
33
32
|
const tree = new equalNode_1.EqualNode(affine, b.toTree());
|
|
34
|
-
const answer = new equalNode_1.EqualNode(new variableNode_1.VariableNode(
|
|
33
|
+
const answer = new equalNode_1.EqualNode(new variableNode_1.VariableNode('x'), solution.toTree());
|
|
35
34
|
const question = {
|
|
36
|
-
startStatement:
|
|
37
|
-
answer:
|
|
35
|
+
startStatement: tree.toTex(),
|
|
36
|
+
answer: answer.toTex(),
|
|
38
37
|
};
|
|
39
38
|
return question;
|
|
40
39
|
}
|
|
@@ -6,7 +6,6 @@ const rational_1 = require("../../../numbers/rationals/rational");
|
|
|
6
6
|
const affine_1 = require("../../../polynomials/affine");
|
|
7
7
|
const discreteSet_1 = require("../../../sets/discreteSet");
|
|
8
8
|
const intervals_1 = require("../../../sets/intervals/intervals");
|
|
9
|
-
const latexParser_1 = require("../../../tree/parsers/latexParser");
|
|
10
9
|
const equalNode_1 = require("../../../tree/nodes/operators/equalNode");
|
|
11
10
|
const variableNode_1 = require("../../../tree/nodes/variables/variableNode");
|
|
12
11
|
const getDistinctQuestions_1 = require("../../utils/getDistinctQuestions");
|
|
@@ -14,28 +13,28 @@ const getDistinctQuestions_1 = require("../../utils/getDistinctQuestions");
|
|
|
14
13
|
* type ax+b=c
|
|
15
14
|
*/
|
|
16
15
|
exports.equationType3Exercise = {
|
|
17
|
-
id:
|
|
18
|
-
connector:
|
|
19
|
-
instruction:
|
|
20
|
-
label:
|
|
21
|
-
levels: [
|
|
22
|
-
section:
|
|
16
|
+
id: 'equa3',
|
|
17
|
+
connector: '\\iff',
|
|
18
|
+
instruction: 'Résoudre : ',
|
|
19
|
+
label: 'Equations $ax+b=c$',
|
|
20
|
+
levels: ['4', '3', '2'],
|
|
21
|
+
section: 'Calcul littéral',
|
|
23
22
|
isSingleStep: false,
|
|
24
23
|
generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getEquationType3ExerciseQuestion, nb),
|
|
25
24
|
};
|
|
26
25
|
function getEquationType3ExerciseQuestion() {
|
|
27
|
-
const interval = new intervals_1.Interval(
|
|
28
|
-
const intervalStar = new intervals_1.Interval(
|
|
26
|
+
const interval = new intervals_1.Interval('[[-10; 10]]');
|
|
27
|
+
const intervalStar = new intervals_1.Interval('[[-10; 10]]').difference(new discreteSet_1.DiscreteSet([new integer_1.Integer(0)]));
|
|
29
28
|
const b = intervalStar.getRandomElement();
|
|
30
29
|
const a = intervalStar.getRandomElement();
|
|
31
30
|
const c = interval.getRandomElement();
|
|
32
31
|
const affine = new affine_1.Affine(a.value, b.value).toTree();
|
|
33
32
|
const solution = new rational_1.Rational(c.value - b.value, a.value).simplify();
|
|
34
33
|
const statementTree = new equalNode_1.EqualNode(affine, c.toTree());
|
|
35
|
-
const answerTree = new equalNode_1.EqualNode(new variableNode_1.VariableNode(
|
|
34
|
+
const answerTree = new equalNode_1.EqualNode(new variableNode_1.VariableNode('x'), solution.toTree());
|
|
36
35
|
const question = {
|
|
37
|
-
startStatement:
|
|
38
|
-
answer:
|
|
36
|
+
startStatement: statementTree.toTex(),
|
|
37
|
+
answer: answerTree.toTex(),
|
|
39
38
|
};
|
|
40
39
|
return question;
|
|
41
40
|
}
|
|
@@ -6,7 +6,6 @@ const rational_1 = require("../../../numbers/rationals/rational");
|
|
|
6
6
|
const affine_1 = require("../../../polynomials/affine");
|
|
7
7
|
const discreteSet_1 = require("../../../sets/discreteSet");
|
|
8
8
|
const intervals_1 = require("../../../sets/intervals/intervals");
|
|
9
|
-
const latexParser_1 = require("../../../tree/parsers/latexParser");
|
|
10
9
|
const equalNode_1 = require("../../../tree/nodes/operators/equalNode");
|
|
11
10
|
const variableNode_1 = require("../../../tree/nodes/variables/variableNode");
|
|
12
11
|
const getDistinctQuestions_1 = require("../../utils/getDistinctQuestions");
|
|
@@ -14,30 +13,30 @@ const getDistinctQuestions_1 = require("../../utils/getDistinctQuestions");
|
|
|
14
13
|
* type ax+b=cx+d
|
|
15
14
|
*/
|
|
16
15
|
exports.equationType4Exercise = {
|
|
17
|
-
id:
|
|
18
|
-
connector:
|
|
19
|
-
instruction:
|
|
20
|
-
label:
|
|
21
|
-
levels: [
|
|
22
|
-
section:
|
|
16
|
+
id: 'equa4',
|
|
17
|
+
connector: '\\iff',
|
|
18
|
+
instruction: 'Résoudre : ',
|
|
19
|
+
label: 'Equations $ax+b=cx+d$',
|
|
20
|
+
levels: ['4', '3', '2'],
|
|
21
|
+
section: 'Calcul littéral',
|
|
23
22
|
isSingleStep: false,
|
|
24
23
|
generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getEquationType4ExerciseQuestion, nb),
|
|
25
24
|
};
|
|
26
25
|
function getEquationType4ExerciseQuestion() {
|
|
27
|
-
const interval = new intervals_1.Interval(
|
|
28
|
-
const intervalStar = new intervals_1.Interval(
|
|
26
|
+
const interval = new intervals_1.Interval('[[-10; 10]]');
|
|
27
|
+
const intervalStar = new intervals_1.Interval('[[-10; 10]]').difference(new discreteSet_1.DiscreteSet([new integer_1.Integer(0)]));
|
|
29
28
|
const a = intervalStar.getRandomElement();
|
|
30
29
|
const b = interval.getRandomElement();
|
|
31
|
-
const intervalC = new intervals_1.Interval(
|
|
30
|
+
const intervalC = new intervals_1.Interval('[[-10; 10]]').difference(new discreteSet_1.DiscreteSet([new integer_1.Integer(0), new integer_1.Integer(a.value)]));
|
|
32
31
|
const c = intervalC.getRandomElement();
|
|
33
32
|
const d = interval.getRandomElement();
|
|
34
33
|
const affines = [new affine_1.Affine(a.value, b.value), new affine_1.Affine(c.value, d.value)];
|
|
35
34
|
const solution = new rational_1.Rational(d.value - b.value, a.value - c.value).simplify();
|
|
36
35
|
const statementTree = new equalNode_1.EqualNode(affines[0].toTree(), affines[1].toTree());
|
|
37
|
-
const answerTree = new equalNode_1.EqualNode(new variableNode_1.VariableNode(
|
|
36
|
+
const answerTree = new equalNode_1.EqualNode(new variableNode_1.VariableNode('x'), solution.toTree());
|
|
38
37
|
const question = {
|
|
39
|
-
startStatement:
|
|
40
|
-
answer:
|
|
38
|
+
startStatement: statementTree.toTex(),
|
|
39
|
+
answer: answerTree.toTex(),
|
|
41
40
|
};
|
|
42
41
|
return question;
|
|
43
42
|
}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getFactoType1Question = exports.factoType1Exercise = void 0;
|
|
4
4
|
const affine_1 = require("../../../polynomials/affine");
|
|
5
|
-
const latexParser_1 = require("../../../tree/parsers/latexParser");
|
|
6
5
|
const addNode_1 = require("../../../tree/nodes/operators/addNode");
|
|
7
6
|
const multiplyNode_1 = require("../../../tree/nodes/operators/multiplyNode");
|
|
8
7
|
const substractNode_1 = require("../../../tree/nodes/operators/substractNode");
|
|
@@ -13,26 +12,26 @@ const getDistinctQuestions_1 = require("../../utils/getDistinctQuestions");
|
|
|
13
12
|
* type (ax+b)(cx+d) ± (ax+b)(ex+f)
|
|
14
13
|
*/
|
|
15
14
|
exports.factoType1Exercise = {
|
|
16
|
-
id:
|
|
17
|
-
connector:
|
|
18
|
-
instruction:
|
|
15
|
+
id: 'facto1',
|
|
16
|
+
connector: '=',
|
|
17
|
+
instruction: 'Factoriser :',
|
|
19
18
|
isSingleStep: false,
|
|
20
|
-
label:
|
|
21
|
-
levels: [
|
|
22
|
-
section:
|
|
19
|
+
label: 'Factorisation du type $(ax+b)(cx+d) \\pm (ax+b)(ex+f)$',
|
|
20
|
+
levels: ['3', '2'],
|
|
21
|
+
section: 'Calcul littéral',
|
|
23
22
|
generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getFactoType1Question, nb),
|
|
24
23
|
};
|
|
25
24
|
function getFactoType1Question() {
|
|
26
25
|
const affines = affine_1.AffineConstructor.differentRandoms(3);
|
|
27
26
|
const permut = [(0, shuffle_1.shuffle)([affines[0], affines[1]]), (0, shuffle_1.shuffle)([affines[0], affines[2]])];
|
|
28
|
-
const operation = (0, random_1.random)([
|
|
29
|
-
const statementTree = operation ===
|
|
27
|
+
const operation = (0, random_1.random)(['add', 'substract']);
|
|
28
|
+
const statementTree = operation === 'add'
|
|
30
29
|
? 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()))
|
|
31
30
|
: 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()));
|
|
32
|
-
const answerTree = new multiplyNode_1.MultiplyNode(affines[0].toTree(), affines[1].add(operation ===
|
|
31
|
+
const answerTree = new multiplyNode_1.MultiplyNode(affines[0].toTree(), affines[1].add(operation === 'add' ? affines[2] : affines[2].opposite()).toTree());
|
|
33
32
|
const question = {
|
|
34
|
-
startStatement:
|
|
35
|
-
answer:
|
|
33
|
+
startStatement: statementTree.toTex(),
|
|
34
|
+
answer: answerTree.toTex(),
|
|
36
35
|
};
|
|
37
36
|
return question;
|
|
38
37
|
}
|
|
@@ -21,7 +21,7 @@ function getMidpointQuestion() {
|
|
|
21
21
|
const B = new point_1.Point('B', new numberNode_1.NumberNode(coords2[0]), new numberNode_1.NumberNode(coords2[1]));
|
|
22
22
|
const question = {
|
|
23
23
|
instruction: `Soit $${A.toTexWithCoords()}$ et $${B.toTexWithCoords()}$. Quelles sont les coordonnées du milieu $I$ de $[AB]$ ?`,
|
|
24
|
-
startStatement:
|
|
24
|
+
startStatement: 'I',
|
|
25
25
|
answer: A.midpoint(B).toTexWithCoords(),
|
|
26
26
|
};
|
|
27
27
|
return question;
|
|
@@ -4,26 +4,25 @@ exports.getScalarProductViaCoordsQuestion = exports.scalarProductViaCoords = voi
|
|
|
4
4
|
const vector_1 = require("../../../geometry/vector");
|
|
5
5
|
const randTupleInt_1 = require("../../../mathutils/random/randTupleInt");
|
|
6
6
|
const numberNode_1 = require("../../../tree/nodes/numbers/numberNode");
|
|
7
|
-
const latexParser_1 = require("../../../tree/parsers/latexParser");
|
|
8
7
|
const getDistinctQuestions_1 = require("../../utils/getDistinctQuestions");
|
|
9
8
|
exports.scalarProductViaCoords = {
|
|
10
9
|
id: 'scalarProductViaCoords',
|
|
11
|
-
connector:
|
|
12
|
-
instruction:
|
|
10
|
+
connector: '=',
|
|
11
|
+
instruction: '',
|
|
13
12
|
isSingleStep: false,
|
|
14
13
|
label: "Calculer un produit scalaire à l'aide des coordonnées",
|
|
15
|
-
levels: [
|
|
16
|
-
section:
|
|
17
|
-
generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getScalarProductViaCoordsQuestion, nb)
|
|
14
|
+
levels: ['1, 0'],
|
|
15
|
+
section: 'Vecteurs',
|
|
16
|
+
generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getScalarProductViaCoordsQuestion, nb),
|
|
18
17
|
};
|
|
19
18
|
function getScalarProductViaCoordsQuestion() {
|
|
20
19
|
const [coords1, coords2] = (0, randTupleInt_1.distinctRandTupleInt)(2, 2, { from: -9, to: 10 });
|
|
21
|
-
const u = new vector_1.Vector(
|
|
22
|
-
const v = new vector_1.Vector(
|
|
20
|
+
const u = new vector_1.Vector('u', new numberNode_1.NumberNode(coords1[0]), new numberNode_1.NumberNode(coords1[1]));
|
|
21
|
+
const v = new vector_1.Vector('v', new numberNode_1.NumberNode(coords2[0]), new numberNode_1.NumberNode(coords2[1]));
|
|
23
22
|
return {
|
|
24
|
-
instruction: `Soit
|
|
23
|
+
instruction: `Soit $${u.toTexWithCoords()}$ et $${v.toTexWithCoords()}$. Calculer $${u.toTex()}\\cdot ${v.toTex()}$.`,
|
|
25
24
|
startStatement: `${u.toTex()}\\cdot ${v.toTex()}`,
|
|
26
|
-
answer:
|
|
25
|
+
answer: u.scalarProduct(v).toTex(),
|
|
27
26
|
};
|
|
28
27
|
}
|
|
29
28
|
exports.getScalarProductViaCoordsQuestion = getScalarProductViaCoordsQuestion;
|
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getPowersDivisionQuestion = exports.powersOfTenDivision = exports.powersDivision = void 0;
|
|
4
4
|
const randint_1 = require("../../mathutils/random/randint");
|
|
5
5
|
const power_1 = require("../../numbers/integer/power");
|
|
6
|
-
const latexParser_1 = require("../../tree/parsers/latexParser");
|
|
7
6
|
const numberNode_1 = require("../../tree/nodes/numbers/numberNode");
|
|
8
7
|
const fractionNode_1 = require("../../tree/nodes/operators/fractionNode");
|
|
9
8
|
const powerNode_1 = require("../../tree/nodes/operators/powerNode");
|
|
@@ -12,22 +11,22 @@ const getDistinctQuestions_1 = require("../utils/getDistinctQuestions");
|
|
|
12
11
|
* a^b/a^c
|
|
13
12
|
*/
|
|
14
13
|
exports.powersDivision = {
|
|
15
|
-
id:
|
|
16
|
-
connector:
|
|
17
|
-
instruction:
|
|
18
|
-
label:
|
|
19
|
-
levels: [
|
|
20
|
-
section:
|
|
14
|
+
id: 'powersDivision',
|
|
15
|
+
connector: '=',
|
|
16
|
+
instruction: 'Calculer :',
|
|
17
|
+
label: 'Division de puissances',
|
|
18
|
+
levels: ['4', '3', '2', '1'],
|
|
19
|
+
section: 'Puissances',
|
|
21
20
|
isSingleStep: true,
|
|
22
21
|
generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getPowersDivisionQuestion, nb),
|
|
23
22
|
};
|
|
24
23
|
exports.powersOfTenDivision = {
|
|
25
|
-
id:
|
|
26
|
-
connector:
|
|
27
|
-
instruction:
|
|
28
|
-
label:
|
|
29
|
-
levels: [
|
|
30
|
-
section:
|
|
24
|
+
id: 'powersOfTenDivision',
|
|
25
|
+
connector: '=',
|
|
26
|
+
instruction: 'Calculer :',
|
|
27
|
+
label: 'Division de puissances de 10',
|
|
28
|
+
levels: ['4', '3', '2', '1'],
|
|
29
|
+
section: 'Puissances',
|
|
31
30
|
isSingleStep: true,
|
|
32
31
|
generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(() => getPowersDivisionQuestion(true), nb),
|
|
33
32
|
};
|
|
@@ -37,8 +36,8 @@ function getPowersDivisionQuestion(useOnlyPowersOfTen = false) {
|
|
|
37
36
|
const statement = new fractionNode_1.FractionNode(new powerNode_1.PowerNode(new numberNode_1.NumberNode(a), new numberNode_1.NumberNode(b)), new powerNode_1.PowerNode(new numberNode_1.NumberNode(a), new numberNode_1.NumberNode(c)));
|
|
38
37
|
const answerTree = new power_1.Power(a, b - c).simplify();
|
|
39
38
|
const question = {
|
|
40
|
-
startStatement:
|
|
41
|
-
answer:
|
|
39
|
+
startStatement: statement.toTex(),
|
|
40
|
+
answer: answerTree.toTex(),
|
|
42
41
|
};
|
|
43
42
|
return question;
|
|
44
43
|
}
|
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getPowersOfTenDivisionQuestion = exports.powersOfTenToDecimal = void 0;
|
|
4
4
|
const randint_1 = require("../../mathutils/random/randint");
|
|
5
5
|
const power_1 = require("../../numbers/integer/power");
|
|
6
|
-
const latexParser_1 = require("../../tree/parsers/latexParser");
|
|
7
6
|
const numberNode_1 = require("../../tree/nodes/numbers/numberNode");
|
|
8
7
|
const powerNode_1 = require("../../tree/nodes/operators/powerNode");
|
|
9
8
|
const getDistinctQuestions_1 = require("../utils/getDistinctQuestions");
|
|
@@ -11,12 +10,12 @@ const getDistinctQuestions_1 = require("../utils/getDistinctQuestions");
|
|
|
11
10
|
* 10^(-x) into 0,0...1
|
|
12
11
|
*/
|
|
13
12
|
exports.powersOfTenToDecimal = {
|
|
14
|
-
id:
|
|
15
|
-
connector:
|
|
13
|
+
id: 'powersOfTenToDecimal',
|
|
14
|
+
connector: '=',
|
|
16
15
|
instruction: "Donner l'écriture décimale de :",
|
|
17
16
|
label: "Ecriture décimale d'une puissance de 10",
|
|
18
|
-
levels: [
|
|
19
|
-
section:
|
|
17
|
+
levels: ['5', '4', '3', '2'],
|
|
18
|
+
section: 'Puissances',
|
|
20
19
|
isSingleStep: true,
|
|
21
20
|
generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getPowersOfTenDivisionQuestion, nb),
|
|
22
21
|
};
|
|
@@ -25,8 +24,8 @@ function getPowersOfTenDivisionQuestion() {
|
|
|
25
24
|
const statement = new powerNode_1.PowerNode(new numberNode_1.NumberNode(10), new numberNode_1.NumberNode(randPower));
|
|
26
25
|
const answerTree = new power_1.Power(10, randPower).toDecimalWriting().toTree();
|
|
27
26
|
const question = {
|
|
28
|
-
startStatement:
|
|
29
|
-
answer:
|
|
27
|
+
startStatement: statement.toTex(),
|
|
28
|
+
answer: answerTree.toTex(),
|
|
30
29
|
};
|
|
31
30
|
return question;
|
|
32
31
|
}
|
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getPowersPowerQuestion = exports.powersPower = exports.powersOfTenPower = void 0;
|
|
4
4
|
const randint_1 = require("../../mathutils/random/randint");
|
|
5
5
|
const power_1 = require("../../numbers/integer/power");
|
|
6
|
-
const latexParser_1 = require("../../tree/parsers/latexParser");
|
|
7
6
|
const numberNode_1 = require("../../tree/nodes/numbers/numberNode");
|
|
8
7
|
const powerNode_1 = require("../../tree/nodes/operators/powerNode");
|
|
9
8
|
const getDistinctQuestions_1 = require("../utils/getDistinctQuestions");
|
|
@@ -11,22 +10,22 @@ const getDistinctQuestions_1 = require("../utils/getDistinctQuestions");
|
|
|
11
10
|
* (a^b)^c
|
|
12
11
|
*/
|
|
13
12
|
exports.powersOfTenPower = {
|
|
14
|
-
id:
|
|
15
|
-
connector:
|
|
16
|
-
instruction:
|
|
13
|
+
id: 'powersOfTenPower',
|
|
14
|
+
connector: '=',
|
|
15
|
+
instruction: 'Calculer :',
|
|
17
16
|
label: "Puissance d'une puissance de 10 ",
|
|
18
|
-
levels: [
|
|
19
|
-
section:
|
|
17
|
+
levels: ['4', '3', '2', '1'],
|
|
18
|
+
section: 'Puissances',
|
|
20
19
|
isSingleStep: true,
|
|
21
20
|
generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(() => getPowersPowerQuestion(true), nb),
|
|
22
21
|
};
|
|
23
22
|
exports.powersPower = {
|
|
24
|
-
id:
|
|
25
|
-
connector:
|
|
26
|
-
instruction:
|
|
23
|
+
id: 'powersPower',
|
|
24
|
+
connector: '=',
|
|
25
|
+
instruction: 'Calculer :',
|
|
27
26
|
label: "Puissance d'une puissance",
|
|
28
|
-
levels: [
|
|
29
|
-
section:
|
|
27
|
+
levels: ['4', '3', '2', '1'],
|
|
28
|
+
section: 'Puissances',
|
|
30
29
|
isSingleStep: true,
|
|
31
30
|
generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getPowersPowerQuestion, nb),
|
|
32
31
|
};
|
|
@@ -36,8 +35,8 @@ function getPowersPowerQuestion(useOnlyPowersOfTen = false) {
|
|
|
36
35
|
const statement = new powerNode_1.PowerNode(new powerNode_1.PowerNode(new numberNode_1.NumberNode(a), new numberNode_1.NumberNode(b)), new numberNode_1.NumberNode(c));
|
|
37
36
|
let answerTree = new power_1.Power(a, b * c).simplify();
|
|
38
37
|
const question = {
|
|
39
|
-
startStatement:
|
|
40
|
-
answer:
|
|
38
|
+
startStatement: statement.toTex(),
|
|
39
|
+
answer: answerTree.toTex(),
|
|
41
40
|
};
|
|
42
41
|
return question;
|
|
43
42
|
}
|
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getPowersProductQuestion = exports.powersProduct = exports.powersOfTenProduct = void 0;
|
|
4
4
|
const randint_1 = require("../../mathutils/random/randint");
|
|
5
5
|
const power_1 = require("../../numbers/integer/power");
|
|
6
|
-
const latexParser_1 = require("../../tree/parsers/latexParser");
|
|
7
6
|
const numberNode_1 = require("../../tree/nodes/numbers/numberNode");
|
|
8
7
|
const multiplyNode_1 = require("../../tree/nodes/operators/multiplyNode");
|
|
9
8
|
const powerNode_1 = require("../../tree/nodes/operators/powerNode");
|
|
@@ -12,22 +11,22 @@ const getDistinctQuestions_1 = require("../utils/getDistinctQuestions");
|
|
|
12
11
|
* a^b*a^c
|
|
13
12
|
*/
|
|
14
13
|
exports.powersOfTenProduct = {
|
|
15
|
-
id:
|
|
16
|
-
connector:
|
|
17
|
-
instruction:
|
|
18
|
-
label:
|
|
19
|
-
levels: [
|
|
20
|
-
section:
|
|
14
|
+
id: 'powersOfTenProduct',
|
|
15
|
+
connector: '=',
|
|
16
|
+
instruction: 'Calculer :',
|
|
17
|
+
label: 'Multiplication de puissances de 10',
|
|
18
|
+
levels: ['4', '3', '2', '1'],
|
|
19
|
+
section: 'Puissances',
|
|
21
20
|
isSingleStep: true,
|
|
22
21
|
generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(() => getPowersProductQuestion(true), nb),
|
|
23
22
|
};
|
|
24
23
|
exports.powersProduct = {
|
|
25
|
-
id:
|
|
26
|
-
connector:
|
|
27
|
-
instruction:
|
|
28
|
-
label:
|
|
29
|
-
levels: [
|
|
30
|
-
section:
|
|
24
|
+
id: 'powersProduct',
|
|
25
|
+
connector: '=',
|
|
26
|
+
instruction: 'Calculer :',
|
|
27
|
+
label: 'Multiplication de puissances',
|
|
28
|
+
levels: ['4', '3', '2', '1'],
|
|
29
|
+
section: 'Puissances',
|
|
31
30
|
isSingleStep: true,
|
|
32
31
|
generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getPowersProductQuestion, nb),
|
|
33
32
|
};
|
|
@@ -37,8 +36,8 @@ function getPowersProductQuestion(useOnlyPowersOfTen = false) {
|
|
|
37
36
|
const statement = new multiplyNode_1.MultiplyNode(new powerNode_1.PowerNode(new numberNode_1.NumberNode(a), new numberNode_1.NumberNode(b)), new powerNode_1.PowerNode(new numberNode_1.NumberNode(a), new numberNode_1.NumberNode(c)));
|
|
38
37
|
const answerTree = new power_1.Power(a, b + c).simplify();
|
|
39
38
|
const question = {
|
|
40
|
-
startStatement:
|
|
41
|
-
answer:
|
|
39
|
+
startStatement: statement.toTex(),
|
|
40
|
+
answer: answerTree.toTex(),
|
|
42
41
|
};
|
|
43
42
|
return question;
|
|
44
43
|
}
|