math-exercises 1.3.56 → 1.3.57
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/exercises.d.ts.map +1 -1
- package/lib/exercises/exercises.js +4 -0
- package/lib/exercises/sequences/arithmetic/firstIntegersSum.d.ts +4 -0
- package/lib/exercises/sequences/arithmetic/firstIntegersSum.d.ts.map +1 -0
- package/lib/exercises/sequences/arithmetic/firstIntegersSum.js +67 -0
- package/lib/exercises/sequences/geometric/geometricFirstTermsSum.d.ts +4 -0
- package/lib/exercises/sequences/geometric/geometricFirstTermsSum.d.ts.map +1 -0
- package/lib/exercises/sequences/geometric/geometricFirstTermsSum.js +69 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exercises.d.ts","sourceRoot":"","sources":["../../src/exercises/exercises.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"exercises.d.ts","sourceRoot":"","sources":["../../src/exercises/exercises.ts"],"names":[],"mappings":"AAgKA,eAAO,MAAM,SAAS,iCAoNrB,CAAC"}
|
|
@@ -149,6 +149,8 @@ const conjugateMultiplyComplex_1 = require("./complex/conjugateMultiplyComplex")
|
|
|
149
149
|
const inverseComplex_1 = require("./complex/inverseComplex");
|
|
150
150
|
const divideComplex_1 = require("./complex/divideComplex");
|
|
151
151
|
const conjugateDivideComplex_1 = require("./complex/conjugateDivideComplex");
|
|
152
|
+
const firstIntegersSum_1 = require("./sequences/arithmetic/firstIntegersSum");
|
|
153
|
+
const geometricFirstTermsSum_1 = require("./sequences/geometric/geometricFirstTermsSum");
|
|
152
154
|
exports.exercises = [
|
|
153
155
|
/**
|
|
154
156
|
* calcul litteral
|
|
@@ -236,6 +238,8 @@ exports.exercises = [
|
|
|
236
238
|
arithmeticReasonUsage_1.arithmeticReasonUsage,
|
|
237
239
|
arithmeticRecurrenceFormulaUsage_1.arithmeticRecurrenceFormulaUsage,
|
|
238
240
|
arithmeticThresholdFind_1.arithmeticThresholdFind,
|
|
241
|
+
firstIntegersSum_1.firstIntegersSum,
|
|
242
|
+
geometricFirstTermsSum_1.geometricFirstTermsSum,
|
|
239
243
|
/**
|
|
240
244
|
* islam
|
|
241
245
|
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"firstIntegersSum.d.ts","sourceRoot":"","sources":["../../../../src/exercises/sequences/arithmetic/firstIntegersSum.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAM3E,eAAO,MAAM,gBAAgB,EAAE,QAS9B,CAAC;AAEF,wBAAgB,2BAA2B,IAAI,QAAQ,CAuDtD"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getFirstIntegersSumQuestion = exports.firstIntegersSum = 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.firstIntegersSum = {
|
|
9
|
+
id: 'firstIntegersSum',
|
|
10
|
+
connector: '=',
|
|
11
|
+
instruction: '',
|
|
12
|
+
label: 'Somme des $n$ premiers entiers',
|
|
13
|
+
levels: ['1rePro', '1reTech', '1reSpé', '1reESM'],
|
|
14
|
+
isSingleStep: true,
|
|
15
|
+
sections: ['Suites'],
|
|
16
|
+
generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getFirstIntegersSumQuestion, nb),
|
|
17
|
+
};
|
|
18
|
+
function getFirstIntegersSumQuestion() {
|
|
19
|
+
const final = (0, randint_1.randint)(20, 100);
|
|
20
|
+
const getPropositions = (n) => {
|
|
21
|
+
const res = [];
|
|
22
|
+
res.push({
|
|
23
|
+
id: (0, uuid_1.v4)(),
|
|
24
|
+
statement: `${(final * (final + 1)) / 2}`,
|
|
25
|
+
isRightAnswer: true,
|
|
26
|
+
format: 'tex',
|
|
27
|
+
});
|
|
28
|
+
res.push({
|
|
29
|
+
id: (0, uuid_1.v4)(),
|
|
30
|
+
statement: `${(final * (final - 1)) / 2}`,
|
|
31
|
+
isRightAnswer: false,
|
|
32
|
+
format: 'tex',
|
|
33
|
+
});
|
|
34
|
+
res.push({
|
|
35
|
+
id: (0, uuid_1.v4)(),
|
|
36
|
+
statement: `${final * (final + 1)}`,
|
|
37
|
+
isRightAnswer: false,
|
|
38
|
+
format: 'tex',
|
|
39
|
+
});
|
|
40
|
+
const missing = n - res.length;
|
|
41
|
+
for (let i = 0; i < missing; i++) {
|
|
42
|
+
let isDuplicate;
|
|
43
|
+
let proposition;
|
|
44
|
+
do {
|
|
45
|
+
const wrongAnswer = (0, randint_1.randint)(30, 200) + '';
|
|
46
|
+
proposition = {
|
|
47
|
+
id: (0, uuid_1.v4)() + ``,
|
|
48
|
+
statement: wrongAnswer,
|
|
49
|
+
isRightAnswer: false,
|
|
50
|
+
format: 'tex',
|
|
51
|
+
};
|
|
52
|
+
isDuplicate = res.some((p) => p.statement === proposition.statement);
|
|
53
|
+
} while (isDuplicate);
|
|
54
|
+
res.push(proposition);
|
|
55
|
+
}
|
|
56
|
+
return (0, shuffle_1.shuffle)(res);
|
|
57
|
+
};
|
|
58
|
+
const question = {
|
|
59
|
+
answer: `${(final * (final + 1)) / 2}`,
|
|
60
|
+
instruction: `Calculer la somme suivante : $1+2+3+\\ldots + ${final}$`,
|
|
61
|
+
keys: [],
|
|
62
|
+
getPropositions,
|
|
63
|
+
answerFormat: 'tex',
|
|
64
|
+
};
|
|
65
|
+
return question;
|
|
66
|
+
}
|
|
67
|
+
exports.getFirstIntegersSumQuestion = getFirstIntegersSumQuestion;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"geometricFirstTermsSum.d.ts","sourceRoot":"","sources":["../../../../src/exercises/sequences/geometric/geometricFirstTermsSum.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAM3E,eAAO,MAAM,sBAAsB,EAAE,QASpC,CAAC;AAEF,wBAAgB,iCAAiC,IAAI,QAAQ,CAyD5D"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getGeometricFirstTermsSumQuestion = exports.geometricFirstTermsSum = 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.geometricFirstTermsSum = {
|
|
9
|
+
id: 'geometricFirstTermsSum',
|
|
10
|
+
connector: '=',
|
|
11
|
+
instruction: '',
|
|
12
|
+
label: "Somme des termes d'une suite géométrique",
|
|
13
|
+
levels: ['1reESM', '1rePro', '1reSpé', '1reTech', 'TermPro', 'TermSpé', 'TermTech'],
|
|
14
|
+
isSingleStep: true,
|
|
15
|
+
sections: ['Suites'],
|
|
16
|
+
generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getGeometricFirstTermsSumQuestion, nb),
|
|
17
|
+
};
|
|
18
|
+
function getGeometricFirstTermsSumQuestion() {
|
|
19
|
+
const raison = (0, randint_1.randint)(2, 10);
|
|
20
|
+
const final = (0, randint_1.randint)(6, 15);
|
|
21
|
+
const answer = (raison ** (final + 1) - 1) / (raison - 1);
|
|
22
|
+
const getPropositions = (n) => {
|
|
23
|
+
const res = [];
|
|
24
|
+
res.push({
|
|
25
|
+
id: (0, uuid_1.v4)(),
|
|
26
|
+
statement: answer.toString(),
|
|
27
|
+
isRightAnswer: true,
|
|
28
|
+
format: 'tex',
|
|
29
|
+
});
|
|
30
|
+
res.push({
|
|
31
|
+
id: (0, uuid_1.v4)(),
|
|
32
|
+
statement: (raison ** (final + 1) - 1).toString(),
|
|
33
|
+
isRightAnswer: false,
|
|
34
|
+
format: 'tex',
|
|
35
|
+
});
|
|
36
|
+
res.push({
|
|
37
|
+
id: (0, uuid_1.v4)(),
|
|
38
|
+
statement: ((raison ** final - 1) / (raison - 1)).toString(),
|
|
39
|
+
isRightAnswer: false,
|
|
40
|
+
format: 'tex',
|
|
41
|
+
});
|
|
42
|
+
const missing = n - res.length;
|
|
43
|
+
for (let i = 0; i < missing; i++) {
|
|
44
|
+
let isDuplicate;
|
|
45
|
+
let proposition;
|
|
46
|
+
do {
|
|
47
|
+
const wrongAnswer = (0, randint_1.randint)(1000, 10000) + '';
|
|
48
|
+
proposition = {
|
|
49
|
+
id: (0, uuid_1.v4)() + ``,
|
|
50
|
+
statement: wrongAnswer,
|
|
51
|
+
isRightAnswer: false,
|
|
52
|
+
format: 'tex',
|
|
53
|
+
};
|
|
54
|
+
isDuplicate = res.some((p) => p.statement === proposition.statement);
|
|
55
|
+
} while (isDuplicate);
|
|
56
|
+
res.push(proposition);
|
|
57
|
+
}
|
|
58
|
+
return (0, shuffle_1.shuffle)(res);
|
|
59
|
+
};
|
|
60
|
+
const question = {
|
|
61
|
+
answer: answer + '',
|
|
62
|
+
instruction: `Calculer la somme suivante : $1 + ${raison} + ${raison}^2 + \\ldots + ${raison}^{${final}}$`,
|
|
63
|
+
keys: [],
|
|
64
|
+
getPropositions,
|
|
65
|
+
answerFormat: 'tex',
|
|
66
|
+
};
|
|
67
|
+
return question;
|
|
68
|
+
}
|
|
69
|
+
exports.getGeometricFirstTermsSumQuestion = getGeometricFirstTermsSumQuestion;
|