math-exercises 2.0.27 → 2.0.28

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 (27) hide show
  1. package/lib/exercises/derivation/derivative/thirdDegreeFunctionVariation.d.ts.map +1 -1
  2. package/lib/exercises/derivation/derivative/thirdDegreeFunctionVariation.js +13 -10
  3. package/lib/exercises/derivation/derivativeNumberReading.d.ts.map +1 -1
  4. package/lib/exercises/derivation/derivativeNumberReading.js +16 -3
  5. package/lib/exercises/functions/affines/affineExpressionReading.d.ts.map +1 -1
  6. package/lib/exercises/functions/affines/affineExpressionReading.js +5 -1
  7. package/lib/exercises/functions/affines/interceptReading.d.ts.map +1 -1
  8. package/lib/exercises/functions/affines/interceptReading.js +6 -2
  9. package/lib/exercises/functions/affines/leadingCoefficient.d.ts.map +1 -1
  10. package/lib/exercises/functions/affines/leadingCoefficient.js +5 -1
  11. package/lib/exercises/functions/basics/graphicEquation.d.ts.map +1 -1
  12. package/lib/exercises/functions/basics/graphicEquation.js +2 -0
  13. package/lib/exercises/functions/basics/graphicInequation.d.ts.map +1 -1
  14. package/lib/exercises/functions/basics/graphicInequation.js +2 -0
  15. package/lib/exercises/functions/basics/imageFunctionGeogebra.d.ts.map +1 -1
  16. package/lib/exercises/functions/basics/imageFunctionGeogebra.js +6 -2
  17. package/lib/exercises/functions/basics/inverseImageFunctionGeogebra.d.ts.map +1 -1
  18. package/lib/exercises/functions/basics/inverseImageFunctionGeogebra.js +4 -2
  19. package/lib/exercises/geometry/vectors/coordinatesReading.d.ts.map +1 -1
  20. package/lib/exercises/geometry/vectors/coordinatesReading.js +2 -0
  21. package/lib/exercises/limits/limitReading.d.ts.map +1 -1
  22. package/lib/exercises/limits/limitReading.js +9 -1
  23. package/lib/geogebra/colors.d.ts +25 -0
  24. package/lib/geogebra/colors.d.ts.map +1 -0
  25. package/lib/geogebra/colors.js +31 -0
  26. package/lib/geogebra/geogebraConstructor.js +4 -4
  27. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"thirdDegreeFunctionVariation.d.ts","sourceRoot":"","sources":["../../../../src/exercises/derivation/derivative/thirdDegreeFunctionVariation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAQb,MAAM,0BAA0B,CAAC;AAgBlC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAsGF,eAAO,MAAM,4BAA4B,EAAE,YAAY,CAAC,WAAW,CAsBlE,CAAC"}
