pimath 0.0.48 → 0.0.52

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 (114) hide show
  1. package/README.md +1 -1
  2. package/dist/pi.js +617 -351
  3. package/dist/pi.js.map +1 -1
  4. package/dist/pi.min.js +1 -1
  5. package/dist/pi.min.js.map +1 -1
  6. package/docs/assets/highlight.css +78 -78
  7. package/docs/assets/icons.css +1043 -1043
  8. package/docs/assets/main.js +52 -52
  9. package/docs/assets/search.js +1 -1
  10. package/docs/assets/style.css +1413 -1388
  11. package/docs/classes/Logicalset.Logicalset-1.html +5 -0
  12. package/docs/classes/Polynom.Rational.html +4 -0
  13. package/docs/classes/Vector.Point.html +1 -0
  14. package/docs/classes/Vector.Vector-1.html +1 -0
  15. package/docs/classes/algebra_equation.Equation.html +26 -0
  16. package/docs/classes/algebra_linearSystem.LinearSystem.html +1 -0
  17. package/docs/classes/algebra_monom.Monom.html +114 -0
  18. package/docs/classes/algebra_polynom.Polynom.html +30 -0
  19. package/docs/classes/coefficients_fraction.Fraction.html +19 -0
  20. package/docs/classes/coefficients_nthroot.NthRoot.html +3 -0
  21. package/docs/classes/expressions_numexp.NumExp.html +1 -0
  22. package/docs/classes/expressions_polynomexp.PolynomExpFactor.html +1 -0
  23. package/docs/classes/expressions_polynomexp.PolynomExpProduct.html +1 -0
  24. package/docs/classes/geometry_circle.Circle.html +3 -0
  25. package/docs/classes/geometry_line.Line.html +3 -0
  26. package/docs/classes/geometry_triangle.Triangle.html +17 -0
  27. package/docs/classes/numeric.Numeric.html +14 -14
  28. package/docs/classes/shutingyard.Shutingyard.html +18 -18
  29. package/docs/enums/algebra_equation.PARTICULAR_SOLUTION.html +1 -0
  30. package/docs/enums/geometry_line.LinePropriety.html +1 -0
  31. package/docs/enums/shutingyard.ShutingyardMode.html +1 -1
  32. package/docs/enums/shutingyard.ShutingyardType.html +1 -1
  33. package/docs/index.html +11 -11
  34. package/docs/interfaces/algebra_equation.ISolution.html +3 -0
  35. package/docs/interfaces/geometry_triangle.remarquableLines.html +1 -0
  36. package/docs/modules/Logicalset.html +3 -0
  37. package/docs/modules/Polynom.html +3 -0
  38. package/docs/modules/Vector.html +3 -0
  39. package/docs/modules/algebra_equation.html +1 -0
  40. package/docs/modules/algebra_linearSystem.html +1 -0
  41. package/docs/modules/algebra_monom.html +1 -0
  42. package/docs/modules/algebra_polynom.html +1 -0
  43. package/docs/modules/coefficients_fraction.html +1 -0
  44. package/docs/modules/coefficients_nthroot.html +1 -0
  45. package/docs/modules/expressions_numexp.html +1 -0
  46. package/docs/modules/expressions_polynomexp.html +1 -0
  47. package/docs/modules/geometry_circle.html +1 -0
  48. package/docs/modules/geometry_line.html +1 -0
  49. package/docs/modules/geometry_triangle.html +1 -0
  50. package/docs/modules/numeric.html +1 -1
  51. package/docs/modules/shutingyard.html +1 -1
  52. package/docs/modules.html +1 -1
  53. package/esm/index.d.ts +2 -2
  54. package/esm/index.js +2 -2
  55. package/esm/maths/algebra/equation.d.ts +7 -2
  56. package/esm/maths/algebra/equation.js +52 -9
  57. package/esm/maths/algebra/equation.js.map +1 -1
  58. package/esm/maths/algebra/polynom.d.ts +5 -1
  59. package/esm/maths/algebra/polynom.js +157 -81
  60. package/esm/maths/algebra/polynom.js.map +1 -1
  61. package/esm/maths/algebra/rational.d.ts +16 -6
  62. package/esm/maths/algebra/rational.js +141 -30
  63. package/esm/maths/algebra/rational.js.map +1 -1
  64. package/esm/maths/coefficients/fraction.d.ts +3 -1
  65. package/esm/maths/coefficients/fraction.js +37 -5
  66. package/esm/maths/coefficients/fraction.js.map +1 -1
  67. package/esm/maths/coefficients/{nthroot.d.ts → nthRoot.d.ts} +5 -5
  68. package/esm/maths/coefficients/{nthroot.js → nthRoot.js} +5 -5
  69. package/esm/maths/coefficients/{nthroot.js.map → nthRoot.js.map} +1 -1
  70. package/esm/maths/expressions/polynomexp.js.map +1 -1
  71. package/esm/maths/geometry/line.js +8 -0
  72. package/esm/maths/geometry/line.js.map +1 -1
  73. package/esm/maths/randomization/random.js +1 -5
  74. package/esm/maths/randomization/random.js.map +1 -1
  75. package/package.json +11 -11
  76. package/public/index.html +234 -235
  77. package/src/index.ts +2 -2
  78. package/src/maths/algebra/equation.ts +61 -12
  79. package/src/maths/algebra/polynom.ts +170 -87
  80. package/src/maths/algebra/rational.ts +242 -98
  81. package/src/maths/coefficients/fraction.ts +44 -6
  82. package/src/maths/coefficients/{nthroot.ts → nthRoot.ts} +5 -5
  83. package/src/maths/expressions/polynomexp.ts +1 -0
  84. package/src/maths/geometry/line.ts +0 -1
  85. package/tests/algebra/equation.test.ts +38 -0
  86. package/tests/algebra/monom.test.ts +1 -4
  87. package/tests/algebra/polynom.test.ts +5 -1
  88. package/tests/algebra/rationnal.test.ts +63 -0
  89. package/tests/coefficients/fraction.test.ts +43 -1
  90. package/tests/geometry/circle.test.ts +4 -2
  91. package/tests/polynomexp.test.ts +0 -3
  92. package/tsconfig.json +16 -5
  93. package/docs/classes/Algebra.Equation.html +0 -26
  94. package/docs/classes/algebra.LinearSystem.html +0 -1
  95. package/docs/classes/algebra.Logicalset.html +0 -5
  96. package/docs/classes/algebra.Monom.html +0 -114
  97. package/docs/classes/algebra.Polynom.html +0 -30
  98. package/docs/classes/algebra.PolynomExpFactor.html +0 -1
  99. package/docs/classes/algebra.PolynomExpProduct.html +0 -1
  100. package/docs/classes/algebra.Rational.html +0 -4
  101. package/docs/classes/coefficients.Fraction.html +0 -19
  102. package/docs/classes/coefficients.Nthroot.html +0 -3
  103. package/docs/classes/geometry.Circle.html +0 -3
  104. package/docs/classes/geometry.Line.html +0 -3
  105. package/docs/classes/geometry.Point.html +0 -1
  106. package/docs/classes/geometry.Triangle.html +0 -17
  107. package/docs/classes/geometry.Vector.html +0 -1
  108. package/docs/enums/geometry.LinePropriety.html +0 -1
  109. package/docs/interfaces/geometry.remarquableLines.html +0 -1
  110. package/docs/modules/Algebra.html +0 -1
  111. package/docs/modules/Random.html +0 -1
  112. package/docs/modules/coefficients.html +0 -1
  113. package/docs/modules/geometry.html +0 -1
  114. package/docs/modules/random.Random.html +0 -1
