math-exercises 3.0.99 → 3.0.101

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 (114) hide show
  1. package/lib/exercises/math/geometry/areas/calculateAreaFromCodedShape.d.ts +9 -0
  2. package/lib/exercises/math/geometry/areas/calculateAreaFromCodedShape.d.ts.map +1 -0
  3. package/lib/exercises/math/geometry/areas/calculateAreaFromCodedShape.js +156 -0
  4. package/lib/exercises/math/geometry/areas/index.d.ts +1 -0
  5. package/lib/exercises/math/geometry/areas/index.d.ts.map +1 -1
  6. package/lib/exercises/math/geometry/areas/index.js +1 -0
  7. package/lib/exercises/math/geometry/euclidian/index.d.ts +1 -0
  8. package/lib/exercises/math/geometry/euclidian/index.d.ts.map +1 -1
  9. package/lib/exercises/math/geometry/euclidian/index.js +1 -0
  10. package/lib/exercises/math/geometry/euclidian/orthogonalProjectFromPicture.d.ts +8 -0
  11. package/lib/exercises/math/geometry/euclidian/orthogonalProjectFromPicture.d.ts.map +1 -0
  12. package/lib/exercises/math/geometry/euclidian/orthogonalProjectFromPicture.js +197 -0
  13. package/lib/exercises/math/geometry/euclidianConstructions/pointImageFromTranslation.d.ts.map +1 -1
  14. package/lib/exercises/math/geometry/euclidianConstructions/pointImageFromTranslation.js +45 -17
  15. package/lib/exercises/math/geometry/pythagore/calculateDiagonalFromSides.d.ts +9 -0
  16. package/lib/exercises/math/geometry/pythagore/calculateDiagonalFromSides.d.ts.map +1 -0
  17. package/lib/exercises/math/geometry/pythagore/calculateDiagonalFromSides.js +155 -0
  18. package/lib/exercises/math/geometry/pythagore/index.d.ts +1 -0
  19. package/lib/exercises/math/geometry/pythagore/index.d.ts.map +1 -1
  20. package/lib/exercises/math/geometry/pythagore/index.js +2 -0
  21. package/lib/exercises/math/geometry/pythagore/pythagoreCalcul.js +1 -1
  22. package/lib/exercises/math/geometry/pythagore/triangleHeight.d.ts +9 -0
  23. package/lib/exercises/math/geometry/pythagore/triangleHeight.d.ts.map +1 -0
  24. package/lib/exercises/math/geometry/pythagore/triangleHeight.js +105 -0
  25. package/lib/exercises/math/geometry/quadrilaterals/index.d.ts +2 -0
  26. package/lib/exercises/math/geometry/quadrilaterals/index.d.ts.map +1 -1
  27. package/lib/exercises/math/geometry/quadrilaterals/index.js +2 -0
  28. package/lib/exercises/math/geometry/quadrilaterals/parallelogramRectangle.d.ts +11 -0
  29. package/lib/exercises/math/geometry/quadrilaterals/parallelogramRectangle.d.ts.map +1 -0
  30. package/lib/exercises/math/geometry/quadrilaterals/parallelogramRectangle.js +140 -0
  31. package/lib/exercises/math/geometry/quadrilaterals/parallelogramRhombus.d.ts +11 -0
  32. package/lib/exercises/math/geometry/quadrilaterals/parallelogramRhombus.d.ts.map +1 -0
  33. package/lib/exercises/math/geometry/quadrilaterals/parallelogramRhombus.js +144 -0
  34. package/lib/exercises/math/geometry/vectors/colinearity/colinearityFromPicture.d.ts +9 -0
  35. package/lib/exercises/math/geometry/vectors/colinearity/colinearityFromPicture.d.ts.map +1 -0
  36. package/lib/exercises/math/geometry/vectors/colinearity/colinearityFromPicture.js +201 -0
  37. package/lib/exercises/math/geometry/vectors/colinearity/determinant.d.ts +8 -0
  38. package/lib/exercises/math/geometry/vectors/colinearity/determinant.d.ts.map +1 -0
  39. package/lib/exercises/math/geometry/vectors/colinearity/determinant.js +101 -0
  40. package/lib/exercises/math/geometry/vectors/colinearity/index.d.ts +2 -0
  41. package/lib/exercises/math/geometry/vectors/colinearity/index.d.ts.map +1 -1
  42. package/lib/exercises/math/geometry/vectors/colinearity/index.js +2 -0
  43. package/lib/exercises/math/geometry/vectors/constructions/drawAVectorInGGB.d.ts +8 -0
  44. package/lib/exercises/math/geometry/vectors/constructions/drawAVectorInGGB.d.ts.map +1 -0
  45. package/lib/exercises/math/geometry/vectors/constructions/drawAVectorInGGB.js +78 -0
  46. package/lib/exercises/math/geometry/vectors/constructions/index.d.ts +8 -0
  47. package/lib/exercises/math/geometry/vectors/constructions/index.d.ts.map +1 -0
  48. package/lib/exercises/math/geometry/vectors/constructions/index.js +7 -0
  49. package/lib/exercises/math/geometry/vectors/constructions/linearVectorCombinationFromGraph.d.ts +9 -0
  50. package/lib/exercises/math/geometry/vectors/constructions/linearVectorCombinationFromGraph.d.ts.map +1 -0
  51. package/lib/exercises/math/geometry/vectors/constructions/linearVectorCombinationFromGraph.js +179 -0
  52. package/lib/exercises/math/geometry/vectors/constructions/placePointFromPointAndVector.d.ts +12 -0
  53. package/lib/exercises/math/geometry/vectors/constructions/placePointFromPointAndVector.d.ts.map +1 -0
  54. package/lib/exercises/math/geometry/vectors/constructions/placePointFromPointAndVector.js +171 -0
  55. package/lib/exercises/math/geometry/vectors/constructions/traceOppositeVector.d.ts +10 -0
  56. package/lib/exercises/math/geometry/vectors/constructions/traceOppositeVector.d.ts.map +1 -0
  57. package/lib/exercises/math/geometry/vectors/constructions/traceOppositeVector.js +135 -0
  58. package/lib/exercises/math/geometry/vectors/constructions/traceVectorDifference.d.ts +11 -0
  59. package/lib/exercises/math/geometry/vectors/constructions/traceVectorDifference.d.ts.map +1 -0
  60. package/lib/exercises/math/geometry/vectors/constructions/traceVectorDifference.js +163 -0
  61. package/lib/exercises/math/geometry/vectors/constructions/traceVectorMultiple.d.ts +11 -0
  62. package/lib/exercises/math/geometry/vectors/constructions/traceVectorMultiple.d.ts.map +1 -0
  63. package/lib/exercises/math/geometry/vectors/constructions/traceVectorMultiple.js +148 -0
  64. package/lib/exercises/math/geometry/vectors/constructions/traceVectorSum.d.ts +11 -0
  65. package/lib/exercises/math/geometry/vectors/constructions/traceVectorSum.d.ts.map +1 -0
  66. package/lib/exercises/math/geometry/vectors/constructions/traceVectorSum.js +160 -0
  67. package/lib/exercises/math/geometry/vectors/coordinatesReading.d.ts.map +1 -1
  68. package/lib/exercises/math/geometry/vectors/coordinatesReading.js +63 -14
  69. package/lib/exercises/math/geometry/vectors/equalCaracteristicFromGraph.d.ts +3 -0
  70. package/lib/exercises/math/geometry/vectors/equalCaracteristicFromGraph.d.ts.map +1 -1
  71. package/lib/exercises/math/geometry/vectors/equalCaracteristicFromGraph.js +63 -2
  72. package/lib/exercises/math/geometry/vectors/index.d.ts +4 -8
  73. package/lib/exercises/math/geometry/vectors/index.d.ts.map +1 -1
  74. package/lib/exercises/math/geometry/vectors/index.js +4 -8
  75. package/lib/exercises/math/geometry/vectors/parallelogram/fourthParallelogramPoint.d.ts +14 -0
  76. package/lib/exercises/math/geometry/vectors/parallelogram/fourthParallelogramPoint.d.ts.map +1 -0
  77. package/lib/exercises/math/geometry/vectors/parallelogram/fourthParallelogramPoint.js +78 -0
  78. package/lib/exercises/math/geometry/vectors/parallelogram/index.d.ts +4 -0
  79. package/lib/exercises/math/geometry/vectors/parallelogram/index.d.ts.map +1 -0
  80. package/lib/exercises/math/geometry/vectors/parallelogram/index.js +3 -0
  81. package/lib/exercises/math/geometry/vectors/parallelogram/parallelogramCriterion.d.ts +8 -0
  82. package/lib/exercises/math/geometry/vectors/parallelogram/parallelogramCriterion.d.ts.map +1 -0
  83. package/lib/exercises/math/geometry/vectors/parallelogram/parallelogramCriterion.js +193 -0
  84. package/lib/exercises/math/geometry/vectors/parallelogram/parallelogramViaEqualVectors.d.ts +14 -0
  85. package/lib/exercises/math/geometry/vectors/parallelogram/parallelogramViaEqualVectors.d.ts.map +1 -0
  86. package/lib/exercises/math/geometry/vectors/parallelogram/parallelogramViaEqualVectors.js +116 -0
  87. package/lib/exercises/math/geometry/vectors/translationFromPicture.d.ts +8 -0
  88. package/lib/exercises/math/geometry/vectors/translationFromPicture.d.ts.map +1 -0
  89. package/lib/exercises/math/geometry/vectors/translationFromPicture.js +104 -0
  90. package/lib/exercises/math/geometry/vectors/vectorRepresentative.d.ts +8 -0
  91. package/lib/exercises/math/geometry/vectors/vectorRepresentative.d.ts.map +1 -0
  92. package/lib/exercises/math/geometry/vectors/vectorRepresentative.js +161 -0
  93. package/lib/exercises/math/geometry/volumes/index.d.ts +1 -0
  94. package/lib/exercises/math/geometry/volumes/index.d.ts.map +1 -1
  95. package/lib/exercises/math/geometry/volumes/index.js +1 -0
  96. package/lib/exercises/math/geometry/volumes/variableVolume.d.ts +9 -0
  97. package/lib/exercises/math/geometry/volumes/variableVolume.d.ts.map +1 -0
  98. package/lib/exercises/math/geometry/volumes/variableVolume.js +203 -0
  99. package/lib/index.d.ts +89 -40
  100. package/lib/index.d.ts.map +1 -1
  101. package/lib/math/geometry/point.d.ts +1 -0
  102. package/lib/math/geometry/point.d.ts.map +1 -1
  103. package/lib/math/geometry/point.js +3 -0
  104. package/lib/math/geometry/vector.d.ts +1 -0
  105. package/lib/math/geometry/vector.d.ts.map +1 -1
  106. package/lib/math/geometry/vector.js +3 -0
  107. package/lib/playground.d.ts.map +1 -1
  108. package/lib/tests/pdfs/quizPdfPreambule.js +1 -1
  109. package/lib/tests/questionTest.d.ts.map +1 -1
  110. package/lib/tests/questionTest.js +4 -4
  111. package/lib/tree/nodes/functions/sqrtNode.d.ts +1 -1
  112. package/lib/tree/nodes/functions/sqrtNode.d.ts.map +1 -1
  113. package/lib/tree/nodes/functions/sqrtNode.js +8 -2
  114. package/package.json +1 -1
