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 { addValidProp, shuffleProps, tryToAddWrongProp, propWhile, GeneratorOptionTarget, GeneratorOptionType, } from "../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../exercises/utils/getDistinctQuestions.js";
3
+ import { defaultArrayedOptsWhereNeeded } from "../../../exercises/utils/options/arrayedOptions.js";
4
+ import { greenMain } from "../../../geogebra/colors.js";
5
+ import { GeogebraConstructor } from "../../../geogebra/geogebraConstructor.js";
6
+ import { Point } from "../../../math/geometry/point.js";
7
+ import { GraphConstructor } from "../../../math/graphs/graph.js";
8
+ import { GraphRenderer, } from "../../../math/utils/graphs/graphRenderer.js";
9
+ import { randint } from "../../../math/utils/random/randint.js";
10
+ import { parseAlgebraic } from "../../../tree/parsers/latexParser.js";
11
+ import { NodeComparator } from "../../../tree/utilities/nodeComparator.js";
12
+ import { probaLawFlip } from "../../../utils/alea/probaLawFlip.js";
13
+ import { random } from "../../../utils/alea/random.js";
14
+ import { handleVEAError } from "../../../utils/errors/handleVEAError.js";
15
+ import { joinanded } from "../../../utils/strings/joinanded.js";
16
+ const getHydrated = (identifiers) => {
17
+ const { graphIds, indexAsked } = identifiers;
18
+ const graph = GraphConstructor.fromIdentifiers(graphIds);
19
+ const nameVertexAsked = graph.vertexNames[indexAsked];
20
+ const arrNameVertexAdjacent = graph.getArrVertexNameAdjacent(nameVertexAsked);
21
+ return {
22
+ graph,
23
+ nameVertexAsked,
24
+ arrNameVertexAdjacent,
25
+ };
26
+ };
27
+ const getInstruction = (identifiers) => {
28
+ const { nameVertexAsked } = getHydrated(identifiers);
29
+ return `Un graphe est représenté ci-dessous.
30
+ Quel est le degré du sommet $${nameVertexAsked}$ ?`;
31
+ };
32
+ const getAnswerNode = (identifiers) => {
33
+ const { arrNameVertexAdjacent } = getHydrated(identifiers);
34
+ return arrNameVertexAdjacent.length.toTree();
35
+ };
36
+ const getAnswer = (identifiers) => {
37
+ return getAnswerNode(identifiers).toTex();
38
+ };
39
+ const getHint = () => {
40
+ return `Le degré d'un sommet est le nombre d'arêtes incidentes à ce sommet, sans tenir compte de leur sens de parcours.`;
41
+ };
42
+ const getCorrection = (identifiers) => {
43
+ const { nameVertexAsked, arrNameVertexAdjacent } = getHydrated(identifiers);
44
+ const nbAdjacent = arrNameVertexAdjacent.length;
45
+ return `Le sommet $${nameVertexAsked}$ a pour ${nbAdjacent === 1 ? "sommet adjacent" : "sommets adjacents"} ${joinanded(arrNameVertexAdjacent.map((nameVertex) => `$${nameVertex}$`), ", ", " et ")}.
46
+
47
+ Le degré de $${nameVertexAsked}$ est donc $${nbAdjacent.frenchify()}$.`;
48
+ };
49
+ const getCorrectionGGBOptions = (identifiers) => {
50
+ const { graphNodes, graphEdges } = identifiers;
51
+ const { graph, nameVertexAsked } = getHydrated(identifiers);
52
+ const arrPoint = graphNodes.map(({ label, x, y }) => new Point(label, x, y));
53
+ const pointCommands = arrPoint.flatMap((point) => point.toGGBCommand({
54
+ isFixed: false,
55
+ isSelectionnable: true,
56
+ showLabel: true,
57
+ style: 0,
58
+ size: 8,
59
+ color: point.name === nameVertexAsked ? greenMain : "#000000",
60
+ }));
61
+ const edgeCommands = graphEdges.flatMap((e, i) => {
62
+ return [
63
+ graph.isDirected
64
+ ? `edge${i + 1} = Vector(${e.from}, ${e.to})`
65
+ : `edge${i + 1} = Segment(${e.from}, ${e.to})`,
66
+ ...(e.from === nameVertexAsked || e.to === nameVertexAsked
67
+ ? [`SetColor(edge${i + 1}, "${greenMain}")`]
68
+ : []),
69
+ ];
70
+ });
71
+ const ggb = new GeogebraConstructor({
72
+ commands: [...pointCommands, ...edgeCommands],
73
+ fontSize: 16,
74
+ hideAxes: true,
75
+ hideGrid: true,
76
+ });
77
+ return ggb.getOptions({
78
+ coords: ggb.getCoordsForPoints(arrPoint),
79
+ });
80
+ };
81
+ const getGGBOptions = (identifiers) => {
82
+ const { graphNodes, graphEdges } = identifiers;
83
+ const { graph } = getHydrated(identifiers);
84
+ const arrPoint = graphNodes.map(({ label, x, y }) => new Point(label, x, y));
85
+ const pointCommands = arrPoint.flatMap((point) => point.toGGBCommand({
86
+ isFixed: false,
87
+ isSelectionnable: true,
88
+ showLabel: true,
89
+ style: 0,
90
+ size: 8,
91
+ }));
92
+ const edgeCommands = graphEdges.map((e, i) => graph.isDirected
93
+ ? `v${i + 1} = Vector(${e.from}, ${e.to})`
94
+ : `s${i + 1} = Segment(${e.from}, ${e.to})`);
95
+ const arrGGBCommandForGraph = [...pointCommands, ...edgeCommands];
96
+ const ggb = new GeogebraConstructor({
97
+ commands: [...arrGGBCommandForGraph],
98
+ fontSize: 16,
99
+ hideAxes: true,
100
+ hideGrid: true,
101
+ });
102
+ return ggb.getOptions({
103
+ coords: ggb.getCoordsForPoints(arrPoint),
104
+ });
105
+ };
106
+ const getPropositions = (n, { answer, ...identifiers }) => {
107
+ const propositions = [];
108
+ addValidProp(propositions, answer);
109
+ const { graph, nameVertexAsked } = getHydrated(identifiers);
110
+ //student: d -> d+ or d -> d-
111
+ if (graph.isDirected) {
112
+ const [_, dMinus, dPlus] = graph.getArrDegreeOfVertex(nameVertexAsked);
113
+ const [isAddWrongPropDMinus, isAddWrongPropDPlus] = probaLawFlip([
114
+ [[true, false], 0.4],
115
+ [[false, true], 0.4],
116
+ [[true, true], 0.2],
117
+ ]);
118
+ if (isAddWrongPropDMinus) {
119
+ tryToAddWrongProp(propositions, dMinus.frenchify());
120
+ }
121
+ if (isAddWrongPropDPlus) {
122
+ tryToAddWrongProp(propositions, dPlus.frenchify());
123
+ }
124
+ }
125
+ //student: degree of other vertex
126
+ {
127
+ [...Array(graph.vertexNames.length).keys()].forEach((index) => {
128
+ const identifiersWrong = {
129
+ ...identifiers,
130
+ indexAsked: index,
131
+ };
132
+ tryToAddWrongProp(propositions, getAnswer(identifiersWrong));
133
+ });
134
+ }
135
+ //filler
136
+ propWhile(propositions, n, () => {
137
+ const dWrong = randint(1, 10);
138
+ tryToAddWrongProp(propositions, dWrong.frenchify());
139
+ });
140
+ return shuffleProps(propositions, n);
141
+ };
142
+ const getKeys = () => {
143
+ return [];
144
+ };
145
+ const isAnswerValid = (ans, { answer }) => {
146
+ try {
147
+ const [nodeAns, nodeAnswer] = [ans, answer].map((str) => parseAlgebraic(str));
148
+ return NodeComparator.isEqualViaSub(nodeAns, nodeAnswer);
149
+ }
150
+ catch (err) {
151
+ return handleVEAError(err);
152
+ }
153
+ };
154
+ const createRandomIdentifiers = (isDirected) => {
155
+ const nbVertices = randint(5, 10);
156
+ const isSimple = true;
157
+ const minDensity = (() => {
158
+ switch (nbVertices) {
159
+ case 5:
160
+ return isDirected ? 0.4 : 0.62;
161
+ case 6:
162
+ return isDirected ? 0.35 : 0.57;
163
+ case 7:
164
+ return isDirected ? 0.3 : 0.52;
165
+ case 8:
166
+ return isDirected ? 0.27 : 0.37;
167
+ case 9:
168
+ return isDirected ? 0.24 : 0.32;
169
+ }
170
+ })();
171
+ const graph = GraphConstructor.random(nbVertices, isSimple, isDirected, minDensity, "ABCDEFGHIJKLM".split(""), true);
172
+ const indexAsked = randint(0, nbVertices);
173
+ const { nodes: graphNodes, edges: graphEdges } = GraphRenderer.renderToNodesAndEdges(graph);
174
+ const identifiers = {
175
+ graphIds: graph.toIdentifiers(),
176
+ indexAsked,
177
+ graphNodes,
178
+ graphEdges,
179
+ };
180
+ return identifiers;
181
+ };
182
+ const getGraphsDegreeOfVertexQuestion = (optsIn) => {
183
+ const arrayedOpts = defaultArrayedOptsWhereNeeded(optsIn, arrayedOptsDefault);
184
+ const opts = {
185
+ graphType: random(arrayedOpts.graphType),
186
+ };
187
+ const isDirected = opts.graphType === "orienté";
188
+ const identifiers = createRandomIdentifiers(isDirected);
189
+ return getQuestionFromIdentifiers(identifiers);
190
+ };
191
+ const getQuestionFromIdentifiers = (identifiers, opts) => {
192
+ const question = {
193
+ answer: getAnswer(identifiers, opts),
194
+ instruction: getInstruction(identifiers, opts),
195
+ keys: getKeys(identifiers, opts),
196
+ answerFormat: "tex",
197
+ identifiers,
198
+ hint: getHint(identifiers, opts),
199
+ correction: getCorrection(identifiers, opts),
200
+ correctionGgbOptions: getCorrectionGGBOptions(identifiers, opts),
201
+ ggbOptions: getGGBOptions(identifiers, opts),
202
+ };
203
+ return question;
204
+ };
205
+ const arrayedOptsDefault = {
206
+ graphType: ["non orienté"],
207
+ };
208
+ const options = [
209
+ {
210
+ id: "graphType",
211
+ label: "Types de graphes",
212
+ target: GeneratorOptionTarget.generation,
213
+ type: GeneratorOptionType.multiselect,
214
+ values: ["non orienté", "orienté"],
215
+ defaultValue: arrayedOptsDefault.graphType,
216
+ },
217
+ ];
218
+ export const graphsDegreeOfVertex = {
219
+ id: "graphsDegreeOfVertex",
220
+ label: "Déterminer le degré du sommet d'un graphe",
221
+ isSingleStep: true,
222
+ generator: (nb, opts) => getDistinctQuestions(() => getGraphsDegreeOfVertexQuestion(opts), nb),
223
+ options,
224
+ qcmTimer: 60,
225
+ freeTimer: 60,
226
+ isAnswerValid,
227
+ getPropositions,
228
+ subject: "Mathématiques",
229
+ getQuestionFromIdentifiers,
230
+ hasHintAndCorrection: true,
231
+ hasGeogebra: true,
232
+ };
@@ -0,0 +1,14 @@
1
+ import { Exercise } from "../../../exercises/exercise.js";
2
+ import { GraphIdentifiers } from "../../../math/graphs/graph.js";
3
+ import { GraphEdge, GraphNode } from "../../../math/utils/graphs/graphRenderer.js";
4
+ type Identifiers = {
5
+ graphIds: GraphIdentifiers;
6
+ graphNodes: GraphNode[];
7
+ graphEdges: GraphEdge[];
8
+ };
9
+ type Options = {
10
+ graphType: string;
11
+ };
12
+ export declare const graphsOrderOfGraph: Exercise<Identifiers, Options>;
13
+ export {};
14
+ //# sourceMappingURL=graphsOrderOfGraph.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graphsOrderOfGraph.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/graphs/graphsOrderOfGraph.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAoBT,MAAM,6BAA6B,CAAC;AAMrC,OAAO,EAAoB,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAChF,OAAO,EACL,SAAS,EACT,SAAS,EAEV,MAAM,0CAA0C,CAAC;AAUlD,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,gBAAgB,CAAC;IAG3B,UAAU,EAAE,SAAS,EAAE,CAAC;IACxB,UAAU,EAAE,SAAS,EAAE,CAAC;CACzB,CAAC;AAoPF,KAAK,OAAO,GAAG;IACb,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAsBF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAe7D,CAAC"}
@@ -0,0 +1,222 @@
1
+ import { addValidProp, shuffleProps, tryToAddWrongProp, propWhile, GeneratorOptionTarget, GeneratorOptionType, } from "../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../exercises/utils/getDistinctQuestions.js";
3
+ import { defaultArrayedOptsWhereNeeded } from "../../../exercises/utils/options/arrayedOptions.js";
4
+ import { greenMain } from "../../../geogebra/colors.js";
5
+ import { GeogebraConstructor } from "../../../geogebra/geogebraConstructor.js";
6
+ import { Point } from "../../../math/geometry/point.js";
7
+ import { GraphConstructor } from "../../../math/graphs/graph.js";
8
+ import { GraphRenderer, } from "../../../math/utils/graphs/graphRenderer.js";
9
+ import { randint } from "../../../math/utils/random/randint.js";
10
+ import { parseAlgebraic } from "../../../tree/parsers/latexParser.js";
11
+ import { NodeComparator } from "../../../tree/utilities/nodeComparator.js";
12
+ import { coinFlip } from "../../../utils/alea/coinFlip.js";
13
+ import { probaFlip } from "../../../utils/alea/probaFlip.js";
14
+ import { random } from "../../../utils/alea/random.js";
15
+ import { handleVEAError } from "../../../utils/errors/handleVEAError.js";
16
+ import { joinanded } from "../../../utils/strings/joinanded.js";
17
+ const getHydrated = (identifiers) => {
18
+ const { graphIds } = identifiers;
19
+ const graph = GraphConstructor.fromIdentifiers(graphIds);
20
+ return {
21
+ graph,
22
+ };
23
+ };
24
+ const getInstruction = () => {
25
+ return `Un graphe est représenté ci-dessous.
26
+ Quel est son ordre ?`;
27
+ };
28
+ const getAnswerNode = (identifiers) => {
29
+ const { graph } = getHydrated(identifiers);
30
+ return graph.vertexNames.length.toTree();
31
+ };
32
+ const getAnswer = (identifiers) => {
33
+ return getAnswerNode(identifiers).toTex();
34
+ };
35
+ const getHint = () => {
36
+ return `L'ordre d'un graphe est le nombre de sommets dont il est composé.`;
37
+ };
38
+ const getCorrection = (identifiers) => {
39
+ const { graph } = getHydrated(identifiers);
40
+ return `Le graphe a pour sommets ${joinanded(graph.vertexNames.map((nameVertex) => `$${nameVertex}$`), ", ", " et ")}.
41
+
42
+ L'ordre du graphe est donc $${graph.vertexNames.length.frenchify()}$.`;
43
+ };
44
+ const getCorrectionGGBOptions = (identifiers) => {
45
+ const { graphNodes, graphEdges } = identifiers;
46
+ const { graph } = getHydrated(identifiers);
47
+ const arrPoint = graphNodes.map(({ label, x, y }) => new Point(label, x, y));
48
+ const pointCommands = arrPoint.flatMap((point) => point.toGGBCommand({
49
+ isFixed: false,
50
+ isSelectionnable: true,
51
+ showLabel: true,
52
+ style: 0,
53
+ size: 8,
54
+ color: greenMain,
55
+ }));
56
+ const edgeCommands = graphEdges.flatMap((e, i) => {
57
+ return [
58
+ graph.isDirected
59
+ ? `edge${i + 1} = Vector(${e.from}, ${e.to})`
60
+ : `edge${i + 1} = Segment(${e.from}, ${e.to})`,
61
+ ];
62
+ });
63
+ const ggb = new GeogebraConstructor({
64
+ commands: [...pointCommands, ...edgeCommands],
65
+ fontSize: 16,
66
+ hideAxes: true,
67
+ hideGrid: true,
68
+ });
69
+ return ggb.getOptions({
70
+ coords: ggb.getCoordsForPoints(arrPoint),
71
+ });
72
+ };
73
+ const getGGBOptions = (identifiers) => {
74
+ const { graphNodes, graphEdges } = identifiers;
75
+ const { graph } = getHydrated(identifiers);
76
+ const arrPoint = graphNodes.map(({ label, x, y }) => new Point(label, x, y));
77
+ const pointCommands = arrPoint.flatMap((point) => point.toGGBCommand({
78
+ isFixed: false,
79
+ isSelectionnable: true,
80
+ showLabel: true,
81
+ style: 0,
82
+ size: 8,
83
+ }));
84
+ const edgeCommands = graphEdges.map((e, i) => graph.isDirected
85
+ ? `v${i + 1} = Vector(${e.from}, ${e.to})`
86
+ : `s${i + 1} = Segment(${e.from}, ${e.to})`);
87
+ const arrGGBCommandForGraph = [...pointCommands, ...edgeCommands];
88
+ const ggb = new GeogebraConstructor({
89
+ commands: [...arrGGBCommandForGraph],
90
+ fontSize: 16,
91
+ hideAxes: true,
92
+ hideGrid: true,
93
+ });
94
+ return ggb.getOptions({
95
+ coords: ggb.getCoordsForPoints(arrPoint),
96
+ });
97
+ };
98
+ const getPropositions = (n, { answer, ...identifiers }) => {
99
+ const propositions = [];
100
+ addValidProp(propositions, answer);
101
+ const { graphEdges } = identifiers;
102
+ const { graph } = getHydrated(identifiers);
103
+ const isTerror = probaFlip(0.4);
104
+ //student: number of edges
105
+ {
106
+ const nbWrong = graphEdges.length;
107
+ tryToAddWrongProp(propositions, nbWrong.frenchify());
108
+ if (isTerror) {
109
+ if (coinFlip()) {
110
+ tryToAddWrongProp(propositions, (nbWrong - 1).frenchify());
111
+ }
112
+ if (coinFlip()) {
113
+ tryToAddWrongProp(propositions, (nbWrong + 1).frenchify());
114
+ }
115
+ }
116
+ }
117
+ //student: counting mistake (offset)
118
+ if (!isTerror) {
119
+ const nbAnswer = graph.vertexNames.length;
120
+ if (coinFlip()) {
121
+ tryToAddWrongProp(propositions, (nbAnswer - 1).frenchify());
122
+ }
123
+ if (coinFlip()) {
124
+ tryToAddWrongProp(propositions, (nbAnswer + 1).frenchify());
125
+ }
126
+ }
127
+ //filler
128
+ propWhile(propositions, n, () => {
129
+ const nbWrong = randint(5, 15);
130
+ tryToAddWrongProp(propositions, nbWrong.frenchify());
131
+ });
132
+ return shuffleProps(propositions, n);
133
+ };
134
+ const getKeys = () => {
135
+ return [];
136
+ };
137
+ const isAnswerValid = (ans, { answer }) => {
138
+ try {
139
+ const [nodeAns, nodeAnswer] = [ans, answer].map((str) => parseAlgebraic(str));
140
+ return NodeComparator.isEqualViaSub(nodeAns, nodeAnswer);
141
+ }
142
+ catch (err) {
143
+ return handleVEAError(err);
144
+ }
145
+ };
146
+ const createRandomIdentifiers = (isDirected) => {
147
+ const nbVertices = randint(5, 10);
148
+ const isSimple = true;
149
+ const minDensity = (() => {
150
+ switch (nbVertices) {
151
+ case 5:
152
+ return isDirected ? 0.4 : 0.62;
153
+ case 6:
154
+ return isDirected ? 0.35 : 0.57;
155
+ case 7:
156
+ return isDirected ? 0.3 : 0.52;
157
+ case 8:
158
+ return isDirected ? 0.27 : 0.37;
159
+ case 9:
160
+ return isDirected ? 0.24 : 0.32;
161
+ }
162
+ })();
163
+ const graph = GraphConstructor.random(nbVertices, isSimple, isDirected, minDensity, "ABCDEFGHIJKLM".split(""), true);
164
+ const { nodes: graphNodes, edges: graphEdges } = GraphRenderer.renderToNodesAndEdges(graph);
165
+ const identifiers = {
166
+ graphIds: graph.toIdentifiers(),
167
+ graphNodes,
168
+ graphEdges,
169
+ };
170
+ return identifiers;
171
+ };
172
+ const getGraphsOrderOfGraphQuestion = (optsIn) => {
173
+ const arrayedOpts = defaultArrayedOptsWhereNeeded(optsIn, arrayedOptsDefault);
174
+ const opts = {
175
+ graphType: random(arrayedOpts.graphType),
176
+ };
177
+ const isDirected = opts.graphType === "orienté";
178
+ const identifiers = createRandomIdentifiers(isDirected);
179
+ return getQuestionFromIdentifiers(identifiers);
180
+ };
181
+ const getQuestionFromIdentifiers = (identifiers, opts) => {
182
+ const question = {
183
+ answer: getAnswer(identifiers, opts),
184
+ instruction: getInstruction(identifiers, opts),
185
+ keys: getKeys(identifiers, opts),
186
+ answerFormat: "tex",
187
+ identifiers,
188
+ hint: getHint(identifiers, opts),
189
+ correction: getCorrection(identifiers, opts),
190
+ correctionGgbOptions: getCorrectionGGBOptions(identifiers, opts),
191
+ ggbOptions: getGGBOptions(identifiers, opts),
192
+ };
193
+ return question;
194
+ };
195
+ const arrayedOptsDefault = {
196
+ graphType: ["non orienté"],
197
+ };
198
+ const options = [
199
+ {
200
+ id: "graphType",
201
+ label: "Types de graphes",
202
+ target: GeneratorOptionTarget.generation,
203
+ type: GeneratorOptionType.multiselect,
204
+ values: ["non orienté", "orienté"],
205
+ defaultValue: arrayedOptsDefault.graphType,
206
+ },
207
+ ];
208
+ export const graphsOrderOfGraph = {
209
+ id: "graphsOrderOfGraph",
210
+ label: "Déterminer l'ordre d'un graphe",
211
+ isSingleStep: true,
212
+ generator: (nb, opts) => getDistinctQuestions(() => getGraphsOrderOfGraphQuestion(opts), nb),
213
+ options,
214
+ qcmTimer: 60,
215
+ freeTimer: 60,
216
+ isAnswerValid,
217
+ getPropositions,
218
+ subject: "Mathématiques",
219
+ getQuestionFromIdentifiers,
220
+ hasHintAndCorrection: true,
221
+ hasGeogebra: true,
222
+ };
@@ -0,0 +1,10 @@
1
+ export * from "./graphsOrderOfGraph.js";
2
+ export * from "./graphsDegreeOfVertex.js";
3
+ export * from "./graphsCheckIsVerticesAdjacent.js";
4
+ export * from "./graphsCheckIsSameGraph.js";
5
+ export * from "./graphsCheckIsConnectedUndirectedGraph.js";
6
+ export * from "./graphsChainOrPathOfLengthN.js";
7
+ export * from "./edgesNumberFromSummitsDegrees.js";
8
+ export * from "./adjacentMatrixPath.js";
9
+ export * from "./eulerianChainFromAdjacentMatrix.js";
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/graphs/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oCAAoC,CAAC;AACnD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,4CAA4C,CAAC;AAC3D,cAAc,iCAAiC,CAAC;AAChD,cAAc,oCAAoC,CAAC;AACnD,cAAc,yBAAyB,CAAC;AACxC,cAAc,sCAAsC,CAAC"}
@@ -0,0 +1,9 @@
1
+ export * from "./graphsOrderOfGraph.js";
2
+ export * from "./graphsDegreeOfVertex.js";
3
+ export * from "./graphsCheckIsVerticesAdjacent.js";
4
+ export * from "./graphsCheckIsSameGraph.js";
5
+ export * from "./graphsCheckIsConnectedUndirectedGraph.js";
6
+ export * from "./graphsChainOrPathOfLengthN.js";
7
+ export * from "./edgesNumberFromSummitsDegrees.js";
8
+ export * from "./adjacentMatrixPath.js";
9
+ export * from "./eulerianChainFromAdjacentMatrix.js";
@@ -26,5 +26,6 @@ export * from "./tests/index.js";
26
26
  export * from "./pcExosInMath.js";
