math-exercises 3.0.21 → 3.0.23

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 (70) hide show
  1. package/lib/exercises/exercise.d.ts +2 -0
  2. package/lib/exercises/exercise.d.ts.map +1 -1
  3. package/lib/exercises/math/calculLitteral/equation/multiplicationEquation.d.ts.map +1 -1
  4. package/lib/exercises/math/calculLitteral/equation/multiplicationEquation.js +60 -28
  5. package/lib/exercises/math/derivation/derivative/secondDegreeDerivative.d.ts.map +1 -1
  6. package/lib/exercises/math/derivation/derivative/secondDegreeDerivative.js +5 -3
  7. package/lib/exercises/math/derivation/derivative/thirdDegreeDerivative.d.ts.map +1 -1
  8. package/lib/exercises/math/derivation/derivative/thirdDegreeDerivative.js +5 -3
  9. package/lib/exercises/math/functions/affines/algebricExpressionOfAffine.d.ts.map +1 -1
  10. package/lib/exercises/math/functions/affines/algebricExpressionOfAffine.js +14 -3
  11. package/lib/exercises/math/functions/exponential/expFactorization.d.ts.map +1 -1
  12. package/lib/exercises/math/functions/exponential/expFactorization.js +5 -2
  13. package/lib/exercises/math/geometry/cartesian/pointCoordinates.d.ts.map +1 -1
  14. package/lib/exercises/math/geometry/cartesian/pointCoordinates.js +30 -29
  15. package/lib/exercises/math/geometry/euclidian/index.d.ts +1 -1
  16. package/lib/exercises/math/geometry/euclidian/index.d.ts.map +1 -1
  17. package/lib/exercises/math/geometry/euclidian/index.js +1 -2
  18. package/lib/exercises/math/geometry/euclidian/pythagoreOrThales.d.ts +9 -0
  19. package/lib/exercises/math/geometry/euclidian/pythagoreOrThales.d.ts.map +1 -1
  20. package/lib/exercises/math/geometry/euclidian/pythagoreOrThales.js +205 -187
  21. package/lib/exercises/math/geometry/index.d.ts +1 -0
  22. package/lib/exercises/math/geometry/index.d.ts.map +1 -1
  23. package/lib/exercises/math/geometry/index.js +1 -1
  24. package/lib/exercises/math/geometry/thales/thalesCalcul.d.ts.map +1 -1
  25. package/lib/exercises/math/geometry/thales/thalesCalcul.js +1 -1
  26. package/lib/exercises/math/primitive/polynomialPrimitive.d.ts.map +1 -1
  27. package/lib/exercises/math/primitive/polynomialPrimitive.js +47 -16
  28. package/lib/exercises/math/probaStat/probaFromTableWithContext.js +3 -3
  29. package/lib/exercises/math/spaceGeometry/basis/index.d.ts +2 -0
  30. package/lib/exercises/math/spaceGeometry/basis/index.d.ts.map +1 -0
  31. package/lib/exercises/math/spaceGeometry/basis/index.js +1 -0
  32. package/lib/exercises/math/spaceGeometry/basis/spaceCoordinatesInPrism.d.ts +11 -0
  33. package/lib/exercises/math/spaceGeometry/basis/spaceCoordinatesInPrism.d.ts.map +1 -0
  34. package/lib/exercises/math/spaceGeometry/basis/spaceCoordinatesInPrism.js +141 -0
  35. package/lib/exercises/math/spaceGeometry/index.d.ts +1 -0
  36. package/lib/exercises/math/spaceGeometry/index.d.ts.map +1 -1
  37. package/lib/exercises/math/spaceGeometry/index.js +1 -0
  38. package/lib/exercises/math/trigonometry/calculateCosSinAndTan.d.ts.map +1 -1
  39. package/lib/exercises/math/trigonometry/calculateCosSinAndTan.js +38 -26
  40. package/lib/exercises/utils/geogebra/toGGBCommandsProps.d.ts +1 -0
  41. package/lib/exercises/utils/geogebra/toGGBCommandsProps.d.ts.map +1 -1
  42. package/lib/geogebra/geogebraConstructor.d.ts +2 -0
  43. package/lib/geogebra/geogebraConstructor.d.ts.map +1 -1
  44. package/lib/geogebra/geogebraConstructor.js +6 -0
  45. package/lib/index.d.ts +11 -0
  46. package/lib/index.d.ts.map +1 -1
  47. package/lib/math/geometry/segment.d.ts +6 -2
  48. package/lib/math/geometry/segment.d.ts.map +1 -1
  49. package/lib/math/geometry/segment.js +11 -6
  50. package/lib/math/geometry/spacePoint.d.ts +2 -1
  51. package/lib/math/geometry/spacePoint.d.ts.map +1 -1
  52. package/lib/math/geometry/spacePoint.js +16 -2
  53. package/lib/math/geometry/triangle.d.ts +2 -1
  54. package/lib/math/geometry/triangle.d.ts.map +1 -1
  55. package/lib/math/geometry/triangle.js +31 -13
  56. package/lib/math/spaceGeometry/prism.d.ts +4 -0
  57. package/lib/math/spaceGeometry/prism.d.ts.map +1 -0
  58. package/lib/math/spaceGeometry/prism.js +3 -0
  59. package/lib/tree/nodes/algebraicNode.d.ts +4 -1
  60. package/lib/tree/nodes/algebraicNode.d.ts.map +1 -1
  61. package/lib/tree/nodes/functions/cosNode.d.ts +2 -2
  62. package/lib/tree/nodes/functions/cosNode.d.ts.map +1 -1
  63. package/lib/tree/nodes/functions/cosNode.js +4 -1
  64. package/lib/tree/nodes/functions/sinNode.d.ts +2 -2
  65. package/lib/tree/nodes/functions/sinNode.d.ts.map +1 -1
  66. package/lib/tree/nodes/functions/sinNode.js +4 -1
  67. package/lib/tree/nodes/functions/tanNode.d.ts +2 -2
  68. package/lib/tree/nodes/functions/tanNode.d.ts.map +1 -1
  69. package/lib/tree/nodes/functions/tanNode.js +4 -1
  70. package/package.json +1 -1
