math-exercises 1.4.15 → 1.4.17

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 (64) hide show
  1. package/lib/exercises/calcul/arithmetics/paritySumsAndProducts.d.ts +4 -0
  2. package/lib/exercises/calcul/arithmetics/paritySumsAndProducts.d.ts.map +1 -0
  3. package/lib/exercises/calcul/arithmetics/paritySumsAndProducts.js +113 -0
  4. package/lib/exercises/combinatory/anagrams.d.ts +4 -0
  5. package/lib/exercises/combinatory/anagrams.d.ts.map +1 -0
  6. package/lib/exercises/combinatory/anagrams.js +128 -0
  7. package/lib/exercises/combinatory/ballsCounting.d.ts +4 -0
  8. package/lib/exercises/combinatory/ballsCounting.d.ts.map +1 -0
  9. package/lib/exercises/combinatory/ballsCounting.js +124 -0
  10. package/lib/exercises/combinatory/diceCounting.d.ts +4 -0
  11. package/lib/exercises/combinatory/diceCounting.d.ts.map +1 -0
  12. package/lib/exercises/combinatory/diceCounting.js +134 -0
  13. package/lib/exercises/derivation/derivative/productDerivative.d.ts +4 -0
  14. package/lib/exercises/derivation/derivative/productDerivative.d.ts.map +1 -0
  15. package/lib/exercises/derivation/derivative/productDerivative.js +62 -0
  16. package/lib/exercises/derivation/derivative/quotientDerivative.d.ts +4 -0
  17. package/lib/exercises/derivation/derivative/quotientDerivative.d.ts.map +1 -0
  18. package/lib/exercises/derivation/derivative/quotientDerivative.js +65 -0
  19. package/lib/exercises/exercise.d.ts +1 -1
  20. package/lib/exercises/exercise.d.ts.map +1 -1
  21. package/lib/exercises/exercises.d.ts.map +1 -1
  22. package/lib/exercises/exercises.js +58 -26
  23. package/lib/exercises/functions/absolute/absoluteValueEquations.d.ts +4 -0
  24. package/lib/exercises/functions/absolute/absoluteValueEquations.d.ts.map +1 -0
  25. package/lib/exercises/functions/absolute/absoluteValueEquations.js +75 -0
  26. package/lib/exercises/functions/absolute/absoluteValueInequations.d.ts +4 -0
  27. package/lib/exercises/functions/absolute/absoluteValueInequations.d.ts.map +1 -0
  28. package/lib/exercises/functions/absolute/absoluteValueInequations.js +67 -0
  29. package/lib/exercises/geometry/vectors/coordinatesReading.d.ts +4 -0
  30. package/lib/exercises/geometry/vectors/coordinatesReading.d.ts.map +1 -0
  31. package/lib/exercises/geometry/vectors/coordinatesReading.js +81 -0
  32. package/lib/exercises/geometry/vectors/vectorCoordinatesFromTwoPoints.d.ts +4 -0
  33. package/lib/exercises/geometry/vectors/vectorCoordinatesFromTwoPoints.d.ts.map +1 -0
  34. package/lib/exercises/geometry/vectors/vectorCoordinatesFromTwoPoints.js +68 -0
  35. package/lib/exercises/percent/evolutionToCM.d.ts +4 -0
  36. package/lib/exercises/percent/evolutionToCM.d.ts.map +1 -0
  37. package/lib/exercises/percent/evolutionToCM.js +74 -0
  38. package/lib/exercises/sequences/explicitFormulaUsage.d.ts +22 -0
  39. package/lib/exercises/sequences/explicitFormulaUsage.d.ts.map +1 -0
  40. package/lib/exercises/sequences/explicitFormulaUsage.js +82 -0
  41. package/lib/exercises/sequences/genericSequenceVariations.d.ts +4 -0
  42. package/lib/exercises/sequences/genericSequenceVariations.d.ts.map +1 -0
  43. package/lib/exercises/sequences/genericSequenceVariations.js +55 -0
  44. package/lib/exercises/sequences/recurrenceFormulaUsage.d.ts +4 -0
  45. package/lib/exercises/sequences/recurrenceFormulaUsage.d.ts.map +1 -0
  46. package/lib/exercises/sequences/recurrenceFormulaUsage.js +69 -0
  47. package/lib/exercises/utils/geogebra/getAdaptedCoords.d.ts +1 -0
  48. package/lib/exercises/utils/geogebra/getAdaptedCoords.d.ts.map +1 -0
  49. package/lib/exercises/utils/geogebra/getAdaptedCoords.js +1 -0
  50. package/lib/math/geometry/point.d.ts +2 -0
  51. package/lib/math/geometry/point.d.ts.map +1 -1
  52. package/lib/math/geometry/point.js +8 -0
  53. package/lib/math/polynomials/polynomial.d.ts +7 -0
  54. package/lib/math/polynomials/polynomial.d.ts.map +1 -1
  55. package/lib/math/polynomials/polynomial.js +7 -0
  56. package/lib/math/sequences/sequence.d.ts +3 -1
  57. package/lib/math/sequences/sequence.d.ts.map +1 -1
  58. package/lib/math/sequences/sequence.js +2 -1
  59. package/lib/types/keyIds.d.ts +6 -4
  60. package/lib/types/keyIds.d.ts.map +1 -1
  61. package/lib/utils/randomLetter.d.ts +2 -0
  62. package/lib/utils/randomLetter.d.ts.map +1 -0
  63. package/lib/utils/randomLetter.js +9 -0
  64. package/package.json +1 -2