package/dist/pi.js CHANGED
@@ -1,11 +1,11 @@
1
- /******/ (() => { // webpackBootstrap
2
- /******/ "use strict";
3
- /******/ var __webpack_modules__ = ({
4
-
5
- /***/ 607:
6
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
7
-
8
- var __webpack_unused_export__;
1
+ /******/ (() => { // webpackBootstrap
2
+ /******/ "use strict";
3
+ /******/ var __webpack_modules__ = ({
4
+
5
+ /***/ 607:
6
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
7
+
8
+ var __webpack_unused_export__;
9
9
 
10
10
  __webpack_unused_export__ = ({ value: true });
11
11
  exports.l = void 0;
@@ -14,7 +14,7 @@ const numexp_1 = __webpack_require__(735);
14
14
  const shutingyard_1 = __webpack_require__(505);
15
15
  const random_1 = __webpack_require__(330);
16
16
  const fraction_1 = __webpack_require__(506);
17
- const nthroot_1 = __webpack_require__(923);
17
+ const nthRoot_1 = __webpack_require__(872);
18
18
  const monom_1 = __webpack_require__(937);
19
19
  const polynom_1 = __webpack_require__(38);
20
20
  const equation_1 = __webpack_require__(760);
@@ -33,7 +33,7 @@ exports.l = {
33
33
  Numeric: numeric_1.Numeric,
34
34
  NumExp: numexp_1.NumExp,
35
35
  Fraction: fraction_1.Fraction,
36
- Root: nthroot_1.Nthroot,
36
+ Root: nthRoot_1.NthRoot,
37
37
  Monom: monom_1.Monom,
38
38
  Polynom: polynom_1.Polynom,
39
39
  Equation: equation_1.Equation,
@@ -52,20 +52,25 @@ exports.l = {
52
52
  }
53
53
  };
54
54
  window.Pi = exports.l;
55
-
56
-
57
- /***/ }),
58
-
59
- /***/ 760:
60
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
61
-
55
+
56
+
57
+ /***/ }),
58
+
59
+ /***/ 760:
60
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
61
+
62
62
 
63
63
  Object.defineProperty(exports, "__esModule", ({ value: true }));
64
- exports.Equation = void 0;
64
+ exports.Equation = exports.PARTICULAR_SOLUTION = void 0;
65
65
  const polynom_1 = __webpack_require__(38);
66
66
  const numeric_1 = __webpack_require__(956);
67
67
  const fraction_1 = __webpack_require__(506);
68
- const nthroot_1 = __webpack_require__(923);
68
+ const nthRoot_1 = __webpack_require__(872);
69
+ var PARTICULAR_SOLUTION;
70
+ (function (PARTICULAR_SOLUTION) {
71
+ PARTICULAR_SOLUTION["real"] = "\\mathbb{R}";
72
+ PARTICULAR_SOLUTION["varnothing"] = "\\varnothing";
73
+ })(PARTICULAR_SOLUTION = exports.PARTICULAR_SOLUTION || (exports.PARTICULAR_SOLUTION = {}));
69
74
  class Equation {
70
75
  /**
71
76
  * Create an Equation using two polynoms.
@@ -74,8 +79,11 @@ class Equation {
74
79
  */
75
80
  constructor(...equations) {
76
81
  // Undetermined texSolutions.
77
- this._varnothing = '\\varnothing';
78
- this._real = '\\mathbb{R}';
82
+ this._varnothing = PARTICULAR_SOLUTION.varnothing;
83
+ this._real = PARTICULAR_SOLUTION.real;
84
+ this.hasVariable = (letter) => {
85
+ return this.variables.includes(letter);
86
+ };
79
87
  // ------------------------------------------
80
88
  // Creation / parsing functions
81
89
  // -----------------------------------------------
@@ -270,6 +278,8 @@ class Equation {
270
278
  default:
271
279
  this._solveDegree3plus();
272
280
  }
281
+ // cleanup the solutions.
282
+ this._solutions = Equation.makeSolutionsUnique(this._solutions);
273
283
  return this;
274
284
  };
275
285
  this.test = (values) => {
@@ -400,7 +410,7 @@ class Equation {
400
410
  }
401
411
  else {
402
412
  this._solutions = [{
403
- tex: v.display,
413
+ tex: v.tex,
404
414
  value: v.value,
405
415
  exact: v
406
416
  }];
@@ -460,7 +470,7 @@ class Equation {
460
470
  ];
461
471
  }
462
472
  else {
463
- nthDelta = new nthroot_1.Nthroot(delta).reduce();
473
+ nthDelta = new nthRoot_1.NthRoot(delta).reduce();
464
474
  if (nthDelta.hasRadical()) {
465
475
  // -b +- coeff\sqrt{radical}
466
476
  // -------------------------
@@ -634,9 +644,27 @@ class Equation {
634
644
  }
635
645
  return this._solutions;
636
646
  };
637
- this._solveDegree3plus = () => {
638
- // TODO: try to resolve equations with a degree superior than 2.
639
- this._solutions = [{ tex: 'solve x - not yet handled', value: NaN, exact: false }]; // ESLint remove system :(
647
+ this._solveDegree3plus = (letter) => {
648
+ // Push everything to the left
649
+ // factorize
650
+ // solve each factors.
651
+ let equ = this.clone().moveLeft();
652
+ equ.left.factorize();
653
+ this._solutions = [];
654
+ equ.left.factors.forEach(factor => {
655
+ if (factor.degree(letter).leq(2)) {
656
+ let factorAsEquation = new Equation(factor, 0);
657
+ factorAsEquation.solve();
658
+ factorAsEquation.solutions.forEach(solution => {
659
+ this._solutions.push(solution);
660
+ });
661
+ }
662
+ else {
663
+ console.log(factor.tex, ': cannot actually get the solution of this equation');
664
+ }
665
+ });
666
+ // TODO: check equation resolution for more than degree 2
667
+ // this._solutions = [{tex: 'solve x - not yet handled', value: NaN, exact: false}]; // ESLint remove system :(
640
668
  return this._solutions;
641
669
  };
642
670
  // Default equation
@@ -751,15 +779,30 @@ class Equation {
751
779
  set randomizeDefaults(value) {
752
780
  this._randomizeDefaults = value;
753
781
  }
782
+ static makeSolutionsUnique(solutions, sorted) {
783
+ let solutionAsTex = [], uniqueSolutions = solutions.filter(sol => {
784
+ if (!solutionAsTex.includes(sol.tex)) {
785
+ solutionAsTex.push(sol.tex);
786
+ return true;
787
+ }
788
+ else {
789
+ return false;
790
+ }
791
+ });
792
+ if (sorted === true) {
793
+ uniqueSolutions.sort((a, b) => a.value - b.value);
794
+ }
795
+ return uniqueSolutions;
796
+ }
754
797
  }
755
798
  exports.Equation = Equation;
756
-
757
-
758
- /***/ }),
759
-
760
- /***/ 554:
761
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
762
-
799
+
800
+
801
+ /***/ }),
802
+
803
+ /***/ 554:
804
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
805
+
763
806
 
764
807
  Object.defineProperty(exports, "__esModule", ({ value: true }));
765
808
  exports.LinearSystem = void 0;
@@ -1020,13 +1063,13 @@ class LinearSystem {
1020
1063
  }
1021
1064
  }
1022
1065
  exports.LinearSystem = LinearSystem;
1023
-
1024
-
1025
- /***/ }),
1026
-
1027
- /***/ 236:
1028
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
1029
-
1066
+
1067
+
1068
+ /***/ }),
1069
+
1070
+ /***/ 236:
1071
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
1072
+
1030
1073
 
