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.
Files changed (100) hide show
  1. package/lib/exercises/math/derivation/derivative/trigo/productOfSinAXPlusBCosCXPlusDDerivative.js +1 -1
  2. package/lib/exercises/math/derivation/derivative/trigo/sinAndCosMixedWithSquareDerivative.js +1 -1
  3. package/lib/exercises/math/derivation/derivative/trigo/sinCosDerivativeRewriteUsingCos2PlusSin2Equals1.d.ts.map +1 -1
  4. package/lib/exercises/math/derivation/derivative/trigo/sinCosDerivativeRewriteUsingCos2PlusSin2Equals1.js +1 -1
  5. package/lib/exercises/math/geometry/angles/anglesUsingIsParallel.d.ts.map +1 -1
  6. package/lib/exercises/math/geometry/angles/anglesUsingIsParallel.js +172 -51
  7. package/lib/exercises/math/geometry/angles/index.d.ts +1 -0
  8. package/lib/exercises/math/geometry/angles/index.d.ts.map +1 -1
  9. package/lib/exercises/math/geometry/angles/index.js +1 -1
  10. package/lib/exercises/math/limits/index.d.ts +1 -5
  11. package/lib/exercises/math/limits/index.d.ts.map +1 -1
  12. package/lib/exercises/math/limits/index.js +1 -5
  13. package/lib/exercises/math/limits/limitReading.d.ts.map +1 -1
  14. package/lib/exercises/math/limits/limitReading.js +70 -0
  15. package/lib/exercises/math/limits/polynomLimit.d.ts.map +1 -1
  16. package/lib/exercises/math/limits/polynomLimit.js +55 -4
  17. package/lib/exercises/math/limits/polynomLimitNoFI.d.ts.map +1 -1
  18. package/lib/exercises/math/limits/polynomLimitNoFI.js +35 -2
  19. package/lib/exercises/math/limits/sequenceGeometricLimit.d.ts.map +1 -1
  20. package/lib/exercises/math/limits/sequenceGeometricLimit.js +45 -9
  21. package/lib/exercises/math/limits/sequencePolynomLimit.d.ts.map +1 -1
  22. package/lib/exercises/math/limits/sequencePolynomLimit.js +56 -3
  23. package/lib/exercises/math/limits/sequencePolynomNoFILimit.d.ts.map +1 -1
  24. package/lib/exercises/math/limits/sequencePolynomNoFILimit.js +32 -0
  25. package/lib/exercises/math/limits/sequencePolynomProductLimit.d.ts.map +1 -1
  26. package/lib/exercises/math/limits/sequencePolynomProductLimit.js +33 -3
  27. package/lib/exercises/math/limits/sequenceRationalFracLimit.d.ts.map +1 -1
  28. package/lib/exercises/math/limits/sequenceRationalFracLimit.js +2 -2
  29. package/lib/exercises/math/limits/sequences/index.d.ts +6 -0
  30. package/lib/exercises/math/limits/sequences/index.d.ts.map +1 -0
  31. package/lib/exercises/math/limits/sequences/index.js +5 -0
  32. package/lib/exercises/math/limits/sequences/sequenceGeometricLimit.d.ts +9 -0
  33. package/lib/exercises/math/limits/sequences/sequenceGeometricLimit.d.ts.map +1 -0
  34. package/lib/exercises/math/limits/sequences/sequenceGeometricLimit.js +110 -0
  35. package/lib/exercises/math/limits/sequences/sequencePolynomLimit.d.ts +7 -0
  36. package/lib/exercises/math/limits/sequences/sequencePolynomLimit.d.ts.map +1 -0
  37. package/lib/exercises/math/limits/sequences/sequencePolynomLimit.js +116 -0
  38. package/lib/exercises/math/limits/sequences/sequencePolynomNoFILimit.d.ts +7 -0
  39. package/lib/exercises/math/limits/sequences/sequencePolynomNoFILimit.d.ts.map +1 -0
  40. package/lib/exercises/math/limits/sequences/sequencePolynomNoFILimit.js +95 -0
  41. package/lib/exercises/math/limits/sequences/sequencePolynomProductLimit.d.ts +8 -0
  42. package/lib/exercises/math/limits/sequences/sequencePolynomProductLimit.d.ts.map +1 -0
  43. package/lib/exercises/math/limits/sequences/sequencePolynomProductLimit.js +111 -0
  44. package/lib/exercises/math/limits/sequences/sequenceRationalFracLimit.d.ts +8 -0
  45. package/lib/exercises/math/limits/sequences/sequenceRationalFracLimit.d.ts.map +1 -0
  46. package/lib/exercises/math/limits/sequences/sequenceRationalFracLimit.js +114 -0
  47. package/lib/exercises/math/sequences/index.d.ts +1 -0
  48. package/lib/exercises/math/sequences/index.d.ts.map +1 -1
  49. package/lib/exercises/math/sequences/index.js +1 -0
  50. package/lib/exercises/math/sequences/proofByInduction/index.d.ts +5 -0
  51. package/lib/exercises/math/sequences/proofByInduction/index.d.ts.map +1 -0
  52. package/lib/exercises/math/sequences/proofByInduction/index.js +4 -0
  53. package/lib/exercises/math/sequences/proofByInduction/proofByInductionCheckInitialization.d.ts +10 -0
  54. package/lib/exercises/math/sequences/proofByInduction/proofByInductionCheckInitialization.d.ts.map +1 -0
  55. package/lib/exercises/math/sequences/proofByInduction/proofByInductionCheckInitialization.js +236 -0
  56. package/lib/exercises/math/sequences/proofByInduction/proofByInductionReorderProof.d.ts +13 -0
  57. package/lib/exercises/math/sequences/proofByInduction/proofByInductionReorderProof.d.ts.map +1 -0
  58. package/lib/exercises/math/sequences/proofByInduction/proofByInductionReorderProof.js +244 -0
  59. package/lib/exercises/math/sequences/proofByInduction/proofByInductionSituations.d.ts +98 -0
  60. package/lib/exercises/math/sequences/proofByInduction/proofByInductionSituations.d.ts.map +1 -0
  61. package/lib/exercises/math/sequences/proofByInduction/proofByInductionSituations.js +175 -0
  62. package/lib/exercises/math/sequences/proofByInduction/proofByInductionWriteMissingStep.d.ts +13 -0
  63. package/lib/exercises/math/sequences/proofByInduction/proofByInductionWriteMissingStep.d.ts.map +1 -0
  64. package/lib/exercises/math/sequences/proofByInduction/proofByInductionWriteMissingStep.js +317 -0
  65. package/lib/exercises/math/sequences/proofByInduction/proofByInductionWritePropAtRankKPlus1.d.ts +13 -0
  66. package/lib/exercises/math/sequences/proofByInduction/proofByInductionWritePropAtRankKPlus1.d.ts.map +1 -0
  67. package/lib/exercises/math/sequences/proofByInduction/proofByInductionWritePropAtRankKPlus1.js +265 -0
  68. package/lib/exercises/vea/polynomialVEA.d.ts.map +1 -1
  69. package/lib/exercises/vea/polynomialVEA.js +4 -0
  70. package/lib/index.d.ts +49 -13
  71. package/lib/index.d.ts.map +1 -1
  72. package/lib/math/geometry/point.d.ts.map +1 -1
  73. package/lib/math/geometry/point.js +1 -1
  74. package/lib/math/utils/functions/functionDecomposition.d.ts +2 -2
  75. package/lib/math/utils/functions/functionDecomposition.d.ts.map +1 -1
  76. package/lib/tests/exoTest.d.ts.map +1 -1
  77. package/lib/tests/exoTest.js +7 -11
  78. package/lib/tests/questionTest.d.ts.map +1 -1
  79. package/lib/tests/questionTest.js +7 -3
  80. package/lib/tests/singleExo.test.d.ts.map +1 -1
  81. package/lib/tests/singleExo.test.js +2 -2
  82. package/lib/tree/nodes/node.d.ts +2 -1
  83. package/lib/tree/nodes/node.d.ts.map +1 -1
  84. package/lib/tree/nodes/node.js +1 -0
  85. package/lib/tree/nodes/student/iDontKnowNode.d.ts +26 -0
  86. package/lib/tree/nodes/student/iDontKnowNode.d.ts.map +1 -0
  87. package/lib/tree/nodes/student/iDontKnowNode.js +63 -0
  88. package/lib/tree/parsers/latexParser.d.ts +3 -2
  89. package/lib/tree/parsers/latexParser.d.ts.map +1 -1
  90. package/lib/tree/parsers/latexParser.js +7 -0
  91. package/lib/tree/parsers/monomParser.d.ts +1 -1
  92. package/lib/tree/parsers/monomParser.d.ts.map +1 -1
  93. package/lib/tree/parsers/polynomialParser.d.ts +1 -1
  94. package/lib/tree/parsers/polynomialParser.d.ts.map +1 -1
  95. package/lib/tree/parsers/trinomParser.d.ts +1 -1
  96. package/lib/tree/parsers/trinomParser.d.ts.map +1 -1
  97. package/lib/tree/utilities/nodeComparator.d.ts +3 -1
  98. package/lib/tree/utilities/nodeComparator.d.ts.map +1 -1
  99. package/lib/tree/utilities/nodeComparator.js +63 -5
  100. package/package.json +1 -1
