math-exercises 3.0.213 → 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 (267) 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/hasDiophantianEquationSolution.js +4 -4
  8. package/lib/exercises/math/arithmetic/index.d.ts +7 -0
  9. package/lib/exercises/math/arithmetic/index.d.ts.map +1 -1
  10. package/lib/exercises/math/arithmetic/index.js +7 -0
  11. package/lib/exercises/math/arithmetic/isBigNumberPrime.d.ts +7 -0
  12. package/lib/exercises/math/arithmetic/isBigNumberPrime.d.ts.map +1 -0
  13. package/lib/exercises/math/arithmetic/isBigNumberPrime.js +107 -0
  14. package/lib/exercises/math/arithmetic/numberOfEndingZerosOfBigProduct.d.ts +8 -0
  15. package/lib/exercises/math/arithmetic/numberOfEndingZerosOfBigProduct.d.ts.map +1 -0
  16. package/lib/exercises/math/arithmetic/numberOfEndingZerosOfBigProduct.js +139 -0
  17. package/lib/exercises/math/arithmetic/pgcdFromEuclid.d.ts +8 -0
  18. package/lib/exercises/math/arithmetic/pgcdFromEuclid.d.ts.map +1 -0
  19. package/lib/exercises/math/arithmetic/pgcdFromEuclid.js +123 -0
  20. package/lib/exercises/math/arithmetic/solveDiophantianEquationByUsingPrimality.d.ts +7 -0
  21. package/lib/exercises/math/arithmetic/solveDiophantianEquationByUsingPrimality.d.ts.map +1 -0
  22. package/lib/exercises/math/arithmetic/solveDiophantianEquationByUsingPrimality.js +117 -0
  23. package/lib/exercises/math/arithmetic/whichDayInXDays.d.ts +8 -0
  24. package/lib/exercises/math/arithmetic/whichDayInXDays.d.ts.map +1 -0
  25. package/lib/exercises/math/arithmetic/whichDayInXDays.js +81 -0
  26. package/lib/exercises/math/calcul/fractions/fractionsSumFillInTheBlank.d.ts +15 -0
  27. package/lib/exercises/math/calcul/fractions/fractionsSumFillInTheBlank.d.ts.map +1 -0
  28. package/lib/exercises/math/calcul/fractions/fractionsSumFillInTheBlank.js +256 -0
  29. package/lib/exercises/math/calcul/fractions/index.d.ts +1 -0
  30. package/lib/exercises/math/calcul/fractions/index.d.ts.map +1 -1
  31. package/lib/exercises/math/calcul/fractions/index.js +1 -0
  32. package/lib/exercises/math/calcul/index.d.ts +1 -0
  33. package/lib/exercises/math/calcul/index.d.ts.map +1 -1
  34. package/lib/exercises/math/calcul/index.js +1 -0
  35. package/lib/exercises/math/calcul/mentalCaluls/index.d.ts +3 -0
  36. package/lib/exercises/math/calcul/mentalCaluls/index.d.ts.map +1 -1
  37. package/lib/exercises/math/calcul/mentalCaluls/index.js +3 -0
  38. package/lib/exercises/math/calcul/mentalCaluls/mentalMultiplication101AndFriends.d.ts +10 -0
  39. package/lib/exercises/math/calcul/mentalCaluls/mentalMultiplication101AndFriends.d.ts.map +1 -0
  40. package/lib/exercises/math/calcul/mentalCaluls/mentalMultiplication101AndFriends.js +264 -0
  41. package/lib/exercises/math/calcul/mentalCaluls/mentalMultiplication11AndFriends.d.ts +10 -0
  42. package/lib/exercises/math/calcul/mentalCaluls/mentalMultiplication11AndFriends.d.ts.map +1 -0
  43. package/lib/exercises/math/calcul/mentalCaluls/mentalMultiplication11AndFriends.js +264 -0
  44. package/lib/exercises/math/calcul/mentalCaluls/mentalMultiplicationTable.d.ts +11 -0
  45. package/lib/exercises/math/calcul/mentalCaluls/mentalMultiplicationTable.d.ts.map +1 -0
  46. package/lib/exercises/math/calcul/mentalCaluls/mentalMultiplicationTable.js +141 -0
  47. package/lib/exercises/math/calcul/ratio/index.d.ts +1 -0
  48. package/lib/exercises/math/calcul/ratio/index.d.ts.map +1 -1
  49. package/lib/exercises/math/calcul/ratio/index.js +1 -0
  50. package/lib/exercises/math/calcul/ratio/partsUsingRatio.d.ts +13 -0
  51. package/lib/exercises/math/calcul/ratio/partsUsingRatio.d.ts.map +1 -0
  52. package/lib/exercises/math/calcul/ratio/partsUsingRatio.js +237 -0
  53. package/lib/exercises/math/calcul/relatives/index.d.ts +2 -0
  54. package/lib/exercises/math/calcul/relatives/index.d.ts.map +1 -0
  55. package/lib/exercises/math/calcul/relatives/index.js +1 -0
  56. package/lib/exercises/math/calcul/relatives/relativesAddAndSub.d.ts +17 -0
  57. package/lib/exercises/math/calcul/relatives/relativesAddAndSub.d.ts.map +1 -0
  58. package/lib/exercises/math/calcul/relatives/relativesAddAndSub.js +448 -0
  59. package/lib/exercises/math/calculLitteral/factorisation/factoByXK.d.ts +10 -0
  60. package/lib/exercises/math/calculLitteral/factorisation/factoByXK.d.ts.map +1 -0
  61. package/lib/exercises/math/calculLitteral/factorisation/factoByXK.js +190 -0
  62. package/lib/exercises/math/calculLitteral/factorisation/index.d.ts +1 -0
  63. package/lib/exercises/math/calculLitteral/factorisation/index.d.ts.map +1 -1
  64. package/lib/exercises/math/calculLitteral/factorisation/index.js +1 -0
  65. package/lib/exercises/math/complex/algebraic/addComplex.d.ts +10 -0
  66. package/lib/exercises/math/complex/algebraic/addComplex.d.ts.map +1 -0
  67. package/lib/exercises/math/complex/algebraic/addComplex.js +125 -0
  68. package/lib/exercises/math/complex/algebraic/conjugateComplex.d.ts +8 -0
  69. package/lib/exercises/math/complex/algebraic/conjugateComplex.d.ts.map +1 -0
  70. package/lib/exercises/math/complex/algebraic/conjugateComplex.js +105 -0
  71. package/lib/exercises/math/complex/algebraic/conjugateDivideComplex.d.ts +8 -0
  72. package/lib/exercises/math/complex/algebraic/conjugateDivideComplex.d.ts.map +1 -0
  73. package/lib/exercises/math/complex/algebraic/conjugateDivideComplex.js +137 -0
  74. package/lib/exercises/math/complex/algebraic/conjugateMultiplyComplex.d.ts +8 -0
  75. package/lib/exercises/math/complex/algebraic/conjugateMultiplyComplex.d.ts.map +1 -0
  76. package/lib/exercises/math/complex/algebraic/conjugateMultiplyComplex.js +116 -0
  77. package/lib/exercises/math/complex/algebraic/divideComplex.d.ts +8 -0
  78. package/lib/exercises/math/complex/algebraic/divideComplex.d.ts.map +1 -0
  79. package/lib/exercises/math/complex/algebraic/divideComplex.js +128 -0
  80. package/lib/exercises/math/complex/algebraic/index.d.ts +11 -0
  81. package/lib/exercises/math/complex/algebraic/index.d.ts.map +1 -0
  82. package/lib/exercises/math/complex/algebraic/index.js +10 -0
  83. package/lib/exercises/math/complex/algebraic/inverseComplex.d.ts +8 -0
  84. package/lib/exercises/math/complex/algebraic/inverseComplex.d.ts.map +1 -0
  85. package/lib/exercises/math/complex/algebraic/inverseComplex.js +95 -0
  86. package/lib/exercises/math/complex/algebraic/linearCombinaisonComplex.d.ts +10 -0
  87. package/lib/exercises/math/complex/algebraic/linearCombinaisonComplex.d.ts.map +1 -0
  88. package/lib/exercises/math/complex/algebraic/linearCombinaisonComplex.js +105 -0
  89. package/lib/exercises/math/complex/algebraic/moduloFromAlgebraicComplex.d.ts +8 -0
  90. package/lib/exercises/math/complex/algebraic/moduloFromAlgebraicComplex.d.ts.map +1 -0
  91. package/lib/exercises/math/complex/algebraic/moduloFromAlgebraicComplex.js +93 -0
  92. package/lib/exercises/math/complex/algebraic/mutiplyComplex.d.ts +8 -0
  93. package/lib/exercises/math/complex/algebraic/mutiplyComplex.d.ts.map +1 -0
  94. package/lib/exercises/math/complex/algebraic/mutiplyComplex.js +106 -0
  95. package/lib/exercises/math/complex/algebraic/reAndIm.d.ts +9 -0
  96. package/lib/exercises/math/complex/algebraic/reAndIm.d.ts.map +1 -0
  97. package/lib/exercises/math/complex/algebraic/reAndIm.js +92 -0
  98. package/lib/exercises/math/complex/geometric/complexAlgebraicFromModuloAndArg.d.ts +9 -0
  99. package/lib/exercises/math/complex/geometric/complexAlgebraicFromModuloAndArg.d.ts.map +1 -0
  100. package/lib/exercises/math/complex/geometric/complexAlgebraicFromModuloAndArg.js +151 -0
  101. package/lib/exercises/math/complex/geometric/complexDistance.d.ts +11 -0
  102. package/lib/exercises/math/complex/geometric/complexDistance.d.ts.map +1 -0
  103. package/lib/exercises/math/complex/geometric/complexDistance.js +125 -0
  104. package/lib/exercises/math/complex/geometric/complexGeomAffixAlgFromPoint.d.ts +9 -0
  105. package/lib/exercises/math/complex/geometric/complexGeomAffixAlgFromPoint.d.ts.map +1 -0
  106. package/lib/exercises/math/complex/geometric/complexGeomAffixAlgFromPoint.js +326 -0
  107. package/lib/exercises/math/complex/geometric/complexGeomAffixExpFromCenteredRegularPolygon.d.ts +10 -0
  108. package/lib/exercises/math/complex/geometric/complexGeomAffixExpFromCenteredRegularPolygon.d.ts.map +1 -0
  109. package/lib/exercises/math/complex/geometric/complexGeomAffixExpFromCenteredRegularPolygon.js +459 -0
  110. package/lib/exercises/math/complex/geometric/complexGeomAffixExpFromPoint.d.ts +14 -0
  111. package/lib/exercises/math/complex/geometric/complexGeomAffixExpFromPoint.d.ts.map +1 -0
  112. package/lib/exercises/math/complex/geometric/complexGeomAffixExpFromPoint.js +539 -0
  113. package/lib/exercises/math/complex/geometric/complexGeomAffixTrigFromPoint.d.ts +13 -0
  114. package/lib/exercises/math/complex/geometric/complexGeomAffixTrigFromPoint.d.ts.map +1 -0
  115. package/lib/exercises/math/complex/geometric/complexGeomAffixTrigFromPoint.js +485 -0
  116. package/lib/exercises/math/complex/geometric/complexGeomApproxOfCosArgOrSinArgFromPointAndAffixTrig.d.ts +12 -0
  117. package/lib/exercises/math/complex/geometric/complexGeomApproxOfCosArgOrSinArgFromPointAndAffixTrig.d.ts.map +1 -0
  118. package/lib/exercises/math/complex/geometric/complexGeomApproxOfCosArgOrSinArgFromPointAndAffixTrig.js +224 -0
  119. package/lib/exercises/math/complex/geometric/complexGeomArgumentOfFracCBABFromFigure.d.ts +11 -0
  120. package/lib/exercises/math/complex/geometric/complexGeomArgumentOfFracCBABFromFigure.d.ts.map +1 -0
  121. package/lib/exercises/math/complex/geometric/complexGeomArgumentOfFracCBABFromFigure.js +448 -0
  122. package/lib/exercises/math/complex/geometric/complexGeomFindPointFromAffixExp.d.ts +11 -0
  123. package/lib/exercises/math/complex/geometric/complexGeomFindPointFromAffixExp.d.ts.map +1 -0
  124. package/lib/exercises/math/complex/geometric/complexGeomFindPointFromAffixExp.js +223 -0
  125. package/lib/exercises/math/complex/geometric/complexGeomFindPointFromPowerOfUnitRootFromFigure.d.ts +11 -0
  126. package/lib/exercises/math/complex/geometric/complexGeomFindPointFromPowerOfUnitRootFromFigure.d.ts.map +1 -0
  127. package/lib/exercises/math/complex/geometric/complexGeomFindPointFromPowerOfUnitRootFromFigure.js +348 -0
  128. package/lib/exercises/math/complex/geometric/complexGeomPlaceAffixPoint.d.ts +8 -0
  129. package/lib/exercises/math/complex/geometric/complexGeomPlaceAffixPoint.d.ts.map +1 -0
  130. package/lib/exercises/math/complex/geometric/complexGeomPlaceAffixPoint.js +86 -0
  131. package/lib/exercises/math/complex/geometric/complexGeomPlacePointFromZAPlusZ.d.ts +11 -0
  132. package/lib/exercises/math/complex/geometric/complexGeomPlacePointFromZAPlusZ.d.ts.map +1 -0
  133. package/lib/exercises/math/complex/geometric/complexGeomPlacePointFromZAPlusZ.js +311 -0
  134. package/lib/exercises/math/complex/geometric/complexGeomPlacePointFromZATimesZ.d.ts +11 -0
  135. package/lib/exercises/math/complex/geometric/complexGeomPlacePointFromZATimesZ.d.ts.map +1 -0
  136. package/lib/exercises/math/complex/geometric/complexGeomPlacePointFromZATimesZ.js +345 -0
  137. package/lib/exercises/math/complex/geometric/complexGeomPlacePointFromZATransformed.d.ts +16 -0
  138. package/lib/exercises/math/complex/geometric/complexGeomPlacePointFromZATransformed.d.ts.map +1 -0
  139. package/lib/exercises/math/complex/geometric/complexGeomPlacePointFromZATransformed.js +729 -0
  140. package/lib/exercises/math/complex/geometric/complexGeomPlacePointWithAffixInU.d.ts +11 -0
  141. package/lib/exercises/math/complex/geometric/complexGeomPlacePointWithAffixInU.d.ts.map +1 -0
  142. package/lib/exercises/math/complex/geometric/complexGeomPlacePointWithAffixInU.js +253 -0
  143. package/lib/exercises/math/complex/geometric/index.d.ts +12 -0
  144. package/lib/exercises/math/complex/geometric/index.d.ts.map +1 -0
  145. package/lib/exercises/math/complex/geometric/index.js +19 -0
  146. package/lib/exercises/math/complex/index.d.ts +4 -10
  147. package/lib/exercises/math/complex/index.d.ts.map +1 -1
  148. package/lib/exercises/math/complex/index.js +4 -11
  149. package/lib/exercises/math/complex/polynomials/factorizePolynomialInC.d.ts +10 -0
  150. package/lib/exercises/math/complex/polynomials/factorizePolynomialInC.d.ts.map +1 -0
  151. package/lib/exercises/math/complex/polynomials/factorizePolynomialInC.js +176 -0
  152. package/lib/exercises/math/complex/polynomials/index.d.ts +4 -0
  153. package/lib/exercises/math/complex/polynomials/index.d.ts.map +1 -0
  154. package/lib/exercises/math/complex/polynomials/index.js +3 -0
  155. package/lib/exercises/math/complex/polynomials/solveSecondDegreeInComplex.d.ts +10 -0
  156. package/lib/exercises/math/complex/polynomials/solveSecondDegreeInComplex.d.ts.map +1 -0
  157. package/lib/exercises/math/complex/polynomials/solveSecondDegreeInComplex.js +190 -0
  158. package/lib/exercises/math/complex/polynomials/solveZSquareEqualsA.d.ts +11 -0
  159. package/lib/exercises/math/complex/polynomials/solveZSquareEqualsA.d.ts.map +1 -0
  160. package/lib/exercises/math/complex/polynomials/solveZSquareEqualsA.js +158 -0
  161. package/lib/exercises/math/complex/unitRoots/giveNUnitRoot.d.ts +7 -0
  162. package/lib/exercises/math/complex/unitRoots/giveNUnitRoot.d.ts.map +1 -0
  163. package/lib/exercises/math/complex/unitRoots/giveNUnitRoot.js +122 -0
  164. package/lib/exercises/math/complex/unitRoots/giveOneSolutionToComplexPowNEqualsOne.d.ts +8 -0
  165. package/lib/exercises/math/complex/unitRoots/giveOneSolutionToComplexPowNEqualsOne.d.ts.map +1 -0
  166. package/lib/exercises/math/complex/unitRoots/giveOneSolutionToComplexPowNEqualsOne.js +138 -0
  167. package/lib/exercises/math/complex/unitRoots/index.d.ts +3 -0
  168. package/lib/exercises/math/complex/unitRoots/index.d.ts.map +1 -0
  169. package/lib/exercises/math/complex/unitRoots/index.js +2 -0
  170. package/lib/exercises/math/conversion/clock/clockReading.d.ts +12 -0
  171. package/lib/exercises/math/conversion/clock/clockReading.d.ts.map +1 -0
  172. package/lib/exercises/math/conversion/clock/clockReading.js +385 -0
  173. package/lib/exercises/math/conversion/clock/clockReadingPlusTimeOperation.d.ts +2 -0
  174. package/lib/exercises/math/conversion/clock/clockReadingPlusTimeOperation.d.ts.map +1 -0
  175. package/lib/exercises/math/conversion/clock/clockReadingPlusTimeOperation.js +521 -0
  176. package/lib/exercises/math/conversion/clock/clockWritingByManipulatingNeedles.d.ts +2 -0
  177. package/lib/exercises/math/conversion/clock/clockWritingByManipulatingNeedles.d.ts.map +1 -0
  178. package/lib/exercises/math/conversion/clock/clockWritingByManipulatingNeedles.js +359 -0
  179. package/lib/exercises/math/conversion/clock/dateTimeOperationAdd.d.ts +16 -0
  180. package/lib/exercises/math/conversion/clock/dateTimeOperationAdd.d.ts.map +1 -0
  181. package/lib/exercises/math/conversion/clock/dateTimeOperationAdd.js +319 -0
  182. package/lib/exercises/math/conversion/clock/index.d.ts +3 -0
  183. package/lib/exercises/math/conversion/clock/index.d.ts.map +1 -0
  184. package/lib/exercises/math/conversion/clock/index.js +4 -0
  185. package/lib/exercises/math/conversion/index.d.ts +1 -0
  186. package/lib/exercises/math/conversion/index.d.ts.map +1 -1
  187. package/lib/exercises/math/conversion/index.js +1 -0
  188. package/lib/exercises/math/geometry/angles/angleNatureFromFigure.d.ts +11 -0
  189. package/lib/exercises/math/geometry/angles/angleNatureFromFigure.d.ts.map +1 -0
  190. package/lib/exercises/math/geometry/angles/angleNatureFromFigure.js +233 -0
  191. package/lib/exercises/math/geometry/angles/angleNatureFromMeasure.d.ts +10 -0
  192. package/lib/exercises/math/geometry/angles/angleNatureFromMeasure.d.ts.map +1 -0
  193. package/lib/exercises/math/geometry/angles/angleNatureFromMeasure.js +137 -0
  194. package/lib/exercises/math/geometry/angles/index.d.ts +2 -0
  195. package/lib/exercises/math/geometry/angles/index.d.ts.map +1 -1
  196. package/lib/exercises/math/geometry/angles/index.js +2 -0
  197. package/lib/exercises/math/geometry/circles/buildCircleFromRadius.d.ts +9 -0
  198. package/lib/exercises/math/geometry/circles/buildCircleFromRadius.d.ts.map +1 -0
  199. package/lib/exercises/math/geometry/circles/buildCircleFromRadius.js +187 -0
  200. package/lib/exercises/math/geometry/circles/index.d.ts +1 -0
  201. package/lib/exercises/math/geometry/circles/index.d.ts.map +1 -1
  202. package/lib/exercises/math/geometry/circles/index.js +1 -0
  203. package/lib/exercises/math/geometry/lines/buildParallelFromLineAndPoint.d.ts +11 -0
  204. package/lib/exercises/math/geometry/lines/buildParallelFromLineAndPoint.d.ts.map +1 -0
  205. package/lib/exercises/math/geometry/lines/buildParallelFromLineAndPoint.js +154 -0
  206. package/lib/exercises/math/geometry/lines/buildPerpendicularFromLineAndPoint.d.ts +11 -0
  207. package/lib/exercises/math/geometry/lines/buildPerpendicularFromLineAndPoint.d.ts.map +1 -0
  208. package/lib/exercises/math/geometry/lines/buildPerpendicularFromLineAndPoint.js +157 -0
  209. package/lib/exercises/math/geometry/lines/index.d.ts +2 -0
  210. package/lib/exercises/math/geometry/lines/index.d.ts.map +1 -1
  211. package/lib/exercises/math/geometry/lines/index.js +2 -0
  212. package/lib/exercises/math/geometry/triangles/index.d.ts +2 -0
  213. package/lib/exercises/math/geometry/triangles/index.d.ts.map +1 -1
  214. package/lib/exercises/math/geometry/triangles/index.js +2 -1
  215. package/lib/exercises/math/geometry/triangles/traceHeightInTriangle.d.ts +13 -0
  216. package/lib/exercises/math/geometry/triangles/traceHeightInTriangle.d.ts.map +1 -0
  217. package/lib/exercises/math/geometry/triangles/traceHeightInTriangle.js +271 -0
  218. package/lib/exercises/math/geometry/triangles/traceMedianInTriangle.d.ts +8 -0
  219. package/lib/exercises/math/geometry/triangles/traceMedianInTriangle.d.ts.map +1 -1
  220. package/lib/exercises/math/geometry/triangles/traceMedianInTriangle.js +284 -53
  221. package/lib/exercises/math/geometry/vectors/constructions/index.d.ts +1 -0
  222. package/lib/exercises/math/geometry/vectors/constructions/index.d.ts.map +1 -1
  223. package/lib/exercises/math/geometry/vectors/constructions/index.js +1 -0
  224. package/lib/exercises/math/geometry/vectors/constructions/traceVectorSumFromVecs.d.ts +8 -0
  225. package/lib/exercises/math/geometry/vectors/constructions/traceVectorSumFromVecs.d.ts.map +1 -0
  226. package/lib/exercises/math/geometry/vectors/constructions/traceVectorSumFromVecs.js +165 -0
  227. package/lib/exercises/math/geometry/volumes/index.d.ts +1 -0
  228. package/lib/exercises/math/geometry/volumes/index.d.ts.map +1 -1
  229. package/lib/exercises/math/geometry/volumes/index.js +1 -0
  230. package/lib/exercises/math/geometry/volumes/volumeOfCylinder.d.ts +8 -0
  231. package/lib/exercises/math/geometry/volumes/volumeOfCylinder.d.ts.map +1 -0
  232. package/lib/exercises/math/geometry/volumes/volumeOfCylinder.js +157 -0
  233. package/lib/exercises/math/spaceGeometry/basis/index.d.ts +1 -0
  234. package/lib/exercises/math/spaceGeometry/basis/index.d.ts.map +1 -1
  235. package/lib/exercises/math/spaceGeometry/basis/index.js +1 -0
  236. package/lib/exercises/math/spaceGeometry/basis/spaceSegmentLengthInRectangularPrism.d.ts +18 -0
  237. package/lib/exercises/math/spaceGeometry/basis/spaceSegmentLengthInRectangularPrism.d.ts.map +1 -0
  238. package/lib/exercises/math/spaceGeometry/basis/spaceSegmentLengthInRectangularPrism.js +538 -0
  239. package/lib/exercises/math/trigonometry/formulas/trigoAdditionFormulaUsage.d.ts.map +1 -1
  240. package/lib/exercises/math/trigonometry/formulas/trigoAdditionFormulaUsage.js +6 -5
  241. package/lib/exercises/math/trigonometry/triangle/trigonometrySohcahtoaCalcul.js +1 -1
  242. package/lib/exercises/utils/geogebra/toolBarConstructor.d.ts +1 -0
  243. package/lib/exercises/utils/geogebra/toolBarConstructor.d.ts.map +1 -1
  244. package/lib/exercises/utils/geogebra/toolBarConstructor.js +2 -0
  245. package/lib/geogebra/parsers/geogebraParser.d.ts +3 -0
  246. package/lib/geogebra/parsers/geogebraParser.d.ts.map +1 -1
  247. package/lib/geogebra/parsers/geogebraParser.js +27 -0
  248. package/lib/index.d.ts +213 -23
  249. package/lib/index.d.ts.map +1 -1
  250. package/lib/latexTester.js +2 -0
  251. package/lib/math/geometry/angle.d.ts.map +1 -1
  252. package/lib/math/geometry/angle.js +3 -0
  253. package/lib/math/geometry/segment.d.ts +1 -1
  254. package/lib/math/geometry/segment.d.ts.map +1 -1
  255. package/lib/math/geometry/segment.js +5 -2
  256. package/lib/math/utils/geometry/angleBetweenPoints.d.ts +4 -0
  257. package/lib/math/utils/geometry/angleBetweenPoints.d.ts.map +1 -0
  258. package/lib/math/utils/geometry/angleBetweenPoints.js +58 -0
  259. package/lib/math/utils/geometry/angleNWSE.d.ts +3 -0
  260. package/lib/math/utils/geometry/angleNWSE.d.ts.map +1 -0
  261. package/lib/math/utils/geometry/angleNWSE.js +56 -0
  262. package/lib/tests/singleExo.test.d.ts.map +1 -1
  263. package/lib/tests/singleExo.test.js +2 -2
  264. package/lib/utils/strings/frenchDays.d.ts +2 -0
  265. package/lib/utils/strings/frenchDays.d.ts.map +1 -0
  266. package/lib/utils/strings/frenchDays.js +9 -0
  267. package/package.json +1 -1