1031
1074
  /**
1032
1075
  * Polynom module contains everything necessary to handle polynoms.
@@ -1184,13 +1227,13 @@ class Logicalset {
1184
1227
  }
1185
1228
  }
1186
1229
  exports.Logicalset = Logicalset;
1187
-
1188
-
1189
- /***/ }),
1190
-
1191
- /***/ 937:
1192
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
1193
-
1230
+
1231
+
1232
+ /***/ }),
1233
+
1234
+ /***/ 937:
1235
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
1236
+
1194
1237
 
1195
1238
  Object.defineProperty(exports, "__esModule", ({ value: true }));
1196
1239
  exports.Monom = void 0;
@@ -2026,13 +2069,13 @@ Monom.xmultiply = (...monoms) => {
2026
2069
  }
2027
2070
  return M;
2028
2071
  };
2029
-
2030
-
2031
- /***/ }),
2032
-
2033
- /***/ 38:
2034
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
2035
-
2072
+
2073
+
2074
+ /***/ }),
2075
+
2076
+ /***/ 38:
2077
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
2078
+
2036
2079
 
2037
2080
  /**
2038
2081
  * Polynom module contains everything necessary to handle polynoms.*
@@ -2043,6 +2086,7 @@ const monom_1 = __webpack_require__(937);
2043
2086
  const shutingyard_1 = __webpack_require__(505);
2044
2087
  const numeric_1 = __webpack_require__(956);
2045
2088
  const fraction_1 = __webpack_require__(506);
2089
+ const equation_1 = __webpack_require__(760);
2046
2090
  /**
2047
2091
  * Polynom class can handle polynoms, reorder, resolve, ...
2048
2092
  * ```
@@ -2069,9 +2113,16 @@ class Polynom {
2069
2113
  if (typeof inputStr === 'string') {
2070
2114
  return this._parseString(inputStr, ...values);
2071
2115
  }
2072
- else if (typeof inputStr === 'number' || inputStr instanceof fraction_1.Fraction || inputStr instanceof monom_1.Monom) {
2116
+ else if ((typeof inputStr === 'number' || inputStr instanceof fraction_1.Fraction || inputStr instanceof monom_1.Monom)
2117
+ && (values === undefined || values.length === 0)) {
2073
2118
  this._monoms.push(new monom_1.Monom(inputStr));
2074
2119
  }
2120
+ else if (inputStr instanceof monom_1.Monom && values.length > 0) {
2121
+ this._monoms.push(new monom_1.Monom(inputStr));
2122
+ values.forEach(m => {
2123
+ this._monoms.push(new monom_1.Monom(m));
2124
+ });
2125
+ }
2075
2126
  else if (inputStr instanceof Polynom) {
2076
2127
  for (const m of inputStr.monoms) {
2077
2128
  this._monoms.push(m.clone());
@@ -2545,105 +2596,148 @@ class Polynom {
2545
2596
  P = P.euclidian(tempPolynom).quotient;
2546
2597
  }
2547
2598
  let securityLoop = P.degree().clone().multiply(2).value;
2599
+ let result;
2548
2600
  // securityLoop = 0
2549
2601
  while (securityLoop >= 0) {
2550
2602
  securityLoop--;
2551
2603
  if (P.monoms.length < 2) {
2552
2604
  if (!P.isOne()) {
2553
2605
  factors.push(P.clone());
2606
+ P.one();
2554
2607
  }
2555
2608
  break;
2556
2609
  }
2610
+ else if (P.degree(letter).isOne()) {
2611
+ factors.push(P.clone());
2612
+ P.one();
2613
+ break;
2614
+ }
2557
2615
  else {
2558
- // Get the first and last monom.
2616
+ // Get the first and last monom and build all their dividers.
2559
2617
  let m1 = P.monoms[0].dividers, m2 = P.monoms[P.monoms.length - 1].dividers;
2560
- for (let m1d of m1) {
2561
- for (let m2d of m2) {
2562
- // if(m1d.degree()===m2d.degree()){continue}
2563
- let dividerPolynom = new Polynom(), result;
2564
- dividerPolynom.monoms = [m1d.clone(), m2d.clone()];
2565
- result = P.euclidian(dividerPolynom);
2566
- if (result.reminder.isZero()) {
2567
- P = result.quotient.clone();
2568
- factors.push(dividerPolynom);
2569
- continue;
2570
- }
2571
- dividerPolynom.monoms = [m1d.clone(), m2d.clone().opposed()];
2572
- result = P.euclidian(dividerPolynom);
2573
- if (result.reminder.isZero()) {
2574
- P = result.quotient.clone();
2575
- factors.push(dividerPolynom);
2576
- }
2618
+ // Create the list of all "potential" polynom dividers.
2619
+ let allDividers = this._getAllPotentialFactors(P, letter);
2620
+ allDividers.every(div => {
2621
+ result = P.euclidian(div);
2622
+ if (result.reminder.isZero()) {
2623
+ P = result.quotient.clone();
2624
+ factors.push(div);
2625
+ return false;
2577
2626
  }
2578
- }
2627
+ return true;
2628
+ });
2579
2629
  }
2580
2630
  }
2631
+ if (!P.isOne()) {
2632
+ factors.push(P.clone());
2633
+ }
2581
2634
  this.factors = factors;
2582
2635
  return factors;
2583
2636
  };
2637
+ this._getAllPotentialFactors = (P, letter) => {
2638
+ let m1 = P.monoms[0].dividers, m2 = P.monoms[P.monoms.length - 1].dividers;
2639
+ let allDividers = [];
2640
+ m1.forEach(m1d => {
2641
+ m2.forEach(m2d => {
2642
+ if (m1d.degree(letter).isNotEqual(m2d.degree(letter))) {
2643
+ allDividers.push(new Polynom(m1d, m2d));
2644
+ allDividers.push(new Polynom(m1d, m2d.clone().opposed()));
2645
+ }
2646
+ });
2647
+ });
2648
+ return allDividers;
2649
+ };
2584
2650
  // TODO: get zeroes for more than first degree and for more than natural degrees
2585
2651
  this.getZeroes = () => {
2586
- const Z = [];
2587
- switch (this.degree().value) {
2588
- case 0:
2589
- if (this._monoms[0].coefficient.value === 0) {
2590
- return [true];
2591
- }
2592
- else {
2593
- return [false];
2594
- }
2595
- case 1:
2596
- // There is only one monoms,
2597
- if (this._monoms.length === 1) {
2598
- return [new fraction_1.Fraction().zero()];
2599
- }
2600
- else {
2601
- const P = this.clone().reduce().reorder();
2602
- return [P.monoms[1].coefficient.opposed().divide(P.monoms[0].coefficient)];
2603
- }
2604
- // TODO: Determine the zeros of an equation of second degree.
2605
- //case 2:
2606
- default:
2607
- // Make sure the polynom is factorized.
2608
- if (this._factors.length === 0) {
2609
- this.factorize();
2610
- }
2611
- let zeroes = [], zeroesAsTex = [];
2612
- for (let P of this._factors) {
2613
- if (P.degree().greater(2)) {
2614
- // TODO: Handle other polynom.
2615
- }
2616
- else if (P.degree().value === 2) {
2617
- let A = P.monomByDegree(2).coefficient, B = P.monomByDegree(1).coefficient, C = P.monomByDegree(0).coefficient, D = B.clone().pow(2).subtract(A.clone().multiply(C).multiply(4));
2618
- if (D.value > 0) {
2619
- /*console.log('Two zeroes for ', P.tex); */
2620
- let x1 = (-(B.value) + Math.sqrt(D.value)) / (2 * A.value), x2 = (-(B.value) - Math.sqrt(D.value)) / (2 * A.value);
2621
- zeroes.push(new fraction_1.Fraction(x1.toFixed(3)).reduce());
2622
- zeroes.push(new fraction_1.Fraction(x2.toFixed(3)).reduce());
2623
- }
2624
- else if (D.value === 0) {
2625
- /*console.log('One zero for ', P.tex); */
2626
- }
2627
- else {
2628
- console.log('No zero for ', P.tex);
2629
- }
2630
- }
2631
- else {
2632
- for (let z of P.getZeroes()) {
2633
- // Check if the zero is already in the list.
2634
- if (z === false || z === true) {
2635
- continue;
2636
- }
2637
- if (zeroesAsTex.indexOf(z.frac) === -1) {
2638
- zeroes.push(z);
2639
- zeroesAsTex.push(z.frac);
2640
- }
2641
- }
2642
- }
2643
- }
2644
- return zeroes;
2645
- }
2646
- return Z;
2652
+ let equ = new equation_1.Equation(this.clone(), 0);
2653
+ equ.solve();
2654
+ return equ.solutions;
2655
+ //
2656
+ // const Z: Fraction[] = [];
2657
+ //
2658
+ // // ISolution: {tex: string, value: number, exact: boolean|Fraction|...}
2659
+ //
2660
+ // switch (this.degree().value) {
2661
+ // case 0:
2662
+ // if (this._monoms[0].coefficient.value === 0) {
2663
+ // return [{
2664
+ // tex: '\\mathbb{R}',
2665
+ // value: NaN,
2666
+ // exact: false
2667
+ // }];
2668
+ // } else {
2669
+ // return [{
2670
+ // tex: '\\varnothing',
2671
+ // value: NaN,
2672
+ // exact: false
2673
+ // }];
2674
+ // }
2675
+ // case 1:
2676
+ // // There is only one monoms,
2677
+ // if (this._monoms.length === 1) {
2678
+ // return [{
2679
+ // tex: '0',
2680
+ // value: 0,
2681
+ // exact: new Fraction().zero()
2682
+ // }];
2683
+ // } else {
2684
+ // const P = this.clone().reduce().reorder();
2685
+ // const coeff = P.monoms[1].coefficient.opposed().divide(P.monoms[0].coefficient)
2686
+ // return [{
2687
+ // tex: coeff.tex,
2688
+ // value: coeff.value,
2689
+ // exact: coeff
2690
+ // }];
2691
+ // }
2692
+ // // TODO: Determine the zeros of an equation of second degree.
2693
+ // //case 2:
2694
+ // default:
2695
+ // // Make sure the polynom is factorized.
2696
+ // if (this._factors.length === 0) {
2697
+ // this.factorize()
2698
+ // }
2699
+ //
2700
+ // let zeroes:Fraction[] = [], zeroesAsTex = [];
2701
+ // for (let P of this._factors) {
2702
+ // if (P.degree().greater(2)) {
2703
+ // // TODO: get zeroes of polynom with a degree greater than 2.
2704
+ //
2705
+ // } else if (P.degree().value === 2) {
2706
+ // let A = P.monomByDegree(2).coefficient,
2707
+ // B = P.monomByDegree(1).coefficient,
2708
+ // C = P.monomByDegree(0).coefficient,
2709
+ // D = B.clone().pow(2).subtract(A.clone().multiply(C).multiply(4));
2710
+ //
2711
+ // if (D.value > 0) {
2712
+ // /*console.log('Two zeroes for ', P.tex); */
2713
+ // let x1 = (-(B.value) + Math.sqrt(D.value)) / (2 * A.value),
2714
+ // x2 = (-(B.value) - Math.sqrt(D.value)) / (2 * A.value);
2715
+ //
2716
+ // zeroes.push(new Fraction(x1.toFixed(3)).reduce());
2717
+ // zeroes.push(new Fraction(x2.toFixed(3)).reduce());
2718
+ // } else if (D.value === 0) {
2719
+ // /*console.log('One zero for ', P.tex); */
2720
+ // } else {
2721
+ // console.log('No zero for ', P.tex);
2722
+ // }
2723
+ // } else {
2724
+ // for (let z of P.getZeroes()) {
2725
+ // // Check if the zero is already in the list.
2726
+ // // if (z === false || z === true) {
2727
+ // // continue;
2728
+ // // }
2729
+ // if (zeroesAsTex.indexOf(z.frac) === -1) {
2730
+ // zeroes.push(z);
2731
+ // zeroesAsTex.push(z.frac);
2732
+ // }
2733
+ // }
2734
+ // }
2735
+ // }
2736
+ //
2737
+ //
2738
+ // return zeroes;
2739
+ // }
2740
+ // return Z;
2647
2741
  };
