math-exercises 2.1.8 → 2.1.10

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 (205) hide show
  1. package/lib/exercises/exercise.d.ts +1 -1
  2. package/lib/exercises/exercise.d.ts.map +1 -1
  3. package/lib/exercises/math/calcul/arithmetics/commonDivisorsList.js +1 -1
  4. package/lib/exercises/math/calcul/arithmetics/divisorsList.js +1 -1
  5. package/lib/exercises/math/calcul/arithmetics/euclideanDivision.js +1 -1
  6. package/lib/exercises/math/calcul/arithmetics/pgcdCalcul.js +1 -1
  7. package/lib/exercises/math/calcul/rounding/rounding.js +1 -1
  8. package/lib/exercises/math/calculLitteral/equation/binomialsTrinomialsProposedSolutions.d.ts +5 -0
  9. package/lib/exercises/math/calculLitteral/equation/binomialsTrinomialsProposedSolutions.d.ts.map +1 -0
  10. package/lib/exercises/math/calculLitteral/equation/binomialsTrinomialsProposedSolutions.js +78 -0
  11. package/lib/exercises/math/calculLitteral/equation/equationFromSentenceExercise.d.ts +14 -0
  12. package/lib/exercises/math/calculLitteral/equation/equationFromSentenceExercise.d.ts.map +1 -0
  13. package/lib/exercises/math/calculLitteral/equation/equationFromSentenceExercise.js +160 -0
  14. package/lib/exercises/math/calculLitteral/equation/firstDegreeEquationIntType1.d.ts +9 -0
  15. package/lib/exercises/math/calculLitteral/equation/firstDegreeEquationIntType1.d.ts.map +1 -0
  16. package/lib/exercises/math/calculLitteral/equation/firstDegreeEquationIntType1.js +65 -0
  17. package/lib/exercises/math/calculLitteral/equation/firstDegreeEquationIntType2.d.ts +10 -0
  18. package/lib/exercises/math/calculLitteral/equation/firstDegreeEquationIntType2.d.ts.map +1 -0
  19. package/lib/exercises/math/calculLitteral/equation/firstDegreeEquationIntType2.js +72 -0
  20. package/lib/exercises/math/calculLitteral/equation/firstDegreeEquationIntType3.d.ts +11 -0
  21. package/lib/exercises/math/calculLitteral/equation/firstDegreeEquationIntType3.d.ts.map +1 -0
  22. package/lib/exercises/math/calculLitteral/equation/firstDegreeEquationIntType3.js +78 -0
  23. package/lib/exercises/math/calculLitteral/equation/index.d.ts +5 -1
  24. package/lib/exercises/math/calculLitteral/equation/index.d.ts.map +1 -1
  25. package/lib/exercises/math/calculLitteral/equation/index.js +5 -1
  26. package/lib/exercises/math/derivation/derivative/convexityQuadrinomials.d.ts +8 -0
  27. package/lib/exercises/math/derivation/derivative/convexityQuadrinomials.d.ts.map +1 -0
  28. package/lib/exercises/math/derivation/derivative/convexityQuadrinomials.js +96 -0
  29. package/lib/exercises/math/derivation/derivative/convexityTrinomials.d.ts +7 -0
  30. package/lib/exercises/math/derivation/derivative/convexityTrinomials.d.ts.map +1 -0
  31. package/lib/exercises/math/derivation/derivative/convexityTrinomials.js +44 -0
  32. package/lib/exercises/math/derivation/derivative/cosSecondDegreeDerivative.d.ts +7 -0
  33. package/lib/exercises/math/derivation/derivative/cosSecondDegreeDerivative.d.ts.map +1 -0
  34. package/lib/exercises/math/derivation/derivative/cosSecondDegreeDerivative.js +79 -0
  35. package/lib/exercises/math/derivation/derivative/index.d.ts +8 -0
  36. package/lib/exercises/math/derivation/derivative/index.d.ts.map +1 -1
  37. package/lib/exercises/math/derivation/derivative/index.js +8 -0
  38. package/lib/exercises/math/derivation/derivative/inflexionPointQuadrinomials.d.ts +7 -0
  39. package/lib/exercises/math/derivation/derivative/inflexionPointQuadrinomials.d.ts.map +1 -0
  40. package/lib/exercises/math/derivation/derivative/inflexionPointQuadrinomials.js +83 -0
  41. package/lib/exercises/math/derivation/derivative/secondDerivativeOfExpoFunction.d.ts +7 -0
  42. package/lib/exercises/math/derivation/derivative/secondDerivativeOfExpoFunction.d.ts.map +1 -0
  43. package/lib/exercises/math/derivation/derivative/secondDerivativeOfExpoFunction.js +59 -0
  44. package/lib/exercises/math/derivation/derivative/secondDerivativeOfThirdDegreeFunction.d.ts +10 -0
  45. package/lib/exercises/math/derivation/derivative/secondDerivativeOfThirdDegreeFunction.d.ts.map +1 -0
  46. package/lib/exercises/math/derivation/derivative/secondDerivativeOfThirdDegreeFunction.js +60 -0
  47. package/lib/exercises/math/derivation/derivative/secondDerivativeOfTrinom.d.ts +9 -0
  48. package/lib/exercises/math/derivation/derivative/secondDerivativeOfTrinom.d.ts.map +1 -0
  49. package/lib/exercises/math/derivation/derivative/secondDerivativeOfTrinom.js +56 -0
  50. package/lib/exercises/math/derivation/derivative/sinSecondDegreeDerivative.d.ts +7 -0
  51. package/lib/exercises/math/derivation/derivative/sinSecondDegreeDerivative.d.ts.map +1 -0
  52. package/lib/exercises/math/derivation/derivative/sinSecondDegreeDerivative.js +79 -0
  53. package/lib/exercises/math/derivation/index.d.ts +1 -0
  54. package/lib/exercises/math/derivation/index.d.ts.map +1 -1
  55. package/lib/exercises/math/derivation/index.js +1 -0
  56. package/lib/exercises/math/derivation/tangent/index.d.ts +2 -0
  57. package/lib/exercises/math/derivation/tangent/index.d.ts.map +1 -0
  58. package/lib/exercises/math/derivation/tangent/index.js +17 -0
  59. package/lib/exercises/math/derivation/tangent/tangentEquations.d.ts +8 -0
  60. package/lib/exercises/math/derivation/tangent/tangentEquations.d.ts.map +1 -0
  61. package/lib/exercises/math/derivation/tangent/tangentEquations.js +70 -0
  62. package/lib/exercises/math/equaDiff/equaDiffAyPlusB.d.ts +8 -0
  63. package/lib/exercises/math/equaDiff/equaDiffAyPlusB.d.ts.map +1 -0
  64. package/lib/exercises/math/equaDiff/equaDiffAyPlusB.js +85 -0
  65. package/lib/exercises/math/equaDiff/index.d.ts +1 -0
  66. package/lib/exercises/math/equaDiff/index.d.ts.map +1 -1
  67. package/lib/exercises/math/equaDiff/index.js +1 -0
  68. package/lib/exercises/math/functions/affines/affineAdjustment.d.ts +10 -0
  69. package/lib/exercises/math/functions/affines/affineAdjustment.d.ts.map +1 -0
  70. package/lib/exercises/math/functions/affines/affineAdjustment.js +106 -0
  71. package/lib/exercises/math/functions/affines/affineAdjustmentComplete.d.ts +11 -0
  72. package/lib/exercises/math/functions/affines/affineAdjustmentComplete.d.ts.map +1 -0
  73. package/lib/exercises/math/functions/affines/affineAdjustmentComplete.js +125 -0
  74. package/lib/exercises/math/functions/affines/affineAdjustmentRsquared.d.ts +7 -0
  75. package/lib/exercises/math/functions/affines/affineAdjustmentRsquared.d.ts.map +1 -0
  76. package/lib/exercises/math/functions/affines/affineAdjustmentRsquared.js +100 -0
  77. package/lib/exercises/math/functions/affines/algebricExpressionOfAffine.d.ts +8 -0
  78. package/lib/exercises/math/functions/affines/algebricExpressionOfAffine.d.ts.map +1 -0
  79. package/lib/exercises/math/functions/affines/algebricExpressionOfAffine.js +55 -0
  80. package/lib/exercises/math/functions/affines/index.d.ts +5 -0
  81. package/lib/exercises/math/functions/affines/index.d.ts.map +1 -1
  82. package/lib/exercises/math/functions/affines/index.js +5 -0
  83. package/lib/exercises/math/functions/affines/leadingCoeffAndOriginOrdinate.d.ts +9 -0
  84. package/lib/exercises/math/functions/affines/leadingCoeffAndOriginOrdinate.d.ts.map +1 -0
  85. package/lib/exercises/math/functions/affines/leadingCoeffAndOriginOrdinate.js +61 -0
  86. package/lib/exercises/math/geometry/cartesian/cartesianEquationOfLine.d.ts +10 -0
  87. package/lib/exercises/math/geometry/cartesian/cartesianEquationOfLine.d.ts.map +1 -0
  88. package/lib/exercises/math/geometry/cartesian/cartesianEquationOfLine.js +172 -0
  89. package/lib/exercises/math/geometry/cartesian/directionVector.d.ts +8 -0
  90. package/lib/exercises/math/geometry/cartesian/directionVector.d.ts.map +1 -0
  91. package/lib/exercises/math/geometry/cartesian/directionVector.js +106 -0
  92. package/lib/exercises/math/geometry/cartesian/directionVectorEquation.d.ts +8 -0
  93. package/lib/exercises/math/geometry/cartesian/directionVectorEquation.d.ts.map +1 -0
  94. package/lib/exercises/math/geometry/cartesian/directionVectorEquation.js +100 -0
  95. package/lib/exercises/math/geometry/cartesian/index.d.ts +4 -0
  96. package/lib/exercises/math/geometry/cartesian/index.d.ts.map +1 -1
  97. package/lib/exercises/math/geometry/cartesian/index.js +4 -0
  98. package/lib/exercises/math/geometry/cartesian/pointCoordinates.d.ts +8 -0
  99. package/lib/exercises/math/geometry/cartesian/pointCoordinates.d.ts.map +1 -0
  100. package/lib/exercises/math/geometry/cartesian/pointCoordinates.js +76 -0
  101. package/lib/exercises/math/geometry/convexity/convexityQuadrinomialsGeo.d.ts +8 -0
  102. package/lib/exercises/math/geometry/convexity/convexityQuadrinomialsGeo.d.ts.map +1 -0
  103. package/lib/exercises/math/geometry/convexity/convexityQuadrinomialsGeo.js +135 -0
  104. package/lib/exercises/math/geometry/convexity/convexityTrinomialsGeo.d.ts +7 -0
  105. package/lib/exercises/math/geometry/convexity/convexityTrinomialsGeo.d.ts.map +1 -0
  106. package/lib/exercises/math/geometry/convexity/convexityTrinomialsGeo.js +61 -0
  107. package/lib/exercises/math/geometry/convexity/index.d.ts +3 -0
  108. package/lib/exercises/math/geometry/convexity/index.d.ts.map +1 -0
  109. package/lib/exercises/math/geometry/convexity/index.js +18 -0
  110. package/lib/exercises/math/geometry/index.d.ts +1 -0
  111. package/lib/exercises/math/geometry/index.d.ts.map +1 -1
  112. package/lib/exercises/math/geometry/index.js +1 -0
  113. package/lib/exercises/math/geometry/vectors/index.d.ts +3 -0
  114. package/lib/exercises/math/geometry/vectors/index.d.ts.map +1 -1
  115. package/lib/exercises/math/geometry/vectors/index.js +3 -0
  116. package/lib/exercises/math/geometry/vectors/lineFromDirectorVector.d.ts +10 -0
  117. package/lib/exercises/math/geometry/vectors/lineFromDirectorVector.d.ts.map +1 -0
  118. package/lib/exercises/math/geometry/vectors/lineFromDirectorVector.js +112 -0
  119. package/lib/exercises/math/geometry/vectors/vectorLinearCombination.d.ts +14 -0
  120. package/lib/exercises/math/geometry/vectors/vectorLinearCombination.d.ts.map +1 -0
  121. package/lib/exercises/math/geometry/vectors/vectorLinearCombination.js +99 -0
  122. package/lib/exercises/math/geometry/vectors/vectorNormCalculation.d.ts +8 -0
  123. package/lib/exercises/math/geometry/vectors/vectorNormCalculation.d.ts.map +1 -0
  124. package/lib/exercises/math/geometry/vectors/vectorNormCalculation.js +61 -0
  125. package/lib/exercises/math/index.d.ts +1 -0
  126. package/lib/exercises/math/index.d.ts.map +1 -1
  127. package/lib/exercises/math/index.js +1 -0
  128. package/lib/exercises/math/percent/findProportion.js +1 -1
  129. package/lib/exercises/math/probaStat/probaFromTableNoContext.js +3 -3
  130. package/lib/exercises/math/probaStat/stats2var/fineAdjustementExercise.d.ts +7 -0
  131. package/lib/exercises/math/probaStat/stats2var/fineAdjustementExercise.d.ts.map +1 -0
  132. package/lib/exercises/math/probaStat/stats2var/fineAdjustementExercise.js +97 -0
  133. package/lib/exercises/math/probaStat/stats2var/index.d.ts +1 -0
  134. package/lib/exercises/math/probaStat/stats2var/index.d.ts.map +1 -1
  135. package/lib/exercises/math/probaStat/stats2var/index.js +1 -0
  136. package/lib/exercises/math/python/conditionIf.d.ts +9 -0
  137. package/lib/exercises/math/python/conditionIf.d.ts.map +1 -0
  138. package/lib/exercises/math/python/conditionIf.js +66 -0
  139. package/lib/exercises/math/python/forLoop.d.ts +10 -0
  140. package/lib/exercises/math/python/forLoop.d.ts.map +1 -0
  141. package/lib/exercises/math/python/forLoop.js +90 -0
  142. package/lib/exercises/math/python/inOutCalcul.d.ts +10 -0
  143. package/lib/exercises/math/python/inOutCalcul.d.ts.map +1 -0
  144. package/lib/exercises/math/python/inOutCalcul.js +71 -0
  145. package/lib/exercises/math/python/index.d.ts +8 -0
  146. package/lib/exercises/math/python/index.d.ts.map +1 -1
  147. package/lib/exercises/math/python/index.js +23 -0
  148. package/lib/exercises/math/python/pyForLoop1Exercise.d.ts +13 -0
  149. package/lib/exercises/math/python/pyForLoop1Exercise.d.ts.map +1 -0
  150. package/lib/exercises/math/python/pyForLoop1Exercise.js +144 -0
  151. package/lib/exercises/math/python/pyNestedForLoopExercise.d.ts +12 -0
  152. package/lib/exercises/math/python/pyNestedForLoopExercise.d.ts.map +1 -0
  153. package/lib/exercises/math/python/pyNestedForLoopExercise.js +84 -0
  154. package/lib/exercises/math/python/pyWhileLoop1Exercise.d.ts +12 -0
  155. package/lib/exercises/math/python/pyWhileLoop1Exercise.d.ts.map +1 -0
  156. package/lib/exercises/math/python/pyWhileLoop1Exercise.js +114 -0
  157. package/lib/exercises/math/python/pythonFunctionTrinom.d.ts +9 -0
  158. package/lib/exercises/math/python/pythonFunctionTrinom.d.ts.map +1 -0
  159. package/lib/exercises/math/python/pythonFunctionTrinom.js +63 -0
  160. package/lib/exercises/math/python/whileLoop.d.ts +12 -0
  161. package/lib/exercises/math/python/whileLoop.d.ts.map +1 -0
  162. package/lib/exercises/math/python/whileLoop.js +78 -0
  163. package/lib/exercises/pc/electricity/electricChargeFromIntensity.js +1 -1
  164. package/lib/exercises/pc/mole/molFromMass.js +1 -1
  165. package/lib/exercises/pc/mole/molFromMolarMass.js +1 -1
  166. package/lib/exercises/pc/potentialEnergy.d.ts.map +1 -1
  167. package/lib/exercises/pc/potentialEnergy.js +4 -5
  168. package/lib/exercises/pc/waves/periodicWaveCelerity.js +1 -1
  169. package/lib/index.d.ts +152 -0
  170. package/lib/index.d.ts.map +1 -1
  171. package/lib/math/geometry/CloudPoints.d.ts +14 -0
  172. package/lib/math/geometry/CloudPoints.d.ts.map +1 -0
  173. package/lib/math/geometry/CloudPoints.js +94 -0
  174. package/lib/math/geometry/line.d.ts +4 -0
  175. package/lib/math/geometry/line.d.ts.map +1 -1
  176. package/lib/math/geometry/line.js +25 -0
  177. package/lib/math/geometry/vector.d.ts +5 -0
  178. package/lib/math/geometry/vector.d.ts.map +1 -1
  179. package/lib/math/geometry/vector.js +31 -0
  180. package/lib/math/polynomials/polynomial.d.ts +1 -0
  181. package/lib/math/polynomials/polynomial.d.ts.map +1 -1
  182. package/lib/math/polynomials/polynomial.js +10 -2
  183. package/lib/math/polynomials/trinom.d.ts +1 -0
  184. package/lib/math/polynomials/trinom.d.ts.map +1 -1
  185. package/lib/math/polynomials/trinom.js +28 -0
  186. package/lib/math/utils/arithmetic/factorial.d.ts +2 -0
  187. package/lib/math/utils/arithmetic/factorial.d.ts.map +1 -0
  188. package/lib/math/utils/arithmetic/factorial.js +10 -0
  189. package/lib/math/utils/covariance.d.ts +4 -0
  190. package/lib/math/utils/covariance.d.ts.map +1 -0
  191. package/lib/math/utils/covariance.js +26 -0
  192. package/lib/math/utils/functions/expUDerivate.d.ts +5 -0
  193. package/lib/math/utils/functions/expUDerivate.d.ts.map +1 -0
  194. package/lib/math/utils/functions/expUDerivate.js +9 -0
  195. package/lib/math/utils/functions/expUSecondDerivate.d.ts +5 -0
  196. package/lib/math/utils/functions/expUSecondDerivate.d.ts.map +1 -0
  197. package/lib/math/utils/functions/expUSecondDerivate.js +12 -0
  198. package/lib/math/utils/variance.d.ts +4 -0
  199. package/lib/math/utils/variance.d.ts.map +1 -0
  200. package/lib/math/utils/variance.js +27 -0
  201. package/lib/server.d.ts.map +1 -1
  202. package/lib/tree/nodes/sets/intervalNode.d.ts +1 -1
  203. package/lib/tree/nodes/sets/intervalNode.d.ts.map +1 -1
  204. package/lib/tree/nodes/sets/intervalNode.js +2 -2
  205. package/package.json +3 -3
