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,301 @@
1
+ import { GeneratorOptionType, GeneratorOptionTarget, shuffleProps, addValidProp, tryToAddWrongProp, propWhile, } from "../../../../exercises/exercise.js";
2
+ import { toolBarConstructor } from "../../../../exercises/utils/geogebra/toolBarConstructor.js";
3
+ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
4
+ import { GeogebraConstructor } from "../../../../geogebra/geogebraConstructor.js";
5
+ import { Point, PointConstructor, } from "../../../../math/geometry/point.js";
6
+ import { VectorConstructor } from "../../../../math/geometry/vector.js";
7
+ import { randint } from "../../../../math/utils/random/randint.js";
8
+ import { sqrt } from "../../../../tree/nodes/functions/sqrtNode.js";
9
+ import { add, AddNode } from "../../../../tree/nodes/operators/addNode.js";
10
+ import { frac, isFractionNode, } from "../../../../tree/nodes/operators/fractionNode.js";
11
+ import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
12
+ import { SquareNode } 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 { coinFlip } from "../../../../utils/alea/coinFlip.js";
16
+ import { random, randomMany } from "../../../../utils/alea/random.js";
17
+ import { shuffle } from "../../../../utils/alea/shuffle.js";
18
+ import { doWhile } from "../../../../utils/doWhile.js";
19
+ const getSquaredNormNode = (vec) => {
20
+ return new AddNode(new SquareNode(vec.x), new SquareNode(vec.y));
21
+ };
22
+ const getDivisorsOfVector = (vec) => {
23
+ return [2, 3, 4, 5, 7, 8, 9].filter((n) => [vec.x, vec.y].every((z) => z.evaluate() % n === 0));
24
+ };
25
+ const getRandomFactorNodeForVector = (vec, isPositiveFactorOnly = false, excludes = [], factorType) => {
26
+ let factorNode;
27
+ switch (factorType) {
28
+ case "fraction":
29
+ {
30
+ const divisorsOfVec = getDivisorsOfVector(vec);
31
+ if (divisorsOfVec.length > 0) {
32
+ const den = random(divisorsOfVec);
33
+ const num = randint(1, 3 * den, [den, 2 * den]);
34
+ factorNode = frac(num, den);
35
+ }
36
+ else {
37
+ throw new Error("can't find frac for vec");
38
+ }
39
+ }
40
+ break;
41
+ default:
42
+ case "entier":
43
+ {
44
+ factorNode = randint(1, 5, excludes).toTree();
45
+ }
46
+ break;
47
+ }
48
+ return multiply(isPositiveFactorOnly ? 1 : coinFlip() ? 1 : -1, factorNode);
49
+ };
50
+ const getInstruction = (identifiers) => {
51
+ const { nameCenterPoint, nameSrcPoint, nameDstPoint } = identifiers;
52
+ return `Quel est le rapport de l'homothétie de centre $${nameCenterPoint}$ qui transforme $${nameSrcPoint}$ en $${nameDstPoint}$ ?`;
53
+ };
54
+ const getAnswerNode = (identifiers) => {
55
+ const { nameCenterPoint, nameSrcPoint, nameDstPoint, pointsDict } = identifiers;
56
+ const [pointCenter, pointSrc, pointDst] = [
57
+ nameCenterPoint,
58
+ nameSrcPoint,
59
+ nameDstPoint,
60
+ ].map((pointName) => PointConstructor.fromIdentifiers(pointsDict[pointName]));
61
+ const vec1 = VectorConstructor.fromPoints(pointCenter, pointSrc);
62
+ const vec2 = VectorConstructor.fromPoints(pointCenter, pointDst);
63
+ const nodeFactor = multiply(Math.sign(vec1.scalarProduct(vec2).evaluate()), sqrt(frac(getSquaredNormNode(vec2).simplify(), getSquaredNormNode(vec1).simplify())).simplify()).simplify();
64
+ return nodeFactor;
65
+ };
66
+ const getAnswer = (identifiers) => {
67
+ return getAnswerNode(identifiers).toTex();
68
+ };
69
+ const getHint = (identifiers) => {
70
+ const { nameCenterPoint, nameSrcPoint, nameDstPoint } = identifiers;
71
+ return `Compare la longueur algébrique $\\overline{${nameCenterPoint}${nameDstPoint}}$ à la longueur algébrique $\\overline{${nameCenterPoint}${nameSrcPoint}}$`;
72
+ };
73
+ const getCorrection = (identifiers) => {
74
+ const { nameCenterPoint, nameSrcPoint, nameDstPoint } = identifiers;
75
+ const answerTex = getAnswer(identifiers);
76
+ return `Le rapport de l'homothétie de centre $${nameCenterPoint}$ qui transforme $${nameSrcPoint}$ en $${nameDstPoint}$ est :
77
+
78
+ $$
79
+ \\frac{\\overline{${nameCenterPoint}${nameDstPoint}}}{\\overline{${nameCenterPoint}${nameSrcPoint}}} = ${answerTex}
80
+ $$
81
+
82
+ `;
83
+ };
84
+ const getGGBOptions = (identifiers) => {
85
+ const points = Object.values(identifiers.pointsDict).map((p) => PointConstructor.fromIdentifiers(p));
86
+ const ggb = new GeogebraConstructor({
87
+ hideAxes: true,
88
+ isGridSimple: true,
89
+ customToolBar: toolBarConstructor({ point: true }),
90
+ commands: points.flatMap((p) => p.toGGBCommand({
91
+ size: 3,
92
+ style: 1,
93
+ })),
94
+ fontSize: 16,
95
+ });
96
+ return ggb.getOptions({
97
+ coords: ggb.getCoordsForPoints(points),
98
+ });
99
+ };
100
+ const isAnswerValid = (ans, { answer }) => {
101
+ try {
102
+ const [nodeAns, nodeAnswer] = [ans, answer].map((str) => parseAlgebraic(str));
103
+ return substract(nodeAns, nodeAnswer).simplify().evaluate() === 0;
104
+ }
105
+ catch (_) {
106
+ return false;
107
+ }
108
+ };
109
+ const getPropositions = (n, { answer, ...identifiers }, optsIn) => {
110
+ const opts = optsIn ?? optsDefault;
111
+ const propositions = [];
112
+ const answerNode = getAnswerNode(identifiers);
113
+ addValidProp(propositions, answerNode.toTex());
114
+ if (!opts.isPositiveFactorOnly) {
115
+ //sign
116
+ tryToAddWrongProp(propositions, multiply(-1, answerNode).simplify().toTex());
117
+ }
118
+ //+-1
119
+ {
120
+ const nodePlus1 = add(+1, answerNode).simplify();
121
+ const nodeMinus1 = add(-1, answerNode).simplify();
122
+ [nodePlus1, nodeMinus1].forEach((node) => {
123
+ const value = node.evaluate();
124
+ if (value !== 0 && value !== 1) {
125
+ tryToAddWrongProp(propositions, node.toTex());
126
+ }
127
+ });
128
+ if (!opts.isPositiveFactorOnly) {
129
+ //sign
130
+ [nodePlus1, nodeMinus1].forEach((node) => {
131
+ const oppNode = multiply(-1, node).simplify();
132
+ const value = node.evaluate();
133
+ if (value !== 0 && value !== 1) {
134
+ tryToAddWrongProp(propositions, oppNode.toTex());
135
+ }
136
+ });
137
+ }
138
+ }
139
+ //num:+-1
140
+ {
141
+ if (isFractionNode(answerNode)) {
142
+ const [numNode, denNode] = [
143
+ answerNode.leftChild,
144
+ answerNode.rightChild,
145
+ ];
146
+ const nodeNumPlus1 = frac(add(+1, numNode), denNode).simplify();
147
+ const nodeNumMinus1 = frac(add(-1, numNode), denNode).simplify();
148
+ [nodeNumPlus1, nodeNumMinus1].forEach((node) => {
149
+ const value = node.evaluate();
150
+ if (value !== 0 && value !== 1) {
151
+ tryToAddWrongProp(propositions, node.toTex());
152
+ }
153
+ });
154
+ if (!opts.isPositiveFactorOnly) {
155
+ //sign
156
+ [nodeNumPlus1, nodeNumMinus1].forEach((node) => {
157
+ const oppNode = multiply(-1, node).simplify();
158
+ const value = node.evaluate();
159
+ if (value !== 0 && value !== 1) {
160
+ tryToAddWrongProp(propositions, oppNode.toTex());
161
+ }
162
+ });
163
+ }
164
+ }
165
+ }
166
+ propWhile(propositions, n, () => {
167
+ tryToAddWrongProp(propositions, randint(-3, 3, [0]).frenchify());
168
+ });
169
+ return shuffleProps(propositions, n);
170
+ };
171
+ const getHomothetyFactorFromPointsQuestion = (optsIn) => {
172
+ const opts = optsIn ?? optsDefault;
173
+ const { isPositiveFactorOnly, factorTypes } = opts;
174
+ const factorType = random(factorTypes);
175
+ function createRandomPoints() {
176
+ const points = [];
177
+ for (let i = 0; i < 2; i++) {
178
+ const name = String.fromCharCode(65 + i);
179
+ const newPoint = doWhile(() => PointConstructor.random(name, -3, 4), (p) => points.some((p2) => p.distanceTo(p2) < 2));
180
+ points.push(newPoint);
181
+ }
182
+ return points;
183
+ }
184
+ function createRandomIdentifiers() {
185
+ const points = createRandomPoints();
186
+ const [pointCenter, pointSrc] = randomMany(points, 2);
187
+ const vec1 = VectorConstructor.fromPoints(pointCenter, pointSrc);
188
+ const factorNode = getRandomFactorNodeForVector(vec1, isPositiveFactorOnly, [1], factorType).simplify();
189
+ const pointDst = vec1
190
+ .times(factorNode)
191
+ .getEndPoint(pointCenter, String.fromCharCode(65 + points.length));
192
+ points.push(pointDst);
193
+ const identifiersRaw = {
194
+ pointsDict: Object.fromEntries(points.map((p) => [p.name, p.toIdentifiers()])),
195
+ nameCenterPoint: pointCenter.name,
196
+ nameSrcPoint: pointSrc.name,
197
+ nameDstPoint: pointDst.name,
198
+ };
199
+ //shuffle
200
+ const pointNamesRaw = Object.keys(identifiersRaw.pointsDict);
201
+ const shuffleDict = Object.fromEntries(shuffle(pointNamesRaw).map((pointNameOld, i) => [
202
+ pointNameOld,
203
+ pointNamesRaw[i],
204
+ ]));
205
+ const identifiersShuffled = {
206
+ pointsDict: Object.fromEntries(Object.entries(identifiersRaw.pointsDict).map(([pointNameOld, pointIds]) => {
207
+ const pointNameNew = shuffleDict[pointNameOld];
208
+ return [
209
+ pointNameNew,
210
+ Object.assign({}, pointIds, { name: pointNameNew }),
211
+ ];
212
+ })),
213
+ nameCenterPoint: shuffleDict[pointCenter.name],
214
+ nameSrcPoint: shuffleDict[pointSrc.name],
215
+ nameDstPoint: shuffleDict[pointDst.name],
216
+ };
217
+ return identifiersShuffled;
218
+ }
219
+ const pointOrigin = new Point("O", 0, 0);
220
+ let identifiers;
221
+ let counter = -1;
222
+ let isValidIdentifiers = false;
223
+ while (!isValidIdentifiers && counter < 100) {
224
+ counter++;
225
+ try {
226
+ identifiers = createRandomIdentifiers();
227
+ }
228
+ catch (_) {
229
+ continue;
230
+ }
231
+ const points = Object.values(identifiers.pointsDict).map((pointIds) => PointConstructor.fromIdentifiers(pointIds));
232
+ const isPointsDistinct = [...new Set(points.map((point) => point.toCoords()))].length ===
233
+ points.length;
234
+ const isPointsCloseToOrigin = points.every((point) => point.distanceTo(pointOrigin) < 10);
235
+ isValidIdentifiers = isPointsDistinct && isPointsCloseToOrigin;
236
+ }
237
+ // const identifiers = createRandomIdentifiers(points);
238
+ const defaultIdentifiers = {
239
+ pointsDict: Object.fromEntries([
240
+ new Point("O", 0, 0),
241
+ new Point("A", 5, 0),
242
+ new Point("B", 0, 5),
243
+ new Point("C", -5, 0),
244
+ new Point("D", 0, -5),
245
+ ].map((point) => [point.name, point.toIdentifiers()])),
246
+ nameSrcPoint: "A",
247
+ nameCenterPoint: "O",
248
+ nameDstPoint: "C",
249
+ };
250
+ return getQuestionFromIdentifiers(identifiers ?? defaultIdentifiers, opts);
251
+ };
252
+ const getQuestionFromIdentifiers = (identifiers, opts) => {
253
+ const question = {
254
+ answer: getAnswer(identifiers, opts),
255
+ instruction: getInstruction(identifiers, opts),
256
+ ggbOptions: getGGBOptions(identifiers, opts),
257
+ keys: [],
258
+ identifiers,
259
+ hint: getHint(identifiers, opts),
260
+ correction: getCorrection(identifiers, opts),
261
+ };
262
+ return question;
263
+ };
264
+ const options = [
265
+ {
266
+ id: "isPositiveFactorOnly",
267
+ label: "Rapports positifs uniquement",
268
+ type: GeneratorOptionType.checkbox,
269
+ target: GeneratorOptionTarget.generation,
270
+ defaultValue: false,
271
+ },
272
+ {
273
+ id: "factorTypes",
274
+ label: "Rapport: type de nombre",
275
+ type: GeneratorOptionType.multiselect,
276
+ target: GeneratorOptionTarget.generation,
277
+ values: ["entier", "fraction"],
278
+ defaultValue: ["entier", "fraction"],
279
+ },
280
+ ];
281
+ const optsDefault = {
282
+ isPositiveFactorOnly: false,
283
+ factorTypes: ["entier", "fraction"],
284
+ };
285
+ export const homothetyFactorFromPoints = {
286
+ id: "homothetyFactorFromPoints",
287
+ label: "Trouver le rapport d'une homothétie",
288
+ isSingleStep: true,
289
+ generator: (nb, opts) => getDistinctQuestions(() => getHomothetyFactorFromPointsQuestion(opts), nb),
290
+ ggbTimer: 60,
291
+ subject: "Mathématiques",
292
+ getHint,
293
+ getCorrection,
294
+ getGGBOptions,
295
+ hasGeogebra: true,
296
+ options,
297
+ getQuestionFromIdentifiers,
298
+ hasHintAndCorrection: true,
299
+ isAnswerValid,
300
+ getPropositions,
301
+ };
@@ -1,3 +1,10 @@
1
1
  export * from "./pythagoreOrThales.js";