2648
2742
  // TODO: analyse the next functions to determine if they are useful or not...
2649
2743
  this.monomByDegree = (degree, letter) => {
@@ -2736,6 +2830,28 @@ class Polynom {
2736
2830
  }
2737
2831
  return M;
2738
2832
  };
2833
+ this.limitToInfinity = (letter) => {
2834
+ const M = this.monomByDegree(undefined, letter), sign = M.coefficient.sign(), degree = M.degree(letter);
2835
+ if (degree.isStrictlyPositive()) {
2836
+ return sign === 1 ? (new fraction_1.Fraction()).infinite() : (new fraction_1.Fraction()).infinite().opposed();
2837
+ }
2838
+ else if (degree.isZero()) {
2839
+ return M.coefficient;
2840
+ }
2841
+ // Any other cases
2842
+ return (new fraction_1.Fraction()).zero();
2843
+ };
2844
+ this.limitToNegativeInfinity = (letter) => {
2845
+ const M = this.monomByDegree(undefined, letter), sign = M.coefficient.sign(), degree = M.degree(letter);
2846
+ if (degree.isStrictlyPositive()) {
2847
+ return sign === -1 ? (new fraction_1.Fraction()).infinite() : (new fraction_1.Fraction()).infinite().opposed();
2848
+ }
2849
+ else if (degree.isZero()) {
2850
+ return M.coefficient;
2851
+ }
2852
+ // Any other cases
2853
+ return (new fraction_1.Fraction()).zero();
2854
+ };
2739
2855
  this.genDisplay = (output, forceSign, wrapParentheses) => {
2740
2856
  let P = '';
2741
2857
  for (const k of this._monoms) {
@@ -2993,6 +3109,9 @@ class Polynom {
2993
3109
  }
2994
3110
  get texFactors() {
2995
3111
  this.factorize();
3112
+ if (this.factors.length === 0) {
3113
+ return this.tex;
3114
+ }
2996
3115
  let tex = '';
2997
3116
  for (let f of this.factors) {
2998
3117
  if (f.monoms.length > 1) {
@@ -3172,13 +3291,13 @@ Polynom.addToken = (stack, element) => {
3172
3291
  break;
3173
3292
  }
3174
3293
  };
3175
-
3176
-
3177
- /***/ }),
3178
-
3179
- /***/ 107:
3180
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
3181
-
3294
+
3295
+
3296
+ /***/ }),
3297
+
3298
+ /***/ 107:
3299
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
3300
+
3182
3301
 
3183
3302
  /**
3184
3303
  * Rational polynom module contains everything necessary to handle rational polynoms.
@@ -3188,6 +3307,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
3188
3307
  exports.Rational = void 0;
3189
3308
  const polynom_1 = __webpack_require__(38);
3190
3309
  const fraction_1 = __webpack_require__(506);
3310
+ const equation_1 = __webpack_require__(760);
3191
3311
  /**
3192
3312
  * Rational class can handle rational polynoms
3193
3313
  */
