math-exercises 3.0.156 → 3.0.157

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/math/calcul/proportionality/proportionalityTableCoefficient.js +1 -1
  2. package/lib/exercises/math/calculLitteral/equation/factorizeEquation.d.ts +4 -1
  3. package/lib/exercises/math/calculLitteral/equation/factorizeEquation.d.ts.map +1 -1
  4. package/lib/exercises/math/calculLitteral/equation/factorizeEquation.js +148 -31
  5. package/lib/exercises/math/calculLitteral/equation/multiplicationEquation.d.ts +4 -1
  6. package/lib/exercises/math/calculLitteral/equation/multiplicationEquation.d.ts.map +1 -1
  7. package/lib/exercises/math/calculLitteral/equation/multiplicationEquation.js +124 -44
  8. package/lib/exercises/math/dataRepresentations/halfPieChartCommenting.d.ts.map +1 -1
  9. package/lib/exercises/math/dataRepresentations/halfPieChartCommenting.js +4 -1
  10. package/lib/exercises/math/functions/affines/drawAffineFromPointAndLeadingCoeff.d.ts.map +1 -1
  11. package/lib/exercises/math/functions/affines/drawAffineFromPointAndLeadingCoeff.js +5 -4
  12. package/lib/exercises/math/functions/linear/linearFromExercise.d.ts.map +1 -1
  13. package/lib/exercises/math/functions/linear/linearFromExercise.js +4 -3
  14. package/lib/exercises/math/geometry/euclidian/pinSegmentFromRotation.js +1 -1
  15. package/lib/exercises/math/geometry/euclidian/recognizeHomothetyCenter.d.ts.map +1 -1
  16. package/lib/exercises/math/geometry/euclidian/recognizeHomothetyCenter.js +4 -5
  17. package/lib/exercises/math/geometry/euclidianConstructions/placeHomothetyCenter.js +4 -4
  18. package/lib/exercises/math/geometry/perimeters/circleCircumference.d.ts.map +1 -1
  19. package/lib/exercises/math/geometry/perimeters/circleCircumference.js +5 -3
  20. package/lib/exercises/math/geometry/volumes/parallelepipedVolume.d.ts.map +1 -1
  21. package/lib/exercises/math/geometry/volumes/parallelepipedVolume.js +18 -5
  22. package/lib/exercises/math/geometry/volumes/volumeOfPyramidWithSquareOrRectBase.d.ts.map +1 -1
  23. package/lib/exercises/math/geometry/volumes/volumeOfPyramidWithSquareOrRectBase.js +45 -21
  24. package/lib/exercises/math/geometry/volumes/volumeOfPyramidWithTriangleBase.d.ts.map +1 -1
  25. package/lib/exercises/math/geometry/volumes/volumeOfPyramidWithTriangleBase.js +33 -12
  26. package/lib/exercises/math/geometry/volumes/volumeOfPyramidWithTriangleRectBase.d.ts.map +1 -1
  27. package/lib/exercises/math/geometry/volumes/volumeOfPyramidWithTriangleRectBase.js +38 -15
  28. package/lib/exercises/math/percent/findTVA.d.ts.map +1 -1
  29. package/lib/exercises/math/percent/findTVA.js +17 -11
  30. package/lib/exercises/math/percent/populationEffectifFromSubPopulation.js +1 -1
  31. package/lib/exercises/math/probaStat/basicProbas/index.d.ts +1 -0
  32. package/lib/exercises/math/probaStat/basicProbas/index.d.ts.map +1 -1
  33. package/lib/exercises/math/probaStat/basicProbas/index.js +1 -1
  34. package/lib/exercises/math/probaStat/basicProbas/pickEquiprobableSituations.d.ts.map +1 -1
  35. package/lib/exercises/math/probaStat/basicProbas/pickEquiprobableSituations.js +114 -20
  36. package/lib/exercises/math/probaStat/basicProbas/pickEquiprobableTo.js +2 -2
  37. package/lib/exercises/math/probaStat/stats1var/etendueTable.d.ts.map +1 -1
  38. package/lib/exercises/math/probaStat/stats1var/etendueTable.js +5 -1
  39. package/lib/exercises/math/probaStat/stats1var/medianWithList.js +1 -1
  40. package/lib/exercises/math/probaStat/stats1var/medianWithTable.d.ts.map +1 -1
  41. package/lib/exercises/math/probaStat/stats1var/medianWithTable.js +19 -5
  42. package/lib/exercises/math/probaStat/stats1var/plausibilityOfAverage.js +1 -1
  43. package/lib/exercises/math/probaStat/twoStepExperiments/headsOrTailsTwiceOutcomes.d.ts.map +1 -1
  44. package/lib/exercises/math/probaStat/twoStepExperiments/headsOrTailsTwiceOutcomes.js +34 -29
  45. package/lib/exercises/math/probaStat/twoStepExperiments/headsOrTailsTwiceProbas.js +3 -3
  46. package/lib/exercises/math/probaStat/twoStepExperiments/numberPoolTwiceProbas.js +2 -2
  47. package/lib/exercises/math/probaStat/twoStepExperiments/twoStepExperimentProbas.d.ts.map +1 -1
  48. package/lib/exercises/math/probaStat/twoStepExperiments/twoStepExperimentProbas.js +18 -10
  49. package/lib/exercises/math/spaceGeometry/solids/recognizeSolidFromSolidPattern.js +1 -1
  50. package/lib/exercises/math/spaceGeometry/sphere/index.d.ts +2 -0
  51. package/lib/exercises/math/spaceGeometry/sphere/index.d.ts.map +1 -1
  52. package/lib/exercises/math/spaceGeometry/sphere/index.js +3 -1
  53. package/lib/exercises/math/spaceGeometry/sphere/pinPointLatLon.2d.d.ts +12 -0
  54. package/lib/exercises/math/spaceGeometry/sphere/pinPointLatLon.2d.d.ts.map +1 -0
  55. package/lib/exercises/math/spaceGeometry/sphere/pinPointLatLon.2d.js +205 -0
  56. package/lib/exercises/math/spaceGeometry/sphere/sphereLatLonReading.2d.d.ts +13 -0
  57. package/lib/exercises/math/spaceGeometry/sphere/sphereLatLonReading.2d.d.ts.map +1 -0
  58. package/lib/exercises/math/spaceGeometry/sphere/sphereLatLonReading.2d.js +215 -0
  59. package/lib/exercises/math/spaceGeometry/sphere/sphereLatLonReading.3d.d.ts +14 -0
  60. package/lib/exercises/math/spaceGeometry/sphere/sphereLatLonReading.3d.d.ts.map +1 -0
  61. package/lib/exercises/math/spaceGeometry/sphere/sphereLatLonReading.3d.js +390 -0
  62. package/lib/exercises/math/trigonometry/trigonometrySideCalcul.js +1 -1
  63. package/lib/exercises/vea/setVEA.d.ts.map +1 -1
  64. package/lib/exercises/vea/setVEA.js +4 -0
  65. package/lib/index.d.ts +24 -2
  66. package/lib/index.d.ts.map +1 -1
  67. package/lib/utils/arrays/dichoFilter.d.ts +2 -0
  68. package/lib/utils/arrays/dichoFilter.d.ts.map +1 -0
  69. package/lib/utils/arrays/dichoFilter.js +11 -0
  70. package/package.json +1 -1