@@ -1,187 +1,205 @@
1
- // import {
2
- // Exercise,
3
- // Proposition,
4
- // QCMGenerator,
5
- // Question,
6
- // QuestionGenerator,
7
- // VEA,
8
- // GGBVEA,
9
- // addValidProp,
10
- // shuffleProps,
11
- // tryToAddWrongProp,
12
- // GetAnswer,
13
- // GetHint,
14
- // GetCorrection,
15
- // GetInstruction,
16
- // GetKeys,
17
- // GetGGBOptions,
18
- // GetStudentGGBOptions,
19
- // GetGGBAnswer,
20
- // } from "../../../../exercises/exercise.js";
21
- // import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
22
- // import { GeogebraConstructor } from "../../../../geogebra/geogebraConstructor.js";
23
- // import { Line, LineConstructor } from "../../../../math/geometry/line.js";
24
- // import {
25
- // Point,
26
- // PointConstructor,
27
- // PointIdentifiers,
28
- // } from "../../../../math/geometry/point.js";
29
- // import {
30
- // Segment,
31
- // SegmentConstructor,
32
- // SegmentIdentifiers,
33
- // } from "../../../../math/geometry/segment.js";
34
- // import {
35
- // Triangle,
36
- // TriangleConstructor,
37
- // TriangleIdentifiers,
38
- // } from "../../../../math/geometry/triangle.js";
39
- // import { coinFlip } from "../../../../utils/alea/coinFlip.js";
40
- export {};
41
- // type Identifiers = {
42
- // isAskingLength: boolean;
43
- // triangleIdentifiers: TriangleIdentifiers;
44
- // extraPoints: PointIdentifiers[];
45
- // isSegmentHeight: boolean; // si hauteur alors configuration pythagore
46
- // };
47
- // const getPropositions: QCMGenerator<Identifiers> = (n, { answer }) => {
48
- // const propositions: Proposition[] = [];
49
- // addValidProp(propositions, answer, "raw");
50
- // tryToAddWrongProp(propositions, "Le théorème de Thalès", "raw");
51
- // tryToAddWrongProp(propositions, "La réciproque du théorème de Thalès", "raw");
52
- // tryToAddWrongProp(propositions, "Le théorème de Pythagore", "raw");
53
- // tryToAddWrongProp(
54
- // propositions,
55
- // "La réciproque du théorème de Pythagore",
56
- // "raw",
57
- // );
58
- // return shuffleProps(propositions, n);
59
- // };
60
- // const getAnswer: GetAnswer<Identifiers> = (identifiers) => {
61
- // const { isAskingLength, triangleIdentifiers, isSegmentHeight } = identifiers;
62
- // return isSegmentHeight
63
- // ? isAskingLength
64
- // ? "Le théorème de Pythagore"
65
- // : "La réciproque du théorème de Pythagore"
66
- // : isAskingLength
67
- // ? "Le théorème de Thalès"
68
- // : "La réciproque du théorème de Thalès";
69
- // };
70
- // const getInstruction: GetInstruction<Identifiers> = (identifiers) => {
71
- // const { isAskingLength, triangleIdentifiers, isSegmentHeight, extraPoints } = identifiers;
72
- // const triangle = TriangleConstructor.fromIdentifiers(triangleIdentifiers);
73
- // const points = extraPoints.map((e) => PointConstructor.fromIdentifiers(e));
74
- // let instruction = ``;
75
- // if(isSegmentHeight){
76
- // if(isAskingLength){
77
- // instruction = `calculer la longueur $${triangle.sides[2].toInsideName()}$`
78
- // } else {
79
- // instruction = `prouver que le triangle $${triangle.points[1].name}${triangle.points[2].name}${points[0].name}$ est rectangle en $${points[0].name}$`
80
- // }
81
- // } else {
82
- // if(isAskingLength){
83
- // instruction = `calculer la longueur $${points[0].name}${points[1].name}$`
84
- // } else {
85
- // instruction = `prouver que les droites $${}$ et $${}$ sont parallèles`
86
- // }
87
- // }
88
- // return `On donne la figure ci-dessous.
89
- // Pour ${instruction}, il faut utiliser... `;
90
- // };
91
- // // const getHint: GetHint<Identifiers> = (identifiers) => {};
92
- // // const getCorrection: GetCorrection<Identifiers> = (identifiers) => {};
93
- // const getGGBOptions: GetGGBOptions<Identifiers> = (identifiers) => {
94
- // const { isAskingLength, triangleIdentifiers, extraPoints, isSegmentHeight } =
95
- // identifiers;
96
- // const triangle = TriangleConstructor.fromIdentifiers(triangleIdentifiers);
97
- // const points = extraPoints.map((e) => PointConstructor.fromIdentifiers(e));
98
- // const commands = [
99
- // ...triangle.commands,
100
- // ...points.flatMap((p) => p.toGGBCommand()),
101
- // ];
102
- // if (isSegmentHeight) {
103
- // commands.push(
104
- // ...new Segment(triangle.points[1], points[0]).toGGBCommands(false),
105
- // );
106
- // } else {
107
- // commands.push(...new Segment(points[0], points[1]).toGGBCommands(false));
108
- // }
109
- // const ggb = new GeogebraConstructor({
110
- // commands,
111
- // hideAxes: true,
112
- // hideGrid: true,
113
- // });
114
- // return ggb.getOptions({
115
- // coords: triangle.generateCoords(),
116
- // });
117
- // };
118
- // const getKeys: GetKeys<Identifiers> = (identifiers) => {
119
- // return [];
120
- // };
121
- // const isAnswerValid: VEA<Identifiers> = (ans, { answer }) => {
122
- // throw Error("VEA not implemented");
123
- // };
124
- // const getPythagoreOrThalesQuestion: QuestionGenerator<Identifiers> = (opts) => {
125
- // // const triangle = TriangleConstructor.randomNiceSides({});
126
- // const A = new Point("A", 0, 0);
127
- // const B = new Point("B", 4, 4);
128
- // const C = new Point("C", 8, 0);
129
- // const triangle = new Triangle([A, B, C]);
130
- // const isSegmentHeight = coinFlip();
131
- // const isAskingLength = coinFlip();
132
- // let extraPoints: PointIdentifiers[] = [];
133
- // if (isSegmentHeight) {
134
- // const baseLine = LineConstructor.fromSegment(triangle.sides[1]);
135
- // const height = baseLine.getPerpendicular(triangle.points[1]);
136
- // extraPoints.push(height.intersect(baseLine, "H").toIdentifiers());
137
- // } else {
138
- // const baseLine = LineConstructor.fromSegment(triangle.sides[1]);
139
- // const D = PointConstructor.onSegment(triangle.sides[2], "D", {
140
- // spacing: 0.3,
141
- // });
142
- // const para = baseLine.getParallele(D);
143
- // const E = para.intersect(
144
- // LineConstructor.fromSegment(triangle.sides[0]),
145
- // "E",
146
- // );
147
- // extraPoints.push(D.toIdentifiers());
148
- // extraPoints.push(E.toIdentifiers());
149
- // }
150
- // const identifiers: Identifiers = {
151
- // triangleIdentifiers: triangle.toIdentifiers(),
152
- // // segmentIdentifiers: triangle.sides[0].toIdentifiers(),
153
- // extraPoints,
154
- // isAskingLength,
155
- // isSegmentHeight,
156
- // };
157
- // const question: Question<Identifiers> = {
158
- // answer: getAnswer(identifiers),
159
- // instruction: getInstruction(identifiers),
160
- // keys: getKeys(identifiers),
161
- // answerFormat: "raw",
162
- // identifiers,
163
- // // hint: getHint(identifiers),
164
- // // correction: getCorrection(identifiers),
165
- // ggbOptions: getGGBOptions(identifiers),
166
- // };
167
- // return question;
168
- // };
169
- // export const pythagoreOrThales: Exercise<Identifiers> = {
170
- // id: "pythagoreOrThales",
171
- // label: "",
172
- // isSingleStep: true,
173
- // generator: (nb, opts) =>
174
- // getDistinctQuestions(() => getPythagoreOrThalesQuestion(opts), nb),
175
- // qcmTimer: 60,
176
- // freeTimer: 60,
177
- // getPropositions,
178
- // isAnswerValid,
179
- // subject: "Mathématiques",
180
- // // getHint,
181
- // // getCorrection,
182
- // getInstruction,
183
- // getAnswer,
184
- // getGGBOptions,
185
- // hasGeogebra: true,
186
- // answerType: "QCU",
187
- // };
1
+ import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { GeogebraConstructor } from "../../../../geogebra/geogebraConstructor.js";
4
+ import { Angle } from "../../../../math/geometry/angle.js";
5
+ import { PointConstructor, } from "../../../../math/geometry/point.js";
6
+ import { RightTriangleConstructor } from "../../../../math/geometry/rightTriangle.js";
7
+ import { Segment, } from "../../../../math/geometry/segment.js";
8
+ import { Triangle, TriangleConstructor, } from "../../../../math/geometry/triangle.js";
9
+ import { VectorConstructor } from "../../../../math/geometry/vector.js";
10
+ import { round } from "../../../../math/utils/round.js";
11
+ import { NumberNode } from "../../../../tree/nodes/numbers/numberNode.js";
12
+ import { coinFlip } from "../../../../utils/alea/coinFlip.js";
13
+ const getPropositions = (n, { answer }) => {
14
+ const propositions = [];
15
+ addValidProp(propositions, answer, "raw");
16
+ tryToAddWrongProp(propositions, "Le théorème de Thalès", "raw");
17
+ tryToAddWrongProp(propositions, "La réciproque du théorème de Thalès", "raw");
18
+ tryToAddWrongProp(propositions, "Le théorème de Pythagore", "raw");
19
+ tryToAddWrongProp(propositions, "La réciproque du théorème de Pythagore", "raw");
20
+ return shuffleProps(propositions, n);
21
+ };
22
+ const getAnswer = (identifiers) => {
23
+ const { isAskingLength, isSegmentHeight } = identifiers;
24
+ return isSegmentHeight
25
+ ? isAskingLength
26
+ ? "Le théorème de Pythagore"
27
+ : "La réciproque du théorème de Pythagore"
28
+ : isAskingLength
29
+ ? "Le théorème de Thalès"
30
+ : "La réciproque du théorème de Thalès";
31
+ };
32
+ const getInstruction = (identifiers) => {
33
+ const { isAskingLength, pointsIdentifiers, isSegmentHeight } = identifiers;
34
+ const points = pointsIdentifiers.map((p) => PointConstructor.fromIdentifiers(p));
35
+ let instruction = ``;
36
+ if (isSegmentHeight) {
37
+ if (isAskingLength) {
38
+ instruction = `calculer la longueur $${points[0].name}${points[1].name}$`;
39
+ }
40
+ else {
41
+ instruction = `prouver que le triangle $${points[1].name}${points[2].name}${points[3].name}$ est rectangle en $${points[3].name}$`;
42
+ }
43
+ }
44
+ else {
45
+ if (isAskingLength) {
46
+ instruction = `calculer la longueur $${points[1].name}${points[3].name}$`;
47
+ }
48
+ else {
49
+ instruction = `prouver que les droites $\\left(${points[1].name}${points[3].name}\\right)$ et $\\left(${points[0].name}${points[4].name}\\right)$ sont parallèles`;
50
+ }
51
+ }
52
+ return `On donne la figure ci-dessous${!isSegmentHeight && isAskingLength
53
+ ? `, où les droites $\\left(${points[1].name}${points[3].name}\\right)$ et $\\left(${points[0].name}${points[4].name}\\right)$ sont parallèles.`
54
+ : "."}
55
+
56
+ Pour ${instruction}, il faut utiliser... `;
57
+ };
58
+ // const getHint: GetHint<Identifiers> = (identifiers) => {};
59
+ // const getCorrection: GetCorrection<Identifiers> = (identifiers) => {};
60
+ const getGGBOptions = (identifiers) => {
61
+ const { isAskingLength, lengths, pointsIdentifiers, isSegmentHeight } = identifiers;
62
+ const points = pointsIdentifiers.map((p) => PointConstructor.fromIdentifiers(p));
63
+ let segments;
64
+ if (isSegmentHeight) {
65
+ const withoutA = points.slice(1);
66
+ segments = withoutA.map((p, i) => new Segment(p, withoutA[(i + 1) % 3], {
67
+ lengthNode: new NumberNode(lengths[i]),
68
+ }));
69
+ segments.push(new Segment(points[3], points[0], {
70
+ lengthNode: new NumberNode(lengths[3]),
71
+ }));
72
+ segments.push(new Segment(points[0], points[1]));
73
+ }
74
+ else {
75
+ segments = points.map((p, i) => new Segment(p, points[(i + 1) % points.length], {
76
+ lengthNode: new NumberNode(lengths[i]),
77
+ }));
78
+ segments.push(new Segment(points[1], points[3]));
79
+ }
80
+ const commands = [
81
+ ...points.flatMap((p) => p.toGGBCommand()),
82
+ ...segments.flatMap((s, i) => s.toGGBCommands(false, { color: "grey", thickness: 3 })),
83
+ ...segments
84
+ .slice(0, segments.length - 1)
85
+ .flatMap((s, i) => s.getFitCaptionCommands({ size: "scriptsize", color: "red" })),
86
+ ...(isAskingLength && isSegmentHeight
87
+ ? new Angle([points[1], points[3], points[0]]).toCommands()
88
+ : []),
89
+ ];
90
+ const ggb = new GeogebraConstructor({
91
+ commands,
92
+ hideAxes: true,
93
+ hideGrid: true,
94
+ });
95
+ return ggb.getOptions({
96
+ coords: ggb.getCoordsForPoints(points),
97
+ });
98
+ };
99
+ const getKeys = (identifiers) => {
100
+ return [];
101
+ };
102
+ const isAnswerValid = (ans, { answer }) => {
103
+ throw Error("VEA not implemented");
104
+ };
105
+ const getPythagoreOrThalesQuestion = (opts) => {
106
+ const isSegmentHeight = coinFlip();
107
+ const isAskingLength = coinFlip();
108
+ let points;
109
+ let lengths;
110
+ const triangle = isSegmentHeight
111
+ ? RightTriangleConstructor.randomNiceSides({ names: ["D", "B", "C"] })
112
+ : TriangleConstructor.randomNiceSides({ minAngle: 40 });
113
+ const summitNames = triangle.points.map((p) => p.name);
114
+ if (isSegmentHeight) {
115
+ const triangle = RightTriangleConstructor.randomNiceSides({
116
+ names: ["D", "B", "C"],
117
+ });
118
+ const ratio = round(0.4 + Math.random() * 0.2, 1);
119
+ const triangleLengths = triangle.sides.map((s) => s.getLength());
120
+ const A = VectorConstructor.fromPoints(triangle.points[2], triangle.points[0])
121
+ .times(ratio.toTree())
122
+ .getEndPoint(triangle.points[0], "A");
123
+ points = [A, triangle.points[1], triangle.points[2], triangle.points[0]];
124
+ lengths = [
125
+ round(triangleLengths[0], 2),
126
+ round(triangleLengths[1], 2),
127
+ round(triangleLengths[2], 2),
128
+ round(A.distanceTo(triangle.points[0]), 2),
129
+ ];
130
+ }
131
+ else {
132
+ const triangle = TriangleConstructor.randomNiceSides({ minAngle: 40 });
133
+ const ratio = round(0.4 + Math.random() * 0.2, 1);
134
+ const dName = "D";
135
+ const eName = "E";
136
+ const subTriangle = getSubTriangle({
137
+ triangle,
138
+ insidePointsNames: [dName, eName],
139
+ ratio,
140
+ isPapillon: false,
141
+ });
142
+ const triangleLengths = triangle.sides.map((s) => s.getLength());
143
+ const subTriangleLengths = subTriangle.sides.map((s) => s.getLength());
144
+ points = [
145
+ triangle.points[0],
146
+ subTriangle.points[0],
147
+ triangle.points[1],
148
+ subTriangle.points[2],
149
+ triangle.points[2],
150
+ ];
151
+ lengths = [
152
+ round(triangleLengths[2] - subTriangleLengths[2], 2),
153
+ round(subTriangleLengths[2], 2),
154
+ round(subTriangleLengths[0], 2),
155
+ round(triangleLengths[0] - subTriangleLengths[0], 2),
156
+ round(triangleLengths[1], 2),
157
+ ];
158
+ }
159
+ const identifiers = {
160
+ lengths,
161
+ pointsIdentifiers: points.map((p) => p.toIdentifiers()),
162
+ isAskingLength,
163
+ isSegmentHeight,
164
+ };
165
+ const question = {
166
+ answer: getAnswer(identifiers),
167
+ instruction: getInstruction(identifiers),
168
+ keys: getKeys(identifiers),
169
+ answerFormat: "raw",
170
+ identifiers,
171
+ // hint: getHint(identifiers),
172
+ // correction: getCorrection(identifiers),
173
+ ggbOptions: getGGBOptions(identifiers),
174
+ };
175
+ return question;
176
+ };
177
+ export const pythagoreOrThales = {
178
+ id: "pythagoreOrThales",
179
+ label: "Choisir entre Thalès, Pythagore et leurs réciproques",
180
+ isSingleStep: true,
181
+ generator: (nb, opts) => getDistinctQuestions(() => getPythagoreOrThalesQuestion(opts), nb),
182
+ qcmTimer: 60,
183
+ freeTimer: 60,
184
+ getPropositions,
185
+ isAnswerValid,
186
+ subject: "Mathématiques",
187
+ // getHint,
188
+ // getCorrection,
189
+ getInstruction,
190
+ getAnswer,
191
+ getGGBOptions,
192
+ hasGeogebra: true,
193
+ answerType: "QCU",
194
+ };
195
+ const getSubTriangle = ({ triangle, insidePointsNames, ratio, isPapillon, }) => {
196
+ const [A, B, C] = triangle.points;
197
+ const [dName, eName] = insidePointsNames;
198
+ const vecAB = VectorConstructor.fromPoints(A, B).times((1 - ratio).toTree());
199
+ const pointD = vecAB.getEndPoint(A, dName);
200
+ const vecCB = VectorConstructor.fromPoints(C, B).times((1 - ratio).toTree());
201
+ const pointE = vecCB.getEndPoint(C, eName);
202
+ return new Triangle([pointD, triangle.points[1], pointE], {
203
+ sidesLengths: triangle.sides.map((s) => round(s.getLength() * Math.abs(ratio), 2).toTree()),
204
+ });
205
+ };
@@ -8,6 +8,7 @@ export * from "./convexity/index.js";
8
8
  export * from "./volumes/index.js";
