math-exercises 2.2.19 → 2.2.20

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 (42) hide show
  1. package/lib/exercises/math/geometry/euclidianConstructions/buildMediatriceWithCompass.d.ts.map +1 -1
  2. package/lib/exercises/math/geometry/euclidianConstructions/buildMediatriceWithCompass.js +4 -12
  3. package/lib/exercises/math/geometry/index.d.ts +1 -0
  4. package/lib/exercises/math/geometry/index.d.ts.map +1 -1
  5. package/lib/exercises/math/geometry/index.js +1 -0
  6. package/lib/exercises/math/geometry/shapes/basicShapesNaming.d.ts +8 -0
  7. package/lib/exercises/math/geometry/shapes/basicShapesNaming.d.ts.map +1 -0
  8. package/lib/exercises/math/geometry/shapes/basicShapesNaming.js +118 -0
  9. package/lib/exercises/math/geometry/shapes/basicShapesRecognition.d.ts +8 -0
  10. package/lib/exercises/math/geometry/shapes/basicShapesRecognition.d.ts.map +1 -0
  11. package/lib/exercises/math/geometry/shapes/basicShapesRecognition.js +83 -0
  12. package/lib/exercises/math/geometry/shapes/index.d.ts +3 -0
  13. package/lib/exercises/math/geometry/shapes/index.d.ts.map +1 -0
  14. package/lib/exercises/math/geometry/shapes/index.js +18 -0
  15. package/lib/exercises/math/probaStat/conditionalProbability.d.ts +5 -3
  16. package/lib/exercises/math/probaStat/conditionalProbability.d.ts.map +1 -1
  17. package/lib/exercises/math/probaStat/conditionalProbability.js +145 -19
  18. package/lib/exercises/math/sequences/arithmetic/recognizeArithmeticFromGraph.d.ts.map +1 -1
  19. package/lib/exercises/math/sequences/arithmetic/recognizeArithmeticFromGraph.js +3 -4
  20. package/lib/exercises/math/sequences/arithmetic/recognizeReasonFromGraph.d.ts.map +1 -1
  21. package/lib/exercises/math/sequences/arithmetic/recognizeReasonFromGraph.js +3 -4
  22. package/lib/exercises/utils/geogebra/toGGBCommandsProps.d.ts +6 -0
  23. package/lib/exercises/utils/geogebra/toGGBCommandsProps.d.ts.map +1 -0
  24. package/lib/exercises/utils/geogebra/toGGBCommandsProps.js +2 -0
  25. package/lib/index.d.ts +11 -3
  26. package/lib/index.d.ts.map +1 -1
  27. package/lib/math/geometry/line.d.ts +9 -1
  28. package/lib/math/geometry/line.d.ts.map +1 -1
  29. package/lib/math/geometry/line.js +35 -2
  30. package/lib/math/geometry/point.d.ts +2 -1
  31. package/lib/math/geometry/point.d.ts.map +1 -1
  32. package/lib/math/geometry/point.js +6 -2
  33. package/lib/math/geometry/ray.d.ts +15 -0
  34. package/lib/math/geometry/ray.d.ts.map +1 -0
  35. package/lib/math/geometry/ray.js +44 -0
  36. package/lib/math/geometry/segment.d.ts +8 -1
  37. package/lib/math/geometry/segment.d.ts.map +1 -1
  38. package/lib/math/geometry/segment.js +34 -3
  39. package/lib/tree/parsers/isSegmentName.d.ts +2 -0
  40. package/lib/tree/parsers/isSegmentName.d.ts.map +1 -0
  41. package/lib/tree/parsers/isSegmentName.js +15 -0
  42. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"buildMediatriceWithCompass.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/euclidianConstructions/buildMediatriceWithCompass.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAUT,MAAM,0BAA0B,CAAC;AAalC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,EAAE,CAAC;IACZ,CAAC,EAAE,MAAM,EAAE,CAAC;CACb,CAAC;AA8GF,eAAO,MAAM,0BAA0B,EAAE,QAAQ,CAAC,WAAW,CAe5D,CAAC"}
