math-exercises 1.3.26 → 1.3.27

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.
Files changed (36) hide show
  1. package/lib/exercises/calcul/fractions/fractionToPercentToDecimal.js +2 -2
  2. package/lib/exercises/calcul/mentalCaluls.ts/mentalAddAndSub.d.ts +4 -0
  3. package/lib/exercises/calcul/mentalCaluls.ts/mentalAddAndSub.d.ts.map +1 -0
  4. package/lib/exercises/calcul/mentalCaluls.ts/mentalAddAndSub.js +46 -0
  5. package/lib/exercises/calcul/mentalCaluls.ts/mentalDivisions.d.ts +4 -0
  6. package/lib/exercises/calcul/mentalCaluls.ts/mentalDivisions.d.ts.map +1 -0
  7. package/lib/exercises/calcul/mentalCaluls.ts/mentalDivisions.js +64 -0
  8. package/lib/exercises/calcul/mentalCaluls.ts/mentalMultiplications.d.ts +4 -0
  9. package/lib/exercises/calcul/mentalCaluls.ts/mentalMultiplications.d.ts.map +1 -0
  10. package/lib/exercises/calcul/mentalCaluls.ts/mentalMultiplications.js +51 -0
  11. package/lib/exercises/calcul/mentalCaluls.ts/mentalPercentage.d.ts +4 -0
  12. package/lib/exercises/calcul/mentalCaluls.ts/mentalPercentage.d.ts.map +1 -0
  13. package/lib/exercises/calcul/mentalCaluls.ts/mentalPercentage.js +67 -0
  14. package/lib/exercises/derivation/derivative/firstDegreeDerivative.d.ts +4 -0
  15. package/lib/exercises/derivation/derivative/firstDegreeDerivative.d.ts.map +1 -0
  16. package/lib/exercises/derivation/derivative/firstDegreeDerivative.js +29 -0
  17. package/lib/exercises/derivation/derivative/inverseFunctionDerivative.d.ts +4 -0
  18. package/lib/exercises/derivation/derivative/inverseFunctionDerivative.d.ts.map +1 -0
  19. package/lib/exercises/derivation/derivative/inverseFunctionDerivative.js +27 -0
  20. package/lib/exercises/derivation/derivative/powerFunctionDerivative.d.ts +4 -0
  21. package/lib/exercises/derivation/derivative/powerFunctionDerivative.d.ts.map +1 -0
  22. package/lib/exercises/derivation/derivative/powerFunctionDerivative.js +35 -0
  23. package/lib/exercises/derivation/derivative/rootFunctionDerivative.d.ts +4 -0
  24. package/lib/exercises/derivation/derivative/rootFunctionDerivative.d.ts.map +1 -0
  25. package/lib/exercises/derivation/derivative/rootFunctionDerivative.js +40 -0
  26. package/lib/exercises/derivation/derivative/secondDegreeDerivative.d.ts +4 -0
  27. package/lib/exercises/derivation/derivative/secondDegreeDerivative.d.ts.map +1 -0
  28. package/lib/exercises/derivation/derivative/secondDegreeDerivative.js +33 -0
  29. package/lib/exercises/derivation/derivative/usualderivative.d.ts.map +1 -1
  30. package/lib/exercises/derivation/derivative/usualderivative.js +22 -54
  31. package/lib/exercises/exercises.d.ts.map +1 -1
  32. package/lib/exercises/exercises.js +18 -0
  33. package/lib/exercises/geometry/cartesian/leadingCoefficient.js +1 -1
  34. package/lib/exercises/proba/conditionalProbability.js +6 -6
  35. package/lib/tree/nodes/operators/divideNode.js +1 -1
  36. package/package.json +1 -1
@@ -61,8 +61,8 @@ function getFractionToPercentToDecimal() {
61
61
  const question = {
62
62
  instruction,
63
63
  //startStatement: `${simplifyNode(fraction).toTex()}`,
64
- answer: answer.replace('.', ','),
65
- keys: [],
64
+ answer,
65
+ keys: ['percent'],
66
66
  };
67
67
  return question;
68
68
  }
