math-exercises 1.3.5 → 1.3.6
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/calcul/addAndSub.js +3 -3
- package/lib/exercises/calcul/fractions/fractionAndIntegerDivision.js +6 -6
- package/lib/exercises/calcul/fractions/fractionAndIntegerProduct.js +5 -5
- package/lib/exercises/calcul/fractions/fractionAndIntegerSum.js +5 -5
- package/lib/exercises/calcul/fractions/fractionsDivision.js +3 -3
- package/lib/exercises/calcul/fractions/fractionsProduct.js +3 -3
- package/lib/exercises/calcul/fractions/fractionsSum.js +3 -3
- package/lib/exercises/calcul/fractions/simplifyFraction.js +2 -2
- package/lib/exercises/calcul/operations/operationsPriorities.js +7 -7
- package/lib/exercises/calcul/rounding/rounding.js +3 -3
- package/lib/exercises/calculLitteral/distributivity/allIdentities.js +2 -2
- package/lib/exercises/calculLitteral/distributivity/doubleDistributivity.js +6 -6
- package/lib/exercises/calculLitteral/distributivity/firstIdentity.js +7 -7
- package/lib/exercises/calculLitteral/distributivity/secondIdentity.js +7 -7
- package/lib/exercises/calculLitteral/distributivity/simpleDistributivity.js +7 -7
- package/lib/exercises/calculLitteral/distributivity/thirdIdentity.js +6 -6
- package/lib/exercises/calculLitteral/equation/equationType1Exercise.js +6 -6
- package/lib/exercises/calculLitteral/equation/equationType2Exercise.js +8 -8
- package/lib/exercises/calculLitteral/equation/equationType3Exercise.js +8 -8
- package/lib/exercises/calculLitteral/equation/equationType4Exercise.js +8 -8
- package/lib/exercises/calculLitteral/factorisation/factoType1Exercise.js +7 -7
- package/lib/exercises/geometry/cartesian/midpoint.js +4 -4
- package/lib/exercises/geometry/vectors/scalarProductViaCoords.js +4 -4
- package/lib/exercises/powers/powersDivision.js +5 -5
- package/lib/exercises/powers/powersOfTenToDecimal.js +4 -4
- package/lib/exercises/powers/powersPower.js +4 -4
- package/lib/exercises/powers/powersProduct.js +5 -5
- package/lib/exercises/powers/scientificToDecimal.js +6 -6
- package/lib/exercises/sequences/geometric/geometricExplicitFormulaUsage.js +3 -3
- package/lib/exercises/sequences/geometric/geometricFindReason.js +3 -3
- package/lib/exercises/squareRoots/simpifySquareRoot.js +1 -1
- package/lib/exercises/trigonometry/mainRemarkableValues.js +2 -2
- package/lib/exercises/trigonometry/remarkableValues.js +2 -2
- package/lib/index.js +1 -0
- package/lib/math/geometry/point.js +4 -4
- package/lib/math/geometry/vector.js +4 -4
- package/lib/math/numbers/decimals/decimal.js +17 -17
- package/lib/math/numbers/integer/integer.js +9 -9
- package/lib/math/numbers/integer/power.js +8 -8
- package/lib/math/numbers/rationals/rational.js +12 -12
- package/lib/math/numbers/reals/real.js +1 -1
- package/lib/math/numbers/reals/squareRoot.js +8 -8
- package/lib/math/polynomials/affine.js +4 -4
- package/lib/math/sequences/sequence.js +0 -2
- package/lib/math/sets/discreteSet.js +4 -4
- package/lib/math/sets/intervals/intervals.js +5 -5
- package/lib/math/trigonometry/remarkableValue.js +7 -7
- package/lib/math/trigonometry/remarkableValues.js +6 -6
- package/lib/math/utils/random/randTupleInt.js +2 -2
- package/package.json +8 -2
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getAddAndSubQuestions = exports.addAndSubExercise = void 0;
|
|
4
|
-
const randint_1 = require("
|
|
5
|
-
const numberNode_1 = require("
|
|
6
|
-
const addNode_1 = require("
|
|
4
|
+
const randint_1 = require("#root/math/utils/random/randint");
|
|
5
|
+
const numberNode_1 = require("#root/tree/nodes/numbers/numberNode");
|
|
6
|
+
const addNode_1 = require("#root/tree/nodes/operators/addNode");
|
|
7
7
|
const getDistinctQuestions_1 = require("../utils/getDistinctQuestions");
|
|
8
8
|
/**
|
|
9
9
|
* a±b±c±d
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getFractionAndIntegerDivision = exports.fractionAndIntegerDivision = void 0;
|
|
4
|
-
const getDistinctQuestions_1 = require("
|
|
5
|
-
const integer_1 = require("
|
|
6
|
-
const rational_1 = require("
|
|
7
|
-
const randint_1 = require("
|
|
8
|
-
const divideNode_1 = require("
|
|
9
|
-
const coinFlip_1 = require("
|
|
4
|
+
const getDistinctQuestions_1 = require("#root/exercises/utils/getDistinctQuestions");
|
|
5
|
+
const integer_1 = require("#root/math/numbers/integer/integer");
|
|
6
|
+
const rational_1 = require("#root/math/numbers/rationals/rational");
|
|
7
|
+
const randint_1 = require("#root/math/utils/random/randint");
|
|
8
|
+
const divideNode_1 = require("#root/tree/nodes/operators/divideNode");
|
|
9
|
+
const coinFlip_1 = require("#root/utils/coinFlip");
|
|
10
10
|
exports.fractionAndIntegerDivision = {
|
|
11
11
|
id: 'fractionAndIntegerDivision',
|
|
12
12
|
connector: '=',
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getFractionAndIntegerProduct = exports.fractionAndIntegerProduct = void 0;
|
|
4
|
-
const getDistinctQuestions_1 = require("
|
|
5
|
-
const integer_1 = require("
|
|
6
|
-
const rational_1 = require("
|
|
7
|
-
const randint_1 = require("
|
|
8
|
-
const multiplyNode_1 = require("
|
|
4
|
+
const getDistinctQuestions_1 = require("#root/exercises/utils/getDistinctQuestions");
|
|
5
|
+
const integer_1 = require("#root/math/numbers/integer/integer");
|
|
6
|
+
const rational_1 = require("#root/math/numbers/rationals/rational");
|
|
7
|
+
const randint_1 = require("#root/math/utils/random/randint");
|
|
8
|
+
const multiplyNode_1 = require("#root/tree/nodes/operators/multiplyNode");
|
|
9
9
|
exports.fractionAndIntegerProduct = {
|
|
10
10
|
id: 'fractionAndIntegerProduct',
|
|
11
11
|
connector: '=',
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getFractionAndIntegerSum = exports.fractionAndIntegerSum = void 0;
|
|
4
|
-
const getDistinctQuestions_1 = require("
|
|
5
|
-
const integer_1 = require("
|
|
6
|
-
const rational_1 = require("
|
|
7
|
-
const randint_1 = require("
|
|
8
|
-
const addNode_1 = require("
|
|
4
|
+
const getDistinctQuestions_1 = require("#root/exercises/utils/getDistinctQuestions");
|
|
5
|
+
const integer_1 = require("#root/math/numbers/integer/integer");
|
|
6
|
+
const rational_1 = require("#root/math/numbers/rationals/rational");
|
|
7
|
+
const randint_1 = require("#root/math/utils/random/randint");
|
|
8
|
+
const addNode_1 = require("#root/tree/nodes/operators/addNode");
|
|
9
9
|
exports.fractionAndIntegerSum = {
|
|
10
10
|
id: 'fractionAndIntegerSum',
|
|
11
11
|
connector: '=',
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getFractionsDivision = exports.fractionsDivision = void 0;
|
|
4
|
-
const getDistinctQuestions_1 = require("
|
|
5
|
-
const rational_1 = require("
|
|
6
|
-
const divideNode_1 = require("
|
|
4
|
+
const getDistinctQuestions_1 = require("#root/exercises/utils/getDistinctQuestions");
|
|
5
|
+
const rational_1 = require("#root/math/numbers/rationals/rational");
|
|
6
|
+
const divideNode_1 = require("#root/tree/nodes/operators/divideNode");
|
|
7
7
|
exports.fractionsDivision = {
|
|
8
8
|
id: 'fractionsDivision',
|
|
9
9
|
connector: '=',
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getFractionsProduct = exports.fractionsProduct = void 0;
|
|
4
|
-
const getDistinctQuestions_1 = require("
|
|
5
|
-
const rational_1 = require("
|
|
6
|
-
const multiplyNode_1 = require("
|
|
4
|
+
const getDistinctQuestions_1 = require("#root/exercises/utils/getDistinctQuestions");
|
|
5
|
+
const rational_1 = require("#root/math/numbers/rationals/rational");
|
|
6
|
+
const multiplyNode_1 = require("#root/tree/nodes/operators/multiplyNode");
|
|
7
7
|
exports.fractionsProduct = {
|
|
8
8
|
id: 'fractionsProduct',
|
|
9
9
|
connector: '=',
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getFractionsSum = exports.fractionsSum = void 0;
|
|
4
|
-
const getDistinctQuestions_1 = require("
|
|
5
|
-
const rational_1 = require("
|
|
6
|
-
const addNode_1 = require("
|
|
4
|
+
const getDistinctQuestions_1 = require("#root/exercises/utils/getDistinctQuestions");
|
|
5
|
+
const rational_1 = require("#root/math/numbers/rationals/rational");
|
|
6
|
+
const addNode_1 = require("#root/tree/nodes/operators/addNode");
|
|
7
7
|
exports.fractionsSum = {
|
|
8
8
|
id: 'fractionsSum',
|
|
9
9
|
connector: '=',
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getSimplifyFraction = exports.simplifyFraction = void 0;
|
|
4
|
-
const getDistinctQuestions_1 = require("
|
|
5
|
-
const rational_1 = require("
|
|
4
|
+
const getDistinctQuestions_1 = require("#root/exercises/utils/getDistinctQuestions");
|
|
5
|
+
const rational_1 = require("#root/math/numbers/rationals/rational");
|
|
6
6
|
exports.simplifyFraction = {
|
|
7
7
|
id: 'simplifyFrac',
|
|
8
8
|
connector: '=',
|
|
@@ -8,13 +8,13 @@
|
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.getPriorityQuestions = exports.operationsPriorities = void 0;
|
|
11
|
-
const getDistinctQuestions_1 = require("
|
|
12
|
-
const randint_1 = require("
|
|
13
|
-
const numberNode_1 = require("
|
|
14
|
-
const addNode_1 = require("
|
|
15
|
-
const divideNode_1 = require("
|
|
16
|
-
const multiplyNode_1 = require("
|
|
17
|
-
const coinFlip_1 = require("
|
|
11
|
+
const getDistinctQuestions_1 = require("#root/exercises/utils/getDistinctQuestions");
|
|
12
|
+
const randint_1 = require("#root/math/utils/random/randint");
|
|
13
|
+
const numberNode_1 = require("#root/tree/nodes/numbers/numberNode");
|
|
14
|
+
const addNode_1 = require("#root/tree/nodes/operators/addNode");
|
|
15
|
+
const divideNode_1 = require("#root/tree/nodes/operators/divideNode");
|
|
16
|
+
const multiplyNode_1 = require("#root/tree/nodes/operators/multiplyNode");
|
|
17
|
+
const coinFlip_1 = require("#root/utils/coinFlip");
|
|
18
18
|
exports.operationsPriorities = {
|
|
19
19
|
id: 'operationsPriorities',
|
|
20
20
|
connector: '=',
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getRoundQuestions = exports.allRoundings = exports.roundToMillieme = exports.roundToCentieme = exports.roundToDixieme = exports.roundToUnit = void 0;
|
|
4
|
-
const getDistinctQuestions_1 = require("
|
|
5
|
-
const decimal_1 = require("
|
|
6
|
-
const randint_1 = require("
|
|
4
|
+
const getDistinctQuestions_1 = require("#root/exercises/utils/getDistinctQuestions");
|
|
5
|
+
const decimal_1 = require("#root/math/numbers/decimals/decimal");
|
|
6
|
+
const randint_1 = require("#root/math/utils/random/randint");
|
|
7
7
|
/**
|
|
8
8
|
* arrondi à l'unité
|
|
9
9
|
*/
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getAllIdentitiesQuestion = exports.allIdentities = void 0;
|
|
4
|
-
const getDistinctQuestions_1 = require("
|
|
5
|
-
const random_1 = require("
|
|
4
|
+
const getDistinctQuestions_1 = require("#root/exercises/utils/getDistinctQuestions");
|
|
5
|
+
const random_1 = require("#root/utils/random");
|
|
6
6
|
const firstIdentity_1 = require("./firstIdentity");
|
|
7
7
|
const secondIdentity_1 = require("./secondIdentity");
|
|
8
8
|
const thirdIdentity_1 = require("./thirdIdentity");
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getDoubleDistributivityQuestion = exports.doubleDistributivity = void 0;
|
|
4
|
-
const getDistinctQuestions_1 = require("
|
|
5
|
-
const integer_1 = require("
|
|
6
|
-
const affine_1 = require("
|
|
7
|
-
const discreteSet_1 = require("
|
|
8
|
-
const intervals_1 = require("
|
|
9
|
-
const multiplyNode_1 = require("
|
|
4
|
+
const getDistinctQuestions_1 = require("#root/exercises/utils/getDistinctQuestions");
|
|
5
|
+
const integer_1 = require("#root/math/numbers/integer/integer");
|
|
6
|
+
const affine_1 = require("#root/math/polynomials/affine");
|
|
7
|
+
const discreteSet_1 = require("#root/math/sets/discreteSet");
|
|
8
|
+
const intervals_1 = require("#root/math/sets/intervals/intervals");
|
|
9
|
+
const multiplyNode_1 = require("#root/tree/nodes/operators/multiplyNode");
|
|
10
10
|
exports.doubleDistributivity = {
|
|
11
11
|
id: 'doubleDistri',
|
|
12
12
|
connector: '=',
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getFirstIdentityQuestion = exports.firstIdentity = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
4
|
+
const getDistinctQuestions_1 = require("#root/exercises/utils/getDistinctQuestions");
|
|
5
|
+
const integer_1 = require("#root/math/numbers/integer/integer");
|
|
6
|
+
const affine_1 = require("#root/math/polynomials/affine");
|
|
7
|
+
const discreteSet_1 = require("#root/math/sets/discreteSet");
|
|
8
|
+
const intervals_1 = require("#root/math/sets/intervals/intervals");
|
|
9
|
+
const numberNode_1 = require("#root/tree/nodes/numbers/numberNode");
|
|
10
|
+
const powerNode_1 = require("#root/tree/nodes/operators/powerNode");
|
|
11
11
|
exports.firstIdentity = {
|
|
12
12
|
id: 'idRmq1',
|
|
13
13
|
connector: '=',
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getSecondIdentityQuestion = exports.secondIdentity = void 0;
|
|
4
|
-
const getDistinctQuestions_1 = require("
|
|
5
|
-
const integer_1 = require("
|
|
6
|
-
const affine_1 = require("
|
|
7
|
-
const discreteSet_1 = require("
|
|
8
|
-
const intervals_1 = require("
|
|
9
|
-
const numberNode_1 = require("
|
|
10
|
-
const powerNode_1 = require("
|
|
4
|
+
const getDistinctQuestions_1 = require("#root/exercises/utils/getDistinctQuestions");
|
|
5
|
+
const integer_1 = require("#root/math/numbers/integer/integer");
|
|
6
|
+
const affine_1 = require("#root/math/polynomials/affine");
|
|
7
|
+
const discreteSet_1 = require("#root/math/sets/discreteSet");
|
|
8
|
+
const intervals_1 = require("#root/math/sets/intervals/intervals");
|
|
9
|
+
const numberNode_1 = require("#root/tree/nodes/numbers/numberNode");
|
|
10
|
+
const powerNode_1 = require("#root/tree/nodes/operators/powerNode");
|
|
11
11
|
exports.secondIdentity = {
|
|
12
12
|
id: 'idRmq2',
|
|
13
13
|
connector: '=',
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getSimpleDistributivityQuestion = exports.simpleDistributivity = void 0;
|
|
4
|
-
const getDistinctQuestions_1 = require("
|
|
5
|
-
const integer_1 = require("
|
|
6
|
-
const affine_1 = require("
|
|
7
|
-
const discreteSet_1 = require("
|
|
8
|
-
const intervals_1 = require("
|
|
9
|
-
const numberNode_1 = require("
|
|
10
|
-
const multiplyNode_1 = require("
|
|
4
|
+
const getDistinctQuestions_1 = require("#root/exercises/utils/getDistinctQuestions");
|
|
5
|
+
const integer_1 = require("#root/math/numbers/integer/integer");
|
|
6
|
+
const affine_1 = require("#root/math/polynomials/affine");
|
|
7
|
+
const discreteSet_1 = require("#root/math/sets/discreteSet");
|
|
8
|
+
const intervals_1 = require("#root/math/sets/intervals/intervals");
|
|
9
|
+
const numberNode_1 = require("#root/tree/nodes/numbers/numberNode");
|
|
10
|
+
const multiplyNode_1 = require("#root/tree/nodes/operators/multiplyNode");
|
|
11
11
|
exports.simpleDistributivity = {
|
|
12
12
|
id: 'simpleDistri',
|
|
13
13
|
connector: '=',
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getThirdIdentityQuestion = exports.thirdIdentity = void 0;
|
|
4
|
-
const getDistinctQuestions_1 = require("
|
|
5
|
-
const integer_1 = require("
|
|
6
|
-
const affine_1 = require("
|
|
7
|
-
const discreteSet_1 = require("
|
|
8
|
-
const intervals_1 = require("
|
|
9
|
-
const multiplyNode_1 = require("
|
|
4
|
+
const getDistinctQuestions_1 = require("#root/exercises/utils/getDistinctQuestions");
|
|
5
|
+
const integer_1 = require("#root/math/numbers/integer/integer");
|
|
6
|
+
const affine_1 = require("#root/math/polynomials/affine");
|
|
7
|
+
const discreteSet_1 = require("#root/math/sets/discreteSet");
|
|
8
|
+
const intervals_1 = require("#root/math/sets/intervals/intervals");
|
|
9
|
+
const multiplyNode_1 = require("#root/tree/nodes/operators/multiplyNode");
|
|
10
10
|
exports.thirdIdentity = {
|
|
11
11
|
id: 'idRmq3',
|
|
12
12
|
connector: '=',
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getEquationType1ExerciseQuestion = exports.equationType1Exercise = void 0;
|
|
4
|
-
const getDistinctQuestions_1 = require("
|
|
5
|
-
const integer_1 = require("
|
|
6
|
-
const affine_1 = require("
|
|
7
|
-
const discreteSet_1 = require("
|
|
8
|
-
const intervals_1 = require("
|
|
9
|
-
const equalNode_1 = require("
|
|
4
|
+
const getDistinctQuestions_1 = require("#root/exercises/utils/getDistinctQuestions");
|
|
5
|
+
const integer_1 = require("#root/math/numbers/integer/integer");
|
|
6
|
+
const affine_1 = require("#root/math/polynomials/affine");
|
|
7
|
+
const discreteSet_1 = require("#root/math/sets/discreteSet");
|
|
8
|
+
const intervals_1 = require("#root/math/sets/intervals/intervals");
|
|
9
|
+
const equalNode_1 = require("#root/tree/nodes/operators/equalNode");
|
|
10
10
|
/**
|
|
11
11
|
* type x+a=b
|
|
12
12
|
*/
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getEquationType2ExerciseQuestion = exports.equationType2Exercise = void 0;
|
|
4
|
-
const getDistinctQuestions_1 = require("
|
|
5
|
-
const integer_1 = require("
|
|
6
|
-
const rational_1 = require("
|
|
7
|
-
const affine_1 = require("
|
|
8
|
-
const discreteSet_1 = require("
|
|
9
|
-
const intervals_1 = require("
|
|
10
|
-
const equalNode_1 = require("
|
|
11
|
-
const variableNode_1 = require("
|
|
4
|
+
const getDistinctQuestions_1 = require("#root/exercises/utils/getDistinctQuestions");
|
|
5
|
+
const integer_1 = require("#root/math/numbers/integer/integer");
|
|
6
|
+
const rational_1 = require("#root/math/numbers/rationals/rational");
|
|
7
|
+
const affine_1 = require("#root/math/polynomials/affine");
|
|
8
|
+
const discreteSet_1 = require("#root/math/sets/discreteSet");
|
|
9
|
+
const intervals_1 = require("#root/math/sets/intervals/intervals");
|
|
10
|
+
const equalNode_1 = require("#root/tree/nodes/operators/equalNode");
|
|
11
|
+
const variableNode_1 = require("#root/tree/nodes/variables/variableNode");
|
|
12
12
|
/**
|
|
13
13
|
* type ax=b
|
|
14
14
|
*/
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getEquationType3ExerciseQuestion = exports.equationType3Exercise = void 0;
|
|
4
|
-
const getDistinctQuestions_1 = require("
|
|
5
|
-
const integer_1 = require("
|
|
6
|
-
const rational_1 = require("
|
|
7
|
-
const affine_1 = require("
|
|
8
|
-
const discreteSet_1 = require("
|
|
9
|
-
const intervals_1 = require("
|
|
10
|
-
const equalNode_1 = require("
|
|
11
|
-
const variableNode_1 = require("
|
|
4
|
+
const getDistinctQuestions_1 = require("#root/exercises/utils/getDistinctQuestions");
|
|
5
|
+
const integer_1 = require("#root/math/numbers/integer/integer");
|
|
6
|
+
const rational_1 = require("#root/math/numbers/rationals/rational");
|
|
7
|
+
const affine_1 = require("#root/math/polynomials/affine");
|
|
8
|
+
const discreteSet_1 = require("#root/math/sets/discreteSet");
|
|
9
|
+
const intervals_1 = require("#root/math/sets/intervals/intervals");
|
|
10
|
+
const equalNode_1 = require("#root/tree/nodes/operators/equalNode");
|
|
11
|
+
const variableNode_1 = require("#root/tree/nodes/variables/variableNode");
|
|
12
12
|
/**
|
|
13
13
|
* type ax+b=c
|
|
14
14
|
*/
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getEquationType4ExerciseQuestion = exports.equationType4Exercise = void 0;
|
|
4
|
-
const getDistinctQuestions_1 = require("
|
|
5
|
-
const integer_1 = require("
|
|
6
|
-
const rational_1 = require("
|
|
7
|
-
const affine_1 = require("
|
|
8
|
-
const discreteSet_1 = require("
|
|
9
|
-
const intervals_1 = require("
|
|
10
|
-
const equalNode_1 = require("
|
|
11
|
-
const variableNode_1 = require("
|
|
4
|
+
const getDistinctQuestions_1 = require("#root/exercises/utils/getDistinctQuestions");
|
|
5
|
+
const integer_1 = require("#root/math/numbers/integer/integer");
|
|
6
|
+
const rational_1 = require("#root/math/numbers/rationals/rational");
|
|
7
|
+
const affine_1 = require("#root/math/polynomials/affine");
|
|
8
|
+
const discreteSet_1 = require("#root/math/sets/discreteSet");
|
|
9
|
+
const intervals_1 = require("#root/math/sets/intervals/intervals");
|
|
10
|
+
const equalNode_1 = require("#root/tree/nodes/operators/equalNode");
|
|
11
|
+
const variableNode_1 = require("#root/tree/nodes/variables/variableNode");
|
|
12
12
|
/**
|
|
13
13
|
* type ax+b=cx+d
|
|
14
14
|
*/
|
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.getFactoType1Question = exports.factoType1Exercise = void 0;
|
|
7
|
-
const getDistinctQuestions_1 = require("
|
|
8
|
-
const affine_1 = require("
|
|
9
|
-
const addNode_1 = require("
|
|
10
|
-
const multiplyNode_1 = require("
|
|
11
|
-
const substractNode_1 = require("
|
|
12
|
-
const random_1 = require("
|
|
13
|
-
const shuffle_1 = require("
|
|
7
|
+
const getDistinctQuestions_1 = require("#root/exercises/utils/getDistinctQuestions");
|
|
8
|
+
const affine_1 = require("#root/math/polynomials/affine");
|
|
9
|
+
const addNode_1 = require("#root/tree/nodes/operators/addNode");
|
|
10
|
+
const multiplyNode_1 = require("#root/tree/nodes/operators/multiplyNode");
|
|
11
|
+
const substractNode_1 = require("#root/tree/nodes/operators/substractNode");
|
|
12
|
+
const random_1 = require("#root/utils/random");
|
|
13
|
+
const shuffle_1 = require("#root/utils/shuffle");
|
|
14
14
|
exports.factoType1Exercise = {
|
|
15
15
|
id: 'facto1',
|
|
16
16
|
connector: '=',
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getMidpointQuestion = exports.midpoint = void 0;
|
|
4
|
-
const getDistinctQuestions_1 = require("
|
|
5
|
-
const point_1 = require("
|
|
6
|
-
const randTupleInt_1 = require("
|
|
7
|
-
const numberNode_1 = require("
|
|
4
|
+
const getDistinctQuestions_1 = require("#root/exercises/utils/getDistinctQuestions");
|
|
5
|
+
const point_1 = require("#root/math/geometry/point");
|
|
6
|
+
const randTupleInt_1 = require("#root/math/utils/random/randTupleInt");
|
|
7
|
+
const numberNode_1 = require("#root/tree/nodes/numbers/numberNode");
|
|
8
8
|
exports.midpoint = {
|
|
9
9
|
id: 'midpoint',
|
|
10
10
|
connector: '=',
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getScalarProductViaCoordsQuestion = exports.scalarProductViaCoords = void 0;
|
|
4
|
-
const getDistinctQuestions_1 = require("
|
|
5
|
-
const vector_1 = require("
|
|
6
|
-
const randTupleInt_1 = require("
|
|
7
|
-
const numberNode_1 = require("
|
|
4
|
+
const getDistinctQuestions_1 = require("#root/exercises/utils/getDistinctQuestions");
|
|
5
|
+
const vector_1 = require("#root/math/geometry/vector");
|
|
6
|
+
const randTupleInt_1 = require("#root/math/utils/random/randTupleInt");
|
|
7
|
+
const numberNode_1 = require("#root/tree/nodes/numbers/numberNode");
|
|
8
8
|
exports.scalarProductViaCoords = {
|
|
9
9
|
id: 'scalarProductViaCoords',
|
|
10
10
|
connector: '=',
|
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.getPowersDivisionQuestion = exports.powersOfTenDivision = exports.powersDivision = void 0;
|
|
7
|
-
const power_1 = require("
|
|
8
|
-
const randint_1 = require("
|
|
9
|
-
const numberNode_1 = require("
|
|
10
|
-
const fractionNode_1 = require("
|
|
11
|
-
const powerNode_1 = require("
|
|
7
|
+
const power_1 = require("#root/math/numbers/integer/power");
|
|
8
|
+
const randint_1 = require("#root/math/utils/random/randint");
|
|
9
|
+
const numberNode_1 = require("#root/tree/nodes/numbers/numberNode");
|
|
10
|
+
const fractionNode_1 = require("#root/tree/nodes/operators/fractionNode");
|
|
11
|
+
const powerNode_1 = require("#root/tree/nodes/operators/powerNode");
|
|
12
12
|
const getDistinctQuestions_1 = require("../utils/getDistinctQuestions");
|
|
13
13
|
exports.powersDivision = {
|
|
14
14
|
id: 'powersDivision',
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.getPowersOfTenDivisionQuestion = exports.powersOfTenToDecimal = void 0;
|
|
7
|
-
const power_1 = require("
|
|
8
|
-
const randint_1 = require("
|
|
9
|
-
const numberNode_1 = require("
|
|
10
|
-
const powerNode_1 = require("
|
|
7
|
+
const power_1 = require("#root/math/numbers/integer/power");
|
|
8
|
+
const randint_1 = require("#root/math/utils/random/randint");
|
|
9
|
+
const numberNode_1 = require("#root/tree/nodes/numbers/numberNode");
|
|
10
|
+
const powerNode_1 = require("#root/tree/nodes/operators/powerNode");
|
|
11
11
|
const getDistinctQuestions_1 = require("../utils/getDistinctQuestions");
|
|
12
12
|
exports.powersOfTenToDecimal = {
|
|
13
13
|
id: 'powersOfTenToDecimal',
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.getPowersPowerQuestion = exports.powersPower = exports.powersOfTenPower = void 0;
|
|
7
|
-
const power_1 = require("
|
|
8
|
-
const randint_1 = require("
|
|
9
|
-
const numberNode_1 = require("
|
|
10
|
-
const powerNode_1 = require("
|
|
7
|
+
const power_1 = require("#root/math/numbers/integer/power");
|
|
8
|
+
const randint_1 = require("#root/math/utils/random/randint");
|
|
9
|
+
const numberNode_1 = require("#root/tree/nodes/numbers/numberNode");
|
|
10
|
+
const powerNode_1 = require("#root/tree/nodes/operators/powerNode");
|
|
11
11
|
const getDistinctQuestions_1 = require("../utils/getDistinctQuestions");
|
|
12
12
|
exports.powersOfTenPower = {
|
|
13
13
|
id: 'powersOfTenPower',
|
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.getPowersProductQuestion = exports.powersProduct = exports.powersOfTenProduct = void 0;
|
|
7
|
-
const power_1 = require("
|
|
8
|
-
const randint_1 = require("
|
|
9
|
-
const numberNode_1 = require("
|
|
10
|
-
const multiplyNode_1 = require("
|
|
11
|
-
const powerNode_1 = require("
|
|
7
|
+
const power_1 = require("#root/math/numbers/integer/power");
|
|
8
|
+
const randint_1 = require("#root/math/utils/random/randint");
|
|
9
|
+
const numberNode_1 = require("#root/tree/nodes/numbers/numberNode");
|
|
10
|
+
const multiplyNode_1 = require("#root/tree/nodes/operators/multiplyNode");
|
|
11
|
+
const powerNode_1 = require("#root/tree/nodes/operators/powerNode");
|
|
12
12
|
const getDistinctQuestions_1 = require("../utils/getDistinctQuestions");
|
|
13
13
|
exports.powersOfTenProduct = {
|
|
14
14
|
id: 'powersOfTenProduct',
|
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
* */
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.getScientificToDecimalQuestion = exports.scientificToDecimal = void 0;
|
|
7
|
-
const decimal_1 = require("
|
|
8
|
-
const integer_1 = require("
|
|
9
|
-
const randint_1 = require("
|
|
10
|
-
const numberNode_1 = require("
|
|
11
|
-
const multiplyNode_1 = require("
|
|
12
|
-
const powerNode_1 = require("
|
|
7
|
+
const decimal_1 = require("#root/math/numbers/decimals/decimal");
|
|
8
|
+
const integer_1 = require("#root/math/numbers/integer/integer");
|
|
9
|
+
const randint_1 = require("#root/math/utils/random/randint");
|
|
10
|
+
const numberNode_1 = require("#root/tree/nodes/numbers/numberNode");
|
|
11
|
+
const multiplyNode_1 = require("#root/tree/nodes/operators/multiplyNode");
|
|
12
|
+
const powerNode_1 = require("#root/tree/nodes/operators/powerNode");
|
|
13
13
|
const getDistinctQuestions_1 = require("../utils/getDistinctQuestions");
|
|
14
14
|
exports.scientificToDecimal = {
|
|
15
15
|
id: 'scientificToDecimal',
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
// import { Exercise, Question } from "
|
|
3
|
-
// import { getDistinctQuestions } from "
|
|
4
|
-
// import { randint } from "
|
|
2
|
+
// import { Exercise, Question } from "#root/exercises/exercise";
|
|
3
|
+
// import { getDistinctQuestions } from "#root/exercises/utils/getDistinctQuestions";
|
|
4
|
+
// import { randint } from "#root/math/utils/random/randint";
|
|
5
5
|
// export const geometricExplicitFormulaUsage: Exercise = {
|
|
6
6
|
// id: 'geometricExplicitFormulaUsage',
|
|
7
7
|
// connector: '=',
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
// import { Exercise, Question } from "
|
|
3
|
-
// import { getDistinctQuestions } from "
|
|
4
|
-
// import { randint } from "
|
|
2
|
+
// import { Exercise, Question } from "#root/exercises/exercise";
|
|
3
|
+
// import { getDistinctQuestions } from "#root/exercises/utils/getDistinctQuestions";
|
|
4
|
+
// import { randint } from "#root/math/utils/random/randint";
|
|
5
5
|
// export const geometricFindReason: Exercise = {
|
|
6
6
|
// id: 'geometricFindReason',
|
|
7
7
|
// connector: '=',
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getSimplifySquareRoot = exports.simplifySquareRoot = void 0;
|
|
4
|
-
const squareRoot_1 = require("
|
|
4
|
+
const squareRoot_1 = require("#root/math/numbers/reals/squareRoot");
|
|
5
5
|
const getDistinctQuestions_1 = require("../utils/getDistinctQuestions");
|
|
6
6
|
exports.simplifySquareRoot = {
|
|
7
7
|
id: 'simplifySqrt',
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getMainRemarkableValues = exports.mainRemarkableValuesExercise = void 0;
|
|
4
|
-
const remarkableValue_1 = require("
|
|
5
|
-
const coinFlip_1 = require("
|
|
4
|
+
const remarkableValue_1 = require("#root/math/trigonometry/remarkableValue");
|
|
5
|
+
const coinFlip_1 = require("#root/utils/coinFlip");
|
|
6
6
|
const getDistinctQuestions_1 = require("../utils/getDistinctQuestions");
|
|
7
7
|
exports.mainRemarkableValuesExercise = {
|
|
8
8
|
id: 'mainRemarkableValues',
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getRemarkableValues = exports.remarkableValuesExercise = void 0;
|
|
4
|
-
const remarkableValue_1 = require("
|
|
5
|
-
const coinFlip_1 = require("
|
|
4
|
+
const remarkableValue_1 = require("#root/math/trigonometry/remarkableValue");
|
|
5
|
+
const coinFlip_1 = require("#root/utils/coinFlip");
|
|
6
6
|
const getDistinctQuestions_1 = require("../utils/getDistinctQuestions");
|
|
7
7
|
exports.remarkableValuesExercise = {
|
|
8
8
|
id: 'remarkableValues',
|
package/lib/index.js
CHANGED
|
@@ -4,3 +4,4 @@ exports.exercises = void 0;
|
|
|
4
4
|
const exercises_1 = require("./exercises/exercises");
|
|
5
5
|
Object.defineProperty(exports, "exercises", { enumerable: true, get: function () { return exercises_1.exercises; } });
|
|
6
6
|
exercises_1.exercises.forEach((exo) => console.log(exo.generator(10)));
|
|
7
|
+
console.log('erger');
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Point = exports.PointConstructor = void 0;
|
|
4
|
-
const numberNode_1 = require("
|
|
5
|
-
const addNode_1 = require("
|
|
6
|
-
const fractionNode_1 = require("
|
|
7
|
-
const simplify_1 = require("
|
|
4
|
+
const numberNode_1 = require("#root/tree/nodes/numbers/numberNode");
|
|
5
|
+
const addNode_1 = require("#root/tree/nodes/operators/addNode");
|
|
6
|
+
const fractionNode_1 = require("#root/tree/nodes/operators/fractionNode");
|
|
7
|
+
const simplify_1 = require("#root/tree/parsers/simplify");
|
|
8
8
|
class PointConstructor {
|
|
9
9
|
}
|
|
10
10
|
exports.PointConstructor = PointConstructor;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Vector = exports.VectorConstructor = void 0;
|
|
4
|
-
const addNode_1 = require("
|
|
5
|
-
const multiplyNode_1 = require("
|
|
6
|
-
const substractNode_1 = require("
|
|
7
|
-
const simplify_1 = require("
|
|
4
|
+
const addNode_1 = require("#root/tree/nodes/operators/addNode");
|
|
5
|
+
const multiplyNode_1 = require("#root/tree/nodes/operators/multiplyNode");
|
|
6
|
+
const substractNode_1 = require("#root/tree/nodes/operators/substractNode");
|
|
7
|
+
const simplify_1 = require("#root/tree/parsers/simplify");
|
|
8
8
|
class VectorConstructor {
|
|
9
9
|
static fromPoints(origin, end) {
|
|
10
10
|
return new Vector(`${origin.name}${end.name}`, new substractNode_1.SubstractNode(end.x, origin.x), new substractNode_1.SubstractNode(end.y, origin.y));
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Decimal = exports.DecimalConstructor = void 0;
|
|
4
|
-
const randint_1 = require("
|
|
5
|
-
const numberNode_1 = require("
|
|
4
|
+
const randint_1 = require("#root/math/utils/random/randint");
|
|
5
|
+
const numberNode_1 = require("#root/tree/nodes/numbers/numberNode");
|
|
6
6
|
const integer_1 = require("../integer/integer");
|
|
7
7
|
const nombre_1 = require("../nombre");
|
|
8
8
|
class DecimalConstructor {
|
|
9
9
|
static randomFracPart(precision) {
|
|
10
|
-
let decimals =
|
|
10
|
+
let decimals = '';
|
|
11
11
|
for (let i = 0; i < precision; i++) {
|
|
12
12
|
decimals += (0, randint_1.randint)(i === precision - 1 ? 1 : 0, 10);
|
|
13
13
|
}
|
|
14
14
|
return decimals;
|
|
15
15
|
}
|
|
16
16
|
static random(min, max, precision) {
|
|
17
|
-
const int = (0, randint_1.randint)(min, max) +
|
|
17
|
+
const int = (0, randint_1.randint)(min, max) + '';
|
|
18
18
|
const decimals = DecimalConstructor.randomFracPart(precision);
|
|
19
19
|
return DecimalConstructor.fromParts(int, decimals);
|
|
20
20
|
}
|
|
21
21
|
static fromParts(intPart, decimalPart) {
|
|
22
|
-
return new Decimal(Number(
|
|
22
|
+
return new Decimal(Number('' + intPart + '.' + decimalPart));
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
exports.DecimalConstructor = DecimalConstructor;
|
|
@@ -27,10 +27,10 @@ class Decimal {
|
|
|
27
27
|
constructor(value) {
|
|
28
28
|
this.type = nombre_1.NumberType.Decimal;
|
|
29
29
|
this.value = value;
|
|
30
|
-
this.tex = value +
|
|
31
|
-
let [intPartString, decimalPartString] = (value +
|
|
30
|
+
this.tex = value + '';
|
|
31
|
+
let [intPartString, decimalPartString] = (value + '').split('.');
|
|
32
32
|
this.intPart = Number(intPartString);
|
|
33
|
-
this.decimalPart = decimalPartString ||
|
|
33
|
+
this.decimalPart = decimalPartString || '';
|
|
34
34
|
this.precision = this.decimalPart.length;
|
|
35
35
|
}
|
|
36
36
|
/**
|
|
@@ -39,7 +39,7 @@ class Decimal {
|
|
|
39
39
|
* @returns
|
|
40
40
|
*/
|
|
41
41
|
round(precision) {
|
|
42
|
-
const intPartString = this.intPart +
|
|
42
|
+
const intPartString = this.intPart + '';
|
|
43
43
|
if (precision < 0) {
|
|
44
44
|
if (precision < -intPartString.length)
|
|
45
45
|
throw Error("can't round to higher precision");
|
|
@@ -49,7 +49,7 @@ class Decimal {
|
|
|
49
49
|
throw Error("can't round to higher precision");
|
|
50
50
|
if (precision === this.precision)
|
|
51
51
|
return this;
|
|
52
|
-
let newFracPart =
|
|
52
|
+
let newFracPart = '', newIntPart = '';
|
|
53
53
|
const shouldRoundUp = Number(this.decimalPart[precision]) > 4;
|
|
54
54
|
if (shouldRoundUp) {
|
|
55
55
|
let retenue = true;
|
|
@@ -72,7 +72,7 @@ class Decimal {
|
|
|
72
72
|
}
|
|
73
73
|
else {
|
|
74
74
|
const nb = (Number(intPartString[i + intPartString.length]) + 1) % 10;
|
|
75
|
-
newIntPart = nb +
|
|
75
|
+
newIntPart = nb + '' + newIntPart;
|
|
76
76
|
if (nb !== 0) {
|
|
77
77
|
retenue = false;
|
|
78
78
|
for (let j = i + intPartString.length - 1; j > -1; j--) {
|
|
@@ -112,22 +112,22 @@ class Decimal {
|
|
|
112
112
|
return DecimalConstructor.fromParts(newIntPart, newFracPart);
|
|
113
113
|
}
|
|
114
114
|
multiplyByPowerOfTen(power) {
|
|
115
|
-
let newIntPart =
|
|
115
|
+
let newIntPart = '', newFracPart = '';
|
|
116
116
|
if (power > -1) {
|
|
117
|
-
newIntPart = this.intPart +
|
|
117
|
+
newIntPart = this.intPart + '';
|
|
118
118
|
for (let i = 0; i < power; i++) {
|
|
119
|
-
newIntPart += i > this.decimalPart.length - 1 ?
|
|
119
|
+
newIntPart += i > this.decimalPart.length - 1 ? '0' : this.decimalPart[i];
|
|
120
120
|
}
|
|
121
121
|
newFracPart = this.decimalPart.slice(power);
|
|
122
122
|
}
|
|
123
123
|
else {
|
|
124
|
-
const intPartString = this.intPart +
|
|
124
|
+
const intPartString = this.intPart + '';
|
|
125
125
|
newFracPart = this.decimalPart;
|
|
126
126
|
for (let i = intPartString.length - 1; i > intPartString.length - 1 + power; i--) {
|
|
127
|
-
newFracPart = (i < 0 ?
|
|
127
|
+
newFracPart = (i < 0 ? '0' : intPartString[i]) + newFracPart;
|
|
128
128
|
}
|
|
129
129
|
if (power + intPartString.length < 1)
|
|
130
|
-
newIntPart =
|
|
130
|
+
newIntPart = '0';
|
|
131
131
|
else
|
|
132
132
|
newIntPart = intPartString.slice(0, power + intPartString.length);
|
|
133
133
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Integer = exports.IntegerConstructor = void 0;
|
|
4
|
-
const randint_1 = require("
|
|
5
|
-
const numberNode_1 = require("
|
|
4
|
+
const randint_1 = require("#root/math/utils/random/randint");
|
|
5
|
+
const numberNode_1 = require("#root/tree/nodes/numbers/numberNode");
|
|
6
6
|
const nombre_1 = require("../nombre");
|
|
7
7
|
const rational_1 = require("../rationals/rational");
|
|
8
8
|
class IntegerConstructor {
|
|
@@ -14,27 +14,27 @@ exports.IntegerConstructor = IntegerConstructor;
|
|
|
14
14
|
class Integer {
|
|
15
15
|
constructor(value, tex) {
|
|
16
16
|
this.value = value;
|
|
17
|
-
this.tex = tex || value +
|
|
17
|
+
this.tex = tex || value + '';
|
|
18
18
|
this.type = nombre_1.NumberType.Integer;
|
|
19
19
|
}
|
|
20
20
|
toTree() {
|
|
21
21
|
return new numberNode_1.NumberNode(this.value, this.tex);
|
|
22
22
|
}
|
|
23
23
|
round(precision) {
|
|
24
|
-
const intString = this.value +
|
|
24
|
+
const intString = this.value + '';
|
|
25
25
|
if (precision >= intString.length || precision < 1)
|
|
26
26
|
throw Error("can't round to higher precision");
|
|
27
|
-
let newInt =
|
|
27
|
+
let newInt = '';
|
|
28
28
|
const shouldRoundUp = Number(intString[intString.length - precision]) > 4;
|
|
29
29
|
if (shouldRoundUp) {
|
|
30
30
|
for (let i = 0; i < precision; i++) {
|
|
31
|
-
newInt +=
|
|
31
|
+
newInt += '0';
|
|
32
32
|
}
|
|
33
33
|
let retenue = true;
|
|
34
34
|
let i = intString.length - precision - 1;
|
|
35
35
|
while (retenue) {
|
|
36
36
|
const nb = (Number(intString[i]) + 1) % 10;
|
|
37
|
-
newInt =
|
|
37
|
+
newInt = '' + nb + newInt;
|
|
38
38
|
if (nb === 0) {
|
|
39
39
|
i--;
|
|
40
40
|
}
|
|
@@ -48,7 +48,7 @@ class Integer {
|
|
|
48
48
|
}
|
|
49
49
|
else {
|
|
50
50
|
for (let i = 0; i < intString.length; i++) {
|
|
51
|
-
newInt += i < intString.length - precision ? intString[i] :
|
|
51
|
+
newInt += i < intString.length - precision ? intString[i] : '0';
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
return new Integer(Number(newInt));
|
|
@@ -61,7 +61,7 @@ class Integer {
|
|
|
61
61
|
const rational = nb;
|
|
62
62
|
return new rational_1.Rational(this.value * rational.denum, rational.num).simplify();
|
|
63
63
|
default:
|
|
64
|
-
throw Error(
|
|
64
|
+
throw Error('not implemented');
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Power = void 0;
|
|
4
|
-
const numberNode_1 = require("
|
|
5
|
-
const powerNode_1 = require("
|
|
4
|
+
const numberNode_1 = require("#root/tree/nodes/numbers/numberNode");
|
|
5
|
+
const powerNode_1 = require("#root/tree/nodes/operators/powerNode");
|
|
6
6
|
const nombre_1 = require("../nombre");
|
|
7
7
|
const integer_1 = require("./integer");
|
|
8
8
|
class Power {
|
|
@@ -28,20 +28,20 @@ class Power {
|
|
|
28
28
|
}
|
|
29
29
|
toDecimalWriting() {
|
|
30
30
|
if (this.operand !== 10)
|
|
31
|
-
throw Error(
|
|
32
|
-
let s =
|
|
31
|
+
throw Error('only implemented for powers of ten so far');
|
|
32
|
+
let s = '';
|
|
33
33
|
if (this.power > -1) {
|
|
34
|
-
s +=
|
|
34
|
+
s += '1';
|
|
35
35
|
for (let i = 0; i < this.power; i++) {
|
|
36
36
|
s += 0;
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
else {
|
|
40
|
-
s +=
|
|
40
|
+
s += '1';
|
|
41
41
|
for (let i = 1; i < Math.abs(this.power); i++) {
|
|
42
|
-
s =
|
|
42
|
+
s = '0' + s;
|
|
43
43
|
}
|
|
44
|
-
s =
|
|
44
|
+
s = '0.' + s;
|
|
45
45
|
}
|
|
46
46
|
return new integer_1.Integer(Number(s), s);
|
|
47
47
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Rational = exports.RationalConstructor = void 0;
|
|
4
|
-
const coprimesOf_1 = require("
|
|
5
|
-
const gcd_1 = require("
|
|
6
|
-
const lcd_1 = require("
|
|
7
|
-
const randint_1 = require("
|
|
8
|
-
const numberNode_1 = require("
|
|
9
|
-
const fractionNode_1 = require("
|
|
10
|
-
const random_1 = require("
|
|
11
|
-
const shuffle_1 = require("
|
|
4
|
+
const coprimesOf_1 = require("#root/math/utils/arithmetic/coprimesOf");
|
|
5
|
+
const gcd_1 = require("#root/math/utils/arithmetic/gcd");
|
|
6
|
+
const lcd_1 = require("#root/math/utils/arithmetic/lcd");
|
|
7
|
+
const randint_1 = require("#root/math/utils/random/randint");
|
|
8
|
+
const numberNode_1 = require("#root/tree/nodes/numbers/numberNode");
|
|
9
|
+
const fractionNode_1 = require("#root/tree/nodes/operators/fractionNode");
|
|
10
|
+
const random_1 = require("#root/utils/random");
|
|
11
|
+
const shuffle_1 = require("#root/utils/shuffle");
|
|
12
12
|
const integer_1 = require("../integer/integer");
|
|
13
13
|
const nombre_1 = require("../nombre");
|
|
14
14
|
class RationalConstructor {
|
|
@@ -39,7 +39,7 @@ exports.RationalConstructor = RationalConstructor;
|
|
|
39
39
|
class Rational {
|
|
40
40
|
constructor(numerator, denumerator) {
|
|
41
41
|
if (denumerator === 0)
|
|
42
|
-
throw Error(
|
|
42
|
+
throw Error('division by zero');
|
|
43
43
|
this.num = numerator;
|
|
44
44
|
this.denum = denumerator;
|
|
45
45
|
this.value = numerator / denumerator;
|
|
@@ -63,7 +63,7 @@ class Rational {
|
|
|
63
63
|
return new Rational(num, ppcm).simplify();
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
|
-
throw Error(
|
|
66
|
+
throw Error('not implemented yet');
|
|
67
67
|
}
|
|
68
68
|
multiply(nb) {
|
|
69
69
|
switch (nb.type) {
|
|
@@ -79,7 +79,7 @@ class Rational {
|
|
|
79
79
|
return new Rational(num, denum).simplify();
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
|
-
throw Error(
|
|
82
|
+
throw Error('not implemented yet');
|
|
83
83
|
}
|
|
84
84
|
divide(nb) {
|
|
85
85
|
switch (nb.type) {
|
|
@@ -94,7 +94,7 @@ class Rational {
|
|
|
94
94
|
return new Rational(num, denum).simplify();
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
|
-
throw Error(
|
|
97
|
+
throw Error('not implemented yet');
|
|
98
98
|
}
|
|
99
99
|
opposite() {
|
|
100
100
|
return new Rational(-this.num, this.denum);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Real = void 0;
|
|
4
|
-
const numberNode_1 = require("
|
|
4
|
+
const numberNode_1 = require("#root/tree/nodes/numbers/numberNode");
|
|
5
5
|
const nombre_1 = require("../nombre");
|
|
6
6
|
class Real {
|
|
7
7
|
constructor(value, tex) {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SquareRoot = exports.SquareRootConstructor = void 0;
|
|
4
|
-
const isSquare_1 = require("
|
|
5
|
-
const primeFactors_1 = require("
|
|
6
|
-
const randint_1 = require("
|
|
7
|
-
const
|
|
8
|
-
const
|
|
4
|
+
const isSquare_1 = require("#root/math/utils/arithmetic/isSquare");
|
|
5
|
+
const primeFactors_1 = require("#root/math/utils/arithmetic/primeFactors");
|
|
6
|
+
const randint_1 = require("#root/math/utils/random/randint");
|
|
7
|
+
const sqrtNode_1 = require("#root/tree/nodes/functions/sqrtNode");
|
|
8
|
+
const numberNode_1 = require("#root/tree/nodes/numbers/numberNode");
|
|
9
|
+
const multiplyNode_1 = require("#root/tree/nodes/operators/multiplyNode");
|
|
9
10
|
const real_1 = require("./real");
|
|
10
|
-
const sqrtNode_1 = require("../../tree/nodes/functions/sqrtNode");
|
|
11
11
|
class SquareRootConstructor {
|
|
12
12
|
/**
|
|
13
13
|
* @returns simplifiable square root type sqrt(c)=a*sqrt(b)
|
|
@@ -42,8 +42,8 @@ class SquareRoot extends real_1.Real {
|
|
|
42
42
|
const outsideSqrt = multiples.reduce((x, y) => x * y);
|
|
43
43
|
const insideSqrt = factors.length === 0 ? 1 : factors.reduce((x, y) => x * y);
|
|
44
44
|
const simplified = insideSqrt !== 1
|
|
45
|
-
? new real_1.Real(outsideSqrt * Math.sqrt(insideSqrt), `${outsideSqrt === 1 ?
|
|
46
|
-
: new real_1.Real(outsideSqrt, outsideSqrt +
|
|
45
|
+
? new real_1.Real(outsideSqrt * Math.sqrt(insideSqrt), `${outsideSqrt === 1 ? '' : `${outsideSqrt}`}\\sqrt{${insideSqrt}}`)
|
|
46
|
+
: new real_1.Real(outsideSqrt, outsideSqrt + '');
|
|
47
47
|
simplified.toTree = () => {
|
|
48
48
|
return insideSqrt !== 1
|
|
49
49
|
? outsideSqrt === 1
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Affine = exports.AffineConstructor = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
4
|
+
const integer_1 = require("../numbers/integer/integer");
|
|
5
|
+
const rational_1 = require("../numbers/rationals/rational");
|
|
6
|
+
const discreteSet_1 = require("../sets/discreteSet");
|
|
7
|
+
const intervals_1 = require("../sets/intervals/intervals");
|
|
6
8
|
const polynomial_1 = require("./polynomial");
|
|
7
|
-
const discreteSet_1 = require("../../sets/discreteSet");
|
|
8
|
-
const integer_1 = require("../../numbers/integer/integer");
|
|
9
9
|
class AffineConstructor {
|
|
10
10
|
static random(domainA = new intervals_1.Interval('[[-10; 10]]').difference(new discreteSet_1.DiscreteSet([new integer_1.Integer(0)])), domainB = new intervals_1.Interval('[[-10; 10]]')) {
|
|
11
11
|
const a = domainA.getRandomElement();
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DiscreteSet = void 0;
|
|
4
|
-
const random_1 = require("
|
|
4
|
+
const random_1 = require("#root/utils/random");
|
|
5
5
|
class DiscreteSet {
|
|
6
6
|
constructor(elements) {
|
|
7
7
|
this.elements = Array.from(new Set(elements));
|
|
8
|
-
let tex =
|
|
8
|
+
let tex = '\\{';
|
|
9
9
|
this.elements.forEach((el, index) => {
|
|
10
10
|
tex += el.tex;
|
|
11
11
|
if (index < this.elements.length - 1)
|
|
12
|
-
tex +=
|
|
12
|
+
tex += ';';
|
|
13
13
|
else
|
|
14
|
-
tex +=
|
|
14
|
+
tex += '\\}';
|
|
15
15
|
});
|
|
16
16
|
this.tex = tex;
|
|
17
17
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Interval = void 0;
|
|
4
|
-
const epsilon_1 = require("
|
|
5
|
-
const
|
|
6
|
-
const
|
|
4
|
+
const epsilon_1 = require("#root/math/numbers/epsilon");
|
|
5
|
+
const integer_1 = require("#root/math/numbers/integer/integer");
|
|
6
|
+
const nombre_1 = require("#root/math/numbers/nombre");
|
|
7
|
+
const real_1 = require("#root/math/numbers/reals/real");
|
|
8
|
+
const round_1 = require("#root/math/utils/round");
|
|
7
9
|
const mathSet_1 = require("../mathSet");
|
|
8
|
-
const integer_1 = require("../../numbers/integer/integer");
|
|
9
|
-
const real_1 = require("../../numbers/reals/real");
|
|
10
10
|
var BoundType;
|
|
11
11
|
(function (BoundType) {
|
|
12
12
|
BoundType["OO"] = "]a;b[";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.RemarkableValueConstructor = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
4
|
+
const numberNode_1 = require("#root/tree/nodes/numbers/numberNode");
|
|
5
|
+
const piNode_1 = require("#root/tree/nodes/numbers/piNode");
|
|
6
|
+
const addNode_1 = require("#root/tree/nodes/operators/addNode");
|
|
7
|
+
const multiplyNode_1 = require("#root/tree/nodes/operators/multiplyNode");
|
|
8
|
+
const simplify_1 = require("#root/tree/parsers/simplify");
|
|
9
|
+
const random_1 = require("#root/utils/random");
|
|
10
|
+
const randint_1 = require("../utils/random/randint");
|
|
11
11
|
const remarkableValues_1 = require("./remarkableValues");
|
|
12
12
|
class RemarkableValueConstructor {
|
|
13
13
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.remarkableTrigoValues = void 0;
|
|
4
|
-
const oppositeNode_1 = require("
|
|
5
|
-
const sqrtNode_1 = require("
|
|
6
|
-
const numberNode_1 = require("
|
|
7
|
-
const piNode_1 = require("
|
|
8
|
-
const fractionNode_1 = require("
|
|
9
|
-
const multiplyNode_1 = require("
|
|
4
|
+
const oppositeNode_1 = require("#root/tree/nodes/functions/oppositeNode");
|
|
5
|
+
const sqrtNode_1 = require("#root/tree/nodes/functions/sqrtNode");
|
|
6
|
+
const numberNode_1 = require("#root/tree/nodes/numbers/numberNode");
|
|
7
|
+
const piNode_1 = require("#root/tree/nodes/numbers/piNode");
|
|
8
|
+
const fractionNode_1 = require("#root/tree/nodes/operators/fractionNode");
|
|
9
|
+
const multiplyNode_1 = require("#root/tree/nodes/operators/multiplyNode");
|
|
10
10
|
exports.remarkableTrigoValues = [
|
|
11
11
|
{
|
|
12
12
|
angle: new numberNode_1.NumberNode(0),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.distinctRandTupleInt = exports.randTupleInt = void 0;
|
|
4
|
-
const arrayEqual_1 = require("
|
|
4
|
+
const arrayEqual_1 = require("#root/utils/arrayEqual");
|
|
5
5
|
const randint_1 = require("./randint");
|
|
6
6
|
/**
|
|
7
7
|
* @param size tuple length
|
|
@@ -22,7 +22,7 @@ const distinctRandTupleInt = (nb, size, options) => {
|
|
|
22
22
|
let newTuple;
|
|
23
23
|
do {
|
|
24
24
|
newTuple = (0, exports.randTupleInt)(size, options);
|
|
25
|
-
} while (res.some(tuple => (0, arrayEqual_1.arrayEqual)(tuple, newTuple)));
|
|
25
|
+
} while (res.some((tuple) => (0, arrayEqual_1.arrayEqual)(tuple, newTuple)));
|
|
26
26
|
res.push(newTuple);
|
|
27
27
|
}
|
|
28
28
|
return res;
|
package/package.json
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "math-exercises",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.6",
|
|
4
4
|
"description": "Math exercises generator for middle school and high school",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"files": [
|
|
7
7
|
"lib/**/*"
|
|
8
8
|
],
|
|
9
9
|
"scripts": {
|
|
10
|
+
"dev": "ts-node-dev -r tsconfig-paths/register src/index.ts",
|
|
11
|
+
"start": "ts-node -r tsconfig-paths/register src/index.ts",
|
|
10
12
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
11
13
|
"start:dev": "nodemon",
|
|
12
14
|
"build": "tsc",
|
|
@@ -33,7 +35,11 @@
|
|
|
33
35
|
},
|
|
34
36
|
"homepage": "https://github.com/krirkrirk/math-exercises#readme",
|
|
35
37
|
"dependencies": {
|
|
36
|
-
"mathjs": "^11.5.1"
|
|
38
|
+
"mathjs": "^11.5.1",
|
|
39
|
+
"tsconfig-paths": "^4.1.2"
|
|
40
|
+
},
|
|
41
|
+
"imports": {
|
|
42
|
+
"#root/*": "./lib/*"
|
|
37
43
|
},
|
|
38
44
|
"exports": {
|
|
39
45
|
".": "./lib/index.js"
|