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,194 @@
1
+ import { addValidProp, shuffleProps, propWhile, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { numberVEA } from "../../../../exercises/vea/numberVEA.js";
4
+ import { Polynomial } from "../../../../math/polynomials/polynomial.js";
5
+ import { randfloat } from "../../../../math/utils/random/randfloat.js";
6
+ import { randint } from "../../../../math/utils/random/randint.js";
7
+ import { randTupleInt } from "../../../../math/utils/random/randTupleInt.js";
8
+ import { round } from "../../../../math/utils/round.js";
9
+ import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
10
+ const getPropositions = (n, { answer, xValues }) => {
11
+ const propositions = [];
12
+ addValidProp(propositions, answer);
13
+ propWhile(propositions, n, () => {
14
+ tryToAddWrongProp(propositions, randfloat(xValues[0], xValues[1], 2).frenchify());
15
+ });
16
+ return shuffleProps(propositions, n);
17
+ };
18
+ const getTable = (identifiers) => {
19
+ const { xValues, coeffs } = identifiers;
20
+ const poly = new Polynomial(coeffs).toTree();
21
+ const [fa, fb] = xValues.map((x) => poly.evaluate({ x }));
22
+ const isFirstAscending = fb < fa;
23
+ const arrows = isFirstAscending
24
+ ? ["\\nearrow", "0\\searrow", "\\nearrow"]
25
+ : ["\\searrow", "0\\nearrow", "\\searrow"];
26
+ const yStart = coeffs[3] > 0 ? "-\\infty" : "+\\infty";
27
+ const yEnd = coeffs[3] > 0 ? "+\\infty" : "-\\infty";
28
+ return [
29
+ [
30
+ "£x£",
31
+ "-\\infty",
32
+ "\\ ",
33
+ xValues[0].frenchify(),
34
+ "\\alpha",
35
+ xValues[1].frenchify(),
36
+ "\\ ",
37
+ "+\\infty",
38
+ ],
39
+ [
40
+ " ",
41
+ isFirstAscending ? "\\ " : yStart,
42
+ "\\ ",
43
+ isFirstAscending ? fa.frenchify() : "\\ ",
44
+ "\\ ",
45
+ isFirstAscending ? "\\ " : fb.frenchify(),
46
+ "\\ ",
47
+ isFirstAscending ? yEnd : "\\ ",
48
+ ],
49
+ ["£f(x)£", "\\ ", arrows[0], "\\ ", arrows[1], "\\ ", arrows[2], "\\ "],
50
+ [
51
+ " ",
52
+ !isFirstAscending ? "\\ " : yStart,
53
+ "\\ ",
54
+ !isFirstAscending ? fa.frenchify() : "\\ ",
55
+ "\\ ",
56
+ !isFirstAscending ? "\\ " : fb.frenchify(),
57
+ "\\ ",
58
+ !isFirstAscending ? yEnd : "\\ ",
59
+ ],
60
+ ];
61
+ };
62
+ const getAnswer = (identifiers) => {
63
+ //on pourrait utiliser Cardano mais n'est-ce pas plus approprié de raisonner comme un élève
64
+ const { xValues, coeffs } = identifiers;
65
+ const poly = new Polynomial(coeffs).toTree();
66
+ //ya une dichotomie bcp plus opti j'imagine mais osef je pense
67
+ let xStart = xValues[0];
68
+ let xEnd = xValues[0] + 0.1;
69
+ let foundOpposite = false;
70
+ let counter = 0;
71
+ while (!foundOpposite) {
72
+ counter++;
73
+ if (counter > 10000)
74
+ throw new Error("too many iterations");
75
+ const fStart = poly.evaluate({ x: xStart });
76
+ const fEnd = poly.evaluate({ x: xEnd });
77
+ if (fStart * fEnd < 0)
78
+ foundOpposite = true;
79
+ else {
80
+ xEnd = xEnd + 0.1;
81
+ xStart = xStart + 0.1;
82
+ }
83
+ }
84
+ xEnd = xStart + 0.01;
85
+ let foundOpposite2 = false;
86
+ counter = 0;
87
+ while (!foundOpposite2) {
88
+ counter++;
89
+ if (counter > 10000)
90
+ throw new Error("too many iterations 2");
91
+ const fStart = poly.evaluate({ x: xStart });
92
+ const fEnd = poly.evaluate({ x: xEnd });
93
+ if (fStart * fEnd < 0)
94
+ foundOpposite2 = true;
95
+ else {
96
+ xEnd = xEnd + 0.01;
97
+ xStart = xStart + 0.01;
98
+ }
99
+ }
100
+ return round((xStart + xEnd) / 2, 2).frenchify();
101
+ };
102
+ const getInstruction = (identifiers) => {
103
+ const { coeffs } = identifiers;
104
+ const poly = new Polynomial(coeffs);
105
+ return `Soit $f$ la fonction définie par :
106
+
107
+ $$
108
+ f(x) = ${poly.toTree().toTex()}
109
+ $$
110
+
111
+ Le tableau de variations de $f$ est le suivant :
112
+
113
+ <svg id="varTable">${JSON.stringify(getTable(identifiers))}</svg>
114
+
115
+ Donner une valeur approchée au centième de $\\alpha$.`;
116
+ };
117
+ const getHint = () => {
118
+ return `Utilise le menu TABLE de la calculatrice. En réduisant peu à peu le pas, tu peux obtenir une valeur approchée au centième de $\\alpha$.`;
119
+ };
120
+ const getCorrection = (identifiers) => {
121
+ const { xValues } = identifiers;
122
+ return `D'après le tableau de variations, on sait que $\\alpha$ est compris entre $${xValues[0].frenchify()}$ et $${xValues[1].frenchify()}$.
123
+
124
+ On utilise alors la calculatrice et le menu TABLE. On entre l'expression de la fonction, puis on entre un pas de $0,1$ allant de $${xValues[0].frenchify()}$ à $${xValues[1].frenchify()}$.
125
+
126
+ Dès qu'on voit que les valeurs de $f(x)$ changent de signe, on diminue le pas à $0.01$ et on recommence.
127
+
128
+ On détermine alors qu'une valeur approchée de $\\alpha$ est $${getAnswer(identifiers)}$.
129
+ `;
130
+ };
131
+ const getKeys = () => {
132
+ return [];
133
+ };
134
+ const isAnswerValid = (ans, { answer }) => {
135
+ try {
136
+ return numberVEA(ans, answer, undefined, 0.01);
137
+ }
138
+ catch (err) {
139
+ return handleVEAError(err);
140
+ }
141
+ };
142
+ const getThirdDegreeZeroesFramingWithCalculatorQuestion = () => {
143
+ let A, a, b, k, d;
144
+ do {
145
+ A = randint(-10, 11);
146
+ [a, b] = randTupleInt(2, {
147
+ from: -10,
148
+ to: 11,
149
+ allDifferent: true,
150
+ sorted: true,
151
+ });
152
+ k = randint(-10, 11, [0]);
153
+ d = b - a;
154
+ } while (A * (A + k * (b - a) ** 3) >= 0);
155
+ const identifiers = {
156
+ coeffs: [
157
+ A + k * a ** 2 * (2 * a + 3 * d),
158
+ -6 * k * a * (a + d),
159
+ 3 * k * (2 * a + d),
160
+ -2 * k,
161
+ ],
162
+ xValues: [a, b],
163
+ };
164
+ return getQuestionFromIdentifiers(identifiers);
165
+ };
166
+ const getQuestionFromIdentifiers = (identifiers) => {
167
+ return {
168
+ answer: getAnswer(identifiers),
169
+ instruction: getInstruction(identifiers),
170
+ keys: getKeys(identifiers),
171
+ answerFormat: "tex",
172
+ identifiers,
173
+ hint: getHint(identifiers),
174
+ correction: getCorrection(identifiers),
175
+ };
176
+ };
177
+ export const thirdDegreeZeroesFramingWithCalculator = {
178
+ id: "thirdDegreeZeroesFramingWithCalculator",
179
+ connector: "=",
180
+ label: "Donner un encadrement de la solution de $f(x) = 0$ à l'aide de la calculatrice.",
181
+ isSingleStep: true,
182
+ generator: (nb, opts) => getDistinctQuestions(() => getThirdDegreeZeroesFramingWithCalculatorQuestion(opts), nb),
183
+ qcmTimer: 60,
184
+ freeTimer: 60,
185
+ getPropositions,
186
+ isAnswerValid,
187
+ subject: "Mathématiques",
188
+ getInstruction,
189
+ getHint,
190
+ getCorrection,
191
+ getAnswer,
192
+ getQuestionFromIdentifiers,
193
+ hasHintAndCorrection: true,
194
+ };
@@ -17,4 +17,5 @@ export * from "./inverse/index.js";
17
17
  export * from "./composition/index.js";
18
18
  export * from "./linear/index.js";
19
19
  export * from "./periodicity/index.js";
20
+ export * from "./continuity/index.js";
20
21
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/functions/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/functions/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC"}
@@ -17,3 +17,4 @@ export * from "./inverse/index.js";
17
17
  export * from "./composition/index.js";
18
18
  export * from "./linear/index.js";
19
19
  export * from "./periodicity/index.js";
20
+ export * from "./continuity/index.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/variations/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC;AACvC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/variations/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC;AACvC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AAExC,cAAc,gBAAgB,CAAC"}
@@ -6,4 +6,5 @@ export * from "./varTableFromSentences.js";
6
6
  export * from "./readVarOnGraph.js";
