math-exercises 3.0.97 → 3.0.98

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 (81) hide show
  1. package/lib/exercises/math/calculLitteral/inequations/index.d.ts +2 -0
  2. package/lib/exercises/math/calculLitteral/inequations/index.d.ts.map +1 -1
  3. package/lib/exercises/math/calculLitteral/inequations/index.js +2 -0
  4. package/lib/exercises/math/calculLitteral/inequations/inverseInequality.d.ts.map +1 -1
  5. package/lib/exercises/math/calculLitteral/inequations/inverseInequality.js +83 -5
  6. package/lib/exercises/math/calculLitteral/inequations/inverseInequalityWithGraph.d.ts +10 -0
  7. package/lib/exercises/math/calculLitteral/inequations/inverseInequalityWithGraph.d.ts.map +1 -0
  8. package/lib/exercises/math/calculLitteral/inequations/inverseInequalityWithGraph.js +220 -0
  9. package/lib/exercises/math/conversion/hoursToDecimal.js +1 -1
  10. package/lib/exercises/math/functions/affines/leadingCoefficient.js +1 -1
  11. package/lib/exercises/math/functions/basics/findZeroesProductQuotient.js +1 -1
  12. package/lib/exercises/math/functions/basics/graphicInequation.d.ts.map +1 -1
  13. package/lib/exercises/math/functions/basics/graphicInequation.js +37 -5
  14. package/lib/exercises/math/functions/basics/inverseImageFunctionTable.js +1 -1
  15. package/lib/exercises/math/functions/basics/isPointOnFunction.d.ts.map +1 -1
  16. package/lib/exercises/math/functions/basics/isPointOnFunction.js +1 -1
  17. package/lib/exercises/math/functions/basics/twoFunctionsInequation.d.ts.map +1 -1
  18. package/lib/exercises/math/functions/basics/twoFunctionsInequation.js +34 -0
  19. package/lib/exercises/math/functions/basics/valueTableFromGraph.d.ts.map +1 -1
  20. package/lib/exercises/math/functions/basics/valueTableFromGraph.js +1 -1
  21. package/lib/exercises/math/functions/inverse/index.d.ts +1 -0
  22. package/lib/exercises/math/functions/inverse/index.d.ts.map +1 -1
  23. package/lib/exercises/math/functions/inverse/index.js +1 -0
  24. package/lib/exercises/math/functions/inverse/solveInverseEquation.d.ts +8 -0
  25. package/lib/exercises/math/functions/inverse/solveInverseEquation.d.ts.map +1 -0
  26. package/lib/exercises/math/functions/inverse/solveInverseEquation.js +147 -0
  27. package/lib/exercises/math/functions/sign/affineProductSignTable.js +1 -1
  28. package/lib/exercises/math/functions/sign/affineProductSignTableThirdLine.d.ts +9 -0
  29. package/lib/exercises/math/functions/sign/affineProductSignTableThirdLine.d.ts.map +1 -0
  30. package/lib/exercises/math/functions/sign/affineProductSignTableThirdLine.js +201 -0
  31. package/lib/exercises/math/functions/sign/affineSignTable.js +1 -1
  32. package/lib/exercises/math/functions/sign/index.d.ts +1 -0
  33. package/lib/exercises/math/functions/sign/index.d.ts.map +1 -1
  34. package/lib/exercises/math/functions/sign/index.js +1 -0
  35. package/lib/exercises/math/functions/square/index.d.ts +2 -0
  36. package/lib/exercises/math/functions/square/index.d.ts.map +1 -1
  37. package/lib/exercises/math/functions/square/index.js +2 -1
  38. package/lib/exercises/math/functions/square/squareFunctionInequationWithGraph.d.ts +9 -0
  39. package/lib/exercises/math/functions/square/squareFunctionInequationWithGraph.d.ts.map +1 -0
  40. package/lib/exercises/math/functions/square/squareFunctionInequationWithGraph.js +151 -0
  41. package/lib/exercises/math/functions/square/squareImageIntervalWithGraph.d.ts.map +1 -1
  42. package/lib/exercises/math/functions/square/squareImageIntervalWithGraph.js +19 -3
  43. package/lib/exercises/math/functions/variations/index.d.ts +4 -0
  44. package/lib/exercises/math/functions/variations/index.d.ts.map +1 -1
  45. package/lib/exercises/math/functions/variations/index.js +4 -0
  46. package/lib/exercises/math/functions/variations/readExtremaOnGraph.d.ts +14 -0
  47. package/lib/exercises/math/functions/variations/readExtremaOnGraph.d.ts.map +1 -0
  48. package/lib/exercises/math/functions/variations/readExtremaOnGraph.js +215 -0
  49. package/lib/exercises/math/functions/variations/readVarOnGraph.d.ts +9 -0
  50. package/lib/exercises/math/functions/variations/readVarOnGraph.d.ts.map +1 -0
  51. package/lib/exercises/math/functions/variations/readVarOnGraph.js +128 -0
  52. package/lib/exercises/math/functions/variations/readVarOnGraph2.d.ts +9 -0
  53. package/lib/exercises/math/functions/variations/readVarOnGraph2.d.ts.map +1 -0
  54. package/lib/exercises/math/functions/variations/readVarOnGraph2.js +172 -0
  55. package/lib/exercises/math/functions/variations/varTableExtremaReading.d.ts +4 -1
  56. package/lib/exercises/math/functions/variations/varTableExtremaReading.d.ts.map +1 -1
  57. package/lib/exercises/math/functions/variations/varTableExtremaReading.js +108 -42
  58. package/lib/exercises/math/functions/variations/varTableFromSentences.d.ts +7 -0
  59. package/lib/exercises/math/functions/variations/varTableFromSentences.d.ts.map +1 -1
  60. package/lib/exercises/math/functions/variations/varTableFromSentences.js +167 -137
  61. package/lib/exercises/math/geometry/areas/triangleArea.js +1 -1
  62. package/lib/exercises/math/probaStat/basicStats/calculateFrequency.js +1 -1
  63. package/lib/exercises/math/probaStat/binomial/binomialInequation.js +2 -2
  64. package/lib/exercises/math/trigonometry/trigonometryAngleCalcul.js +1 -1
  65. package/lib/exercises/math/trigonometry/trigonometrySideCalcul.js +1 -1
  66. package/lib/geogebra/colors.d.ts +0 -1
  67. package/lib/geogebra/colors.d.ts.map +1 -1
  68. package/lib/geogebra/colors.js +2 -2
  69. package/lib/index.d.ts +42 -1
  70. package/lib/index.d.ts.map +1 -1
  71. package/lib/math/inequations/inequation.d.ts +1 -0
  72. package/lib/math/inequations/inequation.d.ts.map +1 -1
  73. package/lib/math/inequations/inequation.js +12 -0
  74. package/lib/tree/nodes/operators/addNode.js +0 -1
  75. package/lib/tree/nodes/sets/intervalNode.d.ts +1 -0
  76. package/lib/tree/nodes/sets/intervalNode.d.ts.map +1 -1
  77. package/lib/tree/nodes/sets/intervalNode.js +3 -0
  78. package/lib/tree/parsers/intervalParser.d.ts +2 -0
  79. package/lib/tree/parsers/intervalParser.d.ts.map +1 -1
  80. package/lib/tree/parsers/intervalParser.js +2 -1
  81. package/package.json +1 -1
