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,729 @@
1
+ import { toolBarConstructor } from "../../../../exercises/utils/geogebra/toolBarConstructor.js";
2
+ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { colorWithOpacity, greenMain, orange } from "../../../../geogebra/colors.js";
4
+ import { GeogebraConstructor } from "../../../../geogebra/geogebraConstructor.js";
5
+ import { ggbPointToCoords } from "../../../../geogebra/parsers/ggbPointToCoords.js";
6
+ import { parseGGBPoints } from "../../../../geogebra/parsers/parseGGBPoints.js";
7
+ import { Point, PointConstructor, } from "../../../../math/geometry/point.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 { abs } from "../../../../tree/nodes/functions/absNode.js";
12
+ import { cos } from "../../../../tree/nodes/functions/cosNode.js";
13
+ import { exp } from "../../../../tree/nodes/functions/expNode.js";
14
+ import { sin } from "../../../../tree/nodes/functions/sinNode.js";
15
+ import { NodeConstructor, } from "../../../../tree/nodes/nodeConstructor.js";
16
+ import { PiNode } from "../../../../tree/nodes/numbers/piNode.js";
17
+ import { add } from "../../../../tree/nodes/operators/addNode.js";
18
+ import { frac, isFractionNode, } from "../../../../tree/nodes/operators/fractionNode.js";
19
+ import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
20
+ import { substract } from "../../../../tree/nodes/operators/substractNode.js";
21
+ import { VariableNode } from "../../../../tree/nodes/variables/variableNode.js";
22
+ import { NodeComparator } from "../../../../tree/utilities/nodeComparator.js";
23
+ import { coinFlip } from "../../../../utils/alea/coinFlip.js";
24
+ import { random } from "../../../../utils/alea/random.js";
25
+ import { alignTex } from "../../../../utils/latex/alignTex.js";
26
+ const lFrame = 4;
27
+ const coordsFrame = (() => {
28
+ const lFrameMore = lFrame + 0.1;
29
+ return [-lFrameMore, lFrameMore, -lFrameMore, lFrameMore];
30
+ })();
31
+ const pointO = new Point("O", 0, 0);
32
+ //TODO: frac does not simplify "i"
33
+ // const nodeI = new ComplexNode((0).toTree(), (1).toTree());
34
+ const nodeI = new VariableNode("i");
35
+ const _degreesToRadians = (angleInDegrees, precision) => {
36
+ const oneOver180 = 0.00555555555555555;
37
+ return round(multiply(multiply(angleInDegrees, PiNode), oneOver180).evaluate(), precision);
38
+ };
39
+ const rotateVector = (vec, angle, name) => {
40
+ //x' = cos(t)*x -sin(t)*y
41
+ //y' = sin(t)*x + cos(t)*y
42
+ const cos = Math.cos(angle);
43
+ const sin = Math.sin(angle);
44
+ 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());
45
+ };
46
+ const rotatePoint = (target, angle, center, name, precision = 2) => {
47
+ const vSrc = createVector(center, target, "vSrc", precision);
48
+ const vRotated = rotateVector(vSrc, angle, "vRotated");
49
+ return createPoint(add(center.x, vRotated.x).evaluate(), add(center.y, vRotated.y).evaluate(), name, precision);
50
+ };
51
+ const createVector = (from, to, name, precision = 5) => {
52
+ return new Vector(name, round(substract(to.x, from.x).evaluate(), precision).toTree(), round(substract(to.y, from.y).evaluate(), precision).toTree());
53
+ };
54
+ const createPoint = (x, y, name, precision = 5) => {
55
+ return new Point(name, round(x, precision), round(y, precision));
56
+ };
57
+ const createPointForModuleAndArgument = (nodeModule, nodeArgument, name) => new Point(name, multiply(nodeModule, cos(nodeArgument)), multiply(nodeModule, sin(nodeArgument)));
58
+ const getHydrated = (identifiers) => {
59
+ const { pointIdsA, nodeIdsModuleZ, nodeIdsArgumentZ, typeAffixObjZ, nodeIdsModuleZPrime, nodeIdsArgumentZPrime, typeAffixObjZPrime, typeExpr, } = identifiers;
60
+ const [nodeModuleZ, nodeArgumentZ, nodeModuleZPrime, nodeArgumentZPrime] = [
61
+ nodeIdsModuleZ,
62
+ nodeIdsArgumentZ,
63
+ nodeIdsModuleZPrime,
64
+ nodeIdsArgumentZPrime,
65
+ ].map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds));
66
+ const pointA = PointConstructor.fromIdentifiers(pointIdsA);
67
+ const affixObjZ = {
68
+ nodeModule: nodeModuleZ,
69
+ nodeArgument: nodeArgumentZ,
70
+ typeAffixObj: typeAffixObjZ,
71
+ };
72
+ const affixObjZPrime = {
73
+ nodeModule: nodeModuleZPrime,
74
+ nodeArgument: nodeArgumentZPrime,
75
+ typeAffixObj: typeAffixObjZPrime,
76
+ };
77
+ const [pointI, pointB] = (() => {
78
+ switch (typeExpr) {
79
+ case "(z_{A} + z) \\times z'": {
80
+ const pointTranslated = (() => {
81
+ const pointZ = createPointForModuleAndArgument(affixObjZ.nodeModule, affixObjZ.nodeArgument, "Z");
82
+ return new Point("ATranslated", add(pointA.x, pointZ.x), add(pointA.y, pointZ.y));
83
+ })();
84
+ const pointI = new Point("I", pointTranslated.x, pointTranslated.y);
85
+ const pointScaledOrRotated = (() => {
86
+ switch (affixObjZPrime.typeAffixObj) {
87
+ case "integer": {
88
+ const nodeK = (() => {
89
+ const isNegative = NodeComparator.isEqualViaSub(affixObjZPrime.nodeArgument, PiNode);
90
+ return isNegative
91
+ ? multiply(-1, affixObjZPrime.nodeModule)
92
+ : affixObjZPrime.nodeModule;
93
+ })();
94
+ const pointScaled = new Point("ATranslatedScaled", multiply(nodeK, pointTranslated.x), multiply(nodeK, pointTranslated.y));
95
+ return pointScaled;
96
+ }
97
+ case "exp(ia)": {
98
+ const pointRotated = rotatePoint(pointTranslated, affixObjZPrime.nodeArgument.evaluate(), pointO, "ATranslatedRotated");
99
+ return pointRotated;
100
+ }
101
+ default:
102
+ throw new Error("Unsupported ");
103
+ }
104
+ })();
105
+ const pointB = new Point("B", pointScaledOrRotated.x, pointScaledOrRotated.y);
106
+ return [pointI, pointB];
107
+ }
108
+ case "(z_{A} \\times z) + z'": {
109
+ const pointScaledOrRotated = (() => {
110
+ switch (affixObjZ.typeAffixObj) {
111
+ case "integer": {
112
+ const nodeK = (() => {
113
+ const isNegative = NodeComparator.isEqualViaSub(affixObjZ.nodeArgument, PiNode);
114
+ return isNegative
115
+ ? multiply(-1, affixObjZ.nodeModule)
116
+ : affixObjZ.nodeModule;
117
+ })();
118
+ const pointScaled = new Point("AScaled", multiply(nodeK, pointA.x), multiply(nodeK, pointA.y));
119
+ return pointScaled;
120
+ }
121
+ case "exp(ia)": {
122
+ const pointRotated = rotatePoint(pointA, affixObjZ.nodeArgument.evaluate(), pointO, "ARotated");
123
+ return pointRotated;
124
+ }
125
+ default:
126
+ throw new Error("Unsupported ");
127
+ }
128
+ })();
129
+ const pointI = new Point("I", pointScaledOrRotated.x, pointScaledOrRotated.y);
130
+ const pointScaledOrRotatedTranslated = (() => {
131
+ const pointZPrime = createPointForModuleAndArgument(affixObjZPrime.nodeModule, affixObjZPrime.nodeArgument, "Z");
132
+ return new Point("ATranslatedScaledOrRotated", add(pointScaledOrRotated.x, pointZPrime.x), add(pointScaledOrRotated.y, pointZPrime.y));
133
+ })();
134
+ const pointB = new Point("B", pointScaledOrRotatedTranslated.x, pointScaledOrRotatedTranslated.y);
135
+ return [pointI, pointB];
136
+ }
137
+ default:
138
+ throw new Error("Unsupported typeExpr: " + typeExpr);
139
+ }
140
+ })();
141
+ const [nodeAffixZ, nodeAffixZPrime] = [affixObjZ, affixObjZPrime].map((affixObj) => {
142
+ if (NodeComparator.isEqualViaSub(affixObj.nodeArgument, (0).toTree())) {
143
+ return affixObj.nodeModule;
144
+ }
145
+ else {
146
+ return multiply(affixObj.nodeModule, exp(multiply(nodeI, affixObj.nodeArgument.simplify({ towardsDistribute: true }))));
147
+ }
148
+ });
149
+ return {
150
+ pointA,
151
+ affixObjZ,
152
+ affixObjZPrime,
153
+ nodeAffixZ,
154
+ nodeAffixZPrime,
155
+ pointI,
156
+ pointB,
157
+ };
158
+ };
159
+ const getInstruction = (identifiers) => {
160
+ const { typeExpr } = identifiers;
161
+ const { nodeAffixZ, nodeAffixZPrime } = getHydrated(identifiers);
162
+ return `Sur la figure ci-dessous, le point $A$ a pour affixe $z_{A}$.
163
+ Placer le point $B$ d'affixe $z_{B}$ tel que :
164
+
165
+ ${(() => {
166
+ switch (typeExpr) {
167
+ case "(z_{A} + z) \\times z'": {
168
+ return `
169
+
170
+ $$
171
+ z_{B} = (z_{A} + (${nodeAffixZ.toTex()})) \\times (${nodeAffixZPrime.toTex()})
172
+ $$
173
+
174
+ `;
175
+ }
176
+ case "(z_{A} \\times z) + z'": {
177
+ return `
178
+
179
+ $$
180
+ z_{B} = (z_{A} \\times (${nodeAffixZ.toTex()})) + (${nodeAffixZPrime.toTex()})
181
+ $$
182
+
183
+ `;
184
+ }
185
+ default:
186
+ throw new Error("Unsupported typeExpr: " + typeExpr);
187
+ }
188
+ })()}
189
+
190
+
191
+ `;
192
+ };
193
+ const getGGBAnswer = (identifiers) => {
194
+ const { pointB } = getHydrated(identifiers);
195
+ return [
196
+ ...[pointB].flatMap((point) => point.toGGBCommand({
197
+ isFixed: true,
198
+ isSelectionnable: true,
199
+ showLabel: true,
200
+ // style: 1,
201
+ color: greenMain,
202
+ })),
203
+ ];
204
+ };
205
+ const getHint = () => {
206
+ return `Le point $B$ est l'image du point $A$ par un enchaînement de $2$ transformations.
207
+ Dans l'expression de l'affixe de $z_{B}$, identifie la sous-expression la plus interne pour déterminer quelle est la transformation qui se produit en premier,
208
+ et ainsi pouvoir placer mentalement un point intermédiaire qui va subir la dernière transformation.`;
209
+ };
210
+ const getCorrection = (identifiers) => {
211
+ const { typeExpr } = identifiers;
212
+ const { affixObjZ, affixObjZPrime, nodeAffixZ, nodeAffixZPrime } = getHydrated(identifiers);
213
+ switch (typeExpr) {
214
+ case "(z_{A} + z) \\times z'": {
215
+ const isZPrimeIntegerNegative = affixObjZPrime.typeAffixObj === "integer" &&
216
+ NodeComparator.isEqualViaSub(affixObjZPrime.nodeArgument, PiNode);
217
+ return `Soit $O$ l'origine du repère.
218
+ Soit $M$ le point d'affixe $z = ${nodeAffixZ.toTex()}$.
219
+ Soit $I$ le point d'abscisse $z_{I}$ tel que :
220
+
221
+ $$
222
+ z_{I} = z_{A} + (${nodeAffixZ.toTex()})
223
+ $$
224
+
225
+ $I$ est l'image du point $A$ par la translation de vecteur $\\overrightarrow{OM}$.
226
+
227
+ ${alignTex([
228
+ ["z_{B}", "=", `z_{I} \\times (${nodeAffixZPrime.toTex()})`],
229
+ ...(isZPrimeIntegerNegative
230
+ ? [["", "=", `z_{I} \\times (-${affixObjZPrime.nodeModule.toTex()})`]]
231
+ : [[]]),
232
+ ])}
233
+
234
+ ${(() => {
235
+ switch (affixObjZPrime.typeAffixObj) {
236
+ case "integer": {
237
+ const nodeK = isZPrimeIntegerNegative
238
+ ? multiply(-1, affixObjZPrime.nodeModule)
239
+ : affixObjZPrime.nodeModule;
240
+ return `$B$ est l'image du point $I$ par l'homothétie de centre $O$ et de rapport $${nodeK.toTex()}$.`;
241
+ }
242
+ case "exp(ia)":
243
+ return `$B$ est l'image du point $I$ par la rotation de centre $O$ et d'angle $${affixObjZPrime.nodeArgument.toTex()}$.`;
244
+ default:
245
+ throw new Error("Unsupported typeAffixObj: " + affixObjZPrime.typeAffixObj);
246
+ }
247
+ })()}
248
+
249
+ `;
250
+ }
251
+ case "(z_{A} \\times z) + z'": {
252
+ const isZIntegerNegative = affixObjZ.typeAffixObj === "integer" &&
253
+ NodeComparator.isEqualViaSub(affixObjZ.nodeArgument, PiNode);
254
+ return `Soit $O$ l'origine du repère.
255
+ Soit $I$ le point d'abscisse $z_{I}$ tel que :
256
+
257
+ ${alignTex([
258
+ ["z_{I}", "=", `z_{A} \\times (${nodeAffixZ.toTex()})`],
259
+ ...(isZIntegerNegative
260
+ ? [["", "=", `z_{A} \\times (-${affixObjZ.nodeModule.toTex()})`]]
261
+ : [[]]),
262
+ ])}
263
+
264
+
265
+ ${(() => {
266
+ switch (affixObjZ.typeAffixObj) {
267
+ case "integer": {
268
+ const nodeK = isZIntegerNegative
269
+ ? multiply(-1, affixObjZ.nodeModule)
270
+ : affixObjZ.nodeModule;
271
+ return `$I$ est l'image du point $A$ par l'homothétie de centre $O$ et de rapport $${nodeK.toTex()}$.`;
272
+ }
273
+ case "exp(ia)":
274
+ return `$I$ est l'image du point $A$ par la rotation de centre $O$ et d'angle $${affixObjZ.nodeArgument.toTex()}$.`;
275
+ default:
276
+ throw new Error("Unsupported typeAffixObj: " + affixObjZ.typeAffixObj);
277
+ }
278
+ })()}
279
+
280
+ Soit $M'$ le point d'affixe $z' = ${nodeAffixZPrime.toTex()}$.
281
+
282
+ $$
283
+ z_{B} = z_{I} + (${nodeAffixZPrime.toTex()})
284
+ $$
285
+
286
+ $B$ est l'image du point $I$ par la translation de vecteur $\\overrightarrow{OM'}$.
287
+
288
+ `;
289
+ }
290
+ default:
291
+ throw new Error("Unsupported typeExpr: " + typeExpr);
292
+ }
293
+ };
294
+ const getCorrectionGGBOptions = (identifiers) => {
295
+ const { typeExpr } = identifiers;
296
+ const { affixObjZ, affixObjZPrime, pointA, pointB, pointI } = getHydrated(identifiers);
297
+ const strLineColor = `"${colorWithOpacity("#000000", 26)}"`;
298
+ const commands = (() => {
299
+ switch (typeExpr) {
300
+ case "(z_{A} + z) \\times z'": {
301
+ return [
302
+ ...[pointA].flatMap((point) => point.toGGBCommand({
303
+ isFixed: true,
304
+ isSelectionnable: true,
305
+ showLabel: true,
306
+ // style: 1,
307
+ })),
308
+ //vecAI
309
+ ...[
310
+ `vecAI = Vector(${pointA.toMathString()}, ${pointI.toMathString()})`,
311
+ `SetColor(vecAI, "${orange}")`,
312
+ ],
313
+ //pointI
314
+ ...[pointI].flatMap((point) => point.toGGBCommand({
315
+ isFixed: true,
316
+ isSelectionnable: true,
317
+ showLabel: true,
318
+ // style: 1,
319
+ color: orange,
320
+ })),
321
+ ...(() => {
322
+ switch (affixObjZPrime.typeAffixObj) {
323
+ case "integer": {
324
+ return [
325
+ //circles
326
+ ...[
327
+ `cirI = Circle(${pointO.toMathString()}, ${pointI.toMathString()})`,
328
+ `SetLineThickness(cirI, 1)`,
329
+ `SetLineStyle(cirI, 2)`,
330
+ ],
331
+ ...[
332
+ `cirB = Circle(${pointO.toMathString()}, ${pointB.toMathString()})`,
333
+ `SetLineThickness(cirB, 1)`,
334
+ `SetLineStyle(cirB, 2)`,
335
+ ],
336
+ ];
337
+ }
338
+ case "exp(ia)": {
339
+ const nodeAngleBase = (() => {
340
+ const nodeAbsArgumentZPrime = abs(affixObjZPrime.nodeArgument).simplify({
341
+ towardsDistribute: false,
342
+ });
343
+ if (isFractionNode(nodeAbsArgumentZPrime)) {
344
+ const nodeDen = nodeAbsArgumentZPrime.rightChild;
345
+ return frac(PiNode, nodeDen);
346
+ }
347
+ else {
348
+ throw new Error("isFractionNode(nodeAbsArgumentZPrime) === false");
349
+ }
350
+ })();
351
+ const nbRays = frac(multiply(2, PiNode), nodeAngleBase)
352
+ .simplify({ towardsDistribute: false })
353
+ .evaluate();
354
+ const arrNodeAngle = [...Array(nbRays).keys()].map((i) => multiply(i, nodeAngleBase));
355
+ const precision = 5;
356
+ const pointO = new Point("O", 0, 0);
357
+ const arrPointForAngle = arrNodeAngle.map((nodeAngle, i) => rotatePoint(pointI, nodeAngle.evaluate(), pointO, `PF${i}`, precision));
358
+ return [
359
+ //circles
360
+ ...[
361
+ `cirI = Circle(${pointO.toMathString()}, ${pointI.toMathString()})`,
362
+ `SetLineThickness(cirI, 1)`,
363
+ `SetLineStyle(cirI, 2)`,
364
+ ],
365
+ //segments (rays)
366
+ ...arrPointForAngle.flatMap((point, i) => [
367
+ `segRay${i} = Segment(${pointO.toMathString()}, ${point.toMathString()})`,
368
+ `SetColor(segRay${i}, ${strLineColor})`,
369
+ `SetLineThickness(segRay${i}, 1)`,
370
+ `SetLineStyle(segRay${i}, 0)`,
371
+ ]),
372
+ //argument
373
+ ...(() => {
374
+ const isClockwise = affixObjZPrime.nodeArgument.evaluate() > 0;
375
+ return [
376
+ `rayOI = Ray(${pointO.toMathString()}, ${pointI.toMathString()})`,
377
+ `rayOB = Ray(${pointO.toMathString()}, ${pointB.toMathString()})`,
378
+ `SetVisibleInView(rayOI, 1, false)`,
379
+ `SetVisibleInView(rayOB, 1, false)`,
380
+ `angArg = ${isClockwise
381
+ ? "Angle(rayOI, rayOB)"
382
+ : "Angle(rayOB, rayOI)"}`,
383
+ `SetDecoration(angArg, ${isClockwise ? 6 : 7})`,
384
+ `SetColor(angArg, "${orange}")`,
385
+ `SetCaption(angArg, "$\\\\ \\\\ \\ \\ ${affixObjZPrime.nodeArgument.toTex()}$")`,
386
+ `ShowLabel(angArg, true)`,
387
+ ];
388
+ })(),
389
+ ];
390
+ }
391
+ default:
392
+ throw new Error("Unsupported typeAffixObj: " + affixObjZPrime.typeAffixObj);
393
+ }
394
+ })(),
395
+ //pointB
396
+ ...[pointB].flatMap((point) => point.toGGBCommand({
397
+ isFixed: true,
398
+ isSelectionnable: true,
399
+ showLabel: true,
400
+ // style: 1,
401
+ color: greenMain,
402
+ })),
403
+ ];
404
+ }
405
+ case "(z_{A} \\times z) + z'": {
406
+ return [
407
+ ...[pointA].flatMap((point) => point.toGGBCommand({
408
+ isFixed: true,
409
+ isSelectionnable: true,
410
+ showLabel: true,
411
+ // style: 1,
412
+ })),
413
+ ...(() => {
414
+ switch (affixObjZ.typeAffixObj) {
415
+ case "integer": {
416
+ return [
417
+ //circles
418
+ ...[
419
+ `cirA = Circle(${pointO.toMathString()}, ${pointA.toMathString()})`,
420
+ `SetLineThickness(cirA, 1)`,
421
+ `SetLineStyle(cirA, 2)`,
422
+ ],
423
+ ...[
424
+ `cirI = Circle(${pointO.toMathString()}, ${pointI.toMathString()})`,
425
+ `SetLineThickness(cirI, 1)`,
426
+ `SetLineStyle(cirI, 2)`,
427
+ ],
428
+ ];
429
+ }
430
+ case "exp(ia)": {
431
+ const nodeAngleBase = (() => {
432
+ const nodeAbsArgumentZ = abs(affixObjZ.nodeArgument).simplify({
433
+ towardsDistribute: false,
434
+ });
435
+ if (isFractionNode(nodeAbsArgumentZ)) {
436
+ const nodeDen = nodeAbsArgumentZ.rightChild;
437
+ return frac(PiNode, nodeDen);
438
+ }
439
+ else {
440
+ throw new Error("isFractionNode(nodeAbsArgumentZPrime) === false");
441
+ }
442
+ })();
443
+ const nbRays = frac(multiply(2, PiNode), nodeAngleBase)
444
+ .simplify({ towardsDistribute: false })
445
+ .evaluate();
446
+ const arrNodeAngle = [...Array(nbRays).keys()].map((i) => multiply(i, nodeAngleBase));
447
+ const precision = 5;
448
+ const pointO = new Point("O", 0, 0);
449
+ const arrPointForAngle = arrNodeAngle.map((nodeAngle, i) => rotatePoint(pointA, nodeAngle.evaluate(), pointO, `PF${i}`, precision));
450
+ return [
451
+ //circles
452
+ ...[
453
+ `cirA = Circle(${pointO.toMathString()}, ${pointA.toMathString()})`,
454
+ `SetLineThickness(cirA, 1)`,
455
+ `SetLineStyle(cirA, 2)`,
456
+ ],
457
+ //segments (rays)
458
+ ...arrPointForAngle.flatMap((point, i) => [
459
+ `segRay${i} = Segment(${pointO.toMathString()}, ${point.toMathString()})`,
460
+ `SetColor(segRay${i}, ${strLineColor})`,
461
+ `SetLineThickness(segRay${i}, 1)`,
462
+ `SetLineStyle(segRay${i}, 0)`,
463
+ ]),
464
+ //argument
465
+ ...(() => {
466
+ const isClockwise = affixObjZPrime.nodeArgument.evaluate() > 0;
467
+ return [
468
+ `rayOA = Ray(${pointO.toMathString()}, ${pointA.toMathString()})`,
469
+ `rayOI = Ray(${pointO.toMathString()}, ${pointI.toMathString()})`,
470
+ `SetVisibleInView(rayOA, 1, false)`,
471
+ `SetVisibleInView(rayOI, 1, false)`,
472
+ `angArg = ${isClockwise
473
+ ? "Angle(rayOA, rayOI)"
474
+ : "Angle(rayOI, rayOA)"}`,
475
+ `SetDecoration(angArg, ${isClockwise ? 6 : 7})`,
476
+ `SetColor(angArg, "${orange}")`,
477
+ `SetCaption(angArg, "$\\\\ \\\\ \\ \\ ${affixObjZPrime.nodeArgument.toTex()}$")`,
478
+ `ShowLabel(angArg, true)`,
479
+ ];
480
+ })(),
481
+ ];
482
+ }
483
+ default:
484
+ throw new Error("Unsupported typeAffixObj: " + affixObjZPrime.typeAffixObj);
485
+ }
486
+ })(),
487
+ //pointI
488
+ ...[pointI].flatMap((point) => point.toGGBCommand({
489
+ isFixed: true,
490
+ isSelectionnable: true,
491
+ showLabel: true,
492
+ // style: 1,
493
+ color: orange,
494
+ })),
495
+ //vecIB
496
+ ...[
497
+ `vecIB = Vector(${pointI.toMathString()}, ${pointB.toMathString()})`,
498
+ `SetColor(vecIB, "${orange}")`,
499
+ ],
500
+ //pointB
501
+ ...[pointB].flatMap((point) => point.toGGBCommand({
502
+ isFixed: true,
503
+ isSelectionnable: true,
504
+ showLabel: true,
505
+ // style: 1,
506
+ color: greenMain,
507
+ })),
508
+ ];
509
+ }
510
+ default:
511
+ throw new Error("Unsupported typeExpr: " + typeExpr);
512
+ }
513
+ })();
514
+ const ggb = new GeogebraConstructor({
515
+ isGridSimple: true,
516
+ commands,
517
+ fontSize: 16,
518
+ });
519
+ return ggb.getOptions({
520
+ coords: coordsFrame,
521
+ });
522
+ };
523
+ const getStudentGGBOptions = (identifiers) => {
524
+ const { pointA } = getHydrated(identifiers);
525
+ const studentGgb = new GeogebraConstructor({
526
+ customToolBar: toolBarConstructor({ point: true }),
527
+ isGridSimple: true,
528
+ commands: [
529
+ //points
530
+ ...[pointA].flatMap((point) => point.toGGBCommand({
531
+ isFixed: true,
532
+ isSelectionnable: true,
533
+ showLabel: true,
534
+ // style: 1,
535
+ })),
536
+ ],
537
+ fontSize: 16,
538
+ });
539
+ return studentGgb.getOptions({
540
+ coords: coordsFrame,
541
+ });
542
+ };
543
+ const isGGBAnswerValid = (ggbAns, { ggbAnswer, ...identifiers }) => {
544
+ const { pointB } = getHydrated(identifiers);
545
+ const pointCoords = parseGGBPoints(ggbAns).map((p) => ggbPointToCoords(p));
546
+ if (pointCoords.length !== 1)
547
+ return false;
548
+ const distanceBonus = 0;
549
+ return (new Point("K", pointCoords[0].x, pointCoords[0].y).distanceTo(pointB) <
550
+ 0.67 + distanceBonus);
551
+ };
552
+ const getComplexGeomPlacePointFromZATransformedQuestion = () => {
553
+ const pointO = new Point("O", 0, 0);
554
+ const typeExpr = random(["(z_{A} + z) \\times z'", "(z_{A} \\times z) + z'"]);
555
+ function createRandomAffixObj(typeAffixObj) {
556
+ let nodeModule;
557
+ let nodeArgument;
558
+ switch (typeAffixObj) {
559
+ case "integer":
560
+ {
561
+ nodeArgument = random([(0).toTree(), PiNode]);
562
+ nodeModule = (() => {
563
+ if (NodeComparator.isEqualViaSub(nodeArgument, (0).toTree())) {
564
+ return randint(2, 4).toTree();
565
+ }
566
+ else {
567
+ return randint(1, 4).toTree();
568
+ }
569
+ })();
570
+ }
571
+ break;
572
+ case "cross":
573
+ {
574
+ nodeModule = randint(1, 3).toTree();
575
+ nodeArgument = (() => {
576
+ const den = 4;
577
+ const num = (coinFlip() ? +1 : -1) * randint(0, Math.ceil(den / 2));
578
+ return multiply(multiply(2, PiNode), frac(num, den)).simplify({
579
+ towardsDistribute: false,
580
+ });
581
+ })();
582
+ }
583
+ break;
584
+ case "exp(ia)":
585
+ {
586
+ nodeModule = (1).toTree();
587
+ nodeArgument = (() => {
588
+ const den = random([3, 4, 6, 8]);
589
+ const num = (coinFlip() ? +1 : -1) * randint(1, Math.ceil(den / 2));
590
+ return multiply(multiply(2, PiNode), frac(num, den)).simplify({
591
+ towardsDistribute: false,
592
+ });
593
+ })();
594
+ }
595
+ break;
596
+ default:
597
+ throw new Error("Unsupported typeAffixObj: " + typeAffixObj);
598
+ }
599
+ const affixObj = { nodeModule, nodeArgument, typeAffixObj };
600
+ return affixObj;
601
+ }
602
+ function isPointBInFrame(pointB, coordsFrame) {
603
+ const [xMin, xMax, yMin, yMax] = coordsFrame;
604
+ const [vX, vY] = [pointB.x, pointB.y].map((node) => node.evaluate());
605
+ return xMin <= vX && vX <= xMax && yMin <= vY && vY <= yMax;
606
+ }
607
+ const { pointA, affixObjZ, affixObjZPrime } = (() => {
608
+ let pointA;
609
+ let affixObjZ;
610
+ let affixObjZPrime;
611
+ let pointB;
612
+ do {
613
+ const lFrameA = lFrame - 1;
614
+ pointA = new Point("A", (randint(-(lFrameA * 2), lFrameA * 2 + 1) * 0.5).toTree(), (randint(-(lFrameA * 2), lFrameA * 2 + 1) * 0.5).toTree());
615
+ [affixObjZ, affixObjZPrime] = (() => {
616
+ switch (typeExpr) {
617
+ case "(z_{A} + z) \\times z'": {
618
+ const typeAffixObjZ = random(["cross", "exp(ia)"]);
619
+ const typeAffixObjZPrime = random(["integer", "exp(ia)"]);
620
+ const [affixObjZ, affixObjZPrime] = [
621
+ typeAffixObjZ,
622
+ typeAffixObjZPrime,
623
+ ].map((typeAffixObj) => createRandomAffixObj(typeAffixObj));
624
+ return [affixObjZ, affixObjZPrime];
625
+ }
626
+ case "(z_{A} \\times z) + z'": {
627
+ const typeAffixObjZ = random(["integer", "exp(ia)"]);
628
+ const typeAffixObjZPrime = random(["cross", "exp(ia)"]);
629
+ const [affixObjZ, affixObjZPrime] = [
630
+ typeAffixObjZ,
631
+ typeAffixObjZPrime,
632
+ ].map((typeAffixObj) => createRandomAffixObj(typeAffixObj));
633
+ return [affixObjZ, affixObjZPrime];
634
+ }
635
+ default:
636
+ throw new Error("Unsupported typeExpr: " + typeExpr);
637
+ }
638
+ })();
639
+ pointB = (() => {
640
+ switch (typeExpr) {
641
+ case "(z_{A} + z) \\times z'": {
642
+ const pointTranslated = (() => {
643
+ const pointZ = createPointForModuleAndArgument(affixObjZ.nodeModule, affixObjZ.nodeArgument, "Z");
644
+ return new Point("ATranslated", add(pointA.x, pointZ.x), add(pointA.y, pointZ.y));
645
+ })();
646
+ const pointScaledOrRotated = (() => {
647
+ switch (affixObjZPrime.typeAffixObj) {
648
+ case "integer": {
649
+ const pointScaled = new Point("ATranslatedScaled", multiply(affixObjZPrime.nodeModule, pointTranslated.x), multiply(affixObjZPrime.nodeModule, pointTranslated.y));
650
+ return pointScaled;
651
+ }
652
+ case "exp(ia)": {
653
+ const pointRotated = rotatePoint(pointTranslated, affixObjZPrime.nodeArgument.evaluate(), pointO, "ATranslatedRotated");
654
+ return pointRotated;
655
+ }
656
+ default:
657
+ throw new Error("Unsupported ");
658
+ }
659
+ })();
660
+ const pointB = new Point("B", pointScaledOrRotated.x, pointScaledOrRotated.y);
661
+ return pointB;
662
+ }
663
+ case "(z_{A} \\times z) + z'": {
664
+ const pointScaledOrRotated = (() => {
665
+ switch (affixObjZ.typeAffixObj) {
666
+ case "integer": {
667
+ const pointScaled = new Point("AScaled", multiply(affixObjZ.nodeModule, pointA.x), multiply(affixObjZ.nodeModule, pointA.y));
668
+ return pointScaled;
669
+ }
670
+ case "exp(ia)": {
671
+ const pointRotated = rotatePoint(pointA, affixObjZ.nodeArgument.evaluate(), pointO, "ARotated");
672
+ return pointRotated;
673
+ }
674
+ default:
675
+ throw new Error("Unsupported ");
676
+ }
677
+ })();
678
+ const pointScaledOrRotatedTranslated = (() => {
679
+ const pointZPrime = createPointForModuleAndArgument(affixObjZPrime.nodeModule, affixObjZPrime.nodeArgument, "Z");
680
+ return new Point("ATranslatedScaledOrRotated", add(pointScaledOrRotated.x, pointZPrime.x), add(pointScaledOrRotated.y, pointZPrime.y));
681
+ })();
682
+ const pointB = new Point("B", pointScaledOrRotatedTranslated.x, pointScaledOrRotatedTranslated.y);
683
+ return pointB;
684
+ }
685
+ default:
686
+ throw new Error("Unsupported typeExpr: " + typeExpr);
687
+ }
688
+ })();
689
+ } while (!isPointBInFrame(pointB, coordsFrame));
690
+ return { pointA, affixObjZ, affixObjZPrime };
691
+ })();
692
+ const identifiers = {
693
+ pointIdsA: pointA.toIdentifiers(),
694
+ typeExpr,
695
+ nodeIdsModuleZ: affixObjZ.nodeModule.toIdentifiers(),
696
+ nodeIdsArgumentZ: affixObjZ.nodeArgument.toIdentifiers(),
697
+ typeAffixObjZ: affixObjZ.typeAffixObj,
698
+ nodeIdsModuleZPrime: affixObjZPrime.nodeModule.toIdentifiers(),
699
+ nodeIdsArgumentZPrime: affixObjZPrime.nodeArgument.toIdentifiers(),
700
+ typeAffixObjZPrime: affixObjZPrime.typeAffixObj,
701
+ };
702
+ return getQuestionFromIdentifiers(identifiers);
703
+ };
704
+ const getQuestionFromIdentifiers = (identifiers, opts) => {
705
+ const question = {
706
+ ggbAnswer: getGGBAnswer(identifiers),
707
+ instruction: getInstruction(identifiers),
708
+ answerFormat: "tex",
709
+ identifiers,
710
+ hint: getHint(identifiers),
711
+ correction: getCorrection(identifiers),
712
+ correctionGgbOptions: getCorrectionGGBOptions(identifiers),
713
+ studentGgbOptions: getStudentGGBOptions(identifiers, opts),
714
+ };
715
+ return question;
716
+ };
717
+ export const complexGeomPlacePointFromZATransformed = {
718
+ id: "complexGeomPlacePointFromZATransformed",
719
+ label: "Placer le point image d'un nombre de la forme $(z_{A} + z) \\times z'$ ou $(z_{A} \\times z) + z'$",
720
+ isSingleStep: true,
721
+ generator: (nb, opts) => getDistinctQuestions(() => getComplexGeomPlacePointFromZATransformedQuestion(opts), nb),
722
+ qcmTimer: 60,
723
+ freeTimer: 60,
724
+ subject: "Mathématiques",
725
+ getQuestionFromIdentifiers,
726
+ hasHintAndCorrection: true,
727
+ answerType: "GGB",
728
+ isGGBAnswerValid,
729
+ };