math-exercises 3.0.99 → 3.0.100

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 +9 -4
  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 +110 -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 +123 -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 +115 -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 +123 -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,105 @@
1
+ import { addValidProp, shuffleProps, } from "../../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { GeogebraConstructor } from "../../../../geogebra/geogebraConstructor.js";
4
+ import { randint } from "../../../../math/utils/random/randint.js";
5
+ import { sqrt } from "../../../../tree/nodes/functions/sqrtNode.js";
6
+ import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
7
+ import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
8
+ import { square } from "../../../../tree/nodes/operators/powerNode.js";
9
+ import { substract } from "../../../../tree/nodes/operators/substractNode.js";
10
+ import { coinFlip } from "../../../../utils/alea/coinFlip.js";
11
+ const getPropositions = (n, { answer }) => {
12
+ const propositions = [];
13
+ addValidProp(propositions, answer);
14
+ while (propositions.length < n) {
15
+ throw Error("QCM not implemented");
16
+ }
17
+ return shuffleProps(propositions, n);
18
+ };
19
+ const getAnswer = (identifiers) => {
20
+ const { isEqui, side, base } = identifiers;
21
+ if (isEqui) {
22
+ return sqrt(multiply(frac(3, 4), square(side)))
23
+ .simplify()
24
+ .toTex();
25
+ }
26
+ else {
27
+ return sqrt(substract(square(side), frac(square(base), 4)))
28
+ .simplify()
29
+ .toTex();
30
+ }
31
+ };
32
+ const getInstruction = (identifiers) => {
33
+ const { isEqui, side, base } = identifiers;
34
+ if (isEqui) {
35
+ return `Le triangle équilatéral ci-dessous a pour côté $${side}$.
36
+
37
+ Calculer sa hauteur $h$.`;
38
+ }
39
+ return `Le triangle isocèle ci-dessous a deux côtés valant $${side}$ et son troisième côté vaut $${base}$.
40
+
41
+ Calculer sa hauteur $h$.`;
42
+ };
43
+ const getHint = (identifiers) => {
44
+ return ``;
45
+ };
46
+ const getCorrection = (identifiers) => {
47
+ return ``;
48
+ };
49
+ const getGGBOptions = (identifiers) => {
50
+ const ggb = new GeogebraConstructor({
51
+ commands: [],
52
+ hideAxes: true,
53
+ hideGrid: true,
54
+ });
55
+ return ggb.getOptions({
56
+ coords: [-1, 1, -1, 1],
57
+ });
58
+ };
59
+ const getKeys = (identifiers) => {
60
+ return [];
61
+ };
62
+ const isAnswerValid = (ans, { answer }) => {
63
+ throw Error("VEA not implemented");
64
+ };
65
+ const getTriangleHeightQuestion = (opts) => {
66
+ const isEqui = coinFlip();
67
+ const side = randint(1, 11);
68
+ const base = isEqui ? undefined : randint(1, 11, [side]);
69
+ const identifiers = {
70
+ isEqui,
71
+ side,
72
+ base,
73
+ };
74
+ return getQuestionFromIdentifiers(identifiers);
75
+ };
76
+ const getQuestionFromIdentifiers = (identifiers) => {
77
+ return {
78
+ answer: getAnswer(identifiers),
79
+ instruction: getInstruction(identifiers),
80
+ keys: getKeys(identifiers),
81
+ answerFormat: "tex",
82
+ identifiers,
83
+ hint: getHint(identifiers),
84
+ correction: getCorrection(identifiers),
85
+ ggbOptions: getGGBOptions(identifiers),
86
+ };
87
+ };
88
+ export const triangleHeight = {
89
+ id: "triangleHeight",
90
+ label: "Calculer la hauteur d'un triangle équilatéral ou isocèle",
91
+ isSingleStep: true,
92
+ generator: (nb, opts) => getDistinctQuestions(() => getTriangleHeightQuestion(opts), nb),
93
+ qcmTimer: 60,
94
+ freeTimer: 60,
95
+ getPropositions,
96
+ isAnswerValid,
97
+ subject: "Mathématiques",
98
+ getHint,
99
+ getCorrection,
100
+ getInstruction,
101
+ getAnswer,
102
+ getGGBOptions,
103
+ hasGeogebra: true,
104
+ getQuestionFromIdentifiers,
105
+ };
@@ -1,3 +1,5 @@
1
1
  export * from "./quadrilateralRecognition.js";