package/lib/index.d.ts CHANGED
@@ -167,6 +167,8 @@ declare const mathExercises: (import("./exercises/exercise").Exercise<{
167
167
  }> | import("./exercises/exercise").Exercise<{
168
168
  a: number;
169
169
  b: number;
170
+ c: number;
171
+ d: number;
170
172
  }> | import("./exercises/exercise").Exercise<{
171
173
  a: number;
172
174
  b: number;
@@ -175,9 +177,27 @@ declare const mathExercises: (import("./exercises/exercise").Exercise<{
175
177
  }> | import("./exercises/exercise").Exercise<{
176
178
  a: number;
177
179
  b: number;
180
+ x: number;
181
+ }> | import("./exercises/exercise").Exercise<{
182
+ a: number;
183
+ x: number;
184
+ b: number;
185
+ c: number;
186
+ }> | import("./exercises/exercise").Exercise<{
187
+ a: number;
188
+ x: number;
189
+ b: number;
178
190
  c: number;
179
191
  d: number;
180
192
  }> | import("./exercises/exercise").Exercise<{
193
+ type: number;
194
+ vars: {
195
+ flip: boolean;
196
+ resultNb: number;
197
+ randAdd?: number | undefined;
198
+ op2?: string | undefined;
199
+ };
200
+ }> | import("./exercises/exercise").Exercise<{}> | import("./exercises/exercise").Exercise<{
181
201
  a: number;
182
202
  b: number;
183
203
  }> | import("./exercises/exercise").Exercise<{
@@ -417,12 +437,37 @@ declare const mathExercises: (import("./exercises/exercise").Exercise<{
417
437
  affineA: number;
418
438
  affineB: number;
419
439
  power: number;
440
+ }> | import("./exercises/exercise").Exercise<{
441
+ affinecoeffs: number[];
442
+ }> | import("./exercises/exercise").Exercise<{
443
+ affinecoeffs: number[];
444
+ }> | import("./exercises/exercise").Exercise<{
445
+ coeffs: number[];
446
+ }> | import("./exercises/exercise").Exercise<{
447
+ askConvex: boolean;
448
+ quadcoeffs: number[];
449
+ }> | import("./exercises/exercise").Exercise<{
450
+ quadcoeffs: number[];
451
+ }> | import("./exercises/exercise").Exercise<{
452
+ a: number;
453
+ b: number;
454
+ c: number;
455
+ }> | import("./exercises/exercise").Exercise<{
456
+ a: number;
457
+ b: number;
458
+ c: number;
459
+ d: number;
460
+ }> | import("./exercises/exercise").Exercise<{
461
+ coeffs: number[];
420
462
  }> | import("./exercises/exercise").Exercise<{
421
463
  coeffs: number[];
422
464
  x: number;
423
465
  }> | import("./exercises/exercise").Exercise<{
424
466
  A: number[];
425
467
  B: number[];
468
+ }> | import("./exercises/exercise").Exercise<{
469
+ abscisse: number;
470
+ trinome: number[];
426
471
  }> | import("./exercises/exercise").Exercise<{
427
472
  a: number;
428
473
  }> | import("./exercises/exercise").Exercise<{
@@ -436,6 +481,9 @@ declare const mathExercises: (import("./exercises/exercise").Exercise<{
436
481
  }> | import("./exercises/exercise").Exercise<{
437
482
  a: number;
438
483
  b: number;
484
+ }> | import("./exercises/exercise").Exercise<{
485
+ a: number;
486
+ b: number;
439
487
  }> | import("./exercises/exercise").Exercise<{
440
488
  a: number;
441
489
  b: number;
@@ -465,6 +513,26 @@ declare const mathExercises: (import("./exercises/exercise").Exercise<{
465
513
  }> | import("./exercises/exercise").Exercise<{
466
514
  b: number;
467
515
  secondPoint: number[];
516
+ }> | import("./exercises/exercise").Exercise<{
517
+ a: number;
518
+ b: number;
519
+ }> | import("./exercises/exercise").Exercise<{
520
+ a: number;
521
+ b: number;
522
+ isAskingA: boolean;
523
+ }> | import("./exercises/exercise").Exercise<{
524
+ G1x: number;
525
+ G2x: number;
526
+ G2y: number;
527
+ G1y: number;
528
+ }> | import("./exercises/exercise").Exercise<{
529
+ rSquared: number;
530
+ }> | import("./exercises/exercise").Exercise<{
531
+ G1x: number;
532
+ G2x: number;
533
+ G2y: number;
534
+ G1y: number;
535
+ rSquared: number;
468
536
  }> | import("./exercises/exercise").Exercise<{
469
537
  rand: boolean;
470
538
  poly1: number[];
@@ -641,6 +709,20 @@ declare const mathExercises: (import("./exercises/exercise").Exercise<{
641
709
  }> | import("./exercises/exercise").Exercise<{
642
710
  coordsA: number[];
643
711
  coordsB: number[];
712
+ }> | import("./exercises/exercise").Exercise<{
713
+ aX: number;
714
+ aY: number;
715
+ bX: number;
716
+ bY: number;
717
+ }> | import("./exercises/exercise").Exercise<{
718
+ x: number;
719
+ y: number;
720
+ }> | import("./exercises/exercise").Exercise<{
721
+ xValue: number;
722
+ yValue: number;
723
+ }> | import("./exercises/exercise").Exercise<{
724
+ xValue: number;
725
+ yValue: number;
644
726
  }> | import("./exercises/exercise").Exercise<{
645
727
  coin: boolean;
646
728
  radius: number;
@@ -730,6 +812,30 @@ declare const mathExercises: (import("./exercises/exercise").Exercise<{
730
812
  caracAsked: string;
731
813
  uPoints: number[][];
732
814
  vPoints: number[][];
815
+ }> | import("./exercises/exercise").Exercise<{
816
+ a: number;
817
+ b: number;
818
+ u: {
819
+ x: number;
820
+ y: number;
821
+ };
822
+ v: {
823
+ x: number;
824
+ y: number;
825
+ };
826
+ }> | import("./exercises/exercise").Exercise<{
827
+ x: number;
828
+ y: number;
829
+ }> | import("./exercises/exercise").Exercise<{
830
+ uX: number;
831
+ uY: number;
832
+ aX: number;
833
+ aY: number;
834
+ }> | import("./exercises/exercise").Exercise<{
835
+ trinom: number[];
836
+ }> | import("./exercises/exercise").Exercise<{
837
+ askConvex: boolean;
838
+ quadcoeffs: number[];
733
839
  }> | import("./exercises/exercise").Exercise<{
734
840
  coeffs: number[];
735
841
  to: string;
@@ -891,6 +997,8 @@ declare const mathExercises: (import("./exercises/exercise").Exercise<{
891
997
  }> | import("./exercises/exercise").Exercise<{
892
998
  xValues: number[];
893
999
  yValues: number[];
1000
+ }> | import("./exercises/exercise").Exercise<{
1001
+ isJustified: boolean;
894
1002
  }> | import("./exercises/exercise").Exercise<{
895
1003
  pA: number;
896
1004
  pB: number;
@@ -1099,6 +1207,50 @@ declare const mathExercises: (import("./exercises/exercise").Exercise<{
1099
1207
  randSideQuestion: number;
1100
1208
  }> | import("./exercises/exercise").Exercise<{
1101
1209
  angleValue: number;
1210
+ }> | import("./exercises/exercise").Exercise<{
1211
+ exercise: {
1212
+ a: number;
1213
+ nbIteration: number;
1214
+ op: string;
1215
+ b?: number | undefined;
1216
+ };
1217
+ }> | import("./exercises/exercise").Exercise<{
1218
+ exercise: {
1219
+ a: number;
1220
+ b: number;
1221
+ op: string;
1222
+ };
1223
+ }> | import("./exercises/exercise").Exercise<{
1224
+ a: number;
1225
+ b: number;
1226
+ id1: number;
1227
+ id2: number;
1228
+ }> | import("./exercises/exercise").Exercise<{
1229
+ initialValue: number;
1230
+ step: number;
1231
+ iterations: number;
1232
+ opIndex: number;
1233
+ }> | import("./exercises/exercise").Exercise<{
1234
+ initialValue: number;
1235
+ step: number;
1236
+ iterations: number;
1237
+ opIndex: number;
1238
+ a: number;
1239
+ x: number;
1240
+ }> | import("./exercises/exercise").Exercise<{
1241
+ x: number;
1242
+ trinom: number[];
1243
+ image: number;
1244
+ }> | import("./exercises/exercise").Exercise<{
1245
+ a: number;
1246
+ b: number;
1247
+ opresult: number;
1248
+ }> | import("./exercises/exercise").Exercise<{
1249
+ exercise: {
1250
+ op: string;
1251
+ n: number;
1252
+ p: number;
1253
+ };
1102
1254
  }>)[];
1103
1255
  declare const pcExercises: (import("./exercises/exercise").Exercise<{
1104
1256
  numbers: number[];
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAG3D,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,MAAM,EAAE,MAAM,aAAa,CAAC;QAC5B,SAAS,EAAE,MAAM,MAAM,CAAC;QACxB,YAAY,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,KAAK,aAAa,CAAC;KACpD;CACF;AAcD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+BE;AAEF,QAAA,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAjCnB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MA+BE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA/BF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MA+BE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAEgD,CAAC;AACnD,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAA6B,CAAC;AAE/C,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { Point } from "./point";
2
+ import { EqualNode } from "../../tree/nodes/equations/equalNode";
3
+ import { NumberNode } from "../../tree/nodes/numbers/numberNode";
4
+ export declare abstract class CloudPointsConstructor {
5
+ static random(nbPoints: number): CloudPoints;
6
+ static randomLinear(nbPoints: number): CloudPoints;
7
+ }
8
+ export declare class CloudPoints {
9
+ points: Point[];
10
+ constructor(points: Point[]);
11
+ getFineAdjustement(): EqualNode;
12
+ getCorrelationCoeff(): NumberNode;
13
+ }
14
+ //# sourceMappingURL=CloudPoints.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CloudPoints.d.ts","sourceRoot":"","sources":["../../../src/math/geometry/CloudPoints.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAoB,MAAM,SAAS,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AAGjE,OAAO,EAAE,UAAU,EAAgB,MAAM,qCAAqC,CAAC;AAM/E,8BAAsB,sBAAsB;IAC1C,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM;IAQ9B,MAAM,CAAC,YAAY,CAAC,QAAQ,EAAE,MAAM;CAyBrC;AAED,qBAAa,WAAW;IACtB,MAAM,EAAE,KAAK,EAAE,CAAC;gBAEJ,MAAM,EAAE,KAAK,EAAE;IAI3B,kBAAkB,IAAI,SAAS;IA8C/B,mBAAmB;CAsBpB"}
@@ -0,0 +1,94 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CloudPoints = exports.CloudPointsConstructor = void 0;
4
+ const point_1 = require("./point");
5
+ const equalNode_1 = require("../../tree/nodes/equations/equalNode");
6
+ const multiplyNode_1 = require("../../tree/nodes/operators/multiplyNode");
7
+ const variableNode_1 = require("../../tree/nodes/variables/variableNode");
8
+ const numberNode_1 = require("../../tree/nodes/numbers/numberNode");
9
+ const addNode_1 = require("../../tree/nodes/operators/addNode");
10
+ const randint_1 = require("../utils/random/randint");
11
+ const covariance_1 = require("../utils/covariance");
12
+ const variance_1 = require("../utils/variance");
13
+ class CloudPointsConstructor {
14
+ static random(nbPoints) {
15
+ const names = [];
16
+ for (let i = 0; i < nbPoints; i++) {
17
+ names.push(`a${i}`);
18
+ }
19
+ return new CloudPoints(point_1.PointConstructor.randomDifferent(names));
20
+ }
21
+ static randomLinear(nbPoints) {
22
+ const points = [];
23
+ const deltaX = (0, randint_1.randint)(2, 6, [0]);
24
+ const deltaY = (0, randint_1.randint)(2, 6, [0]);
25
+ const a = (0, randint_1.randint)(-5, 6, [0]);
26
+ const b = (0, randint_1.randint)(-5, 6);
27
+ for (let i = -nbPoints * 2; i < nbPoints * 2; i += 4) {
28
+ points.push(new point_1.Point(`a${i + nbPoints * 2}`, new numberNode_1.NumberNode(i), new numberNode_1.NumberNode(a * i + b)));
29
+ }
30
+ points.forEach((point) => {
31
+ const x = point.getXnumber();
32
+ const y = point.getYnumber();
33
+ point.y = new numberNode_1.NumberNode(y + (0, randint_1.randint)(-deltaX, deltaX + 1));
34
+ point.x = new numberNode_1.NumberNode(x + (0, randint_1.randint)(-deltaY, deltaY + 1, [deltaX, -deltaX]));
35
+ });
36
+ return new CloudPoints(points);
37
+ }
38
+ }
39
+ exports.CloudPointsConstructor = CloudPointsConstructor;
40
+ class CloudPoints {
41
+ constructor(points) {
42
+ this.points = points;
43
+ }
44
+ getFineAdjustement() {
45
+ const xValues = this.points.map((element) => {
46
+ return element.getXnumber();
47
+ });
48
+ const yValues = this.points.map((element) => {
49
+ return element.getYnumber();
50
+ });
51
+ const avgX = xValues.reduce((accumulator, nb) => {
52
+ return accumulator + nb;
53
+ }) / this.points.length;
54
+ const avgY = yValues.reduce((accumulator, nb) => {
55
+ return accumulator + nb;
56
+ }) / this.points.length;
57
+ const avgXsquare = xValues
58
+ .map((point) => {
59
+ return point * point;
60
+ })
61
+ .reduce((acc, nb) => {
62
+ return acc + nb;
63
+ }) / this.points.length;
64
+ const avgXY = xValues
65
+ .map((point, i) => {
66
+ return point * yValues[i];
67
+ })
68
+ .reduce((acc, nb) => {
69
+ return acc + nb;
70
+ }) / this.points.length;
71
+ const a = (avgXY - avgX * avgY) / (avgXsquare * Math.pow(avgX, avgX));
72
+ const b = avgY - a * avgX;
73
+ return new equalNode_1.EqualNode(new variableNode_1.VariableNode("y"), new addNode_1.AddNode(new multiplyNode_1.MultiplyNode(new numberNode_1.NumberNode(+a.toFixed(2)), new variableNode_1.VariableNode("x")).simplify(), new numberNode_1.NumberNode(+b.toFixed(2))));
74
+ }
75
+ getCorrelationCoeff() {
76
+ const xValues = this.points.map((point) => {
77
+ return point.getXnumber();
78
+ });
79
+ const yValues = this.points.map((point) => {
80
+ return point.getYnumber();
81
+ });
82
+ const avgX = xValues.reduce((accumulator, nb) => {
83
+ return accumulator + nb;
84
+ }) / this.points.length;
85
+ const avgY = yValues.reduce((accumulator, nb) => {
86
+ return accumulator + nb;
87
+ }) / this.points.length;
88
+ const covXY = (0, covariance_1.covarianceXY)(xValues, avgX, yValues, avgY);
89
+ const xVariance = (0, variance_1.variance)(xValues, avgX);
90
+ const yVariance = (0, variance_1.variance)(yValues, avgY);
91
+ return new numberNode_1.NumberNode(+(covXY / Math.sqrt(xVariance * yVariance)).toFixed(2));
92
+ }
93
+ }
94
+ exports.CloudPoints = CloudPoints;
@@ -1,5 +1,7 @@
1
1
  import { AlgebraicNode } from "../../tree/nodes/algebraicNode";
2
+ import { EqualNode } from "../../tree/nodes/equations/equalNode";
2
3
  import { Point } from "./point";
4
+ import { Vector } from "./vector";
3
5
  export declare class Line {
4
6
  pointA: Point;
5
7
  pointB: Point;
@@ -10,5 +12,7 @@ export declare class Line {
10
12
  getParallele(point: Point): Line;
11
13
  includes(point: Point): boolean;
12
14
  getRandomPoint(name?: string): Point;
15
+ getEquation: (u: Vector, a: Point) => EqualNode;
16
+ getCartesianEquation(): EqualNode;
13
17
  }
14
18
  //# sourceMappingURL=line.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"line.d.ts","sourceRoot":"","sources":["../../../src/math/geometry/line.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAO/D,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,qBAAa,IAAI;IACf,MAAM,EAAE,KAAK,CAAC;IACd,MAAM,EAAE,KAAK,CAAC;IACd,UAAU,EAAE,OAAO,CAAC;IACpB,CAAC,EAAE,aAAa,GAAG,SAAS,CAAC;IAC7B,CAAC,EAAE,aAAa,GAAG,SAAS,CAAC;gBACjB,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK;IAkBxC,YAAY,CAAC,KAAK,EAAE,KAAK;IAUzB,QAAQ,CAAC,KAAK,EAAE,KAAK;IAarB,cAAc,CAAC,IAAI,CAAC,EAAE,MAAM;CAa7B"}
1
+ {"version":3,"file":"line.d.ts","sourceRoot":"","sources":["../../../src/math/geometry/line.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AAQjE,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,qBAAa,IAAI;IACf,MAAM,EAAE,KAAK,CAAC;IACd,MAAM,EAAE,KAAK,CAAC;IACd,UAAU,EAAE,OAAO,CAAC;IACpB,CAAC,EAAE,aAAa,GAAG,SAAS,CAAC;IAC7B,CAAC,EAAE,aAAa,GAAG,SAAS,CAAC;gBACjB,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK;IAkBxC,YAAY,CAAC,KAAK,EAAE,KAAK;IAUzB,QAAQ,CAAC,KAAK,EAAE,KAAK;IAarB,cAAc,CAAC,IAAI,CAAC,EAAE,MAAM;IAc5B,WAAW,MAAO,MAAM,KAAK,KAAK,KAAG,SAAS,CAmB5C;IAEF,oBAAoB,IAAI,SAAS;CAsBlC"}
@@ -1,15 +1,31 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Line = void 0;
4
+ const equalNode_1 = require("../../tree/nodes/equations/equalNode");
4
5
  const numberNode_1 = require("../../tree/nodes/numbers/numberNode");
5
6
  const addNode_1 = require("../../tree/nodes/operators/addNode");
6
7
  const fractionNode_1 = require("../../tree/nodes/operators/fractionNode");
7
8
  const multiplyNode_1 = require("../../tree/nodes/operators/multiplyNode");
8
9
  const substractNode_1 = require("../../tree/nodes/operators/substractNode");
10
+ const variableNode_1 = require("../../tree/nodes/variables/variableNode");
9
11
  const randint_1 = require("../utils/random/randint");
10
12
  const point_1 = require("./point");
13
+ const vector_1 = require("./vector");
11
14
  class Line {
12
15
  constructor(pointA, pointB) {
16
+ this.getEquation = (u, a) => {
17
+ const x = new variableNode_1.VariableNode("x");
18
+ const y = new variableNode_1.VariableNode("y");
19
+ const uYDivuX = new fractionNode_1.FractionNode(u.y, u.x).simplify();
20
+ const natural = u.getYAsNumber() % u.getXAsNumber() === 0;
21
+ const aYuX = new multiplyNode_1.MultiplyNode(a.y, u.x).simplify();
22
+ const aXuY = new multiplyNode_1.MultiplyNode(a.x, u.y).simplify();
23
+ const rightSide = new addNode_1.AddNode(natural
24
+ ? new multiplyNode_1.MultiplyNode(uYDivuX, x).simplify()
25
+ : new multiplyNode_1.MultiplyNode(uYDivuX, x), new fractionNode_1.FractionNode(new substractNode_1.SubstractNode(aYuX, aXuY).simplify(), u.x).simplify());
26
+ const equation = new equalNode_1.EqualNode(y, rightSide);
27
+ return equation;
28
+ };
13
29
  this.pointA = pointA;
14
30
  this.pointB = pointB;
15
31
  this.isVertical = pointA.x.equals(pointB.x);
@@ -48,5 +64,14 @@ class Line {
48
64
  console.log(y.toTex(), this.a.toTex(), x.toTex(), this.b?.toTex());
49
65
  return new point_1.Point(name ?? "A", x, y);
50
66
  }
67
+ getCartesianEquation() {
68
+ const u = new vector_1.Vector("u", new numberNode_1.NumberNode(this.pointB.getXnumber() - this.pointA.getXnumber()), new numberNode_1.NumberNode(this.pointB.getYnumber() - this.pointA.getYnumber()));
69
+ const b = -u.getXAsNumber();
70
+ const a = u.getYAsNumber();
71
+ const c = -a * this.pointA.getXnumber() - b * this.pointA.getYnumber();
72
+ const x = new variableNode_1.VariableNode("x");
73
+ const y = new variableNode_1.VariableNode("y");
74
+ return new equalNode_1.EqualNode(new addNode_1.AddNode(new addNode_1.AddNode(new multiplyNode_1.MultiplyNode(new numberNode_1.NumberNode(a), x).simplify(), new multiplyNode_1.MultiplyNode(new numberNode_1.NumberNode(b), y).simplify()), new numberNode_1.NumberNode(c)).simplify({ forbidFactorize: true }), new numberNode_1.NumberNode(0));
75
+ }
51
76
  }
52
77
  exports.Line = Line;
@@ -13,11 +13,16 @@ export declare class Vector {
13
13
  constructor(name: string, x: AlgebraicNode, y: AlgebraicNode);
14
14
  toTex(): string;
15
15
  toTexWithCoords(): string;
16
+ toInlineCoordsTex(): string;
16
17
  isColinear(v: Vector): boolean;
17
18
  determinant(v: Vector): AlgebraicNode;
18
19
  times(k: AlgebraicNode, name?: string): Vector;
19
20
  scalarProduct(v: Vector): Node;
21
+ add(v: Vector): Vector;
22
+ getNorm(): AlgebraicNode;
20
23
  getEndPoint(startPoint: Point, name?: string): Point;
21
24
  equals(v: Vector): boolean;
25
+ getXAsNumber(): number;
26
+ getYAsNumber(): number;
22
27
  }
23
28
  //# sourceMappingURL=vector.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"vector.d.ts","sourceRoot":"","sources":["../../../src/math/geometry/vector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,IAAI,EAAY,MAAM,uBAAuB,CAAC;AAMvD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,8BAAsB,iBAAiB;IACrC,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,GAAG,MAAM;IAOpD,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,UAAO,GAAG,MAAM;CAOtD;AAED,qBAAa,MAAM;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,CAAC,EAAE,aAAa,CAAC;IACjB,CAAC,EAAE,aAAa,CAAC;gBACL,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,aAAa,EAAE,CAAC,EAAE,aAAa;IAO5D,KAAK,IAAI,MAAM;IAIf,eAAe,IAAI,MAAM;IAMzB,UAAU,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO;IAI9B,WAAW,CAAC,CAAC,E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tB,OAAO,IAAI,aAAa;IAUxB,WAAW,CAAC,UAAU,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,MAAM;IAO5C,MAAM,CAAC,CAAC,EAAE,MAAM;IAIhB,YAAY;IAMZ,YAAY;CAMb"}
@@ -1,10 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Vector = exports.VectorConstructor = void 0;
4
+ const sqrtNode_1 = require("../../tree/nodes/functions/sqrtNode");
4
5
  const node_1 = require("../../tree/nodes/node");
5
6
  const numberNode_1 = require("../../tree/nodes/numbers/numberNode");
6
7
  const addNode_1 = require("../../tree/nodes/operators/addNode");
7
8
  const multiplyNode_1 = require("../../tree/nodes/operators/multiplyNode");
9
+ const powerNode_1 = require("../../tree/nodes/operators/powerNode");
8
10
  const substractNode_1 = require("../../tree/nodes/operators/substractNode");
9
11
  const randint_1 = require("../utils/random/randint");
10
12
  const point_1 = require("./point");
@@ -32,6 +34,11 @@ class Vector {
32
34
  toTexWithCoords() {
33
35
  return `\\overrightarrow{${this.name}}\\begin{pmatrix}${this.x.toTex()} \\\\ ${this.y.toTex()} \\end{pmatrix}`;
34
36
  }
37
+ toInlineCoordsTex() {
38
+ return `\\left(${this.x.simplify().toTex()};${this.y
39
+ .simplify()
40
+ .toTex()}\\right)`;
41
+ }
35
42
  isColinear(v) {
36
43
  const det = this.determinant(v);
37
44
  return det.evaluate({}) === 0;
@@ -57,11 +64,35 @@ class Vector {
57
64
  const vyValue = v.y.value;
58
65
  return new numberNode_1.NumberNode(xValue * vxValue + yValue * vyValue);
59
66
  }
67
+ add(v) {
68
+ const x = v.x;
69
+ const y = v.y;
70
+ const resultX = new addNode_1.AddNode(this.x, x);
71
+ const resultY = new addNode_1.AddNode(this.y, y);
72
+ return new Vector(`${this.name}+${v.name}`, resultX.simplify(), resultY.simplify());
73
+ }
74
+ getNorm() {
75
+ const xValue = this.x.simplify().value;
76
+ const yValue = this.y.simplify().value;
77
+ return new sqrtNode_1.SqrtNode(new addNode_1.AddNode(new powerNode_1.SquareNode(new numberNode_1.NumberNode(xValue)), new powerNode_1.SquareNode(new numberNode_1.NumberNode(yValue))));
78
+ }
60
79
  getEndPoint(startPoint, name) {
61
80
  return new point_1.Point(name ?? "B", new addNode_1.AddNode(startPoint.x, this.x).simplify(), new addNode_1.AddNode(startPoint.y, this.y).simplify());
62
81
  }
63
82
  equals(v) {
64
83
  return this.x.equals(v.x) && this.y.equals(v.y);
65
84
  }
85
+ getXAsNumber() {
86
+ if (!(0, numberNode_1.isNumberNode)(this.x)) {
87
+ throw Error("not implemented for nodes other than NumberNode");
88
+ }
89
+ return this.x.value;
90
+ }
91
+ getYAsNumber() {
92
+ if (!(0, numberNode_1.isNumberNode)(this.y)) {
93
+ throw Error("not implemented for nodes other than NumberNode");
94
+ }
95
+ return this.y.value;
96
+ }
66
97
  }
67
98
  exports.Vector = Vector;
@@ -36,6 +36,7 @@ export declare class Polynomial {
36
36
  scalarDivide(n: number): Polynomial;
37
37
  opposite(): Polynomial;
38
38
  derivate(): Polynomial;
39
+ secondDerivate(): Polynomial;
39
40
  integrateToNode(opts?: NodeOptions): AlgebraicNode;
40
41
  calculate(x: number): number;
41
42
  getLimit(to: "+\\infty" | "-\\infty"): string;
@@ -1 +1 @@
1
- {"version":3,"file":"polynomial.d.ts","sourceRoot":"","sources":["../../../src/math/polynomials/polynomial.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAC;AAcjE,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAE/D,8BAAsB,qBAAqB;IACzC,MAAM,CAAC,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAY;IAa5D,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAY;IActD;;;;;;OAMG;IACH,MA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E,MAAM,GAAG,UAAU;IAqBnC,QAAQ,IAAI,UAAU;IAOtB,QAAQ,IAAI,UAAU;IAWtB,cAAc,IAAI,UAAU;IAiB5B,eAAe,CAAC,IAAI,CAAC,EAAE,WAAW;IA+BlC,SAAS,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM;IAO5B,QAAQ,CAAC,EAAE,EAAE,UAAU,GAAG,UAAU,GAAG,MAAM;IAiB7C,YAAY,CAAC,EAAE,EAAE,UAAU,GAAG,UAAU;IAiBxC,MAAM,CAAC,IAAI,CAAC,EAAE,WAAW;IAuCzB,KAAK,IAAI,MAAM;IAyBf,QAAQ,IAAI,MAAM;CAGnB"}
@@ -235,6 +235,14 @@ class Polynomial {
235
235
  res.push(i * this.coefficients[i]);
236
236
  return new Polynomial(res, this.variable);
237
237
  }
238
+ secondDerivate() {
239
+ if (this.coefficients.length <= 2)
240
+ return new Polynomial([0], this.variable);
241
+ const res = [];
242
+ for (let i = 2; i < this.coefficients.length; i++)
243
+ res.push(i * (i - 1) * this.coefficients[i]);
244
+ return new Polynomial(res, this.variable);
245
+ }
238
246
  // integrate(): Polynomial {
239
247
  // const newCoefficients = this.coefficients.map(
240
248
  // (coeff, exp) => coeff / (exp + 1),
@@ -321,11 +329,11 @@ class Polynomial {
321
329
  toTree(opts) {
322
330
  const recursive = (cursor) => {
323
331
  const coeff = this.coefficients[cursor];
324
- if (coeff === 0)
325
- return recursive(cursor - 1);
326
332
  if (cursor === 0) {
327
333
  return new numberNode_1.NumberNode(coeff);
328
334
  }
335
+ if (coeff === 0)
336
+ return recursive(cursor - 1);
329
337
  const monome = cursor > 1
330
338
  ? new powerNode_1.PowerNode(new variableNode_1.VariableNode(this.variable), new numberNode_1.NumberNode(cursor), opts)
331
339
  : new variableNode_1.VariableNode(this.variable);
@@ -68,5 +68,6 @@ export declare class Trinom extends Polynomial {
68
68
  getCanonicalForm(): MultiplyNode | AddNode;
69
69
  getSommet(): Point;
70
70
  getCoords(): number[];
71
+ toPython(): string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AE;IAoD/B,2BAA2B;IAO3B,QAAQ;IAGR,YAAY;IAIZ,OAAO;IAIP,WAAW;IAIX,iBAAiB;IA4CjB,gBAAgB;IAsBhB,SAAS;IAIT,SAAS;IAYT,QAAQ;CAkCT"}
@@ -199,5 +199,33 @@ class Trinom extends polynomial_1.Polynomial {
199
199
  const yMax = Math.max(1, this.a > 0 ? beta + 5 : beta + 2);
200
200
  return [xMin, xMax, yMin, yMax];
201
201
  }
202
+ toPython() {
203
+ const aString = this.a === 0
204
+ ? ""
205
+ : this.a === 1
206
+ ? "x**2"
207
+ : this.a === -1
208
+ ? "-x**2"
209
+ : `${this.a}*x**2`;
210
+ const bString = this.b === 0
211
+ ? ""
212
+ : this.b === 1
213
+ ? " + x"
214
+ : this.b === -1
215
+ ? " - x"
216
+ : this.b > 0
217
+ ? ` + ${Math.abs(this.b)}*x`
218
+ : ` - ${Math.abs(this.b)}*x`;
219
+ const cString = this.c === 0
220
+ ? ""
221
+ : this.c === 1
222
+ ? " + 1"
223
+ : this.c === -1
224
+ ? " - 1"
225
+ : this.c > 0
226
+ ? ` + ${Math.abs(this.c)}`
227
+ : ` - ${Math.abs(this.c)}`;
228
+ return `${aString}${bString}${cString}`;
229
+ }
202
230
  }
203
231
  exports.Trinom = Trinom;
@@ -0,0 +1,2 @@
1
+ export declare const factorial: (nb: number) => number;
2
+ //# sourceMappingURL=factorial.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"factorial.d.ts","sourceRoot":"","sources":["../../../../src/math/utils/arithmetic/factorial.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,OAAQ,MAAM,KAAG,MAItC,CAAC"}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.factorial = void 0;
4
+ const factorial = (nb) => {
5
+ let result = 1;
6
+ for (let i = 2; i <= nb; i++)
7
+ result = result * i;
8
+ return result;
9
+ };
10
+ exports.factorial = factorial;
@@ -0,0 +1,4 @@
1
+ import { AlgebraicNode } from "../../tree/nodes/algebraicNode";
2
+ export declare function covXYAsNode(xValues: number[], avgX: AlgebraicNode, yValues: number[], avgY: AlgebraicNode): AlgebraicNode;
3
+ export declare function covarianceXY(xValues: number[], avgX: number, yValues: number[], avgY: number): number;
4
+ //# sourceMappingURL=covariance.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"covariance.d.ts","sourceRoot":"","sources":["../../../src/math/utils/covariance.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAO/D,wBAAgB,WAAW,CACzB,OAAO,EAAE,MAAM,EAAE,EACjB,IAAI,EAAE,aAAa,EACnB,OAAO,EAAE,MAAM,EAAE,EACjB,IAAI,EAAE,aAAa,GAClB,aAAa,CAef;AAED,wBAAgB,YAAY,CAC1B,OAAO,EAAE,MAAM,EAAE,EACjB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EAAE,EACjB,IAAI,EAAE,MAAM,GACX,MAAM,CASR"}