math-exercises 3.0.202 → 3.0.203
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/derivative/trigo/productOfSinAXPlusBCosCXPlusDDerivative.js +1 -1
- package/lib/exercises/math/derivation/derivative/trigo/sinAndCosMixedWithSquareDerivative.js +1 -1
- package/lib/exercises/math/derivation/derivative/trigo/sinCosDerivativeRewriteUsingCos2PlusSin2Equals1.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/trigo/sinCosDerivativeRewriteUsingCos2PlusSin2Equals1.js +1 -1
- package/lib/exercises/math/geometry/angles/anglesUsingIsParallel.d.ts.map +1 -1
- package/lib/exercises/math/geometry/angles/anglesUsingIsParallel.js +172 -51
- package/lib/exercises/math/geometry/angles/index.d.ts +1 -0
- package/lib/exercises/math/geometry/angles/index.d.ts.map +1 -1
- package/lib/exercises/math/geometry/angles/index.js +1 -1
- package/lib/exercises/math/limits/index.d.ts +1 -5
- package/lib/exercises/math/limits/index.d.ts.map +1 -1
- package/lib/exercises/math/limits/index.js +1 -5
- package/lib/exercises/math/limits/limitReading.d.ts.map +1 -1
- package/lib/exercises/math/limits/limitReading.js +70 -0
- package/lib/exercises/math/limits/polynomLimit.d.ts.map +1 -1
- package/lib/exercises/math/limits/polynomLimit.js +55 -4
- package/lib/exercises/math/limits/polynomLimitNoFI.d.ts.map +1 -1
- package/lib/exercises/math/limits/polynomLimitNoFI.js +35 -2
- package/lib/exercises/math/limits/sequenceGeometricLimit.d.ts.map +1 -1
- package/lib/exercises/math/limits/sequenceGeometricLimit.js +45 -9
- package/lib/exercises/math/limits/sequencePolynomLimit.d.ts.map +1 -1
- package/lib/exercises/math/limits/sequencePolynomLimit.js +56 -3
- package/lib/exercises/math/limits/sequencePolynomNoFILimit.d.ts.map +1 -1
- package/lib/exercises/math/limits/sequencePolynomNoFILimit.js +32 -0
- package/lib/exercises/math/limits/sequencePolynomProductLimit.d.ts.map +1 -1
- package/lib/exercises/math/limits/sequencePolynomProductLimit.js +33 -3
- package/lib/exercises/math/limits/sequenceRationalFracLimit.d.ts.map +1 -1
- package/lib/exercises/math/limits/sequenceRationalFracLimit.js +2 -2
- package/lib/exercises/math/limits/sequences/index.d.ts +6 -0
- package/lib/exercises/math/limits/sequences/index.d.ts.map +1 -0
- package/lib/exercises/math/limits/sequences/index.js +5 -0
- package/lib/exercises/math/limits/sequences/sequenceGeometricLimit.d.ts +9 -0
- package/lib/exercises/math/limits/sequences/sequenceGeometricLimit.d.ts.map +1 -0
- package/lib/exercises/math/limits/sequences/sequenceGeometricLimit.js +110 -0
- package/lib/exercises/math/limits/sequences/sequencePolynomLimit.d.ts +7 -0
- package/lib/exercises/math/limits/sequences/sequencePolynomLimit.d.ts.map +1 -0
- package/lib/exercises/math/limits/sequences/sequencePolynomLimit.js +116 -0
- package/lib/exercises/math/limits/sequences/sequencePolynomNoFILimit.d.ts +7 -0
- package/lib/exercises/math/limits/sequences/sequencePolynomNoFILimit.d.ts.map +1 -0
- package/lib/exercises/math/limits/sequences/sequencePolynomNoFILimit.js +95 -0
- package/lib/exercises/math/limits/sequences/sequencePolynomProductLimit.d.ts +8 -0
- package/lib/exercises/math/limits/sequences/sequencePolynomProductLimit.d.ts.map +1 -0
- package/lib/exercises/math/limits/sequences/sequencePolynomProductLimit.js +111 -0
- package/lib/exercises/math/limits/sequences/sequenceRationalFracLimit.d.ts +8 -0
- package/lib/exercises/math/limits/sequences/sequenceRationalFracLimit.d.ts.map +1 -0
- package/lib/exercises/math/limits/sequences/sequenceRationalFracLimit.js +114 -0
- package/lib/exercises/math/sequences/index.d.ts +1 -0
- package/lib/exercises/math/sequences/index.d.ts.map +1 -1
- package/lib/exercises/math/sequences/index.js +1 -0
- package/lib/exercises/math/sequences/proofByInduction/index.d.ts +5 -0
- package/lib/exercises/math/sequences/proofByInduction/index.d.ts.map +1 -0
- package/lib/exercises/math/sequences/proofByInduction/index.js +4 -0
- package/lib/exercises/math/sequences/proofByInduction/proofByInductionCheckInitialization.d.ts +10 -0
- package/lib/exercises/math/sequences/proofByInduction/proofByInductionCheckInitialization.d.ts.map +1 -0
- package/lib/exercises/math/sequences/proofByInduction/proofByInductionCheckInitialization.js +236 -0
- package/lib/exercises/math/sequences/proofByInduction/proofByInductionReorderProof.d.ts +13 -0
- package/lib/exercises/math/sequences/proofByInduction/proofByInductionReorderProof.d.ts.map +1 -0
- package/lib/exercises/math/sequences/proofByInduction/proofByInductionReorderProof.js +244 -0
- package/lib/exercises/math/sequences/proofByInduction/proofByInductionSituations.d.ts +98 -0
- package/lib/exercises/math/sequences/proofByInduction/proofByInductionSituations.d.ts.map +1 -0
- package/lib/exercises/math/sequences/proofByInduction/proofByInductionSituations.js +175 -0
- package/lib/exercises/math/sequences/proofByInduction/proofByInductionWriteMissingStep.d.ts +13 -0
- package/lib/exercises/math/sequences/proofByInduction/proofByInductionWriteMissingStep.d.ts.map +1 -0
- package/lib/exercises/math/sequences/proofByInduction/proofByInductionWriteMissingStep.js +317 -0
- package/lib/exercises/math/sequences/proofByInduction/proofByInductionWritePropAtRankKPlus1.d.ts +13 -0
- package/lib/exercises/math/sequences/proofByInduction/proofByInductionWritePropAtRankKPlus1.d.ts.map +1 -0
- package/lib/exercises/math/sequences/proofByInduction/proofByInductionWritePropAtRankKPlus1.js +265 -0
- package/lib/exercises/vea/polynomialVEA.d.ts.map +1 -1
- package/lib/exercises/vea/polynomialVEA.js +4 -0
- package/lib/index.d.ts +49 -13
- package/lib/index.d.ts.map +1 -1
- package/lib/math/geometry/point.d.ts.map +1 -1
- package/lib/math/geometry/point.js +1 -1
- package/lib/math/utils/functions/functionDecomposition.d.ts +2 -2
- package/lib/math/utils/functions/functionDecomposition.d.ts.map +1 -1
- package/lib/tests/exoTest.d.ts.map +1 -1
- package/lib/tests/exoTest.js +7 -11
- package/lib/tests/questionTest.d.ts.map +1 -1
- package/lib/tests/questionTest.js +7 -3
- package/lib/tests/singleExo.test.d.ts.map +1 -1
- package/lib/tests/singleExo.test.js +2 -2
- package/lib/tree/nodes/node.d.ts +2 -1
- package/lib/tree/nodes/node.d.ts.map +1 -1
- package/lib/tree/nodes/node.js +1 -0
- package/lib/tree/nodes/student/iDontKnowNode.d.ts +26 -0
- package/lib/tree/nodes/student/iDontKnowNode.d.ts.map +1 -0
- package/lib/tree/nodes/student/iDontKnowNode.js +63 -0
- package/lib/tree/parsers/latexParser.d.ts +3 -2
- package/lib/tree/parsers/latexParser.d.ts.map +1 -1
- package/lib/tree/parsers/latexParser.js +7 -0
- package/lib/tree/parsers/monomParser.d.ts +1 -1
- package/lib/tree/parsers/monomParser.d.ts.map +1 -1
- package/lib/tree/parsers/polynomialParser.d.ts +1 -1
- package/lib/tree/parsers/polynomialParser.d.ts.map +1 -1
- package/lib/tree/parsers/trinomParser.d.ts +1 -1
- package/lib/tree/parsers/trinomParser.d.ts.map +1 -1
- package/lib/tree/utilities/nodeComparator.d.ts +3 -1
- package/lib/tree/utilities/nodeComparator.d.ts.map +1 -1
- package/lib/tree/utilities/nodeComparator.js +63 -5
- package/package.json +1 -1
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { addValidProp, propWhile, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { Polynomial, PolynomialConstructor, } from "../../../../math/polynomials/polynomial.js";
|
|
4
|
+
import { randint } from "../../../../math/utils/random/randint.js";
|
|
5
|
+
import { AddNode } from "../../../../tree/nodes/operators/addNode.js";
|
|
6
|
+
import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
|
|
7
|
+
import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
8
|
+
import { power } from "../../../../tree/nodes/operators/powerNode.js";
|
|
9
|
+
import { operatorComposition } from "../../../../tree/utilities/operatorComposition.js";
|
|
10
|
+
import { shuffle } from "../../../../utils/alea/shuffle.js";
|
|
11
|
+
const getInstruction = (identifiers) => {
|
|
12
|
+
const poly = new Polynomial(identifiers.coeffs, "n");
|
|
13
|
+
return `Déterminer la limite de la suite $u$ définie par :
|
|
14
|
+
|
|
15
|
+
$$
|
|
16
|
+
u_n = ${poly.toTree().toTex()}
|
|
17
|
+
$$`;
|
|
18
|
+
};
|
|
19
|
+
const getAnswer = (identifiers) => {
|
|
20
|
+
const to = "+\\infty";
|
|
21
|
+
const poly = new Polynomial(identifiers.coeffs, "n");
|
|
22
|
+
const answer = poly.getLimit(to);
|
|
23
|
+
return answer;
|
|
24
|
+
};
|
|
25
|
+
const getHint = () => {
|
|
26
|
+
return `Attention ! Ici, on est en présence d'une forme indéterminée du type "$\\infty - \\infty"$.
|
|
27
|
+
|
|
28
|
+
On ne peut pas immédiatemment déterminer la limite de $u_n$.
|
|
29
|
+
|
|
30
|
+
Pour s'en sortir, il faut d'abord factoriser $u_n$ par son terme de plus haut degré.`;
|
|
31
|
+
};
|
|
32
|
+
const getCorrection = (identifiers) => {
|
|
33
|
+
const { coeffs } = identifiers;
|
|
34
|
+
const order = coeffs.length - 1;
|
|
35
|
+
const highCoeff = coeffs[order];
|
|
36
|
+
const high = power("n", order);
|
|
37
|
+
const factoNodes = [...coeffs].reverse().map((e, i) => {
|
|
38
|
+
//coeff / n^(order-i)
|
|
39
|
+
return frac(e, power("n", i)).simplify();
|
|
40
|
+
});
|
|
41
|
+
const facto = operatorComposition(AddNode, factoNodes);
|
|
42
|
+
return `Ici, on est en présence d'une forme indéterminée du type "$\\infty - \\infty"$.
|
|
43
|
+
|
|
44
|
+
Pour déterminer la limite de $u_n$, on factorise par son terme de plus haut degré :
|
|
45
|
+
|
|
46
|
+
$$
|
|
47
|
+
u_n = ${multiply(high, facto).toTex()}
|
|
48
|
+
$$
|
|
49
|
+
|
|
50
|
+
On a alors :
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
- $\\displaystyle \\lim_{n \\to +\\infty} ${high.toTex()} = +\\infty$
|
|
54
|
+
|
|
55
|
+
- $\\displaystyle \\lim_{n \\to +\\infty} ${facto.toTex()} = ${highCoeff}$
|
|
56
|
+
|
|
57
|
+
Par produit des limites, on obtient donc :
|
|
58
|
+
|
|
59
|
+
$$
|
|
60
|
+
\\lim_{n \\to +\\infty} u_{n} = ${getAnswer(identifiers)}
|
|
61
|
+
$$`;
|
|
62
|
+
};
|
|
63
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
64
|
+
const question = {
|
|
65
|
+
answer: getAnswer(identifiers),
|
|
66
|
+
instruction: getInstruction(identifiers),
|
|
67
|
+
keys: ["infty"],
|
|
68
|
+
answerFormat: "tex",
|
|
69
|
+
identifiers,
|
|
70
|
+
hint: getHint(identifiers),
|
|
71
|
+
correction: getCorrection(identifiers),
|
|
72
|
+
};
|
|
73
|
+
return question;
|
|
74
|
+
};
|
|
75
|
+
const getSequencePolynomLimitQuestion = () => {
|
|
76
|
+
const order = randint(2, 5);
|
|
77
|
+
const poly = PolynomialConstructor.randomWithOrder(order, "n");
|
|
78
|
+
const coeffs = [...poly.coefficients];
|
|
79
|
+
const signs = coeffs.slice(1).map((e) => (e > 0 ? "+" : "-"));
|
|
80
|
+
if (signs.every((s) => s === signs[0])) {
|
|
81
|
+
const index = randint(1, order);
|
|
82
|
+
coeffs[index] *= -1;
|
|
83
|
+
}
|
|
84
|
+
const identifiers = { coeffs: coeffs };
|
|
85
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
86
|
+
};
|
|
87
|
+
const getPropositions = (n, { answer, coeffs }) => {
|
|
88
|
+
const propositions = [];
|
|
89
|
+
addValidProp(propositions, answer);
|
|
90
|
+
tryToAddWrongProp(propositions, "+\\infty");
|
|
91
|
+
tryToAddWrongProp(propositions, "-\\infty");
|
|
92
|
+
tryToAddWrongProp(propositions, "0");
|
|
93
|
+
tryToAddWrongProp(propositions, coeffs[coeffs.length - 1] + "");
|
|
94
|
+
propWhile(propositions, n, () => {
|
|
95
|
+
const wrongAnswer = randint(-10, 10) + "";
|
|
96
|
+
tryToAddWrongProp(propositions, wrongAnswer);
|
|
97
|
+
});
|
|
98
|
+
return shuffle(propositions);
|
|
99
|
+
};
|
|
100
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
101
|
+
return ans === answer;
|
|
102
|
+
};
|
|
103
|
+
export const sequencePolynomLimit = {
|
|
104
|
+
id: "sequencePolynomLimit",
|
|
105
|
+
connector: "=",
|
|
106
|
+
label: "Limite d'une suite polynomiale (avec F.I.)",
|
|
107
|
+
isSingleStep: true,
|
|
108
|
+
generator: (nb) => getDistinctQuestions(getSequencePolynomLimitQuestion, nb),
|
|
109
|
+
qcmTimer: 60,
|
|
110
|
+
freeTimer: 60,
|
|
111
|
+
getPropositions,
|
|
112
|
+
isAnswerValid,
|
|
113
|
+
subject: "Mathématiques",
|
|
114
|
+
getQuestionFromIdentifiers,
|
|
115
|
+
hasHintAndCorrection: true,
|
|
116
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sequencePolynomNoFILimit.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/limits/sequences/sequencePolynomNoFILimit.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAWrC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AA4FF,eAAO,MAAM,wBAAwB,EAAE,QAAQ,CAAC,WAAW,CAc1D,CAAC"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { addValidProp, propWhile, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { Polynomial, PolynomialConstructor, } from "../../../../math/polynomials/polynomial.js";
|
|
4
|
+
import { randint } from "../../../../math/utils/random/randint.js";
|
|
5
|
+
import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
6
|
+
import { power } from "../../../../tree/nodes/operators/powerNode.js";
|
|
7
|
+
import { shuffle } from "../../../../utils/alea/shuffle.js";
|
|
8
|
+
const getInstruction = (identifiers) => {
|
|
9
|
+
const poly = new Polynomial(identifiers.coeffs, "n");
|
|
10
|
+
return `Déterminer la limite de la suite $u$ définie par :
|
|
11
|
+
|
|
12
|
+
$$
|
|
13
|
+
u_n = ${poly.toTree().toTex()}
|
|
14
|
+
$$`;
|
|
15
|
+
};
|
|
16
|
+
const getAnswer = (identifiers) => {
|
|
17
|
+
const to = "+\\infty";
|
|
18
|
+
const poly = new Polynomial(identifiers.coeffs, "n");
|
|
19
|
+
const answer = poly.getLimit(to);
|
|
20
|
+
return answer;
|
|
21
|
+
};
|
|
22
|
+
const getHint = () => {
|
|
23
|
+
return `Détermine la limite quand $n$ tend vers $+\\infty$ de chaque terme de la somme composant $u_n$.
|
|
24
|
+
|
|
25
|
+
Puis, déduis-en la limite de $u_n$ en "additionnant" les limites obtenues.`;
|
|
26
|
+
};
|
|
27
|
+
const getCorrection = (identifiers) => {
|
|
28
|
+
const texs = identifiers.coeffs
|
|
29
|
+
.map((coeff, i) => {
|
|
30
|
+
if (coeff === 0)
|
|
31
|
+
return "";
|
|
32
|
+
if (i === 0)
|
|
33
|
+
return `$\\displaystyle \\lim_{n \\to +\\infty} ${coeff} = ${coeff}$`;
|
|
34
|
+
const monom = multiply(coeff, power("n", i)).simplify().toTex();
|
|
35
|
+
const sign = coeff > 0 ? "+" : "-";
|
|
36
|
+
return `$\\displaystyle \\lim_{n \\to +\\infty} ${monom} = ${sign}\\infty$`;
|
|
37
|
+
})
|
|
38
|
+
.filter(Boolean);
|
|
39
|
+
return `On détermine la limite de chaque terme de la somme composant $u_n$ :
|
|
40
|
+
|
|
41
|
+
${texs.reverse().join("\n \n")}
|
|
42
|
+
|
|
43
|
+
Par addition des limites, on obtient donc :
|
|
44
|
+
|
|
45
|
+
$$
|
|
46
|
+
\\lim_{n \\to +\\infty} u_{n} = ${getAnswer(identifiers)}
|
|
47
|
+
$$`;
|
|
48
|
+
};
|
|
49
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
50
|
+
const question = {
|
|
51
|
+
answer: getAnswer(identifiers),
|
|
52
|
+
instruction: getInstruction(identifiers),
|
|
53
|
+
keys: ["infty"],
|
|
54
|
+
answerFormat: "tex",
|
|
55
|
+
identifiers,
|
|
56
|
+
hint: getHint(identifiers),
|
|
57
|
+
correction: getCorrection(identifiers),
|
|
58
|
+
};
|
|
59
|
+
return question;
|
|
60
|
+
};
|
|
61
|
+
const getSequencePolynomNoFILimitQuestion = () => {
|
|
62
|
+
const length = randint(2, 5);
|
|
63
|
+
const poly = PolynomialConstructor.randomWithLengthAndSameSigns(4, length, "n");
|
|
64
|
+
const identifiers = { coeffs: poly.coefficients };
|
|
65
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
66
|
+
};
|
|
67
|
+
const getPropositions = (n, { answer, coeffs }) => {
|
|
68
|
+
const propositions = [];
|
|
69
|
+
addValidProp(propositions, answer);
|
|
70
|
+
tryToAddWrongProp(propositions, "+\\infty");
|
|
71
|
+
tryToAddWrongProp(propositions, "-\\infty");
|
|
72
|
+
tryToAddWrongProp(propositions, "0");
|
|
73
|
+
tryToAddWrongProp(propositions, coeffs[coeffs.length - 1] + "");
|
|
74
|
+
propWhile(propositions, n, () => {
|
|
75
|
+
tryToAddWrongProp(propositions, randint(-10, 10) + "");
|
|
76
|
+
});
|
|
77
|
+
return shuffle(propositions);
|
|
78
|
+
};
|
|
79
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
80
|
+
return ans === answer;
|
|
81
|
+
};
|
|
82
|
+
export const sequencePolynomNoFILimit = {
|
|
83
|
+
id: "sequencePolynomNoFILimit",
|
|
84
|
+
connector: "=",
|
|
85
|
+
label: "Limite d'une suite polynomiale (sans F.I.)",
|
|
86
|
+
isSingleStep: true,
|
|
87
|
+
generator: (nb) => getDistinctQuestions(getSequencePolynomNoFILimitQuestion, nb),
|
|
88
|
+
qcmTimer: 60,
|
|
89
|
+
freeTimer: 60,
|
|
90
|
+
getPropositions,
|
|
91
|
+
isAnswerValid,
|
|
92
|
+
subject: "Mathématiques",
|
|
93
|
+
getQuestionFromIdentifiers,
|
|
94
|
+
hasHintAndCorrection: true,
|
|
95
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise.js";
|
|
2
|
+
type Identifiers = {
|
|
3
|
+
polyNumCoeffs: number[];
|
|
4
|
+
polyDenumCoeffs: number[];
|
|
5
|
+
};
|
|
6
|
+
export declare const sequencePolynomProductLimit: Exercise<Identifiers>;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=sequencePolynomProductLimit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sequencePolynomProductLimit.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/limits/sequences/sequencePolynomProductLimit.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAWrC,KAAK,WAAW,GAAG;IACjB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,eAAe,EAAE,MAAM,EAAE,CAAC;CAC3B,CAAC;AAwHF,eAAO,MAAM,2BAA2B,EAAE,QAAQ,CAAC,WAAW,CAc7D,CAAC"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { addValidProp, propWhile, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { Rational } from "../../../../math/numbers/rationals/rational.js";
|
|
4
|
+
import { Monom } from "../../../../math/polynomials/monom.js";
|
|
5
|
+
import { Polynomial, PolynomialConstructor, } from "../../../../math/polynomials/polynomial.js";
|
|
6
|
+
import { randint } from "../../../../math/utils/random/randint.js";
|
|
7
|
+
import { shuffle } from "../../../../utils/alea/shuffle.js";
|
|
8
|
+
const getInstruction = (identifiers) => {
|
|
9
|
+
const { polyNumCoeffs, polyDenumCoeffs } = identifiers;
|
|
10
|
+
const polyNum = new Polynomial(polyNumCoeffs, "n");
|
|
11
|
+
const polyDenum = new Polynomial(polyDenumCoeffs, "n");
|
|
12
|
+
return `Déterminer la limite de la suite $u$ définie par :
|
|
13
|
+
|
|
14
|
+
$$
|
|
15
|
+
u_n = (${polyNum.toTree().toTex()})(${polyDenum.toTree().toTex()})
|
|
16
|
+
$$`;
|
|
17
|
+
};
|
|
18
|
+
const getAnswer = (identifiers) => {
|
|
19
|
+
const { polyNumCoeffs, polyDenumCoeffs } = identifiers;
|
|
20
|
+
const polyNum = new Polynomial(polyNumCoeffs, "n");
|
|
21
|
+
const polyDenum = new Polynomial(polyDenumCoeffs, "n");
|
|
22
|
+
const numLeadingCoeff = polyNum.coefficients[polyNum.degree];
|
|
23
|
+
const denumLeadingCoeff = polyDenum.coefficients[polyDenum.degree];
|
|
24
|
+
const product = new Monom(polyNum.degree + polyDenum.degree, numLeadingCoeff * denumLeadingCoeff, "n");
|
|
25
|
+
const to = "+\\infty";
|
|
26
|
+
const answer = product.getLimit(to);
|
|
27
|
+
return answer;
|
|
28
|
+
};
|
|
29
|
+
const getHint = () => {
|
|
30
|
+
return `Détermine la limite quand $n$ tend vers $+\\infty$ de chaque facteur du produit composant $u_n$.
|
|
31
|
+
|
|
32
|
+
Puis, déduis-en la limite de $u_n$ en "multipliant" les limites obtenues.`;
|
|
33
|
+
};
|
|
34
|
+
const getCorrection = (identifiers) => {
|
|
35
|
+
const { polyNumCoeffs, polyDenumCoeffs } = identifiers;
|
|
36
|
+
const polyNum = new Polynomial(polyNumCoeffs, "n");
|
|
37
|
+
const polyDenum = new Polynomial(polyDenumCoeffs, "n");
|
|
38
|
+
const numLim = polyNum.getLimit("+\\infty");
|
|
39
|
+
const denumLim = polyDenum.getLimit("+\\infty");
|
|
40
|
+
return `On détermine la limite de chaque facteur du produit composant $u_n$ :
|
|
41
|
+
|
|
42
|
+
- $\\displaystyle \\lim_{n \\to +\\infty} ${polyNum
|
|
43
|
+
.toTree()
|
|
44
|
+
.toTex()} = ${numLim}$
|
|
45
|
+
|
|
46
|
+
- $\\displaystyle \\lim_{n \\to +\\infty} ${polyDenum
|
|
47
|
+
.toTree()
|
|
48
|
+
.toTex()} = ${denumLim}$
|
|
49
|
+
|
|
50
|
+
Par produit des limites, on obtient donc :
|
|
51
|
+
|
|
52
|
+
$$
|
|
53
|
+
\\lim_{n \\to +\\infty} u_{n} = ${getAnswer(identifiers)}
|
|
54
|
+
$$`;
|
|
55
|
+
};
|
|
56
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
57
|
+
const question = {
|
|
58
|
+
answer: getAnswer(identifiers),
|
|
59
|
+
instruction: getInstruction(identifiers),
|
|
60
|
+
keys: ["infty"],
|
|
61
|
+
answerFormat: "tex",
|
|
62
|
+
identifiers,
|
|
63
|
+
hint: getHint(identifiers),
|
|
64
|
+
correction: getCorrection(identifiers),
|
|
65
|
+
};
|
|
66
|
+
return question;
|
|
67
|
+
};
|
|
68
|
+
const getSequencePolynomProductLimitQuestion = () => {
|
|
69
|
+
const polyNum = PolynomialConstructor.randomWithLengthAndSameSigns(3, 2, "n");
|
|
70
|
+
const polyDenum = PolynomialConstructor.randomWithLengthAndSameSigns(3, 2, "n");
|
|
71
|
+
const identifiers = {
|
|
72
|
+
polyDenumCoeffs: polyDenum.coefficients,
|
|
73
|
+
polyNumCoeffs: polyNum.coefficients,
|
|
74
|
+
};
|
|
75
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
76
|
+
};
|
|
77
|
+
const getPropositions = (n, { answer, polyDenumCoeffs, polyNumCoeffs }) => {
|
|
78
|
+
const propositions = [];
|
|
79
|
+
addValidProp(propositions, answer);
|
|
80
|
+
const numLeadingCoeff = polyNumCoeffs[polyNumCoeffs.length - 1];
|
|
81
|
+
const denumLeadingCoeff = polyDenumCoeffs[polyDenumCoeffs.length - 1];
|
|
82
|
+
const leadingCoeffsRational = new Rational(numLeadingCoeff, denumLeadingCoeff)
|
|
83
|
+
.simplify()
|
|
84
|
+
.toTree()
|
|
85
|
+
.toTex();
|
|
86
|
+
tryToAddWrongProp(propositions, "+\\infty");
|
|
87
|
+
tryToAddWrongProp(propositions, "-\\infty");
|
|
88
|
+
tryToAddWrongProp(propositions, "0");
|
|
89
|
+
tryToAddWrongProp(propositions, leadingCoeffsRational);
|
|
90
|
+
propWhile(propositions, n, () => {
|
|
91
|
+
tryToAddWrongProp(propositions, randint(-10, 10) + "");
|
|
92
|
+
});
|
|
93
|
+
return shuffle(propositions);
|
|
94
|
+
};
|
|
95
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
96
|
+
return ans === answer;
|
|
97
|
+
};
|
|
98
|
+
export const sequencePolynomProductLimit = {
|
|
99
|
+
id: "sequencePolynomProductLimit",
|
|
100
|
+
connector: "=",
|
|
101
|
+
label: "Limite d'un produit de suites polynomiales (sans F.I.)",
|
|
102
|
+
isSingleStep: true,
|
|
103
|
+
generator: (nb) => getDistinctQuestions(getSequencePolynomProductLimitQuestion, nb),
|
|
104
|
+
qcmTimer: 60,
|
|
105
|
+
freeTimer: 60,
|
|
106
|
+
getPropositions,
|
|
107
|
+
isAnswerValid,
|
|
108
|
+
subject: "Mathématiques",
|
|
109
|
+
getQuestionFromIdentifiers,
|
|
110
|
+
hasHintAndCorrection: true,
|
|
111
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise.js";
|
|
2
|
+
type Identifiers = {
|
|
3
|
+
numCoeffs: number[];
|
|
4
|
+
denumCoeffs: number[];
|
|
5
|
+
};
|
|
6
|
+
export declare const sequenceRationalFracLimit: Exercise<Identifiers>;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=sequenceRationalFracLimit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sequenceRationalFracLimit.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/limits/sequences/sequenceRationalFracLimit.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAarC,KAAK,WAAW,GAAG;IACjB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB,CAAC;AAgIF,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,WAAW,CAa3D,CAAC"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { addValidProp, propWhile, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { Rational } from "../../../../math/numbers/rationals/rational.js";
|
|
4
|
+
import { Monom } from "../../../../math/polynomials/monom.js";
|
|
5
|
+
import { Polynomial, PolynomialConstructor, } from "../../../../math/polynomials/polynomial.js";
|
|
6
|
+
import { randint } from "../../../../math/utils/random/randint.js";
|
|
7
|
+
import { NumberNode } from "../../../../tree/nodes/numbers/numberNode.js";
|
|
8
|
+
import { shuffle } from "../../../../utils/alea/shuffle.js";
|
|
9
|
+
const getInstruction = (identifiers) => {
|
|
10
|
+
const { numCoeffs, denumCoeffs } = identifiers;
|
|
11
|
+
const polyNum = new Polynomial(numCoeffs, "n");
|
|
12
|
+
const polyDenum = new Polynomial(denumCoeffs, "n");
|
|
13
|
+
return `Déterminer la limite de la suite $u$ définie par :
|
|
14
|
+
|
|
15
|
+
$$
|
|
16
|
+
u_n = \\dfrac{${polyNum.toTree().toTex()}}{${polyDenum.toTree().toTex()}}
|
|
17
|
+
$$`;
|
|
18
|
+
};
|
|
19
|
+
const getAnswer = (identifiers) => {
|
|
20
|
+
const { numCoeffs, denumCoeffs } = identifiers;
|
|
21
|
+
const polyNum = new Polynomial(numCoeffs, "n");
|
|
22
|
+
const polyDenum = new Polynomial(denumCoeffs, "n");
|
|
23
|
+
let answer = "";
|
|
24
|
+
const to = "+\\infty";
|
|
25
|
+
const numLeadingCoeff = polyNum.coefficients[polyNum.degree];
|
|
26
|
+
const denumLeadingCoeff = polyDenum.coefficients[polyDenum.degree];
|
|
27
|
+
const leadingCoeffsRational = new Rational(numLeadingCoeff, denumLeadingCoeff)
|
|
28
|
+
.simplify()
|
|
29
|
+
.toTree()
|
|
30
|
+
.toTex();
|
|
31
|
+
if (polyDenum.degree === polyNum.degree) {
|
|
32
|
+
answer = leadingCoeffsRational;
|
|
33
|
+
}
|
|
34
|
+
else if (polyDenum.degree > polyNum.degree) {
|
|
35
|
+
answer = "0";
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
const tempPoly = new Monom(polyNum.degree - polyDenum.degree, numLeadingCoeff * denumLeadingCoeff > 0 ? 1 : -1, "n");
|
|
39
|
+
answer = tempPoly.getLimit(to);
|
|
40
|
+
}
|
|
41
|
+
return answer;
|
|
42
|
+
};
|
|
43
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
44
|
+
const question = {
|
|
45
|
+
answer: getAnswer(identifiers),
|
|
46
|
+
instruction: getInstruction(identifiers),
|
|
47
|
+
keys: ["infty"],
|
|
48
|
+
answerFormat: "tex",
|
|
49
|
+
identifiers,
|
|
50
|
+
};
|
|
51
|
+
return question;
|
|
52
|
+
};
|
|
53
|
+
const getSequenceRationalFracLimitQuestion = () => {
|
|
54
|
+
const polyNum = PolynomialConstructor.randomWithLengthAndSameSigns(3, randint(2, 4), "n");
|
|
55
|
+
const polyDenum = PolynomialConstructor.randomWithLengthAndSameSigns(3, randint(2, 4), "n");
|
|
56
|
+
const identifiers = {
|
|
57
|
+
numCoeffs: polyNum.coefficients,
|
|
58
|
+
denumCoeffs: polyDenum.coefficients,
|
|
59
|
+
};
|
|
60
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
61
|
+
};
|
|
62
|
+
const getPropositions = (n, { answer, numCoeffs, denumCoeffs }) => {
|
|
63
|
+
const propositions = [];
|
|
64
|
+
addValidProp(propositions, answer);
|
|
65
|
+
const numLeadingCoeff = numCoeffs[numCoeffs.length - 1];
|
|
66
|
+
const denumLeadingCoeff = denumCoeffs[denumCoeffs.length - 1];
|
|
67
|
+
const leadingCoeffsRational = new Rational(numLeadingCoeff, denumLeadingCoeff)
|
|
68
|
+
.simplify()
|
|
69
|
+
.toTree()
|
|
70
|
+
.toTex();
|
|
71
|
+
tryToAddWrongProp(propositions, "+\\infty");
|
|
72
|
+
tryToAddWrongProp(propositions, "-\\infty");
|
|
73
|
+
tryToAddWrongProp(propositions, "0");
|
|
74
|
+
tryToAddWrongProp(propositions, leadingCoeffsRational);
|
|
75
|
+
propWhile(propositions, n, () => {
|
|
76
|
+
tryToAddWrongProp(propositions, randint(-10, 10) + "");
|
|
77
|
+
});
|
|
78
|
+
return shuffle(propositions);
|
|
79
|
+
};
|
|
80
|
+
const isAnswerValid = (ans, { denumCoeffs, numCoeffs }) => {
|
|
81
|
+
const numDegree = numCoeffs.length - 1;
|
|
82
|
+
const denumDegree = denumCoeffs.length - 1;
|
|
83
|
+
const numLeadingCoeff = numCoeffs[numDegree];
|
|
84
|
+
const denumLeadingCoeff = denumCoeffs[denumDegree];
|
|
85
|
+
const leadingCoeffsRational = new Rational(numLeadingCoeff, denumLeadingCoeff)
|
|
86
|
+
.simplify()
|
|
87
|
+
.toTree({ allowFractionToDecimal: true });
|
|
88
|
+
let answer;
|
|
89
|
+
if (denumDegree === numDegree) {
|
|
90
|
+
answer = leadingCoeffsRational;
|
|
91
|
+
}
|
|
92
|
+
else if (denumDegree > numDegree) {
|
|
93
|
+
answer = new NumberNode(0);
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
const tempPoly = new Monom(numDegree - denumDegree, numLeadingCoeff * denumLeadingCoeff > 0 ? 1 : -1);
|
|
97
|
+
answer = tempPoly.getLimitNode("+\\infty");
|
|
98
|
+
}
|
|
99
|
+
const texs = answer.toAllValidTexs();
|
|
100
|
+
return texs.includes(ans);
|
|
101
|
+
};
|
|
102
|
+
export const sequenceRationalFracLimit = {
|
|
103
|
+
id: "sequenceRationalFracLimit",
|
|
104
|
+
connector: "=",
|
|
105
|
+
label: "Limite d'une suite rationnelle",
|
|
106
|
+
isSingleStep: true,
|
|
107
|
+
generator: (nb) => getDistinctQuestions(getSequenceRationalFracLimitQuestion, nb),
|
|
108
|
+
qcmTimer: 60,
|
|
109
|
+
freeTimer: 60,
|
|
110
|
+
getPropositions,
|
|
111
|
+
isAnswerValid,
|
|
112
|
+
subject: "Mathématiques",
|
|
113
|
+
getQuestionFromIdentifiers,
|
|
114
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/sequences/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/sequences/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,6BAA6B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/proofByInduction/index.ts"],"names":[],"mappings":"AAAA,cAAc,0CAA0C,CAAC;AACzD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,uCAAuC,CAAC;AACtD,cAAc,mCAAmC,CAAC"}
|
package/lib/exercises/math/sequences/proofByInduction/proofByInductionCheckInitialization.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { ProofByInductionSituationParams } from "./proofByInductionSituations.js";
|
|
3
|
+
type Identifiers = {
|
|
4
|
+
situationParams: ProofByInductionSituationParams;
|
|
5
|
+
isValid: boolean;
|
|
6
|
+
indexForNodeProperty: number;
|
|
7
|
+
};
|
|
8
|
+
export declare const proofByInductionCheckInitialization: Exercise<Identifiers>;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=proofByInductionCheckInitialization.d.ts.map
|
package/lib/exercises/math/sequences/proofByInduction/proofByInductionCheckInitialization.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"proofByInductionCheckInitialization.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/proofByInduction/proofByInductionCheckInitialization.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAWT,MAAM,6BAA6B,CAAC;AASrC,OAAO,EAGL,+BAA+B,EAChC,MAAM,iCAAiC,CAAC;AAEzC,KAAK,WAAW,GAAG;IACjB,eAAe,EAAE,+BAA+B,CAAC;IACjD,OAAO,EAAE,OAAO,CAAC;IACjB,oBAAoB,EAAE,MAAM,CAAC;CAC9B,CAAC;AA8PF,eAAO,MAAM,mCAAmC,EAAE,QAAQ,CAAC,WAAW,CAkBrE,CAAC"}
|