math-exercises 3.0.150 → 3.0.151

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 (139) hide show
  1. package/lib/exercises/math/calcul/arithmetics/primeNumbersAffirmations.js +1 -1
  2. package/lib/exercises/math/calculLitteral/equation/equa1.d.ts +4 -1
  3. package/lib/exercises/math/calculLitteral/equation/equa1.d.ts.map +1 -1
  4. package/lib/exercises/math/calculLitteral/equation/equa1.js +27 -7
  5. package/lib/exercises/math/calculLitteral/equation/equa2.d.ts +1 -0
  6. package/lib/exercises/math/calculLitteral/equation/equa2.d.ts.map +1 -1
  7. package/lib/exercises/math/calculLitteral/equation/equa2.js +18 -1
  8. package/lib/exercises/math/calculLitteral/equation/equa3.d.ts +4 -1
  9. package/lib/exercises/math/calculLitteral/equation/equa3.d.ts.map +1 -1
  10. package/lib/exercises/math/calculLitteral/equation/equa3.js +26 -6
  11. package/lib/exercises/math/calculLitteral/equation/equa4.d.ts +4 -1
  12. package/lib/exercises/math/calculLitteral/equation/equa4.d.ts.map +1 -1
  13. package/lib/exercises/math/calculLitteral/equation/equa4.js +27 -7
  14. package/lib/exercises/math/calculLitteral/equation/firstDegree/equa1.d.ts +14 -0
  15. package/lib/exercises/math/calculLitteral/equation/firstDegree/equa1.d.ts.map +1 -0
  16. package/lib/exercises/math/calculLitteral/equation/firstDegree/equa1.js +129 -0
  17. package/lib/exercises/math/calculLitteral/equation/firstDegree/equa2.d.ts +18 -0
  18. package/lib/exercises/math/calculLitteral/equation/firstDegree/equa2.d.ts.map +1 -0
  19. package/lib/exercises/math/calculLitteral/equation/firstDegree/equa2.js +167 -0
  20. package/lib/exercises/math/calculLitteral/equation/firstDegree/equa3.d.ts +15 -0
  21. package/lib/exercises/math/calculLitteral/equation/firstDegree/equa3.d.ts.map +1 -0
  22. package/lib/exercises/math/calculLitteral/equation/firstDegree/equa3.js +129 -0
  23. package/lib/exercises/math/calculLitteral/equation/firstDegree/equa4.d.ts +16 -0
  24. package/lib/exercises/math/calculLitteral/equation/firstDegree/equa4.d.ts.map +1 -0
  25. package/lib/exercises/math/calculLitteral/equation/firstDegree/equa4.js +124 -0
  26. package/lib/exercises/math/calculLitteral/equation/firstDegree/firstDegreeEquationIntType1.d.ts +9 -0
  27. package/lib/exercises/math/calculLitteral/equation/firstDegree/firstDegreeEquationIntType1.d.ts.map +1 -0
  28. package/lib/exercises/math/calculLitteral/equation/firstDegree/firstDegreeEquationIntType1.js +107 -0
  29. package/lib/exercises/math/calculLitteral/equation/firstDegree/firstDegreeEquationIntType2.d.ts +10 -0
  30. package/lib/exercises/math/calculLitteral/equation/firstDegree/firstDegreeEquationIntType2.d.ts.map +1 -0
  31. package/lib/exercises/math/calculLitteral/equation/firstDegree/firstDegreeEquationIntType2.js +108 -0
  32. package/lib/exercises/math/calculLitteral/equation/firstDegree/firstDegreeEquationIntType3.d.ts +11 -0
  33. package/lib/exercises/math/calculLitteral/equation/firstDegree/firstDegreeEquationIntType3.d.ts.map +1 -0
  34. package/lib/exercises/math/calculLitteral/equation/firstDegree/firstDegreeEquationIntType3.js +104 -0
  35. package/lib/exercises/math/calculLitteral/equation/firstDegree/index.d.ts +8 -0
  36. package/lib/exercises/math/calculLitteral/equation/firstDegree/index.d.ts.map +1 -0
  37. package/lib/exercises/math/calculLitteral/equation/firstDegree/index.js +7 -0
  38. package/lib/exercises/math/calculLitteral/equation/index.d.ts +1 -7
  39. package/lib/exercises/math/calculLitteral/equation/index.d.ts.map +1 -1
  40. package/lib/exercises/math/calculLitteral/equation/index.js +1 -7
  41. package/lib/exercises/math/dataRepresentations/histogram/etendueHistogram.d.ts +8 -0
  42. package/lib/exercises/math/dataRepresentations/histogram/etendueHistogram.d.ts.map +1 -0
  43. package/lib/exercises/math/dataRepresentations/histogram/etendueHistogram.js +175 -0
  44. package/lib/exercises/math/dataRepresentations/histogram/histogramCommenting.d.ts +9 -0
  45. package/lib/exercises/math/dataRepresentations/histogram/histogramCommenting.d.ts.map +1 -0
  46. package/lib/exercises/math/dataRepresentations/histogram/histogramCommenting.js +250 -0
  47. package/lib/exercises/math/dataRepresentations/histogram/histogramFillDataTableFromHistogramData.d.ts +9 -0
  48. package/lib/exercises/math/dataRepresentations/histogram/histogramFillDataTableFromHistogramData.d.ts.map +1 -0
  49. package/lib/exercises/math/dataRepresentations/histogram/histogramFillDataTableFromHistogramData.js +173 -0
  50. package/lib/exercises/math/dataRepresentations/histogram/histogramIsSameData.d.ts +14 -0
  51. package/lib/exercises/math/dataRepresentations/histogram/histogramIsSameData.d.ts.map +1 -0
  52. package/lib/exercises/math/dataRepresentations/histogram/histogramIsSameData.js +232 -0
  53. package/lib/exercises/math/dataRepresentations/histogram/histogramReading.d.ts +9 -0
  54. package/lib/exercises/math/dataRepresentations/histogram/histogramReading.d.ts.map +1 -0
  55. package/lib/exercises/math/dataRepresentations/histogram/histogramReading.js +163 -0
  56. package/lib/exercises/math/dataRepresentations/histogram/index.d.ts +6 -0
  57. package/lib/exercises/math/dataRepresentations/histogram/index.d.ts.map +1 -0
  58. package/lib/exercises/math/dataRepresentations/histogram/index.js +5 -0
  59. package/lib/exercises/math/dataRepresentations/index.d.ts +1 -1
  60. package/lib/exercises/math/dataRepresentations/index.d.ts.map +1 -1
  61. package/lib/exercises/math/dataRepresentations/index.js +1 -1
  62. package/lib/exercises/math/functions/affines/leadingCoeffAndOriginOrdinate.d.ts +4 -1
  63. package/lib/exercises/math/functions/affines/leadingCoeffAndOriginOrdinate.d.ts.map +1 -1
  64. package/lib/exercises/math/functions/affines/leadingCoeffAndOriginOrdinate.js +19 -4
  65. package/lib/exercises/math/functions/affines/leadingCoefficient.d.ts +1 -0
  66. package/lib/exercises/math/functions/affines/leadingCoefficient.d.ts.map +1 -1
  67. package/lib/exercises/math/functions/affines/leadingCoefficient.js +13 -1
  68. package/lib/exercises/math/functions/affines/recognizeAffineGraph.d.ts +4 -1
  69. package/lib/exercises/math/functions/affines/recognizeAffineGraph.d.ts.map +1 -1
  70. package/lib/exercises/math/functions/affines/recognizeAffineGraph.js +19 -4
  71. package/lib/exercises/math/geometry/euclidian/pythagoreOrThales.d.ts +4 -1
  72. package/lib/exercises/math/geometry/euclidian/pythagoreOrThales.d.ts.map +1 -1
  73. package/lib/exercises/math/geometry/euclidian/pythagoreOrThales.js +18 -3
  74. package/lib/exercises/math/geometry/triangles/index.d.ts +1 -0
  75. package/lib/exercises/math/geometry/triangles/index.d.ts.map +1 -1
  76. package/lib/exercises/math/geometry/triangles/index.js +1 -0
  77. package/lib/exercises/math/geometry/triangles/similar/index.d.ts +4 -0
  78. package/lib/exercises/math/geometry/triangles/similar/index.d.ts.map +1 -0
  79. package/lib/exercises/math/geometry/triangles/similar/index.js +3 -0
  80. package/lib/exercises/math/geometry/triangles/similar/isSimilarTrianglesWithAngles.d.ts +10 -0
  81. package/lib/exercises/math/geometry/triangles/similar/isSimilarTrianglesWithAngles.d.ts.map +1 -0
  82. package/lib/exercises/math/geometry/triangles/similar/isSimilarTrianglesWithAngles.js +122 -0
  83. package/lib/exercises/math/geometry/triangles/similar/isSimilarTrianglesWrtSideLengths.d.ts +15 -0
  84. package/lib/exercises/math/geometry/triangles/similar/isSimilarTrianglesWrtSideLengths.d.ts.map +1 -0
  85. package/lib/exercises/math/geometry/triangles/similar/isSimilarTrianglesWrtSideLengths.js +351 -0
  86. package/lib/exercises/math/geometry/triangles/similar/placeSegmentsOfSimilarTriangle.d.ts +11 -0
  87. package/lib/exercises/math/geometry/triangles/similar/placeSegmentsOfSimilarTriangle.d.ts.map +1 -0
  88. package/lib/exercises/math/geometry/triangles/similar/placeSegmentsOfSimilarTriangle.js +311 -0
  89. package/lib/exercises/math/probaStat/basicProbas/calculateProbaFromProbaLaw.d.ts +10 -0
  90. package/lib/exercises/math/probaStat/basicProbas/calculateProbaFromProbaLaw.d.ts.map +1 -0
  91. package/lib/exercises/math/probaStat/basicProbas/calculateProbaFromProbaLaw.js +128 -0
  92. package/lib/exercises/math/probaStat/basicProbas/findEffectifFromProba.d.ts +9 -0
  93. package/lib/exercises/math/probaStat/basicProbas/findEffectifFromProba.d.ts.map +1 -0
  94. package/lib/exercises/math/probaStat/basicProbas/findEffectifFromProba.js +109 -0
  95. package/lib/exercises/math/probaStat/basicProbas/index.d.ts +2 -0
  96. package/lib/exercises/math/probaStat/basicProbas/index.d.ts.map +1 -1
  97. package/lib/exercises/math/probaStat/basicProbas/index.js +2 -0
  98. package/lib/exercises/math/spaceGeometry/index.d.ts +1 -0
  99. package/lib/exercises/math/spaceGeometry/index.d.ts.map +1 -1
  100. package/lib/exercises/math/spaceGeometry/index.js +1 -0
  101. package/lib/exercises/math/spaceGeometry/sections/areaOfConeSection.d.ts +14 -0
  102. package/lib/exercises/math/spaceGeometry/sections/areaOfConeSection.d.ts.map +1 -0
  103. package/lib/exercises/math/spaceGeometry/sections/areaOfConeSection.js +439 -0
  104. package/lib/exercises/math/spaceGeometry/sections/areaOfCylinderSection.d.ts +14 -0
  105. package/lib/exercises/math/spaceGeometry/sections/areaOfCylinderSection.d.ts.map +1 -0
  106. package/lib/exercises/math/spaceGeometry/sections/areaOfCylinderSection.js +548 -0
  107. package/lib/exercises/math/spaceGeometry/sections/areaOfRectangularPrismSection.d.ts +11 -0
  108. package/lib/exercises/math/spaceGeometry/sections/areaOfRectangularPrismSection.d.ts.map +1 -0
  109. package/lib/exercises/math/spaceGeometry/sections/areaOfRectangularPrismSection.js +360 -0
  110. package/lib/exercises/math/spaceGeometry/sections/areaOfSphereSection.d.ts +9 -0
  111. package/lib/exercises/math/spaceGeometry/sections/areaOfSphereSection.d.ts.map +1 -0
  112. package/lib/exercises/math/spaceGeometry/sections/areaOfSphereSection.js +272 -0
  113. package/lib/exercises/math/spaceGeometry/sections/index.d.ts +9 -0
  114. package/lib/exercises/math/spaceGeometry/sections/index.d.ts.map +1 -0
  115. package/lib/exercises/math/spaceGeometry/sections/index.js +8 -0
  116. package/lib/exercises/math/spaceGeometry/sections/recognizeSectionsOfCone.d.ts +11 -0
  117. package/lib/exercises/math/spaceGeometry/sections/recognizeSectionsOfCone.d.ts.map +1 -0
  118. package/lib/exercises/math/spaceGeometry/sections/recognizeSectionsOfCone.js +266 -0
  119. package/lib/exercises/math/spaceGeometry/sections/recognizeSectionsOfCylinder.d.ts +11 -0
  120. package/lib/exercises/math/spaceGeometry/sections/recognizeSectionsOfCylinder.d.ts.map +1 -0
  121. package/lib/exercises/math/spaceGeometry/sections/recognizeSectionsOfCylinder.js +236 -0
  122. package/lib/exercises/math/spaceGeometry/sections/recognizeSectionsOfRectangularPrism.d.ts +7 -0
  123. package/lib/exercises/math/spaceGeometry/sections/recognizeSectionsOfRectangularPrism.d.ts.map +1 -0
  124. package/lib/exercises/math/spaceGeometry/sections/recognizeSectionsOfRectangularPrism.js +92 -0
  125. package/lib/exercises/math/spaceGeometry/sections/recognizeSectionsOfSphereOrBall.d.ts +9 -0
  126. package/lib/exercises/math/spaceGeometry/sections/recognizeSectionsOfSphereOrBall.d.ts.map +1 -0
  127. package/lib/exercises/math/spaceGeometry/sections/recognizeSectionsOfSphereOrBall.js +236 -0
  128. package/lib/exercises/pc/mathExosInPC.d.ts +4 -4
  129. package/lib/exercises/pc/mathExosInPC.d.ts.map +1 -1
  130. package/lib/exercises/pc/mathExosInPC.js +4 -4
  131. package/lib/index.d.ts +153 -44
  132. package/lib/index.d.ts.map +1 -1
  133. package/lib/math/geometry/spacePoint.d.ts +10 -0
  134. package/lib/math/geometry/spacePoint.d.ts.map +1 -1
  135. package/lib/math/geometry/spacePoint.js +13 -0
  136. package/lib/tree/nodes/operators/substractNode.d.ts +1 -0
  137. package/lib/tree/nodes/operators/substractNode.d.ts.map +1 -1
  138. package/lib/tree/nodes/operators/substractNode.js +6 -0
  139. package/package.json +1 -1
