math-exercises 1.4.12 → 1.4.14
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/derivative/firstDegreeDerivative.js +1 -1
- package/lib/exercises/derivation/derivative/thirdDegreeFunctionVariation.d.ts.map +1 -1
- package/lib/exercises/derivation/derivative/thirdDegreeFunctionVariation.js +5 -7
- package/lib/exercises/functions/affines/signFunction.js +6 -6
- package/lib/exercises/sets/intervals/inequalityToInterval.d.ts.map +1 -1
- package/lib/exercises/sets/intervals/inequalityToInterval.js +3 -3
- package/lib/math/sets/intervals/intervals.js +2 -2
- package/lib/tree/nodes/operators/divideNode.js +2 -2
- package/lib/tree/nodes/operators/multiplyNode.js +2 -2
- package/package.json +1 -1
|
@@ -55,7 +55,7 @@ function getFirstDegreeDerivative() {
|
|
|
55
55
|
instruction: `Déterminer la fonction dérivée $f'$ de la fonction $f$ définie par $f(x) = ${polynomial.toString()}$.`,
|
|
56
56
|
startStatement: `f'(x)`,
|
|
57
57
|
answer: a + '',
|
|
58
|
-
keys: [],
|
|
58
|
+
keys: ['x'],
|
|
59
59
|
getPropositions,
|
|
60
60
|
answerFormat: 'tex',
|
|
61
61
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"thirdDegreeFunctionVariation.d.ts","sourceRoot":"","sources":["../../../../src/exercises/derivation/derivative/thirdDegreeFunctionVariation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAQ/E,eAAO,MAAM,4BAA4B,EAAE,YAY1C,CAAC;AAEF,wBAAgB,+BAA+B,IAAI,QAAQ,
|
|
1
|
+
{"version":3,"file":"thirdDegreeFunctionVariation.d.ts","sourceRoot":"","sources":["../../../../src/exercises/derivation/derivative/thirdDegreeFunctionVariation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAQ/E,eAAO,MAAM,4BAA4B,EAAE,YAY1C,CAAC;AAEF,wBAAgB,+BAA+B,IAAI,QAAQ,CA+F1D"}
|
|
@@ -30,9 +30,7 @@ function getThirdDegreeFunctionVariation() {
|
|
|
30
30
|
const coin = (0, coinFlip_1.coinFlip)() ? -1 : 1;
|
|
31
31
|
const instruction = `Soit $f$ la fonction représentée ci-dessous. Sur quel intervalle la dérivée de $f$ est-elle ` +
|
|
32
32
|
(coin < 0 ? 'négative ?' : 'positive ?');
|
|
33
|
-
const answer = coin * a < 0
|
|
34
|
-
? `\\left[${racine1};${racine2}\\right]`
|
|
35
|
-
: `\\left]-\\infty;${racine1}\\right]\\cup\\left[${racine2};+\\infty\\right[`;
|
|
33
|
+
const answer = coin * a < 0 ? `[${racine1};${racine2}]` : `]-\\infty;${racine1}]\\cup[${racine2};+\\infty[`;
|
|
36
34
|
const getPropositions = (n) => {
|
|
37
35
|
const res = [];
|
|
38
36
|
res.push({
|
|
@@ -43,21 +41,21 @@ function getThirdDegreeFunctionVariation() {
|
|
|
43
41
|
});
|
|
44
42
|
res.push({
|
|
45
43
|
id: (0, uuid_1.v4)() + '',
|
|
46
|
-
statement:
|
|
44
|
+
statement: `[${racine2};+\\infty[`,
|
|
47
45
|
isRightAnswer: false,
|
|
48
46
|
format: 'tex',
|
|
49
47
|
});
|
|
50
48
|
if (n > 2)
|
|
51
49
|
res.push({
|
|
52
50
|
id: (0, uuid_1.v4)() + '',
|
|
53
|
-
statement:
|
|
51
|
+
statement: `]-\\infty;${racine1}]`,
|
|
54
52
|
isRightAnswer: false,
|
|
55
53
|
format: 'tex',
|
|
56
54
|
});
|
|
57
55
|
if (n > 3)
|
|
58
56
|
res.push({
|
|
59
57
|
id: (0, uuid_1.v4)() + '',
|
|
60
|
-
statement:
|
|
58
|
+
statement: `]-\\infty;${racine1}] \\cup [${racine2};+\\infty[`,
|
|
61
59
|
isRightAnswer: false,
|
|
62
60
|
format: 'tex',
|
|
63
61
|
});
|
|
@@ -67,7 +65,7 @@ function getThirdDegreeFunctionVariation() {
|
|
|
67
65
|
do {
|
|
68
66
|
const racine1 = (0, randint_1.randint)(-5, 4);
|
|
69
67
|
const racine2 = (0, randint_1.randint)(racine1 + 1, 6);
|
|
70
|
-
const wrongAnswer =
|
|
68
|
+
const wrongAnswer = `[${racine1};${racine2}]`;
|
|
71
69
|
proposition = {
|
|
72
70
|
id: (0, uuid_1.v4)() + '',
|
|
73
71
|
statement: wrongAnswer,
|
|
@@ -33,15 +33,15 @@ function getSignFunction() {
|
|
|
33
33
|
instruction += 'positive ?';
|
|
34
34
|
answer =
|
|
35
35
|
a > 0
|
|
36
|
-
?
|
|
37
|
-
:
|
|
36
|
+
? `[${(0, simplify_1.simplifyNode)(new numberNode_1.NumberNode(-b / a)).toTex()};+\\infty[`
|
|
37
|
+
: `]-\\infty;${(0, simplify_1.simplifyNode)(new numberNode_1.NumberNode(-b / a)).toTex()}]`;
|
|
38
38
|
break;
|
|
39
39
|
case false:
|
|
40
40
|
instruction += 'négative ?';
|
|
41
41
|
answer =
|
|
42
42
|
a > 0
|
|
43
|
-
?
|
|
44
|
-
:
|
|
43
|
+
? `]-\\infty;${(0, simplify_1.simplifyNode)(new numberNode_1.NumberNode(-b / a)).toTex()}]`
|
|
44
|
+
: `[${(0, simplify_1.simplifyNode)(new numberNode_1.NumberNode(-b / a)).toTex()};+\\infty[`;
|
|
45
45
|
break;
|
|
46
46
|
}
|
|
47
47
|
const getPropositions = (n) => {
|
|
@@ -59,8 +59,8 @@ function getSignFunction() {
|
|
|
59
59
|
const a = (0, randint_1.randint)(-9, 10, [0]);
|
|
60
60
|
const b = (0, randint_1.randint)(-9, 10);
|
|
61
61
|
const wrongAnswer = (0, coinFlip_1.coinFlip)()
|
|
62
|
-
?
|
|
63
|
-
:
|
|
62
|
+
? `[${(0, simplify_1.simplifyNode)(new numberNode_1.NumberNode(-b / a)).toTex()};+\\infty[`
|
|
63
|
+
: `]-\\infty;${(0, simplify_1.simplifyNode)(new numberNode_1.NumberNode(-b / a)).toTex()}]`;
|
|
64
64
|
proposition = {
|
|
65
65
|
id: (0, uuid_1.v4)() + '',
|
|
66
66
|
statement: wrongAnswer,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inequalityToInterval.d.ts","sourceRoot":"","sources":["../../../../src/exercises/sets/intervals/inequalityToInterval.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAO/E,eAAO,MAAM,oBAAoB,EAAE,YAWlC,CAAC;AAEF,wBAAgB,+BAA+B,IAAI,QAAQ,
|
|
1
|
+
{"version":3,"file":"inequalityToInterval.d.ts","sourceRoot":"","sources":["../../../../src/exercises/sets/intervals/inequalityToInterval.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAO/E,eAAO,MAAM,oBAAoB,EAAE,YAWlC,CAAC;AAEF,wBAAgB,+BAA+B,IAAI,QAAQ,CAqH1D"}
|
|
@@ -105,19 +105,19 @@ function getInequalityToIntervalQuestion() {
|
|
|
105
105
|
else {
|
|
106
106
|
res.push({
|
|
107
107
|
id: (0, uuid_1.v4)(),
|
|
108
|
-
statement: `x \\in
|
|
108
|
+
statement: `x \\in ${reverseBracket(interval.leftBracket)}${interval.insideToTex()}${interval.rightBracket}`,
|
|
109
109
|
isRightAnswer: false,
|
|
110
110
|
format: 'tex',
|
|
111
111
|
});
|
|
112
112
|
res.push({
|
|
113
113
|
id: (0, uuid_1.v4)(),
|
|
114
|
-
statement: `x \\in
|
|
114
|
+
statement: `x \\in ${interval.leftBracket}${interval.insideToTex()}${reverseBracket(interval.rightBracket)}`,
|
|
115
115
|
isRightAnswer: false,
|
|
116
116
|
format: 'tex',
|
|
117
117
|
});
|
|
118
118
|
res.push({
|
|
119
119
|
id: (0, uuid_1.v4)(),
|
|
120
|
-
statement: `x \\in
|
|
120
|
+
statement: `x \\in ${reverseBracket(interval.leftBracket)}${interval.insideToTex()}${reverseBracket(interval.rightBracket)}`,
|
|
121
121
|
isRightAnswer: false,
|
|
122
122
|
format: 'tex',
|
|
123
123
|
});
|
|
@@ -148,7 +148,7 @@ class Interval {
|
|
|
148
148
|
(this.min === interval.max && this.leftBracket === ']' && interval.rightBracket === '[')) {
|
|
149
149
|
const firstInterval = this.min < interval.min ? this : interval;
|
|
150
150
|
const secondInterval = this.min < interval.min ? interval : this;
|
|
151
|
-
return new mathSet_1.MathSet(
|
|
151
|
+
return new mathSet_1.MathSet(`${unionLeftBracket}${firstInterval.minTex};${firstInterval.maxTex}${firstInterval.rightBracket}\\cup${secondInterval.leftBracket}${secondInterval.minTex};${secondInterval.maxTex}${unionRightBracket}`, () => ((0, coinFlip_1.coinFlip)() ? firstInterval.getRandomElement() : secondInterval.getRandomElement()));
|
|
152
152
|
}
|
|
153
153
|
else {
|
|
154
154
|
return new Interval(`${unionLeftBracket}${minTex};${maxTex}${unionRightBracket}`);
|
|
@@ -209,7 +209,7 @@ class Interval {
|
|
|
209
209
|
return this.tex.replaceAll('[', '').replaceAll(']', '');
|
|
210
210
|
}
|
|
211
211
|
toTex() {
|
|
212
|
-
return
|
|
212
|
+
return `${this.leftBracket}${this.insideToTex()}${this.rightBracket}`;
|
|
213
213
|
}
|
|
214
214
|
toInequality() {
|
|
215
215
|
const isLeftClosed = this.boundType === BoundType.FO || this.boundType === BoundType.FF;
|
|
@@ -20,7 +20,7 @@ class DivideNode extends operatorNode_1.OperatorNode {
|
|
|
20
20
|
let leftTex = this.leftChild.toTex();
|
|
21
21
|
if (this.leftChild.type === node_1.NodeType.operator) {
|
|
22
22
|
if ([operatorNode_1.OperatorIds.add, operatorNode_1.OperatorIds.substract, operatorNode_1.OperatorIds.multiply].includes(this.leftChild.id))
|
|
23
|
-
leftTex =
|
|
23
|
+
leftTex = `\\left(${leftTex}\\right)`;
|
|
24
24
|
}
|
|
25
25
|
let needBrackets = rightTex[0] === '-';
|
|
26
26
|
if (this.rightChild.type === node_1.NodeType.operator) {
|
|
@@ -28,7 +28,7 @@ class DivideNode extends operatorNode_1.OperatorNode {
|
|
|
28
28
|
needBrackets ||= [operatorNode_1.OperatorIds.add, operatorNode_1.OperatorIds.substract, operatorNode_1.OperatorIds.divide].includes(operatorRightChild.id);
|
|
29
29
|
}
|
|
30
30
|
if (needBrackets)
|
|
31
|
-
rightTex =
|
|
31
|
+
rightTex = `\\left(${rightTex}\\right)`;
|
|
32
32
|
const nextIsLetter = rightTex[0].toLowerCase() !== rightTex[0].toUpperCase();
|
|
33
33
|
return `${leftTex}\\div${nextIsLetter ? ' ' : ''}${rightTex}`;
|
|
34
34
|
}
|
|
@@ -29,7 +29,7 @@ class MultiplyNode extends operatorNode_1.OperatorNode {
|
|
|
29
29
|
}
|
|
30
30
|
if (this.leftChild.type === node_1.NodeType.operator) {
|
|
31
31
|
if ([operatorNode_1.OperatorIds.add, operatorNode_1.OperatorIds.substract, operatorNode_1.OperatorIds.divide].includes(this.leftChild.id))
|
|
32
|
-
leftTex =
|
|
32
|
+
leftTex = `\\left(${leftTex}\\right)`;
|
|
33
33
|
}
|
|
34
34
|
let needBrackets = rightTex[0] === '-';
|
|
35
35
|
if (this.rightChild.type === node_1.NodeType.operator) {
|
|
@@ -37,7 +37,7 @@ class MultiplyNode extends operatorNode_1.OperatorNode {
|
|
|
37
37
|
needBrackets ||= [operatorNode_1.OperatorIds.add, operatorNode_1.OperatorIds.substract].includes(operatorRightChild.id);
|
|
38
38
|
}
|
|
39
39
|
if (needBrackets)
|
|
40
|
-
rightTex =
|
|
40
|
+
rightTex = `\\left(${rightTex}\\right)`;
|
|
41
41
|
// permet de gérer le cas 3*2^x par ex
|
|
42
42
|
let showTimesSign = this.forceTimesSign || !isNaN(+rightTex[0]) || this.rightChild.type === node_1.NodeType.number;
|
|
43
43
|
if (this.rightChild.type === node_1.NodeType.operator) {
|