@@ -3205,18 +3325,15 @@ class Rational {
3205
3325
  };
3206
3326
  this.domain = () => {
3207
3327
  let zeroes = this._denominator.getZeroes();
3208
- if (zeroes.length === 0 || zeroes[0] === false) {
3209
- return '\\mathbb{R}';
3328
+ if (zeroes.length === 0 || zeroes[0].tex === equation_1.PARTICULAR_SOLUTION.real) {
3329
+ return equation_1.PARTICULAR_SOLUTION.real;
3210
3330
  }
3211
- else if (zeroes[0] === true) {
3212
- return '\\varnothing';
3331
+ else if (zeroes[0].tex === equation_1.PARTICULAR_SOLUTION.varnothing) {
3332
+ return equation_1.PARTICULAR_SOLUTION.varnothing;
3213
3333
  }
3214
3334
  else {
3215
- return '\\mathbb{R}\\setminus\\left{' +
3216
- zeroes.map(x => {
3217
- return (typeof x === 'boolean') ? '' : x.frac;
3218
- })
3219
- .join(';') + '\\right}';
3335
+ return '\\mathbb{R}\\setminus\\left\\{' +
3336
+ zeroes.map(x => x.tex).join(';') + '\\right\\}';
3220
3337
  }
3221
3338
  };
3222
3339
  this.amplify = (P) => {
@@ -3224,6 +3341,12 @@ class Rational {
3224
3341
  this._denominator.multiply(P);
3225
3342
  return this;
3226
3343
  };
3344
+ this.derivative = (letter) => {
3345
+ let N = this._numerator.clone(), D = this._denominator.clone(), dN = N.clone().derivative(letter), dD = D.clone().derivative(letter);
3346
+ this._numerator = dN.clone().multiply(D).subtract(N.clone().multiply(dD));
3347
+ this._denominator = D.clone().pow(2);
3348
+ return this;
3349
+ };
3227
3350
  this.simplify = (P) => {
3228
3351
  let NumeratorEuclidien = this._numerator.euclidian(P);
3229
3352
  if (!NumeratorEuclidien.reminder.isZero()) {
@@ -3238,9 +3361,7 @@ class Rational {
3238
3361
  return this;
3239
3362
  };
3240
3363
  this.reduce = () => {
3241
- console.log(this._numerator.tex);
3242
3364
  this._numerator.factorize();
3243
- console.log(this._numerator.factors.map(x => x.tex));
3244
3365
  for (let f of this._numerator.factors) {
3245
3366
  this.simplify(f);
3246
3367
  }
@@ -3265,50 +3386,159 @@ class Rational {
3265
3386
  this.subtract = (R) => {
3266
3387
  return this.add(R.clone().opposed());
3267
3388
  };
3268
- this.limits = (value, letter) => {
3389
+ this.limits = (value, offset, letter) => {
3269
3390
  if (value === Infinity || value === -Infinity) {
3270
- let N = this._numerator.monomByDegree(this._numerator.degree(letter), letter), D = this._denominator.monomByDegree(this._denominator.degree(letter), letter);
3271
- N.divide(D);
3272
- if (N.degree(letter).isStrictlyPositive()) {
3273
- return N.coefficient.sign() * (Math.pow((value > 0 ? 1 : -1), N.degree(letter).value % 2)) === 1 ? Infinity : -Infinity;
3274
- }
3275
- if (N.degree(letter).isZero()) {
3276
- return N.coefficient;
3391
+ let { quotient, reminder } = this._numerator.clone().euclidian(this._denominator);
3392
+ // quotient is positive => it will be infinite.
3393
+ if (quotient.degree(letter).isStrictlyPositive()) {
3394
+ return value === Infinity ? quotient.limitToInfinity(letter) : quotient.limitToNegativeInfinity(letter);
3395
+ // return quotient.monomByDegree(undefined, letter).coefficient.sign()===1?(new Fraction()).infinite():(new Fraction()).infinite().opposed()
3277
3396
  }
3278
- if (N.degree(letter).isStrictlyPositive()) {
3279
- return N.coefficient.sign() * (Math.pow(-1, N.degree(letter).value % 2)) === 1 ? 0 : -0;
3397
+ else {
3398
+ return quotient.monomByDegree(undefined, letter).coefficient;
3280
3399
  }
3281
3400
  }
3282
3401
  else {
3283
- return this._numerator.evaluate({ letter: new fraction_1.Fraction(value) }).divide(this._denominator.evaluate({ letter: new fraction_1.Fraction(value) }));
3402
+ let evalValues = {}, evalValuesOffset = {}, theLimit, theSign, FR = this.clone().reduce();
3403
+ evalValues[letter === undefined ? 'x' : letter] = new fraction_1.Fraction(value);
3404
+ if (offset !== 'above' && offset !== 'below') {
3405
+ theLimit = FR._numerator.evaluate(evalValues)
3406
+ .divide(FR._denominator.evaluate(evalValues));
3407
+ return theLimit.isInfinity() ? theLimit.abs() : theLimit;
3408
+ }
3409
+ else {
3410
+ if (offset === 'above') {
3411
+ evalValuesOffset[letter === undefined ? 'x' : letter] = (new fraction_1.Fraction(value)).add(0.000001);
3412
+ }
3413
+ else if (offset === 'below') {
3414
+ evalValuesOffset[letter === undefined ? 'x' : letter] = (new fraction_1.Fraction(value)).subtract(0.000001);
3415
+ }
3416
+ theLimit = FR._numerator.evaluate(evalValues)
3417
+ .divide(FR._denominator.evaluate(evalValues));
3418
+ theSign = FR._numerator.evaluate(evalValuesOffset)
3419
+ .divide(FR._denominator.evaluate(evalValuesOffset)).sign();
3420
+ if (theLimit.isInfinity()) {
3421
+ return theSign === 1 ? theLimit.abs() : theLimit.abs().opposed();
3422
+ }
3423
+ else {
3424
+ return theLimit;
3425
+ }
3426
+ }
3284
3427
  }
3285
3428
  };
3429
+ this.makeTableOfSigns = () => {
3430
+ // Factorize the numerator and the denominator
3431
+ this._numerator.factorize();
3432
+ this._denominator.factorize();
3433
+ let zeroes = equation_1.Equation.makeSolutionsUnique([...this._numerator.getZeroes(), ...this._denominator.getZeroes()], true), NFactors = this._numerator.factors, DFactors = this._denominator.factors;
3434
+ let tableOfSigns = [], result = [];
3435
+ NFactors.forEach(factor => {
3436
+ tableOfSigns.push(this._makeOneLineOfTableOfSigns(factor, zeroes, 'z'));
3437
+ });
3438
+ DFactors.forEach(factor => {
3439
+ tableOfSigns.push(this._makeOneLineOfTableOfSigns(factor, zeroes, 'd'));
3440
+ });
3441
+ // Empty line
3442
+ tableOfSigns.push([]);
3443
+ // Add the final row as cumulative
3444
+ let resultLine = tableOfSigns[0].map((x, index) => {
3445
+ if (index === 0) {
3446
+ return '';
3447
+ }
3448
+ if (index === tableOfSigns[0].length - 1) {
3449
+ return '';
3450
+ }
3451
+ if (index % 2 === 0) {
3452
+ return 't';
3453
+ }
3454
+ return '+';
3455
+ });
3456
+ for (let current of tableOfSigns) {
3457
+ for (let i = 0; i < current.length; i++) {
3458
+ if (i % 2 === 0) {
3459
+ // t, z or d
3460
+ if (resultLine[i] === 'd') {
3461
+ continue;
3462
+ }
3463
+ if (current[i] !== 't') {
3464
+ resultLine[i] = current[i];
3465
+ }
3466
+ }
3467
+ else {
3468
+ // + or -
3469
+ if (current[i] === '-') {
3470
+ resultLine[i] = resultLine[i] === '+' ? '-' : '+';
3471
+ }
3472
+ }
3473
+ }
3474
+ }
3475
+ // Add the variation line.
3476
+ // TODO: add the variation line.
3477
+ tableOfSigns.push(resultLine);
3478
+ let tos = {
3479
+ factors: [...NFactors, ...DFactors],
3480
+ zeroes: zeroes,
3481
+ signs: tableOfSigns,
3482
+ tex: ''
3483
+ };
3484
+ this._makeTexFromTableOfSigns(tos);
3485
+ return tos;
3486
+ };
3487
+ this._makeTexFromTableOfSigns = (tos) => {
3488
+ let tex = `\\begin{tikzpicture}
3489
+ \\tkzTabInit[lgt=3,espcl=2,deltacl=0]{/1.2,\\(${tos.factors.map(x => x.tex).join('\\)/1,\\(')}\\)/1,/.1,\\(f(x)\\)/1.2}{{\\scriptsize \\hspace{1cm} \\(-\\infty\\)},\\(${tos.zeroes.map(x => x.tex).join('\\),\\(')}\\),{\\scriptsize \\hspace{-1cm} \\(+\\infty\\)}}`;
3490
+ tos.signs.forEach(list => {
3491
+ tex += (`\n\\tkzTabLine{${list.join(',')}}`);
3492
+ });
3493
+ tex += `\n\\end{tikzpicture}`;
3494
+ tos.tex = tex;
3495
+ return tex;
3496
+ };
3497
+ this._makeOneLineOfTableOfSigns = (factor, zeroes, zeroSign) => {
3498
+ let oneLine = [],
3499
+ // TODO : check if there is no zero ?
3500
+ currentZero = factor.getZeroes().map(x => x.tex);
3501
+ // First +/- sign, before the first zero
3502
+ oneLine.push('');
3503
+ oneLine.push(factor.evaluate(zeroes[0].value - 1).sign() === 1 ? '+' : '-');
3504
+ for (let i = 0; i < zeroes.length; i++) {
3505
+ // Add the zero if it's the current one
3506
+ oneLine.push(currentZero.includes(zeroes[i].tex) ? zeroSign : 't');
3507
+ // + / - sign after the current zero
3508
+ if (i < zeroes.length - 1) {
3509
+ oneLine.push(factor.evaluate((zeroes[i].value + zeroes[i + 1].value) / 2).sign() === 1 ? '+' : '-');
3510
+ }
3511
+ else if (i === zeroes.length - 1) {
3512
+ oneLine.push(factor.evaluate(zeroes[i].value + 1).sign() === 1 ? '+' : '-');
3513
+ }
3514
+ }
3515
+ oneLine.push('');
3516
+ return oneLine;
3517
+ };
3286
3518
  this._numerator = numerator ? numerator.clone() : new polynom_1.Polynom();
3287
3519
  this._denominator = denominator ? denominator.clone() : new polynom_1.Polynom();
3288
3520
  }
3289
- get tex() {
3290
- return `\\dfrac{ ${this._numerator.tex} }{ ${this._denominator.tex} }`;
3291
- }
3292
- get texFactors() {
3293
- this._numerator.factorize();
3294
- this._denominator.factorize();
3295
- return `\\dfrac{ ${this._numerator.texFactors} }{ ${this._denominator.texFactors} }`;
3296
- }
3297
3521
  get numerator() {
3298
3522
  return this._numerator;
3299
3523
  }
3300
3524
  get denominator() {
3301
3525
  return this._denominator;
3302
3526
  }
3527
+ get tex() {
3528
+ return `\\dfrac{ ${this._numerator.tex} }{ ${this._denominator.tex} }`;
3529
+ }
3530
+ get texFactors() {
3531
+ return `\\dfrac{ ${this._numerator.texFactors} }{ ${this._denominator.texFactors} }`;
3532
+ }
3303
3533
  }
3304
3534
  exports.Rational = Rational;
3305
-
3306
-
3307
- /***/ }),
3308
-
3309
- /***/ 506:
3310
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
3311
-
3535
+
3536
+
3537
+ /***/ }),
3538
+
3539
+ /***/ 506:
3540
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
3541
+
3312
3542
 
3313
3543
  Object.defineProperty(exports, "__esModule", ({ value: true }));
3314
3544
  exports.Fraction = void 0;
@@ -3639,10 +3869,10 @@ class Fraction {
3639
3869
  return isNaN(this._numerator);
3640
3870
  };
3641
3871
  this.isInfinity = () => {
3642
- return this._numerator === Infinity;
3872
+ return Math.abs(this._numerator) === Infinity;
3643
3873
  };
3644
3874
  this.isFinite = () => {
3645
- return !this.isInfinity();
3875
+ return !this.isInfinity() && !this.isNaN();
3646
3876
  };
3647
3877
  this.isSquare = () => {
3648
3878
  return Math.sqrt(this._numerator) % 1 === 0 && Math.sqrt(this._denominator) % 1 === 0;
@@ -3687,9 +3917,6 @@ class Fraction {
3687
3917
  }
3688
3918
  return this;
3689
3919
  }
3690
- get isFraction() {
3691
- return true;
3692
- }
3693
3920
  // ------------------------------------------
3694
3921
  // Getter and setter
3695
3922
  // ------------------------------------------
@@ -3710,6 +3937,9 @@ class Fraction {
3710
3937
  }
3711
3938
  // Display getter
3712
3939
  get tex() {
3940
+ if (this.isInfinity()) {
3941
+ return `${this.sign() === 1 ? '+' : '-'}\\infty`;
3942
+ }
3713
3943
  if (this._denominator === 1) {
3714
3944
  return `${this._numerator}`;
3715
3945
  }
@@ -3760,20 +3990,52 @@ Fraction.min = (...fractions) => {
3760
3990
  }
3761
3991
  return M;
3762
3992
  };
3763
-
3764
-
3765
- /***/ }),
3766
-
3767
- /***/ 923:
3768
- /***/ ((__unused_webpack_module, exports) => {
3769
-
3993
+ Fraction.average = (...fractions) => {
3994
+ let M = new Fraction().zero();
3995
+ for (let f of fractions) {
3996
+ M.add(f);
3997
+ }
3998
+ M.divide(fractions.length);
3999
+ return M;
4000
+ };
4001
+ Fraction.unique = (fractions, sorted) => {
4002
+ // TODO: make sure it's wokring -> test !
4003
+ let unique = {}, distinct = [];
4004
+ fractions.forEach(x => {
4005
+ if (!unique[x.clone().reduce().tex]) {
4006
+ distinct.push(x.clone());
4007
+ unique[x.tex] = true;
4008
+ }
4009
+ });
4010
+ if (sorted) {
4011
+ return Fraction.sort(distinct);
4012
+ }
4013
+ else {
4014
+ return distinct;
4015
+ }
4016
+ };
4017
+ Fraction.sort = (fractions, reverse) => {
4018
+ // Todo make sure it's the correct order, not reverse -> make a test
4019
+ let sorted = fractions.sort((a, b) => a.value - b.value);
4020
+ if (reverse) {
4021
+ sorted.reverse();
4022
+ }
4023
+ return sorted;
4024
+ };
4025
+
4026
+
4027
+ /***/ }),
4028
+
4029
+ /***/ 872:
4030
+ /***/ ((__unused_webpack_module, exports) => {
4031
+
3770
4032
 
3771
4033
  Object.defineProperty(exports, "__esModule", ({ value: true }));
3772
- exports.Nthroot = void 0;
4034
+ exports.NthRoot = void 0;
3773
4035
  /**
3774
- * Nthroot is something like "a+b\sqrt{3}
4036
+ * NthRoot is something like "a+b\sqrt{3}
3775
4037
  */
3776
- class Nthroot {
4038
+ class NthRoot {
3777
4039
  constructor(...values) {
3778
4040
  // ------------------------------------------
3779
4041
  // Creation / parsing functions
@@ -3879,14 +4141,14 @@ class Nthroot {
3879
4141
  return this._coefficient * Math.pow(this._radical, 1 / this._nth);
3880
4142
  }
3881
4143
  }
3882
- exports.Nthroot = Nthroot;
3883
-
3884
-
3885
- /***/ }),
3886
-
3887
- /***/ 735:
3888
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
3889
-
4144
+ exports.NthRoot = NthRoot;
4145
+
4146
+
4147
+ /***/ }),
4148
+
4149
+ /***/ 735:
4150
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
4151
+
3890
4152
 
3891
4153
  Object.defineProperty(exports, "__esModule", ({ value: true }));
3892
4154
  exports.NumExp = void 0;
@@ -4041,13 +4303,13 @@ class NumExp {
4041
4303
  }
4042
4304
  }
4043
4305
  exports.NumExp = NumExp;
4044
-
4045
-
4046
- /***/ }),
4047
-
4048
- /***/ 75:
4049
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
4050
-
4306
+
4307
+
4308
+ /***/ }),
4309
+
4310
+ /***/ 75:
4311
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
4312
+
4051
4313
 