1
+ {"version":3,"file":"buildMediatriceWithCompass.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/euclidianConstructions/buildMediatriceWithCompass.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAUT,MAAM,0BAA0B,CAAC;AAalC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,EAAE,CAAC;IACZ,CAAC,EAAE,MAAM,EAAE,CAAC;CACb,CAAC;AAsGF,eAAO,MAAM,0BAA0B,EAAE,QAAQ,CAAC,WAAW,CAe5D,CAAC"}
@@ -25,12 +25,8 @@ const getBuildMediatriceWithCompassQuestion = () => {
25
25
  const yMin = Math.min(ya, yb) - length;
26
26
  const yMax = Math.max(ya, yb) + length;
27
27
  const ggbAnswer = [
28
- `${pointA.toGGBCommand()}`,
29
- `${pointB.toGGBCommand()}`,
30
- `SetFixed(${A}, true)`,
31
- `SetFixed(${B}, true)`,
32
- `ShowLabel(${A}, true)`,
33
- `ShowLabel(${B}, true)`,
28
+ ...pointA.toGGBCommand(),
29
+ ...pointB.toGGBCommand(),
34
30
  `Seg = Segment(${A},${B})`,
35
31
  `C_1 = Circle(${A},${B})`,
36
32
  `C_2 = Circle(${B},${A})`,
@@ -41,12 +37,8 @@ const getBuildMediatriceWithCompassQuestion = () => {
41
37
  ];
42
38
  const studentGGB = new geogebraConstructor_1.GeogebraConstructor({
43
39
  commands: [
44
- `${pointA.toGGBCommand()}`,
45
- `${pointB.toGGBCommand()}`,
46
- `SetFixed(${A}, true)`,
47
- `SetFixed(${B}, true)`,
48
- `ShowLabel(${A}, true)`,
49
- `ShowLabel(${B}, true)`,
40
+ ...pointA.toGGBCommand(),
41
+ ...pointB.toGGBCommand(),
50
42
  `Seg = Segment(${A},${B})`,
51
43
  ],
52
44
  hideGrid: true,
@@ -7,4 +7,5 @@ export * from "./vectors";
7
7
  export * from "./convexity";
8
8
  export * from "./volumes";
9
9
  export * from "./euclidianConstructions";
10
+ export * from "./shapes";
10
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/geometry/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAE1B,cAAc,0BAA0B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/geometry/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAE1B,cAAc,0BAA0B,CAAC;AACzC,cAAc,UAAU,CAAC"}
@@ -24,3 +24,4 @@ __exportStar(require("./convexity"), exports);
24
24
  __exportStar(require("./volumes"), exports);
25
25
  // export * from "./triangles";
26
26
  __exportStar(require("./euclidianConstructions"), exports);
27
+ __exportStar(require("./shapes"), exports);
@@ -0,0 +1,8 @@
1
+ import { Exercise } from "../../../../exercises/exercise";
2
+ type Identifiers = {
3
+ type: number;
4
+ commands: string[];
5
+ };
6
+ export declare const basicShapesNaming: Exercise<Identifiers>;
7
+ export {};
8
+ //# sourceMappingURL=basicShapesNaming.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"basicShapesNaming.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/shapes/basicShapesNaming.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAUT,MAAM,0BAA0B,CAAC;AAWlC,KAAK,WAAW,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC;AAsGxD,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,WAAW,CAenD,CAAC"}
@@ -0,0 +1,118 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.basicShapesNaming = void 0;
4
+ const exercise_1 = require("../../../../exercises/exercise");
5
+ const getDistinctQuestions_1 = require("../../../../exercises/utils/getDistinctQuestions");
6
+ const geogebraConstructor_1 = require("../../../../geogebra/geogebraConstructor");
7
+ const line_1 = require("../../../../math/geometry/line");
8
+ const ray_1 = require("../../../../math/geometry/ray");
9
+ const segment_1 = require("../../../../math/geometry/segment");
10
+ const randint_1 = require("../../../../math/utils/random/randint");
11
+ //!!Difficile de rendre cet exo non pur QCM car taper la parenthèse ouvre un environnement left/right ce qui empeche de taper des demi droites [AB)
12
+ //!solutions que je vois :
13
+ //! créer une touche parenthèse qui n'ouvre pas left/right (faisable mais relou)
14
+ //! créer des touches [..], (..) et [..) directement (mais il faut déplacer le curseur vers la gauche dans ce cas)
15
+ const getBasicShapesNamingQuestion = () => {
16
+ let answer = "";
17
+ const commands = [];
18
+ const type = (0, randint_1.randint)(1, 4);
19
+ let startPointName = "";
20
+ switch (type) {
21
+ case 1: //segment
22
+ const segment = segment_1.SegmentConstructor.random();
23
+ commands.push(...segment.toGGBCommands(true));
24
+ answer = segment.name;
25
+ break;
26
+ case 2: //demi-droite
27
+ const ray = ray_1.RayConstructor.random();
28
+ commands.push(...ray.toGGBCommands(true));
29
+ answer = ray.name;
30
+ startPointName = ray.startPoint.name;
31
+ break;
32
+ case 3: //droite
33
+ default:
34
+ const line = line_1.LineConstructor.random();
35
+ commands.push(...line.toGGBCommands(true));
36
+ answer = line.name;
37
+ break;
38
+ }
39
+ const ggb = new geogebraConstructor_1.GeogebraConstructor({
40
+ commands,
41
+ hideAxes: true,
42
+ hideGrid: true,
43
+ });
44
+ // const letters = answer.substring(1, answer.length - 1).split("") as KeyId[];
45
+ // console.log(letters);
46
+ const question = {
47
+ answer,
48
+ instruction: `Comment se nomme la figure suivante ?`,
49
+ // keys: ["lbracket", "rbracket", ...letters],
50
+ // keys: [{
51
+ // id: "custom",
52
+ // label: "[...]",
53
+ // labelType: "tex",
54
+ // mathfieldInstructions: {
55
+ // method: "write",
56
+ // content: "[$1]"
57
+ // }
58
+ // }],
59
+ answerFormat: "tex",
60
+ identifiers: { type, commands },
61
+ ggbOptions: ggb.getOptions({
62
+ coords: [-15, 15, -15, 15],
63
+ }),
64
+ hint: `On rappelle que :
65
+
66
+ - Une longueur se note $AB$ ;
67
+ - Un segment se note $[AB]$ ;
68
+ - Une demi-droite d'origine $A$ se note $[AB)$ ;
69
+ - Une droite se note $(AB)$.
70
+ `,
71
+ correction: `La figure tracée est ${type === 1
72
+ ? "un segment"
73
+ : type === 2
74
+ ? `une demi-droite d'origine ${startPointName}$`
75
+ : "une droite"}.
76
+
77
+ Cette figure se nomme donc $${answer}$.`,
78
+ };
79
+ return question;
80
+ };
81
+ const getPropositions = (n, { answer }) => {
82
+ const propositions = [];
83
+ (0, exercise_1.addValidProp)(propositions, answer);
84
+ const name = answer
85
+ .replace("\\left(", "")
86
+ .replace("\\right)", "")
87
+ .replace("[", "")
88
+ .replace("]", "")
89
+ .replace(")", "");
90
+ (0, exercise_1.tryToAddWrongProp)(propositions, "[" + name + "]");
91
+ (0, exercise_1.tryToAddWrongProp)(propositions, "[" + name + ")");
92
+ (0, exercise_1.tryToAddWrongProp)(propositions, "\\left(" + name + "\\right)");
93
+ (0, exercise_1.tryToAddWrongProp)(propositions, name);
94
+ return (0, exercise_1.shuffleProps)(propositions, n);
95
+ };
96
+ const isAnswerValid = (ans, { type, answer }) => {
97
+ const reversedAnswer = answer[0] + answer[2] + answer[1] + answer[3];
98
+ if (type === 2)
99
+ return ans === answer;
100
+ else {
101
+ return ans === answer || ans === reversedAnswer;
102
+ }
103
+ };
104
+ exports.basicShapesNaming = {
105
+ id: "basicShapesNaming",
106
+ connector: "=",
107
+ label: "Nommer un segment/une demi-droite/une droite",
108
+ levels: [],
109
+ isSingleStep: true,
110
+ sections: [],
111
+ generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getBasicShapesNamingQuestion, nb),
112
+ qcmTimer: 60,
113
+ freeTimer: 60,
114
+ getPropositions,
115
+ isAnswerValid,
116
+ subject: "Mathématiques",
117
+ answerType: "QCU",
118
+ };
@@ -0,0 +1,8 @@
1
+ import { Exercise } from "../../../../exercises/exercise";
2
+ type Identifiers = {
3
+ type: number;
4
+ commands: string[];
5
+ };
6
+ export declare const basicShapesRecognition: Exercise<Identifiers>;
7
+ export {};
8
+ //# sourceMappingURL=basicShapesRecognition.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"basicShapesRecognition.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/shapes/basicShapesRecognition.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAUT,MAAM,0BAA0B,CAAC;AAUlC,KAAK,WAAW,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC;AAmExD,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,CAexD,CAAC"}
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.basicShapesRecognition = void 0;
4
+ const exercise_1 = require("../../../../exercises/exercise");
5
+ const getDistinctQuestions_1 = require("../../../../exercises/utils/getDistinctQuestions");
6
+ const geogebraConstructor_1 = require("../../../../geogebra/geogebraConstructor");
7
+ const line_1 = require("../../../../math/geometry/line");
8
+ const point_1 = require("../../../../math/geometry/point");
9
+ const ray_1 = require("../../../../math/geometry/ray");
10
+ const segment_1 = require("../../../../math/geometry/segment");
11
+ const randint_1 = require("../../../../math/utils/random/randint");
12
+ const randomLetter_1 = require("../../../../utils/strings/randomLetter");
13
+ const getBasicShapesRecognitionQuestion = () => {
14
+ let answer = "";
15
+ const commands = [];
16
+ const type = (0, randint_1.randint)(0, 4);
17
+ switch (type) {
18
+ case 0: //point
19
+ answer = "Un point";
20
+ const point = point_1.PointConstructor.random((0, randomLetter_1.randomLetter)(true));
21
+ commands.push(...point.toGGBCommand());
22
+ break;
23
+ case 1: //segment
24
+ answer = "Un segment";
25
+ const segment = segment_1.SegmentConstructor.random();
26
+ commands.push(...segment.toGGBCommands(true));
27
+ break;
28
+ case 2: //demi-droite
29
+ answer = "Une demi-droite";
30
+ const ray = ray_1.RayConstructor.random();
31
+ commands.push(...ray.toGGBCommands(true));
32
+ break;
33
+ case 3: //droite
34
+ default:
35
+ answer = "Une droite";
36
+ const line = line_1.LineConstructor.random();
37
+ commands.push(...line.toGGBCommands(true));
38
+ break;
39
+ }
40
+ const ggb = new geogebraConstructor_1.GeogebraConstructor({
41
+ commands,
42
+ hideAxes: true,
43
+ hideGrid: true,
44
+ });
45
+ const question = {
46
+ answer,
47
+ instruction: `Quel est le type d'objet tracé ci-dessous ?`,
48
+ keys: [],
49
+ answerFormat: "raw",
50
+ identifiers: { type, commands },
51
+ ggbOptions: ggb.getOptions({
52
+ coords: [-15, 15, -15, 15],
53
+ }),
54
+ };
55
+ return question;
56
+ };
57
+ const getPropositions = (n, { answer }) => {
58
+ const propositions = [];
59
+ (0, exercise_1.addValidProp)(propositions, answer, "raw");
60
+ (0, exercise_1.tryToAddWrongProp)(propositions, "Un point", "raw");
61
+ (0, exercise_1.tryToAddWrongProp)(propositions, "Une droite", "raw");
62
+ (0, exercise_1.tryToAddWrongProp)(propositions, "Un segment", "raw");
63
+ (0, exercise_1.tryToAddWrongProp)(propositions, "Une demi-droite", "raw");
64
+ return (0, exercise_1.shuffleProps)(propositions, n);
65
+ };
66
+ const isAnswerValid = (ans, { answer }) => {
67
+ return ans === answer;
68
+ };
69
+ exports.basicShapesRecognition = {
70
+ id: "basicShapesRecognition",
71
+ connector: "=",
72
+ label: "Reconnaître un point / un segment / une demi-droite / une droite",
73
+ levels: [],
74
+ isSingleStep: true,
75
+ sections: [],
76
+ generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getBasicShapesRecognitionQuestion, nb),
77
+ qcmTimer: 60,
78
+ freeTimer: 60,
79
+ getPropositions,
80
+ isAnswerValid,
81
+ subject: "Mathématiques",
82
+ answerType: "QCU",
83
+ };
@@ -0,0 +1,3 @@
1
+ export * from "./basicShapesRecognition";
2
+ export * from "./basicShapesNaming";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/shapes/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./basicShapesRecognition"), exports);
18
+ __exportStar(require("./basicShapesNaming"), exports);
@@ -1,9 +1,11 @@
1
1
  import { Exercise } from "../../exercise";
2
2
  type Identifiers = {
3
3
  flip: number;
4
- pA: number;
5
- pB: number;
6
- pAB: number;
4
+ pA?: number;
5
+ pB?: number;
6
+ pAB?: number;
7
+ pA_B?: number;
8
+ pB_A?: number;
7
9
  };
8
10
  export declare const conditionalProbability: Exercise<Identifiers>;
9
11
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"conditionalProbability.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/probaStat/conditionalProbability.ts"],"names":[],"mappings":"AACA,OAAO,EACL,QAAQ,EAQT,MAAM,gBAAgB,CAAC;AAIxB,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAuHF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,CAcxD,CAAC"}
1
+ {"version":3,"file":"conditionalProbability.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/probaStat/conditionalProbability.ts"],"names":[],"mappings":"AACA,OAAO,EACL,QAAQ,EAQT,MAAM,gBAAgB,CAAC;AAKxB,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAyNF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,CAexD,CAAC"}
@@ -6,62 +6,187 @@ const exercise_1 = require("../../exercise");
6
6
  const getDistinctQuestions_1 = require("../../utils/getDistinctQuestions");
