math-exercises 3.0.186 → 3.0.188

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 (79) hide show
  1. package/lib/exercises/math/derivation/derivative/exp/expDerivativeProductFExp.d.ts.map +1 -1
  2. package/lib/exercises/math/derivation/derivative/exp/expDerivativeProductFExp.js +22 -6
  3. package/lib/exercises/math/derivation/derivative/exp/expDerivativeQuotientFExp.d.ts.map +1 -1
  4. package/lib/exercises/math/derivation/derivative/exp/expDerivativeQuotientFExp.js +16 -8
  5. package/lib/exercises/math/derivation/derivativeNumber/derivativeNumberAndImageReading.d.ts +9 -0
  6. package/lib/exercises/math/derivation/derivativeNumber/derivativeNumberAndImageReading.d.ts.map +1 -0
  7. package/lib/exercises/math/derivation/derivativeNumber/derivativeNumberAndImageReading.js +155 -0
  8. package/lib/exercises/math/derivation/derivativeNumber/index.d.ts +1 -0
  9. package/lib/exercises/math/derivation/derivativeNumber/index.d.ts.map +1 -1
  10. package/lib/exercises/math/derivation/derivativeNumber/index.js +1 -0
  11. package/lib/exercises/math/derivation/problems/problemMaximizeBoxVolumeFindX.d.ts.map +1 -1
  12. package/lib/exercises/math/derivation/problems/problemMaximizeBoxVolumeFindX.js +80 -29
  13. package/lib/exercises/math/derivation/problems/problemMaximizeProfitFindProduction.d.ts.map +1 -1
  14. package/lib/exercises/math/derivation/problems/problemMaximizeProfitFindProduction.js +30 -2
  15. package/lib/exercises/math/derivation/problems/problemMovementOnLineFindSpeedAtPoint.d.ts.map +1 -1
  16. package/lib/exercises/math/derivation/problems/problemMovementOnLineFindSpeedAtPoint.js +59 -16
  17. package/lib/exercises/math/derivation/tangent/derivativeReadingByManipulatingSecant.d.ts.map +1 -1
  18. package/lib/exercises/math/derivation/tangent/derivativeReadingByManipulatingSecant.js +0 -4
  19. package/lib/exercises/math/derivation/tangent/tangentEquationFromFunctionExpression.d.ts.map +1 -1
  20. package/lib/exercises/math/derivation/tangent/tangentEquationFromFunctionExpression.js +23 -9
  21. package/lib/exercises/math/derivation/variations/findAbscissaOfExtremaFromFunctionExpression.d.ts.map +1 -1
  22. package/lib/exercises/math/derivation/variations/findAbscissaOfExtremaFromFunctionExpression.js +5 -29
  23. package/lib/exercises/math/derivation/variations/findExtremaFromFunctionExpression.d.ts.map +1 -1
  24. package/lib/exercises/math/derivation/variations/findExtremaFromFunctionExpression.js +2 -7
  25. package/lib/exercises/math/functions/basics/inverseImageFunction.js +1 -1
  26. package/lib/exercises/math/functions/sign/affineSignTable.d.ts.map +1 -1
  27. package/lib/exercises/math/functions/sign/affineSignTable.js +1 -1
  28. package/lib/exercises/math/functions/sign/equationFromSignTable.d.ts +1 -0
  29. package/lib/exercises/math/functions/sign/equationFromSignTable.d.ts.map +1 -1
  30. package/lib/exercises/math/functions/sign/equationFromSignTable.js +60 -33
  31. package/lib/exercises/math/functions/sign/partialSignTableFromGraph.d.ts +6 -4
  32. package/lib/exercises/math/functions/sign/partialSignTableFromGraph.d.ts.map +1 -1
  33. package/lib/exercises/math/functions/sign/partialSignTableFromGraph.js +160 -63
  34. package/lib/exercises/math/functions/sign/readSignTable.d.ts +4 -1
  35. package/lib/exercises/math/functions/sign/readSignTable.d.ts.map +1 -1
  36. package/lib/exercises/math/functions/sign/readSignTable.js +32 -9
  37. package/lib/exercises/math/functions/sign/signTableFromGraph.d.ts +6 -4
  38. package/lib/exercises/math/functions/sign/signTableFromGraph.d.ts.map +1 -1
  39. package/lib/exercises/math/functions/sign/signTableFromGraph.js +160 -57
  40. package/lib/exercises/math/percent/evolutions/averageEvolutionRateFromStartAndEndValue.d.ts +9 -0
  41. package/lib/exercises/math/percent/evolutions/averageEvolutionRateFromStartAndEndValue.d.ts.map +1 -0
  42. package/lib/exercises/math/percent/evolutions/averageEvolutionRateFromStartAndEndValue.js +135 -0
  43. package/lib/exercises/math/percent/evolutions/index.d.ts +1 -0
  44. package/lib/exercises/math/percent/evolutions/index.d.ts.map +1 -1
  45. package/lib/exercises/math/percent/evolutions/index.js +1 -0
  46. package/lib/exercises/math/powers/equationOnePlusTPowerN.d.ts +9 -0
  47. package/lib/exercises/math/powers/equationOnePlusTPowerN.d.ts.map +1 -0
  48. package/lib/exercises/math/powers/equationOnePlusTPowerN.js +118 -0
  49. package/lib/exercises/math/powers/estimateNthRoot.d.ts +13 -0
  50. package/lib/exercises/math/powers/estimateNthRoot.d.ts.map +1 -0
  51. package/lib/exercises/math/powers/estimateNthRoot.js +126 -0
  52. package/lib/exercises/math/powers/index.d.ts +3 -0
  53. package/lib/exercises/math/powers/index.d.ts.map +1 -1
  54. package/lib/exercises/math/powers/index.js +3 -0
  55. package/lib/exercises/math/powers/solveNthRootEquation.d.ts +9 -0
  56. package/lib/exercises/math/powers/solveNthRootEquation.d.ts.map +1 -0
  57. package/lib/exercises/math/powers/solveNthRootEquation.js +111 -0
  58. package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindRecurrenceFormulaFromSituation.d.ts.map +1 -1
  59. package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindRecurrenceFormulaFromSituation.js +2 -2
  60. package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFromTwoConsecutiveTerms.js +1 -1
  61. package/lib/exercises/math/sequences/geometric/geometricFindRandomTermFromTwoConsecutiveTerms.js +1 -1
  62. package/lib/exercises/vea/percentVEA.d.ts +6 -1
  63. package/lib/exercises/vea/percentVEA.d.ts.map +1 -1
  64. package/lib/exercises/vea/percentVEA.js +15 -1
  65. package/lib/index.d.ts +34 -9
  66. package/lib/index.d.ts.map +1 -1
  67. package/lib/math/utils/sequences/situations/seqArithmeticSituations.d.ts.map +1 -1
  68. package/lib/math/utils/sequences/situations/seqArithmeticSituations.js +5 -8
  69. package/lib/math/utils/sequences/situations/seqArithmeticUtils.d.ts +1 -1
  70. package/lib/math/utils/sequences/situations/seqArithmeticUtils.d.ts.map +1 -1
  71. package/lib/math/utils/sequences/situations/seqArithmeticUtils.js +1 -3
  72. package/lib/math/utils/sequences/situations/seqGeometricSituations.d.ts.map +1 -1
  73. package/lib/math/utils/sequences/situations/seqGeometricSituations.js +8 -10
  74. package/lib/tests/questionTest.d.ts.map +1 -1
  75. package/lib/tests/questionTest.js +8 -0
  76. package/lib/tree/nodes/sets/closure.d.ts +1 -0
  77. package/lib/tree/nodes/sets/closure.d.ts.map +1 -1
  78. package/lib/tree/nodes/sets/closure.js +12 -0
  79. package/package.json +1 -1
