math-exercises 3.0.213 → 3.0.215

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (267) hide show
  1. package/lib/exercises/math/arithmetic/findLeftInHugeNumberDivision.d.ts +9 -0
  2. package/lib/exercises/math/arithmetic/findLeftInHugeNumberDivision.d.ts.map +1 -0
  3. package/lib/exercises/math/arithmetic/findLeftInHugeNumberDivision.js +194 -0
  4. package/lib/exercises/math/arithmetic/findMissingNumberToMakeNumberDivisibleBy9.d.ts +8 -0
  5. package/lib/exercises/math/arithmetic/findMissingNumberToMakeNumberDivisibleBy9.d.ts.map +1 -0
  6. package/lib/exercises/math/arithmetic/findMissingNumberToMakeNumberDivisibleBy9.js +121 -0
  7. package/lib/exercises/math/arithmetic/hasDiophantianEquationSolution.js +4 -4
  8. package/lib/exercises/math/arithmetic/index.d.ts +7 -0
  9. package/lib/exercises/math/arithmetic/index.d.ts.map +1 -1
  10. package/lib/exercises/math/arithmetic/index.js +7 -0
  11. package/lib/exercises/math/arithmetic/isBigNumberPrime.d.ts +7 -0
  12. package/lib/exercises/math/arithmetic/isBigNumberPrime.d.ts.map +1 -0
  13. package/lib/exercises/math/arithmetic/isBigNumberPrime.js +107 -0
  14. package/lib/exercises/math/arithmetic/numberOfEndingZerosOfBigProduct.d.ts +8 -0
  15. package/lib/exercises/math/arithmetic/numberOfEndingZerosOfBigProduct.d.ts.map +1 -0
  16. package/lib/exercises/math/arithmetic/numberOfEndingZerosOfBigProduct.js +139 -0
  17. package/lib/exercises/math/arithmetic/pgcdFromEuclid.d.ts +8 -0
  18. package/lib/exercises/math/arithmetic/pgcdFromEuclid.d.ts.map +1 -0
  19. package/lib/exercises/math/arithmetic/pgcdFromEuclid.js +123 -0
  20. package/lib/exercises/math/arithmetic/solveDiophantianEquationByUsingPrimality.d.ts +7 -0
  21. package/lib/exercises/math/arithmetic/solveDiophantianEquationByUsingPrimality.d.ts.map +1 -0
  22. package/lib/exercises/math/arithmetic/solveDiophantianEquationByUsingPrimality.js +117 -0
  23. package/lib/exercises/math/arithmetic/whichDayInXDays.d.ts +8 -0
  24. package/lib/exercises/math/arithmetic/whichDayInXDays.d.ts.map +1 -0
  25. package/lib/exercises/math/arithmetic/whichDayInXDays.js +81 -0
  26. package/lib/exercises/math/calcul/fractions/fractionsSumFillInTheBlank.d.ts +15 -0
  27. package/lib/exercises/math/calcul/fractions/fractionsSumFillInTheBlank.d.ts.map +1 -0
  28. package/lib/exercises/math/calcul/fractions/fractionsSumFillInTheBlank.js +256 -0
  29. package/lib/exercises/math/calcul/fractions/index.d.ts +1 -0
  30. package/lib/exercises/math/calcul/fractions/index.d.ts.map +1 -1
  31. package/lib/exercises/math/calcul/fractions/index.js +1 -0
  32. package/lib/exercises/math/calcul/index.d.ts +1 -0
  33. package/lib/exercises/math/calcul/index.d.ts.map +1 -1
  34. package/lib/exercises/math/calcul/index.js +1 -0
  35. package/lib/exercises/math/calcul/mentalCaluls/index.d.ts +3 -0
  36. package/lib/exercises/math/calcul/mentalCaluls/index.d.ts.map +1 -1
  37. package/lib/exercises/math/calcul/mentalCaluls/index.js +3 -0
  38. package/lib/exercises/math/calcul/mentalCaluls/mentalMultiplication101AndFriends.d.ts +10 -0
  39. package/lib/exercises/math/calcul/mentalCaluls/mentalMultiplication101AndFriends.d.ts.map +1 -0
  40. package/lib/exercises/math/calcul/mentalCaluls/mentalMultiplication101AndFriends.js +264 -0
  41. package/lib/exercises/math/calcul/mentalCaluls/mentalMultiplication11AndFriends.d.ts +10 -0
  42. package/lib/exercises/math/calcul/mentalCaluls/mentalMultiplication11AndFriends.d.ts.map +1 -0
  43. package/lib/exercises/math/calcul/mentalCaluls/mentalMultiplication11AndFriends.js +264 -0
  44. package/lib/exercises/math/calcul/mentalCaluls/mentalMultiplicationTable.d.ts +11 -0
  45. package/lib/exercises/math/calcul/mentalCaluls/mentalMultiplicationTable.d.ts.map +1 -0
  46. package/lib/exercises/math/calcul/mentalCaluls/mentalMultiplicationTable.js +141 -0
  47. package/lib/exercises/math/calcul/ratio/index.d.ts +1 -0
  48. package/lib/exercises/math/calcul/ratio/index.d.ts.map +1 -1
  49. package/lib/exercises/math/calcul/ratio/index.js +1 -0
  50. package/lib/exercises/math/calcul/ratio/partsUsingRatio.d.ts +13 -0
  51. package/lib/exercises/math/calcul/ratio/partsUsingRatio.d.ts.map +1 -0
  52. package/lib/exercises/math/calcul/ratio/partsUsingRatio.js +237 -0
  53. package/lib/exercises/math/calcul/relatives/index.d.ts +2 -0
  54. package/lib/exercises/math/calcul/relatives/index.d.ts.map +1 -0
  55. package/lib/exercises/math/calcul/relatives/index.js +1 -0
  56. package/lib/exercises/math/calcul/relatives/relativesAddAndSub.d.ts +17 -0
  57. package/lib/exercises/math/calcul/relatives/relativesAddAndSub.d.ts.map +1 -0
  58. package/lib/exercises/math/calcul/relatives/relativesAddAndSub.js +448 -0
  59. package/lib/exercises/math/calculLitteral/factorisation/factoByXK.d.ts +10 -0
  60. package/lib/exercises/math/calculLitteral/factorisation/factoByXK.d.ts.map +1 -0
  61. package/lib/exercises/math/calculLitteral/factorisation/factoByXK.js +190 -0
  62. package/lib/exercises/math/calculLitteral/factorisation/index.d.ts +1 -0
  63. package/lib/exercises/math/calculLitteral/factorisation/index.d.ts.map +1 -1
  64. package/lib/exercises/math/calculLitteral/factorisation/index.js +1 -0
  65. package/lib/exercises/math/complex/algebraic/addComplex.d.ts +10 -0
  66. package/lib/exercises/math/complex/algebraic/addComplex.d.ts.map +1 -0
  67. package/lib/exercises/math/complex/algebraic/addComplex.js +125 -0
  68. package/lib/exercises/math/complex/algebraic/conjugateComplex.d.ts +8 -0
  69. package/lib/exercises/math/complex/algebraic/conjugateComplex.d.ts.map +1 -0
  70. package/lib/exercises/math/complex/algebraic/conjugateComplex.js +105 -0
  71. package/lib/exercises/math/complex/algebraic/conjugateDivideComplex.d.ts +8 -0
  72. package/lib/exercises/math/complex/algebraic/conjugateDivideComplex.d.ts.map +1 -0
  73. package/lib/exercises/math/complex/algebraic/conjugateDivideComplex.js +137 -0
  74. package/lib/exercises/math/complex/algebraic/conjugateMultiplyComplex.d.ts +8 -0
  75. package/lib/exercises/math/complex/algebraic/conjugateMultiplyComplex.d.ts.map +1 -0
  76. package/lib/exercises/math/complex/algebraic/conjugateMultiplyComplex.js +116 -0
  77. package/lib/exercises/math/complex/algebraic/divideComplex.d.ts +8 -0
  78. package/lib/exercises/math/complex/algebraic/divideComplex.d.ts.map +1 -0
  79. package/lib/exercises/math/complex/algebraic/divideComplex.js +128 -0
  80. package/lib/exercises/math/complex/algebraic/index.d.ts +11 -0
  81. package/lib/exercises/math/complex/algebraic/index.d.ts.map +1 -0
  82. package/lib/exercises/math/complex/algebraic/index.js +10 -0
  83. package/lib/exercises/math/complex/algebraic/inverseComplex.d.ts +8 -0
  84. package/lib/exercises/math/complex/algebraic/inverseComplex.d.ts.map +1 -0
  85. package/lib/exercises/math/complex/algebraic/inverseComplex.js +95 -0
  86. package/lib/exercises/math/complex/algebraic/linearCombinaisonComplex.d.ts +10 -0
  87. package/lib/exercises/math/complex/algebraic/linearCombinaisonComplex.d.ts.map +1 -0
  88. package/lib/exercises/math/complex/algebraic/linearCombinaisonComplex.js +105 -0
  89. package/lib/exercises/math/complex/algebraic/moduloFromAlgebraicComplex.d.ts +8 -0
  90. package/lib/exercises/math/complex/algebraic/moduloFromAlgebraicComplex.d.ts.map +1 -0
  91. package/lib/exercises/math/complex/algebraic/moduloFromAlgebraicComplex.js +93 -0
  92. package/lib/exercises/math/complex/algebraic/mutiplyComplex.d.ts +8 -0
  93. package/lib/exercises/math/complex/algebraic/mutiplyComplex.d.ts.map +1 -0
  94. package/lib/exercises/math/complex/algebraic/mutiplyComplex.js +106 -0
  95. package/lib/exercises/math/complex/algebraic/reAndIm.d.ts +9 -0
  96. package/lib/exercises/math/complex/algebraic/reAndIm.d.ts.map +1 -0
  97. package/lib/exercises/math/complex/algebraic/reAndIm.js +92 -0
  98. package/lib/exercises/math/complex/geometric/complexAlgebraicFromModuloAndArg.d.ts +9 -0
  99. package/lib/exercises/math/complex/geometric/complexAlgebraicFromModuloAndArg.d.ts.map +1 -0
  100. package/lib/exercises/math/complex/geometric/complexAlgebraicFromModuloAndArg.js +151 -0
  101. package/lib/exercises/math/complex/geometric/complexDistance.d.ts +11 -0
  102. package/lib/exercises/math/complex/geometric/complexDistance.d.ts.map +1 -0
  103. package/lib/exercises/math/complex/geometric/complexDistance.js +125 -0
  104. package/lib/exercises/math/complex/geometric/complexGeomAffixAlgFromPoint.d.ts +9 -0
  105. package/lib/exercises/math/complex/geometric/complexGeomAffixAlgFromPoint.d.ts.map +1 -0
  106. package/lib/exercises/math/complex/geometric/complexGeomAffixAlgFromPoint.js +326 -0
  107. package/lib/exercises/math/complex/geometric/complexGeomAffixExpFromCenteredRegularPolygon.d.ts +10 -0
  108. package/lib/exercises/math/complex/geometric/complexGeomAffixExpFromCenteredRegularPolygon.d.ts.map +1 -0
  109. package/lib/exercises/math/complex/geometric/complexGeomAffixExpFromCenteredRegularPolygon.js +459 -0
  110. package/lib/exercises/math/complex/geometric/complexGeomAffixExpFromPoint.d.ts +14 -0
  111. package/lib/exercises/math/complex/geometric/complexGeomAffixExpFromPoint.d.ts.map +1 -0
  112. package/lib/exercises/math/complex/geometric/complexGeomAffixExpFromPoint.js +539 -0
  113. package/lib/exercises/math/complex/geometric/complexGeomAffixTrigFromPoint.d.ts +13 -0
  114. package/lib/exercises/math/complex/geometric/complexGeomAffixTrigFromPoint.d.ts.map +1 -0
  115. package/lib/exercises/math/complex/geometric/complexGeomAffixTrigFromPoint.js +485 -0
  116. package/lib/exercises/math/complex/geometric/complexGeomApproxOfCosArgOrSinArgFromPointAndAffixTrig.d.ts +12 -0
  117. package/lib/exercises/math/complex/geometric/complexGeomApproxOfCosArgOrSinArgFromPointAndAffixTrig.d.ts.map +1 -0
  118. package/lib/exercises/math/complex/geometric/complexGeomApproxOfCosArgOrSinArgFromPointAndAffixTrig.js +224 -0
  119. package/lib/exercises/math/complex/geometric/complexGeomArgumentOfFracCBABFromFigure.d.ts +11 -0
  120. package/lib/exercises/math/complex/geometric/complexGeomArgumentOfFracCBABFromFigure.d.ts.map +1 -0
  121. package/lib/exercises/math/complex/geometric/complexGeomArgumentOfFracCBABFromFigure.js +448 -0
  122. package/lib/exercises/math/complex/geometric/complexGeomFindPointFromAffixExp.d.ts +11 -0
  123. package/lib/exercises/math/complex/geometric/complexGeomFindPointFromAffixExp.d.ts.map +1 -0
  124. package/lib/exercises/math/complex/geometric/complexGeomFindPointFromAffixExp.js +223 -0
  125. package/lib/exercises/math/complex/geometric/complexGeomFindPointFromPowerOfUnitRootFromFigure.d.ts +11 -0
  126. package/lib/exercises/math/complex/geometric/complexGeomFindPointFromPowerOfUnitRootFromFigure.d.ts.map +1 -0
  127. package/lib/exercises/math/complex/geometric/complexGeomFindPointFromPowerOfUnitRootFromFigure.js +348 -0
  128. package/lib/exercises/math/complex/geometric/complexGeomPlaceAffixPoint.d.ts +8 -0
  129. package/lib/exercises/math/complex/geometric/complexGeomPlaceAffixPoint.d.ts.map +1 -0
  130. package/lib/exercises/math/complex/geometric/complexGeomPlaceAffixPoint.js +86 -0
  131. package/lib/exercises/math/complex/geometric/complexGeomPlacePointFromZAPlusZ.d.ts +11 -0
  132. package/lib/exercises/math/complex/geometric/complexGeomPlacePointFromZAPlusZ.d.ts.map +1 -0
  133. package/lib/exercises/math/complex/geometric/complexGeomPlacePointFromZAPlusZ.js +311 -0
  134. package/lib/exercises/math/complex/geometric/complexGeomPlacePointFromZATimesZ.d.ts +11 -0
  135. package/lib/exercises/math/complex/geometric/complexGeomPlacePointFromZATimesZ.d.ts.map +1 -0
  136. package/lib/exercises/math/complex/geometric/complexGeomPlacePointFromZATimesZ.js +345 -0
  137. package/lib/exercises/math/complex/geometric/complexGeomPlacePointFromZATransformed.d.ts +16 -0
  138. package/lib/exercises/math/complex/geometric/complexGeomPlacePointFromZATransformed.d.ts.map +1 -0
  139. package/lib/exercises/math/complex/geometric/complexGeomPlacePointFromZATransformed.js +729 -0
  140. package/lib/exercises/math/complex/geometric/complexGeomPlacePointWithAffixInU.d.ts +11 -0
  141. package/lib/exercises/math/complex/geometric/complexGeomPlacePointWithAffixInU.d.ts.map +1 -0
  142. package/lib/exercises/math/complex/geometric/complexGeomPlacePointWithAffixInU.js +253 -0
  143. package/lib/exercises/math/complex/geometric/index.d.ts +12 -0
  144. package/lib/exercises/math/complex/geometric/index.d.ts.map +1 -0
  145. package/lib/exercises/math/complex/geometric/index.js +19 -0
  146. package/lib/exercises/math/complex/index.d.ts +4 -10
  147. package/lib/exercises/math/complex/index.d.ts.map +1 -1
  148. package/lib/exercises/math/complex/index.js +4 -11
  149. package/lib/exercises/math/complex/polynomials/factorizePolynomialInC.d.ts +10 -0
  150. package/lib/exercises/math/complex/polynomials/factorizePolynomialInC.d.ts.map +1 -0
  151. package/lib/exercises/math/complex/polynomials/factorizePolynomialInC.js +176 -0
  152. package/lib/exercises/math/complex/polynomials/index.d.ts +4 -0
  153. package/lib/exercises/math/complex/polynomials/index.d.ts.map +1 -0
  154. package/lib/exercises/math/complex/polynomials/index.js +3 -0
  155. package/lib/exercises/math/complex/polynomials/solveSecondDegreeInComplex.d.ts +10 -0
  156. package/lib/exercises/math/complex/polynomials/solveSecondDegreeInComplex.d.ts.map +1 -0
  157. package/lib/exercises/math/complex/polynomials/solveSecondDegreeInComplex.js +190 -0
  158. package/lib/exercises/math/complex/polynomials/solveZSquareEqualsA.d.ts +11 -0
  159. package/lib/exercises/math/complex/polynomials/solveZSquareEqualsA.d.ts.map +1 -0
  160. package/lib/exercises/math/complex/polynomials/solveZSquareEqualsA.js +158 -0
  161. package/lib/exercises/math/complex/unitRoots/giveNUnitRoot.d.ts +7 -0
  162. package/lib/exercises/math/complex/unitRoots/giveNUnitRoot.d.ts.map +1 -0
  163. package/lib/exercises/math/complex/unitRoots/giveNUnitRoot.js +122 -0
  164. package/lib/exercises/math/complex/unitRoots/giveOneSolutionToComplexPowNEqualsOne.d.ts +8 -0
  165. package/lib/exercises/math/complex/unitRoots/giveOneSolutionToComplexPowNEqualsOne.d.ts.map +1 -0
  166. package/lib/exercises/math/complex/unitRoots/giveOneSolutionToComplexPowNEqualsOne.js +138 -0
  167. package/lib/exercises/math/complex/unitRoots/index.d.ts +3 -0
  168. package/lib/exercises/math/complex/unitRoots/index.d.ts.map +1 -0
  169. package/lib/exercises/math/complex/unitRoots/index.js +2 -0
  170. package/lib/exercises/math/conversion/clock/clockReading.d.ts +12 -0
  171. package/lib/exercises/math/conversion/clock/clockReading.d.ts.map +1 -0
  172. package/lib/exercises/math/conversion/clock/clockReading.js +385 -0
  173. package/lib/exercises/math/conversion/clock/clockReadingPlusTimeOperation.d.ts +2 -0
  174. package/lib/exercises/math/conversion/clock/clockReadingPlusTimeOperation.d.ts.map +1 -0
  175. package/lib/exercises/math/conversion/clock/clockReadingPlusTimeOperation.js +521 -0
  176. package/lib/exercises/math/conversion/clock/clockWritingByManipulatingNeedles.d.ts +2 -0
  177. package/lib/exercises/math/conversion/clock/clockWritingByManipulatingNeedles.d.ts.map +1 -0
  178. package/lib/exercises/math/conversion/clock/clockWritingByManipulatingNeedles.js +359 -0
  179. package/lib/exercises/math/conversion/clock/dateTimeOperationAdd.d.ts +16 -0
  180. package/lib/exercises/math/conversion/clock/dateTimeOperationAdd.d.ts.map +1 -0
  181. package/lib/exercises/math/conversion/clock/dateTimeOperationAdd.js +319 -0
  182. package/lib/exercises/math/conversion/clock/index.d.ts +3 -0
  183. package/lib/exercises/math/conversion/clock/index.d.ts.map +1 -0
  184. package/lib/exercises/math/conversion/clock/index.js +4 -0
  185. package/lib/exercises/math/conversion/index.d.ts +1 -0
  186. package/lib/exercises/math/conversion/index.d.ts.map +1 -1
  187. package/lib/exercises/math/conversion/index.js +1 -0
  188. package/lib/exercises/math/geometry/angles/angleNatureFromFigure.d.ts +11 -0
  189. package/lib/exercises/math/geometry/angles/angleNatureFromFigure.d.ts.map +1 -0
  190. package/lib/exercises/math/geometry/angles/angleNatureFromFigure.js +233 -0
  191. package/lib/exercises/math/geometry/angles/angleNatureFromMeasure.d.ts +10 -0
  192. package/lib/exercises/math/geometry/angles/angleNatureFromMeasure.d.ts.map +1 -0
  193. package/lib/exercises/math/geometry/angles/angleNatureFromMeasure.js +137 -0
  194. package/lib/exercises/math/geometry/angles/index.d.ts +2 -0
  195. package/lib/exercises/math/geometry/angles/index.d.ts.map +1 -1
  196. package/lib/exercises/math/geometry/angles/index.js +2 -0
  197. package/lib/exercises/math/geometry/circles/buildCircleFromRadius.d.ts +9 -0
  198. package/lib/exercises/math/geometry/circles/buildCircleFromRadius.d.ts.map +1 -0
  199. package/lib/exercises/math/geometry/circles/buildCircleFromRadius.js +187 -0
  200. package/lib/exercises/math/geometry/circles/index.d.ts +1 -0
  201. package/lib/exercises/math/geometry/circles/index.d.ts.map +1 -1
  202. package/lib/exercises/math/geometry/circles/index.js +1 -0
  203. package/lib/exercises/math/geometry/lines/buildParallelFromLineAndPoint.d.ts +11 -0
  204. package/lib/exercises/math/geometry/lines/buildParallelFromLineAndPoint.d.ts.map +1 -0
  205. package/lib/exercises/math/geometry/lines/buildParallelFromLineAndPoint.js +154 -0
  206. package/lib/exercises/math/geometry/lines/buildPerpendicularFromLineAndPoint.d.ts +11 -0
  207. package/lib/exercises/math/geometry/lines/buildPerpendicularFromLineAndPoint.d.ts.map +1 -0
  208. package/lib/exercises/math/geometry/lines/buildPerpendicularFromLineAndPoint.js +157 -0
  209. package/lib/exercises/math/geometry/lines/index.d.ts +2 -0
  210. package/lib/exercises/math/geometry/lines/index.d.ts.map +1 -1
  211. package/lib/exercises/math/geometry/lines/index.js +2 -0
  212. package/lib/exercises/math/geometry/triangles/index.d.ts +2 -0
  213. package/lib/exercises/math/geometry/triangles/index.d.ts.map +1 -1
  214. package/lib/exercises/math/geometry/triangles/index.js +2 -1
  215. package/lib/exercises/math/geometry/triangles/traceHeightInTriangle.d.ts +13 -0
  216. package/lib/exercises/math/geometry/triangles/traceHeightInTriangle.d.ts.map +1 -0
  217. package/lib/exercises/math/geometry/triangles/traceHeightInTriangle.js +271 -0
  218. package/lib/exercises/math/geometry/triangles/traceMedianInTriangle.d.ts +8 -0
  219. package/lib/exercises/math/geometry/triangles/traceMedianInTriangle.d.ts.map +1 -1
  220. package/lib/exercises/math/geometry/triangles/traceMedianInTriangle.js +284 -53
  221. package/lib/exercises/math/geometry/vectors/constructions/index.d.ts +1 -0
  222. package/lib/exercises/math/geometry/vectors/constructions/index.d.ts.map +1 -1
  223. package/lib/exercises/math/geometry/vectors/constructions/index.js +1 -0
  224. package/lib/exercises/math/geometry/vectors/constructions/traceVectorSumFromVecs.d.ts +8 -0
  225. package/lib/exercises/math/geometry/vectors/constructions/traceVectorSumFromVecs.d.ts.map +1 -0
  226. package/lib/exercises/math/geometry/vectors/constructions/traceVectorSumFromVecs.js +165 -0
  227. package/lib/exercises/math/geometry/volumes/index.d.ts +1 -0
  228. package/lib/exercises/math/geometry/volumes/index.d.ts.map +1 -1
  229. package/lib/exercises/math/geometry/volumes/index.js +1 -0
  230. package/lib/exercises/math/geometry/volumes/volumeOfCylinder.d.ts +8 -0
  231. package/lib/exercises/math/geometry/volumes/volumeOfCylinder.d.ts.map +1 -0
  232. package/lib/exercises/math/geometry/volumes/volumeOfCylinder.js +157 -0
  233. package/lib/exercises/math/spaceGeometry/basis/index.d.ts +1 -0
  234. package/lib/exercises/math/spaceGeometry/basis/index.d.ts.map +1 -1
  235. package/lib/exercises/math/spaceGeometry/basis/index.js +1 -0
  236. package/lib/exercises/math/spaceGeometry/basis/spaceSegmentLengthInRectangularPrism.d.ts +18 -0
  237. package/lib/exercises/math/spaceGeometry/basis/spaceSegmentLengthInRectangularPrism.d.ts.map +1 -0
  238. package/lib/exercises/math/spaceGeometry/basis/spaceSegmentLengthInRectangularPrism.js +538 -0
  239. package/lib/exercises/math/trigonometry/formulas/trigoAdditionFormulaUsage.d.ts.map +1 -1
  240. package/lib/exercises/math/trigonometry/formulas/trigoAdditionFormulaUsage.js +6 -5
  241. package/lib/exercises/math/trigonometry/triangle/trigonometrySohcahtoaCalcul.js +1 -1
  242. package/lib/exercises/utils/geogebra/toolBarConstructor.d.ts +1 -0
  243. package/lib/exercises/utils/geogebra/toolBarConstructor.d.ts.map +1 -1
  244. package/lib/exercises/utils/geogebra/toolBarConstructor.js +2 -0
  245. package/lib/geogebra/parsers/geogebraParser.d.ts +3 -0
  246. package/lib/geogebra/parsers/geogebraParser.d.ts.map +1 -1
  247. package/lib/geogebra/parsers/geogebraParser.js +27 -0
  248. package/lib/index.d.ts +213 -23
  249. package/lib/index.d.ts.map +1 -1
  250. package/lib/latexTester.js +2 -0
  251. package/lib/math/geometry/angle.d.ts.map +1 -1
  252. package/lib/math/geometry/angle.js +3 -0
  253. package/lib/math/geometry/segment.d.ts +1 -1
  254. package/lib/math/geometry/segment.d.ts.map +1 -1
  255. package/lib/math/geometry/segment.js +5 -2
  256. package/lib/math/utils/geometry/angleBetweenPoints.d.ts +4 -0
  257. package/lib/math/utils/geometry/angleBetweenPoints.d.ts.map +1 -0
  258. package/lib/math/utils/geometry/angleBetweenPoints.js +58 -0
  259. package/lib/math/utils/geometry/angleNWSE.d.ts +3 -0
  260. package/lib/math/utils/geometry/angleNWSE.d.ts.map +1 -0
  261. package/lib/math/utils/geometry/angleNWSE.js +56 -0
  262. package/lib/tests/singleExo.test.d.ts.map +1 -1
  263. package/lib/tests/singleExo.test.js +2 -2
  264. package/lib/utils/strings/frenchDays.d.ts +2 -0
  265. package/lib/utils/strings/frenchDays.d.ts.map +1 -0
  266. package/lib/utils/strings/frenchDays.js +9 -0
  267. package/package.json +1 -1