7
7
  const round_1 = require("../../../math/utils/round");
8
8
  const shuffle_1 = require("../../../utils/shuffle");
9
+ const alignTex_1 = require("../../../utils/alignTex");
9
10
  const getConditionalProbability = () => {
10
- const pA = (0, randint_1.randint)(2, 100);
11
- const pB = (0, randint_1.randint)(2, 100);
12
- const pAB = (0, randint_1.randint)(1, Math.min(pA, pB));
13
- const pA_B = (0, round_1.round)(pAB / pB, 2);
14
- const pB_A = (0, round_1.round)(pAB / pA, 2);
11
+ let pA, pB, pAB, pA_B, pB_A;
12
+ let pAStr, pBStr, pABStr, pA_BStr, pB_AStr;
15
13
  const flip = (0, randint_1.randint)(1, 7);
16
14
  let instruction = `On considère deux événements $A$ et $B$ tels que `;
17
15
  let startStatement = "";
18
16
  let answer = "";
17
+ let correction = "";
19
18
  switch (flip) {
20
19
  case 1: {
21
- instruction += `$P(A) = ${(pA / 100 + "").replace(".", ",")}\\ $ et $\\ P(A \\cap B) = ${(pAB / 100 + "").replace(".", ",")}$.$\\\\$Déterminer $P_A(B)$.`;
20
+ pA = (0, randint_1.randint)(2, 100);
21
+ pAB = (0, randint_1.randint)(1, pA);
22
+ pAStr = (pA / 100).frenchify();
23
+ pABStr = (pAB / 100).frenchify();
24
+ pB_AStr = (0, round_1.round)(pAB / pA, 2).frenchify();
25
+ instruction += `$P(A) = ${pAStr}\\ $ et $\\ P(A \\cap B) = ${pABStr}$.$\\\\$Déterminer $P_A(B)$ (arrondir au centième).`;
22
26
  startStatement = `P_A(B)`;
23
- answer = `${pB_A}`;
27
+ answer = pB_AStr;
28
+ correction = `
29
+ On sait que :
30
+
31
+ $$
32
+ P_A(B) = \\frac{P(A \\cap B)}{P(A)}
33
+ $$
34
+
35
+ On a donc :
36
+
37
+ $$
38
+ P_A(B) = \\frac{${pABStr}}{${pAStr}} \\approx ${answer}
39
+ $$
40
+ `;
24
41
  break;
25
42
  }
26
43
  case 2: {
27
- instruction += `$P(B) = ${(pB / 100 + "").replace(".", ",")}\\ $ et $\\ P(B \\cap A) = ${(pAB / 100 + "").replace(".", ",")}$.$\\\\$Déterminer $P_B(A)$.`;
44
+ pB = (0, randint_1.randint)(2, 100);
45
+ pAB = (0, randint_1.randint)(1, pB);
46
+ pBStr = (pB / 100).frenchify();
47
+ pABStr = (pAB / 100).frenchify();
48
+ pA_BStr = (0, round_1.round)(pAB / pB, 2).frenchify();
49
+ instruction += `$P(B) = ${pBStr}\\ $ et $\\ P(B \\cap A) = ${pABStr}$.$\\\\$Déterminer $P_B(A)$ (arrondir au centième).`;
28
50
  startStatement = `P_B(A)`;
29
- answer = `${pA_B}`;
51
+ answer = pA_BStr;
52
+ correction = `
53
+ On sait que :
54
+
55
+ $$
56
+ P_B(A) = \\frac{P(A \\cap B)}{P(B)}
57
+ $$
58
+
59
+ On a donc :
60
+
61
+ $$
62
+ P_B(A) = \\frac{${pABStr}}{${pBStr}} \\approx ${answer}
63
+ $$
64
+ `;
30
65
  break;
31
66
  }
32
67
  case 3: {
33
- instruction += `$P(A) = ${(pA / 100 + "").replace(".", ",")}\\ $ et $\\ P_A(B) = ${(pB_A + "").replace(".", ",")}$.$\\\\$Déterminer $P(A \\cap B)$.`;
68
+ pA = (0, randint_1.randint)(2, 100);
69
+ pAStr = (pA / 100).frenchify();
70
+ pB_A = (0, randint_1.randint)(1, pA);
71
+ pB_AStr = (pB_A / 100).frenchify();
72
+ pAB = (0, round_1.round)((pB_A * pA) / 10000, 2);
73
+ pABStr = pAB.frenchify();
74
+ instruction += `$P(A) = ${pAStr}\\ $ et $\\ P_A(B) = ${pB_AStr}$.$\\\\$Déterminer $P(A \\cap B)$ (arrondir au centième).`;
34
75
  startStatement = `P(A \\cap B)`;
35
- answer = `${pAB / 100}`;
76
+ answer = pABStr;
77
+ correction = `
78
+ On sait que :
79
+
80
+ $$
81
+ P_A(B) = \\frac{P(A \\cap B)}{P(A)}
82
+ $$
83
+
84
+ On a donc :
85
+
86
+ ${(0, alignTex_1.alignTex)([
87
+ ["P(A \\cap B)", "=", "P_A(B)\\times P(A)"],
88
+ ["", "=", `${pB_AStr}\\times ${pAStr}`],
89
+ ["", "\\approx", answer],
90
+ ])}
91
+ `;
36
92
  break;
37
93
  }
38
94
  case 4: {
39
- instruction += `$P(B) = ${(pB / 100 + "").replace(".", ",")}\\ $ et $\\ P_B(A) = ${(pA_B + "").replace(".", ",")}$.$\\\\$Déterminer $P(A \\cap B)$.`;
95
+ pB = (0, randint_1.randint)(2, 100);
96
+ pBStr = (pB / 100).frenchify();
97
+ pA_B = (0, randint_1.randint)(1, pB);
98
+ pA_BStr = pA_B.frenchify();
99
+ pAB = (0, round_1.round)((pA_B * pB) / 10000, 2);
100
+ pABStr = pAB.frenchify();
101
+ instruction += `$P(B) = ${pBStr}\\ $ et $\\ P_B(A) = ${pA_BStr}$.$\\\\$Déterminer $P(A \\cap B)$ (arrondir au centième).`;
40
102
  startStatement = `P(A \\cap B)`;
41
- answer = `${pAB / 100}`;
103
+ answer = pABStr;
104
+ correction = `
105
+ On sait que :
106
+
107
+ $$
108
+ P_B(A) = \\frac{P(A \\cap B)}{P(B)}
109
+ $$
110
+
111
+ On a donc :
112
+
113
+ ${(0, alignTex_1.alignTex)([
114
+ ["P(A \\cap B)", "=", "P_B(A)\\times P(B)"],
115
+ ["", "=", `${pA_BStr}\\times ${pBStr}`],
116
+ ["", "\\approx", answer],
117
+ ])}
118
+ `;
42
119
  break;
43
120
  }
44
121
  case 5: {
45
- instruction += `$P(A \\cap B) = ${(pAB / 100 + "").replace(".", ",")}\\ $ et $\\ P_B(A) = ${(pA_B + "").replace(".", ",")}$.$\\\\$Déterminer $P(B)$.`;
122
+ pA_B = (0, randint_1.randint)(1, 100);
123
+ pAB = (0, randint_1.randint)(1, pA_B);
124
+ pABStr = (pAB / 100).frenchify();
125
+ pA_BStr = (pA_B / 100).frenchify();
126
+ pB = (0, round_1.round)(pAB / pA_B, 2);
127
+ pBStr = pB.frenchify();
128
+ instruction += `$P(A \\cap B) = ${pABStr}\\ $ et $\\ P_B(A) = ${pA_BStr}$.$\\\\$Déterminer $P(B)$ (arrondir au centième).`;
46
129
  startStatement = `P(B)`;
47
- answer = `${pB / 100}`;
130
+ answer = pBStr;
131
+ correction = `
132
+ On sait que :
133
+
134
+ $$
135
+ P_B(A) = \\frac{P(A \\cap B)}{P(B)}
136
+ $$
137
+
138
+ On a donc :
139
+
140
+ ${(0, alignTex_1.alignTex)([
141
+ ["P(B)", "=", "\\frac{P(A\\cap B)}{P_B(A)}"],
142
+ ["", "=", `\\frac{${pABStr}}{${pA_BStr}}`],
143
+ ["", "\\approx", answer],
144
+ ])}
145
+ `;
48
146
  break;
49
147
  }
50
148
  case 6: {
51
- instruction += `$P(A \\cap B) = ${(pAB / 100 + "").replace(".", ",")}\\ $ et $\\ P_A(B) = ${(pB_A + "").replace(".", ",")}$.$\\\\$Déterminer $P(A)$.`;
149
+ pB_A = (0, randint_1.randint)(1, 100);
150
+ pAB = (0, randint_1.randint)(1, pB_A);
151
+ pABStr = (pAB / 100).frenchify();
152
+ pB_AStr = (pB_A / 100).frenchify();
153
+ pA = (0, round_1.round)(pAB / pB_A, 2);
154
+ pAStr = pA.frenchify();
155
+ instruction += `$P(A \\cap B) = ${pABStr}\\ $ et $\\ P_A(B) = ${pB_AStr}$.$\\\\$Déterminer $P(A)$ (arrondir au centième).`;
52
156
  startStatement = `P(A)`;
53
- answer = `${pA / 100}`;
157
+ answer = pAStr;
158
+ correction = `
159
+ On sait que :
160
+
161
+ $$
162
+ P_A(B) = \\frac{P(A \\cap B)}{P(A)}
163
+ $$
164
+
165
+ On a donc :
166
+
167
+ ${(0, alignTex_1.alignTex)([
168
+ ["P(A)", "=", "\\frac{P(A\\cap B)}{P_A(B)}"],
169
+ ["", "=", `\\frac{${pABStr}}{${pB_AStr}}`],
170
+ ["", "\\approx", answer],
171
+ ])}
172
+ `;
54
173
  break;
55
174
  }
56
175
  }
57
- answer = answer.replace(".", ",");
58
176
  const question = {
59
177
  instruction,
60
178
  startStatement,
61
179
  answer,
62
180
  keys: ["p", "cap", "underscore"],
63
181
  answerFormat: "tex",
64
- identifiers: { flip, pA, pAB, pB },
182
+ identifiers: { flip, pA, pAB, pB, pA_B, pB_A },
183
+ hint: `Pour deux événements $M$ et $N$, on a:
184
+
185
+ $$
186
+ P_M(N) = \\frac{P(M \\cap N)}{P(M)}
187
+ $$
188
+ `,
189
+ correction,
65
190
  };
66
191
  return question;
67
192
  };