@@ -0,0 +1,9 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ type Identifiers = {
3
+ shape: number;
4
+ height: number;
5
+ width: number;
6
+ };
7
+ export declare const calculateAreaFromCodedShape: Exercise<Identifiers>;
8
+ export {};
9
+ //# sourceMappingURL=calculateAreaFromCodedShape.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"calculateAreaFromCodedShape.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/areas/calculateAreaFromCodedShape.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAgBT,MAAM,6BAA6B,CAAC;AASrC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AA8KF,eAAO,MAAM,2BAA2B,EAAE,QAAQ,CAAC,WAAW,CAsB7D,CAAC"}
@@ -0,0 +1,156 @@
1
+ import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { numberVEA } from "../../../../exercises/vea/numberVEA.js";
4
+ import { GeogebraConstructor } from "../../../../geogebra/geogebraConstructor.js";
5
+ import { randint } from "../../../../math/utils/random/randint.js";
6
+ import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
7
+ import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
8
+ import { substract } from "../../../../tree/nodes/operators/substractNode.js";
9
+ const getPropositions = (n, { answer, height, shape, width }) => {
10
+ const propositions = [];
11
+ addValidProp(propositions, answer);
12
+ tryToAddWrongProp(propositions, (height * width).frenchify());
13
+ tryToAddWrongProp(propositions, ((height * width) / 2).frenchify());
14
+ while (propositions.length < n) {
15
+ tryToAddWrongProp(propositions, ((3 / 4) * height * width + randint(-3, 3, [0])).frenchify());
16
+ }
17
+ return shuffleProps(propositions, n);
18
+ };
19
+ const getAnswer = (identifiers) => {
20
+ return multiply(0.75, identifiers.height * identifiers.width)
21
+ .simplify()
22
+ .toTex();
23
+ };
24
+ const getInstruction = (identifiers) => {
25
+ return `On considère la figure ci-dessous.
26
+
27
+ Quelle est l'aire de la surface colorée ?`;
28
+ };
29
+ const getHint = (identifiers) => {
30
+ return `L'aire de la surface colorée est égale à l'aire du rectangle $ABCD$ moins l'aire du triangle $CED$.`;
31
+ };
32
+ const getCorrection = (identifiers) => {
33
+ //rectangle - triangle
34
+ //moitié rectangle + triangle
35
+ //moitié reactangle + moitié moitié reactalge
36
+ const { height, shape, width } = identifiers;
37
+ return `Pour calculer l'aire de la surface colorée, on remarque qu'elle est égale à l'aire du rectangle $ABCD$ moins l'aire du triangle $CED$.
38
+
39
+ L'aire du rectangle $ABCD$ est égale à :
40
+
41
+ $$
42
+ ${multiply(height, width).toTex({ forceNoSimplification: true })}=${(height * width).frenchify()}
43
+ $$
44
+
45
+ On calcule ensuite l'aire du triangle $CED$. Puisqu'il est rectangle en $D$, son aire vaut :
46
+
47
+ $$
48
+ ${frac(multiply("CD", "DE"), 2).toTex({ forceTimesSign: true })}
49
+ $$
50
+
51
+ Or $CD = ${height.frenchify()}$ et $DE = ${(width / 2).frenchify()}$. L'aire de $CED$ vaut donc :
52
+
53
+ $$
54
+ ${frac(multiply(height, width / 2), 2).toTex()}=${((height * width) /
55
+ 4).frenchify()}
56
+ $$
57
+
58
+ L'aire de la surface colorée vaut donc :
59
+
60
+ $$
61
+ ${substract(height * width, (height * width) / 4).toTex()} = ${getAnswer(identifiers)}
62
+ $$
63
+
64
+
65
+
66
+ `;
67
+ };
68
+ const getGGBOptions = (identifiers) => {
69
+ const { height, shape, width } = identifiers;
70
+ const ggb = new GeogebraConstructor({
71
+ commands: [
72
+ `B = (0,0)`,
73
+ `C = (${width},0)`,
74
+ `D = (${width},${height})`,
75
+ `A = (0,${height})`,
76
+ `E = (${width / 2},${height})`,
77
+ ...["A", "B", "C", "D", "E"].flatMap((e) => [
78
+ `SetVisibleInView(${e},1, false)`,
79
+ `SetFixed(${e}, true)`,
80
+ ]),
81
+ `Segment(E, C)`,
82
+ `Segment(D, C)`,
83
+ `se1 = Segment(A, E)`,
84
+ `se2 = Segment(E,D)`,
85
+ `SetDecoration(se1, 2)`,
86
+ `SetDecoration(se2, 2)`,
87
+ `a = Angle(C,B,A)`,
88
+ `ShowLabel(a, false)`,
89
+ `b = Angle(B,A,D)`,
90
+ `ShowLabel(b, false)`,
91
+ `c = Angle(A,D,C)`,
92
+ `ShowLabel(c, false)`,
93
+ `P = Polygon(B,A,E,C)`,
94
+ `SetFixed(P, true)`,
95
+ `Text("$\\scriptsize B$", (0, -0.1*${height}), true, true, 0, 0)`,
96
+ `Text("$\\scriptsize C$", (${width}, -0.1*${height}), true, true, 0, 0)`,
97
+ `Text("$\\scriptsize D$", (${width}, ${height}+0.3+${Math.min(1, 0.1 * height)}), true, true, 0, 0)`,
98
+ `Text("$\\scriptsize E$", (${width / 2}, ${height}+0.3+${Math.min(1, 0.1 * height)}), true, true, 0, 0)`,
99
+ `Text("$\\scriptsize A$", (0, ${height}+0.3+${Math.min(1, 0.1 * height)}), true, true, 0, 0)`,
100
+ `Text("$\\scriptsize ${height}$", (-0.4, ${height / 2}), true, true, 0, 0)`,
101
+ `Text("$\\scriptsize ${width}$", (${width / 2}, -0.1*${height}), true, true, 0, 0)`,
102
+ ],
103
+ hideAxes: true,
104
+ hideGrid: true,
105
+ });
106
+ return ggb.getOptions({
107
+ coords: [-1, width + 1, -1.5, height + 1.5],
108
+ });
109
+ };
110
+ const getKeys = (identifiers) => {
111
+ return [];
112
+ };
113
+ const isAnswerValid = (ans, { answer }) => {
114
+ return numberVEA(ans, answer);
115
+ };
116
+ const getCalculateAreaFromCodedShapeQuestion = (opts) => {
117
+ const width = randint(3, 11);
118
+ const height = randint(1, width);
119
+ const identifiers = {
120
+ shape: 1,
121
+ height,
122
+ width,
123
+ };
124
+ return getQuestionFromIdentifiers(identifiers);
125
+ };
126
+ const getQuestionFromIdentifiers = (identifiers) => {
127
+ return {
128
+ answer: getAnswer(identifiers),
129
+ instruction: getInstruction(identifiers),
130
+ keys: getKeys(identifiers),
131
+ answerFormat: "tex",
132
+ identifiers,
133
+ hint: getHint(identifiers),
134
+ correction: getCorrection(identifiers),
135
+ ggbOptions: getGGBOptions(identifiers),
136
+ };
137
+ };
138
+ export const calculateAreaFromCodedShape = {
139
+ id: "calculateAreaFromCodedShape",
140
+ label: "Calculer l'aire d'une figure codée",
141
+ isSingleStep: true,
142
+ generator: (nb, opts) => getDistinctQuestions(() => getCalculateAreaFromCodedShapeQuestion(opts), nb),
143
+ qcmTimer: 60,
144
+ freeTimer: 60,
145
+ getPropositions,
146
+ isAnswerValid,
147
+ subject: "Mathématiques",
148
+ getHint,
149
+ getCorrection,
150
+ getInstruction,
151
+ getAnswer,
152
+ getGGBOptions,
153
+ hasGeogebra: true,
154
+ getQuestionFromIdentifiers,
155
+ hasHintAndCorrection: true,
156
+ };
@@ -7,4 +7,5 @@ export * from "./triangleAreaV2.js";
7
7
  export * from "./squareSideFromArea.js";