@@ -0,0 +1,538 @@
1
+ import { addValidProp, tryToAddWrongProp, shuffleProps, GeneratorOptionTarget, GeneratorOptionType, propWhile, } from "../../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { defaultArrayedOptsWhereNeeded } from "../../../../exercises/utils/options/arrayedOptions.js";
4
+ import { blueMain, colorWithOpacity, greenMain, } from "../../../../geogebra/colors.js";
5
+ import { GeogebraConstructor } from "../../../../geogebra/geogebraConstructor.js";
6
+ import { SpacePointConstructor, } from "../../../../math/geometry/spacePoint.js";
7
+ import { SpaceVectorConstructor, } from "../../../../math/geometry/spaceVector.js";
8
+ import { randint } from "../../../../math/utils/random/randint.js";
9
+ import { round } from "../../../../math/utils/round.js";
10
+ import { abs } from "../../../../tree/nodes/functions/absNode.js";
11
+ import { sqrt } from "../../../../tree/nodes/functions/sqrtNode.js";
12
+ import { add, AddNode } from "../../../../tree/nodes/operators/addNode.js";
13
+ import { square } from "../../../../tree/nodes/operators/powerNode.js";
14
+ import { substract } from "../../../../tree/nodes/operators/substractNode.js";
15
+ import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
16
+ import { NodeComparator } from "../../../../tree/utilities/nodeComparator.js";
17
+ import { operatorComposition } from "../../../../tree/utilities/operatorComposition.js";
18
+ import { coinFlip } from "../../../../utils/alea/coinFlip.js";
19
+ import { random, randomMany } from "../../../../utils/alea/random.js";
20
+ import { zip } from "../../../../utils/arrays/arrayZip.js";
21
+ import { getCartesiansProducts } from "../../../../utils/arrays/cartesianProducts.js";
22
+ import { transpose } from "../../../../utils/arrays/transpose.js";
23
+ import { alignTex } from "../../../../utils/latex/alignTex.js";
24
+ const getCoordsForFrame = (spacePointStart, spacePointEnd) => {
25
+ const [arrAxisMin, arrAxisMax] = [Math.min, Math.max].map((funcMinMax) => {
26
+ return ["x", "y", "z"].map((axis) => {
27
+ const [vAxisStart, vAxisEnd] = [spacePointStart, spacePointEnd]
28
+ .map((spacePoint) => spacePoint[axis])
29
+ .map((node) => node.evaluate());
30
+ return funcMinMax(vAxisStart, vAxisEnd);
31
+ });
32
+ });
33
+ const [xMin, yMin, zMin] = arrAxisMin;
34
+ const [xMax, yMax, zMax] = arrAxisMax;
35
+ return [xMin, xMax, yMin, yMax, zMin, zMax];
36
+ };
37
+ const createArrSpacePointBoundingBox = (spacePointStart, spacePointEnd) => {
38
+ const [xMin, xMax, yMin, yMax, zMin, zMax] = getCoordsForFrame(spacePointStart, spacePointEnd);
39
+ const arrSpacePoint = getCartesiansProducts([
40
+ [xMin, xMax],
41
+ [yMin, yMax],
42
+ [zMin, zMax],
43
+ ]).map(([x, y, z], i) => {
44
+ return SpacePointConstructor.fromScalars([x, y, z], `PBB${i}`);
45
+ });
46
+ return arrSpacePoint;
47
+ };
48
+ const getAcceptedInputTypesSentence = (acceptedInputType) => {
49
+ return `Donner le résultat
50
+ ${(() => {
51
+ switch (acceptedInputType) {
52
+ case "exact":
53
+ return "sous forme exacte";
54
+ default:
55
+ case "arrondi au centième":
56
+ return "arrondie au centième";
57
+ }
58
+ })()}.`;
59
+ };
60
+ const getFormattedNode = (node, acceptedInputType) => {
61
+ switch (acceptedInputType) {
62
+ case "exact":
63
+ return node;
64
+ default:
65
+ case "arrondi au centième":
66
+ return round(node.evaluate(), 2).toTree();
67
+ }
68
+ };
69
+ /**********/
70
+ function* genFuncNamePretty() {
71
+ const arrLetter = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".split("");
72
+ yield* arrLetter;
73
+ return "Done";
74
+ }
75
+ const getRectangularPrismPoints = (rectangularPrismOriginSpacePoint, L, l, h) => {
76
+ const [x1, y1, z1] = [
77
+ rectangularPrismOriginSpacePoint.x,
78
+ rectangularPrismOriginSpacePoint.y,
79
+ rectangularPrismOriginSpacePoint.z,
80
+ ].map((node) => node.evaluate());
81
+ const [x2, y2, z2] = [x1, y1, z1].map((t, i) => add(t, [L, l, h][i]).evaluate());
82
+ return [
83
+ //bottom
84
+ SpacePointConstructor.fromScalars([x1, y1, z1]),
85
+ SpacePointConstructor.fromScalars([x1, y2, z1]),
86
+ SpacePointConstructor.fromScalars([x2, y2, z1]),
87
+ SpacePointConstructor.fromScalars([x2, y1, z1]),
88
+ //top
89
+ SpacePointConstructor.fromScalars([x1, y1, z2]),
90
+ SpacePointConstructor.fromScalars([x1, y2, z2]),
91
+ SpacePointConstructor.fromScalars([x2, y2, z2]),
92
+ SpacePointConstructor.fromScalars([x2, y1, z2]),
93
+ ];
94
+ };
95
+ const createPointMeshForSide = (spacePointOrigin, u, v, nbH, nbW) => {
96
+ return [...Array(nbH + 1).keys()].map((i) => [...Array(nbW + 1).keys()].map((j) => {
97
+ const spaceVec = u.times(i.toTree()).add(v.times(j.toTree()));
98
+ const spacePointIJ = spaceVec.getEndPoint(spacePointOrigin);
99
+ return spacePointIJ;
100
+ }));
101
+ };
102
+ const createSegmentMeshForPointMesh = (pointMesh) => {
103
+ //horiz
104
+ const arrSegmentHoriz = pointMesh.map((rowOfPoints) => {
105
+ return [rowOfPoints[0], rowOfPoints[rowOfPoints.length - 1]];
106
+ });
107
+ //vert
108
+ const arrSegmentVert = transpose(pointMesh).map((columnOfPoints) => {
109
+ return [columnOfPoints[0], columnOfPoints[columnOfPoints.length - 1]];
110
+ });
111
+ return [...arrSegmentHoriz, ...arrSegmentVert];
112
+ };
113
+ const getAllPointMeshes = (rectangularPrismOriginSpacePoint, L, l, h) => {
114
+ return [
115
+ //z-
116
+ createPointMeshForSide(rectangularPrismOriginSpacePoint, SpaceVectorConstructor.fromScalars([1, 0, 0]), SpaceVectorConstructor.fromScalars([0, 1, 0]), L, l),
117
+ //z+
118
+ createPointMeshForSide(SpaceVectorConstructor.fromScalars([0, 0, h]).getEndPoint(rectangularPrismOriginSpacePoint, "NoName"), SpaceVectorConstructor.fromScalars([1, 0, 0]), SpaceVectorConstructor.fromScalars([0, 1, 0]), L, l),
119
+ //y-
120
+ createPointMeshForSide(rectangularPrismOriginSpacePoint, SpaceVectorConstructor.fromScalars([1, 0, 0]), SpaceVectorConstructor.fromScalars([0, 0, 1]), L, h),
121
+ //y+
122
+ createPointMeshForSide(SpaceVectorConstructor.fromScalars([0, l, 0]).getEndPoint(rectangularPrismOriginSpacePoint, "NoName"), SpaceVectorConstructor.fromScalars([1, 0, 0]), SpaceVectorConstructor.fromScalars([0, 0, 1]), L, h),
123
+ //x-
124
+ createPointMeshForSide(rectangularPrismOriginSpacePoint, SpaceVectorConstructor.fromScalars([0, 1, 0]), SpaceVectorConstructor.fromScalars([0, 0, 1]), l, h),
125
+ //x+
126
+ createPointMeshForSide(SpaceVectorConstructor.fromScalars([L, 0, 0]).getEndPoint(rectangularPrismOriginSpacePoint, "NoName"), SpaceVectorConstructor.fromScalars([0, 1, 0]), SpaceVectorConstructor.fromScalars([0, 0, 1]), l, h),
127
+ ];
128
+ };
129
+ const getInstruction = (identifiers) => {
130
+ const { L, l, h, arrSegmentSpacePointIds, acceptedInputType } = identifiers;
131
+ const arrSegmentSpacePoint = arrSegmentSpacePointIds.map((spacePointIds) => SpacePointConstructor.fromIdentifiers(spacePointIds));
132
+ const [spacePointStart, spacePointEnd] = arrSegmentSpacePoint;
133
+ const texSegment = `[${spacePointStart.name}${spacePointEnd.name}]`;
134
+ return `Le pavé droit affiché a les dimensions suivantes :
135
+ - longueur : $${L.frenchify()}$
136
+ - largeur : $${l.frenchify()}$
137
+ - hauteur : $${h.frenchify()}$
138
+
139
+ Quelle est la longueur du segment $${texSegment}$ ?
140
+ ${getAcceptedInputTypesSentence(acceptedInputType)}
141
+
142
+ *On pourra tourner la fenêtre graphique.*`;
143
+ };
144
+ const createNodeSumOfSquares = (identifiers, isShouldFilterOutZeros = true) => {
145
+ const { arrSegmentSpacePointIds } = identifiers;
146
+ const [spacePointStart, spacePointEnd] = arrSegmentSpacePointIds.map((spacePointIds) => SpacePointConstructor.fromIdentifiers(spacePointIds));
147
+ const arrSubNode = ["x", "y", "z"]
148
+ .map((axis) => square(abs(substract(spacePointEnd[axis], spacePointStart[axis])).simplify({ towardsDistribute: true })))
149
+ .filter((node) => isShouldFilterOutZeros
150
+ ? !NodeComparator.isEqualViaSub(node, (0).toTree())
151
+ : true);
152
+ const nodeSumOfSquares = operatorComposition(AddNode, arrSubNode);
153
+ return nodeSumOfSquares;
154
+ };
155
+ const getAnswerNode = (identifiers, isShouldFilterOutZeros = true) => {
156
+ const nodeSumOfSquares = createNodeSumOfSquares(identifiers, isShouldFilterOutZeros);
157
+ const nodeAnswerRaw = sqrt(nodeSumOfSquares);
158
+ return nodeAnswerRaw;
159
+ };
160
+ const getAnswer = (identifiers) => {
161
+ const { acceptedInputType } = identifiers;
162
+ return getFormattedNode(getAnswerNode(identifiers), acceptedInputType)
163
+ .simplify({ towardsDistribute: true })
164
+ .toTex();
165
+ };
166
+ const getHint = (identifiers) => {
167
+ const { arrSegmentSpacePointIds } = identifiers;
168
+ const [spacePointStart, spacePointEnd] = arrSegmentSpacePointIds.map((spacePointIds) => SpacePointConstructor.fromIdentifiers(spacePointIds));
169
+ const texSegment = `[${spacePointStart.name}${spacePointEnd.name}]`;
170
+ const texVec = `\\overrightarrow{${spacePointStart.name}${spacePointEnd.name}}`;
171
+ return `La longueur du segment $${texSegment}$ est la norme du vecteur $\\overrightarrow{v} = ${texVec}$.
172
+ Détermine les $3$ composantes $v_x$, $v_y$, $v_z$
173
+ et utilise la formule (qui découle d'une double application du théorème de Pythagore) :
174
+
175
+ $$
176
+ \\lVert \\overrightarrow v \\rVert = \\sqrt{ {v_x}^2 + {v_y}^2 + {v_z}^2 }
177
+ $$
178
+
179
+ `;
180
+ };
181
+ const getCorrection = (identifiers) => {
182
+ const { arrSegmentSpacePointIds, acceptedInputType } = identifiers;
183
+ const [spacePointStart, spacePointEnd] = arrSegmentSpacePointIds.map((spacePointIds) => SpacePointConstructor.fromIdentifiers(spacePointIds));
184
+ const texLength = `${spacePointStart.name}${spacePointEnd.name}`;
185
+ const texSegment = `[${spacePointStart.name}${spacePointEnd.name}]`;
186
+ const texVec = `\\overrightarrow{${spacePointStart.name}${spacePointEnd.name}}`;
187
+ const nodeAnswer = getAnswerNode(identifiers, false);
188
+ return `La longueur du segment $${texSegment}$ est la norme du vecteur $${texVec}$.
189
+ On détermine les $3$ composantes $v_x$, $v_y$, $v_z$ :
190
+ et utilise la formule (qui découle d'une double application du théorème de Pythagore) :
191
+
192
+ ${alignTex([
193
+ [texLength, "=", `\\lVert ${texVec} \\rVert`],
194
+ ["", "=", nodeAnswer.toTex()],
195
+ ["", "=", nodeAnswer.simplify({ towardsDistribute: true }).toTex()],
196
+ ...(acceptedInputType === "arrondi au centième"
197
+ ? [
198
+ [
199
+ "",
200
+ "\\approx",
201
+ getFormattedNode(nodeAnswer, acceptedInputType).toTex(),
202
+ ],
203
+ ]
204
+ : [[]]),
205
+ ])}
206
+
207
+ `;
208
+ };
209
+ const getCorrectionGGBOptions = (identifiers) => {
210
+ const { rectangularPrismOrigin, L, l, h, arrSegmentSpacePointIds } = identifiers;
211
+ const spacePointRectangularPrismOrigin = SpacePointConstructor.fromIdentifiers(rectangularPrismOrigin);
212
+ const rectangularPrismSpacePoints = getRectangularPrismPoints(spacePointRectangularPrismOrigin, L, l, h);
213
+ const arrSegmentSpacePoint = [...arrSegmentSpacePointIds].map((spacePointIds) => SpacePointConstructor.fromIdentifiers(spacePointIds));
214
+ const arrSpacePoint = [
215
+ // spacePointRectangularPrismOrigin,
216
+ ...arrSegmentSpacePoint,
217
+ ];
218
+ const [spacePointStart, spacePointEnd] = arrSegmentSpacePoint;
219
+ const arrSpacePointBoundingBox = createArrSpacePointBoundingBox(spacePointStart, spacePointEnd);
220
+ const arrSide = getAllPointMeshes(rectangularPrismSpacePoints[0], L, l, h);
221
+ const arrSegment = arrSide.flatMap(createSegmentMeshForPointMesh);
222
+ const commands = [
223
+ //hide xOyPlane
224
+ `SetFilling(xOyPlane, 0.1)`,
225
+ //pretty names
226
+ ...[
227
+ //points
228
+ ...arrSpacePoint.flatMap((spacePoint) => spacePoint.toGGBCommand({
229
+ isFixed: true,
230
+ showLabel: true,
231
+ })),
232
+ ],
233
+ //no names
234
+ ...[
235
+ //prism
236
+ `Pri = Prism(${rectangularPrismSpacePoints
237
+ .slice(0, 5)
238
+ .map((p) => p.toMathString())
239
+ .join(",")})`,
240
+ `SetColor(Pri, "${colorWithOpacity("#000000", 14)}")`,
241
+ `SetLineThickness(Pri, 1)`,
242
+ //segment meshes
243
+ ...arrSegment.flatMap(([spacePointStart, spacePointEnd], i) => {
244
+ return [
245
+ `S_${i} = Segment(${spacePointStart.toMathString()}, ${spacePointEnd.toMathString()})`,
246
+ `SetColor(S_${i}, "${colorWithOpacity("#BBBBBB", 37)}")`, //opacity is ignored
247
+ `SetLineThickness(S_${i}, 1)`,
248
+ ];
249
+ }),
250
+ ],
251
+ //segment
252
+ `segInstruction = Segment(${spacePointStart.toMathString()}, ${spacePointEnd.toMathString()})`,
253
+ `SetLineThickness(segInstruction, 4)`,
254
+ `SetColor(segInstruction, "${blueMain}")`,
255
+ //boundingBox of segment
256
+ `polyBoundinBox = Polygon(${[
257
+ arrSpacePointBoundingBox[0],
258
+ arrSpacePointBoundingBox[1],
259
+ arrSpacePointBoundingBox[3],
260
+ arrSpacePointBoundingBox[2],
261
+ ]
262
+ .map((p) => p.toMathString())
263
+ .join(",")})`,
264
+ `priBoundingBox = Prism(polyBoundinBox, ${arrSpacePointBoundingBox[4].toMathString()})`,
265
+ `SetColor(priBoundingBox, "${colorWithOpacity(`${greenMain}`, 69)}")`,
266
+ `SetLineThickness(priBoundingBox, 2)`,
267
+ // `RunUpdateScript()`,
268
+ ];
269
+ const ggb = new GeogebraConstructor({
270
+ commands,
271
+ is3D: true,
272
+ hideAxes: true,
273
+ viewDirectionVector: [-0.5, -1, -1],
274
+ });
275
+ const [xMin, xMax, yMin, yMax, zMin, zMax] = getCoordsForFrame(spacePointStart, spacePointEnd);
276
+ return ggb.getOptions({
277
+ coords: [xMin - 2, xMax + 2, yMin - 2, yMax + 2, zMin - 2, zMax + 2],
278
+ });
279
+ };
280
+ const getGGBOptions = (identifiers) => {
281
+ const { rectangularPrismOrigin, L, l, h, arrSegmentSpacePointIds } = identifiers;
282
+ const spacePointRectangularPrismOrigin = SpacePointConstructor.fromIdentifiers(rectangularPrismOrigin);
283
+ const rectangularPrismSpacePoints = getRectangularPrismPoints(spacePointRectangularPrismOrigin, L, l, h);
284
+ const arrSegmentSpacePoint = [...arrSegmentSpacePointIds].map((spacePointIds) => SpacePointConstructor.fromIdentifiers(spacePointIds));
285
+ const arrSpacePoint = [
286
+ // spacePointRectangularPrismOrigin,
287
+ ...arrSegmentSpacePoint,
288
+ ];
289
+ const [spacePointStart, spacePointEnd] = arrSegmentSpacePoint;
290
+ const arrSide = getAllPointMeshes(rectangularPrismSpacePoints[0], L, l, h);
291
+ const arrSegment = arrSide.flatMap(createSegmentMeshForPointMesh);
292
+ const commands = [
293
+ //hide xOyPlane
294
+ `SetFilling(xOyPlane, 0.1)`,
295
+ //pretty names
296
+ ...[
297
+ //points
298
+ ...arrSpacePoint.flatMap((spacePoint) => spacePoint.toGGBCommand({
299
+ isFixed: true,
300
+ showLabel: true,
301
+ })),
302
+ ],
303
+ //no names
304
+ ...[
305
+ //prism
306
+ `Pri = Prism(${rectangularPrismSpacePoints
307
+ .slice(0, 5)
308
+ .map((p) => p.toMathString())
309
+ .join(",")})`,
310
+ `SetColor(Pri, "${colorWithOpacity("#000000", 14)}")`,
311
+ `SetLineThickness(Pri, 1)`,
312
+ //segment meshes
313
+ ...arrSegment.flatMap(([spacePointStart, spacePointEnd], i) => {
314
+ return [
315
+ `S_${i} = Segment(${spacePointStart.toMathString()}, ${spacePointEnd.toMathString()})`,
316
+ `SetColor(S_${i}, "${colorWithOpacity("#BBBBBB", 37)}")`, //opacity is ignored
317
+ `SetLineThickness(S_${i}, 1)`,
318
+ ];
319
+ }),
320
+ ],
321
+ //segment
322
+ `segInstruction = Segment(${spacePointStart.toMathString()}, ${spacePointEnd.toMathString()})`,
323
+ `SetLineThickness(segInstruction, 4)`,
324
+ `SetColor(segInstruction, "${blueMain}")`,
325
+ // `RunUpdateScript()`,
326
+ ];
327
+ const ggb = new GeogebraConstructor({
328
+ commands,
329
+ is3D: true,
330
+ hideAxes: true,
331
+ viewDirectionVector: [-0.5, -1, -1],
332
+ });
333
+ const [xMin, xMax, yMin, yMax, zMin, zMax] = getCoordsForFrame(spacePointStart, spacePointEnd);
334
+ return ggb.getOptions({
335
+ coords: [xMin - 2, xMax + 2, yMin - 2, yMax + 2, zMin - 2, zMax + 2],
336
+ });
337
+ };
338
+ const getPropositions = (n, { answer, ...identifiers }, optsIn) => {
339
+ const arrayedOpts = defaultArrayedOptsWhereNeeded(optsIn, arrayedOptsDefault);
340
+ const opts = {
341
+ ...(optsIn ?? optsDefault),
342
+ nbComponents: random(arrayedOpts.nbComponents),
343
+ };
344
+ const propositions = [];
345
+ addValidProp(propositions, answer);
346
+ const { acceptedInputType } = identifiers;
347
+ const createNodeSum = (identifiers, isShouldFilterOutZeros = true) => {
348
+ const { arrSegmentSpacePointIds } = identifiers;
349
+ const [spacePointStart, spacePointEnd] = arrSegmentSpacePointIds.map((spacePointIds) => SpacePointConstructor.fromIdentifiers(spacePointIds));
350
+ const arrSubNode = ["x", "y", "z"]
351
+ .map((axis) => abs(substract(spacePointEnd[axis], spacePointStart[axis])).simplify({ towardsDistribute: true }))
352
+ .filter((node) => isShouldFilterOutZeros
353
+ ? !NodeComparator.isEqualViaSub(node, (0).toTree())
354
+ : true);
355
+ const nodeSumOfSquares = operatorComposition(AddNode, arrSubNode);
356
+ return nodeSumOfSquares;
357
+ };
358
+ //student: forgets squares
359
+ {
360
+ const nodeWrong = getFormattedNode(sqrt(createNodeSum(identifiers, true)).simplify({
361
+ towardsDistribute: true,
362
+ }), acceptedInputType);
363
+ tryToAddWrongProp(propositions, nodeWrong.toTex());
364
+ }
365
+ if (coinFlip()) {
366
+ //student: forgets sqrt
367
+ {
368
+ const nodeWrong = getFormattedNode(createNodeSumOfSquares(identifiers, true).simplify({
369
+ towardsDistribute: true,
370
+ }), acceptedInputType);
371
+ tryToAddWrongProp(propositions, nodeWrong.toTex());
372
+ }
373
+ }
374
+ else {
375
+ //student: forgets sqrt and squares
376
+ {
377
+ const nodeWrong = getFormattedNode(createNodeSum(identifiers, true).simplify({
378
+ towardsDistribute: true,
379
+ }), acceptedInputType);
380
+ tryToAddWrongProp(propositions, nodeWrong.toTex());
381
+ }
382
+ }
383
+ //student: l'âge du capitaine
384
+ {
385
+ const { L, l, h } = identifiers;
386
+ const nodeWrong = getFormattedNode(sqrt(operatorComposition(AddNode, [L, l, h].map((v) => square(v)))), acceptedInputType).simplify({
387
+ towardsDistribute: true,
388
+ });
389
+ tryToAddWrongProp(propositions, nodeWrong.toTex());
390
+ }
391
+ propWhile(propositions, n, () => {
392
+ const identifiersWrong = createRandomIdentifiers(opts);
393
+ tryToAddWrongProp(propositions, getAnswer(identifiersWrong, opts));
394
+ });
395
+ return shuffleProps(propositions, n);
396
+ };
397
+ const getKeys = () => {
398
+ return [];
399
+ };
400
+ const isAnswerValid = (ans, { answer, ..._identifiers }, _optsIn) => {
401
+ try {
402
+ const nodeAns = parseAlgebraic(ans);
403
+ const nodeAnswer = parseAlgebraic(answer);
404
+ return (substract(nodeAns.simplify(), nodeAnswer.simplify())
405
+ .simplify()
406
+ .evaluate() === 0);
407
+ }
408
+ catch (_) {
409
+ return false;
410
+ }
411
+ };
412
+ const createRandomIdentifiers = (opts) => {
413
+ const L = randint(3, 7);
414
+ const l = randint(3, 7);
415
+ const h = randint(3, 7);
416
+ const genNamePretty = genFuncNamePretty();
417
+ const rectangularPrismOriginSpacePoint = SpacePointConstructor.fromScalars([0, 0, 0], genNamePretty.next().value);
418
+ function createSpacePointWithPrettyName(spacePoint) {
419
+ const namePretty = genNamePretty.next().value;
420
+ const spacePointWithPrettyName = SpacePointConstructor.fromIdentifiers(Object.assign({}, spacePoint.toIdentifiers(), {
421
+ name: namePretty,
422
+ }));
423
+ return spacePointWithPrettyName;
424
+ }
425
+ const arrSide = getAllPointMeshes(rectangularPrismOriginSpacePoint, L, l, h).map((arrArrSpacePoint) => arrArrSpacePoint.flat());
426
+ function getNbShared(spacePoint1, spacePoint2) {
427
+ return zip([spacePoint1.x, spacePoint1.y, spacePoint1.z], [spacePoint2.x, spacePoint2.y, spacePoint2.z]).reduce((acc, [nodeSpacePoint1Axis, nodeSpacePoint2Axis]) => {
428
+ return (acc +
429
+ (NodeComparator.isEqualViaSub(nodeSpacePoint1Axis, nodeSpacePoint2Axis)
430
+ ? 1
431
+ : 0));
432
+ }, 0);
433
+ }
434
+ function getSpacePoint2(arrSpacePoint, spacePoint1Raw, nbDifferent) {
435
+ const arrSpacePointCandidate = arrSpacePoint.filter((spacePoint2Raw) => {
436
+ const nbShared = getNbShared(spacePoint2Raw, spacePoint1Raw);
437
+ return nbShared === 3 - nbDifferent;
438
+ });
439
+ return random(arrSpacePointCandidate);
440
+ }
441
+ const arrSegmentSpacePoint = (() => {
442
+ switch (opts.nbComponents) {
443
+ case "2": {
444
+ const arrSpacePoint = random(arrSide);
445
+ const spacePoint1Raw = random(arrSpacePoint);
446
+ const spacePoint2Raw = getSpacePoint2(arrSpacePoint, spacePoint1Raw, 2);
447
+ return [spacePoint1Raw, spacePoint2Raw].map(createSpacePointWithPrettyName);
448
+ }
449
+ case "3": {
450
+ const [arrSpacePoint1, arrSpacePoint2] = randomMany(arrSide, 2);
451
+ let isFound = false;
452
+ let spacePoint1Raw;
453
+ let spacePoint2Raw;
454
+ while (!isFound) {
455
+ spacePoint1Raw = random(arrSpacePoint1);
456
+ spacePoint2Raw = getSpacePoint2(arrSpacePoint2, spacePoint1Raw, 3);
457
+ isFound = spacePoint2Raw !== undefined;
458
+ }
459
+ return [spacePoint1Raw, spacePoint2Raw].map(createSpacePointWithPrettyName);
460
+ }
461
+ default:
462
+ throw new Error("Unsupported opts.nbComponents: " + opts.nbComponents);
463
+ }
464
+ })();
465
+ const identifiers = {
466
+ rectangularPrismOrigin: rectangularPrismOriginSpacePoint.toIdentifiers(),
467
+ L,
468
+ l,
469
+ h,
470
+ arrSegmentSpacePointIds: arrSegmentSpacePoint.map((spacePoint) => spacePoint.toIdentifiers()),
471
+ acceptedInputType: opts.acceptedInputType,
472
+ };
473
+ return identifiers;
474
+ };
475
+ const getSpaceSegmentLengthInRectangularPrismQuestion = (optsIn) => {
476
+ const arrayedOpts = defaultArrayedOptsWhereNeeded(optsIn, arrayedOptsDefault);
477
+ const opts = {
478
+ ...(optsIn ?? optsDefault),
479
+ nbComponents: random(arrayedOpts.nbComponents),
480
+ };
481
+ const identifiers = createRandomIdentifiers(opts);
482
+ return getQuestionFromIdentifiers(identifiers);
483
+ };
484
+ const getQuestionFromIdentifiers = (identifiers, opts) => {
485
+ const question = {
486
+ answer: getAnswer(identifiers, opts),
487
+ instruction: getInstruction(identifiers, opts),
488
+ identifiers,
489
+ keys: getKeys(identifiers, opts),
490
+ hint: getHint(identifiers, opts),
491
+ correction: getCorrection(identifiers, opts),
492
+ correctionGgbOptions: getCorrectionGGBOptions(identifiers, opts),
493
+ ggbOptions: getGGBOptions(identifiers, opts),
494
+ };
495
+ return question;
496
+ };
497
+ const optsDefault = {
498
+ acceptedInputType: "exact",
499
+ };
500
+ const arrayedOptsDefault = {
501
+ nbComponents: ["2", "3"],
502
+ };
503
+ const options = [
504
+ {
505
+ id: "nbComponents",
506
+ label: "Nombre de composantes",
507
+ target: GeneratorOptionTarget.generation,
508
+ type: GeneratorOptionType.multiselect,
509
+ values: ["2", "3"],
510
+ defaultValue: arrayedOptsDefault.nbComponents,
511
+ },
512
+ {
513
+ id: "acceptedInputType",
514
+ label: "Format du résultat",
515
+ target: GeneratorOptionTarget.vea,
516
+ type: GeneratorOptionType.select,
517
+ values: ["exact", "arrondi au centième"],
518
+ defaultValue: optsDefault.acceptedInputType,
519
+ },
520
+ ];
521
+ export const spaceSegmentLengthInRectangularPrism = {
522
+ id: "spaceSegmentLengthInRectangularPrism",
523
+ connector: "=",
524
+ label: "Longueur d'un segment dans un pavé droit",
525
+ isSingleStep: true,
526
+ generator: (nb, opts) => getDistinctQuestions(() => getSpaceSegmentLengthInRectangularPrismQuestion(opts), nb),
527
+ options,
528
+ qcmTimer: 60,
529
+ freeTimer: 60,
530
+ subject: "Mathématiques",
531
+ hasGeogebra: true,
532
+ getQuestionFromIdentifiers,
533
+ getHint,
534
+ getCorrection,
535
+ hasHintAndCorrection: true,
536
+ isAnswerValid,
537
+ getPropositions,
538
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"trigoAdditionFormulaUsage.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/trigonometry/formulas/trigoAdditionFormulaUsage.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAmBrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,OAAO,CAAC;CAChB,CAAC;AA2NF,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,WAAW,CAwB3D,CAAC"}
1
+ {"version":3,"file":"trigoAdditionFormulaUsage.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/trigonometry/formulas/trigoAdditionFormulaUsage.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAmBrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,OAAO,CAAC;CAChB,CAAC;AA4NF,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,WAAW,CAwB3D,CAAC"}
@@ -92,7 +92,8 @@ const getCorrection = (identifiers) => {
92
92
  const angle = frac(multiply(k, PiNode), 12);
93
93
  const [a, b] = getDecompCoeffs(identifiers);
94
94
  const absB = b.evaluate() > 0 ? b : opposite(b).simplify();
95
- const formula = getFormula(isCos, b.evaluate() > 0).rightChild;
95
+ const formula = getFormula(isCos, b.evaluate() > 0);
96
+ const formulaRight = formula.rightChild;
96
97
  const start = fct(angle).toTex();
97
98
  return `On remarque que :
98
99
 
@@ -113,7 +114,7 @@ ${alignTex([
113
114
  [
114
115
  "",
115
116
  "=",
116
- formula
117
+ formulaRight
117
118
  .toDetailedEvaluation({
118
119
  a: a,
119
120
  b: absB,
@@ -123,7 +124,7 @@ ${alignTex([
123
124
  [
124
125
  "",
125
126
  "=",
126
- formula
127
+ formulaRight
127
128
  .toDetailedEvaluation({
128
129
  a: a,
129
130
  b: abs(b),
@@ -137,7 +138,7 @@ ${alignTex([
137
138
  [
138
139
  "",
139
140
  "=",
140
- formula
141
+ formulaRight
141
142
  .toDetailedEvaluation({
142
143
  a: a,
143
144
  b: abs(b),
@@ -150,7 +151,7 @@ ${alignTex([
150
151
  [
151
152
  "",
152
153
  "=",
153
- formula
154
+ formulaRight
154
155
  .toDetailedEvaluation({
155
156
  a: a,
156
157
  b: absB,
@@ -91,7 +91,7 @@ ${triangle.sides.map((side) => `- $${side.toLengthTex()}\\ \\textrm{cm}$`)
91
91
 
92
92
  `)}