1
+ {"version":3,"file":"thirdDegreeFunctionVariation.d.ts","sourceRoot":"","sources":["../../../../src/exercises/derivation/derivative/thirdDegreeFunctionVariation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAQb,MAAM,0BAA0B,CAAC;AAiBlC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAkGF,eAAO,MAAM,4BAA4B,EAAE,YAAY,CAAC,WAAW,CAsBlE,CAAC"}
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.thirdDegreeFunctionVariation = void 0;
4
4
  const exercise_1 = require("../../../exercises/exercise");
5
5
  const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
6
+ const colors_1 = require("../../../geogebra/colors");
6
7
  const geogebraConstructor_1 = require("../../../geogebra/geogebraConstructor");
7
8
  const polynomial_1 = require("../../../math/polynomials/polynomial");
8
9
  const randint_1 = require("../../../math/utils/random/randint");
@@ -30,9 +31,16 @@ const getThirdDegreeFunctionVariation = () => {
30
31
  const answer = coin * a < 0
31
32
  ? `[${racine1};${racine2}]`
32
33
  : `]-\\infty;${racine1}]\\cup[${racine2};+\\infty[`;
33
- const commands = [polynome.toString()];
34
- const ymax = Math.max(polynome.calculate(racine1), polynome.calculate(racine2));
35
- const ymin = Math.min(polynome.calculate(racine1), polynome.calculate(racine2));
34
+ const commands = [
35
+ `f(x) = ${polynome.toString()}`,
36
+ `SetColor(f, "${(0, colors_1.randomColor)()}")`,
37
+ ];
38
+ const y1 = polynome.calculate(racine1);
39
+ const y2 = polynome.calculate(racine2);
40
+ const yMax = Math.max(y1, y2);
41
+ const yMin = Math.min(y1, y2);
42
+ const xMax = Math.max(racine1, racine2);
43
+ const xMin = Math.min(racine1, racine2);
36
44
  const ggb = new geogebraConstructor_1.GeogebraConstructor(commands, {
37
45
  isAxesRatioFixed: false,
38
46
  isGridSimple: true,
@@ -42,14 +50,9 @@ const getThirdDegreeFunctionVariation = () => {
42
50
  instruction,
43
51
  startStatement: "S",
44
52
  answer,
45
- keys: ["lbracket", "rbracket", "semicolon", "infty"],
53
+ keys: ["lbracket", "rbracket", "semicolon", "infty", "cup"],
46
54
  answerFormat: "tex",
47
- coords: [
48
- Math.min(racine1 - ((0, randint_1.randint)(7, 20) / 10) * (racine2 - racine1), -1),
49
- Math.max(racine2 + ((0, randint_1.randint)(7, 20) / 10) * (racine2 - racine1), 1),
50
- Math.min(ymin - ((ymax - ymin) * (0, randint_1.randint)(7, 20)) / 10, -1),
51
- Math.max(ymax + ((ymax - ymin) * (0, randint_1.randint)(7, 20)) / 10, 1),
52
- ],
55
+ coords: ggb.getAdaptedCoords({ xMin, xMax, yMin, yMax }),
53
56
  commands: ggb.commands,
54
57
  options: ggb.getOptions(),
55
58
  identifiers: { racine1, racine2, coin, a },
@@ -1 +1 @@
1
- {"version":3,"file":"derivativeNumberReading.d.ts","sourceRoot":"","sources":["../../../src/exercises/derivation/derivativeNumberReading.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAQb,MAAM,0BAA0B,CAAC;AAUlC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,EAAE,CAAC;IACZ,CAAC,EAAE,MAAM,EAAE,CAAC;CACb,CAAC;AAiFF,eAAO,MAAM,uBAAuB,EAAE,YAAY,CAAC,WAAW,CAa7D,CAAC"}
1
+ {"version":3,"file":"derivativeNumberReading.d.ts","sourceRoot":"","sources":["../../../src/exercises/derivation/derivativeNumberReading.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAQb,MAAM,0BAA0B,CAAC;AAmBlC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,EAAE,CAAC;IACZ,CAAC,EAAE,MAAM,EAAE,CAAC;CACb,CAAC;AA4FF,eAAO,MAAM,uBAAuB,EAAE,YAAY,CAAC,WAAW,CAa7D,CAAC"}
@@ -3,6 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.derivativeNumberReading = void 0;
4
4
  const exercise_1 = require("../../exercises/exercise");
5
5
  const getDistinctQuestions_1 = require("../../exercises/utils/getDistinctQuestions");
6
+ const colors_1 = require("../../geogebra/colors");
7
+ const geogebraConstructor_1 = require("../../geogebra/geogebraConstructor");
6
8
  const integer_1 = require("../../math/numbers/integer/integer");
7
9
  const rational_1 = require("../../math/numbers/rationals/rational");
8
10
  const polynomial_1 = require("../../math/polynomials/polynomial");
@@ -35,19 +37,30 @@ const getDerivativeNumberReading = () => {
35
37
  const instruction = `Ci-dessous sont tracées la courbe $\\mathcal C_f$ de la fonction $f$ et la tangente à cette courbe au point d'abscisse $${xA}$.$\\\\$ Déterminer $f'(${xA})$.`;
36
38
  const commands = [
37
39
  `f(x) = ${polynome.toString()}`,
40
+ `SetColor(f, "${colors_1.blueMain}")`,
38
41
  `SetCaption(f, "$\\mathcal C_f$")`,
39
42
  `ShowLabel(f, true)`,
40
43
  `g(x) = (${penteString}) * x + (${originString})`,
44
+ `SetColor(g, "${colors_1.orange}")`,
41
45
  `A = (${xA},${yA})`,
46
+ "SetFixed(A, true) ",
42
47
  ];
43
- // const ggb = new GeogebraConstructor(commands);
48
+ const xMin = Math.min(xA, xB);
49
+ const yMin = Math.min(yA, yB);
50
+ const xMax = Math.max(xA, xB);
51
+ const yMax = Math.max(yA, yB);
52
+ const ggb = new geogebraConstructor_1.GeogebraConstructor(commands, {
53
+ isGridSimple: true,
54
+ });
44
55
  const answer = penteTree.toTex();
45
56
  const question = {
46
57
  instruction,
47
58
  startStatement: "a",
48
59
  answer,
49
- commands,
50
- coords: [xA - 5, xA + 5, yA - 5, yA + 5],
60
+ commands: ggb.commands,
61
+ // coords: ggb.getAdaptedCoords({ xMax, xMin, yMax, yMin }),
62
+ coords: [xMin - 5, xMax + 5, yMin - 5, yMax + 5],
63
+ options: ggb.getOptions(),
51
64
  answerFormat: "tex",
52
65
  keys: [],
53
66
  identifiers: { A: [xA, yA], B: [xB, yB] },
@@ -1 +1 @@
1
- {"version":3,"file":"affineExpressionReading.d.ts","sourceRoot":"","sources":["../../../../src/exercises/functions/affines/affineExpressionReading.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EASb,MAAM,0BAA0B,CAAC;AAclC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB,CAAC;AA4GF,eAAO,MAAM,uBAAuB,EAAE,YAAY,CAAC,WAAW,CAa7D,CAAC"}
1
+ {"version":3,"file":"affineExpressionReading.d.ts","sourceRoot":"","sources":["../../../../src/exercises/functions/affines/affineExpressionReading.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EASb,MAAM,0BAA0B,CAAC;AAelC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB,CAAC;AA+GF,eAAO,MAAM,uBAAuB,EAAE,YAAY,CAAC,WAAW,CAa7D,CAAC"}
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.affineExpressionReading = void 0;
4
4
  const exercise_1 = require("../../../exercises/exercise");
5
5
  const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
6
+ const colors_1 = require("../../../geogebra/colors");
6
7
  const geogebraConstructor_1 = require("../../../geogebra/geogebraConstructor");
7
8
  const rational_1 = require("../../../math/numbers/rationals/rational");
8
9
  const affine_1 = require("../../../math/polynomials/affine");
@@ -23,7 +24,10 @@ const getAffineExpressionReadingQuestion = () => {
23
24
  let xMax = Math.max(0, secondPoint[0]);
24
25
  let yMin = Math.min(b, secondPoint[1]);
25
26
  let yMax = Math.max(b, secondPoint[1]);
26
- const commands = [`Line((0, ${b}), (${secondPoint[0]}, ${secondPoint[1]}))`];
27
+ const commands = [
28
+ `l = Line((0, ${b}), (${secondPoint[0]}, ${secondPoint[1]}))`,
29
+ `SetColor(l, "${(0, colors_1.randomColor)()}")`,
30
+ ];
27
31
  const ggb = new geogebraConstructor_1.GeogebraConstructor(commands, {
28
32
  gridDistance: [1, 1],
29
33
  isGridSimple: true,
@@ -1 +1 @@
1
- {"version":3,"file":"interceptReading.d.ts","sourceRoot":"","sources":["../../../../src/exercises/functions/affines/interceptReading.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EASb,MAAM,0BAA0B,CAAC;AAiBlC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB,CAAC;AAqDF,eAAO,MAAM,gBAAgB,EAAE,YAAY,CAAC,WAAW,CAatD,CAAC"}
1
+ {"version":3,"file":"interceptReading.d.ts","sourceRoot":"","sources":["../../../../src/exercises/functions/affines/interceptReading.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EASb,MAAM,0BAA0B,CAAC;AAkBlC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB,CAAC;AAwDF,eAAO,MAAM,gBAAgB,EAAE,YAAY,CAAC,WAAW,CAatD,CAAC"}
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.interceptReading = void 0;
4
4
  const exercise_1 = require("../../../exercises/exercise");
5
5
  const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
6
+ const colors_1 = require("../../../geogebra/colors");
6
7
  const geogebraConstructor_1 = require("../../../geogebra/geogebraConstructor");
7
8
  const frenchify_1 = require("../../../math/utils/latex/frenchify");
8
9
  const randint_1 = require("../../../math/utils/random/randint");
@@ -15,7 +16,10 @@ const getInterceptReadingQuestion = () => {
15
16
  let xMax = Math.max(0, secondPoint[0]);
16
17
  let yMin = Math.min(b, secondPoint[1]);
17
18
  let yMax = Math.max(b, secondPoint[1]);
18
- const commands = [`Line((0, ${b}), (${secondPoint[0]}, ${secondPoint[1]}))`];
19
+ const commands = [
20
+ `l = Line((0, ${b}), (${secondPoint[0]}, ${secondPoint[1]}))`,
21
+ `SetColor(l, "${(0, colors_1.randomColor)()}")`,
22
+ ];
19
23
  const ggb = new geogebraConstructor_1.GeogebraConstructor(commands, {
20
24
  gridDistance: [1, 1],
21
25
  isGridSimple: true,
@@ -24,7 +28,7 @@ const getInterceptReadingQuestion = () => {
24
28
  answer,
25
29
  instruction: `Ci-dessous est tracée la courbe représentative d'une fonction affine $f$. Déterminer graphiquement l'ordonnée à l'origine $b$ de la fonction $f$.`,
26
30
  keys: [],
27
- commands: [`Line((0, ${b}), (${secondPoint[0]}, ${secondPoint[1]}))`],
31
+ commands: ggb.commands,
28
32
  coords: ggb.getAdaptedCoords({ xMin, xMax, yMin, yMax }),
29
33
  options: ggb.getOptions(),
30
34
  answerFormat: "tex",
@@ -1 +1 @@
1
- {"version":3,"file":"leadingCoefficient.d.ts","sourceRoot":"","sources":["../../../../src/exercises/functions/affines/leadingCoefficient.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAQb,MAAM,0BAA0B,CAAC;AASlC,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAoEF,eAAO,MAAM,kBAAkB,EAAE,YAAY,CAAC,WAAW,CAaxD,CAAC"}
1
+ {"version":3,"file":"leadingCoefficient.d.ts","sourceRoot":"","sources":["../../../../src/exercises/functions/affines/leadingCoefficient.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAQb,MAAM,0BAA0B,CAAC;AAUlC,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAuEF,eAAO,MAAM,kBAAkB,EAAE,YAAY,CAAC,WAAW,CAaxD,CAAC"}
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.leadingCoefficient = void 0;
4
4
  const exercise_1 = require("../../../exercises/exercise");
5
5
  const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
6
+ const colors_1 = require("../../../geogebra/colors");
6
7
  const geogebraConstructor_1 = require("../../../geogebra/geogebraConstructor");
7
8
  const integer_1 = require("../../../math/numbers/integer/integer");
8
9
  const rational_1 = require("../../../math/numbers/rationals/rational");
@@ -24,7 +25,10 @@ const getLeadingCoefficientQuestion = () => {
24
25
  const xMax = Math.max(xA, xB);
25
26
  const yMin = Math.min(yA, yB);
26
27
  const yMax = Math.max(yA, yB);
27
- const commands = [`f(x) = (${aString}) * x + (${bString})`];
28
+ const commands = [
29
+ `f(x) = (${aString}) * x + (${bString})`,
30
+ `SetColor(f, "${(0, colors_1.randomColor)()}")`,
31
+ ];
28
32
  const ggb = new geogebraConstructor_1.GeogebraConstructor(commands, {
29
33
  isGridSimple: true,
30
34
  });
@@ -1 +1 @@
1
- {"version":3,"file":"graphicEquation.d.ts","sourceRoot":"","sources":["../../../../src/exercises/functions/basics/graphicEquation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EASb,MAAM,0BAA0B,CAAC;AAclC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC;CAClC,CAAC;AAiGF,eAAO,MAAM,eAAe,EAAE,YAAY,CAAC,WAAW,CAarD,CAAC"}
1
+ {"version":3,"file":"graphicEquation.d.ts","sourceRoot":"","sources":["../../../../src/exercises/functions/basics/graphicEquation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EASb,MAAM,0BAA0B,CAAC;AAelC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC;CAClC,CAAC;AAkGF,eAAO,MAAM,eAAe,EAAE,YAAY,CAAC,WAAW,CAarD,CAAC"}
@@ -4,6 +4,7 @@ exports.graphicEquation = void 0;
4
4
  const exercise_1 = require("../../../exercises/exercise");
5
5
  const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
6
6
  const discreteSetKeys_1 = require("../../../exercises/utils/keys/discreteSetKeys");
7
+ const colors_1 = require("../../../geogebra/colors");
7
8
  const geogebraConstructor_1 = require("../../../geogebra/geogebraConstructor");
8
9
  const randint_1 = require("../../../math/utils/random/randint");
9
10
  const equationSolutionNode_1 = require("../../../tree/nodes/equations/equationSolutionNode");
@@ -55,6 +56,7 @@ const getGraphicEquationQuestion = () => {
55
56
  .map((point) => `(${point[0]},${point[1]})`)
56
57
  .join(",")})`,
57
58
  "SetFixed(S, true)",
59
+ `SetColor(S, "${(0, colors_1.randomColor)()}")`,
58
60
  ];
59
61
  const ggb = new geogebraConstructor_1.GeogebraConstructor(commands, {
60
62
  isGridSimple: true,
@@ -1 +1 @@
1
- {"version":3,"file":"graphicInequation.d.ts","sourceRoot":"","sources":["../../../../src/exercises/functions/basics/graphicInequation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EASb,MAAM,0BAA0B,CAAC;AAQlC,OAAO,EAAE,WAAW,EAAgB,MAAM,oCAAoC,CAAC;AAI/E,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC;IACjC,QAAQ,EAAE,OAAO,CAAC;IAClB,WAAW,EAAE,OAAO,CAAC;IACrB,SAAS,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,WAAW,CAAA;KAAE,EAAE,CAAC;CAC7D,CAAC;AA+JF,eAAO,MAAM,iBAAiB,EAAE,YAAY,CAAC,WAAW,CAavD,CAAC"}
1
+ {"version":3,"file":"graphicInequation.d.ts","sourceRoot":"","sources":["../../../../src/exercises/functions/basics/graphicInequation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EASb,MAAM,0BAA0B,CAAC;AASlC,OAAO,EAAE,WAAW,EAAgB,MAAM,oCAAoC,CAAC;AAI/E,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC;IACjC,QAAQ,EAAE,OAAO,CAAC;IAClB,WAAW,EAAE,OAAO,CAAC;IACrB,SAAS,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,WAAW,CAAA;KAAE,EAAE,CAAC;CAC7D,CAAC;AAgKF,eAAO,MAAM,iBAAiB,EAAE,YAAY,CAAC,WAAW,CAavD,CAAC"}
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.graphicInequation = void 0;
4
4
  const exercise_1 = require("../../../exercises/exercise");
5
5
  const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
6
+ const colors_1 = require("../../../geogebra/colors");
6
7
  const geogebraConstructor_1 = require("../../../geogebra/geogebraConstructor");
7
8
  const randint_1 = require("../../../math/utils/random/randint");
8
9
  const inequationSolutionNode_1 = require("../../../tree/nodes/inequations/inequationSolutionNode");
@@ -81,6 +82,7 @@ const getGraphicInequationQuestion = () => {
81
82
  .map((point) => `(${point[0]},${point[1]})`)
82
83
  .join(",")})`,
83
84
  "SetFixed(S, true)",
85
+ `SetColor(S, "${(0, colors_1.randomColor)()}")`,
84
86
  ];
85
87
  const ggb = new geogebraConstructor_1.GeogebraConstructor(commands, {
86
88
  isGridSimple: true,
@@ -1 +1 @@
1
- {"version":3,"file":"imageFunctionGeogebra.d.ts","sourceRoot":"","sources":["../../../../src/exercises/functions/basics/imageFunctionGeogebra.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAQb,MAAM,0BAA0B,CAAC;AAQlC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAwEF,eAAO,MAAM,qBAAqB,EAAE,YAAY,CAAC,WAAW,CAY3D,CAAC"}
1
+ {"version":3,"file":"imageFunctionGeogebra.d.ts","sourceRoot":"","sources":["../../../../src/exercises/functions/basics/imageFunctionGeogebra.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAQb,MAAM,0BAA0B,CAAC;AASlC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AA2EF,eAAO,MAAM,qBAAqB,EAAE,YAAY,CAAC,WAAW,CAY3D,CAAC"}
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.imageFunctionGeogebra = void 0;
4
4
  const exercise_1 = require("../../../exercises/exercise");
5
5
  const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
6
+ const colors_1 = require("../../../geogebra/colors");
6
7
  const geogebraConstructor_1 = require("../../../geogebra/geogebraConstructor");
7
8
  const polynomial_1 = require("../../../math/polynomials/polynomial");
8
9
  const randint_1 = require("../../../math/utils/random/randint");
@@ -33,7 +34,10 @@ const getImageFunctionGeogebra = () => {
33
34
  const xMax = xValue;
34
35
  const yMin = answer;
35
36
  const yMax = answer;
36
- const commands = [rand ? polynome1.toString() : polynome2.toString()];
37
+ const commands = [
38
+ `f(x) = ${rand ? polynome1.toString() : polynome2.toString()}`,
39
+ `SetColor(f, "${(0, colors_1.randomColor)()}")`,
40
+ ];
37
41
  const ggb = new geogebraConstructor_1.GeogebraConstructor(commands, { isGridSimple: true });
38
42
  const answerTex = answer + "";
39
43
  const question = {
@@ -43,7 +47,7 @@ const getImageFunctionGeogebra = () => {
43
47
  keys: [],
44
48
  commands: ggb.commands,
45
49
  options: ggb.getOptions(),
46
- coords: ggb.getAdaptedCoords({ xMin, xMax, yMin, yMax }),
50
+ coords: [-10, 10, -10, 10],
47
51
  answerFormat: "tex",
48
52
  identifiers: {
49
53
  poly1: polynome1.coefficients,
@@ -1 +1 @@
1
- {"version":3,"file":"inverseImageFunctionGeogebra.d.ts","sourceRoot":"","sources":["../../../../src/exercises/functions/basics/inverseImageFunctionGeogebra.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAQb,MAAM,0BAA0B,CAAC;AAWlC,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;AAyIF,eAAO,MAAM,4BAA4B,EAAE,YAAY,CAAC,WAAW,CAalE,CAAC"}
1
+ {"version":3,"file":"inverseImageFunctionGeogebra.d.ts","sourceRoot":"","sources":["../../../../src/exercises/functions/basics/inverseImageFunctionGeogebra.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAQb,MAAM,0BAA0B,CAAC;AAYlC,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;AA4IF,eAAO,MAAM,4BAA4B,EAAE,YAAY,CAAC,WAAW,CAalE,CAAC"}
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.inverseImageFunctionGeogebra = void 0;
4
4
  const exercise_1 = require("../../../exercises/exercise");
5
5
  const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
6
+ const colors_1 = require("../../../geogebra/colors");
6
7
  const geogebraConstructor_1 = require("../../../geogebra/geogebraConstructor");
7
8
  const affine_1 = require("../../../math/polynomials/affine");
8
9
  const polynomial_1 = require("../../../math/polynomials/polynomial");
@@ -54,9 +55,10 @@ const getInverseImageFunctionGeogebra = () => {
54
55
  xMax = roots.length ? Math.max(...roots) : -10;
55
56
  xMin = roots.length ? Math.min(...roots) : 10;
56
57
  commands = [
57
- yValue !== 0
58
+ `f(x) = ${yValue !== 0
58
59
  ? trinom.add(new polynomial_1.Polynomial([yValue])).toString()
59
- : trinom.toString(),
60
+ : trinom.toString()}`,
61
+ `SetColor(f, "${(0, colors_1.randomColor)()}")`,
60
62
  ];
61
63
  }
62
64
  const statement = `Lire graphiquement le ou les antécédents de $${yValue}$ par la fonction $f$ représentée ci dessous.`;
@@ -1 +1 @@
1
- {"version":3,"file":"coordinatesReading.d.ts","sourceRoot":"","sources":["../../../../src/exercises/geometry/vectors/coordinatesReading.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,YAAY,EAQb,MAAM,0BAA0B,CAAC;AAMlC,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAoEF,eAAO,MAAM,kBAAkB,EAAE,YAAY,CAAC,WAAW,CAaxD,CAAC"}
1
+ {"version":3,"file":"coordinatesReading.d.ts","sourceRoot":"","sources":["../../../../src/exercises/geometry/vectors/coordinatesReading.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,YAAY,EAQb,MAAM,0BAA0B,CAAC;AAOlC,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAqEF,eAAO,MAAM,kBAAkB,EAAE,YAAY,CAAC,WAAW,CAaxD,CAAC"}
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.coordinatesReading = void 0;
4
4
  const exercise_1 = require("../../../exercises/exercise");
5
5
  const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
6
+ const colors_1 = require("../../../geogebra/colors");
6
7
  const geogebraConstructor_1 = require("../../../geogebra/geogebraConstructor");
7
8
  const integer_1 = require("../../../math/numbers/integer/integer");
8
9
  const randint_1 = require("../../../math/utils/random/randint");
@@ -19,6 +20,7 @@ const getCoordinatesReadingQuestion = () => {
19
20
  `u = Vector((${xA},${yA}), (${xB}, ${yB}))`,
20
21
  'SetCaption(u, "$\\overrightarrow u$")',
21
22
  "ShowLabel(u, true)",
23
+ `SetColor(u, "${(0, colors_1.randomColor)()}")`,
22
24
  ];
23
25
  const xMin = Math.min(xA, xB);
24
26
  const yMin = Math.min(yA, yB);
@@ -1 +1 @@
1
- {"version":3,"file":"limitReading.d.ts","sourceRoot":"","sources":["../../../src/exercises/limits/limitReading.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EASb,MAAM,0BAA0B,CAAC;AAuBlC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACvB,CAAC;AAmGF,eAAO,MAAM,YAAY,EAAE,YAAY,CAAC,WAAW,CAYlD,CAAC"}
1
+ {"version":3,"file":"limitReading.d.ts","sourceRoot":"","sources":["../../../src/exercises/limits/limitReading.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EASb,MAAM,0BAA0B,CAAC;AAyBlC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACvB,CAAC;AAyGF,eAAO,MAAM,YAAY,EAAE,YAAY,CAAC,WAAW,CAYlD,CAAC"}
@@ -3,6 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.limitReading = void 0;
4
4
  const exercise_1 = require("../../exercises/exercise");
5
5
  const getDistinctQuestions_1 = require("../../exercises/utils/getDistinctQuestions");
6
+ const colors_1 = require("../../geogebra/colors");
7
+ const geogebraConstructor_1 = require("../../geogebra/geogebraConstructor");
6
8
  const randint_1 = require("../../math/utils/random/randint");
7
9
  const infiniteNode_1 = require("../../tree/nodes/numbers/infiniteNode");
8
10
  const numberNode_1 = require("../../tree/nodes/numbers/numberNode");
@@ -69,12 +71,18 @@ const getLimitReadingQuestion = () => {
69
71
  : infiniteNode_1.PlusInfinityNode.toTex();
70
72
  break;
71
73
  }
74
+ const commands = [`f(x) = ${fct}`, `SetColor(f, "${(0, colors_1.randomColor)()}")`];
75
+ const ggb = new geogebraConstructor_1.GeogebraConstructor(commands, {
76
+ isAxesRatioFixed: false,
77
+ isGridSimple: true,
78
+ });
72
79
  const question = {
73
80
  answer,
74
81
  instruction: `Ci-dessous est tracée la courbe représentative d'une fonction $f$. Déterminer la limite: $\\displaystyle ${new limitNode_1.LimitNode(to, new variableNode_1.VariableNode("f(x)"), from).toTex()}$`,
75
82
  keys: ["infty"],
76
- commands: [fct],
83
+ commands: ggb.commands,
77
84
  coords: [-10, 10, -10, 10],
85
+ options: ggb.getOptions(),
78
86
  answerFormat: "tex",
79
87
  identifiers: { type, to: to.toTex(), from, a },
80
88
  };
@@ -0,0 +1,25 @@
1
+ export declare const red = "#FF3333";
2
+ export declare const pinkDark = "#A10039";
3
+ export declare const pinkMain = "#D83F63";
4
+ export declare const pinkLight = "#FF7390";
5
+ export declare const reds: string[];
6
+ export declare const orangeDark = "#BE5F00";
7
+ export declare const orange = "#F6A118";
8
+ export declare const orangeLight = "#FFBE46";
9
+ export declare const oranges: string[];
10
+ export declare const greenLight = "#54B1B7";
11
+ export declare const greenMain = "#168187";
12
+ export declare const greenDark = "#00545A";
13
+ export declare const greens: string[];
14
+ export declare const blueLight = "#769DFF";
15
+ export declare const blueDark = "#0045AB";
16
+ export declare const blueMain = "#376FDE";
17
+ export declare const blueExtraDark = "#00035D";
18
+ export declare const blues: string[];
19
+ export declare const purpleLight = "#BA86FF";
20
+ export declare const purpleMain = "#8657DE";
21
+ export declare const purpleDark = "#522AAB";
22
+ export declare const purples: string[];
23
+ export declare const colors: string[];
24
+ export declare const randomColor: () => string;
25
+ //# sourceMappingURL=colors.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.randomColor = exports.colors = exports.purples = exports.purpleDark = exports.purpleMain = exports.purpleLight = exports.blues = exports.blueExtraDark = exports.blueMain = exports.blueDark = exports.blueLight = exports.greens = exports.greenDark = exports.greenMain = exports.greenLight = exports.oranges = exports.orangeLight = exports.orange = exports.orangeDark = exports.reds = exports.pinkLight = exports.pinkMain = exports.pinkDark = exports.red = void 0;
4
+ const random_1 = require("../utils/random");
5
+ exports.red = "#FF3333";
6
+ exports.pinkDark = "#A10039";
7
+ exports.pinkMain = "#D83F63";
8
+ exports.pinkLight = "#FF7390";
9
+ exports.reds = [exports.red, exports.pinkDark, exports.pinkLight, exports.pinkMain];
10
+ exports.orangeDark = "#BE5F00";
11
+ exports.orange = "#F6A118";
12
+ exports.orangeLight = "#FFBE46";
13
+ exports.oranges = [exports.orange, exports.orangeDark, exports.orangeLight];
14
+ exports.greenLight = "#54B1B7";
15
+ exports.greenMain = "#168187";
16
+ exports.greenDark = "#00545A";
17
+ exports.greens = [exports.greenDark, exports.greenLight, exports.greenMain];
18
+ exports.blueLight = "#769DFF";
19
+ exports.blueDark = "#0045AB";
20
+ exports.blueMain = "#376FDE";
21
+ exports.blueExtraDark = "#00035D";
22
+ exports.blues = [exports.blueDark, exports.blueExtraDark, exports.blueLight, exports.blueMain];
23
+ exports.purpleLight = "#BA86FF";
24
+ exports.purpleMain = "#8657DE";
25
+ exports.purpleDark = "#522AAB";
26
+ exports.purples = [exports.purpleDark, exports.purpleLight, exports.purpleMain];
27
+ exports.colors = [...exports.reds, ...exports.oranges, ...exports.greens, ...exports.blues, ...exports.purples];
28
+ const randomColor = () => {
29
+ return (0, random_1.random)(exports.colors);
30
+ };
31
+ exports.randomColor = randomColor;
@@ -16,10 +16,10 @@ class GeogebraConstructor {
16
16
  const xDelta = xMax - xMin;
17
17
  const yDelta = yMax - yMin;
18
18
  const coords = [
19
- xMin === xMax ? xMin - 1 : xMin - 0.2 * Math.abs(xDelta),
20
- xMin === xMax ? xMax + 1 : xMax + 0.2 * Math.abs(xDelta),
21
- yMin === yMax ? yMin - 1 : yMin - 0.2 * Math.abs(yDelta),
22
- yMin === yMax ? yMax + 1 : yMax + 0.2 * Math.abs(yDelta),
19
+ xMin === xMax ? xMin - 1 : xMin - Math.max(1, 0.2 * Math.abs(xDelta)),
20
+ xMin === xMax ? xMax + 1 : xMax + Math.max(1, 0.2 * Math.abs(xDelta)),
21
+ yMin === yMax ? yMin - 1 : yMin - Math.max(1, 0.2 * Math.abs(yDelta)),
22
+ yMin === yMax ? yMax + 1 : yMax + Math.max(1, 0.2 * Math.abs(yDelta)),
23
23
  ];
24
24
  if (showAxes) {
25
25
  coords[0] = Math.min(-1, coords[0]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "math-exercises",
3
- "version": "2.0.27",
3
+ "version": "2.0.28",
4
4
  "description": "Math exercises generator for middle school and high school",
5
5
  "main": "lib/index.js",
6
6
  "files": [