8
8
  export * from "./rectangleSideFromArea.js";
9
9
  export * from "./circleRadiusFromArea.js";
10
+ export * from "./calculateAreaFromCodedShape.js";
10
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/areas/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/areas/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,kCAAkC,CAAC"}
@@ -7,3 +7,4 @@ export * from "./triangleAreaV2.js";
7
7
  export * from "./squareSideFromArea.js";
8
8
  export * from "./rectangleSideFromArea.js";
9
9
  export * from "./circleRadiusFromArea.js";
10
+ export * from "./calculateAreaFromCodedShape.js";
@@ -1,2 +1,3 @@
1
1
  export * from "./pythagoreOrThales.js";
2
+ export * from "./orthogonalProjectFromPicture.js";
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/euclidian/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/euclidian/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,mCAAmC,CAAC"}
@@ -1 +1,2 @@
1
1
  export * from "./pythagoreOrThales.js";
2
+ export * from "./orthogonalProjectFromPicture.js";
@@ -0,0 +1,8 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ type Identifiers = {
3
+ point: string;
4
+ line: string;
5
+ };
6
+ export declare const orthogonalProjectFromPicture: Exercise<Identifiers>;
7
+ export {};
8
+ //# sourceMappingURL=orthogonalProjectFromPicture.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"orthogonalProjectFromPicture.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/euclidian/orthogonalProjectFromPicture.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAOrC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAkMF,eAAO,MAAM,4BAA4B,EAAE,QAAQ,CAAC,WAAW,CAoB9D,CAAC"}
@@ -0,0 +1,197 @@
1
+ import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { Point } from "../../../../math/geometry/point.js";
4
+ import { random } from "../../../../utils/alea/random.js";
5
+ import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
6
+ const getPoints = () => {
7
+ const points = [
8
+ new Point("A", 0, 0),
9
+ new Point("B", 4, 0),
10
+ new Point("C", 4, 4),
11
+ new Point("D", 0, 4),
12
+ new Point("E", 0, 2),
13
+ new Point("F", 4, 2),
14
+ new Point("G", 2, 4),
15
+ new Point("H", 2, 0),
16
+ new Point("I", 1, 3),
17
+ new Point("J", 3, 1),
18
+ new Point("K", 1, 1),
19
+ new Point("L", 3, 3),
20
+ new Point("P", 2, 2),
21
+ ];
22
+ return points;
23
+ };
24
+ const getNames = () => {
25
+ const names = [
26
+ "A",
27
+ "B",
28
+ "C",
29
+ "D",
30
+ "E",
31
+ "F",
32
+ "G",
33
+ "H",
34
+ "I",
35
+ "J",
36
+ "K",
37
+ "L",
38
+ "P",
39
+ ];
40
+ return names;
41
+ };
42
+ const getPropositions = (n, { answer }) => {
43
+ const propositions = [];
44
+ addValidProp(propositions, answer);
45
+ const names = getNames();
46
+ while (propositions.length < n) {
47
+ tryToAddWrongProp(propositions, random(names));
48
+ }
49
+ return shuffleProps(propositions, n);
50
+ };
51
+ const getAnswer = (identifiers) => {
52
+ const projs = [
53
+ { line: "AB", A: ["A", "E", "D"], H: ["G", "P", "H"], B: ["C", "F", "B"] },
54
+ { line: "EF", E: ["A", "E", "D"], P: ["G", "P", "H"], F: ["C", "F", "B"] },
55
+ { line: "DC", D: ["A", "E", "D"], G: ["G", "P", "H"], C: ["C", "F", "B"] },
56
+ { line: "DA", A: ["A", "H", "B"], E: ["E", "P", "F"], D: ["D", "G", "C"] },
57
+ { line: "GH", H: ["A", "H", "B"], P: ["E", "P", "F"], G: ["D", "G", "C"] },
58
+ { line: "CB", B: ["A", "H", "B"], F: ["E", "P", "F"], C: ["D", "G", "C"] },
59
+ {
60
+ line: "DB",
61
+ D: ["D"],
62
+ I: ["E", "I", "G"],
63
+ P: ["A", "K", "P", "L", "C"],
64
+ J: ["H", "J", "F"],
65
+ B: ["B"],
66
+ },
67
+ {
68
+ line: "AC",
69
+ C: ["C"],
70
+ K: ["E", "K", "H"],
71
+ P: ["D", "I", "P", "J", "B"],
72
+ L: ["G", "L", "F"],
73
+ A: ["A"],
74
+ },
75
+ {
76
+ line: "EH",
77
+ E: ["E", "I", "G"],
78
+ H: ["H", "J", "F"],
79
+ K: ["A", "K", "P", "L", "C"],
80
+ },
81
+ {
82
+ line: "GF",
83
+ G: ["E", "I", "G"],
84
+ F: ["H", "J", "F"],
85
+ L: ["A", "K", "P", "L", "C"],
86
+ },
87
+ {
88
+ line: "EG",
89
+ E: ["E", "K", "H"],
90
+ G: ["G", "L", "F"],
91
+ I: ["D", "I", "P", "J", "B"],
92
+ },
93
+ {
94
+ line: "HF",
95
+ H: ["E", "K", "H"],
96
+ F: ["G", "L", "F"],
97
+ J: ["D", "I", "P", "J", "B"],
98
+ },
99
+ ];
100
+ const dataSet = projs.find((e) => e.line === identifiers.line);
101
+ for (const [key, value] of Object.entries(dataSet)) {
102
+ if (key === "line")
103
+ continue;
104
+ if (value.includes(identifiers.point)) {
105
+ return key;
106
+ }
107
+ }
108
+ return "";
109
+ };
110
+ const getInstruction = (identifiers) => {
111
+ const { line, point } = identifiers;
112
+ return `On considère le carré $ABCD$ ci-dessous :
113
+
114
+ ![](https://heureuxhasarddocsbucket.s3.eu-west-3.amazonaws.com/mathliveV2/activities/quizzes/generator/pointsOnSquare.png)
115
+
116
+ Quel est le projeté orthogonal de $${point}$ sur la droite $\\left(${line}\\right)$ ?
117
+ `;
118
+ };
119
+ const getHint = (identifiers) => {
120
+ return `- Si $A$ est un point sur une droite $d$, alors le projeté orthogonal de $A$ sur $d$ est $A$.
121
+
122
+ - Si $A$ n'appartient pas à la droite $d$, alors le projeté orthogonal de $A$ sur $d$ est le point $H$ sur $d$ tel que la droite $(AH)$ est perpendiculaire à $d$.`;
123
+ };
124
+ const getCorrection = (identifiers) => {
125
+ const { line, point } = identifiers;
126
+ //si point sur droite
127
+ //sinon
128
+ const points = getPoints();
129
+ const pointAnswer = getAnswer(identifiers);
130
+ const pointObj = points.find((e) => e.name === point);
131
+ const linePoints = points.filter((e) => line.includes(e.name));
132
+ const isOnLine = pointObj.isAligned(linePoints[0], linePoints[1]);
133
+ if (isOnLine) {
134
+ return `Puisque $${point}$ appartient à la droite $\\left(${line}\\right)$, le projeté orthogonal de $${point}$ sur $\\left(${line}\\right)$ est $${point}$.`;
135
+ }
136
+ else {
137
+ return `Les droites $\\left(${line}\\right)$ et $\\left(${point}${pointAnswer}\\right)$ sont perpendiculaires. De plus, le point $${pointAnswer}$ appartient à la droite $${line}$. Le projeté orthogonal de $${point}$ sur $\\left(${line}\\right)$ est donc $${pointAnswer}$.`;
138
+ }
139
+ };
140
+ const getKeys = (identifiers) => {
141
+ const names = getNames();
142
+ return names;
143
+ };
144
+ const isAnswerValid = (ans, { answer }) => {
145
+ try {
146
+ return ans === answer;
147
+ }
148
+ catch (err) {
149
+ return handleVEAError(err);
150
+ }
151
+ };
152
+ const getOrthogonalProjectFromPictureQuestion = (ops) => {
153
+ const data = [
154
+ { lines: ["AB", "EF", "DC"], excludes: ["I", "J", "K", "L"] },
155
+ { lines: ["DA", "GH", "CB"], excludes: ["I", "J", "K", "L"] },
156
+ { lines: ["DB", "AC"], excludes: [] },
157
+ { lines: ["EH", "GF"], excludes: ["B", "D"] },
158
+ { lines: ["EG", "HF"], excludes: ["A", "C"] },
159
+ ];
160
+ const names = getNames();
161
+ const dataSet = random(data);
162
+ const line = random(dataSet.lines);
163
+ const point = random(names, dataSet.excludes);
164
+ const identifiers = {
165
+ line,
166
+ point,
167
+ };
168
+ return getQuestionFromIdentifiers(identifiers);
169
+ };
170
+ const getQuestionFromIdentifiers = (identifiers) => {
171
+ return {
172
+ answer: getAnswer(identifiers),
173
+ instruction: getInstruction(identifiers),
174
+ keys: getKeys(identifiers),
175
+ answerFormat: "tex",
176
+ identifiers,
177
+ hint: getHint(identifiers),
178
+ correction: getCorrection(identifiers),
179
+ };
180
+ };
181
+ export const orthogonalProjectFromPicture = {
182
+ id: "orthogonalProjectFromPicture",
183
+ label: "Identifier le projeté orthogonal d'un point sur une figure codée",
184
+ isSingleStep: true,
185
+ generator: (nb, opts) => getDistinctQuestions(() => getOrthogonalProjectFromPictureQuestion(opts), nb),
186
+ qcmTimer: 60,
187
+ freeTimer: 60,
188
+ getPropositions,
189
+ isAnswerValid,
190
+ subject: "Mathématiques",
191
+ getInstruction,
192
+ getHint,
193
+ getCorrection,
194
+ getAnswer,
195
+ getQuestionFromIdentifiers,
196
+ hasHintAndCorrection: true,
197
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"pointImageFromTranslation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/euclidianConstructions/pointImageFromTranslation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAOrC,OAAO,EAGL,gBAAgB,EACjB,MAAM,8BAA8B,CAAC;AAMtC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,gBAAgB,EAAE,CAAC;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,EAAE,MAAM,EAAE,CAAC;CAC7B,CAAC;AAEF,KAAK,OAAO,GAAG;IACb,SAAS,EAAE,OAAO,CAAC;CACpB,CAAC;AA0IF,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAgBpE,CAAC"}
1
+ {"version":3,"file":"pointImageFromTranslation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/euclidianConstructions/pointImageFromTranslation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAQrC,OAAO,EAGL,gBAAgB,EACjB,MAAM,8BAA8B,CAAC;AAMtC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,gBAAgB,EAAE,CAAC;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,EAAE,MAAM,EAAE,CAAC;CAC7B,CAAC;AAEF,KAAK,OAAO,GAAG;IACb,SAAS,EAAE,OAAO,CAAC;CACpB,CAAC;AAqKF,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAiBpE,CAAC"}
@@ -1,6 +1,7 @@
1
1
  import { GeneratorOptionType, GeneratorOptionTarget, } from "../../../../exercises/exercise.js";