27
27
  export * from "./scratch/index.js";
28
28
  export * from "./integration/index.js";
29
+ export * from "./graphs/index.js";
29
30
  export * from "./arithmetic/index.js";
30
31
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/exercises/math/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AAEvC,cAAc,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/exercises/math/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAElC,cAAc,uBAAuB,CAAC"}
@@ -26,5 +26,6 @@ export * from "./tests/index.js";
26
26
  export * from "./pcExosInMath.js";
27
27
  export * from "./scratch/index.js";
28
28
  export * from "./integration/index.js";
29
+ export * from "./graphs/index.js";
29
30
  // export * from "./_debug/index.js";
30
31
  export * from "./arithmetic/index.js";
@@ -0,0 +1,9 @@
1
+ import { Exercise } from "../../../exercises/exercise.js";
2
+ import { MatrixIdentifiers } from "../../../math/matrices/matrix.js";
3
+ type Identifiers = {
4
+ aIds: MatrixIdentifiers;
5
+ bIds: MatrixIdentifiers;
6
+ };
7
+ export declare const areMatricesInverse: Exercise<Identifiers>;
8
+ export {};
9
+ //# sourceMappingURL=areMatricesInverse.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"areMatricesInverse.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/matrices/areMatricesInverse.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAEL,iBAAiB,EAClB,MAAM,+BAA+B,CAAC;AAKvC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,iBAAiB,CAAC;IACxB,IAAI,EAAE,iBAAiB,CAAC;CACzB,CAAC;AAmGF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,CAmBpD,CAAC"}
@@ -0,0 +1,106 @@
1
+ import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../exercises/utils/getDistinctQuestions.js";
3
+ import { MatrixConstructor, } from "../../../math/matrices/matrix.js";
4
+ import { randint } from "../../../math/utils/random/randint.js";
5
+ import { add } from "../../../tree/nodes/operators/addNode.js";
6
+ import { coinFlip } from "../../../utils/alea/coinFlip.js";
7
+ const getPropositions = (n, { answer }) => {
8
+ const propositions = [];
9
+ addValidProp(propositions, answer, "raw");
10
+ tryToAddWrongProp(propositions, "Oui", "raw");
11
+ tryToAddWrongProp(propositions, "Non", "raw");
12
+ return shuffleProps(propositions, n);
13
+ };
14
+ const getAnswer = (identifiers) => {
15
+ const { aIds, bIds } = identifiers;
16
+ const a = MatrixConstructor.fromIdentifiers(aIds);
17
+ const b = MatrixConstructor.fromIdentifiers(bIds);
18
+ const inv = a.toInversed();
19
+ return inv.simplify().toTex() === b.simplify().toTex() ? "Oui" : "Non";
20
+ };
21
+ const getInstruction = (identifiers) => {
22
+ const { aIds, bIds } = identifiers;
23
+ const a = MatrixConstructor.fromIdentifiers(aIds);
24
+ const b = MatrixConstructor.fromIdentifiers(bIds);
25
+ return `On considère les matrices :
26
+
27
+ $$
28
+ A = ${a.toTex()}
29
+ $$
30
+
31
+ $$
32
+ B = ${b.toTex()}
33
+ $$
34
+
35
+ $B$ est-elle la matrice inverse de $A$ ?`;
36
+ };
37
+ const getHint = () => {
38
+ return `$B$ est la matrice inverse de $A$ si et seulement si $AB = I$.`;
39
+ };
40
+ const getCorrection = (identifiers) => {
41
+ const { aIds, bIds } = identifiers;
42
+ const a = MatrixConstructor.fromIdentifiers(aIds);
43
+ const b = MatrixConstructor.fromIdentifiers(bIds);
44
+ const ab = a.matrixProduct(b);
45
+ const absimp = ab.simplify();
46
+ const isInv = absimp.isIdentity();
47
+ return `$B$ est la matrice inverse de $A$ si et seulement si $AB = I$.
48
+
49
+ On calcule donc le produit $AB$ :
50
+
51
+ $$
52
+ A\\times B = ${ab.toTex()}
53
+ $$
54
+
55
+ $$
56
+ A\\times B = ${absimp.toTex()}
57
+ $$
58
+
59
+ ${isInv
60
+ ? `On a donc $AB = I$ et donc $B$ est la matrice inverse de $A$.`
61
+ : `On a donc $AB \\neq I$ et donc $B$ n'est pas la matrice inverse de $A$.`}`;
62
+ };
63
+ const getAreMatricesInverseQuestion = () => {
64
+ const isInv = coinFlip();
65
+ const a = MatrixConstructor.randomInversible(2, 2, {
66
+ allowIdentity: false,
67
+ elementsOpts: [-5, 6],
68
+ });
69
+ const b = a.toInversed().simplify();
70
+ if (!isInv) {
71
+ b.elements[randint(0, 2)][randint(0, 2)] = add(b.elements[randint(0, 2)][randint(0, 2)], randint(-2, 2, [0])).simplify();
72
+ }
73
+ const identifiers = {
74
+ aIds: a.toIdentifiers(),
75
+ bIds: b.toIdentifiers(),
76
+ };
77
+ return getQuestionFromIdentifiers(identifiers);
78
+ };
79
+ const getQuestionFromIdentifiers = (identifiers) => {
80
+ return {
81
+ answer: getAnswer(identifiers),
82
+ instruction: getInstruction(identifiers),
83
+ keys: [],
84
+ answerFormat: "raw",
85
+ identifiers,
86
+ hint: getHint(identifiers),
87
+ correction: getCorrection(identifiers),
88
+ };
89
+ };
90
+ export const areMatricesInverse = {
91
+ id: "areMatricesInverse",
92
+ label: "Vérifier si $B$ est la matrice inverse de $A$ (matrices $2 \\times 2$)",
93
+ isSingleStep: true,
94
+ generator: (nb, opts) => getDistinctQuestions(() => getAreMatricesInverseQuestion(opts), nb),
95
+ qcmTimer: 60,
96
+ freeTimer: 60,
97
+ getPropositions,
98
+ subject: "Mathématiques",
99
+ getInstruction,
100
+ getHint,
101
+ getCorrection,
102
+ getAnswer,
103
+ getQuestionFromIdentifiers,
104
+ hasHintAndCorrection: true,
105
+ answerType: "QCU",
106
+ };
@@ -0,0 +1,9 @@
1
+ import { Exercise } from "../../../exercises/exercise.js";
2
+ import { MatrixIdentifiers } from "../../../math/matrices/matrix.js";
3
+ type Identifiers = {
4
+ aIds: MatrixIdentifiers;
5
+ bIds: MatrixIdentifiers;
6
+ };
7
+ export declare const computeFixedMatrixInRecurrenceSequence: Exercise<Identifiers>;
8
+ export {};
9
+ //# sourceMappingURL=computeFixedMatrixInRecurrenceSequence.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"computeFixedMatrixInRecurrenceSequence.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/matrices/computeFixedMatrixInRecurrenceSequence.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAIrC,OAAO,EAEL,iBAAiB,EAClB,MAAM,+BAA+B,CAAC;AAUvC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,iBAAiB,CAAC;IACxB,IAAI,EAAE,iBAAiB,CAAC;CACzB,CAAC;AAqIF,eAAO,MAAM,sCAAsC,EAAE,QAAQ,CAAC,WAAW,CAqBxE,CAAC"}