@@ -1,7 +1,6 @@
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 { numberVEA } from "../../../../exercises/vea/numberVEA.js";
4
- import { GeogebraConstructor } from "../../../../geogebra/geogebraConstructor.js";
5
4
  import { randint } from "../../../../math/utils/random/randint.js";
6
5
  import { ClosureType } from "../../../../tree/nodes/sets/closure.js";
7
6
  import { IntervalNode } from "../../../../tree/nodes/sets/intervalNode.js";
@@ -20,13 +19,57 @@ const getAnswer = (identifiers) => {
20
19
  const { isAskingX, isAskingMin, xValues, yValues, intervalXIndexes } = identifiers;
21
20
  return (isAskingX ? xValues : yValues)[yValues.indexOf((isAskingMin ? Math.min : Math.max)(...yValues.slice(intervalXIndexes[0], intervalXIndexes[1] + 1)))].frenchify();
22
21
  };
22
+ const getTable = (identifiers) => {
23
+ const { xValues, yValues } = identifiers;
24
+ const isFirstAscending = yValues[0] < yValues[1];
25
+ const firstArrow = isFirstAscending ? "\\nearrow" : "\\searrow";
26
+ const secondArrow = isFirstAscending ? "\\searrow" : "\\nearrow";
27
+ return [
28
+ [
29
+ "x",
30
+ xValues[0].frenchify(),
31
+ "\\ ",
32
+ xValues[1].frenchify(),
33
+ "\\ ",
34
+ xValues[2].frenchify(),
35
+ "\\ ",
36
+ xValues[3].frenchify(),
37
+ ],
38
+ [
39
+ " ",
40
+ isFirstAscending ? "\\ " : yValues[0].frenchify(),
41
+ "\\ ",
42
+ isFirstAscending ? yValues[1].frenchify() : "\\ ",
43
+ "\\ ",
44
+ isFirstAscending ? "\\ " : yValues[2].frenchify(),
45
+ "\\ ",
46
+ isFirstAscending ? yValues[3].frenchify() : "\\ ",
47
+ ],
48
+ ["f(x)", "\\ ", firstArrow, "\\ ", secondArrow, "\\ ", firstArrow, "\\ "],
49
+ [
50
+ " ",
51
+ !isFirstAscending ? "\\ " : yValues[0].frenchify(),
52
+ "\\ ",
53
+ !isFirstAscending ? yValues[1].frenchify() : "\\ ",
54
+ "\\ ",
55
+ !isFirstAscending ? "\\ " : yValues[2].frenchify(),
56
+ "\\ ",
57
+ !isFirstAscending ? yValues[3].frenchify() : "\\ ",
58
+ ],
59
+ ];
60
+ };
23
61
  const getInstruction = (identifiers) => {
24
62
  const type = identifiers.isAskingMin ? "minimum" : "maximum";
25
63
  const interval = new IntervalNode(identifiers.xValues[identifiers.intervalXIndexes[0]].toTree(), identifiers.xValues[identifiers.intervalXIndexes[1]].toTree(), ClosureType.FF);
26
- let instruction = `On considère la fonction $f$ dont le tableau de variations est donné ci-dessous.`;
27
- instruction += `\n\n${identifiers.isAskingX
64
+ const table = getTable(identifiers);
65
+ let instruction = `On considère la fonction $f$ dont le tableau de variations est donné ci-dessous :
66
+
67
+ <svg id='varTable'>${JSON.stringify(table)}</svg>
68
+
69
+ ${identifiers.isAskingX
28
70
  ? `Sur l'intervalle $${interval.toTex()}$, en quelle valeur le ${type} de la fonction $f$ est-il atteint ?`
29
- : `Sur l'intervalle $${interval.toTex()}$, quel est le ${type} de la fonction $f$ ?`}`;
71
+ : `Sur l'intervalle $${interval.toTex()}$, quel est le ${type} de la fonction $f$ ?`}
72
+ `;
30
73
  return instruction;
31
74
  };
32
75
  const getHint = (identifiers) => {
@@ -49,39 +92,41 @@ ${identifiers.isAskingX
49
92
  : `Sur l'intervalle $${interval.toTex()}$, le ${type} de la fonction $f$ est donc $${y}$.`}
50
93
  `;
51
94
  };
52
- const getGGBOptions = (identifiers) => {
53
- const xValues = identifiers.xValues;
54
- const yValues = identifiers.yValues;
55
- const isFirstAscending = yValues[0] < yValues[1];
56
- const firstArrow = isFirstAscending ? "\\nearrow" : "\\searrow";
57
- const secondArrow = isFirstAscending ? "\\searrow" : "\\nearrow";
58
- const xLine = `liste1={"x","${xValues[0]}"," ", "${xValues[1]}", " ", "${xValues[2]}", " ", "${xValues[3]}", " "}`;
59
- const y0Line = `liste2={" ","${yValues[0]}"," "," "," ","${yValues[2]}"," ", " "}`;
60
- const y1Line = `liste4={" "," ", " ", "${yValues[1]}"," "," "," ","${yValues[3]}"}`;
61
- const centerLine = `liste3={"f(x)"," ", "${firstArrow}", " ", "${secondArrow}", " ", "${firstArrow}", " "}`;
62
- const commands = [
63
- xLine,
64
- y0Line,
65
- y1Line,
66
- centerLine,
67
- `T = TableText(liste1, ${isFirstAscending ? "liste4" : "liste2"}, liste3, ${isFirstAscending ? "liste2" : "liste4"} , "c|01000000000_01000")`,
68
- `SetFixed(T, true)`,
69
- // `SetCoords(T, 30, 100)`,
70
- ];
71
- const ggb = new GeogebraConstructor({
72
- commands: commands,
73
- hideAxes: true,
74
- hideGrid: true,
75
- forbidShiftDragZoom: true,
76
- fontSize: 12,
77
- maxHeight: 80,
78
- maxWidth: 300,
79
- hideFullScreenButton: true,
80
- });
81
- return ggb.getOptions({
82
- coords: [-10, 10, -10, 10],
83
- });
84
- };
95
+ // const getGGBOptions: GetGGBOptions<Identifiers> = (identifiers) => {
96
+ // const xValues = identifiers.xValues;
97
+ // const yValues = identifiers.yValues;
98
+ // const isFirstAscending = yValues[0] < yValues[1];
99
+ // const firstArrow = isFirstAscending ? "\\nearrow" : "\\searrow";
100
+ // const secondArrow = isFirstAscending ? "\\searrow" : "\\nearrow";
101
+ // const xLine = `liste1={"x","${xValues[0]}"," ", "${xValues[1]}", " ", "${xValues[2]}", " ", "${xValues[3]}", " "}`;
102
+ // const y0Line = `liste2={" ","${yValues[0]}"," "," "," ","${yValues[2]}"," ", " "}`;
103
+ // const y1Line = `liste4={" "," ", " ", "${yValues[1]}"," "," "," ","${yValues[3]}"}`;
104
+ // const centerLine = `liste3={"f(x)"," ", "${firstArrow}", " ", "${secondArrow}", " ", "${firstArrow}", " "}`;
105
+ // const commands = [
106
+ // xLine,
107
+ // y0Line,
108
+ // y1Line,
109
+ // centerLine,
110
+ // `T = TableText(liste1, ${isFirstAscending ? "liste4" : "liste2"}, liste3, ${
111
+ // isFirstAscending ? "liste2" : "liste4"
112
+ // } , "c|01000000000_01000")`,
113
+ // `SetFixed(T, true)`,
114
+ // // `SetCoords(T, 30, 100)`,
115
+ // ];
116
+ // const ggb = new GeogebraConstructor({
117
+ // commands: commands,
118
+ // hideAxes: true,
119
+ // hideGrid: true,
120
+ // forbidShiftDragZoom: true,
121
+ // fontSize: 12,
122
+ // maxHeight: 80,
123
+ // maxWidth: 300,
124
+ // hideFullScreenButton: true,
125
+ // });
126
+ // return ggb.getOptions({
127
+ // coords: [-10, 10, -10, 10],
128
+ // });
129
+ // };
85
130
  const getKeys = (identifiers) => {
86
131
  return [];
87
132
  };
@@ -100,7 +145,17 @@ const getVarTableExtremaReadingQuestion = (opts) => {
100
145
  const isFirstAscending = yValues[0] < yValues[1];
101
146
  yValues.push(randint(isFirstAscending ? Math.min(yValues[0] - 2, -10) : yValues[1], isFirstAscending ? yValues[1] : Math.max(yValues[0] + 2, -10), [yValues[0], yValues[1]]));
102
147
  yValues.push(randint(!isFirstAscending ? Math.min(yValues[1] - 2, -10) : yValues[2], !isFirstAscending ? yValues[2] : Math.max(yValues[1] + 2, -10), [yValues[1], yValues[2]]));
103
- const intervalXIndexes = coinFlip() ? [0, 3] : coinFlip() ? [0, 2] : [1, 3];
148
+ const intervalXIndexes = opts?.extremumType === "Global"
149
+ ? [0, 3]
150
+ : opts?.extremumType === "Local"
151
+ ? coinFlip()
152
+ ? [0, 2]
153
+ : [1, 3]
154
+ : coinFlip()
155
+ ? [0, 3]
156
+ : coinFlip()
157
+ ? [0, 2]
158
+ : [1, 3];
104
159
  const identifiers = {
105
160
  xValues,
106
161
  yValues,
@@ -108,7 +163,7 @@ const getVarTableExtremaReadingQuestion = (opts) => {
108
163
  isAskingMin: coinFlip(),
109
164
  intervalXIndexes,
110
165
  };
111
- return getQuestionFromIdentifiers(identifiers);
166
+ return getQuestionFromIdentifiers(identifiers, opts);
112
167
  };
113
168
  const getQuestionFromIdentifiers = (identifiers) => {
114
169
  const question = {
@@ -119,10 +174,20 @@ const getQuestionFromIdentifiers = (identifiers) => {
119
174
  identifiers,
120
175
  hint: getHint(identifiers),
121
176
  correction: getCorrection(identifiers),
122
- ggbOptions: getGGBOptions(identifiers),
177
+ // ggbOptions: getGGBOptions(identifiers),
123
178
  };
124
179
  return question;
125
180
  };
181
+ const options = [
182
+ {
183
+ id: "extremumType",
184
+ label: "Type d'extremum",
185
+ target: GeneratorOptionTarget.generation,
186
+ type: GeneratorOptionType.select,
187
+ values: ["Local", "Global", "Les deux"],
188
+ defaultValue: "Les deux",
189
+ },
190
+ ];
126
191
  export const varTableExtremaReading = {
127
192
  id: "varTableExtremaReading",
128
193
  label: "Lire les extremums d'une fonction à partir de son tableau de variations",
@@ -134,6 +199,7 @@ export const varTableExtremaReading = {
134
199
  isAnswerValid,
135
200
  subject: "Mathématiques",
136
201
  getQuestionFromIdentifiers,
137
- hasGeogebra: true,
202
+ // hasGeogebra: true,
138
203
  hasHintAndCorrection: true,
204
+ options,
139
205
  };
@@ -1,2 +1,9 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ import { NodeIdentifiers } from "../../../../tree/nodes/nodeConstructor.js";
3
+ type Identifiers = {
4
+ vars: string[];
5
+ xs: NodeIdentifiers[];
6
+ };
7
+ export declare const varTableFromSentences: Exercise<Identifiers>;
1
8
  export {};
2
9
  //# sourceMappingURL=varTableFromSentences.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"varTableFromSentences.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/variations/varTableFromSentences.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"varTableFromSentences.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/variations/varTableFromSentences.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAgBT,MAAM,6BAA6B,CAAC;AAIrC,OAAO,EACL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;AAK7C,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,EAAE,EAAE,eAAe,EAAE,CAAC;CACvB,CAAC;AAyKF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,WAAW,CAkBvD,CAAC"}
@@ -1,137 +1,167 @@
1
- // import {
2
- // Exercise,
3
- // Proposition,
4
- // QCMGenerator,
5
- // Question,
6
- // QuestionGenerator,
7
- // VEA,
8
- // addValidProp,
9
- // shuffleProps,
10
- // GetAnswer,
11
- // GetHint,
12
- // GetCorrection,
13
- // GetInstruction,
14
- // GetKeys,
15
- // GetQuestionFromIdentifiers,
16
- // GetAnswerTable,
17
- // TableVEA,
18
- // } from "../../../../exercises/exercise.js";
19
- // import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
20
- // import { randTupleInt } from "../../../../math/utils/random/randTupleInt.js";
21
- // import {
22
- // NodeIdentifiers,
23
- // reifyAlgebraic,
24
- // } from "../../../../tree/nodes/nodeConstructor.js";
25
- // import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
26
- // import { coinFlip } from "../../../../utils/alea/coinFlip.js";
27
- // import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
28
- export {};
29
- // type Identifiers = {
30
- // vars: string[];
31
- // xs: NodeIdentifiers[];
32
- // };
33
- // /**
34
- // *
35
- // * xs
36
- // * [-10, -4, 3, 10]
37
- // * [f(-10), "\\nearrow", f(-4), "\\searrow", "f(3)", "\\nearrow", f(10)]
38
- // */
39
- // const getAnswerTable: GetAnswerTable<Identifiers> = (identifiers) => {
40
- // const { vars, xs } = identifiers;
41
- // const xsNodes = xs.map((x) => reifyAlgebraic(x));
42
- // const secondLine: string[][] = [[], [], []];
43
- // for (let i = 0; i < vars.length; i++) {
44
- // if (i % 2 === 0) {
45
- // let row = 0;
46
- // if (i === 0) {
47
- // row = vars[1] === "\\nearrow" ? 2 : 0;
48
- // } else {
49
- // row = vars[i - 1] === "\\nearrow" ? 0 : 2;
50
- // }
51
- // secondLine[row].push(vars[i]);
52
- // secondLine[2 - row].push("\\ ");
53
- // secondLine[1].push("\\ ");
54
- // } else {
55
- // secondLine[1].push(vars[i]);
56
- // secondLine[0].push("\\ ");
57
- // secondLine[2].push("\\ ");
58
- // }
59
- // }
60
- // return [
61
- // ["$x$", ...xsNodes.join("\\ ")],
62
- // ["$\\ $", ...secondLine[0]],
63
- // ["$f(x)$", ...secondLine[1]],
64
- // ["$\\ $", ...secondLine[2]],
65
- // ];
66
- // };
67
- // const getInstruction: GetInstruction<Identifiers> = (identifiers) => {
68
- // const { vars, xs } = identifiers;
69
- // const xsNodes = xs.map((x) => reifyAlgebraic(x));
70
- // return `La fonction $f$ est définie sur ...
71
- // Elle est croissante sur ...
72
- // Elle est décroissante sur ...
73
- // De plus, on a $f()=...$`;
74
- // };
75
- // const getHint: GetHint<Identifiers> = (identifiers) => {
76
- // return `La première ligne d'un tableau de variations contient les valeurs de $x$. La deuxième ligne donne les variations de la fonction en fonction des valeurs de $x$ de la premiere ligne.`;
77
- // };
78
- // const getCorrection: GetCorrection<Identifiers> = (identifiers) => {
79
- // return ``;
80
- // };
81
- // const getKeys: GetKeys<Identifiers> = (identifiers) => {
82
- // return [];
83
- // };
84
- // const isAnswerTableValid: TableVEA<Identifiers> = (ans, { answerTable }) => {
85
- // try {
86
- // return ans.every((row, i) =>
87
- // row.every((cell, j) => cell === answerTable[i][j]),
88
- // );
89
- // } catch (err) {
90
- // return handleVEAError(err);
91
- // }
92
- // };
93
- // const getVarTableFromSentencesQuestion: QuestionGenerator<Identifiers> = (
94
- // ops,
95
- // ) => {
96
- // const x = randTupleInt(4, {allDifferent: true, from: -10, to: 11})
97
- // const xs = x.sort((a,b)=>a-b);
98
- // const sens = coinFlip()
99
- // const vars = [];
100
- // const identifiers: Identifiers = {
101
- // xs: xs.map((e)=>e.toTree().toIdentifiers()),
102
- // vars,
103
- // };
104
- // return getQuestionFromIdentifiers(identifiers);
105
- // };
106
- // const getQuestionFromIdentifiers: GetQuestionFromIdentifiers<Identifiers> = (
107
- // identifiers,
108
- // ) => {
109
- // return {
110
- // answerTable: getAnswerTable(identifiers),
111
- // instruction: getInstruction(identifiers),
112
- // keys: getKeys(identifiers),
113
- // answerFormat: "tex",
114
- // identifiers,
115
- // hint: getHint(identifiers),
116
- // correction: getCorrection(identifiers),
117
- // };
118
- // };
119
- // export const varTableFromSentences: Exercise<Identifiers> = {
120
- // id: "varTableFromSentences",
121
- // label:
122
- // "Dresser le tableau de variations d'une fonction à partir de phrases descriptives",
123
- // isSingleStep: true,
124
- // generator: (nb, opts) =>
125
- // getDistinctQuestions(() => getVarTableFromSentencesQuestion(opts), nb),
126
- // qcmTimer: 60,
127
- // freeTimer: 60,
128
- // isAnswerTableValid,
129
- // subject: "Mathématiques",
130
- // getInstruction,
131
- // getHint,
132
- // getCorrection,
133
- // getAnswerTable,
134
- // getQuestionFromIdentifiers,
135
- // hasHintAndCorrection: true,
136
- // answerType: "varTable",
137
- // };
1
+ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
2
+ import { randint } from "../../../../math/utils/random/randint.js";
3
+ import { randTupleInt } from "../../../../math/utils/random/randTupleInt.js";
4
+ import { reifyAlgebraic, } from "../../../../tree/nodes/nodeConstructor.js";
5
+ import { coinFlip } from "../../../../utils/alea/coinFlip.js";
6
+ import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
7
+ /**
8
+ * xs
9
+ * [-10, -4, 3, 10]
10
+ * [f(-10), "\\nearrow", f(-4), "\\searrow", "f(3)", "\\nearrow", f(10)]
11
+ */
12
+ const getAnswerTable = (identifiers) => {
13
+ const { vars, xs } = identifiers;
14
+ const xsNodes = xs.map((x) => reifyAlgebraic(x).toTex());
15
+ const stringed = [
16
+ xsNodes[0],
17
+ "\\ ",
18
+ xsNodes[1],
19
+ "\\ ",
20
+ xsNodes[2],
21
+ "\\ ",
22
+ xsNodes[3],
23
+ ];
24
+ const secondLine = [[], [], []];
25
+ for (let i = 0; i < vars.length; i++) {
26
+ if (i % 2 === 0) {
27
+ let row = 0;
28
+ if (i === 0) {
29
+ row = vars[1] === "\\nearrow" ? 2 : 0;
30
+ }
31
+ else {
32
+ row = vars[i - 1] === "\\nearrow" ? 0 : 2;
33
+ }
34
+ secondLine[row].push(vars[i]);
35
+ secondLine[2 - row].push("\\ ");
36
+ secondLine[1].push("\\ ");
37
+ }
38
+ else {
39
+ secondLine[1].push(vars[i]);
40
+ secondLine[0].push("\\ ");
41
+ secondLine[2].push("\\ ");
42
+ }
43
+ }
44
+ return [
45
+ ["$x$", ...stringed],
46
+ ["$\\ $", ...secondLine[0]],
47
+ ["$f(x)$", ...secondLine[1]],
48
+ ["$\\ $", ...secondLine[2]],
49
+ ];
50
+ };
51
+ const getInstruction = (identifiers) => {
52
+ const { vars, xs } = identifiers;
53
+ const xsNodes = xs.map((x) => reifyAlgebraic(x));
54
+ const increases = (vars[3] === "\\nearrow"
55
+ ? [[1, 2]]
56
+ : [
57
+ [0, 1],
58
+ [2, 3],
59
+ ]).map((e) => [xsNodes[e[0]].toTex(), xsNodes[e[1]].toTex()]);
60
+ const decreases = (vars[3] === "\\searrow"
61
+ ? [[1, 2]]
62
+ : [
63
+ [0, 1],
64
+ [2, 3],
65
+ ]).map((e) => [xsNodes[e[0]].toTex(), xsNodes[e[1]].toTex()]);
66
+ return `La fonction $f$ est définie sur $\\left[${xsNodes[0].toTex()}; ${xsNodes[xsNodes.length - 1].toTex()}\\right]$.
67
+
68
+ Elle est croissante sur $[${increases[0][0]}; ${increases[0][1]}]$ ${increases[1]?.length
69
+ ? `et sur $[${increases[1][0]}; ${increases[1][1]}]$`
70
+ : ""}.
71
+
72
+ Elle est décroissante sur $[${decreases[0][0]}; ${decreases[0][1]}]$ ${decreases[1]?.length
73
+ ? `et sur $[${decreases[1][0]}; ${decreases[1][1]}]$`
74
+ : ""}.
75
+
76
+ De plus, on a $f(${xsNodes[0].toTex()})=${vars[0]}$, $f(${xsNodes[1].toTex()})=${vars[2]}$, $f(${xsNodes[2].toTex()})=${vars[4]}$ et $f(${xsNodes[3].toTex()})=${vars[6]}$.
77
+
78
+ Dresser le tableau de variations de $f$.`;
79
+ };
80
+ const getHint = (identifiers) => {
81
+ return `La première ligne d'un tableau de variations contient les valeurs de $x$. La deuxième ligne donne les variations de la fonction en fonction des valeurs de $x$ de la première ligne.`;
82
+ };
83
+ const getCorrection = (identifiers) => {
84
+ const { vars, xs } = identifiers;
85
+ const xsNodes = xs.map((x) => reifyAlgebraic(x));
86
+ return `Dans la première ligne, on met les valeurs de $x$ dans l'ordre croissant : ${xsNodes
87
+ .map((e) => `$${e.toTex()}$`)
88
+ .join(" ; ")}.
89
+
90
+ Dans la deuxième ligne, on met une flèche croissante sur les intervalles où la fonction est croissante, et une flèche décroissante sur les intervalles où elle est décroissante.
91
+
92
+ Puis, on met les images des valeurs de $x$ à l'extrémité des flèches.`;
93
+ };
94
+ const getKeys = (identifiers) => {
95
+ return ["infty"];
96
+ };
97
+ const isAnswerTableValid = (ans, { answerTable }) => {
98
+ try {
99
+ return ans.every((row, i) => row.every((cell, j) => cell === answerTable[i][j]));
100
+ }
101
+ catch (err) {
102
+ return handleVEAError(err);
103
+ }
104
+ };
105
+ const getVarTableFromSentencesQuestion = (ops) => {
106
+ const x = randTupleInt(4, { allDifferent: true, from: -10, to: 11 });
107
+ const xs = x.sort((a, b) => a - b);
108
+ const sens = coinFlip(); // true = down up down, false : up down up
109
+ const vars = [];
110
+ if (sens) {
111
+ let a = randint(-10, 10);
112
+ vars[0] = a.frenchify();
113
+ vars[1] = vars[5] = "\\searrow";
114
+ let b = randint(a - 10, a);
115
+ vars[2] = b.frenchify();
116
+ vars[3] = "\\nearrow";
117
+ let c = randint(b + 1, b + 10);
118
+ vars[4] = c.frenchify();
119
+ let d = randint(c - 10, c);
120
+ vars[6] = d.frenchify();
121
+ }
122
+ else {
123
+ let a = randint(-10, 10);
124
+ vars[0] = a.frenchify();
125
+ vars[1] = vars[5] = "\\nearrow";
126
+ let b = randint(a + 1, a + 10);
127
+ vars[2] = b.frenchify();
128
+ vars[3] = "\\searrow";
129
+ let c = randint(b - 10, b);
130
+ vars[4] = c.frenchify();
131
+ let d = randint(c + 1, c + 10);
132
+ vars[6] = d.frenchify();
133
+ }
134
+ const identifiers = {
135
+ xs: xs.map((e) => e.toTree().toIdentifiers()),
136
+ vars,
137
+ };
138
+ return getQuestionFromIdentifiers(identifiers);
139
+ };
140
+ const getQuestionFromIdentifiers = (identifiers) => {
141
+ return {
142
+ answerTable: getAnswerTable(identifiers),
143
+ instruction: getInstruction(identifiers),
144
+ keys: getKeys(identifiers),
145
+ answerFormat: "tex",
146
+ identifiers,
147
+ hint: getHint(identifiers),
148
+ correction: getCorrection(identifiers),
149
+ };
150
+ };
151
+ export const varTableFromSentences = {
152
+ id: "varTableFromSentences",
153
+ label: "Dresser le tableau de variations d'une fonction à partir de phrases descriptives",
154
+ isSingleStep: true,
155
+ generator: (nb, opts) => getDistinctQuestions(() => getVarTableFromSentencesQuestion(opts), nb),
156
+ qcmTimer: 60,
157
+ freeTimer: 60,
158
+ isAnswerTableValid,
159
+ subject: "Mathématiques",
160
+ getInstruction,
161
+ getHint,
162
+ getCorrection,
163
+ getAnswerTable,
164
+ getQuestionFromIdentifiers,
165
+ hasHintAndCorrection: true,
166
+ answerType: "varTable",
167
+ };
@@ -20,7 +20,7 @@ const getInstruction = (identifiers) => {
20
20
  const heightSegment = SegmentConstructor.fromIdentifiers(heightIdentifiers);
21
21
  return `Calculer l'aire du triangle $${triangle.name}$ sachant que $${triangle.sides[1].toLengthTex()} \\ \\textrm{cm}$ et $${heightSegment.toLengthTex()} \\ \\textrm{cm}$.
22
22
 
23
- Arrondir à $0,1 \\ \\textrm{cm}^2$ près.`;
23
+ Arrondir à $0,1 \\ \\textrm{cm}^2$.`;
24
24
  };
25
25
  const getAnswer = (identifiers) => {
26
26
  const { height, base } = identifiers;
@@ -53,7 +53,7 @@ const getInstruction = (identifiers, opts) => {
53
53
  }
54
54
  instruction += `
55
55
 
56
- Quelle est la fréquence d'apparition de ${caracType} ? Arrondir au centième près.`;
56
+ Quelle est la fréquence d'apparition de ${caracType} ? Arrondir au centième.`;
57
57
  return instruction;
58
58
  };
59
59
  const getHint = (identifiers, opts) => {
@@ -59,8 +59,8 @@ const getInstruction = (identifiers, opts) => {
59
59
  return `Soit $X$ une variable aléatoire qui suit une loi binomiale de paramètres $n = ${identifiers.n}$ et $p = ${pNode.toTex()}$.
60
60
 
61
61
  ${identifiers.isSentence
62
- ? `Quelle est la probabilité d'obtenir ${sentence} succès ? Arrondir à $10^{-2}$ près.`
63
- : `Calculer en donnant la réponse à $10^{-2}$ près :
62
+ ? `Quelle est la probabilité d'obtenir ${sentence} succès ? Arrondir à $10^{-2}$.`
63
+ : `Calculer en donnant une réponse arrondie à $10^{-2}$ :
64
64
 
65
65
  $$
66
66
  P\\left(${interval.toInequality("X".toTree()).toTex()}\\right)
@@ -15,7 +15,7 @@ const getInstruction = (identifiers) => {
15
15
  const angle = triangle.angles[randAngle];
16
16
  return `Le triangle $${triangle.name}$ rectangle en $${triangle.points[0].name}$ est tel que $${givenSides[0].toLengthTex()}\\ \\textrm{cm}$ et $${givenSides[1].toLengthTex()}\\ \\textrm{cm}$.
17
17
 
18
- Calculer l'angle $${angle.toTex()}$ à $1^\\circ$ près.`;
18
+ Calculer l'angle $${angle.toTex()}$ en arrondissant à $1^\\circ$.`;
19
19
  };
20
20
  const getAnswer = (identifiers) => {
21
21
  const { randAngle, hiddenSide, triangleIdentifiers } = identifiers;
@@ -14,7 +14,7 @@ const getInstruction = (identifiers) => {
14
14
  const angleValue = triangle.angles[givenAngle].evaluate().frenchify();
15
15
  return `Le triangle $${triangle.name}$ rectangle en $${triangle.points[0].name}$ est tel que $${triangle.sides[givenSide].toLengthTex()}\\ \\textrm{cm}$ et $${triangle.angles[givenAngle].toTex()} = ${angleValue}^\\circ$.
16
16
 
17
- Calculer $${triangle.sides[sideAsked].toInsideName()}$ à $0,1 \\ \\textrm{cm}$ près.`;
17
+ Calculer $${triangle.sides[sideAsked].toInsideName()}$ à $0,1 \\ \\textrm{cm}$.`;
18
18
  };
19
19
  const getAnswer = (identifiers) => {
20
20
  const { givenAngle, givenSide, sideAsked, triangleIdentifiers } = identifiers;
@@ -5,7 +5,6 @@ export declare const pinkLight = "#FF7390";
5
5
  export declare const reds: string[];
6
6
  export declare const orangeDark = "#BE5F00";
7
7
  export declare const orange = "#F6A118";
8
- export declare const orangeLight = "#FFBE46";
9
8
  export declare const oranges: string[];
10
9
  export declare const greenLight = "#54B1B7";
11
10
  export declare const greenMain = "#168187";
@@ -1 +1 @@
1
- {"version":3,"file":"colors.d.ts","sourceRoot":"","sources":["../../src/geogebra/colors.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,GAAG,YAAY,CAAC;AAC7B,eAAO,MAAM,QAAQ,YAAY,CAAC;AAClC,eAAO,MAAM,QAAQ,YAAY,CAAC;AAClC,eAAO,MAAM,SAAS,YAAY,CAAC;AACnC,eAAO,MAAM,IAAI,UAAuC,CAAC;AAEzD,eAAO,MAAM,UAAU,YAAY,CAAC;AACpC,eAAO,MAAM,MAAM,YAAY,CAAC;AAChC,eAAO,MAAM,WAAW,YAAY,CAAC;AACrC,eAAO,MAAM,OAAO,UAAoC,CAAC;AAEzD,eAAO,MAAM,UAAU,YAAY,CAAC;AACpC,eAAO,MAAM,SAAS,YAAY,CAAC;AACnC,eAAO,MAAM,SAAS,YAAY,CAAC;AACnC,eAAO,MAAM,MAAM,UAAqC,CAAC;AAEzD,eAAO,MAAM,SAAS,YAAY,CAAC;AACnC,eAAO,MAAM,QAAQ,YAAY,CAAC;AAClC,eAAO,MAAM,QAAQ,YAAY,CAAC;AAClC,eAAO,MAAM,aAAa,YAAY,CAAC;AACvC,eAAO,MAAM,KAAK,UAAiD,CAAC;AAEpE,eAAO,MAAM,WAAW,YAAY,CAAC;AACrC,eAAO,MAAM,UAAU,YAAY,CAAC;AACpC,eAAO,MAAM,UAAU,YAAY,CAAC;AACpC,eAAO,MAAM,OAAO,UAAwC,CAAC;AAC7D,eAAO,MAAM,MAAM,UAAyD,CAAC;AAE7E,eAAO,MAAM,WAAW,cAEvB,CAAC;AAEF,eAAO,MAAM,gBAAgB,UAAW,MAAM,WAAW,MAAM,WAE9D,CAAC"}
1
+ {"version":3,"file":"colors.d.ts","sourceRoot":"","sources":["../../src/geogebra/colors.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,GAAG,YAAY,CAAC;AAC7B,eAAO,MAAM,QAAQ,YAAY,CAAC;AAClC,eAAO,MAAM,QAAQ,YAAY,CAAC;AAClC,eAAO,MAAM,SAAS,YAAY,CAAC;AACnC,eAAO,MAAM,IAAI,UAAuC,CAAC;AAEzD,eAAO,MAAM,UAAU,YAAY,CAAC;AACpC,eAAO,MAAM,MAAM,YAAY,CAAC;AAEhC,eAAO,MAAM,OAAO,UAAuB,CAAC;AAE5C,eAAO,MAAM,UAAU,YAAY,CAAC;AACpC,eAAO,MAAM,SAAS,YAAY,CAAC;AACnC,eAAO,MAAM,SAAS,YAAY,CAAC;AACnC,eAAO,MAAM,MAAM,UAAqC,CAAC;AAEzD,eAAO,MAAM,SAAS,YAAY,CAAC;AACnC,eAAO,MAAM,QAAQ,YAAY,CAAC;AAClC,eAAO,MAAM,QAAQ,YAAY,CAAC;AAClC,eAAO,MAAM,aAAa,YAAY,CAAC;AACvC,eAAO,MAAM,KAAK,UAAiD,CAAC;AAEpE,eAAO,MAAM,WAAW,YAAY,CAAC;AACrC,eAAO,MAAM,UAAU,YAAY,CAAC;AACpC,eAAO,MAAM,UAAU,YAAY,CAAC;AACpC,eAAO,MAAM,OAAO,UAAwC,CAAC;AAC7D,eAAO,MAAM,MAAM,UAAyD,CAAC;AAE7E,eAAO,MAAM,WAAW,cAEvB,CAAC;AAEF,eAAO,MAAM,gBAAgB,UAAW,MAAM,WAAW,MAAM,WAE9D,CAAC"}
@@ -6,8 +6,8 @@ export const pinkLight = "#FF7390";
6
6
  export const reds = [red, pinkDark, pinkLight, pinkMain];
7
7
  export const orangeDark = "#BE5F00";
8
8
  export const orange = "#F6A118";
9
- export const orangeLight = "#FFBE46";
10
- export const oranges = [orange, orangeDark, orangeLight];
9
+ // export const orangeLight = "#FFBE46";
10
+ export const oranges = [orange, orangeDark];
11
11
  export const greenLight = "#54B1B7";
12
12
  export const greenMain = "#168187";
13
13
  export const greenDark = "#00545A";