math-exercises 3.0.214 → 3.0.215

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 (266) hide show
  1. package/lib/exercises/math/arithmetic/findLeftInHugeNumberDivision.d.ts +9 -0
  2. package/lib/exercises/math/arithmetic/findLeftInHugeNumberDivision.d.ts.map +1 -0
  3. package/lib/exercises/math/arithmetic/findLeftInHugeNumberDivision.js +194 -0
  4. package/lib/exercises/math/arithmetic/findMissingNumberToMakeNumberDivisibleBy9.d.ts +8 -0
  5. package/lib/exercises/math/arithmetic/findMissingNumberToMakeNumberDivisibleBy9.d.ts.map +1 -0
  6. package/lib/exercises/math/arithmetic/findMissingNumberToMakeNumberDivisibleBy9.js +121 -0
  7. package/lib/exercises/math/arithmetic/index.d.ts +7 -0
  8. package/lib/exercises/math/arithmetic/index.d.ts.map +1 -1
  9. package/lib/exercises/math/arithmetic/index.js +7 -0
  10. package/lib/exercises/math/arithmetic/isBigNumberPrime.d.ts +7 -0
  11. package/lib/exercises/math/arithmetic/isBigNumberPrime.d.ts.map +1 -0
  12. package/lib/exercises/math/arithmetic/isBigNumberPrime.js +107 -0
  13. package/lib/exercises/math/arithmetic/numberOfEndingZerosOfBigProduct.d.ts +8 -0
  14. package/lib/exercises/math/arithmetic/numberOfEndingZerosOfBigProduct.d.ts.map +1 -0
  15. package/lib/exercises/math/arithmetic/numberOfEndingZerosOfBigProduct.js +139 -0
  16. package/lib/exercises/math/arithmetic/pgcdFromEuclid.d.ts +8 -0
  17. package/lib/exercises/math/arithmetic/pgcdFromEuclid.d.ts.map +1 -0
  18. package/lib/exercises/math/arithmetic/pgcdFromEuclid.js +123 -0
  19. package/lib/exercises/math/arithmetic/solveDiophantianEquationByUsingPrimality.d.ts +7 -0
  20. package/lib/exercises/math/arithmetic/solveDiophantianEquationByUsingPrimality.d.ts.map +1 -0
  21. package/lib/exercises/math/arithmetic/solveDiophantianEquationByUsingPrimality.js +117 -0
  22. package/lib/exercises/math/arithmetic/whichDayInXDays.d.ts +8 -0
  23. package/lib/exercises/math/arithmetic/whichDayInXDays.d.ts.map +1 -0
  24. package/lib/exercises/math/arithmetic/whichDayInXDays.js +81 -0
  25. package/lib/exercises/math/calcul/fractions/fractionsSumFillInTheBlank.d.ts +15 -0
  26. package/lib/exercises/math/calcul/fractions/fractionsSumFillInTheBlank.d.ts.map +1 -0
  27. package/lib/exercises/math/calcul/fractions/fractionsSumFillInTheBlank.js +256 -0
  28. package/lib/exercises/math/calcul/fractions/index.d.ts +1 -0
  29. package/lib/exercises/math/calcul/fractions/index.d.ts.map +1 -1
  30. package/lib/exercises/math/calcul/fractions/index.js +1 -0
  31. package/lib/exercises/math/calcul/index.d.ts +1 -0
  32. package/lib/exercises/math/calcul/index.d.ts.map +1 -1
  33. package/lib/exercises/math/calcul/index.js +1 -0
  34. package/lib/exercises/math/calcul/mentalCaluls/index.d.ts +3 -0
  35. package/lib/exercises/math/calcul/mentalCaluls/index.d.ts.map +1 -1
  36. package/lib/exercises/math/calcul/mentalCaluls/index.js +3 -0
  37. package/lib/exercises/math/calcul/mentalCaluls/mentalMultiplication101AndFriends.d.ts +10 -0
  38. package/lib/exercises/math/calcul/mentalCaluls/mentalMultiplication101AndFriends.d.ts.map +1 -0
  39. package/lib/exercises/math/calcul/mentalCaluls/mentalMultiplication101AndFriends.js +264 -0
  40. package/lib/exercises/math/calcul/mentalCaluls/mentalMultiplication11AndFriends.d.ts +10 -0
  41. package/lib/exercises/math/calcul/mentalCaluls/mentalMultiplication11AndFriends.d.ts.map +1 -0
  42. package/lib/exercises/math/calcul/mentalCaluls/mentalMultiplication11AndFriends.js +264 -0
  43. package/lib/exercises/math/calcul/mentalCaluls/mentalMultiplicationTable.d.ts +11 -0
  44. package/lib/exercises/math/calcul/mentalCaluls/mentalMultiplicationTable.d.ts.map +1 -0
  45. package/lib/exercises/math/calcul/mentalCaluls/mentalMultiplicationTable.js +141 -0
  46. package/lib/exercises/math/calcul/ratio/index.d.ts +1 -0
  47. package/lib/exercises/math/calcul/ratio/index.d.ts.map +1 -1
  48. package/lib/exercises/math/calcul/ratio/index.js +1 -0
  49. package/lib/exercises/math/calcul/ratio/partsUsingRatio.d.ts +13 -0
  50. package/lib/exercises/math/calcul/ratio/partsUsingRatio.d.ts.map +1 -0
  51. package/lib/exercises/math/calcul/ratio/partsUsingRatio.js +237 -0
  52. package/lib/exercises/math/calcul/relatives/index.d.ts +2 -0
  53. package/lib/exercises/math/calcul/relatives/index.d.ts.map +1 -0
  54. package/lib/exercises/math/calcul/relatives/index.js +1 -0
  55. package/lib/exercises/math/calcul/relatives/relativesAddAndSub.d.ts +17 -0
  56. package/lib/exercises/math/calcul/relatives/relativesAddAndSub.d.ts.map +1 -0
  57. package/lib/exercises/math/calcul/relatives/relativesAddAndSub.js +448 -0
  58. package/lib/exercises/math/calculLitteral/factorisation/factoByXK.d.ts +10 -0
  59. package/lib/exercises/math/calculLitteral/factorisation/factoByXK.d.ts.map +1 -0
  60. package/lib/exercises/math/calculLitteral/factorisation/factoByXK.js +190 -0
  61. package/lib/exercises/math/calculLitteral/factorisation/index.d.ts +1 -0
  62. package/lib/exercises/math/calculLitteral/factorisation/index.d.ts.map +1 -1
  63. package/lib/exercises/math/calculLitteral/factorisation/index.js +1 -0
  64. package/lib/exercises/math/complex/algebraic/addComplex.d.ts +10 -0
  65. package/lib/exercises/math/complex/algebraic/addComplex.d.ts.map +1 -0
  66. package/lib/exercises/math/complex/algebraic/addComplex.js +125 -0
  67. package/lib/exercises/math/complex/algebraic/conjugateComplex.d.ts +8 -0
  68. package/lib/exercises/math/complex/algebraic/conjugateComplex.d.ts.map +1 -0
  69. package/lib/exercises/math/complex/algebraic/conjugateComplex.js +105 -0
  70. package/lib/exercises/math/complex/algebraic/conjugateDivideComplex.d.ts +8 -0
  71. package/lib/exercises/math/complex/algebraic/conjugateDivideComplex.d.ts.map +1 -0
  72. package/lib/exercises/math/complex/algebraic/conjugateDivideComplex.js +137 -0
  73. package/lib/exercises/math/complex/algebraic/conjugateMultiplyComplex.d.ts +8 -0
  74. package/lib/exercises/math/complex/algebraic/conjugateMultiplyComplex.d.ts.map +1 -0
  75. package/lib/exercises/math/complex/algebraic/conjugateMultiplyComplex.js +116 -0
  76. package/lib/exercises/math/complex/algebraic/divideComplex.d.ts +8 -0
  77. package/lib/exercises/math/complex/algebraic/divideComplex.d.ts.map +1 -0
  78. package/lib/exercises/math/complex/algebraic/divideComplex.js +128 -0
  79. package/lib/exercises/math/complex/algebraic/index.d.ts +11 -0
  80. package/lib/exercises/math/complex/algebraic/index.d.ts.map +1 -0
  81. package/lib/exercises/math/complex/algebraic/index.js +10 -0
  82. package/lib/exercises/math/complex/algebraic/inverseComplex.d.ts +8 -0
  83. package/lib/exercises/math/complex/algebraic/inverseComplex.d.ts.map +1 -0
  84. package/lib/exercises/math/complex/algebraic/inverseComplex.js +95 -0
  85. package/lib/exercises/math/complex/algebraic/linearCombinaisonComplex.d.ts +10 -0
  86. package/lib/exercises/math/complex/algebraic/linearCombinaisonComplex.d.ts.map +1 -0
  87. package/lib/exercises/math/complex/algebraic/linearCombinaisonComplex.js +105 -0
  88. package/lib/exercises/math/complex/algebraic/moduloFromAlgebraicComplex.d.ts +8 -0
  89. package/lib/exercises/math/complex/algebraic/moduloFromAlgebraicComplex.d.ts.map +1 -0
  90. package/lib/exercises/math/complex/algebraic/moduloFromAlgebraicComplex.js +93 -0
  91. package/lib/exercises/math/complex/algebraic/mutiplyComplex.d.ts +8 -0
  92. package/lib/exercises/math/complex/algebraic/mutiplyComplex.d.ts.map +1 -0
  93. package/lib/exercises/math/complex/algebraic/mutiplyComplex.js +106 -0
  94. package/lib/exercises/math/complex/algebraic/reAndIm.d.ts +9 -0
  95. package/lib/exercises/math/complex/algebraic/reAndIm.d.ts.map +1 -0
  96. package/lib/exercises/math/complex/algebraic/reAndIm.js +92 -0
  97. package/lib/exercises/math/complex/geometric/complexAlgebraicFromModuloAndArg.d.ts +9 -0
  98. package/lib/exercises/math/complex/geometric/complexAlgebraicFromModuloAndArg.d.ts.map +1 -0
  99. package/lib/exercises/math/complex/geometric/complexAlgebraicFromModuloAndArg.js +151 -0
  100. package/lib/exercises/math/complex/geometric/complexDistance.d.ts +11 -0
  101. package/lib/exercises/math/complex/geometric/complexDistance.d.ts.map +1 -0
  102. package/lib/exercises/math/complex/geometric/complexDistance.js +125 -0
  103. package/lib/exercises/math/complex/geometric/complexGeomAffixAlgFromPoint.d.ts +9 -0
  104. package/lib/exercises/math/complex/geometric/complexGeomAffixAlgFromPoint.d.ts.map +1 -0
  105. package/lib/exercises/math/complex/geometric/complexGeomAffixAlgFromPoint.js +326 -0
  106. package/lib/exercises/math/complex/geometric/complexGeomAffixExpFromCenteredRegularPolygon.d.ts +10 -0
  107. package/lib/exercises/math/complex/geometric/complexGeomAffixExpFromCenteredRegularPolygon.d.ts.map +1 -0
  108. package/lib/exercises/math/complex/geometric/complexGeomAffixExpFromCenteredRegularPolygon.js +459 -0
  109. package/lib/exercises/math/complex/geometric/complexGeomAffixExpFromPoint.d.ts +14 -0
  110. package/lib/exercises/math/complex/geometric/complexGeomAffixExpFromPoint.d.ts.map +1 -0
  111. package/lib/exercises/math/complex/geometric/complexGeomAffixExpFromPoint.js +539 -0
  112. package/lib/exercises/math/complex/geometric/complexGeomAffixTrigFromPoint.d.ts +13 -0
  113. package/lib/exercises/math/complex/geometric/complexGeomAffixTrigFromPoint.d.ts.map +1 -0
  114. package/lib/exercises/math/complex/geometric/complexGeomAffixTrigFromPoint.js +485 -0
  115. package/lib/exercises/math/complex/geometric/complexGeomApproxOfCosArgOrSinArgFromPointAndAffixTrig.d.ts +12 -0
  116. package/lib/exercises/math/complex/geometric/complexGeomApproxOfCosArgOrSinArgFromPointAndAffixTrig.d.ts.map +1 -0
  117. package/lib/exercises/math/complex/geometric/complexGeomApproxOfCosArgOrSinArgFromPointAndAffixTrig.js +224 -0
  118. package/lib/exercises/math/complex/geometric/complexGeomArgumentOfFracCBABFromFigure.d.ts +11 -0
  119. package/lib/exercises/math/complex/geometric/complexGeomArgumentOfFracCBABFromFigure.d.ts.map +1 -0
  120. package/lib/exercises/math/complex/geometric/complexGeomArgumentOfFracCBABFromFigure.js +448 -0
  121. package/lib/exercises/math/complex/geometric/complexGeomFindPointFromAffixExp.d.ts +11 -0
  122. package/lib/exercises/math/complex/geometric/complexGeomFindPointFromAffixExp.d.ts.map +1 -0
  123. package/lib/exercises/math/complex/geometric/complexGeomFindPointFromAffixExp.js +223 -0
  124. package/lib/exercises/math/complex/geometric/complexGeomFindPointFromPowerOfUnitRootFromFigure.d.ts +11 -0
  125. package/lib/exercises/math/complex/geometric/complexGeomFindPointFromPowerOfUnitRootFromFigure.d.ts.map +1 -0
  126. package/lib/exercises/math/complex/geometric/complexGeomFindPointFromPowerOfUnitRootFromFigure.js +348 -0
  127. package/lib/exercises/math/complex/geometric/complexGeomPlaceAffixPoint.d.ts +8 -0
  128. package/lib/exercises/math/complex/geometric/complexGeomPlaceAffixPoint.d.ts.map +1 -0
  129. package/lib/exercises/math/complex/geometric/complexGeomPlaceAffixPoint.js +86 -0
  130. package/lib/exercises/math/complex/geometric/complexGeomPlacePointFromZAPlusZ.d.ts +11 -0
  131. package/lib/exercises/math/complex/geometric/complexGeomPlacePointFromZAPlusZ.d.ts.map +1 -0
  132. package/lib/exercises/math/complex/geometric/complexGeomPlacePointFromZAPlusZ.js +311 -0
  133. package/lib/exercises/math/complex/geometric/complexGeomPlacePointFromZATimesZ.d.ts +11 -0
  134. package/lib/exercises/math/complex/geometric/complexGeomPlacePointFromZATimesZ.d.ts.map +1 -0
  135. package/lib/exercises/math/complex/geometric/complexGeomPlacePointFromZATimesZ.js +345 -0
  136. package/lib/exercises/math/complex/geometric/complexGeomPlacePointFromZATransformed.d.ts +16 -0
  137. package/lib/exercises/math/complex/geometric/complexGeomPlacePointFromZATransformed.d.ts.map +1 -0
  138. package/lib/exercises/math/complex/geometric/complexGeomPlacePointFromZATransformed.js +729 -0
  139. package/lib/exercises/math/complex/geometric/complexGeomPlacePointWithAffixInU.d.ts +11 -0
  140. package/lib/exercises/math/complex/geometric/complexGeomPlacePointWithAffixInU.d.ts.map +1 -0
  141. package/lib/exercises/math/complex/geometric/complexGeomPlacePointWithAffixInU.js +253 -0
  142. package/lib/exercises/math/complex/geometric/index.d.ts +12 -0
  143. package/lib/exercises/math/complex/geometric/index.d.ts.map +1 -0
  144. package/lib/exercises/math/complex/geometric/index.js +19 -0
  145. package/lib/exercises/math/complex/index.d.ts +4 -10
  146. package/lib/exercises/math/complex/index.d.ts.map +1 -1
  147. package/lib/exercises/math/complex/index.js +4 -11
  148. package/lib/exercises/math/complex/polynomials/factorizePolynomialInC.d.ts +10 -0
  149. package/lib/exercises/math/complex/polynomials/factorizePolynomialInC.d.ts.map +1 -0
  150. package/lib/exercises/math/complex/polynomials/factorizePolynomialInC.js +176 -0
  151. package/lib/exercises/math/complex/polynomials/index.d.ts +4 -0
  152. package/lib/exercises/math/complex/polynomials/index.d.ts.map +1 -0
  153. package/lib/exercises/math/complex/polynomials/index.js +3 -0
  154. package/lib/exercises/math/complex/polynomials/solveSecondDegreeInComplex.d.ts +10 -0
  155. package/lib/exercises/math/complex/polynomials/solveSecondDegreeInComplex.d.ts.map +1 -0
  156. package/lib/exercises/math/complex/polynomials/solveSecondDegreeInComplex.js +190 -0
  157. package/lib/exercises/math/complex/polynomials/solveZSquareEqualsA.d.ts +11 -0
  158. package/lib/exercises/math/complex/polynomials/solveZSquareEqualsA.d.ts.map +1 -0
  159. package/lib/exercises/math/complex/polynomials/solveZSquareEqualsA.js +158 -0
  160. package/lib/exercises/math/complex/unitRoots/giveNUnitRoot.d.ts +7 -0
  161. package/lib/exercises/math/complex/unitRoots/giveNUnitRoot.d.ts.map +1 -0
  162. package/lib/exercises/math/complex/unitRoots/giveNUnitRoot.js +122 -0
  163. package/lib/exercises/math/complex/unitRoots/giveOneSolutionToComplexPowNEqualsOne.d.ts +8 -0
  164. package/lib/exercises/math/complex/unitRoots/giveOneSolutionToComplexPowNEqualsOne.d.ts.map +1 -0
  165. package/lib/exercises/math/complex/unitRoots/giveOneSolutionToComplexPowNEqualsOne.js +138 -0
  166. package/lib/exercises/math/complex/unitRoots/index.d.ts +3 -0
  167. package/lib/exercises/math/complex/unitRoots/index.d.ts.map +1 -0
  168. package/lib/exercises/math/complex/unitRoots/index.js +2 -0
  169. package/lib/exercises/math/conversion/clock/clockReading.d.ts +12 -0
  170. package/lib/exercises/math/conversion/clock/clockReading.d.ts.map +1 -0
  171. package/lib/exercises/math/conversion/clock/clockReading.js +385 -0
  172. package/lib/exercises/math/conversion/clock/clockReadingPlusTimeOperation.d.ts +2 -0
  173. package/lib/exercises/math/conversion/clock/clockReadingPlusTimeOperation.d.ts.map +1 -0
  174. package/lib/exercises/math/conversion/clock/clockReadingPlusTimeOperation.js +521 -0
  175. package/lib/exercises/math/conversion/clock/clockWritingByManipulatingNeedles.d.ts +2 -0
  176. package/lib/exercises/math/conversion/clock/clockWritingByManipulatingNeedles.d.ts.map +1 -0
  177. package/lib/exercises/math/conversion/clock/clockWritingByManipulatingNeedles.js +359 -0
  178. package/lib/exercises/math/conversion/clock/dateTimeOperationAdd.d.ts +16 -0
  179. package/lib/exercises/math/conversion/clock/dateTimeOperationAdd.d.ts.map +1 -0
  180. package/lib/exercises/math/conversion/clock/dateTimeOperationAdd.js +319 -0
  181. package/lib/exercises/math/conversion/clock/index.d.ts +3 -0
  182. package/lib/exercises/math/conversion/clock/index.d.ts.map +1 -0
  183. package/lib/exercises/math/conversion/clock/index.js +4 -0
  184. package/lib/exercises/math/conversion/index.d.ts +1 -0
  185. package/lib/exercises/math/conversion/index.d.ts.map +1 -1
  186. package/lib/exercises/math/conversion/index.js +1 -0
  187. package/lib/exercises/math/geometry/angles/angleNatureFromFigure.d.ts +11 -0
  188. package/lib/exercises/math/geometry/angles/angleNatureFromFigure.d.ts.map +1 -0
  189. package/lib/exercises/math/geometry/angles/angleNatureFromFigure.js +233 -0
  190. package/lib/exercises/math/geometry/angles/angleNatureFromMeasure.d.ts +10 -0
  191. package/lib/exercises/math/geometry/angles/angleNatureFromMeasure.d.ts.map +1 -0
  192. package/lib/exercises/math/geometry/angles/angleNatureFromMeasure.js +137 -0
  193. package/lib/exercises/math/geometry/angles/index.d.ts +2 -0
  194. package/lib/exercises/math/geometry/angles/index.d.ts.map +1 -1
  195. package/lib/exercises/math/geometry/angles/index.js +2 -0
  196. package/lib/exercises/math/geometry/circles/buildCircleFromRadius.d.ts +9 -0
  197. package/lib/exercises/math/geometry/circles/buildCircleFromRadius.d.ts.map +1 -0
  198. package/lib/exercises/math/geometry/circles/buildCircleFromRadius.js +187 -0
  199. package/lib/exercises/math/geometry/circles/index.d.ts +1 -0
  200. package/lib/exercises/math/geometry/circles/index.d.ts.map +1 -1
  201. package/lib/exercises/math/geometry/circles/index.js +1 -0
  202. package/lib/exercises/math/geometry/lines/buildParallelFromLineAndPoint.d.ts +11 -0
  203. package/lib/exercises/math/geometry/lines/buildParallelFromLineAndPoint.d.ts.map +1 -0
  204. package/lib/exercises/math/geometry/lines/buildParallelFromLineAndPoint.js +154 -0
  205. package/lib/exercises/math/geometry/lines/buildPerpendicularFromLineAndPoint.d.ts +11 -0
  206. package/lib/exercises/math/geometry/lines/buildPerpendicularFromLineAndPoint.d.ts.map +1 -0
  207. package/lib/exercises/math/geometry/lines/buildPerpendicularFromLineAndPoint.js +157 -0
  208. package/lib/exercises/math/geometry/lines/index.d.ts +2 -0
  209. package/lib/exercises/math/geometry/lines/index.d.ts.map +1 -1
  210. package/lib/exercises/math/geometry/lines/index.js +2 -0
  211. package/lib/exercises/math/geometry/triangles/index.d.ts +2 -0
  212. package/lib/exercises/math/geometry/triangles/index.d.ts.map +1 -1
  213. package/lib/exercises/math/geometry/triangles/index.js +2 -1
  214. package/lib/exercises/math/geometry/triangles/traceHeightInTriangle.d.ts +13 -0
  215. package/lib/exercises/math/geometry/triangles/traceHeightInTriangle.d.ts.map +1 -0
  216. package/lib/exercises/math/geometry/triangles/traceHeightInTriangle.js +271 -0
  217. package/lib/exercises/math/geometry/triangles/traceMedianInTriangle.d.ts +8 -0
  218. package/lib/exercises/math/geometry/triangles/traceMedianInTriangle.d.ts.map +1 -1
  219. package/lib/exercises/math/geometry/triangles/traceMedianInTriangle.js +284 -53
  220. package/lib/exercises/math/geometry/vectors/constructions/index.d.ts +1 -0
  221. package/lib/exercises/math/geometry/vectors/constructions/index.d.ts.map +1 -1
  222. package/lib/exercises/math/geometry/vectors/constructions/index.js +1 -0
  223. package/lib/exercises/math/geometry/vectors/constructions/traceVectorSumFromVecs.d.ts +8 -0
  224. package/lib/exercises/math/geometry/vectors/constructions/traceVectorSumFromVecs.d.ts.map +1 -0
  225. package/lib/exercises/math/geometry/vectors/constructions/traceVectorSumFromVecs.js +165 -0
  226. package/lib/exercises/math/geometry/volumes/index.d.ts +1 -0
  227. package/lib/exercises/math/geometry/volumes/index.d.ts.map +1 -1
  228. package/lib/exercises/math/geometry/volumes/index.js +1 -0
  229. package/lib/exercises/math/geometry/volumes/volumeOfCylinder.d.ts +8 -0
  230. package/lib/exercises/math/geometry/volumes/volumeOfCylinder.d.ts.map +1 -0
  231. package/lib/exercises/math/geometry/volumes/volumeOfCylinder.js +157 -0
  232. package/lib/exercises/math/spaceGeometry/basis/index.d.ts +1 -0
  233. package/lib/exercises/math/spaceGeometry/basis/index.d.ts.map +1 -1
  234. package/lib/exercises/math/spaceGeometry/basis/index.js +1 -0
  235. package/lib/exercises/math/spaceGeometry/basis/spaceSegmentLengthInRectangularPrism.d.ts +18 -0
  236. package/lib/exercises/math/spaceGeometry/basis/spaceSegmentLengthInRectangularPrism.d.ts.map +1 -0
  237. package/lib/exercises/math/spaceGeometry/basis/spaceSegmentLengthInRectangularPrism.js +538 -0
  238. package/lib/exercises/math/trigonometry/formulas/trigoAdditionFormulaUsage.d.ts.map +1 -1
  239. package/lib/exercises/math/trigonometry/formulas/trigoAdditionFormulaUsage.js +6 -5
  240. package/lib/exercises/math/trigonometry/triangle/trigonometrySohcahtoaCalcul.js +1 -1
  241. package/lib/exercises/utils/geogebra/toolBarConstructor.d.ts +1 -0
  242. package/lib/exercises/utils/geogebra/toolBarConstructor.d.ts.map +1 -1
  243. package/lib/exercises/utils/geogebra/toolBarConstructor.js +2 -0
  244. package/lib/geogebra/parsers/geogebraParser.d.ts +3 -0
  245. package/lib/geogebra/parsers/geogebraParser.d.ts.map +1 -1
  246. package/lib/geogebra/parsers/geogebraParser.js +27 -0
  247. package/lib/index.d.ts +213 -23
  248. package/lib/index.d.ts.map +1 -1
  249. package/lib/latexTester.js +2 -0
  250. package/lib/math/geometry/angle.d.ts.map +1 -1
  251. package/lib/math/geometry/angle.js +3 -0
  252. package/lib/math/geometry/segment.d.ts +1 -1
  253. package/lib/math/geometry/segment.d.ts.map +1 -1
  254. package/lib/math/geometry/segment.js +5 -2
  255. package/lib/math/utils/geometry/angleBetweenPoints.d.ts +4 -0
  256. package/lib/math/utils/geometry/angleBetweenPoints.d.ts.map +1 -0
  257. package/lib/math/utils/geometry/angleBetweenPoints.js +58 -0
  258. package/lib/math/utils/geometry/angleNWSE.d.ts +3 -0
  259. package/lib/math/utils/geometry/angleNWSE.d.ts.map +1 -0
  260. package/lib/math/utils/geometry/angleNWSE.js +56 -0
  261. package/lib/tests/singleExo.test.d.ts.map +1 -1
  262. package/lib/tests/singleExo.test.js +2 -2
  263. package/lib/utils/strings/frenchDays.d.ts +2 -0
  264. package/lib/utils/strings/frenchDays.d.ts.map +1 -0
  265. package/lib/utils/strings/frenchDays.js +9 -0
  266. package/package.json +1 -1
