math-exercises 3.0.200 → 3.0.201

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 (406) hide show
  1. package/lib/exercises/math/calcul/fractions/fractionsSumsPrimeDenominators.js +1 -1
  2. package/lib/exercises/math/calcul/index.d.ts +1 -0
  3. package/lib/exercises/math/calcul/index.d.ts.map +1 -1
  4. package/lib/exercises/math/calcul/index.js +1 -0
  5. package/lib/exercises/math/calculLitteral/inequations/index.d.ts +1 -0
  6. package/lib/exercises/math/calculLitteral/inequations/index.d.ts.map +1 -1
  7. package/lib/exercises/math/calculLitteral/inequations/index.js +1 -0
  8. package/lib/exercises/math/calculLitteral/inequations/inequationCenteredInterval.d.ts +14 -0
  9. package/lib/exercises/math/calculLitteral/inequations/inequationCenteredInterval.d.ts.map +1 -0
  10. package/lib/exercises/math/calculLitteral/inequations/inequationCenteredInterval.js +263 -0
  11. package/lib/exercises/math/combinatory/anagrams.d.ts.map +1 -1
  12. package/lib/exercises/math/combinatory/anagrams.js +89 -68
  13. package/lib/exercises/math/combinatory/index.d.ts +1 -0
  14. package/lib/exercises/math/combinatory/index.d.ts.map +1 -1
  15. package/lib/exercises/math/combinatory/index.js +1 -0
  16. package/lib/exercises/math/dataRepresentations/index.d.ts +1 -1
  17. package/lib/exercises/math/dataRepresentations/index.d.ts.map +1 -1
  18. package/lib/exercises/math/dataRepresentations/index.js +5 -1
  19. package/lib/exercises/math/dataRepresentations/scatterPlot/index.d.ts +0 -2
  20. package/lib/exercises/math/dataRepresentations/scatterPlot/index.d.ts.map +1 -1
  21. package/lib/exercises/math/dataRepresentations/scatterPlot/index.js +2 -2
  22. package/lib/exercises/math/derivation/derivative/trigo/index.d.ts +2 -0
  23. package/lib/exercises/math/derivation/derivative/trigo/index.d.ts.map +1 -1
  24. package/lib/exercises/math/derivation/derivative/trigo/index.js +3 -0
  25. package/lib/exercises/math/derivation/problems/index.d.ts +0 -1
  26. package/lib/exercises/math/derivation/problems/index.d.ts.map +1 -1
  27. package/lib/exercises/math/derivation/problems/index.js +1 -1
  28. package/lib/exercises/math/derivation/problems/problemMovementOnLineFindSpeedAtPoint.d.ts.map +1 -1
  29. package/lib/exercises/math/derivation/problems/problemMovementOnLineFindSpeedAtPoint.js +5 -2
  30. package/lib/exercises/math/derivation/tangent/index.d.ts +0 -1
  31. package/lib/exercises/math/derivation/tangent/index.d.ts.map +1 -1
  32. package/lib/exercises/math/derivation/tangent/index.js +1 -1
  33. package/lib/exercises/math/derivation/variations/index.d.ts +1 -1
  34. package/lib/exercises/math/derivation/variations/index.d.ts.map +1 -1
  35. package/lib/exercises/math/derivation/variations/index.js +2 -1
  36. package/lib/exercises/math/derivation/variations/signVarTableAffinePlusCXLogX.d.ts +10 -0
  37. package/lib/exercises/math/derivation/variations/signVarTableAffinePlusCXLogX.d.ts.map +1 -0
  38. package/lib/exercises/math/derivation/variations/signVarTableAffinePlusCXLogX.js +222 -0
  39. package/lib/exercises/math/derivation/variations/signVarTableProductFExp.js +1 -1
  40. package/lib/exercises/math/derivation/variations/signVarTableQuotientFExp.js +1 -1
  41. package/lib/exercises/math/functions/affines/index.d.ts +5 -0
  42. package/lib/exercises/math/functions/affines/index.d.ts.map +1 -1
  43. package/lib/exercises/math/functions/affines/index.js +5 -0
  44. package/lib/exercises/math/functions/integral/index.d.ts +1 -0
  45. package/lib/exercises/math/functions/integral/index.d.ts.map +1 -1
  46. package/lib/exercises/math/functions/integral/index.js +1 -0
  47. package/lib/exercises/math/functions/integral/integralTrinomialOverX2.d.ts +12 -0
  48. package/lib/exercises/math/functions/integral/integralTrinomialOverX2.d.ts.map +1 -0
  49. package/lib/exercises/math/functions/integral/integralTrinomialOverX2.js +280 -0
  50. package/lib/exercises/math/functions/logarithm/findLargestPossibleDomainOfLogF.d.ts +13 -0
  51. package/lib/exercises/math/functions/logarithm/findLargestPossibleDomainOfLogF.d.ts.map +1 -0
  52. package/lib/exercises/math/functions/logarithm/findLargestPossibleDomainOfLogF.js +622 -0
  53. package/lib/exercises/math/functions/logarithm/index.d.ts +5 -0
  54. package/lib/exercises/math/functions/logarithm/index.d.ts.map +1 -1
  55. package/lib/exercises/math/functions/logarithm/index.js +5 -0
  56. package/lib/exercises/math/functions/logarithm/logEquationLnAXPlusBEqualsK.d.ts +10 -0
  57. package/lib/exercises/math/functions/logarithm/logEquationLnAXPlusBEqualsK.d.ts.map +1 -0
  58. package/lib/exercises/math/functions/logarithm/logEquationLnAXPlusBEqualsK.js +172 -0
  59. package/lib/exercises/math/functions/logarithm/logInequationIntegerSolutions.d.ts +11 -0
  60. package/lib/exercises/math/functions/logarithm/logInequationIntegerSolutions.d.ts.map +1 -0
  61. package/lib/exercises/math/functions/logarithm/logInequationIntegerSolutions.js +163 -0
  62. package/lib/exercises/math/functions/logarithm/logInequationLnAXPlusBInfK.d.ts +18 -0
  63. package/lib/exercises/math/functions/logarithm/logInequationLnAXPlusBInfK.d.ts.map +1 -0
  64. package/lib/exercises/math/functions/logarithm/logInequationLnAXPlusBInfK.js +330 -0
  65. package/lib/exercises/math/functions/logarithm/logLinearCombinationSimplifiying.d.ts +11 -0
  66. package/lib/exercises/math/functions/logarithm/logLinearCombinationSimplifiying.d.ts.map +1 -0
  67. package/lib/exercises/math/functions/logarithm/logLinearCombinationSimplifiying.js +185 -0
  68. package/lib/exercises/math/index.d.ts +1 -1
  69. package/lib/exercises/math/index.d.ts.map +1 -1
  70. package/lib/exercises/math/index.js +2 -1
  71. package/lib/exercises/math/integration/fromExpr/areaBetweenCrossingCurvesFixedPosFromExpr.d.ts +15 -0
  72. package/lib/exercises/math/integration/fromExpr/areaBetweenCrossingCurvesFixedPosFromExpr.d.ts.map +1 -0
  73. package/lib/exercises/math/integration/fromExpr/areaBetweenCrossingCurvesFixedPosFromExpr.js +505 -0
  74. package/lib/exercises/math/integration/fromExpr/boundIntegralByBoundingFunctionWithAffinesFromExpr.d.ts +16 -0
  75. package/lib/exercises/math/integration/fromExpr/boundIntegralByBoundingFunctionWithAffinesFromExpr.d.ts.map +1 -0
  76. package/lib/exercises/math/integration/fromExpr/boundIntegralByBoundingFunctionWithAffinesFromExpr.js +433 -0
  77. package/lib/exercises/math/integration/fromExpr/boundIntegralByManualRectanglesMethodFromExpr.d.ts +15 -0
  78. package/lib/exercises/math/integration/fromExpr/boundIntegralByManualRectanglesMethodFromExpr.d.ts.map +1 -0
  79. package/lib/exercises/math/integration/fromExpr/boundIntegralByManualRectanglesMethodFromExpr.js +436 -0
  80. package/lib/exercises/math/integration/fromExpr/byParts/index.d.ts +3 -0
  81. package/lib/exercises/math/integration/fromExpr/byParts/index.d.ts.map +1 -0
  82. package/lib/exercises/math/integration/fromExpr/byParts/index.js +2 -0
  83. package/lib/exercises/math/integration/fromExpr/byParts/integralOfAXPlusBTimesExpKXByParts.d.ts +9 -0
  84. package/lib/exercises/math/integration/fromExpr/byParts/integralOfAXPlusBTimesExpKXByParts.d.ts.map +1 -0
  85. package/lib/exercises/math/integration/fromExpr/byParts/integralOfAXPlusBTimesExpKXByParts.js +234 -0
  86. package/lib/exercises/math/integration/fromExpr/byParts/integralOfPolynomialTimesLogXByParts.d.ts +12 -0
  87. package/lib/exercises/math/integration/fromExpr/byParts/integralOfPolynomialTimesLogXByParts.d.ts.map +1 -0
  88. package/lib/exercises/math/integration/fromExpr/byParts/integralOfPolynomialTimesLogXByParts.js +330 -0
  89. package/lib/exercises/math/integration/fromExpr/checkIsPrimitiveFromExpr.d.ts +15 -0
  90. package/lib/exercises/math/integration/fromExpr/checkIsPrimitiveFromExpr.d.ts.map +1 -0
  91. package/lib/exercises/math/integration/fromExpr/checkIsPrimitiveFromExpr.js +450 -0
  92. package/lib/exercises/math/integration/fromExpr/derivativeOfPrimitive.d.ts +10 -0
  93. package/lib/exercises/math/integration/fromExpr/derivativeOfPrimitive.d.ts.map +1 -0
  94. package/lib/exercises/math/integration/fromExpr/derivativeOfPrimitive.js +261 -0
  95. package/lib/exercises/math/integration/fromExpr/index.d.ts +8 -0
  96. package/lib/exercises/math/integration/fromExpr/index.d.ts.map +1 -0
  97. package/lib/exercises/math/integration/fromExpr/index.js +8 -0
  98. package/lib/exercises/math/integration/fromExpr/integralFromExpr.d.ts +13 -0
  99. package/lib/exercises/math/integration/fromExpr/integralFromExpr.d.ts.map +1 -0
  100. package/lib/exercises/math/integration/fromExpr/integralFromExpr.js +359 -0
  101. package/lib/exercises/math/integration/fromExpr/meanValue/index.d.ts +2 -0
  102. package/lib/exercises/math/integration/fromExpr/meanValue/index.d.ts.map +1 -0
  103. package/lib/exercises/math/integration/fromExpr/meanValue/index.js +1 -0
  104. package/lib/exercises/math/integration/fromExpr/meanValue/meanValueOfTrinomFromIntegralFromExpr.d.ts +14 -0
  105. package/lib/exercises/math/integration/fromExpr/meanValue/meanValueOfTrinomFromIntegralFromExpr.d.ts.map +1 -0
  106. package/lib/exercises/math/integration/fromExpr/meanValue/meanValueOfTrinomFromIntegralFromExpr.js +429 -0
  107. package/lib/exercises/math/integration/fromGraph/boundIntegralByManipulatingAutomaticRectanglesMethodFromGraph.d.ts +10 -0
  108. package/lib/exercises/math/integration/fromGraph/boundIntegralByManipulatingAutomaticRectanglesMethodFromGraph.d.ts.map +1 -0
  109. package/lib/exercises/math/integration/fromGraph/boundIntegralByManipulatingAutomaticRectanglesMethodFromGraph.js +286 -0
  110. package/lib/exercises/math/integration/fromGraph/imageOfPrimitiveByManipulatingIntegralBoundsFromGraph.d.ts +9 -0
  111. package/lib/exercises/math/integration/fromGraph/imageOfPrimitiveByManipulatingIntegralBoundsFromGraph.d.ts.map +1 -0
  112. package/lib/exercises/math/integration/fromGraph/imageOfPrimitiveByManipulatingIntegralBoundsFromGraph.js +231 -0
  113. package/lib/exercises/math/integration/fromGraph/index.d.ts +7 -0
  114. package/lib/exercises/math/integration/fromGraph/index.d.ts.map +1 -0
  115. package/lib/exercises/math/integration/fromGraph/index.js +6 -0
  116. package/lib/exercises/math/integration/fromGraph/integralOfAffineFromExprByComputingArea.d.ts +15 -0
  117. package/lib/exercises/math/integration/fromGraph/integralOfAffineFromExprByComputingArea.d.ts.map +1 -0
  118. package/lib/exercises/math/integration/fromGraph/integralOfAffineFromExprByComputingArea.js +464 -0
  119. package/lib/exercises/math/integration/fromGraph/integralOfAffineFromGraph.d.ts +15 -0
  120. package/lib/exercises/math/integration/fromGraph/integralOfAffineFromGraph.d.ts.map +1 -0
  121. package/lib/exercises/math/integration/fromGraph/integralOfAffineFromGraph.js +493 -0
  122. package/lib/exercises/math/integration/fromGraph/integralOfPiecewiseAffineFromGraph.d.ts +18 -0
  123. package/lib/exercises/math/integration/fromGraph/integralOfPiecewiseAffineFromGraph.d.ts.map +1 -0
  124. package/lib/exercises/math/integration/fromGraph/integralOfPiecewiseAffineFromGraph.js +466 -0
  125. package/lib/exercises/math/integration/fromGraph/varTableOfPrimitiveFromGraph.d.ts +10 -0
  126. package/lib/exercises/math/integration/fromGraph/varTableOfPrimitiveFromGraph.d.ts.map +1 -0
  127. package/lib/exercises/math/integration/fromGraph/varTableOfPrimitiveFromGraph.js +192 -0
  128. package/lib/exercises/math/integration/index.d.ts +4 -0
  129. package/lib/exercises/math/integration/index.d.ts.map +1 -0
  130. package/lib/exercises/math/integration/index.js +3 -0
  131. package/lib/exercises/math/integration/integralOfPiecewiseFunctionByUsingComputedIntegrals.d.ts +14 -0
  132. package/lib/exercises/math/integration/integralOfPiecewiseFunctionByUsingComputedIntegrals.d.ts.map +1 -0
  133. package/lib/exercises/math/integration/integralOfPiecewiseFunctionByUsingComputedIntegrals.js +222 -0
  134. package/lib/exercises/math/limits/frac1XTimesALogXPlusBLimit.d.ts +8 -0
  135. package/lib/exercises/math/limits/frac1XTimesALogXPlusBLimit.d.ts.map +1 -0
  136. package/lib/exercises/math/limits/frac1XTimesALogXPlusBLimit.js +121 -0
  137. package/lib/exercises/math/limits/index.d.ts +3 -0
  138. package/lib/exercises/math/limits/index.d.ts.map +1 -1
  139. package/lib/exercises/math/limits/index.js +3 -0
  140. package/lib/exercises/math/limits/kLogXPlusTrinomLimit.d.ts +12 -0
  141. package/lib/exercises/math/limits/kLogXPlusTrinomLimit.d.ts.map +1 -0
  142. package/lib/exercises/math/limits/kLogXPlusTrinomLimit.js +224 -0
  143. package/lib/exercises/math/limits/logOfPolynomialLimit.d.ts +10 -0
  144. package/lib/exercises/math/limits/logOfPolynomialLimit.d.ts.map +1 -0
  145. package/lib/exercises/math/limits/logOfPolynomialLimit.js +154 -0
  146. package/lib/exercises/math/probaStat/basicProbas/expectedValueOfLinearCombination.d.ts +12 -0
  147. package/lib/exercises/math/probaStat/basicProbas/expectedValueOfLinearCombination.d.ts.map +1 -0
  148. package/lib/exercises/math/probaStat/basicProbas/expectedValueOfLinearCombination.js +170 -0
  149. package/lib/exercises/math/probaStat/basicProbas/expectedValueOfSumFromDice.d.ts +7 -0
  150. package/lib/exercises/math/probaStat/basicProbas/expectedValueOfSumFromDice.d.ts.map +1 -0
  151. package/lib/exercises/math/probaStat/basicProbas/expectedValueOfSumFromDice.js +163 -0
  152. package/lib/exercises/math/probaStat/basicProbas/expectedValueOfSumFromProbaLaw.d.ts +14 -0
  153. package/lib/exercises/math/probaStat/basicProbas/expectedValueOfSumFromProbaLaw.d.ts.map +1 -0
  154. package/lib/exercises/math/probaStat/basicProbas/expectedValueOfSumFromProbaLaw.js +150 -0
  155. package/lib/exercises/math/probaStat/basicProbas/index.d.ts +5 -0
  156. package/lib/exercises/math/probaStat/basicProbas/index.d.ts.map +1 -1
  157. package/lib/exercises/math/probaStat/basicProbas/index.js +5 -0
  158. package/lib/exercises/math/probaStat/basicProbas/varianceOfLinearCombination.d.ts +12 -0
  159. package/lib/exercises/math/probaStat/basicProbas/varianceOfLinearCombination.d.ts.map +1 -0
  160. package/lib/exercises/math/probaStat/basicProbas/varianceOfLinearCombination.js +193 -0
  161. package/lib/exercises/math/probaStat/basicProbas/varianceOfMean.d.ts +13 -0
  162. package/lib/exercises/math/probaStat/basicProbas/varianceOfMean.d.ts.map +1 -0
  163. package/lib/exercises/math/probaStat/basicProbas/varianceOfMean.js +171 -0
  164. package/lib/exercises/math/probaStat/binomial/fromSituation/binomialExpectedValueFromSituation.d.ts +9 -0
  165. package/lib/exercises/math/probaStat/binomial/fromSituation/binomialExpectedValueFromSituation.d.ts.map +1 -0
  166. package/lib/exercises/math/probaStat/binomial/fromSituation/binomialExpectedValueFromSituation.js +125 -0
  167. package/lib/exercises/math/probaStat/binomial/fromSituation/binomialFindParamsFromSituation.d.ts +9 -0
  168. package/lib/exercises/math/probaStat/binomial/fromSituation/binomialFindParamsFromSituation.d.ts.map +1 -0
  169. package/lib/exercises/math/probaStat/binomial/fromSituation/binomialFindParamsFromSituation.js +126 -0
  170. package/lib/exercises/math/probaStat/binomial/fromSituation/binomialFindProbaOfAtLeastOneSuccessFromSituation.d.ts +8 -0
  171. package/lib/exercises/math/probaStat/binomial/fromSituation/binomialFindProbaOfAtLeastOneSuccessFromSituation.d.ts.map +1 -0
  172. package/lib/exercises/math/probaStat/binomial/fromSituation/binomialFindProbaOfAtLeastOneSuccessFromSituation.js +150 -0
  173. package/lib/exercises/math/probaStat/binomial/fromSituation/binomialFindProbaOfXCompKFromSituation.d.ts +15 -0
  174. package/lib/exercises/math/probaStat/binomial/fromSituation/binomialFindProbaOfXCompKFromSituation.d.ts.map +1 -0
  175. package/lib/exercises/math/probaStat/binomial/fromSituation/binomialFindProbaOfXCompKFromSituation.js +386 -0
  176. package/lib/exercises/math/probaStat/binomial/fromSituation/binomialFindThresholdForNFromSituation.d.ts +14 -0
  177. package/lib/exercises/math/probaStat/binomial/fromSituation/binomialFindThresholdForNFromSituation.d.ts.map +1 -0
  178. package/lib/exercises/math/probaStat/binomial/fromSituation/binomialFindThresholdForNFromSituation.js +248 -0
  179. package/lib/exercises/math/probaStat/binomial/fromSituation/binomialSituations.d.ts +47 -0
  180. package/lib/exercises/math/probaStat/binomial/fromSituation/binomialSituations.d.ts.map +1 -0
  181. package/lib/exercises/math/probaStat/binomial/fromSituation/binomialSituations.js +184 -0
  182. package/lib/exercises/math/probaStat/binomial/fromSituation/buildTreeBernoulliFromSituation.d.ts +9 -0
  183. package/lib/exercises/math/probaStat/binomial/fromSituation/buildTreeBernoulliFromSituation.d.ts.map +1 -0
  184. package/lib/exercises/math/probaStat/binomial/fromSituation/buildTreeBernoulliFromSituation.js +120 -0
  185. package/lib/exercises/math/probaStat/binomial/fromSituation/index.d.ts +7 -0
  186. package/lib/exercises/math/probaStat/binomial/fromSituation/index.d.ts.map +1 -0
  187. package/lib/exercises/math/probaStat/binomial/fromSituation/index.js +6 -0
  188. package/lib/exercises/math/probaStat/binomial/index.d.ts +1 -0
  189. package/lib/exercises/math/probaStat/binomial/index.d.ts.map +1 -1
  190. package/lib/exercises/math/probaStat/binomial/index.js +1 -0
  191. package/lib/exercises/math/probaStat/index.d.ts +1 -0
  192. package/lib/exercises/math/probaStat/index.d.ts.map +1 -1
  193. package/lib/exercises/math/probaStat/index.js +1 -0
  194. package/lib/exercises/math/probaStat/tchebychev/index.d.ts +5 -0
  195. package/lib/exercises/math/probaStat/tchebychev/index.d.ts.map +1 -0
  196. package/lib/exercises/math/probaStat/tchebychev/index.js +4 -0
  197. package/lib/exercises/math/probaStat/tchebychev/mean/index.d.ts +4 -0
  198. package/lib/exercises/math/probaStat/tchebychev/mean/index.d.ts.map +1 -0
  199. package/lib/exercises/math/probaStat/tchebychev/mean/index.js +3 -0
  200. package/lib/exercises/math/probaStat/tchebychev/mean/tchebychevFindRadiusToMinorizeProbaOfMeanInCenteredInterval.d.ts +11 -0
  201. package/lib/exercises/math/probaStat/tchebychev/mean/tchebychevFindRadiusToMinorizeProbaOfMeanInCenteredInterval.d.ts.map +1 -0
  202. package/lib/exercises/math/probaStat/tchebychev/mean/tchebychevFindRadiusToMinorizeProbaOfMeanInCenteredInterval.js +273 -0
  203. package/lib/exercises/math/probaStat/tchebychev/mean/tchebychevMajorizeProbaOfMeanOutOfCenteredInterval.d.ts +14 -0
  204. package/lib/exercises/math/probaStat/tchebychev/mean/tchebychevMajorizeProbaOfMeanOutOfCenteredInterval.d.ts.map +1 -0
  205. package/lib/exercises/math/probaStat/tchebychev/mean/tchebychevMajorizeProbaOfMeanOutOfCenteredInterval.js +219 -0
  206. package/lib/exercises/math/probaStat/tchebychev/mean/tchebychevMinorizeProbaOfMeanInCenteredInterval.d.ts +14 -0
  207. package/lib/exercises/math/probaStat/tchebychev/mean/tchebychevMinorizeProbaOfMeanInCenteredInterval.d.ts.map +1 -0
  208. package/lib/exercises/math/probaStat/tchebychev/mean/tchebychevMinorizeProbaOfMeanInCenteredInterval.js +245 -0
  209. package/lib/exercises/math/probaStat/tchebychev/tchebychevFindRadiusToMajorizeProbaOfXOutOfCenteredInterval.d.ts +10 -0
  210. package/lib/exercises/math/probaStat/tchebychev/tchebychevFindRadiusToMajorizeProbaOfXOutOfCenteredInterval.d.ts.map +1 -0
  211. package/lib/exercises/math/probaStat/tchebychev/tchebychevFindRadiusToMajorizeProbaOfXOutOfCenteredInterval.js +191 -0
  212. package/lib/exercises/math/probaStat/tchebychev/tchebychevMajorizeProbaOfXOutOfCenteredInterval.d.ts +10 -0
  213. package/lib/exercises/math/probaStat/tchebychev/tchebychevMajorizeProbaOfXOutOfCenteredInterval.d.ts.map +1 -0
  214. package/lib/exercises/math/probaStat/tchebychev/tchebychevMajorizeProbaOfXOutOfCenteredInterval.js +135 -0
  215. package/lib/exercises/math/probaStat/tchebychev/tchebychevMinorizeProbaOfXInCenteredInterval.d.ts +10 -0
  216. package/lib/exercises/math/probaStat/tchebychev/tchebychevMinorizeProbaOfXInCenteredInterval.d.ts.map +1 -0
  217. package/lib/exercises/math/probaStat/tchebychev/tchebychevMinorizeProbaOfXInCenteredInterval.js +155 -0
  218. package/lib/exercises/math/probaStat/trees/buildTreeBernoulli.d.ts +9 -0
  219. package/lib/exercises/math/probaStat/trees/buildTreeBernoulli.d.ts.map +1 -0
  220. package/lib/exercises/math/probaStat/trees/buildTreeBernoulli.js +124 -0
  221. package/lib/exercises/math/probaStat/trees/index.d.ts +1 -0
  222. package/lib/exercises/math/probaStat/trees/index.d.ts.map +1 -1
  223. package/lib/exercises/math/probaStat/trees/index.js +1 -0
  224. package/lib/exercises/math/sequences/geometric/graph/index.d.ts +4 -0
  225. package/lib/exercises/math/sequences/geometric/graph/index.d.ts.map +1 -1
  226. package/lib/exercises/math/sequences/geometric/graph/index.js +4 -0
  227. package/lib/exercises/math/sequences/geometric/index.d.ts +2 -0
  228. package/lib/exercises/math/sequences/geometric/index.d.ts.map +1 -1
  229. package/lib/exercises/math/sequences/geometric/index.js +2 -0
  230. package/lib/exercises/math/sequences/geometric/situations/geometricFindRankFromSituation.d.ts.map +1 -1
  231. package/lib/exercises/math/sequences/geometric/situations/geometricFindRankFromSituation.js +71 -48
  232. package/lib/exercises/math/sequences/geometric/situations/index.d.ts +2 -1
  233. package/lib/exercises/math/sequences/geometric/situations/index.d.ts.map +1 -1
  234. package/lib/exercises/math/sequences/geometric/situations/index.js +2 -2
  235. package/lib/exercises/math/sets/index.d.ts +3 -0
  236. package/lib/exercises/math/sets/index.d.ts.map +1 -1
  237. package/lib/exercises/math/sets/index.js +3 -0
  238. package/lib/exercises/math/spaceGeometry/basis/index.d.ts +6 -0
  239. package/lib/exercises/math/spaceGeometry/basis/index.d.ts.map +1 -1
  240. package/lib/exercises/math/spaceGeometry/basis/index.js +6 -0
  241. package/lib/exercises/math/spaceGeometry/basis/lineLineRelativePositionsFromCubeOuterPoints.d.ts +11 -0
  242. package/lib/exercises/math/spaceGeometry/basis/lineLineRelativePositionsFromCubeOuterPoints.d.ts.map +1 -0
  243. package/lib/exercises/math/spaceGeometry/basis/lineLineRelativePositionsFromCubeOuterPoints.js +576 -0
  244. package/lib/exercises/math/spaceGeometry/basis/linePlaneRelativePositionsFromCubeOuterPoints.d.ts +11 -0
  245. package/lib/exercises/math/spaceGeometry/basis/linePlaneRelativePositionsFromCubeOuterPoints.d.ts.map +1 -0
  246. package/lib/exercises/math/spaceGeometry/basis/linePlaneRelativePositionsFromCubeOuterPoints.js +595 -0
  247. package/lib/exercises/math/spaceGeometry/basis/spaceCoordinatesOfPointInCubeCoordSystem.d.ts +11 -0
  248. package/lib/exercises/math/spaceGeometry/basis/spaceCoordinatesOfPointInCubeCoordSystem.d.ts.map +1 -0
  249. package/lib/exercises/math/spaceGeometry/basis/spaceCoordinatesOfPointInCubeCoordSystem.js +501 -0
  250. package/lib/exercises/math/spaceGeometry/basis/spaceCoordinatesOfPointInCubeCoordSystemFromVecPath.d.ts +16 -0
  251. package/lib/exercises/math/spaceGeometry/basis/spaceCoordinatesOfPointInCubeCoordSystemFromVecPath.d.ts.map +1 -0
  252. package/lib/exercises/math/spaceGeometry/basis/spaceCoordinatesOfPointInCubeCoordSystemFromVecPath.js +753 -0
  253. package/lib/exercises/math/spaceGeometry/basis/spaceCoordinatesOfVectorInCubeCoordSystem.d.ts +12 -0
  254. package/lib/exercises/math/spaceGeometry/basis/spaceCoordinatesOfVectorInCubeCoordSystem.d.ts.map +1 -0
  255. package/lib/exercises/math/spaceGeometry/basis/spaceCoordinatesOfVectorInCubeCoordSystem.js +546 -0
  256. package/lib/exercises/math/spaceGeometry/basis/spaceVectorLinearCombinationFromCoords.d.ts +13 -0
  257. package/lib/exercises/math/spaceGeometry/basis/spaceVectorLinearCombinationFromCoords.d.ts.map +1 -0
  258. package/lib/exercises/math/spaceGeometry/basis/spaceVectorLinearCombinationFromCoords.js +233 -0
  259. package/lib/exercises/math/spaceGeometry/collinearity/checkAlignedSpacePointsFromCoords.d.ts +11 -0
  260. package/lib/exercises/math/spaceGeometry/collinearity/checkAlignedSpacePointsFromCoords.d.ts.map +1 -0
  261. package/lib/exercises/math/spaceGeometry/collinearity/checkAlignedSpacePointsFromCoords.js +192 -0
  262. package/lib/exercises/math/spaceGeometry/collinearity/checkAlignedSpacePointsFromVecPathsFromCubeOuterPoints.d.ts +15 -0
  263. package/lib/exercises/math/spaceGeometry/collinearity/checkAlignedSpacePointsFromVecPathsFromCubeOuterPoints.d.ts.map +1 -0
  264. package/lib/exercises/math/spaceGeometry/collinearity/checkAlignedSpacePointsFromVecPathsFromCubeOuterPoints.js +511 -0
  265. package/lib/exercises/math/spaceGeometry/collinearity/index.d.ts +3 -0
  266. package/lib/exercises/math/spaceGeometry/collinearity/index.d.ts.map +1 -0
  267. package/lib/exercises/math/spaceGeometry/collinearity/index.js +2 -0
  268. package/lib/exercises/math/spaceGeometry/index.d.ts +5 -0
  269. package/lib/exercises/math/spaceGeometry/index.d.ts.map +1 -1
  270. package/lib/exercises/math/spaceGeometry/index.js +5 -1
  271. package/lib/exercises/math/spaceGeometry/orthogonalProjection/findOrthogonalProjectionOfPointOnPlane.d.ts +22 -0
  272. package/lib/exercises/math/spaceGeometry/orthogonalProjection/findOrthogonalProjectionOfPointOnPlane.d.ts.map +1 -0
  273. package/lib/exercises/math/spaceGeometry/orthogonalProjection/findOrthogonalProjectionOfPointOnPlane.js +366 -0
  274. package/lib/exercises/math/spaceGeometry/orthogonalProjection/index.d.ts +2 -0
  275. package/lib/exercises/math/spaceGeometry/orthogonalProjection/index.d.ts.map +1 -0
  276. package/lib/exercises/math/spaceGeometry/orthogonalProjection/index.js +2 -0
  277. package/lib/exercises/math/spaceGeometry/parametricLine/index.d.ts +3 -0
  278. package/lib/exercises/math/spaceGeometry/parametricLine/index.d.ts.map +1 -0
  279. package/lib/exercises/math/spaceGeometry/parametricLine/index.js +2 -0
  280. package/lib/exercises/math/spaceGeometry/parametricLine/lineLineRelativePositionsFromParametricLines.d.ts +14 -0
  281. package/lib/exercises/math/spaceGeometry/parametricLine/lineLineRelativePositionsFromParametricLines.d.ts.map +1 -0
  282. package/lib/exercises/math/spaceGeometry/parametricLine/lineLineRelativePositionsFromParametricLines.js +325 -0
  283. package/lib/exercises/math/spaceGeometry/parametricLine/parametricLineFromPointAndDirectionVector.d.ts +13 -0
  284. package/lib/exercises/math/spaceGeometry/parametricLine/parametricLineFromPointAndDirectionVector.d.ts.map +1 -0
  285. package/lib/exercises/math/spaceGeometry/parametricLine/parametricLineFromPointAndDirectionVector.js +181 -0
  286. package/lib/exercises/math/spaceGeometry/planes/checkIsPointBelongingToPlane.d.ts +10 -0
  287. package/lib/exercises/math/spaceGeometry/planes/checkIsPointBelongingToPlane.d.ts.map +1 -0
  288. package/lib/exercises/math/spaceGeometry/planes/checkIsPointBelongingToPlane.js +208 -0
  289. package/lib/exercises/math/spaceGeometry/planes/findNormalVectorFromPlaneEquation.d.ts +8 -0
  290. package/lib/exercises/math/spaceGeometry/planes/findNormalVectorFromPlaneEquation.d.ts.map +1 -0
  291. package/lib/exercises/math/spaceGeometry/planes/findNormalVectorFromPlaneEquation.js +255 -0
  292. package/lib/exercises/math/spaceGeometry/planes/findNormalVectorFromPlanePointsCoords.d.ts +10 -0
  293. package/lib/exercises/math/spaceGeometry/planes/findNormalVectorFromPlanePointsCoords.d.ts.map +1 -0
  294. package/lib/exercises/math/spaceGeometry/planes/findNormalVectorFromPlanePointsCoords.js +232 -0
  295. package/lib/exercises/math/spaceGeometry/planes/index.d.ts +5 -1
  296. package/lib/exercises/math/spaceGeometry/planes/index.d.ts.map +1 -1
  297. package/lib/exercises/math/spaceGeometry/planes/index.js +6 -2
  298. package/lib/exercises/math/spaceGeometry/planes/planeEquationFromNormalVectorAndContainedPoint.d.ts +10 -0
  299. package/lib/exercises/math/spaceGeometry/planes/planeEquationFromNormalVectorAndContainedPoint.d.ts.map +1 -0
  300. package/lib/exercises/math/spaceGeometry/planes/planeEquationFromNormalVectorAndContainedPoint.js +273 -0
  301. package/lib/exercises/math/spaceGeometry/planes/planeEquationFromOrthogonalLineAndContainedPoint.d.ts +12 -0
  302. package/lib/exercises/math/spaceGeometry/planes/planeEquationFromOrthogonalLineAndContainedPoint.d.ts.map +1 -0
  303. package/lib/exercises/math/spaceGeometry/planes/planeEquationFromOrthogonalLineAndContainedPoint.js +398 -0
  304. package/lib/exercises/math/spaceGeometry/planes/planePlaneRelativePositions.d.ts +22 -0
  305. package/lib/exercises/math/spaceGeometry/planes/planePlaneRelativePositions.d.ts.map +1 -0
  306. package/lib/exercises/math/spaceGeometry/planes/planePlaneRelativePositions.js +509 -0
  307. package/lib/exercises/math/spaceGeometry/scalarProduct/angleFromScalarProductFromSpacePointCoords.d.ts +8 -0
  308. package/lib/exercises/math/spaceGeometry/scalarProduct/angleFromScalarProductFromSpacePointCoords.d.ts.map +1 -0
  309. package/lib/exercises/math/spaceGeometry/scalarProduct/angleFromScalarProductFromSpacePointCoords.js +229 -0
  310. package/lib/exercises/math/spaceGeometry/scalarProduct/checkIsOrthogonalLinesFromParametricReps.d.ts +9 -0
  311. package/lib/exercises/math/spaceGeometry/scalarProduct/checkIsOrthogonalLinesFromParametricReps.d.ts.map +1 -0
  312. package/lib/exercises/math/spaceGeometry/scalarProduct/checkIsOrthogonalLinesFromParametricReps.js +200 -0
  313. package/lib/exercises/math/spaceGeometry/scalarProduct/checkIsOrthogonalSpaceVecsFromCoords.d.ts +8 -0
  314. package/lib/exercises/math/spaceGeometry/scalarProduct/checkIsOrthogonalSpaceVecsFromCoords.d.ts.map +1 -0
  315. package/lib/exercises/math/spaceGeometry/scalarProduct/checkIsOrthogonalSpaceVecsFromCoords.js +176 -0
  316. package/lib/exercises/math/spaceGeometry/scalarProduct/checkIsSpaceVecOrthogonalToPlaneFromCoords.d.ts +9 -0
  317. package/lib/exercises/math/spaceGeometry/scalarProduct/checkIsSpaceVecOrthogonalToPlaneFromCoords.d.ts.map +1 -0
  318. package/lib/exercises/math/spaceGeometry/scalarProduct/checkIsSpaceVecOrthogonalToPlaneFromCoords.js +263 -0
  319. package/lib/exercises/math/spaceGeometry/scalarProduct/index.d.ts +6 -0
  320. package/lib/exercises/math/spaceGeometry/scalarProduct/index.d.ts.map +1 -0
  321. package/lib/exercises/math/spaceGeometry/scalarProduct/index.js +6 -0
  322. package/lib/exercises/math/spaceGeometry/scalarProduct/scalarProductFromCubeOuterPoints.d.ts +14 -0
  323. package/lib/exercises/math/spaceGeometry/scalarProduct/scalarProductFromCubeOuterPoints.d.ts.map +1 -0
  324. package/lib/exercises/math/spaceGeometry/scalarProduct/scalarProductFromCubeOuterPoints.js +497 -0
  325. package/lib/exercises/math/spaceGeometry/scalarProduct/scalarProductFromSpacePointCoords.d.ts +8 -0
  326. package/lib/exercises/math/spaceGeometry/scalarProduct/scalarProductFromSpacePointCoords.d.ts.map +1 -0
  327. package/lib/exercises/math/spaceGeometry/scalarProduct/scalarProductFromSpacePointCoords.js +173 -0
  328. package/lib/exercises/math/spaceGeometry/vectors/findLinearDecompositionWrtCoplanarUVFromCoords.d.ts +10 -0
  329. package/lib/exercises/math/spaceGeometry/vectors/findLinearDecompositionWrtCoplanarUVFromCoords.d.ts.map +1 -0
  330. package/lib/exercises/math/spaceGeometry/vectors/findLinearDecompositionWrtCoplanarUVFromCoords.js +236 -0
  331. package/lib/exercises/math/spaceGeometry/vectors/index.d.ts +2 -0
  332. package/lib/exercises/math/spaceGeometry/vectors/index.d.ts.map +1 -1
  333. package/lib/exercises/math/spaceGeometry/vectors/index.js +2 -0
  334. package/lib/exercises/math/spaceGeometry/vectors/spacePointsDistanceCalculation.d.ts +8 -0
  335. package/lib/exercises/math/spaceGeometry/vectors/spacePointsDistanceCalculation.d.ts.map +1 -0
  336. package/lib/exercises/math/spaceGeometry/vectors/spacePointsDistanceCalculation.js +156 -0
  337. package/lib/exercises/math/trigonometry/functions/index.d.ts +1 -0
  338. package/lib/exercises/math/trigonometry/functions/index.d.ts.map +1 -1
  339. package/lib/exercises/math/trigonometry/functions/index.js +1 -0
  340. package/lib/exercises/utils/data/randomDataTable.d.ts +4 -1
  341. package/lib/exercises/utils/data/randomDataTable.d.ts.map +1 -1
  342. package/lib/exercises/utils/data/randomDataTable.js +1 -2
  343. package/lib/exercises/vea/varLineVEA.d.ts.map +1 -1
  344. package/lib/exercises/vea/varLineVEA.js +15 -2
  345. package/lib/exercises/vea/xTableLineVEA.d.ts.map +1 -1
  346. package/lib/exercises/vea/xTableLineVEA.js +13 -2
  347. package/lib/index.d.ts +539 -34
  348. package/lib/index.d.ts.map +1 -1
  349. package/lib/latexTester.d.ts.map +1 -1
  350. package/lib/latexTester.js +9 -7
  351. package/lib/math/geometry/parametricLine.d.ts +1 -1
  352. package/lib/math/geometry/parametricLine.d.ts.map +1 -1
  353. package/lib/math/geometry/parametricLine.js +2 -2
  354. package/lib/math/geometry/spaceVector.d.ts +11 -1
  355. package/lib/math/geometry/spaceVector.d.ts.map +1 -1
  356. package/lib/math/geometry/spaceVector.js +18 -4
  357. package/lib/math/probability/randomVariable.d.ts +3 -2
  358. package/lib/math/probability/randomVariable.d.ts.map +1 -1
  359. package/lib/math/probability/randomVariable.js +14 -8
  360. package/lib/math/systems/generalSystem.d.ts +3 -3
  361. package/lib/math/systems/generalSystem.d.ts.map +1 -1
  362. package/lib/math/systems/generalSystem.js +20 -17
  363. package/lib/math/utils/functions/functionComparison.d.ts.map +1 -1
  364. package/lib/math/utils/functions/functionComparison.js +2 -45
  365. package/lib/math/utils/functions/functionComposition.d.ts +3 -1
  366. package/lib/math/utils/functions/functionComposition.d.ts.map +1 -1
  367. package/lib/math/utils/functions/functionComposition.js +17 -17
  368. package/lib/math/utils/integration/rectanglesMethod.d.ts +6 -0
  369. package/lib/math/utils/integration/rectanglesMethod.d.ts.map +1 -0
  370. package/lib/math/utils/integration/rectanglesMethod.js +66 -0
  371. package/lib/math/utils/polynomial/polynomialUtils.d.ts +9 -1
  372. package/lib/math/utils/polynomial/polynomialUtils.d.ts.map +1 -1
  373. package/lib/math/utils/polynomial/polynomialUtils.js +66 -7
  374. package/lib/math/utils/sequences/situations/seqGeometricSituations.d.ts +34 -2
  375. package/lib/math/utils/sequences/situations/seqGeometricSituations.d.ts.map +1 -1
  376. package/lib/math/utils/sequences/situations/seqGeometricSituations.js +288 -47
  377. package/lib/tests/questionTest.d.ts.map +1 -1
  378. package/lib/tests/questionTest.js +5 -2
  379. package/lib/tests/singleExo.test.js +2 -2
  380. package/lib/tree/nodes/functions/cosNode.d.ts +1 -1
  381. package/lib/tree/nodes/functions/cosNode.d.ts.map +1 -1
  382. package/lib/tree/nodes/functions/cosNode.js +5 -2
  383. package/lib/tree/nodes/functions/factorialNode.d.ts +1 -0
  384. package/lib/tree/nodes/functions/factorialNode.d.ts.map +1 -1
  385. package/lib/tree/nodes/functions/factorialNode.js +16 -1
  386. package/lib/tree/nodes/functions/logNode.d.ts.map +1 -1
  387. package/lib/tree/nodes/functions/logNode.js +2 -1
  388. package/lib/tree/nodes/operators/binomialCoefficientNode.d.ts +2 -0
  389. package/lib/tree/nodes/operators/binomialCoefficientNode.d.ts.map +1 -1
  390. package/lib/tree/nodes/operators/binomialCoefficientNode.js +34 -0
  391. package/lib/tree/nodes/sets/discreteSetNode.d.ts.map +1 -1
  392. package/lib/tree/nodes/sets/discreteSetNode.js +1 -0
  393. package/lib/tree/utilities/nodeComparator.d.ts +7 -0
  394. package/lib/tree/utilities/nodeComparator.d.ts.map +1 -1
  395. package/lib/tree/utilities/nodeComparator.js +59 -0
  396. package/lib/tree/utilities/nodeInspector.d.ts +2 -0
  397. package/lib/tree/utilities/nodeInspector.d.ts.map +1 -1
  398. package/lib/tree/utilities/nodeInspector.js +23 -1
  399. package/lib/tree/utilities/nodeRewriter.d.ts.map +1 -1
  400. package/lib/tree/utilities/nodeRewriter.js +4 -1
  401. package/lib/types/keyIds.d.ts +1 -1
  402. package/lib/types/keyIds.d.ts.map +1 -1
  403. package/lib/utils/strings/splitAndKeep.d.ts +2 -0
  404. package/lib/utils/strings/splitAndKeep.d.ts.map +1 -0
  405. package/lib/utils/strings/splitAndKeep.js +13 -0
  406. package/package.json +1 -1