@@ -89,4 +214,5 @@ exports.conditionalProbability = {
89
214
  getPropositions,
90
215
  isAnswerValid,
91
216
  subject: "Mathématiques",
217
+ hasHintAndCorrection: true,
92
218
  };
@@ -1 +1 @@
1
- {"version":3,"file":"recognizeArithmeticFromGraph.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/arithmetic/recognizeArithmeticFromGraph.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,0BAA0B,CAAC;AAQlC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,OAAO,CAAC;IACf,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB,CAAC;AA6EF,eAAO,MAAM,4BAA4B,EAAE,QAAQ,CAAC,WAAW,CAe9D,CAAC"}
1
+ {"version":3,"file":"recognizeArithmeticFromGraph.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/arithmetic/recognizeArithmeticFromGraph.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,0BAA0B,CAAC;AAQlC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,OAAO,CAAC;IACf,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB,CAAC;AA8EF,eAAO,MAAM,4BAA4B,EAAE,QAAQ,CAAC,WAAW,CAe9D,CAAC"}
@@ -42,10 +42,9 @@ const getRecognizeArithmeticFromGraphQuestion = () => {
42
42
  ? new Array(10).fill(0).map((el, index) => firstAriTerm + reason * index)
43
43
  : getRandomFirstNonAriTerms();
44
44
  const answer = isAri ? "Oui" : "Non";
45
- const commands = sequence.flatMap((nb, index) => [
46
- new point_1.Point(`A_${index}`, index.toTree(), nb.toTree()).toGGBCommand(),
47
- `SetFixed(A_${index}, true)`,
48
- ]);
45
+ const commands = sequence.flatMap((nb, index) => new point_1.Point(`A_${index}`, index.toTree(), nb.toTree()).toGGBCommand({
46
+ showLabel: false,
47
+ }));
49
48
  const ggb = new geogebraConstructor_1.GeogebraConstructor({
50
49
  commands,
51
50
  lockedAxesRatio: false,
@@ -1 +1 @@
1
- {"version":3,"file":"recognizeReasonFromGraph.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/arithmetic/recognizeReasonFromGraph.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,0BAA0B,CAAC;AAMlC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB,CAAC;AAiDF,eAAO,MAAM,wBAAwB,EAAE,QAAQ,CAAC,WAAW,CAe1D,CAAC"}
1
+ {"version":3,"file":"recognizeReasonFromGraph.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/arithmetic/recognizeReasonFromGraph.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,0BAA0B,CAAC;AAMlC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB,CAAC;AAkDF,eAAO,MAAM,wBAAwB,EAAE,QAAQ,CAAC,WAAW,CAe1D,CAAC"}
@@ -14,10 +14,9 @@ const getRecognizeReasonFromGraphQuestion = () => {
14
14
  .map((el, index) => firstTerm + index * reason);
15
15
  const yMin = Math.min(...sequence.slice(0, 5));
16
16
  const yMax = Math.max(...sequence.slice(0, 5));
17
- const commands = sequence.flatMap((nb, index) => [
18
- new point_1.Point(`A_${index}`, index.toTree(), nb.toTree()).toGGBCommand(),
19
- `SetFixed(A_${index}, true)`,
20
- ]);
17
+ const commands = sequence.flatMap((nb, index) => new point_1.Point(`A_${index}`, index.toTree(), nb.toTree()).toGGBCommand({
18
+ showLabel: false,
19
+ }));
21
20
  const ggb = new geogebraConstructor_1.GeogebraConstructor({
22
21
  commands,
23
22
  xAxis: { natural: true },
@@ -0,0 +1,6 @@
1
+ export type ToGGBCommandsProps = {
2
+ isFixed?: boolean;
3
+ showLabel?: boolean;
4
+ showUnderlyingPointsLabel?: boolean;
5
+ };
6
+ //# sourceMappingURL=toGGBCommandsProps.d.ts.map
@@ -0,0 +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;CACrC,CAAC"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/lib/index.d.ts CHANGED
@@ -967,6 +967,12 @@ declare const mathExercises: (import("./exercises/exercise").Exercise<{
967
967
  }> | import("./exercises/exercise").Exercise<{
968
968
  A: number[];
969
969
  B: number[];
970
+ }> | import("./exercises/exercise").Exercise<{
971
+ type: number;
972
+ commands: string[];
973
+ }> | import("./exercises/exercise").Exercise<{
974
+ type: number;
975
+ commands: string[];
970
976
  }> | import("./exercises/exercise").Exercise<{
971
977
  coeffs: number[];
972
978
  to: string;
@@ -1097,9 +1103,11 @@ declare const mathExercises: (import("./exercises/exercise").Exercise<{
1097
1103
  questionType: string;
1098
1104
  }> | import("./exercises/exercise").Exercise<{
1099
1105
  flip: number;
1100
- pA: number;
1101
- pB: number;
1102
- pAB: number;
1106
+ pA?: number | undefined;
1107
+ pB?: number | undefined;
1108
+ pAB?: number | undefined;
1109
+ pA_B?: number | undefined;
1110
+ pB_A?: number | undefined;
1103
1111
  }> | import("./exercises/exercise").Exercise<{
1104
1112
  isParityQuestion: boolean;
1105
1113
  isEvenQuestion: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,OAAO,yBAAyB,CAAC;AAEjC,QAAA,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAA+B,CAAC;AACnD,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAA6B,CAAC;AAE/C,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,CAAC"}
@@ -1,18 +1,26 @@
1
+ import { ToGGBCommandsProps } from "../../exercises/utils/geogebra/toGGBCommandsProps";
1
2
  import { AlgebraicNode } from "../../tree/nodes/algebraicNode";
2
3
  import { EqualNode } from "../../tree/nodes/equations/equalNode";
3
4
  import { Point } from "./point";
4
5
  import { Vector } from "./vector";
6
+ export declare abstract class LineConstructor {
7
+ static random(name?: string): Line;
8
+ }
5
9
  export declare class Line {
6
10
  pointA: Point;
7
11
  pointB: Point;
8
12
  isVertical: boolean;
9
13
  a: AlgebraicNode | undefined;
10
14
  b: AlgebraicNode | undefined;
11
- constructor(pointA: Point, pointB: Point);
15
+ name: string;
16
+ ggbName: string;
17
+ constructor(pointA: Point, pointB: Point, name?: string);
12
18
  getParallele(point: Point): Line;
13
19
  includes(point: Point, allowApprox?: boolean): boolean;
14
20
  getRandomPoint(name?: string): Point;
15
21
  getEquation: (u: Vector, a: Point) => EqualNode;
16
22
  getCartesianEquation(): EqualNode;
23
+ toTex(): string;
24
+ toGGBCommands(shouldBuildPoints: boolean, { isFixed, showLabel, showUnderlyingPointsLabel, }?: ToGGBCommandsProps): string[];
17
25
  }
18
26
  //# 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,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AAQjE,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,qBAAa,IAAI;IACf,MAAM,EAAE,KAAK,CAAC;IACd,MAAM,EAAE,KAAK,CAAC;IACd,UAAU,EAAE,OAAO,CAAC;IACpB,CAAC,EAAE,aAAa,GAAG,SAAS,CAAC;IAC7B,CAAC,EAAE,aAAa,GAAG,SAAS,CAAC;gBACjB,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK;IAkBxC,YAAY,CAAC,KAAK,EAAE,KAAK;IASzB,QAAQ,CAAC,KAAK,EAAE,KAAK,EAAE,WAAW,GAAE,OAAe;IAgBnD,cAAc,CAAC,IAAI,CAAC,EAAE,MAAM;IAa5B,WAAW,MAAO,MAAM,KAAK,KAAK,KAAG,SAAS,CAmB5C;IAEF,oBAAoB,IAAI,SAAS;CAsBlC"}
1
+ {"version":3,"file":"line.d.ts","sourceRoot":"","sources":["../../../src/math/geometry/line.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,mDAAmD,CAAC;AAEvF,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AAQjE,OAAO,EAAE,KAAK,EAAoB,MAAM,SAAS,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,8BAAsB,eAAe;IACnC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,MAAM;CAK5B;AACD,qBAAa,IAAI;IACf,MAAM,EAAE,KAAK,CAAC;IACd,MAAM,EAAE,KAAK,CAAC;IACd,UAAU,EAAE,OAAO,CAAC;IACpB,CAAC,EAAE,aAAa,GAAG,SAAS,CAAC;IAC7B,CAAC,EAAE,aAAa,GAAG,SAAS,CAAC;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;gBACJ,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,MAAM;IAoBvD,YAAY,CAAC,KAAK,EAAE,KAAK;IASzB,QAAQ,CAAC,KAAK,EAAE,KAAK,EAAE,WAAW,GAAE,OAAe;IAgBnD,cAAc,CAAC,IAAI,CAAC,EAAE,MAAM;IAa5B,WAAW,MAAO,MAAM,KAAK,KAAK,KAAG,SAAS,CAmB5C;IAEF,oBAAoB,IAAI,SAAS;IAuBjC,KAAK;IAIL,aAAa,CACX,iBAAiB,EAAE,OAAO,EAC1B,EACE,OAAc,EACd,SAAiB,EACjB,yBAAgC,GACjC,GAAE,kBAAuB;CAoB7B"}
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Line = void 0;
3
+ exports.Line = exports.LineConstructor = void 0;
4
+ const randomSegmentName_1 = require("../../exercises/utils/geometry/randomSegmentName");
4
5
  const equalNode_1 = require("../../tree/nodes/equations/equalNode");
5
6
  const numberNode_1 = require("../../tree/nodes/numbers/numberNode");
6
7
  const addNode_1 = require("../../tree/nodes/operators/addNode");
@@ -11,8 +12,16 @@ const variableNode_1 = require("../../tree/nodes/variables/variableNode");
11
12
  const randint_1 = require("../utils/random/randint");
12
13
  const point_1 = require("./point");
13
14
  const vector_1 = require("./vector");
15
+ class LineConstructor {
16
+ static random(name) {
17
+ const names = (0, randomSegmentName_1.randomSegmentName)();
18
+ const points = point_1.PointConstructor.randomDifferent(names.split(""));
19
+ return new Line(points[0], points[1], name);
20
+ }
21
+ }
22
+ exports.LineConstructor = LineConstructor;
14
23
  class Line {
15
- constructor(pointA, pointB) {
24
+ constructor(pointA, pointB, name) {
16
25
  this.getEquation = (u, a) => {
17
26
  const x = new variableNode_1.VariableNode("x");
18
27
  const y = new variableNode_1.VariableNode("y");
@@ -28,6 +37,8 @@ class Line {
28
37
  };
29
38
  this.pointA = pointA;
30
39
  this.pointB = pointB;
40
+ this.name = name ?? `\\left(${pointA.name}${pointB.name}\\right)`;
41
+ this.ggbName = name ?? `line_{${pointA.name}${pointB.name}}`;
31
42
  this.isVertical = pointA.x.equals(pointB.x);
32
43
  if (this.isVertical) {
33
44
  this.a = undefined;
@@ -80,5 +91,27 @@ class Line {
80
91
  const y = new variableNode_1.VariableNode("y");
81
92
  return new equalNode_1.EqualNode(new addNode_1.AddNode(new addNode_1.AddNode(new multiplyNode_1.MultiplyNode(new numberNode_1.NumberNode(a), x).simplify(), new multiplyNode_1.MultiplyNode(new numberNode_1.NumberNode(b), y).simplify()), new numberNode_1.NumberNode(c)).simplify({ forbidFactorize: true }), new numberNode_1.NumberNode(0));
82
93
  }
94
+ toTex() {
95
+ return this.name;
96
+ }
97
+ toGGBCommands(shouldBuildPoints, { isFixed = true, showLabel = false, showUnderlyingPointsLabel = true, } = {}) {
98
+ const commands = [
99
+ `${this.ggbName}=Line(${this.pointA.name},${this.pointB.name})`,
100
+ `SetFixed(${this.ggbName},${isFixed ? "true" : "false"})`,
101
+ `ShowLabel(${this.ggbName},${showLabel ? "true" : "false"})`,
102
+ ];
103
+ if (shouldBuildPoints) {
104
+ const ACommands = this.pointA.toGGBCommand({
105
+ isFixed,
106
+ showLabel: showUnderlyingPointsLabel,
107
+ });
108
+ const BCommands = this.pointB.toGGBCommand({
109
+ isFixed,
110
+ showLabel: showUnderlyingPointsLabel,
111
+ });
112
+ commands.unshift(...ACommands, ...BCommands);
113
+ }
114
+ return commands;
115
+ }
83
116
  }
84
117
  exports.Line = Line;
@@ -1,5 +1,6 @@
1
1
  import { NodeIds } from "../../tree/nodes/node";
2
2
  import { AlgebraicNode } from "../../tree/nodes/algebraicNode";
3
+ import { ToGGBCommandsProps } from "../../exercises/utils/geogebra/toGGBCommandsProps";
3
4
  export declare abstract class PointConstructor {
4
5
  static random(name: string): Point;
5
6
  static randomDifferent(names: string[]): Point[];
@@ -29,6 +30,6 @@ export declare class Point {
29
30
  distanceTo(B: Point): number;
30
31
  equals(B: Point): boolean;
31
32
  isAligned(B: Point, C: Point): boolean;
32
- toGGBCommand(): string;
33
+ toGGBCommand({ isFixed, showLabel }?: ToGGBCommandsProps): string[];
33
34
  }
34
35
  //# sourceMappingURL=point.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"point.d.ts","sourceRoot":"","sources":["../../../src/math/geometry/point.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAY,MAAM,uBAAuB,CAAC;AAI1D,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAI/D,8BAAsB,gBAAgB;IACpC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,KAAK;IAMlC,MAAM,CAAC,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE;IAetC,MAAM,CAAC,cAAc,CAAC,GAAG,EAAE,MAAM;CAclC;AAED,qBAAa,KAAK;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,EAAE,aAAa,CAAC;IACjB,CAAC,EAAE,aAAa,CAAC;gBACL,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,aAAa,EAAE,CAAC,EAAE,aAAa;IAM5D,KAAK,IAAI,MAAM;IAGf,aAAa;;;;;;;;;;IAQb,eAAe,IAAI,MAAM;IAGzB,QAAQ,IAAI,MAAM;IAIlB,UAAU,IAAI,MAAM;IAM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EAAE,CAAC,EAAE,KAAK;IAM5B,YAAY,CAAC,EAAE,OAAc,EAAE,SAAgB,EAAE,GAAE,kBAAuB;CAO3E"}
@@ -96,8 +96,12 @@ class Point {
96
96
  const AC = vector_1.VectorConstructor.fromPoints(this, C);
97
97
  return AB.isColinear(AC);
98
98
  }
99
- toGGBCommand() {
100
- return `${this.name} = (${this.x.toMathString()}, ${this.y.toMathString()})`;
99
+ toGGBCommand({ isFixed = true, showLabel = true } = {}) {
100
+ return [
101
+ `${this.name} = (${this.x.toMathString()}, ${this.y.toMathString()})`,
102
+ `SetFixed(${this.name},${isFixed ? "true" : "false"})`,
103
+ `ShowLabel(${this.name},${showLabel ? "true" : "false"})`,
104
+ ];
101
105
  }
102
106
  }
103
107
  exports.Point = Point;
@@ -0,0 +1,15 @@
1
+ import { ToGGBCommandsProps } from "../../exercises/utils/geogebra/toGGBCommandsProps";
2
+ import { Point } from "./point";
3
+ export declare abstract class RayConstructor {
4
+ static random(name?: string): Ray;
5
+ }
6
+ export declare class Ray {
7
+ startPoint: Point;
8
+ secondPoint: Point;
9
+ name: string;
10
+ ggbName: string;
11
+ constructor(startPoint: Point, secondPoint: Point, name?: string);
12
+ toTex(): string;
13
+ toGGBCommands(shouldBuildPoints: boolean, { isFixed, showLabel, showUnderlyingPointsLabel, }?: ToGGBCommandsProps): string[];
14
+ }
15
+ //# sourceMappingURL=ray.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ray.d.ts","sourceRoot":"","sources":["../../../src/math/geometry/ray.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,mDAAmD,CAAC;AAEvF,OAAO,EAAE,KAAK,EAAoB,MAAM,SAAS,CAAC;AAElD,8BAAsB,cAAc;IAClC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,MAAM;CAK5B;AAED,qBAAa,GAAG;IACd,UAAU,EAAE,KAAK,CAAC;IAClB,WAAW,EAAE,KAAK,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;gBACJ,UAAU,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,MAAM;IAOhE,KAAK;IAGL,aAAa,CACX,iBAAiB,EAAE,OAAO,EAC1B,EACE,OAAc,EACd,SAAiB,EACjB,yBAAgC,GACjC,GAAE,kBAAuB;CAoB7B"}
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Ray = exports.RayConstructor = void 0;
4
+ const randomSegmentName_1 = require("../../exercises/utils/geometry/randomSegmentName");
5
+ const point_1 = require("./point");
6
+ class RayConstructor {
7
+ static random(name) {
8
+ const names = (0, randomSegmentName_1.randomSegmentName)();
9
+ const points = point_1.PointConstructor.randomDifferent(names.split(""));
10
+ return new Ray(points[0], points[1], name);
11
+ }
12
+ }
13
+ exports.RayConstructor = RayConstructor;
14
+ class Ray {
15
+ constructor(startPoint, secondPoint, name) {
16
+ this.startPoint = startPoint;
17
+ this.secondPoint = secondPoint;
18
+ this.name = name ?? `[${startPoint.name}${secondPoint.name})`;
19
+ this.ggbName = name ?? `ray_{${startPoint.name}${secondPoint.name}}`;
20
+ }
21
+ toTex() {
22
+ return this.name;
23
+ }
24
+ toGGBCommands(shouldBuildPoints, { isFixed = true, showLabel = false, showUnderlyingPointsLabel = true, } = {}) {
25
+ const commands = [
26
+ `${this.ggbName}=Ray(${this.startPoint.name},${this.secondPoint.name})`,
27
+ `SetFixed(${this.ggbName},${isFixed ? "true" : "false"})`,
28
+ `ShowLabel(${this.ggbName},${showLabel ? "true" : "false"})`,
29
+ ];
30
+ if (shouldBuildPoints) {
31
+ const ACommands = this.startPoint.toGGBCommand({
32
+ isFixed,
33
+ showLabel: showUnderlyingPointsLabel,
34
+ });
35
+ const BCommands = this.secondPoint.toGGBCommand({
36
+ isFixed,
37
+ showLabel: showUnderlyingPointsLabel,
38
+ });
39
+ commands.unshift(...ACommands, ...BCommands);
40
+ }
41
+ return commands;
42
+ }
43
+ }
44
+ exports.Ray = Ray;
@@ -1,9 +1,16 @@
1
+ import { ToGGBCommandsProps } from "../../exercises/utils/geogebra/toGGBCommandsProps";
1
2
  import { Point } from "./point";
3
+ export declare abstract class SegmentConstructor {
4
+ static random(): Segment;
5
+ }
2
6
  export declare class Segment {
3
7
  pointA: Point;
4
8
  pointB: Point;
9
+ name: string;
10
+ ggbName: string;
5
11
  constructor(pointA: Point, pointB: Point);
6
12
  getLength(): number;
7
- getName(): string;
13
+ toTex(): string;
14
+ toGGBCommands(shouldBuildPoints: boolean, { isFixed, showLabel, showUnderlyingPointsLabel, }?: ToGGBCommandsProps): string[];
8
15
  }
9
16
  //# sourceMappingURL=segment.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"segment.d.ts","sourceRoot":"","sources":["../../../src/math/geometry/segment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,qBAAa,OAAO;IAClB,MAAM,EAAE,KAAK,CAAC;IACd,MAAM,EAAE,KAAK,CAAC;gBACF,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK;IAIxC,SAAS;IAGT,OAAO;CAMR"}
1
+ {"version":3,"file":"segment.d.ts","sourceRoot":"","sources":["../../../src/math/geometry/segment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,mDAAmD,CAAC;AAEvF,OAAO,EAAE,KAAK,EAAoB,MAAM,SAAS,CAAC;AAElD,8BAAsB,kBAAkB;IACtC,MAAM,CAAC,MAAM;CAKd;AACD,qBAAa,OAAO;IAClB,MAAM,EAAE,KAAK,CAAC;IACd,MAAM,EAAE,KAAK,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;gBACJ,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK;IAMxC,SAAS;IAGT,KAAK;IAGL,aAAa,CACX,iBAAiB,EAAE,OAAO,EAC1B,EACE,OAAc,EACd,SAAiB,EACjB,yBAAgC,GACjC,GAAE,kBAAuB;CAoB7B"}
@@ -1,16 +1,47 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Segment = void 0;
3
+ exports.Segment = exports.SegmentConstructor = void 0;
4
+ const randomSegmentName_1 = require("../../exercises/utils/geometry/randomSegmentName");
5
+ const point_1 = require("./point");
6
+ class SegmentConstructor {
7
+ static random() {
8
+ const name = (0, randomSegmentName_1.randomSegmentName)();
9
+ const points = point_1.PointConstructor.randomDifferent(name.split(""));
10
+ return new Segment(points[0], points[1]);
11
+ }
12
+ }
13
+ exports.SegmentConstructor = SegmentConstructor;
4
14
  class Segment {
5
15
  constructor(pointA, pointB) {
6
16
  this.pointA = pointA;
7
17
  this.pointB = pointB;
18
+ this.name = `[${pointA.name}${pointB.name}]`;
19
+ this.ggbName = `segment_{${pointA.name}${pointB.name}}`;
8
20
  }
9
21
  getLength() {
10
22
  return this.pointA.distanceTo(this.pointB);
11
23
  }
12
- getName() {
13
- return `\\left[${this.pointA.name}, ${this.pointB.name}\\right]`;
24
+ toTex() {
25
+ return this.name;
26
+ }
27
+ toGGBCommands(shouldBuildPoints, { isFixed = true, showLabel = false, showUnderlyingPointsLabel = true, } = {}) {
28
+ const commands = [
29
+ `${this.ggbName}=Segment(${this.pointA.name},${this.pointB.name})`,
30
+ `SetFixed(${this.ggbName},${isFixed ? "true" : "false"})`,
31
+ `ShowLabel(${this.ggbName},${showLabel ? "true" : "false"})`,
32
+ ];
33
+ if (shouldBuildPoints) {
34
+ const ACommands = this.pointA.toGGBCommand({
35
+ isFixed,
36
+ showLabel: showUnderlyingPointsLabel,
37
+ });
38
+ const BCommands = this.pointB.toGGBCommand({
39
+ isFixed,
40
+ showLabel: showUnderlyingPointsLabel,
41
+ });
42
+ commands.unshift(...ACommands, ...BCommands);
43
+ }
44
+ return commands;
14
45
  }
15
46
  }
16
47
  exports.Segment = Segment;
@@ -0,0 +1,2 @@
1
+ export declare const isSegmentName: (ans: string) => boolean;
2
+ //# sourceMappingURL=isSegmentName.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isSegmentName.d.ts","sourceRoot":"","sources":["../../../src/tree/parsers/isSegmentName.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,aAAa,QAAS,MAAM,YAUxC,CAAC"}
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isSegmentName = void 0;
4
+ const isLetter_1 = require("../../utils/strings/isLetter");
5
+ //to use when the answer is a segment type [AB]
6
+ const isSegmentName = (ans) => {
7
+ if (ans.length === 4 &&
8
+ ans[0] === "[" &&
9
+ ans[ans.length - 1] === "]" &&
10
+ (0, isLetter_1.isLetter)(ans[1]) &&
11
+ (0, isLetter_1.isLetter)(ans[2]))
12
+ return true;
13
+ return false;
14
+ };
15
+ exports.isSegmentName = isSegmentName;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "math-exercises",
3
- "version": "2.2.19",
3
+ "version": "2.2.20",
4
4
  "description": "Math exercises generator for middle school and high school",
5
5
  "main": "lib/index.js",
6
6
  "files": [