@@ -0,0 +1,4 @@
1
+ import { MathExercise, Question } from '../../../exercises/exercise';
2
+ export declare const paritySumsAndProducts: MathExercise;
3
+ export declare function getParitySumsAndProductsQuestion(): Question;
4
+ //# sourceMappingURL=paritySumsAndProducts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paritySumsAndProducts.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calcul/arithmetics/paritySumsAndProducts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,YAAY,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAM7F,eAAO,MAAM,qBAAqB,EAAE,YAanC,CAAC;AAEF,wBAAgB,gCAAgC,IAAI,QAAQ,CA8F3D"}
@@ -0,0 +1,113 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getParitySumsAndProductsQuestion = exports.paritySumsAndProducts = void 0;
4
+ const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
5
+ const randint_1 = require("../../../math/utils/random/randint");
6
+ const shuffle_1 = require("../../../utils/shuffle");
7
+ const uuid_1 = require("uuid");
8
+ exports.paritySumsAndProducts = {
9
+ id: 'paritySumsAndProducts',
10
+ connector: '=',
11
+ instruction: '',
12
+ label: 'Parité de sommes et de produits',
13
+ levels: ['2nde'],
14
+ isSingleStep: true,
15
+ sections: ['Arithmétique'],
16
+ generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getParitySumsAndProductsQuestion, nb, 12),
17
+ qcmTimer: 60,
18
+ freeTimer: 60,
19
+ answerType: 'QCM',
20
+ maxAllowedQuestions: 12,
21
+ };
22
+ function getParitySumsAndProductsQuestion() {
23
+ const type = (0, randint_1.randint)(0, 12);
24
+ let instruction = '';
25
+ let answer;
26
+ switch (type) {
27
+ case 0:
28
+ instruction = 'La somme de deux nombres pairs est un nombre...';
29
+ answer = 'Pair';
30
+ break;
31
+ case 1:
32
+ instruction = 'La somme de deux nombres impairs est un nombre...';
33
+ answer = 'Pair';
34
+ break;
35
+ case 2:
36
+ instruction = "La somme d'un nombre pair et d'un nombre impair un nombre...";
37
+ answer = 'Impair';
38
+ break;
39
+ case 3:
40
+ instruction = 'La somme de trois nombres impairs est un nombre...';
41
+ answer = 'Impair';
42
+ break;
43
+ case 4:
44
+ instruction = 'La somme de trois nombres consécutifs est un nombre...';
45
+ answer = 'Parfois pair, parfois impair';
46
+ break;
47
+ case 5:
48
+ instruction = 'La somme de quatre nombres consécutifs est un nombre...';
49
+ answer = 'Pair';
50
+ break;
51
+ case 6:
52
+ instruction = 'Le produit de deux nombres pairs est un nombre...';
53
+ answer = 'Pair';
54
+ break;
55
+ case 7:
56
+ instruction = 'Le produit de deux nombres impairs est un nombre...';
57
+ answer = 'Impair';
58
+ break;
59
+ case 8:
60
+ instruction = "Le produit d'un nombre pair et d'un nombre impair est un nombre...";
61
+ answer = 'Pair';
62
+ break;
63
+ case 9:
64
+ instruction = 'Le produit de trois nombres consécutifs est un nombre...';
65
+ answer = 'Pair';
66
+ break;
67
+ case 10:
68
+ instruction = 'Le produit de trois nombres impairs est un nombre...';
69
+ answer = 'Impair';
70
+ break;
71
+ case 11:
72
+ instruction = 'Le produit de trois nombres pairs est un nombre...';
73
+ answer = 'Pair';
74
+ break;
75
+ }
76
+ const getPropositions = (n) => {
77
+ const res = [];
78
+ res.push({
79
+ id: (0, uuid_1.v4)(),
80
+ statement: `Pair`,
81
+ isRightAnswer: answer === 'Pair',
82
+ format: 'raw',
83
+ });
84
+ res.push({
85
+ id: (0, uuid_1.v4)(),
86
+ statement: `Impair`,
87
+ isRightAnswer: answer === 'Impair',
88
+ format: 'raw',
89
+ });
90
+ res.push({
91
+ id: (0, uuid_1.v4)(),
92
+ statement: `Parfois pair, parfois impair`,
93
+ isRightAnswer: answer === 'Parfois pair, parfois impair',
94
+ format: 'raw',
95
+ });
96
+ res.push({
97
+ id: (0, uuid_1.v4)(),
98
+ statement: `Premier`,
99
+ isRightAnswer: answer === 'Premier',
100
+ format: 'raw',
101
+ });
102
+ return (0, shuffle_1.shuffle)(res);
103
+ };
104
+ const question = {
105
+ answer: answer,
106
+ instruction,
107
+ keys: [],
108
+ getPropositions,
109
+ answerFormat: 'raw',
110
+ };
111
+ return question;
112
+ }
113
+ exports.getParitySumsAndProductsQuestion = getParitySumsAndProductsQuestion;
@@ -0,0 +1,4 @@
1
+ import { MathExercise, Question } from '../../exercises/exercise';
2
+ export declare const anagrams: MathExercise;
3
+ export declare function getAnagramsQuestion(): Question;
4
+ //# sourceMappingURL=anagrams.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"anagrams.d.ts","sourceRoot":"","sources":["../../../src/exercises/combinatory/anagrams.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,YAAY,EAAe,QAAQ,EAAqB,MAAM,0BAA0B,CAAC;AAqEhH,eAAO,MAAM,QAAQ,EAAE,YAWtB,CAAC;AAEF,wBAAgB,mBAAmB,IAAI,QAAQ,CAoD9C"}
@@ -0,0 +1,128 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getAnagramsQuestion = exports.anagrams = void 0;
4
+ const exercise_1 = require("../../exercises/exercise");
5
+ const getDistinctQuestions_1 = require("../../exercises/utils/getDistinctQuestions");
6
+ const randint_1 = require("../../math/utils/random/randint");
7
+ const random_1 = require("../../utils/random");
8
+ const uuid_1 = require("uuid");
9
+ const words = [
10
+ 'angle',
11
+ 'armoire',
12
+ 'banc',
13
+ 'bureau',
14
+ 'cabinet',
15
+ 'carreau',
16
+ 'chaise',
17
+ 'classe',
18
+ 'clé',
19
+ 'coin',
20
+ 'couloir',
21
+ 'dossier',
22
+ 'eau',
23
+ 'école',
24
+ 'écriture',
25
+ 'entrée',
26
+ 'escalier',
27
+ 'étagère',
28
+ 'étude',
29
+ 'extérieur',
30
+ 'fenêtre',
31
+ 'intérieur',
32
+ 'lavabo',
33
+ 'lecture',
34
+ 'lit',
35
+ 'marche',
36
+ 'matelas',
37
+ 'maternelle',
38
+ 'meuble',
39
+ 'mousse',
40
+ 'mur',
41
+ 'peluche',
42
+ 'placard',
43
+ 'plafond',
44
+ 'porte',
45
+ 'portemanteau',
46
+ 'poubelle',
47
+ 'radiateur',
48
+ 'rampe',
49
+ 'récréation',
50
+ 'rentrée',
51
+ 'rideau',
52
+ 'robinet',
53
+ 'salle',
54
+ 'savon',
55
+ 'serrure',
56
+ 'serviette',
57
+ 'siège',
58
+ 'sieste',
59
+ 'silence',
60
+ 'sol',
61
+ 'sommeil',
62
+ 'sonnette',
63
+ 'sortie',
64
+ 'table',
65
+ 'tableau',
66
+ 'tabouret',
67
+ 'tapis',
68
+ 'tiroir',
69
+ 'toilette',
70
+ 'vitre',
71
+ ];
72
+ exports.anagrams = {
73
+ id: 'anagrams',
74
+ connector: '=',
75
+ instruction: '',
76
+ label: "Compter le nombre d'anagrammes d'un mot",
77
+ levels: ['TermSpé'],
78
+ isSingleStep: true,
79
+ sections: ['Combinatoire et dénombrement'],
80
+ generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getAnagramsQuestion, nb),
81
+ qcmTimer: 60,
82
+ freeTimer: 60,
83
+ };
84
+ function getAnagramsQuestion() {
85
+ const word = (0, random_1.random)(words);
86
+ const answer = word
87
+ .split('')
88
+ .map((el, index) => index + 1)
89
+ .reduce((acc, curr) => acc * curr, 1);
90
+ const getPropositions = (n) => {
91
+ const res = [];
92
+ res.push({
93
+ id: (0, uuid_1.v4)(),
94
+ statement: answer + ``,
95
+ isRightAnswer: true,
96
+ format: 'tex',
97
+ });
98
+ (0, exercise_1.tryToAddWrongProp)(res, Math.pow(word.length, word.length) + '');
99
+ (0, exercise_1.tryToAddWrongProp)(res, (word.length * (word.length + 1)) / 2 + '');
100
+ (0, exercise_1.tryToAddWrongProp)(res, word.length * word.length + '');
101
+ const missing = n - res.length;
102
+ for (let i = 0; i < missing; i++) {
103
+ let isDuplicate;
104
+ let proposition;
105
+ do {
106
+ const wrongAnswer = (0, randint_1.randint)(1000, 10000);
107
+ proposition = {
108
+ id: (0, uuid_1.v4)() + ``,
109
+ statement: wrongAnswer + '',
110
+ isRightAnswer: false,
111
+ format: 'tex',
112
+ };
113
+ isDuplicate = res.some((p) => p.statement === proposition.statement);
114
+ } while (isDuplicate);
115
+ res.push(proposition);
116
+ }
117
+ return (0, exercise_1.shuffleProps)(res, n);
118
+ };
119
+ const question = {
120
+ answer: answer + '',
121
+ instruction: `Combien d'anagrammes mathématiques du mot ${word} sont possibles ? `,
122
+ keys: [],
123
+ getPropositions,
124
+ answerFormat: 'tex',
125
+ };
126
+ return question;
127
+ }
128
+ exports.getAnagramsQuestion = getAnagramsQuestion;
@@ -0,0 +1,4 @@
1
+ import { MathExercise, Question } from '../../exercises/exercise';
2
+ export declare const ballsCounting: MathExercise;
3
+ export declare function getBallsCountingQuestion(): Question;
4
+ //# sourceMappingURL=ballsCounting.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ballsCounting.d.ts","sourceRoot":"","sources":["../../../src/exercises/combinatory/ballsCounting.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,YAAY,EAAe,QAAQ,EAAqB,MAAM,0BAA0B,CAAC;AAKhH,eAAO,MAAM,aAAa,EAAE,YAW3B,CAAC;AAEF,wBAAgB,wBAAwB,IAAI,QAAQ,CA8GnD"}
@@ -0,0 +1,124 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getBallsCountingQuestion = exports.ballsCounting = void 0;
4
+ const exercise_1 = require("../../exercises/exercise");
5
+ const getDistinctQuestions_1 = require("../../exercises/utils/getDistinctQuestions");
6
+ const randint_1 = require("../../math/utils/random/randint");
7
+ const uuid_1 = require("uuid");
8
+ exports.ballsCounting = {
9
+ id: 'ballsCounting',
10
+ connector: '=',
11
+ instruction: '',
12
+ label: 'Dénombrement avec des boules',
13
+ levels: ['TermSpé'],
14
+ isSingleStep: true,
15
+ sections: ['Combinatoire et dénombrement'],
16
+ generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getBallsCountingQuestion, nb),
17
+ qcmTimer: 60,
18
+ freeTimer: 60,
19
+ };
20
+ function getBallsCountingQuestion() {
21
+ const type = (0, randint_1.randint)(0, 6);
22
+ let instruction = '';
23
+ let answer = '';
24
+ const blacks = (0, randint_1.randint)(2, 6);
25
+ const greens = (0, randint_1.randint)(2, 6);
26
+ const reds = (0, randint_1.randint)(3, 6);
27
+ const total = blacks + greens + reds;
28
+ switch (type) {
29
+ case 0:
30
+ instruction = ``;
31
+ answer = total * (total - 1) * (total - 2) + '';
32
+ break;
33
+ case 1:
34
+ instruction = `comportant trois boules rouges`;
35
+ answer = reds * (reds - 1) * (reds - 2) + '';
36
+ break;
37
+ case 2:
38
+ instruction = `ne comportant pas de boule noire`;
39
+ answer = (reds + greens) * (reds + greens - 1) * (reds + greens - 2) + '';
40
+ break;
41
+ case 3:
42
+ instruction = `comportant au moins une boule noire`;
43
+ answer = total * (total - 1) * (total - 2) - (reds + greens) * (reds + greens - 1) * (reds + greens - 2) + '';
44
+ break;
45
+ case 4:
46
+ instruction = `comportant trois boules de trois couleurs différentes`;
47
+ answer = 6 * (blacks * greens * reds) + '';
48
+ break;
49
+ case 5:
50
+ instruction = `comportant exactement une boule verte et deux boules noires`;
51
+ answer = 6 * (greens * blacks * (blacks - 1)) + '';
52
+ break;
53
+ case 6:
54
+ instruction = `comportant exactement une boule verte`;
55
+ answer = 6 * greens * (reds + blacks) * (reds + blacks - 1) + '';
56
+ }
57
+ const getPropositions = (n) => {
58
+ const res = [];
59
+ res.push({
60
+ id: (0, uuid_1.v4)(),
61
+ statement: answer,
62
+ isRightAnswer: true,
63
+ format: 'tex',
64
+ });
65
+ switch (type) {
66
+ case 0:
67
+ (0, exercise_1.tryToAddWrongProp)(res, total * total * total + '');
68
+ (0, exercise_1.tryToAddWrongProp)(res, 6 + '');
69
+ break;
70
+ case 1:
71
+ (0, exercise_1.tryToAddWrongProp)(res, reds * reds * reds + '');
72
+ (0, exercise_1.tryToAddWrongProp)(res, 1 + '');
73
+ break;
74
+ case 2:
75
+ (0, exercise_1.tryToAddWrongProp)(res, (reds + greens) * (reds + greens) * (reds + greens) + '');
76
+ (0, exercise_1.tryToAddWrongProp)(res, 6 * blacks * (reds + greens) * (reds + greens - 1) + '');
77
+ break;
78
+ case 3:
79
+ (0, exercise_1.tryToAddWrongProp)(res, (reds + greens) * (reds + greens) * (reds + greens) + '');
80
+ (0, exercise_1.tryToAddWrongProp)(res, 3 * (reds + greens) * (reds + greens - 1) + '');
81
+ break;
82
+ case 4:
83
+ (0, exercise_1.tryToAddWrongProp)(res, blacks * greens * reds + '');
84
+ (0, exercise_1.tryToAddWrongProp)(res, 6 + '');
85
+ break;
86
+ case 5:
87
+ (0, exercise_1.tryToAddWrongProp)(res, 6 * greens * blacks * blacks + '');
88
+ (0, exercise_1.tryToAddWrongProp)(res, 6 + '');
89
+ break;
90
+ case 6:
91
+ (0, exercise_1.tryToAddWrongProp)(res, 6 * (blacks * greens * reds) + '');
92
+ (0, exercise_1.tryToAddWrongProp)(res, greens * (reds + blacks) * (reds + blacks - 1) + '');
93
+ break;
94
+ }
95
+ const missing = n - res.length;
96
+ for (let i = 0; i < missing; i++) {
97
+ let isDuplicate;
98
+ let proposition;
99
+ do {
100
+ const wrongAnswer = (0, randint_1.randint)(1, 100) + '';
101
+ proposition = {
102
+ id: (0, uuid_1.v4)() + ``,
103
+ statement: wrongAnswer,
104
+ isRightAnswer: false,
105
+ format: 'tex',
106
+ };
107
+ isDuplicate = res.some((p) => p.statement === proposition.statement);
108
+ } while (isDuplicate);
109
+ res.push(proposition);
110
+ }
111
+ return (0, exercise_1.shuffleProps)(res, n);
112
+ };
113
+ const question = {
114
+ answer: answer,
115
+ instruction: `Une urne contient ${blacks} boules noires numérotées de 1 à ${blacks}, ${reds} boules rouges numérotées de 1 à ${reds} et ${greens} boules vertes numérotées de 1 à ${greens}.
116
+ On tire successivement et sans remise 3 boules dans l'urne.
117
+ Combien de tirages ${instruction} sont possibles ?`,
118
+ keys: [],
119
+ getPropositions,
120
+ answerFormat: 'tex',
121
+ };
122
+ return question;
123
+ }
124
+ exports.getBallsCountingQuestion = getBallsCountingQuestion;
@@ -0,0 +1,4 @@
1
+ import { MathExercise, Question } from '../../exercises/exercise';
2
+ export declare const diceCounting: MathExercise;
3
+ export declare function getDiceCountingQuestion(): Question;
4
+ //# sourceMappingURL=diceCounting.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diceCounting.d.ts","sourceRoot":"","sources":["../../../src/exercises/combinatory/diceCounting.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,YAAY,EAAe,QAAQ,EAAqB,MAAM,0BAA0B,CAAC;AAKhH,eAAO,MAAM,YAAY,EAAE,YAW1B,CAAC;AAEF,wBAAgB,uBAAuB,IAAI,QAAQ,CAwHlD"}
@@ -0,0 +1,134 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getDiceCountingQuestion = exports.diceCounting = void 0;
4
+ const exercise_1 = require("../../exercises/exercise");
5
+ const getDistinctQuestions_1 = require("../../exercises/utils/getDistinctQuestions");
6
+ const randint_1 = require("../../math/utils/random/randint");
7
+ const uuid_1 = require("uuid");
8
+ exports.diceCounting = {
9
+ id: 'diceCounting',
10
+ connector: '=',
11
+ instruction: '',
12
+ label: 'Dénombrement avec des dés',
13
+ levels: ['TermSpé'],
14
+ isSingleStep: true,
15
+ sections: ['Combinatoire et dénombrement'],
16
+ generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getDiceCountingQuestion, nb),
17
+ qcmTimer: 60,
18
+ freeTimer: 60,
19
+ };
20
+ function getDiceCountingQuestion() {
21
+ const type = (0, randint_1.randint)(0, 8);
22
+ let instruction = '';
23
+ let answer = '';
24
+ let face1, face2, face3;
25
+ switch (type) {
26
+ case 0:
27
+ instruction = `avec exactement deux chiffres identiques`;
28
+ answer = 6 * 3 * 5 + '';
29
+ break;
30
+ case 1:
31
+ instruction = `avec trois chiffres identiques`;
32
+ answer = 6 + '';
33
+ break;
34
+ case 2:
35
+ face1 = (0, randint_1.randint)(1, 7);
36
+ instruction = `avec exactement une fois la face ${face1}`;
37
+ answer = 3 * 5 * 5 + '';
38
+ break;
39
+ case 3:
40
+ face1 = (0, randint_1.randint)(1, 7);
41
+ instruction = `avec exactement deux fois la face ${face1}`;
42
+ answer = 3 * 5 + '';
43
+ break;
44
+ case 4:
45
+ face1 = (0, randint_1.randint)(1, 7);
46
+ face2 = (0, randint_1.randint)(1, 7, [face1]);
47
+ face3 = (0, randint_1.randint)(1, 7, [face1, face2]);
48
+ instruction = `avec exactement les faces ${face1}, ${face2} et ${face3}`;
49
+ answer = 6 + '';
50
+ break;
51
+ case 5:
52
+ face1 = (0, randint_1.randint)(1, 7);
53
+ face2 = (0, randint_1.randint)(1, 7, [face1]);
54
+ face3 = (0, randint_1.randint)(1, 7, [face1, face2]);
55
+ instruction = `avec exactement une fois la face ${face1} et une fois la face ${face2}`;
56
+ answer = 3 * 5 + '';
57
+ break;
58
+ case 6:
59
+ instruction = `dans lesquels toutes les faces sont différentes`;
60
+ answer = 6 * 5 * 4 + '';
61
+ break;
62
+ }
63
+ const getPropositions = (n) => {
64
+ const res = [];
65
+ res.push({
66
+ id: (0, uuid_1.v4)(),
67
+ statement: answer,
68
+ isRightAnswer: true,
69
+ format: 'tex',
70
+ });
71
+ switch (type) {
72
+ case 0:
73
+ (0, exercise_1.tryToAddWrongProp)(res, 3 * 5 + '');
74
+ (0, exercise_1.tryToAddWrongProp)(res, 6 * 6 * 3 + '');
75
+ (0, exercise_1.tryToAddWrongProp)(res, 6 * 3 + '');
76
+ break;
77
+ case 1:
78
+ (0, exercise_1.tryToAddWrongProp)(res, 6 * 3 + '');
79
+ (0, exercise_1.tryToAddWrongProp)(res, 1 + '');
80
+ break;
81
+ case 2:
82
+ (0, exercise_1.tryToAddWrongProp)(res, 3 * 6 * 6 + '');
83
+ (0, exercise_1.tryToAddWrongProp)(res, 6 + '');
84
+ (0, exercise_1.tryToAddWrongProp)(res, 5 * 5 + '');
85
+ break;
86
+ case 3:
87
+ (0, exercise_1.tryToAddWrongProp)(res, 6 * 3 + '');
88
+ (0, exercise_1.tryToAddWrongProp)(res, 6 * 5 + '');
89
+ (0, exercise_1.tryToAddWrongProp)(res, 5 + '');
90
+ break;
91
+ case 4:
92
+ (0, exercise_1.tryToAddWrongProp)(res, 3 + '');
93
+ (0, exercise_1.tryToAddWrongProp)(res, 1 + '');
94
+ (0, exercise_1.tryToAddWrongProp)(res, 6 * 6 * 6 + '');
95
+ break;
96
+ case 5:
97
+ (0, exercise_1.tryToAddWrongProp)(res, 6 * 3 + '');
98
+ (0, exercise_1.tryToAddWrongProp)(res, 6 * 5 + '');
99
+ (0, exercise_1.tryToAddWrongProp)(res, 5 + '');
100
+ break;
101
+ case 6:
102
+ (0, exercise_1.tryToAddWrongProp)(res, 6 * 6 * 6 + '');
103
+ (0, exercise_1.tryToAddWrongProp)(res, 6 * 5 + '');
104
+ (0, exercise_1.tryToAddWrongProp)(res, 6 + '');
105
+ break;
106
+ }
107
+ const missing = n - res.length;
108
+ for (let i = 0; i < missing; i++) {
109
+ let isDuplicate;
110
+ let proposition;
111
+ do {
112
+ const wrongAnswer = (0, randint_1.randint)(1, 100) + '';
113
+ proposition = {
114
+ id: (0, uuid_1.v4)() + ``,
115
+ statement: wrongAnswer,
116
+ isRightAnswer: false,
117
+ format: 'tex',
118
+ };
119
+ isDuplicate = res.some((p) => p.statement === proposition.statement);
120
+ } while (isDuplicate);
121
+ res.push(proposition);
122
+ }
123
+ return (0, exercise_1.shuffleProps)(res, n);
124
+ };
125
+ const question = {
126
+ answer: answer,
127
+ instruction: `On tire 3 fois consécutivement un dé à six faces numérotées de 1 à 6. Combien de tirages ${instruction} sont possibles ?`,
128
+ keys: [],
129
+ getPropositions,
130
+ answerFormat: 'tex',
131
+ };
132
+ return question;
133
+ }
134
+ exports.getDiceCountingQuestion = getDiceCountingQuestion;
@@ -0,0 +1,4 @@
1
+ import { MathExercise, Question } from '../../../exercises/exercise';
2
+ export declare const productDerivative: MathExercise;
3
+ export declare function getProductDerivativeQuestion(): Question;
4
+ //# sourceMappingURL=productDerivative.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"productDerivative.d.ts","sourceRoot":"","sources":["../../../../src/exercises/derivation/derivative/productDerivative.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,YAAY,EAAe,QAAQ,EAAqB,MAAM,0BAA0B,CAAC;AAOhH,eAAO,MAAM,iBAAiB,EAAE,YAW/B,CAAC;AAEF,wBAAgB,4BAA4B,IAAI,QAAQ,CAkDvD"}
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getProductDerivativeQuestion = exports.productDerivative = void 0;
4
+ const exercise_1 = require("../../../exercises/exercise");
5
+ const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
6
+ const polynomial_1 = require("../../../math/polynomials/polynomial");
7
+ const multiplyNode_1 = require("../../../tree/nodes/operators/multiplyNode");
8
+ const uuid_1 = require("uuid");
9
+ exports.productDerivative = {
10
+ id: 'productDerivative',
11
+ connector: '=',
12
+ instruction: '',
13
+ label: "Dérivée d'un produit de polynômes",
14
+ levels: ['1reSpé', 'MathComp'],
15
+ isSingleStep: true,
16
+ sections: ['Dérivation'],
17
+ generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getProductDerivativeQuestion, nb),
18
+ qcmTimer: 60,
19
+ freeTimer: 60,
20
+ };
21
+ function getProductDerivativeQuestion() {
22
+ const poly1 = polynomial_1.PolynomialConstructor.randomWithLength(3, 2);
23
+ const poly2 = polynomial_1.PolynomialConstructor.randomWithLength(3, 2);
24
+ const answer = poly1.multiply(poly2).derivate().toTree().toTex();
25
+ const getPropositions = (n) => {
26
+ const res = [];
27
+ res.push({
28
+ id: (0, uuid_1.v4)(),
29
+ statement: answer,
30
+ isRightAnswer: true,
31
+ format: 'tex',
32
+ });
33
+ (0, exercise_1.tryToAddWrongProp)(res, poly1.derivate().multiply(poly2.derivate()).toTree().toTex());
34
+ (0, exercise_1.tryToAddWrongProp)(res, poly1.derivate().add(poly2.derivate()).toTree().toTex());
35
+ const missing = n - res.length;
36
+ for (let i = 0; i < missing; i++) {
37
+ let isDuplicate;
38
+ let proposition;
39
+ do {
40
+ const wrongAnswer = polynomial_1.PolynomialConstructor.random(3).toTree().toTex();
41
+ proposition = {
42
+ id: (0, uuid_1.v4)() + ``,
43
+ statement: wrongAnswer,
44
+ isRightAnswer: false,
45
+ format: 'tex',
46
+ };
47
+ isDuplicate = res.some((p) => p.statement === proposition.statement);
48
+ } while (isDuplicate);
49
+ res.push(proposition);
50
+ }
51
+ return (0, exercise_1.shuffleProps)(res, n);
52
+ };
53
+ const question = {
54
+ answer: answer,
55
+ instruction: `Déterminer la dérivée de la fonction $f$ définie par $f(x) = ${new multiplyNode_1.MultiplyNode(poly1.toTree(), poly2.toTree()).toTex()}$`,
56
+ keys: ['x', 'xsquare', 'xcube'],
57
+ getPropositions,
58
+ answerFormat: 'tex',
59
+ };
60
+ return question;
61
+ }
62
+ exports.getProductDerivativeQuestion = getProductDerivativeQuestion;
@@ -0,0 +1,4 @@
1
+ import { MathExercise, Question } from '../../../exercises/exercise';
2
+ export declare const quotientDerivative: MathExercise;
3
+ export declare function getProductDerivativeQuestion(): Question;
4
+ //# sourceMappingURL=quotientDerivative.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"quotientDerivative.d.ts","sourceRoot":"","sources":["../../../../src/exercises/derivation/derivative/quotientDerivative.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,YAAY,EAAe,QAAQ,EAAqB,MAAM,0BAA0B,CAAC;AAUhH,eAAO,MAAM,kBAAkB,EAAE,YAWhC,CAAC;AAEF,wBAAgB,4BAA4B,IAAI,QAAQ,CAoDvD"}