2
2
  export * from "./parallelogramAngles.js";
3
+ export * from "./parallelogramRhombus.js";
4
+ export * from "./parallelogramRectangle.js";
3
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/quadrilaterals/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,0BAA0B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/quadrilaterals/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC"}
@@ -1,2 +1,4 @@
1
1
  export * from "./quadrilateralRecognition.js";
2
2
  export * from "./parallelogramAngles.js";
3
+ export * from "./parallelogramRhombus.js";
4
+ export * from "./parallelogramRectangle.js";
@@ -0,0 +1,11 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ import { NodeIdentifiers } from "../../../../tree/nodes/nodeConstructor.js";
3
+ type Identifiers = {
4
+ BC: NodeIdentifiers;
5
+ BA: NodeIdentifiers;
6
+ AC: NodeIdentifiers;
7
+ isRectangle: boolean;
8
+ };
9
+ export declare const parallelogramRectangle: Exercise<Identifiers>;
10
+ export {};
11
+ //# sourceMappingURL=parallelogramRectangle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parallelogramRectangle.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/quadrilaterals/parallelogramRectangle.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAMrC,OAAO,EACL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;AAc7C,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,eAAe,CAAC;IACpB,EAAE,EAAE,eAAe,CAAC;IACpB,EAAE,EAAE,eAAe,CAAC;IACpB,WAAW,EAAE,OAAO,CAAC;CACtB,CAAC;AA8IF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,CAoBxD,CAAC"}
@@ -0,0 +1,140 @@
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 { randint } from "../../../../math/utils/random/randint.js";
5
+ import { sqrt } from "../../../../tree/nodes/functions/sqrtNode.js";
6
+ import { reifyAlgebraic, } from "../../../../tree/nodes/nodeConstructor.js";
7
+ import { add } from "../../../../tree/nodes/operators/addNode.js";
8
+ import { square } from "../../../../tree/nodes/operators/powerNode.js";
9
+ import { coinFlip } from "../../../../utils/alea/coinFlip.js";
10
+ const getPropositions = (n, { answer }) => {
11
+ const propositions = [];
12
+ addValidProp(propositions, answer, "raw");
13
+ tryToAddWrongProp(propositions, "Non", "raw");
14
+ tryToAddWrongProp(propositions, "Oui", "raw");
15
+ return shuffleProps(propositions, n);
16
+ };
17
+ const getAnswer = (identifiers) => {
18
+ return `${identifiers.isRectangle ? "Oui" : "Non"}`;
19
+ };
20
+ const getInstruction = (identifiers) => {
21
+ const { AC, BA, BC } = identifiers;
22
+ return `$ABCD$ est un parallélogramme, tel que $BC = ${reifyAlgebraic(BC).toTex()}$, $BA = ${reifyAlgebraic(BA).toTex()}$ et $AC = ${reifyAlgebraic(AC).toTex()}$.
23
+
24
+ $ABCD$ est-il un rectangle ?`;
25
+ };
26
+ const getHint = (identifiers) => {
27
+ return `Un parallélogramme est un rectangle si et seulement s'il possède au moins un angle droit.`;
28
+ };
29
+ const getCorrection = (identifiers) => {
30
+ const AC = reifyAlgebraic(identifiers.AC);
31
+ const BA = reifyAlgebraic(identifiers.BA);
32
+ const BC = reifyAlgebraic(identifiers.BC);
33
+ return `Un parallélogramme est un un rectangle si et seulement s'il possède au moins un angle droit. On cherche donc à déterminer si $ABC$ est un triangle rectangle en $B$.
34
+
35
+ Pour cela, on vérifie si le carré de l'hypoténuse ($AC$) est égal à la somme des carrés des deux autres côtés. D'une part, on a :
36
+
37
+ $$
38
+ AC^2 = ${square(AC).toTex()} = ${square(AC).simplify().toTex()}
39
+ $$
40
+
41
+ et d'autre part
42
+
43
+ $$
44
+ BA^2 + BC^2 = ${add(square(BA), square(BC)).toTex()} = ${add(square(BA), square(BC))
45
+ .simplify()
46
+ .toTex()}.
47
+ $$
48
+
49
+ ${identifiers.isRectangle
50
+ ? `Puisque $AC^2 = BA^2 + BC^2$, d'après la réciproque du théorème de Pythagore, le triangle $ABC$ est rectangle en $B$. Le parallélogramme possède donc un angle droit : $ABCD$ est donc un rectangle.`
51
+ : `Puisque $AC^2$ n'est pas égal à $BA^2 + BC^2$, d'après la contraposée du théorème de Pythagore, le triangle $ABC$ n'est pas rectangle en $B$. Le parallélogramme ne possède donc pas $4$ angles droits : $ABCD$ n'est donc pas un rectangle.`}
52
+ `;
53
+ };
54
+ const getGGBOptions = (identifiers) => {
55
+ const AC = reifyAlgebraic(identifiers.AC);
56
+ const BA = reifyAlgebraic(identifiers.BA);
57
+ const BC = reifyAlgebraic(identifiers.BC);
58
+ const commands = [
59
+ "B = (-2, -2)",
60
+ `ShowLabel(B, true)`,
61
+ `SetFixed(B, true)`,
62
+ "A = (-2, 2)",
63
+ `ShowLabel(A, true)`,
64
+ `SetFixed(A, true)`,
65
+ "D = (1, 2)",
66
+ `ShowLabel(D, true)`,
67
+ `SetFixed(D, true)`,
68
+ "C= (1, -2)",
69
+ `ShowLabel(C, true)`,
70
+ `SetFixed(C, true)`,
71
+ "SA = Segment(A, B)",
72
+ "SB = Segment(B, C)",
73
+ "SC = Segment(C, D)",
74
+ "SD = Segment(D, A)",
75
+ "SF = Segment(C, A)",
76
+ "SetLineStyle(SF, 2)",
77
+ `Text("\\tiny \\text{${AC.toTex()}}", (-0.5, 0.6), true, true)`,
78
+ `Text("\\tiny \\text{${BC.toTex()}}", (-0.7, -1.8), true, true)`,
79
+ `Text("\\tiny \\text{${BA.toTex()}}", (-2.5, 0.5), true, true)`,
80
+ ];
81
+ const ggb = new GeogebraConstructor({
82
+ commands,
83
+ hideGrid: true,
84
+ hideAxes: true,
85
+ hideFullScreenButton: true,
86
+ forbidShiftDragZoom: true,
87
+ });
88
+ return ggb.getOptions({
89
+ coords: [-3, 3, -3, 3],
90
+ });
91
+ };
92
+ const isAnswerValid = (ans, { answer }) => {
93
+ return ans === answer;
94
+ };
95
+ const getParallelogramLozengeQuestion = (opts) => {
96
+ const isRectangle = coinFlip();
97
+ const BA = randint(4, 10);
98
+ const BC = randint(1, BA);
99
+ const AC = isRectangle
100
+ ? sqrt(BA ** 2 + BC ** 2)
101
+ : sqrt(BA ** 2 + BC ** 2 + randint(-3, 4, [0]));
102
+ const identifiers = {
103
+ isRectangle,
104
+ BA: BA.toTree().toIdentifiers(),
105
+ BC: BC.toTree().toIdentifiers(),
106
+ AC: AC.toIdentifiers(),
107
+ };
108
+ return getQuestionFromIdentifiers(identifiers);
109
+ };
110
+ const getQuestionFromIdentifiers = (identifiers) => {
111
+ return {
112
+ answer: getAnswer(identifiers),
113
+ instruction: getInstruction(identifiers),
114
+ keys: [],
115
+ answerFormat: "raw",
116
+ identifiers,
117
+ hint: getHint(identifiers),
118
+ correction: getCorrection(identifiers),
119
+ ggbOptions: getGGBOptions(identifiers),
120
+ };
121
+ };
122
+ export const parallelogramRectangle = {
123
+ id: "parallelogramRectangle",
124
+ label: "Déterminer si un parallélogramme est un rectangle en utilisant Pythagore",
125
+ isSingleStep: true,
126
+ generator: (nb, opts) => getDistinctQuestions(() => getParallelogramLozengeQuestion(opts), nb),
127
+ qcmTimer: 60,
128
+ freeTimer: 60,
129
+ getPropositions,
130
+ isAnswerValid,
131
+ subject: "Mathématiques",
132
+ getHint,
133
+ getCorrection,
134
+ getInstruction,
135
+ getAnswer,
136
+ getGGBOptions,
137
+ hasGeogebra: true,
138
+ hasHintAndCorrection: true,
139
+ getQuestionFromIdentifiers,
140
+ };
@@ -0,0 +1,11 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ import { NodeIdentifiers } from "../../../../tree/nodes/nodeConstructor.js";
3
+ type Identifiers = {
4
+ CB: NodeIdentifiers;
5
+ CO: NodeIdentifiers;
6
+ BO: NodeIdentifiers;
7
+ isLosange: boolean;
8
+ };
9
+ export declare const parallelogramRhombus: Exercise<Identifiers>;
10
+ export {};
11
+ //# sourceMappingURL=parallelogramRhombus.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parallelogramRhombus.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/quadrilaterals/parallelogramRhombus.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAMrC,OAAO,EACL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;AAc7C,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,eAAe,CAAC;IACpB,EAAE,EAAE,eAAe,CAAC;IACpB,EAAE,EAAE,eAAe,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;CACpB,CAAC;AAkJF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAoBtD,CAAC"}
@@ -0,0 +1,144 @@
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 { randint } from "../../../../math/utils/random/randint.js";
5
+ import { sqrt } from "../../../../tree/nodes/functions/sqrtNode.js";
6
+ import { reifyAlgebraic, } from "../../../../tree/nodes/nodeConstructor.js";
7
+ import { add } from "../../../../tree/nodes/operators/addNode.js";
8
+ import { square } from "../../../../tree/nodes/operators/powerNode.js";
9
+ import { coinFlip } from "../../../../utils/alea/coinFlip.js";
10
+ const getPropositions = (n, { answer }) => {
11
+ const propositions = [];
12
+ addValidProp(propositions, answer, "raw");
13
+ tryToAddWrongProp(propositions, "Non", "raw");
14
+ tryToAddWrongProp(propositions, "Oui", "raw");
15
+ return shuffleProps(propositions, n);
16
+ };
17
+ const getAnswer = (identifiers) => {
18
+ return `${identifiers.isLosange ? "Oui" : "Non"}`;
19
+ };
20
+ const getInstruction = (identifiers) => {
21
+ const { BO, CB, CO } = identifiers;
22
+ return `$ABCD$ est un parallélogramme de centre $O$, tel que $CO = ${reifyAlgebraic(CO).toTex()}$, $BO = ${reifyAlgebraic(BO).toTex()}$ et $CB = ${reifyAlgebraic(CB).toTex()}$.
23
+
24
+ $ABCD$ est-il un losange ?`;
25
+ };
26
+ const getHint = (identifiers) => {
27
+ return `Un parallélogramme est un losange si et seulement si ses diagonales sont perpendiculaires. Il faut donc déterminer si $COB$ est un triangle rectangle.`;
28
+ };
29
+ const getCorrection = (identifiers) => {
30
+ const CO = reifyAlgebraic(identifiers.CO);
31
+ const BO = reifyAlgebraic(identifiers.BO);
32
+ const CB = reifyAlgebraic(identifiers.CB);
33
+ return `Un parallélogramme est un losange si et seulement si ses diagonales sont perpendiculaires. On cherche donc à déterminer si $COB$ est un triangle rectangle.
34
+
35
+ Pour cela, on vérifie si le carré de l'hypoténuse ($CB$) est égal à la somme des carrés des deux autres côtés. D'une part, on a :
36
+
37
+ $$
38
+ CB^2 = ${square(CB).toTex()} = ${square(CB).simplify().toTex()}
39
+ $$
40
+
41
+ et d'autre part
42
+
43
+ $$
44
+ CO^2 + BO^2 = ${add(square(CO), square(BO)).toTex()} = ${add(square(CO), square(BO))
45
+ .simplify()
46
+ .toTex()}.
47
+ $$
48
+
49
+ ${identifiers.isLosange
50
+ ? `Puisque $CB^2 = CO^2 + BO^2$, d'après la réciproque du théorème de Pythagore, le triangle $COB$ est rectangle en $O$. Les diagonales du parallalélogramme sont donc perpendiculaires : $ABCD$ est donc un losange.`
51
+ : `Puisque $CB^2$ n'est pas égal à $CO^2 + BO^2$, d'après la contraposée du théorème de Pythagore, le triangle $COB$ n'est rectangle en $O$. Les diagonales du parallalélogramme ne sont donc pas perpendiculaires : $ABCD$ n'est donc pas un losange.`}
52
+ `;
53
+ };
54
+ const getGGBOptions = (identifiers) => {
55
+ const CO = reifyAlgebraic(identifiers.CO);
56
+ const BO = reifyAlgebraic(identifiers.BO);
57
+ const CB = reifyAlgebraic(identifiers.CB);
58
+ const commands = [
59
+ "C = (-6, -6)",
60
+ `ShowLabel(C, true)`,
61
+ `SetFixed(C, true)`,
62
+ "D = (-3, 3)",
63
+ `ShowLabel(D, true)`,
64
+ `SetFixed(D, true)`,
65
+ "A = (6, 6)",
66
+ `ShowLabel(A, true)`,
67
+ `SetFixed(A, true)`,
68
+ "B = (3, -3)",
69
+ `ShowLabel(B, true)`,
70
+ `SetFixed(B, true)`,
71
+ "SA = Segment(A, B)",
72
+ "SB = Segment(B, C)",
73
+ "SC = Segment(C, D)",
74
+ "SD = Segment(D, A)",
75
+ "SE = Segment(B, D)",
76
+ "SF = Segment(C, A)",
77
+ "O = Intersect(SE, SF)",
78
+ `ShowLabel(O, true)`,
79
+ "SetLineStyle(SE, 2)",
80
+ "SetLineStyle(SF, 2)",
81
+ `Text("\\tiny \\text{${BO.toTex()}}", (1, 0.6), true, true)`,
82
+ `Text("\\tiny \\text{${CO.toTex()}}", (-4.5, -1), true, true)`,
83
+ `Text("\\tiny \\text{${CB.toTex()}}", (-2.33, -4.33), true, true)`,
84
+ ];
85
+ const ggb = new GeogebraConstructor({
86
+ commands,
87
+ hideGrid: true,
88
+ hideAxes: true,
89
+ hideFullScreenButton: true,
90
+ forbidShiftDragZoom: true,
91
+ });
92
+ return ggb.getOptions({
93
+ coords: [-8, 8, -8, 8],
94
+ });
95
+ };
96
+ const isAnswerValid = (ans, { answer }) => {
97
+ return ans === answer;
98
+ };
99
+ const getParallelogramLozengeQuestion = (opts) => {
100
+ const isLosange = coinFlip();
101
+ const CO = randint(4, 10);
102
+ const BO = randint(1, CO);
103
+ const CB = isLosange
104
+ ? sqrt(CO ** 2 + BO ** 2)
105
+ : sqrt(CO ** 2 + BO ** 2 + randint(-3, 4, [0]));
106
+ const identifiers = {
107
+ isLosange,
108
+ CO: CO.toTree().toIdentifiers(),
109
+ BO: BO.toTree().toIdentifiers(),
110
+ CB: CB.toIdentifiers(),
111
+ };
112
+ return getQuestionFromIdentifiers(identifiers);
113
+ };
114
+ const getQuestionFromIdentifiers = (identifiers) => {
115
+ return {
116
+ answer: getAnswer(identifiers),
117
+ instruction: getInstruction(identifiers),
118
+ keys: [],
119
+ answerFormat: "raw",
120
+ identifiers,
121
+ hint: getHint(identifiers),
122
+ correction: getCorrection(identifiers),
123
+ ggbOptions: getGGBOptions(identifiers),
124
+ };
125
+ };
126
+ export const parallelogramRhombus = {
127
+ id: "parallelogramRhombus",
128
+ label: "Déterminer si un parallélogramme est un losange en utilisant Pythagore",
129
+ isSingleStep: true,
130
+ generator: (nb, opts) => getDistinctQuestions(() => getParallelogramLozengeQuestion(opts), nb),
131
+ qcmTimer: 60,
132
+ freeTimer: 60,
133
+ getPropositions,
134
+ isAnswerValid,
135
+ subject: "Mathématiques",
136
+ getHint,
137
+ getCorrection,
138
+ getInstruction,
139
+ getAnswer,
140
+ getGGBOptions,
141
+ hasGeogebra: true,
142
+ hasHintAndCorrection: true,
143
+ getQuestionFromIdentifiers,
144
+ };
@@ -0,0 +1,9 @@
1
+ import { Exercise } from "../../../../../exercises/exercise.js";
2
+ import { PointIdentifiers } from "../../../../../math/geometry/point.js";
3
+ type Identifiers = {
4
+ firstVec: PointIdentifiers[];
5
+ secondVec: PointIdentifiers[];
6
+ };
7
+ export declare const colinearityFromPicture: Exercise<Identifiers>;
8
+ export {};
9
+ //# sourceMappingURL=colinearityFromPicture.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"colinearityFromPicture.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/geometry/vectors/colinearity/colinearityFromPicture.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAGL,gBAAgB,EACjB,MAAM,8BAA8B,CAAC;AAQtC,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,gBAAgB,EAAE,CAAC;IAC7B,SAAS,EAAE,gBAAgB,EAAE,CAAC;CAC/B,CAAC;AA2NF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,CAkBxD,CAAC"}
@@ -0,0 +1,201 @@
1
+ import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { Point, PointConstructor, } from "../../../../../math/geometry/point.js";
4
+ import { VectorConstructor } from "../../../../../math/geometry/vector.js";
5
+ import { randint } from "../../../../../math/utils/random/randint.js";
6
+ import { coinFlip } from "../../../../../utils/alea/coinFlip.js";
7
+ import { random } from "../../../../../utils/alea/random.js";
8
+ import { handleVEAError } from "../../../../../utils/errors/handleVEAError.js";
9
+ const getPropositions = (n, { answer }) => {
10
+ const propositions = [];
11
+ addValidProp(propositions, answer, "raw");
12
+ tryToAddWrongProp(propositions, "Oui", "raw");
13
+ tryToAddWrongProp(propositions, "Non", "raw");
14
+ return shuffleProps(propositions, n);
15
+ };
16
+ const getAnswer = (identifiers) => {
17
+ const firstPoints = identifiers.firstVec.map((ids) => PointConstructor.fromIdentifiers(ids));
18
+ const secondPoints = identifiers.secondVec.map((ids) => PointConstructor.fromIdentifiers(ids));
19
+ const firstVec = VectorConstructor.fromPoints(firstPoints[0], firstPoints[1]);
20
+ const secondVec = VectorConstructor.fromPoints(secondPoints[0], secondPoints[1]);
21
+ return firstVec.isColinear(secondVec) ? "Oui" : "Non";
22
+ };
23
+ const getInstruction = (identifiers) => {
24
+ const firstPoints = identifiers.firstVec.map((ids) => PointConstructor.fromIdentifiers(ids));
25
+ const secondPoints = identifiers.secondVec.map((ids) => PointConstructor.fromIdentifiers(ids));
26
+ const firstVec = VectorConstructor.fromPoints(firstPoints[0], firstPoints[1]);
27
+ const secondVec = VectorConstructor.fromPoints(secondPoints[0], secondPoints[1]);
28
+ return `On considère la figure suivante :
29
+
30
+ ![](https://heureuxhasarddocsbucket.s3.eu-west-3.amazonaws.com/mathliveV2/activities/quizzes/generator/pointsOnParallelogram.png)
31
+
32
+ Les vecteurs $${firstVec.toTex()}$ et $${secondVec.toTex()}$ sont-ils colinéaires ?
33
+ `;
34
+ };
35
+ const getHint = (identifiers) => {
36
+ return `Deux vecteurs sont colinéaires si les droites qui les portent sont parallèles.`;
37
+ };
38
+ const getCorrection = (identifiers) => {
39
+ const firstPoints = identifiers.firstVec.map((ids) => PointConstructor.fromIdentifiers(ids));
40
+ const secondPoints = identifiers.secondVec.map((ids) => PointConstructor.fromIdentifiers(ids));
41
+ const firstVec = VectorConstructor.fromPoints(firstPoints[0], firstPoints[1]);
42
+ const secondVec = VectorConstructor.fromPoints(secondPoints[0], secondPoints[1]);
43
+ const isColinear = firstVec.isColinear(secondVec);
44
+ if (isColinear) {
45
+ // if(memedroite){}//
46
+ if (firstPoints[0].isAligned(secondPoints[0], secondPoints[1]) &&
47
+ firstPoints[1].isAligned(secondPoints[0], secondPoints[1])) {
48
+ return `Puisque les vecteurs $${firstVec.toTex()}$ et $${secondVec.toTex()}$ appartiennent à la même droite, ils sont colinéaires.`;
49
+ }
50
+ return `Puisque les droites $(${firstVec.name})$ et $(${secondVec.name})$ sont parallèles, les vecteurs $${firstVec.toTex()}$ et $${secondVec.toTex()}$ sont colinéaires.`;
51
+ }
52
+ return `Puisque les droites $(${firstVec.name})$ et $(${secondVec.name})$ ne sont pas parallèles, les vecteurs $${firstVec.toTex()}$ et $${secondVec.toTex()}$ ne sont pas colinéaires.`;
53
+ };
54
+ const isAnswerValid = (ans, { answer }) => {
55
+ try {
56
+ throw Error("VEA not implemented");
57
+ }
58
+ catch (err) {
59
+ return handleVEAError(err);
60
+ }
61
+ };
62
+ const getColinearityFromPictureQuestion = (ops) => {
63
+ const points = [];
64
+ let letterIndex = 65; //"A"
65
+ for (let j = 0; j < 4; j++) {
66
+ for (let i = 0; i < 3; i++) {
67
+ points.push(new Point(String.fromCharCode(letterIndex), i, j));
68
+ letterIndex++;
69
+ }
70
+ }
71
+ //!mama mia
72
+ //pardon au moi du futur
73
+ //en gros l'idée est qu'on construit deux paires de coordonnées de vecteurs colinéaires (ou non colinéaires) puis on boucle à l'infini sur les points pour trouver des points correspondants aux coordonnées des vecteurs choisis
74
+ let firstVecCoords, secondVecCoords;
75
+ const isColinear = coinFlip();
76
+ if (isColinear) {
77
+ const choices = [
78
+ [
79
+ [1, 0],
80
+ [2, 0],
81
+ ],
82
+ [
83
+ [0, 1],
84
+ [0, 2],
85
+ [0, 3],
86
+ ],
87
+ [
88
+ [1, 1],
89
+ [2, 2],
90
+ ],
91
+ [[2, 1]],
92
+ [[1, 2]],
93
+ [[1, 3]],
94
+ ];
95
+ let choice = random(choices);
96
+ let firstVecIndex = randint(0, choice.length);
97
+ firstVecCoords = choice[firstVecIndex];
98
+ if (choice.length === 1) {
99
+ firstVecCoords = choice[0];
100
+ secondVecCoords = choice[0];
101
+ const reverseFirst = coinFlip();
102
+ reverseFirst
103
+ ? (firstVecCoords = firstVecCoords.map((e) => -e))
104
+ : (secondVecCoords = secondVecCoords.map((e) => -e));
105
+ }
106
+ else {
107
+ let secondVecIndex = randint(0, choice.length);
108
+ secondVecCoords = choice[secondVecIndex];
109
+ const mustReverseOne = secondVecIndex === firstVecIndex;
110
+ const willReverse = mustReverseOne || coinFlip();
111
+ if (willReverse) {
112
+ const reverseFirst = coinFlip();
113
+ reverseFirst
114
+ ? (firstVecCoords = firstVecCoords.map((e) => -e))
115
+ : (secondVecCoords = secondVecCoords.map((e) => -e));
116
+ }
117
+ }
118
+ }
119
+ else {
120
+ //choix précédents + (2,3)
121
+ const choices = [
122
+ [
123
+ [1, 0],
124
+ [2, 0],
125
+ ],
126
+ [
127
+ [0, 1],
128
+ [0, 2],
129
+ [0, 3],
130
+ ],
131
+ [
132
+ [1, 1],
133
+ [2, 2],
134
+ ],
135
+ [[2, 1]],
136
+ [[1, 2]],
137
+ [[1, 3]],
138
+ [[2, 3]],
139
+ ];
140
+ const firstChoiceIndex = randint(0, choices.length);
141
+ const secondChoiceIndex = randint(0, choices.length, [firstChoiceIndex]);
142
+ firstVecCoords = random(choices[firstChoiceIndex]);
143
+ secondVecCoords = random(choices[secondChoiceIndex]);
144
+ const reverseFirst = coinFlip();
145
+ reverseFirst
146
+ ? (firstVecCoords = firstVecCoords.map((e) => -e))
147
+ : (secondVecCoords = secondVecCoords.map((e) => -e));
148
+ }
149
+ let firstVec, secondVec;
150
+ while (true) {
151
+ const A = random(points);
152
+ const B = random(points);
153
+ if (B.x.evaluate() - A.x.evaluate() === firstVecCoords[0] &&
154
+ B.y.evaluate() - A.y.evaluate() === firstVecCoords[1]) {
155
+ firstVec = [A.toIdentifiers(), B.toIdentifiers()];
156
+ break;
157
+ }
158
+ }
159
+ while (true) {
160
+ const C = random(points);
161
+ const D = random(points);
162
+ if (D.x.evaluate() - C.x.evaluate() === secondVecCoords[0] &&
163
+ D.y.evaluate() - C.y.evaluate() === secondVecCoords[1]) {
164
+ secondVec = [C.toIdentifiers(), D.toIdentifiers()];
165
+ break;
166
+ }
167
+ }
168
+ const identifiers = {
169
+ firstVec,
170
+ secondVec,
171
+ };
172
+ return getQuestionFromIdentifiers(identifiers);
173
+ };
174
+ const getQuestionFromIdentifiers = (identifiers) => {
175
+ return {
176
+ answer: getAnswer(identifiers),
177
+ instruction: getInstruction(identifiers),
178
+ answerFormat: "raw",
179
+ identifiers,
180
+ hint: getHint(identifiers),
181
+ correction: getCorrection(identifiers),
182
+ };
183
+ };
184
+ export const colinearityFromPicture = {
185
+ id: "colinearityFromPicture",
186
+ label: "Reconnaître des vecteurs colinéaires (à partir d'une figure)",
187
+ isSingleStep: true,
188
+ generator: (nb, opts) => getDistinctQuestions(() => getColinearityFromPictureQuestion(opts), nb),
189
+ qcmTimer: 60,
190
+ freeTimer: 60,
191
+ getPropositions,
192
+ isAnswerValid,
193
+ subject: "Mathématiques",
194
+ getInstruction,
195
+ getHint,
196
+ getCorrection,
197
+ getAnswer,
198
+ getQuestionFromIdentifiers,
199
+ hasHintAndCorrection: true,
200
+ answerType: "QCU",
201
+ };
@@ -0,0 +1,8 @@
1
+ import { Exercise } from "../../../../../exercises/exercise.js";
2
+ type Identifiers = {
3
+ uCoords: string[];
4
+ vCoords: string[];
5
+ };
6
+ export declare const determinant: Exercise<Identifiers>;
7
+ export {};
8
+ //# sourceMappingURL=determinant.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"determinant.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/geometry/vectors/colinearity/determinant.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAQrC,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AA6GF,eAAO,MAAM,WAAW,EAAE,QAAQ,CAAC,WAAW,CAa7C,CAAC"}