@@ -0,0 +1,4 @@
1
+ import { Exercise, Question } from '../../../exercises/exercise';
2
+ export declare const mentalAddAndSub: Exercise;
3
+ export declare function getMentalAddAndSub(): Question;
4
+ //# sourceMappingURL=mentalAddAndSub.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mentalAddAndSub.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calcul/mentalCaluls.ts/mentalAddAndSub.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAQ9D,eAAO,MAAM,eAAe,EAAE,QAU7B,CAAC;AAEF,wBAAgB,kBAAkB,IAAI,QAAQ,CA4B7C"}
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getMentalAddAndSub = exports.mentalAddAndSub = void 0;
4
+ const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
5
+ const randint_1 = require("../../../math/utils/random/randint");
6
+ const round_1 = require("../../../math/utils/round");
7
+ const numberNode_1 = require("../../../tree/nodes/numbers/numberNode");
8
+ const addNode_1 = require("../../../tree/nodes/operators/addNode");
9
+ const coinFlip_1 = require("../../../utils/coinFlip");
10
+ exports.mentalAddAndSub = {
11
+ id: 'mentalAddAndSub',
12
+ connector: '=',
13
+ instruction: 'Calculer :',
14
+ label: "Effectuer mentalement des calculs d'additions et de soustractions simples",
15
+ levels: ['6', '5', '4', '3', '2', '1', '0'],
16
+ section: 'Calculs',
17
+ isSingleStep: true,
18
+ generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getMentalAddAndSub, nb),
19
+ keys: [],
20
+ };
21
+ function getMentalAddAndSub() {
22
+ let numbers = [];
23
+ const nbrOperations = (0, coinFlip_1.coinFlip)() ? 2 : 3;
24
+ numbers[0] = (0, coinFlip_1.coinFlip)() ? (0, randint_1.randint)(1, 10) : (0, randint_1.randint)(10, 100) / 10;
25
+ numbers[1] = (0, coinFlip_1.coinFlip)() ? (0, randint_1.randint)(-100, 100) / 10 : (0, randint_1.randint)(-1000, 1000) / 100;
26
+ let sum = numbers[0] + numbers[1];
27
+ if (nbrOperations === 3) {
28
+ numbers[2] = (0, coinFlip_1.coinFlip)() ? (0, randint_1.randint)(-100, 100) / 10 : (0, randint_1.randint)(-1000, 1000) / 100;
29
+ sum += numbers[2];
30
+ sum = (0, round_1.round)(sum * 10, 0);
31
+ numbers[2] = (0, round_1.round)(sum / 10 - numbers[0] - numbers[1], 2);
32
+ sum = numbers[0] + numbers[1] + numbers[2];
33
+ }
34
+ const allNumbersNodes = numbers.map((nb) => new numberNode_1.NumberNode(nb));
35
+ let statementTree = new addNode_1.AddNode(allNumbersNodes[0], allNumbersNodes[1]);
36
+ for (let i = 2; i < nbrOperations; i++)
37
+ statementTree = new addNode_1.AddNode(statementTree, allNumbersNodes[i]);
38
+ statementTree.shuffle();
39
+ const question = {
40
+ startStatement: statementTree.toTex(),
41
+ answer: (0, round_1.round)(sum, 2) + '',
42
+ keys: [],
43
+ };
44
+ return question;
45
+ }
46
+ exports.getMentalAddAndSub = getMentalAddAndSub;
@@ -0,0 +1,4 @@
1
+ import { Exercise, Question } from '../../../exercises/exercise';
2
+ export declare const mentalDivisions: Exercise;
3
+ export declare function getMentalDivisions(): Question;
4
+ //# sourceMappingURL=mentalDivisions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mentalDivisions.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calcul/mentalCaluls.ts/mentalDivisions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAQ9D,eAAO,MAAM,eAAe,EAAE,QAU7B,CAAC;AAEF,wBAAgB,kBAAkB,IAAI,QAAQ,CAuD7C"}
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getMentalDivisions = exports.mentalDivisions = void 0;
4
+ const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
5
+ const randint_1 = require("../../../math/utils/random/randint");
6
+ const round_1 = require("../../../math/utils/round");
7
+ const numberNode_1 = require("../../../tree/nodes/numbers/numberNode");
8
+ const divideNode_1 = require("../../../tree/nodes/operators/divideNode");
9
+ const coinFlip_1 = require("../../../utils/coinFlip");
10
+ exports.mentalDivisions = {
11
+ id: 'mentalDivisions',
12
+ connector: '=',
13
+ instruction: 'Calculer :',
14
+ label: 'Effectuer mentalement des calculs de divisions simples',
15
+ levels: ['6', '5', '4', '3', '2', '1', '0'],
16
+ section: 'Calculs',
17
+ isSingleStep: true,
18
+ generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getMentalDivisions, nb),
19
+ keys: [],
20
+ };
21
+ function getMentalDivisions() {
22
+ let a = 1, b = 1, c = 1;
23
+ const rand = (0, randint_1.randint)(1, 7);
24
+ switch (rand) {
25
+ case 1: // random / 10 ou random / 100
26
+ a = (0, randint_1.randint)(1, 100);
27
+ b = (0, coinFlip_1.coinFlip)() ? 10 : 100;
28
+ break;
29
+ case 2: // ex : 0.28 / 0.7 ou 0.6 / 0.2
30
+ b = (0, randint_1.randint)(1, 10) / 10;
31
+ a = (0, coinFlip_1.coinFlip)() ? (0, round_1.round)((b * (0, randint_1.randint)(2, 10)) / 10, 2) : (0, round_1.round)(b * (0, randint_1.randint)(2, 10), 1);
32
+ break;
33
+ case 3: // ex : 25 / 50
34
+ b = (0, randint_1.randint)(1, 10) * 10;
35
+ a = (b / 10) * (0, randint_1.randint)(-9, 10, [-1, 0, 1]);
36
+ break;
37
+ case 4: // ex : ex : 55 / 1.1
38
+ b = (0, randint_1.randint)(1, 16) / 10;
39
+ a = b * (0, randint_1.randint)(2, 10) * 10;
40
+ a = (0, round_1.round)(a, 0);
41
+ break;
42
+ case 5: // ex : 5.6 / -7
43
+ b = (0, randint_1.randint)(-9, 10, [-1, 0, 1]);
44
+ a = (0, round_1.round)((Math.abs(b) / 10) * (0, randint_1.randint)(2, 10), 1);
45
+ break;
46
+ case 6: // ex 24 / (12 / 2)
47
+ c = (0, randint_1.randint)(1, 10);
48
+ b = c * (0, randint_1.randint)(2, 10);
49
+ a = (b / c) * (0, randint_1.randint)(2, 10);
50
+ break;
51
+ }
52
+ const allNumbersNodes = rand === 6 ? [a, b, c].map((nb) => new numberNode_1.NumberNode(nb)) : [a, b].map((nb) => new numberNode_1.NumberNode(nb));
53
+ const statementTree = rand === 6
54
+ ? new divideNode_1.DivideNode(allNumbersNodes[0], new divideNode_1.DivideNode(allNumbersNodes[1], allNumbersNodes[2]))
55
+ : new divideNode_1.DivideNode(allNumbersNodes[0], allNumbersNodes[1]);
56
+ const answer = rand === 6 ? a / (b / c) : a / b;
57
+ const question = {
58
+ startStatement: statementTree.toTex(),
59
+ answer: (0, round_1.round)(answer, 2) + '',
60
+ keys: [],
61
+ };
62
+ return question;
63
+ }
64
+ exports.getMentalDivisions = getMentalDivisions;
@@ -0,0 +1,4 @@
1
+ import { Exercise, Question } from '../../../exercises/exercise';
2
+ export declare const mentalMultiplications: Exercise;
3
+ export declare function getMentalMultiplications(): Question;
4
+ //# sourceMappingURL=mentalMultiplications.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mentalMultiplications.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calcul/mentalCaluls.ts/mentalMultiplications.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAQ9D,eAAO,MAAM,qBAAqB,EAAE,QAUnC,CAAC;AAEF,wBAAgB,wBAAwB,IAAI,QAAQ,CAmCnD"}
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getMentalMultiplications = exports.mentalMultiplications = void 0;
4
+ const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
5
+ const randint_1 = require("../../../math/utils/random/randint");
6
+ const round_1 = require("../../../math/utils/round");
7
+ const numberNode_1 = require("../../../tree/nodes/numbers/numberNode");
8
+ const multiplyNode_1 = require("../../../tree/nodes/operators/multiplyNode");
9
+ const coinFlip_1 = require("../../../utils/coinFlip");
10
+ exports.mentalMultiplications = {
11
+ id: 'mentalMultiplications',
12
+ connector: '=',
13
+ instruction: 'Calculer :',
14
+ label: 'Effectuer mentalement des calculs de multiplications simples',
15
+ levels: ['6', '5', '4', '3', '2', '1', '0'],
16
+ section: 'Calculs',
17
+ isSingleStep: true,
18
+ generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getMentalMultiplications, nb),
19
+ keys: [],
20
+ };
21
+ function getMentalMultiplications() {
22
+ const a = (0, randint_1.randint)(-9, 10, [-1, 0, 1]);
23
+ const b = (0, coinFlip_1.coinFlip)()
24
+ ? (0, randint_1.randint)(-99, 100, [-10, 0, 10]) / 10
25
+ : (0, coinFlip_1.coinFlip)()
26
+ ? (0, randint_1.randint)(2, 10) * 10 + (0, randint_1.randint)(-1, 2, [0])
27
+ : (0, randint_1.randint)(2, 10) + (0, randint_1.randint)(-1, 2, [0]) / 10;
28
+ const c = (0, randint_1.randint)(2, 9, [3, 6, 7]);
29
+ const d = (0, randint_1.randint)(2, 11, [c]) / c;
30
+ const f = (0, coinFlip_1.coinFlip)() ? (0, randint_1.randint)(2, 10) / 10 : (0, randint_1.randint)(2, 100) / 100;
31
+ let numbers = [a, b, c, d, f];
32
+ const allNumbersNodes = numbers.map((nb) => new numberNode_1.NumberNode(nb));
33
+ let statementTree;
34
+ let answer;
35
+ if ((0, coinFlip_1.coinFlip)()) {
36
+ statementTree = new multiplyNode_1.MultiplyNode(allNumbersNodes[0], allNumbersNodes[1]);
37
+ answer = numbers[0] * numbers[1];
38
+ }
39
+ else {
40
+ statementTree = new multiplyNode_1.MultiplyNode(allNumbersNodes[2], new multiplyNode_1.MultiplyNode(allNumbersNodes[3], allNumbersNodes[4]));
41
+ answer = numbers[2] * numbers[3] * numbers[4];
42
+ }
43
+ statementTree.shuffle();
44
+ const question = {
45
+ startStatement: statementTree.toTex(),
46
+ answer: (0, round_1.round)(answer, 2) + '',
47
+ keys: [],
48
+ };
49
+ return question;
50
+ }
51
+ exports.getMentalMultiplications = getMentalMultiplications;
@@ -0,0 +1,4 @@
1
+ import { Exercise, Question } from '../../../exercises/exercise';
2
+ export declare const mentalPercentage: Exercise;
3
+ export declare function getMentalPercentage(): Question;
4
+ //# sourceMappingURL=mentalPercentage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mentalPercentage.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calcul/mentalCaluls.ts/mentalPercentage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAK9D,eAAO,MAAM,gBAAgB,EAAE,QAU9B,CAAC;AAEF,wBAAgB,mBAAmB,IAAI,QAAQ,CA6D9C"}
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getMentalPercentage = exports.mentalPercentage = void 0;
4
+ const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
5
+ const randint_1 = require("../../../math/utils/random/randint");
6
+ const coinFlip_1 = require("../../../utils/coinFlip");
7
+ exports.mentalPercentage = {
8
+ id: 'mentalPercentage',
9
+ connector: '=',
10
+ instruction: '',
11
+ label: 'Effectuer mentalement des calculs de pourcentages simples',
12
+ levels: ['5', '4', '3', '2', '1', '0'],
13
+ section: 'Pourcentages',
14
+ isSingleStep: true,
15
+ generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getMentalPercentage, nb),
16
+ keys: [],
17
+ };
18
+ function getMentalPercentage() {
19
+ let a = 1, b = 1;
20
+ const rand = (0, randint_1.randint)(1, 10);
21
+ switch (rand) {
22
+ case 1: // 10% de 70%
23
+ a = 10 * (0, randint_1.randint)(1, 3);
24
+ b = (0, randint_1.randint)(1, 200);
25
+ break;
26
+ case 2: // 30% de 9
27
+ a = (0, randint_1.randint)(1, 10);
28
+ b = (0, randint_1.randint)(1, 10) * a;
29
+ a *= 10;
30
+ break;
31
+ case 3: // 32% de 10
32
+ a = (0, randint_1.randint)(1, 100);
33
+ b = 10 ** (0, randint_1.randint)(1, 3);
34
+ break;
35
+ case 4: // 14% de 50 ou 230% de 20
36
+ a = (0, coinFlip_1.coinFlip)() ? (0, randint_1.randint)(1, 100) : (0, randint_1.randint)(11, 30) * 10;
37
+ b = (0, coinFlip_1.coinFlip)() ? 20 : 50;
38
+ break;
39
+ case 5: // 12.5% de 72
40
+ a = (0, coinFlip_1.coinFlip)() ? 12.5 : 12.5 + 100;
41
+ b = 8 * (0, randint_1.randint)(1, 25);
42
+ break;
43
+ case 6: // 15% de 90
44
+ a = (0, coinFlip_1.coinFlip)() ? 15 * (0, randint_1.randint)(1, 6) : 30 * (0, randint_1.randint)(1, 4, [2]) + 100;
45
+ b = 3 * (0, randint_1.randint)(1, 10) * 10;
46
+ break;
47
+ case 7: // 20% de x
48
+ a = 20 * (0, randint_1.randint)(1, 12, [5]);
49
+ b = 5 * (0, randint_1.randint)(1, 21);
50
+ break;
51
+ case 8: // 75% de x
52
+ a = 25 * (0, randint_1.randint)(1, 8, [4]);
53
+ b = 4 * (0, randint_1.randint)(1, 75);
54
+ break;
55
+ case 9: //0.5 % de 1000
56
+ a = (0, randint_1.randint)(1, 10) / 10;
57
+ b = 1000;
58
+ break;
59
+ }
60
+ const question = {
61
+ instruction: `Calculer $${a}\\%$ de $${b}$`,
62
+ answer: (a * b) / 100 + '',
63
+ keys: [],
64
+ };
65
+ return question;
66
+ }
67
+ exports.getMentalPercentage = getMentalPercentage;
@@ -0,0 +1,4 @@
1
+ import { Exercise, Question } from '../../../exercises/exercise';
2
+ export declare const firstDegreeDerivative: Exercise;
3
+ export declare function getFirstDegreeDerivative(): Question;
4
+ //# sourceMappingURL=firstDegreeDerivative.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"firstDegreeDerivative.d.ts","sourceRoot":"","sources":["../../../../src/exercises/derivation/derivative/firstDegreeDerivative.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAK9D,eAAO,MAAM,qBAAqB,EAAE,QAUnC,CAAC;AAEF,wBAAgB,wBAAwB,IAAI,QAAQ,CAYnD"}
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getFirstDegreeDerivative = exports.firstDegreeDerivative = void 0;
4
+ const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
5
+ const polynomial_1 = require("../../../math/polynomials/polynomial");
6
+ const randint_1 = require("../../../math/utils/random/randint");
7
+ exports.firstDegreeDerivative = {
8
+ id: 'firstDegreeDerivative',
9
+ connector: '=',
10
+ instruction: '',
11
+ label: "Dérivée d'un polynôme de degré 1",
12
+ levels: ['1', '0'],
13
+ section: 'Dérivation',
14
+ isSingleStep: false,
15
+ generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getFirstDegreeDerivative, nb),
16
+ keys: ['x'],
17
+ };
18
+ function getFirstDegreeDerivative() {
19
+ const [a, b] = [(0, randint_1.randint)(-9, 10), (0, randint_1.randint)(-9, 10)];
20
+ const polynomial = new polynomial_1.Polynomial([b, a]);
21
+ const question = {
22
+ instruction: `Déterminer la fonction dérivée $f'$ de la fonction $f$ définie par $f(x) = ${polynomial.toString()}$ `,
23
+ startStatement: `f'(x)`,
24
+ answer: a + '',
25
+ keys: [],
26
+ };
27
+ return question;
28
+ }
29
+ exports.getFirstDegreeDerivative = getFirstDegreeDerivative;
@@ -0,0 +1,4 @@
1
+ import { Exercise, Question } from '../../../exercises/exercise';
2
+ export declare const inverseFunctionDerivative: Exercise;
3
+ export declare function getInverseFunctionDerivative(): Question;
4
+ //# sourceMappingURL=inverseFunctionDerivative.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inverseFunctionDerivative.d.ts","sourceRoot":"","sources":["../../../../src/exercises/derivation/derivative/inverseFunctionDerivative.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAI9D,eAAO,MAAM,yBAAyB,EAAE,QAUvC,CAAC;AAEF,wBAAgB,4BAA4B,IAAI,QAAQ,CAWvD"}
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getInverseFunctionDerivative = exports.inverseFunctionDerivative = void 0;
4
+ const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
5
+ const randint_1 = require("../../../math/utils/random/randint");
6
+ exports.inverseFunctionDerivative = {
7
+ id: 'inverseFunctionDerivative',
8
+ connector: '=',
9
+ instruction: '',
10
+ label: "Dérivée d'une fonction inverse",
11
+ levels: ['1', '0'],
12
+ section: 'Dérivation',
13
+ isSingleStep: false,
14
+ generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getInverseFunctionDerivative, nb),
15
+ keys: ['x'],
16
+ };
17
+ function getInverseFunctionDerivative() {
18
+ const a = (0, randint_1.randint)(-10, 10, [0]);
19
+ const question = {
20
+ instruction: `Déterminer la fonction dérivée $f'$ de la fonction $f$ définie par $f(x) =\\frac{${a}}{x}$ `,
21
+ startStatement: `f'(x)`,
22
+ answer: `\\frac{${-a}}{x^2}`,
23
+ keys: ['x'],
24
+ };
25
+ return question;
26
+ }
27
+ exports.getInverseFunctionDerivative = getInverseFunctionDerivative;
@@ -0,0 +1,4 @@
1
+ import { Exercise, Question } from '../../../exercises/exercise';
2
+ export declare const powerFunctionDerivative: Exercise;
3
+ export declare function getPowerFunctionDerivative(): Question;
4
+ //# sourceMappingURL=powerFunctionDerivative.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"powerFunctionDerivative.d.ts","sourceRoot":"","sources":["../../../../src/exercises/derivation/derivative/powerFunctionDerivative.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAS9D,eAAO,MAAM,uBAAuB,EAAE,QAUrC,CAAC;AAEF,wBAAgB,0BAA0B,IAAI,QAAQ,CAoBrD"}
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getPowerFunctionDerivative = exports.powerFunctionDerivative = void 0;
4
+ const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
5
+ const randint_1 = require("../../../math/utils/random/randint");
6
+ const numberNode_1 = require("../../../tree/nodes/numbers/numberNode");
7
+ const multiplyNode_1 = require("../../../tree/nodes/operators/multiplyNode");
8
+ const powerNode_1 = require("../../../tree/nodes/operators/powerNode");
9
+ const variableNode_1 = require("../../../tree/nodes/variables/variableNode");
10
+ const simplify_1 = require("../../../tree/parsers/simplify");
11
+ exports.powerFunctionDerivative = {
12
+ id: 'powerFunctionDerivative',
13
+ connector: '=',
14
+ instruction: '',
15
+ label: "Dérivée d'une fonction puissance",
16
+ levels: ['1', '0'],
17
+ section: 'Dérivation',
18
+ isSingleStep: false,
19
+ generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getPowerFunctionDerivative, nb),
20
+ keys: ['x'],
21
+ };
22
+ function getPowerFunctionDerivative() {
23
+ const a = (0, randint_1.randint)(-10, 10, [0]);
24
+ const n = (0, randint_1.randint)(2, 10);
25
+ const statement = (0, simplify_1.simplifyNode)(new multiplyNode_1.MultiplyNode(new numberNode_1.NumberNode(a), new powerNode_1.PowerNode(new variableNode_1.VariableNode('x'), new numberNode_1.NumberNode(n))));
26
+ const answerStatement = (0, simplify_1.simplifyNode)(new multiplyNode_1.MultiplyNode(new numberNode_1.NumberNode(a * n), new powerNode_1.PowerNode(new variableNode_1.VariableNode('x'), new numberNode_1.NumberNode(n - 1))));
27
+ const question = {
28
+ instruction: `Déterminer la fonction dérivée $f'$ de la fonction $f$ définie par $f(x) =${statement.toTex()}$ `,
29
+ startStatement: `f'(x)`,
30
+ answer: answerStatement.toTex(),
31
+ keys: ['x'],
32
+ };
33
+ return question;
34
+ }
35
+ exports.getPowerFunctionDerivative = getPowerFunctionDerivative;
@@ -0,0 +1,4 @@
1
+ import { Exercise, Question } from '../../../exercises/exercise';
2
+ export declare const rootFunctionDerivative: Exercise;
3
+ export declare function getRootFunctionDerivative(): Question;
4
+ //# sourceMappingURL=rootFunctionDerivative.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rootFunctionDerivative.d.ts","sourceRoot":"","sources":["../../../../src/exercises/derivation/derivative/rootFunctionDerivative.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAK9D,eAAO,MAAM,sBAAsB,EAAE,QAUpC,CAAC;AAEF,wBAAgB,yBAAyB,IAAI,QAAQ,CAqBpD"}
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getRootFunctionDerivative = exports.rootFunctionDerivative = void 0;
4
+ const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
5
+ const randint_1 = require("../../../math/utils/random/randint");
6
+ const round_1 = require("../../../math/utils/round");
7
+ exports.rootFunctionDerivative = {
8
+ id: 'rootFunctionDerivative',
9
+ connector: '=',
10
+ instruction: '',
11
+ label: "Dérivée d'une fonction racine",
12
+ levels: ['1', '0'],
13
+ section: 'Dérivation',
14
+ isSingleStep: false,
15
+ generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getRootFunctionDerivative, nb),
16
+ keys: ['x'],
17
+ };
18
+ function getRootFunctionDerivative() {
19
+ const a = (0, randint_1.randint)(-10, 10, [0]);
20
+ let instruction = `Déterminer la fonction dérivée $f'$ de la fonction $f$ définie par $f(x) =$ `;
21
+ let answer = '';
22
+ if (a === 1)
23
+ instruction += `$\\sqrt{x}$`;
24
+ else if (a === -1)
25
+ instruction += `$-\\sqrt{x}$`;
26
+ else
27
+ instruction += `$${a}\\sqrt{x}$`;
28
+ if (a / 2 === (0, round_1.round)(a / 2, 0))
29
+ answer = `\\frac{${a / 2}}{\\sqrt{x}}`;
30
+ else
31
+ answer = `\\frac{${a}}{2\\sqrt{x}}`;
32
+ const question = {
33
+ instruction,
34
+ startStatement: `f'(x)`,
35
+ answer,
36
+ keys: ['x'],
37
+ };
38
+ return question;
39
+ }
40
+ exports.getRootFunctionDerivative = getRootFunctionDerivative;
@@ -0,0 +1,4 @@
1
+ import { Exercise, Question } from '../../../exercises/exercise';
2
+ export declare const secondDegreeDerivative: Exercise;
3
+ export declare function getSecondDegreeDerivative(): Question;
4
+ //# sourceMappingURL=secondDegreeDerivative.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"secondDegreeDerivative.d.ts","sourceRoot":"","sources":["../../../../src/exercises/derivation/derivative/secondDegreeDerivative.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAK9D,eAAO,MAAM,sBAAsB,EAAE,QAUpC,CAAC;AAEF,wBAAgB,yBAAyB,IAAI,QAAQ,CAiBpD"}
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getSecondDegreeDerivative = exports.secondDegreeDerivative = void 0;
4
+ const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
5
+ const polynomial_1 = require("../../../math/polynomials/polynomial");
6
+ const randint_1 = require("../../../math/utils/random/randint");
7
+ exports.secondDegreeDerivative = {
8
+ id: 'secondDegreeDerivative',
9
+ connector: '=',
10
+ instruction: '',
11
+ label: "Dérivée d'un polynôme de degré 2",
12
+ levels: ['1', '0'],
13
+ section: 'Dérivation',
14
+ isSingleStep: false,
15
+ generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getSecondDegreeDerivative, nb),
16
+ keys: ['x'],
17
+ };
18
+ function getSecondDegreeDerivative() {
19
+ const coefficients = [];
20
+ coefficients.push((0, randint_1.randint)(-9, 10, [0]));
21
+ for (let i = 1; i <= 2; i++)
22
+ coefficients.push((0, randint_1.randint)(-9, 10));
23
+ const polynomial = new polynomial_1.Polynomial(coefficients);
24
+ const derivative = polynomial.derivate();
25
+ const question = {
26
+ instruction: `Déterminer la fonction dérivée $f'$ de la fonction $f$ définie par $f(x) = ${polynomial.toString()}$ `,
27
+ startStatement: `f'(x)`,
28
+ answer: derivative.toString(),
29
+ keys: ['x'],
30
+ };
31
+ return question;
32
+ }
33
+ exports.getSecondDegreeDerivative = getSecondDegreeDerivative;
@@ -1 +1 @@
1
- {"version":3,"file":"usualderivative.d.ts","sourceRoot":"","sources":["../../../../src/exercises/derivation/derivative/usualderivative.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAGpD,eAAO,MAAM,eAAe,EAAE,QAU7B,CAAC;AAEF,wBAAgB,kBAAkB,IAAI,QAAQ,CAsD7C"}
1
+ {"version":3,"file":"usualderivative.d.ts","sourceRoot":"","sources":["../../../../src/exercises/derivation/derivative/usualderivative.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AASpD,eAAO,MAAM,eAAe,EAAE,QAU7B,CAAC;AAEF,wBAAgB,kBAAkB,IAAI,QAAQ,CAmB7C"}
@@ -1,10 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getUsualDerivative = exports.usualDerivative = void 0;
4
- const polynomial_1 = require("../../../math/polynomials/polynomial");
5
4
  const randint_1 = require("../../../math/utils/random/randint");
6
- const round_1 = require("../../../math/utils/round");
7
5
  const getDistinctQuestions_1 = require("../../utils/getDistinctQuestions");
6
+ const firstDegreeDerivative_1 = require("./firstDegreeDerivative");
7
+ const inverseFunctionDerivative_1 = require("./inverseFunctionDerivative");
8
+ const powerFunctionDerivative_1 = require("./powerFunctionDerivative");
9
+ const rootFunctionDerivative_1 = require("./rootFunctionDerivative");
10
+ const secondDegreeDerivative_1 = require("./secondDegreeDerivative");
11
+ const thirdDegreeDerivative_1 = require("./thirdDegreeDerivative");
8
12
  exports.usualDerivative = {
9
13
  id: 'usualDerivative',
10
14
  connector: '=',
@@ -17,58 +21,22 @@ exports.usualDerivative = {
17
21
  keys: ['x'],
18
22
  };
19
23
  function getUsualDerivative() {
20
- const a = (0, randint_1.randint)(-10, 10, [0]);
21
- const b = (0, randint_1.randint)(-10, 10);
22
- const c = (0, randint_1.randint)(-10, 10);
23
- const flip = (0, randint_1.randint)(1, 6);
24
- let instruction = `Déterminer la fonction dérivée $f'$ de la fonction $f$ définie par $f(x) =$ `;
25
- let answer = '';
26
- switch (flip) {
27
- case 1: {
28
- // f(x) = c
29
- instruction += `$${c}$`;
30
- answer = `0`;
31
- break;
32
- }
33
- case 2: {
34
- // f(x) = ax + b
35
- instruction += `$${new polynomial_1.Polynomial([b, a]).toString()}$`;
36
- answer = `${a}`;
37
- break;
38
- }
39
- case 3: {
40
- // f(x) = ax² + bx + c
41
- instruction += `$${new polynomial_1.Polynomial([c, b, a]).toString()}$`;
42
- answer = `${new polynomial_1.Polynomial([b, 2 * a]).toString()}`;
43
- break;
44
- }
45
- case 4: {
46
- //f(x) = a/x
47
- instruction += `$\\frac{${a}}{x}$`;
48
- answer = `\\frac{${-a}}{x^2}`;
49
- break;
50
- }
51
- case 5: {
52
- // f(x) = a * sqrt(x)
53
- if (a === 1)
54
- instruction += `$\\sqrt{x}$`;
55
- else if (a === -1)
56
- instruction += `$-\\sqrt{x}$`;
57
- else
58
- instruction += `$${a}\\sqrt{x}$`;
59
- if (a / 2 === (0, round_1.round)(a / 2, 0))
60
- answer = `\\frac{${a / 2}}{\\sqrt{x}}`;
61
- else
62
- answer = `\\frac{${a}}{2\\sqrt{x}}`;
63
- break;
64
- }
24
+ const rand = (0, randint_1.randint)(1, 7);
25
+ switch (rand) {
26
+ case 1:
27
+ return (0, firstDegreeDerivative_1.getFirstDegreeDerivative)();
28
+ case 2:
29
+ return (0, secondDegreeDerivative_1.getSecondDegreeDerivative)();
30
+ case 3:
31
+ return (0, thirdDegreeDerivative_1.getThirdDegreeDerivative)();
32
+ case 4:
33
+ return (0, inverseFunctionDerivative_1.getInverseFunctionDerivative)();
34
+ case 5:
35
+ return (0, powerFunctionDerivative_1.getPowerFunctionDerivative)();
36
+ case 6:
37
+ return (0, rootFunctionDerivative_1.getRootFunctionDerivative)();
38
+ default:
39
+ throw Error('erreur');
65
40
  }
66
- const question = {
67
- instruction,
68
- startStatement: `f'(x)`,
69
- answer,
70
- keys: ['x'],
71
- };
72
- return question;
73
41
  }
74
42
  exports.getUsualDerivative = getUsualDerivative;
@@ -1 +1 @@
1
- {"version":3,"file":"exercises.d.ts","sourceRoot":"","sources":["../../src/exercises/exercises.ts"],"names":[],"mappings":"AAqEA,eAAO,MAAM,SAAS,iCA8GrB,CAAC"}
1
+ {"version":3,"file":"exercises.d.ts","sourceRoot":"","sources":["../../src/exercises/exercises.ts"],"names":[],"mappings":"AA8EA,eAAO,MAAM,SAAS,iCAuHrB,CAAC"}
@@ -11,6 +11,10 @@ const fractionsDivision_1 = require("./calcul/fractions/fractionsDivision");
11
11
  const fractionsProduct_1 = require("./calcul/fractions/fractionsProduct");
12
12
  const fractionsSum_1 = require("./calcul/fractions/fractionsSum");
13
13
  const simplifyFraction_1 = require("./calcul/fractions/simplifyFraction");
14
+ const mentalAddAndSub_1 = require("./calcul/mentalCaluls.ts/mentalAddAndSub");
15
+ const mentalDivisions_1 = require("./calcul/mentalCaluls.ts/mentalDivisions");
16
+ const mentalMultiplications_1 = require("./calcul/mentalCaluls.ts/mentalMultiplications");
17
+ const mentalPercentage_1 = require("./calcul/mentalCaluls.ts/mentalPercentage");
14
18
  const operationsPriorities_1 = require("./calcul/operations/operationsPriorities");
15
19
  const operationsPrioritiesWithoutRelative_1 = require("./calcul/operations/operationsPrioritiesWithoutRelative");
16
20
  const rounding_1 = require("./calcul/rounding/rounding");
@@ -30,6 +34,11 @@ const factoIdRmq1_1 = require("./calculLitteral/factorisation/factoIdRmq1");
30
34
  const factoIdRmq2_1 = require("./calculLitteral/factorisation/factoIdRmq2");
31
35
  const factoIdRmq3_1 = require("./calculLitteral/factorisation/factoIdRmq3");
32
36
  const factoType1Exercise_1 = require("./calculLitteral/factorisation/factoType1Exercise");
37
+ const firstDegreeDerivative_1 = require("./derivation/derivative/firstDegreeDerivative");
38
+ const inverseFunctionDerivative_1 = require("./derivation/derivative/inverseFunctionDerivative");
39
+ const powerFunctionDerivative_1 = require("./derivation/derivative/powerFunctionDerivative");
40
+ const rootFunctionDerivative_1 = require("./derivation/derivative/rootFunctionDerivative");
41
+ const secondDegreeDerivative_1 = require("./derivation/derivative/secondDegreeDerivative");
33
42
  const thirdDegreeDerivative_1 = require("./derivation/derivative/thirdDegreeDerivative");
34
43
  const usualderivative_1 = require("./derivation/derivative/usualderivative");
35
44
  const derivativeNumberReading_1 = require("./geometry/cartesian/derivativeNumberReading");
@@ -153,11 +162,20 @@ exports.exercises = [
153
162
  reciprocalPercentage_1.reciprocalPercentage,
154
163
  averageEvolutionRate_1.averageEvolutionRate,
155
164
  usualderivative_1.usualDerivative,
165
+ firstDegreeDerivative_1.firstDegreeDerivative,
166
+ secondDegreeDerivative_1.secondDegreeDerivative,
156
167
  thirdDegreeDerivative_1.thirdDegreeDerivative,
168
+ inverseFunctionDerivative_1.inverseFunctionDerivative,
169
+ rootFunctionDerivative_1.rootFunctionDerivative,
170
+ powerFunctionDerivative_1.powerFunctionDerivative,
157
171
  conditionalProbability_1.conditionalProbability,
158
172
  leadingCoefficient_1.leadingCoefficient,
159
173
  derivativeNumberReading_1.derivativeNumberReading,
160
174
  probabilityTree_1.probabilityTree,
161
175
  fractionToPercentToDecimal_1.fractionToPercentToDecimal,
162
176
  marginalAndConditionalFrequency_1.marginalAndConditionalFrequency,
177
+ mentalAddAndSub_1.mentalAddAndSub,
178
+ mentalMultiplications_1.mentalMultiplications,
179
+ mentalDivisions_1.mentalDivisions,
180
+ mentalPercentage_1.mentalPercentage,
163
181
  ];
@@ -10,7 +10,7 @@ const mathjs_1 = require("mathjs");
10
10
  exports.leadingCoefficient = {
11
11
  id: 'leadingCoefficient',
12
12
  connector: '=',
13
- instruction: 'Quel est le coefficient directeur de la droite suivante :',
13
+ instruction: 'Déterminer le coefficient directeur de la droite représentée ci-dessous :',
14
14
  label: 'Déterminer le coefficient directeur',
15
15
  levels: ['3', '2', '1'],
16
16
  isSingleStep: false,
@@ -29,37 +29,37 @@ function getConditionalProbability() {
29
29
  case 1: {
30
30
  instruction += `$p(A) = ${pA / 100}, p(A \\cap B) = ${pAB / 100}$.$\\\\$Déterminer $p_A(B)$.`;
31
31
  startStatement = `p_A(B)`;
32
- answer = `${pB_A}`.replace('.', ',');
32
+ answer = `${pB_A}`;
33
33
  break;
34
34
  }
35
35
  case 2: {
36
36
  instruction += `$p(B) = ${pB / 100}, p(B \\cap A) = ${pAB / 100}$.$\\\\$Déterminer $p_B(A)$.`;
37
37
  startStatement = `p_B(A)`;
38
- answer = `${pA_B}`.replace('.', ',');
38
+ answer = `${pA_B}`;
39
39
  break;
40
40
  }
41
41
  case 3: {
42
42
  instruction += `$p(A) = ${pA / 100}, p_A(B) = ${pB_A}$.$\\\\$Déterminer $p(A \\cap B)$.`;
43
43
  startStatement = `p(A \\cap B)`;
44
- answer = `${pAB / 100}`.replace('.', ',');
44
+ answer = `${pAB / 100}`;
45
45
  break;
46
46
  }
47
47
  case 4: {
48
48
  instruction += `$p(B) = ${pB / 100}, p_B(A) = ${pA_B}$.$\\\\$Déterminer $p(A \\cap B)$.`;
49
49
  startStatement = `p(A \\cap B)`;
50
- answer = `${pAB / 100}`.replace('.', ',');
50
+ answer = `${pAB / 100}`;
51
51
  break;
52
52
  }
53
53
  case 5: {
54
54
  instruction += `$p(A \\cap B) = ${pAB / 100}, p_B(A) = ${pA_B}$.$\\\\$Déterminer $p(B)$.`;
55
55
  startStatement = `p(B)`;
56
- answer = `${pB / 100}`.replace('.', ',');
56
+ answer = `${pB / 100}`;
57
57
  break;
58
58
  }
59
59
  case 6: {
60
60
  instruction += `$p(A \\cap B) = ${pAB / 100}, p_A(B) = ${pB_A}$.$\\\\$Déterminer $p(A)$.`;
61
61
  startStatement = `p(A)`;
62
- answer = `${pA / 100}`.replace('.', ',');
62
+ answer = `${pA / 100}`;
63
63
  break;
64
64
  }
65
65
  }
@@ -24,7 +24,7 @@ class DivideNode extends operatorNode_1.OperatorNode {
24
24
  let needBrackets = rightTex[0] === '-';
25
25
  if (this.rightChild.type === node_1.NodeType.operator) {
26
26
  const operatorRightChild = this.rightChild;
27
- needBrackets || (needBrackets = [operatorNode_1.OperatorIds.add, operatorNode_1.OperatorIds.substract].includes(operatorRightChild.id));
27
+ needBrackets || (needBrackets = [operatorNode_1.OperatorIds.add, operatorNode_1.OperatorIds.substract, operatorNode_1.OperatorIds.divide].includes(operatorRightChild.id));
28
28
  }
29
29
  if (needBrackets)
30
30
  rightTex = `(${rightTex})`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "math-exercises",
3
- "version": "1.3.26",
3
+ "version": "1.3.27",
4
4
  "description": "Math exercises generator for middle school and high school",
5
5
  "main": "lib/index.js",
6
6
  "files": [