@@ -0,0 +1,271 @@
1
+ import { GeneratorOptionTarget, GeneratorOptionType, } from "../../../../exercises/exercise.js";
2
+ import { toolBarConstructor } from "../../../../exercises/utils/geogebra/toolBarConstructor.js";
3
+ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
4
+ import { defaultArrayedOptsWhereNeeded } from "../../../../exercises/utils/options/arrayedOptions.js";
5
+ import { greenMain } from "../../../../geogebra/colors.js";
6
+ import { GeogebraConstructor } from "../../../../geogebra/geogebraConstructor.js";
7
+ import { GeogebraParser } from "../../../../geogebra/parsers/geogebraParser.js";
8
+ import { Point, PointConstructor } from "../../../../math/geometry/point.js";
9
+ import { Triangle, TriangleConstructor, } from "../../../../math/geometry/triangles/triangle.js";
10
+ import { Vector } from "../../../../math/geometry/vector.js";
11
+ import { randint } from "../../../../math/utils/random/randint.js";
12
+ import { round } from "../../../../math/utils/round.js";
13
+ import { PiNode } from "../../../../tree/nodes/numbers/piNode.js";
14
+ import { add } from "../../../../tree/nodes/operators/addNode.js";
15
+ import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
16
+ import { substract } from "../../../../tree/nodes/operators/substractNode.js";
17
+ import { coinFlip } from "../../../../utils/alea/coinFlip.js";
18
+ import { random } from "../../../../utils/alea/random.js";
19
+ import { shuffle } from "../../../../utils/alea/shuffle.js";
20
+ import { zip } from "../../../../utils/arrays/arrayZip.js";
21
+ const degreesToRadians = (angleInDegrees, precision) => {
22
+ const oneOver180 = 0.00555555555555555;
23
+ return round(multiply(multiply(angleInDegrees, PiNode), oneOver180).evaluate(), precision);
24
+ };
25
+ const rotateVector = (vec, angle, name) => {
26
+ //x' = cos(t)*x -sin(t)*y
27
+ //y' = sin(t)*x + cos(t)*y
28
+ const cos = Math.cos(angle);
29
+ const sin = Math.sin(angle);
30
+ return new Vector(name, substract(multiply(cos, vec.x), multiply(sin, vec.y)).evaluate().toTree(), add(multiply(sin, vec.x), multiply(cos, vec.y)).evaluate().toTree());
31
+ };
32
+ const rotatePoint = (target, angle, center, name, precision = 2) => {
33
+ const vSrc = createVector(center, target, "vSrc", precision);
34
+ const vRotated = rotateVector(vSrc, angle, "vRotated");
35
+ return createPoint(add(center.x, vRotated.x).evaluate(), add(center.y, vRotated.y).evaluate(), name, precision);
36
+ };
37
+ const createVector = (from, to, name, precision = 5) => {
38
+ return new Vector(name, round(substract(to.x, from.x).evaluate(), precision).toTree(), round(substract(to.y, from.y).evaluate(), precision).toTree());
39
+ };
40
+ const createPoint = (x, y, name, precision = 5) => {
41
+ return new Point(name, round(x, precision), round(y, precision));
42
+ };
43
+ const getHydrated = (identifiers) => {
44
+ const { triangleIds } = identifiers;
45
+ const triangle = TriangleConstructor.fromIdentifiers(triangleIds);
46
+ const [point] = triangle.points;
47
+ const [segment] = triangle.sides;
48
+ return {
49
+ triangle,
50
+ point,
51
+ segment,
52
+ };
53
+ };
54
+ const getInstruction = (identifiers) => {
55
+ const { strNameTriangle } = identifiers;
56
+ const { point } = getHydrated(identifiers);
57
+ return `Avec les outils disponibles, construire la hauteur de $${strNameTriangle}$ issue de $${point.name}$.`;
58
+ };
59
+ const getGGBAnswer = (identifiers) => {
60
+ const { triangle, point, segment } = getHydrated(identifiers);
61
+ const ggbAnswer = [
62
+ ...getStudentGGBCommands(triangle),
63
+ `lPer = PerpendicularLine(${point.name},${segment.ggbName})`,
64
+ `SetColor(lPer, "${greenMain}")`,
65
+ `ang = Angle(${segment.ggbName}, lPer)`,
66
+ `lDashed = Line(${segment.pointA.name}, ${segment.pointB.name})`,
67
+ `SetLineStyle(lDashed, 2)`,
68
+ ];
69
+ return ggbAnswer;
70
+ };
71
+ const getHint = (identifiers) => {
72
+ const { point, segment } = getHydrated(identifiers);
73
+ return `Sélectionne l'outil Perpendiculaire dans Geogebra puis clique sur le segment $${segment.toTex()}$ puis sur le point $${point.name}$.`;
74
+ };
75
+ const getCorrection = (identifiers) => {
76
+ const { point, segment } = getHydrated(identifiers);
77
+ return `On sélectionne l'outil Perpendiculaire dans Geogebra puis on clique sur le segment $${segment.toTex()}$ puis sur le point $${point.name}$.`;
78
+ };
79
+ const getCorrectionGGBOptions = (identifiers) => {
80
+ const ggb = new GeogebraConstructor({
81
+ commands: [...getGGBAnswer(identifiers)],
82
+ hideGrid: true,
83
+ hideAxes: true,
84
+ isGridSimple: true,
85
+ fontSize: 16,
86
+ });
87
+ return ggb.getOptions({ coords: [-10, 10, -10, 10] });
88
+ };
89
+ const getStudentGGBCommands = (triangle) => {
90
+ const [point] = triangle.points;
91
+ const [segment] = triangle.sides;
92
+ return [
93
+ ...triangle.points.flatMap((point) => point.toGGBCommand({
94
+ isFixed: true,
95
+ isSelectionnable: true,
96
+ showLabel: true,
97
+ })),
98
+ ...triangle.sides.flatMap((segment) => segment.toGGBCommands(false, { isFixed: true, isSelectionnable: true })),
99
+ //force display of right angle (if needed)
100
+ ...(() => {
101
+ const [angleRightAngle] = triangle.angles.filter((angle) => Math.abs(angle.evaluate(false) - 90) < 0.3);
102
+ if (angleRightAngle !== undefined) {
103
+ if (angleRightAngle.evaluate() === 90) {
104
+ //display is already ok
105
+ return [
106
+ ...angleRightAngle.toCommands({
107
+ pointsAreNotBuilt: false,
108
+ showValue: false,
109
+ }),
110
+ ];
111
+ }
112
+ else {
113
+ if (angleRightAngle !== undefined) {
114
+ const [pointRightAngle1, pointRightAngle2, pointRightAngle3] = angleRightAngle.points;
115
+ return [
116
+ `lPer = PerpendicularLine(${pointRightAngle2.name},${segment.ggbName})`,
117
+ `SetVisibleInView(lPer, 1, false)`,
118
+ `lPer2 = PerpendicularLine(${point.name},lPer)`,
119
+ `SetVisibleInView(lPer2, 1, false)`,
120
+ `prjct = Intersect(lPer, lPer2)`,
121
+ `SetVisibleInView(prjct, 1, false)`,
122
+ //horror?
123
+ `ang1 = Angle(${pointRightAngle1.name},${pointRightAngle2.name}, prjct)`,
124
+ `ShowLabel(ang1, false)`,
125
+ `ang2 = Angle(prjct,${pointRightAngle2.name},${pointRightAngle1.name})`,
126
+ `ShowLabel(ang2, false)`,
127
+ `SetVisibleInView(ang1, 1, ang1<ang2)`,
128
+ `SetVisibleInView(ang2, 1, ang2<ang1)`,
129
+ `ang3 = Angle(${pointRightAngle3.name},${pointRightAngle2.name}, prjct)`,
130
+ `ShowLabel(ang3, false)`,
131
+ `ang4 = Angle(prjct,${pointRightAngle2.name},${pointRightAngle3.name})`,
132
+ `ShowLabel(ang4, false)`,
133
+ `SetVisibleInView(ang3, 1, ang3<ang4)`,
134
+ `SetVisibleInView(ang4, 1, ang4<ang3)`,
135
+ ];
136
+ }
137
+ else {
138
+ return [];
139
+ }
140
+ }
141
+ }
142
+ else {
143
+ return [];
144
+ }
145
+ })(),
146
+ ];
147
+ };
148
+ const getStudentGGBOptions = (identifiers) => {
149
+ const { triangle } = getHydrated(identifiers);
150
+ const commands = getStudentGGBCommands(triangle);
151
+ const studentGGB = new GeogebraConstructor({
152
+ commands,
153
+ hideGrid: true,
154
+ hideAxes: true,
155
+ customToolBar: toolBarConstructor({
156
+ orthogonal: true,
157
+ }),
158
+ });
159
+ return studentGGB.getOptions({
160
+ coords: studentGGB.getCoordsForPoints([...triangle.points]),
161
+ });
162
+ };
163
+ const isGGBAnswerValid = (ans, { ggbAnswer, ...identifiers }) => {
164
+ const { point, segment } = getHydrated(identifiers);
165
+ const commands = ans;
166
+ const ggbParser = new GeogebraParser(commands);
167
+ const objectDict = ggbParser.objectDict();
168
+ const arrStrOrthogonalLine = Object.entries(objectDict)
169
+ .filter(([_, strObj]) => strObj.startsWith("OrthogonalLine"))
170
+ .map(([_, strObj]) => strObj);
171
+ //required: only one orthogonal line
172
+ if (arrStrOrthogonalLine.length !== 1) {
173
+ return false;
174
+ }
175
+ const [strOrthogonalLine] = arrStrOrthogonalLine;
176
+ const [namePointAns, nameLineAns] = GeogebraParser.argNamesForOrthogonalLineObj(strOrthogonalLine);
177
+ return zip([namePointAns, nameLineAns], [point.name, segment.ggbName]).every(([strAns, strAnswer]) => strAns === strAnswer);
178
+ };
179
+ const getTraceHeightInTriangleQuestion = (optsIn) => {
180
+ const arrayedOpts = defaultArrayedOptsWhereNeeded(optsIn, arrayedOptsDefault);
181
+ const opts = {
182
+ heightType: random(arrayedOpts.heightType),
183
+ };
184
+ const [nameA, nameB, nameC] = shuffle(["A", "B", "C"]);
185
+ const [pointARaw, pointBRaw, pointCRaw] = (() => {
186
+ const a = -randint(4, 12);
187
+ const b = +randint(4, 12);
188
+ const pointA = PointConstructor.fromCoords([a, 0], nameA);
189
+ const pointB = PointConstructor.fromCoords([b, 0], nameB);
190
+ switch (opts.heightType) {
191
+ case "intérieure": {
192
+ const c = randint(a + 1, b);
193
+ const h = +randint(4, 12);
194
+ const pointC = PointConstructor.fromCoords([c, h], nameC);
195
+ return [pointA, pointB, pointC];
196
+ }
197
+ case "sur un cathète": {
198
+ const isLeftSide = coinFlip();
199
+ const c = isLeftSide ? a : b;
200
+ const h = +randint(4, 12);
201
+ const pointC = PointConstructor.fromCoords([c, h], nameC);
202
+ return [pointA, pointB, pointC];
203
+ }
204
+ case "extérieure": {
205
+ const isLeftSide = coinFlip();
206
+ const c = isLeftSide ? a - randint(2, 8) : b + randint(2, 8);
207
+ const h = +randint(4, 12);
208
+ const pointC = PointConstructor.fromCoords([c, h], nameC);
209
+ return [pointA, pointB, pointC];
210
+ }
211
+ default:
212
+ throw new Error("Unsupported heightType: " + opts.heightType);
213
+ }
214
+ })();
215
+ const [pointA, pointB, pointC] = (() => {
216
+ const pointOrigin = new Point("O", 0, 0);
217
+ const angleInDegrees = randint(0, 360);
218
+ return [pointARaw, pointBRaw, pointCRaw].map((point) => rotatePoint(point, degreesToRadians(angleInDegrees, 5), pointOrigin, point.name));
219
+ })();
220
+ const triangle = new Triangle([pointC, pointB, pointA]);
221
+ const strNameTriangle = shuffle(triangle.name.split("")).join("");
222
+ const identifiers = {
223
+ triangleIds: triangle.toIdentifiers(),
224
+ strNameTriangle,
225
+ };
226
+ return getQuestionFromIdentifiers(identifiers);
227
+ };
228
+ const getQuestionFromIdentifiers = (identifiers, opts) => {
229
+ const question = {
230
+ ggbAnswer: getGGBAnswer(identifiers, opts),
231
+ instruction: getInstruction(identifiers, opts),
232
+ keys: [],
233
+ answerFormat: "tex",
234
+ identifiers,
235
+ studentGgbOptions: getStudentGGBOptions(identifiers, opts),
236
+ hint: getHint(identifiers, opts),
237
+ correction: getCorrection(identifiers, opts),
238
+ correctionGgbOptions: getCorrectionGGBOptions(identifiers, opts),
239
+ };
240
+ return question;
241
+ };
242
+ const arrayedOptsDefault = {
243
+ heightType: ["intérieure"],
244
+ };
245
+ const options = [
246
+ {
247
+ id: "heightType",
248
+ label: "Type de hauteur",
249
+ target: GeneratorOptionTarget.generation,
250
+ type: GeneratorOptionType.multiselect,
251
+ values: ["intérieure", "sur un cathète", "extérieure"],
252
+ defaultValue: arrayedOptsDefault.heightType,
253
+ },
254
+ ];
255
+ export const traceHeightInTriangle = {
256
+ id: "traceHeightInTriangle",
257
+ connector: "=",
258
+ label: "Tracer une hauteur d'un triangle",
259
+ isSingleStep: true,
260
+ generator: (nb, opts) => getDistinctQuestions(() => getTraceHeightInTriangleQuestion(opts), nb),
261
+ options,
262
+ ggbTimer: 60,
263
+ isGGBAnswerValid,
264
+ subject: "Mathématiques",
265
+ answerType: "GGB",
266
+ getStudentGGBOptions,
267
+ getQuestionFromIdentifiers,
268
+ getHint,
269
+ getCorrection,
270
+ hasHintAndCorrection: true,
271
+ };
@@ -1,2 +1,10 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ import { TriangleIdentifiers } from "../../../../math/geometry/triangles/triangle.js";
3
+ /************/
4
+ type Identifiers = {
5
+ triangleIds: TriangleIdentifiers;
6
+ strNameTriangle: string;
7
+ };
8
+ export declare const traceMedianInTriangle: Exercise<Identifiers>;
1
9
  export {};
