math-exercises 1.2.7 → 1.2.10
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 +40 -0
- package/lib/exercises/calcul/fractions/fractionAndIntegerDivision.js +35 -0
- package/lib/exercises/calcul/fractions/fractionAndIntegerProduct.js +31 -0
- package/lib/exercises/calcul/fractions/fractionAndIntegerSum.js +32 -0
- package/lib/exercises/calcul/fractions/fractionsDivision.js +29 -0
- package/lib/exercises/calcul/fractions/fractionsProduct.js +29 -0
- package/lib/exercises/calcul/fractions/fractionsSum.js +29 -0
- package/lib/exercises/calcul/fractions/simplifyFraction.js +25 -0
- package/lib/exercises/calcul/operations/operationsPriorities.js +88 -0
- package/lib/exercises/calcul/operations/operationsPrioritiesWithoutRelative.js +111 -0
- package/{src → lib}/exercises/calcul/operationsPriorities.js +88 -89
- package/lib/exercises/calcul/rounding/rounding.js +86 -0
- package/{src → lib}/exercises/calculLitteral/distributivity/allIdentities.js +27 -27
- package/lib/exercises/calculLitteral/distributivity/doubleDistributivity.js +31 -0
- package/lib/exercises/calculLitteral/distributivity/firstIdentity.js +32 -0
- package/lib/exercises/calculLitteral/distributivity/secondIdentity.js +33 -0
- package/lib/exercises/calculLitteral/distributivity/simpleDistributivity.js +33 -0
- package/lib/exercises/calculLitteral/distributivity/thirdIdentity.js +32 -0
- package/lib/exercises/calculLitteral/equation/equationType1Exercise.js +38 -0
- package/lib/exercises/calculLitteral/equation/equationType2Exercise.js +41 -0
- package/lib/exercises/calculLitteral/equation/equationType3Exercise.js +42 -0
- package/lib/exercises/calculLitteral/equation/equationType4Exercise.js +44 -0
- package/lib/exercises/calculLitteral/factorisation/factoType1Exercise.js +39 -0
- package/{src → lib}/exercises/exercise.js +7 -7
- package/lib/exercises/exercises.js +95 -0
- package/lib/exercises/geometry/cartesian/midpoint.js +29 -0
- package/lib/exercises/geometry/vectors/scalarProductViaCoords.js +29 -0
- package/lib/exercises/geometry/vectors/scalarProductViaNorms.js +27 -0
- package/lib/exercises/powers/powersDivision.js +45 -0
- package/lib/exercises/powers/powersOfTenToDecimal.js +33 -0
- package/lib/exercises/powers/powersPower.js +44 -0
- package/lib/exercises/powers/powersProduct.js +45 -0
- package/lib/exercises/powers/scientificToDecimal.js +38 -0
- package/{src → lib}/exercises/squareRoots/simpifySquareRoot.js +28 -28
- package/lib/exercises/utils/getDistinctQuestions.js +16 -0
- package/lib/geometry/point.js +27 -0
- package/lib/geometry/vector.js +31 -0
- package/lib/index.js +10 -0
- package/lib/mathutils/arithmetic/coprimesOf.js +13 -0
- package/lib/mathutils/arithmetic/dividersOf.js +12 -0
- package/{src → lib}/mathutils/arithmetic/gcd.js +7 -7
- package/{src → lib}/mathutils/arithmetic/isSquare.js +7 -7
- package/{src → lib}/mathutils/arithmetic/lcd.js +12 -12
- package/lib/mathutils/arithmetic/nonCoprimesOf.js +13 -0
- package/lib/mathutils/arithmetic/nonDividersOf.js +14 -0
- package/{src → lib}/mathutils/arithmetic/primeFactors.js +22 -22
- package/lib/mathutils/decimals/decimalPartLengthOf.js +14 -0
- package/lib/mathutils/random/randTupleInt.js +30 -0
- package/{src → lib}/mathutils/random/randint.js +18 -18
- package/{src → lib}/mathutils/round.js +8 -8
- package/{src → lib}/numbers/decimals/decimal.js +140 -144
- package/{src → lib}/numbers/epsilon.js +10 -10
- package/{src → lib}/numbers/integer/integer.js +68 -72
- package/{src → lib}/numbers/integer/power.js +52 -53
- package/{src → lib}/numbers/nombre.js +10 -10
- package/lib/numbers/rationals/rational.js +113 -0
- package/lib/numbers/reals/real.js +16 -0
- package/lib/numbers/reals/squareRoot.js +63 -0
- package/lib/polynomials/affine.js +42 -0
- package/lib/polynomials/polynomial.js +125 -0
- package/lib/sets/discreteSet.js +28 -0
- package/{src/sets/emptySet.ts → lib/sets/emptySet.js} +6 -6
- package/{src → lib}/sets/intervals/intervals.js +108 -113
- package/lib/sets/intervals/union.js +1 -0
- package/lib/sets/mathSet.js +10 -0
- package/lib/sets/mathSetInterface.js +2 -0
- package/{src → lib}/tree/nodes/functions/functionNode.js +18 -19
- package/lib/tree/nodes/functions/oppositeNode.js +13 -0
- package/lib/tree/nodes/functions/sqrtNode.js +15 -0
- package/{src → lib}/tree/nodes/node.js +10 -10
- package/lib/tree/nodes/numbers/numberNode.js +18 -0
- package/lib/tree/nodes/operators/addNode.js +15 -0
- package/lib/tree/nodes/operators/divideNode.js +17 -0
- package/lib/tree/nodes/operators/equalNode.js +13 -0
- package/lib/tree/nodes/operators/fractionNode.js +17 -0
- package/lib/tree/nodes/operators/multiplyNode.js +13 -0
- package/{src → lib}/tree/nodes/operators/operatorNode.js +35 -37
- package/lib/tree/nodes/operators/powerNode.js +13 -0
- package/lib/tree/nodes/operators/substractNode.js +13 -0
- package/lib/tree/nodes/variables/variableNode.js +16 -0
- package/{src → lib}/tree/parsers/derivateParser.js +60 -60
- package/{src → lib}/tree/parsers/latexParser.js +117 -117
- package/lib/utils/arrayEqual.js +13 -0
- package/{src → lib}/utils/coin.js +7 -7
- package/{src → lib}/utils/random.js +7 -7
- package/lib/utils/shuffle.js +15 -0
- package/package.json +35 -28
- package/nodemon.json +0 -5
- package/src/exercises/calcul/addAndSub.js +0 -40
- package/src/exercises/calcul/addAndSub.ts +0 -39
- package/src/exercises/calcul/fractions/fractionAndIntegerDivision.js +0 -35
- package/src/exercises/calcul/fractions/fractionAndIntegerDivision.ts +0 -38
- package/src/exercises/calcul/fractions/fractionAndIntegerProduct.js +0 -31
- package/src/exercises/calcul/fractions/fractionAndIntegerProduct.ts +0 -32
- package/src/exercises/calcul/fractions/fractionAndIntegerSum.js +0 -32
- package/src/exercises/calcul/fractions/fractionAndIntegerSum.ts +0 -31
- package/src/exercises/calcul/fractions/fractionsDivision.js +0 -29
- package/src/exercises/calcul/fractions/fractionsDivision.ts +0 -30
- package/src/exercises/calcul/fractions/fractionsProduct.js +0 -29
- package/src/exercises/calcul/fractions/fractionsProduct.ts +0 -29
- package/src/exercises/calcul/fractions/fractionsSum.js +0 -29
- package/src/exercises/calcul/fractions/fractionsSum.ts +0 -28
- package/src/exercises/calcul/fractions/simplifyFraction.js +0 -25
- package/src/exercises/calcul/fractions/simplifyFraction.ts +0 -24
- package/src/exercises/calcul/operationsPriorities.ts +0 -115
- package/src/exercises/calcul/rounding/roundToUnit.js +0 -70
- package/src/exercises/calcul/rounding/roundToUnit.ts +0 -68
- package/src/exercises/calculLitteral/distributivity/allIdentities.ts +0 -26
- package/src/exercises/calculLitteral/distributivity/doubleDistributivity.js +0 -31
- package/src/exercises/calculLitteral/distributivity/doubleDistributivity.ts +0 -33
- package/src/exercises/calculLitteral/distributivity/firstIdentity.js +0 -32
- package/src/exercises/calculLitteral/distributivity/firstIdentity.ts +0 -33
- package/src/exercises/calculLitteral/distributivity/secondIdentity.js +0 -33
- package/src/exercises/calculLitteral/distributivity/secondIdentity.ts +0 -35
- package/src/exercises/calculLitteral/distributivity/simpleDistributivity.js +0 -33
- package/src/exercises/calculLitteral/distributivity/simpleDistributivity.ts +0 -33
- package/src/exercises/calculLitteral/distributivity/thirdIdentity.js +0 -32
- package/src/exercises/calculLitteral/distributivity/thirdIdentity.ts +0 -34
- package/src/exercises/calculLitteral/equation/equationType1Exercise.js +0 -38
- package/src/exercises/calculLitteral/equation/equationType1Exercise.ts +0 -38
- package/src/exercises/calculLitteral/equation/equationType2Exercise.js +0 -41
- package/src/exercises/calculLitteral/equation/equationType2Exercise.ts +0 -41
- package/src/exercises/calculLitteral/equation/equationType3Exercise.js +0 -42
- package/src/exercises/calculLitteral/equation/equationType3Exercise.ts +0 -43
- package/src/exercises/calculLitteral/equation/equationType4Exercise.js +0 -44
- package/src/exercises/calculLitteral/equation/equationType4Exercise.ts +0 -46
- package/src/exercises/calculLitteral/factorisation/factoType1Exercise.js +0 -39
- package/src/exercises/calculLitteral/factorisation/factoType1Exercise.ts +0 -54
- package/src/exercises/calculLitteral/reduction.ts +0 -27
- package/src/exercises/exercise.ts +0 -25
- package/src/exercises/exercises.js +0 -86
- package/src/exercises/exercises.ts +0 -91
- package/src/exercises/powers/powersDivision.js +0 -46
- package/src/exercises/powers/powersDivision.ts +0 -51
- package/src/exercises/powers/powersOfTenToDecimal.js +0 -33
- package/src/exercises/powers/powersOfTenToDecimal.ts +0 -37
- package/src/exercises/powers/powersPower.js +0 -45
- package/src/exercises/powers/powersPower.ts +0 -55
- package/src/exercises/powers/powersProduct.js +0 -46
- package/src/exercises/powers/powersProduct.ts +0 -51
- package/src/exercises/powers/scientificToDecimal.js +0 -38
- package/src/exercises/powers/scientificToDecimal.ts +0 -44
- package/src/exercises/squareRoots/simpifySquareRoot.ts +0 -27
- package/src/exercises/utils/getDistinctQuestions.js +0 -18
- package/src/exercises/utils/getDistinctQuestions.ts +0 -14
- package/src/index.js +0 -10
- package/src/index.ts +0 -14
- package/src/mathutils/arithmetic/coprimesOf.js +0 -13
- package/src/mathutils/arithmetic/coprimesOf.ts +0 -9
- package/src/mathutils/arithmetic/dividersOf.ts +0 -7
- package/src/mathutils/arithmetic/gcd.ts +0 -3
- package/src/mathutils/arithmetic/isSquare.ts +0 -3
- package/src/mathutils/arithmetic/lcd.ts +0 -7
- package/src/mathutils/arithmetic/nonCoprimesOf.ts +0 -9
- package/src/mathutils/arithmetic/nonDividersOf.ts +0 -12
- package/src/mathutils/arithmetic/primeFactors.ts +0 -18
- package/src/mathutils/decimals/decimalPartLengthOf.ts +0 -10
- package/src/mathutils/random/randint.ts +0 -12
- package/src/mathutils/round.ts +0 -5
- package/src/numbers/decimals/decimal.ts +0 -140
- package/src/numbers/epsilon.ts +0 -7
- package/src/numbers/integer/integer.ts +0 -72
- package/src/numbers/integer/power.ts +0 -49
- package/src/numbers/nombre.ts +0 -15
- package/src/numbers/number.js +0 -8
- package/src/numbers/rationals/rational.js +0 -128
- package/src/numbers/rationals/rational.ts +0 -122
- package/src/numbers/reals/real.js +0 -17
- package/src/numbers/reals/real.ts +0 -17
- package/src/numbers/reals/squareRoot.js +0 -85
- package/src/numbers/reals/squareRoot.ts +0 -70
- package/src/polynomials/affine.js +0 -71
- package/src/polynomials/affine.ts +0 -60
- package/src/polynomials/polynomial.js +0 -128
- package/src/polynomials/polynomial.ts +0 -137
- package/src/sets/discreteSet.js +0 -30
- package/src/sets/discreteSet.ts +0 -30
- package/src/sets/intervals/intervals.ts +0 -122
- package/src/sets/intervals/union.ts +0 -0
- package/src/sets/mathSet.js +0 -11
- package/src/sets/mathSet.ts +0 -12
- package/src/sets/mathSetInterface.js +0 -2
- package/src/sets/mathSetInterface.ts +0 -10
- package/src/tree/latexParser/latexParse.js +0 -117
- package/src/tree/nodes/functions/functionNode.ts +0 -18
- package/src/tree/nodes/functions/oppositeNode.js +0 -30
- package/src/tree/nodes/functions/oppositeNode.ts +0 -12
- package/src/tree/nodes/functions/sqrtNode.js +0 -33
- package/src/tree/nodes/functions/sqrtNode.ts +0 -12
- package/src/tree/nodes/node.ts +0 -12
- package/src/tree/nodes/numbers/numberNode.js +0 -16
- package/src/tree/nodes/numbers/numberNode.ts +0 -16
- package/src/tree/nodes/operators/addNode.js +0 -33
- package/src/tree/nodes/operators/addNode.ts +0 -13
- package/src/tree/nodes/operators/divideNode.js +0 -34
- package/src/tree/nodes/operators/divideNode.ts +0 -16
- package/src/tree/nodes/operators/equalNode.js +0 -30
- package/src/tree/nodes/operators/equalNode.ts +0 -11
- package/src/tree/nodes/operators/fractionNode.js +0 -34
- package/src/tree/nodes/operators/fractionNode.ts +0 -16
- package/src/tree/nodes/operators/multiplyNode.js +0 -30
- package/src/tree/nodes/operators/multiplyNode.ts +0 -12
- package/src/tree/nodes/operators/operatorNode.ts +0 -36
- package/src/tree/nodes/operators/oppositeNode.js +0 -18
- package/src/tree/nodes/operators/powerNode.js +0 -30
- package/src/tree/nodes/operators/powerNode.ts +0 -12
- package/src/tree/nodes/operators/substractNode.js +0 -30
- package/src/tree/nodes/operators/substractNode.ts +0 -11
- package/src/tree/nodes/variables/variableNode.js +0 -17
- package/src/tree/nodes/variables/variableNode.ts +0 -15
- package/src/tree/parsers/derivateParser.ts +0 -66
- package/src/tree/parsers/latexParser.ts +0 -122
- package/src/utils/coin.ts +0 -3
- package/src/utils/random.ts +0 -3
- package/src/utils/randomIn.js +0 -7
- package/src/utils/shuffle.js +0 -24
- package/src/utils/shuffle.ts +0 -11
- package/tsconfig.json +0 -110
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { randint } from "../../../mathutils/random/randint";
|
|
2
|
-
import { Integer } from "../../../numbers/integer/integer";
|
|
3
|
-
import { RationalConstructor } from "../../../numbers/rationals/rational";
|
|
4
|
-
import { latexParser } from "../../../tree/parsers/latexParser";
|
|
5
|
-
import { AddNode } from "../../../tree/nodes/operators/addNode";
|
|
6
|
-
import { DivideNode } from "../../../tree/nodes/operators/divideNode";
|
|
7
|
-
import { MultiplyNode } from "../../../tree/nodes/operators/multiplyNode";
|
|
8
|
-
import { random } from "../../../utils/random";
|
|
9
|
-
import { Exercise, Question } from "../../exercise";
|
|
10
|
-
import { getDistinctQuestions } from "../../utils/getDistinctQuestions";
|
|
11
|
-
|
|
12
|
-
export const fractionAndIntegerDivision: Exercise = {
|
|
13
|
-
id: "fractionAndIntegerDivision",
|
|
14
|
-
connector: "=",
|
|
15
|
-
instruction: "Calculer la forme irréductible :",
|
|
16
|
-
label: "Division d'un entier et d'une fraction",
|
|
17
|
-
levels: ["4", "3", "2", "1"],
|
|
18
|
-
isSingleStep: false,
|
|
19
|
-
section: "Fractions",
|
|
20
|
-
generator: (nb: number) => getDistinctQuestions(getFractionAndIntegerDivision, nb),
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
export function getFractionAndIntegerDivision(): Question {
|
|
24
|
-
const rational = RationalConstructor.randomIrreductible();
|
|
25
|
-
const integer = new Integer(randint(-10, 11, [0]));
|
|
26
|
-
|
|
27
|
-
const integerFirst = random([0, 1]);
|
|
28
|
-
const statementTree = integerFirst
|
|
29
|
-
? new DivideNode(integer.toTree(), rational.toTree())
|
|
30
|
-
: new DivideNode(rational.toTree(), integer.toTree());
|
|
31
|
-
|
|
32
|
-
const answerTree = integerFirst ? integer.divide(rational).toTree() : rational.divide(integer).toTree();
|
|
33
|
-
const question: Question = {
|
|
34
|
-
startStatement: latexParser(statementTree),
|
|
35
|
-
answer: latexParser(answerTree),
|
|
36
|
-
};
|
|
37
|
-
return question;
|
|
38
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
exports.__esModule = true;
|
|
3
|
-
exports.getFractionAndIntegerProduct = exports.fractionAndIntegerProduct = void 0;
|
|
4
|
-
var randint_1 = require("../../../mathutils/random/randint");
|
|
5
|
-
var integer_1 = require("../../../numbers/integer/integer");
|
|
6
|
-
var rational_1 = require("../../../numbers/rationals/rational");
|
|
7
|
-
var latexParser_1 = require("../../../tree/parsers/latexParser");
|
|
8
|
-
var multiplyNode_1 = require("../../../tree/nodes/operators/multiplyNode");
|
|
9
|
-
var getDistinctQuestions_1 = require("../../utils/getDistinctQuestions");
|
|
10
|
-
exports.fractionAndIntegerProduct = {
|
|
11
|
-
id: "fractionAndIntegerProduct",
|
|
12
|
-
connector: "=",
|
|
13
|
-
instruction: "Calculer la forme irréductible :",
|
|
14
|
-
label: "Produit d'un entier et d'une fraction",
|
|
15
|
-
levels: ["4", "3", "2", "1"],
|
|
16
|
-
isSingleStep: false,
|
|
17
|
-
section: "Fractions",
|
|
18
|
-
generator: function (nb) { return (0, getDistinctQuestions_1.getDistinctQuestions)(getFractionAndIntegerProduct, nb); }
|
|
19
|
-
};
|
|
20
|
-
function getFractionAndIntegerProduct() {
|
|
21
|
-
var rational = rational_1.RationalConstructor.randomIrreductible();
|
|
22
|
-
var integer = new integer_1.Integer((0, randint_1.randint)(-10, 11, [0]));
|
|
23
|
-
var statementTree = new multiplyNode_1.MultiplyNode(rational.toTree(), integer.toTree()).shuffle();
|
|
24
|
-
var answerTree = rational.multiply(integer).toTree();
|
|
25
|
-
var question = {
|
|
26
|
-
startStatement: (0, latexParser_1.latexParser)(statementTree),
|
|
27
|
-
answer: (0, latexParser_1.latexParser)(answerTree)
|
|
28
|
-
};
|
|
29
|
-
return question;
|
|
30
|
-
}
|
|
31
|
-
exports.getFractionAndIntegerProduct = getFractionAndIntegerProduct;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { randint } from "../../../mathutils/random/randint";
|
|
2
|
-
import { Integer } from "../../../numbers/integer/integer";
|
|
3
|
-
import { RationalConstructor } from "../../../numbers/rationals/rational";
|
|
4
|
-
import { latexParser } from "../../../tree/parsers/latexParser";
|
|
5
|
-
import { AddNode } from "../../../tree/nodes/operators/addNode";
|
|
6
|
-
import { MultiplyNode } from "../../../tree/nodes/operators/multiplyNode";
|
|
7
|
-
import { Exercise, Question } from "../../exercise";
|
|
8
|
-
import { getDistinctQuestions } from "../../utils/getDistinctQuestions";
|
|
9
|
-
|
|
10
|
-
export const fractionAndIntegerProduct: Exercise = {
|
|
11
|
-
id: "fractionAndIntegerProduct",
|
|
12
|
-
connector: "=",
|
|
13
|
-
instruction: "Calculer la forme irréductible :",
|
|
14
|
-
label: "Produit d'un entier et d'une fraction",
|
|
15
|
-
levels: ["4", "3", "2", "1"],
|
|
16
|
-
isSingleStep: false,
|
|
17
|
-
section: "Fractions",
|
|
18
|
-
generator: (nb: number) => getDistinctQuestions(getFractionAndIntegerProduct, nb),
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export function getFractionAndIntegerProduct(): Question {
|
|
22
|
-
const rational = RationalConstructor.randomIrreductible();
|
|
23
|
-
const integer = new Integer(randint(-10, 11, [0]));
|
|
24
|
-
const statementTree = new MultiplyNode(rational.toTree(), integer.toTree()).shuffle();
|
|
25
|
-
|
|
26
|
-
const answerTree = rational.multiply(integer).toTree();
|
|
27
|
-
const question: Question = {
|
|
28
|
-
startStatement: latexParser(statementTree),
|
|
29
|
-
answer: latexParser(answerTree),
|
|
30
|
-
};
|
|
31
|
-
return question;
|
|
32
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
exports.__esModule = true;
|
|
3
|
-
exports.getFractionAndIntegerSum = exports.fractionAndIntegerSum = void 0;
|
|
4
|
-
var randint_1 = require("../../../mathutils/random/randint");
|
|
5
|
-
var integer_1 = require("../../../numbers/integer/integer");
|
|
6
|
-
var rational_1 = require("../../../numbers/rationals/rational");
|
|
7
|
-
var latexParser_1 = require("../../../tree/parsers/latexParser");
|
|
8
|
-
var addNode_1 = require("../../../tree/nodes/operators/addNode");
|
|
9
|
-
var getDistinctQuestions_1 = require("../../utils/getDistinctQuestions");
|
|
10
|
-
exports.fractionAndIntegerSum = {
|
|
11
|
-
id: "fractionAndIntegerSum",
|
|
12
|
-
connector: "=",
|
|
13
|
-
instruction: "Calculer la forme irréductible :",
|
|
14
|
-
label: "Somme d'un entier et d'une fraction",
|
|
15
|
-
levels: ["4", "3", "2", "1"],
|
|
16
|
-
isSingleStep: false,
|
|
17
|
-
section: "Fractions",
|
|
18
|
-
generator: function (nb) { return (0, getDistinctQuestions_1.getDistinctQuestions)(getFractionAndIntegerSum, nb); }
|
|
19
|
-
};
|
|
20
|
-
function getFractionAndIntegerSum() {
|
|
21
|
-
var rational = rational_1.RationalConstructor.randomIrreductible();
|
|
22
|
-
var integer = new integer_1.Integer((0, randint_1.randint)(-10, 11, [0]));
|
|
23
|
-
var statementTree = new addNode_1.AddNode(rational.toTree(), integer.toTree());
|
|
24
|
-
statementTree.shuffle();
|
|
25
|
-
var answerTree = rational.add(integer).toTree();
|
|
26
|
-
var question = {
|
|
27
|
-
startStatement: (0, latexParser_1.latexParser)(statementTree),
|
|
28
|
-
answer: (0, latexParser_1.latexParser)(answerTree)
|
|
29
|
-
};
|
|
30
|
-
return question;
|
|
31
|
-
}
|
|
32
|
-
exports.getFractionAndIntegerSum = getFractionAndIntegerSum;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { randint } from "../../../mathutils/random/randint";
|
|
2
|
-
import { Integer } from "../../../numbers/integer/integer";
|
|
3
|
-
import { RationalConstructor } from "../../../numbers/rationals/rational";
|
|
4
|
-
import { latexParser } from "../../../tree/parsers/latexParser";
|
|
5
|
-
import { AddNode } from "../../../tree/nodes/operators/addNode";
|
|
6
|
-
import { Exercise, Question } from "../../exercise";
|
|
7
|
-
import { getDistinctQuestions } from "../../utils/getDistinctQuestions";
|
|
8
|
-
|
|
9
|
-
export const fractionAndIntegerSum: Exercise = {
|
|
10
|
-
id: "fractionAndIntegerSum",
|
|
11
|
-
connector: "=",
|
|
12
|
-
instruction: "Calculer la forme irréductible :",
|
|
13
|
-
label: "Somme d'un entier et d'une fraction",
|
|
14
|
-
levels: ["4", "3", "2", "1"],
|
|
15
|
-
isSingleStep: false,
|
|
16
|
-
section: "Fractions",
|
|
17
|
-
generator: (nb: number) => getDistinctQuestions(getFractionAndIntegerSum, nb),
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export function getFractionAndIntegerSum(): Question {
|
|
21
|
-
const rational = RationalConstructor.randomIrreductible();
|
|
22
|
-
const integer = new Integer(randint(-10, 11, [0]));
|
|
23
|
-
const statementTree = new AddNode(rational.toTree(), integer.toTree());
|
|
24
|
-
statementTree.shuffle();
|
|
25
|
-
const answerTree = rational.add(integer).toTree();
|
|
26
|
-
const question: Question = {
|
|
27
|
-
startStatement: latexParser(statementTree),
|
|
28
|
-
answer: latexParser(answerTree),
|
|
29
|
-
};
|
|
30
|
-
return question;
|
|
31
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
exports.__esModule = true;
|
|
3
|
-
exports.getFractionsDivision = exports.fractionsDivision = void 0;
|
|
4
|
-
var rational_1 = require("../../../numbers/rationals/rational");
|
|
5
|
-
var latexParser_1 = require("../../../tree/parsers/latexParser");
|
|
6
|
-
var divideNode_1 = require("../../../tree/nodes/operators/divideNode");
|
|
7
|
-
var getDistinctQuestions_1 = require("../../utils/getDistinctQuestions");
|
|
8
|
-
exports.fractionsDivision = {
|
|
9
|
-
id: "fractionsDivision",
|
|
10
|
-
connector: "=",
|
|
11
|
-
instruction: "Calculer la forme irréductible :",
|
|
12
|
-
label: "Divisions de fractions",
|
|
13
|
-
levels: ["4", "3", "2", "1"],
|
|
14
|
-
section: "Fractions",
|
|
15
|
-
isSingleStep: false,
|
|
16
|
-
generator: function (nb) { return (0, getDistinctQuestions_1.getDistinctQuestions)(getFractionsDivision, nb); }
|
|
17
|
-
};
|
|
18
|
-
function getFractionsDivision() {
|
|
19
|
-
var rational = rational_1.RationalConstructor.randomIrreductible();
|
|
20
|
-
var rational2 = rational_1.RationalConstructor.randomIrreductible();
|
|
21
|
-
var statementTree = new divideNode_1.DivideNode(rational.toTree(), rational2.toTree());
|
|
22
|
-
var answerTree = rational.divide(rational2).toTree();
|
|
23
|
-
var question = {
|
|
24
|
-
startStatement: (0, latexParser_1.latexParser)(statementTree),
|
|
25
|
-
answer: (0, latexParser_1.latexParser)(answerTree)
|
|
26
|
-
};
|
|
27
|
-
return question;
|
|
28
|
-
}
|
|
29
|
-
exports.getFractionsDivision = getFractionsDivision;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { RationalConstructor } from "../../../numbers/rationals/rational";
|
|
2
|
-
import { latexParser } from "../../../tree/parsers/latexParser";
|
|
3
|
-
import { AddNode } from "../../../tree/nodes/operators/addNode";
|
|
4
|
-
import { DivideNode } from "../../../tree/nodes/operators/divideNode";
|
|
5
|
-
import { MultiplyNode } from "../../../tree/nodes/operators/multiplyNode";
|
|
6
|
-
import { Exercise, Question } from "../../exercise";
|
|
7
|
-
import { getDistinctQuestions } from "../../utils/getDistinctQuestions";
|
|
8
|
-
|
|
9
|
-
export const fractionsDivision: Exercise = {
|
|
10
|
-
id: "fractionsDivision",
|
|
11
|
-
connector: "=",
|
|
12
|
-
instruction: "Calculer la forme irréductible :",
|
|
13
|
-
label: "Divisions de fractions",
|
|
14
|
-
levels: ["4", "3", "2", "1"],
|
|
15
|
-
section: "Fractions",
|
|
16
|
-
isSingleStep: false,
|
|
17
|
-
generator: (nb: number) => getDistinctQuestions(getFractionsDivision, nb),
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export function getFractionsDivision(): Question {
|
|
21
|
-
const rational = RationalConstructor.randomIrreductible();
|
|
22
|
-
const rational2 = RationalConstructor.randomIrreductible();
|
|
23
|
-
const statementTree = new DivideNode(rational.toTree(), rational2.toTree());
|
|
24
|
-
const answerTree = rational.divide(rational2).toTree();
|
|
25
|
-
const question: Question = {
|
|
26
|
-
startStatement: latexParser(statementTree),
|
|
27
|
-
answer: latexParser(answerTree),
|
|
28
|
-
};
|
|
29
|
-
return question;
|
|
30
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
exports.__esModule = true;
|
|
3
|
-
exports.getFractionsProduct = exports.fractionsProduct = void 0;
|
|
4
|
-
var rational_1 = require("../../../numbers/rationals/rational");
|
|
5
|
-
var latexParser_1 = require("../../../tree/parsers/latexParser");
|
|
6
|
-
var multiplyNode_1 = require("../../../tree/nodes/operators/multiplyNode");
|
|
7
|
-
var getDistinctQuestions_1 = require("../../utils/getDistinctQuestions");
|
|
8
|
-
exports.fractionsProduct = {
|
|
9
|
-
id: "fractionsProduct",
|
|
10
|
-
connector: "=",
|
|
11
|
-
instruction: "Calculer la forme irréductible :",
|
|
12
|
-
label: "Produits de fractions",
|
|
13
|
-
levels: ["4", "3", "2", "1"],
|
|
14
|
-
section: "Fractions",
|
|
15
|
-
isSingleStep: false,
|
|
16
|
-
generator: function (nb) { return (0, getDistinctQuestions_1.getDistinctQuestions)(getFractionsProduct, nb); }
|
|
17
|
-
};
|
|
18
|
-
function getFractionsProduct() {
|
|
19
|
-
var rational = rational_1.RationalConstructor.randomIrreductible();
|
|
20
|
-
var rational2 = rational_1.RationalConstructor.randomIrreductible();
|
|
21
|
-
var statementTree = new multiplyNode_1.MultiplyNode(rational.toTree(), rational2.toTree());
|
|
22
|
-
var answerTree = rational.multiply(rational2).toTree();
|
|
23
|
-
var question = {
|
|
24
|
-
startStatement: (0, latexParser_1.latexParser)(statementTree),
|
|
25
|
-
answer: (0, latexParser_1.latexParser)(answerTree)
|
|
26
|
-
};
|
|
27
|
-
return question;
|
|
28
|
-
}
|
|
29
|
-
exports.getFractionsProduct = getFractionsProduct;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { RationalConstructor } from "../../../numbers/rationals/rational";
|
|
2
|
-
import { latexParser } from "../../../tree/parsers/latexParser";
|
|
3
|
-
import { AddNode } from "../../../tree/nodes/operators/addNode";
|
|
4
|
-
import { MultiplyNode } from "../../../tree/nodes/operators/multiplyNode";
|
|
5
|
-
import { Exercise, Question } from "../../exercise";
|
|
6
|
-
import { getDistinctQuestions } from "../../utils/getDistinctQuestions";
|
|
7
|
-
|
|
8
|
-
export const fractionsProduct: Exercise = {
|
|
9
|
-
id: "fractionsProduct",
|
|
10
|
-
connector: "=",
|
|
11
|
-
instruction: "Calculer la forme irréductible :",
|
|
12
|
-
label: "Produits de fractions",
|
|
13
|
-
levels: ["4", "3", "2", "1"],
|
|
14
|
-
section: "Fractions",
|
|
15
|
-
isSingleStep: false,
|
|
16
|
-
generator: (nb: number) => getDistinctQuestions(getFractionsProduct, nb),
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export function getFractionsProduct(): Question {
|
|
20
|
-
const rational = RationalConstructor.randomIrreductible();
|
|
21
|
-
const rational2 = RationalConstructor.randomIrreductible();
|
|
22
|
-
const statementTree = new MultiplyNode(rational.toTree(), rational2.toTree());
|
|
23
|
-
const answerTree = rational.multiply(rational2).toTree();
|
|
24
|
-
const question: Question = {
|
|
25
|
-
startStatement: latexParser(statementTree),
|
|
26
|
-
answer: latexParser(answerTree),
|
|
27
|
-
};
|
|
28
|
-
return question;
|
|
29
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
exports.__esModule = true;
|
|
3
|
-
exports.getFractionsSum = exports.fractionsSum = void 0;
|
|
4
|
-
var rational_1 = require("../../../numbers/rationals/rational");
|
|
5
|
-
var latexParser_1 = require("../../../tree/parsers/latexParser");
|
|
6
|
-
var addNode_1 = require("../../../tree/nodes/operators/addNode");
|
|
7
|
-
var getDistinctQuestions_1 = require("../../utils/getDistinctQuestions");
|
|
8
|
-
exports.fractionsSum = {
|
|
9
|
-
id: "fractionsSum",
|
|
10
|
-
connector: "=",
|
|
11
|
-
instruction: "Calculer la forme irréductible :",
|
|
12
|
-
label: "Sommes de fractions",
|
|
13
|
-
levels: ["4", "3", "2", "1"],
|
|
14
|
-
section: "Fractions",
|
|
15
|
-
isSingleStep: false,
|
|
16
|
-
generator: function (nb) { return (0, getDistinctQuestions_1.getDistinctQuestions)(getFractionsSum, nb); }
|
|
17
|
-
};
|
|
18
|
-
function getFractionsSum() {
|
|
19
|
-
var rational = rational_1.RationalConstructor.randomIrreductible();
|
|
20
|
-
var rational2 = rational_1.RationalConstructor.randomIrreductible();
|
|
21
|
-
var statementTree = new addNode_1.AddNode(rational.toTree(), rational2.toTree());
|
|
22
|
-
var answerTree = rational.add(rational2).toTree();
|
|
23
|
-
var question = {
|
|
24
|
-
startStatement: (0, latexParser_1.latexParser)(statementTree),
|
|
25
|
-
answer: (0, latexParser_1.latexParser)(answerTree)
|
|
26
|
-
};
|
|
27
|
-
return question;
|
|
28
|
-
}
|
|
29
|
-
exports.getFractionsSum = getFractionsSum;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { RationalConstructor } from "../../../numbers/rationals/rational";
|
|
2
|
-
import { latexParser } from "../../../tree/parsers/latexParser";
|
|
3
|
-
import { AddNode } from "../../../tree/nodes/operators/addNode";
|
|
4
|
-
import { Exercise, Question } from "../../exercise";
|
|
5
|
-
import { getDistinctQuestions } from "../../utils/getDistinctQuestions";
|
|
6
|
-
|
|
7
|
-
export const fractionsSum: Exercise = {
|
|
8
|
-
id: "fractionsSum",
|
|
9
|
-
connector: "=",
|
|
10
|
-
instruction: "Calculer la forme irréductible :",
|
|
11
|
-
label: "Sommes de fractions",
|
|
12
|
-
levels: ["4", "3", "2", "1"],
|
|
13
|
-
section: "Fractions",
|
|
14
|
-
isSingleStep: false,
|
|
15
|
-
generator: (nb: number) => getDistinctQuestions(getFractionsSum, nb),
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export function getFractionsSum(): Question {
|
|
19
|
-
const rational = RationalConstructor.randomIrreductible();
|
|
20
|
-
const rational2 = RationalConstructor.randomIrreductible();
|
|
21
|
-
const statementTree = new AddNode(rational.toTree(), rational2.toTree());
|
|
22
|
-
const answerTree = rational.add(rational2).toTree();
|
|
23
|
-
const question: Question = {
|
|
24
|
-
startStatement: latexParser(statementTree),
|
|
25
|
-
answer: latexParser(answerTree),
|
|
26
|
-
};
|
|
27
|
-
return question;
|
|
28
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
exports.__esModule = true;
|
|
3
|
-
exports.getSimplifyFraction = exports.simplifyFraction = void 0;
|
|
4
|
-
var rational_1 = require("../../../numbers/rationals/rational");
|
|
5
|
-
var latexParser_1 = require("../../../tree/parsers/latexParser");
|
|
6
|
-
var getDistinctQuestions_1 = require("../../utils/getDistinctQuestions");
|
|
7
|
-
exports.simplifyFraction = {
|
|
8
|
-
id: "simplifySqrt",
|
|
9
|
-
connector: "=",
|
|
10
|
-
instruction: "Simplifier :",
|
|
11
|
-
label: "Simplification de fractions",
|
|
12
|
-
levels: ["4", "3", "2"],
|
|
13
|
-
isSingleStep: false,
|
|
14
|
-
section: "Fractions",
|
|
15
|
-
generator: function (nb) { return (0, getDistinctQuestions_1.getDistinctQuestions)(getSimplifyFraction, nb); }
|
|
16
|
-
};
|
|
17
|
-
function getSimplifyFraction() {
|
|
18
|
-
var rational = rational_1.RationalConstructor.randomSimplifiable(10);
|
|
19
|
-
var question = {
|
|
20
|
-
startStatement: (0, latexParser_1.latexParser)(rational.toTree()),
|
|
21
|
-
answer: (0, latexParser_1.latexParser)(rational.simplify().toTree())
|
|
22
|
-
};
|
|
23
|
-
return question;
|
|
24
|
-
}
|
|
25
|
-
exports.getSimplifyFraction = getSimplifyFraction;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { RationalConstructor } from "../../../numbers/rationals/rational";
|
|
2
|
-
import { latexParser } from "../../../tree/parsers/latexParser";
|
|
3
|
-
import { Exercise, Question } from "../../exercise";
|
|
4
|
-
import { getDistinctQuestions } from "../../utils/getDistinctQuestions";
|
|
5
|
-
|
|
6
|
-
export const simplifyFraction: Exercise = {
|
|
7
|
-
id: "simplifySqrt",
|
|
8
|
-
connector: "=",
|
|
9
|
-
instruction: "Simplifier :",
|
|
10
|
-
label: "Simplification de fractions",
|
|
11
|
-
levels: ["4", "3", "2"],
|
|
12
|
-
isSingleStep: false,
|
|
13
|
-
section: "Fractions",
|
|
14
|
-
generator: (nb: number) => getDistinctQuestions(getSimplifyFraction, nb),
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export function getSimplifyFraction(): Question {
|
|
18
|
-
const rational = RationalConstructor.randomSimplifiable(10);
|
|
19
|
-
const question: Question = {
|
|
20
|
-
startStatement: latexParser(rational.toTree()),
|
|
21
|
-
answer: latexParser(rational.simplify().toTree()),
|
|
22
|
-
};
|
|
23
|
-
return question;
|
|
24
|
-
}
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
import { randint } from "../../mathutils/random/randint";
|
|
2
|
-
import { latexParser } from "../../tree/parsers/latexParser";
|
|
3
|
-
import { Node } from "../../tree/nodes/node";
|
|
4
|
-
import { NumberNode } from "../../tree/nodes/numbers/numberNode";
|
|
5
|
-
import { AddNode } from "../../tree/nodes/operators/addNode";
|
|
6
|
-
import { DivideNode } from "../../tree/nodes/operators/divideNode";
|
|
7
|
-
import { MultiplyNode } from "../../tree/nodes/operators/multiplyNode";
|
|
8
|
-
import { coin } from "../../utils/coin";
|
|
9
|
-
import { Exercise, Question } from "../exercise";
|
|
10
|
-
import { getDistinctQuestions } from "../utils/getDistinctQuestions";
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* a*b ±c±d
|
|
14
|
-
* a/b ±c±d
|
|
15
|
-
* a*b*c ± d
|
|
16
|
-
* a*b±c*d
|
|
17
|
-
* a/b ± c*d
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
export const operationsPriorities: Exercise = {
|
|
21
|
-
id: "operationsPriorities",
|
|
22
|
-
connector: "=",
|
|
23
|
-
instruction: "Calculer :",
|
|
24
|
-
label: "Priorités opératoires",
|
|
25
|
-
levels: ["6", "5", "4"],
|
|
26
|
-
section: "Calculs",
|
|
27
|
-
isSingleStep: true,
|
|
28
|
-
generator: (nb: number) => getDistinctQuestions(getPriorityQuestions, nb),
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
export function getPriorityQuestions(): Question {
|
|
32
|
-
const type = randint(1, 6);
|
|
33
|
-
let statement: Node;
|
|
34
|
-
let answer: string = "";
|
|
35
|
-
let a, b, c, d: number;
|
|
36
|
-
|
|
37
|
-
switch (type) {
|
|
38
|
-
case 1: // a*b ±c±d
|
|
39
|
-
[c, d] = [1, 2, 3, 4].map((el) => randint(-10, 11, [0]));
|
|
40
|
-
[a, b] = [1, 2].map((el) => randint(-10, 11));
|
|
41
|
-
statement = coin()
|
|
42
|
-
? //a*b first ou last
|
|
43
|
-
new AddNode(
|
|
44
|
-
new MultiplyNode(new NumberNode(a), new NumberNode(b)),
|
|
45
|
-
new AddNode(new NumberNode(c), new NumberNode(d))
|
|
46
|
-
).shuffle()
|
|
47
|
-
: //a*b middle
|
|
48
|
-
new AddNode(
|
|
49
|
-
new AddNode(new NumberNode(c), new MultiplyNode(new NumberNode(a), new NumberNode(b))),
|
|
50
|
-
new NumberNode(d)
|
|
51
|
-
);
|
|
52
|
-
answer = (a * b + c + d).toString();
|
|
53
|
-
break;
|
|
54
|
-
case 2: // a/b ±c±d
|
|
55
|
-
[b, c, d] = [1, 2, 3].map((el) => randint(-10, 11, [0]));
|
|
56
|
-
a = b * randint(0, 11);
|
|
57
|
-
statement = coin()
|
|
58
|
-
? //a/b first ou last
|
|
59
|
-
new AddNode(
|
|
60
|
-
new DivideNode(new NumberNode(a), new NumberNode(b)),
|
|
61
|
-
new AddNode(new NumberNode(c), new NumberNode(d))
|
|
62
|
-
).shuffle()
|
|
63
|
-
: //a/b middle
|
|
64
|
-
new AddNode(
|
|
65
|
-
new AddNode(new NumberNode(c), new DivideNode(new NumberNode(a), new NumberNode(b))),
|
|
66
|
-
new NumberNode(d)
|
|
67
|
-
);
|
|
68
|
-
answer = (a / b + c + d).toString();
|
|
69
|
-
break;
|
|
70
|
-
case 3: // a*b ± c*d
|
|
71
|
-
[a, b, c, d] = [1, 2, 3, 4].map((el) => randint(-10, 11));
|
|
72
|
-
statement = new AddNode(
|
|
73
|
-
new MultiplyNode(new NumberNode(a), new NumberNode(b)),
|
|
74
|
-
new MultiplyNode(new NumberNode(c), new NumberNode(d))
|
|
75
|
-
);
|
|
76
|
-
answer = (a * b + c * d).toString();
|
|
77
|
-
break;
|
|
78
|
-
case 4: // a*b ± c/d
|
|
79
|
-
[a, b] = [1, 2].map((el) => randint(-10, 11));
|
|
80
|
-
d = randint(-10, 11, [0]);
|
|
81
|
-
c = d * randint(0, 11);
|
|
82
|
-
statement = new AddNode(
|
|
83
|
-
new MultiplyNode(new NumberNode(a), new NumberNode(b)),
|
|
84
|
-
new DivideNode(new NumberNode(c), new NumberNode(d))
|
|
85
|
-
).shuffle();
|
|
86
|
-
answer = (a * b + c / d).toString();
|
|
87
|
-
break;
|
|
88
|
-
case 5: // a/b ± c/d
|
|
89
|
-
[b, d] = [1, 2].map((el) => randint(-10, 11, [0]));
|
|
90
|
-
a = b * randint(0, 11);
|
|
91
|
-
c = d * randint(0, 11);
|
|
92
|
-
statement = new AddNode(
|
|
93
|
-
new DivideNode(new NumberNode(a), new NumberNode(b)),
|
|
94
|
-
new DivideNode(new NumberNode(c), new NumberNode(d))
|
|
95
|
-
);
|
|
96
|
-
answer = (a / b + c / d).toString();
|
|
97
|
-
break;
|
|
98
|
-
case 5: // a*b*c ± d
|
|
99
|
-
[b, d] = [1, 2].map((el) => randint(-10, 11, [0]));
|
|
100
|
-
a = b * randint(0, 11);
|
|
101
|
-
c = d * randint(0, 11);
|
|
102
|
-
statement = new AddNode(
|
|
103
|
-
new MultiplyNode(new MultiplyNode(new NumberNode(a), new NumberNode(b)), new NumberNode(c)),
|
|
104
|
-
new NumberNode(d)
|
|
105
|
-
).shuffle();
|
|
106
|
-
answer = (a * b * c + d).toString();
|
|
107
|
-
break;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
const question: Question = {
|
|
111
|
-
startStatement: latexParser(statement!),
|
|
112
|
-
answer: answer,
|
|
113
|
-
};
|
|
114
|
-
return question;
|
|
115
|
-
}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
exports.__esModule = true;
|
|
3
|
-
exports.getRoundQuestions = exports.roundToMillieme = exports.roundToCentieme = exports.roundToDizieme = exports.roundToUnit = void 0;
|
|
4
|
-
var randint_1 = require("../../../mathutils/random/randint");
|
|
5
|
-
var decimal_1 = require("../../../numbers/decimals/decimal");
|
|
6
|
-
var latexParser_1 = require("../../../tree/parsers/latexParser");
|
|
7
|
-
var getDistinctQuestions_1 = require("../../utils/getDistinctQuestions");
|
|
8
|
-
/**
|
|
9
|
-
* arrondi à l'unité
|
|
10
|
-
*/
|
|
11
|
-
exports.roundToUnit = {
|
|
12
|
-
id: "roundToUnit",
|
|
13
|
-
connector: "\\approx",
|
|
14
|
-
instruction: "Arrondir à l'unité :",
|
|
15
|
-
label: "Arrondir à l'unité",
|
|
16
|
-
levels: ["6", "5"],
|
|
17
|
-
section: "Calculs",
|
|
18
|
-
isSingleStep: true,
|
|
19
|
-
generator: function (nb) { return (0, getDistinctQuestions_1.getDistinctQuestions)(function () { return getRoundQuestions(0); }, nb); }
|
|
20
|
-
};
|
|
21
|
-
/**
|
|
22
|
-
* arrondi à l'unité
|
|
23
|
-
*/
|
|
24
|
-
exports.roundToDizieme = {
|
|
25
|
-
id: "roundToDizieme",
|
|
26
|
-
connector: "\\approx",
|
|
27
|
-
instruction: "Arrondir au dizième :",
|
|
28
|
-
label: "Arrondir au dizième",
|
|
29
|
-
levels: ["6", "5"],
|
|
30
|
-
section: "Calculs",
|
|
31
|
-
isSingleStep: true,
|
|
32
|
-
generator: function (nb) { return (0, getDistinctQuestions_1.getDistinctQuestions)(function () { return getRoundQuestions(1); }, nb); }
|
|
33
|
-
};
|
|
34
|
-
/**
|
|
35
|
-
* arrondi à l'unité
|
|
36
|
-
*/
|
|
37
|
-
exports.roundToCentieme = {
|
|
38
|
-
id: "roundToCentieme",
|
|
39
|
-
connector: "\\approx",
|
|
40
|
-
instruction: "Arrondir au centième :",
|
|
41
|
-
label: "Arrondir au centième",
|
|
42
|
-
levels: ["6", "5"],
|
|
43
|
-
section: "Calculs",
|
|
44
|
-
isSingleStep: true,
|
|
45
|
-
generator: function (nb) { return (0, getDistinctQuestions_1.getDistinctQuestions)(function () { return getRoundQuestions(2); }, nb); }
|
|
46
|
-
};
|
|
47
|
-
/**
|
|
48
|
-
* arrondi à l'unité
|
|
49
|
-
*/
|
|
50
|
-
exports.roundToMillieme = {
|
|
51
|
-
id: "roundToMillieme",
|
|
52
|
-
connector: "\\approx",
|
|
53
|
-
instruction: "Arrondir au millième :",
|
|
54
|
-
label: "Arrondir au millième",
|
|
55
|
-
levels: ["6", "5"],
|
|
56
|
-
section: "Calculs",
|
|
57
|
-
isSingleStep: true,
|
|
58
|
-
generator: function (nb) { return (0, getDistinctQuestions_1.getDistinctQuestions)(function () { return getRoundQuestions(3); }, nb); }
|
|
59
|
-
};
|
|
60
|
-
function getRoundQuestions(precisionAsked) {
|
|
61
|
-
if (precisionAsked === void 0) { precisionAsked = 0; }
|
|
62
|
-
var precision = (0, randint_1.randint)(precisionAsked + 1, precisionAsked + 5);
|
|
63
|
-
var dec = decimal_1.DecimalConstructor.random(0, 1000, precision);
|
|
64
|
-
var question = {
|
|
65
|
-
startStatement: (0, latexParser_1.latexParser)(dec.toTree()),
|
|
66
|
-
answer: (0, latexParser_1.latexParser)(dec.round(precisionAsked).toTree())
|
|
67
|
-
};
|
|
68
|
-
return question;
|
|
69
|
-
}
|
|
70
|
-
exports.getRoundQuestions = getRoundQuestions;
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { randint } from "../../../mathutils/random/randint";
|
|
2
|
-
import { DecimalConstructor } from "../../../numbers/decimals/decimal";
|
|
3
|
-
import { latexParser } from "../../../tree/parsers/latexParser";
|
|
4
|
-
import { Exercise, Question } from "../../exercise";
|
|
5
|
-
import { getDistinctQuestions } from "../../utils/getDistinctQuestions";
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* arrondi à l'unité
|
|
9
|
-
*/
|
|
10
|
-
export const roundToUnit: Exercise = {
|
|
11
|
-
id: "roundToUnit",
|
|
12
|
-
connector: "\\approx",
|
|
13
|
-
instruction: "Arrondir à l'unité :",
|
|
14
|
-
label: "Arrondir à l'unité",
|
|
15
|
-
levels: ["6", "5"],
|
|
16
|
-
section: "Calculs",
|
|
17
|
-
isSingleStep: true,
|
|
18
|
-
generator: (nb: number) => getDistinctQuestions(() => getRoundQuestions(0), nb),
|
|
19
|
-
};
|
|
20
|
-
/**
|
|
21
|
-
* arrondi à l'unité
|
|
22
|
-
*/
|
|
23
|
-
export const roundToDizieme: Exercise = {
|
|
24
|
-
id: "roundToDizieme",
|
|
25
|
-
connector: "\\approx",
|
|
26
|
-
instruction: "Arrondir au dizième :",
|
|
27
|
-
label: "Arrondir au dizième",
|
|
28
|
-
levels: ["6", "5"],
|
|
29
|
-
section: "Calculs",
|
|
30
|
-
isSingleStep: true,
|
|
31
|
-
generator: (nb: number) => getDistinctQuestions(() => getRoundQuestions(1), nb),
|
|
32
|
-
};
|
|
33
|
-
/**
|
|
34
|
-
* arrondi à l'unité
|
|
35
|
-
*/
|
|
36
|
-
export const roundToCentieme: Exercise = {
|
|
37
|
-
id: "roundToCentieme",
|
|
38
|
-
connector: "\\approx",
|
|
39
|
-
instruction: "Arrondir au centième :",
|
|
40
|
-
label: "Arrondir au centième",
|
|
41
|
-
levels: ["6", "5"],
|
|
42
|
-
section: "Calculs",
|
|
43
|
-
isSingleStep: true,
|
|
44
|
-
generator: (nb: number) => getDistinctQuestions(() => getRoundQuestions(2), nb),
|
|
45
|
-
};
|
|
46
|
-
/**
|
|
47
|
-
* arrondi à l'unité
|
|
48
|
-
*/
|
|
49
|
-
export const roundToMillieme: Exercise = {
|
|
50
|
-
id: "roundToMillieme",
|
|
51
|
-
connector: "\\approx",
|
|
52
|
-
instruction: "Arrondir au millième :",
|
|
53
|
-
label: "Arrondir au millième",
|
|
54
|
-
levels: ["6", "5"],
|
|
55
|
-
section: "Calculs",
|
|
56
|
-
isSingleStep: true,
|
|
57
|
-
generator: (nb: number) => getDistinctQuestions(() => getRoundQuestions(3), nb),
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
export function getRoundQuestions(precisionAsked: number = 0): Question {
|
|
61
|
-
const precision = randint(precisionAsked + 1, precisionAsked + 5);
|
|
62
|
-
const dec = DecimalConstructor.random(0, 1000, precision);
|
|
63
|
-
const question: Question = {
|
|
64
|
-
startStatement: latexParser(dec.toTree()),
|
|
65
|
-
answer: latexParser(dec.round(precisionAsked).toTree()),
|
|
66
|
-
};
|
|
67
|
-
return question;
|
|
68
|
-
}
|