math-exercises 3.0.151 → 3.0.153

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 (199) hide show
  1. package/lib/exercises/exercise.d.ts +7 -0
  2. package/lib/exercises/exercise.d.ts.map +1 -1
  3. package/lib/exercises/math/calcul/fractions/fractionToPercentToDecimal.d.ts +5 -1
  4. package/lib/exercises/math/calcul/fractions/fractionToPercentToDecimal.d.ts.map +1 -1
  5. package/lib/exercises/math/calcul/fractions/fractionToPercentToDecimal.js +92 -38
  6. package/lib/exercises/math/calcul/proportionality/findCoeffInProportionalTableNonIntegers.d.ts.map +1 -1
  7. package/lib/exercises/math/calcul/proportionality/findCoeffInProportionalTableNonIntegers.js +5 -1
  8. package/lib/exercises/math/calcul/proportionality/isTableProportional.d.ts.map +1 -1
  9. package/lib/exercises/math/calcul/proportionality/isTableProportional.js +7 -1
  10. package/lib/exercises/math/calcul/proportionality/isTableProportionalNonInteger.d.ts.map +1 -1
  11. package/lib/exercises/math/calcul/proportionality/isTableProportionalNonInteger.js +5 -1
  12. package/lib/exercises/math/calcul/proportionality/proportionalityTable.d.ts.map +1 -1
  13. package/lib/exercises/math/calcul/proportionality/proportionalityTable.js +5 -1
  14. package/lib/exercises/math/calcul/proportionality/proportionalityTableCoefficient.d.ts.map +1 -1
  15. package/lib/exercises/math/calcul/proportionality/proportionalityTableCoefficient.js +8 -2
  16. package/lib/exercises/math/calculLitteral/equation/index.d.ts +1 -1
  17. package/lib/exercises/math/calculLitteral/equation/index.d.ts.map +1 -1
  18. package/lib/exercises/math/calculLitteral/equation/index.js +1 -1
  19. package/lib/exercises/math/calculLitteral/equation/square/equationSimpleSquare.d.ts +10 -0
  20. package/lib/exercises/math/calculLitteral/equation/square/equationSimpleSquare.d.ts.map +1 -0
  21. package/lib/exercises/math/calculLitteral/equation/square/equationSimpleSquare.js +183 -0
  22. package/lib/exercises/math/calculLitteral/equation/square/equationSquareWithSteps.d.ts +10 -0
  23. package/lib/exercises/math/calculLitteral/equation/square/equationSquareWithSteps.d.ts.map +1 -0
  24. package/lib/exercises/math/calculLitteral/equation/square/equationSquareWithSteps.js +173 -0
  25. package/lib/exercises/math/calculLitteral/equation/square/index.d.ts +3 -0
  26. package/lib/exercises/math/calculLitteral/equation/square/index.d.ts.map +1 -0
  27. package/lib/exercises/math/calculLitteral/equation/square/index.js +2 -0
  28. package/lib/exercises/math/dataRepresentations/histogram/histogramIsSameData.d.ts.map +1 -1
  29. package/lib/exercises/math/dataRepresentations/histogram/histogramIsSameData.js +7 -0
  30. package/lib/exercises/math/dataRepresentations/tableReading.d.ts.map +1 -1
  31. package/lib/exercises/math/dataRepresentations/tableReading.js +7 -0
  32. package/lib/exercises/math/functions/affines/affineAdjustment.d.ts.map +1 -1
  33. package/lib/exercises/math/functions/affines/affineAdjustment.js +7 -1
  34. package/lib/exercises/math/functions/affines/affineAdjustmentComplete.d.ts.map +1 -1
  35. package/lib/exercises/math/functions/affines/affineAdjustmentComplete.js +7 -1
  36. package/lib/exercises/math/functions/affines/affineAdjustmentRsquared.d.ts.map +1 -1
  37. package/lib/exercises/math/functions/affines/affineAdjustmentRsquared.js +7 -1
  38. package/lib/exercises/math/functions/basics/inverseImageFunctionTable.d.ts.map +1 -1
  39. package/lib/exercises/math/functions/basics/inverseImageFunctionTable.js +7 -1
  40. package/lib/exercises/math/functions/basics/placePointsFromValueTable.d.ts.map +1 -1
  41. package/lib/exercises/math/functions/basics/placePointsFromValueTable.js +7 -0
  42. package/lib/exercises/math/functions/sqrt/squareRootCalculation.d.ts.map +1 -1
  43. package/lib/exercises/math/functions/sqrt/squareRootCalculation.js +4 -2
  44. package/lib/exercises/math/geometry/euclidian/homothetyFactorFromPoints.d.ts +15 -0
  45. package/lib/exercises/math/geometry/euclidian/homothetyFactorFromPoints.d.ts.map +1 -0
  46. package/lib/exercises/math/geometry/euclidian/homothetyFactorFromPoints.js +301 -0
  47. package/lib/exercises/math/geometry/euclidian/index.d.ts +7 -0
  48. package/lib/exercises/math/geometry/euclidian/index.d.ts.map +1 -1
  49. package/lib/exercises/math/geometry/euclidian/index.js +7 -0
  50. package/lib/exercises/math/geometry/euclidian/pinPointFromAxialOrCentralSymmetry.d.ts +21 -0
  51. package/lib/exercises/math/geometry/euclidian/pinPointFromAxialOrCentralSymmetry.d.ts.map +1 -0
  52. package/lib/exercises/math/geometry/euclidian/pinPointFromAxialOrCentralSymmetry.js +406 -0
  53. package/lib/exercises/math/geometry/euclidian/pinPointFromRotation.d.ts +18 -0
  54. package/lib/exercises/math/geometry/euclidian/pinPointFromRotation.d.ts.map +1 -0
  55. package/lib/exercises/math/geometry/euclidian/pinPointFromRotation.js +315 -0
  56. package/lib/exercises/math/geometry/euclidian/pinPointFromTranslation.d.ts +20 -0
  57. package/lib/exercises/math/geometry/euclidian/pinPointFromTranslation.d.ts.map +1 -0
  58. package/lib/exercises/math/geometry/euclidian/pinPointFromTranslation.js +314 -0
  59. package/lib/exercises/math/geometry/euclidian/pinSegmentFromRotation.d.ts +18 -0
  60. package/lib/exercises/math/geometry/euclidian/pinSegmentFromRotation.d.ts.map +1 -0
  61. package/lib/exercises/math/geometry/euclidian/pinSegmentFromRotation.js +387 -0
  62. package/lib/exercises/math/geometry/euclidian/recognizeAngleFromRotation.d.ts +18 -0
  63. package/lib/exercises/math/geometry/euclidian/recognizeAngleFromRotation.d.ts.map +1 -0
  64. package/lib/exercises/math/geometry/euclidian/recognizeAngleFromRotation.js +309 -0
  65. package/lib/exercises/math/geometry/euclidian/recognizeHomothetyCenter.d.ts +17 -0
  66. package/lib/exercises/math/geometry/euclidian/recognizeHomothetyCenter.d.ts.map +1 -0
  67. package/lib/exercises/math/geometry/euclidian/recognizeHomothetyCenter.js +301 -0
  68. package/lib/exercises/math/geometry/euclidianConstructions/buildPointFromAxialSymetry.d.ts.map +1 -1
  69. package/lib/exercises/math/geometry/euclidianConstructions/buildPointFromAxialSymetry.js +22 -8
  70. package/lib/exercises/math/geometry/euclidianConstructions/buildPointFromCentralSymmetry.d.ts +11 -0
  71. package/lib/exercises/math/geometry/euclidianConstructions/buildPointFromCentralSymmetry.d.ts.map +1 -0
  72. package/lib/exercises/math/geometry/euclidianConstructions/buildPointFromCentralSymmetry.js +169 -0
  73. package/lib/exercises/math/geometry/euclidianConstructions/index.d.ts +2 -0
  74. package/lib/exercises/math/geometry/euclidianConstructions/index.d.ts.map +1 -1
  75. package/lib/exercises/math/geometry/euclidianConstructions/index.js +2 -0
  76. package/lib/exercises/math/geometry/euclidianConstructions/placeHomothetyCenter.d.ts +16 -0
  77. package/lib/exercises/math/geometry/euclidianConstructions/placeHomothetyCenter.d.ts.map +1 -0
  78. package/lib/exercises/math/geometry/euclidianConstructions/placeHomothetyCenter.js +309 -0
  79. package/lib/exercises/math/probaStat/basicProbas/calculateProbaFromProbaLaw.d.ts.map +1 -1
  80. package/lib/exercises/math/probaStat/basicProbas/calculateProbaFromProbaLaw.js +7 -0
  81. package/lib/exercises/math/probaStat/basicProbas/getMissingProbabilityValue.d.ts.map +1 -1
  82. package/lib/exercises/math/probaStat/basicProbas/getMissingProbabilityValue.js +7 -0
  83. package/lib/exercises/math/probaStat/basicProbas/getMissingProbabilityValueMiddleSchool.d.ts +9 -0
  84. package/lib/exercises/math/probaStat/basicProbas/getMissingProbabilityValueMiddleSchool.d.ts.map +1 -0
  85. package/lib/exercises/math/probaStat/basicProbas/getMissingProbabilityValueMiddleSchool.js +120 -0
  86. package/lib/exercises/math/probaStat/basicProbas/index.d.ts +2 -0
  87. package/lib/exercises/math/probaStat/basicProbas/index.d.ts.map +1 -1
  88. package/lib/exercises/math/probaStat/basicProbas/index.js +2 -0
  89. package/lib/exercises/math/probaStat/basicProbas/pickEquiprobableTo.d.ts +12 -0
  90. package/lib/exercises/math/probaStat/basicProbas/pickEquiprobableTo.d.ts.map +1 -0
  91. package/lib/exercises/math/probaStat/basicProbas/pickEquiprobableTo.js +374 -0
  92. package/lib/exercises/math/probaStat/probaFromTableNoContext.d.ts.map +1 -1
  93. package/lib/exercises/math/probaStat/probaFromTableNoContext.js +7 -0
  94. package/lib/exercises/math/probaStat/probaFromTableWithContext.d.ts.map +1 -1
  95. package/lib/exercises/math/probaStat/probaFromTableWithContext.js +7 -0
  96. package/lib/exercises/math/probaStat/stats1var/averageWithClasses.d.ts +9 -0
  97. package/lib/exercises/math/probaStat/stats1var/averageWithClasses.d.ts.map +1 -0
  98. package/lib/exercises/math/probaStat/stats1var/averageWithClasses.js +140 -0
  99. package/lib/exercises/math/probaStat/stats1var/averageWithTable.d.ts.map +1 -1
  100. package/lib/exercises/math/probaStat/stats1var/averageWithTable.js +7 -1
  101. package/lib/exercises/math/probaStat/stats1var/averageWithTableWithContext.d.ts +8 -0
  102. package/lib/exercises/math/probaStat/stats1var/averageWithTableWithContext.d.ts.map +1 -0
  103. package/lib/exercises/math/probaStat/stats1var/averageWithTableWithContext.js +113 -0
  104. package/lib/exercises/math/probaStat/stats1var/calculateMeanFromFrequencies.d.ts.map +1 -1
  105. package/lib/exercises/math/probaStat/stats1var/calculateMeanFromFrequencies.js +7 -0
  106. package/lib/exercises/math/probaStat/stats1var/cumulativeSum.d.ts.map +1 -1
  107. package/lib/exercises/math/probaStat/stats1var/cumulativeSum.js +7 -0
  108. package/lib/exercises/math/probaStat/stats1var/etendueTable.d.ts.map +1 -1
  109. package/lib/exercises/math/probaStat/stats1var/etendueTable.js +7 -1
  110. package/lib/exercises/math/probaStat/stats1var/getQuartileProportionQuestion.d.ts.map +1 -1
  111. package/lib/exercises/math/probaStat/stats1var/getQuartileProportionQuestion.js +7 -0
  112. package/lib/exercises/math/probaStat/stats1var/index.d.ts +2 -0
  113. package/lib/exercises/math/probaStat/stats1var/index.d.ts.map +1 -1
  114. package/lib/exercises/math/probaStat/stats1var/index.js +2 -0
  115. package/lib/exercises/math/probaStat/stats1var/interquartilesTable.d.ts.map +1 -1
  116. package/lib/exercises/math/probaStat/stats1var/interquartilesTable.js +5 -1
  117. package/lib/exercises/math/probaStat/stats1var/marginalAndConditionalFrequency.d.ts.map +1 -1
  118. package/lib/exercises/math/probaStat/stats1var/marginalAndConditionalFrequency.js +7 -0
  119. package/lib/exercises/math/probaStat/stats1var/medianWithList.d.ts +2 -0
  120. package/lib/exercises/math/probaStat/stats1var/medianWithList.d.ts.map +1 -1
  121. package/lib/exercises/math/probaStat/stats1var/medianWithList.js +67 -14
  122. package/lib/exercises/math/probaStat/stats1var/medianWithTable.d.ts.map +1 -1
  123. package/lib/exercises/math/probaStat/stats1var/medianWithTable.js +7 -1
  124. package/lib/exercises/math/probaStat/stats1var/quartiles.d.ts.map +1 -1
  125. package/lib/exercises/math/probaStat/stats1var/quartiles.js +7 -1
  126. package/lib/exercises/math/probaStat/stats1var/standardDeviationTable.d.ts.map +1 -1
  127. package/lib/exercises/math/probaStat/stats1var/standardDeviationTable.js +5 -1
  128. package/lib/exercises/math/probaStat/stats1var/varianceTable.d.ts.map +1 -1
  129. package/lib/exercises/math/probaStat/stats1var/varianceTable.js +5 -1
  130. package/lib/exercises/math/probaStat/stats2var/averagePoint.d.ts.map +1 -1
  131. package/lib/exercises/math/probaStat/stats2var/averagePoint.js +7 -1
  132. package/lib/exercises/math/probaStat/twoStepExperiments/headsOrTailsTwiceOutcomes.d.ts +7 -0
  133. package/lib/exercises/math/probaStat/twoStepExperiments/headsOrTailsTwiceOutcomes.d.ts.map +1 -0
  134. package/lib/exercises/math/probaStat/twoStepExperiments/headsOrTailsTwiceOutcomes.js +171 -0
  135. package/lib/exercises/math/probaStat/twoStepExperiments/headsOrTailsTwiceProbas.d.ts +7 -0
  136. package/lib/exercises/math/probaStat/twoStepExperiments/headsOrTailsTwiceProbas.d.ts.map +1 -0
  137. package/lib/exercises/math/probaStat/twoStepExperiments/headsOrTailsTwiceProbas.js +155 -0
  138. package/lib/exercises/math/probaStat/twoStepExperiments/index.d.ts +3 -0
  139. package/lib/exercises/math/probaStat/twoStepExperiments/index.d.ts.map +1 -1
  140. package/lib/exercises/math/probaStat/twoStepExperiments/index.js +3 -0
  141. package/lib/exercises/math/probaStat/twoStepExperiments/numberPoolTwiceProbas.d.ts +7 -0
  142. package/lib/exercises/math/probaStat/twoStepExperiments/numberPoolTwiceProbas.d.ts.map +1 -0
  143. package/lib/exercises/math/probaStat/twoStepExperiments/numberPoolTwiceProbas.js +189 -0
  144. package/lib/exercises/math/scratch/index.d.ts +3 -0
  145. package/lib/exercises/math/scratch/index.d.ts.map +1 -1
  146. package/lib/exercises/math/scratch/index.js +3 -0
  147. package/lib/exercises/math/scratch/scratchListElemAtIndex.d.ts +13 -0
  148. package/lib/exercises/math/scratch/scratchListElemAtIndex.d.ts.map +1 -0
  149. package/lib/exercises/math/scratch/scratchListElemAtIndex.js +189 -0
  150. package/lib/exercises/math/scratch/scratchListElemAtIndex2.d.ts +23 -0
  151. package/lib/exercises/math/scratch/scratchListElemAtIndex2.d.ts.map +1 -0
  152. package/lib/exercises/math/scratch/scratchListElemAtIndex2.js +207 -0
  153. package/lib/exercises/math/scratch/scratchListFilter.d.ts +13 -0
  154. package/lib/exercises/math/scratch/scratchListFilter.d.ts.map +1 -0
  155. package/lib/exercises/math/scratch/scratchListFilter.js +397 -0
  156. package/lib/exercises/math/spaceGeometry/basis/findSpacePointOnRectangularPrism.d.ts +14 -0
  157. package/lib/exercises/math/spaceGeometry/basis/findSpacePointOnRectangularPrism.d.ts.map +1 -0
  158. package/lib/exercises/math/spaceGeometry/basis/findSpacePointOnRectangularPrism.js +347 -0
  159. package/lib/exercises/math/spaceGeometry/basis/index.d.ts +1 -0
  160. package/lib/exercises/math/spaceGeometry/basis/index.d.ts.map +1 -1
  161. package/lib/exercises/math/spaceGeometry/basis/index.js +1 -0
  162. package/lib/exercises/math/spaceGeometry/index.d.ts +2 -0
  163. package/lib/exercises/math/spaceGeometry/index.d.ts.map +1 -1
  164. package/lib/exercises/math/spaceGeometry/index.js +2 -0
  165. package/lib/exercises/math/spaceGeometry/sections/areaOfConeSection.js +3 -3
  166. package/lib/exercises/math/spaceGeometry/solids/index.d.ts +3 -0
  167. package/lib/exercises/math/spaceGeometry/solids/index.d.ts.map +1 -0
  168. package/lib/exercises/math/spaceGeometry/solids/index.js +2 -0
  169. package/lib/exercises/math/spaceGeometry/solids/recognizeSolidFrom3D.d.ts +15 -0
  170. package/lib/exercises/math/spaceGeometry/solids/recognizeSolidFrom3D.d.ts.map +1 -0
  171. package/lib/exercises/math/spaceGeometry/solids/recognizeSolidFrom3D.js +440 -0
  172. package/lib/exercises/math/spaceGeometry/solids/recognizeSolidFromSolidPattern.d.ts +11 -0
  173. package/lib/exercises/math/spaceGeometry/solids/recognizeSolidFromSolidPattern.d.ts.map +1 -0
  174. package/lib/exercises/math/spaceGeometry/solids/recognizeSolidFromSolidPattern.js +1089 -0
  175. package/lib/exercises/math/spaceGeometry/sphere/index.d.ts +3 -0
  176. package/lib/exercises/math/spaceGeometry/sphere/index.d.ts.map +1 -0
  177. package/lib/exercises/math/spaceGeometry/sphere/index.js +2 -0
  178. package/lib/exercises/math/spaceGeometry/sphere/pickIsPointInSphereOrBall.d.ts +9 -0
  179. package/lib/exercises/math/spaceGeometry/sphere/pickIsPointInSphereOrBall.d.ts.map +1 -0
  180. package/lib/exercises/math/spaceGeometry/sphere/pickIsPointInSphereOrBall.js +127 -0
  181. package/lib/exercises/math/spaceGeometry/sphere/sphereLatLonReading.d.ts +14 -0
  182. package/lib/exercises/math/spaceGeometry/sphere/sphereLatLonReading.d.ts.map +1 -0
  183. package/lib/exercises/math/spaceGeometry/sphere/sphereLatLonReading.js +390 -0
  184. package/lib/geogebra/geogebraConstructor.d.ts +2 -0
  185. package/lib/geogebra/geogebraConstructor.d.ts.map +1 -1
  186. package/lib/geogebra/geogebraConstructor.js +6 -0
  187. package/lib/index.d.ts +198 -6
  188. package/lib/index.d.ts.map +1 -1
  189. package/lib/math/geometry/point.d.ts +6 -0
  190. package/lib/math/geometry/point.d.ts.map +1 -1
  191. package/lib/math/geometry/point.js +28 -0
  192. package/lib/tree/nodes/equations/equalNode.d.ts +1 -1
  193. package/lib/tree/nodes/equations/equalNode.d.ts.map +1 -1
  194. package/lib/tree/nodes/equations/equalNode.js +0 -1
  195. package/lib/tree/utilities/nodeSimplifier.d.ts +1 -1
  196. package/lib/utils/arrays/arrayZip.d.ts +2 -0
  197. package/lib/utils/arrays/arrayZip.d.ts.map +1 -0
  198. package/lib/utils/arrays/arrayZip.js +12 -0
  199. package/package.json +1 -1