7
7
  export * from "./readVarOnGraph2.js";
8
8
  export * from "./readExtremaOnGraph.js";
9
+ // export * from "./varTableWithExtremumTestExercise.js";
9
10
  export * from "./exp/index.js";
@@ -0,0 +1,9 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ type Identifiers = {
3
+ type: number;
4
+ coeffs: number[];
5
+ initTable: string[][];
6
+ };
7
+ export declare const varTableWithExtremumTestExercise: Exercise<Identifiers>;
8
+ export {};
9
+ //# sourceMappingURL=varTableWithExtremumTestExercise.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"varTableWithExtremumTestExercise.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/variations/varTableWithExtremumTestExercise.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAUT,MAAM,6BAA6B,CAAC;AAWrC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,SAAS,EAAE,MAAM,EAAE,EAAE,CAAC;CACvB,CAAC;AA2KF,eAAO,MAAM,gCAAgC,EAAE,QAAQ,CAAC,WAAW,CAmBlE,CAAC"}
@@ -0,0 +1,183 @@
1
+ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
2
+ import { varTableVEA } from "../../../../exercises/vea/varTableVEA.js";
3
+ import { GeogebraConstructor } from "../../../../geogebra/geogebraConstructor.js";
4
+ import { Polynomial } from "../../../../math/polynomials/polynomial.js";
5
+ import { randint } from "../../../../math/utils/random/randint.js";
6
+ import { coinFlip } from "../../../../utils/alea/coinFlip.js";
7
+ import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
8
+ const getRoots = (identifiers) => {
9
+ const { coeffs } = identifiers;
10
+ const [_d, c, b, a] = coeffs;
11
+ const sqrtDelta = 2 * Math.sqrt(b ** 2 - 3 * a * c);
12
+ const x1 = (-2 * b - sqrtDelta) / (6 * a);
13
+ const x2 = (-2 * b + sqrtDelta) / (6 * a);
14
+ return [x1, x2].sort((a, b) => a - b);
15
+ };
16
+ const getGGBOptions = (identifiers) => {
17
+ const { coeffs } = identifiers;
18
+ const poly = new Polynomial(coeffs);
19
+ const commands = [`f(x) =${poly.toMathString()}`];
20
+ const ggb = new GeogebraConstructor({
21
+ commands,
22
+ lockedAxesRatio: false,
23
+ });
24
+ const [x1, x2] = getRoots(identifiers);
25
+ const fx1 = poly.calculate(x1);
26
+ const fx2 = poly.calculate(x2);
27
+ return ggb.getOptions({
28
+ coords: ggb.getAdaptedCoords({
29
+ xMin: x1 - 2,
30
+ xMax: x2 + 2,
31
+ yMin: Math.min(fx1, fx2) - 2,
32
+ yMax: Math.max(fx1, fx2) + 2,
33
+ }),
34
+ });
35
+ };
36
+ const getAnswerTable = (identifiers) => {
37
+ const { coeffs } = identifiers;
38
+ const [_d, _c, _b, a] = coeffs;
39
+ const poly = new Polynomial(coeffs);
40
+ const [x1, x2] = getRoots(identifiers);
41
+ const fx1 = poly.calculate(x1);
42
+ const fx2 = poly.calculate(x2);
43
+ const vars = coeffs[3] > 0
44
+ ? ["0\\nearrow", "\\searrow", "\\nearrow"]
45
+ : ["\\searrow", "\\0nearrow", "\\searrow"];
46
+ return [
47
+ [
48
+ "$x$",
49
+ "-\\infty",
50
+ "\\ ",
51
+ x1.toTree().toTex(),
52
+ "\\ ",
53
+ x2.toTree().toTex(),
54
+ "\\ ",
55
+ "+\\infty",
56
+ ],
57
+ [
58
+ "$\\ $",
59
+ "\\ ",
60
+ "\\ ",
61
+ a > 0 ? fx1.toTree().toTex() : "\\ ",
62
+ "\\ ",
63
+ a > 0 ? "\\ " : fx2.toTree().toTex(),
64
+ "\\ ",
65
+ "\\ ",
66
+ ],
67
+ ["$f(x)$", "\\ ", vars[0], "\\ ", vars[1], "\\ ", vars[2], "\\ "],
68
+ [
69
+ "$\\ $",
70
+ "\\ ",
71
+ "\\ ",
72
+ a > 0 ? "\\ " : fx1.toTree().toTex(),
73
+ "\\ ",
74
+ a > 0 ? fx2.toTree().toTex() : "\\ ",
75
+ "\\ ",
76
+ "\\ ",
77
+ ],
78
+ ];
79
+ };
80
+ const getInstruction = () => {
81
+ return `Dresser le tableau de variations de la fonction $f$ définie sur $\\mathbb{R}$ dont la courbe représentative est donnée ci-dessous :`;
82
+ };
83
+ const getHint = () => {
84
+ return `La fonction est définie sur $\\mathbb{R}$, donc les valeurs de $x$ vont de $-\\infty$ à $+\\infty$.
85
+
86
+ Repère ensuite les points de la courbe auxquels le sens de variation change. Dans la première ligne du tableau, il faut mettre les abscisses de ces points, et dans la deuxième ligne, les ordonnées.`;
87
+ };
88
+ const getCorrection = (identifiers) => {
89
+ const { coeffs } = identifiers;
90
+ const [_d, _c, _b, a] = coeffs;
91
+ const poly = new Polynomial(coeffs);
92
+ const [x1, x2] = getRoots(identifiers);
93
+ const fx1 = poly.calculate(x1);
94
+ const fx2 = poly.calculate(x2);
95
+ const words = a > 0
96
+ ? ["croissante", "décroissante", "croissante"]
97
+ : ["décroissante", "croissante", "décroissante"];
98
+ return `D'après le graphique, la fonction $f$ est ${words[0]} sur $]-\\infty; ${x1}]$, puis ${words[1]} sur $[${x1}; ${x2}]$, puis ${words[2]} sur $[${x2}; +\\infty[$.
99
+
100
+ De plus, on lit graphiquement que l'image de $${x1}$ est $${fx1}$, et celle de $${x2}$ est $${fx2}$.
101
+
102
+
103
+ `;
104
+ };
105
+ const getKeys = () => {
106
+ return ["infty"];
107
+ };
108
+ const isAnswerTableValid = (ans, { answerTable }) => {
109
+ try {
110
+ return varTableVEA(ans, answerTable);
111
+ }
112
+ catch (err) {
113
+ return handleVEAError(err);
114
+ }
115
+ };
116
+ // const lists = [
117
+ // "x^3 - 3x",
118
+ // "x^3 -6x^2 + 9x",
119
+ // "-x^3 + 3x^2 + 9x",
120
+ // "2x^3 - 9x^2 + 12x",
121
+ // "-x^3+6x^2-9x",
122
+ // "4x^3 -24x^2 + 36x",
123
+ // ];
124
+ const poly3Coeffs = [
125
+ [0, -3, 0, 1],
126
+ [0, 9, -6, 1],
127
+ // [0, 9, 3, -1],
128
+ [0, 12, -9, 2],
129
+ [0, -9, 6, -1],
130
+ // [0, 36, -24, 4],
131
+ ];
132
+ const getTestSignTableQuestion = () => {
133
+ const index = randint(0, 4);
134
+ const coeffs = coinFlip()
135
+ ? poly3Coeffs[index]
136
+ : poly3Coeffs[index].map((x) => -x);
137
+ const initTable = [
138
+ ["$x$", "", "\\ ", "", "\\ ", "", "\\ ", ""],
139
+ ["$\\ $", "\\ ", "\\ ", "\\ ", "\\ ", "\\ ", "\\ ", "\\ "],
140
+ ["$f(x)$", "\\ ", "", "", "", "", "", "\\ "],
141
+ ["$\\ $", "\\ ", "\\ ", "\\ ", "\\ ", "\\ ", "\\ ", "\\ "],
142
+ ];
143
+ const identifiers = {
144
+ type: 0,
145
+ coeffs: [coeffs[0] + randint(-10, 10), ...coeffs.slice(1)],
146
+ initTable,
147
+ };
148
+ return getQuestionFromIdentifiers(identifiers);
149
+ };
150
+ const getQuestionFromIdentifiers = (identifiers) => {
151
+ return {
152
+ answerTable: getAnswerTable(identifiers),
153
+ instruction: getInstruction(identifiers),
154
+ keys: getKeys(identifiers),
155
+ answerFormat: "tex",
156
+ identifiers,
157
+ hint: getHint(identifiers),
158
+ correction: getCorrection(identifiers),
159
+ initTable: identifiers.initTable,
160
+ ggbOptions: getGGBOptions(identifiers),
161
+ varTableOptions: {
162
+ includeArrowWithZero: true,
163
+ },
164
+ };
165
+ };
166
+ export const varTableWithExtremumTestExercise = {
167
+ id: "varTableWithExtremumTestExercise",
168
+ label: "Dresser le tableau de variations d'une fonction à partir de sa représentation graphique",
169
+ isSingleStep: true,
170
+ generator: (nb, opts) => getDistinctQuestions(() => getTestSignTableQuestion(opts), nb),
171
+ qcmTimer: 60,
172
+ freeTimer: 60,
173
+ isAnswerTableValid,
174
+ subject: "Mathématiques",
175
+ getInstruction,
176
+ getHint,
177
+ getCorrection,
178
+ getAnswerTable,
179
+ getQuestionFromIdentifiers,
180
+ hasHintAndCorrection: true,
181
+ answerType: "varTable",
182
+ hasGeogebra: true,
183
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"anglesUsingIsParallel.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/angles/anglesUsingIsParallel.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAmBT,MAAM,6BAA6B,CAAC;AAIrC,OAAO,EAGL,eAAe,EAChB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAGL,gBAAgB,EACjB,MAAM,8BAA8B,CAAC;AAuItC,KAAK,eAAe,GAAG;IACrB,MAAM,EAAE,gBAAgB,CAAC;IACzB,KAAK,EAAE,eAAe,CAAC;IACvB,KAAK,EAAE,eAAe,CAAC;CACxB,CAAC;AA6HF,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EACL,mBAAmB,GACnB,gBAAgB,GAChB,mBAAmB,GACnB,QAAQ,CAAC;IAGb,kBAAkB,EAAE,eAAe,EAAE,CAAC;IACtC,aAAa,EAAE,MAAM,EAAE,CAAC;IAGxB,gBAAgB,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;CACxC,CAAC;AAwMF,KAAK,OAAO,GAAG;IACb,UAAU,EAAE,CACR,mBAAmB,GACnB,gBAAgB,GAChB,mBAAmB,GACnB,QAAQ,CACX,EAAE,CAAC;IACJ,aAAa,EAAE,OAAO,CAAC;IACvB,QAAQ,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;CAC3B,CAAC;AAsNF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAkBhE,CAAC"}
1
+ {"version":3,"file":"anglesUsingIsParallel.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/angles/anglesUsingIsParallel.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAmBT,MAAM,6BAA6B,CAAC;AAIrC,OAAO,EAGL,eAAe,EAChB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAGL,gBAAgB,EACjB,MAAM,8BAA8B,CAAC;AAoMtC,KAAK,eAAe,GAAG;IACrB,MAAM,EAAE,gBAAgB,CAAC;IACzB,KAAK,EAAE,eAAe,CAAC;IACvB,KAAK,EAAE,eAAe,CAAC;CACxB,CAAC;AA6HF,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EACL,mBAAmB,GACnB,gBAAgB,GAChB,mBAAmB,GACnB,QAAQ,CAAC;IAGb,kBAAkB,EAAE,eAAe,EAAE,CAAC;IACtC,aAAa,EAAE,MAAM,EAAE,CAAC;IAGxB,gBAAgB,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;CACxC,CAAC;AAweF,KAAK,OAAO,GAAG;IACb,UAAU,EAAE,CACR,mBAAmB,GACnB,gBAAgB,GAChB,mBAAmB,GACnB,QAAQ,CACX,EAAE,CAAC;IACJ,aAAa,EAAE,OAAO,CAAC;IACvB,QAAQ,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;CAC3B,CAAC;AAqCF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAiBhE,CAAC"}