math-exercises 3.0.9 → 3.0.10

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.
@@ -6,7 +6,7 @@ type Identifiers = {
6
6
  functionType: string;
7
7
  x: number;
8
8
  y?: number;
9
- wrongY: number;
9
+ wrongY?: number;
10
10
  otherPoints: number[][];
11
11
  functionCommand?: string;
12
12
  };
@@ -1 +1 @@
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"}
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;AAyBrC,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,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,EAAE,EAAE,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC;AA0SF,KAAK,OAAO,GAAG;IACb,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AACF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAqBhE,CAAC"}
@@ -13,8 +13,11 @@ import { randfloat } from "../../../../math/utils/random/randfloat.js";
13
13
  import { randint } from "../../../../math/utils/random/randint.js";
14
14
  import { ClosureType } from "../../../../tree/nodes/sets/closure.js";
15
15
  import { IntervalNode } from "../../../../tree/nodes/sets/intervalNode.js";
16
+ import { valueParser } from "../../../../tree/parsers/valueParser.js";
17
+ import { probaFlip } from "../../../../utils/alea/probaFlip.js";
16
18
  import { random } from "../../../../utils/alea/random.js";
17
19
  import { shuffle } from "../../../../utils/alea/shuffle.js";
20
+ import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
18
21
  const rebuildIdentifiers = (oldIds) => {
19
22
  if (oldIds.splinePoints?.length) {
20
23
  const x = oldIds.x;
@@ -51,12 +54,13 @@ const rebuildIdentifiers = (oldIds) => {
51
54
  };
52
55
  const getInstruction = (identifiers, opts) => {
53
56
  const { x } = identifiers;
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
-
57
+ let instruction = `Quelle est l'image de $${x}$ par la fonction $f$ représentée ci dessous ?
58
+
58
59
  On écrira "aucun" si l'image n'existe pas.`;
59
- }
60
+ // if (opts?.curveTypes?.includes("Avec valeur interdite (pas d'image)")) {
61
+ // instruction += `
62
+ // On écrira "aucun" si l'image n'existe pas.`;
63
+ // }
60
64
  return instruction;
61
65
  };
62
66
  const getAnswer = (identifiers) => {
@@ -67,18 +71,25 @@ const getAnswer = (identifiers) => {
67
71
  };
68
72
  const getGGBOptions = (identifiers) => {
69
73
  const { functionType, otherPoints, wrongY, x, y, functionCommand } = identifiers;
70
- const allPoints = [...otherPoints, [x, y], [wrongY, x]].sort((a, b) => a[0] - b[0]);
74
+ const allPoints = [...otherPoints];
75
+ if (y !== undefined)
76
+ allPoints.push([x, y]);
77
+ if (wrongY !== undefined)
78
+ allPoints.push([wrongY, x]);
79
+ allPoints.sort((a, b) => a[0] - b[0]);
71
80
  let commands = [];
72
81
  switch (functionType) {
73
82
  case "Avec valeur interdite (pas d'image)":
74
83
  commands = [
75
84
  `f(x) = ${functionCommand}`,
76
85
  `SetColor(f, "${randomColor()}")`,
86
+ `SetCaption(f, "$f$")`,
87
+ `ShowLabel(f, true)`,
77
88
  ];
78
89
  break;
79
90
  case "Droites":
80
91
  const line = new Line(new Point("A", allPoints[0][0], allPoints[0][1]), new Point("B", allPoints[1][0], allPoints[1][1]));
81
- commands = line.toGGBCommands(false);
92
+ commands = line.toGGBCommands(false, { showLabel: true, label: "$f$" });
82
93
  break;
83
94
  case "Tracés":
84
95
  //! on devrait plutôt build a spline et renvoyer toGgbCommand
@@ -88,6 +99,8 @@ const getGGBOptions = (identifiers) => {
88
99
  .join(",")})`,
89
100
  "SetFixed(S, true)",
90
101
  `SetColor(S, "${randomColor()}")`,
102
+ `SetCaption(S, "$f$")`,
103
+ `ShowLabel(S, true)`,
91
104
  ];
92
105
  break;
93
106
  case "Paraboles":
@@ -96,7 +109,10 @@ const getGGBOptions = (identifiers) => {
96
109
  new Point("B", allPoints[1][0], allPoints[1][1]),
97
110
  new Point("C", allPoints[2][0], allPoints[2][1]),
98
111
  ]);
99
- commands = parabola.toGGBCommands(false);
112
+ commands = parabola.toGGBCommands(false, {
113
+ showLabel: true,
114
+ label: "$f$",
115
+ });
100
116
  break;
101
117
  case "Polynômes":
102
118
  default:
@@ -107,6 +123,8 @@ const getGGBOptions = (identifiers) => {
107
123
  .join(",")})`,
108
124
  "SetFixed(P, true)",
109
125
  `SetColor(P, "${randomColor()}")`,
126
+ `SetCaption(P, "$f$")`,
127
+ `ShowLabel(P, true)`,
110
128
  ];
111
129
  break;
112
130
  }
@@ -146,12 +164,12 @@ const getStartStatement = (identifiers) => {
146
164
  return `f(${x})`;
147
165
  };
148
166
  const getKeys = (identifiers, options) => {
149
- if (options?.curveTypes?.includes("Avec valeur interdite (pas d'image)")) {
150
- return ["aucun"];
151
- }
152
- else {
153
- return [];
154
- }
167
+ // if (options?.curveTypes?.includes("Avec valeur interdite (pas d'image)")) {
168
+ // return ["aucun"];
169
+ // } else {
170
+ // return [];
171
+ // }
172
+ return ["aucun"];
155
173
  };
156
174
  const getQuestionFromIdentifiers = (identifiers, opts) => {
157
175
  const question = {
@@ -179,6 +197,11 @@ const getImageFunctionGeogebra = (opts) => {
179
197
  functionCommand = `${k}/(x-${x}) -x`;
180
198
  break;
181
199
  case "Droites":
200
+ const isConstante = probaFlip(0.2);
201
+ if (isConstante) {
202
+ wrongY = undefined;
203
+ otherPoints.push([x + 1, y]);
204
+ }
182
205
  //nothing to add
183
206
  break;
184
207
  case "Tracés":
@@ -216,15 +239,27 @@ const getImageFunctionGeogebra = (opts) => {
216
239
  const getPropositions = (n, { answer, wrongY }, opts) => {
217
240
  const propositions = [];
218
241
  addValidProp(propositions, answer);
219
- //old questions have spline POint undefined
220
- tryToAddWrongProp(propositions, wrongY + "");
242
+ if (wrongY !== undefined)
243
+ tryToAddWrongProp(propositions, wrongY + "");
244
+ tryToAddWrongProp(propositions, "\\text{Aucun}");
221
245
  while (propositions.length < n) {
222
- const wrongAnswer = Number(answer) + randint(-10, 11, [0]);
246
+ const wrongAnswer = randint(-10, 11, [0]);
223
247
  tryToAddWrongProp(propositions, wrongAnswer + "");
224
248
  }
225
249
  return shuffle(propositions);
226
250
  };
227
251
  const isAnswerValid = (ans, { answer }, opts) => {
252
+ if (answer === "\\text{Aucun}")
253
+ return ans === answer;
254
+ try {
255
+ const parsed = valueParser(ans);
256
+ if (parsed === false)
257
+ return false;
258
+ return Math.abs(parsed - answer.unfrenchify()) < 0.3;
259
+ }
260
+ catch (err) {
261
+ return handleVEAError(err);
262
+ }
228
263
  return numberVEA(ans, answer);
229
264
  };
230
265
  const options = [
@@ -261,4 +296,6 @@ export const imageFunctionGeogebra = {
261
296
  getGGBOptions,
262
297
  rebuildIdentifiers,
263
298
  getQuestionFromIdentifiers,
299
+ getKeys,
300
+ getStartStatement,
264
301
  };
@@ -7,5 +7,6 @@ export type ToGGBCommandsProps = {
7
7
  size?: number;
8
8
  color?: string;
9
9
  showLength?: boolean;
10
+ label?: string;
10
11
  };
11
12
  //# sourceMappingURL=toGGBCommandsProps.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"toGGBCommandsProps.d.ts","sourceRoot":"","sources":["../../../../src/exercises/utils/geogebra/toGGBCommandsProps.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,kBAAkB,GAAG;IAC/B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC"}
1
+ {"version":3,"file":"toGGBCommandsProps.d.ts","sourceRoot":"","sources":["../../../../src/exercises/utils/geogebra/toGGBCommandsProps.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,kBAAkB,GAAG;IAC/B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC"}
package/lib/index.d.ts CHANGED
@@ -685,7 +685,7 @@ declare const mathExercises: (Exercise<{
685
685
  functionType: string;
686
686
  x: number;
687
687
  y?: number;
688
- wrongY: number;
688
+ wrongY?: number;
689
689
  otherPoints: number[][];
690
690
  functionCommand?: string;
691
691
  }, {
@@ -49,7 +49,7 @@ export declare class Line {
49
49
  };
50
50
  toTex(): string;
51
51
  toTexNoLeftRight(): string;
52
- toGGBCommands(shouldBuildPoints: boolean, { isFixed, showLabel, showUnderlyingPointsLabel, showUnderlyingPoints, }?: ToGGBCommandsProps): string[];
52
+ toGGBCommands(shouldBuildPoints: boolean, { isFixed, showLabel, showUnderlyingPointsLabel, showUnderlyingPoints, color, label, }?: ToGGBCommandsProps): string[];
53
53
  intersect(line: Line, intersectName?: string): Point;
54
54
  }
55
55
  //# sourceMappingURL=line.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"line.d.ts","sourceRoot":"","sources":["../../../src/math/geometry/line.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sDAAsD,CAAC;AAE1F,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAGpE,OAAO,EAAE,OAAO,EAAO,MAAM,uCAAuC,CAAC;AAMrE,OAAO,EACL,aAAa,EAEd,MAAM,6CAA6C,CAAC;AAKrD,OAAO,EAAE,KAAK,EAAoB,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACvE,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,MAAM,EAAqB,MAAM,aAAa,CAAC;AAExD,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,gBAAgB,CAAC;IACzB,MAAM,EAAE,gBAAgB,CAAC;CAC1B,CAAC;AACF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;IAOb,WAAW,CAAC,IAAI,EAAE,IAAI;IAYtB,iBAAiB;IAIjB,YAAY,CAAC,KAAK,EAAE,KAAK;IAYzB,gBAAgB,CAAC,KAAK,EAAE,KAAK;IAW7B,QAAQ,CAAC,KAAK,EAAE,KAAK,EAAE,WAAW,GAAE,OAAe;IAgBnD,aAAa,CAAC,CAAC,EAAE,aAAa,EAAE,IAAI,CAAC,EAAE,MAAM;IAK7C,aAAa,CAAC,CAAC,EAAE,aAAa,EAAE,IAAI,CAAC,EAAE,MAAM;IAW7C,cAAc,CAAC,IAAI,CAAC,EAAE,MAAM;IAa5B,WAAW,MAAO,MAAM,KAAK,KAAK,KAAG,SAAS,CAmB5C;IAEF,oBAAoB,IAAI,SAAS;IAuBjC,WAAW;IAMX,iBAAiB;;;;;IAcjB,KAAK;IAGL,gBAAgB;IAIhB,aAAa,CACX,iBAAiB,EAAE,OAAO,EAC1B,EACE,OAAc,EACd,SAAiB,EACjB,yBAAgC,EAChC,oBAA2B,EAC3B,KAAiB,EACjB,KAAiB,GAClB,GAAE,kBAAuB;IA2C5B,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,aAAa,CAAC,EAAE,MAAM;CAW7C"}
@@ -1,4 +1,5 @@
1
1
  import { randomSegmentName } from "../../exercises/utils/geometry/randomSegmentName.js";
2
+ import { randomColor } from "../../geogebra/colors.js";
2
3
  import { EqualNode } from "../../tree/nodes/equations/equalNode.js";
3
4
  import { opposite } from "../../tree/nodes/functions/oppositeNode.js";
4
5
  import { NumberNode } from "../../tree/nodes/numbers/numberNode.js";
@@ -176,7 +177,7 @@ export class Line {
176
177
  toTexNoLeftRight() {
177
178
  return this.name.replace("\\left", "").replace("\\right", "");
178
179
  }
179
- toGGBCommands(shouldBuildPoints, { isFixed = true, showLabel = false, showUnderlyingPointsLabel = true, showUnderlyingPoints = true, } = {}) {
180
+ toGGBCommands(shouldBuildPoints, { isFixed = true, showLabel = false, showUnderlyingPointsLabel = true, showUnderlyingPoints = true, color = undefined, label = undefined, } = {}) {
180
181
  const commands = [];
181
182
  if (shouldBuildPoints) {
182
183
  const ACommands = this.pointA.toGGBCommand({
@@ -196,6 +197,15 @@ export class Line {
196
197
  `SetFixed(${this.ggbName},${isFixed ? "true" : "false"})`,
197
198
  `ShowLabel(${this.ggbName},${showLabel ? "true" : "false"})`,
198
199
  ]);
200
+ if (label) {
201
+ commands.push(`SetCaption(${this.ggbName}, "${label}")`);
202
+ }
203
+ if (color) {
204
+ commands.push(`SetColor(${this.ggbName},"${color}")`);
205
+ }
206
+ else {
207
+ commands.push(`SetColor(${this.ggbName},"${randomColor()}")`);
208
+ }
199
209
  return commands;
200
210
  }
201
211
  intersect(line, intersectName) {
@@ -6,6 +6,6 @@ export declare class Parabola {
6
6
  unformatedName: string;
7
7
  ggbName: string;
8
8
  constructor(points: Point[], name?: string);
9
- toGGBCommands(shouldBuildPoints: boolean, { isFixed, showLabel, showUnderlyingPointsLabel, showUnderlyingPoints, }?: ToGGBCommandsProps): string[];
9
+ toGGBCommands(shouldBuildPoints: boolean, { isFixed, showLabel, showUnderlyingPointsLabel, showUnderlyingPoints, label, }?: ToGGBCommandsProps): string[];
10
10
  }
11
11
  //# sourceMappingURL=parabola.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"parabola.d.ts","sourceRoot":"","sources":["../../../src/math/geometry/parabola.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sDAAsD,CAAC;AAC1F,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,qBAAa,QAAQ;IACnB,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;gBACJ,MAAM,EAAE,KAAK,EAAE,EAAE,IAAI,CAAC,EAAE,MAAM;IAS1C,aAAa,CACX,iBAAiB,EAAE,OAAO,EAC1B,EACE,OAAc,EACd,SAAiB,EACjB,yBAAgC,EAChC,oBAA2B,GAC5B,GAAE,kBAAuB;CA+B7B"}
1
+ {"version":3,"file":"parabola.d.ts","sourceRoot":"","sources":["../../../src/math/geometry/parabola.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sDAAsD,CAAC;AAC1F,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,qBAAa,QAAQ;IACnB,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;gBACJ,MAAM,EAAE,KAAK,EAAE,EAAE,IAAI,CAAC,EAAE,MAAM;IAS1C,aAAa,CACX,iBAAiB,EAAE,OAAO,EAC1B,EACE,OAAc,EACd,SAAiB,EACjB,yBAAgC,EAChC,oBAA2B,EAC3B,KAAiB,GAClB,GAAE,kBAAuB;CAkC7B"}
@@ -11,7 +11,7 @@ export class Parabola {
11
11
  this.name = name ?? `\\mathcal{P}_${points.map((p) => p.name)}`;
12
12
  this.ggbName = name ?? `parabola_{${points.map((p) => p.name)}}`;
13
13
  }
14
- toGGBCommands(shouldBuildPoints, { isFixed = true, showLabel = false, showUnderlyingPointsLabel = true, showUnderlyingPoints = true, } = {}) {
14
+ toGGBCommands(shouldBuildPoints, { isFixed = true, showLabel = false, showUnderlyingPointsLabel = true, showUnderlyingPoints = true, label = undefined, } = {}) {
15
15
  const commands = [];
16
16
  if (shouldBuildPoints) {
17
17
  const pointsCommands = this.points.map((p) => p.toGGBCommand({
@@ -23,6 +23,9 @@ export class Parabola {
23
23
  else {
24
24
  commands.push(`${this.ggbName}=Polynomial(${this.points[0].toMathString()},${this.points[1].toMathString()},${this.points[2].toMathString()})`);
25
25
  }
26
+ if (label) {
27
+ commands.push(`SetCaption(${this.ggbName}, "${label}")`);
28
+ }
26
29
  commands.push(...[
27
30
  `SetFixed(${this.ggbName},${isFixed ? "true" : "false"})`,
28
31
  `ShowLabel(${this.ggbName},${showLabel ? "true" : "false"})`,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "math-exercises",
3
3
  "type": "module",
4
- "version": "3.0.9",
4
+ "version": "3.0.10",
5
5
  "description": "Math exercises generator for middle school and high school",
6
6
  "main": "lib/index.js",
7
7
  "files": [