math-exercises 3.0.180 → 3.0.182

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 (72) hide show
  1. package/lib/exercises/math/derivation/applications/index.d.ts +3 -0
  2. package/lib/exercises/math/derivation/applications/index.d.ts.map +1 -0
  3. package/lib/exercises/math/derivation/applications/index.js +2 -0
  4. package/lib/exercises/math/derivation/applications/maxBenefice.d.ts +11 -0
  5. package/lib/exercises/math/derivation/applications/maxBenefice.d.ts.map +1 -0
  6. package/lib/exercises/math/derivation/applications/maxBenefice.js +184 -0
  7. package/lib/exercises/math/derivation/applications/minimalCost.d.ts +11 -0
  8. package/lib/exercises/math/derivation/applications/minimalCost.d.ts.map +1 -0
  9. package/lib/exercises/math/derivation/applications/minimalCost.js +181 -0
  10. package/lib/exercises/math/derivation/index.d.ts +1 -0
  11. package/lib/exercises/math/derivation/index.d.ts.map +1 -1
  12. package/lib/exercises/math/derivation/index.js +1 -0
  13. package/lib/exercises/math/derivation/tangent/horizontalTangentFromAlgebraic.d.ts.map +1 -1
  14. package/lib/exercises/math/derivation/tangent/horizontalTangentFromAlgebraic.js +8 -4
  15. package/lib/exercises/math/functions/composition/functionComposition.d.ts.map +1 -1
  16. package/lib/exercises/math/functions/composition/functionComposition.js +20 -15
  17. package/lib/exercises/math/functions/exponential/algebraic/index.d.ts +0 -1
  18. package/lib/exercises/math/functions/exponential/algebraic/index.d.ts.map +1 -1
  19. package/lib/exercises/math/functions/exponential/algebraic/index.js +1 -1
  20. package/lib/exercises/math/probaStat/independancy/independancyFromEffectifTable.d.ts +10 -0
  21. package/lib/exercises/math/probaStat/independancy/independancyFromEffectifTable.d.ts.map +1 -0
  22. package/lib/exercises/math/probaStat/independancy/independancyFromEffectifTable.js +154 -0
  23. package/lib/exercises/math/probaStat/independancy/independancyFromProbaTree.d.ts +10 -0
  24. package/lib/exercises/math/probaStat/independancy/independancyFromProbaTree.d.ts.map +1 -0
  25. package/lib/exercises/math/probaStat/independancy/independancyFromProbaTree.js +152 -0
  26. package/lib/exercises/math/probaStat/independancy/index.d.ts +2 -0
  27. package/lib/exercises/math/probaStat/independancy/index.d.ts.map +1 -1
  28. package/lib/exercises/math/probaStat/independancy/index.js +2 -0
  29. package/lib/exercises/math/probaStat/trees/index.d.ts +4 -1
  30. package/lib/exercises/math/probaStat/trees/index.d.ts.map +1 -1
  31. package/lib/exercises/math/probaStat/trees/index.js +4 -8
  32. package/lib/exercises/math/probaStat/trees/probaTreeSituationTotalProbaFormula.d.ts +6 -0
  33. package/lib/exercises/math/probaStat/trees/probaTreeSituationTotalProbaFormula.d.ts.map +1 -1
  34. package/lib/exercises/math/probaStat/trees/probaTreeSituationTotalProbaFormula.js +125 -80
  35. package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindRecurrenceFormulaFromSituation.d.ts.map +1 -1
  36. package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindRecurrenceFormulaFromSituation.js +0 -4
  37. package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFromTwoConsecutiveTerms.d.ts.map +1 -1
  38. package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFromTwoConsecutiveTerms.js +38 -26
  39. package/lib/exercises/math/sequences/geometric/index.d.ts +0 -3
  40. package/lib/exercises/math/sequences/geometric/index.d.ts.map +1 -1
  41. package/lib/exercises/math/sequences/geometric/index.js +3 -3
  42. package/lib/exercises/math/sequences/geometric/situations/geometricFindExplicitFormulaFromSituation.js +1 -1
  43. package/lib/exercises/math/sequences/geometric/situations/index.d.ts +0 -1
  44. package/lib/exercises/math/sequences/geometric/situations/index.d.ts.map +1 -1
  45. package/lib/exercises/math/sequences/geometric/situations/index.js +1 -1
  46. package/lib/exercises/math/sequences/index.d.ts +1 -1
  47. package/lib/exercises/math/sequences/index.d.ts.map +1 -1
  48. package/lib/exercises/math/sequences/index.js +1 -2
  49. package/lib/exercises/math/sequences/limits/index.d.ts +2 -1
  50. package/lib/exercises/math/sequences/limits/index.d.ts.map +1 -1
  51. package/lib/exercises/math/sequences/limits/index.js +2 -2
  52. package/lib/exercises/math/sequences/limits/readSequenceConvergencyType.d.ts +9 -0
  53. package/lib/exercises/math/sequences/limits/readSequenceConvergencyType.d.ts.map +1 -0
  54. package/lib/exercises/math/sequences/limits/readSequenceConvergencyType.js +256 -0
  55. package/lib/exercises/math/sequences/limits/sequenceLimitReading.d.ts +7 -0
  56. package/lib/exercises/math/sequences/limits/sequenceLimitReading.d.ts.map +1 -1
  57. package/lib/exercises/math/sequences/limits/sequenceLimitReading.js +232 -163
  58. package/lib/exercises/math/sequences/variations/genericSequenceVariations.d.ts +7 -0
  59. package/lib/exercises/math/sequences/variations/genericSequenceVariations.d.ts.map +1 -0
  60. package/lib/exercises/math/sequences/variations/genericSequenceVariations.js +122 -0
  61. package/lib/exercises/math/sequences/variations/index.d.ts +2 -0
  62. package/lib/exercises/math/sequences/variations/index.d.ts.map +1 -1
  63. package/lib/exercises/math/sequences/variations/index.js +2 -0
  64. package/lib/exercises/math/sequences/variations/sequenceVariationFromTermsDifference.d.ts +9 -0
  65. package/lib/exercises/math/sequences/variations/sequenceVariationFromTermsDifference.d.ts.map +1 -0
  66. package/lib/exercises/math/sequences/variations/sequenceVariationFromTermsDifference.js +155 -0
  67. package/lib/index.d.ts +47 -39
  68. package/lib/index.d.ts.map +1 -1
  69. package/lib/tests/singleExo.test.js +2 -2
  70. package/lib/tree/parsers/rationalParser.d.ts.map +1 -1
  71. package/lib/tree/parsers/rationalParser.js +7 -1
  72. package/package.json +1 -1
