math-exercises 3.0.8 → 3.0.9

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.
@@ -132,7 +132,7 @@ const isAnswerValid = (ans, { a, b }) => {
132
132
  const options = [
133
133
  {
134
134
  id: "aNumberType",
135
- label: "Autoriser des fractions pour $a$",
135
+ label: "Type du coefficient $a$",
136
136
  target: GeneratorOptionTarget.generation,
137
137
  type: GeneratorOptionType.multiselect,
138
138
  defaultValue: ["Entier"],
@@ -5,9 +5,10 @@ type Identifiers = {
5
5
  /** new */
6
6
  functionType: string;
7
7
  x: number;
8
- y: number;
8
+ y?: number;
9
9
  wrongY: number;
10
10
  otherPoints: number[][];
11
+ functionCommand?: string;
11
12
  };
12
13
  type Options = {
13
14
  curveTypes: string[];
@@ -1 +1 @@
1
- {"version":3,"file":"imageFunctionGeogebra.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/basics/imageFunctionGeogebra.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAiBT,MAAM,6BAA6B,CAAC;AAsBrC,KAAK,WAAW,GAAG;IACjB,cAAc;IAMd,UAAU;IAMV,UAAU;IACV,YAAY,EAAE,MAAM,CAAC;IACrB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,EAAE,EAAE,CAAC;CACzB,CAAC;AAoOF,KAAK,OAAO,GAAG;IACb,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AACF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAmBhE,CAAC"}
1
+ {"version":3,"file":"imageFunctionGeogebra.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/basics/imageFunctionGeogebra.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;AAsBrC,KAAK,WAAW,GAAG;IACjB,cAAc;IAMd,UAAU;IAMV,UAAU;IACV,YAAY,EAAE,MAAM,CAAC;IACrB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,EAAE,EAAE,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC;AAgRF,KAAK,OAAO,GAAG;IACb,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AACF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAmBhE,CAAC"}
@@ -49,19 +49,33 @@ const rebuildIdentifiers = (oldIds) => {
49
49
  else
50
50
  return oldIds;
51
51
  };
52
- const getInstruction = (identifiers) => {
52
+ const getInstruction = (identifiers, opts) => {
53
53
  const { x } = identifiers;
54
- return `Quelle est l'image de $${x}$ par la fonction $f$ représentée ci dessous ?`;
54
+ let instruction = `Quelle est l'image de $${x}$ par la fonction $f$ représentée ci dessous ?`;
55
+ if (opts?.curveTypes?.includes("Avec valeur interdite (pas d'image)")) {
56
+ instruction += `
57
+
58
+ On écrira "aucun" si l'image n'existe pas.`;
59
+ }
60
+ return instruction;
55
61
  };
56
62
  const getAnswer = (identifiers) => {
57
63
  const { y } = identifiers;
64
+ if (y === undefined)
65
+ return "\\text{Aucun}";
58
66
  return y.frenchify();
59
67
  };
60
68
  const getGGBOptions = (identifiers) => {
61
- const { functionType, otherPoints, wrongY, x, y } = identifiers;
69
+ const { functionType, otherPoints, wrongY, x, y, functionCommand } = identifiers;
62
70
  const allPoints = [...otherPoints, [x, y], [wrongY, x]].sort((a, b) => a[0] - b[0]);
63
71
  let commands = [];
64
72
  switch (functionType) {
73
+ case "Avec valeur interdite (pas d'image)":
74
+ commands = [
75
+ `f(x) = ${functionCommand}`,
76
+ `SetColor(f, "${randomColor()}")`,
77
+ ];
78
+ break;
65
79
  case "Droites":
66
80
  const line = new Line(new Point("A", allPoints[0][0], allPoints[0][1]), new Point("B", allPoints[1][0], allPoints[1][1]));
67
81
  commands = line.toGGBCommands(false);
@@ -104,10 +118,19 @@ const getGGBOptions = (identifiers) => {
104
118
  // commands: spline.getCommands()
105
119
  commands,
106
120
  });
107
- const xMin = allPoints[0][0];
108
- const xMax = allPoints[allPoints.length - 1][0];
109
- const yMin = Math.min(...allPoints.map((p) => p[1])) - 1;
110
- const yMax = Math.max(...allPoints.map((p) => p[1])) + 1;
121
+ let xMin, xMax, yMin, yMax;
122
+ if (functionType === "Avec valeur interdite (pas d'image)") {
123
+ xMin = x - 3;
124
+ xMax = x + 3;
125
+ yMin = -7;
126
+ yMax = 7;
127
+ }
128
+ else {
129
+ xMin = allPoints[0][0];
130
+ xMax = allPoints[allPoints.length - 1][0];
131
+ yMin = Math.min(...allPoints.map((p) => p[1])) - 1;
132
+ yMax = Math.max(...allPoints.map((p) => p[1])) + 1;
133
+ }
111
134
  return ggb.getOptions({
112
135
  coords: ggb.getAdaptedCoords({
113
136
  forceShowAxes: true,
@@ -122,12 +145,20 @@ const getStartStatement = (identifiers) => {
122
145
  const { x } = identifiers;
123
146
  return `f(${x})`;
124
147
  };
148
+ const getKeys = (identifiers, options) => {
149
+ if (options?.curveTypes?.includes("Avec valeur interdite (pas d'image)")) {
150
+ return ["aucun"];
151
+ }
152
+ else {
153
+ return [];
154
+ }
155
+ };
125
156
  const getQuestionFromIdentifiers = (identifiers, opts) => {
126
157
  const question = {
127
158
  instruction: getInstruction(identifiers, opts),
128
159
  startStatement: getStartStatement(identifiers, opts),
129
160
  answer: getAnswer(identifiers, opts),
130
- keys: [],
161
+ keys: getKeys(identifiers, opts),
131
162
  ggbOptions: getGGBOptions(identifiers, opts),
132
163
  answerFormat: "tex",
133
164
  identifiers,
@@ -135,12 +166,18 @@ const getQuestionFromIdentifiers = (identifiers, opts) => {
135
166
  return question;
136
167
  };
137
168
  const getImageFunctionGeogebra = (opts) => {
138
- const x = randint(-8, 9);
139
- const y = randint(-8, 9);
140
- const wrongY = y + randint(-3, 4, [0, x - y, 10 - y, -10 - y]);
169
+ let x = randint(-8, 9);
170
+ let y = randint(-8, 9);
171
+ let wrongY = y + randint(-3, 4, [0, x - y, 10 - y, -10 - y]);
172
+ let functionCommand = undefined;
141
173
  const functionType = random(opts?.curveTypes ?? ["Tracés", "Polynômes", "Droites", "Paraboles"]);
142
174
  let otherPoints = [];
143
175
  switch (functionType) {
176
+ case "Avec valeur interdite (pas d'image)":
177
+ y = undefined;
178
+ const k = randint(2, 6);
179
+ functionCommand = `${k}/(x-${x}) -x`;
180
+ break;
144
181
  case "Droites":
145
182
  //nothing to add
146
183
  break;
@@ -172,10 +209,11 @@ const getImageFunctionGeogebra = (opts) => {
172
209
  functionType,
173
210
  wrongY,
174
211
  otherPoints,
212
+ functionCommand,
175
213
  };
176
214
  return getQuestionFromIdentifiers(identifiers, opts);
177
215
  };
178
- const getPropositions = (n, { answer, x, y, wrongY }, opts) => {
216
+ const getPropositions = (n, { answer, wrongY }, opts) => {
179
217
  const propositions = [];
180
218
  addValidProp(propositions, answer);
181
219
  //old questions have spline POint undefined
@@ -196,7 +234,13 @@ const options = [
196
234
  target: GeneratorOptionTarget.generation,
197
235
  type: GeneratorOptionType.multiselect,
198
236
  defaultValue: ["Tracés", "Polynômes", "Droites", "Paraboles"],
199
- values: ["Tracés", "Polynômes", "Droites", "Paraboles"],
237
+ values: [
238
+ "Tracés",
239
+ "Polynômes",
240
+ "Droites",
241
+ "Paraboles",
242
+ "Avec valeur interdite (pas d'image)",
243
+ ],
200
244
  },
201
245
  ];
202
246
  export const imageFunctionGeogebra = {
@@ -1,10 +1,7 @@
1
1
  import { Exercise } from "../../../../exercises/exercise.js";
2
2
  type Identifiers = {
3
- xValue: number;
4
3
  yValue: number;
5
- affineCoeffs?: number[];
6
- trinomCoeffs?: number[];
7
- isAffine: boolean;
4
+ points: number[][];
8
5
  };
9
6
  export declare const inverseImageFunctionGeogebra: Exercise<Identifiers>;
10
7
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"inverseImageFunctionGeogebra.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/basics/inverseImageFunctionGeogebra.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAQT,MAAM,6BAA6B,CAAC;AAYrC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC;AA0IF,eAAO,MAAM,4BAA4B,EAAE,QAAQ,CAAC,WAAW,CAe9D,CAAC"}
1
+ {"version":3,"file":"inverseImageFunctionGeogebra.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/basics/inverseImageFunctionGeogebra.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAoBrC,KAAK,WAAW,GAAG;IAEjB,MAAM,EAAE,MAAM,CAAC;IAIf,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC;CACpB,CAAC;AAmNF,eAAO,MAAM,4BAA4B,EAAE,QAAQ,CAAC,WAAW,CAoB9D,CAAC"}
@@ -1,94 +1,175 @@
1
1
  import { addValidProp, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
2
2
  import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
- import { randomColor } from "../../../../geogebra/colors.js";
4
3
  import { GeogebraConstructor } from "../../../../geogebra/geogebraConstructor.js";
5
- import { Affine } from "../../../../math/polynomials/affine.js";
6
- import { Polynomial } from "../../../../math/polynomials/polynomial.js";
7
- import { Trinom } from "../../../../math/polynomials/trinom.js";
4
+ import { Line } from "../../../../math/geometry/line.js";
5
+ import { Parabola } from "../../../../math/geometry/parabola.js";
6
+ import { Point } from "../../../../math/geometry/point.js";
7
+ import { AffineConstructor } from "../../../../math/polynomials/affine.js";
8
+ import { TrinomConstructor } from "../../../../math/polynomials/trinom.js";
9
+ import { randfloat } from "../../../../math/utils/random/randfloat.js";
8
10
  import { randint } from "../../../../math/utils/random/randint.js";
9
11
  import { round } from "../../../../math/utils/round.js";
12
+ import { valueParser } from "../../../../tree/parsers/valueParser.js";
10
13
  import { coinFlip } from "../../../../utils/alea/coinFlip.js";
14
+ import { probaFlip } from "../../../../utils/alea/probaFlip.js";
11
15
  import { shuffle } from "../../../../utils/alea/shuffle.js";
16
+ const rebuildIdentifiers = (oldIds) => {
17
+ if (oldIds.points?.length)
18
+ return oldIds;
19
+ const [x, y] = [oldIds.xValue, oldIds.yValue];
20
+ let points = [[x, y]];
21
+ if (oldIds.isAffine) {
22
+ const affine = AffineConstructor.fromCoeffs(oldIds.affineCoeffs);
23
+ const x2 = x + 1;
24
+ const y2 = affine.calculate(x2);
25
+ points.push([x2, y2]);
26
+ }
27
+ else {
28
+ const trinom = TrinomConstructor.fromCoeffs(oldIds.trinomCoeffs);
29
+ const x2 = x - 1;
30
+ const x3 = x + 1;
31
+ const y2 = trinom.calculate(x2);
32
+ const y3 = trinom.calculate(x3);
33
+ points.push([x2, y2], [x3, y3]);
34
+ }
35
+ return {
36
+ points,
37
+ yValue: oldIds.yValue,
38
+ };
39
+ };
40
+ const getInstruction = (identifiers) => {
41
+ const { yValue } = identifiers;
42
+ return `Avec la précision permise par le graphique, déterminer le ou les antécédents de $${yValue}$ par la fonction $f$ représentée ci dessous.
43
+
44
+ S'il n'y en a pas, on écrira "aucun".`;
45
+ };
46
+ const getAnswer = (identifiers) => {
47
+ const { points, yValue } = identifiers;
48
+ const validPoints = points.filter((p) => p[1] === yValue);
49
+ if (!validPoints.length) {
50
+ return "\\text{Aucun}";
51
+ }
52
+ return validPoints
53
+ .map((p) => round(p[0], 2).frenchify())
54
+ .join("\\text{ et }");
55
+ };
56
+ const getGGBOptions = (identifiers) => {
57
+ const { points } = identifiers;
58
+ let commands = [];
59
+ if (points.length === 2) {
60
+ const line = new Line(new Point("A", points[0][0], points[0][1]), new Point("B", points[1][0], points[1][1]));
61
+ commands = line.toGGBCommands(false);
62
+ }
63
+ else {
64
+ const parabola = new Parabola(points.map((p, i) => new Point(`A_${i}`, p[0], p[1])));
65
+ commands = parabola.toGGBCommands(false);
66
+ }
67
+ const Xs = points.map((p) => p[0]);
68
+ const Ys = points.map((p) => p[1]);
69
+ const xMin = Math.min(...Xs);
70
+ const xMax = Math.max(...Xs);
71
+ const yMin = Math.min(...Ys);
72
+ const yMax = Math.max(...Ys);
73
+ const ggb = new GeogebraConstructor({ commands });
74
+ return ggb.getOptions({
75
+ coords: ggb.getAdaptedCoords({
76
+ xMin,
77
+ xMax,
78
+ yMin,
79
+ yMax,
80
+ forceShowAxes: true,
81
+ }),
82
+ });
83
+ };
12
84
  const getInverseImageFunctionGeogebra = () => {
13
- const isAffine = coinFlip();
14
- const xValue = randint(-5, 6);
15
- // const yValue = randint(-5, 6);
85
+ const isLine = coinFlip();
86
+ const hasAntecedent = probaFlip(0.8);
87
+ // const isLine = false;
88
+ // const hasAntecedent = true;
16
89
  let yValue;
17
- let affine;
18
- let trinom;
19
- let answer = "";
20
- let xMin = -1;
21
- let xMax = 1;
22
- let yMin = -1;
23
- let yMax = 1;
24
- let commands;
25
- if (isAffine) {
26
- do {
27
- affine = new Affine(randint(-5, 6, [0]), randint(-9, 10));
28
- yValue = affine.calculate(xValue);
29
- } while (Math.abs(yValue) > 10);
30
- answer = xValue.toString().replace(".", ",");
31
- yMin = yValue;
32
- yMax = yValue;
33
- xMin = xValue;
34
- xMax = xValue;
35
- commands = [affine.toString()];
90
+ const points = [];
91
+ if (isLine) {
92
+ if (hasAntecedent) {
93
+ yValue = randint(-6, 7);
94
+ const xIsDecimal = probaFlip(0.3);
95
+ const xValue = xIsDecimal
96
+ ? randfloat(-6, 7, 2, [yValue])
97
+ : randint(-6, 7, [yValue]);
98
+ const wrongY = randint(-6, 7);
99
+ points.push([xValue, yValue], [yValue, wrongY]);
100
+ }
101
+ else {
102
+ yValue = randint(-6, 7, [0]);
103
+ const constante = randint(-6, 7, [yValue]);
104
+ points.push([0, constante], [1, constante]);
105
+ }
36
106
  }
37
107
  else {
38
- let roots;
39
- yValue = randint(-5, 6);
40
- do {
41
- trinom = new Trinom(randint(-4, 5, [0]), randint(-9, 10), randint(-9, 10) - yValue);
42
- roots = trinom.getRoots();
43
- } while (roots.some((root) => Math.abs(root) > 10));
44
- answer = !roots.length
45
- ? "\\text{Aucun}"
46
- : roots
47
- .map((r) => round(r, 1).toString().replace(".", ","))
48
- .join("\\text{ et }");
49
- const beta = trinom.getBeta() + yValue;
50
- yMin = trinom.a > 0 ? beta : roots.length ? yValue : beta - 5;
51
- yMax = trinom.a < 0 ? beta : roots.length ? yValue : beta + 5;
52
- xMax = roots.length ? Math.max(...roots) : -10;
53
- xMin = roots.length ? Math.min(...roots) : 10;
54
- commands = [
55
- `f(x) = ${yValue !== 0
56
- ? trinom.add(new Polynomial([yValue])).toString()
57
- : trinom.toString()}`,
58
- `SetColor(f, "${randomColor()}")`,
59
- ];
108
+ if (hasAntecedent) {
109
+ yValue = randint(-6, 7);
110
+ const xIsDecimal = coinFlip();
111
+ const xValue = xIsDecimal
112
+ ? randfloat(-6, 7, 2, [yValue])
113
+ : randint(-6, 7, [yValue]);
114
+ const hasTwoAntecedents = probaFlip(0.8);
115
+ if (hasTwoAntecedents) {
116
+ const wrongY = randint(-6, 7, [yValue]);
117
+ const secondAntecedentPoint = [
118
+ randint(-6, 7, [xValue, yValue]),
119
+ yValue,
120
+ ];
121
+ points.push([xValue, yValue], [yValue, wrongY], secondAntecedentPoint);
122
+ }
123
+ else {
124
+ //(x,y) is summit
125
+ const wrongY = randint(-6, 7, [yValue]);
126
+ points.push([xValue, yValue], [yValue, wrongY], [2 * xValue - yValue, wrongY]);
127
+ }
128
+ }
129
+ else {
130
+ yValue = randint(-8, 9);
131
+ const wrongY = randint(-3, 4, [yValue, yValue - 1, yValue + 1]);
132
+ const below = wrongY < yValue;
133
+ const summit = [
134
+ randint(-6, 7, [yValue]),
135
+ below
136
+ ? randint(wrongY + 1, yValue, [wrongY])
137
+ : randint(yValue + 1, wrongY, [wrongY]),
138
+ ];
139
+ const thirdPoint = [2 * summit[0] - yValue, wrongY];
140
+ //construire deux autrs points au pif avec y sous/audssu yValus
141
+ points.push([yValue, wrongY], summit, thirdPoint);
142
+ }
60
143
  }
61
- const statement = `Lire graphiquement le ou les antécédents de $${yValue}$ par la fonction $f$ représentée ci dessous.`;
62
- const ggb = new GeogebraConstructor({ commands });
144
+ points.sort((p1, p2) => p1[0] - p2[0]);
145
+ const identifiers = {
146
+ // xValue,
147
+ // affineCoeffs: isAffine ? affine!.coefficients : undefined,
148
+ // trinomCoeffs: isAffine ? undefined : trinom!.coefficients,
149
+ yValue,
150
+ points,
151
+ // isAffine,
152
+ };
153
+ return getQuestionFromIdentifiers(identifiers);
154
+ };
155
+ const getQuestionFromIdentifiers = (identifiers) => {
63
156
  const question = {
64
- instruction: statement,
65
- answer,
157
+ instruction: getInstruction(identifiers),
158
+ answer: getAnswer(identifiers),
66
159
  keys: ["et", "aucun"],
67
- ggbOptions: ggb.getOptions({
68
- coords: ggb.getAdaptedCoords({ xMin, xMax, yMin, yMax }),
69
- }),
160
+ ggbOptions: getGGBOptions(identifiers),
70
161
  answerFormat: "tex",
71
- identifiers: {
72
- xValue,
73
- affineCoeffs: isAffine ? affine.coefficients : undefined,
74
- trinomCoeffs: isAffine ? undefined : trinom.coefficients,
75
- yValue,
76
- isAffine,
77
- },
162
+ identifiers,
78
163
  };
79
164
  return question;
80
165
  };
81
- const getPropositions = (n, { answer, xValue, affineCoeffs, trinomCoeffs, yValue, isAffine }) => {
166
+ const getPropositions = (n, { answer, points, yValue }) => {
82
167
  const propositions = [];
83
168
  addValidProp(propositions, answer);
84
169
  tryToAddWrongProp(propositions, "\\text{Aucun}");
85
- if (isAffine) {
86
- const affine = new Polynomial(affineCoeffs);
87
- tryToAddWrongProp(propositions, affine.calculate(yValue).toString().replace(".", ","));
88
- }
89
- else {
90
- const trinom = new Polynomial(trinomCoeffs);
91
- tryToAddWrongProp(propositions, trinom.calculate(yValue).toString().replace(".", ","));
170
+ const wrongY = points.find((p) => p[0] === yValue)?.[1];
171
+ if (wrongY !== undefined) {
172
+ tryToAddWrongProp(propositions, wrongY.frenchify());
92
173
  }
93
174
  while (propositions.length < n) {
94
175
  const wrongAnswer = coinFlip()
@@ -98,26 +179,27 @@ const getPropositions = (n, { answer, xValue, affineCoeffs, trinomCoeffs, yValue
98
179
  }
99
180
  return shuffle(propositions);
100
181
  };
101
- const isAnswerValid = (ans, { answer, xValue, affineCoeffs, trinomCoeffs, yValue, isAffine }) => {
102
- const antecedents = [];
103
- if (isAffine) {
104
- antecedents.push(xValue);
182
+ const isAnswerValid = (ans, { answer, points, yValue }) => {
183
+ if (ans === "\\text{Aucun}" || answer === "\\text{Aucun}")
184
+ return ans === answer;
185
+ const validPoints = points.filter((p) => p[1] === yValue);
186
+ const ansElements = ans.split("\\text{ et }");
187
+ if (validPoints.length !== ansElements.length)
188
+ return false;
189
+ let sorted = [];
190
+ for (const el of ansElements) {
191
+ const parsed = valueParser(el);
192
+ if (parsed === false)
193
+ return false;
194
+ sorted.push(parsed);
105
195
  }
106
- else {
107
- const trinom = new Polynomial(trinomCoeffs);
108
- const roots = trinom.getRoots();
109
- antecedents.push(...roots);
196
+ sorted.sort((a, b) => a - b);
197
+ for (let i = 0; i < sorted.length; i++) {
198
+ const validPointX = validPoints[i][0];
199
+ if (Math.abs(sorted[i] - validPointX) > 0.3)
200
+ return false;
110
201
  }
111
- if (!antecedents.length)
112
- return ans === `\\text{Aucun}`;
113
- const studentNumbers = ans
114
- .split("\\text{ et }")
115
- .map((n) => Number(n.replace(",", ".")))
116
- .filter((n) => !isNaN(n))
117
- .sort((a, b) => a - b);
118
- antecedents.sort((a, b) => a - b);
119
- return (!!studentNumbers.length &&
120
- studentNumbers.every((nb, index) => Math.abs(nb - antecedents[index]) < 0.2));
202
+ return true;
121
203
  };
122
204
  export const inverseImageFunctionGeogebra = {
123
205
  id: "inverseImageFunctionGeogebra",
@@ -133,4 +215,9 @@ export const inverseImageFunctionGeogebra = {
133
215
  isAnswerValid,
134
216
  hasGeogebra: true,
135
217
  subject: "Mathématiques",
218
+ getAnswer,
219
+ getInstruction,
220
+ getGGBOptions,
221
+ getQuestionFromIdentifiers,
222
+ rebuildIdentifiers,
136
223
  };
package/lib/index.d.ts CHANGED
@@ -684,20 +684,18 @@ declare const mathExercises: (Exercise<{
684
684
  }> | Exercise<{
685
685
  functionType: string;
686
686
  x: number;
687
- y: number;
687
+ y?: number;
688
688
  wrongY: number;
689
689
  otherPoints: number[][];
690
+ functionCommand?: string;
690
691
  }, {
691
692
  curveTypes: string[];
692
693
  }> | Exercise<{
693
694
  poly1: number[];
694
695
  xValue: number;
695
696
  }, {}> | Exercise<{
696
- xValue: number;
697
697
  yValue: number;
698
- affineCoeffs?: number[];
699
- trinomCoeffs?: number[];
700
- isAffine: boolean;
698
+ points: number[][];
701
699
  }, {}> | Exercise<{
702
700
  yValue: number;
703
701
  splinePoints: [number, number][];
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAG7D,OAAO,4BAA4B,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,QAAA,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAA+B,CAAC;AACnD,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAA6B,CAAC;AAE/C,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,cAAc,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "math-exercises",
3
3
  "type": "module",
4
- "version": "3.0.8",
4
+ "version": "3.0.9",
5
5
  "description": "Math exercises generator for middle school and high school",
6
6
  "main": "lib/index.js",
7
7
  "files": [