math-exercises 1.4.6 → 1.4.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/lib/exercises/derivation/derivativeNumberReading.d.ts.map +1 -1
- package/lib/exercises/derivation/derivativeNumberReading.js +1 -0
- package/lib/exercises/exercises.d.ts.map +1 -1
- package/lib/exercises/exercises.js +6 -0
- package/lib/exercises/functions/affines/leadingCoefficientCalculV1.d.ts.map +1 -1
- package/lib/exercises/functions/affines/leadingCoefficientCalculV1.js +1 -0
- package/lib/exercises/functions/affines/leadingCoefficientCalculV2.d.ts.map +1 -1
- package/lib/exercises/functions/affines/leadingCoefficientCalculV2.js +1 -0
- package/lib/exercises/functions/trinoms/extremumTypeFromAlgebricForm.d.ts.map +1 -1
- package/lib/exercises/functions/trinoms/extremumTypeFromAlgebricForm.js +1 -0
- package/lib/exercises/geometry/euclidean/circleArea.d.ts.map +1 -1
- package/lib/exercises/geometry/euclidean/circleArea.js +1 -0
- package/lib/exercises/geometry/euclidean/circleCircumference.d.ts.map +1 -1
- package/lib/exercises/geometry/euclidean/circleCircumference.js +1 -0
- package/lib/exercises/geometry/euclidean/rectangleArea.d.ts.map +1 -1
- package/lib/exercises/geometry/euclidean/rectangleArea.js +1 -0
- package/lib/exercises/geometry/euclidean/rectanglePerimeter.d.ts.map +1 -1
- package/lib/exercises/geometry/euclidean/rectanglePerimeter.js +1 -0
- package/lib/exercises/geometry/euclidean/squareArea.d.ts.map +1 -1
- package/lib/exercises/geometry/euclidean/squareArea.js +1 -0
- package/lib/exercises/geometry/euclidean/squarePerimeter.d.ts.map +1 -1
- package/lib/exercises/geometry/euclidean/squarePerimeter.js +1 -0
- package/lib/exercises/geometry/euclidean/triangleAreaV2.d.ts.map +1 -1
- package/lib/exercises/geometry/euclidean/triangleAreaV2.js +1 -0
- package/lib/exercises/geometry/euclidean/trianglePerimeter.d.ts.map +1 -1
- package/lib/exercises/geometry/euclidean/trianglePerimeter.js +1 -0
- package/lib/exercises/probaStat/ballsBasicProbas.d.ts +4 -0
- package/lib/exercises/probaStat/ballsBasicProbas.d.ts.map +1 -0
- package/lib/exercises/probaStat/ballsBasicProbas.js +70 -0
- package/lib/exercises/probaStat/cardBasicProbas.d.ts +4 -0
- package/lib/exercises/probaStat/cardBasicProbas.d.ts.map +1 -0
- package/lib/exercises/probaStat/cardBasicProbas.js +102 -0
- package/lib/exercises/probaStat/diceBasicProbas.d.ts +4 -0
- package/lib/exercises/probaStat/diceBasicProbas.d.ts.map +1 -0
- package/lib/exercises/probaStat/diceBasicProbas.js +77 -0
- package/lib/exercises/utils/cardsData.d.ts +22 -0
- package/lib/exercises/utils/cardsData.d.ts.map +1 -0
- package/lib/exercises/utils/cardsData.js +26 -0
- package/lib/utils/enumToArray.d.ts +8 -0
- package/lib/utils/enumToArray.d.ts.map +1 -0
- package/lib/utils/enumToArray.js +16 -0
- package/lib/utils/probaFlip.d.ts +5 -0
- package/lib/utils/probaFlip.d.ts.map +1 -1
- package/lib/utils/probaFlip.js +5 -0
- package/lib/utils/probaLawFlip.d.ts +2 -0
- package/lib/utils/probaLawFlip.d.ts.map +1 -0
- package/lib/utils/probaLawFlip.js +19 -0
- package/lib/utils/randomEnumValue.d.ts +2 -0
- package/lib/utils/randomEnumValue.d.ts.map +1 -0
- package/lib/utils/randomEnumValue.js +9 -0
- package/package.json +1 -1
- package/lib/exercises/calculLitteral/equation/evaluateExpression.d.ts +0 -4
- package/lib/exercises/calculLitteral/equation/evaluateExpression.d.ts.map +0 -1
- package/lib/exercises/calculLitteral/equation/evaluateExpression.js +0 -61
- package/lib/exercises/calculLitteral/equation/firstDegreeGeneralEquation.d.ts +0 -4
- package/lib/exercises/calculLitteral/equation/firstDegreeGeneralEquation.d.ts.map +0 -1
- package/lib/exercises/calculLitteral/equation/firstDegreeGeneralEquation.js +0 -32
- package/lib/exercises/functions/affines/template.d.ts +0 -4
- package/lib/exercises/functions/affines/template.d.ts.map +0 -1
- package/lib/exercises/functions/affines/template.js +0 -51
- package/lib/exercises/geometry/cartesian/imageFunction.d.ts +0 -4
- package/lib/exercises/geometry/cartesian/imageFunction.d.ts.map +0 -1
- package/lib/exercises/geometry/cartesian/imageFunction.js +0 -65
- package/lib/exercises/geometry/cartesian/imageFunctionGeogebra.d.ts +0 -4
- package/lib/exercises/geometry/cartesian/imageFunctionGeogebra.d.ts.map +0 -1
- package/lib/exercises/geometry/cartesian/imageFunctionGeogebra.js +0 -89
- package/lib/exercises/geometry/cartesian/inverseImageFunction.d.ts +0 -4
- package/lib/exercises/geometry/cartesian/inverseImageFunction.d.ts.map +0 -1
- package/lib/exercises/geometry/cartesian/inverseImageFunction.js +0 -62
- package/lib/exercises/geometry/cartesian/inverseImageFunctionGeogebra.d.ts +0 -4
- package/lib/exercises/geometry/cartesian/inverseImageFunctionGeogebra.d.ts.map +0 -1
- package/lib/exercises/geometry/cartesian/inverseImageFunctionGeogebra.js +0 -154
- package/lib/exercises/geometry/cartesian/leadingCoefficient.d.ts +0 -4
- package/lib/exercises/geometry/cartesian/leadingCoefficient.d.ts.map +0 -1
- package/lib/exercises/geometry/cartesian/leadingCoefficient.js +0 -93
- package/lib/exercises/geometry/cartesian/leadingCoefficientCalculV1.d.ts +0 -4
- package/lib/exercises/geometry/cartesian/leadingCoefficientCalculV1.d.ts.map +0 -1
- package/lib/exercises/geometry/cartesian/leadingCoefficientCalculV1.js +0 -59
- package/lib/exercises/geometry/cartesian/leadingCoefficientCalculV2.d.ts +0 -4
- package/lib/exercises/geometry/cartesian/leadingCoefficientCalculV2.d.ts.map +0 -1
- package/lib/exercises/geometry/cartesian/leadingCoefficientCalculV2.js +0 -58
- package/lib/exercises/geometry/cartesian/signFunction.d.ts +0 -4
- package/lib/exercises/geometry/cartesian/signFunction.d.ts.map +0 -1
- package/lib/exercises/geometry/cartesian/signFunction.js +0 -84
- package/lib/exercises/limits/polynomeLimit.d.ts +0 -4
- package/lib/exercises/limits/polynomeLimit.d.ts.map +0 -1
- package/lib/exercises/limits/polynomeLimit.js +0 -134
- package/lib/exercises/proba/conditionalProbability.d.ts +0 -4
- package/lib/exercises/proba/conditionalProbability.d.ts.map +0 -1
- package/lib/exercises/proba/conditionalProbability.js +0 -99
- package/lib/exercises/proba/marginalAndConditionalFrequency.d.ts +0 -4
- package/lib/exercises/proba/marginalAndConditionalFrequency.d.ts.map +0 -1
- package/lib/exercises/proba/marginalAndConditionalFrequency.js +0 -106
- package/lib/exercises/proba/probabilityTree.d.ts +0 -4
- package/lib/exercises/proba/probabilityTree.d.ts.map +0 -1
- package/lib/exercises/proba/probabilityTree.js +0 -132
- package/lib/exercises/probaStat/frequencyTable.d.ts +0 -4
- package/lib/exercises/probaStat/frequencyTable.d.ts.map +0 -1
- package/lib/exercises/probaStat/frequencyTable.js +0 -76
- package/lib/exercises/sequences/arithmetic/arithmeticSum.d.ts +0 -1
- package/lib/exercises/sequences/arithmetic/arithmeticSum.d.ts.map +0 -1
- package/lib/exercises/sequences/arithmetic/arithmeticSum.js +0 -1
- package/lib/exercises/sets/intervalsUnion.d.ts +0 -4
- package/lib/exercises/sets/intervalsUnion.d.ts.map +0 -1
- package/lib/exercises/sets/intervalsUnion.js +0 -55
- package/lib/exercises/utils/sum.test.d.ts +0 -2
- package/lib/exercises/utils/sum.test.d.ts.map +0 -1
- package/lib/exercises/utils/sum.test.js +0 -22
- package/lib/math/numbers/reals/squareRoot.d.ts +0 -19
- package/lib/math/numbers/reals/squareRoot.d.ts.map +0 -1
- package/lib/math/numbers/reals/squareRoot.js +0 -63
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.randomEnumValue = void 0;
|
|
4
|
+
const randint_1 = require("../math/utils/random/randint");
|
|
5
|
+
const randomEnumValue = (e) => {
|
|
6
|
+
const randIndex = (0, randint_1.randint)(0, Object.keys(e).length / 2);
|
|
7
|
+
return e[randIndex];
|
|
8
|
+
};
|
|
9
|
+
exports.randomEnumValue = randomEnumValue;
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"evaluateExpression.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calculLitteral/equation/evaluateExpression.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAQ3E,eAAO,MAAM,kBAAkB,EAAE,QAUhC,CAAC;AAEF,wBAAgB,qBAAqB,IAAI,QAAQ,CAiDhD"}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getEvaluateExpression = exports.evaluateExpression = 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
|
-
const coinFlip_1 = require("../../../utils/coinFlip");
|
|
8
|
-
const shuffle_1 = require("../../../utils/shuffle");
|
|
9
|
-
const uuid_1 = require("uuid");
|
|
10
|
-
exports.evaluateExpression = {
|
|
11
|
-
id: 'evaluateExpression',
|
|
12
|
-
connector: '=',
|
|
13
|
-
instruction: '',
|
|
14
|
-
label: 'Evaluer une expression',
|
|
15
|
-
levels: ['4', '3', '2'],
|
|
16
|
-
section: 'Équations',
|
|
17
|
-
isSingleStep: true,
|
|
18
|
-
generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getEvaluateExpression, nb),
|
|
19
|
-
keys: ['x', 'S', 'equal', 'lbrace', 'rbrace', 'semicolon', 'emptyset'],
|
|
20
|
-
};
|
|
21
|
-
function getEvaluateExpression() {
|
|
22
|
-
const rand = (0, coinFlip_1.coinFlip)();
|
|
23
|
-
const polynome1 = new polynomial_1.Polynomial([(0, randint_1.randint)(-9, 10), (0, randint_1.randint)(-5, 6, [0])]);
|
|
24
|
-
const polynome2 = new polynomial_1.Polynomial([(0, randint_1.randint)(-9, 10), (0, randint_1.randint)(-9, 10), (0, randint_1.randint)(-4, 5, [0])]);
|
|
25
|
-
const xValue = (0, randint_1.randint)(-9, 10);
|
|
26
|
-
const statement = rand
|
|
27
|
-
? `Calculer $${polynome1.toTree().toTex()}$ pour x = $${xValue}$`
|
|
28
|
-
: `Calculer $${polynome2.toTree().toTex()}$ pour x = $${xValue}$`;
|
|
29
|
-
const answer = rand ? polynome1.calculate(xValue) : polynome2.calculate(xValue);
|
|
30
|
-
const getPropositions = (n) => {
|
|
31
|
-
const res = [];
|
|
32
|
-
res.push({
|
|
33
|
-
id: (0, uuid_1.v4)() + '',
|
|
34
|
-
statement: answer + '',
|
|
35
|
-
isRightAnswer: true,
|
|
36
|
-
});
|
|
37
|
-
for (let i = 0; i < n - 1; i++) {
|
|
38
|
-
let isDuplicate;
|
|
39
|
-
let proposition;
|
|
40
|
-
do {
|
|
41
|
-
const wrongAnswer = answer + (0, randint_1.randint)(-10, 11, [0]);
|
|
42
|
-
proposition = {
|
|
43
|
-
id: (0, uuid_1.v4)() + '',
|
|
44
|
-
statement: wrongAnswer + '',
|
|
45
|
-
isRightAnswer: false,
|
|
46
|
-
};
|
|
47
|
-
isDuplicate = res.some((p) => p.statement === proposition.statement);
|
|
48
|
-
} while (isDuplicate);
|
|
49
|
-
res.push(proposition);
|
|
50
|
-
}
|
|
51
|
-
return (0, shuffle_1.shuffle)(res);
|
|
52
|
-
};
|
|
53
|
-
const question = {
|
|
54
|
-
instruction: statement,
|
|
55
|
-
answer: answer + '',
|
|
56
|
-
keys: ['x', 'S', 'equal', 'lbrace', 'rbrace', 'semicolon', 'emptyset'],
|
|
57
|
-
getPropositions,
|
|
58
|
-
};
|
|
59
|
-
return question;
|
|
60
|
-
}
|
|
61
|
-
exports.getEvaluateExpression = getEvaluateExpression;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"firstDegreeGeneralEquation.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calculLitteral/equation/firstDegreeGeneralEquation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAQ9D,eAAO,MAAM,0BAA0B,EAAE,QAUxC,CAAC;AAEF,wBAAgB,6BAA6B,IAAI,QAAQ,CAaxD"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getFirstDegreeGeneralEquation = exports.firstDegreeGeneralEquation = 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
|
-
const numberNode_1 = require("../../../tree/nodes/numbers/numberNode");
|
|
8
|
-
const simplify_1 = require("../../../tree/parsers/simplify");
|
|
9
|
-
exports.firstDegreeGeneralEquation = {
|
|
10
|
-
id: 'firstDegreeGeneralEquation',
|
|
11
|
-
connector: '=',
|
|
12
|
-
instruction: '',
|
|
13
|
-
label: 'Résoudre une équation du premier degré du type ax + b = cx',
|
|
14
|
-
levels: ['4ème', '3ème', '2nde'],
|
|
15
|
-
sections: ['Équations'],
|
|
16
|
-
isSingleStep: false,
|
|
17
|
-
generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getFirstDegreeGeneralEquation, nb),
|
|
18
|
-
keys: ['x', 'S', 'equal', 'lbrace', 'rbrace', 'semicolon', 'emptyset'],
|
|
19
|
-
};
|
|
20
|
-
function getFirstDegreeGeneralEquation() {
|
|
21
|
-
let a = (0, randint_1.randint)(-9, 10, [0]);
|
|
22
|
-
const b = (0, randint_1.randint)(-9, 10);
|
|
23
|
-
const c = (0, randint_1.randint)(-9, 10, [a, 0]);
|
|
24
|
-
const question = {
|
|
25
|
-
instruction: `Résoudre l'équation suivante $${new polynomial_1.Polynomial([b, a])} = ${new polynomial_1.Polynomial([0, c])}$`,
|
|
26
|
-
startStatement: `x`,
|
|
27
|
-
answer: (0, simplify_1.simplifyNode)(new numberNode_1.NumberNode(-b / (a - c))).toTex(),
|
|
28
|
-
keys: ['x', 'S', 'equal', 'lbrace', 'rbrace', 'semicolon', 'emptyset'],
|
|
29
|
-
};
|
|
30
|
-
return question;
|
|
31
|
-
}
|
|
32
|
-
exports.getFirstDegreeGeneralEquation = getFirstDegreeGeneralEquation;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"template.d.ts","sourceRoot":"","sources":["../../../../src/exercises/functions/affines/template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAK3E,eAAO,MAAM,GAAG,EAAE,QASjB,CAAC;AAEF,wBAAgB,cAAc,IAAI,QAAQ,CAyCzC"}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getExoQuestion = exports.exo = void 0;
|
|
4
|
-
const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
|
|
5
|
-
const shuffle_1 = require("../../../utils/shuffle");
|
|
6
|
-
const uuid_1 = require("uuid");
|
|
7
|
-
exports.exo = {
|
|
8
|
-
id: 'name',
|
|
9
|
-
connector: '',
|
|
10
|
-
instruction: '',
|
|
11
|
-
label: '',
|
|
12
|
-
levels: [],
|
|
13
|
-
isSingleStep: true,
|
|
14
|
-
sections: [],
|
|
15
|
-
generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getExoQuestion, nb),
|
|
16
|
-
};
|
|
17
|
-
function getExoQuestion() {
|
|
18
|
-
const getPropositions = (n) => {
|
|
19
|
-
const res = [];
|
|
20
|
-
res.push({
|
|
21
|
-
id: (0, uuid_1.v4)() + '',
|
|
22
|
-
statement: '',
|
|
23
|
-
isRightAnswer: true,
|
|
24
|
-
format: 'tex',
|
|
25
|
-
});
|
|
26
|
-
for (let i = 0; i < n - 1; i++) {
|
|
27
|
-
let isDuplicate;
|
|
28
|
-
let proposition;
|
|
29
|
-
do {
|
|
30
|
-
const wrongAnswer = '';
|
|
31
|
-
proposition = {
|
|
32
|
-
id: (0, uuid_1.v4)() + '',
|
|
33
|
-
statement: wrongAnswer,
|
|
34
|
-
isRightAnswer: false,
|
|
35
|
-
format: 'tex',
|
|
36
|
-
};
|
|
37
|
-
isDuplicate = res.some((p) => p.statement === proposition.statement);
|
|
38
|
-
} while (isDuplicate);
|
|
39
|
-
res.push(proposition);
|
|
40
|
-
}
|
|
41
|
-
return (0, shuffle_1.shuffle)(res);
|
|
42
|
-
};
|
|
43
|
-
const question = {
|
|
44
|
-
answer: '',
|
|
45
|
-
keys: [],
|
|
46
|
-
getPropositions,
|
|
47
|
-
answerFormat: 'tex',
|
|
48
|
-
};
|
|
49
|
-
return question;
|
|
50
|
-
}
|
|
51
|
-
exports.getExoQuestion = getExoQuestion;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"imageFunction.d.ts","sourceRoot":"","sources":["../../../../src/exercises/geometry/cartesian/imageFunction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAQ3E,eAAO,MAAM,aAAa,EAAE,QAU3B,CAAC;AAEF,wBAAgB,gBAAgB,IAAI,QAAQ,CAqD3C"}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getImageFunction = exports.imageFunction = 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
|
-
const coinFlip_1 = require("../../../utils/coinFlip");
|
|
8
|
-
const shuffle_1 = require("../../../utils/shuffle");
|
|
9
|
-
const uuid_1 = require("uuid");
|
|
10
|
-
exports.imageFunction = {
|
|
11
|
-
id: 'imageFunction',
|
|
12
|
-
connector: '=',
|
|
13
|
-
instruction: '',
|
|
14
|
-
label: "Image d'une fonction",
|
|
15
|
-
levels: ['4', '3', '2'],
|
|
16
|
-
section: 'Géométrie cartésienne',
|
|
17
|
-
isSingleStep: true,
|
|
18
|
-
generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getImageFunction, nb),
|
|
19
|
-
keys: [],
|
|
20
|
-
};
|
|
21
|
-
function getImageFunction() {
|
|
22
|
-
const rand = (0, coinFlip_1.coinFlip)();
|
|
23
|
-
const polynome1 = new polynomial_1.Polynomial([(0, randint_1.randint)(-9, 10), (0, randint_1.randint)(-5, 6, [0])]);
|
|
24
|
-
const polynome2 = new polynomial_1.Polynomial([(0, randint_1.randint)(-9, 10), (0, randint_1.randint)(-9, 10), (0, randint_1.randint)(-4, 5, [0])]);
|
|
25
|
-
const xValue = (0, randint_1.randint)(-9, 10);
|
|
26
|
-
const statement = rand
|
|
27
|
-
? `Soit $f(x) = ${polynome1.toTree().toTex()}$. Calculer $f(${xValue})$.`
|
|
28
|
-
: `Soit $f(x) = ${polynome2.toTree().toTex()}$. Calculer $f(${xValue})$.`;
|
|
29
|
-
const answer = rand ? polynome1.calculate(xValue) : polynome2.calculate(xValue);
|
|
30
|
-
const getPropositions = (n) => {
|
|
31
|
-
const res = [];
|
|
32
|
-
res.push({
|
|
33
|
-
id: (0, uuid_1.v4)() + '',
|
|
34
|
-
statement: answer + '',
|
|
35
|
-
isRightAnswer: true,
|
|
36
|
-
format: 'tex',
|
|
37
|
-
});
|
|
38
|
-
for (let i = 0; i < n - 1; i++) {
|
|
39
|
-
let isDuplicate;
|
|
40
|
-
let proposition;
|
|
41
|
-
do {
|
|
42
|
-
const wrongAnswer = answer + (0, randint_1.randint)(-10, 11, [0]);
|
|
43
|
-
proposition = {
|
|
44
|
-
id: (0, uuid_1.v4)() + '',
|
|
45
|
-
statement: wrongAnswer + '',
|
|
46
|
-
isRightAnswer: false,
|
|
47
|
-
format: 'tex',
|
|
48
|
-
};
|
|
49
|
-
isDuplicate = res.some((p) => p.statement === proposition.statement);
|
|
50
|
-
} while (isDuplicate);
|
|
51
|
-
res.push(proposition);
|
|
52
|
-
}
|
|
53
|
-
return (0, shuffle_1.shuffle)(res);
|
|
54
|
-
};
|
|
55
|
-
const question = {
|
|
56
|
-
instruction: statement,
|
|
57
|
-
startStatement: `f(${xValue})`,
|
|
58
|
-
answer: answer + '',
|
|
59
|
-
keys: [],
|
|
60
|
-
getPropositions,
|
|
61
|
-
answerFormat: 'tex',
|
|
62
|
-
};
|
|
63
|
-
return question;
|
|
64
|
-
}
|
|
65
|
-
exports.getImageFunction = getImageFunction;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"imageFunctionGeogebra.d.ts","sourceRoot":"","sources":["../../../../src/exercises/geometry/cartesian/imageFunctionGeogebra.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAQ3E,eAAO,MAAM,qBAAqB,EAAE,QAUnC,CAAC;AAEF,wBAAgB,wBAAwB,IAAI,QAAQ,CAiFnD"}
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getImageFunctionGeogebra = exports.imageFunctionGeogebra = 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
|
-
const coinFlip_1 = require("../../../utils/coinFlip");
|
|
8
|
-
const shuffle_1 = require("../../../utils/shuffle");
|
|
9
|
-
const uuid_1 = require("uuid");
|
|
10
|
-
exports.imageFunctionGeogebra = {
|
|
11
|
-
id: 'imageFunctionGeogebra',
|
|
12
|
-
connector: '=',
|
|
13
|
-
instruction: '',
|
|
14
|
-
label: "Lecture d'une image",
|
|
15
|
-
levels: ['4', '3', '2'],
|
|
16
|
-
section: 'Géométrie cartésienne',
|
|
17
|
-
isSingleStep: true,
|
|
18
|
-
generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getImageFunctionGeogebra, nb),
|
|
19
|
-
keys: [],
|
|
20
|
-
};
|
|
21
|
-
function getImageFunctionGeogebra() {
|
|
22
|
-
const rand = (0, coinFlip_1.coinFlip)();
|
|
23
|
-
const xValue = (0, randint_1.randint)(-5, 6);
|
|
24
|
-
let polynome1;
|
|
25
|
-
do {
|
|
26
|
-
polynome1 = new polynomial_1.Polynomial([(0, randint_1.randint)(-9, 10), (0, randint_1.randint)(-5, 6, [0])]);
|
|
27
|
-
} while (polynome1.calculate(xValue) > 10 || polynome1.calculate(xValue) < -10);
|
|
28
|
-
let polynome2;
|
|
29
|
-
do {
|
|
30
|
-
polynome2 = new polynomial_1.Polynomial([(0, randint_1.randint)(-9, 10), (0, randint_1.randint)(-9, 10), (0, randint_1.randint)(-4, 5, [0])]);
|
|
31
|
-
} while (polynome2.calculate(xValue) > 10 || polynome2.calculate(xValue) < -10);
|
|
32
|
-
const statement = `Quelle est l'image de $${xValue}$ par la fonction $f$ représentée ci dessous ?`;
|
|
33
|
-
const answer = rand ? polynome1.calculate(xValue) : polynome2.calculate(xValue);
|
|
34
|
-
let xmin, xmax, ymin, ymax;
|
|
35
|
-
if (answer > 0) {
|
|
36
|
-
ymax = answer + 1;
|
|
37
|
-
ymin = -1;
|
|
38
|
-
}
|
|
39
|
-
else {
|
|
40
|
-
ymin = answer - 1;
|
|
41
|
-
ymax = 1;
|
|
42
|
-
}
|
|
43
|
-
if (xValue > 0) {
|
|
44
|
-
xmax = xValue + 1;
|
|
45
|
-
xmin = -1;
|
|
46
|
-
}
|
|
47
|
-
else {
|
|
48
|
-
xmin = xValue - 1;
|
|
49
|
-
xmax = 1;
|
|
50
|
-
}
|
|
51
|
-
const getPropositions = (n) => {
|
|
52
|
-
const res = [];
|
|
53
|
-
res.push({
|
|
54
|
-
id: (0, uuid_1.v4)() + '',
|
|
55
|
-
statement: answer + '',
|
|
56
|
-
isRightAnswer: true,
|
|
57
|
-
format: 'tex',
|
|
58
|
-
});
|
|
59
|
-
for (let i = 0; i < n - 1; i++) {
|
|
60
|
-
let isDuplicate;
|
|
61
|
-
let proposition;
|
|
62
|
-
do {
|
|
63
|
-
const wrongAnswer = answer + (0, randint_1.randint)(-10, 11, [0]);
|
|
64
|
-
proposition = {
|
|
65
|
-
id: (0, uuid_1.v4)() + '',
|
|
66
|
-
statement: wrongAnswer + '',
|
|
67
|
-
isRightAnswer: false,
|
|
68
|
-
format: 'tex',
|
|
69
|
-
};
|
|
70
|
-
isDuplicate = res.some((p) => p.statement === proposition.statement);
|
|
71
|
-
} while (isDuplicate);
|
|
72
|
-
res.push(proposition);
|
|
73
|
-
}
|
|
74
|
-
return (0, shuffle_1.shuffle)(res);
|
|
75
|
-
};
|
|
76
|
-
const commands = [rand ? polynome1.toString() : polynome2.toString()];
|
|
77
|
-
const question = {
|
|
78
|
-
instruction: statement,
|
|
79
|
-
startStatement: `f(${xValue})`,
|
|
80
|
-
answer: answer + '',
|
|
81
|
-
keys: [],
|
|
82
|
-
commands,
|
|
83
|
-
coords: [xmin, xmax, ymin, ymax],
|
|
84
|
-
getPropositions,
|
|
85
|
-
answerFormat: 'tex',
|
|
86
|
-
};
|
|
87
|
-
return question;
|
|
88
|
-
}
|
|
89
|
-
exports.getImageFunctionGeogebra = getImageFunctionGeogebra;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"inverseImageFunction.d.ts","sourceRoot":"","sources":["../../../../src/exercises/geometry/cartesian/inverseImageFunction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAO3E,eAAO,MAAM,oBAAoB,EAAE,QAUlC,CAAC;AAEF,wBAAgB,uBAAuB,IAAI,QAAQ,CAkDlD"}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getInverseImageFunction = exports.inverseImageFunction = 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
|
-
const shuffle_1 = require("../../../utils/shuffle");
|
|
8
|
-
const uuid_1 = require("uuid");
|
|
9
|
-
exports.inverseImageFunction = {
|
|
10
|
-
id: 'inverseImageFunction',
|
|
11
|
-
connector: '\\iff',
|
|
12
|
-
instruction: '',
|
|
13
|
-
label: 'Calculer des antécédents',
|
|
14
|
-
levels: ['4', '3', '2'],
|
|
15
|
-
section: 'Géométrie cartésienne',
|
|
16
|
-
isSingleStep: true,
|
|
17
|
-
generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getInverseImageFunction, nb),
|
|
18
|
-
keys: [],
|
|
19
|
-
};
|
|
20
|
-
function getInverseImageFunction() {
|
|
21
|
-
const polynome1 = new polynomial_1.Polynomial([(0, randint_1.randint)(-9, 10), (0, randint_1.randint)(-5, 6, [0])]);
|
|
22
|
-
const xValue = (0, randint_1.randint)(-9, 10);
|
|
23
|
-
const answer = polynome1.calculate(xValue);
|
|
24
|
-
const statement = `Soit $f(x) = ${polynome1
|
|
25
|
-
.toTree()
|
|
26
|
-
.toTex()}$. Déterminer le ou les antécédents de $${answer}$ par $f$.`;
|
|
27
|
-
const getPropositions = (n) => {
|
|
28
|
-
const res = [];
|
|
29
|
-
res.push({
|
|
30
|
-
id: (0, uuid_1.v4)() + '',
|
|
31
|
-
statement: xValue + '',
|
|
32
|
-
isRightAnswer: true,
|
|
33
|
-
format: 'tex',
|
|
34
|
-
});
|
|
35
|
-
for (let i = 0; i < n - 1; i++) {
|
|
36
|
-
let isDuplicate;
|
|
37
|
-
let proposition;
|
|
38
|
-
do {
|
|
39
|
-
const wrongAnswer = xValue + (0, randint_1.randint)(-10, 11, [0]);
|
|
40
|
-
proposition = {
|
|
41
|
-
id: (0, uuid_1.v4)() + '',
|
|
42
|
-
statement: wrongAnswer + '',
|
|
43
|
-
isRightAnswer: false,
|
|
44
|
-
format: 'tex',
|
|
45
|
-
};
|
|
46
|
-
isDuplicate = res.some((p) => p.statement === proposition.statement);
|
|
47
|
-
} while (isDuplicate);
|
|
48
|
-
res.push(proposition);
|
|
49
|
-
}
|
|
50
|
-
return (0, shuffle_1.shuffle)(res);
|
|
51
|
-
};
|
|
52
|
-
const question = {
|
|
53
|
-
instruction: statement,
|
|
54
|
-
startStatement: `f(x) = ${answer}`,
|
|
55
|
-
answer: xValue + '',
|
|
56
|
-
keys: ['x', 'equal'],
|
|
57
|
-
getPropositions,
|
|
58
|
-
answerFormat: 'tex',
|
|
59
|
-
};
|
|
60
|
-
return question;
|
|
61
|
-
}
|
|
62
|
-
exports.getInverseImageFunction = getInverseImageFunction;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"inverseImageFunctionGeogebra.d.ts","sourceRoot":"","sources":["../../../../src/exercises/geometry/cartesian/inverseImageFunctionGeogebra.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAS3E,eAAO,MAAM,4BAA4B,EAAE,QAU1C,CAAC;AAEF,wBAAgB,+BAA+B,IAAI,QAAQ,CAsJ1D"}
|
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getInverseImageFunctionGeogebra = exports.inverseImageFunctionGeogebra = 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
|
-
const round_1 = require("../../../math/utils/round");
|
|
8
|
-
const coinFlip_1 = require("../../../utils/coinFlip");
|
|
9
|
-
const shuffle_1 = require("../../../utils/shuffle");
|
|
10
|
-
const uuid_1 = require("uuid");
|
|
11
|
-
exports.inverseImageFunctionGeogebra = {
|
|
12
|
-
id: 'inverseImageFunctionGeogebra',
|
|
13
|
-
connector: '\\iff',
|
|
14
|
-
instruction: '',
|
|
15
|
-
label: "Lecture d'antécédents",
|
|
16
|
-
levels: ['3', '2', '1'],
|
|
17
|
-
section: 'Fonctions',
|
|
18
|
-
isSingleStep: true,
|
|
19
|
-
generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getInverseImageFunctionGeogebra, nb),
|
|
20
|
-
keys: ['S', 'equal', 'lbrace', 'rbrace', 'semicolon', 'emptyset'],
|
|
21
|
-
};
|
|
22
|
-
function getInverseImageFunctionGeogebra() {
|
|
23
|
-
const rand = (0, coinFlip_1.coinFlip)();
|
|
24
|
-
const xValue = (0, randint_1.randint)(-5, 6);
|
|
25
|
-
const yValue = (0, randint_1.randint)(-5, 6);
|
|
26
|
-
let polynome1;
|
|
27
|
-
do {
|
|
28
|
-
polynome1 = new polynomial_1.Polynomial([(0, randint_1.randint)(-9, 10), (0, randint_1.randint)(-5, 6, [0])]);
|
|
29
|
-
} while (polynome1.calculate(xValue) > 10 || polynome1.calculate(xValue) < -10);
|
|
30
|
-
let polynome2 = new polynomial_1.Polynomial([(0, randint_1.randint)(-9, 10) - yValue, (0, randint_1.randint)(-9, 10), (0, randint_1.randint)(-4, 5, [0])]);
|
|
31
|
-
let roots = polynome2.getRoots();
|
|
32
|
-
if (roots.length === 2)
|
|
33
|
-
while (roots[0] > 10 || roots[0] < -10 || roots[1] > 10 || roots[1] < -10) {
|
|
34
|
-
polynome2 = new polynomial_1.Polynomial([(0, randint_1.randint)(-9, 10) - yValue, (0, randint_1.randint)(-9, 10), (0, randint_1.randint)(-4, 5, [0])]);
|
|
35
|
-
roots = polynome2.getRoots();
|
|
36
|
-
}
|
|
37
|
-
if (roots.length === 1)
|
|
38
|
-
while (roots[0] < -10 || roots[0] > 10) {
|
|
39
|
-
polynome2 = new polynomial_1.Polynomial([(0, randint_1.randint)(-9, 10) - yValue, (0, randint_1.randint)(-9, 10), (0, randint_1.randint)(-4, 5, [0])]);
|
|
40
|
-
roots = polynome2.getRoots();
|
|
41
|
-
}
|
|
42
|
-
const statement = rand
|
|
43
|
-
? `Déterminer le ou les antécédents de ${polynome1.calculate(xValue)}$ par la fonction $f$ représentée ci dessous.`
|
|
44
|
-
: `Déterminer le ou les antécédents de ${yValue}$ par la fonction $f$ représentée ci dessous.`;
|
|
45
|
-
const answer = rand
|
|
46
|
-
? xValue
|
|
47
|
-
: roots.length === 2
|
|
48
|
-
? `\\{${(0, round_1.round)(roots[0], 1)};${(0, round_1.round)(roots[1], 1)} \\}`
|
|
49
|
-
: roots.length === 1
|
|
50
|
-
? roots[0]
|
|
51
|
-
: `\\emptyset`;
|
|
52
|
-
const optimum = polynome2.derivate().getRoots()[0];
|
|
53
|
-
let xmin = 0, xmax = 0, ymin = 0, ymax = 0;
|
|
54
|
-
if (rand) {
|
|
55
|
-
if (polynome1.calculate(xValue) > 0) {
|
|
56
|
-
ymax = polynome1.calculate(xValue) + 1;
|
|
57
|
-
ymin = -1;
|
|
58
|
-
}
|
|
59
|
-
else {
|
|
60
|
-
ymin = polynome1.calculate(xValue) - 1;
|
|
61
|
-
ymax = 1;
|
|
62
|
-
}
|
|
63
|
-
if (xValue > 0) {
|
|
64
|
-
xmax = xValue + 1;
|
|
65
|
-
xmin = -1;
|
|
66
|
-
}
|
|
67
|
-
else {
|
|
68
|
-
xmin = xValue - 1;
|
|
69
|
-
xmax = 1;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
else {
|
|
73
|
-
console.log(optimum);
|
|
74
|
-
if (roots.length === 2) {
|
|
75
|
-
if (yValue > polynome2.calculate(optimum) + yValue) {
|
|
76
|
-
ymax = yValue + 2;
|
|
77
|
-
ymin = polynome2.calculate(optimum) + yValue - 2;
|
|
78
|
-
}
|
|
79
|
-
else {
|
|
80
|
-
ymin = yValue - 2;
|
|
81
|
-
ymax = polynome2.calculate(optimum) + yValue + 2;
|
|
82
|
-
}
|
|
83
|
-
xmax = Math.max(roots[0], roots[1]) + 1;
|
|
84
|
-
xmin = Math.min(roots[0], roots[1]) - 1;
|
|
85
|
-
}
|
|
86
|
-
if (roots.length === 1) {
|
|
87
|
-
if (yValue > 0) {
|
|
88
|
-
ymax = yValue + 5;
|
|
89
|
-
ymin = yValue - 1;
|
|
90
|
-
}
|
|
91
|
-
else {
|
|
92
|
-
ymin = yValue - 5;
|
|
93
|
-
ymax = yValue + 1;
|
|
94
|
-
}
|
|
95
|
-
xmax = optimum + 5;
|
|
96
|
-
xmin = optimum - 5;
|
|
97
|
-
}
|
|
98
|
-
if (roots.length === 0) {
|
|
99
|
-
if (yValue > polynome2.calculate(optimum) + yValue) {
|
|
100
|
-
ymax = yValue + 1;
|
|
101
|
-
ymin = polynome2.calculate(optimum) + yValue - 3;
|
|
102
|
-
}
|
|
103
|
-
else {
|
|
104
|
-
ymin = yValue - 1;
|
|
105
|
-
ymax = polynome2.calculate(optimum) + yValue + 3;
|
|
106
|
-
}
|
|
107
|
-
xmax = optimum + 5;
|
|
108
|
-
xmin = optimum - 5;
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
const getPropositions = (n) => {
|
|
112
|
-
const res = [];
|
|
113
|
-
res.push({
|
|
114
|
-
id: (0, uuid_1.v4)() + '',
|
|
115
|
-
statement: answer + '',
|
|
116
|
-
isRightAnswer: true,
|
|
117
|
-
format: 'tex',
|
|
118
|
-
});
|
|
119
|
-
for (let i = 0; i < n - 1; i++) {
|
|
120
|
-
let isDuplicate;
|
|
121
|
-
let proposition;
|
|
122
|
-
do {
|
|
123
|
-
const wrongAnswer = (0, coinFlip_1.coinFlip)()
|
|
124
|
-
? (0, randint_1.randint)(-9, 10, [polynome1.calculate(xValue)])
|
|
125
|
-
: roots.length === 2
|
|
126
|
-
? `\\{${(0, randint_1.randint)(-9, 10)};${(0, randint_1.randint)(-9, 10)} \\}`
|
|
127
|
-
: roots.length === 1
|
|
128
|
-
? (0, randint_1.randint)(-9, 10, [roots[0]])
|
|
129
|
-
: `\\emptyset`;
|
|
130
|
-
proposition = {
|
|
131
|
-
id: (0, uuid_1.v4)() + '',
|
|
132
|
-
statement: wrongAnswer + '',
|
|
133
|
-
isRightAnswer: false,
|
|
134
|
-
format: 'tex',
|
|
135
|
-
};
|
|
136
|
-
isDuplicate = res.some((p) => p.statement === proposition.statement);
|
|
137
|
-
} while (isDuplicate);
|
|
138
|
-
res.push(proposition);
|
|
139
|
-
}
|
|
140
|
-
return (0, shuffle_1.shuffle)(res);
|
|
141
|
-
};
|
|
142
|
-
const commands = [rand ? polynome1.toString() : polynome2.add(new polynomial_1.Polynomial([yValue])).toString()];
|
|
143
|
-
const question = {
|
|
144
|
-
instruction: statement,
|
|
145
|
-
answer: answer + '',
|
|
146
|
-
keys: ['S', 'equal', 'lbrace', 'rbrace', 'semicolon', 'emptyset'],
|
|
147
|
-
commands,
|
|
148
|
-
coords: [xmin, xmax, ymin, ymax],
|
|
149
|
-
getPropositions,
|
|
150
|
-
answerFormat: 'tex',
|
|
151
|
-
};
|
|
152
|
-
return question;
|
|
153
|
-
}
|
|
154
|
-
exports.getInverseImageFunctionGeogebra = getInverseImageFunctionGeogebra;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"leadingCoefficient.d.ts","sourceRoot":"","sources":["../../../../src/exercises/geometry/cartesian/leadingCoefficient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAY3E,eAAO,MAAM,kBAAkB,EAAE,QAShC,CAAC;AAEF,wBAAgB,6BAA6B,IAAI,QAAQ,CAiFxD"}
|