math-exercises 3.0.202 → 3.0.204

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.
Files changed (133) hide show
  1. package/lib/exercises/exercise.d.ts +4 -0
  2. package/lib/exercises/exercise.d.ts.map +1 -1
  3. package/lib/exercises/math/derivation/derivative/trigo/productOfSinAXPlusBCosCXPlusDDerivative.js +1 -1
  4. package/lib/exercises/math/derivation/derivative/trigo/sinAndCosMixedWithSquareDerivative.js +1 -1
  5. package/lib/exercises/math/derivation/derivative/trigo/sinCosDerivativeRewriteUsingCos2PlusSin2Equals1.d.ts.map +1 -1
  6. package/lib/exercises/math/derivation/derivative/trigo/sinCosDerivativeRewriteUsingCos2PlusSin2Equals1.js +1 -1
  7. package/lib/exercises/math/derivation/variations/index.d.ts.map +1 -1
  8. package/lib/exercises/math/derivation/variations/index.js +1 -0
  9. package/lib/exercises/math/derivation/variations/signVarTableWithExtremumTestExercise.d.ts +9 -0
  10. package/lib/exercises/math/derivation/variations/signVarTableWithExtremumTestExercise.d.ts.map +1 -0
  11. package/lib/exercises/math/derivation/variations/signVarTableWithExtremumTestExercise.js +191 -0
  12. package/lib/exercises/math/functions/continuity/equationNumberOfSolutionsFromVarTable.d.ts +9 -0
  13. package/lib/exercises/math/functions/continuity/equationNumberOfSolutionsFromVarTable.d.ts.map +1 -0
  14. package/lib/exercises/math/functions/continuity/equationNumberOfSolutionsFromVarTable.js +176 -0
  15. package/lib/exercises/math/functions/continuity/index.d.ts +6 -0
  16. package/lib/exercises/math/functions/continuity/index.d.ts.map +1 -0
  17. package/lib/exercises/math/functions/continuity/index.js +5 -0
  18. package/lib/exercises/math/functions/continuity/isFunctionContinuousFromGraph.d.ts +9 -0
  19. package/lib/exercises/math/functions/continuity/isFunctionContinuousFromGraph.d.ts.map +1 -0
  20. package/lib/exercises/math/functions/continuity/isFunctionContinuousFromGraph.js +193 -0
  21. package/lib/exercises/math/functions/continuity/piecewiseFunctionContinuity.d.ts +10 -0
  22. package/lib/exercises/math/functions/continuity/piecewiseFunctionContinuity.d.ts.map +1 -0
  23. package/lib/exercises/math/functions/continuity/piecewiseFunctionContinuity.js +150 -0
  24. package/lib/exercises/math/functions/continuity/signTableFromVarTableWithZeroes.d.ts +9 -0
  25. package/lib/exercises/math/functions/continuity/signTableFromVarTableWithZeroes.d.ts.map +1 -0
  26. package/lib/exercises/math/functions/continuity/signTableFromVarTableWithZeroes.js +162 -0
  27. package/lib/exercises/math/functions/continuity/thirdDegreeZeroesFramingWithCalculator.d.ts +8 -0
  28. package/lib/exercises/math/functions/continuity/thirdDegreeZeroesFramingWithCalculator.d.ts.map +1 -0
  29. package/lib/exercises/math/functions/continuity/thirdDegreeZeroesFramingWithCalculator.js +194 -0
  30. package/lib/exercises/math/functions/index.d.ts +1 -0
  31. package/lib/exercises/math/functions/index.d.ts.map +1 -1
  32. package/lib/exercises/math/functions/index.js +1 -0
  33. package/lib/exercises/math/functions/variations/index.d.ts.map +1 -1
  34. package/lib/exercises/math/functions/variations/index.js +1 -0
  35. package/lib/exercises/math/functions/variations/varTableWithExtremumTestExercise.d.ts +9 -0
  36. package/lib/exercises/math/functions/variations/varTableWithExtremumTestExercise.d.ts.map +1 -0
  37. package/lib/exercises/math/functions/variations/varTableWithExtremumTestExercise.js +183 -0
  38. package/lib/exercises/math/geometry/angles/anglesUsingIsParallel.d.ts.map +1 -1
  39. package/lib/exercises/math/geometry/angles/anglesUsingIsParallel.js +172 -51
  40. package/lib/exercises/math/geometry/angles/index.d.ts +1 -0
  41. package/lib/exercises/math/geometry/angles/index.d.ts.map +1 -1
  42. package/lib/exercises/math/geometry/angles/index.js +1 -1
  43. package/lib/exercises/math/limits/index.d.ts +1 -5
  44. package/lib/exercises/math/limits/index.d.ts.map +1 -1
  45. package/lib/exercises/math/limits/index.js +1 -5
  46. package/lib/exercises/math/limits/limitReading.d.ts.map +1 -1
  47. package/lib/exercises/math/limits/limitReading.js +70 -0
  48. package/lib/exercises/math/limits/polynomLimit.d.ts.map +1 -1
  49. package/lib/exercises/math/limits/polynomLimit.js +55 -4
  50. package/lib/exercises/math/limits/polynomLimitNoFI.d.ts.map +1 -1
  51. package/lib/exercises/math/limits/polynomLimitNoFI.js +35 -2
  52. package/lib/exercises/math/limits/sequenceGeometricLimit.d.ts.map +1 -1
  53. package/lib/exercises/math/limits/sequenceGeometricLimit.js +45 -9
  54. package/lib/exercises/math/limits/sequencePolynomLimit.d.ts.map +1 -1
  55. package/lib/exercises/math/limits/sequencePolynomLimit.js +56 -3
  56. package/lib/exercises/math/limits/sequencePolynomNoFILimit.d.ts.map +1 -1
  57. package/lib/exercises/math/limits/sequencePolynomNoFILimit.js +32 -0
  58. package/lib/exercises/math/limits/sequencePolynomProductLimit.d.ts.map +1 -1
  59. package/lib/exercises/math/limits/sequencePolynomProductLimit.js +33 -3
  60. package/lib/exercises/math/limits/sequenceRationalFracLimit.d.ts.map +1 -1
  61. package/lib/exercises/math/limits/sequenceRationalFracLimit.js +2 -2
  62. package/lib/exercises/math/limits/sequences/index.d.ts +6 -0
  63. package/lib/exercises/math/limits/sequences/index.d.ts.map +1 -0
  64. package/lib/exercises/math/limits/sequences/index.js +5 -0
  65. package/lib/exercises/math/limits/sequences/sequenceGeometricLimit.d.ts +9 -0
  66. package/lib/exercises/math/limits/sequences/sequenceGeometricLimit.d.ts.map +1 -0
  67. package/lib/exercises/math/limits/sequences/sequenceGeometricLimit.js +110 -0
  68. package/lib/exercises/math/limits/sequences/sequencePolynomLimit.d.ts +7 -0
  69. package/lib/exercises/math/limits/sequences/sequencePolynomLimit.d.ts.map +1 -0
  70. package/lib/exercises/math/limits/sequences/sequencePolynomLimit.js +116 -0
  71. package/lib/exercises/math/limits/sequences/sequencePolynomNoFILimit.d.ts +7 -0
  72. package/lib/exercises/math/limits/sequences/sequencePolynomNoFILimit.d.ts.map +1 -0
  73. package/lib/exercises/math/limits/sequences/sequencePolynomNoFILimit.js +95 -0
  74. package/lib/exercises/math/limits/sequences/sequencePolynomProductLimit.d.ts +8 -0
  75. package/lib/exercises/math/limits/sequences/sequencePolynomProductLimit.d.ts.map +1 -0
  76. package/lib/exercises/math/limits/sequences/sequencePolynomProductLimit.js +111 -0
  77. package/lib/exercises/math/limits/sequences/sequenceRationalFracLimit.d.ts +8 -0
  78. package/lib/exercises/math/limits/sequences/sequenceRationalFracLimit.d.ts.map +1 -0
  79. package/lib/exercises/math/limits/sequences/sequenceRationalFracLimit.js +114 -0
  80. package/lib/exercises/math/sequences/index.d.ts +1 -0
  81. package/lib/exercises/math/sequences/index.d.ts.map +1 -1
  82. package/lib/exercises/math/sequences/index.js +1 -0
  83. package/lib/exercises/math/sequences/proofByInduction/index.d.ts +5 -0
  84. package/lib/exercises/math/sequences/proofByInduction/index.d.ts.map +1 -0
  85. package/lib/exercises/math/sequences/proofByInduction/index.js +4 -0
  86. package/lib/exercises/math/sequences/proofByInduction/proofByInductionCheckInitialization.d.ts +10 -0
  87. package/lib/exercises/math/sequences/proofByInduction/proofByInductionCheckInitialization.d.ts.map +1 -0
  88. package/lib/exercises/math/sequences/proofByInduction/proofByInductionCheckInitialization.js +236 -0
  89. package/lib/exercises/math/sequences/proofByInduction/proofByInductionReorderProof.d.ts +13 -0
  90. package/lib/exercises/math/sequences/proofByInduction/proofByInductionReorderProof.d.ts.map +1 -0
  91. package/lib/exercises/math/sequences/proofByInduction/proofByInductionReorderProof.js +244 -0
  92. package/lib/exercises/math/sequences/proofByInduction/proofByInductionSituations.d.ts +98 -0
  93. package/lib/exercises/math/sequences/proofByInduction/proofByInductionSituations.d.ts.map +1 -0
  94. package/lib/exercises/math/sequences/proofByInduction/proofByInductionSituations.js +175 -0
  95. package/lib/exercises/math/sequences/proofByInduction/proofByInductionWriteMissingStep.d.ts +13 -0
  96. package/lib/exercises/math/sequences/proofByInduction/proofByInductionWriteMissingStep.d.ts.map +1 -0
  97. package/lib/exercises/math/sequences/proofByInduction/proofByInductionWriteMissingStep.js +317 -0
  98. package/lib/exercises/math/sequences/proofByInduction/proofByInductionWritePropAtRankKPlus1.d.ts +13 -0
  99. package/lib/exercises/math/sequences/proofByInduction/proofByInductionWritePropAtRankKPlus1.d.ts.map +1 -0
  100. package/lib/exercises/math/sequences/proofByInduction/proofByInductionWritePropAtRankKPlus1.js +265 -0
  101. package/lib/exercises/vea/polynomialVEA.d.ts.map +1 -1
  102. package/lib/exercises/vea/polynomialVEA.js +4 -0
  103. package/lib/index.d.ts +68 -13
  104. package/lib/index.d.ts.map +1 -1
  105. package/lib/math/geometry/point.d.ts.map +1 -1
  106. package/lib/math/geometry/point.js +1 -1
  107. package/lib/math/utils/functions/functionDecomposition.d.ts +2 -2
  108. package/lib/math/utils/functions/functionDecomposition.d.ts.map +1 -1
  109. package/lib/tests/exoTest.d.ts.map +1 -1
  110. package/lib/tests/exoTest.js +7 -11
  111. package/lib/tests/questionTest.d.ts.map +1 -1
  112. package/lib/tests/questionTest.js +7 -3
  113. package/lib/tests/singleExo.test.d.ts.map +1 -1
  114. package/lib/tests/singleExo.test.js +2 -2
  115. package/lib/tree/nodes/node.d.ts +2 -1
  116. package/lib/tree/nodes/node.d.ts.map +1 -1
  117. package/lib/tree/nodes/node.js +1 -0
  118. package/lib/tree/nodes/student/iDontKnowNode.d.ts +26 -0
  119. package/lib/tree/nodes/student/iDontKnowNode.d.ts.map +1 -0
  120. package/lib/tree/nodes/student/iDontKnowNode.js +63 -0
  121. package/lib/tree/parsers/latexParser.d.ts +3 -2
  122. package/lib/tree/parsers/latexParser.d.ts.map +1 -1
  123. package/lib/tree/parsers/latexParser.js +7 -0
  124. package/lib/tree/parsers/monomParser.d.ts +1 -1
  125. package/lib/tree/parsers/monomParser.d.ts.map +1 -1
  126. package/lib/tree/parsers/polynomialParser.d.ts +1 -1
  127. package/lib/tree/parsers/polynomialParser.d.ts.map +1 -1
  128. package/lib/tree/parsers/trinomParser.d.ts +1 -1
  129. package/lib/tree/parsers/trinomParser.d.ts.map +1 -1
  130. package/lib/tree/utilities/nodeComparator.d.ts +3 -1
  131. package/lib/tree/utilities/nodeComparator.d.ts.map +1 -1
  132. package/lib/tree/utilities/nodeComparator.js +63 -5
  133. package/package.json +1 -1
