math-exercises 3.0.214 → 3.0.216

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 (371) 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 +82 -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 +2 -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/graphs/adjacentMatrixPath.d.ts +10 -0
  233. package/lib/exercises/math/graphs/adjacentMatrixPath.d.ts.map +1 -0
  234. package/lib/exercises/math/graphs/adjacentMatrixPath.js +89 -0
  235. package/lib/exercises/math/graphs/edgesNumberFromSummitsDegrees.d.ts +7 -0
  236. package/lib/exercises/math/graphs/edgesNumberFromSummitsDegrees.d.ts.map +1 -0
  237. package/lib/exercises/math/graphs/edgesNumberFromSummitsDegrees.js +98 -0
  238. package/lib/exercises/math/graphs/eulerianChainFromAdjacentMatrix.d.ts +8 -0
  239. package/lib/exercises/math/graphs/eulerianChainFromAdjacentMatrix.d.ts.map +1 -0
  240. package/lib/exercises/math/graphs/eulerianChainFromAdjacentMatrix.js +96 -0
  241. package/lib/exercises/math/graphs/graphsChainOrPathOfLengthN.d.ts +15 -0
  242. package/lib/exercises/math/graphs/graphsChainOrPathOfLengthN.d.ts.map +1 -0
  243. package/lib/exercises/math/graphs/graphsChainOrPathOfLengthN.js +262 -0
  244. package/lib/exercises/math/graphs/graphsCheckIsConnectedUndirectedGraph.d.ts +11 -0
  245. package/lib/exercises/math/graphs/graphsCheckIsConnectedUndirectedGraph.d.ts.map +1 -0
  246. package/lib/exercises/math/graphs/graphsCheckIsConnectedUndirectedGraph.js +178 -0
  247. package/lib/exercises/math/graphs/graphsCheckIsSameGraph.d.ts +19 -0
  248. package/lib/exercises/math/graphs/graphsCheckIsSameGraph.d.ts.map +1 -0
  249. package/lib/exercises/math/graphs/graphsCheckIsSameGraph.js +301 -0
  250. package/lib/exercises/math/graphs/graphsCheckIsVerticesAdjacent.d.ts +16 -0
  251. package/lib/exercises/math/graphs/graphsCheckIsVerticesAdjacent.d.ts.map +1 -0
  252. package/lib/exercises/math/graphs/graphsCheckIsVerticesAdjacent.js +207 -0
  253. package/lib/exercises/math/graphs/graphsDegreeOfVertex.d.ts +15 -0
  254. package/lib/exercises/math/graphs/graphsDegreeOfVertex.d.ts.map +1 -0
  255. package/lib/exercises/math/graphs/graphsDegreeOfVertex.js +232 -0
  256. package/lib/exercises/math/graphs/graphsOrderOfGraph.d.ts +14 -0
  257. package/lib/exercises/math/graphs/graphsOrderOfGraph.d.ts.map +1 -0
  258. package/lib/exercises/math/graphs/graphsOrderOfGraph.js +222 -0
  259. package/lib/exercises/math/graphs/index.d.ts +10 -0
  260. package/lib/exercises/math/graphs/index.d.ts.map +1 -0
  261. package/lib/exercises/math/graphs/index.js +9 -0
  262. package/lib/exercises/math/index.d.ts +1 -0
  263. package/lib/exercises/math/index.d.ts.map +1 -1
  264. package/lib/exercises/math/index.js +1 -0
  265. package/lib/exercises/math/matrices/areMatricesInverse.d.ts +9 -0
  266. package/lib/exercises/math/matrices/areMatricesInverse.d.ts.map +1 -0
  267. package/lib/exercises/math/matrices/areMatricesInverse.js +106 -0
  268. package/lib/exercises/math/matrices/computeFixedMatrixInRecurrenceSequence.d.ts +9 -0
  269. package/lib/exercises/math/matrices/computeFixedMatrixInRecurrenceSequence.d.ts.map +1 -0
  270. package/lib/exercises/math/matrices/computeFixedMatrixInRecurrenceSequence.js +144 -0
  271. package/lib/exercises/math/matrices/findInversedMatrixFromSystem.d.ts +8 -0
  272. package/lib/exercises/math/matrices/findInversedMatrixFromSystem.d.ts.map +1 -0
  273. package/lib/exercises/math/matrices/findInversedMatrixFromSystem.js +148 -0
  274. package/lib/exercises/math/matrices/index.d.ts +12 -0
  275. package/lib/exercises/math/matrices/index.d.ts.map +1 -1
  276. package/lib/exercises/math/matrices/index.js +12 -0
  277. package/lib/exercises/math/matrices/isMatrixTransitionMatrix.d.ts +8 -0
  278. package/lib/exercises/math/matrices/isMatrixTransitionMatrix.d.ts.map +1 -0
  279. package/lib/exercises/math/matrices/isMatrixTransitionMatrix.js +132 -0
  280. package/lib/exercises/math/matrices/matrixBuildMatrixFromCoefficients.d.ts +8 -0
  281. package/lib/exercises/math/matrices/matrixBuildMatrixFromCoefficients.d.ts.map +1 -0
  282. package/lib/exercises/math/matrices/matrixBuildMatrixFromCoefficients.js +152 -0
  283. package/lib/exercises/math/matrices/matrixCheckIsSymmetrical.d.ts +8 -0
  284. package/lib/exercises/math/matrices/matrixCheckIsSymmetrical.d.ts.map +1 -0
  285. package/lib/exercises/math/matrices/matrixCheckIsSymmetrical.js +155 -0
  286. package/lib/exercises/math/matrices/matrixComputeDetOfMat2.d.ts +8 -0
  287. package/lib/exercises/math/matrices/matrixComputeDetOfMat2.d.ts.map +1 -0
  288. package/lib/exercises/math/matrices/matrixComputeDetOfMat2.js +142 -0
  289. package/lib/exercises/math/matrices/matrixComputeInverseOfMat2.d.ts +8 -0
  290. package/lib/exercises/math/matrices/matrixComputeInverseOfMat2.d.ts.map +1 -0
  291. package/lib/exercises/math/matrices/matrixComputeInverseOfMat2.js +237 -0
  292. package/lib/exercises/math/matrices/matrixComputeLinearCombination.d.ts +15 -0
  293. package/lib/exercises/math/matrices/matrixComputeLinearCombination.d.ts.map +1 -0
  294. package/lib/exercises/math/matrices/matrixComputeLinearCombination.js +232 -0
  295. package/lib/exercises/math/matrices/matrixComputePower.d.ts +12 -0
  296. package/lib/exercises/math/matrices/matrixComputePower.d.ts.map +1 -0
  297. package/lib/exercises/math/matrices/matrixComputePower.js +230 -0
  298. package/lib/exercises/math/matrices/matrixComputeProduct.d.ts +9 -0
  299. package/lib/exercises/math/matrices/matrixComputeProduct.d.ts.map +1 -0
  300. package/lib/exercises/math/matrices/matrixComputeProduct.js +178 -0
  301. package/lib/exercises/math/matrices/writeMatrixAssociatedToSystem.d.ts +8 -0
  302. package/lib/exercises/math/matrices/writeMatrixAssociatedToSystem.d.ts.map +1 -0
  303. package/lib/exercises/math/matrices/writeMatrixAssociatedToSystem.js +105 -0
  304. package/lib/exercises/math/spaceGeometry/basis/index.d.ts +1 -0
  305. package/lib/exercises/math/spaceGeometry/basis/index.d.ts.map +1 -1
  306. package/lib/exercises/math/spaceGeometry/basis/index.js +1 -0
  307. package/lib/exercises/math/spaceGeometry/basis/spaceSegmentLengthInRectangularPrism.d.ts +18 -0
  308. package/lib/exercises/math/spaceGeometry/basis/spaceSegmentLengthInRectangularPrism.d.ts.map +1 -0
  309. package/lib/exercises/math/spaceGeometry/basis/spaceSegmentLengthInRectangularPrism.js +538 -0
  310. package/lib/exercises/math/trigonometry/formulas/trigoAdditionFormulaUsage.d.ts.map +1 -1
  311. package/lib/exercises/math/trigonometry/formulas/trigoAdditionFormulaUsage.js +6 -5
  312. package/lib/exercises/math/trigonometry/triangle/trigonometrySohcahtoaCalcul.js +1 -1
  313. package/lib/exercises/utils/geogebra/toolBarConstructor.d.ts +1 -0
  314. package/lib/exercises/utils/geogebra/toolBarConstructor.d.ts.map +1 -1
  315. package/lib/exercises/utils/geogebra/toolBarConstructor.js +2 -0
  316. package/lib/exercises/vea/matrixVEA.d.ts +2 -0
  317. package/lib/exercises/vea/matrixVEA.d.ts.map +1 -0
  318. package/lib/exercises/vea/matrixVEA.js +1 -0
  319. package/lib/geogebra/parsers/geogebraParser.d.ts +3 -0
  320. package/lib/geogebra/parsers/geogebraParser.d.ts.map +1 -1
  321. package/lib/geogebra/parsers/geogebraParser.js +27 -0
  322. package/lib/index.d.ts +286 -23
  323. package/lib/index.d.ts.map +1 -1
  324. package/lib/latexTester.js +2 -0
  325. package/lib/math/geometry/angle.d.ts.map +1 -1
  326. package/lib/math/geometry/angle.js +3 -0
  327. package/lib/math/geometry/point.d.ts.map +1 -1
  328. package/lib/math/geometry/point.js +3 -1
  329. package/lib/math/geometry/segment.d.ts +1 -1
  330. package/lib/math/geometry/segment.d.ts.map +1 -1
  331. package/lib/math/geometry/segment.js +5 -2
  332. package/lib/math/graphs/graph.d.ts +43 -0
  333. package/lib/math/graphs/graph.d.ts.map +1 -0
  334. package/lib/math/graphs/graph.js +391 -0
  335. package/lib/math/matrices/matrix.d.ts +42 -3
  336. package/lib/math/matrices/matrix.d.ts.map +1 -1
  337. package/lib/math/matrices/matrix.js +173 -7
  338. package/lib/math/matrices/parseMatrix.d.ts +3 -0
  339. package/lib/math/matrices/parseMatrix.d.ts.map +1 -0
  340. package/lib/math/matrices/parseMatrix.js +22 -0
  341. package/lib/math/systems/generalSystem.d.ts +2 -0
  342. package/lib/math/systems/generalSystem.d.ts.map +1 -1
  343. package/lib/math/systems/generalSystem.js +5 -0
  344. package/lib/math/utils/geometry/angleBetweenPoints.d.ts +4 -0
  345. package/lib/math/utils/geometry/angleBetweenPoints.d.ts.map +1 -0
  346. package/lib/math/utils/geometry/angleBetweenPoints.js +58 -0
  347. package/lib/math/utils/geometry/angleNWSE.d.ts +3 -0
  348. package/lib/math/utils/geometry/angleNWSE.d.ts.map +1 -0
  349. package/lib/math/utils/geometry/angleNWSE.js +56 -0
  350. package/lib/math/utils/graphs/graphRenderer.d.ts +25 -0
  351. package/lib/math/utils/graphs/graphRenderer.d.ts.map +1 -0
  352. package/lib/math/utils/graphs/graphRenderer.js +123 -0
  353. package/lib/playground.d.ts +6 -1
  354. package/lib/playground.d.ts.map +1 -1
  355. package/lib/playground.js +6 -5
  356. package/lib/tests/singleExo.test.d.ts.map +1 -1
  357. package/lib/tests/singleExo.test.js +2 -2
  358. package/lib/tree/parsers/latexParser.d.ts +1 -1
  359. package/lib/tree/utilities/nodeSimplifier.d.ts +1 -1
  360. package/lib/types/keyIds.d.ts +2 -0
  361. package/lib/types/keyIds.d.ts.map +1 -1
  362. package/lib/utils/arrays/arrayChunks.d.ts +9 -0
  363. package/lib/utils/arrays/arrayChunks.d.ts.map +1 -0
  364. package/lib/utils/arrays/arrayChunks.js +34 -0
  365. package/lib/utils/strings/frenchDays.d.ts +2 -0
  366. package/lib/utils/strings/frenchDays.d.ts.map +1 -0
  367. package/lib/utils/strings/frenchDays.js +9 -0
  368. package/lib/utils/strings/ordinalSuffixed.d.ts +2 -0
  369. package/lib/utils/strings/ordinalSuffixed.d.ts.map +1 -0
  370. package/lib/utils/strings/ordinalSuffixed.js +5 -0
  371. package/package.json +7 -1