2
10
  //# sourceMappingURL=traceMedianInTriangle.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"traceMedianInTriangle.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/triangles/traceMedianInTriangle.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"traceMedianInTriangle.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/triangles/traceMedianInTriangle.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAWT,MAAM,6BAA6B,CAAC;AAOrC,OAAO,EAGL,mBAAmB,EACpB,MAAM,2CAA2C,CAAC;AAuEnD,cAAc;AAEd,KAAK,WAAW,GAAG;IACjB,WAAW,EAAE,mBAAmB,CAAC;IACjC,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC;AAqSF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,WAAW,CAgBvD,CAAC"}
@@ -1,53 +1,284 @@
1
- // import {
2
- // Exercise,
3
- // Proposition,
4
- // QCMGenerator,
5
- // Question,
6
- // QuestionGenerator,
7
- // VEA,
8
- // GGBVEA,
9
- // addValidProp,
10
- // shuffleProps,
11
- // tryToAddWrongProp,
12
- // } from '../../../../exercises/exercise.js';
13
- // import { getDistinctQuestions } from '../../../../exercises/utils/getDistinctQuestions.js';
14
- export {};
15
- // type Identifiers = {
16
- // };
17
- // const getTraceMedianInTriangleQuestion: QuestionGenerator<Identifiers> = ()=>{
18
- // const question: Question<Identifiers> = {
19
- // answer,
20
- // instruction: ``,
21
- // keys: [],
22
- // answerFormat: 'tex',
23
- // identifiers : {}
24
- // };
25
- // return question;
26
- // }
27
- // const getPropositions: QCMGenerator<Identifiers> = (n, { answer }) => {
28
- // const propositions: Proposition[] = [];
29
- // addValidProp(propositions, answer);
30
- // propWhile(propositions, n, () => {
31
- // throw Error("QCM not implemented")
32
- // }
33
- // return shuffleProps(propositions, n);
34
- // };
35
- // const isAnswerValid: VEA<Identifiers> = (ans, {answer})=>{
36
- // throw Error("VEA not implemented")
37
- // }
38
- // const isGGBAnswerValid: GGBVEA<Identifiers> = (ans, {ggbAnswer}) => {
39
- // throw Error("GGBVea not implemented")
40
- // }
41
- // export const traceMedianInTriangle: Exercise<Identifiers> = {
42
- // id: 'traceMedianInTriangle',
43
- // connector: "",
44
- // label: "",
45
- // isSingleStep: true,
46
- // generator: (nb: number) => getDistinctQuestions(getTraceMedianInTriangleQuestion, nb),
47
- // qcmTimer: 60,
48
- // freeTimer: 60,
49
- // getPropositions,
50
- // isAnswerValid,
51
- // isGGBAnswerValid,
52
- // subject: "Mathématiques"
53
- // };
1
+ import { toolBarConstructor } from "../../../../exercises/utils/geogebra/toolBarConstructor.js";
2
+ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { greenMain } from "../../../../geogebra/colors.js";
4
+ import { GeogebraConstructor } from "../../../../geogebra/geogebraConstructor.js";
5
+ import { GeogebraParser } from "../../../../geogebra/parsers/geogebraParser.js";
6
+ import { Point, PointConstructor } from "../../../../math/geometry/point.js";
7
+ import { Triangle, TriangleConstructor, } from "../../../../math/geometry/triangles/triangle.js";
8
+ import { Vector } from "../../../../math/geometry/vector.js";
9
+ import { randint } from "../../../../math/utils/random/randint.js";
10
+ import { round } from "../../../../math/utils/round.js";
11
+ import { PiNode } from "../../../../tree/nodes/numbers/piNode.js";
12
+ import { add } from "../../../../tree/nodes/operators/addNode.js";
13
+ import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
14
+ import { substract } from "../../../../tree/nodes/operators/substractNode.js";
15
+ import { coinFlip } from "../../../../utils/alea/coinFlip.js";
16
+ import { shuffle } from "../../../../utils/alea/shuffle.js";
17
+ import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
18
+ const degreesToRadians = (angleInDegrees, precision) => {
19
+ const oneOver180 = 0.00555555555555555;
20
+ return round(multiply(multiply(angleInDegrees, PiNode), oneOver180).evaluate(), precision);
21
+ };
22
+ const rotateVector = (vec, angle, name) => {
23
+ //x' = cos(t)*x -sin(t)*y
24
+ //y' = sin(t)*x + cos(t)*y
25
+ const cos = Math.cos(angle);
26
+ const sin = Math.sin(angle);
27
+ return new Vector(name, substract(multiply(cos, vec.x), multiply(sin, vec.y)).evaluate().toTree(), add(multiply(sin, vec.x), multiply(cos, vec.y)).evaluate().toTree());
28
+ };
29
+ const rotatePoint = (target, angle, center, name, precision = 2) => {
30
+ const vSrc = createVector(center, target, "vSrc", precision);
31
+ const vRotated = rotateVector(vSrc, angle, "vRotated");
32
+ return createPoint(add(center.x, vRotated.x).evaluate(), add(center.y, vRotated.y).evaluate(), name, precision);
33
+ };
34
+ const createVector = (from, to, name, precision = 5) => {
35
+ return new Vector(name, round(substract(to.x, from.x).evaluate(), precision).toTree(), round(substract(to.y, from.y).evaluate(), precision).toTree());
36
+ };
37
+ const createPoint = (x, y, name, precision = 5) => {
38
+ return new Point(name, round(x, precision), round(y, precision));
39
+ };
40
+ const getHydrated = (identifiers) => {
41
+ const { triangleIds } = identifiers;
42
+ const triangle = TriangleConstructor.fromIdentifiers(triangleIds);
43
+ const [point] = triangle.points;
44
+ const [segment] = triangle.sides;
45
+ return {
46
+ triangle,
47
+ point,
48
+ segment,
49
+ };
50
+ };
51
+ const getInstruction = (identifiers) => {
52
+ const { strNameTriangle } = identifiers;
53
+ const { point } = getHydrated(identifiers);
54
+ return `Avec les outils disponibles, construire la médiane de $${strNameTriangle}$ issue de $${point.name}$.`;
55
+ };
56
+ const getGGBAnswer = (identifiers) => {
57
+ const { triangle, point, segment } = getHydrated(identifiers);
58
+ const ggbAnswer = [
59
+ ...getStudentGGBCommands(triangle),
60
+ `M = Midpoint(${segment.pointA.name}, ${segment.pointB.name})`,
61
+ `lMed = Line(${point.name},M)`,
62
+ `SetColor(lMed, "${greenMain}")`,
63
+ ];
64
+ return ggbAnswer;
65
+ };
66
+ const getHint = (identifiers) => {
67
+ const { point } = getHydrated(identifiers);
68
+ return `La médiane issue du point $${point.name}$ est la droite qui relie $${point.name}$ avec le milieu du côté opposé à $${point.name}$.`;
69
+ };
70
+ const getCorrection = (identifiers) => {
71
+ const { point, segment } = getHydrated(identifiers);
72
+ return `On sélectionne l'outil Milieu dans Geogebra puis on clique sur le segment $${segment.toTex()}$. On sélectionne ensuite l'outil Droite pour relier le milieu qui vient d'être créé avec le point $${point.name}$.`;
73
+ };
74
+ const getCorrectionGGBOptions = (identifiers) => {
75
+ const ggb = new GeogebraConstructor({
76
+ commands: [...getGGBAnswer(identifiers)],
77
+ hideGrid: true,
78
+ hideAxes: true,
79
+ isGridSimple: true,
80
+ fontSize: 16,
81
+ });
82
+ return ggb.getOptions({ coords: [-10, 10, -10, 10] });
83
+ };
84
+ const getStudentGGBCommands = (triangle) => {
85
+ const [point] = triangle.points;
86
+ const [segment] = triangle.sides;
87
+ return [
88
+ ...triangle.points.flatMap((point) => point.toGGBCommand({
89
+ isFixed: true,
90
+ isSelectionnable: true,
91
+ showLabel: true,
92
+ })),
93
+ ...triangle.sides.flatMap((segment) => segment.toGGBCommands(false, { isFixed: true, isSelectionnable: true })),
94
+ //force display of right angle (if needed)
95
+ ...(() => {
96
+ const [angleRightAngle] = triangle.angles.filter((angle) => Math.abs(angle.evaluate(false) - 90) < 0.3);
97
+ if (angleRightAngle !== undefined) {
98
+ if (angleRightAngle.evaluate() === 90) {
99
+ //display is already ok
100
+ return [
101
+ ...angleRightAngle.toCommands({
102
+ pointsAreNotBuilt: false,
103
+ showValue: false,
104
+ }),
105
+ ];
106
+ }
107
+ else {
108
+ if (angleRightAngle !== undefined) {
109
+ const [pointRightAngle1, pointRightAngle2, pointRightAngle3] = angleRightAngle.points;
110
+ return [
111
+ `lPer = PerpendicularLine(${pointRightAngle2.name},${segment.ggbName})`,
112
+ `SetVisibleInView(lPer, 1, false)`,
113
+ `lPer2 = PerpendicularLine(${point.name},lPer)`,
114
+ `SetVisibleInView(lPer2, 1, false)`,
115
+ `prjct = Intersect(lPer, lPer2)`,
116
+ `SetVisibleInView(prjct, 1, false)`,
117
+ //horror?
118
+ `ang1 = Angle(${pointRightAngle1.name},${pointRightAngle2.name}, prjct)`,
119
+ `ShowLabel(ang1, false)`,
120
+ `ang2 = Angle(prjct,${pointRightAngle2.name},${pointRightAngle1.name})`,
121
+ `ShowLabel(ang2, false)`,
122
+ `SetVisibleInView(ang1, 1, ang1<ang2)`,
123
+ `SetVisibleInView(ang2, 1, ang2<ang1)`,
124
+ `ang3 = Angle(${pointRightAngle3.name},${pointRightAngle2.name}, prjct)`,
125
+ `ShowLabel(ang3, false)`,
126
+ `ang4 = Angle(prjct,${pointRightAngle2.name},${pointRightAngle3.name})`,
127
+ `ShowLabel(ang4, false)`,
128
+ `SetVisibleInView(ang3, 1, ang3<ang4)`,
129
+ `SetVisibleInView(ang4, 1, ang4<ang3)`,
130
+ ];
131
+ }
132
+ else {
133
+ return [];
134
+ }
135
+ }
136
+ }
137
+ else {
138
+ return [];
139
+ }
140
+ })(),
141
+ ];
142
+ };
143
+ const getStudentGGBOptions = (identifiers) => {
144
+ const { triangle } = getHydrated(identifiers);
145
+ const commands = getStudentGGBCommands(triangle);
146
+ const studentGGB = new GeogebraConstructor({
147
+ commands,
148
+ hideGrid: true,
149
+ hideAxes: true,
150
+ customToolBar: toolBarConstructor({
151
+ orthogonal: true,
152
+ midpoint: true,
153
+ join: true,
154
+ }),
155
+ });
156
+ return studentGGB.getOptions({
157
+ coords: studentGGB.getCoordsForPoints([...triangle.points]),
158
+ });
159
+ };
160
+ const isGGBAnswerValid = (ans, { ggbAnswer, ...identifiers }) => {
161
+ const { triangle, point, segment } = getHydrated(identifiers);
162
+ try {
163
+ const commands = ans;
164
+ const ggbParser = new GeogebraParser(commands);
165
+ const objectDict = ggbParser.objectDict();
166
+ const arrStrOrthogonalLine = Object.entries(objectDict)
167
+ .filter(([_, strObj]) => strObj.startsWith("OrthogonalLine"))
168
+ .map(([_, strObj]) => strObj);
169
+ //required: no orthogonal line
170
+ if (arrStrOrthogonalLine.length > 0) {
171
+ return false;
172
+ }
173
+ const arrStrLine = Object.entries(objectDict)
174
+ .filter(([_, strObj]) => strObj.startsWith("Line"))
175
+ .map(([_, strObj]) => strObj);
176
+ //required: only one line
177
+ if (arrStrLine.length !== 1) {
178
+ return false;
179
+ }
180
+ const [strLine] = arrStrLine;
181
+ const [namePoint1Ans, namePoint2Ans] = GeogebraParser.pointNamesForLineObj(strLine);
182
+ const [point1Ans, point2Ans] = [namePoint1Ans, namePoint2Ans].map((namePoint) => {
183
+ const pointCoords = ggbParser.pointCoords(namePoint);
184
+ if (pointCoords) {
185
+ const point = PointConstructor.fromCoords(pointCoords, namePoint);
186
+ return point;
187
+ }
188
+ else {
189
+ const [point] = triangle.points.filter((point) => point.name === namePoint);
190
+ return point;
191
+ }
192
+ });
193
+ const midPoint = segment.getMidpoint();
194
+ return [
195
+ [point1Ans, point2Ans],
196
+ [point2Ans, point1Ans],
197
+ ].some(([point1Ans, point2Ans]) => {
198
+ const isPoint = () => point1Ans.distanceTo(point) < 0.1;
199
+ const isMidPoint = () => point2Ans.distanceTo(midPoint) < 0.1;
200
+ return isPoint() && isMidPoint();
201
+ });
202
+ }
203
+ catch (e) {
204
+ console.log(e);
205
+ handleVEAError(e);
206
+ return false;
207
+ }
208
+ };
209
+ const getTraceMedianInTriangleQuestion = () => {
210
+ const [nameA, nameB, nameC] = shuffle(["A", "B", "C"]);
211
+ const [pointARaw, pointBRaw, pointCRaw] = (() => {
212
+ const a = -randint(4, 12);
213
+ const b = +randint(4, 12);
214
+ const pointA = PointConstructor.fromCoords([a, 0], nameA);
215
+ const pointB = PointConstructor.fromCoords([b, 0], nameB);
216
+ const rand = randint(0, 3);
217
+ switch (rand) {
218
+ case 0: {
219
+ const c = randint(a + 1, b);
220
+ const h = +randint(4, 12);
221
+ const pointC = PointConstructor.fromCoords([c, h], nameC);
222
+ return [pointA, pointB, pointC];
223
+ }
224
+ case 1: {
225
+ const isLeftSide = coinFlip();
226
+ const c = isLeftSide ? a : b;
227
+ const h = +randint(4, 12);
228
+ const pointC = PointConstructor.fromCoords([c, h], nameC);
229
+ return [pointA, pointB, pointC];
230
+ }
231
+ case 2: {
232
+ const isLeftSide = coinFlip();
233
+ const c = isLeftSide ? a - randint(2, 8) : b + randint(2, 8);
234
+ const h = +randint(4, 12);
235
+ const pointC = PointConstructor.fromCoords([c, h], nameC);
236
+ return [pointA, pointB, pointC];
237
+ }
238
+ default:
239
+ throw new Error("Unsupported rand: " + rand);
240
+ }
241
+ })();
242
+ const [pointA, pointB, pointC] = (() => {
243
+ const pointOrigin = new Point("O", 0, 0);
244
+ const angleInDegrees = randint(0, 360);
245
+ return [pointARaw, pointBRaw, pointCRaw].map((point) => rotatePoint(point, degreesToRadians(angleInDegrees, 5), pointOrigin, point.name));
246
+ })();
247
+ const triangle = new Triangle([pointC, pointB, pointA]);
248
+ const strNameTriangle = shuffle(triangle.name.split("")).join("");
249
+ const identifiers = {
250
+ triangleIds: triangle.toIdentifiers(),
251
+ strNameTriangle,
252
+ };
253
+ return getQuestionFromIdentifiers(identifiers);
254
+ };
255
+ const getQuestionFromIdentifiers = (identifiers, opts) => {
256
+ const question = {
257
+ ggbAnswer: getGGBAnswer(identifiers, opts),
258
+ instruction: getInstruction(identifiers, opts),
259
+ keys: [],
260
+ answerFormat: "tex",
261
+ identifiers,
262
+ studentGgbOptions: getStudentGGBOptions(identifiers, opts),
263
+ hint: getHint(identifiers, opts),
264
+ correction: getCorrection(identifiers, opts),
265
+ correctionGgbOptions: getCorrectionGGBOptions(identifiers, opts),
266
+ };
267
+ return question;
268
+ };
269
+ export const traceMedianInTriangle = {
270
+ id: "traceMedianInTriangle",
271
+ connector: "=",
272
+ label: "Tracer une médiane d'un triangle",
273
+ isSingleStep: true,
274
+ generator: (nb) => getDistinctQuestions(getTraceMedianInTriangleQuestion, nb),
275
+ ggbTimer: 60,
276
+ isGGBAnswerValid,
277
+ subject: "Mathématiques",
278
+ answerType: "GGB",
279
+ getStudentGGBOptions,
280
+ getQuestionFromIdentifiers,
281
+ getHint,
282
+ getCorrection,
283
+ hasHintAndCorrection: true,
284
+ };
@@ -6,4 +6,5 @@ export * from "./drawAVectorInGGB.js";
6
6
  export * from "./placePointFromPointAndVector.js";