@@ -2,6 +2,8 @@ import { addValidProp, propWhile, tryToAddWrongProp, } from "../../../exercises/
2
2
  import { getDistinctQuestions } from "../../../exercises/utils/getDistinctQuestions.js";
3
3
  import { Polynomial, PolynomialConstructor, } from "../../../math/polynomials/polynomial.js";
4
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";
5
7
  import { coinFlip } from "../../../utils/alea/coinFlip.js";
6
8
  import { shuffle } from "../../../utils/alea/shuffle.js";
7
9
  const getInstruction = (identifiers) => {
@@ -19,8 +21,36 @@ const getAnswer = (identifiers) => {
19
21
  const answer = poly.getLimit(to);
20
22
  return answer;
21
23
  };
22
- // const getHint: GetHint<Identifiers> = (identifiers) => {};
23
- // const getCorrection: GetCorrection<Identifiers> = (identifiers) => {};
24
+ const getHint = (identifiers) => {
25
+ const { to } = identifiers;
26
+ return `Détermine la limite quand $x$ tend vers $${to}$ de chaque terme de la somme composant $f(x)$.
27
+
28
+ Puis, déduis-en la limite de $f(x)$ en "additionnant" les limites obtenues.`;
29
+ };
30
+ const getCorrection = (identifiers) => {
31
+ const { to, coeffs } = identifiers;
32
+ const texs = coeffs
33
+ .map((coeff, i) => {
34
+ if (coeff === 0)
35
+ return "";
36
+ if (i === 0)
37
+ return `$\\displaystyle \\lim_{x \\to ${to}} ${coeff} = ${coeff}$`;
38
+ const monom = multiply(coeff, power("x", i)).simplify();
39
+ const value = to === "+\\infty" ? 100 : -100;
40
+ const sign = monom.evaluate({ x: value }) > 0 ? "+" : "-";
41
+ return `$\\displaystyle \\lim_{x \\to ${to}} ${monom.toTex()} = ${sign}\\infty$`;
42
+ })
43
+ .filter(Boolean);
44
+ return `On détermine la limite de chaque terme de la somme composant $f(x)$ :
45
+
46
+ ${texs.reverse().join("\n \n")}
47
+
48
+ Par addition des limites, on obtient donc :
49
+
50
+ $$
51
+ \\lim_{x \\to ${to}} f(x) = ${getAnswer(identifiers)}
52
+ $$`;
53
+ };
24
54
  const getQuestionFromIdentifiers = (identifiers) => {
25
55
  const question = {
26
56
  answer: getAnswer(identifiers),
@@ -28,6 +58,8 @@ const getQuestionFromIdentifiers = (identifiers) => {
28
58
  keys: ["infty"],
29
59
  answerFormat: "tex",
30
60
  identifiers,
61
+ hint: getHint(identifiers),
62
+ correction: getCorrection(identifiers),
31
63
  };
32
64
  return question;
33
65
  };
@@ -65,4 +97,5 @@ export const polynomLimitNoFI = {
65
97
  isAnswerValid,
66
98
  subject: "Mathématiques",
67
99
  getQuestionFromIdentifiers,
100
+ hasHintAndCorrection: true,
68
101
  };
@@ -1 +1 @@
1
- {"version":3,"file":"sequenceGeometricLimit.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/limits/sequenceGeometricLimit.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAMrC,OAAO,EACL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;AAE7C,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,eAAe,CAAC;IACxB,SAAS,EAAE,eAAe,CAAC;CAC5B,CAAC;AA4EF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,CAgBxD,CAAC"}
1
+ {"version":3,"file":"sequenceGeometricLimit.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/limits/sequenceGeometricLimit.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAMrC,OAAO,EACL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;AAG7C,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,eAAe,CAAC;IACxB,SAAS,EAAE,eAAe,CAAC;CAC5B,CAAC;AAoHF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,CAgBxD,CAAC"}
@@ -2,6 +2,7 @@ import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../exercis
2
2
  import { getDistinctQuestions } from "../../../exercises/utils/getDistinctQuestions.js";
3
3
  import { GeometricSequence, GeometricSequenceConstructor, } from "../../../math/sequences/geometricSequence.js";
4
4
  import { reifyAlgebraic, } from "../../../tree/nodes/nodeConstructor.js";
5
+ import { power } from "../../../tree/nodes/operators/powerNode.js";
5
6
  const getInstruction = (identifiers) => {
6
7
  const { reason, firstTerm } = identifiers;
7
8
  const sequence = new GeometricSequence(reifyAlgebraic(firstTerm), reifyAlgebraic(reason));
@@ -17,12 +18,47 @@ const getAnswer = (identifiers) => {
17
18
  const answer = sequence.getLimit();
18
19
  return answer.toTex();
19
20
  };
20
- // const getHint: GetHint<Identifiers> = (identifiers)=>{
21
- // return ``
22
- // }
23
- // const getCorrection: GetCorrection<Identifiers> = (identifiers)=>{
24
- // return ``
25
- // }
21
+ const getHint = () => {
22
+ return `Soit $u$ la suite géométrique définie par :
23
+
24
+ $$
25
+ u_n = q^n
26
+ $$
27
+
28
+ Alors :
29
+
30
+ - si $q>1$, la limite de $u_n$ est $+\\infty$ ;
31
+ - si $-1<q<1$, la limite de $u_n$ est $0$.
32
+ - si $q<-1$, $u_n$ n'admet pas de limite.
33
+
34
+ `;
35
+ };
36
+ const getCorrection = (identifiers) => {
37
+ const { reason } = identifiers;
38
+ const reasonNode = reifyAlgebraic(reason);
39
+ const reasonEv = reasonNode.evaluate({});
40
+ const reasonTex = reasonEv > 1
41
+ ? `Puisque $${reasonNode.toTex()}>1$, on a :
42
+
43
+ $$
44
+ \\lim_{n \\to +\\infty} ${power(reasonNode, "n").toTex()} = +\\infty
45
+ $$
46
+
47
+ `
48
+ : `Puisque $-1<${reasonNode.toTex()}<1$, on a :
49
+
50
+ $$
51
+ \\lim_{n \\to +\\infty} ${power(reasonNode, "n").toTex()} = 0
52
+ $$`;
53
+ return (reasonTex +
54
+ `
55
+
56
+ On en déduit donc :
57
+
58
+ $$
59
+ \\lim_{n \\to +\\infty} u_n = ${getAnswer(identifiers)}
60
+ $$`);
61
+ };
26
62
  const getSequenceGeometricLimitQuestion = () => {
27
63
  const sequence = GeometricSequenceConstructor.randomWithLimit();
28
64
  const identifiers = {
@@ -38,8 +74,8 @@ const getQuestionFromIdentifiers = (identifiers) => {
38
74
  keys: ["infty"],
39
75
  answerFormat: "tex",
40
76
  identifiers,
41
- // hint: getHint(identifiers),
42
- // correction: getCorrection(identifiers),
77
+ hint: getHint(identifiers),
78
+ correction: getCorrection(identifiers),
43
79
  };
44
80
  return question;
45
81
  };
@@ -70,5 +106,5 @@ export const sequenceGeometricLimit = {
70
106
  getAnswer,
71
107
  getInstruction,
72
108
  getQuestionFromIdentifiers,
73
- // hasHintAndCorrection: true,
109
+ hasHintAndCorrection: true,
74
110
  };
@@ -1 +1 @@
1
- {"version":3,"file":"sequencePolynomLimit.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/limits/sequencePolynomLimit.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AASrC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AAyDF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAatD,CAAC"}
1
+ {"version":3,"file":"sequencePolynomLimit.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/limits/sequencePolynomLimit.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAcrC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AA2GF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CActD,CAAC"}
@@ -2,6 +2,11 @@ import { addValidProp, propWhile, tryToAddWrongProp, } from "../../../exercises/
2
2
  import { getDistinctQuestions } from "../../../exercises/utils/getDistinctQuestions.js";
3
3
  import { Polynomial, PolynomialConstructor, } from "../../../math/polynomials/polynomial.js";
4
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";
5
10
  import { shuffle } from "../../../utils/alea/shuffle.js";
6
11
  const getInstruction = (identifiers) => {
7
12
  const poly = new Polynomial(identifiers.coeffs, "n");
@@ -17,6 +22,44 @@ const getAnswer = (identifiers) => {
17
22
  const answer = poly.getLimit(to);
18
23
  return answer;
19
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
+ };
20
63
  const getQuestionFromIdentifiers = (identifiers) => {
21
64
  const question = {
22
65
  answer: getAnswer(identifiers),
@@ -24,12 +67,21 @@ const getQuestionFromIdentifiers = (identifiers) => {
24
67
  keys: ["infty"],
25
68
  answerFormat: "tex",
26
69
  identifiers,
70
+ hint: getHint(identifiers),
71
+ correction: getCorrection(identifiers),
27
72
  };
28
73
  return question;
29
74
  };
30
75
  const getSequencePolynomLimitQuestion = () => {
31
- const poly = PolynomialConstructor.random(4, "n");
32
- const identifiers = { coeffs: poly.coefficients };
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 };
33
85
  return getQuestionFromIdentifiers(identifiers);
34
86
  };
35
87
  const getPropositions = (n, { answer, coeffs }) => {
@@ -51,7 +103,7 @@ const isAnswerValid = (ans, { answer }) => {
51
103
  export const sequencePolynomLimit = {
52
104
  id: "sequencePolynomLimit",
53
105
  connector: "=",
54
- label: "Limite d'une suite polynomiale",
106
+ label: "Limite d'une suite polynomiale (avec F.I.)",
55
107
  isSingleStep: true,
56
108
  generator: (nb) => getDistinctQuestions(getSequencePolynomLimitQuestion, nb),
57
109
  qcmTimer: 60,
@@ -60,4 +112,5 @@ export const sequencePolynomLimit = {
60
112
  isAnswerValid,
61
113
  subject: "Mathématiques",
62
114
  getQuestionFromIdentifiers,
115
+ hasHintAndCorrection: true,
63
116
  };
@@ -1 +1 @@
1
- {"version":3,"file":"sequencePolynomNoFILimit.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/limits/sequencePolynomNoFILimit.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AASrC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AA+DF,eAAO,MAAM,wBAAwB,EAAE,QAAQ,CAAC,WAAW,CAa1D,CAAC"}
1
+ {"version":3,"file":"sequencePolynomNoFILimit.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/limits/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"}
@@ -2,6 +2,8 @@ import { addValidProp, propWhile, tryToAddWrongProp, } from "../../../exercises/
2
2
  import { getDistinctQuestions } from "../../../exercises/utils/getDistinctQuestions.js";
3
3
  import { Polynomial, PolynomialConstructor, } from "../../../math/polynomials/polynomial.js";
4
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";
5
7
  import { shuffle } from "../../../utils/alea/shuffle.js";
6
8
  const getInstruction = (identifiers) => {
7
9
  const poly = new Polynomial(identifiers.coeffs, "n");
@@ -17,6 +19,33 @@ const getAnswer = (identifiers) => {
17
19
  const answer = poly.getLimit(to);
18
20
  return answer;
19
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
+ };
20
49
  const getQuestionFromIdentifiers = (identifiers) => {
21
50
  const question = {
22
51
  answer: getAnswer(identifiers),
@@ -24,6 +53,8 @@ const getQuestionFromIdentifiers = (identifiers) => {
24
53
  keys: ["infty"],
25
54
  answerFormat: "tex",
26
55
  identifiers,
56
+ hint: getHint(identifiers),
57
+ correction: getCorrection(identifiers),
27
58
  };
28
59
  return question;
29
60
  };
@@ -60,4 +91,5 @@ export const sequencePolynomNoFILimit = {
60
91
  isAnswerValid,
61
92
  subject: "Mathématiques",
62
93
  getQuestionFromIdentifiers,
94
+ hasHintAndCorrection: true,
63
95
  };
@@ -1 +1 @@
1
- {"version":3,"file":"sequencePolynomProductLimit.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/limits/sequencePolynomProductLimit.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAWrC,KAAK,WAAW,GAAG;IACjB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,eAAe,EAAE,MAAM,EAAE,CAAC;CAC3B,CAAC;AAoFF,eAAO,MAAM,2BAA2B,EAAE,QAAQ,CAAC,WAAW,CAa7D,CAAC"}
1
+ {"version":3,"file":"sequencePolynomProductLimit.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/limits/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"}
@@ -26,6 +26,33 @@ const getAnswer = (identifiers) => {
26
26
  const answer = product.getLimit(to);
27
27
  return answer;
28
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
+ };
29
56
  const getQuestionFromIdentifiers = (identifiers) => {
30
57
  const question = {
31
58
  answer: getAnswer(identifiers),
@@ -33,12 +60,14 @@ const getQuestionFromIdentifiers = (identifiers) => {
33
60
  keys: ["infty"],
34
61
  answerFormat: "tex",
35
62
  identifiers,
63
+ hint: getHint(identifiers),
64
+ correction: getCorrection(identifiers),
36
65
  };
37
66
  return question;
38
67
  };
39
68
  const getSequencePolynomProductLimitQuestion = () => {
40
- const polyNum = PolynomialConstructor.randomWithLength(3, 2, "n");
41
- const polyDenum = PolynomialConstructor.randomWithLength(3, 2, "n");
69
+ const polyNum = PolynomialConstructor.randomWithLengthAndSameSigns(3, 2, "n");
70
+ const polyDenum = PolynomialConstructor.randomWithLengthAndSameSigns(3, 2, "n");
42
71
  const identifiers = {
43
72
  polyDenumCoeffs: polyDenum.coefficients,
44
73
  polyNumCoeffs: polyNum.coefficients,
@@ -69,7 +98,7 @@ const isAnswerValid = (ans, { answer }) => {
69
98
  export const sequencePolynomProductLimit = {
70
99
  id: "sequencePolynomProductLimit",
71
100
  connector: "=",
72
- label: "Limite d'un produit de suites polynomiales",
101
+ label: "Limite d'un produit de suites polynomiales (sans F.I.)",
73
102
  isSingleStep: true,
74
103
  generator: (nb) => getDistinctQuestions(getSequencePolynomProductLimitQuestion, nb),
75
104
  qcmTimer: 60,
@@ -78,4 +107,5 @@ export const sequencePolynomProductLimit = {
78
107
  isAnswerValid,
79
108
  subject: "Mathématiques",
80
109
  getQuestionFromIdentifiers,
110
+ hasHintAndCorrection: true,
81
111
  };
@@ -1 +1 @@
1
- {"version":3,"file":"sequenceRationalFracLimit.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/limits/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;AAwHF,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,WAAW,CAa3D,CAAC"}
1
+ {"version":3,"file":"sequenceRationalFracLimit.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/limits/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"}
@@ -51,8 +51,8 @@ const getQuestionFromIdentifiers = (identifiers) => {
51
51
  return question;
52
52
  };
53
53
  const getSequenceRationalFracLimitQuestion = () => {
54
- const polyNum = PolynomialConstructor.random(4, "n");
55
- const polyDenum = PolynomialConstructor.random(4, "n");
54
+ const polyNum = PolynomialConstructor.randomWithLengthAndSameSigns(3, randint(2, 4), "n");
55
+ const polyDenum = PolynomialConstructor.randomWithLengthAndSameSigns(3, randint(2, 4), "n");
56
56
  const identifiers = {
57
57
  numCoeffs: polyNum.coefficients,
58
58
  denumCoeffs: polyDenum.coefficients,
@@ -0,0 +1,6 @@
1
+ export * from "./sequenceGeometricLimit.js";
2
+ export * from "./sequencePolynomLimit.js";
3
+ export * from "./sequencePolynomNoFILimit.js";
4
+ export * from "./sequencePolynomProductLimit.js";
5
+ export * from "./sequenceRationalFracLimit.js";
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/limits/sequences/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,kCAAkC,CAAC;AACjD,cAAc,gCAAgC,CAAC"}
@@ -0,0 +1,5 @@
1
+ export * from "./sequenceGeometricLimit.js";
2
+ export * from "./sequencePolynomLimit.js";
3
+ export * from "./sequencePolynomNoFILimit.js";
4
+ export * from "./sequencePolynomProductLimit.js";
5
+ export * from "./sequenceRationalFracLimit.js";
@@ -0,0 +1,9 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ import { NodeIdentifiers } from "../../../../tree/nodes/nodeConstructor.js";
3
+ type Identifiers = {
4
+ reason: NodeIdentifiers;
5
+ firstTerm: NodeIdentifiers;
6
+ };
7
+ export declare const sequenceGeometricLimit: Exercise<Identifiers>;
8
+ export {};
9
+ //# sourceMappingURL=sequenceGeometricLimit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sequenceGeometricLimit.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/limits/sequences/sequenceGeometricLimit.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAMrC,OAAO,EACL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;AAG7C,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,eAAe,CAAC;IACxB,SAAS,EAAE,eAAe,CAAC;CAC5B,CAAC;AAoHF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,CAgBxD,CAAC"}
@@ -0,0 +1,110 @@
1
+ import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { GeometricSequence, GeometricSequenceConstructor, } from "../../../../math/sequences/geometricSequence.js";
4
+ import { reifyAlgebraic, } from "../../../../tree/nodes/nodeConstructor.js";
5
+ import { power } from "../../../../tree/nodes/operators/powerNode.js";
6
+ const getInstruction = (identifiers) => {
7
+ const { reason, firstTerm } = identifiers;
8
+ const sequence = new GeometricSequence(reifyAlgebraic(firstTerm), reifyAlgebraic(reason));
9
+ return `Déterminer la limite de la suite $u$ définie par :
10
+
11
+ $$
12
+ u_n = ${sequence.toTree().toTex()}
13
+ $$`;
14
+ };
15
+ const getAnswer = (identifiers) => {
16
+ const { reason, firstTerm } = identifiers;
17
+ const sequence = new GeometricSequence(reifyAlgebraic(firstTerm), reifyAlgebraic(reason));
18
+ const answer = sequence.getLimit();
19
+ return answer.toTex();
20
+ };
21
+ const getHint = () => {
22
+ return `Soit $u$ la suite géométrique définie par :
23
+
24
+ $$
25
+ u_n = q^n
26
+ $$
27
+
28
+ Alors :
29
+
30
+ - si $q>1$, la limite de $u_n$ est $+\\infty$ ;
31
+ - si $-1<q<1$, la limite de $u_n$ est $0$.
32
+ - si $q<-1$, $u_n$ n'admet pas de limite.
33
+
34
+ `;
35
+ };
36
+ const getCorrection = (identifiers) => {
37
+ const { reason } = identifiers;
38
+ const reasonNode = reifyAlgebraic(reason);
39
+ const reasonEv = reasonNode.evaluate({});
40
+ const reasonTex = reasonEv > 1
41
+ ? `Puisque $${reasonNode.toTex()}>1$, on a :
42
+
43
+ $$
44
+ \\lim_{n \\to +\\infty} ${power(reasonNode, "n").toTex()} = +\\infty
45
+ $$
46
+
47
+ `
48
+ : `Puisque $-1<${reasonNode.toTex()}<1$, on a :
49
+
50
+ $$
51
+ \\lim_{n \\to +\\infty} ${power(reasonNode, "n").toTex()} = 0
52
+ $$`;
53
+ return (reasonTex +
54
+ `
55
+
56
+ On en déduit donc :
57
+
58
+ $$
59
+ \\lim_{n \\to +\\infty} u_n = ${getAnswer(identifiers)}
60
+ $$`);
61
+ };
62
+ const getSequenceGeometricLimitQuestion = () => {
63
+ const sequence = GeometricSequenceConstructor.randomWithLimit();
64
+ const identifiers = {
65
+ reason: sequence.reason.toIdentifiers(),
66
+ firstTerm: sequence.firstTerm.toIdentifiers(),
67
+ };
68
+ return getQuestionFromIdentifiers(identifiers);
69
+ };
70
+ const getQuestionFromIdentifiers = (identifiers) => {
71
+ const question = {
72
+ answer: getAnswer(identifiers),
73
+ instruction: getInstruction(identifiers),
74
+ keys: ["infty"],
75
+ answerFormat: "tex",
76
+ identifiers,
77
+ hint: getHint(identifiers),
78
+ correction: getCorrection(identifiers),
79
+ };
80
+ return question;
81
+ };
82
+ const getPropositions = (n, { answer, reason, firstTerm }) => {
83
+ const propositions = [];
84
+ addValidProp(propositions, answer);
85
+ tryToAddWrongProp(propositions, "+\\infty");
86
+ tryToAddWrongProp(propositions, "-\\infty");
87
+ tryToAddWrongProp(propositions, "0");
88
+ tryToAddWrongProp(propositions, reifyAlgebraic(reason).toTex());
89
+ tryToAddWrongProp(propositions, reifyAlgebraic(firstTerm).toTex());
90
+ return shuffleProps(propositions, n);
91
+ };
92
+ const isAnswerValid = (ans, { answer }) => {
93
+ return ans === answer;
94
+ };
95
+ export const sequenceGeometricLimit = {
96
+ id: "sequenceGeometricLimit",
97
+ connector: "=",
98
+ label: "Limite d'une suite géométrique",
99
+ isSingleStep: true,
100
+ generator: (nb) => getDistinctQuestions(getSequenceGeometricLimitQuestion, nb),
101
+ qcmTimer: 60,
102
+ freeTimer: 60,
103
+ getPropositions,
104
+ isAnswerValid,
105
+ subject: "Mathématiques",
106
+ getAnswer,
107
+ getInstruction,
108
+ getQuestionFromIdentifiers,
109
+ hasHintAndCorrection: true,
110
+ };
@@ -0,0 +1,7 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ type Identifiers = {
3
+ coeffs: number[];
4
+ };
5
+ export declare const sequencePolynomLimit: Exercise<Identifiers>;
6
+ export {};
7
+ //# sourceMappingURL=sequencePolynomLimit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sequencePolynomLimit.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/limits/sequences/sequencePolynomLimit.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAcrC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AA2GF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CActD,CAAC"}