4052
4314
  Object.defineProperty(exports, "__esModule", ({ value: true }));
4053
4315
  exports.PolynomExpProduct = exports.PolynomExpFactor = void 0;
@@ -4293,13 +4555,13 @@ class PolynomExpProduct {
4293
4555
  }
4294
4556
  }
4295
4557
  exports.PolynomExpProduct = PolynomExpProduct;
4296
-
4297
-
4298
- /***/ }),
4299
-
4300
- /***/ 699:
4301
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
4302
-
4558
+
4559
+
4560
+ /***/ }),
4561
+
4562
+ /***/ 699:
4563
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
4564
+
4303
4565
 
4304
4566
  Object.defineProperty(exports, "__esModule", ({ value: true }));
4305
4567
  exports.Circle = void 0;
@@ -4606,13 +4868,13 @@ class Circle {
4606
4868
  }
4607
4869
  }
4608
4870
  exports.Circle = Circle;
4609
-
4610
-
4611
- /***/ }),
4612
-
4613
- /***/ 9:
4614
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
4615
-
4871
+
4872
+
4873
+ /***/ }),
4874
+
4875
+ /***/ 9:
4876
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
4877
+
4616
4878
 
4617
4879
  /**
4618
4880
  * This class works for 2d line in a plane.
@@ -4696,6 +4958,14 @@ class Line {
4696
4958
  return this.parseByPointAndVector(values[0], values[1]);
4697
4959
  }
4698
4960
  }
4961
+ else if (values[0] instanceof point_1.Point && values[1] instanceof Line) {
4962
+ if (values[2] === LinePropriety.Parallel || values[2] === null) {
4963
+ return this.parseByPointAndLine(values[0], values[1], LinePropriety.Parallel);
4964
+ }
4965
+ else {
4966
+ return this.parseByPointAndLine(values[0], values[1], LinePropriety.Perpendicular);
4967
+ }
4968
+ }
4699
4969
  }
4700
4970
  // TODO: Add the ability to create line from a normal vector
4701
4971
  console.log('Someting wrong happend while creating the line');
@@ -5009,13 +5279,13 @@ class Line {
5009
5279
  exports.Line = Line;
5010
5280
  Line.PERPENDICULAR = LinePropriety.Perpendicular;
5011
5281
  Line.PARALLEL = LinePropriety.Parallel;
5012
-
5013
-
5014
- /***/ }),
5015
-
5016
- /***/ 557:
5017
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5018
-
5282
+
5283
+
5284
+ /***/ }),
5285
+
5286
+ /***/ 557:
5287
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5288
+
5019
5289
 