@@ -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
+ };
@@ -9,4 +9,5 @@ export * from "./notation/index.js";
9
9
  export * from "./seqArithmGeom/index.js";
10
10
  export * from "./limits/index.js";
11
11
  export * from "./variations/index.js";
12
+ export * from "./proofByInduction/index.js";
12
13
  //# sourceMappingURL=index.d.ts.map
@@ -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"}
@@ -9,3 +9,4 @@ export * from "./notation/index.js";
9
9
  export * from "./seqArithmGeom/index.js";
10
10
  export * from "./limits/index.js";
11
11
  export * from "./variations/index.js";
12
+ export * from "./proofByInduction/index.js";
@@ -0,0 +1,5 @@
1
+ export * from "./proofByInductionCheckInitialization.js";
2
+ export * from "./proofByInductionWritePropAtRankKPlus1.js";
3
+ export * from "./proofByInductionWriteMissingStep.js";
4
+ export * from "./proofByInductionReorderProof.js";
5
+ //# sourceMappingURL=index.d.ts.map
@@ -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"}
@@ -0,0 +1,4 @@
1
+ export * from "./proofByInductionCheckInitialization.js";
2
+ export * from "./proofByInductionWritePropAtRankKPlus1.js";
3
+ export * from "./proofByInductionWriteMissingStep.js";
4
+ export * from "./proofByInductionReorderProof.js";
@@ -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
@@ -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"}
@@ -0,0 +1,236 @@
1
+ import { tryToAddWrongProp, addValidProp, } from "../../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { nodeBySubstitutingVar } from "../../../../math/utils/functions/functionComposition.js";
4
+ import { randint } from "../../../../math/utils/random/randint.js";
5
+ import { VariableNode } from "../../../../tree/nodes/variables/variableNode.js";
6
+ import { coinFlip } from "../../../../utils/alea/coinFlip.js";
7
+ import { alignTex } from "../../../../utils/latex/alignTex.js";
8
+ import { splitAndKeep } from "../../../../utils/strings/splitAndKeep.js";
9
+ import { getHydratedProofByInductionSituation, getRandomProofByInductionSituationParams, } from "./proofByInductionSituations.js";
10
+ const getHydrated = (identifiers) => {
11
+ const { situationParams, isValid, indexForNodeProperty } = identifiers;
12
+ const situation = getHydratedProofByInductionSituation(situationParams);
13
+ const { n0 } = situation;
14
+ switch (situation.id) {
15
+ case "generalFormulaOfArithmeticoGeometricSequence": {
16
+ const nodeProperty = (isValid ? situation.arrNodeValid : situation.arrNodeInvalid)[indexForNodeProperty];
17
+ const nodeVarN = new VariableNode("n");
18
+ const nodePropertySubstituted = nodeBySubstitutingVar(nodeBySubstitutingVar(nodeProperty, n0.toTree(), nodeVarN), new VariableNode(`u_{${n0}}`), new VariableNode("u_{n}"));
19
+ return {
20
+ situation,
21
+ isValid,
22
+ nodeProperty,
23
+ nodePropertySubstituted,
24
+ };
25
+ }
26
+ case "multipleFromPolynomial": {
27
+ const { nbMod } = situation.params;
28
+ const nodeProperty = (isValid ? situation.arrNodeValid : situation.arrNodeInvalid)[indexForNodeProperty];
29
+ const nodeVarN = new VariableNode("n");
30
+ const nodePropertySubstituted = nodeBySubstitutingVar(nodeProperty, n0.toTree(), nodeVarN);
31
+ return {
32
+ situation,
33
+ isValid,
34
+ nodeProperty,
35
+ nodePropertySubstituted,
36
+ nbMod,
37
+ };
38
+ }
39
+ default:
40
+ throw new Error("Unsupported situation.id: " + situation.id);
41
+ }
42
+ };
43
+ const getInstruction = (identifiers) => {
44
+ const { situation, nodeProperty, nbMod } = getHydrated(identifiers);
45
+ const { n0 } = situation;
46
+ switch (situation.id) {
47
+ case "generalFormulaOfArithmeticoGeometricSequence": {
48
+ return `${situation.strContext}
49
+
50
+ Pour $n \\geq ${n0}$, on note $\\mathcal{P}(n)$ la propriété :
51
+
52
+ $$
53
+ \\mathcal{P}(n) :\\ \\ ${nodeProperty.toTex()}
54
+ $$
55
+
56
+ La propriété $\\mathcal{P}(${n0})$ est-elle vraie ?`;
57
+ }
58
+ case "multipleFromPolynomial": {
59
+ return `${situation.strContext}
60
+
61
+ Pour $n \\geq ${n0}$, on note $\\mathcal{P}(n)$ la propriété :
62
+
63
+ $$
64
+ \\mathcal{P}(n) :\\ \\ f(n) \\text{ est un multiple de } ${nbMod}
65
+ $$
66
+
67
+ La propriété $\\mathcal{P}(${n0})$ est-elle vraie ?`;
68
+ }
69
+ default:
70
+ throw new Error("Unsupported situation.id: " + situation.id);
71
+ }
72
+ };
73
+ const getAnswer = (identifiers) => {
74
+ const { isValid } = identifiers;
75
+ return isValid ? "Oui" : "Non";
76
+ };
77
+ const getHint = (identifiers) => {
78
+ const { situation } = getHydrated(identifiers);
79
+ const { n0 } = situation;
80
+ return `Remplace $n$ par $${n0}$ dans la formule proposée et compare la valeur obtenue avec la valeur de $u_{${n0}}$ fournie dans l'énoncé.`;
81
+ };
82
+ const getCorrection = (identifiers) => {
83
+ const { isValid } = identifiers;
84
+ const { situation, nodePropertySubstituted } = getHydrated(identifiers);
85
+ const { n0 } = situation;
86
+ switch (situation.id) {
87
+ case "generalFormulaOfArithmeticoGeometricSequence": {
88
+ return `On calcule la valeur de $u_{${n0}}$ d'après $\\mathcal{P}(${n0})$ :
89
+
90
+ ${alignTex([
91
+ splitAndKeep(nodePropertySubstituted.toTex(), "="),
92
+ splitAndKeep(nodePropertySubstituted.simplify().toTex(), "="),
93
+ ])}
94
+
95
+ ${(() => {
96
+ if (isValid) {
97
+ return `La propriété $\\mathcal{P}(${n0})$ est donc vraie.`;
98
+ }
99
+ else {
100
+ return `La propriété $\\mathcal{P}(${n0})$ est donc fausse.`;
101
+ }
102
+ })()}
103
+
104
+ `;
105
+ }
106
+ case "multipleFromPolynomial": {
107
+ return `On calcule la valeur de $f(${n0})$ :
108
+
109
+ ${alignTex([
110
+ [`f(${n0})`, "=", nodePropertySubstituted.toTex()],
111
+ ["", "=", nodePropertySubstituted.simplify().toTex()],
112
+ ])}
113
+
114
+ ${(() => {
115
+ if (isValid) {
116
+ return `La propriété $\\mathcal{P}(${n0})$ est donc vraie.`;
117
+ }
118
+ else {
119
+ return `La propriété $\\mathcal{P}(${n0})$ est donc fausse.`;
120
+ }
121
+ })()}
122
+
123
+ `;
124
+ }
125
+ default:
126
+ throw new Error("Unsupported situation.id: " + situation.id);
127
+ }
128
+ };
129
+ const getPropositions = (_n, { answer }) => {
130
+ const propositions = [];
131
+ ["Oui", "Non", "On ne peut pas savoir"].forEach((str) => {
132
+ if (str === answer) {
133
+ addValidProp(propositions, answer, "raw");
134
+ }
135
+ else {
136
+ tryToAddWrongProp(propositions, str, "raw");
137
+ }
138
+ });
139
+ return propositions;
140
+ };
141
+ const createRandomIdentifiers = () => {
142
+ const situationParams = getRandomProofByInductionSituationParams();
143
+ const situation = getHydratedProofByInductionSituation(situationParams);
144
+ const [isValid, indexForNodeProperty] = (() => {
145
+ switch (situation.id) {
146
+ case "generalFormulaOfArithmeticoGeometricSequence": {
147
+ const isValid = coinFlip();
148
+ const indexForNodeProperty = randint(0, isValid
149
+ ? situation.arrNodeValid.length
150
+ : situation.arrNodeInvalid.length);
151
+ return [isValid, indexForNodeProperty];
152
+ }
153
+ case "multipleFromPolynomial": {
154
+ const isValid = situation.arrNodeValid.length > 0;
155
+ const indexForNodeProperty = 0;
156
+ return [isValid, indexForNodeProperty];
157
+ }
158
+ default:
159
+ throw new Error("Unsupported situation.id: " + situation.id);
160
+ }
161
+ })();
162
+ const identifiers = {
163
+ situationParams,
164
+ isValid,
165
+ indexForNodeProperty,
166
+ };
167
+ return identifiers;
168
+ };
169
+ // const isIdentifiersQCPassed = (identifiers: Identifiers) => {
170
+ // const isExploding = (identifiers: Identifiers) => {
171
+ // let isExploding = false;
172
+ // try {
173
+ // getHydrated(identifiers);
174
+ // } catch (_) {
175
+ // isExploding = true;
176
+ // }
177
+ // return isExploding;
178
+ // };
179
+ // return !isExploding(identifiers);
180
+ // };
181
+ // const createQCPassedIdentifiers = () => {
182
+ // let identifiers: Identifiers;
183
+ // let counter = -1;
184
+ // let isValid = false;
185
+ // while (!isValid && counter < 100) {
186
+ // counter++;
187
+ // const identifiersCandidate = createRandomIdentifiers();
188
+ // isValid = isIdentifiersQCPassed(identifiersCandidate);
189
+ // if (isValid) {
190
+ // identifiers = identifiersCandidate;
191
+ // }
192
+ // }
193
+ // if (!isValid) {
194
+ // const [situationParams] = getArrProofByInductionSituationParams([
195
+ // "generalFormulaOfArithmeticoGeometricSequence",
196
+ // ]);
197
+ // const identifiersDefault: Identifiers = (() => {
198
+ // return {
199
+ // situationParams,
200
+ // isValid: true,
201
+ // indexForNodeProperty: 0,
202
+ // };
203
+ // })();
204
+ // identifiers = identifiersDefault;
205
+ // }
206
+ // return identifiers!;
207
+ // };
208
+ const getProofByInductionCheckInitializationQuestion = () => {
209
+ const identifiers = createRandomIdentifiers();
210
+ return getQuestionFromIdentifiers(identifiers);
211
+ };
212
+ const getQuestionFromIdentifiers = (identifiers) => {
213
+ return {
214
+ answer: getAnswer(identifiers),
215
+ instruction: getInstruction(identifiers),
216
+ keys: [],
217
+ answerFormat: "raw",
218
+ identifiers,
219
+ hint: getHint(identifiers),
220
+ correction: getCorrection(identifiers),
221
+ };
222
+ };
223
+ export const proofByInductionCheckInitialization = {
224
+ id: "proofByInductionCheckInitialization",
225
+ connector: "=",
226
+ label: "Vérifier si une propriété $\\mathcal{P}(n)$ est vraie pour un rang $n_{0}$ donné",
227
+ isSingleStep: true,
228
+ generator: (nb, opts) => getDistinctQuestions(() => getProofByInductionCheckInitializationQuestion(opts), nb),
229
+ qcmTimer: 60,
230
+ freeTimer: 60,
231
+ getPropositions,
232
+ subject: "Mathématiques",
233
+ getQuestionFromIdentifiers,
234
+ hasHintAndCorrection: true,
235
+ answerType: "QCU",
236
+ };
@@ -0,0 +1,13 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ import { NodeIdentifiers } from "../../../../tree/nodes/nodeConstructor.js";
3
+ import { ProofByInductionSituationParams } from "./proofByInductionSituations.js";
4
+ type Identifiers = {
5
+ situationParams: ProofByInductionSituationParams;
6
+ isValid: boolean;
7
+ indexForNodeProperty: number;
8
+ nodeIdsVarStepDefinition: NodeIdentifiers;
9
+ nodeIdsVarStepInduction: NodeIdentifiers;
10
+ };
11
+ export declare const proofByInductionReorderProof: Exercise<Identifiers>;
12
+ export {};
13
+ //# sourceMappingURL=proofByInductionReorderProof.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"proofByInductionReorderProof.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/proofByInduction/proofByInductionReorderProof.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAQT,MAAM,6BAA6B,CAAC;AAIrC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAK7C,OAAO,EAGL,+BAA+B,EAChC,MAAM,iCAAiC,CAAC;AAQzC,KAAK,WAAW,GAAG;IACjB,eAAe,EAAE,+BAA+B,CAAC;IACjD,OAAO,EAAE,OAAO,CAAC;IACjB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,wBAAwB,EAAE,eAAe,CAAC;IAC1C,uBAAuB,EAAE,eAAe,CAAC;CAC1C,CAAC;AA0WF,eAAO,MAAM,4BAA4B,EAAE,QAAQ,CAAC,WAAW,CAiB9D,CAAC"}