7
7
  export * from "./linearVectorCombinationFromGraph.js";
8
8
  export * from "./traceVectorCL.js";
9
+ export * from "./traceVectorSumFromVecs.js";
9
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/geometry/vectors/constructions/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mCAAmC,CAAC;AAClD,cAAc,uCAAuC,CAAC;AACtD,cAAc,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/geometry/vectors/constructions/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mCAAmC,CAAC;AAClD,cAAc,uCAAuC,CAAC;AACtD,cAAc,oBAAoB,CAAC;AACnC,cAAc,6BAA6B,CAAC"}
@@ -6,3 +6,4 @@ export * from "./drawAVectorInGGB.js";
6
6
  export * from "./placePointFromPointAndVector.js";
7
7
  export * from "./linearVectorCombinationFromGraph.js";
8
8
  export * from "./traceVectorCL.js";
9
+ export * from "./traceVectorSumFromVecs.js";
@@ -0,0 +1,8 @@
1
+ import { Exercise } from "../../../../../exercises/exercise.js";
2
+ import { PointIdentifiers } from "../../../../../math/geometry/point.js";
3
+ type Identifiers = {
4
+ pointIds: PointIdentifiers[];
5
+ };
6
+ export declare const traceVectorSumFromVecs: Exercise<Identifiers>;
7
+ export {};
8
+ //# sourceMappingURL=traceVectorSumFromVecs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"traceVectorSumFromVecs.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/geometry/vectors/constructions/traceVectorSumFromVecs.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAWT,MAAM,6BAA6B,CAAC;AAMrC,OAAO,EAGL,gBAAgB,EACjB,MAAM,8BAA8B,CAAC;AAGtC,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,gBAAgB,EAAE,CAAC;CAC9B,CAAC;AAqMF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,CAiBxD,CAAC"}