5020
5290
  Object.defineProperty(exports, "__esModule", ({ value: true }));
5021
5291
  exports.Point = void 0;
@@ -5179,13 +5449,13 @@ Point.pmatrix = (a, b, c) => {
5179
5449
  return `\\begin{pmatrix} ${a.tex ? a.tex : a} \\\\ ${b.tex ? b.tex : b} \\\\ ${c.tex ? c.tex : c} \\end{pmatrix}`;
5180
5450
  }
5181
5451
  };
5182
-
5183
-
5184
- /***/ }),
5185
-
5186
- /***/ 164:
5187
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5188
-
5452
+
5453
+
5454
+ /***/ }),
5455
+
5456
+ /***/ 164:
5457
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5458
+
5189
5459
 
5190
5460
  Object.defineProperty(exports, "__esModule", ({ value: true }));
5191
5461
  exports.Triangle = void 0;
@@ -5454,13 +5724,13 @@ class Triangle {
5454
5724
  }
5455
5725
  }
5456
5726
  exports.Triangle = Triangle;
5457
-
5458
-
5459
- /***/ }),
5460
-
5461
- /***/ 586:
5462
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5463
-
5727
+
5728
+
5729
+ /***/ }),
5730
+
5731
+ /***/ 586:
5732
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5733
+
5464
5734
 
5465
5735
  Object.defineProperty(exports, "__esModule", ({ value: true }));
5466
5736
  exports.Vector = void 0;
@@ -5638,13 +5908,13 @@ Vector.scalarProduct = (v1, v2) => {
5638
5908
  // TODO: Transform to fraction with nthroot.
5639
5909
  return v1.x.value * v2.x.value + v1.y.value * v2.y.value;
5640
5910
  };
5641
-
5642
-
5643
- /***/ }),
5644
-
5645
- /***/ 956:
5646
- /***/ ((__unused_webpack_module, exports) => {
5647
-
5911
+
5912
+
5913
+ /***/ }),
5914
+
5915
+ /***/ 956:
5916
+ /***/ ((__unused_webpack_module, exports) => {
5917
+
5648
5918
 
5649
5919
  Object.defineProperty(exports, "__esModule", ({ value: true }));
5650
5920
  exports.Numeric = void 0;
@@ -5750,21 +6020,17 @@ class Numeric {
5750
6020
  }
5751
6021
  }
5752
6022
  exports.Numeric = Numeric;
5753
-
5754
-
5755
- /***/ }),
5756
-
5757
- /***/ 330:
5758
- /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
5759
-
6023
+
6024
+
6025
+ /***/ }),
6026
+
6027
+ /***/ 330:
6028
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
6029
+
5760
6030
 
5761
6031
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
5762
6032
  if (k2 === undefined) k2 = k;
5763
- var desc = Object.getOwnPropertyDescriptor(m, k);
5764
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
5765
- desc = { enumerable: true, get: function() { return m[k]; } };
5766
- }
5767
- Object.defineProperty(o, k2, desc);
6033
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5768
6034
  }) : (function(o, m, k, k2) {
5769
6035
  if (k2 === undefined) k2 = k;
5770
6036
  o[k2] = m[k];
@@ -5818,13 +6084,13 @@ var Random;
5818
6084
  }
5819
6085
  Random.shuffle = shuffle;
5820
6086
  })(Random = exports.Random || (exports.Random = {}));