@@ -0,0 +1,151 @@
1
+ import { addValidProp, shuffleProps, propWhile, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { mainTrigoValues } from "../../../../math/trigonometry/remarkableValues.js";
4
+ import { randint } from "../../../../math/utils/random/randint.js";
5
+ import { ComplexNode } from "../../../../tree/nodes/complex/complexNode.js";
6
+ import { cos } from "../../../../tree/nodes/functions/cosNode.js";
7
+ import { sin } from "../../../../tree/nodes/functions/sinNode.js";
8
+ import { reifyAlgebraic, } from "../../../../tree/nodes/nodeConstructor.js";
9
+ import { add } from "../../../../tree/nodes/operators/addNode.js";
10
+ import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
11
+ import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
12
+ import { random } from "../../../../utils/alea/random.js";
13
+ import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
14
+ import { alignTex } from "../../../../utils/latex/alignTex.js";
15
+ const getPropositions = (n, { answer, moduleIds }) => {
16
+ const propositions = [];
17
+ addValidProp(propositions, answer);
18
+ propWhile(propositions, n, () => {
19
+ tryToAddWrongProp(propositions, getAnswer({
20
+ moduleIds,
21
+ argIds: random(mainTrigoValues).angle.toIdentifiers(),
22
+ }));
23
+ });
24
+ return shuffleProps(propositions, n);
25
+ };
26
+ const getAnswer = (identifiers) => {
27
+ const { argIds, moduleIds } = identifiers;
28
+ const arg = reifyAlgebraic(argIds);
29
+ const module = reifyAlgebraic(moduleIds);
30
+ const re = multiply(module, cos(arg)).simplify();
31
+ const im = multiply(module, sin(arg)).simplify();
32
+ return new ComplexNode(re, im).toTex();
33
+ };
34
+ const getInstruction = (identifiers) => {
35
+ const { argIds, moduleIds } = identifiers;
36
+ const arg = reifyAlgebraic(argIds);
37
+ const module = reifyAlgebraic(moduleIds);
38
+ return `Donner la forme algbérique du nombre complexe $z$ tel que :
39
+
40
+ $$
41
+ |z| = ${module.toTex()}
42
+ $$
43
+
44
+ et
45
+
46
+ $$
47
+ \\arg(z) = ${arg.toTex()} \\ (2\\pi)
48
+ $$`;
49
+ };
50
+ const getHint = () => {
51
+ return `Soit $z$ un nombre complexe de module $r$ et dont un argument est $\\theta$.
52
+
53
+ Alors $z$ peut s'écrire sous sa forme trigonométrique :
54
+
55
+ $$
56
+ z = r \\left(\\cos\\left(\\theta\\right) + i \\sin\\left(\\theta\\right)\\right)
57
+ $$`;
58
+ };
59
+ const getCorrection = (identifiers) => {
60
+ const { argIds, moduleIds } = identifiers;
61
+ const arg = reifyAlgebraic(argIds);
62
+ const module = reifyAlgebraic(moduleIds);
63
+ return `Soit $z$ un nombre complexe de module $r$ et dont un argument est $\\theta$.
64
+
65
+ Alors $z$ peut s'écrire sous sa forme trigonométrique :
66
+
67
+ $$
68
+ z = r \\left(\\cos\\left(\\theta\\right) + i \\sin\\left(\\theta\\right)\\right)
69
+ $$
70
+
71
+ Ici, $r = ${module.toTex()}$ et $\\theta = ${arg.toTex()}$.
72
+
73
+ On a donc :
74
+
75
+ ${alignTex([
76
+ ["z", "=", multiply(module, add(cos(arg), multiply("i", sin(arg)))).toTex()],
77
+ [
78
+ "",
79
+ "=",
80
+ multiply(module, add(cos(arg).simplify(), multiply(sin(arg).simplify(), "i"))).toTex({
81
+ forceNoSimplification: true,
82
+ }),
83
+ ],
84
+ ["", "=", getAnswer(identifiers)],
85
+ ])}
86
+ `;
87
+ };
88
+ const getKeys = () => {
89
+ return ["i"];
90
+ };
91
+ const isAnswerValid = (ans, { answer: _answer, ...identifiers }) => {
92
+ try {
93
+ const { argIds, moduleIds } = identifiers;
94
+ const parsed = parseAlgebraic(ans);
95
+ const arg = reifyAlgebraic(argIds);
96
+ const module = reifyAlgebraic(moduleIds);
97
+ return (multiply(module, add(cos(arg), multiply("i", sin(arg))))
98
+ .simplify({
99
+ towardsDistribute: true,
100
+ forbidFactorize: true,
101
+ })
102
+ .toTex() ===
103
+ parsed
104
+ .simplify({
105
+ towardsDistribute: true,
106
+ forbidFactorize: true,
107
+ })
108
+ .toTex());
109
+ }
110
+ catch (err) {
111
+ return handleVEAError(err);
112
+ }
113
+ };
114
+ const getComplexAlgebraicFromModuloAndArgQuestion = () => {
115
+ const module = randint(2, 10);
116
+ const arg = random(mainTrigoValues).angle;
117
+ const identifiers = {
118
+ moduleIds: module.toTree().toIdentifiers(),
119
+ argIds: arg.toIdentifiers(),
120
+ };
121
+ return getQuestionFromIdentifiers(identifiers);
122
+ };
123
+ const getQuestionFromIdentifiers = (identifiers) => {
124
+ return {
125
+ answer: getAnswer(identifiers),
126
+ instruction: getInstruction(identifiers),
127
+ keys: getKeys(identifiers),
128
+ answerFormat: "tex",
129
+ identifiers,
130
+ hint: getHint(identifiers),
131
+ correction: getCorrection(identifiers),
132
+ };
133
+ };
134
+ export const complexAlgebraicFromModuloAndArg = {
135
+ id: "complexAlgebraicFromModuloAndArg",
136
+ connector: "=",
137
+ label: "Écrire la forme algébrique d'un nombre complexe dont le module et un argument sont donnés",
138
+ isSingleStep: true,
139
+ generator: (nb, opts) => getDistinctQuestions(() => getComplexAlgebraicFromModuloAndArgQuestion(opts), nb),
140
+ qcmTimer: 60,
141
+ freeTimer: 60,
142
+ getPropositions,
143
+ isAnswerValid,
144
+ subject: "Mathématiques",
145
+ getInstruction,
146
+ getHint,
147
+ getCorrection,
148
+ getAnswer,
149
+ getQuestionFromIdentifiers,
150
+ hasHintAndCorrection: true,
151
+ };
@@ -0,0 +1,11 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ import { NodeIdentifiers } from "../../../../tree/nodes/nodeConstructor.js";
3
+ type Identifiers = {
4
+ aReIds: NodeIdentifiers;
5
+ aImIds: NodeIdentifiers;
6
+ bReIds: NodeIdentifiers;
7
+ bImIds: NodeIdentifiers;
8
+ };
9
+ export declare const complexDistance: Exercise<Identifiers>;
10
+ export {};
11
+ //# sourceMappingURL=complexDistance.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"complexDistance.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/complex/geometric/complexDistance.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAMrC,OAAO,EACL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;AAQ7C,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,eAAe,CAAC;IACxB,MAAM,EAAE,eAAe,CAAC;IACxB,MAAM,EAAE,eAAe,CAAC;IACxB,MAAM,EAAE,eAAe,CAAC;CACzB,CAAC;AA4GF,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,WAAW,CAkBjD,CAAC"}
@@ -0,0 +1,125 @@
1
+ import { addValidProp, shuffleProps, propWhile, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { sqrtVEA } from "../../../../exercises/vea/sqrtVEA.js";
4
+ import { SquareRootConstructor } from "../../../../math/numbers/reals/real.js";
5
+ import { randint } from "../../../../math/utils/random/randint.js";
6
+ import { sqrt } from "../../../../tree/nodes/functions/sqrtNode.js";
7
+ import { reifyAlgebraic, } from "../../../../tree/nodes/nodeConstructor.js";
8
+ import { add } from "../../../../tree/nodes/operators/addNode.js";
9
+ import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
10
+ import { square } from "../../../../tree/nodes/operators/powerNode.js";
11
+ import { substract } from "../../../../tree/nodes/operators/substractNode.js";
12
+ import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
13
+ import { alignTex } from "../../../../utils/latex/alignTex.js";
14
+ const getPropositions = (n, { answer }) => {
15
+ const propositions = [];
16
+ addValidProp(propositions, answer);
17
+ propWhile(propositions, n, () => {
18
+ tryToAddWrongProp(propositions, SquareRootConstructor.randomIrreductible().toTex());
19
+ });
20
+ return shuffleProps(propositions, n);
21
+ };
22
+ const getAnswer = (identifiers) => {
23
+ const { aReIds, aImIds, bReIds, bImIds } = identifiers;
24
+ const aRe = reifyAlgebraic(aReIds);
25
+ const aIm = reifyAlgebraic(aImIds);
26
+ const bRe = reifyAlgebraic(bReIds);
27
+ const bIm = reifyAlgebraic(bImIds);
28
+ const subRe = substract(aRe, bRe).simplify();
29
+ const subIm = substract(aIm, bIm).simplify();
30
+ const squareRoot = sqrt(add(square(subRe), square(subIm)))
31
+ .simplify()
32
+ .toTex();
33
+ return squareRoot;
34
+ };
35
+ const getInstruction = (identifiers) => {
36
+ const { aReIds, aImIds, bReIds, bImIds } = identifiers;
37
+ const aRe = reifyAlgebraic(aReIds);
38
+ const aIm = reifyAlgebraic(aImIds);
39
+ const bRe = reifyAlgebraic(bReIds);
40
+ const bIm = reifyAlgebraic(bImIds);
41
+ const affA = add(aRe, multiply(aIm, "i")).toTex();
42
+ const affB = add(bRe, multiply(bIm, "i")).toTex();
43
+ return `Dans le plan complexe, on considère le point $A$ d'affixe $${affA}$ et le point $B$ d'affixe $${affB}$.
44
+
45
+ Déterminer $AB$.`;
46
+ };
47
+ const getHint = () => {
48
+ return `Si $a$ est l'affixe d'un point $A$ et $b$ celle d'un point $B$, alors :
49
+
50
+ $$
51
+ AB = |a-b| = |b-a|
52
+ $$`;
53
+ };
54
+ const getCorrection = (identifiers) => {
55
+ const { aReIds, aImIds, bReIds, bImIds } = identifiers;
56
+ const aRe = reifyAlgebraic(aReIds);
57
+ const aIm = reifyAlgebraic(aImIds);
58
+ const bRe = reifyAlgebraic(bReIds);
59
+ const bIm = reifyAlgebraic(bImIds);
60
+ const subRe = substract(aRe, bRe).simplify();
61
+ const subIm = substract(aIm, bIm).simplify();
62
+ const affA = add(aRe, multiply(aIm, "i"));
63
+ const affB = add(bRe, multiply(bIm, "i"));
64
+ return `On a :
65
+
66
+ ${alignTex([
67
+ ["AB", "=", `|${substract(affA, affB).toTex()}|`],
68
+ ["", "=", `|${add(subRe, multiply(subIm, "i")).toTex()}|`],
69
+ ["", "=", sqrt(add(square(subRe), square(subIm))).toTex()],
70
+ ["", "=", getAnswer(identifiers)],
71
+ ])} `;
72
+ };
73
+ const getKeys = () => {
74
+ return ["i"];
75
+ };
76
+ const isAnswerValid = (ans, { answer }) => {
77
+ try {
78
+ return sqrtVEA(ans, answer);
79
+ }
80
+ catch (err) {
81
+ return handleVEAError(err);
82
+ }
83
+ };
84
+ const getComplexDistanceQuestion = () => {
85
+ const aRe = randint(-10, 10, [0]);
86
+ const aIm = randint(-10, 10, [0]);
87
+ const bRe = randint(-10, 10, [0]);
88
+ const bIm = randint(-10, 10, [0, aIm]);
89
+ const identifiers = {
90
+ aImIds: aIm.toTree().toIdentifiers(),
91
+ aReIds: aRe.toTree().toIdentifiers(),
92
+ bImIds: bIm.toTree().toIdentifiers(),
93
+ bReIds: bRe.toTree().toIdentifiers(),
94
+ };
95
+ return getQuestionFromIdentifiers(identifiers);
96
+ };
97
+ const getQuestionFromIdentifiers = (identifiers) => {
98
+ return {
99
+ answer: getAnswer(identifiers),
100
+ instruction: getInstruction(identifiers),
101
+ keys: getKeys(identifiers),
102
+ answerFormat: "tex",
103
+ identifiers,
104
+ hint: getHint(identifiers),
105
+ correction: getCorrection(identifiers),
106
+ };
107
+ };
108
+ export const complexDistance = {
109
+ id: "complexDistance",
110
+ connector: "=",
111
+ label: "Calculer une distance dans le plan complexe",
112
+ isSingleStep: true,
113
+ generator: (nb, opts) => getDistinctQuestions(() => getComplexDistanceQuestion(opts), nb),
114
+ qcmTimer: 60,
115
+ freeTimer: 60,
116
+ getPropositions,
117
+ isAnswerValid,
118
+ subject: "Mathématiques",
119
+ getInstruction,
120
+ getHint,
121
+ getCorrection,
122
+ getAnswer,
123
+ getQuestionFromIdentifiers,
124
+ hasHintAndCorrection: true,
125
+ };
@@ -0,0 +1,9 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ import { NodeIdentifiers } from "../../../../tree/nodes/nodeConstructor.js";
3
+ type Identifiers = {
4
+ nodeIdsX: NodeIdentifiers;
5
+ nodeIdsY: NodeIdentifiers;
6
+ };
7
+ export declare const complexGeomAffixAlgFromPoint: Exercise<Identifiers>;
8
+ export {};
9
+ //# sourceMappingURL=complexGeomAffixAlgFromPoint.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"complexGeomAffixAlgFromPoint.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/complex/geometric/complexGeomAffixAlgFromPoint.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAiBT,MAAM,6BAA6B,CAAC;AAYrC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAgC7C,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,eAAe,CAAC;IAC1B,QAAQ,EAAE,eAAe,CAAC;CAC3B,CAAC;AA+UF,eAAO,MAAM,4BAA4B,EAAE,QAAQ,CAAC,WAAW,CAiB9D,CAAC"}
@@ -0,0 +1,326 @@
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 } from "../../../../math/geometry/point.js";
5
+ import { nodeBySubstitutingVar } from "../../../../math/utils/functions/functionComposition.js";
6
+ import { randint } from "../../../../math/utils/random/randint.js";
7
+ import { ComplexNode } from "../../../../tree/nodes/complex/complexNode.js";
8
+ import { isOppositeNode, opposite, } from "../../../../tree/nodes/functions/oppositeNode.js";
9
+ import { NodeConstructor, } from "../../../../tree/nodes/nodeConstructor.js";
10
+ import { isNumberNode } from "../../../../tree/nodes/numbers/numberNode.js";
11
+ import { add, isAddNode } from "../../../../tree/nodes/operators/addNode.js";
12
+ import { isMultiplyNode, multiply, MultiplyNode, } from "../../../../tree/nodes/operators/multiplyNode.js";
13
+ import { isSubstractNode, substract, } from "../../../../tree/nodes/operators/substractNode.js";
14
+ import { VariableNode } from "../../../../tree/nodes/variables/variableNode.js";
15
+ import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
16
+ import { NodeComparator } from "../../../../tree/utilities/nodeComparator.js";
17
+ import { coinFlip } from "../../../../utils/alea/coinFlip.js";
18
+ import { probaLawFlip } from "../../../../utils/alea/probaLawFlip.js";
19
+ import { random } from "../../../../utils/alea/random.js";
20
+ import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
21
+ class MyReverseOrderedComplexNode extends ComplexNode {
22
+ toTex() {
23
+ const nodeI = new VariableNode("i");
24
+ if (NodeComparator.isEqualViaSub(this.im, (0).toTree()))
25
+ return this.re.toTex();
26
+ if (NodeComparator.isEqualViaSub(this.re, (0).toTree())) {
27
+ return new MultiplyNode(this.im, nodeI).toTex();
28
+ }
29
+ return add(multiply(this.im, nodeI), this.re).toTex();
30
+ }
31
+ }
32
+ const getHydrated = (identifiers) => {
33
+ const { nodeIdsX, nodeIdsY } = identifiers;
34
+ const [nodeX, nodeY] = [nodeIdsX, nodeIdsY].map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds));
35
+ const nodeAffix = new ComplexNode(nodeX, nodeY);
36
+ const pointM = new Point("M", nodeX, nodeY);
37
+ return {
38
+ nodeX,
39
+ nodeY,
40
+ nodeAffix,
41
+ pointM,
42
+ };
43
+ };
44
+ const getInstruction = (_identifiers) => {
45
+ return `On considère le point $M$ placé dans le plan complexe ci-dessous.
46
+
47
+ Donner l'affixe de $M$, sous forme algébrique.`;
48
+ };
49
+ const getAnswerNode = (identifiers) => {
50
+ const { nodeAffix } = getHydrated(identifiers);
51
+ return nodeAffix;
52
+ };
53
+ const getAnswer = (identifiers) => {
54
+ return getAnswerNode(identifiers).toTex();
55
+ };
56
+ const getHint = () => {
57
+ return `Soit $z$ l'affixe du point $M$.
58
+ L'écriture sous forme algébrique de $z$ est :
59
+
60
+ $$
61
+ \\text{Re}(z) + i \\ \\text{Im}(z)
62
+ $$
63
+
64
+ La partie réelle se lit sur l'axe des abscisses et la partie imaginaire sur l'axe des imaginaires purs.
65
+ `;
66
+ };
67
+ const getCorrection = (identifiers) => {
68
+ const { nodeX, nodeY, nodeAffix } = getHydrated(identifiers);
69
+ return `Soit $z$ l'affixe du point $M$.
70
+
71
+ L'abscisse du point $M$ est $${nodeX.toTex()}$.
72
+ La partie réelle de $z$ est donc $${nodeX.toTex()}$.
73
+
74
+ L'ordonnée du point $M$ est $${nodeY.toTex()}$.
75
+ La partie imaginaire de $z$ est donc $${nodeY.toTex()}$.
76
+
77
+ L'affixe de $M$ est donc $${nodeAffix.toTex()}$.`;
78
+ };
79
+ const getGGBOptions = (identifiers) => {
80
+ const { pointM } = getHydrated(identifiers);
81
+ const ggb = new GeogebraConstructor({
82
+ isGridSimple: true,
83
+ commands: [
84
+ //pointM
85
+ ...[
86
+ `M = ${pointM.toMathString()}`,
87
+ `SetFixed(M, true, false)`,
88
+ `ShowLabel(M, true)`,
89
+ ],
90
+ ],
91
+ fontSize: 16,
92
+ });
93
+ return ggb.getOptions({
94
+ coords: [-4.1, 4.1, -4.1, 4.1],
95
+ });
96
+ };
97
+ const getPropositions = (n, { answer, ...identifiers }) => {
98
+ const propositions = [];
99
+ const { nodeX, nodeY, nodeAffix } = getHydrated(identifiers);
100
+ const [isReverseOrder, nodeAffixValid] = (() => {
101
+ if (NodeComparator.isEqualViaSub(nodeX, (0).toTree()) ||
102
+ NodeComparator.isEqualViaSub(nodeY, (0).toTree())) {
103
+ return [false, nodeAffix];
104
+ }
105
+ else {
106
+ const isReverseOrder = coinFlip();
107
+ const nodeAffix = isReverseOrder
108
+ ? new MyReverseOrderedComplexNode(nodeX, nodeY)
109
+ : new ComplexNode(nodeX, nodeY);
110
+ return [isReverseOrder, nodeAffix];
111
+ }
112
+ })();
113
+ addValidProp(propositions, nodeAffixValid.toTex());
114
+ //student: x<->y
115
+ if (isReverseOrder) {
116
+ const nodeAffixWrong = !isReverseOrder
117
+ ? new MyReverseOrderedComplexNode(nodeY, nodeX)
118
+ : new ComplexNode(nodeY, nodeX);
119
+ tryToAddWrongProp(propositions, nodeAffixWrong.toTex());
120
+ }
121
+ //student: forgets i
122
+ {
123
+ const nodeAffixWrong = add(nodeX, nodeY);
124
+ tryToAddWrongProp(propositions, nodeAffixWrong.toTex());
125
+ }
126
+ //student: reads wrong: offset
127
+ {
128
+ const isFarX = Math.abs(nodeX.evaluate()) > 3;
129
+ const isFarY = Math.abs(nodeY.evaluate()) > 3;
130
+ if (isFarX && isFarY) {
131
+ const [vOffsetX, vOffsetY] = probaLawFlip([
132
+ [[coinFlip() ? +1 : -1, 0], 0.4],
133
+ [[0, coinFlip() ? +1 : -1], 0.4],
134
+ [[coinFlip() ? +1 : -1, coinFlip() ? +1 : -1], 0.2],
135
+ ]);
136
+ const nodeXWrong = add(nodeX, vOffsetX).simplify({
137
+ towardsDistribute: true,
138
+ });
139
+ const nodeYWrong = add(nodeY, vOffsetY).simplify({
140
+ towardsDistribute: true,
141
+ });
142
+ const nodeAffixWrong = coinFlip()
143
+ ? new MyReverseOrderedComplexNode(nodeXWrong, nodeYWrong)
144
+ : new ComplexNode(nodeXWrong, nodeYWrong);
145
+ tryToAddWrongProp(propositions, nodeAffixWrong.toTex());
146
+ }
147
+ else {
148
+ if (isFarX) {
149
+ const vOffsetX = coinFlip() ? +1 : -1;
150
+ const nodeXWrong = add(nodeX, vOffsetX).simplify({
151
+ towardsDistribute: true,
152
+ });
153
+ const nodeAffixWrong = coinFlip()
154
+ ? new MyReverseOrderedComplexNode(nodeXWrong, nodeY)
155
+ : new ComplexNode(nodeXWrong, nodeY);
156
+ tryToAddWrongProp(propositions, nodeAffixWrong.toTex());
157
+ }
158
+ else {
159
+ const vOffsetY = coinFlip() ? +1 : -1;
160
+ const nodeYWrong = add(nodeY, vOffsetY).simplify({
161
+ towardsDistribute: true,
162
+ });
163
+ const nodeAffixWrong = coinFlip()
164
+ ? new MyReverseOrderedComplexNode(nodeX, nodeYWrong)
165
+ : new ComplexNode(nodeX, nodeYWrong);
166
+ tryToAddWrongProp(propositions, nodeAffixWrong.toTex());
167
+ }
168
+ }
169
+ }
170
+ //filler
171
+ propWhile(propositions, n, () => {
172
+ const identifiersWrong = createRandomIdentifiers();
173
+ tryToAddWrongProp(propositions, getAnswer(identifiersWrong));
174
+ });
175
+ return shuffleProps(propositions, n);
176
+ };
177
+ const getKeys = () => {
178
+ return ["i"];
179
+ };
180
+ const isAnswerValid = (ans, { answer, ...identifiers }) => {
181
+ try {
182
+ const nodeAns = parseAlgebraic(ans);
183
+ const nodeI = new VariableNode("i");
184
+ //todo: parse complex numbers
185
+ //todo: use regexps on algebraicNodes
186
+ const [nodeXAns, nodeYAns] = (() => {
187
+ const nodeXAns = nodeBySubstitutingVar(nodeAns, (0).toTree(), nodeI).simplify({ towardsDistribute: true });
188
+ //pour chopper le terme en i...
189
+ const nodeYAns = nodeBySubstitutingVar(substract(nodeAns, nodeXAns), (1).toTree(), nodeI).simplify({ towardsDistribute: true });
190
+ return [nodeXAns, nodeYAns];
191
+ })();
192
+ // console.log(
193
+ // "[nodeXAns, nodeYAns]",
194
+ // [nodeXAns, nodeYAns].map((node) => node.toTex()),
195
+ // );
196
+ const { nodeX, nodeY } = getHydrated(identifiers);
197
+ // console.log(
198
+ // "[nodeX, nodeY]",
199
+ // [nodeX, nodeY].map((node) => node.toTex()),
200
+ // );
201
+ // const nodeI = new VariableNode("i");
202
+ // const nodeAffixAnswer = add(nodeX, multiply(nodeY, nodeI)).simplify({
203
+ // towardsDistribute: true,
204
+ // });
205
+ const isRealNumberNode = (node) => {
206
+ if (isNumberNode(node)) {
207
+ return true;
208
+ }
209
+ else if (isOppositeNode(node)) {
210
+ if (isNumberNode(node.child)) {
211
+ return true;
212
+ }
213
+ else {
214
+ return false;
215
+ }
216
+ }
217
+ else {
218
+ return false;
219
+ }
220
+ };
221
+ const isImaginaryNumberNode = (node) => {
222
+ if (!isMultiplyNode(node)) {
223
+ if (NodeComparator.isEqualViaSub(node, nodeI)) {
224
+ return true;
225
+ }
226
+ else if (NodeComparator.isEqualViaSub(node, opposite(nodeI))) {
227
+ return true;
228
+ }
229
+ else {
230
+ return false;
231
+ }
232
+ }
233
+ else {
234
+ if (isRealNumberNode(node.leftChild) &&
235
+ NodeComparator.isEqualViaSub(nodeI, node.rightChild)) {
236
+ return true;
237
+ }
238
+ else if (NodeComparator.isEqualViaSub(nodeI, node.leftChild) &&
239
+ isRealNumberNode(node.rightChild)) {
240
+ return true;
241
+ }
242
+ else {
243
+ return false;
244
+ }
245
+ }
246
+ };
247
+ //filter out invalid inputs
248
+ if (NodeComparator.isEqualViaSub(nodeX, (0).toTree())) {
249
+ if (!isRealNumberNode(nodeYAns)) {
250
+ return false;
251
+ }
252
+ }
253
+ else if (NodeComparator.isEqualViaSub(nodeY, (0).toTree())) {
254
+ if (!isRealNumberNode(nodeXAns)) {
255
+ return false;
256
+ }
257
+ }
258
+ else {
259
+ if (!(isAddNode(nodeAns) || isSubstractNode(nodeAns))) {
260
+ return false;
261
+ }
262
+ if (isRealNumberNode(nodeAns.leftChild) &&
263
+ isImaginaryNumberNode(nodeAns.rightChild)) {
264
+ //pass
265
+ }
266
+ else if (isImaginaryNumberNode(nodeAns.leftChild) &&
267
+ isRealNumberNode(nodeAns.rightChild)) {
268
+ //pass
269
+ }
270
+ else {
271
+ return false;
272
+ }
273
+ }
274
+ return (NodeComparator.isEqualViaSub(nodeXAns, nodeX) &&
275
+ NodeComparator.isEqualViaSub(nodeYAns, nodeY));
276
+ }
277
+ catch (err) {
278
+ console.log("err", err);
279
+ return handleVEAError(err);
280
+ }
281
+ };
282
+ const createRandomIdentifiers = () => {
283
+ const [isZeroAllowedX, isZeroAllowedY] = random([
284
+ [true, false],
285
+ [false, true],
286
+ [false, false],
287
+ ]);
288
+ const valueX = randint(-4, 4, isZeroAllowedX ? [] : [0]);
289
+ const valueY = randint(-4, 4, isZeroAllowedY ? [] : [0]);
290
+ const identifiers = {
291
+ nodeIdsX: valueX.toTree().toIdentifiers(),
292
+ nodeIdsY: valueY.toTree().toIdentifiers(),
293
+ };
294
+ return identifiers;
295
+ };
296
+ const getComplexGeomAffixAlgFromPointQuestion = () => {
297
+ const identifiers = createRandomIdentifiers();
298
+ return getQuestionFromIdentifiers(identifiers);
299
+ };
300
+ const getQuestionFromIdentifiers = (identifiers, opts) => {
301
+ const question = {
302
+ answer: getAnswer(identifiers),
303
+ instruction: getInstruction(identifiers),
304
+ keys: getKeys(identifiers, opts),
305
+ answerFormat: "tex",
306
+ identifiers,
307
+ hint: getHint(identifiers),
308
+ correction: getCorrection(identifiers),
309
+ ggbOptions: getGGBOptions(identifiers, opts),
310
+ };
311
+ return question;
312
+ };
313
+ export const complexGeomAffixAlgFromPoint = {
314
+ id: "complexGeomAffixAlgFromPoint",
315
+ label: "Déterminer l'affixe d'un point sous forme algébrique",
316
+ isSingleStep: true,
317
+ generator: (nb, opts) => getDistinctQuestions(() => getComplexGeomAffixAlgFromPointQuestion(opts), nb),
318
+ qcmTimer: 60,
319
+ freeTimer: 60,
320
+ isAnswerValid,
321
+ getPropositions,
322
+ subject: "Mathématiques",
323
+ getQuestionFromIdentifiers,
324
+ hasHintAndCorrection: true,
325
+ hasGeogebra: true,
326
+ };
@@ -0,0 +1,10 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ import { NodeIdentifiers } from "../../../../tree/nodes/nodeConstructor.js";
3
+ type Identifiers = {
4
+ nbSides: number;
5
+ vFactor: number;
6
+ nodeIdsModule: NodeIdentifiers;
7
+ };
8
+ export declare const complexGeomAffixExpFromCenteredRegularPolygon: Exercise<Identifiers>;
9
+ export {};
10
+ //# sourceMappingURL=complexGeomAffixExpFromCenteredRegularPolygon.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"complexGeomAffixExpFromCenteredRegularPolygon.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/complex/geometric/complexGeomAffixExpFromCenteredRegularPolygon.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAiBT,MAAM,6BAA6B,CAAC;AAWrC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAqF7C,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,eAAe,CAAC;CAChC,CAAC;AAqhBF,eAAO,MAAM,6CAA6C,EAAE,QAAQ,CAAC,WAAW,CAmB7E,CAAC"}