math-exercises 1.2.7 → 1.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/exercises/calcul/fractions/fractionAndIntegerDivision.ts +0 -2
- package/src/exercises/calcul/rounding/{roundToUnit.js → rounding.js} +22 -5
- package/src/exercises/calcul/rounding/{roundToUnit.ts → rounding.ts} +23 -4
- package/src/exercises/exercise.ts +1 -4
- package/src/exercises/exercises.js +7 -8
- package/src/exercises/exercises.ts +10 -7
- package/src/index.js +0 -5
- package/src/index.ts +0 -1
- package/src/numbers/decimals/decimal.js +1 -1
- package/src/numbers/decimals/decimal.ts +1 -1
- package/src/exercises/calculLitteral/reduction.ts +0 -27
package/package.json
CHANGED
|
@@ -2,9 +2,7 @@ import { randint } from "../../../mathutils/random/randint";
|
|
|
2
2
|
import { Integer } from "../../../numbers/integer/integer";
|
|
3
3
|
import { RationalConstructor } from "../../../numbers/rationals/rational";
|
|
4
4
|
import { latexParser } from "../../../tree/parsers/latexParser";
|
|
5
|
-
import { AddNode } from "../../../tree/nodes/operators/addNode";
|
|
6
5
|
import { DivideNode } from "../../../tree/nodes/operators/divideNode";
|
|
7
|
-
import { MultiplyNode } from "../../../tree/nodes/operators/multiplyNode";
|
|
8
6
|
import { random } from "../../../utils/random";
|
|
9
7
|
import { Exercise, Question } from "../../exercise";
|
|
10
8
|
import { getDistinctQuestions } from "../../utils/getDistinctQuestions";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
exports.__esModule = true;
|
|
3
|
-
exports.getRoundQuestions = exports.roundToMillieme = exports.roundToCentieme = exports.
|
|
3
|
+
exports.getRoundQuestions = exports.allRoundings = exports.roundToMillieme = exports.roundToCentieme = exports.roundToDixieme = exports.roundToUnit = void 0;
|
|
4
4
|
var randint_1 = require("../../../mathutils/random/randint");
|
|
5
5
|
var decimal_1 = require("../../../numbers/decimals/decimal");
|
|
6
6
|
var latexParser_1 = require("../../../tree/parsers/latexParser");
|
|
@@ -21,11 +21,11 @@ exports.roundToUnit = {
|
|
|
21
21
|
/**
|
|
22
22
|
* arrondi à l'unité
|
|
23
23
|
*/
|
|
24
|
-
exports.
|
|
25
|
-
id: "
|
|
24
|
+
exports.roundToDixieme = {
|
|
25
|
+
id: "roundToDixieme",
|
|
26
26
|
connector: "\\approx",
|
|
27
|
-
instruction: "Arrondir au
|
|
28
|
-
label: "Arrondir au
|
|
27
|
+
instruction: "Arrondir au dixième :",
|
|
28
|
+
label: "Arrondir au dixième",
|
|
29
29
|
levels: ["6", "5"],
|
|
30
30
|
section: "Calculs",
|
|
31
31
|
isSingleStep: true,
|
|
@@ -57,11 +57,28 @@ exports.roundToMillieme = {
|
|
|
57
57
|
isSingleStep: true,
|
|
58
58
|
generator: function (nb) { return (0, getDistinctQuestions_1.getDistinctQuestions)(function () { return getRoundQuestions(3); }, nb); }
|
|
59
59
|
};
|
|
60
|
+
exports.allRoundings = {
|
|
61
|
+
id: "allRoundings",
|
|
62
|
+
connector: "\\approx",
|
|
63
|
+
instruction: "",
|
|
64
|
+
label: "Arrondir un nombre décimal",
|
|
65
|
+
levels: ["6", "5"],
|
|
66
|
+
section: "Calculs",
|
|
67
|
+
isSingleStep: true,
|
|
68
|
+
generator: function (nb) { return (0, getDistinctQuestions_1.getDistinctQuestions)(function () { return getRoundQuestions((0, randint_1.randint)(0, 4)); }, nb); }
|
|
69
|
+
};
|
|
70
|
+
var instructions = [
|
|
71
|
+
"Arrondir à l'unité :",
|
|
72
|
+
"Arrondir au dixième :",
|
|
73
|
+
"Arrondir au centième :",
|
|
74
|
+
"Arrondir au millième :",
|
|
75
|
+
];
|
|
60
76
|
function getRoundQuestions(precisionAsked) {
|
|
61
77
|
if (precisionAsked === void 0) { precisionAsked = 0; }
|
|
62
78
|
var precision = (0, randint_1.randint)(precisionAsked + 1, precisionAsked + 5);
|
|
63
79
|
var dec = decimal_1.DecimalConstructor.random(0, 1000, precision);
|
|
64
80
|
var question = {
|
|
81
|
+
instruction: instructions[precisionAsked],
|
|
65
82
|
startStatement: (0, latexParser_1.latexParser)(dec.toTree()),
|
|
66
83
|
answer: (0, latexParser_1.latexParser)(dec.round(precisionAsked).toTree())
|
|
67
84
|
};
|
|
@@ -20,11 +20,11 @@ export const roundToUnit: Exercise = {
|
|
|
20
20
|
/**
|
|
21
21
|
* arrondi à l'unité
|
|
22
22
|
*/
|
|
23
|
-
export const
|
|
24
|
-
id: "
|
|
23
|
+
export const roundToDixieme: Exercise = {
|
|
24
|
+
id: "roundToDixieme",
|
|
25
25
|
connector: "\\approx",
|
|
26
|
-
instruction: "Arrondir au
|
|
27
|
-
label: "Arrondir au
|
|
26
|
+
instruction: "Arrondir au dixième :",
|
|
27
|
+
label: "Arrondir au dixième",
|
|
28
28
|
levels: ["6", "5"],
|
|
29
29
|
section: "Calculs",
|
|
30
30
|
isSingleStep: true,
|
|
@@ -57,10 +57,29 @@ export const roundToMillieme: Exercise = {
|
|
|
57
57
|
generator: (nb: number) => getDistinctQuestions(() => getRoundQuestions(3), nb),
|
|
58
58
|
};
|
|
59
59
|
|
|
60
|
+
export const allRoundings: Exercise = {
|
|
61
|
+
id: "allRoundings",
|
|
62
|
+
connector: "\\approx",
|
|
63
|
+
instruction: "",
|
|
64
|
+
label: "Arrondir un nombre décimal",
|
|
65
|
+
levels: ["6", "5"],
|
|
66
|
+
section: "Calculs",
|
|
67
|
+
isSingleStep: true,
|
|
68
|
+
generator: (nb: number) => getDistinctQuestions(() => getRoundQuestions(randint(0, 4)), nb),
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
const instructions = [
|
|
72
|
+
"Arrondir à l'unité :",
|
|
73
|
+
"Arrondir au dixième :",
|
|
74
|
+
"Arrondir au centième :",
|
|
75
|
+
"Arrondir au millième :",
|
|
76
|
+
];
|
|
77
|
+
|
|
60
78
|
export function getRoundQuestions(precisionAsked: number = 0): Question {
|
|
61
79
|
const precision = randint(precisionAsked + 1, precisionAsked + 5);
|
|
62
80
|
const dec = DecimalConstructor.random(0, 1000, precision);
|
|
63
81
|
const question: Question = {
|
|
82
|
+
instruction: instructions[precisionAsked],
|
|
64
83
|
startStatement: latexParser(dec.toTree()),
|
|
65
84
|
answer: latexParser(dec.round(precisionAsked).toTree()),
|
|
66
85
|
};
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
// }
|
|
6
6
|
|
|
7
7
|
export interface Question {
|
|
8
|
+
instruction?: string;
|
|
8
9
|
startStatement: string;
|
|
9
10
|
answer: string;
|
|
10
11
|
}
|
|
@@ -18,8 +19,4 @@ export interface Exercise {
|
|
|
18
19
|
levels: string[];
|
|
19
20
|
connector: string;
|
|
20
21
|
generator(nb: number): Question[];
|
|
21
|
-
// questions: Question[];
|
|
22
|
-
// constructor({ generatorType, questionsNumber }: ExerciseParameters) {
|
|
23
|
-
|
|
24
|
-
// }
|
|
25
22
|
}
|
|
@@ -10,7 +10,7 @@ var fractionsProduct_1 = require("./calcul/fractions/fractionsProduct");
|
|
|
10
10
|
var fractionsSum_1 = require("./calcul/fractions/fractionsSum");
|
|
11
11
|
var simplifyFraction_1 = require("./calcul/fractions/simplifyFraction");
|
|
12
12
|
var operationsPriorities_1 = require("./calcul/operationsPriorities");
|
|
13
|
-
var
|
|
13
|
+
var rounding_1 = require("./calcul/rounding/rounding");
|
|
14
14
|
var allIdentities_1 = require("./calculLitteral/distributivity/allIdentities");
|
|
15
15
|
var doubleDistributivity_1 = require("./calculLitteral/distributivity/doubleDistributivity");
|
|
16
16
|
var firstIdentity_1 = require("./calculLitteral/distributivity/firstIdentity");
|
|
@@ -28,9 +28,7 @@ var powersPower_1 = require("./powers/powersPower");
|
|
|
28
28
|
var powersProduct_1 = require("./powers/powersProduct");
|
|
29
29
|
var scientificToDecimal_1 = require("./powers/scientificToDecimal");
|
|
30
30
|
var simpifySquareRoot_1 = require("./squareRoots/simpifySquareRoot");
|
|
31
|
-
exports.data = [
|
|
32
|
-
{}
|
|
33
|
-
];
|
|
31
|
+
exports.data = [{}];
|
|
34
32
|
exports.exercises = [
|
|
35
33
|
/**
|
|
36
34
|
* calcul litteral
|
|
@@ -68,10 +66,11 @@ exports.exercises = [
|
|
|
68
66
|
/**
|
|
69
67
|
* rounding
|
|
70
68
|
*/
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
69
|
+
rounding_1.roundToCentieme,
|
|
70
|
+
rounding_1.roundToDixieme,
|
|
71
|
+
rounding_1.roundToMillieme,
|
|
72
|
+
rounding_1.roundToUnit,
|
|
73
|
+
rounding_1.allRoundings,
|
|
75
74
|
/**
|
|
76
75
|
* puissances
|
|
77
76
|
*/
|
|
@@ -7,7 +7,13 @@ import { fractionsProduct } from "./calcul/fractions/fractionsProduct";
|
|
|
7
7
|
import { fractionsSum } from "./calcul/fractions/fractionsSum";
|
|
8
8
|
import { simplifyFraction } from "./calcul/fractions/simplifyFraction";
|
|
9
9
|
import { operationsPriorities } from "./calcul/operationsPriorities";
|
|
10
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
allRoundings,
|
|
12
|
+
roundToCentieme,
|
|
13
|
+
roundToDixieme,
|
|
14
|
+
roundToMillieme,
|
|
15
|
+
roundToUnit,
|
|
16
|
+
} from "./calcul/rounding/rounding";
|
|
11
17
|
import { allIdentities } from "./calculLitteral/distributivity/allIdentities";
|
|
12
18
|
import { doubleDistributivity } from "./calculLitteral/distributivity/doubleDistributivity";
|
|
13
19
|
import { firstIdentity } from "./calculLitteral/distributivity/firstIdentity";
|
|
@@ -26,11 +32,7 @@ import { powersOfTenProduct, powersProduct } from "./powers/powersProduct";
|
|
|
26
32
|
import { scientificToDecimal } from "./powers/scientificToDecimal";
|
|
27
33
|
import { simplifySquareRoot } from "./squareRoots/simpifySquareRoot";
|
|
28
34
|
|
|
29
|
-
export const data = [
|
|
30
|
-
{
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
]
|
|
35
|
+
export const data = [{}];
|
|
34
36
|
|
|
35
37
|
export const exercises = [
|
|
36
38
|
/**
|
|
@@ -74,9 +76,10 @@ export const exercises = [
|
|
|
74
76
|
* rounding
|
|
75
77
|
*/
|
|
76
78
|
roundToCentieme,
|
|
77
|
-
|
|
79
|
+
roundToDixieme,
|
|
78
80
|
roundToMillieme,
|
|
79
81
|
roundToUnit,
|
|
82
|
+
allRoundings,
|
|
80
83
|
/**
|
|
81
84
|
* puissances
|
|
82
85
|
*/
|
package/src/index.js
CHANGED
|
@@ -3,8 +3,3 @@ exports.__esModule = true;
|
|
|
3
3
|
exports.exercises = void 0;
|
|
4
4
|
var exercises_1 = require("./exercises/exercises");
|
|
5
5
|
exports.exercises = exercises_1.exercises;
|
|
6
|
-
var polynomial_1 = require("./polynomials/polynomial");
|
|
7
|
-
// exercises.forEach((exo) => {
|
|
8
|
-
// console.log(exo.instruction, exo.generator(10));
|
|
9
|
-
// });
|
|
10
|
-
var pol = new polynomial_1.Polynomial([2, 3, 1, 4]);
|
package/src/index.ts
CHANGED
|
@@ -38,7 +38,7 @@ var Decimal = /** @class */ (function () {
|
|
|
38
38
|
}
|
|
39
39
|
/**
|
|
40
40
|
*
|
|
41
|
-
* @param precision 0 = unité, 1 =
|
|
41
|
+
* @param precision 0 = unité, 1 = dixieme, ... , -1 : dizaine
|
|
42
42
|
* @returns
|
|
43
43
|
*/
|
|
44
44
|
Decimal.prototype.round = function (precision) {
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
// import { Interval } from "../../sets/intervals/intervals";
|
|
2
|
-
// import { Exercise, Question } from "../exercise";
|
|
3
|
-
// import { getDistinctQuestions } from "../utils/getDistinctQuestions";
|
|
4
|
-
|
|
5
|
-
// export const reduction: Exercise = {
|
|
6
|
-
// id: "reduction",
|
|
7
|
-
// connector: "=",
|
|
8
|
-
// instruction: "Réduire :",
|
|
9
|
-
// label: "Réduire une expression polynomiale",
|
|
10
|
-
// levels: ["3", "2"],
|
|
11
|
-
// isSingleStep: false,
|
|
12
|
-
// section: "Calcul Littéral",
|
|
13
|
-
// generator: (nb: number) => getDistinctQuestions(getReductionQuestion, nb),
|
|
14
|
-
// };
|
|
15
|
-
|
|
16
|
-
// export function getReductionQuestion(): Question {
|
|
17
|
-
// const interval = new Interval("[[1; 10]]").difference(new DiscreteSet([new Integer(0)]));
|
|
18
|
-
// const affine = AffineConstructor.random(interval, interval);
|
|
19
|
-
|
|
20
|
-
// const statementTree = new PowerNode(affine.toTree(), new NumberNode(2));
|
|
21
|
-
// const answerTree = affine.multiply(affine).toTree();
|
|
22
|
-
|
|
23
|
-
// return {
|
|
24
|
-
// statement: latexParse(statementTree),
|
|
25
|
-
// answer: latexParse(answerTree),
|
|
26
|
-
// };
|
|
27
|
-
// }
|