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,224 @@
1
+ import { addValidProp, shuffleProps, tryToAddWrongProp, propWhile, } from "../../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { GeogebraConstructor } from "../../../../geogebra/geogebraConstructor.js";
4
+ import { Point, PointConstructor, } from "../../../../math/geometry/point.js";
5
+ import { randint } from "../../../../math/utils/random/randint.js";
6
+ import { round } from "../../../../math/utils/round.js";
7
+ import { abs } from "../../../../tree/nodes/functions/absNode.js";
8
+ import { cos } from "../../../../tree/nodes/functions/cosNode.js";
9
+ import { sin } from "../../../../tree/nodes/functions/sinNode.js";
10
+ import { NodeConstructor, } from "../../../../tree/nodes/nodeConstructor.js";
11
+ import { PiNode } from "../../../../tree/nodes/numbers/piNode.js";
12
+ import { add } from "../../../../tree/nodes/operators/addNode.js";
13
+ import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
14
+ import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
15
+ import { substract } from "../../../../tree/nodes/operators/substractNode.js";
16
+ import { VariableNode } from "../../../../tree/nodes/variables/variableNode.js";
17
+ import { coinFlip } from "../../../../utils/alea/coinFlip.js";
18
+ import { random } from "../../../../utils/alea/random.js";
19
+ const pointO = new Point("O", 0, 0);
20
+ const lFrame = 5;
21
+ const _coordsFrame = (() => {
22
+ const lFrameMore = lFrame + 0.1;
23
+ return [-lFrameMore, lFrameMore, -lFrameMore, lFrameMore];
24
+ })();
25
+ //TODO: frac does not simplify "i"
26
+ // const nodeI = new ComplexNode((0).toTree(), (1).toTree());
27
+ const nodeI = new VariableNode("i");
28
+ const createPointForModuleAndArgument = (nodeModule, nodeArgument, name) => new Point(name, multiply(nodeModule, cos(nodeArgument)), multiply(nodeModule, sin(nodeArgument)));
29
+ const getHydrated = (identifiers) => {
30
+ const { nodeIdsModule, nodeIdsArgument, pointIdsA, isCosAsked } = identifiers;
31
+ const [nodeModule, nodeArgument] = [nodeIdsModule, nodeIdsArgument].map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds));
32
+ const [pointA] = [pointIdsA].map((pointIds) => PointConstructor.fromIdentifiers(pointIds));
33
+ const nodeArgumentSimplified = nodeArgument.simplify({
34
+ towardsDistribute: true,
35
+ });
36
+ const nodeAffixSimplified = multiply(nodeModule, add(cos(nodeArgumentSimplified), multiply(nodeI, sin(nodeArgumentSimplified))));
37
+ const nodeAsked = (isCosAsked ? cos : sin)(nodeArgumentSimplified);
38
+ const nodeProductAsked = multiply(nodeModule, nodeAsked);
39
+ const nodeProductAskedRounded = round(nodeProductAsked.evaluate(), 2).toTree();
40
+ return {
41
+ nodeModule,
42
+ nodeArgument,
43
+ nodeArgumentSimplified,
44
+ pointA,
45
+ nodeAffixSimplified,
46
+ nodeAsked,
47
+ nodeProductAsked,
48
+ nodeProductAskedRounded,
49
+ };
50
+ };
51
+ const getInstruction = (identifiers) => {
52
+ const { nodeAffixSimplified, nodeAsked } = getHydrated(identifiers);
53
+ return `Le point $A$ d'affixe $${nodeAffixSimplified.toTex()}$ est représenté sur la figure ci-dessous.
54
+ Étant données ces informations, parmi les propositions suivantes, quelle est la valeur de $${nodeAsked.toTex()}$ arrondie à deux décimales ?`;
55
+ };
56
+ const getAnswerNode = (identifiers) => {
57
+ const { nodeAsked } = getHydrated(identifiers);
58
+ return round(nodeAsked.evaluate(), 2).toTree();
59
+ };
60
+ const getAnswer = (identifiers) => {
61
+ return getAnswerNode(identifiers).toTex();
62
+ };
63
+ const getHint = (identifiers) => {
64
+ const { nodeAsked, nodeAffixSimplified } = getHydrated(identifiers);
65
+ return `Soit $z$ l'affixe de $A$.
66
+ Soient $x$ l'abscisse et $y$ l'ordonnée du point $A$.
67
+ Sous forme algébrique, on a :
68
+
69
+ $$
70
+ z = x + iy
71
+ $$
72
+
73
+ Sous forme trigonométrique, on a :
74
+
75
+ $$
76
+ z = ${nodeAffixSimplified.toTex()}
77
+ $$
78
+
79
+ Utilise ces deux formes pour déterminer mentalement une valeur approchée pour $${nodeAsked.toTex()}$.`;
80
+ };
81
+ const getCorrection = (identifiers) => {
82
+ const { isCosAsked } = identifiers;
83
+ const { nodeAsked, nodeAffixSimplified, nodeModule, nodeProductAskedRounded, } = getHydrated(identifiers);
84
+ return `Soit $z$ l'affixe de $A$.
85
+ Soient $x$ l'abscisse et $y$ l'ordonnée du point $A$.
86
+ Sous forme algébrique, on a :
87
+
88
+ $$
89
+ z = x + iy
90
+ $$
91
+
92
+ Sous forme trigonométrique, on a :
93
+
94
+ $$
95
+ z = ${nodeAffixSimplified.toTex()}
96
+ $$
97
+
98
+ Graphiquement, on lit :
99
+
100
+ $$
101
+ ${isCosAsked ? "x" : "y"} \\approx ${nodeProductAskedRounded.toTex()}
102
+ $$
103
+
104
+ Donc :
105
+
106
+ $$
107
+ ${nodeAsked.toTex()} \\approx ${frac(nodeProductAskedRounded, nodeModule).toTex()} \\approx ${round(nodeAsked.evaluate(), 2).toTree().toTex()}
108
+ $$
109
+
110
+ `;
111
+ };
112
+ const getGGBOptions = (identifiers) => {
113
+ const { pointA } = getHydrated(identifiers);
114
+ const ggb = new GeogebraConstructor({
115
+ isGridSimple: true,
116
+ commands: [
117
+ //points
118
+ ...[pointA].flatMap((point) => point.toGGBCommand({
119
+ isFixed: true,
120
+ isSelectionnable: true,
121
+ showLabel: true,
122
+ // style: 1,
123
+ })),
124
+ ],
125
+ fontSize: 16,
126
+ });
127
+ return ggb.getOptions({
128
+ coords: ggb.getCoordsForPoints([pointO, pointA]),
129
+ });
130
+ };
131
+ const getPropositions = (n, { answer, ...identifiers }) => {
132
+ const propositions = [];
133
+ addValidProp(propositions, answer);
134
+ const { isCosAsked } = identifiers;
135
+ const { nodeAsked, nodeArgumentSimplified, nodeProductAskedRounded } = getHydrated(identifiers);
136
+ //student: forgets to divide by module
137
+ {
138
+ const nodeWrong = nodeProductAskedRounded;
139
+ tryToAddWrongProp(propositions, nodeWrong.toTex());
140
+ }
141
+ function tryToAddWrongPropNotTooClosePlease(nodeRounded) {
142
+ if (abs(substract(nodeRounded, nodeAsked)).evaluate() < 0.2) {
143
+ //ignore
144
+ }
145
+ tryToAddWrongProp(propositions, nodeRounded.toTex());
146
+ }
147
+ //student: cos <-> sin
148
+ {
149
+ const nodeAskedWrong = (isCosAsked ? sin : cos)(nodeArgumentSimplified);
150
+ const nodeWrong = round(nodeAskedWrong.evaluate(), 2).toTree();
151
+ tryToAddWrongPropNotTooClosePlease(nodeWrong);
152
+ }
153
+ //student: evaluates nodeArgument
154
+ {
155
+ const nodeWrong = round(nodeArgumentSimplified.evaluate(), 2).toTree();
156
+ tryToAddWrongPropNotTooClosePlease(nodeWrong);
157
+ }
158
+ propWhile(propositions, n, () => {
159
+ const identifiersWrong = createRandomIdentifiers();
160
+ const nodeWrong = getAnswerNode(identifiersWrong);
161
+ tryToAddWrongPropNotTooClosePlease(nodeWrong);
162
+ });
163
+ return shuffleProps(propositions, n);
164
+ };
165
+ const createRandomIdentifiers = () => {
166
+ function createRandomAffixObj(name) {
167
+ const nodeModule = randint(2, Math.ceil(lFrame)).toTree();
168
+ const nodeArgument = (() => {
169
+ let nodeArgument;
170
+ do {
171
+ const den = random([5, 7, 9, 11, 13, 17]);
172
+ const num = (coinFlip() ? +1 : -1) *
173
+ randint(Math.floor((den * 1) / 4), Math.ceil((den * 3) / 4));
174
+ nodeArgument = multiply(multiply(2, PiNode), frac(num, den)).simplify({
175
+ towardsDistribute: false,
176
+ });
177
+ } while (abs(nodeArgument).simplify().rightChild.evaluate() ===
178
+ 3);
179
+ return nodeArgument;
180
+ })();
181
+ const point = createPointForModuleAndArgument(nodeModule, nodeArgument, name);
182
+ const affixObj = { nodeModule, nodeArgument, point };
183
+ return affixObj;
184
+ }
185
+ const affixObjAsked = createRandomAffixObj("A");
186
+ const isCosAsked = coinFlip();
187
+ const identifiers = {
188
+ pointIdsA: affixObjAsked.point.toIdentifiers(),
189
+ nodeIdsModule: affixObjAsked.nodeModule.toIdentifiers(),
190
+ nodeIdsArgument: affixObjAsked.nodeArgument.toIdentifiers(),
191
+ isCosAsked,
192
+ };
193
+ return identifiers;
194
+ };
195
+ const getComplexGeomApproxOfCosArgOrSinArgFromPointAndAffixTrigQuestion = () => {
196
+ const identifiers = createRandomIdentifiers();
197
+ return getQuestionFromIdentifiers(identifiers);
198
+ };
199
+ const getQuestionFromIdentifiers = (identifiers, opts) => {
200
+ const question = {
201
+ answer: getAnswer(identifiers),
202
+ instruction: getInstruction(identifiers),
203
+ answerFormat: "tex",
204
+ identifiers,
205
+ hint: getHint(identifiers),
206
+ correction: getCorrection(identifiers),
207
+ ggbOptions: getGGBOptions(identifiers, opts),
208
+ };
209
+ return question;
210
+ };
211
+ export const complexGeomApproxOfCosArgOrSinArgFromPointAndAffixTrig = {
212
+ id: "complexGeomApproxOfCosArgOrSinArgFromPointAndAffixTrig",
213
+ label: "Déterminer une valeur approchée de $\\cos(\\arg(z))$ ou $\\sin(\\arg(z))$ à partir d'une figure",
214
+ isSingleStep: true,
215
+ generator: (nb, opts) => getDistinctQuestions(() => getComplexGeomApproxOfCosArgOrSinArgFromPointAndAffixTrigQuestion(opts), nb),
216
+ qcmTimer: 60,
217
+ freeTimer: 60,
218
+ getPropositions,
219
+ subject: "Mathématiques",
220
+ getQuestionFromIdentifiers,
221
+ hasHintAndCorrection: true,
222
+ hasGeogebra: true,
223
+ answerType: "QCU",
224
+ };
@@ -0,0 +1,11 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ import { NodeIdentifiers } from "../../../../tree/nodes/nodeConstructor.js";
3
+ type Identifiers = {
4
+ typeSituation: string;
5
+ nodeIdsAffixExp: NodeIdentifiers[];
6
+ indexesOfPoints: number[];
7
+ letters: string[];
8
+ };
9
+ export declare const complexGeomArgumentOfFracCBABFromFigure: Exercise<Identifiers>;
10
+ export {};
11
+ //# sourceMappingURL=complexGeomArgumentOfFracCBABFromFigure.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"complexGeomArgumentOfFracCBABFromFigure.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/complex/geometric/complexGeomArgumentOfFracCBABFromFigure.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAiBT,MAAM,6BAA6B,CAAC;AAsBrC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AA+H7C,KAAK,WAAW,GAAG;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,eAAe,EAAE,CAAC;IACnC,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AAgdF,eAAO,MAAM,uCAAuC,EAAE,QAAQ,CAAC,WAAW,CAkBzE,CAAC"}
@@ -0,0 +1,448 @@
1
+ import { addValidProp, shuffleProps, tryToAddWrongProp, propWhile, } from "../../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { blueExtraDark, colorWithOpacity, greenMain, orange, } from "../../../../geogebra/colors.js";
4
+ import { GeogebraConstructor } from "../../../../geogebra/geogebraConstructor.js";
5
+ import { Point } from "../../../../math/geometry/point.js";
6
+ import { Vector } from "../../../../math/geometry/vector.js";
7
+ import { exactAngleCandidate, valueAngleBetweenPoints, } from "../../../../math/utils/geometry/angleBetweenPoints.js";
8
+ import { randfloat } from "../../../../math/utils/random/randfloat.js";
9
+ import { round } from "../../../../math/utils/round.js";
10
+ import { cos } from "../../../../tree/nodes/functions/cosNode.js";
11
+ import { exp, isExpNode } from "../../../../tree/nodes/functions/expNode.js";
12
+ import { opposite } from "../../../../tree/nodes/functions/oppositeNode.js";
13
+ import { sin } from "../../../../tree/nodes/functions/sinNode.js";
14
+ import { NodeConstructor, } from "../../../../tree/nodes/nodeConstructor.js";
15
+ import { PiNode } from "../../../../tree/nodes/numbers/piNode.js";
16
+ import { add, isAddNode } from "../../../../tree/nodes/operators/addNode.js";
17
+ import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
18
+ import { isMultiplyNode, multiply, } from "../../../../tree/nodes/operators/multiplyNode.js";
19
+ import { substract } from "../../../../tree/nodes/operators/substractNode.js";
20
+ import { VariableNode } from "../../../../tree/nodes/variables/variableNode.js";
21
+ import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
22
+ import { NodeComparator } from "../../../../tree/utilities/nodeComparator.js";
23
+ import { coinFlip } from "../../../../utils/alea/coinFlip.js";
24
+ import { random, randomMany } from "../../../../utils/alea/random.js";
25
+ import { shuffle } from "../../../../utils/alea/shuffle.js";
26
+ import { zip } from "../../../../utils/arrays/arrayZip.js";
27
+ import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
28
+ //TODO: frac does not simplify "i"
29
+ // const nodeI = new ComplexNode((0).toTree(), (1).toTree());
30
+ const nodeI = new VariableNode("i");
31
+ const _degreesToRadians = (angleInDegrees, precision) => {
32
+ const oneOver180 = 0.00555555555555555;
33
+ return round(multiply(multiply(angleInDegrees, PiNode), oneOver180).evaluate(), precision);
34
+ };
35
+ const rotateVector = (vec, angle, name) => {
36
+ //x' = cos(t)*x -sin(t)*y
37
+ //y' = sin(t)*x + cos(t)*y
38
+ const cos = Math.cos(angle);
39
+ const sin = Math.sin(angle);
40
+ 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());
41
+ };
42
+ const _rotatePoint = (target, angle, center, name, precision = 2) => {
43
+ const vSrc = createVector(center, target, "vSrc", precision);
44
+ const vRotated = rotateVector(vSrc, angle, "vRotated");
45
+ return createPoint(add(center.x, vRotated.x).evaluate(), add(center.y, vRotated.y).evaluate(), name, precision);
46
+ };
47
+ const createVector = (from, to, name, precision = 5) => {
48
+ return new Vector(name, round(substract(to.x, from.x).evaluate(), precision).toTree(), round(substract(to.y, from.y).evaluate(), precision).toTree());
49
+ };
50
+ const createPoint = (x, y, name, precision = 5) => {
51
+ return new Point(name, round(x, precision), round(y, precision));
52
+ };
53
+ const createPointFromNodeAffixExp = (nodeAffixExp, name, precision = 5) => {
54
+ if (isAddNode(nodeAffixExp)) {
55
+ const [point1, point2] = [
56
+ nodeAffixExp.leftChild,
57
+ nodeAffixExp.rightChild,
58
+ ].map((nodeAffixExp, i) => createPointFromNodeAffixExp(nodeAffixExp, `P${i}`, precision));
59
+ const x = point1.x.evaluate() + point2.x.evaluate();
60
+ const y = point1.y.evaluate() + point2.y.evaluate();
61
+ return createPoint(x, y, name, precision);
62
+ }
63
+ else if (isMultiplyNode(nodeAffixExp)) {
64
+ const { nodeModule, nodeArgument } = createAffixObjFromNodeAffixExp(nodeAffixExp);
65
+ const x = multiply(nodeModule, cos(nodeArgument)).evaluate();
66
+ const y = multiply(nodeModule, sin(nodeArgument)).evaluate();
67
+ return createPoint(x, y, name, precision);
68
+ }
69
+ else {
70
+ throw new Error("Unsupported nodeAffixExp: " + nodeAffixExp);
71
+ }
72
+ };
73
+ const createAffixObjFromNodeAffixExp = (nodeAffixExp) => {
74
+ if (isMultiplyNode(nodeAffixExp)) {
75
+ const [nodeModule, nodeExp] = [
76
+ nodeAffixExp.leftChild,
77
+ nodeAffixExp.rightChild,
78
+ ];
79
+ if (isExpNode(nodeExp) && isMultiplyNode(nodeExp.child)) {
80
+ const nodeArgument = nodeExp.child.rightChild;
81
+ return {
82
+ nodeModule,
83
+ nodeArgument,
84
+ };
85
+ }
86
+ else {
87
+ throw new Error("Unsupported nodeAffixExp: " + nodeAffixExp.toTex());
88
+ }
89
+ }
90
+ else {
91
+ throw new Error("Unsupported nodeAffixExp: " + nodeAffixExp.toTex());
92
+ }
93
+ };
94
+ const getHydrated = (identifiers) => {
95
+ const { typeSituation, nodeIdsAffixExp, indexesOfPoints, letters } = identifiers;
96
+ const arrNodeAffixExp = nodeIdsAffixExp.map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds));
97
+ const arrPoint = zip(arrNodeAffixExp, letters).map(([nodeAffixExp, letter]) => createPointFromNodeAffixExp(nodeAffixExp, letter));
98
+ const arrPointTarget = indexesOfPoints.map((i) => arrPoint[i]);
99
+ const arrLetterTarget = indexesOfPoints.map((i) => letters[i]);
100
+ const nodeFracWithLetters = (() => {
101
+ const [letterLow1, letterLowCenter, letterLow2] = arrLetterTarget.map((str) => str.toLocaleLowerCase());
102
+ return frac(substract(letterLow2, letterLowCenter), substract(letterLow1, letterLowCenter));
103
+ })();
104
+ //does not work: simplify does not handle complex expressions
105
+ /*
106
+ const [nodeAffixExp1, nodeAffixExp2, nodeAffixExp3] = indexesOfPoints.map(
107
+ (i) => arrNodeAffixExp[i],
108
+ );
109
+
110
+ const nodeNumRaw = substract(nodeAffixExp3, nodeAffixExp1);
111
+ const nodeNumSimplified = NodeSimplifier.simplifyByVibrating(
112
+ NodeSimplifier.simplifyByInfiltrating(nodeNumRaw, {
113
+ towardsDistribute: true,
114
+ }),
115
+ );
116
+
117
+ const nodeDenRaw = substract(nodeAffixExp2, nodeAffixExp1);
118
+ const nodeDenSimplified = NodeSimplifier.simplifyByVibrating(
119
+ NodeSimplifier.simplifyByInfiltrating(nodeDenRaw, {
120
+ towardsDistribute: true,
121
+ }),
122
+ );
123
+
124
+ const nodeFracRaw = frac(nodeNumSimplified, nodeDenSimplified);
125
+ const nodeFracSimplified = NodeSimplifier.simplifyByVibrating(
126
+ NodeSimplifier.simplifyByInfiltrating(nodeFracRaw, {
127
+ towardsDistribute: true,
128
+ }),
129
+ );
130
+
131
+ const nodeExpCandidate = frac(
132
+ nodeBySubstitutingVar(nodeFracSimplified, (1).toTree(), nodeI),
133
+ nodeBySubstitutingVar(nodeFracSimplified, (0).toTree(), nodeI),
134
+ ).simplify({ towardsDistribute: false });
135
+ const nodeArgument = (() => {
136
+ if (isExpNode(nodeExpCandidate)) {
137
+ return nodeExpCandidate.child;
138
+ } else if (isNumberNode(nodeExpCandidate)) {
139
+ return (0).toTree();
140
+ } else {
141
+ throw new Error("Could not compute nodeArgument");
142
+ }
143
+ })();
144
+ */
145
+ const nodeArgument = (() => {
146
+ switch (typeSituation) {
147
+ case "triangle équilatéral":
148
+ case "carré": {
149
+ const [point1, pointCenter, point2] = arrPointTarget;
150
+ const nodeExactAngleCandidate = exactAngleCandidate(valueAngleBetweenPoints(point1, pointCenter, point2));
151
+ return nodeExactAngleCandidate.simplify();
152
+ }
153
+ default:
154
+ throw new Error("Unsupported typeSituation: " + typeSituation);
155
+ }
156
+ })();
157
+ return {
158
+ arrNodeAffixExp,
159
+ arrPoint,
160
+ nodeFracWithLetters,
161
+ arrLetterTarget,
162
+ arrPointTarget,
163
+ nodeArgument,
164
+ };
165
+ };
166
+ const getInstruction = (identifiers) => {
167
+ const { typeSituation } = identifiers;
168
+ const { arrPoint, nodeFracWithLetters } = getHydrated(identifiers);
169
+ switch (typeSituation) {
170
+ case "triangle équilatéral": {
171
+ const [nameCenter, ...arrNameSummit] = arrPoint.map((point) => point.name);
172
+ const strNameTriangle = arrNameSummit.join("");
173
+ return `Un triangle équilatéral $${strNameTriangle}$ de centre $${nameCenter}$ est représenté ci-dessous.
174
+ ${[nameCenter, ...arrNameSummit].map((namePoint) => {
175
+ const nameAffix = namePoint.toLocaleLowerCase();
176
+ return `On note $${nameAffix}$ l'affixe de $${namePoint}$.`;
177
+ }).join(`
178
+
179
+ `)}
180
+ Donner la valeur exacte de $\\arg(${nodeFracWithLetters.toTex()})$.'`;
181
+ }
182
+ case "carré": {
183
+ const [nameCenter, ...arrNameSummit] = arrPoint.map((point) => point.name);
184
+ const strNameSquare = arrNameSummit.join("");
185
+ return `Un carré $${strNameSquare}$ de centre $${nameCenter}$ est représenté ci-dessous.
186
+ ${[nameCenter, ...arrNameSummit].map((namePoint) => {
187
+ const nameAffix = namePoint.toLocaleLowerCase();
188
+ return `On note $${nameAffix}$ l'affixe de $${namePoint}$.`;
189
+ }).join(`
190
+
191
+ `)}
192
+ Donner la valeur exacte de $\\arg(${nodeFracWithLetters.toTex()})$.'`;
193
+ }
194
+ default:
195
+ throw new Error("Unsupported typeSituation: " + typeSituation);
196
+ }
197
+ };
198
+ const getAnswerNode = (identifiers) => {
199
+ const { nodeArgument } = getHydrated(identifiers);
200
+ return nodeArgument;
201
+ };
202
+ const getAnswer = (identifiers) => {
203
+ return getAnswerNode(identifiers).toTex();
204
+ };
205
+ const getHint = (identifiers) => {
206
+ const { typeSituation } = identifiers;
207
+ const { arrPointTarget } = getHydrated(identifiers);
208
+ const [point1, pointCenter, point2] = arrPointTarget;
209
+ return `Le vecteur $\\overrightarrow{${pointCenter.name}${point1.name}}$ a pour affixe $${point1.name.toLocaleLowerCase()} - ${pointCenter.name.toLocaleLowerCase()}$.
210
+ Le vecteur $\\overrightarrow{${pointCenter.name}${point2.name}}$ a pour affixe $${point2.name.toLocaleLowerCase()} - ${pointCenter.name.toLocaleLowerCase()}$.
211
+ Quand on divise un nombre complexe $z$ par un nombre complexe $z'$, on soustrait $\\arg(z')$ à $\\arg(z)$.
212
+ Les angles dans un ${typeSituation} sont bien connus.`;
213
+ };
214
+ const getCorrection = (identifiers) => {
215
+ const { typeSituation } = identifiers;
216
+ const { nodeFracWithLetters, arrPointTarget, nodeArgument } = getHydrated(identifiers);
217
+ const [point1, pointCenter, point2] = arrPointTarget;
218
+ return `Le vecteur $\\overrightarrow{${pointCenter.name}${point1.name}}$ a pour affixe $${point1.name.toLocaleLowerCase()} - ${pointCenter.name.toLocaleLowerCase()}$.
219
+ Le vecteur $\\overrightarrow{${pointCenter.name}${point2.name}}$ a pour affixe $${point2.name.toLocaleLowerCase()} - ${pointCenter.name.toLocaleLowerCase()}$.
220
+
221
+ $$
222
+ ${nodeFracWithLetters.toTex()} = (\\overrightarrow{${pointCenter.name}${point1.name}},\\overrightarrow{${pointCenter.name}${point2.name}})
223
+ $$
224
+
225
+ Les angles dans un ${typeSituation} sont bien connus.
226
+
227
+ On a donc :
228
+
229
+ $$
230
+ \\text{arg}(${nodeFracWithLetters.toTex()}) = ${nodeArgument.toTex()}
231
+ $$
232
+
233
+ `;
234
+ };
235
+ const getCorrectionGGBOptions = (identifiers) => {
236
+ const { arrPoint, nodeArgument, arrPointTarget } = getHydrated(identifiers);
237
+ const strLineColor = `"${colorWithOpacity("#000000", 26)}"`;
238
+ const [_pointCenter, ...arrPointSummit] = arrPoint;
239
+ const [point1, pointCenter, point2] = arrPointTarget;
240
+ const ggb = new GeogebraConstructor({
241
+ isGridSimple: true,
242
+ commands: [
243
+ //points
244
+ ...arrPoint.flatMap((point) => point.toGGBCommand({
245
+ isFixed: true,
246
+ isSelectionnable: true,
247
+ showLabel: true,
248
+ })),
249
+ //segments
250
+ ...zip(arrPointSummit, [
251
+ ...arrPointSummit.slice(1),
252
+ arrPointSummit[0],
253
+ ]).flatMap(([pointStart, pointEnd], i) => [
254
+ `segPol${i} = Segment(${pointStart.toMathString()}, ${pointEnd.toMathString()})`,
255
+ `SetColor(segPol${i}, "${blueExtraDark}")`,
256
+ `SetLineThickness(segPol${i}, 3)`,
257
+ ]),
258
+ //vectors
259
+ ...[
260
+ `vecCP1 = Vector(${pointCenter.toMathString()}, ${point1.toMathString()})`,
261
+ `vecCP2 = Vector(${pointCenter.toMathString()}, ${point2.toMathString()})`,
262
+ `SetLineThickness(vecCP1, 4)`,
263
+ `SetLineThickness(vecCP2, 4)`,
264
+ `SetColor(vecCP1, "${orange}")`,
265
+ `SetColor(vecCP2, "${orange}")`,
266
+ ],
267
+ //argument
268
+ ...(() => {
269
+ const isClockwise = nodeArgument.evaluate() > 0;
270
+ return [
271
+ `rayCP1 = Ray(${pointCenter.toMathString()}, ${point1.toMathString()})`,
272
+ `rayCP2 = Ray(${pointCenter.toMathString()}, ${point2.toMathString()})`,
273
+ `SetLineThickness(rayCP1, 1)`,
274
+ `SetLineThickness(rayCP2, 1)`,
275
+ `SetColor(rayCP1, ${strLineColor})`,
276
+ `SetColor(rayCP2, ${strLineColor})`,
277
+ `angArg = ${isClockwise ? "Angle(rayCP1, rayCP2)" : "Angle(rayCP2, rayCP1)"}`,
278
+ `SetDecoration(angArg, ${isClockwise ? 6 : 7})`,
279
+ `SetColor(angArg, "${greenMain}")`,
280
+ `SetCaption(angArg, "$\\large \\\\ \\\\ \\ \\ ${nodeArgument.toTex()}$")`,
281
+ `ShowLabel(angArg, true)`,
282
+ ];
283
+ })(),
284
+ ],
285
+ fontSize: 16,
286
+ hideAxes: true,
287
+ hideGrid: true,
288
+ });
289
+ return ggb.getOptions({
290
+ coords: ggb.getCoordsForPoints(arrPoint),
291
+ });
292
+ };
293
+ const getGGBOptions = (identifiers) => {
294
+ const { arrPoint } = getHydrated(identifiers);
295
+ // const strLineColor = `"${colorWithOpacity("#000000", 26)}"`;
296
+ const [_pointCenter, ...arrPointSummit] = arrPoint;
297
+ const ggb = new GeogebraConstructor({
298
+ isGridSimple: true,
299
+ commands: [
300
+ //points
301
+ ...arrPoint.flatMap((point) => point.toGGBCommand({
302
+ isFixed: true,
303
+ isSelectionnable: true,
304
+ showLabel: true,
305
+ })),
306
+ //segments
307
+ ...zip(arrPointSummit, [
308
+ ...arrPointSummit.slice(1),
309
+ arrPointSummit[0],
310
+ ]).flatMap(([pointStart, pointEnd], i) => [
311
+ `segPol${i} = Segment(${pointStart.toMathString()}, ${pointEnd.toMathString()})`,
312
+ `SetColor(segPol${i}, "${blueExtraDark}")`,
313
+ `SetLineThickness(segPol${i}, 3)`,
314
+ ]),
315
+ ],
316
+ fontSize: 16,
317
+ hideAxes: true,
318
+ hideGrid: true,
319
+ });
320
+ return ggb.getOptions({
321
+ coords: ggb.getCoordsForPoints(arrPoint),
322
+ });
323
+ };
324
+ const getPropositions = (n, { answer, ...identifiers }) => {
325
+ const propositions = [];
326
+ addValidProp(propositions, answer);
327
+ const { nodeArgument, arrNodeAffixExp } = getHydrated(identifiers);
328
+ if (coinFlip()) {
329
+ //student: arg -> exp(i arg)
330
+ {
331
+ const nodeExpIArg = exp(multiply(nodeI, nodeArgument));
332
+ tryToAddWrongProp(propositions, nodeExpIArg.toTex());
333
+ }
334
+ }
335
+ if (coinFlip()) {
336
+ //student: arg -> -arg
337
+ {
338
+ tryToAddWrongProp(propositions, opposite(nodeArgument).simplify().toTex());
339
+ }
340
+ }
341
+ propWhile(propositions, n, () => {
342
+ const indexesOfPointsWrong = randomMany([...Array(arrNodeAffixExp.length).keys()], 3);
343
+ const identifiersWrong = {
344
+ ...identifiers,
345
+ indexesOfPoints: indexesOfPointsWrong,
346
+ };
347
+ const { nodeArgument: nodeArgumentWrong } = getHydrated(identifiersWrong);
348
+ if (coinFlip()) {
349
+ const nodeExpIArg = exp(multiply(nodeI, nodeArgumentWrong));
350
+ tryToAddWrongProp(propositions, nodeExpIArg.toTex());
351
+ }
352
+ else {
353
+ tryToAddWrongProp(propositions, nodeArgumentWrong.toTex());
354
+ }
355
+ });
356
+ return shuffleProps(propositions, n);
357
+ };
358
+ const getKeys = () => {
359
+ return ["epower", "i", "pi"];
360
+ };
361
+ const isAnswerValid = (ans, { answer }) => {
362
+ try {
363
+ const [nodeAns, nodeAnswer] = [ans, answer].map((str) => parseAlgebraic(str));
364
+ //-Pi == Pi
365
+ if (NodeComparator.isEqualViaSub(nodeAnswer, PiNode) &&
366
+ NodeComparator.isEqualViaSub(nodeAns, opposite(PiNode))) {
367
+ return true;
368
+ }
369
+ return (NodeComparator.isEqualViaFrac(nodeAns, nodeAnswer) ||
370
+ NodeComparator.isEqualViaSub(nodeAns, nodeAnswer));
371
+ }
372
+ catch (err) {
373
+ return handleVEAError(err);
374
+ }
375
+ };
376
+ const createRandomIdentifiers = () => {
377
+ function createArrNodeAffixExpForRegularPolygon(nbSides) {
378
+ const nodeAffixExpCenter = multiply((0).toTree(), exp(multiply(nodeI, (0).toTree())));
379
+ const arrNodeAffixExpSummit = (() => {
380
+ const nodeModule = randfloat(2, 3, 1).toTree();
381
+ const nodeArgumentOffset = randfloat(0, 2, 1).toTree();
382
+ const nodeAngleBase = frac(multiply(2, PiNode), nbSides);
383
+ return [...Array(nbSides).keys()].map((i) => {
384
+ const nodeArgumentLocal = add(multiply(i, nodeAngleBase).simplify({
385
+ towardsDistribute: false,
386
+ }), nodeArgumentOffset).simplify({ towardsDistribute: false });
387
+ const nodeAffixExpSummit = add(nodeAffixExpCenter, multiply(nodeModule, exp(multiply(nodeI, nodeArgumentLocal))));
388
+ return nodeAffixExpSummit;
389
+ });
390
+ })();
391
+ return [nodeAffixExpCenter, ...arrNodeAffixExpSummit];
392
+ }
393
+ const typeSituation = random(["triangle équilatéral", "carré"]);
394
+ const arrNodeAffixExp = (() => {
395
+ switch (typeSituation) {
396
+ case "triangle équilatéral": {
397
+ return createArrNodeAffixExpForRegularPolygon(3);
398
+ }
399
+ case "carré": {
400
+ return createArrNodeAffixExpForRegularPolygon(4);
401
+ }
402
+ default:
403
+ throw new Error("Unsupported typeSituation: " + typeSituation);
404
+ }
405
+ })();
406
+ const indexesOfPoints = randomMany([...Array(arrNodeAffixExp.length).keys()], 3);
407
+ const arrLetter = shuffle("ABCDFGH".split(""));
408
+ const identifiers = {
409
+ typeSituation,
410
+ nodeIdsAffixExp: arrNodeAffixExp.map((node) => node.toIdentifiers()),
411
+ indexesOfPoints,
412
+ letters: arrLetter,
413
+ };
414
+ return identifiers;
415
+ };
416
+ const getComplexGeomArgumentOfFracCBABFromFigureQuestion = () => {
417
+ // const identifiers = createQCPassedIdentifiers();
418
+ const identifiers = createRandomIdentifiers();
419
+ return getQuestionFromIdentifiers(identifiers);
420
+ };
421
+ const getQuestionFromIdentifiers = (identifiers, opts) => {
422
+ const question = {
423
+ answer: getAnswer(identifiers),
424
+ instruction: getInstruction(identifiers),
425
+ keys: getKeys(identifiers, opts),
426
+ answerFormat: "tex",
427
+ identifiers,
428
+ hint: getHint(identifiers),
429
+ correction: getCorrection(identifiers),
430
+ correctionGgbOptions: getCorrectionGGBOptions(identifiers),
431
+ ggbOptions: getGGBOptions(identifiers, opts),
432
+ };
433
+ return question;
434
+ };
435
+ export const complexGeomArgumentOfFracCBABFromFigure = {
436
+ id: "complexGeomArgumentOfFracCBABFromFigure",
437
+ label: "Déterminer l'argument d'un nombre complexe de la forme $\\frac{c-b}{a-b}$ à partir d'une figure",
438
+ isSingleStep: true,
439
+ generator: (nb, opts) => getDistinctQuestions(() => getComplexGeomArgumentOfFracCBABFromFigureQuestion(opts), nb),
440
+ qcmTimer: 60,
441
+ freeTimer: 60,
442
+ isAnswerValid,
443
+ getPropositions,
444
+ subject: "Mathématiques",
445
+ getQuestionFromIdentifiers,
446
+ hasHintAndCorrection: true,
447
+ hasGeogebra: true,
448
+ };