5821
-
5822
-
5823
- /***/ }),
5824
-
5825
- /***/ 373:
5826
- /***/ ((__unused_webpack_module, exports) => {
5827
-
6087
+
6088
+
6089
+ /***/ }),
6090
+
6091
+ /***/ 373:
6092
+ /***/ ((__unused_webpack_module, exports) => {
6093
+
5828
6094
 
5829
6095
  Object.defineProperty(exports, "__esModule", ({ value: true }));
5830
6096
  exports.randomCore = void 0;
@@ -5846,13 +6112,13 @@ class randomCore {
5846
6112
  }
5847
6113
  }
5848
6114
  exports.randomCore = randomCore;
5849
-
5850
-
5851
- /***/ }),
5852
-
5853
- /***/ 754:
5854
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5855
-
6115
+
6116
+
6117
+ /***/ }),
6118
+
6119
+ /***/ 754:
6120
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
6121
+
5856
6122
 
5857
6123
  Object.defineProperty(exports, "__esModule", ({ value: true }));
5858
6124
  exports.rndFraction = void 0;
@@ -5892,13 +6158,13 @@ class rndFraction extends randomCore_1.randomCore {
5892
6158
  }
5893
6159
  }
5894
6160
  exports.rndFraction = rndFraction;
5895
-
5896
-
5897
- /***/ }),
5898
-
5899
- /***/ 140:
5900
- /***/ ((__unused_webpack_module, exports) => {
5901
-
6161
+
6162
+
6163
+ /***/ }),
6164
+
6165
+ /***/ 140:
6166
+ /***/ ((__unused_webpack_module, exports) => {
6167
+
5902
6168
 
5903
6169
  Object.defineProperty(exports, "__esModule", ({ value: true }));
5904
6170
  exports.rndHelpers = void 0;
@@ -5967,13 +6233,13 @@ class rndHelpers {
5967
6233
  }
5968
6234
  }
5969
6235
  exports.rndHelpers = rndHelpers;
5970
-
5971
-
5972
- /***/ }),
5973
-
5974
- /***/ 793:
5975
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5976
-
6236
+
6237
+
6238
+ /***/ }),
6239
+
6240
+ /***/ 793:
6241
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
6242
+
5977
6243
 
5978
6244
  Object.defineProperty(exports, "__esModule", ({ value: true }));
5979
6245
  exports.rndMonom = void 0;
@@ -6026,13 +6292,13 @@ class rndMonom extends randomCore_1.randomCore {
6026
6292
  }
6027
6293
  }
6028
6294
  exports.rndMonom = rndMonom;
6029
-
6030
-
6031
- /***/ }),
6032
-
6033
- /***/ 22:
6034
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
6035
-
6295
+
6296
+
6297
+ /***/ }),
6298
+
6299
+ /***/ 22:
6300
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
6301
+
6036
6302
 
6037
6303
  Object.defineProperty(exports, "__esModule", ({ value: true }));
6038
6304
  exports.rndPolynom = void 0;
@@ -6107,22 +6373,22 @@ class rndPolynom extends randomCore_1.randomCore {
6107
6373
  }
6108
6374
  }
6109
6375
  exports.rndPolynom = rndPolynom;
6110
-
6111
-
6112
- /***/ }),
6113
-
6114
- /***/ 230:
6115
- /***/ ((__unused_webpack_module, exports) => {
6116
-
6376
+
6377
+
6378
+ /***/ }),
6379
+
6380
+ /***/ 230:
6381
+ /***/ ((__unused_webpack_module, exports) => {
6382
+
6117
6383
 
6118
6384
  Object.defineProperty(exports, "__esModule", ({ value: true }));
6119
-
6120
-
6121
- /***/ }),
6122
-
6123
- /***/ 505:
6124
- /***/ ((__unused_webpack_module, exports) => {
6125
-
6385
+
6386
+
6387
+ /***/ }),
6388
+
6389
+ /***/ 505:
6390
+ /***/ ((__unused_webpack_module, exports) => {
6391
+
6126
6392
 
6127
6393
  Object.defineProperty(exports, "__esModule", ({ value: true }));
6128
6394
  exports.Shutingyard = exports.ShutingyardMode = exports.ShutingyardType = exports.tokenConstant = void 0;
@@ -6427,43 +6693,43 @@ class Shutingyard {
6427
6693
  }
6428
6694
  }
6429
6695
  exports.Shutingyard = Shutingyard;
6430
-
6431
-
6432
- /***/ })
6433
-
6434
- /******/ });
6435
- /************************************************************************/
6436
- /******/ // The module cache
6437
- /******/ var __webpack_module_cache__ = {};
6438
- /******/
6439
- /******/ // The require function
6440
- /******/ function __webpack_require__(moduleId) {
6441
- /******/ // Check if module is in cache
6442
- /******/ var cachedModule = __webpack_module_cache__[moduleId];
6443
- /******/ if (cachedModule !== undefined) {
6444
- /******/ return cachedModule.exports;
6445
- /******/ }
6446
- /******/ // Create a new module (and put it into the cache)
6447
- /******/ var module = __webpack_module_cache__[moduleId] = {
6448
- /******/ // no module.id needed
6449
- /******/ // no module.loaded needed
6450
- /******/ exports: {}
6451
- /******/ };
6452
- /******/
6453
- /******/ // Execute the module function
6454
- /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
6455
- /******/
6456
- /******/ // Return the exports of the module
6457
- /******/ return module.exports;
6458
- /******/ }
6459
- /******/
6460
- /************************************************************************/
6461
- /******/
6462
- /******/ // startup
6463
- /******/ // Load entry module and return exports
6464
- /******/ // This entry module is referenced by other modules so it can't be inlined
6465
- /******/ var __webpack_exports__ = __webpack_require__(607);
6466
- /******/
6467
- /******/ })()
6468
- ;
6696
+
6697
+
6698
+ /***/ })
6699
+
6700
+ /******/ });
6701
+ /************************************************************************/
6702
+ /******/ // The module cache
6703
+ /******/ var __webpack_module_cache__ = {};
6704
+ /******/
6705
+ /******/ // The require function
6706
+ /******/ function __webpack_require__(moduleId) {
6707
+ /******/ // Check if module is in cache
6708
+ /******/ var cachedModule = __webpack_module_cache__[moduleId];
6709
+ /******/ if (cachedModule !== undefined) {
6710
+ /******/ return cachedModule.exports;
6711
+ /******/ }
6712
+ /******/ // Create a new module (and put it into the cache)
6713
+ /******/ var module = __webpack_module_cache__[moduleId] = {
6714
+ /******/ // no module.id needed
6715
+ /******/ // no module.loaded needed
6716
+ /******/ exports: {}
6717
+ /******/ };
6718
+ /******/
6719
+ /******/ // Execute the module function
6720
+ /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
6721
+ /******/
6722
+ /******/ // Return the exports of the module
6723
+ /******/ return module.exports;
6724
+ /******/ }
6725
+ /******/
6726
+ /************************************************************************/
6727
+ /******/
6728
+ /******/ // startup
6729
+ /******/ // Load entry module and return exports
6730
+ /******/ // This entry module is referenced by other modules so it can't be inlined
6731
+ /******/ var __webpack_exports__ = __webpack_require__(607);
6732
+ /******/
6733
+ /******/ })()
6734
+ ;
6469
6735
  //# sourceMappingURL=pi.js.map