@@ -1,4 +1,6 @@
1
+ import { GeneratorOptionTarget, GeneratorOptionType, } from "../../../../exercises/exercise.js";
1
2
  import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { signTableVEA } from "../../../../exercises/vea/signTableVEA.js";
2
4
  import { GeogebraConstructor } from "../../../../geogebra/geogebraConstructor.js";
3
5
  import { randfloat } from "../../../../math/utils/random/randfloat.js";
4
6
  import { randint } from "../../../../math/utils/random/randint.js";
@@ -15,35 +17,73 @@ Repère ensuite les points de la courbe à l'intersection de l'axe des abscisses
15
17
  };
16
18
  const getCorrection = (identifiers) => {
17
19
  const { a, x1, x2, x3 } = identifiers;
18
- const signs = a > 0
19
- ? ["négatif", "positif", "négatif", "positif"]
20
- : ["positif", "négatif", "positif", "négatif"];
21
- return `On lit graphiquement que $f(x)$ s'annule pour les valeurs de $x$ suivantes : $${x1}$, $${x2}$ et $${x3}$.
20
+ const rootsNb = x2 === undefined ? 1 : x3 === undefined ? 2 : 3;
21
+ const signs = rootsNb === 1
22
+ ? a > 0
23
+ ? ["-", "+"]
24
+ : ["+", "-"]
25
+ : rootsNb === 2
26
+ ? a > 0
27
+ ? ["+", "-", "+"]
28
+ : ["-", "+", "-"]
29
+ : a > 0
30
+ ? ["-", "+", "-", "+"]
31
+ : ["+", "-", "+", "-"];
32
+ const signWords = signs.map((e) => (e === "-" ? "négatif" : "positif"));
33
+ return rootsNb === 1
34
+ ? `On lit graphiquement que $f(x)$ s'annule pour $x$ valant $${x1}$.
22
35
 
23
- De plus, $f(x)$ est ${signs[0]} pour $x \\in ]-\\infty;${x1}]$, puis ${signs[1]} pour $x \\in [${x1}, ${x2}]$, puis ${signs[2]} pour $x \\in [${x2}, ${x3}]$, et enfin ${signs[3]} pour $x \\in [${x3}, +\\infty[$.`;
36
+ De plus, $f(x)$ est ${signWords[0]} pour $x \\in ]-\\infty;${x1}]$, puis ${signWords[1]} pour $x \\in [${x1}, +\\infty[$.`
37
+ : rootsNb === 2
38
+ ? `On lit graphiquement que $f(x)$ s'annule pour $x$ valant $${x1}$ et $${x2}$.
39
+
40
+ De plus, $f(x)$ est ${signWords[0]} pour $x \\in ]-\\infty;${x1}]$, puis ${signWords[1]} pour $x \\in [${x1}, ${x2}]$, puis ${signWords[2]} pour $x \\in [${x2}, +\\infty[$.`
41
+ : `On lit graphiquement que $f(x)$ s'annule pour les valeurs de $x$ suivantes : $${x1}$, $${x2}$ et $${x3}$.
42
+
43
+ De plus, $f(x)$ est ${signWords[0]} pour $x \\in ]-\\infty;${x1}]$, puis ${signWords[1]} pour $x \\in [${x1}, ${x2}]$, puis ${signWords[2]} pour $x \\in [${x2}, ${x3}]$, et enfin ${signWords[3]} pour $x \\in [${x3}, +\\infty[$.`;
24
44
  };
25
45
  const getGGBOptions = (identifiers) => {
26
46
  const { a, x1, x2, x3 } = identifiers;
27
47
  const ggb = new GeogebraConstructor({
28
- commands: [`f(x) = ${a}*(x-${x1})*(x-${x2})*(x-${x3})`],
48
+ commands: [
49
+ x2 === undefined
50
+ ? `f(x) = ${a}*(x-${x1})`
51
+ : x3 === undefined
52
+ ? `f(x) = ${a}*(x-${x1})*(x-${x2})`
53
+ : `f(x) = ${a}*(x-${x1})*(x-${x2})*(x-${x3})`,
54
+ ],
29
55
  lockedAxesRatio: false,
30
56
  gridDistance: false,
31
57
  xAxis: {
32
58
  steps: 1,
33
59
  },
34
60
  });
35
- const func = (x) => a * (x - x1) * (x - x2) * (x - x3);
36
- const xMin = Math.min(x1, x2, x3);
37
- const xMax = Math.max(x1, x2, x3);
38
- const root1 = (2 * (x1 + x2 + x3) -
39
- Math.sqrt(4 * (x1 + x2 + x3) ** 2 - 12 * (x1 * x2 + x1 * x3 + x2 * x3))) /
40
- 6;
41
- const root2 = (2 * (x1 + x2 + x3) +
42
- Math.sqrt(4 * (x1 + x2 + x3) ** 2 - 12 * (x1 * x2 + x1 * x3 + x2 * x3))) /
43
- 6;
61
+ const func = (x) => {
62
+ if (x2 === undefined)
63
+ return a * (x - x1);
64
+ if (x3 === undefined)
65
+ return a * (x - x1) * (x - x2);
66
+ return a * (x - x1) * (x - x2) * (x - x3);
67
+ };
68
+ const xMin = Math.min(-2, Math.min(x1, x2 ?? x1, x3 ?? x2 ?? x1));
69
+ const xMax = Math.max(2, Math.max(x1, x2 ?? x1, x3 ?? x2 ?? x1));
70
+ const root1 = x2 === undefined
71
+ ? 0
72
+ : x3 === undefined
73
+ ? (x1 + x2) / 2
74
+ : (2 * (x1 + x2 + x3) -
75
+ Math.sqrt(4 * (x1 + x2 + x3) ** 2 - 12 * (x1 * x2 + x1 * x3 + x2 * x3))) /
76
+ 6;
77
+ const root2 = x2 === undefined
78
+ ? 0
79
+ : x3 === undefined
80
+ ? (x1 + x2) / 2
81
+ : (2 * (x1 + x2 + x3) +
82
+ Math.sqrt(4 * (x1 + x2 + x3) ** 2 - 12 * (x1 * x2 + x1 * x3 + x2 * x3))) /
83
+ 6;
44
84
  const [fx1, fx2] = [func(root1), func(root2)];
45
- const yMin = Math.min(fx1, fx2);
46
- const yMax = Math.max(fx1, fx2);
85
+ const yMin = Math.min(-2, Math.min(fx1, fx2));
86
+ const yMax = Math.max(2, Math.max(fx1, fx2));
47
87
  return ggb.getOptions({
48
88
  coords: [xMin - 2, xMax + 2, yMin - 2, yMax + 2],
49
89
  });
@@ -51,72 +91,118 @@ const getGGBOptions = (identifiers) => {
51
91
  const getKeys = () => {
52
92
  return ["infty"];
53
93
  };
54
- const getFirstLine = (x1, x2, x3) => {
55
- return [
56
- "$x$",
57
- "-\\infty",
58
- "\\ ",
59
- x1.frenchify(),
60
- "\\ ",
61
- x2.frenchify(),
62
- "\\ ",
63
- x3.frenchify(),
64
- "\\ ",
65
- "+\\infty",
66
- ];
94
+ const getFirstLine = (identifiers) => {
95
+ const { x1, x2, x3 } = identifiers;
96
+ const firstLine = x2 === undefined
97
+ ? ["$x$", "-\\infty", "\\ ", x1.frenchify(), "\\ ", "+\\infty"]
98
+ : x3 === undefined
99
+ ? [
100
+ "$x$",
101
+ "-\\infty",
102
+ "\\ ",
103
+ x1.frenchify(),
104
+ "\\ ",
105
+ x2.frenchify(),
106
+ "\\ ",
107
+ "+\\infty",
108
+ ]
109
+ : [
110
+ "$x$",
111
+ "-\\infty",
112
+ "\\ ",
113
+ x1.frenchify(),
114
+ "\\ ",
115
+ x2.frenchify(),
116
+ "\\ ",
117
+ x3.frenchify(),
118
+ "\\ ",
119
+ "+\\infty",
120
+ ];
121
+ return firstLine;
67
122
  };
68
- const getSecondLine = (a) => {
69
- const signs = a > 0 ? ["-", "+", "-", "+"] : ["+", "-", "+", "-"];
70
- return [
71
- "$f(x)$",
72
- "\\ ",
73
- signs[0],
74
- "0",
75
- signs[1],
76
- "0",
77
- signs[2],
78
- "0",
79
- signs[3],
80
- "\\ ",
81
- ];
123
+ const getSecondLine = (identifiers) => {
124
+ const { a, x2, x3 } = identifiers;
125
+ //affine a>0 ? ["-", "+"] : ["+","-"]
126
+ //degré 2 a>0 ? ["+", "-", "+"] : ["-", "+", "-"]
127
+ //degré 3 a > 0 ? ["-", "+", "-", "+"] : ["+", "-", "+", "-"];
128
+ const rootsNb = x2 === undefined ? 1 : x3 === undefined ? 2 : 3;
129
+ const signs = rootsNb === 1
130
+ ? a > 0
131
+ ? ["-", "+"]
132
+ : ["+", "-"]
133
+ : rootsNb === 2
134
+ ? a > 0
135
+ ? ["+", "-", "+"]
136
+ : ["-", "+", "-"]
137
+ : a > 0
138
+ ? ["-", "+", "-", "+"]
139
+ : ["+", "-", "+", "-"];
140
+ return rootsNb === 1
141
+ ? ["$f(x)$", "\\ ", signs[0], "0", signs[1], "\\ "]
142
+ : rootsNb === 2
143
+ ? ["$f(x)$", "\\ ", signs[0], "0", signs[1], "0", signs[2], "\\ "]
144
+ : [
145
+ "$f(x)$",
146
+ "\\ ",
147
+ signs[0],
148
+ "0",
149
+ signs[1],
150
+ "0",
151
+ signs[2],
152
+ "0",
153
+ signs[3],
154
+ "\\ ",
155
+ ];
82
156
  };
83
157
  const getAnswerTable = (identifiers) => {
84
- return [
85
- getFirstLine(identifiers.x1, identifiers.x2, identifiers.x3),
86
- getSecondLine(identifiers.a),
87
- ];
158
+ return [getFirstLine(identifiers), getSecondLine(identifiers)];
88
159
  };
89
160
  const isAnswerTableValid = (ans, { answerTable }) => {
90
161
  try {
91
- return ans.every((row, i) => row.every((cell, j) => cell === answerTable[i][j]));
162
+ return signTableVEA(ans, answerTable);
92
163
  }
93
164
  catch (err) {
94
165
  return handleVEAError(err);
95
166
  }
96
167
  };
97
- const getSignTableFromGraphQuestion = () => {
168
+ const getSignTableFromGraphQuestion = (opts) => {
98
169
  const x1 = randint(-9, 10);
170
+ const type = opts?.functionType === "Affine"
171
+ ? 0
172
+ : opts?.functionType === "Degré $2$"
173
+ ? 1
174
+ : 2;
99
175
  const x2 = randint(-9, 10, [x1]);
100
176
  const x3 = randint(-9, 10, [x1, x2]);
101
177
  const sorted = [x1, x2, x3].sort((a, b) => a - b);
102
- const a = randfloat(-1, 1, 4, [0]);
178
+ const a = type === 0 ? randint(-5, 5, [0]) : randfloat(-1, 1, 4, [0]);
103
179
  const lineAsked = randint(0, 2);
104
180
  const identifiers = {
105
181
  a,
106
182
  lineAsked,
107
183
  x1: sorted[0],
108
- x2: sorted[1],
109
- x3: sorted[2],
110
- initTable: [
111
- lineAsked === 0
112
- ? ["$x$", "", "\\ ", "", "\\ ", "", "\\ ", "", "\\ ", ""]
113
- : getFirstLine(sorted[0], sorted[1], sorted[2]),
114
- lineAsked === 1
115
- ? ["$f(x)$", "\\ ", "", "", "", "", "", "", "", "\\ "]
116
- : getSecondLine(a),
117
- ],
184
+ x2: type < 1 ? undefined : sorted[1],
185
+ x3: type < 2 ? undefined : sorted[2],
118
186
  };
119
- return getQuestionFromIdentifiers(identifiers);
187
+ return getQuestionFromIdentifiers(identifiers, opts);
188
+ };
189
+ const getInitTable = (identifiers) => {
190
+ const { x2, x3, lineAsked } = identifiers;
191
+ const rootsNb = x2 === undefined ? 1 : x3 === undefined ? 2 : 3;
192
+ const firstLine = rootsNb === 1
193
+ ? ["$x$", "", "\\ ", "", "\\ ", ""]
194
+ : rootsNb === 2
195
+ ? ["$x$", "", "\\ ", "", "\\ ", "", "\\ ", ""]
196
+ : ["$x$", "", "\\ ", "", "\\ ", "", "\\ ", "", "\\ ", ""];
197
+ const secondLine = rootsNb === 1
198
+ ? ["$f(x)$", "\\ ", "", "", "", "\\ "]
199
+ : rootsNb === 2
200
+ ? ["$f(x)$", "\\ ", "", "", "", "", "", "\\ "]
201
+ : ["$f(x)$", "\\ ", "", "", "", "", "", "", "", "\\ "];
202
+ return [
203
+ lineAsked === 0 ? firstLine : getFirstLine(identifiers),
204
+ lineAsked === 1 ? secondLine : getSecondLine(identifiers),
205
+ ];
120
206
  };
121
207
  const getQuestionFromIdentifiers = (identifiers) => {
122
208
  return {
@@ -128,9 +214,19 @@ const getQuestionFromIdentifiers = (identifiers) => {
128
214
  hint: getHint(identifiers),
129
215
  correction: getCorrection(identifiers),
130
216
  ggbOptions: getGGBOptions(identifiers),
131
- initTable: identifiers.initTable,
217
+ initTable: getInitTable(identifiers),
132
218
  };
133
219
  };
220
+ const options = [
221
+ {
222
+ id: "functionType",
223
+ label: "Type de fonction",
224
+ target: GeneratorOptionTarget.generation,
225
+ type: GeneratorOptionType.select,
226
+ values: ["Affine", "Degré $2$", "Degré $3$"],
227
+ defaultValue: "Degré $3$",
228
+ },
229
+ ];
134
230
  export const partialSignTableFromGraph = {
135
231
  id: "partialSignTableFromGraph",
136
232
  label: "Compléter le tableau de signes d'une fonction à partir de sa représentation graphique",
@@ -149,4 +245,5 @@ export const partialSignTableFromGraph = {
149
245
  getQuestionFromIdentifiers,
150
246
  answerType: "signTable",
151
247
  hasHintAndCorrection: true,
248
+ options,
152
249
  };
@@ -5,6 +5,9 @@ type Identifiers = {
5
5
  xs: NodeIdentifiers[];
6
6
  x: NodeIdentifiers;
7
7
  };
8
- export declare const readSignTable: Exercise<Identifiers>;
8
+ type Options = {
9
+ functionType: string;
10
+ };
11
+ export declare const readSignTable: Exercise<Identifiers, Options>;
9
12
  export {};
10
13
  //# sourceMappingURL=readSignTable.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"readSignTable.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/sign/readSignTable.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAGrC,OAAO,EACL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;AAO7C,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,EAAE,EAAE,eAAe,EAAE,CAAC;IACtB,CAAC,EAAE,eAAe,CAAC;CACpB,CAAC;AA4GF,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,WAAW,CAiB/C,CAAC"}
1
+ {"version":3,"file":"readSignTable.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/sign/readSignTable.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAGrC,OAAO,EACL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;AAO7C,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,EAAE,EAAE,eAAe,EAAE,CAAC;IACtB,CAAC,EAAE,eAAe,CAAC;CACpB,CAAC;AAmHF,KAAK,OAAO,GAAG;IACb,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAyBF,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAkBxD,CAAC"}
@@ -1,4 +1,4 @@
1
- import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
1
+ import { addValidProp, shuffleProps, tryToAddWrongProp, GeneratorOptionTarget, GeneratorOptionType, } from "../../../../exercises/exercise.js";
2
2
  import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
3
  import { randint } from "../../../../math/utils/random/randint.js";
4
4
  import { reifyAlgebraic, } from "../../../../tree/nodes/nodeConstructor.js";
@@ -81,21 +81,43 @@ const getCorrection = (identifiers) => {
81
81
 
82
82
  D'après le tableau de signes, $f(${xNode.toTex()})$ est donc ${ans}.`;
83
83
  };
84
- const getReadSignTableQuestion = () => {
85
- const a = randint(-10, 0);
86
- const b = randint(0, 10);
87
- const xs = [MinusInfinityNode, a.toTree(), b.toTree(), PlusInfinityNode];
84
+ const getReadSignTableQuestion = (opts) => {
85
+ const x1 = randint(-9, 10);
86
+ const x2 = randint(-9, 10, [x1]);
87
+ const x3 = randint(-9, 10, [x1, x2]);
88
+ const sorted = [x1, x2, x3].sort((a, b) => a - b);
89
+ const type = opts?.functionType === "Affine"
90
+ ? 0
91
+ : opts?.functionType === "Degré $3$"
92
+ ? 2
93
+ : 1;
94
+ const roots = type === 0 ? [x1] : type === 1 ? [sorted[0], sorted[1]] : sorted;
95
+ const xs = [
96
+ MinusInfinityNode,
97
+ ...roots.map((e) => e.toTree()),
98
+ PlusInfinityNode,
99
+ ];
88
100
  const signs = coinFlip()
89
- ? ["+", "0", "-", "0", "+"]
90
- : ["-", "0", "+", "0", "-"];
91
- const x = randint(-20, 20, [a, b]).toTree();
101
+ ? ["+", "0", "-", "0", "+", "0", "-"]
102
+ : ["-", "0", "+", "0", "-", "0", "+"];
103
+ const x = randint(-20, 20, roots).toTree();
92
104
  const identifiers = {
93
105
  x: x.toIdentifiers(),
94
106
  xs: xs.map((e) => e.toIdentifiers()),
95
- signs,
107
+ signs: type === 0 ? signs.slice(0, 3) : type === 1 ? signs.slice(0, 5) : signs,
96
108
  };
97
109
  return getQuestionFromIdentifiers(identifiers);
98
110
  };
111
+ const options = [
112
+ {
113
+ id: "functionType",
114
+ label: "Type de fonction",
115
+ target: GeneratorOptionTarget.generation,
116
+ type: GeneratorOptionType.select,
117
+ values: ["Affine", "Degré $2$", "Degré $3$"],
118
+ defaultValue: "Degré $2$",
119
+ },
120
+ ];
99
121
  const getQuestionFromIdentifiers = (identifiers) => {
100
122
  return {
101
123
  answer: getAnswer(identifiers),
@@ -122,4 +144,5 @@ export const readSignTable = {
122
144
  getQuestionFromIdentifiers,
123
145
  answerType: "QCU",
124
146
  hasHintAndCorrection: true,
147
+ options,
125
148
  };
@@ -1,11 +1,13 @@
1
1
  import { Exercise } from "../../../../exercises/exercise.js";
2
2
  type Identifiers = {
3
- initTable: string[][];
4
3
  a: number;
5
4
  x1: number;
6
- x2: number;
7
- x3: number;
5
+ x2?: number;
6
+ x3?: number;
8
7
  };
9
- export declare const signTableFromGraph: Exercise<Identifiers>;
8
+ type Options = {
9
+ functionType: string;
10
+ };
11
+ export declare const signTableFromGraph: Exercise<Identifiers, Options>;
10
12
  export {};
11
13
  //# sourceMappingURL=signTableFromGraph.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"signTableFromGraph.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/sign/signTableFromGraph.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAUT,MAAM,6BAA6B,CAAC;AAOrC,KAAK,WAAW,GAAG;IACjB,SAAS,EAAE,MAAM,EAAE,EAAE,CAAC;IACtB,CAAC,EAAE,MAAM,CAAC;IACV,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAwIF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,CAoBpD,CAAC"}
1
+ {"version":3,"file":"signTableFromGraph.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/sign/signTableFromGraph.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAQrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,EAAE,CAAC,EAAE,MAAM,CAAC;CACb,CAAC;AA+OF,KAAK,OAAO,GAAG;IACb,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAWF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAqB7D,CAAC"}