2
2
  import { toolBarConstructor } from "../../../../exercises/utils/geogebra/toolBarConstructor.js";
3
3
  import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
4
+ import { red } from "../../../../geogebra/colors.js";
4
5
  import { GeogebraConstructor } from "../../../../geogebra/geogebraConstructor.js";
5
6
  import { approxEqual } from "../../../../geogebra/parsers/approxEqual.js";
6
7
  import { ggbPointToCoords } from "../../../../geogebra/parsers/ggbPointToCoords.js";
@@ -23,14 +24,40 @@ const getEndPoint = (identifiers) => {
23
24
  const end = vector.getEndPoint(startPoint, identifiers.startPoint + "'");
24
25
  return end;
25
26
  };
26
- // const getHint: GetHint<Identifiers> = (identifiers) => {};
27
- // const getCorrection: GetCorrection<Identifiers> = (identifiers) => {};
27
+ const getHint = (identifiers, opts) => {
28
+ const { points, startPoint, translationPoints } = identifiers;
29
+ const useVector = opts?.useVector;
30
+ if (useVector) {
31
+ const vector = translationPoints[0] + translationPoints[1];
32
+ return `Trace le vecteur $\\overrightarrow{${vector}}$ à partir du point $${startPoint}$.`;
33
+ }
34
+ else {
35
+ const vector = translationPoints[0] + translationPoints[1];
36
+ return `À partir du point $${startPoint}$, déplace toi de la même façon que le déplacement de $${translationPoints[0]}$ vers $${translationPoints[1]}$.`;
37
+ }
38
+ };
39
+ const getCorrection = (identifiers, opts) => {
40
+ const { points, startPoint, translationPoints } = identifiers;
41
+ const useVector = opts?.useVector;
42
+ if (useVector) {
43
+ const vector = translationPoints[0] + translationPoints[1];
44
+ return `On se place à partir du point $${startPoint}$. On trace le vecteur $\\overrightarrow{${vector}}$. Le point d'arrivée est le point recherché.`;
45
+ }
46
+ else {
47
+ return `On se place à partir du point $${startPoint}$. On se déplace de la même façon que le déplacement de $${translationPoints[0]}$ vers $${translationPoints[1]}$. Le point d'arrivée est le point recherché.`;
48
+ }
49
+ };
28
50
  const getGGBAnswer = (identifiers) => {
29
- return getEndPoint(identifiers).toGGBCommand();
51
+ const { points, startPoint, translationPoints } = identifiers;
52
+ const endPoint = getEndPoint(identifiers);
53
+ return [
54
+ ...endPoint.toGGBCommand(),
55
+ `a = Vector(${startPoint}, ${endPoint.name})`,
56
+ `SetColor(a, "${red}")`,
57
+ ];
30
58
  };