9
9
  export * from "./euclidianConstructions/index.js";
10
10
  export * from "./shapes/index.js";
11
+ export * from "./euclidian/index.js";
11
12
  export * from "./parametric/index.js";
12
13
  export * from "./quadrilaterals/index.js";
13
14
  export * from "./angles/index.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/geometry/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AAEnC,cAAc,mCAAmC,CAAC;AAClD,cAAc,mBAAmB,CAAC;AAElC,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/geometry/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AAEnC,cAAc,mCAAmC,CAAC;AAClD,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC"}
@@ -9,7 +9,7 @@ export * from "./volumes/index.js";
9
9
  // export * from "./triangles.js";
10
10
  export * from "./euclidianConstructions/index.js";
11
11
  export * from "./shapes/index.js";
12
- // export * from "./euclidian/index.js";
12
+ export * from "./euclidian/index.js";
13
13
  export * from "./parametric/index.js";
14
14
  export * from "./quadrilaterals/index.js";
15
15
  export * from "./angles/index.js";
@@ -1 +1 @@
1
- {"version":3,"file":"thalesCalcul.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/thales/thalesCalcul.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAqBT,MAAM,6BAA6B,CAAC;AAMrC,OAAO,EAGL,mBAAmB,EACpB,MAAM,iCAAiC,CAAC;AAQzC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,mBAAmB,EAAE,mBAAmB,CAAC;IACzC,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,gBAAgB,EAAE,MAAM,CAAC;IACzB,UAAU,EAAE,OAAO,CAAC;CACrB,CAAC;AAqJF,KAAK,OAAO,GAAG;IACb,iBAAiB,EAAE,MAAM,CAAC;CAC3B,CAAC;AA8DF,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAwBvD,CAAC"}
1
+ {"version":3,"file":"thalesCalcul.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/thales/thalesCalcul.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAqBT,MAAM,6BAA6B,CAAC;AAMrC,OAAO,EAGL,mBAAmB,EACpB,MAAM,iCAAiC,CAAC;AAQzC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,mBAAmB,EAAE,mBAAmB,CAAC;IACzC,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,gBAAgB,EAAE,MAAM,CAAC;IACzB,UAAU,EAAE,OAAO,CAAC;CACrB,CAAC;AAmJF,KAAK,OAAO,GAAG;IACb,iBAAiB,EAAE,MAAM,CAAC;CAC3B,CAAC;AA8DF,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAwBvD,CAAC"}
@@ -83,7 +83,7 @@ const getGGBOptions = (identifiers) => {
83
83
  const seg = new Segment(points[0], points[1]);
84
84
  const commands = [
85
85
  ...triangle.commands,
86
- ...points.flatMap((p) => p.toGGBCommand({ style: 0, color: "#444444", size: 4 })),
86
+ ...points.flatMap((p) => p.toGGBCommand({ color: "#444444", size: 4 })),
87
87
  ...seg.toGGBCommands(false),
88
88
  ];
89
89
  if (identifiers.isPapillon) {
@@ -1 +1 @@
1
- {"version":3,"file":"polynomialPrimitive.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/primitive/polynomialPrimitive.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAER,YAAY,EAEZ,iBAAiB,EACjB,GAAG,EAGJ,MAAM,6BAA6B,CAAC;AASrC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,iBAAiB,CAAC,WAAW,CAiBjE,CAAC;AAEF,eAAO,MAAM,kCAAkC,EAAE,YAAY,CAAC,WAAW,CAexE,CAAC;AAEF,eAAO,MAAM,gCAAgC,EAAE,GAAG,CAAC,WAAW,CAa7D,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,WAAW,CAarD,CAAC"}
1
+ {"version":3,"file":"polynomialPrimitive.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/primitive/polynomialPrimitive.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAIR,YAAY,EAEZ,iBAAiB,EACjB,GAAG,EAGJ,MAAM,6BAA6B,CAAC;AAWrC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AAiBF,eAAO,MAAM,sBAAsB,EAAE,iBAAiB,CAAC,WAAW,CAcjE,CAAC;AAEF,eAAO,MAAM,kCAAkC,EAAE,YAAY,CAAC,WAAW,CAexE,CAAC;AAEF,eAAO,MAAM,gCAAgC,EAAE,GAAG,CAAC,WAAW,CA8B7D,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,WAAW,CAWrD,CAAC"}
@@ -2,19 +2,34 @@ import { addValidProp, tryToAddWrongProp, } from "../../../exercises/exercise.js
2
2
  import { getDistinctQuestions } from "../../../exercises/utils/getDistinctQuestions.js";
3
3
  import { Polynomial, PolynomialConstructor, } from "../../../math/polynomials/polynomial.js";
4
4
  import { randint } from "../../../math/utils/random/randint.js";
5
+ import { parseAlgebraic } from "../../../tree/parsers/latexParser.js";
5
6
  import { shuffle } from "../../../utils/alea/shuffle.js";
7
+ import { handleVEAError } from "../../../utils/errors/handleVEAError.js";
8
+ const getInstruction = (identifiers) => {
9
+ const polynomial = new Polynomial(identifiers.coeffs);
10
+ return `Déterminer la forme générale des primitives de la fonction polynomiale $f$ définie par :
11
+
12
+ $$
13
+ f(x) = ${polynomial.toTex()}
14
+ $$`;
15
+ };
16
+ const getAnswer = (identifiers) => {
17
+ const polynomial = new Polynomial(identifiers.coeffs);
18
+ const integralPolynomial = polynomial.integrateToNode();
19
+ const answer = `${integralPolynomial.toTex()}`;
20
+ return answer;
21
+ };
6
22
  export const getPolynomialPrimitive = () => {
7
23
  const degree = randint(1, 4);
8
24
  const polynomial = PolynomialConstructor.randomWithOrder(degree);
9
- const integralPolynomial = polynomial.integrateToNode();
10
- const answer = `${integralPolynomial.toTex()}`;
25
+ const identifiers = { coeffs: polynomial.coefficients };
11
26
  const question = {
12
- instruction: `Déterminer la forme générale des primitives de la fonction polynomiale $f$ définie par $f(x) = ${polynomial.toTex()}$.`,
27
+ instruction: getInstruction(identifiers),
13
28
  startStatement: `F(x)`,
14
- answer,
29
+ answer: getAnswer(identifiers),
15
30
  keys: ["x", "C"],
16
31
  answerFormat: "tex",
17
- identifiers: { coeffs: polynomial.coefficients },
32
+ identifiers,
18
33
  };
19
34
  return question;
20
35
  };
@@ -28,22 +43,38 @@ export const getPolynomialPrimitivePropositions = (n, { answer, coeffs }) => {
28
43
  }
29
44
  return shuffle(propositions);
30
45
  };
31
- export const isPolynomialPrimitiveAnswerValid = (ans, { coeffs }) => {
32
- const opts = {
33
- allowFractionToDecimal: true,
34
- forbidPowerToProduct: true,
35
- };
36
- const polynomial = new Polynomial(coeffs);
37
- const integralPolynomial = polynomial.integrateToNode(opts);
38
- const texs = integralPolynomial.toAllValidTexs(opts);
39
- return texs.includes(ans);
46
+ export const isPolynomialPrimitiveAnswerValid = (ans, { coeffs, answer }) => {
47
+ try {
48
+ const parsed = parseAlgebraic(ans);
49
+ if (!parsed)
50
+ return false;
51
+ // console.log(
52
+ // parsed
53
+ // .simplify({
54
+ // towardsDistribute: true,
55
+ // forbidFactorize: true,
56
+ // decimalToFractions: true,
57
+ // forceDistributeFractions: true,
58
+ // forceIsolateMonomCoeffs: true,
59
+ // })
60
+ // .toTex(),
61
+ // );
62
+ return (parsed
63
+ .simplify({
64
+ towardsDistribute: true,
65
+ forbidFactorize: true,
66
+ forceDistributeFractions: true,
67
+ })
68
+ .toTex() === answer);
69
+ }
70
+ catch (err) {
71
+ return handleVEAError(err);
72
+ }
40
73
  };
41
74
  export const polynomialPrimitive = {
42
75
  id: "polynomialPrimitive",
43
76
  connector: "=",
44
77
  label: "Primitive d'une fonction polynomiale",
45
- levels: ["TermSpé", "MathComp"],
46
- sections: ["Primitives"],
47
78
  isSingleStep: false,
48
79
  generator: (nb) => getDistinctQuestions(getPolynomialPrimitive, nb),
49
80
  qcmTimer: 60,
@@ -46,9 +46,9 @@ const getAnswer = (identifiers) => {
46
46
  };
47
47
  const getProbaFromTableWithContextQuestion = () => {
48
48
  const aCapB = randint(1, 20);
49
- const aCapBBarre = randint(1, 20);
50
- const aBarreCapB = randint(1, 20);
51
- const aBarreCapBBarre = randint(1, 20);
49
+ const aCapBBarre = randint(1, 20, [aCapB]);
50
+ const aBarreCapB = randint(1, 20, [aCapB, aCapBBarre]);
51
+ const aBarreCapBBarre = randint(1, 20, [aCapB, aCapBBarre, aBarreCapB]);
52
52
  const total = aBarreCapB + aBarreCapBBarre + aCapB + aCapBBarre;
53
53
  const aTotal = aCapB + aCapBBarre;
54
54
  const bTotal = aCapB + aBarreCapB;
@@ -0,0 +1,2 @@
1
+ export * from "./spaceCoordinatesInPrism.js";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/spaceGeometry/basis/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC"}
@@ -0,0 +1 @@
1
+ export * from "./spaceCoordinatesInPrism.js";
@@ -0,0 +1,11 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ type Identifiers = {
3
+ l: number;
4
+ L: number;
5
+ h: number;
6
+ askedPoint: string;
7
+ givenPoints: string[];
8
+ };
9
+ export declare const spaceCoordinatesInPrism: Exercise<Identifiers>;
10
+ export {};
11
+ //# sourceMappingURL=spaceCoordinatesInPrism.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spaceCoordinatesInPrism.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/spaceGeometry/basis/spaceCoordinatesInPrism.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;AAOrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB,CAAC;AA0IF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,WAAW,CAiBzD,CAAC"}