@@ -4,7 +4,7 @@ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQue
4
4
  import { randfloat } from "../../../../math/utils/random/randfloat.js";
5
5
  import { randint } from "../../../../math/utils/random/randint.js";
6
6
  import { round } from "../../../../math/utils/round.js";
7
- import { EqualNode, isEqualNode, } from "../../../../tree/nodes/equations/equalNode.js";
7
+ import { EqualNode } from "../../../../tree/nodes/equations/equalNode.js";
8
8
  import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
9
9
  import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
10
10
  import { power } from "../../../../tree/nodes/operators/powerNode.js";
@@ -122,34 +122,46 @@ const getPropositions = (n, { answer, ..._identifiers }, optsIn) => {
122
122
  });
123
123
  return shuffle(propositions);
124
124
  };
125
- const isAnswerValid = (ans, { answer, ...identifiers }, optsIn) => {
126
- const opts = optsIn ?? optsDefault;
125
+ const isAnswerValid = (ans, { answer }) => {
127
126
  try {
128
127
  //TODO faire fonctionner parseAlgebraic("u_n=3+2n") (token _ not implemented)
129
- const nodeAnswer = getAnswerStuff(identifiers, opts).answerNode;
130
- if (!ans.includes("=")) {
131
- // return false;
132
- ans = nodeAnswer.leftChild.toTex() + "=" + ans;
133
- }
134
- // const nodeAns = parseAlgebraic(ans);
135
- const nodeAns = (() => {
136
- const [lhs, rhs] = ans.split("=");
137
- const nodeLhs = lhs.toTree();
138
- const nodeRhs = parseAlgebraic(rhs);
139
- return new EqualNode(nodeLhs, nodeRhs);
140
- })();
141
- if (!isEqualNode(nodeAns)) {
128
+ const splitted = ans.split("=");
129
+ const studentAns = splitted[1] ?? ans;
130
+ const parsed = parseAlgebraic(studentAns);
131
+ if (!parsed)
142
132
  return false;
143
- }
144
- const isValidLhs = () => nodeAns.leftChild.toTex() === nodeAnswer.leftChild.toTex();
145
- const isValidRhs = () => {
146
- const nodeAnsRhs = nodeAns.rightChild;
147
- const nodeAnswerRhs = nodeAnswer.rightChild;
148
- return [0, 1, 2, 10].every((n) => {
149
- return (substract(nodeAnsRhs.evaluate({ n }), nodeAnswerRhs.evaluate({ n })).evaluate() === 0);
150
- });
151
- };
152
- return isValidLhs() && isValidRhs();
133
+ return parsed.simplify().toTex() === answer.split("=")[1];
134
+ //!ROBIN : tout commenté car ne passent pas les tests
135
+ // const nodeAnswer = getAnswerStuff(identifiers, opts).answerNode;
136
+ // if (!ans.includes("=")) {
137
+ // // return false;
138
+ // ans = nodeAnswer.leftChild.toTex() + "=" + ans;
139
+ // }
140
+ // // const nodeAns = parseAlgebraic(ans);
141
+ // const nodeAns = (() => {
142
+ // const [lhs, rhs] = ans.split("=");
143
+ // const nodeLhs = lhs.toTree();
144
+ // const nodeRhs = parseAlgebraic(rhs);
145
+ // return new EqualNode(nodeLhs, nodeRhs);
146
+ // })();
147
+ // if (!isEqualNode(nodeAns)) {
148
+ // return false;
149
+ // }
150
+ // const isValidLhs = () =>
151
+ // nodeAns.leftChild.toTex() === nodeAnswer.leftChild.toTex();
152
+ // const isValidRhs = () => {
153
+ // const nodeAnsRhs = nodeAns.rightChild;
154
+ // const nodeAnswerRhs = nodeAnswer.rightChild;
155
+ // return [0, 1, 2].every((n) => {
156
+ // return (
157
+ // substract(
158
+ // nodeAnsRhs.evaluate({ n }),
159
+ // nodeAnswerRhs.evaluate({ n }),
160
+ // ).evaluate() === 0
161
+ // );
162
+ // });
163
+ // };
164
+ // return isValidLhs() && isValidRhs();
153
165
  }
154
166
  catch (e) {
155
167
  handleVEAError(e);
@@ -9,10 +9,7 @@ export * from "./geometricFindTerm.js";
9
9
  export * from "./geometricFindTermFirstRankOne.js";
10
10
  export * from "./geometricRecognizeReasonFromFirstTerms.js";
11
11
  export * from "./geometricVariations.js";
12
- export * from "./geometricFindExplicitFormulaFromTwoTerms.js";
13
- export * from "./geometricFindExplicitFormulaFromTwoConsecutiveTerms.js";
14
12
  export * from "./geometricFindRandomTermFromTwoTerms.js";
15
- export * from "./geometricFindRandomTermFromTwoConsecutiveTerms.js";
16
13
  export * from "./sum/index.js";
17
14
  export * from "./situations/index.js";
18
15
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/geometric/index.ts"],"names":[],"mappings":"AAAA,cAAc,oCAAoC,CAAC;AACnD,cAAc,mCAAmC,CAAC;AAClD,cAAc,+CAA+C,CAAC;AAE9D,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,sCAAsC,CAAC;AACrD,cAAc,kDAAkD,CAAC;AACjE,cAAc,wBAAwB,CAAC;AACvC,cAAc,oCAAoC,CAAC;AAEnD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,0BAA0B,CAAC;AAEzC,cAAc,+CAA+C,CAAC;AAC9D,cAAc,0DAA0D,CAAC;AACzE,cAAc,0CAA0C,CAAC;AACzD,cAAc,qDAAqD,CAAC;AAEpE,cAAc,gBAAgB,CAAC;AAE/B,cAAc,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/geometric/index.ts"],"names":[],"mappings":"AAAA,cAAc,oCAAoC,CAAC;AACnD,cAAc,mCAAmC,CAAC;AAClD,cAAc,+CAA+C,CAAC;AAE9D,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,sCAAsC,CAAC;AACrD,cAAc,kDAAkD,CAAC;AACjE,cAAc,wBAAwB,CAAC;AACvC,cAAc,oCAAoC,CAAC;AAEnD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,0BAA0B,CAAC;AAEzC,cAAc,0CAA0C,CAAC;AAEzD,cAAc,gBAAgB,CAAC;AAE/B,cAAc,uBAAuB,CAAC"}
@@ -9,9 +9,9 @@ export * from "./geometricFindTerm.js";
9
9
  export * from "./geometricFindTermFirstRankOne.js";
10
10
  export * from "./geometricRecognizeReasonFromFirstTerms.js";
11
11
  export * from "./geometricVariations.js";
12
- export * from "./geometricFindExplicitFormulaFromTwoTerms.js";
13
- export * from "./geometricFindExplicitFormulaFromTwoConsecutiveTerms.js";
14
12
  export * from "./geometricFindRandomTermFromTwoTerms.js";
15
- export * from "./geometricFindRandomTermFromTwoConsecutiveTerms.js";
16
13
  export * from "./sum/index.js";
17
14
  export * from "./situations/index.js";
15
+ // export * from "./geometricFindExplicitFormulaFromTwoTerms.js";
16
+ // export * from "./geometricFindExplicitFormulaFromTwoConsecutiveTerms.js";
17
+ // export * from "./geometricFindRandomTermFromTwoConsecutiveTerms.js";
@@ -121,7 +121,7 @@ const isAnswerValid = (ans, { answer, ...identifiers }, optsIn) => {
121
121
  const isValidRhs = () => {
122
122
  const nodeAnsRhs = nodeAns.rightChild;
123
123
  const nodeAnswerRhs = nodeAnswer.rightChild;
124
- return [0, 1, 2, 10].every((n) => {
124
+ return [0, 1, 2, 3].every((n) => {
125
125
  return (substract(nodeAnsRhs.evaluate({ n }), nodeAnswerRhs.evaluate({ n })).evaluate() === 0);
126
126
  });
127
127
  };
@@ -1,4 +1,3 @@
1
- export * from "./geometricFindExplicitFormulaFromSituation.js";
2
1
  export * from "./geometricFindRecurrenceFormulaFromSituation.js";
3
2
  export * from "./geometricFindTermFromSituation.js";
4
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/sequences/geometric/situations/index.ts"],"names":[],"mappings":"AAAA,cAAc,gDAAgD,CAAC;AAC/D,cAAc,kDAAkD,CAAC;AACjE,cAAc,qCAAqC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/sequences/geometric/situations/index.ts"],"names":[],"mappings":"AAAA,cAAc,kDAAkD,CAAC;AACjE,cAAc,qCAAqC,CAAC"}
@@ -1,5 +1,5 @@
1
- export * from "./geometricFindExplicitFormulaFromSituation.js";
2
1
  export * from "./geometricFindRecurrenceFormulaFromSituation.js";
3
2
  export * from "./geometricFindTermFromSituation.js";
4
3
  // export * from "./geometricFindRankFromSituation.js";
5
4
  // export * from "./geometricFindThresholdFromSituation.js";
5
+ // export * from "./geometricFindExplicitFormulaFromSituation.js";
@@ -1,12 +1,12 @@
1
1
  export * from "./arithmetic/index.js";
2
2
  export * from "./geometric/index.js";
3
3
  export * from "./explicitFormulaUsage.js";
4
- export * from "./genericSequenceVariations.js";
5
4
  export * from "./recurrenceFormulaUsage.js";
6
5
  export * from "./sequenceEvaluation.js";
7
6
  export * from "./sequencePlot.js";
8
7
  export * from "./graph/index.js";
9
8
  export * from "./notation/index.js";
10
9
  export * from "./seqArithmGeom/index.js";
10
+ export * from "./limits/index.js";
11
11
  export * from "./variations/index.js";
12
12
  //# 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,gCAAgC,CAAC;AAC/C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AAEzC,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"}
@@ -1,12 +1,11 @@
1
1
  export * from "./arithmetic/index.js";
2
2
  export * from "./geometric/index.js";
3
3
  export * from "./explicitFormulaUsage.js";
4
- export * from "./genericSequenceVariations.js";
5
4
  export * from "./recurrenceFormulaUsage.js";
6
5
  export * from "./sequenceEvaluation.js";
7
6
  export * from "./sequencePlot.js";
8
7
  export * from "./graph/index.js";
9
8
  export * from "./notation/index.js";
10
9
  export * from "./seqArithmGeom/index.js";
11
- // export * from "./limits/index.js";
10
+ export * from "./limits/index.js";
12
11
  export * from "./variations/index.js";
@@ -1,2 +1,3 @@
1
- export {};
1
+ export * from "./sequenceLimitReading.js";
2
+ export * from "./readSequenceConvergencyType.js";
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/limits/index.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/limits/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,kCAAkC,CAAC"}
@@ -1,2 +1,2 @@
1
- export {};
2
- // export * from "./sequenceLimitReading.js";
1
+ export * from "./sequenceLimitReading.js";
2
+ export * from "./readSequenceConvergencyType.js";
@@ -0,0 +1,9 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ import { NodeIdentifiers } from "../../../../tree/nodes/nodeConstructor.js";
3
+ type Identifiers = {
4
+ type: number;
5
+ formulaIds: NodeIdentifiers;
6
+ };
7
+ export declare const readSequenceConvergencyType: Exercise<Identifiers>;
8
+ export {};
9
+ //# sourceMappingURL=readSequenceConvergencyType.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"readSequenceConvergencyType.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/limits/readSequenceConvergencyType.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAYrC,OAAO,EACL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;AAQ7C,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,eAAe,CAAC;CAC7B,CAAC;AAoRF,eAAO,MAAM,2BAA2B,EAAE,QAAQ,CAAC,WAAW,CAsB7D,CAAC"}
@@ -0,0 +1,256 @@
1
+ import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { GeogebraConstructor } from "../../../../geogebra/geogebraConstructor.js";
4
+ import { Point } from "../../../../math/geometry/point.js";
5
+ import { AffineConstructor } from "../../../../math/polynomials/affine.js";
6
+ import { TrinomConstructor } from "../../../../math/polynomials/trinom.js";
7
+ import { randfloat } from "../../../../math/utils/random/randfloat.js";
8
+ import { randint } from "../../../../math/utils/random/randint.js";
9
+ import { round } from "../../../../math/utils/round.js";
10
+ import { cos } from "../../../../tree/nodes/functions/cosNode.js";
11
+ import { exp } from "../../../../tree/nodes/functions/expNode.js";
12
+ import { sin } from "../../../../tree/nodes/functions/sinNode.js";
13
+ import { reifyAlgebraic, } from "../../../../tree/nodes/nodeConstructor.js";
14
+ import { add } from "../../../../tree/nodes/operators/addNode.js";
15
+ import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
16
+ import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
17
+ import { power } from "../../../../tree/nodes/operators/powerNode.js";
18
+ import { coinFlip } from "../../../../utils/alea/coinFlip.js";
19
+ import { doWhile } from "../../../../utils/doWhile.js";
20
+ const getPropositions = (n, { answer }) => {
21
+ const propositions = [];
22
+ addValidProp(propositions, answer, "raw");
23
+ ["Limite finie", "Limite infinie", "Pas de limite"].forEach((prop) => {
24
+ tryToAddWrongProp(propositions, prop, "raw");
25
+ });
26
+ return shuffleProps(propositions, n);
27
+ };
28
+ const getAnswer = (identifiers) => {
29
+ return ["Limite finie", "Limite infinie", "Pas de limite"][identifiers.type];
30
+ };
31
+ const getInstruction = () => {
32
+ return `On considère une suite $u$ représentée graphiquement ci-dessous.
33
+
34
+ Conjecturer le comportement de $u$ lorsque $n$ tend vers $+\\infty$ : admet-elle une limite finie, une limite infinie, ou bien semble-t-elle ne pas avoir de limite ?`;
35
+ };
36
+ const getHint = () => {
37
+ return `Observe les termes de la suite lorsque $n$ devient très grand.
38
+
39
+ Si ces termes semblent se rapprocher autant que l'on veut d'une certaine valeur, alors on peut conjecturer que la suite admet une limite finie.
40
+
41
+ Si ces termes semblent devenir aussi grands ou aussi petits que l'on veut, alors on peut conjecturer que la suite admet une limite infinie.
42
+
43
+ Sinon, on peut conjecturer que la suite n'a pas de limite.`;
44
+ };
45
+ const getLimit = (identifiers) => {
46
+ const { formulaIds, type } = identifiers;
47
+ const formula = reifyAlgebraic(formulaIds);
48
+ switch (type) {
49
+ case 0:
50
+ default:
51
+ return round(formula.toDetailedEvaluation({ n: (10).toTree() }).evaluate(), 0);
52
+ case 1: {
53
+ const pos = formula.toDetailedEvaluation({ n: (10).toTree() }).evaluate() > 0;
54
+ return pos ? "+\\infty" : "-\\infty";
55
+ }
56
+ case 2:
57
+ return null;
58
+ }
59
+ };
60
+ const getCorrection = (identifiers) => {
61
+ const { type } = identifiers;
62
+ const limit = getLimit(identifiers);
63
+ let corr = `On observe les termes de la suite lorsque $n$ devient très grand : c'est à dire qu'on observe les ordonnées des points qui ont une abscisse très grande.
64
+
65
+ `;
66
+ switch (type) {
67
+ case 0:
68
+ corr += `Les termes semblent se rapprocher autant que l'on veut de $${limit}$. On peut donc conjecturer que la suite $u$ a une limite finie :
69
+
70
+ $$
71
+ \\lim_{n \\to +\\infty} u_{n} = ${limit}
72
+ $$`;
73
+ break;
74
+ case 1:
75
+ corr += `Les termes semblent devenir aussi ${limit === "+\\infty" ? "grands" : "petits"} que l'on veut. On peut donc conjecturer que la suite $u$ a une limite infinie :
76
+
77
+ $$
78
+ \\lim_{n \\to +\\infty} u_{n} = ${limit}
79
+ $$`;
80
+ break;
81
+ case 2:
82
+ corr += `Les termes ne semblent pas se rapprocher autant que l'on veut d'une valeur finie, ni devenir aussi grands ou aussi petits que l'on veut. On peut donc conjecturer que la suite $u$ n'a pas de limite.`;
83
+ break;
84
+ }
85
+ return corr;
86
+ };
87
+ const getGGBOptions = (identifiers) => {
88
+ const { formulaIds } = identifiers;
89
+ const formula = reifyAlgebraic(formulaIds);
90
+ console.log(formula.toTex());
91
+ const points = Array.from({ length: 50 }).map((_, index) => {
92
+ return new Point(`A_{${index}}`, index, formula.toDetailedEvaluation({ n: index.toTree() }).evaluate());
93
+ });
94
+ const yMin = Math.min(Math.min(...points.slice(0, 10).map((p) => p.y.evaluate())) - 2, -2);
95
+ const yMax = Math.max(Math.max(...points.slice(0, 10).map((p) => p.y.evaluate())) + 2, 2);
96
+ const ggb = new GeogebraConstructor({
97
+ commands: points.flatMap((point) => point.toGGBCommand({
98
+ showLabel: false,
99
+ isFixed: true,
100
+ isSelectionnable: false,
101
+ size: 3,
102
+ })),
103
+ lockedAxesRatio: false,
104
+ gridDistance: false,
105
+ });
106
+ return ggb.getOptions({
107
+ coords: [-1, 15, yMin, yMax],
108
+ });
109
+ };
110
+ const getReadSequenceConvergencyTypeQuestion = () => {
111
+ const type = randint(0, 3);
112
+ //type0 limites finies :
113
+ //1/n+k , an+b/cn+d, q^n avec q<1, exp(-kx)
114
+ //type1 limites infinie :
115
+ //affine, trinom, q^n avec q>1, exp(kx)
116
+ //
117
+ //type2 pas de limite:
118
+ //(-1)^n, trigo, anarchie totale
119
+ let formulaIds;
120
+ switch (type) {
121
+ case 0: {
122
+ const subtype = randint(0, 4);
123
+ switch (subtype) {
124
+ case 0: {
125
+ //1/(n+1)+k
126
+ const k = randint(-5, 5);
127
+ formulaIds = add(frac(1, add("n", 1)), k).toIdentifiers();
128
+ break;
129
+ }
130
+ case 1: {
131
+ //an+b/cn+d
132
+ const c = randint(-5, 5, [0]);
133
+ const a = c * randint(-5, 5, [0]);
134
+ const b = randint(-5, 5, [0]);
135
+ const d = doWhile(() => randint(-5, 5, [0]), (x) => c / a === x / b || (Math.floor(-x / c) === -x / c && -x / c > 0));
136
+ formulaIds = frac(add(multiply(a, "n"), b), add(multiply(c, "n"), d)).toIdentifiers();
137
+ break;
138
+ }
139
+ case 2: {
140
+ //aq^n q<1
141
+ const q = randfloat(0.1, 0.9, 2);
142
+ const a = randint(-5, 5, [0]);
143
+ formulaIds = multiply(a, power(q, "n")).toIdentifiers();
144
+ break;
145
+ }
146
+ case 3:
147
+ default: {
148
+ //aexp(-kx)
149
+ const k = randfloat(0.1, 0.9, 2);
150
+ const a = randint(-5, 5, [0]);
151
+ formulaIds = multiply(a, exp(multiply(-k, "n"))).toIdentifiers();
152
+ break;
153
+ }
154
+ }
155
+ break;
156
+ }
157
+ case 1: {
158
+ const subtype = randint(0, 4);
159
+ switch (subtype) {
160
+ case 0: {
161
+ //affine
162
+ const affine = AffineConstructor.random(undefined, undefined, "n").toTree();
163
+ formulaIds = affine.toIdentifiers();
164
+ break;
165
+ }
166
+ case 1: {
167
+ //trinom
168
+ const trinom = TrinomConstructor.random(undefined, undefined, undefined, "n").toTree();
169
+ formulaIds = trinom.toIdentifiers();
170
+ break;
171
+ }
172
+ case 2: {
173
+ //q^n
174
+ const q = randfloat(1.1, 1.4, 2);
175
+ const a = randint(-5, 5, [0]);
176
+ formulaIds = multiply(a, power(q, "n")).toIdentifiers();
177
+ break;
178
+ }
179
+ case 3:
180
+ default: {
181
+ //aexp(kx)
182
+ const k = randfloat(1.1, 1.4, 2);
183
+ const a = randint(-5, 5, [0]);
184
+ formulaIds = multiply(a, exp(multiply(k, "n"))).toIdentifiers();
185
+ break;
186
+ }
187
+ }
188
+ break;
189
+ }
190
+ case 2:
191
+ default: {
192
+ //(-1)^n, trigo, anarchie totale
193
+ const subtype = randint(0, 2);
194
+ switch (subtype) {
195
+ case 0: {
196
+ //a(-1)^n
197
+ const a = randint(-5, 5, [0]);
198
+ formulaIds = multiply(a, power(-1, "n")).toIdentifiers();
199
+ break;
200
+ }
201
+ case 1:
202
+ default: {
203
+ //trigo acos(bt+c)
204
+ const fct = coinFlip() ? cos : sin;
205
+ const a = randint(-5, 5, [0]);
206
+ const b = randint(-5, 5, [0]);
207
+ const c = randint(-5, 5);
208
+ formulaIds = multiply(a, fct(add(multiply(b, "n"), c))).toIdentifiers();
209
+ break;
210
+ }
211
+ // case 2: {
212
+ // //anarchie totale
213
+ // formulaIds = "n".toIdentifiers();
214
+ // break;
215
+ // }
216
+ }
217
+ break;
218
+ }
219
+ }
220
+ const identifiers = {
221
+ type,
222
+ formulaIds,
223
+ };
224
+ return getQuestionFromIdentifiers(identifiers);
225
+ };
226
+ const getQuestionFromIdentifiers = (identifiers) => {
227
+ return {
228
+ answer: getAnswer(identifiers),
229
+ instruction: getInstruction(identifiers),
230
+ keys: [],
231
+ answerFormat: "raw",
232
+ identifiers,
233
+ hint: getHint(identifiers),
234
+ correction: getCorrection(identifiers),
235
+ ggbOptions: getGGBOptions(identifiers),
236
+ };
237
+ };
238
+ export const readSequenceConvergencyType = {
239
+ id: "readSequenceConvergencyType",
240
+ label: "Conjecturer graphiquement le type de limite d'une suite",
241
+ isSingleStep: true,
242
+ generator: (nb, opts) => getDistinctQuestions(() => getReadSequenceConvergencyTypeQuestion(opts), nb),
243
+ qcmTimer: 60,
244
+ freeTimer: 60,
245
+ getPropositions,
246
+ subject: "Mathématiques",
247
+ getHint,
248
+ getCorrection,
249
+ getInstruction,
250
+ getAnswer,
251
+ getGGBOptions,
252
+ hasGeogebra: true,
253
+ getQuestionFromIdentifiers,
254
+ answerType: "QCU",
255
+ hasHintAndCorrection: true,
256
+ };
@@ -1,2 +1,9 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ import { NodeIdentifiers } from "../../../../tree/nodes/nodeConstructor.js";
3
+ type Identifiers = {
4
+ type: number;
5
+ formulaIds: NodeIdentifiers;
6
+ };
7
+ export declare const sequenceLimitReading: Exercise<Identifiers>;
1
8
  export {};
2
9
  //# sourceMappingURL=sequenceLimitReading.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sequenceLimitReading.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/limits/sequenceLimitReading.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"sequenceLimitReading.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/limits/sequenceLimitReading.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAWrC,OAAO,EACL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;AAQ7C,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,eAAe,CAAC;CAC7B,CAAC;AAsPF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAsBtD,CAAC"}