2
2
  export * from "./orthogonalProjectFromPicture.js";
3
+ export * from "./pinPointFromAxialOrCentralSymmetry.js";
4
+ export * from "./pinPointFromRotation.js";
5
+ export * from "./recognizeAngleFromRotation.js";
6
+ export * from "./pinSegmentFromRotation.js";
7
+ export * from "./pinPointFromTranslation.js";
8
+ export * from "./homothetyFactorFromPoints.js";
9
+ export * from "./recognizeHomothetyCenter.js";
3
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/euclidian/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,mCAAmC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/euclidian/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,mCAAmC,CAAC;AAClD,cAAc,yCAAyC,CAAC;AACxD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iCAAiC,CAAC;AAChD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,+BAA+B,CAAC"}
@@ -1,2 +1,9 @@
1
1
  export * from "./pythagoreOrThales.js";
2
2
  export * from "./orthogonalProjectFromPicture.js";
3
+ export * from "./pinPointFromAxialOrCentralSymmetry.js";
4
+ export * from "./pinPointFromRotation.js";
5
+ export * from "./recognizeAngleFromRotation.js";
6
+ export * from "./pinSegmentFromRotation.js";
7
+ export * from "./pinPointFromTranslation.js";
8
+ export * from "./homothetyFactorFromPoints.js";
9
+ export * from "./recognizeHomothetyCenter.js";
@@ -0,0 +1,21 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ import { PointIdentifiers } from "../../../../math/geometry/point.js";
3
+ type TransformationIdentifiers = {
4
+ type: string;
5
+ point1: PointIdentifiers;
6
+ point2?: PointIdentifiers;
7
+ };
8
+ type Identifiers = {
9
+ pointsDict: Record<string, PointIdentifiers>;
10
+ segments: string[];
11
+ transformationIds: TransformationIdentifiers;
12
+ namePointSrc: string;
13
+ namePointDst: string;
14
+ };
15
+ type Options = {
16
+ isForceDstDifferentFromSrc: boolean;
17
+ typeTransformation: string[];
18
+ };
19
+ export declare const pinPointFromAxialOrCentralSymmetry: Exercise<Identifiers, Options>;
20
+ export {};
21
+ //# sourceMappingURL=pinPointFromAxialOrCentralSymmetry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pinPointFromAxialOrCentralSymmetry.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/euclidian/pinPointFromAxialOrCentralSymmetry.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAOrC,OAAO,EAGL,gBAAgB,EACjB,MAAM,8BAA8B,CAAC;AA6JtC,KAAK,yBAAyB,GAAG;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,gBAAgB,CAAC;IACzB,MAAM,CAAC,EAAE,gBAAgB,CAAC;CAC3B,CAAC;AAEF,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IAC7C,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,iBAAiB,EAAE,yBAAyB,CAAC;IAC7C,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAyXF,KAAK,OAAO,GAAG;IACb,0BAA0B,EAAE,OAAO,CAAC;IACpC,kBAAkB,EAAE,MAAM,EAAE,CAAC;CAC9B,CAAC;AAyBF,eAAO,MAAM,kCAAkC,EAAE,QAAQ,CACvD,WAAW,EACX,OAAO,CAoBR,CAAC"}