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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "math-exercises",
3
- "version": "1.2.7",
3
+ "version": "1.2.8",
4
4
  "description": "Générateurs d'exercices et questions mathématiques en latex",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -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.roundToDizieme = exports.roundToUnit = void 0;
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.roundToDizieme = {
25
- id: "roundToDizieme",
24
+ exports.roundToDixieme = {
25
+ id: "roundToDixieme",
26
26
  connector: "\\approx",
27
- instruction: "Arrondir au dizième :",
28
- label: "Arrondir au dizième",
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 roundToDizieme: Exercise = {
24
- id: "roundToDizieme",
23
+ export const roundToDixieme: Exercise = {
24
+ id: "roundToDixieme",
25
25
  connector: "\\approx",
26
- instruction: "Arrondir au dizième :",
27
- label: "Arrondir au dizième",
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 roundToUnit_1 = require("./calcul/rounding/roundToUnit");
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
- roundToUnit_1.roundToCentieme,
72
- roundToUnit_1.roundToDizieme,
73
- roundToUnit_1.roundToMillieme,
74
- roundToUnit_1.roundToUnit,
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 { roundToCentieme, roundToDizieme, roundToMillieme, roundToUnit } from "./calcul/rounding/roundToUnit";
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
- roundToDizieme,
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
@@ -10,5 +10,4 @@ import { derivateParser } from "./tree/parsers/derivateParser";
10
10
  // console.log(exo.instruction, exo.generator(10));
11
11
  // });
12
12
 
13
- const pol = new Polynomial([2, 3, 1, 4]);
14
13
  export { exercises };
@@ -38,7 +38,7 @@ var Decimal = /** @class */ (function () {
38
38
  }
39
39
  /**
40
40
  *
41
- * @param precision 0 = unité, 1 = dizieme, ... , -1 : dizaine
41
+ * @param precision 0 = unité, 1 = dixieme, ... , -1 : dizaine
42
42
  * @returns
43
43
  */
44
44
  Decimal.prototype.round = function (precision) {
@@ -41,7 +41,7 @@ export class Decimal implements Nombre {
41
41
 
42
42
  /**
43
43
  *
44
- * @param precision 0 = unité, 1 = dizieme, ... , -1 : dizaine
44
+ * @param precision 0 = unité, 1 = dixieme, ... , -1 : dizaine
45
45
  * @returns
46
46
  */
47
47
  round(precision: number): Nombre {
@@ -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
- // }