31
59
  const getStudentGGBOptions = (identifiers) => {
32
60
  const points = identifiers.points.map((p) => PointConstructor.fromIdentifiers(p));
33
- const end = getEndPoint(identifiers);
34
61
  const ggb = new GeogebraConstructor({
35
62
  hideAxes: true,
36
63
  isGridSimple: true,
@@ -39,15 +66,11 @@ const getStudentGGBOptions = (identifiers) => {
39
66
  size: 3,
40
67
  style: 1,
41
68
  })),
69
+ fontSize: 16,
42
70
  });
43
- const [endX, endY] = [end.x.evaluate(), end.y.evaluate()];
71
+ const endPoint = getEndPoint(identifiers);
44
72
  return ggb.getOptions({
45
- coords: [
46
- Math.min(endX - 2, -7),
47
- Math.max(endX + 2, 7),
48
- Math.min(endY - 2, -7),
49
- Math.max(endY + 2, 7),
50
- ],
73
+ coords: ggb.getCoordsForPoints([...points, endPoint]),
51
74
  });
52
75
  };
53
76
  const isGGBAnswerValid = (ans, { ggbAnswer }) => {
@@ -66,7 +89,7 @@ const getPointImageFromTranslationQuestion = (opts) => {
66
89
  const points = [];
67
90
  for (let i = 0; i < 4; i++) {
68
91
  const name = String.fromCharCode(65 + i);
69
- const newPoint = doWhile(() => PointConstructor.random(name, -4, 5), (p) => points.some((p2) => p.distanceTo(p2) < 2));
92
+ const newPoint = doWhile(() => PointConstructor.random(name, -3, 4), (p) => points.some((p2) => p.distanceTo(p2) < 2));
70
93
  points.push(newPoint);
71
94
  }
72
95
  const startPoint = random(points).name;
@@ -74,8 +97,11 @@ const getPointImageFromTranslationQuestion = (opts) => {
74
97
  random(points.filter((p) => p.name !== startPoint)).name,
75
98
  ];
76
99
  translationPoints.push(random(points.filter((p) => p.name !== translationPoints[0])).name);
100
+ const pointsUsed = [startPoint, ...translationPoints];
77
101
  const identifiers = {
78
- points: points.map((p) => p.toIdentifiers()),
102
+ points: points
103
+ .filter((p) => pointsUsed.includes(p.name))
104
+ .map((p) => p.toIdentifiers()),
79
105
  startPoint,
80
106
  translationPoints,
81
107
  };
@@ -87,8 +113,8 @@ const getQuestionFromIdentifiers = (identifiers, opts) => {
87
113
  instruction: getInstruction(identifiers, opts),
88
114
  studentGgbOptions: getStudentGGBOptions(identifiers, opts),
89
115
  identifiers,
90
- // hint: getHint(identifiers),
91
- // correction: getCorrection(identifiers),
116
+ hint: getHint(identifiers, opts),
117
+ correction: getCorrection(identifiers, opts),
92
118
  };
93
119
  return question;
94
120
  };
@@ -98,6 +124,7 @@ const options = [
98
124
  label: 'Utiliser le terme "translation de vecteur"',
99
125
  type: GeneratorOptionType.checkbox,
100
126
  target: GeneratorOptionTarget.instruction,
127
+ defaultValue: false,
101
128
  },
102
129
  ];
103
130
  export const pointImageFromTranslation = {
@@ -108,11 +135,12 @@ export const pointImageFromTranslation = {
108
135
  ggbTimer: 60,
109
136
  isGGBAnswerValid,
110
137
  subject: "Mathématiques",
111
- // getHint,
112
- // getCorrection,
138
+ getHint,
139
+ getCorrection,
113
140
  getGGBAnswer,
114
141
  getStudentGGBOptions,
115
142
  answerType: "GGB",
116
143
  options,
117
144
  getQuestionFromIdentifiers,
145
+ hasHintAndCorrection: true,
118
146
  };
@@ -0,0 +1,9 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ type Identifiers = {
3
+ shape: "square" | "rectangle";
4
+ side: number;
5
+ side2?: number;
6
+ };
7
+ export declare const calculateDiagonalFromSides: Exercise<Identifiers>;
8
+ export {};
9
+ //# sourceMappingURL=calculateDiagonalFromSides.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"calculateDiagonalFromSides.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/pythagore/calculateDiagonalFromSides.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAerC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,QAAQ,GAAG,WAAW,CAAC;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAqJF,eAAO,MAAM,0BAA0B,EAAE,QAAQ,CAAC,WAAW,CAkB5D,CAAC"}