@@ -0,0 +1,232 @@
1
+ import { GeneratorOptionTarget, GeneratorOptionType, addValidProp, propWhile, shuffleProps, tryToAddWrongProp, } from "../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../exercises/utils/getDistinctQuestions.js";
3
+ import { Matrix, MatrixConstructor, } from "../../../math/matrices/matrix.js";
4
+ import { parseMatrix } from "../../../math/matrices/parseMatrix.js";
5
+ import { NodeConstructor, } from "../../../tree/nodes/nodeConstructor.js";
6
+ import { add } from "../../../tree/nodes/operators/addNode.js";
7
+ import { multiply } from "../../../tree/nodes/operators/multiplyNode.js";
8
+ import { probaLawFlip } from "../../../utils/alea/probaLawFlip.js";
9
+ import { shuffle } from "../../../utils/alea/shuffle.js";
10
+ import { zip } from "../../../utils/arrays/arrayZip.js";
11
+ import { handleVEAError } from "../../../utils/errors/handleVEAError.js";
12
+ import { alignTex } from "../../../utils/latex/alignTex.js";
13
+ const getHydrated = (identifiers) => {
14
+ const { matIdsA, matIdsB, nodeIdsKA, nodeIdsKB } = identifiers;
15
+ const [matA, matB] = [matIdsA, matIdsB].map((matIds) => MatrixConstructor.fromIdentifiers(matIds));
16
+ const [nodeKA, nodeKB] = [nodeIdsKA, nodeIdsKB].map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds));
17
+ const nodeExprInstruction = add(multiply(nodeKA, "A".toTree()), multiply(nodeKB, "B".toTree()));
18
+ return {
19
+ matA,
20
+ matB,
21
+ nodeKA,
22
+ nodeKB,
23
+ nodeExprInstruction,
24
+ };
25
+ };
26
+ const getInstruction = (identifiers) => {
27
+ const { matA, matB, nodeExprInstruction } = getHydrated(identifiers);
28
+ return `Soient :
29
+
30
+ $$
31
+ A = ${matA.toTex()}
32
+ $$
33
+
34
+ $$
35
+ B = ${matB.toTex()}
36
+ $$
37
+
38
+ Calculer $${nodeExprInstruction.toTex()}$.`;
39
+ };
40
+ const getAnswer = (identifiers) => {
41
+ const { matA, matB, nodeKA, nodeKB } = getHydrated(identifiers);
42
+ const matLinComb = matA.times(nodeKA).add(matB.times(nodeKB));
43
+ const matLinCombSimplified = matLinComb.simplify({ towardsDistribute: true });
44
+ return matLinCombSimplified.toTex();
45
+ };
46
+ const getHint = (_identifiers, optsIn) => {
47
+ const opts = optsIn ?? optsDefault;
48
+ return `Soient $A$ et $B$ deux matrices à $2$ lignes et $2$ colonnes. Soit $k$ un nombre réel.
49
+
50
+ $$
51
+ A = \\begin{pmatrix} a & b \\\\ c & d \\end{pmatrix}
52
+ $$
53
+
54
+ $$
55
+ B = \\begin{pmatrix} r & s \\\\ t & u \\end{pmatrix}
56
+ $$
57
+
58
+ alors :
59
+
60
+ $$
61
+ A + B = \\begin{pmatrix} a+r & b+s \\\\ c+t & d+u \\end{pmatrix}
62
+ $$
63
+
64
+ ${(() => {
65
+ switch (opts.typeLinComb) {
66
+ case "Combinaison linéaire":
67
+ return `
68
+
69
+ $$
70
+ kA = \\begin{pmatrix} ka & kb \\\\ kc & kd \\end{pmatrix}
71
+ $$
72
+
73
+ `;
74
+ default:
75
+ return "";
76
+ }
77
+ })()}`;
78
+ };
79
+ const getCorrection = (identifiers, optsIn) => {
80
+ const opts = optsIn ?? optsDefault;
81
+ const { matA, matB, nodeExprInstruction, nodeKA, nodeKB } = getHydrated(identifiers);
82
+ const matKAA = matA.times(nodeKA);
83
+ const matKBB = matB.times(nodeKB);
84
+ const matLinComb = matKAA.add(matKBB);
85
+ const [texKA, texKB] = [nodeKA, nodeKB]
86
+ .map((node) => node.toTex())
87
+ .map((str) => (str === "1" ? "" : str.startsWith("-") ? `(${str})` : str));
88
+ switch (opts.typeLinComb) {
89
+ case "Combinaison linéaire":
90
+ return `${alignTex([
91
+ ["", nodeExprInstruction.toTex()],
92
+ ["=", `${texKA} ${matA.toTex()} + ${texKB} ${matB.toTex()}`],
93
+ ["=", `${matKAA.toTex()} + ${matKBB.toTex()}`],
94
+ ["=", matLinComb.toTex()],
95
+ ["=", matLinComb.simplify({ towardsDistribute: true }).toTex()],
96
+ ])}`;
97
+ case "Somme simple":
98
+ return `${alignTex([
99
+ ["", nodeExprInstruction.toTex()],
100
+ ["=", `${matKAA.toTex()} + ${matKBB.toTex()}`],
101
+ ["=", matLinComb.toTex()],
102
+ ["=", matLinComb.simplify({ towardsDistribute: true }).toTex()],
103
+ ])}`;
104
+ default:
105
+ throw new Error("Unsupported opts.typeLinComb: " + opts.typeLinComb);
106
+ }
107
+ };
108
+ const getPropositions = (n, { answer, ...identifiers }, optsIn) => {
109
+ const opts = optsIn ?? optsDefault;
110
+ const propositions = [];
111
+ addValidProp(propositions, answer);
112
+ const { matA, matB, nodeKA, nodeKB } = getHydrated(identifiers);
113
+ const matKAA = matA.times(nodeKA);
114
+ const matKBB = matB.times(nodeKB);
115
+ //student: (kA A) * (kB B)
116
+ {
117
+ const matWrong = matKAA.matrixProduct(matKBB);
118
+ tryToAddWrongProp(propositions, matWrong.simplify({ towardsDistribute: true }).toTex());
119
+ }
120
+ //student: strange addition which resembles product
121
+ {
122
+ function matrixSumWrong(mat1, mat2) {
123
+ const mat2Transposed = mat2.transposed();
124
+ const arrElementSumWrong = mat1.elements.map((row) => mat2Transposed.elements.map((column) => zip(row, column).reduce((acc, [nodeAik, nodeBkj], i) => {
125
+ const nodeAikBkj = add(nodeAik, nodeBkj);
126
+ if (i === 0) {
127
+ return nodeAikBkj;
128
+ }
129
+ else {
130
+ return add(acc, nodeAikBkj);
131
+ }
132
+ }, (0).toTree())));
133
+ return new Matrix(arrElementSumWrong);
134
+ }
135
+ const matWrong = matrixSumWrong(matKAA, matKBB);
136
+ tryToAddWrongProp(propositions, matWrong.simplify({ towardsDistribute: true }).toTex());
137
+ }
138
+ //filler
139
+ {
140
+ propWhile(propositions, n, () => {
141
+ const identifiersWrong = createRandomIdentifiers(opts);
142
+ tryToAddWrongProp(propositions, getAnswer(identifiersWrong));
143
+ });
144
+ }
145
+ return shuffleProps(propositions, n);
146
+ };
147
+ const getKeys = () => {
148
+ return ["mat-2-2"];
149
+ };
150
+ const isAnswerValid = (ans, { answer }) => {
151
+ try {
152
+ const matAns = parseMatrix(ans);
153
+ const matAnswer = parseMatrix(answer);
154
+ return matAns.equals(matAnswer);
155
+ }
156
+ catch (e) {
157
+ handleVEAError(e);
158
+ return false;
159
+ }
160
+ };
161
+ const createRandomIdentifiers = (opts) => {
162
+ const [nodeKA, nodeKB] = (() => {
163
+ switch (opts.typeLinComb) {
164
+ case "Somme simple":
165
+ return [(1).toTree(), (1).toTree()];
166
+ case "Combinaison linéaire":
167
+ return shuffle(probaLawFlip([
168
+ [[(1).toTree(), (2).toTree()], 0.35],
169
+ [[(1).toTree(), (3).toTree()], 0.25],
170
+ [[(1).toTree(), (-2).toTree()], 0.15],
171
+ [[(1).toTree(), (-1).toTree()], 0.15],
172
+ ]));
173
+ default:
174
+ throw new Error("Unsupported opts.typeLinComb: " + opts.typeLinComb);
175
+ }
176
+ })();
177
+ const matA = MatrixConstructor.random(2, 2);
178
+ const matB = MatrixConstructor.random(2, 2);
179
+ const identifiers = {
180
+ matIdsA: matA.toIdentifiers(),
181
+ matIdsB: matB.toIdentifiers(),
182
+ nodeIdsKA: nodeKA.toIdentifiers(),
183
+ nodeIdsKB: nodeKB.toIdentifiers(),
184
+ };
185
+ return identifiers;
186
+ };
187
+ const getMatrixComputeLinearCombinationQuestion = (optsIn) => {
188
+ const opts = optsIn ?? optsDefault;
189
+ const identifiers = createRandomIdentifiers(opts);
190
+ return getQuestionFromIdentifiers(identifiers, opts);
191
+ };
192
+ const getQuestionFromIdentifiers = (identifiers, optsIn) => {
193
+ const question = {
194
+ answer: getAnswer(identifiers),
195
+ instruction: getInstruction(identifiers),
196
+ keys: getKeys(identifiers),
197
+ answerFormat: "tex",
198
+ identifiers,
199
+ hint: getHint(identifiers, optsIn),
200
+ correction: getCorrection(identifiers, optsIn),
201
+ options: optsIn,
202
+ };
203
+ return question;
204
+ };
205
+ const optsDefault = {
206
+ typeLinComb: "Combinaison linéaire",
207
+ };
208
+ const options = [
209
+ {
210
+ id: "typeLinComb",
211
+ label: "Type de combinaison linéaire",
212
+ target: GeneratorOptionTarget.generation,
213
+ type: GeneratorOptionType.select,
214
+ values: ["Somme simple", "Combinaison linéaire"],
215
+ defaultValue: optsDefault.typeLinComb,
216
+ },
217
+ ];
218
+ export const matrixComputeLinearCombination = {
219
+ id: "matrixComputeLinearCombination",
220
+ connector: "=",
221
+ label: "Calculer une combinaison linéaire de deux matrices",
222
+ isSingleStep: true,
223
+ generator: (nb, opts) => getDistinctQuestions(() => getMatrixComputeLinearCombinationQuestion(opts), nb),
224
+ options,
225
+ qcmTimer: 60,
226
+ freeTimer: 60,
227
+ getPropositions,
228
+ isAnswerValid,
229
+ subject: "Mathématiques",
230
+ getQuestionFromIdentifiers,
231
+ hasHintAndCorrection: true,
232
+ };
@@ -0,0 +1,12 @@
1
+ import { Exercise } from "../../../exercises/exercise.js";
2
+ import { MatrixIdentifiers } from "../../../math/matrices/matrix.js";
3
+ type Identifiers = {
4
+ matIdsA: MatrixIdentifiers;
5
+ exponent: number;
6
+ };
7
+ type Options = {
8
+ exponent: string;
9
+ };
10
+ export declare const matrixComputePower: Exercise<Identifiers, Options>;
11
+ export {};
12
+ //# sourceMappingURL=matrixComputePower.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"matrixComputePower.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/matrices/matrixComputePower.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAmBT,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAGL,iBAAiB,EAClB,MAAM,+BAA+B,CAAC;AAQvC,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,iBAAiB,CAAC;IAC3B,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AA4PF,KAAK,OAAO,GAAG;IACb,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAgBF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAe7D,CAAC"}
@@ -0,0 +1,230 @@
1
+ import { GeneratorOptionTarget, GeneratorOptionType, addValidProp, propWhile, shuffleProps, tryToAddWrongProp, } from "../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../exercises/utils/getDistinctQuestions.js";
3
+ import { Matrix, MatrixConstructor, } from "../../../math/matrices/matrix.js";
4
+ import { parseMatrix } from "../../../math/matrices/parseMatrix.js";
5
+ import { multiply } from "../../../tree/nodes/operators/multiplyNode.js";
6
+ import { power } from "../../../tree/nodes/operators/powerNode.js";
7
+ import { handleVEAError } from "../../../utils/errors/handleVEAError.js";
8
+ import { alignTex } from "../../../utils/latex/alignTex.js";
9
+ const getHydrated = (identifiers) => {
10
+ const { matIdsA, exponent } = identifiers;
11
+ const [matA] = [matIdsA].map((matIds) => MatrixConstructor.fromIdentifiers(matIds));
12
+ const nodeExprInstruction = power("A".toTree(), exponent);
13
+ return {
14
+ matA,
15
+ nodeExprInstruction,
16
+ };
17
+ };
18
+ const getInstruction = (identifiers) => {
19
+ const { matA, nodeExprInstruction } = getHydrated(identifiers);
20
+ return `Soit :
21
+
22
+ $$
23
+ A = ${matA.toTex()}
24
+ $$
25
+
26
+ Calculer $${nodeExprInstruction.toTex()}$.`;
27
+ };
28
+ const getAnswer = (identifiers) => {
29
+ const { exponent } = identifiers;
30
+ const { matA } = getHydrated(identifiers);
31
+ const matProduct = matA.power(exponent);
32
+ const matProductSimplified = matProduct.simplify({ towardsDistribute: true });
33
+ return matProductSimplified.toTex();
34
+ };
35
+ const getHint = () => {
36
+ const matA = new Matrix([
37
+ ["a".toTree(), "b".toTree()],
38
+ ["c".toTree(), "d".toTree()],
39
+ ]);
40
+ const matASpaced = new Matrix([
41
+ ["\\ \\ \\ a".toTree(), "\\ \\ \\ \\ \\ b \\ \\ \\ ".toTree()],
42
+ ["\\ \\ \\ c".toTree(), "\\ \\ \\ \\ \\ d \\ \\ \\ ".toTree()],
43
+ ]);
44
+ return `Soient $A$ une matrice à $2$ lignes et $2$ colonnes à coefficients réels.
45
+
46
+ $$
47
+ A = ${matA.toTex()}
48
+ $$
49
+
50
+ Pour calculer $A^2=AA$,
51
+ tu peux disposer les matrices de cette façon pour ne pas te tromper :
52
+
53
+ $$
54
+ \\begin{matrix} {\\begin{matrix} \\ & \\ \\\\ \\ & \\ \\end{matrix}} & {${matASpaced.toTex()}} \\\\ {${matA.toTex()}} & {\\begin{pmatrix} {...} & {ab+bd} \\\\ {...} & {...} \\end{pmatrix}} \\end{matrix}
55
+ $$
56
+
57
+ Ce qui donne :
58
+
59
+ $$
60
+ A^2 = AA = ${matA.matrixProduct(matA).toTex()}
61
+ $$
62
+
63
+ Continue ainsi pour les autres puissances de $A$ :
64
+
65
+ $$
66
+ A^3 = AAA = A^2 A
67
+ $$
68
+
69
+ etc.
70
+
71
+ `;
72
+ };
73
+ const getCorrection = (identifiers) => {
74
+ const { exponent } = identifiers;
75
+ const { matA } = getHydrated(identifiers);
76
+ const matA2 = matA.matrixProduct(matA);
77
+ const matA2Simplified = matA2.simplify({ towardsDistribute: true });
78
+ const matA3 = matA2Simplified.matrixProduct(matA);
79
+ const matA3Simplified = matA3.simplify({ towardsDistribute: true });
80
+ switch (exponent) {
81
+ case 2:
82
+ return `${alignTex([
83
+ ["", "A^2"],
84
+ ["=", `${matA.toTex()} ${matA.toTex()}`],
85
+ ["=", matA2.toTex()],
86
+ ["=", matA2Simplified.toTex()],
87
+ ])}`;
88
+ case 3:
89
+ return `
90
+
91
+ ${alignTex([
92
+ ["", "A^2"],
93
+ ["=", `${matA.toTex()} ${matA.toTex()}`],
94
+ ["=", matA2.toTex()],
95
+ ["=", matA2Simplified.toTex()],
96
+ ])}
97
+
98
+ ${alignTex([
99
+ ["", "A^3"],
100
+ ["=", "A^2 A"],
101
+ ["=", `${matA2Simplified.toTex()} ${matA.toTex()}`],
102
+ ["=", matA3.toTex()],
103
+ ["=", matA3Simplified.toTex()],
104
+ ])}
105
+
106
+ `;
107
+ default:
108
+ throw new Error("Unsupported exponent: " + exponent);
109
+ }
110
+ };
111
+ const getPropositions = (n, { answer, ...identifiers }, optsIn) => {
112
+ const opts = optsIn ?? optsDefault;
113
+ const propositions = [];
114
+ addValidProp(propositions, answer);
115
+ const { exponent } = identifiers;
116
+ const { matA } = getHydrated(identifiers);
117
+ function createPowerFuncWrong(funcAB) {
118
+ const func = (matA, exponent) => [...Array(exponent).keys()].reduce((acc, i) => {
119
+ if (i === 0) {
120
+ return matA;
121
+ }
122
+ else {
123
+ return funcAB(acc, matA);
124
+ }
125
+ }, matA);
126
+ return func;
127
+ }
128
+ //student: AB = A+B
129
+ {
130
+ const powerFuncWrong = createPowerFuncWrong((matA, matB) => matA.add(matB));
131
+ const matWrong = powerFuncWrong(matA, exponent);
132
+ tryToAddWrongProp(propositions, matWrong.simplify({ towardsDistribute: true }).toTex());
133
+ }
134
+ //student: AB = (a_{ij}b_{ij})
135
+ {
136
+ function matrixProductWrong(mat1, mat2) {
137
+ const arrElementSumWrong = mat1.elements.map((row, i) => row.map((elt1, j) => {
138
+ const elt2 = mat2.elements[i][j];
139
+ return multiply(elt1, elt2);
140
+ }));
141
+ return new Matrix(arrElementSumWrong);
142
+ }
143
+ const powerFuncWrong = createPowerFuncWrong(matrixProductWrong);
144
+ const matWrong = powerFuncWrong(matA, exponent);
145
+ tryToAddWrongProp(propositions, matWrong.simplify({ towardsDistribute: true }).toTex());
146
+ }
147
+ //student: AB = (sum(a_{ik}b_{jk}))
148
+ {
149
+ const powerFuncWrong = createPowerFuncWrong((matA, matB) => matA.matrixProduct(matB.transposed()));
150
+ const matWrong = powerFuncWrong(matA, exponent);
151
+ tryToAddWrongProp(propositions, matWrong.simplify({ towardsDistribute: true }).toTex());
152
+ }
153
+ //filler
154
+ {
155
+ propWhile(propositions, n, () => {
156
+ const identifiersWrong = createRandomIdentifiers(opts);
157
+ tryToAddWrongProp(propositions, getAnswer(identifiersWrong));
158
+ });
159
+ }
160
+ return shuffleProps(propositions, n);
161
+ };
162
+ const getKeys = () => {
163
+ return ["mat-2-2"];
164
+ };
165
+ const isAnswerValid = (ans, { answer }) => {
166
+ try {
167
+ const matAns = parseMatrix(ans);
168
+ const matAnswer = parseMatrix(answer);
169
+ return matAns.equals(matAnswer);
170
+ }
171
+ catch (e) {
172
+ handleVEAError(e);
173
+ return false;
174
+ }
175
+ };
176
+ const createRandomIdentifiers = (opts) => {
177
+ const matA = MatrixConstructor.random(2, 2);
178
+ const exponent = parseInt(opts.exponent);
179
+ const identifiers = {
180
+ matIdsA: matA.toIdentifiers(),
181
+ exponent,
182
+ };
183
+ return identifiers;
184
+ };
185
+ const getMatrixComputePowerQuestion = (optsIn) => {
186
+ const opts = optsIn ?? optsDefault;
187
+ const identifiers = createRandomIdentifiers(opts);
188
+ return getQuestionFromIdentifiers(identifiers, opts);
189
+ };
190
+ const getQuestionFromIdentifiers = (identifiers, optsIn) => {
191
+ const question = {
192
+ answer: getAnswer(identifiers),
193
+ instruction: getInstruction(identifiers),
194
+ keys: getKeys(identifiers),
195
+ answerFormat: "tex",
196
+ identifiers,
197
+ hint: getHint(identifiers),
198
+ correction: getCorrection(identifiers),
199
+ options: optsIn,
200
+ };
201
+ return question;
202
+ };
203
+ const optsDefault = {
204
+ exponent: "2",
205
+ };
206
+ const options = [
207
+ {
208
+ id: "exponent",
209
+ label: "Valeur de l'exposant",
210
+ target: GeneratorOptionTarget.generation,
211
+ type: GeneratorOptionType.select,
212
+ values: ["2", "3"],
213
+ defaultValue: optsDefault.exponent,
214
+ },
215
+ ];
216
+ export const matrixComputePower = {
217
+ id: "matrixComputePower",
218
+ connector: "=",
219
+ label: "Calculer une puissance d'une matrice",
220
+ isSingleStep: true,
221
+ generator: (nb, opts) => getDistinctQuestions(() => getMatrixComputePowerQuestion(opts), nb),
222
+ options,
223
+ qcmTimer: 60,
224
+ freeTimer: 60,
225
+ getPropositions,
226
+ isAnswerValid,
227
+ subject: "Mathématiques",
228
+ getQuestionFromIdentifiers,
229
+ hasHintAndCorrection: true,
230
+ };
@@ -0,0 +1,9 @@
1
+ import { Exercise } from "../../../exercises/exercise.js";
2
+ import { MatrixIdentifiers } from "../../../math/matrices/matrix.js";
3
+ type Identifiers = {
4
+ matIdsA: MatrixIdentifiers;
5
+ matIdsB: MatrixIdentifiers;
6
+ };
7
+ export declare const matrixComputeProduct: Exercise<Identifiers>;
8
+ export {};
9
+ //# sourceMappingURL=matrixComputeProduct.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"matrixComputeProduct.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/matrices/matrixComputeProduct.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAgBT,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAGL,iBAAiB,EAClB,MAAM,+BAA+B,CAAC;AAOvC,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,iBAAiB,CAAC;IAC3B,OAAO,EAAE,iBAAiB,CAAC;CAC5B,CAAC;AA0MF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CActD,CAAC"}
@@ -0,0 +1,178 @@
1
+ import { addValidProp, propWhile, shuffleProps, tryToAddWrongProp, } from "../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../exercises/utils/getDistinctQuestions.js";
3
+ import { Matrix, MatrixConstructor, } from "../../../math/matrices/matrix.js";
4
+ import { parseMatrix } from "../../../math/matrices/parseMatrix.js";
5
+ import { multiply } from "../../../tree/nodes/operators/multiplyNode.js";
6
+ import { handleVEAError } from "../../../utils/errors/handleVEAError.js";
7
+ import { alignTex } from "../../../utils/latex/alignTex.js";
8
+ const getHydrated = (identifiers) => {
9
+ const { matIdsA, matIdsB } = identifiers;
10
+ const [matA, matB] = [matIdsA, matIdsB].map((matIds) => MatrixConstructor.fromIdentifiers(matIds));
11
+ const nodeExprInstruction = multiply("A".toTree(), "B".toTree()).simplify();
12
+ return {
13
+ matA,
14
+ matB,
15
+ nodeExprInstruction,
16
+ };
17
+ };
18
+ const getInstruction = (identifiers) => {
19
+ const { matA, matB, nodeExprInstruction } = getHydrated(identifiers);
20
+ return `Soient :
21
+
22
+ $$
23
+ A = ${matA.toTex()}
24
+ $$
25
+
26
+ $$
27
+ B = ${matB.toTex()}
28
+ $$
29
+
30
+ Calculer $${nodeExprInstruction.toTex()}$.`;
31
+ };
32
+ const getAnswer = (identifiers) => {
33
+ const { matA, matB } = getHydrated(identifiers);
34
+ const matProduct = matA.matrixProduct(matB);
35
+ const matProductSimplified = matProduct.simplify({ towardsDistribute: true });
36
+ return matProductSimplified.toTex();
37
+ };
38
+ const getHint = () => {
39
+ const matA = new Matrix([
40
+ ["a".toTree(), "b".toTree()],
41
+ ["c".toTree(), "d".toTree()],
42
+ ]);
43
+ const matB = new Matrix([
44
+ ["r".toTree(), "s".toTree()],
45
+ ["t".toTree(), "u".toTree()],
46
+ ]);
47
+ const matBSpaced = new Matrix([
48
+ ["\\ \\ \\ r".toTree(), "\\ \\ \\ \\ \\ s \\ \\ \\ ".toTree()],
49
+ ["\\ \\ \\ t".toTree(), "\\ \\ \\ \\ \\ u \\ \\ \\ ".toTree()],
50
+ ]);
51
+ return `Soient $A$ et $B$ deux matrices à $2$ lignes et $2$ colonnes à coefficients réels.
52
+
53
+ $$
54
+ A = ${matA.toTex()}
55
+ $$
56
+
57
+ $$
58
+ B = ${matB.toTex()}
59
+ $$
60
+
61
+ Pour calculer le produit matriciel $AB$,
62
+ tu peux disposer les matrices $A$ et $B$ de cette façon pour ne pas te tromper :
63
+
64
+ $$
65
+ \\begin{matrix} {\\begin{matrix} \\ & \\ \\\\ \\ & \\ \\end{matrix}} & {${matBSpaced.toTex()}} \\\\ {${matA.toTex()}} & {\\begin{pmatrix} {...} & {as+bu} \\\\ {...} & {...} \\end{pmatrix}} \\end{matrix}
66
+ $$
67
+
68
+ Ce qui donne :
69
+
70
+ $$
71
+ AB = ${matA.matrixProduct(matB).toTex()}
72
+ $$
73
+
74
+ `;
75
+ };
76
+ const getCorrection = (identifiers) => {
77
+ const { matA, matB, nodeExprInstruction } = getHydrated(identifiers);
78
+ const matProduct = matA.matrixProduct(matB);
79
+ const matProductSimplified = matProduct.simplify({ towardsDistribute: true });
80
+ return `${alignTex([
81
+ ["", nodeExprInstruction.toTex()],
82
+ ["=", `${matA.toTex()} ${matB.toTex()}`],
83
+ ["=", matProduct.toTex()],
84
+ ["=", matProductSimplified.toTex()],
85
+ ])}`;
86
+ };
87
+ const getPropositions = (n, { answer, ...identifiers }) => {
88
+ const propositions = [];
89
+ addValidProp(propositions, answer);
90
+ const { matA, matB } = getHydrated(identifiers);
91
+ //student: AB = A+B
92
+ {
93
+ const matWrong = matA.add(matB);
94
+ tryToAddWrongProp(propositions, matWrong.simplify({ towardsDistribute: true }).toTex());
95
+ }
96
+ //student: AB = (a_{ij}b_{ij})
97
+ {
98
+ function matrixProductWrong(mat1, mat2) {
99
+ const arrElementSumWrong = mat1.elements.map((row, i) => row.map((elt1, j) => {
100
+ const elt2 = mat2.elements[i][j];
101
+ return multiply(elt1, elt2);
102
+ }));
103
+ return new Matrix(arrElementSumWrong);
104
+ }
105
+ const matWrong = matrixProductWrong(matA, matB);
106
+ tryToAddWrongProp(propositions, matWrong.simplify({ towardsDistribute: true }).toTex());
107
+ }
108
+ //student: AB = (sum(a_{ik}b_{jk}))
109
+ {
110
+ const matWrong = matA.matrixProduct(matB.transposed());
111
+ tryToAddWrongProp(propositions, matWrong.simplify({ towardsDistribute: true }).toTex());
112
+ }
113
+ //filler
114
+ {
115
+ propWhile(propositions, n, () => {
116
+ const identifiersWrong = createRandomIdentifiers();
117
+ tryToAddWrongProp(propositions, getAnswer(identifiersWrong));
118
+ });
119
+ }
120
+ return shuffleProps(propositions, n);
121
+ };
122
+ const getKeys = () => {
123
+ return ["mat-2-2"];
124
+ };
125
+ const isAnswerValid = (ans, { answer }) => {
126
+ try {
127
+ const matAns = parseMatrix(ans);
128
+ const matAnswer = parseMatrix(answer);
129
+ return matAns.equals(matAnswer);
130
+ }
131
+ catch (e) {
132
+ handleVEAError(e);
133
+ return false;
134
+ }
135
+ };
136
+ const createRandomIdentifiers = () => {
137
+ const nodeKA = (1).toTree();
138
+ const nodeKB = (2).toTree();
139
+ const matA = MatrixConstructor.random(2, 2);
140
+ const matB = MatrixConstructor.random(2, 2);
141
+ const identifiers = {
142
+ matIdsA: matA.toIdentifiers(),
143
+ matIdsB: matB.toIdentifiers(),
144
+ nodeIdsKA: nodeKA.toIdentifiers(),
145
+ nodeIdsKB: nodeKB.toIdentifiers(),
146
+ };
147
+ return identifiers;
148
+ };
149
+ const getMatrixComputeProductQuestion = () => {
150
+ const identifiers = createRandomIdentifiers();
151
+ return getQuestionFromIdentifiers(identifiers);
152
+ };
153
+ const getQuestionFromIdentifiers = (identifiers) => {
154
+ const question = {
155
+ answer: getAnswer(identifiers),
156
+ instruction: getInstruction(identifiers),
157
+ keys: getKeys(identifiers),
158
+ answerFormat: "tex",
159
+ identifiers,
160
+ hint: getHint(identifiers),
161
+ correction: getCorrection(identifiers),
162
+ };
163
+ return question;
164
+ };
165
+ export const matrixComputeProduct = {
166
+ id: "matrixComputeProduct",
167
+ connector: "=",
168
+ label: "Calculer le produit de deux matrices",
169
+ isSingleStep: true,
170
+ generator: (nb) => getDistinctQuestions(getMatrixComputeProductQuestion, nb),
171
+ qcmTimer: 60,
172
+ freeTimer: 60,
173
+ getPropositions,
174
+ isAnswerValid,
175
+ subject: "Mathématiques",
176
+ getQuestionFromIdentifiers,
177
+ hasHintAndCorrection: true,
178
+ };
@@ -0,0 +1,8 @@
1
+ import { Exercise } from "../../../exercises/exercise.js";
2
+ import { GeneralSystemIdentifiers } from "../../../math/systems/generalSystem.js";
3
+ type Identifiers = {
4
+ systemIds: GeneralSystemIdentifiers;
5
+ };
6
+ export declare const writeMatrixAssociatedToSystem: Exercise<Identifiers>;
7
+ export {};
8
+ //# sourceMappingURL=writeMatrixAssociatedToSystem.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"writeMatrixAssociatedToSystem.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/matrices/writeMatrixAssociatedToSystem.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAIrC,OAAO,EAEL,wBAAwB,EACzB,MAAM,qCAAqC,CAAC;AAG7C,KAAK,WAAW,GAAG;IACjB,SAAS,EAAE,wBAAwB,CAAC;CACrC,CAAC;AA6FF,eAAO,MAAM,6BAA6B,EAAE,QAAQ,CAAC,WAAW,CAqB/D,CAAC"}