@@ -0,0 +1,439 @@
1
+ import { shuffleProps, addValidProp, tryToAddWrongProp, GeneratorOptionType, GeneratorOptionTarget, propWhile, } from "../../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { blueLight, red } from "../../../../geogebra/colors.js";
4
+ import { GeogebraConstructor } from "../../../../geogebra/geogebraConstructor.js";
5
+ import { randint } from "../../../../math/utils/random/randint.js";
6
+ import { round } from "../../../../math/utils/round.js";
7
+ import { sqrt } from "../../../../tree/nodes/functions/sqrtNode.js";
8
+ import { PiNode } from "../../../../tree/nodes/numbers/piNode.js";
9
+ import { add } from "../../../../tree/nodes/operators/addNode.js";
10
+ import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
11
+ import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
12
+ import { power } from "../../../../tree/nodes/operators/powerNode.js";
13
+ import { substract } from "../../../../tree/nodes/operators/substractNode.js";
14
+ import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
15
+ import { probaFlip } from "../../../../utils/alea/probaFlip.js";
16
+ import { random } from "../../../../utils/alea/random.js";
17
+ import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
18
+ const cylinderSectionGGBCommands = (radius, height, offset, isShowSectionPlane, planeType) => {
19
+ return [
20
+ //hide xOyPlane
21
+ `SetFilling(xOyPlane, 0)`,
22
+ //cone
23
+ `Con = Cone((0,0,0), (0,0,${height}), ${radius})`,
24
+ `SetColor(Con, "#d3dde6ff")`,
25
+ `SetFilling(Con, 0.36)`,
26
+ `SetLineThickness(Con, 1)`,
27
+ //plane
28
+ ...(isShowSectionPlane
29
+ ? (() => {
30
+ switch (planeType) {
31
+ case "contenant l'axe de révolution":
32
+ {
33
+ return [
34
+ `Pl = Plane((0,0,0), (0,1,0), (0,1,1))`,
35
+ `SetColor(Pl, "${blueLight}")`,
36
+ `SetFilling(Pl, 0.23)`,
37
+ ];
38
+ }
39
+ break;
40
+ case "perpendiculaire à l'axe de révolution":
41
+ {
42
+ return [
43
+ `Pl = Plane((${1}, 0, ${offset}), (0, ${1}, ${offset}), (${-1}, 0, ${offset}))`,
44
+ `SetColor(Pl, "${blueLight}")`,
45
+ `SetFilling(Pl, 0.23)`,
46
+ ];
47
+ }
48
+ break;
49
+ default:
50
+ throw new Error("unsupported planeType: " + planeType);
51
+ }
52
+ })()
53
+ : []),
54
+ //section
55
+ ...(() => {
56
+ switch (planeType) {
57
+ case "contenant l'axe de révolution":
58
+ {
59
+ return [
60
+ `s = Polygon((0, ${-radius}, 0), (0, ${radius}, 0), (0, 0, ${height}))`,
61
+ `SetColor(s, "${red}")`,
62
+ // `SetFilling(s, 0.36)`,
63
+ `SetLineThickness(s, 3)`,
64
+ ];
65
+ }
66
+ break;
67
+ case "perpendiculaire à l'axe de révolution":
68
+ {
69
+ const nodeHalfWidth = multiply(radius, substract(1, frac(offset, height)));
70
+ const width = nodeHalfWidth.evaluate();
71
+ return [
72
+ `s = Circle((${width}, 0, ${offset}), (0, ${width}, ${offset}), (${-width}, 0, ${offset}))`,
73
+ `SetColor(s, "${red}")`,
74
+ // `SetFilling(s, 0.36)`,
75
+ `SetLineThickness(s, 3)`,
76
+ ];
77
+ }
78
+ break;
79
+ default:
80
+ throw new Error("unsupported planeType: " + planeType);
81
+ }
82
+ })(),
83
+ //points
84
+ `O = Point({0,0,0})`,
85
+ `ShowLabel(O,true)`,
86
+ `I = Point({0,0,${offset}})`,
87
+ `ShowLabel(I,true)`,
88
+ `H = Point({0,0,${height}})`,
89
+ `ShowLabel(H,true)`,
90
+ //center view
91
+ `CenterView(Point({0,0,0}))`,
92
+ ];
93
+ };
94
+ const getInstruction = (identifiers) => {
95
+ const { radius, height, isDiameterGiven, offset, planeType } = identifiers;
96
+ return `Soit $\\mathcal{K}$ un cône ayant pour base le cercle $\\mathcal{C}$ de centre $O$ et de ${isDiameterGiven ? "diamètre" : "rayon"} $${isDiameterGiven ? 2 * radius : radius} \\ \\textrm{cm}$ et pour hauteur $${height.frenchify()} \\ \\textrm{cm}$.
97
+
98
+ ${(() => {
99
+ switch (planeType) {
100
+ case "contenant l'axe de révolution":
101
+ {
102
+ return `Un plan contenant l'axe de révolution coupe $\\mathcal{K}$ en une section telle que $OI = ${offset.frenchify()}\\ \\textrm{cm}$.`;
103
+ }
104
+ break;
105
+ case "perpendiculaire à l'axe de révolution":
106
+ {
107
+ return `Un plan perpendiculaire à l'axe de révolution coupe $\\mathcal{K}$ en une section telle que $OI = ${offset.frenchify()}\\ \\textrm{cm}$.`;
108
+ }
109
+ break;
110
+ default:
111
+ throw new Error("unsupported planeType: " + planeType);
112
+ }
113
+ })()}
114
+
115
+ Quelle est l'aire de la section plane en $\\textrm{cm}^2$ ?
116
+ On donnera le résultat sous forme arrondie à deux décimales.`;
117
+ };
118
+ const getAnswerNode = (identifiers) => {
119
+ const { radius, height, offset, planeType } = identifiers;
120
+ const nodeArea = (() => {
121
+ switch (planeType) {
122
+ case "contenant l'axe de révolution":
123
+ {
124
+ return frac(multiply(radius, height), 2);
125
+ }
126
+ break;
127
+ case "perpendiculaire à l'axe de révolution":
128
+ {
129
+ const nodeHalfWidth = multiply(radius, substract(1, frac(offset, height)));
130
+ return multiply(PiNode, power(nodeHalfWidth, 2));
131
+ }
132
+ break;
133
+ default:
134
+ throw new Error("unsupported planeType: " + planeType);
135
+ }
136
+ })();
137
+ const nodeAreaRounded = round(nodeArea.evaluate(), 2).toTree();
138
+ return nodeAreaRounded;
139
+ };
140
+ const getAnswer = (identifiers) => {
141
+ return getAnswerNode(identifiers).toTex();
142
+ };
143
+ const getHint = (identifiers) => {
144
+ const { planeType } = identifiers;
145
+ switch (planeType) {
146
+ case "contenant l'axe de révolution":
147
+ {
148
+ return `Utilise la formule qui donne l'aire d'un triangle.`;
149
+ }
150
+ break;
151
+ case "perpendiculaire à l'axe de révolution":
152
+ {
153
+ return `Trouve un moyen de calculer le rayon du cercle section puis utilise la formule qui donne l'aire d'un cercle.`;
154
+ }
155
+ break;
156
+ default:
157
+ throw new Error("unsupported planeType: " + planeType);
158
+ }
159
+ };
160
+ const getCorrection = (identifiers) => {
161
+ const { radius, height, planeType, offset } = identifiers;
162
+ switch (planeType) {
163
+ case "contenant l'axe de révolution":
164
+ {
165
+ return `La section est un triangle de hauteur $${height} \\ \\textrm{cm}$ et de base $${2 * radius} \\ \\textrm{cm}$.
166
+ Son aire vaut :
167
+
168
+ $$
169
+ \\mathcal{A}_{\\text{triangle}} = \\frac{${height} \\times ${2 * radius}}{2} = ${getAnswer(identifiers)} \\ \\textrm{cm}^2
170
+ $$
171
+
172
+ `;
173
+ }
174
+ break;
175
+ case "perpendiculaire à l'axe de révolution":
176
+ {
177
+ return `La section est un cercle dont on peut calculer le rayon.
178
+
179
+ En effet, on peut exhiber une configuration de Thalès en plaçant le point $P$, sur la section,
180
+ et le point $B$ sur la base du cône $\\mathcal{K}$ de manière à ce que $H$, $P$ et $B$ soient alignés.
181
+ D'après le théorème de Thalès, on a :
182
+
183
+ $$
184
+ \\frac{PI}{BO} = \\frac{HI}{HO}
185
+ $$
186
+
187
+ $$
188
+ \\frac{PI}{BO} = \\frac{HO - OI}{HO}
189
+ $$
190
+
191
+ $$
192
+ PI = BO \\times \\frac{HO - OI}{HO}
193
+ $$
194
+
195
+ $$
196
+ PI = ${radius} \\times \\frac{${height} - ${offset}}{${height}}
197
+ $$
198
+
199
+ L'aire du cercle section vaut donc :
200
+
201
+ $$
202
+ \\mathcal{A}_{\\text{cercle}} = \\pi \\times {PI}^2 \\approx ${getAnswer(identifiers)} \\ \\textrm{cm}^2
203
+ $$
204
+
205
+ `;
206
+ }
207
+ break;
208
+ default:
209
+ throw new Error("unsupported planeType: " + planeType);
210
+ }
211
+ };
212
+ const getCorrectionGGBOptions = (identifiers) => {
213
+ const { radius, height, offset, planeType } = identifiers;
214
+ const commands = [
215
+ ...cylinderSectionGGBCommands(radius, height, offset, false, planeType),
216
+ `SetFilling(s, 0.36)`,
217
+ ...(() => {
218
+ switch (planeType) {
219
+ case "contenant l'axe de révolution":
220
+ {
221
+ return [];
222
+ }
223
+ break;
224
+ case "perpendiculaire à l'axe de révolution":
225
+ {
226
+ const nodeHalfWidth = multiply(radius, substract(1, frac(offset, height)));
227
+ const width = nodeHalfWidth.evaluate();
228
+ return [
229
+ `P = Point({0,${-width},${offset}})`,
230
+ `ShowLabel(P, true)`,
231
+ `B = Point({0,${-radius},0})`,
232
+ `ShowLabel(B, true)`,
233
+ ];
234
+ }
235
+ break;
236
+ default:
237
+ throw new Error("unsupported planeType: " + planeType);
238
+ }
239
+ })(),
240
+ ];
241
+ const ggb = new GeogebraConstructor({
242
+ commands,
243
+ is3D: true,
244
+ xAxis: {
245
+ hidden: true,
246
+ },
247
+ yAxis: {
248
+ hidden: true,
249
+ },
250
+ zAxis: {
251
+ hidden: false,
252
+ },
253
+ });
254
+ const xMax = radius;
255
+ const xMin = -xMax;
256
+ const yMax = radius;
257
+ const yMin = -yMax;
258
+ const zMax = radius;
259
+ const zMin = -zMax;
260
+ return ggb.getOptions({
261
+ coords: [xMin, xMax, yMin, yMax, zMin, zMax],
262
+ });
263
+ };
264
+ const getGGBOptions = (identifiers) => {
265
+ const { radius, height, offset, planeType } = identifiers;
266
+ const commands = [
267
+ ...cylinderSectionGGBCommands(radius, height, offset, true, planeType),
268
+ ];
269
+ const ggb = new GeogebraConstructor({
270
+ commands,
271
+ is3D: true,
272
+ xAxis: {
273
+ hidden: true,
274
+ },
275
+ yAxis: {
276
+ hidden: true,
277
+ },
278
+ zAxis: {
279
+ hidden: false,
280
+ },
281
+ });
282
+ const xMax = radius;
283
+ const xMin = -xMax;
284
+ const yMax = radius;
285
+ const yMin = -yMax;
286
+ const zMax = radius;
287
+ const zMin = -zMax;
288
+ return ggb.getOptions({
289
+ coords: [xMin, xMax, yMin, yMax, zMin, zMax],
290
+ });
291
+ };
292
+ const getKeys = () => {
293
+ return [];
294
+ };
295
+ const isAnswerValid = (ans, { answer }) => {
296
+ try {
297
+ const nodeAns = parseAlgebraic(ans);
298
+ const nodeAnswer = parseAlgebraic(answer);
299
+ return substract(nodeAns, nodeAnswer).evaluate() === 0;
300
+ }
301
+ catch (e) {
302
+ return handleVEAError(e);
303
+ }
304
+ };
305
+ const getPropositions = (n, { answer, ...identifiers }) => {
306
+ const { radius, height, offset, planeType } = identifiers;
307
+ const propositions = [];
308
+ addValidProp(propositions, answer);
309
+ switch (planeType) {
310
+ case "contenant l'axe de révolution":
311
+ {
312
+ //wrong formula: height * base instead of (height * base)/2
313
+ {
314
+ const nodeArea = multiply(height, 2 * radius);
315
+ const nodeAreaRounded = round(nodeArea.evaluate(), 2).toTree();
316
+ tryToAddWrongProp(propositions, nodeAreaRounded.toTex());
317
+ }
318
+ //wrong formula: perimeter
319
+ {
320
+ const nodeLength = sqrt(add(power(height, 2), power(radius, 2)));
321
+ const nodePerimeter = add(2 * radius, multiply(2, nodeLength));
322
+ const nodePerimeterRounded = round(nodePerimeter.evaluate(), 2).toTree();
323
+ tryToAddWrongProp(propositions, nodePerimeterRounded.toTex());
324
+ }
325
+ }
326
+ break;
327
+ case "perpendiculaire à l'axe de révolution":
328
+ {
329
+ const nodeHalfWidth = multiply(radius, substract(1, frac(offset, height)));
330
+ //wrong formula: circumference
331
+ {
332
+ const nodeCircumference = multiply(multiply(2, PiNode), nodeHalfWidth);
333
+ const nodeCircumferenceRounded = round(nodeCircumference.evaluate(), 2).toTree();
334
+ tryToAddWrongProp(propositions, nodeCircumferenceRounded.toTex());
335
+ }
336
+ //wrong formula: 2*radius instead of radius
337
+ {
338
+ const nodeArea = multiply(PiNode, power(multiply(2, nodeHalfWidth), 2));
339
+ const nodeAreaRounded = round(nodeArea.evaluate(), 2).toTree();
340
+ tryToAddWrongProp(propositions, nodeAreaRounded.toTex());
341
+ }
342
+ }
343
+ break;
344
+ default:
345
+ throw new Error("unsupported planeType: " + planeType);
346
+ }
347
+ propWhile(propositions, n, () => {
348
+ const identifiersWrong = (() => {
349
+ const isDiameterGiven = probaFlip(0.23);
350
+ const radius = randint(5, 21);
351
+ const height = randint(5, 21);
352
+ const offset = randint(2, Math.min(radius, height / 2.0));
353
+ const identifiers = {
354
+ radius,
355
+ height,
356
+ isDiameterGiven,
357
+ offset,
358
+ planeType,
359
+ };
360
+ return {
361
+ planeType: identifiers.planeType,
362
+ isDiameterGiven,
363
+ radius,
364
+ height,
365
+ offset,
366
+ };
367
+ })();
368
+ tryToAddWrongProp(propositions, getAnswer(identifiersWrong));
369
+ });
370
+ return shuffleProps(propositions, n);
371
+ };
372
+ const getAreaOfConeSectionQuestion = (optsIn) => {
373
+ const opts = optsIn ?? optsDefault;
374
+ const planeType = random(opts.planeTypes);
375
+ const isDiameterGiven = probaFlip(0.23);
376
+ const radius = randint(5, 21);
377
+ const height = randint(5, 21);
378
+ const offset = randint(2, Math.min(radius, height / 2.0));
379
+ const identifiers = { radius, height, isDiameterGiven, offset, planeType };
380
+ return getQuestionFromIdentifiers(identifiers, opts);
381
+ };
382
+ const getQuestionFromIdentifiers = (identifiers, opts) => {
383
+ const question = {
384
+ instruction: getInstruction(identifiers),
385
+ answer: getAnswer(identifiers),
386
+ hint: getHint(identifiers),
387
+ keys: getKeys(identifiers),
388
+ correction: getCorrection(identifiers),
389
+ ggbOptions: getGGBOptions(identifiers),
390
+ correctionGgbOptions: getCorrectionGGBOptions(identifiers),
391
+ answerFormat: "tex",
392
+ identifiers,
393
+ options: opts,
394
+ };
395
+ return question;
396
+ };
397
+ const optsDefault = {
398
+ planeTypes: [
399
+ "contenant l'axe de révolution",
400
+ "perpendiculaire à l'axe de révolution",
401
+ ],
402
+ };
403
+ const options = [
404
+ {
405
+ id: "planeTypes",
406
+ label: "Type de plan pour la section",
407
+ type: GeneratorOptionType.multiselect,
408
+ target: GeneratorOptionTarget.generation,
409
+ values: [
410
+ "contenant l'axe de révolution",
411
+ "perpendiculaire à l'axe de révolution",
412
+ ],
413
+ defaultValue: optsDefault.planeTypes,
414
+ },
415
+ ];
416
+ export const areaOfConeSection = {
417
+ id: "areaOfConeSection",
418
+ connector: "=",
419
+ label: "Calculer l'aire d'une section plane de cône",
420
+ isSingleStep: true,
421
+ generator: (nb, opts) => getDistinctQuestions(() => getAreaOfConeSectionQuestion(opts), nb),
422
+ options,
423
+ validateOptions: (opts) => {
424
+ return {
425
+ valid: opts?.planeTypes.length > 0,
426
+ message: "Veuillez choisir un type de section.",
427
+ };
428
+ },
429
+ qcmTimer: 60,
430
+ freeTimer: 60,
431
+ isAnswerValid,
432
+ getPropositions,
433
+ subject: "Mathématiques",
434
+ getQuestionFromIdentifiers,
435
+ getHint,
436
+ getCorrection,
437
+ hasHintAndCorrection: true,
438
+ hasGeogebra: true,
439
+ };
@@ -0,0 +1,14 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ type Identifiers = {
3
+ isDiameterGiven: boolean;
4
+ radius: number;
5
+ height: number;
6
+ offset: number;
7
+ planeType: string;
8
+ };
9
+ type Options = {
10
+ planeTypes: string[];
11
+ };
12
+ export declare const areaOfCylinderSection: Exercise<Identifiers, Options>;
13
+ export {};
14
+ //# sourceMappingURL=areaOfCylinderSection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"areaOfCylinderSection.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/spaceGeometry/sections/areaOfCylinderSection.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAoBT,MAAM,6BAA6B,CAAC;AA4JrC,KAAK,WAAW,GAAG;IACjB,eAAe,EAAE,OAAO,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAqcF,KAAK,OAAO,GAAG;IACb,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AAwBF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAkBhE,CAAC"}