@@ -0,0 +1,753 @@
1
+ import { addValidProp, shuffleProps, tryToAddWrongProp, propWhile, GeneratorOptionTarget, GeneratorOptionType, } from "../../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { blueMain, colorWithOpacity, greenLight, red, } from "../../../../geogebra/colors.js";
4
+ import { GeogebraConstructor } from "../../../../geogebra/geogebraConstructor.js";
5
+ import { SpacePoint, SpacePointConstructor, } from "../../../../math/geometry/spacePoint.js";
6
+ import { SpaceVector, SpaceVectorConstructor, } from "../../../../math/geometry/spaceVector.js";
7
+ import { nodeBySubstitutingVar } from "../../../../math/utils/functions/functionComposition.js";
8
+ import { EqualNode } from "../../../../tree/nodes/equations/equalNode.js";
9
+ import { NodeConstructor, } from "../../../../tree/nodes/nodeConstructor.js";
10
+ import { add } from "../../../../tree/nodes/operators/addNode.js";
11
+ import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
12
+ import { isMultiplyNode, multiply, } from "../../../../tree/nodes/operators/multiplyNode.js";
13
+ import { VariableNode } from "../../../../tree/nodes/variables/variableNode.js";
14
+ import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
15
+ import { NodeComparator } from "../../../../tree/utilities/nodeComparator.js";
16
+ import { coinFlip } from "../../../../utils/alea/coinFlip.js";
17
+ import { probaLawFlip } from "../../../../utils/alea/probaLawFlip.js";
18
+ import { random } from "../../../../utils/alea/random.js";
19
+ import { zip } from "../../../../utils/arrays/arrayZip.js";
20
+ import { permute } from "../../../../utils/arrays/permutations.js";
21
+ import { transpose } from "../../../../utils/arrays/transpose.js";
22
+ import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
23
+ import { alignTex } from "../../../../utils/latex/alignTex.js";
24
+ const createRandomArrRotationMatrix = () => {
25
+ const matX = (() => {
26
+ // const gamma = randfloat(0, 6.28, 2);
27
+ const gamma = random([0, 1.57, 3.14, 4.71]);
28
+ const c = Math.cos(gamma);
29
+ const s = Math.sin(gamma);
30
+ return [
31
+ [1, 0, 0],
32
+ [0, c, -s],
33
+ [0, s, c],
34
+ ];
35
+ })();
36
+ const matY = (() => {
37
+ // const beta = randfloat(0, 6.28, 2);
38
+ const beta = random([0, 1.57, 3.14]); //rotating more leads to bugs
39
+ const c = Math.cos(beta);
40
+ const s = Math.sin(beta);
41
+ return [
42
+ [c, 0, s],
43
+ [0, 1, 0],
44
+ [-s, 0, c],
45
+ ];
46
+ })();
47
+ const matZ = (() => {
48
+ // const alpha = randfloat(0, 6.28, 2);
49
+ const alpha = random([0, 1.57, 3.14]); //rotating more leads to bugs
50
+ const c = Math.cos(alpha);
51
+ const s = Math.sin(alpha);
52
+ return [
53
+ [c, -s, 0],
54
+ [s, c, 0],
55
+ [0, 0, 1],
56
+ ];
57
+ })();
58
+ return [matX, matY, matZ];
59
+ };
60
+ const applyMatrixToVec = (mat, vec) => {
61
+ return [...Array(vec.length).keys()].map((i) => vec.reduce((acc, _, j) => acc + mat[i][j] * vec[j], 0));
62
+ };
63
+ const getSpacePointForRelativeCoords = (spacePointOrigin, coords, arrVec) => {
64
+ return zip(coords.map((v) => v.toTree()), arrVec).reduce((acc, [nodeFactor, vec]) => {
65
+ const vecScaled = vec.times(nodeFactor);
66
+ return vecScaled.getEndPoint(acc);
67
+ }, spacePointOrigin);
68
+ };
69
+ const getPrismPoints = (spacePointOrigin, vecX, vecY, vecZ) => {
70
+ const isRightHanded = vecX.vetorialProduct(vecY).scalarProduct(vecZ).evaluate() > 0;
71
+ const [vecXRH, vecYRH, vecZRH] = isRightHanded
72
+ ? [vecX, vecY, vecZ]
73
+ : [vecY, vecX, vecZ];
74
+ const arrCoordsWrtCubeVecs = [
75
+ [0, 0, 0],
76
+ [0, 1, 0],
77
+ [1, 1, 0],
78
+ [1, 0, 0],
79
+ [0, 0, 1],
80
+ [0, 1, 1],
81
+ [1, 1, 1],
82
+ [1, 0, 1],
83
+ ];
84
+ return arrCoordsWrtCubeVecs.map((coords) => getSpacePointForRelativeCoords(spacePointOrigin, coords, [
85
+ vecXRH,
86
+ vecYRH,
87
+ vecZRH,
88
+ ]));
89
+ };
90
+ const createPointMeshForSide = (spacePointOrigin, u, v, nbH, nbW) => {
91
+ return [...Array(nbH + 1).keys()].map((i) => [...Array(nbW + 1).keys()].map((j) => {
92
+ const spaceVec = u.times(i.toTree()).add(v.times(j.toTree()));
93
+ const spacePointIJ = spaceVec.getEndPoint(spacePointOrigin);
94
+ return spacePointIJ;
95
+ }));
96
+ };
97
+ const createSegmentMeshForPointMesh = (pointMesh) => {
98
+ //horiz
99
+ const arrSegmentHoriz = pointMesh.map((rowOfPoints) => {
100
+ return [rowOfPoints[0], rowOfPoints[rowOfPoints.length - 1]];
101
+ });
102
+ //vert
103
+ const arrSegmentVert = transpose(pointMesh).map((columnOfPoints) => {
104
+ return [columnOfPoints[0], columnOfPoints[columnOfPoints.length - 1]];
105
+ });
106
+ return [...arrSegmentHoriz, ...arrSegmentVert];
107
+ };
108
+ const getAllPointMeshes = (spacePointOrigin, vecX, vecY, vecZ) => {
109
+ const isRightHanded = vecX.vetorialProduct(vecY).scalarProduct(vecZ).evaluate() > 0;
110
+ const [vecXRH, vecYRH, vecZRH] = isRightHanded
111
+ ? [vecX, vecY, vecZ]
112
+ : [vecY, vecX, vecZ];
113
+ const nbS = 2;
114
+ const nodeFactorS = (0.5).toTree();
115
+ return [
116
+ //z-
117
+ createPointMeshForSide(spacePointOrigin, vecXRH.times(nodeFactorS), vecYRH.times(nodeFactorS), nbS, nbS),
118
+ //z+
119
+ createPointMeshForSide(vecZRH.getEndPoint(spacePointOrigin, "NoName"), vecXRH.times(nodeFactorS), vecYRH.times(nodeFactorS), 2, 2),
120
+ //y-
121
+ createPointMeshForSide(spacePointOrigin, vecXRH.times(nodeFactorS), vecZRH.times(nodeFactorS), nbS, nbS),
122
+ //y+
123
+ createPointMeshForSide(vecYRH.getEndPoint(spacePointOrigin, "NoName"), vecXRH.times(nodeFactorS), vecZRH.times(nodeFactorS), 2, 2),
124
+ //x-
125
+ createPointMeshForSide(spacePointOrigin, vecYRH.times(nodeFactorS), vecZRH.times(nodeFactorS), nbS, nbS),
126
+ //x+
127
+ createPointMeshForSide(vecXRH.getEndPoint(spacePointOrigin, "NoName"), vecYRH.times(nodeFactorS), vecZRH.times(nodeFactorS), 2, 2),
128
+ ];
129
+ };
130
+ const getArrCoordsFrame = (arrSpacePoint) => {
131
+ const xMin = arrSpacePoint
132
+ .map((spacePoint) => spacePoint.x.evaluate())
133
+ .reduce((acc, x) => Math.min(acc, x));
134
+ const xMax = arrSpacePoint
135
+ .map((spacePoint) => spacePoint.x.evaluate())
136
+ .reduce((acc, x) => Math.max(acc, x));
137
+ const yMin = arrSpacePoint
138
+ .map((spacePoint) => spacePoint.y.evaluate())
139
+ .reduce((acc, x) => Math.min(acc, x));
140
+ const yMax = arrSpacePoint
141
+ .map((spacePoint) => spacePoint.y.evaluate())
142
+ .reduce((acc, x) => Math.max(acc, x));
143
+ const zMin = arrSpacePoint
144
+ .map((spacePoint) => spacePoint.z.evaluate())
145
+ .reduce((acc, x) => Math.min(acc, x));
146
+ const zMax = arrSpacePoint
147
+ .map((spacePoint) => spacePoint.z.evaluate())
148
+ .reduce((acc, x) => Math.max(acc, x));
149
+ return [xMin, xMax, yMin, yMax, zMin, zMax].map((v) => v * 1.1);
150
+ };
151
+ const getHydrated = (identifiers) => {
152
+ const { spacePointIdsCubeOrigin, spacePointIdsCubeVecsEndPoint, spacePointIdsBaseVecsEndPoint, spacePointIdsWrtBaseVecs, nodeIdsEquationForVecs, } = identifiers;
153
+ const spacePointCubeOrigin = SpacePointConstructor.fromIdentifiers(spacePointIdsCubeOrigin);
154
+ const [arrCubeVec, arrBaseVec] = [
155
+ spacePointIdsCubeVecsEndPoint,
156
+ spacePointIdsBaseVecsEndPoint,
157
+ ].map((arr) => arr.map((pointIds) => SpaceVectorConstructor.fromPoints(spacePointCubeOrigin, SpacePointConstructor.fromIdentifiers(pointIds))));
158
+ const arrSpacePointWrtBaseVecs = spacePointIdsWrtBaseVecs.map((spacePointIds) => SpacePointConstructor.fromIdentifiers(spacePointIds));
159
+ const arrSpacePointNamed = zip("FABCD".split(""), arrSpacePointWrtBaseVecs).map(([name, spacePointWrtBaseVecs]) => {
160
+ const spacePoint = getSpacePointForRelativeCoords(spacePointCubeOrigin, [
161
+ spacePointWrtBaseVecs.x,
162
+ spacePointWrtBaseVecs.y,
163
+ spacePointWrtBaseVecs.z,
164
+ ].map((node) => node.evaluate()), arrBaseVec);
165
+ spacePoint.name = name;
166
+ return spacePoint;
167
+ });
168
+ const nodeEquationForVecs = NodeConstructor.fromIdentifiers(nodeIdsEquationForVecs);
169
+ const [spacePointAskedWrtBaseVecs, arrVecWrtBaseVecs] = (() => {
170
+ if (isMultiplyNode(nodeEquationForVecs.rightChild)) {
171
+ // FM = factor1 * vec1
172
+ const [F, A, B] = arrSpacePointWrtBaseVecs;
173
+ const [vecF, vecA, vecB] = [F, A, B].map((spacePointWrtBaseVecs) => SpaceVectorConstructor.fromPoints(SpacePointConstructor.fromScalars([0, 0, 0]), spacePointWrtBaseVecs));
174
+ const nodeFactor1 = nodeEquationForVecs.rightChild
175
+ .leftChild;
176
+ const strVec1 = nodeEquationForVecs.rightChild
177
+ .rightChild.name;
178
+ const vec1WrtBaseVecs = (() => {
179
+ switch (strVec1) {
180
+ case "\\overrightarrow{AB}": {
181
+ const vecRaw = vecB.add(vecA.times((-1).toTree()));
182
+ return new SpaceVector("AB", vecRaw.x, vecRaw.y, vecRaw.z);
183
+ }
184
+ case "\\overrightarrow{BA}": {
185
+ const vecRaw = vecA.add(vecB.times((-1).toTree()));
186
+ return new SpaceVector("BA", vecRaw.x, vecRaw.y, vecRaw.z);
187
+ }
188
+ default:
189
+ throw new Error("Unsupported strVec1: " + strVec1);
190
+ }
191
+ })();
192
+ const vecM = vecF.add(vec1WrtBaseVecs.times(nodeFactor1));
193
+ const [nodeX, nodeY, nodeZ] = [vecM.x, vecM.y, vecM.z];
194
+ const spacePointAsked = new SpacePoint("M", nodeX, nodeY, nodeZ);
195
+ return [spacePointAsked, [vecF, vec1WrtBaseVecs]];
196
+ }
197
+ else {
198
+ //FM = factor1 * vec1 + factor2 * vec2
199
+ const [F, A, B, C, D] = arrSpacePointWrtBaseVecs;
200
+ const [vecF, vecA, vecB, vecC, vecD] = [F, A, B, C, D].map((spacePointWrtBaseVecs) => SpaceVectorConstructor.fromPoints(SpacePointConstructor.fromScalars([0, 0, 0]), spacePointWrtBaseVecs));
201
+ const nodeFactor1 = nodeEquationForVecs.rightChild.leftChild.leftChild;
202
+ const nodeFactor2 = nodeEquationForVecs.rightChild.rightChild.leftChild;
203
+ const strVec1 = nodeEquationForVecs.rightChild.leftChild
204
+ .rightChild.name;
205
+ const strVec2 = nodeEquationForVecs.rightChild.rightChild
206
+ .rightChild.name;
207
+ const vec1WrtBaseVecs = (() => {
208
+ switch (strVec1) {
209
+ case "\\overrightarrow{AB}": {
210
+ const vecRaw = vecB.add(vecA.times((-1).toTree()));
211
+ return new SpaceVector("AB", vecRaw.x, vecRaw.y, vecRaw.z);
212
+ }
213
+ case "\\overrightarrow{BA}": {
214
+ const vecRaw = vecA.add(vecB.times((-1).toTree()));
215
+ return new SpaceVector("BA", vecRaw.x, vecRaw.y, vecRaw.z);
216
+ }
217
+ default:
218
+ throw new Error("Unsupported strVec1: " + strVec1);
219
+ }
220
+ })();
221
+ const vec2WrtBaseVecs = (() => {
222
+ switch (strVec2) {
223
+ case "\\overrightarrow{CD}": {
224
+ const vecRaw = vecD.add(vecC.times((-1).toTree()));
225
+ return new SpaceVector("CD", vecRaw.x, vecRaw.y, vecRaw.z);
226
+ }
227
+ case "\\overrightarrow{DC}": {
228
+ const vecRaw = vecC.add(vecD.times((-1).toTree()));
229
+ return new SpaceVector("DC", vecRaw.x, vecRaw.y, vecRaw.z);
230
+ }
231
+ default:
232
+ throw new Error("Unsupported strVec2: " + strVec2);
233
+ }
234
+ })();
235
+ const vecM = vecF.add(vec1WrtBaseVecs
236
+ .times(nodeFactor1)
237
+ .add(vec2WrtBaseVecs.times(nodeFactor2)));
238
+ const [nodeX, nodeY, nodeZ] = [vecM.x, vecM.y, vecM.z];
239
+ const spacePointAsked = new SpacePoint("M", nodeX, nodeY, nodeZ);
240
+ return [spacePointAsked, [vecF, vec1WrtBaseVecs, vec2WrtBaseVecs]];
241
+ }
242
+ })();
243
+ return {
244
+ spacePointCubeOrigin,
245
+ arrCubeVec,
246
+ arrBaseVec,
247
+ arrSpacePointNamed,
248
+ arrVecWrtBaseVecs,
249
+ spacePointAskedWrtBaseVecs,
250
+ };
251
+ };
252
+ const getInstruction = (identifiers) => {
253
+ const { nodeIdsEquationForVecs } = identifiers;
254
+ const nodeEquationForVecs = NodeConstructor.fromIdentifiers(nodeIdsEquationForVecs);
255
+ return `Déterminer les coordonnées du point $M$
256
+ dans le repère $(O;\\overrightarrow{i};\\overrightarrow{j};\\overrightarrow{k})$ sachant que :
257
+
258
+ $$
259
+ ${nodeEquationForVecs.toTex()}
260
+ $$
261
+
262
+ *On pourra tourner la fenêtre graphique.*`;
263
+ };
264
+ const getAnswer = (identifiers) => {
265
+ const { spacePointAskedWrtBaseVecs } = getHydrated(identifiers);
266
+ return spacePointAskedWrtBaseVecs.toCoords();
267
+ };
268
+ const getHint = (identifiers) => {
269
+ const { nodeIdsEquationForVecs } = identifiers;
270
+ const nodeEquationForVecs = NodeConstructor.fromIdentifiers(nodeIdsEquationForVecs);
271
+ return `Le point $M$ est l'image du point $F$ par la translation de vecteur $${nodeEquationForVecs.rightChild.toTex()}$.
272
+ Tu as deux possibilités :
273
+ - soit tu arrives à visualiser mentalement l'emplacement du point $M$ sur la figure et tu détermines ses coordonnées
274
+ - soit tu détermines les coordonnées de $F$ et celles du vecteur $${nodeEquationForVecs.rightChild.toTex()}$ puis tu les additionne.`;
275
+ };
276
+ const getCorrection = (identifiers) => {
277
+ const { nodeIdsEquationForVecs } = identifiers;
278
+ const nodeEquationForVecs = NodeConstructor.fromIdentifiers(nodeIdsEquationForVecs);
279
+ if (isMultiplyNode(nodeEquationForVecs.rightChild)) {
280
+ const { arrVecWrtBaseVecs } = getHydrated(identifiers);
281
+ const [vecF, vec1] = arrVecWrtBaseVecs;
282
+ return `Pour trouver les coordonnées de $M$, on applique une translation de vecteur $${nodeEquationForVecs.rightChild.toTex()}$ au point $F$.
283
+
284
+ En effet, la relation de Chasles donne $\\overrightarrow{FM} = \\overrightarrow{FO} + \\overrightarrow{OM}$.
285
+
286
+ D'où :
287
+
288
+ $$
289
+ \\overrightarrow{OM} = \\overrightarrow{OF} + (${nodeEquationForVecs.rightChild.toTex()})
290
+ $$
291
+
292
+ Or :
293
+
294
+ $$
295
+ \\overrightarrow{OF} = ${vecF.toCoordsTex()}
296
+ $$
297
+
298
+ et
299
+
300
+ $$
301
+ ${vec1.toTex()} = ${vec1.toCoordsTex()}
302
+ $$
303
+
304
+ Donc :
305
+
306
+ ${alignTex([
307
+ [
308
+ "\\overrightarrow{OM}",
309
+ "=",
310
+ `\\overrightarrow{OF} + (${nodeEquationForVecs.rightChild.toTex()})`,
311
+ ],
312
+ [
313
+ "\\overrightarrow{OM}",
314
+ "=",
315
+ `${vecF.toCoordsTex()} + (${nodeBySubstitutingVar(nodeEquationForVecs.rightChild, new VariableNode(vec1.toCoordsTex()), //forgive me father
316
+ new VariableNode(vec1.toTex())).toTex()})`,
317
+ ],
318
+ ["", "=", getAnswer(identifiers)],
319
+ ])}
320
+
321
+ `;
322
+ }
323
+ else {
324
+ const { arrVecWrtBaseVecs } = getHydrated(identifiers);
325
+ const [vecF, vec1, vec2] = arrVecWrtBaseVecs;
326
+ return `Pour trouver les coordonnées de $M$, on applique une translation de vecteur $${nodeEquationForVecs.rightChild.toTex()}$ au point $F$.
327
+
328
+ En effet, la relation de Chasles donne $\\overrightarrow{FM} = \\overrightarrow{FO} + \\overrightarrow{OM}$.
329
+
330
+ D'où :
331
+
332
+ $$
333
+ \\overrightarrow{OM} = \\overrightarrow{OF} + (${nodeEquationForVecs.rightChild.toTex()})
334
+ $$
335
+
336
+ Or :
337
+
338
+ $$
339
+ \\overrightarrow{OF} = ${vecF.toCoordsTex()}
340
+ $$
341
+
342
+ $$
343
+ ${vec1.toTex()} = ${vec1.toCoordsTex()}
344
+ $$
345
+
346
+ et
347
+
348
+ $$
349
+ ${vec2.toTex()} = ${vec2.toCoordsTex()}
350
+ $$
351
+
352
+ Donc :
353
+
354
+ ${alignTex([
355
+ [
356
+ "\\overrightarrow{OM}",
357
+ "=",
358
+ `\\overrightarrow{OF} + (${nodeEquationForVecs.rightChild.toTex()})`,
359
+ ],
360
+ [
361
+ "\\overrightarrow{OM}",
362
+ "=",
363
+ `${vecF.toCoordsTex()} + (${nodeBySubstitutingVar(nodeBySubstitutingVar(nodeEquationForVecs.rightChild, new VariableNode(vec1.toCoordsTex()), new VariableNode(vec1.toTex())), new VariableNode(vec2.toCoordsTex()), //forgive me father 2
364
+ new VariableNode(vec2.toTex())).toTex()})`,
365
+ ],
366
+ ["", "=", getAnswer(identifiers)],
367
+ ])}
368
+
369
+ `;
370
+ }
371
+ };
372
+ const getCorrectionGGBOptions = (identifiers) => {
373
+ const { spacePointCubeOrigin, arrCubeVec, arrBaseVec, arrSpacePointNamed, spacePointAskedWrtBaseVecs, } = getHydrated(identifiers);
374
+ const spacePointAsked = getSpacePointForRelativeCoords(spacePointCubeOrigin, [
375
+ spacePointAskedWrtBaseVecs.x,
376
+ spacePointAskedWrtBaseVecs.y,
377
+ spacePointAskedWrtBaseVecs.z,
378
+ ].map((node) => node.evaluate()), arrBaseVec);
379
+ spacePointAsked.name = "M";
380
+ const [vecXCube, vecYCube, vecZCube] = arrCubeVec;
381
+ const prismSpacePoints = getPrismPoints(spacePointCubeOrigin, vecXCube, vecYCube, vecZCube);
382
+ const arrSide = getAllPointMeshes(spacePointCubeOrigin, vecXCube, vecYCube, vecZCube);
383
+ const arrSegment = arrSide.flatMap(createSegmentMeshForPointMesh);
384
+ const commands = [
385
+ //hide xOyPlane
386
+ `SetFilling(xOyPlane, 0)`,
387
+ //pretty names
388
+ ...[
389
+ //points
390
+ ...[spacePointCubeOrigin, ...arrSpacePointNamed, spacePointAsked].flatMap((spacePoint) => spacePoint.toGGBCommand({
391
+ isFixed: true,
392
+ showLabel: true,
393
+ })),
394
+ ],
395
+ //no names
396
+ ...[
397
+ //prism
398
+ `Pri = Prism(${prismSpacePoints
399
+ .slice(0, 5)
400
+ .map((p) => p.toMathString())
401
+ .join(",")})`,
402
+ `SetColor(Pri, "${colorWithOpacity("#000000", 16)}")`,
403
+ `SetLineThickness(Pri, 1)`,
404
+ //segment meshes
405
+ ...arrSegment.flatMap(([spacePointStart, spacePointEnd], i) => {
406
+ return [
407
+ `S_${i} = Segment(${spacePointStart.toMathString()}, ${spacePointEnd.toMathString()})`,
408
+ `SetColor(S_${i}, "${colorWithOpacity("#BBBBBB", 37)}")`, //opacity is ignored
409
+ `SetLineThickness(S_${i}, 1)`,
410
+ ];
411
+ }),
412
+ //vec
413
+ ...arrBaseVec.flatMap((vec, i) => [
414
+ `v${i} = Vector(Point({${vec.x.toMathString()},${vec.y.toMathString()},${vec.z.toMathString()}}))`,
415
+ `SetColor(v${i}, ${(() => {
416
+ switch (i) {
417
+ case 0:
418
+ return `"${red}"`;
419
+ case 1:
420
+ return `"${greenLight}"`;
421
+ case 2:
422
+ return `"${blueMain}"`;
423
+ default:
424
+ return "#000000";
425
+ }
426
+ })()})`,
427
+ `SetCaption(v${i}, ${(() => {
428
+ switch (i) {
429
+ case 0:
430
+ return `"$\\overrightarrow{i}$"`;
431
+ case 1:
432
+ return `"$\\overrightarrow{j}$"`;
433
+ case 2:
434
+ return `"$\\overrightarrow{k}$"`;
435
+ default:
436
+ return "";
437
+ }
438
+ })()})`,
439
+ `ShowLabel(v${i}, true)`,
440
+ ]),
441
+ ],
442
+ ];
443
+ const ggb = new GeogebraConstructor({
444
+ commands,
445
+ is3D: true,
446
+ hideAxes: true,
447
+ viewDirectionVector: [-0.7, -1, -0.5],
448
+ });
449
+ return ggb.getOptions({
450
+ coords: getArrCoordsFrame(prismSpacePoints),
451
+ });
452
+ };
453
+ const getGGBOptions = (identifiers) => {
454
+ const { spacePointCubeOrigin, arrCubeVec, arrBaseVec, arrSpacePointNamed } = getHydrated(identifiers);
455
+ const [vecXCube, vecYCube, vecZCube] = arrCubeVec;
456
+ const prismSpacePoints = getPrismPoints(spacePointCubeOrigin, vecXCube, vecYCube, vecZCube);
457
+ const arrSide = getAllPointMeshes(spacePointCubeOrigin, vecXCube, vecYCube, vecZCube);
458
+ const arrSegment = arrSide.flatMap(createSegmentMeshForPointMesh);
459
+ const commands = [
460
+ //hide xOyPlane
461
+ `SetFilling(xOyPlane, 0)`,
462
+ //pretty names
463
+ ...[
464
+ //points
465
+ ...[spacePointCubeOrigin, ...arrSpacePointNamed].flatMap((spacePoint) => spacePoint.toGGBCommand({
466
+ isFixed: true,
467
+ showLabel: true,
468
+ })),
469
+ ],
470
+ //no names
471
+ ...[
472
+ //prism
473
+ `Pri = Prism(${prismSpacePoints
474
+ .slice(0, 5)
475
+ .map((p) => p.toMathString())
476
+ .join(",")})`,
477
+ `SetColor(Pri, "${colorWithOpacity("#000000", 16)}")`,
478
+ `SetLineThickness(Pri, 1)`,
479
+ //segment meshes
480
+ ...arrSegment.flatMap(([spacePointStart, spacePointEnd], i) => {
481
+ return [
482
+ `S_${i} = Segment(${spacePointStart.toMathString()}, ${spacePointEnd.toMathString()})`,
483
+ `SetColor(S_${i}, "${colorWithOpacity("#BBBBBB", 37)}")`, //opacity is ignored
484
+ `SetLineThickness(S_${i}, 1)`,
485
+ ];
486
+ }),
487
+ //vec
488
+ ...arrBaseVec.flatMap((vec, i) => [
489
+ `v${i} = Vector(Point({${vec.x.toMathString()},${vec.y.toMathString()},${vec.z.toMathString()}}))`,
490
+ `SetColor(v${i}, ${(() => {
491
+ switch (i) {
492
+ case 0:
493
+ return `"${red}"`;
494
+ case 1:
495
+ return `"${greenLight}"`;
496
+ case 2:
497
+ return `"${blueMain}"`;
498
+ default:
499
+ return "#000000";
500
+ }
501
+ })()})`,
502
+ `SetCaption(v${i}, ${(() => {
503
+ switch (i) {
504
+ case 0:
505
+ return `"$\\overrightarrow{i}$"`;
506
+ case 1:
507
+ return `"$\\overrightarrow{j}$"`;
508
+ case 2:
509
+ return `"$\\overrightarrow{k}$"`;
510
+ default:
511
+ return "";
512
+ }
513
+ })()})`,
514
+ `ShowLabel(v${i}, true)`,
515
+ ]),
516
+ ],
517
+ ];
518
+ const ggb = new GeogebraConstructor({
519
+ commands,
520
+ is3D: true,
521
+ hideAxes: true,
522
+ viewDirectionVector: [-0.7, -1, -0.5],
523
+ });
524
+ return ggb.getOptions({
525
+ coords: getArrCoordsFrame(prismSpacePoints),
526
+ });
527
+ };
528
+ const getPropositions = (n, { answer, ...identifiers }, optsIn) => {
529
+ const opts = optsIn ?? optsDefault;
530
+ const nbStepsForVecPath = parseInt(opts.nbStepsForVecPath);
531
+ const propositions = [];
532
+ addValidProp(propositions, answer);
533
+ const { spacePointAskedWrtBaseVecs } = getHydrated(identifiers);
534
+ const arrNodeAnswer = [
535
+ spacePointAskedWrtBaseVecs.x,
536
+ spacePointAskedWrtBaseVecs.y,
537
+ spacePointAskedWrtBaseVecs.z,
538
+ ];
539
+ permute(arrNodeAnswer).forEach((arrNodeAnswerWrong) => {
540
+ const [nodeX, nodeY, nodeZ] = arrNodeAnswerWrong;
541
+ const spacePointWrong = new SpacePoint("MWrong", nodeX, nodeY, nodeZ);
542
+ tryToAddWrongProp(propositions, spacePointWrong.toCoords());
543
+ });
544
+ propWhile(propositions, n, () => {
545
+ const identifiersWrong = createRandomIdentifiers(nbStepsForVecPath);
546
+ tryToAddWrongProp(propositions, getAnswer(identifiersWrong));
547
+ });
548
+ return shuffleProps(propositions, n);
549
+ };
550
+ const getKeys = () => {
551
+ return ["semicolon"];
552
+ };
553
+ const isAnswerValid = (ans, { answer, ...identifiers }) => {
554
+ const { spacePointAskedWrtBaseVecs } = getHydrated(identifiers);
555
+ const arrNodeAnswer = [
556
+ spacePointAskedWrtBaseVecs.x,
557
+ spacePointAskedWrtBaseVecs.y,
558
+ spacePointAskedWrtBaseVecs.z,
559
+ ];
560
+ function matchGroups(regex, input) {
561
+ const match = regex.exec(input);
562
+ return match?.groups || undefined;
563
+ }
564
+ try {
565
+ const arrNodeAns = (() => {
566
+ const arrKey = [...Array(3).keys()]
567
+ .map((i) => i + 1)
568
+ .map((v) => `str${v}`);
569
+ const strRegex = `^\\\\left\\(${arrKey
570
+ .map((strKey) => `(?<${strKey}>.*(?!;$))`)
571
+ .join(";")}\\\\right\\)$`;
572
+ const regex = new RegExp(strRegex);
573
+ const ansParts = matchGroups(regex, ans);
574
+ if (ansParts === undefined) {
575
+ throw new Error("Parsing error: ans is not a tuple");
576
+ }
577
+ const arrNode = Object.entries(ansParts).map(([_key, str]) => parseAlgebraic(str));
578
+ return arrNode;
579
+ })();
580
+ return zip(arrNodeAns, arrNodeAnswer).every(([nodeAns, nodeAnswer]) => NodeComparator.isEqualViaSub(nodeAns, nodeAnswer));
581
+ }
582
+ catch (err) {
583
+ return handleVEAError(err);
584
+ }
585
+ };
586
+ const createRandomSpacePointAskedWrtBaseVecs = (arrFactorBaseWrtCube) => {
587
+ let spacePoint;
588
+ let isFound = false;
589
+ while (!isFound) {
590
+ const [typeX, typeY, typeZ] = arrFactorBaseWrtCube.map(() => probaLawFlip([
591
+ ["zero", 0.2],
592
+ ["mid", 0.4],
593
+ ["full", 0.4],
594
+ ]));
595
+ isFound = !((typeX === "zero" && typeY === "zero" && typeZ === "zero") ||
596
+ (typeX === "mid" && typeY === "mid" && typeZ === "mid"));
597
+ if (isFound) {
598
+ const [x, y, z] = zip([typeX, typeY, typeZ], arrFactorBaseWrtCube).map(([type, factor]) => {
599
+ const factorPoint = factor === 0.5 ? 2 : 1;
600
+ return (factorPoint *
601
+ (() => {
602
+ switch (type) {
603
+ case "zero":
604
+ return 0;
605
+ case "mid":
606
+ return 0.5;
607
+ case "full":
608
+ return 1;
609
+ default:
610
+ throw new Error("Unsupported type: " + type);
611
+ }
612
+ })());
613
+ });
614
+ spacePoint = SpacePointConstructor.fromScalars([x, y, z]);
615
+ isFound = true;
616
+ }
617
+ }
618
+ return spacePoint;
619
+ };
620
+ const createArrRandomSpacePointWrtBaseVecs = (arrFactorBaseWrtCube, nb) => {
621
+ const arrSpacePoint = [];
622
+ const isSameSpacePoint = (spacePoint1, spacePoint2) => {
623
+ return zip([spacePoint1.x, spacePoint1.y, spacePoint1.z], [spacePoint2.x, spacePoint2.y, spacePoint2.z]).every(([node1, node2]) => NodeComparator.isEqualViaSub(node1, node2));
624
+ };
625
+ while (arrSpacePoint.length < nb) {
626
+ const spacePointCandidate = createRandomSpacePointAskedWrtBaseVecs(arrFactorBaseWrtCube);
627
+ const isFound = arrSpacePoint.every((spacePointExisting) => !isSameSpacePoint(spacePointCandidate, spacePointExisting));
628
+ if (isFound) {
629
+ const spacePointNew = spacePointCandidate;
630
+ arrSpacePoint.push(spacePointNew);
631
+ }
632
+ }
633
+ return zip("FABCD".split(""), arrSpacePoint).map(([name, spacePoint]) => {
634
+ spacePoint.name = name;
635
+ return spacePoint;
636
+ });
637
+ };
638
+ const createRandomIdentifiers = (nbStepsForVecPath) => {
639
+ const lengthSideCube = 5;
640
+ const [coordsVecX, coordsVecY, coordsVecZ] = createRandomArrRotationMatrix().reduce((acc, mat) => acc.map((coordsVec) => applyMatrixToVec(mat, coordsVec), [
641
+ [1, 0, 0],
642
+ [0, 1, 0],
643
+ [0, 0, 1],
644
+ ]));
645
+ const [vecXCube, vecYCube, vecZCube] = zip(["vecX", "vecY", "vecZ"], [coordsVecX, coordsVecY, coordsVecZ]).map(([name, arr]) => SpaceVectorConstructor.fromScalars(arr.map((v) => v * lengthSideCube), name));
646
+ const arrFactorBaseWrtCube = ["x", "y", "z"].map(() => random([0.5, 1]));
647
+ const [vecXBase, vecYBase, vecZBase] = zip(arrFactorBaseWrtCube,
648
+ //right-handed or left-handed orientation
649
+ coinFlip()
650
+ ? [vecXCube, vecYCube, vecZCube]
651
+ : [vecYCube, vecXCube, vecZCube]).map(([factor, vec]) => vec.times(factor.toTree()));
652
+ const spacePointCubeOrigin = SpacePointConstructor.fromScalars([0, 0, 0], "O");
653
+ const arrCubeVecEndPoint = [vecXCube, vecYCube, vecZCube].map((vec) => vec.getEndPoint(spacePointCubeOrigin));
654
+ const arrBaseVecEndPoint = [vecXBase, vecYBase, vecZBase].map((vec) => vec.getEndPoint(spacePointCubeOrigin));
655
+ const arrSpacePointWithName = createArrRandomSpacePointWrtBaseVecs(arrFactorBaseWrtCube, 1 + 2 * nbStepsForVecPath);
656
+ const nodeEquationForVecs = new EqualNode(new VariableNode("\\overrightarrow{FM}"), (() => {
657
+ switch (nbStepsForVecPath) {
658
+ case 1: {
659
+ const nodeFactorVec1 = random([
660
+ (-1).toTree(),
661
+ (-2).toTree(),
662
+ (1).toTree(),
663
+ frac(1, 2),
664
+ frac(3, 2),
665
+ (2).toTree(),
666
+ ]);
667
+ const strVec1 = `\\overrightarrow{${random(["AB", "BA"])}}`;
668
+ const nodeVec1 = new VariableNode(strVec1);
669
+ return multiply(nodeFactorVec1, nodeVec1);
670
+ }
671
+ case 2: {
672
+ const nodeFactorVec1 = random([
673
+ (-1).toTree(),
674
+ (-2).toTree(),
675
+ (1).toTree(),
676
+ frac(1, 2),
677
+ frac(3, 2),
678
+ (2).toTree(),
679
+ ]);
680
+ const strVec1 = `\\overrightarrow{${random(["AB", "BA"])}}`;
681
+ const nodeVec1 = new VariableNode(strVec1);
682
+ const nodeFactorVec2 = random([
683
+ (-1).toTree(),
684
+ (1).toTree(),
685
+ (2).toTree(),
686
+ ]);
687
+ const strVec2 = `\\overrightarrow{${random(["CD", "DC"])}}`;
688
+ const nodeVec2 = new VariableNode(strVec2);
689
+ return add(multiply(nodeFactorVec1, nodeVec1), multiply(nodeFactorVec2, nodeVec2));
690
+ }
691
+ default:
692
+ throw new Error("Unsupported nbStepsForVecPath: " + nbStepsForVecPath);
693
+ }
694
+ })());
695
+ const identifiers = {
696
+ spacePointIdsCubeOrigin: spacePointCubeOrigin.toIdentifiers(),
697
+ spacePointIdsCubeVecsEndPoint: arrCubeVecEndPoint.map((point) => point.toIdentifiers()),
698
+ spacePointIdsBaseVecsEndPoint: arrBaseVecEndPoint.map((point) => point.toIdentifiers()),
699
+ spacePointIdsWrtBaseVecs: arrSpacePointWithName.map((point) => point.toIdentifiers()),
700
+ nodeIdsEquationForVecs: nodeEquationForVecs.toIdentifiers(),
701
+ };
702
+ return identifiers;
703
+ };
704
+ const getSpaceCoordinatesOfPointInCubeCoordSystemFromVecPathQuestion = (optsIn) => {
705
+ const opts = optsIn ?? optsDefault;
706
+ const nbStepsForVecPath = parseInt(opts.nbStepsForVecPath);
707
+ const identifiers = createRandomIdentifiers(nbStepsForVecPath);
708
+ return getQuestionFromIdentifiers(identifiers);
709
+ };
710
+ const getQuestionFromIdentifiers = (identifiers) => {
711
+ const question = {
712
+ answer: getAnswer(identifiers),
713
+ instruction: getInstruction(identifiers),
714
+ keys: getKeys(identifiers),
715
+ answerFormat: "tex",
716
+ identifiers,
717
+ hint: getHint(identifiers),
718
+ correction: getCorrection(identifiers),
719
+ ggbOptions: getGGBOptions(identifiers),
720
+ correctionGgbOptions: getCorrectionGGBOptions(identifiers),
721
+ };
722
+ return question;
723
+ };
724
+ const optsDefault = {
725
+ nbStepsForVecPath: "1",
726
+ };
727
+ const options = [
728
+ {
729
+ id: "nbStepsForVecPath",
730
+ label: "Nombre d'étape pour le chemin vectoriel",
731
+ target: GeneratorOptionTarget.generation,
732
+ type: GeneratorOptionType.select,
733
+ values: ["1", "2"],
734
+ defaultValue: optsDefault.nbStepsForVecPath,
735
+ },
736
+ ];
737
+ export const spaceCoordinatesOfPointInCubeCoordSystemFromVecPath = {
738
+ id: "spaceCoordinatesOfPointInCubeCoordSystemFromVecPath",
739
+ label: "À partir d'un cube avec les milieux des arêtes, déterminer les coordonnées d'un vecteur formé par deux points",
740
+ isSingleStep: true,
741
+ generator: (nb, opts) => getDistinctQuestions(() => getSpaceCoordinatesOfPointInCubeCoordSystemFromVecPathQuestion(opts), nb),
742
+ options,
743
+ qcmTimer: 60,
744
+ freeTimer: 60,
745
+ getPropositions,
746
+ isAnswerValid,
747
+ subject: "Mathématiques",
748
+ hasGeogebra: true,
749
+ getQuestionFromIdentifiers,
750
+ getHint,
751
+ getCorrection,
752
+ hasHintAndCorrection: true,
753
+ };