math-exercises 3.0.179 → 3.0.181
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/math/derivation/applications/index.d.ts +3 -0
- package/lib/exercises/math/derivation/applications/index.d.ts.map +1 -0
- package/lib/exercises/math/derivation/applications/index.js +2 -0
- package/lib/exercises/math/derivation/applications/maxBenefice.d.ts +11 -0
- package/lib/exercises/math/derivation/applications/maxBenefice.d.ts.map +1 -0
- package/lib/exercises/math/derivation/applications/maxBenefice.js +184 -0
- package/lib/exercises/math/derivation/applications/minimalCost.d.ts +11 -0
- package/lib/exercises/math/derivation/applications/minimalCost.d.ts.map +1 -0
- package/lib/exercises/math/derivation/applications/minimalCost.js +181 -0
- package/lib/exercises/math/derivation/index.d.ts +1 -0
- package/lib/exercises/math/derivation/index.d.ts.map +1 -1
- package/lib/exercises/math/derivation/index.js +1 -0
- package/lib/exercises/math/derivation/tangent/horizontalTangentFromAlgebraic.d.ts.map +1 -1
- package/lib/exercises/math/derivation/tangent/horizontalTangentFromAlgebraic.js +8 -4
- package/lib/exercises/math/functions/composition/functionComposition.d.ts.map +1 -1
- package/lib/exercises/math/functions/composition/functionComposition.js +20 -15
- package/lib/exercises/math/functions/composition/index.d.ts +1 -0
- package/lib/exercises/math/functions/composition/index.d.ts.map +1 -1
- package/lib/exercises/math/functions/composition/index.js +1 -1
- package/lib/exercises/math/functions/exponential/algebraic/index.d.ts +1 -0
- package/lib/exercises/math/functions/exponential/algebraic/index.d.ts.map +1 -1
- package/lib/exercises/math/functions/exponential/algebraic/index.js +1 -1
- package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindRecurrenceFormulaFromSituation.d.ts.map +1 -1
- package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindRecurrenceFormulaFromSituation.js +0 -4
- package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFromTwoConsecutiveTerms.d.ts.map +1 -1
- package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFromTwoConsecutiveTerms.js +38 -26
- package/lib/exercises/math/sequences/geometric/index.d.ts +3 -0
- package/lib/exercises/math/sequences/geometric/index.d.ts.map +1 -1
- package/lib/exercises/math/sequences/geometric/index.js +3 -3
- package/lib/exercises/math/sequences/geometric/situations/geometricFindExplicitFormulaFromSituation.js +1 -1
- package/lib/exercises/math/sequences/geometric/situations/index.d.ts +1 -0
- package/lib/exercises/math/sequences/geometric/situations/index.d.ts.map +1 -1
- package/lib/exercises/math/sequences/geometric/situations/index.js +1 -1
- package/lib/exercises/math/sequences/index.d.ts +1 -1
- package/lib/exercises/math/sequences/index.d.ts.map +1 -1
- package/lib/exercises/math/sequences/index.js +1 -2
- package/lib/exercises/math/sequences/limits/index.d.ts +2 -1
- package/lib/exercises/math/sequences/limits/index.d.ts.map +1 -1
- package/lib/exercises/math/sequences/limits/index.js +2 -2
- package/lib/exercises/math/sequences/limits/readSequenceConvergencyType.d.ts +9 -0
- package/lib/exercises/math/sequences/limits/readSequenceConvergencyType.d.ts.map +1 -0
- package/lib/exercises/math/sequences/limits/readSequenceConvergencyType.js +256 -0
- package/lib/exercises/math/sequences/limits/sequenceLimitReading.d.ts +7 -0
- package/lib/exercises/math/sequences/limits/sequenceLimitReading.d.ts.map +1 -1
- package/lib/exercises/math/sequences/limits/sequenceLimitReading.js +232 -163
- package/lib/exercises/math/sequences/variations/genericSequenceVariations.d.ts +7 -0
- package/lib/exercises/math/sequences/variations/genericSequenceVariations.d.ts.map +1 -0
- package/lib/exercises/math/sequences/variations/genericSequenceVariations.js +122 -0
- package/lib/exercises/math/sequences/variations/index.d.ts +2 -0
- package/lib/exercises/math/sequences/variations/index.d.ts.map +1 -1
- package/lib/exercises/math/sequences/variations/index.js +2 -0
- package/lib/exercises/math/sequences/variations/sequenceVariationFromTermsDifference.d.ts +9 -0
- package/lib/exercises/math/sequences/variations/sequenceVariationFromTermsDifference.d.ts.map +1 -0
- package/lib/exercises/math/sequences/variations/sequenceVariationFromTermsDifference.js +155 -0
- package/lib/index.d.ts +57 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/tests/singleExo.test.js +2 -2
- package/package.json +1 -1
|
@@ -1,163 +1,232 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
//
|
|
109
|
-
//
|
|
110
|
-
//
|
|
111
|
-
//
|
|
112
|
-
//
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
//
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
//
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
//
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
//
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
//
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
//
|
|
163
|
-
|
|
1
|
+
import { addValidProp, shuffleProps, tryToAddWrongProp, propWhile, } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { numberVEA } from "../../../../exercises/vea/numberVEA.js";
|
|
4
|
+
import { GeogebraConstructor } from "../../../../geogebra/geogebraConstructor.js";
|
|
5
|
+
import { Point } from "../../../../math/geometry/point.js";
|
|
6
|
+
import { AffineConstructor } from "../../../../math/polynomials/affine.js";
|
|
7
|
+
import { TrinomConstructor } from "../../../../math/polynomials/trinom.js";
|
|
8
|
+
import { randfloat } from "../../../../math/utils/random/randfloat.js";
|
|
9
|
+
import { randint } from "../../../../math/utils/random/randint.js";
|
|
10
|
+
import { round } from "../../../../math/utils/round.js";
|
|
11
|
+
import { exp } from "../../../../tree/nodes/functions/expNode.js";
|
|
12
|
+
import { reifyAlgebraic, } from "../../../../tree/nodes/nodeConstructor.js";
|
|
13
|
+
import { add } from "../../../../tree/nodes/operators/addNode.js";
|
|
14
|
+
import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
|
|
15
|
+
import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
16
|
+
import { power } from "../../../../tree/nodes/operators/powerNode.js";
|
|
17
|
+
import { doWhile } from "../../../../utils/doWhile.js";
|
|
18
|
+
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
19
|
+
const getPropositions = (n, { answer }) => {
|
|
20
|
+
const propositions = [];
|
|
21
|
+
addValidProp(propositions, answer);
|
|
22
|
+
tryToAddWrongProp(propositions, "+\\infty");
|
|
23
|
+
tryToAddWrongProp(propositions, "-\\infty");
|
|
24
|
+
propWhile(propositions, n, () => {
|
|
25
|
+
tryToAddWrongProp(propositions, randint(-10, 10) + "");
|
|
26
|
+
});
|
|
27
|
+
return shuffleProps(propositions, n);
|
|
28
|
+
};
|
|
29
|
+
const getAnswer = (identifiers) => {
|
|
30
|
+
return getLimit(identifiers);
|
|
31
|
+
};
|
|
32
|
+
const getInstruction = () => {
|
|
33
|
+
return `On considère une suite $u$ représentée graphiquement ci-dessous.
|
|
34
|
+
|
|
35
|
+
Quelle semble être la limite de la suite $u$ lorsque $n$ tend vers $+\\infty$ ?`;
|
|
36
|
+
};
|
|
37
|
+
const getHint = () => {
|
|
38
|
+
return `Observe les termes de la suite lorsque $n$ devient très grand.
|
|
39
|
+
|
|
40
|
+
Si ces termes semblent se rapprocher autant que l'on veut d'une certaine valeur, alors on peut conjecturer que la suite admet une limite finie.
|
|
41
|
+
|
|
42
|
+
Si ces termes semblent devenir aussi grands ou aussi petits que l'on veut, alors on peut conjecturer que la suite admet une limite infinie.
|
|
43
|
+
|
|
44
|
+
Sinon, on peut conjecturer que la suite n'a pas de limite.`;
|
|
45
|
+
};
|
|
46
|
+
const getLimit = (identifiers) => {
|
|
47
|
+
const { formulaIds, type } = identifiers;
|
|
48
|
+
const formula = reifyAlgebraic(formulaIds);
|
|
49
|
+
switch (type) {
|
|
50
|
+
case 0:
|
|
51
|
+
return round(formula.toDetailedEvaluation({ n: (10).toTree() }).evaluate(), 0).frenchify();
|
|
52
|
+
case 1:
|
|
53
|
+
default: {
|
|
54
|
+
const pos = formula.toDetailedEvaluation({ n: (10).toTree() }).evaluate() > 0;
|
|
55
|
+
return pos ? "+\\infty" : "-\\infty";
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
const getCorrection = (identifiers) => {
|
|
60
|
+
const { type } = identifiers;
|
|
61
|
+
const limit = getLimit(identifiers);
|
|
62
|
+
let corr = `On observe les termes de la suite lorsque $n$ devient très grand : c'est à dire qu'on observe les ordonnées des points qui ont une abscisse très grande.
|
|
63
|
+
|
|
64
|
+
`;
|
|
65
|
+
switch (type) {
|
|
66
|
+
case 0:
|
|
67
|
+
corr += `Les termes semblent se rapprocher autant que l'on veut de $${limit}$. On peut donc conjecturer que la suite $u$ a une limite finie :
|
|
68
|
+
|
|
69
|
+
$$
|
|
70
|
+
\\lim_{n \\to +\\infty} u_{n} = ${limit}
|
|
71
|
+
$$`;
|
|
72
|
+
break;
|
|
73
|
+
case 1:
|
|
74
|
+
corr += `Les termes semblent devenir aussi ${limit === "+\\infty" ? "grands" : "petits"} que l'on veut. On peut donc conjecturer que la suite $u$ a une limite infinie :
|
|
75
|
+
|
|
76
|
+
$$
|
|
77
|
+
\\lim_{n \\to +\\infty} u_{n} = ${limit}
|
|
78
|
+
$$`;
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
81
|
+
return corr;
|
|
82
|
+
};
|
|
83
|
+
const getGGBOptions = (identifiers) => {
|
|
84
|
+
const { formulaIds } = identifiers;
|
|
85
|
+
const formula = reifyAlgebraic(formulaIds);
|
|
86
|
+
console.log(formula.toTex());
|
|
87
|
+
const points = Array.from({ length: 50 }).map((_, index) => {
|
|
88
|
+
return new Point(`A_{${index}}`, index, formula.toDetailedEvaluation({ n: index.toTree() }).evaluate());
|
|
89
|
+
});
|
|
90
|
+
const yMin = Math.min(Math.min(...points.slice(0, 10).map((p) => p.y.evaluate())) - 2, -2);
|
|
91
|
+
const yMax = Math.max(Math.max(...points.slice(0, 10).map((p) => p.y.evaluate())) + 2, 2);
|
|
92
|
+
const ggb = new GeogebraConstructor({
|
|
93
|
+
commands: points.flatMap((point) => point.toGGBCommand({
|
|
94
|
+
showLabel: false,
|
|
95
|
+
isFixed: true,
|
|
96
|
+
isSelectionnable: false,
|
|
97
|
+
size: 3,
|
|
98
|
+
})),
|
|
99
|
+
lockedAxesRatio: false,
|
|
100
|
+
gridDistance: false,
|
|
101
|
+
});
|
|
102
|
+
return ggb.getOptions({
|
|
103
|
+
coords: [-1, 15, yMin, yMax],
|
|
104
|
+
});
|
|
105
|
+
};
|
|
106
|
+
const getReadSequenceConvergencyTypeQuestion = () => {
|
|
107
|
+
const type = randint(0, 2);
|
|
108
|
+
//type0 limites finies :
|
|
109
|
+
//1/n+k , an+b/cn+d, q^n avec q<1, exp(-kx)
|
|
110
|
+
//type1 limites infinie :
|
|
111
|
+
//affine, trinom, q^n avec q>1, exp(kx)
|
|
112
|
+
//
|
|
113
|
+
let formulaIds;
|
|
114
|
+
switch (type) {
|
|
115
|
+
case 0: {
|
|
116
|
+
const subtype = randint(0, 4);
|
|
117
|
+
switch (subtype) {
|
|
118
|
+
case 0: {
|
|
119
|
+
//1/(n+1)+k
|
|
120
|
+
const k = randint(-5, 5);
|
|
121
|
+
formulaIds = add(frac(1, add("n", 1)), k).toIdentifiers();
|
|
122
|
+
break;
|
|
123
|
+
}
|
|
124
|
+
case 1: {
|
|
125
|
+
//an+b/cn+d
|
|
126
|
+
const c = randint(-5, 5, [0]);
|
|
127
|
+
const a = c * randint(-5, 5, [0]);
|
|
128
|
+
const b = randint(-5, 5, [0]);
|
|
129
|
+
const d = doWhile(() => randint(-5, 5, [0]), (x) => c / a === x / b || (Math.floor(-x / c) === -x / c && -x / c > 0));
|
|
130
|
+
formulaIds = frac(add(multiply(a, "n"), b), add(multiply(c, "n"), d)).toIdentifiers();
|
|
131
|
+
break;
|
|
132
|
+
}
|
|
133
|
+
case 2: {
|
|
134
|
+
//aq^n q<1
|
|
135
|
+
const q = randfloat(0.1, 0.9, 2);
|
|
136
|
+
const a = randint(-5, 5, [0]);
|
|
137
|
+
formulaIds = multiply(a, power(q, "n")).toIdentifiers();
|
|
138
|
+
break;
|
|
139
|
+
}
|
|
140
|
+
case 3:
|
|
141
|
+
default: {
|
|
142
|
+
//aexp(-kx)
|
|
143
|
+
const k = randfloat(0.1, 0.9, 2);
|
|
144
|
+
const a = randint(-5, 5, [0]);
|
|
145
|
+
formulaIds = multiply(a, exp(multiply(-k, "n"))).toIdentifiers();
|
|
146
|
+
break;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
break;
|
|
150
|
+
}
|
|
151
|
+
case 1:
|
|
152
|
+
default: {
|
|
153
|
+
const subtype = randint(0, 4);
|
|
154
|
+
switch (subtype) {
|
|
155
|
+
case 0: {
|
|
156
|
+
//affine
|
|
157
|
+
const affine = AffineConstructor.random(undefined, undefined, "n").toTree();
|
|
158
|
+
formulaIds = affine.toIdentifiers();
|
|
159
|
+
break;
|
|
160
|
+
}
|
|
161
|
+
case 1: {
|
|
162
|
+
//trinom
|
|
163
|
+
const trinom = TrinomConstructor.random(undefined, undefined, undefined, "n").toTree();
|
|
164
|
+
formulaIds = trinom.toIdentifiers();
|
|
165
|
+
break;
|
|
166
|
+
}
|
|
167
|
+
case 2: {
|
|
168
|
+
//q^n
|
|
169
|
+
const q = randfloat(1.1, 1.4, 2);
|
|
170
|
+
const a = randint(-5, 5, [0]);
|
|
171
|
+
formulaIds = multiply(a, power(q, "n")).toIdentifiers();
|
|
172
|
+
break;
|
|
173
|
+
}
|
|
174
|
+
case 3:
|
|
175
|
+
default: {
|
|
176
|
+
//aexp(kx)
|
|
177
|
+
const k = randfloat(1.1, 1.4, 2);
|
|
178
|
+
const a = randint(-5, 5, [0]);
|
|
179
|
+
formulaIds = multiply(a, exp(multiply(k, "n"))).toIdentifiers();
|
|
180
|
+
break;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
break;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
const identifiers = {
|
|
187
|
+
type,
|
|
188
|
+
formulaIds,
|
|
189
|
+
};
|
|
190
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
191
|
+
};
|
|
192
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
193
|
+
return {
|
|
194
|
+
answer: getAnswer(identifiers),
|
|
195
|
+
instruction: getInstruction(identifiers),
|
|
196
|
+
keys: ["infty"],
|
|
197
|
+
answerFormat: "tex",
|
|
198
|
+
identifiers,
|
|
199
|
+
hint: getHint(identifiers),
|
|
200
|
+
correction: getCorrection(identifiers),
|
|
201
|
+
ggbOptions: getGGBOptions(identifiers),
|
|
202
|
+
};
|
|
203
|
+
};
|
|
204
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
205
|
+
try {
|
|
206
|
+
if (answer.includes("\\infty"))
|
|
207
|
+
return ans === answer;
|
|
208
|
+
return numberVEA(ans, answer);
|
|
209
|
+
}
|
|
210
|
+
catch (err) {
|
|
211
|
+
return handleVEAError(err);
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
export const sequenceLimitReading = {
|
|
215
|
+
id: "sequenceLimitReading",
|
|
216
|
+
label: "Conjecturer graphiquement la limite d'une suite",
|
|
217
|
+
isSingleStep: true,
|
|
218
|
+
generator: (nb, opts) => getDistinctQuestions(() => getReadSequenceConvergencyTypeQuestion(opts), nb),
|
|
219
|
+
qcmTimer: 60,
|
|
220
|
+
freeTimer: 60,
|
|
221
|
+
getPropositions,
|
|
222
|
+
subject: "Mathématiques",
|
|
223
|
+
getHint,
|
|
224
|
+
getCorrection,
|
|
225
|
+
getInstruction,
|
|
226
|
+
getAnswer,
|
|
227
|
+
getGGBOptions,
|
|
228
|
+
hasGeogebra: true,
|
|
229
|
+
getQuestionFromIdentifiers,
|
|
230
|
+
isAnswerValid,
|
|
231
|
+
hasHintAndCorrection: true,
|
|
232
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"genericSequenceVariations.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/variations/genericSequenceVariations.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAarC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AA0HF,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,WAAW,CAe3D,CAAC"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { shuffleProps, tryToAddWrongProp, addValidProp, } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { Affine } from "../../../../math/polynomials/affine.js";
|
|
4
|
+
import { Polynomial, PolynomialConstructor, } from "../../../../math/polynomials/polynomial.js";
|
|
5
|
+
import { randint } from "../../../../math/utils/random/randint.js";
|
|
6
|
+
import { firstDegreeInequationResolutionTex } from "../../../../tree/nodes/inequations/inequationNode.js";
|
|
7
|
+
import { add } from "../../../../tree/nodes/operators/addNode.js";
|
|
8
|
+
import { substract } from "../../../../tree/nodes/operators/substractNode.js";
|
|
9
|
+
import { alignTex } from "../../../../utils/latex/alignTex.js";
|
|
10
|
+
const getInstruction = (identifiers) => {
|
|
11
|
+
const { coeffs } = identifiers;
|
|
12
|
+
const u = new Polynomial(coeffs, "n");
|
|
13
|
+
return `Soit $u$ la suite définie par :
|
|
14
|
+
|
|
15
|
+
$$
|
|
16
|
+
u_n = ${u.toTree().toTex()}
|
|
17
|
+
$$
|
|
18
|
+
|
|
19
|
+
En étudiant le signe de $u_{n+1}-u_n$, déterminer le sens de variations de $u$.`;
|
|
20
|
+
};
|
|
21
|
+
const getAnswer = (identifiers) => {
|
|
22
|
+
const { coeffs } = identifiers;
|
|
23
|
+
const u = new Polynomial(coeffs, "n");
|
|
24
|
+
const [b, a] = u.coefficients.slice(1);
|
|
25
|
+
const root = Math.ceil((-a - b) / (2 * a));
|
|
26
|
+
const answer = root <= 0
|
|
27
|
+
? a > 0
|
|
28
|
+
? "Croissante"
|
|
29
|
+
: "Décroissante"
|
|
30
|
+
: `${a > 0 ? "Croissante" : "Décroissante"} à partir du rang $${root}$`;
|
|
31
|
+
return answer;
|
|
32
|
+
};
|
|
33
|
+
const getHint = () => {
|
|
34
|
+
return `Exprime $u_{n+1}$ en fonction de $n$, puis calcule $u_{n+1}-u_n$.
|
|
35
|
+
|
|
36
|
+
Ensuite, étudie le signe de ce résultat. Sur les intervalles où il est positif, la suite est croissante. Sur ceux où il est négatif, la suite est décroissante.`;
|
|
37
|
+
};
|
|
38
|
+
const getCorrection = (identifiers) => {
|
|
39
|
+
const { coeffs } = identifiers;
|
|
40
|
+
const u = new Polynomial(coeffs, "n").toTree();
|
|
41
|
+
const unP1 = u.toDetailedEvaluation({ n: add("n", 1) });
|
|
42
|
+
const unP1Simp = unP1.simplify({
|
|
43
|
+
towardsDistribute: true,
|
|
44
|
+
forbidFactorize: true,
|
|
45
|
+
});
|
|
46
|
+
const diff = substract(unP1Simp, u).simplify({
|
|
47
|
+
towardsDistribute: true,
|
|
48
|
+
forbidFactorize: true,
|
|
49
|
+
});
|
|
50
|
+
const b = diff
|
|
51
|
+
.toDetailedEvaluation({ n: (0).toTree() })
|
|
52
|
+
.simplify()
|
|
53
|
+
.evaluate();
|
|
54
|
+
const a = substract(diff.toDetailedEvaluation({ n: (1).toTree() }), b)
|
|
55
|
+
.simplify()
|
|
56
|
+
.evaluate();
|
|
57
|
+
const aff = new Affine(a, b, "n");
|
|
58
|
+
return `On exprime $u_{n+1}$ :
|
|
59
|
+
|
|
60
|
+
${alignTex([
|
|
61
|
+
["u_{n+1}", "=", unP1.toTex()],
|
|
62
|
+
["", "=", unP1Simp.toTex()],
|
|
63
|
+
])}
|
|
64
|
+
|
|
65
|
+
On a donc pour tout entier $n$ :
|
|
66
|
+
|
|
67
|
+
$$
|
|
68
|
+
u_{n+1}-u_n = ${diff.toTex()}
|
|
69
|
+
$$
|
|
70
|
+
|
|
71
|
+
On étudie le signe de $${diff.toTex()}$ :
|
|
72
|
+
|
|
73
|
+
$$
|
|
74
|
+
${firstDegreeInequationResolutionTex(aff, "\\ge", (0).toTree())}
|
|
75
|
+
$$
|
|
76
|
+
|
|
77
|
+
On en conclut que $u$ est ${getAnswer(identifiers).toLocaleLowerCase()}.
|
|
78
|
+
`;
|
|
79
|
+
};
|
|
80
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
81
|
+
const question = {
|
|
82
|
+
answer: getAnswer(identifiers),
|
|
83
|
+
instruction: getInstruction(identifiers),
|
|
84
|
+
keys: [],
|
|
85
|
+
answerFormat: "raw",
|
|
86
|
+
identifiers,
|
|
87
|
+
hint: getHint(identifiers),
|
|
88
|
+
correction: getCorrection(identifiers),
|
|
89
|
+
};
|
|
90
|
+
return question;
|
|
91
|
+
};
|
|
92
|
+
const getGenericSequenceVariationsQuestion = () => {
|
|
93
|
+
const u = PolynomialConstructor.randomWithOrder(2, "n");
|
|
94
|
+
const identifiers = { coeffs: u.coefficients };
|
|
95
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
96
|
+
};
|
|
97
|
+
const getPropositions = (n, { answer, coeffs }) => {
|
|
98
|
+
const [b, a] = coeffs.slice(1);
|
|
99
|
+
const root = Math.ceil((-a - b) / (2 * a));
|
|
100
|
+
const propositions = [];
|
|
101
|
+
addValidProp(propositions, answer, "raw");
|
|
102
|
+
tryToAddWrongProp(propositions, "Croissante", "raw");
|
|
103
|
+
tryToAddWrongProp(propositions, "Décroissante", "raw");
|
|
104
|
+
const fakeRoot = root <= 0 ? randint(1, 10) : root;
|
|
105
|
+
tryToAddWrongProp(propositions, `Croissante à partir du rang $${fakeRoot}$`, "raw");
|
|
106
|
+
tryToAddWrongProp(propositions, `Décroissante à partir du rang $${fakeRoot}$`, "raw");
|
|
107
|
+
return shuffleProps(propositions, n);
|
|
108
|
+
};
|
|
109
|
+
export const genericSequenceVariations = {
|
|
110
|
+
id: "genericSequenceVariations",
|
|
111
|
+
connector: "=",
|
|
112
|
+
label: "Déterminer le sens de variations d'une suite en étudiant la différence de deux termes",
|
|
113
|
+
isSingleStep: true,
|
|
114
|
+
generator: (nb) => getDistinctQuestions(getGenericSequenceVariationsQuestion, nb),
|
|
115
|
+
qcmTimer: 60,
|
|
116
|
+
freeTimer: 60,
|
|
117
|
+
answerType: "QCU",
|
|
118
|
+
getPropositions,
|
|
119
|
+
subject: "Mathématiques",
|
|
120
|
+
getQuestionFromIdentifiers,
|
|
121
|
+
hasHintAndCorrection: true,
|
|
122
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/variations/index.ts"],"names":[],"mappings":"AAAA,cAAc,wCAAwC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/variations/index.ts"],"names":[],"mappings":"AAAA,cAAc,wCAAwC,CAAC;AACvD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,gCAAgC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { NodeIdentifiers } from "../../../../tree/nodes/nodeConstructor.js";
|
|
3
|
+
type Identifiers = {
|
|
4
|
+
diffIdentifiers: NodeIdentifiers;
|
|
5
|
+
type: number;
|
|
6
|
+
};
|
|
7
|
+
export declare const sequenceVariationFromTermsDifference: Exercise<Identifiers>;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=sequenceVariationFromTermsDifference.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sequenceVariationFromTermsDifference.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/variations/sequenceVariationFromTermsDifference.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAKrC,OAAO,EACL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;AAK7C,KAAK,WAAW,GAAG;IACjB,eAAe,EAAE,eAAe,CAAC;IACjC,IAAI,EAAE,MAAM,CAAC;CAEd,CAAC;AAmJF,eAAO,MAAM,oCAAoC,EAAE,QAAQ,CAAC,WAAW,CAqBtE,CAAC"}
|