93
93
 
94
- Calculer ${trigoFunc.strFrenchThe} de l'angle $${texAngle}$.
94
+ Calculer ${trigoFunc.strFrenchThe} de l'angle $${texAngle}$
95
95
  ${getAcceptedInputTypesSentence(opts.acceptedInputType)}.`;
96
96
  };
97
97
  const getAnswerNode = (identifiers) => {
@@ -13,5 +13,6 @@ export declare const toolBarConstructor: (options: {
13
13
  erase?: boolean;
14
14
  centralSymetric?: boolean;
15
15
  lineSymetric?: boolean;
16
+ midpoint?: boolean;
16
17
  }) => string;
17
18
  //# sourceMappingURL=toolBarConstructor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"toolBarConstructor.d.ts","sourceRoot":"","sources":["../../../../src/exercises/utils/geogebra/toolBarConstructor.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kBAAkB,GAAI,SAAS;IAC1C,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,WAkBA,CAAC"}
1
+ {"version":3,"file":"toolBarConstructor.d.ts","sourceRoot":"","sources":["../../../../src/exercises/utils/geogebra/toolBarConstructor.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kBAAkB,GAAI,SAAS;IAC1C,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,WAoBA,CAAC"}
@@ -28,5 +28,7 @@ export const toolBarConstructor = (options) => {
28
28
  customToolBar += "||29";
29
29
  if (options.lineSymetric)
30
30
  customToolBar += "||30";
31
+ if (options.midpoint)
32
+ customToolBar += "||19";
31
33
  return customToolBar;
32
34
  };
@@ -8,5 +8,8 @@ export declare class GeogebraParser {
8
8
  [k: string]: string;
9
9
  };
10
10
  static pointNamesForLineObj(lineObj: string): string[];
11
+ static pointNamesForCircleObj(lineObj: string): string[];
12
+ static argNamesForOrthogonalLineObj(lineObj: string): string[];
13
+ static argNamesForVectorObj(lineObj: string): string[];
11
14
  }
12
15
  //# sourceMappingURL=geogebraParser.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"geogebraParser.d.ts","sourceRoot":"","sources":["../../../src/geogebra/parsers/geogebraParser.ts"],"names":[],"mappings":"AAAA,qBAAa,cAAc;IACzB,QAAQ,EAAE,MAAM,EAAE,CAAC;gBACP,eAAe,EAAE,MAAM,EAAE;IAIrC,WAAW,CAAC,IAAI,EAAE,MAAM;IAWxB,OAAO;IAyCP,uBAAuB;IAsCvB,UAAU;;;IAWV,MAAM,CAAC,oBAAoB,CAAC,OAAO,EAAE,MAAM;CAS5C"}
1
+ {"version":3,"file":"geogebraParser.d.ts","sourceRoot":"","sources":["../../../src/geogebra/parsers/geogebraParser.ts"],"names":[],"mappings":"AAAA,qBAAa,cAAc;IACzB,QAAQ,EAAE,MAAM,EAAE,CAAC;gBACP,eAAe,EAAE,MAAM,EAAE;IAIrC,WAAW,CAAC,IAAI,EAAE,MAAM;IAWxB,OAAO;IAyCP,uBAAuB;IAsCvB,UAAU;;;IAWV,MAAM,CAAC,oBAAoB,CAAC,OAAO,EAAE,MAAM;IAU3C,MAAM,CAAC,sBAAsB,CAAC,OAAO,EAAE,MAAM;IAU7C,MAAM,CAAC,4BAA4B,CAAC,OAAO,EAAE,MAAM;IAUnD,MAAM,CAAC,oBAAoB,CAAC,OAAO,EAAE,MAAM;CAS5C"}
@@ -111,4 +111,31 @@ export class GeogebraParser {
111
111
  const [, nameA, nameB] = match;
112
112
  return [nameA, nameB];
113
113
  }
114
+ static pointNamesForCircleObj(lineObj) {
115
+ const reLine = /^Circle\[\s*([^,\]]+)\s*,\s*([^,\]]+)\s*\]$/;
116
+ const match = lineObj.match(reLine);
117
+ if (!match) {
118
+ return [];
119
+ }
120
+ const [, nameA, nameB] = match;
121
+ return [nameA, nameB];
122
+ }
123
+ static argNamesForOrthogonalLineObj(lineObj) {
124
+ const reLine = /^OrthogonalLine\[\s*([^,\]]+)\s*,\s*([^,\]]+)\s*\]$/;
125
+ const match = lineObj.match(reLine);
126
+ if (!match) {
127
+ return [];
128
+ }
129
+ const [, nameA, nameB] = match;
130
+ return [nameA, nameB];
131
+ }
132
+ static argNamesForVectorObj(lineObj) {
133
+ const reLine = /^Vector\[\s*([^,\]]+)\s*,\s*([^,\]]+)\s*\]$/;
134
+ const match = lineObj.match(reLine);
135
+ if (!match) {
136
+ return [];
137
+ }
138
+ const [, nameA, nameB] = match;
139
+ return [nameA, nameB];
140
+ }
114
141
  }