@@ -0,0 +1,440 @@
1
+ import { shuffleProps, addValidProp, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { blueMain, greenMain, orange, pinkMain, purpleMain, red, } from "../../../../geogebra/colors.js";
4
+ import { GeogebraConstructor } from "../../../../geogebra/geogebraConstructor.js";
5
+ import { Point } from "../../../../math/geometry/point.js";
6
+ import { Segment } from "../../../../math/geometry/segment.js";
7
+ import { Vector, VectorConstructor } from "../../../../math/geometry/vector.js";
8
+ import { randint } from "../../../../math/utils/random/randint.js";
9
+ import { round } from "../../../../math/utils/round.js";
10
+ import { tan } from "../../../../tree/nodes/functions/tanNode.js";
11
+ import { PiNode } from "../../../../tree/nodes/numbers/piNode.js";
12
+ import { add } from "../../../../tree/nodes/operators/addNode.js";
13
+ import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
14
+ import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
15
+ import { substract } from "../../../../tree/nodes/operators/substractNode.js";
16
+ import { random, randomMany } from "../../../../utils/alea/random.js";
17
+ const colors = [greenMain, orange, blueMain, pinkMain, purpleMain, red];
18
+ const createVector = (from, to, name, precision = 5) => {
19
+ return new Vector(name, round(substract(to.x, from.x).evaluate(), precision).toTree(), round(substract(to.y, from.y).evaluate(), precision).toTree());
20
+ };
21
+ const createPoint = (x, y, name, precision = 5) => {
22
+ return new Point(name, round(x, precision), round(y, precision));
23
+ };
24
+ const rotatePoint = (target, angle, center, name, precision = 2) => {
25
+ const vSrc = createVector(center, target, "vSrc", precision);
26
+ const vRotated = vSrc.rotate(angle, "vRotated");
27
+ return createPoint(add(center.x, vRotated.x).evaluate(), add(center.y, vRotated.y).evaluate(), name, precision);
28
+ };
29
+ const regularPolygonPoints = (iObj, segmentBase, nbSides) => {
30
+ const nodeApotheme = frac(segmentBase.getLength(), multiply(2, tan(frac(PiNode, nbSides))));
31
+ const vecAB = VectorConstructor.fromPoints(segmentBase.pointA, segmentBase.pointB);
32
+ const vecOrth = vecAB.getOrthogonal();
33
+ const vecOrthUnit = vecOrth.times(frac(1, vecOrth.getNorm()));
34
+ const pointCenter = vecOrthUnit
35
+ .times(nodeApotheme)
36
+ .getEndPoint(segmentBase.getMidpoint());
37
+ const angleBase = frac(multiply(2, PiNode), nbSides).evaluate();
38
+ const points = [...Array(nbSides).keys()].map((i) => {
39
+ return rotatePoint(segmentBase.pointA, i * angleBase, pointCenter, `P_${iObj}_${i}`, 5);
40
+ });
41
+ return points;
42
+ };
43
+ const ggbCommandRectangularPrism = (indexColor, L, l, h) => {
44
+ return [
45
+ //points
46
+ `A = Point({${L},${l},${h}})`,
47
+ `B = Point({${L},0,${h}})`,
48
+ `C = Point({0,0,${h}})`,
49
+ `D = Point({0,${l},${h}})`,
50
+ `E = Point({${L},${l},0})`,
51
+ //prism
52
+ `Pri = Prism(A,B,C,D,E)`,
53
+ `SetColor(Pri, "${colors[indexColor]}")`,
54
+ `SetFilling(Pri, 0.36)`,
55
+ `SetLineThickness(Pri, 1)`,
56
+ //hide points
57
+ `SetVisibleInView(A,-1, false)`,
58
+ `SetVisibleInView(B,-1, false)`,
59
+ `SetVisibleInView(C,-1, false)`,
60
+ `SetVisibleInView(D,-1, false)`,
61
+ `SetVisibleInView(E,-1, false)`,
62
+ `SetVisibleInView(F,-1, false)`,
63
+ `SetVisibleInView(G,-1, false)`,
64
+ `SetVisibleInView(H,-1, false)`,
65
+ ];
66
+ };
67
+ const boundingCoordsRectangularPrism = (L, l, h) => {
68
+ return {
69
+ xMin: 0,
70
+ yMin: 0,
71
+ zMin: 0,
72
+ xMax: L,
73
+ yMax: l,
74
+ zMax: h,
75
+ };
76
+ };
77
+ const ggbCommandPrismFromRegularPolygon = (indexColor, nbSides, l, h) => {
78
+ return [
79
+ //polygon
80
+ `PolBase = Polygon((${-l / 2.0}, 0), (${l / 2.0}, 0), ${nbSides})`,
81
+ //prism
82
+ `Pri = Prism(PolBase, ${h})`,
83
+ `SetColor(Pri, "${colors[indexColor]}")`,
84
+ `SetFilling(Pri, 0.36)`,
85
+ `SetLineThickness(Pri, 1)`,
86
+ `SetFixed(Pri, false, true)`,
87
+ ];
88
+ };
89
+ const boundingCoordsPrismFromRegularPolygon = (nbSides, l, h) => {
90
+ const ySpan = (() => {
91
+ const pointA = new Point("A", l, 0);
92
+ const pointB = new Point("B", 0, 0);
93
+ const segmentBase = new Segment(pointA, pointB);
94
+ const points = regularPolygonPoints(0, segmentBase, nbSides);
95
+ const ySpan = Math.max(...points.map((point) => point.y.evaluate()));
96
+ return ySpan;
97
+ })();
98
+ return {
99
+ xMin: -ySpan / 2,
100
+ yMin: 0,
101
+ zMin: 0,
102
+ xMax: ySpan / 2,
103
+ yMax: ySpan,
104
+ zMax: h,
105
+ };
106
+ };
107
+ const ggbCommandPyramidFromRegularPolygon = (indexColor, nbSides, l, h) => {
108
+ return [
109
+ //polygon
110
+ `PolBase = Polygon((${-l / 2.0}, 0), (${l / 2.0}, 0), ${nbSides})`,
111
+ //prism
112
+ `Pyr = Pyramid(PolBase, ${h})`,
113
+ `SetColor(Pyr, "${colors[indexColor]}")`,
114
+ `SetFilling(Pyr, 0.36)`,
115
+ `SetLineThickness(Pyr, 1)`,
116
+ `SetFixed(Pyr, false, true)`,
117
+ ];
118
+ };
119
+ const boundingCoordsPyramidFromRegularPolygon = (nbSides, l, h) => {
120
+ const ySpan = (() => {
121
+ const pointA = new Point("A", l, 0);
122
+ const pointB = new Point("B", 0, 0);
123
+ const segmentBase = new Segment(pointA, pointB);
124
+ const points = regularPolygonPoints(0, segmentBase, nbSides);
125
+ const ySpan = Math.max(...points.map((point) => point.y.evaluate()));
126
+ return ySpan;
127
+ })();
128
+ return {
129
+ xMin: -ySpan / 2,
130
+ yMin: 0,
131
+ zMin: 0,
132
+ xMax: ySpan / 2,
133
+ yMax: ySpan,
134
+ zMax: h,
135
+ };
136
+ };
137
+ const ggbCommandCylinder = (indexColor, l, h) => {
138
+ return [
139
+ //cylinder
140
+ `Cyl = Cylinder((0,0,${-h / 2.0}), (0,0,${h / 2.0}), ${l})`,
141
+ `SetColor(Cyl, "${colors[indexColor]}")`,
142
+ `SetFilling(Cyl, 0.36)`,
143
+ `SetLineThickness(Cyl, 1)`,
144
+ ];
145
+ };
146
+ const boundingCoordsCylinder = (l, //radius
147
+ h) => {
148
+ return {
149
+ xMin: -l,
150
+ yMin: -l,
151
+ zMin: -h / 2,
152
+ xMax: l,
153
+ yMax: l,
154
+ zMax: h / 2,
155
+ };
156
+ };
157
+ const ggbCommandCone = (indexColor, l, h) => {
158
+ return [
159
+ //cone
160
+ `Con = Cone((0,0,0), (0,0,${h}), ${l})`,
161
+ `SetColor(Con, "${colors[indexColor]}")`,
162
+ `SetFilling(Con, 0.36)`,
163
+ `SetLineThickness(Con, 1)`,
164
+ ];
165
+ };
166
+ const boundingCoordsCone = (l, //radius
167
+ h) => {
168
+ return {
169
+ xMin: -l,
170
+ yMin: -l,
171
+ zMin: 0,
172
+ xMax: l,
173
+ yMax: l,
174
+ zMax: h,
175
+ };
176
+ };
177
+ const ggbCommandSphere = (indexColor, l, _) => {
178
+ return [
179
+ //sphere
180
+ `Sph = Sphere((0,0,0), ${l})`,
181
+ `SetColor(Sph, "${colors[indexColor]}")`,
182
+ `SetFilling(Sph, 0.36)`,
183
+ `SetLineThickness(Sph, 1)`,
184
+ ];
185
+ };
186
+ const boundingCoordsSphere = (l, //radius
187
+ _) => {
188
+ return {
189
+ xMin: -l,
190
+ yMin: -l,
191
+ zMin: -l,
192
+ xMax: l,
193
+ yMax: l,
194
+ zMax: l,
195
+ };
196
+ };
197
+ const solidFamilies = [
198
+ {
199
+ str: "un cube",
200
+ ggbCommandsFunc: (indexColor, L, l, h) => ggbCommandRectangularPrism(indexColor, L, l, h),
201
+ boundingCoordsFunc: (L, l, h) => boundingCoordsRectangularPrism(L, l, h),
202
+ },
203
+ {
204
+ str: "un pavé droit",
205
+ ggbCommandsFunc: (indexColor, L, l, h) => ggbCommandRectangularPrism(indexColor, L, l, h),
206
+ boundingCoordsFunc: (L, l, h) => boundingCoordsRectangularPrism(L, l, h),
207
+ },
208
+ {
209
+ str: "un prisme droit de polygone régulier",
210
+ ggbCommandsFunc: (indexColor, nbSides, l, h) => ggbCommandPrismFromRegularPolygon(indexColor, nbSides, l, h),
211
+ boundingCoordsFunc: (L, l, h) => boundingCoordsPrismFromRegularPolygon(L, l, h),
212
+ },
213
+ {
214
+ str: "une pyramide régulière",
215
+ ggbCommandsFunc: (indexColor, nbSides, l, h) => ggbCommandPyramidFromRegularPolygon(indexColor, nbSides, l, h),
216
+ boundingCoordsFunc: (nbSides, l, h) => boundingCoordsPyramidFromRegularPolygon(/*index,*/ nbSides, l, h),
217
+ },
218
+ {
219
+ str: "un cylindre",
220
+ ggbCommandsFunc: (indexColor, _, l, h) => ggbCommandCylinder(indexColor, l, h),
221
+ boundingCoordsFunc: (_, l, h) => boundingCoordsCylinder(l, h),
222
+ },
223
+ {
224
+ str: "un cône",
225
+ ggbCommandsFunc: (indexColor, _, l, h) => ggbCommandCone(indexColor, l, h),
226
+ boundingCoordsFunc: (_, l, h) => boundingCoordsCone(l, h),
227
+ },
228
+ {
229
+ str: "une sphère",
230
+ ggbCommandsFunc: (indexColor, _, l, h) => ggbCommandSphere(indexColor, l, h),
231
+ boundingCoordsFunc: (_, l, h) => boundingCoordsSphere(l, h),
232
+ },
233
+ ];
234
+ const getInstruction = (_, opts) => {
235
+ return `Quel solide est ici représenté ${(() => {
236
+ switch (opts?.projection) {
237
+ case "1":
238
+ return "en $3$D";
239
+ case "3":
240
+ return "en perspective cavalière";
241
+ default:
242
+ return "";
243
+ }
244
+ })()} ?
245
+
246
+ ${(() => {
247
+ switch (opts?.projection) {
248
+ case "1":
249
+ return "*On pourra tourner la fenêtre graphique.*";
250
+ default:
251
+ return "";
252
+ }
253
+ })()}`;
254
+ };
255
+ const getAnswer = (identifiers) => {
256
+ const { indexFamily } = identifiers;
257
+ const solidFamily = solidFamilies[indexFamily];
258
+ return solidFamily.str;
259
+ };
260
+ const getHint = () => {
261
+ return `Est-ce un solide de révolution ? Est-ce un prisme ?`;
262
+ };
263
+ const getCorrection = (identifiers) => {
264
+ return `C'est ${getAnswer(identifiers)}.`;
265
+ };
266
+ const getGGBOptions = (identifiers, optsIn) => {
267
+ const opts = optsIn ?? optsDefault;
268
+ const { indexFamily, L, l, h, indexColor } = identifiers;
269
+ const solidFamily = solidFamilies[indexFamily];
270
+ const commands = [
271
+ //hide xOyPlane
272
+ `SetFilling(xOyPlane, 0)`,
273
+ ...solidFamily.ggbCommandsFunc(indexColor, L, l, h),
274
+ ];
275
+ const projection = +opts.projection;
276
+ const ggb = new GeogebraConstructor({
277
+ commands,
278
+ forbidShiftDragZoom: projection === 0,
279
+ is3D: true,
280
+ projection,
281
+ projectionParam: projection === 1 ? 500 : undefined,
282
+ xAxis: {
283
+ hidden: true,
284
+ },
285
+ yAxis: {
286
+ hidden: true,
287
+ },
288
+ zAxis: {
289
+ hidden: true,
290
+ },
291
+ });
292
+ return ggb.getOptions({
293
+ coords: ggb.getAdaptedCoords(solidFamily.boundingCoordsFunc(L, l, h)),
294
+ });
295
+ };
296
+ const getPropositions = (n, { answer, ...identifiers }) => {
297
+ const propositions = [];
298
+ addValidProp(propositions, answer, "raw");
299
+ let arrStrWrong;
300
+ const { indexFamily } = identifiers;
301
+ switch (indexFamily) {
302
+ //avoid multiple possible answers
303
+ case 0:
304
+ case 1:
305
+ {
306
+ arrStrWrong = [
307
+ "une pyramide régulière",
308
+ "un cylindre",
309
+ "un cône",
310
+ "une sphère",
311
+ ];
312
+ }
313
+ break;
314
+ default:
315
+ {
316
+ arrStrWrong = solidFamilies.map((Family) => Family.str);
317
+ }
318
+ break;
319
+ }
320
+ arrStrWrong.forEach((str) => {
321
+ tryToAddWrongProp(propositions, str, "raw");
322
+ });
323
+ return shuffleProps(propositions, n);
324
+ };
325
+ const getRecognizeSolidFrom3DQuestion = (opts) => {
326
+ const indexFamily = randint(0, solidFamilies.length);
327
+ let L;
328
+ let l;
329
+ let h;
330
+ switch (indexFamily) {
331
+ case 0:
332
+ {
333
+ L = 5;
334
+ l = 5;
335
+ h = 5;
336
+ }
337
+ break;
338
+ case 1:
339
+ {
340
+ [L, l, h] = randomMany([...Array(20).keys()].map((i) => i + 5), 3);
341
+ }
342
+ break;
343
+ case 2:
344
+ {
345
+ //L is nbSides
346
+ L = random([3, 5, 6, 7, 8]);
347
+ [l, h] = randomMany([...Array(20).keys()].map((i) => i + 5), 2);
348
+ }
349
+ break;
350
+ case 3:
351
+ {
352
+ //L is nbSides
353
+ L = random([3, 5, 6, 7, 8]);
354
+ l = random([...Array(20).keys()].map((i) => i + 5));
355
+ const nodeApotheme = frac(l, multiply(2, tan(frac(PiNode, L))));
356
+ const minHAsIntegerSharp = Math.ceil(nodeApotheme.evaluate());
357
+ const minHAsIntegerForEye = Math.ceil(1.5 * minHAsIntegerSharp);
358
+ h = randint(minHAsIntegerForEye, 2 * minHAsIntegerForEye);
359
+ }
360
+ break;
361
+ case 4:
362
+ {
363
+ //L is useless
364
+ L = 0;
365
+ [l, h] = randomMany([...Array(20).keys()].map((i) => i + 5), 2);
366
+ }
367
+ break;
368
+ case 5:
369
+ {
370
+ //L is useless
371
+ L = 0;
372
+ [l, h] = randomMany([...Array(20).keys()].map((i) => i + 5), 2);
373
+ h = h + 10;
374
+ }
375
+ break;
376
+ case 6:
377
+ {
378
+ L = 0;
379
+ h = 0;
380
+ l = 5;
381
+ }
382
+ break;
383
+ default:
384
+ throw new Error("Unsupported indexFamily: " + indexFamily);
385
+ }
386
+ const indexColor = randint(0, colors.length);
387
+ const identifiers = { indexFamily, L, l, h, indexColor };
388
+ return getQuestionFromIdentifiers(identifiers, opts);
389
+ };
390
+ const getQuestionFromIdentifiers = (identifiers, opts) => {
391
+ const question = {
392
+ instruction: getInstruction(identifiers, opts),
393
+ answer: getAnswer(identifiers, opts),
394
+ hint: getHint(identifiers, opts),
395
+ correction: getCorrection(identifiers, opts),
396
+ ggbOptions: getGGBOptions(identifiers, opts),
397
+ keys: [],
398
+ answerFormat: "raw",
399
+ identifiers,
400
+ options: opts,
401
+ };
402
+ return question;
403
+ };
404
+ const optsDefault = {
405
+ projection: "3",
406
+ };
407
+ export const recognizeSolidFromCavalierPerspective = {
408
+ id: "recognizeSolidFromCavalierPerspective",
409
+ connector: "=",
410
+ label: "Nommer un solide à partir de sa représentation en perspective cavalière",
411
+ isSingleStep: true,
412
+ generator: (nb) => getDistinctQuestions(() => getRecognizeSolidFrom3DQuestion({ projection: "3" }), nb),
413
+ qcmTimer: 60,
414
+ freeTimer: 60,
415
+ getPropositions,
416
+ subject: "Mathématiques",
417
+ getQuestionFromIdentifiers,
418
+ answerType: "QCU",
419
+ getHint,
420
+ getCorrection,
421
+ hasHintAndCorrection: true,
422
+ hasGeogebra: true,
423
+ };
424
+ export const recognizeSolidFrom3D = {
425
+ id: "recognizeSolidFrom3D",
426
+ connector: "=",
427
+ label: "Nommer un solide à partir de sa représentation $3$D",
428
+ isSingleStep: true,
429
+ generator: (nb) => getDistinctQuestions(() => getRecognizeSolidFrom3DQuestion({ projection: "1" }), nb),
430
+ qcmTimer: 60,
431
+ freeTimer: 60,
432
+ getPropositions,
433
+ subject: "Mathématiques",
434
+ getQuestionFromIdentifiers,
435
+ answerType: "QCU",
436
+ getHint,
437
+ getCorrection,
438
+ hasHintAndCorrection: true,
439
+ hasGeogebra: true,
440
+ };
@@ -0,0 +1,11 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ type Identifiers = {
3
+ indexFamily: number;
4
+ indexPattern: number;
5
+ L: number;
6
+ l: number;
7
+ h: number;
8
+ };
9
+ export declare const recognizeSolidFromSolidPattern: Exercise<Identifiers>;
10
+ export {};
11
+ //# sourceMappingURL=recognizeSolidFromSolidPattern.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recognizeSolidFromSolidPattern.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/spaceGeometry/solids/recognizeSolidFromSolidPattern.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AA8qCrC,KAAK,WAAW,GAAG;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AA0JF,eAAO,MAAM,8BAA8B,EAAE,QAAQ,CAAC,WAAW,CAiBhE,CAAC"}