@@ -0,0 +1,390 @@
1
+ import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { greenMain, red } from "../../../../geogebra/colors.js";
4
+ import { GeogebraConstructor } from "../../../../geogebra/geogebraConstructor.js";
5
+ import { Point, PointConstructor, } from "../../../../math/geometry/point.js";
6
+ import { SpacePoint, SpacePointConstructor, } from "../../../../math/geometry/spacePoint.js";
7
+ import { randint } from "../../../../math/utils/random/randint.js";
8
+ import { cos } from "../../../../tree/nodes/functions/cosNode.js";
9
+ import { sin } from "../../../../tree/nodes/functions/sinNode.js";
10
+ import { PiNode } from "../../../../tree/nodes/numbers/piNode.js";
11
+ import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
12
+ import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
13
+ import { coinFlip } from "../../../../utils/alea/coinFlip.js";
14
+ import { random } from "../../../../utils/alea/random.js";
15
+ const earthGlobeGGBCommands = () => {
16
+ const radius = 10;
17
+ const radiusMore = 10.5;
18
+ const radiusMoreMore = 11;
19
+ return [
20
+ //hide xOyPlane
21
+ `SetFilling(xOyPlane, 0)`,
22
+ //sphere
23
+ `Sph = Sphere((0,0,0), 0.99 * ${radius})`,
24
+ `SetColor(Sph, "#d3dde6ff")`,
25
+ `SetFilling(Sph, 0.84)`,
26
+ `SetLineThickness(Sph, 1)`,
27
+ //circles and arcs
28
+ //méridien
29
+ `c = Circle((0, 0, ${radius}), (${radius}, 0, 0), (0, 0, -${radius}))`,
30
+ `SetVisibleInView(c, -1, false)`,
31
+ `m = Arc(c, (0, 0, ${radius}), (0, 0, -${radius}) )`,
32
+ `SetColor(m, "${greenMain}")`,
33
+ `SetLineThickness(m, 3)`,
34
+ // `SetCaption(m, "$\\footnotesize \\text{Méridien de Greenwich}$")`,
35
+ // `ShowLabel(m, true)`,
36
+ //équateur
37
+ `d = Circle((${radius}, 0, 0), (0, ${radius}, 0), (-${radius}, 0, 0))`,
38
+ `SetColor(d, "${red}")`,
39
+ `SetLineThickness(d, 3)`,
40
+ // `SetCaption(d, "$\\footnotesize \\text{Équateur}$")`,
41
+ // `ShowLabel(d, true)`,
42
+ //other circles
43
+ `A_1 = (${radius}, 0, 0)`,
44
+ `l1 = Sequence(Rotate(m, nn * 15°, zAxis), nn, 1, 24)`,
45
+ `l2 = Sequence(Rotate(A_1, nn * 15°, yAxis), nn, -5, 5)`,
46
+ `l3 = Sequence(z(Element(l2, nn)), nn, 1, Length(l2))`,
47
+ `l4 = Sequence(x(Element(l2, nn)), nn, 1, Length(l2))`,
48
+ `l5 = Sequence(Circle((0, 0, Element(l3, nn)), Element(l4, nn), zAxis), nn, 1, Length(l2))`,
49
+ `SetVisibleInView(l2, -1, false)`, //Use -1 for the 3D View
50
+ `SetVisibleInView(A_1, -1, false)`,
51
+ //cercles::parallèles
52
+ `SetColor(l5, "${red}")`,
53
+ `SetLineThickness(l5, 1)`,
54
+ //cercles::méridiens
55
+ `SetColor(l1, "${greenMain}")`,
56
+ `SetLineThickness(l1, 1)`,
57
+ //markers
58
+ //marqueurs::parallèles
59
+ `lp0 = Sequence(Rotate((${radiusMore}, 0, 0), nn * 15°, yAxis), nn, -5, 5)`,
60
+ `SetVisibleInView(lp0, -1, false)`,
61
+ ...[...Array(11).keys()]
62
+ .map((i) => i + 1)
63
+ .flatMap((i) => {
64
+ const angleInDegrees = -(90 - i * 15);
65
+ let strAngle;
66
+ if (angleInDegrees == 0) {
67
+ return [];
68
+ }
69
+ else if (angleInDegrees < 0) {
70
+ strAngle = `${(-angleInDegrees).frenchify()}°N`;
71
+ }
72
+ else {
73
+ strAngle = `${angleInDegrees.frenchify()}°S`;
74
+ }
75
+ return [
76
+ `P0_{${i}} = Point({x(Element(lp0, ${i})), y(Element(lp0, ${i})), z(Element(lp0, ${i}))})`,
77
+ `SetPointSize(P0_{${i}}, 1)`,
78
+ `SetColor(P0_{${i}}, "${red}")`,
79
+ `SetCaption(P0_{${i}}, "$\\footnotesize \\text{${strAngle}}$")`,
80
+ `ShowLabel(P0_{${i}}, true)`,
81
+ ];
82
+ }),
83
+ `lp2 = Sequence(Rotate(((-${radiusMore}), 0, 0), nn * 15°, yAxis), nn, -5, 5)`,
84
+ `SetVisibleInView(lp2, -1, false)`,
85
+ ...[...Array(11).keys()]
86
+ .map((i) => i + 1)
87
+ .flatMap((i) => {
88
+ const angleInDegrees = 90 - i * 15;
89
+ let strAngle;
90
+ if (angleInDegrees == 0) {
91
+ return [];
92
+ }
93
+ else if (angleInDegrees < 0) {
94
+ strAngle = `${(-angleInDegrees).frenchify()}°N`;
95
+ }
96
+ else {
97
+ strAngle = `${angleInDegrees.frenchify()}°S`;
98
+ }
99
+ return [
100
+ `P2_{${i}} = Point({x(Element(lp2, ${i})), y(Element(lp2, ${i})), z(Element(lp2, ${i}))})`,
101
+ `SetPointSize(P2_{${i}}, 1)`,
102
+ `SetColor(P2_{${i}}, "${red}")`,
103
+ `SetCaption(P2_{${i}}, "$\\footnotesize \\text{${strAngle}}$")`,
104
+ `ShowLabel(P2_{${i}}, true)`,
105
+ ];
106
+ }),
107
+ `lp1 = Sequence(Rotate((0, -${radiusMore}, 0), nn * 15°, xAxis), nn, -5, 5)`,
108
+ `SetVisibleInView(lp1, -1, false)`,
109
+ ...[...Array(11).keys()]
110
+ .map((i) => i + 1)
111
+ .flatMap((i) => {
112
+ const angleInDegrees = -(90 - i * 15);
113
+ let strAngle;
114
+ if (angleInDegrees == 0) {
115
+ return [];
116
+ }
117
+ else if (angleInDegrees < 0) {
118
+ strAngle = `${(-angleInDegrees).frenchify()}°N`;
119
+ }
120
+ else {
121
+ strAngle = `${angleInDegrees.frenchify()}°S`;
122
+ }
123
+ return [
124
+ `P1_{${i}} = Point({x(Element(lp1, ${i})), y(Element(lp1, ${i})), z(Element(lp1, ${i}))})`,
125
+ `SetPointSize(P1_{${i}}, 1)`,
126
+ `SetColor(P1_{${i}}, "${red}")`,
127
+ `SetCaption(P1_{${i}}, "$\\footnotesize \\text{${strAngle}}$")`,
128
+ `ShowLabel(P1_{${i}}, true)`,
129
+ ];
130
+ }),
131
+ `lp3 = Sequence(Rotate((0, ${radiusMore}, 0), nn * 15°, xAxis), nn, -5, 5)`,
132
+ `SetVisibleInView(lp3, -1, false)`,
133
+ ...[...Array(11).keys()]
134
+ .map((i) => i + 1)
135
+ .flatMap((i) => {
136
+ const angleInDegrees = 90 - i * 15;
137
+ let strAngle;
138
+ if (angleInDegrees == 0) {
139
+ return [];
140
+ }
141
+ else if (angleInDegrees < 0) {
142
+ strAngle = `${(-angleInDegrees).frenchify()}°N`;
143
+ }
144
+ else {
145
+ strAngle = `${angleInDegrees.frenchify()}°S`;
146
+ }
147
+ return [
148
+ `P3_{${i}} = Point({x(Element(lp3, ${i})), y(Element(lp3, ${i})), z(Element(lp3, ${i}))})`,
149
+ `SetPointSize(P3_{${i}}, 1)`,
150
+ `SetColor(P3_{${i}}, "${red}")`,
151
+ `SetCaption(P3_{${i}}, "$\\footnotesize \\text{${strAngle}}$")`,
152
+ `ShowLabel(P3_{${i}}, true)`,
153
+ ];
154
+ }),
155
+ //marqueurs::méridiens
156
+ `lm0 = Sequence(Rotate((${radiusMoreMore}, 0, 0), nn * 15°, zAxis), nn, -11, 12)`,
157
+ `SetVisibleInView(lm0, -1, false)`,
158
+ ...[...Array(24).keys()]
159
+ .map((i) => i + 1)
160
+ .flatMap((i) => {
161
+ const angleInDegrees = 180 - i * 15;
162
+ let strAngle;
163
+ if (angleInDegrees == -180 || angleInDegrees == 0) {
164
+ strAngle = `${angleInDegrees.frenchify()}°`;
165
+ }
166
+ else if (angleInDegrees < 0) {
167
+ strAngle = `${(-angleInDegrees).frenchify()}°E`;
168
+ }
169
+ else {
170
+ strAngle = `${angleInDegrees.frenchify()}°O`;
171
+ }
172
+ return [
173
+ `M0_{${i}} = Point({x(Element(lm0, ${i})), y(Element(lm0, ${i})), z(Element(lm0, ${i}))})`,
174
+ `SetPointSize(M0_{${i}}, 1)`,
175
+ `SetColor(M0_{${i}}, "black")`,
176
+ `SetCaption(M0_{${i}}, "$\\footnotesize \\text{${strAngle}}$")`,
177
+ `ShowLabel(M0_{${i}}, true)`,
178
+ ];
179
+ }),
180
+ //center view
181
+ `CenterView(Point({0,0,0}))`,
182
+ ];
183
+ };
184
+ const spacePointForLatLonPoint = (latlonPoint, radius) => {
185
+ const { x: lat, y: lon } = latlonPoint;
186
+ const toRadians = frac(PiNode, 180);
187
+ const delta = multiply(lat, toRadians);
188
+ const theta = multiply(lon, toRadians);
189
+ const chunk = multiply(radius, cos(delta));
190
+ const x = multiply(chunk, cos(theta));
191
+ const y = multiply(chunk, sin(theta));
192
+ const z = multiply(radius, sin(delta));
193
+ return new SpacePoint("S", x, y, z);
194
+ };
195
+ // const latLonPointForSpacePoint = (
196
+ // spacePoint: SpacePoint,
197
+ // center: SpacePoint,
198
+ // ) => {
199
+ // const { x, y, z } = spacePoint;
200
+ // const vec3d = SpaceVectorConstructor.fromPoints(
201
+ // new SpacePoint("O", (0).toTree(), (0).toTree(), (0).toTree()),
202
+ // spacePoint,
203
+ // );
204
+ // const radius = vec3d.getNorm();
205
+ // const delta = substract(
206
+ // frac(PiNode, 2),
207
+ // Math.atan2(y.evaluate(), x.evaluate()),
208
+ // );
209
+ // const theta = Math.acos(z.evaluate()) / radius.evaluate();
210
+ // const toDegrees = frac(180, PiNode).evaluate();
211
+ // const lat = multiply(delta, toDegrees).evaluate();
212
+ // const lon = multiply(theta, toDegrees).evaluate();
213
+ // return new Point("L", lat, lon);
214
+ // };
215
+ const getStrLatitude = (angleInDegrees) => {
216
+ if (angleInDegrees % 90 === 0) {
217
+ return `${angleInDegrees.frenchify()}°`;
218
+ }
219
+ else if (angleInDegrees < 0) {
220
+ return `${(-angleInDegrees).frenchify()}°S`;
221
+ }
222
+ else {
223
+ return `${angleInDegrees.frenchify()}°N`;
224
+ }
225
+ };
226
+ const getStrLongitude = (angleInDegrees) => {
227
+ if (angleInDegrees % 180 === 0) {
228
+ return `${angleInDegrees.frenchify()}°`;
229
+ }
230
+ else if (angleInDegrees < 0) {
231
+ return `${(-angleInDegrees).frenchify()}°O`;
232
+ }
233
+ else {
234
+ return `${angleInDegrees.frenchify()}°E`;
235
+ }
236
+ };
237
+ const getPropositions = (n, { answer, ...identifiers }) => {
238
+ const { pointsDict, namePointTarget, isLatitude } = identifiers;
239
+ const propositions = [];
240
+ const latLonPoints = PointConstructor.fromIdentifiers(pointsDict[namePointTarget].latLon);
241
+ if (isLatitude) {
242
+ addValidProp(propositions, getStrLatitude(latLonPoints.x.evaluate()));
243
+ tryToAddWrongProp(propositions, getStrLongitude(latLonPoints.y.evaluate()));
244
+ //wrongSign
245
+ tryToAddWrongProp(propositions, getStrLatitude(-latLonPoints.x.evaluate()));
246
+ //madness
247
+ tryToAddWrongProp(propositions, getStrLatitude(latLonPoints.y.evaluate()));
248
+ tryToAddWrongProp(propositions, getStrLatitude(-latLonPoints.y.evaluate()));
249
+ tryToAddWrongProp(propositions, getStrLongitude(latLonPoints.x.evaluate()));
250
+ tryToAddWrongProp(propositions, getStrLongitude(-latLonPoints.x.evaluate()));
251
+ }
252
+ else {
253
+ addValidProp(propositions, getStrLongitude(latLonPoints.y.evaluate()));
254
+ tryToAddWrongProp(propositions, getStrLatitude(latLonPoints.x.evaluate()));
255
+ //wrongSign
256
+ tryToAddWrongProp(propositions, getStrLongitude(-latLonPoints.y.evaluate()));
257
+ //madness
258
+ tryToAddWrongProp(propositions, getStrLongitude(latLonPoints.x.evaluate()));
259
+ tryToAddWrongProp(propositions, getStrLongitude(-latLonPoints.x.evaluate()));
260
+ tryToAddWrongProp(propositions, getStrLatitude(latLonPoints.y.evaluate()));
261
+ tryToAddWrongProp(propositions, getStrLatitude(-latLonPoints.y.evaluate()));
262
+ }
263
+ return shuffleProps(propositions, n);
264
+ };
265
+ const getAnswer = (identifiers) => {
266
+ const { pointsDict, namePointTarget, isLatitude } = identifiers;
267
+ const latLonPoints = PointConstructor.fromIdentifiers(pointsDict[namePointTarget].latLon);
268
+ if (isLatitude) {
269
+ return getStrLatitude(latLonPoints.x.evaluate());
270
+ }
271
+ else {
272
+ return getStrLongitude(latLonPoints.y.evaluate());
273
+ }
274
+ };
275
+ const getInstruction = (identifiers) => {
276
+ const { isLatitude, namePointTarget } = identifiers;
277
+ return `Quelle est la ${isLatitude ? "latitude" : "longitude"} du point $${namePointTarget}$ sur la figure ci-dessous ?
278
+
279
+ *On pourra tourner la fenêtre graphique.*`;
280
+ };
281
+ const getHint = () => {
282
+ return `Pour déterminer la latitude, on utlise les parallèles.
283
+ Pour déterminer la longitude, on utilise les méridiens.`;
284
+ };
285
+ const getCorrection = (identifiers) => {
286
+ const { isLatitude, namePointTarget } = identifiers;
287
+ const answer = getAnswer(identifiers);
288
+ return `La latitude donne la position Nord/Sud.
289
+ La longitude donne la position Est/Ouest.
290
+ La ${isLatitude ? "latitude" : "longitude"} du point $${namePointTarget}$ est donc $${answer}$.`;
291
+ };
292
+ const getGGBOptions = (identifiers) => {
293
+ const { pointsDict, namePointTarget } = identifiers;
294
+ const spacePoints = Object.values(pointsDict).map((miniDict) => SpacePointConstructor.fromIdentifiers(miniDict["3d"]));
295
+ const spacePointTarget = SpacePointConstructor.fromIdentifiers(pointsDict[namePointTarget]["3d"]);
296
+ const radius = 5;
297
+ // const zoomInCuboid = [-1, -1, -1, 1, 1, 1].map((v) => v * 0.5);
298
+ const commands = [
299
+ ...earthGlobeGGBCommands(),
300
+ ...spacePoints.flatMap((spacePoint) => spacePoint.toGGBCommand()),
301
+ // `ZoomIn(${zoomInCuboid.join(",")})`, //does not work -_-
302
+ // `ZoomIn(2,${spacePointTarget.toCoords()})`, //does not work -_-
303
+ ];
304
+ const ggb = new GeogebraConstructor({
305
+ commands,
306
+ is3D: true,
307
+ xAxis: {
308
+ hidden: true,
309
+ },
310
+ yAxis: {
311
+ hidden: true,
312
+ },
313
+ zAxis: {
314
+ hidden: true,
315
+ },
316
+ viewDirectionVector: [
317
+ -spacePointTarget.x.evaluate(),
318
+ -spacePointTarget.y.evaluate(),
319
+ -spacePointTarget.z.evaluate(),
320
+ ],
321
+ });
322
+ const xMax = radius;
323
+ const xMin = -xMax;
324
+ const yMax = radius;
325
+ const yMin = -yMax;
326
+ const zMax = radius;
327
+ const zMin = -zMax;
328
+ return ggb.getOptions({
329
+ coords: [xMin, xMax, yMin, yMax, zMin, zMax],
330
+ });
331
+ };
332
+ const getKeys = () => {
333
+ return [];
334
+ };
335
+ const isAnswerValid = (ans, { answer }) => {
336
+ return ans === answer;
337
+ };
338
+ const getSphereLatLonReadingQuestion = () => {
339
+ const isLatitude = coinFlip();
340
+ const radius = 10;
341
+ const letters = ["A", "B", "C", "D"];
342
+ const pointsDict = letters.reduce((acc, letter) => {
343
+ const lat = randint(-4, 5) * 15;
344
+ const lon = randint(-11, 12) * 15;
345
+ const latLonPoint = new Point(`LatLon_{letter}`, lat, lon);
346
+ const spacePoint = spacePointForLatLonPoint(latLonPoint, radius.toTree());
347
+ spacePoint.name = letter;
348
+ acc[letter] = {
349
+ latLon: latLonPoint.toIdentifiers(),
350
+ "3d": spacePoint.toIdentifiers(),
351
+ };
352
+ return acc;
353
+ }, {});
354
+ const namePointTarget = random(Object.keys(pointsDict));
355
+ const identifiers = {
356
+ isLatitude,
357
+ pointsDict,
358
+ namePointTarget,
359
+ };
360
+ return getQuestionFromIdentifiers(identifiers);
361
+ };
362
+ const getQuestionFromIdentifiers = (identifiers) => {
363
+ const question = {
364
+ answer: getAnswer(identifiers),
365
+ instruction: getInstruction(identifiers),
366
+ keys: getKeys(identifiers),
367
+ answerFormat: "tex",
368
+ identifiers,
369
+ hint: getHint(identifiers),
370
+ correction: getCorrection(identifiers),
371
+ ggbOptions: getGGBOptions(identifiers),
372
+ };
373
+ return question;
374
+ };
375
+ export const sphereLatLonReading = {
376
+ id: "sphereLatLonReading",
377
+ label: "Donner la latitude/longitude d'un point sur une sphère",
378
+ isSingleStep: true,
379
+ generator: (nb, opts) => getDistinctQuestions(() => getSphereLatLonReadingQuestion(opts), nb),
380
+ qcmTimer: 60,
381
+ freeTimer: 60,
382
+ getPropositions,
383
+ isAnswerValid,
384
+ getHint,
385
+ getCorrection,
386
+ hasHintAndCorrection: true,
387
+ subject: "Mathématiques",
388
+ hasGeogebra: true,
389
+ getQuestionFromIdentifiers,
390
+ };
@@ -14,7 +14,7 @@ const getInstruction = (identifiers) => {
14
14
  const angleValue = triangle.angles[givenAngle].evaluate().frenchify();
15
15
  return `Le triangle $${triangle.name}$ rectangle en $${triangle.points[0].name}$ est tel que $${triangle.sides[givenSide].toLengthTex()}\\ \\textrm{cm}$ et $${triangle.angles[givenAngle].toTex()} = ${angleValue}^\\circ$.
16
16
 
17
- Calculer $${triangle.sides[sideAsked].toInsideName()}$ à $0,1 \\ \\textrm{cm}$.`;
17
+ Calculer $${triangle.sides[sideAsked].toInsideName()}$ à $0,1 \\ \\textrm{cm}$ près.`;
18
18
  };
19
19
  const getAnswer = (identifiers) => {
20
20
  const { sideAsked, triangleIdentifiers } = identifiers;
@@ -1 +1 @@
1
- {"version":3,"file":"setVEA.d.ts","sourceRoot":"","sources":["../../../src/exercises/vea/setVEA.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAGlE,8BAAsB,MAAM;IAC1B,MAAM,CAAC,mBAAmB,GACxB,QAAQ,aAAa,EAAE,EACvB,WAAW,aAAa,EAAE,aA2B1B;CACH"}
1
+ {"version":3,"file":"setVEA.d.ts","sourceRoot":"","sources":["../../../src/exercises/vea/setVEA.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAGlE,8BAAsB,MAAM;IAC1B,MAAM,CAAC,mBAAmB,GACxB,QAAQ,aAAa,EAAE,EACvB,WAAW,aAAa,EAAE,aAiC1B;CACH"}
@@ -1,6 +1,10 @@
1
1
  import { isNodesEqual } from "./isNodesEqual.js";
2
2
  export class SetVEA {
3
3
  static isArrayOfNodesValid = (arrAns, arrAnswer) => {
4
+ const isSameLength = arrAns.length === arrAnswer.length;
5
+ if (!isSameLength) {
6
+ return false;
7
+ }
4
8
  const dictAnswer = Object.fromEntries(arrAnswer.map((node, i) => [i, node]));
5
9
  let isValid = true;
6
10
  for (let i = 0; i < arrAns.length; i++) {
package/lib/index.d.ts CHANGED
@@ -464,7 +464,9 @@ declare const mathExercises: (Exercise<{
464
464
  b: number;
465
465
  c: number;
466
466
  d: number;
467
- }, Record<string, string | boolean | string[]>> | Exercise<{
467
+ }, {
468
+ answerInputTypes: string[];
469
+ }> | Exercise<{
468
470
  a: number;
469
471
  b: number;
470
472
  }, Record<string, string | boolean | string[]>> | Exercise<{
@@ -499,7 +501,9 @@ declare const mathExercises: (Exercise<{
499
501
  a: number;
500
502
  isSum: boolean;
501
503
  b: number;
502
- }, Record<string, string | boolean | string[]>> | Exercise<{
504
+ }, {
505
+ answerInputTypes: string[];
506
+ }> | Exercise<{
503
507
  problemSkeletonIndex: number;
504
508
  groupNameToVarNameToValue: Record<string, Record<string, import("./tree/nodes/algebraicNode.js").AlgebraicNode>>;
505
509
  mysteryVarPath: string;
@@ -2805,6 +2809,11 @@ declare const mathExercises: (Exercise<{
2805
2809
  xValues: number[];
2806
2810
  yValues: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers[];
2807
2811
  atLeastXIndex: number;
2812
+ }, Record<string, string | boolean | string[]>> | Exercise<{
2813
+ items: {
2814
+ value: number;
2815
+ indexColor: number;
2816
+ }[];
2808
2817
  }, Record<string, string | boolean | string[]>> | Exercise<{
2809
2818
  indexSituation: number;
2810
2819
  eventIds: {
@@ -3102,6 +3111,19 @@ declare const mathExercises: (Exercise<{
3102
3111
  nbs: number[];
3103
3112
  radius: number;
3104
3113
  isSphere: boolean;
3114
+ }, Record<string, string | boolean | string[]>> | Exercise<{
3115
+ pointData: {
3116
+ latLon: import("./math/geometry/point.js").PointIdentifiers;
3117
+ "2d": import("./math/geometry/point.js").PointIdentifiers;
3118
+ };
3119
+ isLatitude: boolean;
3120
+ namePointTarget: string;
3121
+ }, Record<string, string | boolean | string[]>> | Exercise<{
3122
+ pointsDict: Record<string, {
3123
+ latLon: import("./math/geometry/point.js").PointIdentifiers;
3124
+ "2d": import("./math/geometry/point.js").PointIdentifiers;
3125
+ }>;
3126
+ namePointTarget: string;
3105
3127
  }, Record<string, string | boolean | string[]>> | Exercise<{
3106
3128
  indexFamily: number;
3107
3129
  indexPattern: number;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,KAAK,aAAa,MAAM,2BAA2B,CAAC;AAE3D,OAAO,4BAA4B,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,QAAA,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kDAA6B,CAAC;AAE/C,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,cAAc,EAAE,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function dichoFilter<T>(arr: T[], funcFilter: (elt: T) => boolean): [T[], T[]];
2
+ //# sourceMappingURL=dichoFilter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dichoFilter.d.ts","sourceRoot":"","sources":["../../../src/utils/arrays/dichoFilter.ts"],"names":[],"mappings":"AAKA,wBAAgB,WAAW,CAAC,CAAC,EAC3B,GAAG,EAAE,CAAC,EAAE,EACR,UAAU,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,OAAO,GAC9B,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAQZ"}
@@ -0,0 +1,11 @@
1
+ /*
2
+ Returns two arrays
3
+ - first is the array with filtered elements
4
+ - second is the array with filtered-out elements
5
+ */
6
+ export function dichoFilter(arr, funcFilter) {
7
+ return arr.reduce((acc, elt) => {
8
+ acc[funcFilter(elt) ? 0 : 1].push(elt);
9
+ return acc;
10
+ }, [[], []]);
11
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "math-exercises",
3
3
  "type": "module",
4
- "version": "3.0.156",
4
+ "version": "3.0.157",
5
5
  "description": "Math exercises generator for middle school and high school",
6
6
  "main": "lib/index.js",
7
7
  "files": [