pimath 0.0.17 → 0.0.18

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.
package/dev/pi.js CHANGED
@@ -6,19 +6,15 @@
6
6
  /*!***************************************!*\
7
7
  !*** ./src/maths/algebra/equation.ts ***!
8
8
  \***************************************/
9
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
9
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
10
10
 
11
- __webpack_require__.r(__webpack_exports__);
12
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
13
- /* harmony export */ "Equation": () => (/* binding */ Equation)
14
- /* harmony export */ });
15
- /* harmony import */ var _polynom__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./polynom */ "./src/maths/algebra/polynom.ts");
16
- /* harmony import */ var _numeric__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../numeric */ "./src/maths/numeric.ts");
17
- /* harmony import */ var _coefficients__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../coefficients */ "./src/maths/coefficients/index.ts");
18
-
19
-
20
-
21
11
 
12
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
13
+ exports.Equation = void 0;
14
+ const polynom_1 = __webpack_require__(/*! ./polynom */ "./src/maths/algebra/polynom.ts");
15
+ const numeric_1 = __webpack_require__(/*! ../numeric */ "./src/maths/numeric.ts");
16
+ const coefficients_1 = __webpack_require__(/*! ../coefficients */ "./src/maths/coefficients/index.ts");
17
+ const coefficients_2 = __webpack_require__(/*! ../coefficients */ "./src/maths/coefficients/index.ts");
22
18
  class Equation {
23
19
  _left;
24
20
  _right;
@@ -28,8 +24,8 @@ class Equation {
28
24
  _varnothing = '\\varnothing';
29
25
  _real = '\\mathbb{R}';
30
26
  constructor(...equations) {
31
- this._left = new _polynom__WEBPACK_IMPORTED_MODULE_0__.Polynom().zero();
32
- this._right = new _polynom__WEBPACK_IMPORTED_MODULE_0__.Polynom().zero();
27
+ this._left = new polynom_1.Polynom().zero();
28
+ this._right = new polynom_1.Polynom().zero();
33
29
  this._sign = '=';
34
30
  if (equations.length === 1) {
35
31
  if (equations[0].isEquation === true) {
@@ -40,8 +36,8 @@ class Equation {
40
36
  }
41
37
  }
42
38
  else if (equations.length === 2) {
43
- this.left = equations[0].isPolynom ? equations[0].clone() : new _polynom__WEBPACK_IMPORTED_MODULE_0__.Polynom(equations[0]);
44
- this.right = equations[1].isPolynom ? equations[1].clone() : new _polynom__WEBPACK_IMPORTED_MODULE_0__.Polynom(equations[1]);
39
+ this.left = (equations[0] instanceof polynom_1.Polynom) ? equations[0].clone() : new polynom_1.Polynom(equations[0]);
40
+ this.right = (equations[1] instanceof polynom_1.Polynom) ? equations[1].clone() : new polynom_1.Polynom(equations[1]);
45
41
  }
46
42
  else {
47
43
  return this;
@@ -123,7 +119,7 @@ class Equation {
123
119
  return;
124
120
  }
125
121
  pStr = equationString.split(strSign);
126
- return this.create(new _polynom__WEBPACK_IMPORTED_MODULE_0__.Polynom(pStr[0]), new _polynom__WEBPACK_IMPORTED_MODULE_0__.Polynom(pStr[1]), this._formatSign(strSign));
122
+ return this.create(new polynom_1.Polynom(pStr[0]), new polynom_1.Polynom(pStr[1]), this._formatSign(strSign));
127
123
  };
128
124
  _findSign = (equationString) => {
129
125
  let strSign = '';
@@ -224,7 +220,7 @@ class Equation {
224
220
  this._randomizeDefaults = value;
225
221
  }
226
222
  randomize = (opts, sign) => {
227
- return new Equation().create(new _polynom__WEBPACK_IMPORTED_MODULE_0__.Polynom(), new _polynom__WEBPACK_IMPORTED_MODULE_0__.Polynom(), sign);
223
+ return new Equation().create(new polynom_1.Polynom(), new polynom_1.Polynom(), sign);
228
224
  };
229
225
  moveLeft = () => {
230
226
  this._left = this._left.clone().subtract(this._right);
@@ -239,7 +235,7 @@ class Equation {
239
235
  }
240
236
  let mMove;
241
237
  for (let m of this._left.monoms) {
242
- if (m.degree() === 0) {
238
+ if (m.degree().isZero()) {
243
239
  mMove = m.clone();
244
240
  this._left.subtract(mMove);
245
241
  this._right.subtract(mMove);
@@ -250,12 +246,12 @@ class Equation {
250
246
  return this;
251
247
  };
252
248
  simplify = () => {
253
- this.multiply(_numeric__WEBPACK_IMPORTED_MODULE_1__.Numeric.lcm(...this._left.getDenominators(), ...this._right.getDenominators()));
254
- this.divide(_numeric__WEBPACK_IMPORTED_MODULE_1__.Numeric.gcd(...this._left.getNumerators(), ...this._right.getNumerators()));
249
+ this.multiply(numeric_1.Numeric.lcm(...this._left.getDenominators(), ...this._right.getDenominators()));
250
+ this.divide(numeric_1.Numeric.gcd(...this._left.getNumerators(), ...this._right.getNumerators()));
255
251
  return this;
256
252
  };
257
253
  isolate = (letter) => {
258
- if (this.degree(letter) !== 1) {
254
+ if (!this.degree(letter).isOne()) {
259
255
  return false;
260
256
  }
261
257
  if (this.isMultiVariable()) {
@@ -285,7 +281,7 @@ class Equation {
285
281
  return this;
286
282
  };
287
283
  multiply = (value) => {
288
- let F = new _coefficients__WEBPACK_IMPORTED_MODULE_2__.Fraction(value);
284
+ let F = new coefficients_1.Fraction(value);
289
285
  this._left.multiply(F);
290
286
  this._right.multiply(F);
291
287
  if (this._sign !== '=' && F.sign() === -1) {
@@ -294,7 +290,7 @@ class Equation {
294
290
  return this;
295
291
  };
296
292
  divide = (value) => {
297
- let F = new _coefficients__WEBPACK_IMPORTED_MODULE_2__.Fraction(value);
293
+ let F = new coefficients_1.Fraction(value);
298
294
  if (F.isZero()) {
299
295
  return this;
300
296
  }
@@ -303,7 +299,7 @@ class Equation {
303
299
  }
304
300
  };
305
301
  degree = (letter) => {
306
- return Math.max(this._left.degree(letter), this._right.degree(letter));
302
+ return coefficients_1.Fraction.max(this._left.degree(letter), this._right.degree(letter));
307
303
  };
308
304
  isMultiVariable = () => {
309
305
  return this._left.isMultiVariable || this._right.isMultiVariable;
@@ -314,7 +310,7 @@ class Equation {
314
310
  solve = (letter) => {
315
311
  this._solutions = [];
316
312
  this._polynom = this._left.clone().subtract(this._right);
317
- switch (this._polynom.degree(letter)) {
313
+ switch (this._polynom.degree(letter).value) {
318
314
  case 0:
319
315
  case 1:
320
316
  this._solveDegree1(letter);
@@ -390,7 +386,7 @@ class Equation {
390
386
  return this._solutions;
391
387
  };
392
388
  _solveDegree2 = (letter) => {
393
- let aF = this._polynom.monomByDegree(2, letter).coefficient, bF = this._polynom.monomByDegree(1, letter).coefficient, cF = this._polynom.monomByDegree(0, letter).coefficient, delta, nthDelta, lcm = _numeric__WEBPACK_IMPORTED_MODULE_1__.Numeric.lcm(aF.denominator, bF.denominator, cF.denominator), a = aF.multiply(lcm).value, b = bF.multiply(lcm).value, c = cF.multiply(lcm).value, realX1, realX2, sX1, sX2;
389
+ let aF = this._polynom.monomByDegree(2, letter).coefficient, bF = this._polynom.monomByDegree(1, letter).coefficient, cF = this._polynom.monomByDegree(0, letter).coefficient, delta, nthDelta, lcm = numeric_1.Numeric.lcm(aF.denominator, bF.denominator, cF.denominator), a = aF.multiply(lcm).value, b = bF.multiply(lcm).value, c = cF.multiply(lcm).value, realX1, realX2, sX1, sX2;
394
390
  delta = b * b - 4 * a * c;
395
391
  if (delta > 0) {
396
392
  realX1 = (-b - Math.sqrt(delta)) / (2 * a);
@@ -402,9 +398,9 @@ class Equation {
402
398
  ];
403
399
  }
404
400
  else {
405
- nthDelta = new _coefficients__WEBPACK_IMPORTED_MODULE_2__.Nthroot().parse(delta).reduce();
401
+ nthDelta = new coefficients_2.Nthroot().parse(delta).reduce();
406
402
  if (nthDelta.hasRadical()) {
407
- let gcd = _numeric__WEBPACK_IMPORTED_MODULE_1__.Numeric.gcd(b, 2 * a, nthDelta.coefficient);
403
+ let gcd = numeric_1.Numeric.gcd(b, 2 * a, nthDelta.coefficient);
408
404
  nthDelta.coefficient = nthDelta.coefficient / gcd;
409
405
  if (b !== 0) {
410
406
  if (2 * a / gcd === 1) {
@@ -437,14 +433,14 @@ class Equation {
437
433
  }
438
434
  else {
439
435
  this._solutions = [
440
- new _coefficients__WEBPACK_IMPORTED_MODULE_2__.Fraction(-b - nthDelta.coefficient, 2 * a).reduce().dfrac,
441
- new _coefficients__WEBPACK_IMPORTED_MODULE_2__.Fraction(-b + nthDelta.coefficient, 2 * a).reduce().dfrac
436
+ new coefficients_1.Fraction(-b - nthDelta.coefficient, 2 * a).reduce().dfrac,
437
+ new coefficients_1.Fraction(-b + nthDelta.coefficient, 2 * a).reduce().dfrac
442
438
  ];
443
439
  }
444
440
  }
445
441
  }
446
442
  else if (delta === 0) {
447
- this._solutions = [new _coefficients__WEBPACK_IMPORTED_MODULE_2__.Fraction(-b, 2 * a).reduce().dfrac];
443
+ this._solutions = [new coefficients_1.Fraction(-b, 2 * a).reduce().dfrac];
448
444
  }
449
445
  else {
450
446
  this._solutions = [this._varnothing];
@@ -499,6 +495,7 @@ class Equation {
499
495
  return this._solutions;
500
496
  };
501
497
  }
498
+ exports.Equation = Equation;
502
499
 
503
500
 
504
501
  /***/ }),
@@ -507,57 +504,26 @@ class Equation {
507
504
  /*!************************************!*\
508
505
  !*** ./src/maths/algebra/index.ts ***!
509
506
  \************************************/
510
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
507
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
511
508
 
512
- __webpack_require__.r(__webpack_exports__);
513
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
514
- /* harmony export */ "Equation": () => (/* reexport safe */ _equation__WEBPACK_IMPORTED_MODULE_0__.Equation),
515
- /* harmony export */ "LinearSystem": () => (/* reexport safe */ _linearSystem__WEBPACK_IMPORTED_MODULE_1__.LinearSystem),
516
- /* harmony export */ "Logicalset": () => (/* reexport safe */ _logicalset__WEBPACK_IMPORTED_MODULE_2__.Logicalset),
517
- /* harmony export */ "Monom": () => (/* reexport safe */ _monom__WEBPACK_IMPORTED_MODULE_3__.Monom),
518
- /* harmony export */ "Polynom": () => (/* reexport safe */ _polynom__WEBPACK_IMPORTED_MODULE_4__.Polynom),
519
- /* harmony export */ "Rational": () => (/* reexport safe */ _rational__WEBPACK_IMPORTED_MODULE_5__.Rational),
520
- /* harmony export */ "Algebra": () => (/* binding */ Algebra)
521
- /* harmony export */ });
522
- /* harmony import */ var _equation__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./equation */ "./src/maths/algebra/equation.ts");
523
- /* harmony import */ var _linearSystem__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./linearSystem */ "./src/maths/algebra/linearSystem.ts");
524
- /* harmony import */ var _logicalset__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./logicalset */ "./src/maths/algebra/logicalset.ts");
525
- /* harmony import */ var _monom__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./monom */ "./src/maths/algebra/monom.ts");
526
- /* harmony import */ var _polynom__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./polynom */ "./src/maths/algebra/polynom.ts");
527
- /* harmony import */ var _rational__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./rational */ "./src/maths/algebra/rational.ts");
528
-
529
-
530
-
531
-
532
-
533
-
534
-
535
-
536
509
 
537
-
538
-
539
-
540
- var Algebra;
541
- (function (Algebra) {
542
- class Polynom extends _polynom__WEBPACK_IMPORTED_MODULE_4__.Polynom {
543
- }
544
- Algebra.Polynom = Polynom;
545
- class Monom extends _monom__WEBPACK_IMPORTED_MODULE_3__.Monom {
546
- }
547
- Algebra.Monom = Monom;
548
- class LinearSystem extends _linearSystem__WEBPACK_IMPORTED_MODULE_1__.LinearSystem {
549
- }
550
- Algebra.LinearSystem = LinearSystem;
551
- class Equation extends _equation__WEBPACK_IMPORTED_MODULE_0__.Equation {
552
- }
553
- Algebra.Equation = Equation;
554
- class LogicalSet extends _logicalset__WEBPACK_IMPORTED_MODULE_2__.Logicalset {
555
- }
556
- Algebra.LogicalSet = LogicalSet;
557
- class Rational extends _rational__WEBPACK_IMPORTED_MODULE_5__.Rational {
558
- }
559
- Algebra.Rational = Rational;
560
- })(Algebra || (Algebra = {}));
510
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
511
+ if (k2 === undefined) k2 = k;
512
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
513
+ }) : (function(o, m, k, k2) {
514
+ if (k2 === undefined) k2 = k;
515
+ o[k2] = m[k];
516
+ }));
517
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
518
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
519
+ };
520
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
521
+ __exportStar(__webpack_require__(/*! ./equation */ "./src/maths/algebra/equation.ts"), exports);
522
+ __exportStar(__webpack_require__(/*! ./linearSystem */ "./src/maths/algebra/linearSystem.ts"), exports);
523
+ __exportStar(__webpack_require__(/*! ./logicalset */ "./src/maths/algebra/logicalset.ts"), exports);
524
+ __exportStar(__webpack_require__(/*! ./monom */ "./src/maths/algebra/monom.ts"), exports);
525
+ __exportStar(__webpack_require__(/*! ./polynom */ "./src/maths/algebra/polynom.ts"), exports);
526
+ __exportStar(__webpack_require__(/*! ./rational */ "./src/maths/algebra/rational.ts"), exports);
561
527
 
562
528
 
563
529
  /***/ }),
@@ -566,20 +532,15 @@ var Algebra;
566
532
  /*!*******************************************!*\
567
533
  !*** ./src/maths/algebra/linearSystem.ts ***!
568
534
  \*******************************************/
569
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
535
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
570
536
 
571
- __webpack_require__.r(__webpack_exports__);
572
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
573
- /* harmony export */ "LinearSystem": () => (/* binding */ LinearSystem)
574
- /* harmony export */ });
575
- /* harmony import */ var _coefficients__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../coefficients */ "./src/maths/coefficients/index.ts");
576
- /* harmony import */ var _equation__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./equation */ "./src/maths/algebra/equation.ts");
577
- /* harmony import */ var _polynom__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./polynom */ "./src/maths/algebra/polynom.ts");
578
- /* harmony import */ var _random__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../random */ "./src/maths/random/index.ts");
579
-
580
-
581
-
582
537
 
538
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
539
+ exports.LinearSystem = void 0;
540
+ const coefficients_1 = __webpack_require__(/*! ../coefficients */ "./src/maths/coefficients/index.ts");
541
+ const equation_1 = __webpack_require__(/*! ./equation */ "./src/maths/algebra/equation.ts");
542
+ const polynom_1 = __webpack_require__(/*! ./polynom */ "./src/maths/algebra/polynom.ts");
543
+ const random_1 = __webpack_require__(/*! ../random */ "./src/maths/random/index.ts");
583
544
  class LinearSystem {
584
545
  _solutions;
585
546
  _resolutionSteps;
@@ -593,7 +554,7 @@ class LinearSystem {
593
554
  }
594
555
  return this;
595
556
  }
596
- get isLinerarSystem() {
557
+ get isLinearSystem() {
597
558
  return true;
598
559
  }
599
560
  get equations() {
@@ -660,7 +621,7 @@ class LinearSystem {
660
621
  return `(${tex.join(';')})`;
661
622
  }
662
623
  parse = (...equations) => {
663
- this._equations = equations.map(value => new _equation__WEBPACK_IMPORTED_MODULE_1__.Equation(value));
624
+ this._equations = equations.map(value => new equation_1.Equation(value));
664
625
  this._findLetters();
665
626
  return this;
666
627
  };
@@ -668,7 +629,7 @@ class LinearSystem {
668
629
  this._equations = [];
669
630
  let i = 0;
670
631
  while (i < coefficients.length - this._letters.length) {
671
- let left = new _polynom__WEBPACK_IMPORTED_MODULE_2__.Polynom().parse(this._letters.join(''), ...coefficients.slice(i, i + this._letters.length)), right = new _polynom__WEBPACK_IMPORTED_MODULE_2__.Polynom(coefficients[i + this._letters.length].toString()), equ = new _equation__WEBPACK_IMPORTED_MODULE_1__.Equation().create(left, right);
632
+ let left = new polynom_1.Polynom().parse(this._letters.join(''), ...coefficients.slice(i, i + this._letters.length)), right = new polynom_1.Polynom(coefficients[i + this._letters.length].toString()), equ = new equation_1.Equation().create(left, right);
672
633
  this._equations.push(equ.clone());
673
634
  i = i + this._letters.length + 1;
674
635
  }
@@ -693,7 +654,7 @@ class LinearSystem {
693
654
  let solutionsF = [];
694
655
  for (let s of solutions) {
695
656
  if (typeof s === "number") {
696
- solutionsF.push(new _coefficients__WEBPACK_IMPORTED_MODULE_0__.Fraction(s.toString()));
657
+ solutionsF.push(new coefficients_1.Fraction(s.toString()));
697
658
  }
698
659
  else {
699
660
  solutionsF.push(s.clone());
@@ -706,15 +667,15 @@ class LinearSystem {
706
667
  return this;
707
668
  };
708
669
  _generateOneEquation = (...solutions) => {
709
- let coeff = [], leftValue = new _coefficients__WEBPACK_IMPORTED_MODULE_0__.Fraction().zero(), letters = ['x', 'y', 'z', 't', 'u', 'v', 'w', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l'], equString = '', equ;
670
+ let coeff = [], leftValue = new coefficients_1.Fraction().zero(), letters = ['x', 'y', 'z', 't', 'u', 'v', 'w', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l'], equString = '', equ;
710
671
  for (let i = 0; i < solutions.length; i++) {
711
- coeff.push(_random__WEBPACK_IMPORTED_MODULE_3__.Random.numberSym(5));
672
+ coeff.push(random_1.Random.numberSym(5));
712
673
  leftValue.add(solutions[i].clone().multiply(coeff[i]));
713
674
  equString += `${(coeff[i] < 0) ? coeff[i] : '+' + coeff[i]}${letters[i]}`;
714
675
  }
715
- equ = new _equation__WEBPACK_IMPORTED_MODULE_1__.Equation(`${equString}=${leftValue.display}`);
676
+ equ = new equation_1.Equation(`${equString}=${leftValue.display}`);
716
677
  if (equ.right.monoms[0].coefficient.denominator != 1) {
717
- equ.multiply(new _coefficients__WEBPACK_IMPORTED_MODULE_0__.Fraction(equ.right.monoms[0].coefficient.denominator, 1));
678
+ equ.multiply(new coefficients_1.Fraction(equ.right.monoms[0].coefficient.denominator, 1));
718
679
  }
719
680
  if (this._checkIfLinerCombination(equ)) {
720
681
  return equ;
@@ -728,7 +689,7 @@ class LinearSystem {
728
689
  return this.mergeEquations(eq1, eq2, c2, c1);
729
690
  }
730
691
  mergeEquations = (eq1, eq2, factor1, factor2) => {
731
- let eq1multiplied = eq1.clone().multiply(new _coefficients__WEBPACK_IMPORTED_MODULE_0__.Fraction(factor1)), eq2multiplied = eq2.clone().multiply(new _coefficients__WEBPACK_IMPORTED_MODULE_0__.Fraction(factor2));
692
+ let eq1multiplied = eq1.clone().multiply(new coefficients_1.Fraction(factor1)), eq2multiplied = eq2.clone().multiply(new coefficients_1.Fraction(factor2));
732
693
  eq1multiplied.left.add(eq2multiplied.left);
733
694
  eq1multiplied.right.add(eq2multiplied.right);
734
695
  return eq1multiplied;
@@ -768,7 +729,7 @@ class LinearSystem {
768
729
  let E = this._resolutionSteps[this._resolutionSteps.length - 1].equations[0];
769
730
  E.solve();
770
731
  return {
771
- value: new _coefficients__WEBPACK_IMPORTED_MODULE_0__.Fraction(E.solutions[0]),
732
+ value: new coefficients_1.Fraction(E.solutions[0]),
772
733
  isReal: E.isReal,
773
734
  isVarnothing: E.isVarnothing
774
735
  };
@@ -782,6 +743,7 @@ class LinearSystem {
782
743
  return str;
783
744
  };
784
745
  }
746
+ exports.LinearSystem = LinearSystem;
785
747
 
786
748
 
787
749
  /***/ }),
@@ -790,14 +752,12 @@ class LinearSystem {
790
752
  /*!*****************************************!*\
791
753
  !*** ./src/maths/algebra/logicalset.ts ***!
792
754
  \*****************************************/
793
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
755
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
794
756
 
795
- __webpack_require__.r(__webpack_exports__);
796
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
797
- /* harmony export */ "Logicalset": () => (/* binding */ Logicalset)
798
- /* harmony export */ });
799
- /* harmony import */ var _shutingyard__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../shutingyard */ "./src/maths/shutingyard.ts");
800
757
 
758
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
759
+ exports.Logicalset = void 0;
760
+ const shutingyard_1 = __webpack_require__(/*! ../shutingyard */ "./src/maths/shutingyard.ts");
801
761
  class Logicalset {
802
762
  _rawString;
803
763
  _rpn;
@@ -811,7 +771,7 @@ class Logicalset {
811
771
  }
812
772
  ;
813
773
  parse = (value) => {
814
- this._rpn = new _shutingyard__WEBPACK_IMPORTED_MODULE_0__.Shutingyard('set').parse(value).rpn;
774
+ this._rpn = new shutingyard_1.Shutingyard('set').parse(value).rpn;
815
775
  return this;
816
776
  };
817
777
  evaluate(tokenSets, reference) {
@@ -938,6 +898,7 @@ class Logicalset {
938
898
  return varStack[0].token;
939
899
  }
940
900
  }
901
+ exports.Logicalset = Logicalset;
941
902
 
942
903
 
943
904
  /***/ }),
@@ -946,16 +907,14 @@ class Logicalset {
946
907
  /*!************************************!*\
947
908
  !*** ./src/maths/algebra/monom.ts ***!
948
909
  \************************************/
949
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
910
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
950
911
 
951
- __webpack_require__.r(__webpack_exports__);
952
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
953
- /* harmony export */ "Monom": () => (/* binding */ Monom)
954
- /* harmony export */ });
955
- /* harmony import */ var _coefficients_fraction__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../coefficients/fraction */ "./src/maths/coefficients/fraction.ts");
956
- /* harmony import */ var _numeric__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../numeric */ "./src/maths/numeric.ts");
957
-
958
912
 
913
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
914
+ exports.Monom = void 0;
915
+ const coefficients_1 = __webpack_require__(/*! ../coefficients */ "./src/maths/coefficients/index.ts");
916
+ const numeric_1 = __webpack_require__(/*! ../numeric */ "./src/maths/numeric.ts");
917
+ const shutingyard_1 = __webpack_require__(/*! ../shutingyard */ "./src/maths/shutingyard.ts");
959
918
  class Monom {
960
919
  _coefficient;
961
920
  _literal;
@@ -966,9 +925,6 @@ class Monom {
966
925
  }
967
926
  return this;
968
927
  }
969
- get isMonom() {
970
- return true;
971
- }
972
928
  get coefficient() {
973
929
  return this._coefficient;
974
930
  }
@@ -979,10 +935,10 @@ class Monom {
979
935
  return this._literal;
980
936
  }
981
937
  get literalSqrt() {
982
- if (this.isLitteralSquare()) {
938
+ if (this.isLiteralSquare()) {
983
939
  let L = {};
984
940
  for (let key in this._literal) {
985
- L[key] = this._literal[key] / 2;
941
+ L[key] = this._literal[key].clone().sqrt();
986
942
  }
987
943
  return L;
988
944
  }
@@ -996,15 +952,15 @@ class Monom {
996
952
  set literalStr(inputStr) {
997
953
  for (const v of [...inputStr.matchAll(/([a-z])\^([+-]?[0-9]+)/g)]) {
998
954
  if (!(v[1] in this._literal)) {
999
- this._literal[v[1]] = 0;
955
+ this._literal[v[1]] = new coefficients_1.Fraction().zero();
1000
956
  }
1001
- this._literal[v[1]] += +v[2];
957
+ this._literal[v[1]].add(+v[2]);
1002
958
  }
1003
959
  for (const v of [...inputStr.matchAll(/([a-z](?!\^))/g)]) {
1004
960
  if (!(v[1] in this._literal)) {
1005
- this._literal[v[1]] = 0;
961
+ this._literal[v[1]] = new coefficients_1.Fraction().zero();
1006
962
  }
1007
- this._literal[v[1]] += 1;
963
+ this._literal[v[1]].add(1);
1008
964
  }
1009
965
  }
1010
966
  get variables() {
@@ -1012,12 +968,12 @@ class Monom {
1012
968
  return Object.keys(this._literal);
1013
969
  }
1014
970
  get display() {
1015
- let L = '';
1016
- for (let letter in this._literal) {
1017
- if (this._literal[letter] !== 0) {
971
+ let L = '', letters = Object.keys(this._literal).sort();
972
+ for (let letter of letters) {
973
+ if (this._literal[letter].isNotZero()) {
1018
974
  L += `${letter}`;
1019
- if (this._literal[letter] > 1) {
1020
- L += `^${this._literal[letter]}`;
975
+ if (this._literal[letter].isNotEqual(1)) {
976
+ L += `^${this._literal[letter].display}`;
1021
977
  }
1022
978
  }
1023
979
  }
@@ -1048,29 +1004,32 @@ class Monom {
1048
1004
  if (this.coefficient.denominator !== 1) {
1049
1005
  return [this.clone()];
1050
1006
  }
1007
+ if (this.hasFractionCoefficient) {
1008
+ return [this.clone()];
1009
+ }
1051
1010
  if (this.coefficient.numerator > 10000) {
1052
1011
  return [this.clone()];
1053
1012
  }
1054
- const dividers = _numeric__WEBPACK_IMPORTED_MODULE_1__.Numeric.dividers(Math.abs(this.coefficient.numerator));
1055
- let litterals = [];
1013
+ const dividers = numeric_1.Numeric.dividers(Math.abs(this.coefficient.numerator));
1014
+ let literals = [];
1056
1015
  for (let L in this.literal) {
1057
- litterals = this._getLitteralDividers(litterals, L);
1016
+ literals = this._getLiteralDividers(literals, L);
1058
1017
  }
1059
1018
  const monomDividers = [];
1060
- if (litterals.length > 0 && dividers.length > 0) {
1019
+ if (literals.length > 0 && dividers.length > 0) {
1061
1020
  for (let N of dividers) {
1062
- for (let L of litterals) {
1021
+ for (let L of literals) {
1063
1022
  let M = new Monom();
1064
- M.coefficient = new _coefficients_fraction__WEBPACK_IMPORTED_MODULE_0__.Fraction(N);
1023
+ M.coefficient = new coefficients_1.Fraction(N);
1065
1024
  M.literal = L;
1066
1025
  monomDividers.push(M);
1067
1026
  }
1068
1027
  }
1069
1028
  }
1070
1029
  else if (dividers.length === 0) {
1071
- for (let L of litterals) {
1030
+ for (let L of literals) {
1072
1031
  let M = new Monom();
1073
- M.coefficient = new _coefficients_fraction__WEBPACK_IMPORTED_MODULE_0__.Fraction().one();
1032
+ M.coefficient = new coefficients_1.Fraction().one();
1074
1033
  M.literal = L;
1075
1034
  monomDividers.push(M);
1076
1035
  }
@@ -1078,18 +1037,18 @@ class Monom {
1078
1037
  else {
1079
1038
  for (let N of dividers) {
1080
1039
  let M = new Monom();
1081
- M.coefficient = new _coefficients_fraction__WEBPACK_IMPORTED_MODULE_0__.Fraction(N);
1040
+ M.coefficient = new coefficients_1.Fraction(N);
1082
1041
  monomDividers.push(M);
1083
1042
  }
1084
1043
  }
1085
1044
  return monomDividers.length === 0 ? [new Monom().one()] : monomDividers;
1086
1045
  }
1087
- _getLitteralDividers(arr, letter) {
1046
+ _getLiteralDividers(arr, letter) {
1088
1047
  let tmpList = [];
1089
- for (let d = 0; d <= this.literal[letter]; d++) {
1048
+ for (let d = 0; d <= this.literal[letter].value; d++) {
1090
1049
  if (arr.length === 0) {
1091
1050
  let litt = {};
1092
- litt[letter] = d;
1051
+ litt[letter] = new coefficients_1.Fraction(d);
1093
1052
  tmpList.push(litt);
1094
1053
  }
1095
1054
  else {
@@ -1098,7 +1057,7 @@ class Monom {
1098
1057
  for (let currentLetter in item) {
1099
1058
  litt[currentLetter] = item[currentLetter];
1100
1059
  }
1101
- litt[letter] = d;
1060
+ litt[letter] = new coefficients_1.Fraction(d);
1102
1061
  tmpList.push(litt);
1103
1062
  }
1104
1063
  }
@@ -1110,12 +1069,12 @@ class Monom {
1110
1069
  return (d[0] !== '-' ? '+' : '') + d;
1111
1070
  }
1112
1071
  get tex() {
1113
- let L = '';
1114
- for (let letter in this._literal) {
1115
- if (this._literal[letter] !== 0) {
1072
+ let L = '', letters = Object.keys(this._literal).sort();
1073
+ for (let letter of letters) {
1074
+ if (this._literal[letter].isNotZero()) {
1116
1075
  L += `${letter}`;
1117
- if (this._literal[letter] > 1) {
1118
- L += `^${this._literal[letter]}`;
1076
+ if (this._literal[letter].isNotEqual(1)) {
1077
+ L += `^{${this._literal[letter].display}}`;
1119
1078
  }
1120
1079
  }
1121
1080
  }
@@ -1143,37 +1102,96 @@ class Monom {
1143
1102
  }
1144
1103
  }
1145
1104
  parse = (inputStr) => {
1146
- this.literalStr = inputStr;
1147
- this._coefficient = new _coefficients_fraction__WEBPACK_IMPORTED_MODULE_0__.Fraction();
1148
- for (const v of [...inputStr.replace(/([a-z])|(\^[+-]?[0-9]+)/g, ',').split(',')]) {
1149
- if (v.trim() === '') {
1150
- continue;
1105
+ this._shutingYardToReducedMonom(inputStr);
1106
+ return this;
1107
+ };
1108
+ _shutingYardToReducedMonom = (inputStr) => {
1109
+ const SY = new shutingyard_1.Shutingyard().parse(inputStr);
1110
+ const rpn = SY.rpn;
1111
+ let stack = [], m, pow, letter, q1, q2;
1112
+ if (rpn.length === 0) {
1113
+ this.zero();
1114
+ return this;
1115
+ }
1116
+ else if (rpn.length === 1) {
1117
+ const element = rpn[0];
1118
+ this.one();
1119
+ if (element.tokenType === 'coefficient') {
1120
+ this.coefficient = new coefficients_1.Fraction(element.token);
1121
+ }
1122
+ else if (element.tokenType === 'variable') {
1123
+ this.setLetter(element.token, 1);
1124
+ }
1125
+ return this;
1126
+ }
1127
+ else {
1128
+ for (const element of rpn) {
1129
+ if (element.tokenType === 'coefficient') {
1130
+ let M = new Monom().one();
1131
+ M.coefficient = new coefficients_1.Fraction(element.token);
1132
+ stack.push(M.clone());
1133
+ }
1134
+ else if (element.tokenType === 'variable') {
1135
+ let M = new Monom().one();
1136
+ M.setLetter(element.token, 1);
1137
+ stack.push(M.clone());
1138
+ }
1139
+ else if (element.tokenType === 'operation') {
1140
+ switch (element.token) {
1141
+ case '-':
1142
+ q2 = (stack.pop()) || new Monom().zero();
1143
+ q1 = (stack.pop()) || new Monom().zero();
1144
+ stack.push(q1.subtract(q2));
1145
+ break;
1146
+ case '*':
1147
+ q2 = (stack.pop()) || new Monom().one();
1148
+ q1 = (stack.pop()) || new Monom().one();
1149
+ stack.push(q1.multiply(q2));
1150
+ break;
1151
+ case '^':
1152
+ pow = (stack.pop().coefficient) || new coefficients_1.Fraction().one();
1153
+ m = (stack.pop()) || new Monom().one();
1154
+ letter = m.variables[0];
1155
+ if (letter !== undefined) {
1156
+ m.setLetter(letter, pow);
1157
+ }
1158
+ stack.push(m);
1159
+ break;
1160
+ }
1161
+ }
1151
1162
  }
1152
- this._coefficient.multiply(new _coefficients_fraction__WEBPACK_IMPORTED_MODULE_0__.Fraction(v.trim()));
1153
1163
  }
1164
+ this.one();
1165
+ this.multiply(stack[0]);
1154
1166
  return this;
1155
1167
  };
1156
1168
  clone = () => {
1157
1169
  let F = new Monom();
1158
1170
  F.coefficient = this._coefficient.clone();
1159
1171
  for (let k in this._literal) {
1160
- F.setLetter(k, this._literal[k]);
1172
+ F.setLetter(k, this._literal[k].clone());
1161
1173
  }
1162
1174
  return F;
1163
1175
  };
1176
+ makeSame = (M) => {
1177
+ for (let k in M._literal) {
1178
+ this.setLetter(k, M._literal[k].clone());
1179
+ }
1180
+ return this;
1181
+ };
1164
1182
  zero = () => {
1165
- this._coefficient = new _coefficients_fraction__WEBPACK_IMPORTED_MODULE_0__.Fraction().zero();
1183
+ this._coefficient = new coefficients_1.Fraction().zero();
1166
1184
  this._literal = {};
1167
1185
  return this;
1168
1186
  };
1169
1187
  one = () => {
1170
- this._coefficient = new _coefficients_fraction__WEBPACK_IMPORTED_MODULE_0__.Fraction().one();
1188
+ this._coefficient = new coefficients_1.Fraction().one();
1171
1189
  this._literal = {};
1172
1190
  return this;
1173
1191
  };
1174
1192
  clean = () => {
1175
1193
  for (let letter in this._literal) {
1176
- if (this._literal[letter] === 0) {
1194
+ if (this._literal[letter].isZero()) {
1177
1195
  delete this._literal[letter];
1178
1196
  }
1179
1197
  }
@@ -1186,6 +1204,9 @@ class Monom {
1186
1204
  add = (...M) => {
1187
1205
  for (let m of M) {
1188
1206
  if (this.isSameAs(m)) {
1207
+ if (this.isZero()) {
1208
+ this.makeSame(m);
1209
+ }
1189
1210
  this._coefficient.add(m.coefficient);
1190
1211
  }
1191
1212
  else {
@@ -1197,7 +1218,10 @@ class Monom {
1197
1218
  subtract = (...M) => {
1198
1219
  for (let m of M) {
1199
1220
  if (this.isSameAs(m)) {
1200
- this._coefficient.add(m.coefficient.clone().opposed());
1221
+ if (this.isZero()) {
1222
+ this.makeSame(m);
1223
+ }
1224
+ this._coefficient.add(m.clone().coefficient.opposed());
1201
1225
  }
1202
1226
  else {
1203
1227
  console.log('Subtract: Is not similar: ', m.display);
@@ -1209,7 +1233,12 @@ class Monom {
1209
1233
  for (let m of M) {
1210
1234
  this._coefficient.multiply(m.coefficient);
1211
1235
  for (let letter in m.literal) {
1212
- this._literal[letter] = (this._literal[letter] === undefined) ? m.literal[letter] : this._literal[letter] + m.literal[letter];
1236
+ if (this._literal[letter] === undefined) {
1237
+ this._literal[letter] = m.literal[letter].clone();
1238
+ }
1239
+ else {
1240
+ this._literal[letter].add(m.literal[letter]);
1241
+ }
1213
1242
  }
1214
1243
  }
1215
1244
  return this;
@@ -1222,8 +1251,8 @@ class Monom {
1222
1251
  for (let v of M) {
1223
1252
  this._coefficient.divide(v.coefficient);
1224
1253
  for (let letter in v.literal) {
1225
- this._literal[letter] = (this._literal[letter] === undefined) ? -v.literal[letter] : this._literal[letter] - v.literal[letter];
1226
- if (this._literal[letter] === 0) {
1254
+ this._literal[letter] = (this._literal[letter] === undefined) ? v.literal[letter].clone().opposed() : this._literal[letter].subtract(v.literal[letter]);
1255
+ if (this._literal[letter].isZero()) {
1227
1256
  delete this._literal[letter];
1228
1257
  }
1229
1258
  }
@@ -1233,7 +1262,7 @@ class Monom {
1233
1262
  pow = (nb) => {
1234
1263
  this._coefficient.pow(nb);
1235
1264
  for (let letter in this._literal) {
1236
- this._literal[letter] *= nb;
1265
+ this._literal[letter].pow(nb);
1237
1266
  }
1238
1267
  return this;
1239
1268
  };
@@ -1244,7 +1273,7 @@ class Monom {
1244
1273
  if (this.isSquare()) {
1245
1274
  this._coefficient.sqrt();
1246
1275
  for (let letter in this._literal) {
1247
- this._literal[letter] /= 2;
1276
+ this._literal[letter].clone().divide(2);
1248
1277
  }
1249
1278
  }
1250
1279
  return this.root(2);
@@ -1261,12 +1290,14 @@ class Monom {
1261
1290
  return this._coefficient.isEqual(M.coefficient);
1262
1291
  case 'same':
1263
1292
  let M1 = this.variables, M2 = M.variables, K = M1.concat(M2.filter((item) => M1.indexOf(item) < 0));
1264
- for (let key of K) {
1265
- if (this._literal[key] === undefined || M.literal[key] === undefined) {
1266
- return false;
1267
- }
1268
- if (this._literal[key] !== M.literal[key]) {
1269
- return false;
1293
+ if (!this.isZero() && !M.isZero()) {
1294
+ for (let key of K) {
1295
+ if (this._literal[key] === undefined || M.literal[key] === undefined) {
1296
+ return false;
1297
+ }
1298
+ if (!this._literal[key].isEqual(M.literal[key])) {
1299
+ return false;
1300
+ }
1270
1301
  }
1271
1302
  }
1272
1303
  return true;
@@ -1290,53 +1321,68 @@ class Monom {
1290
1321
  if (!this.coefficient.isSquare()) {
1291
1322
  return false;
1292
1323
  }
1293
- return this.isLitteralSquare();
1324
+ return this.isLiteralSquare();
1294
1325
  };
1295
- isLitteralSquare = () => {
1326
+ isLiteralSquare = () => {
1296
1327
  for (let letter in this.literal) {
1297
- if (this.literal[letter] % 2 !== 0) {
1328
+ if (this.literal[letter].isRational()) {
1329
+ return false;
1330
+ }
1331
+ if (this.literal[letter].isEven()) {
1298
1332
  return false;
1299
1333
  }
1300
1334
  }
1301
1335
  return true;
1302
1336
  };
1337
+ hasFractionCoefficient = () => {
1338
+ for (let letter in this._literal) {
1339
+ if (this._literal[letter].isRational()) {
1340
+ return true;
1341
+ }
1342
+ }
1343
+ return false;
1344
+ };
1303
1345
  hasLetter = (letter) => {
1304
- return this._literal[letter === undefined ? 'x' : letter] > 0;
1346
+ if (this._literal[letter === undefined ? 'x' : letter] === undefined) {
1347
+ return false;
1348
+ }
1349
+ return this._literal[letter === undefined ? 'x' : letter].isNotZero();
1305
1350
  };
1306
1351
  setLetter = (letter, pow) => {
1307
- if (pow <= 0 || !Number.isSafeInteger(pow)) {
1308
- if (this._literal[letter] !== undefined) {
1352
+ if (pow instanceof coefficients_1.Fraction) {
1353
+ if (this.hasLetter(letter) && pow.isZero()) {
1309
1354
  delete this._literal[letter];
1310
1355
  }
1356
+ this._literal[letter] = pow.clone();
1311
1357
  }
1312
1358
  else {
1313
- this._literal[letter] = pow;
1359
+ this.setLetter(letter, new coefficients_1.Fraction(pow));
1314
1360
  }
1315
1361
  };
1316
1362
  degree = (letter) => {
1317
1363
  if (this.variables.length === 0) {
1318
- return 0;
1364
+ return new coefficients_1.Fraction().zero();
1319
1365
  }
1320
1366
  if (letter === undefined) {
1321
- return Object.values(this._literal).reduce((t, n) => t + n);
1367
+ return Object.values(this._literal).reduce((t, n) => t.clone().add(n));
1322
1368
  }
1323
1369
  else {
1324
- return this._literal[letter] === undefined ? 0 : this._literal[letter];
1370
+ return this._literal[letter] === undefined ? new coefficients_1.Fraction().zero() : this._literal[letter].clone();
1325
1371
  }
1326
1372
  };
1327
1373
  evaluate = (values) => {
1328
1374
  let r = this.coefficient.clone();
1329
- if (typeof values === 'number' || values instanceof _coefficients_fraction__WEBPACK_IMPORTED_MODULE_0__.Fraction) {
1375
+ if (typeof values === 'number' || values instanceof coefficients_1.Fraction) {
1330
1376
  let tmpValues = {};
1331
- tmpValues[this.variables[0]] = new _coefficients_fraction__WEBPACK_IMPORTED_MODULE_0__.Fraction(values);
1377
+ tmpValues[this.variables[0]] = new coefficients_1.Fraction(values);
1332
1378
  return this.evaluate(tmpValues);
1333
1379
  }
1334
1380
  if (typeof values === 'object') {
1335
1381
  for (let L in this._literal) {
1336
1382
  if (values[L] === undefined) {
1337
- return new _coefficients_fraction__WEBPACK_IMPORTED_MODULE_0__.Fraction().zero();
1383
+ return new coefficients_1.Fraction().zero();
1338
1384
  }
1339
- let value = new _coefficients_fraction__WEBPACK_IMPORTED_MODULE_0__.Fraction(values[L]);
1385
+ let value = new coefficients_1.Fraction(values[L]);
1340
1386
  r.multiply(value.pow(this._literal[L]));
1341
1387
  }
1342
1388
  }
@@ -1347,9 +1393,9 @@ class Monom {
1347
1393
  letter = 'x';
1348
1394
  }
1349
1395
  if (this.hasLetter(letter)) {
1350
- let d = +this._literal[letter], dM = this.clone();
1351
- dM._literal[letter] -= 1;
1352
- dM._coefficient.multiply(new _coefficients_fraction__WEBPACK_IMPORTED_MODULE_0__.Fraction('' + d));
1396
+ let d = this._literal[letter].clone(), dM = this.clone();
1397
+ dM._literal[letter].subtract(1);
1398
+ dM._coefficient.multiply(new coefficients_1.Fraction(d.clone()));
1353
1399
  return dM;
1354
1400
  }
1355
1401
  else {
@@ -1360,34 +1406,40 @@ class Monom {
1360
1406
  if (letter === undefined) {
1361
1407
  letter = 'x';
1362
1408
  }
1363
- let M = this.clone();
1409
+ let M = this.clone(), degree;
1364
1410
  if (M.hasLetter(letter)) {
1365
- M.coefficient = M.coefficient.clone().divide(M.degree(letter) + 1);
1366
- M.setLetter(letter, M.degree(letter) + 1);
1411
+ degree = M.degree(letter).clone().add(1);
1412
+ M.coefficient = M.coefficient.clone().divide(degree);
1413
+ M.setLetter(letter, degree);
1367
1414
  }
1368
1415
  else {
1369
1416
  if (M.coefficient.isZero()) {
1370
- M.coefficient = new _coefficients_fraction__WEBPACK_IMPORTED_MODULE_0__.Fraction().one();
1417
+ M.coefficient = new coefficients_1.Fraction().one();
1371
1418
  }
1372
1419
  M.setLetter(letter, 1);
1373
1420
  }
1374
1421
  return M;
1375
1422
  };
1376
1423
  static lcm = (...monoms) => {
1377
- let M = new Monom(), coeffN = monoms.map(value => value.coefficient.numerator), coeffD = monoms.map(value => value.coefficient.denominator), n = _numeric__WEBPACK_IMPORTED_MODULE_1__.Numeric.gcd(...coeffN), d = _numeric__WEBPACK_IMPORTED_MODULE_1__.Numeric.lcm(...coeffD);
1378
- M.coefficient = new _coefficients_fraction__WEBPACK_IMPORTED_MODULE_0__.Fraction(n, d).reduce();
1424
+ for (let m of monoms) {
1425
+ if (m.hasFractionCoefficient()) {
1426
+ return new Monom().zero();
1427
+ }
1428
+ }
1429
+ let M = new Monom(), coeffN = monoms.map(value => value.coefficient.numerator), coeffD = monoms.map(value => value.coefficient.denominator), n = numeric_1.Numeric.gcd(...coeffN), d = numeric_1.Numeric.lcm(...coeffD);
1430
+ M.coefficient = new coefficients_1.Fraction(n, d).reduce();
1379
1431
  for (let m of monoms) {
1380
1432
  for (let letter in M.literal) {
1381
1433
  if (!(letter in m.literal)) {
1382
- M.literal[letter] = 0;
1434
+ M.literal[letter].zero();
1383
1435
  }
1384
1436
  }
1385
1437
  for (let letter in m.literal) {
1386
- if (M.literal[letter] === undefined && m.literal[letter] > 0) {
1387
- M.literal[letter] = m.literal[letter];
1438
+ if (M.literal[letter] === undefined && m.literal[letter].isStrictlyPositive()) {
1439
+ M.literal[letter] = m.literal[letter].clone();
1388
1440
  }
1389
1441
  else {
1390
- M.literal[letter] = Math.min(m.literal[letter], M.literal[letter]);
1442
+ M.literal[letter] = new coefficients_1.Fraction(Math.min(m.literal[letter].value, M.literal[letter].value));
1391
1443
  }
1392
1444
  }
1393
1445
  }
@@ -1421,6 +1473,7 @@ class Monom {
1421
1473
  return true;
1422
1474
  };
1423
1475
  }
1476
+ exports.Monom = Monom;
1424
1477
 
1425
1478
 
1426
1479
  /***/ }),
@@ -1429,22 +1482,15 @@ class Monom {
1429
1482
  /*!**************************************!*\
1430
1483
  !*** ./src/maths/algebra/polynom.ts ***!
1431
1484
  \**************************************/
1432
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1485
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
1433
1486
 
1434
- __webpack_require__.r(__webpack_exports__);
1435
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1436
- /* harmony export */ "Polynom": () => (/* binding */ Polynom)
1437
- /* harmony export */ });
1438
- /* harmony import */ var _monom__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./monom */ "./src/maths/algebra/monom.ts");
1439
- /* harmony import */ var _shutingyard__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../shutingyard */ "./src/maths/shutingyard.ts");
1440
- /* harmony import */ var _numeric__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../numeric */ "./src/maths/numeric.ts");
1441
- /* harmony import */ var _random__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../random */ "./src/maths/random/index.ts");
1442
- /* harmony import */ var _coefficients_fraction__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../coefficients/fraction */ "./src/maths/coefficients/fraction.ts");
1443
-
1444
-
1445
-
1446
-
1447
1487
 
1488
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
1489
+ exports.Polynom = void 0;
1490
+ const monom_1 = __webpack_require__(/*! ./monom */ "./src/maths/algebra/monom.ts");
1491
+ const shutingyard_1 = __webpack_require__(/*! ../shutingyard */ "./src/maths/shutingyard.ts");
1492
+ const numeric_1 = __webpack_require__(/*! ../numeric */ "./src/maths/numeric.ts");
1493
+ const coefficients_1 = __webpack_require__(/*! ../coefficients */ "./src/maths/coefficients/index.ts");
1448
1494
  class Polynom {
1449
1495
  _rawString;
1450
1496
  _monoms;
@@ -1458,10 +1504,6 @@ class Polynom {
1458
1504
  }
1459
1505
  return this;
1460
1506
  }
1461
- get isPolynom() {
1462
- return true;
1463
- }
1464
- ;
1465
1507
  get monoms() {
1466
1508
  return this._monoms;
1467
1509
  }
@@ -1549,9 +1591,7 @@ class Polynom {
1549
1591
  this._rawString = inputStr;
1550
1592
  if (inputStr !== '' && !isNaN(Number(inputStr))) {
1551
1593
  this.empty();
1552
- let m = new _monom__WEBPACK_IMPORTED_MODULE_0__.Monom();
1553
- m.coefficient = new _coefficients_fraction__WEBPACK_IMPORTED_MODULE_4__.Fraction(inputStr);
1554
- m.literalStr = '';
1594
+ let m = new monom_1.Monom(inputStr);
1555
1595
  this.add(m);
1556
1596
  return this;
1557
1597
  }
@@ -1559,11 +1599,11 @@ class Polynom {
1559
1599
  }
1560
1600
  else if (/^[a-z]/.test(inputStr)) {
1561
1601
  this.empty();
1562
- let fractions = values.map(x => new _coefficients_fraction__WEBPACK_IMPORTED_MODULE_4__.Fraction(x));
1602
+ let fractions = values.map(x => new coefficients_1.Fraction(x));
1563
1603
  if (inputStr.length > 1) {
1564
1604
  let letters = inputStr.split(''), i = 0;
1565
1605
  for (let F of fractions) {
1566
- let m = new _monom__WEBPACK_IMPORTED_MODULE_0__.Monom();
1606
+ let m = new monom_1.Monom();
1567
1607
  m.coefficient = F.clone();
1568
1608
  m.literalStr = letters[i] || '';
1569
1609
  this.add(m);
@@ -1573,7 +1613,7 @@ class Polynom {
1573
1613
  else {
1574
1614
  let n = fractions.length - 1;
1575
1615
  for (let F of fractions) {
1576
- let m = new _monom__WEBPACK_IMPORTED_MODULE_0__.Monom();
1616
+ let m = new monom_1.Monom();
1577
1617
  m.coefficient = F.clone();
1578
1618
  m.literalStr = `${inputStr}^${n}`;
1579
1619
  this.add(m);
@@ -1587,7 +1627,7 @@ class Polynom {
1587
1627
  }
1588
1628
  };
1589
1629
  shutingYardToReducedPolynom = (inputStr) => {
1590
- const SY = new _shutingyard__WEBPACK_IMPORTED_MODULE_1__.Shutingyard().parse(inputStr);
1630
+ const SY = new shutingyard_1.Shutingyard().parse(inputStr);
1591
1631
  const rpn = SY.rpn;
1592
1632
  let m1;
1593
1633
  let m2;
@@ -1595,7 +1635,7 @@ class Polynom {
1595
1635
  for (const element of rpn) {
1596
1636
  if (element.tokenType === 'coefficient' || element.tokenType === 'variable') {
1597
1637
  tempPolynom = new Polynom().zero();
1598
- tempPolynom.monoms = [new _monom__WEBPACK_IMPORTED_MODULE_0__.Monom(element.token)];
1638
+ tempPolynom.monoms = [new monom_1.Monom(element.token)];
1599
1639
  stack.push(tempPolynom.clone());
1600
1640
  }
1601
1641
  else if (element.tokenType === 'operation') {
@@ -1631,13 +1671,13 @@ class Polynom {
1631
1671
  };
1632
1672
  zero = () => {
1633
1673
  this._monoms = [];
1634
- this._monoms.push(new _monom__WEBPACK_IMPORTED_MODULE_0__.Monom().zero());
1674
+ this._monoms.push(new monom_1.Monom().zero());
1635
1675
  this._rawString = '0';
1636
1676
  return this;
1637
1677
  };
1638
1678
  one = () => {
1639
1679
  this._monoms = [];
1640
- this._monoms.push(new _monom__WEBPACK_IMPORTED_MODULE_0__.Monom().one());
1680
+ this._monoms.push(new monom_1.Monom().one());
1641
1681
  this._rawString = '1';
1642
1682
  return this;
1643
1683
  };
@@ -1646,99 +1686,52 @@ class Polynom {
1646
1686
  this._rawString = '';
1647
1687
  return this;
1648
1688
  };
1649
- random(config) {
1650
- return _random__WEBPACK_IMPORTED_MODULE_3__.Random.polynom(config);
1651
- }
1652
- _randomizeDefaults = {
1653
- degree: 2,
1654
- unit: true,
1655
- fractions: false,
1656
- factorable: false,
1657
- letters: 'x',
1658
- allowNullMonom: false,
1659
- numberOfMonoms: false
1660
- };
1661
- get randomizeDefaults() {
1662
- return this._randomizeDefaults;
1663
- }
1664
- set randomizeDefaults(value) {
1665
- this._randomizeDefaults = value;
1666
- }
1667
- randomize = (config) => {
1668
- let P = new Polynom();
1669
- if (config === undefined) {
1670
- config = {};
1671
- }
1672
- for (let k in this._randomizeDefaults) {
1673
- if (config[k] === undefined) {
1674
- config[k] = this._randomizeDefaults[k];
1675
- }
1676
- }
1677
- return P;
1678
- };
1679
- rndFactorable = (degree = 2, unit = false, letters = 'x') => {
1680
- this._factors = [];
1681
- for (let i = 0; i < degree; i++) {
1682
- let factorUnit = unit === true || i >= unit, p = _random__WEBPACK_IMPORTED_MODULE_3__.Random.polynom({
1683
- degree: 1,
1684
- unit: factorUnit,
1685
- fraction: false,
1686
- letters
1687
- });
1688
- this._factors.push(p);
1689
- }
1690
- this.empty().monoms = this._factors[0].monoms;
1691
- for (let i = 1; i < this._factors.length; i++) {
1692
- this.multiply(this._factors[i]);
1693
- }
1694
- return this;
1695
- };
1696
1689
  opposed = () => {
1697
1690
  this._monoms = this._monoms.map(m => m.opposed());
1698
1691
  return this;
1699
1692
  };
1700
1693
  add = (...values) => {
1701
1694
  for (let value of values) {
1702
- if (value.isPolynom) {
1695
+ if (value instanceof Polynom) {
1703
1696
  this._monoms = this._monoms.concat(value.monoms);
1704
1697
  }
1705
- else if (value.isMonom) {
1698
+ else if (value instanceof monom_1.Monom) {
1706
1699
  this._monoms.push(value.clone());
1707
1700
  }
1708
1701
  else if (Number.isSafeInteger(value)) {
1709
- this._monoms.push(new _monom__WEBPACK_IMPORTED_MODULE_0__.Monom(value.toString()));
1702
+ this._monoms.push(new monom_1.Monom(value.toString()));
1710
1703
  }
1711
1704
  else {
1712
- this._monoms.push(new _monom__WEBPACK_IMPORTED_MODULE_0__.Monom(value));
1705
+ this._monoms.push(new monom_1.Monom(value));
1713
1706
  }
1714
1707
  }
1715
1708
  return this.reduce();
1716
1709
  };
1717
1710
  subtract = (...values) => {
1718
1711
  for (let value of values) {
1719
- if (value.isPolynom) {
1712
+ if (value instanceof Polynom) {
1720
1713
  this._monoms = this._monoms.concat(value.clone().opposed().monoms);
1721
1714
  }
1722
- else if (value.isMonom) {
1715
+ else if (value instanceof monom_1.Monom) {
1723
1716
  this._monoms.push(value.clone().opposed());
1724
1717
  }
1725
1718
  else if (Number.isSafeInteger(value)) {
1726
- this._monoms.push(new _monom__WEBPACK_IMPORTED_MODULE_0__.Monom(value.toString()).opposed());
1719
+ this._monoms.push(new monom_1.Monom(value.toString()).opposed());
1727
1720
  }
1728
1721
  else {
1729
- this._monoms.push(new _monom__WEBPACK_IMPORTED_MODULE_0__.Monom(value).opposed());
1722
+ this._monoms.push(new monom_1.Monom(value).opposed());
1730
1723
  }
1731
1724
  }
1732
1725
  return this.reduce();
1733
1726
  };
1734
1727
  multiply = (value) => {
1735
- if (value.isPolynom) {
1728
+ if (value instanceof Polynom) {
1736
1729
  return this.multiplyByPolynom(value);
1737
1730
  }
1738
- else if (value.isFraction) {
1731
+ else if (value instanceof coefficients_1.Fraction) {
1739
1732
  return this.multiplyByFraction(value);
1740
1733
  }
1741
- else if (value.isMonom) {
1734
+ else if (value instanceof monom_1.Monom) {
1742
1735
  return this.multiplyByMonom(value);
1743
1736
  }
1744
1737
  else if (Number.isSafeInteger(value)) {
@@ -1750,7 +1743,7 @@ class Polynom {
1750
1743
  const M = [];
1751
1744
  for (const m1 of this._monoms) {
1752
1745
  for (const m2 of P.monoms) {
1753
- M.push(_monom__WEBPACK_IMPORTED_MODULE_0__.Monom.xmultiply(m1, m2));
1746
+ M.push(monom_1.Monom.xmultiply(m1, m2));
1754
1747
  }
1755
1748
  }
1756
1749
  this._monoms = M;
@@ -1763,7 +1756,7 @@ class Polynom {
1763
1756
  return this.reduce();
1764
1757
  };
1765
1758
  multiplyByInteger = (nb) => {
1766
- return this.multiplyByFraction(new _coefficients_fraction__WEBPACK_IMPORTED_MODULE_4__.Fraction(nb));
1759
+ return this.multiplyByFraction(new coefficients_1.Fraction(nb));
1767
1760
  };
1768
1761
  multiplyByMonom = (M) => {
1769
1762
  for (const m of this._monoms) {
@@ -1781,9 +1774,9 @@ class Polynom {
1781
1774
  const maxMP = P.monomByDegree(undefined, letter);
1782
1775
  const degreeP = P.degree(letter);
1783
1776
  let newM;
1784
- let MaxIteration = this.degree(letter) * 2;
1785
- while (reminder.degree(letter) >= degreeP && MaxIteration >= 0) {
1786
- MaxIteration--;
1777
+ let MaxIteration = this.degree(letter).clone().multiply(2);
1778
+ while (reminder.degree(letter) >= degreeP && MaxIteration.isPositive()) {
1779
+ MaxIteration.subtract(1);
1787
1780
  newM = reminder.monomByDegree(undefined, letter).clone().divide(maxMP);
1788
1781
  if (newM.isZero()) {
1789
1782
  break;
@@ -1802,7 +1795,7 @@ class Polynom {
1802
1795
  }
1803
1796
  };
1804
1797
  divideByInteger = (nb) => {
1805
- const nbF = new _coefficients_fraction__WEBPACK_IMPORTED_MODULE_4__.Fraction(nb);
1798
+ const nbF = new coefficients_1.Fraction(nb);
1806
1799
  for (const m of this._monoms) {
1807
1800
  m.coefficient.divide(nbF);
1808
1801
  }
@@ -1838,7 +1831,7 @@ class Polynom {
1838
1831
  const cP2 = P.clone().reduce().reorder();
1839
1832
  switch (sign) {
1840
1833
  case '=':
1841
- if (cP1.length !== cP2.length || cP1.degree() !== cP2.degree()) {
1834
+ if (cP1.length !== cP2.length || cP1.degree().isNotEqual(cP2.degree())) {
1842
1835
  return false;
1843
1836
  }
1844
1837
  for (const i in cP1.monoms) {
@@ -1962,14 +1955,14 @@ class Polynom {
1962
1955
  };
1963
1956
  reorder = (letter = 'x') => {
1964
1957
  this._monoms.sort(function (a, b) {
1965
- return b.degree(letter) - a.degree(letter);
1958
+ return b.degree(letter).clone().subtract(a.degree(letter)).value;
1966
1959
  });
1967
1960
  return this.reduce();
1968
1961
  };
1969
1962
  degree = (letter) => {
1970
- let d = 0;
1963
+ let d = new coefficients_1.Fraction().zero();
1971
1964
  for (const m of this._monoms) {
1972
- d = Math.max(m.degree(letter), d);
1965
+ d = coefficients_1.Fraction.max(m.degree(letter).value, d);
1973
1966
  }
1974
1967
  return d;
1975
1968
  };
@@ -1984,7 +1977,7 @@ class Polynom {
1984
1977
  let pow;
1985
1978
  const resultPolynom = new Polynom().zero();
1986
1979
  for (const m of this.monoms) {
1987
- if (m.literal[letter] === undefined || m.literal[letter] === 0) {
1980
+ if (m.literal[letter] === undefined || m.literal[letter].isZero()) {
1988
1981
  resultPolynom.add(m.clone());
1989
1982
  }
1990
1983
  else {
@@ -1997,7 +1990,7 @@ class Polynom {
1997
1990
  return this;
1998
1991
  };
1999
1992
  evaluate = (values) => {
2000
- const r = new _coefficients_fraction__WEBPACK_IMPORTED_MODULE_4__.Fraction().zero();
1993
+ const r = new coefficients_1.Fraction().zero();
2001
1994
  this._monoms.forEach(monom => {
2002
1995
  r.add(monom.evaluate(values));
2003
1996
  });
@@ -2023,59 +2016,10 @@ class Polynom {
2023
2016
  letter = 'x';
2024
2017
  }
2025
2018
  let valuesA = {}, valuesB = {};
2026
- valuesA[letter] = a;
2027
- valuesB[letter] = b;
2019
+ valuesA[letter] = new coefficients_1.Fraction(a);
2020
+ valuesB[letter] = new coefficients_1.Fraction(b);
2028
2021
  return primitive.evaluate(valuesB).subtract(primitive.evaluate(valuesA));
2029
2022
  };
2030
- factorize_OLD = (maxValue) => {
2031
- this._factors = [];
2032
- let P = this.clone(), nbFactorsFound = 0;
2033
- if (P.monomByDegree().coefficient.numerator < 0) {
2034
- this._factors.push(new Polynom('-1'));
2035
- }
2036
- let M = P.commonMonom();
2037
- if (!M.isOne()) {
2038
- let commonPolynom = new Polynom();
2039
- commonPolynom.monoms = [M];
2040
- if (this._factors.length === 0) {
2041
- this._factors.push(commonPolynom);
2042
- }
2043
- else {
2044
- this._factors = [];
2045
- this._factors.push(commonPolynom.opposed());
2046
- }
2047
- P = P.euclidian(commonPolynom).quotient;
2048
- nbFactorsFound = commonPolynom.degree();
2049
- }
2050
- if (P.degree() <= 1) {
2051
- this._factors.push(P.clone());
2052
- }
2053
- else {
2054
- let Q = new _coefficients_fraction__WEBPACK_IMPORTED_MODULE_4__.Fraction(), F, degree = P.degree();
2055
- maxValue = maxValue === undefined ? 20 : maxValue;
2056
- for (let a = 1; a <= maxValue; a++) {
2057
- for (let b = -maxValue; b <= maxValue; b++) {
2058
- Q.parse(-b, a);
2059
- if (P.evaluate({ x: Q })) {
2060
- F = new Polynom(`${a}x+${b}`);
2061
- while (P.evaluate({ x: Q }).value === 0) {
2062
- this._factors.push(F.clone());
2063
- nbFactorsFound++;
2064
- P = P.euclidian(F).quotient;
2065
- }
2066
- }
2067
- if (nbFactorsFound > degree) {
2068
- return this;
2069
- }
2070
- }
2071
- }
2072
- if (P.degree() > 1) {
2073
- this._factors.push(P.clone());
2074
- return this;
2075
- }
2076
- }
2077
- return this;
2078
- };
2079
2023
  factorize = (letter) => {
2080
2024
  let factors = [];
2081
2025
  let P = this.clone().reorder(), M = P.commonMonom(), tempPolynom;
@@ -2085,7 +2029,7 @@ class Polynom {
2085
2029
  factors = [tempPolynom.clone()];
2086
2030
  P = P.euclidian(tempPolynom).quotient;
2087
2031
  }
2088
- let securityLoop = P.degree() * 2;
2032
+ let securityLoop = P.degree().clone().multiply(2).value;
2089
2033
  while (securityLoop >= 0) {
2090
2034
  securityLoop--;
2091
2035
  if (P.monoms.length < 2) {
@@ -2168,14 +2112,14 @@ class Polynom {
2168
2112
  a = this.monomByDegree(2, letter);
2169
2113
  b = this.monomByDegree(1, letter);
2170
2114
  c = this.monomByDegree(0, letter);
2171
- if (a.isLitteralSquare() && c.isLitteralSquare()) {
2115
+ if (a.isLiteralSquare() && c.isLiteralSquare()) {
2172
2116
  if (b.clone().pow(2).isSameAs(a.clone().multiply(c))) {
2173
2117
  let xPolynom = new Polynom('x', a.coefficient, b.coefficient, c.coefficient);
2174
2118
  let xFactors = xPolynom._factorize2ndDegree('x');
2175
2119
  let factors = [], xyzPolynom;
2176
2120
  if (xFactors.length >= 2) {
2177
2121
  for (let p of xFactors) {
2178
- if (p.degree() === 0) {
2122
+ if (p.degree().isZero()) {
2179
2123
  factors.push(p.clone());
2180
2124
  }
2181
2125
  else {
@@ -2197,7 +2141,7 @@ class Polynom {
2197
2141
  };
2198
2142
  getZeroes = () => {
2199
2143
  const Z = [];
2200
- switch (this.degree()) {
2144
+ switch (this.degree().value) {
2201
2145
  case 0:
2202
2146
  if (this._monoms[0].coefficient.value === 0) {
2203
2147
  return [true];
@@ -2207,7 +2151,7 @@ class Polynom {
2207
2151
  }
2208
2152
  case 1:
2209
2153
  if (this._monoms.length === 1) {
2210
- return [new _coefficients_fraction__WEBPACK_IMPORTED_MODULE_4__.Fraction().zero()];
2154
+ return [new coefficients_1.Fraction().zero()];
2211
2155
  }
2212
2156
  else {
2213
2157
  const P = this.clone().reduce().reorder();
@@ -2219,14 +2163,14 @@ class Polynom {
2219
2163
  }
2220
2164
  let zeroes = [], zeroesAsTex = [];
2221
2165
  for (let P of this._factors) {
2222
- if (P.degree() > 2) {
2166
+ if (P.degree().greater(2)) {
2223
2167
  }
2224
- else if (P.degree() === 2) {
2168
+ else if (P.degree().value === 2) {
2225
2169
  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));
2226
2170
  if (D.value > 0) {
2227
2171
  let x1 = (-(B.value) + Math.sqrt(D.value)) / (2 * A.value), x2 = (-(B.value) - Math.sqrt(D.value)) / (2 * A.value);
2228
- zeroes.push(new _coefficients_fraction__WEBPACK_IMPORTED_MODULE_4__.Fraction(x1.toFixed(3)).reduce());
2229
- zeroes.push(new _coefficients_fraction__WEBPACK_IMPORTED_MODULE_4__.Fraction(x2.toFixed(3)).reduce());
2172
+ zeroes.push(new coefficients_1.Fraction(x1.toFixed(3)).reduce());
2173
+ zeroes.push(new coefficients_1.Fraction(x2.toFixed(3)).reduce());
2230
2174
  }
2231
2175
  else if (D.value === 0) {
2232
2176
  }
@@ -2256,11 +2200,11 @@ class Polynom {
2256
2200
  }
2257
2201
  const M = this.clone().reduce();
2258
2202
  for (const m of M._monoms) {
2259
- if (m.degree(letter) === degree) {
2203
+ if (m.degree(letter).isEqual(degree)) {
2260
2204
  return m.clone();
2261
2205
  }
2262
2206
  }
2263
- return new _monom__WEBPACK_IMPORTED_MODULE_0__.Monom().zero();
2207
+ return new monom_1.Monom().zero();
2264
2208
  };
2265
2209
  monomsByDegree = (degree, letter) => {
2266
2210
  if (degree === undefined) {
@@ -2282,7 +2226,7 @@ class Polynom {
2282
2226
  return m.clone();
2283
2227
  }
2284
2228
  }
2285
- return new _monom__WEBPACK_IMPORTED_MODULE_0__.Monom().zero();
2229
+ return new monom_1.Monom().zero();
2286
2230
  };
2287
2231
  getDenominators = () => {
2288
2232
  const denominators = [];
@@ -2299,91 +2243,35 @@ class Polynom {
2299
2243
  return numerators;
2300
2244
  };
2301
2245
  lcmDenominator = () => {
2302
- return _numeric__WEBPACK_IMPORTED_MODULE_2__.Numeric.lcm(...this.getDenominators());
2246
+ return numeric_1.Numeric.lcm(...this.getDenominators());
2303
2247
  };
2304
2248
  gcdDenominator = () => {
2305
- return _numeric__WEBPACK_IMPORTED_MODULE_2__.Numeric.gcd(...this.getDenominators());
2249
+ return numeric_1.Numeric.gcd(...this.getDenominators());
2306
2250
  };
2307
2251
  lcmNumerator = () => {
2308
- return _numeric__WEBPACK_IMPORTED_MODULE_2__.Numeric.lcm(...this.getNumerators());
2252
+ return numeric_1.Numeric.lcm(...this.getNumerators());
2309
2253
  };
2310
2254
  gcdNumerator = () => {
2311
- return _numeric__WEBPACK_IMPORTED_MODULE_2__.Numeric.gcd(...this.getNumerators());
2255
+ return numeric_1.Numeric.gcd(...this.getNumerators());
2312
2256
  };
2313
2257
  commonMonom = () => {
2314
- let M = new _monom__WEBPACK_IMPORTED_MODULE_0__.Monom().one(), numerator, denominator, degree = this.degree();
2258
+ let M = new monom_1.Monom().one(), numerator, denominator, degree = this.degree();
2315
2259
  numerator = this.gcdNumerator();
2316
2260
  denominator = this.gcdDenominator();
2317
- M.coefficient = new _coefficients_fraction__WEBPACK_IMPORTED_MODULE_4__.Fraction(numerator, denominator);
2261
+ M.coefficient = new coefficients_1.Fraction(numerator, denominator);
2318
2262
  for (let L of this.variables) {
2319
2263
  M.setLetter(L, degree);
2320
2264
  for (let m of this._monoms) {
2321
- M.setLetter(L, Math.min(m.degree(L), M.degree(L)));
2322
- if (M.degree(L) === 0) {
2265
+ M.setLetter(L, coefficients_1.Fraction.min(m.degree(L), M.degree(L)));
2266
+ if (M.degree(L).isZero()) {
2323
2267
  break;
2324
2268
  }
2325
2269
  }
2326
2270
  }
2327
2271
  return M;
2328
2272
  };
2329
- makeItComplicate = (complexity = 1) => {
2330
- this._texString = '';
2331
- if (this.degree() < 1) {
2332
- return this;
2333
- }
2334
- const mDegree = _random__WEBPACK_IMPORTED_MODULE_3__.Random.number(0, this.degree() - 1);
2335
- return this;
2336
- };
2337
- factorizePartial = (forceSign) => {
2338
- this._texString = '';
2339
- if (this.length <= 1) {
2340
- return this;
2341
- }
2342
- let mMain, mCheck, mFactor, pFactor, g, sign;
2343
- for (let i = 0; i < this.length; i++) {
2344
- mMain = this._monoms[i].clone();
2345
- for (let j = i + 1; j < this.length; j++) {
2346
- mCheck = this._monoms[j].clone();
2347
- g = _numeric__WEBPACK_IMPORTED_MODULE_2__.Numeric.gcd(mMain.coefficient.numerator, mCheck.coefficient.numerator);
2348
- if (g !== 1) {
2349
- mFactor = _monom__WEBPACK_IMPORTED_MODULE_0__.Monom.lcm(mMain, mCheck);
2350
- sign = mMain.coefficient.sign() === 1 ? '+' : '-';
2351
- this._texString = `${forceSign === true ? sign : (sign === '+' ? '' : sign)}${mFactor.tex}`;
2352
- pFactor = new Polynom().add(mMain.divide(mFactor)).add(mCheck.divide(mFactor));
2353
- this._texString += pFactor.genDisplay('tex', false, true);
2354
- this._texString += this.clone().subtract(pFactor.clone().multiply(mFactor)).genDisplay('tex', true, false);
2355
- return this;
2356
- }
2357
- }
2358
- }
2359
- this._texString = this.genDisplay('tex', forceSign);
2360
- return this;
2361
- };
2362
- minify = () => {
2363
- this.multiply(this.lcmDenominator()).divide(this.gcdNumerator()).reduce();
2364
- return this.reduce();
2365
- };
2366
- canDivide = (P, letter = 'x') => {
2367
- const d = P.degree();
2368
- const evalValue = {};
2369
- if (d === 0) {
2370
- return !P.isZero;
2371
- }
2372
- if (d === 1) {
2373
- const z = P.getZeroes();
2374
- if (z[0] === true || z[0] === false) {
2375
- return false;
2376
- }
2377
- evalValue[letter] = z[0];
2378
- return this.evaluate(evalValue).value === 0;
2379
- }
2380
- if (d > 1) {
2381
- console.log('Currently, only first degree polynom are supported');
2382
- return false;
2383
- }
2384
- return false;
2385
- };
2386
2273
  }
2274
+ exports.Polynom = Polynom;
2387
2275
 
2388
2276
 
2389
2277
  /***/ }),
@@ -2392,21 +2280,20 @@ class Polynom {
2392
2280
  /*!***************************************!*\
2393
2281
  !*** ./src/maths/algebra/rational.ts ***!
2394
2282
  \***************************************/
2395
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
2283
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
2396
2284
 
2397
- __webpack_require__.r(__webpack_exports__);
2398
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2399
- /* harmony export */ "Rational": () => (/* binding */ Rational)
2400
- /* harmony export */ });
2401
- /* harmony import */ var _polynom__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./polynom */ "./src/maths/algebra/polynom.ts");
2402
2285
 
2286
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
2287
+ exports.Rational = void 0;
2288
+ const polynom_1 = __webpack_require__(/*! ./polynom */ "./src/maths/algebra/polynom.ts");
2289
+ const fraction_1 = __webpack_require__(/*! ../coefficients/fraction */ "./src/maths/coefficients/fraction.ts");
2403
2290
  class Rational {
2404
2291
  _rawString;
2405
2292
  _numerator;
2406
2293
  _denominator;
2407
2294
  constructor(numerator, denominator) {
2408
- this._numerator = numerator ? numerator.clone() : new _polynom__WEBPACK_IMPORTED_MODULE_0__.Polynom();
2409
- this._denominator = denominator ? denominator.clone() : new _polynom__WEBPACK_IMPORTED_MODULE_0__.Polynom();
2295
+ this._numerator = numerator ? numerator.clone() : new polynom_1.Polynom();
2296
+ this._denominator = denominator ? denominator.clone() : new polynom_1.Polynom();
2410
2297
  }
2411
2298
  clone = () => {
2412
2299
  this._numerator = this._numerator.clone();
@@ -2487,21 +2374,22 @@ class Rational {
2487
2374
  if (value === Infinity || value === -Infinity) {
2488
2375
  let N = this._numerator.monomByDegree(this._numerator.degree(letter), letter), D = this._denominator.monomByDegree(this._denominator.degree(letter), letter);
2489
2376
  N.divide(D);
2490
- if (N.degree(letter) > 0) {
2491
- return N.coefficient.sign() * (Math.pow((value > 0 ? 1 : -1), N.degree(letter) % 2)) === 1 ? Infinity : -Infinity;
2377
+ if (N.degree(letter).isStrictlyPositive()) {
2378
+ return N.coefficient.sign() * (Math.pow((value > 0 ? 1 : -1), N.degree(letter).value % 2)) === 1 ? Infinity : -Infinity;
2492
2379
  }
2493
- if (N.degree(letter) === 0) {
2380
+ if (N.degree(letter).isZero()) {
2494
2381
  return N.coefficient;
2495
2382
  }
2496
- if (N.degree(letter) > 0) {
2497
- return N.coefficient.sign() * (Math.pow(-1, N.degree(letter) % 2)) === 1 ? 0 : -0;
2383
+ if (N.degree(letter).isStrictlyPositive()) {
2384
+ return N.coefficient.sign() * (Math.pow(-1, N.degree(letter).value % 2)) === 1 ? 0 : -0;
2498
2385
  }
2499
2386
  }
2500
2387
  else {
2501
- return this._numerator.evaluate({ letter: value }).divide(this._denominator.evaluate({ letter: value }));
2388
+ return this._numerator.evaluate({ letter: new fraction_1.Fraction(value) }).divide(this._denominator.evaluate({ letter: new fraction_1.Fraction(value) }));
2502
2389
  }
2503
2390
  };
2504
2391
  }
2392
+ exports.Rational = Rational;
2505
2393
 
2506
2394
 
2507
2395
  /***/ }),
@@ -2510,14 +2398,12 @@ class Rational {
2510
2398
  /*!********************************************!*\
2511
2399
  !*** ./src/maths/coefficients/fraction.ts ***!
2512
2400
  \********************************************/
2513
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
2401
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
2514
2402
 
2515
- __webpack_require__.r(__webpack_exports__);
2516
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2517
- /* harmony export */ "Fraction": () => (/* binding */ Fraction)
2518
- /* harmony export */ });
2519
- /* harmony import */ var _numeric__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../numeric */ "./src/maths/numeric.ts");
2520
2403
 
2404
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
2405
+ exports.Fraction = void 0;
2406
+ const numeric_1 = __webpack_require__(/*! ../numeric */ "./src/maths/numeric.ts");
2521
2407
  class Fraction {
2522
2408
  _numerator;
2523
2409
  _denominator;
@@ -2666,13 +2552,23 @@ class Fraction {
2666
2552
  return this;
2667
2553
  };
2668
2554
  add = (F) => {
2669
- let N = this._numerator, D = this._denominator;
2670
- this._numerator = N * F.denominator + F.numerator * D;
2671
- this._denominator = D * F.denominator;
2555
+ if (F instanceof Fraction) {
2556
+ let N = this._numerator, D = this._denominator;
2557
+ this._numerator = N * F.denominator + F.numerator * D;
2558
+ this._denominator = D * F.denominator;
2559
+ }
2560
+ else {
2561
+ return this.add(new Fraction(F));
2562
+ }
2672
2563
  return this.reduce();
2673
2564
  };
2674
2565
  subtract = (F) => {
2675
- return this.add(F.clone().opposed());
2566
+ if (F instanceof Fraction) {
2567
+ return this.add(F.clone().opposed());
2568
+ }
2569
+ else {
2570
+ return this.add(-F);
2571
+ }
2676
2572
  };
2677
2573
  multiply = (F) => {
2678
2574
  let Q = new Fraction(F);
@@ -2697,6 +2593,9 @@ class Fraction {
2697
2593
  return this;
2698
2594
  };
2699
2595
  pow = (p) => {
2596
+ if (p instanceof Fraction) {
2597
+ return this.pow(p.value);
2598
+ }
2700
2599
  if (!Number.isSafeInteger(p)) {
2701
2600
  return this.invalid();
2702
2601
  }
@@ -2728,8 +2627,28 @@ class Fraction {
2728
2627
  this._denominator = Math.abs(this._denominator);
2729
2628
  return this;
2730
2629
  };
2630
+ static max = (...fractions) => {
2631
+ let M = new Fraction(fractions[0]);
2632
+ for (let m of fractions) {
2633
+ let compare = new Fraction(m);
2634
+ if (compare.greater(M)) {
2635
+ M = compare.clone();
2636
+ }
2637
+ }
2638
+ return M;
2639
+ };
2640
+ static min = (...fractions) => {
2641
+ let M = new Fraction(fractions[0]);
2642
+ for (let m of fractions) {
2643
+ let compare = new Fraction(m);
2644
+ if (compare.lesser(M)) {
2645
+ M = compare.clone();
2646
+ }
2647
+ }
2648
+ return M;
2649
+ };
2731
2650
  reduce = () => {
2732
- let g = _numeric__WEBPACK_IMPORTED_MODULE_0__.Numeric.gcd(this._numerator, this._denominator);
2651
+ let g = numeric_1.Numeric.gcd(this._numerator, this._denominator);
2733
2652
  this._numerator = this._numerator / g;
2734
2653
  this._denominator = this._denominator / g;
2735
2654
  if (this._denominator < 0) {
@@ -2749,19 +2668,26 @@ class Fraction {
2749
2668
  if (sign === undefined) {
2750
2669
  sign = '=';
2751
2670
  }
2671
+ let compareFraction;
2672
+ if (F instanceof Fraction) {
2673
+ compareFraction = F.clone();
2674
+ }
2675
+ else {
2676
+ compareFraction = new Fraction(F);
2677
+ }
2752
2678
  switch (sign) {
2753
2679
  case '>':
2754
- return this.value > F.value;
2680
+ return this.value > compareFraction.value;
2755
2681
  case ">=" || 0 || 0:
2756
- return this.value >= F.value;
2682
+ return this.value >= compareFraction.value;
2757
2683
  case "<":
2758
- return this.value < F.value;
2684
+ return this.value < compareFraction.value;
2759
2685
  case "<=" || 0 || 0:
2760
- return this.value <= F.value;
2686
+ return this.value <= compareFraction.value;
2761
2687
  case "=":
2762
- return this.value === F.value;
2688
+ return this.value === compareFraction.value;
2763
2689
  case "<>":
2764
- return this.value !== F.value;
2690
+ return this.value !== compareFraction.value;
2765
2691
  default:
2766
2692
  return false;
2767
2693
  }
@@ -2781,7 +2707,7 @@ class Fraction {
2781
2707
  isEqual = (than) => {
2782
2708
  return this.compare(than, '=');
2783
2709
  };
2784
- isDifferent = (than) => {
2710
+ isNotEqual = (than) => {
2785
2711
  return this.compare(than, '<>');
2786
2712
  };
2787
2713
  isOpposed = (p) => {
@@ -2793,15 +2719,27 @@ class Fraction {
2793
2719
  isZero = () => {
2794
2720
  return this._numerator === 0;
2795
2721
  };
2722
+ isNotZero = () => {
2723
+ return this._numerator !== 0;
2724
+ };
2796
2725
  isOne = () => {
2797
2726
  return this._numerator === 1 && this._denominator === 1;
2798
2727
  };
2728
+ isNegativeOne = () => {
2729
+ return this._numerator === -1 && this._denominator === 1;
2730
+ };
2799
2731
  isPositive = () => {
2800
2732
  return this.sign() === 1;
2801
2733
  };
2802
2734
  isNegative = () => {
2803
2735
  return this.sign() === -1;
2804
2736
  };
2737
+ isStrictlyPositive = () => {
2738
+ return this.value > 0;
2739
+ };
2740
+ isStrictlyNegative = () => {
2741
+ return this.value < 0;
2742
+ };
2805
2743
  isNaN = () => {
2806
2744
  return isNaN(this._numerator);
2807
2745
  };
@@ -2815,7 +2753,19 @@ class Fraction {
2815
2753
  return Math.sqrt(this._numerator) % 1 === 0 && Math.sqrt(this._denominator) % 1 === 0;
2816
2754
  };
2817
2755
  isReduced = () => {
2818
- return Math.abs(_numeric__WEBPACK_IMPORTED_MODULE_0__.Numeric.gcd(this._numerator, this._denominator)) === 1;
2756
+ return Math.abs(numeric_1.Numeric.gcd(this._numerator, this._denominator)) === 1;
2757
+ };
2758
+ isNatural = () => {
2759
+ return this.clone().reduce().denominator === 1;
2760
+ };
2761
+ isRational = () => {
2762
+ return !this.isNatural();
2763
+ };
2764
+ isEven = () => {
2765
+ return this.isNatural() && this.value % 2 === 0;
2766
+ };
2767
+ isOdd = () => {
2768
+ return this.isNatural() && this.value % 2 === 1;
2819
2769
  };
2820
2770
  sign = () => {
2821
2771
  return (this._numerator * this._denominator >= 0) ? 1 : -1;
@@ -2829,6 +2779,7 @@ class Fraction {
2829
2779
  return true;
2830
2780
  };
2831
2781
  }
2782
+ exports.Fraction = Fraction;
2832
2783
 
2833
2784
 
2834
2785
  /***/ }),
@@ -2837,17 +2788,22 @@ class Fraction {
2837
2788
  /*!*****************************************!*\
2838
2789
  !*** ./src/maths/coefficients/index.ts ***!
2839
2790
  \*****************************************/
2840
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
2791
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
2841
2792
 
2842
- __webpack_require__.r(__webpack_exports__);
2843
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2844
- /* harmony export */ "Fraction": () => (/* reexport safe */ _fraction__WEBPACK_IMPORTED_MODULE_0__.Fraction),
2845
- /* harmony export */ "Nthroot": () => (/* reexport safe */ _nthroot__WEBPACK_IMPORTED_MODULE_1__.Nthroot)
2846
- /* harmony export */ });
2847
- /* harmony import */ var _fraction__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./fraction */ "./src/maths/coefficients/fraction.ts");
2848
- /* harmony import */ var _nthroot__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./nthroot */ "./src/maths/coefficients/nthroot.ts");
2849
-
2850
2793
 
2794
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
2795
+ if (k2 === undefined) k2 = k;
2796
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
2797
+ }) : (function(o, m, k, k2) {
2798
+ if (k2 === undefined) k2 = k;
2799
+ o[k2] = m[k];
2800
+ }));
2801
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
2802
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
2803
+ };
2804
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
2805
+ __exportStar(__webpack_require__(/*! ./fraction */ "./src/maths/coefficients/fraction.ts"), exports);
2806
+ __exportStar(__webpack_require__(/*! ./nthroot */ "./src/maths/coefficients/nthroot.ts"), exports);
2851
2807
 
2852
2808
 
2853
2809
  /***/ }),
@@ -2856,12 +2812,11 @@ __webpack_require__.r(__webpack_exports__);
2856
2812
  /*!*******************************************!*\
2857
2813
  !*** ./src/maths/coefficients/nthroot.ts ***!
2858
2814
  \*******************************************/
2859
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
2815
+ /***/ ((__unused_webpack_module, exports) => {
2860
2816
 
2861
- __webpack_require__.r(__webpack_exports__);
2862
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2863
- /* harmony export */ "Nthroot": () => (/* binding */ Nthroot)
2864
- /* harmony export */ });
2817
+
2818
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
2819
+ exports.Nthroot = void 0;
2865
2820
  class Nthroot {
2866
2821
  _radical;
2867
2822
  _nth;
@@ -2953,6 +2908,7 @@ class Nthroot {
2953
2908
  return !(this._radical === 1 || this._radical === 0 || this._isValid === false);
2954
2909
  };
2955
2910
  }
2911
+ exports.Nthroot = Nthroot;
2956
2912
 
2957
2913
 
2958
2914
  /***/ }),
@@ -2961,23 +2917,20 @@ class Nthroot {
2961
2917
  /*!**************************************!*\
2962
2918
  !*** ./src/maths/geometry/circle.ts ***!
2963
2919
  \**************************************/
2964
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
2920
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
2965
2921
 
2966
- __webpack_require__.r(__webpack_exports__);
2967
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2968
- /* harmony export */ "Circle": () => (/* binding */ Circle)
2969
- /* harmony export */ });
2970
- /* harmony import */ var _point__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./point */ "./src/maths/geometry/point.ts");
2971
- /* harmony import */ var _coefficients_fraction__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../coefficients/fraction */ "./src/maths/coefficients/fraction.ts");
2972
- /* harmony import */ var _algebra_equation__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../algebra/equation */ "./src/maths/algebra/equation.ts");
2973
- /* harmony import */ var _algebra_polynom__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../algebra/polynom */ "./src/maths/algebra/polynom.ts");
2974
-
2975
-
2976
-
2977
2922
 
2923
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
2924
+ exports.Circle = void 0;
2925
+ const point_1 = __webpack_require__(/*! ./point */ "./src/maths/geometry/point.ts");
2926
+ const coefficients_1 = __webpack_require__(/*! ../coefficients */ "./src/maths/coefficients/index.ts");
2927
+ const algebra_1 = __webpack_require__(/*! ../algebra */ "./src/maths/algebra/index.ts");
2928
+ const vector_1 = __webpack_require__(/*! ./vector */ "./src/maths/geometry/vector.ts");
2978
2929
  class Circle {
2979
2930
  _center;
2980
2931
  _radius;
2932
+ _squareRadius;
2933
+ _cartesian;
2981
2934
  _exists;
2982
2935
  constructor(...values) {
2983
2936
  this._exists = false;
@@ -2985,11 +2938,44 @@ class Circle {
2985
2938
  this.parse(...values);
2986
2939
  }
2987
2940
  }
2941
+ get center() {
2942
+ return this._center;
2943
+ }
2988
2944
  parse(...values) {
2989
- if (values.length === 2) {
2990
- this._center = new _point__WEBPACK_IMPORTED_MODULE_0__.Point(values[0]);
2991
- this._radius = new _coefficients_fraction__WEBPACK_IMPORTED_MODULE_1__.Fraction(values[1]);
2945
+ if (values.length === 1 && typeof values[0] === 'string') {
2946
+ this.checkCircle(new algebra_1.Equation(values[0]));
2992
2947
  }
2948
+ else if (values.length >= 2) {
2949
+ this._center = new point_1.Point(values[0]);
2950
+ if (values[1] instanceof point_1.Point) {
2951
+ this._squareRadius = new vector_1.Vector(this._center, values[1]).normSquare;
2952
+ }
2953
+ else {
2954
+ if (values[2] === true) {
2955
+ this._squareRadius = new coefficients_1.Fraction(values[1]);
2956
+ }
2957
+ else {
2958
+ this._radius = new coefficients_1.Fraction(values[1]);
2959
+ this._squareRadius = this._radius.clone().pow(2);
2960
+ }
2961
+ }
2962
+ this._cartesian = (new algebra_1.Equation(new algebra_1.Polynom(`(x-(${this._center.x.display}))^2+(y-(${this._center.y.display}))^2`), new algebra_1.Polynom(`${this._squareRadius.display}`))).moveLeft();
2963
+ }
2964
+ }
2965
+ get radius() {
2966
+ if (this._squareRadius.isSquare()) {
2967
+ return {
2968
+ tex: this._squareRadius.clone().sqrt().tex,
2969
+ display: this._squareRadius.clone().sqrt().display,
2970
+ };
2971
+ }
2972
+ else {
2973
+ return {
2974
+ tex: `\\sqrt{${this._squareRadius.tex}}`,
2975
+ display: `sqrt(${this._squareRadius.display})`
2976
+ };
2977
+ }
2978
+ return this._squareRadius;
2993
2979
  }
2994
2980
  get tex() {
2995
2981
  let cx, cy;
@@ -2997,21 +2983,49 @@ class Circle {
2997
2983
  cx = 'x^2';
2998
2984
  }
2999
2985
  else {
3000
- cx = `\\left(x-${this._center.x.tex}\\right)^2`;
2986
+ cx = `\\left(x${this._center.x.isNegative() ? '+' : '-'}${this._center.x.clone().abs().tex}\\right)^2`;
3001
2987
  }
3002
2988
  if (this._center.y.isZero()) {
3003
2989
  cy = 'y^2';
3004
2990
  }
3005
2991
  else {
3006
- cy = `\\left(y-${this._center.y.tex}\\right)^2`;
2992
+ cy = `\\left(y${this._center.y.isNegative() ? '+' : '-'}${this._center.y.clone().abs().tex}\\right)^2`;
3007
2993
  }
3008
- return `${cx}+${cy}=${this._radius.pow(2).tex}`;
2994
+ return `${cx}+${cy}=${this._squareRadius.tex}`;
3009
2995
  }
3010
2996
  get developed() {
3011
- let equ = new _algebra_equation__WEBPACK_IMPORTED_MODULE_2__.Equation(new _algebra_polynom__WEBPACK_IMPORTED_MODULE_3__.Polynom(`(x-(${this._center.x.display}))^2+(y-(${this._center.y.display}))^2`), new _algebra_polynom__WEBPACK_IMPORTED_MODULE_3__.Polynom(`${this._radius.pow(2).display}`));
3012
- return equ.moveLeft().tex;
3013
- }
2997
+ return this._cartesian.tex;
2998
+ }
2999
+ checkCircle = (P) => {
3000
+ if (P.degree('x').value === 2 && P.degree('y').value === 2) {
3001
+ let x2 = P.left.monomByDegree(2, 'x'), y2 = P.left.monomByDegree(2, 'y'), x1, y1, c;
3002
+ if (x2.coefficient.isEqual(y2.coefficient)) {
3003
+ P.divide(x2.coefficient);
3004
+ x1 = P.left.monomByDegree(1, 'x');
3005
+ y1 = P.left.monomByDegree(1, 'y');
3006
+ c = P.left.monomByDegree(0);
3007
+ this._center = new point_1.Point(x1.coefficient.clone().divide(2).opposed(), y1.coefficient.clone().divide(2).opposed());
3008
+ this._squareRadius = c.coefficient.clone().opposed()
3009
+ .add(this._center.x.clone().pow(2))
3010
+ .add(this._center.y.clone().pow(2));
3011
+ }
3012
+ }
3013
+ return false;
3014
+ };
3015
+ relativePosition = (L) => {
3016
+ let distance = L.distanceTo(this.center), radius = Math.sqrt(this._squareRadius.value);
3017
+ if (distance.value - radius > 0.0000000001) {
3018
+ return 0;
3019
+ }
3020
+ else if (Math.abs(distance.value - radius) < 0.0000000001) {
3021
+ return 1;
3022
+ }
3023
+ else {
3024
+ return 2;
3025
+ }
3026
+ };
3014
3027
  }
3028
+ exports.Circle = Circle;
3015
3029
 
3016
3030
 
3017
3031
  /***/ }),
@@ -3020,50 +3034,25 @@ class Circle {
3020
3034
  /*!*************************************!*\
3021
3035
  !*** ./src/maths/geometry/index.ts ***!
3022
3036
  \*************************************/
3023
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
3037
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
3024
3038
 
3025
- __webpack_require__.r(__webpack_exports__);
3026
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
3027
- /* harmony export */ "Vector": () => (/* reexport safe */ _vector__WEBPACK_IMPORTED_MODULE_0__.Vector),
3028
- /* harmony export */ "Triangle": () => (/* reexport safe */ _triangle__WEBPACK_IMPORTED_MODULE_1__.Triangle),
3029
- /* harmony export */ "Point": () => (/* reexport safe */ _point__WEBPACK_IMPORTED_MODULE_2__.Point),
3030
- /* harmony export */ "Circle": () => (/* reexport safe */ _circle__WEBPACK_IMPORTED_MODULE_3__.Circle),
3031
- /* harmony export */ "Line": () => (/* reexport safe */ _line__WEBPACK_IMPORTED_MODULE_4__.Line),
3032
- /* harmony export */ "Geometry": () => (/* binding */ Geometry)
3033
- /* harmony export */ });
3034
- /* harmony import */ var _vector__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./vector */ "./src/maths/geometry/vector.ts");
3035
- /* harmony import */ var _triangle__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./triangle */ "./src/maths/geometry/triangle.ts");
3036
- /* harmony import */ var _point__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./point */ "./src/maths/geometry/point.ts");
3037
- /* harmony import */ var _circle__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./circle */ "./src/maths/geometry/circle.ts");
3038
- /* harmony import */ var _line__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./line */ "./src/maths/geometry/line.ts");
3039
-
3040
-
3041
-
3042
-
3043
-
3044
-
3045
-
3046
-
3047
3039
 
3048
-
3049
- var Geometry;
3050
- (function (Geometry) {
3051
- class Circle extends _circle__WEBPACK_IMPORTED_MODULE_3__.Circle {
3052
- }
3053
- Geometry.Circle = Circle;
3054
- class Line extends _line__WEBPACK_IMPORTED_MODULE_4__.Line {
3055
- }
3056
- Geometry.Line = Line;
3057
- class Point extends _point__WEBPACK_IMPORTED_MODULE_2__.Point {
3058
- }
3059
- Geometry.Point = Point;
3060
- class Triangle extends _triangle__WEBPACK_IMPORTED_MODULE_1__.Triangle {
3061
- }
3062
- Geometry.Triangle = Triangle;
3063
- class Vector extends _vector__WEBPACK_IMPORTED_MODULE_0__.Vector {
3064
- }
3065
- Geometry.Vector = Vector;
3066
- })(Geometry || (Geometry = {}));
3040
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3041
+ if (k2 === undefined) k2 = k;
3042
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
3043
+ }) : (function(o, m, k, k2) {
3044
+ if (k2 === undefined) k2 = k;
3045
+ o[k2] = m[k];
3046
+ }));
3047
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
3048
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
3049
+ };
3050
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
3051
+ __exportStar(__webpack_require__(/*! ./vector */ "./src/maths/geometry/vector.ts"), exports);
3052
+ __exportStar(__webpack_require__(/*! ./triangle */ "./src/maths/geometry/triangle.ts"), exports);
3053
+ __exportStar(__webpack_require__(/*! ./point */ "./src/maths/geometry/point.ts"), exports);
3054
+ __exportStar(__webpack_require__(/*! ./circle */ "./src/maths/geometry/circle.ts"), exports);
3055
+ __exportStar(__webpack_require__(/*! ./line */ "./src/maths/geometry/line.ts"), exports);
3067
3056
 
3068
3057
 
3069
3058
  /***/ }),
@@ -3072,24 +3061,22 @@ var Geometry;
3072
3061
  /*!************************************!*\
3073
3062
  !*** ./src/maths/geometry/line.ts ***!
3074
3063
  \************************************/
3075
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
3064
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
3076
3065
 
3077
- __webpack_require__.r(__webpack_exports__);
3078
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
3079
- /* harmony export */ "Line": () => (/* binding */ Line)
3080
- /* harmony export */ });
3081
- /* harmony import */ var _coefficients_fraction__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../coefficients/fraction */ "./src/maths/coefficients/fraction.ts");
3082
- /* harmony import */ var _vector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./vector */ "./src/maths/geometry/vector.ts");
3083
- /* harmony import */ var _point__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./point */ "./src/maths/geometry/point.ts");
3084
- /* harmony import */ var _algebra_polynom__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../algebra/polynom */ "./src/maths/algebra/polynom.ts");
3085
- /* harmony import */ var _numeric__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../numeric */ "./src/maths/numeric.ts");
3086
- /* harmony import */ var _algebra_equation__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../algebra/equation */ "./src/maths/algebra/equation.ts");
3087
-
3088
-
3089
-
3090
-
3091
-
3092
3066
 
3067
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
3068
+ exports.Line = void 0;
3069
+ const coefficients_1 = __webpack_require__(/*! ../coefficients */ "./src/maths/coefficients/index.ts");
3070
+ const vector_1 = __webpack_require__(/*! ./vector */ "./src/maths/geometry/vector.ts");
3071
+ const point_1 = __webpack_require__(/*! ./point */ "./src/maths/geometry/point.ts");
3072
+ const algebra_1 = __webpack_require__(/*! ../algebra */ "./src/maths/algebra/index.ts");
3073
+ const numeric_1 = __webpack_require__(/*! ../numeric */ "./src/maths/numeric.ts");
3074
+ var LinePropriety;
3075
+ (function (LinePropriety) {
3076
+ LinePropriety[LinePropriety["None"] = 0] = "None";
3077
+ LinePropriety[LinePropriety["Parallel"] = 1] = "Parallel";
3078
+ LinePropriety[LinePropriety["Perpendicular"] = 2] = "Perpendicular";
3079
+ })(LinePropriety || (LinePropriety = {}));
3093
3080
  class Line {
3094
3081
  _a;
3095
3082
  _b;
@@ -3098,17 +3085,25 @@ class Line {
3098
3085
  _d;
3099
3086
  _n;
3100
3087
  _exists;
3088
+ _referencePropriety;
3089
+ _referenceLine;
3090
+ static PERPENDICULAR = LinePropriety.Perpendicular;
3091
+ static PARALLEL = LinePropriety.Parallel;
3101
3092
  constructor(...values) {
3102
3093
  this._exists = false;
3103
- if (values !== undefined) {
3094
+ if (values.length > 0) {
3104
3095
  this.parse(...values);
3105
3096
  }
3106
3097
  return this;
3107
3098
  }
3108
- get isLine() { return true; }
3109
- get exists() { return this._exists; }
3099
+ get isLine() {
3100
+ return true;
3101
+ }
3102
+ get exists() {
3103
+ return this._exists;
3104
+ }
3110
3105
  get equation() {
3111
- return new _algebra_equation__WEBPACK_IMPORTED_MODULE_5__.Equation(new _algebra_polynom__WEBPACK_IMPORTED_MODULE_3__.Polynom().parse('xy', this._a, this._b, this._c), new _algebra_polynom__WEBPACK_IMPORTED_MODULE_3__.Polynom('0')).simplify();
3106
+ return new algebra_1.Equation(new algebra_1.Polynom().parse('xy', this._a, this._b, this._c), new algebra_1.Polynom('0')).simplify();
3112
3107
  }
3113
3108
  get tex() {
3114
3109
  let canonical = this.equation;
@@ -3117,8 +3112,8 @@ class Line {
3117
3112
  }
3118
3113
  return {
3119
3114
  canonical: canonical.tex,
3120
- mxh: this.slope.isInfinity() ? 'x=' + this.OA.x.tex : 'y=' + new _algebra_polynom__WEBPACK_IMPORTED_MODULE_3__.Polynom().parse('x', this.slope, this.height).tex,
3121
- parametric: `${_point__WEBPACK_IMPORTED_MODULE_2__.Point.pmatrix('x', 'y')} = ${_point__WEBPACK_IMPORTED_MODULE_2__.Point.pmatrix(this._OA.x, this._OA.y)} + k\\cdot ${_point__WEBPACK_IMPORTED_MODULE_2__.Point.pmatrix(this._d.x, this._d.y)}`
3115
+ mxh: this.slope.isInfinity() ? 'x=' + this.OA.x.tex : 'y=' + new algebra_1.Polynom().parse('x', this.slope, this.height).tex,
3116
+ parametric: `${point_1.Point.pmatrix('x', 'y')} = ${point_1.Point.pmatrix(this._OA.x, this._OA.y)} + k\\cdot ${point_1.Point.pmatrix(this._d.x, this._d.y)}`
3122
3117
  };
3123
3118
  }
3124
3119
  get a() {
@@ -3152,7 +3147,10 @@ class Line {
3152
3147
  return this._n;
3153
3148
  }
3154
3149
  get normal() {
3155
- return new _vector__WEBPACK_IMPORTED_MODULE_1__.Vector(this._a, this._b);
3150
+ return new vector_1.Vector(this._a, this._b);
3151
+ }
3152
+ get director() {
3153
+ return this._d.clone();
3156
3154
  }
3157
3155
  set d(value) {
3158
3156
  this._d = value;
@@ -3165,49 +3163,71 @@ class Line {
3165
3163
  }
3166
3164
  parse = (...values) => {
3167
3165
  this._exists = false;
3168
- if (values.length === 3) {
3169
- return this.parseByCoefficient(values[0], values[1], values[2]);
3170
- }
3171
- else if (values.length === 2) {
3172
- if (values[0].isPoint && values[1].isVector) {
3173
- return this.parseByPointAndVector(values[0], values[1]);
3174
- }
3175
- else if (values[0].isPoint && values[1].isPoint) {
3176
- return this.parseByPointAndVector(values[0], new _vector__WEBPACK_IMPORTED_MODULE_1__.Vector(values[0], values[1]));
3177
- }
3166
+ if (values.length === 0) {
3167
+ return this;
3178
3168
  }
3179
- else if (values.length === 1) {
3180
- if (values[0].isLine) {
3169
+ if (values.length === 1) {
3170
+ if (values[0] instanceof Line) {
3181
3171
  return values[0].clone();
3182
3172
  }
3183
- let equ = new _algebra_equation__WEBPACK_IMPORTED_MODULE_5__.Equation(values[0]);
3184
- if (equ.isEquation) {
3185
- equ.reorder(true);
3186
- let letters = new Set(equ.letters());
3187
- if (!(letters.has('x') || letters.has('y'))) {
3188
- return;
3189
- }
3190
- for (let elem of ['x', 'y']) {
3191
- if (letters.has(elem)) {
3192
- letters.delete(elem);
3193
- }
3173
+ else if (values[0] instanceof algebra_1.Equation) {
3174
+ return this.parseEquation(values[0]);
3175
+ }
3176
+ else if (typeof values[0] === "string") {
3177
+ try {
3178
+ let E = new algebra_1.Equation(values[0]);
3179
+ return this.parse(E);
3194
3180
  }
3195
- if (letters.size > 0) {
3196
- console.log('Extra variable in the equation.');
3181
+ catch (e) {
3197
3182
  return this;
3198
3183
  }
3199
- return this.parseByCoefficient(equ.left.monomByLetter('x').coefficient, equ.left.monomByLetter('y').coefficient, equ.left.monomByDegree(0).coefficient);
3184
+ }
3185
+ }
3186
+ if (values.length === 2) {
3187
+ if (values[0] instanceof point_1.Point && values[1] instanceof vector_1.Vector) {
3188
+ return this.parseByPointAndVector(values[0], values[1]);
3189
+ }
3190
+ else if (values[0] instanceof point_1.Point && values[1] instanceof point_1.Point) {
3191
+ return this.parseByPointAndVector(values[0], new vector_1.Vector(values[0], values[1]));
3192
+ }
3193
+ else if (values[0] instanceof vector_1.Vector && values[1] instanceof point_1.Point) {
3194
+ return this.parseByPointAndNormal(values[1], values[0]);
3195
+ }
3196
+ }
3197
+ if (values.length === 3) {
3198
+ if ((values[0] instanceof coefficients_1.Fraction || typeof values[0] === 'number')
3199
+ &&
3200
+ (values[1] instanceof coefficients_1.Fraction || typeof values[1] === 'number')
3201
+ &&
3202
+ (values[2] instanceof coefficients_1.Fraction || typeof values[2] === 'number')) {
3203
+ return this.parseByCoefficient(values[0], values[1], values[2]);
3200
3204
  }
3201
3205
  }
3202
3206
  console.log('Someting wrong happend while creating the line');
3203
3207
  return this;
3204
3208
  };
3209
+ parseEquation = (equ) => {
3210
+ equ.reorder(true);
3211
+ let letters = new Set(equ.letters());
3212
+ if (!(letters.has('x') || letters.has('y'))) {
3213
+ return this;
3214
+ }
3215
+ for (let elem of ['x', 'y']) {
3216
+ if (letters.has(elem)) {
3217
+ letters.delete(elem);
3218
+ }
3219
+ }
3220
+ if (letters.size > 0) {
3221
+ return this;
3222
+ }
3223
+ return this.parseByCoefficient(equ.left.monomByLetter('x').coefficient, equ.left.monomByLetter('y').coefficient, equ.left.monomByDegree(0).coefficient);
3224
+ };
3205
3225
  parseByCoefficient = (a, b, c) => {
3206
- this._a = new _coefficients_fraction__WEBPACK_IMPORTED_MODULE_0__.Fraction(a);
3207
- this._b = new _coefficients_fraction__WEBPACK_IMPORTED_MODULE_0__.Fraction(b);
3208
- this._c = new _coefficients_fraction__WEBPACK_IMPORTED_MODULE_0__.Fraction(c);
3209
- this._d = new _vector__WEBPACK_IMPORTED_MODULE_1__.Vector(this._b.clone(), this._a.clone().opposed());
3210
- this._OA = new _point__WEBPACK_IMPORTED_MODULE_2__.Point(new _coefficients_fraction__WEBPACK_IMPORTED_MODULE_0__.Fraction().zero(), this._c.clone());
3226
+ this._a = new coefficients_1.Fraction(a);
3227
+ this._b = new coefficients_1.Fraction(b);
3228
+ this._c = new coefficients_1.Fraction(c);
3229
+ this._d = new vector_1.Vector(this._b.clone(), this._a.clone().opposed());
3230
+ this._OA = new point_1.Point(new coefficients_1.Fraction().zero(), this._c.clone());
3211
3231
  this._n = this._d.clone().normal();
3212
3232
  this._exists = true;
3213
3233
  return this;
@@ -3220,6 +3240,23 @@ class Line {
3220
3240
  this._exists = true;
3221
3241
  return this;
3222
3242
  };
3243
+ parseByPointAndNormal = (P, n) => {
3244
+ return this.parseByCoefficient(n.x, n.y, P.x.clone().multiply(n.x)
3245
+ .add(P.y.clone().multiply(n.y)).opposed());
3246
+ };
3247
+ parseByPointAndLine = (P, L, orientation) => {
3248
+ if (orientation === undefined) {
3249
+ orientation = LinePropriety.Parallel;
3250
+ }
3251
+ if (orientation === LinePropriety.Parallel) {
3252
+ return this.parseByPointAndNormal(P, L.normal);
3253
+ }
3254
+ else if (orientation === LinePropriety.Perpendicular) {
3255
+ return this.parseByPointAndNormal(P, L.director);
3256
+ }
3257
+ this._exists = false;
3258
+ return this;
3259
+ };
3223
3260
  clone = () => {
3224
3261
  this._a = this._a.clone();
3225
3262
  this._b = this._b.clone();
@@ -3227,22 +3264,23 @@ class Line {
3227
3264
  this._d = this._d.clone();
3228
3265
  this._OA = this._OA.clone();
3229
3266
  this._n = this._n.clone();
3267
+ this._exists = this.exists;
3230
3268
  return this;
3231
3269
  };
3232
3270
  isParellelTo = (line) => {
3233
- return this.slope.isEqual(line.slope) && this.height.isDifferent(line.height);
3271
+ return this.slope.isEqual(line.slope) && this.height.isNotEqual(line.height);
3234
3272
  };
3235
3273
  isSameAs = (line) => {
3236
3274
  return this.slope.isEqual(line.slope) && this.height.isEqual(line.height);
3237
3275
  };
3238
3276
  simplifyDirection = () => {
3239
- let lcm = _numeric__WEBPACK_IMPORTED_MODULE_4__.Numeric.lcm(this._d.x.denominator, this._d.y.denominator), gcd = _numeric__WEBPACK_IMPORTED_MODULE_4__.Numeric.gcd(this._d.x.numerator, this._d.y.numerator);
3277
+ let lcm = numeric_1.Numeric.lcm(this._d.x.denominator, this._d.y.denominator), gcd = numeric_1.Numeric.gcd(this._d.x.numerator, this._d.y.numerator);
3240
3278
  this._d.x.multiply(lcm).divide(gcd);
3241
3279
  this._d.y.multiply(lcm).divide(gcd);
3242
3280
  return this;
3243
3281
  };
3244
3282
  intersection = (line) => {
3245
- let Pt = new _point__WEBPACK_IMPORTED_MODULE_2__.Point(), isParallel = false, isSame = false, hasIntersection = true;
3283
+ let Pt = new point_1.Point(), isParallel = false, isSame = false, hasIntersection = true;
3246
3284
  if (this._b.isZero() || line.b.isZero()) {
3247
3285
  }
3248
3286
  if (this.isParellelTo(line)) {
@@ -3276,7 +3314,7 @@ class Line {
3276
3314
  return {
3277
3315
  value: NaN,
3278
3316
  tex: 'Not a line',
3279
- fraction: new _coefficients_fraction__WEBPACK_IMPORTED_MODULE_0__.Fraction().infinite()
3317
+ fraction: new coefficients_1.Fraction().infinite()
3280
3318
  };
3281
3319
  }
3282
3320
  let value = numerator.value / Math.sqrt(d2.value), F = numerator.clone().divide(d2.clone().sqrt());
@@ -3334,6 +3372,7 @@ class Line {
3334
3372
  return canonical + '=0';
3335
3373
  }
3336
3374
  }
3375
+ exports.Line = Line;
3337
3376
 
3338
3377
 
3339
3378
  /***/ }),
@@ -3342,21 +3381,19 @@ class Line {
3342
3381
  /*!*************************************!*\
3343
3382
  !*** ./src/maths/geometry/point.ts ***!
3344
3383
  \*************************************/
3345
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
3384
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
3346
3385
 
3347
- __webpack_require__.r(__webpack_exports__);
3348
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
3349
- /* harmony export */ "Point": () => (/* binding */ Point)
3350
- /* harmony export */ });
3351
- /* harmony import */ var _coefficients_fraction__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../coefficients/fraction */ "./src/maths/coefficients/fraction.ts");
3352
3386
 
3387
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
3388
+ exports.Point = void 0;
3389
+ const fraction_1 = __webpack_require__(/*! ../coefficients/fraction */ "./src/maths/coefficients/fraction.ts");
3353
3390
  class Point {
3354
3391
  _x;
3355
3392
  _y;
3356
3393
  _exist;
3357
3394
  constructor(...values) {
3358
- this._x = new _coefficients_fraction__WEBPACK_IMPORTED_MODULE_0__.Fraction().zero();
3359
- this._y = new _coefficients_fraction__WEBPACK_IMPORTED_MODULE_0__.Fraction().zero();
3395
+ this._x = new fraction_1.Fraction().zero();
3396
+ this._y = new fraction_1.Fraction().zero();
3360
3397
  if (values !== undefined) {
3361
3398
  this.parse(...values);
3362
3399
  }
@@ -3384,6 +3421,12 @@ class Point {
3384
3421
  pts.push(this._y.tex);
3385
3422
  return `\\left(${pts.join(';')}\\right)`;
3386
3423
  }
3424
+ get display() {
3425
+ let pts = [];
3426
+ pts.push(this._x.tex);
3427
+ pts.push(this._y.tex);
3428
+ return `(${pts.join(';')})`;
3429
+ }
3387
3430
  parse = (...values) => {
3388
3431
  this.zero();
3389
3432
  if (values.length === 0) {
@@ -3398,22 +3441,22 @@ class Point {
3398
3441
  if (typeof values[0] === 'string') {
3399
3442
  let xy = values[0].split(',');
3400
3443
  if (xy.length === 2) {
3401
- this._x = new _coefficients_fraction__WEBPACK_IMPORTED_MODULE_0__.Fraction(xy[0]).reduce();
3402
- this._y = new _coefficients_fraction__WEBPACK_IMPORTED_MODULE_0__.Fraction(xy[1]).reduce();
3444
+ this._x = new fraction_1.Fraction(xy[0]).reduce();
3445
+ this._y = new fraction_1.Fraction(xy[1]).reduce();
3403
3446
  return this;
3404
3447
  }
3405
3448
  }
3406
3449
  if (values[0].x !== undefined && values[0].y !== undefined) {
3407
- this._x = new _coefficients_fraction__WEBPACK_IMPORTED_MODULE_0__.Fraction(values[0].x).reduce();
3408
- this._y = new _coefficients_fraction__WEBPACK_IMPORTED_MODULE_0__.Fraction(values[0].y).reduce();
3450
+ this._x = new fraction_1.Fraction(values[0].x).reduce();
3451
+ this._y = new fraction_1.Fraction(values[0].y).reduce();
3409
3452
  }
3410
3453
  else {
3411
3454
  return this.zero();
3412
3455
  }
3413
3456
  }
3414
3457
  if (values.length === 2) {
3415
- this._x = new _coefficients_fraction__WEBPACK_IMPORTED_MODULE_0__.Fraction(values[0]).reduce();
3416
- this._y = new _coefficients_fraction__WEBPACK_IMPORTED_MODULE_0__.Fraction(values[1]).reduce();
3458
+ this._x = new fraction_1.Fraction(values[0]).reduce();
3459
+ this._y = new fraction_1.Fraction(values[1]).reduce();
3417
3460
  }
3418
3461
  return this;
3419
3462
  };
@@ -3423,8 +3466,8 @@ class Point {
3423
3466
  return this;
3424
3467
  };
3425
3468
  zero = () => {
3426
- this._x = new _coefficients_fraction__WEBPACK_IMPORTED_MODULE_0__.Fraction(null);
3427
- this._y = new _coefficients_fraction__WEBPACK_IMPORTED_MODULE_0__.Fraction(null);
3469
+ this._x = new fraction_1.Fraction(null);
3470
+ this._y = new fraction_1.Fraction(null);
3428
3471
  return this;
3429
3472
  };
3430
3473
  origin = () => {
@@ -3451,6 +3494,7 @@ class Point {
3451
3494
  }
3452
3495
  };
3453
3496
  }
3497
+ exports.Point = Point;
3454
3498
 
3455
3499
 
3456
3500
  /***/ }),
@@ -3459,22 +3503,16 @@ class Point {
3459
3503
  /*!****************************************!*\
3460
3504
  !*** ./src/maths/geometry/triangle.ts ***!
3461
3505
  \****************************************/
3462
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
3506
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
3463
3507
 
3464
- __webpack_require__.r(__webpack_exports__);
3465
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
3466
- /* harmony export */ "Triangle": () => (/* binding */ Triangle)
3467
- /* harmony export */ });
3468
- /* harmony import */ var _point__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./point */ "./src/maths/geometry/point.ts");
3469
- /* harmony import */ var _coefficients_fraction__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../coefficients/fraction */ "./src/maths/coefficients/fraction.ts");
3470
- /* harmony import */ var _vector__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./vector */ "./src/maths/geometry/vector.ts");
3471
- /* harmony import */ var _line__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./line */ "./src/maths/geometry/line.ts");
3472
- /* harmony import */ var _algebra_equation__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../algebra/equation */ "./src/maths/algebra/equation.ts");
3473
-
3474
-
3475
-
3476
-
3477
3508
 
3509
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
3510
+ exports.Triangle = void 0;
3511
+ const point_1 = __webpack_require__(/*! ./point */ "./src/maths/geometry/point.ts");
3512
+ const fraction_1 = __webpack_require__(/*! ../coefficients/fraction */ "./src/maths/coefficients/fraction.ts");
3513
+ const vector_1 = __webpack_require__(/*! ./vector */ "./src/maths/geometry/vector.ts");
3514
+ const line_1 = __webpack_require__(/*! ./line */ "./src/maths/geometry/line.ts");
3515
+ const equation_1 = __webpack_require__(/*! ../algebra/equation */ "./src/maths/algebra/equation.ts");
3478
3516
  class Triangle {
3479
3517
  _A;
3480
3518
  _B;
@@ -3545,12 +3583,12 @@ class Triangle {
3545
3583
  }
3546
3584
  parse = (...values) => {
3547
3585
  if (values.length === 6) {
3548
- let v = values.map((x) => new _coefficients_fraction__WEBPACK_IMPORTED_MODULE_1__.Fraction(x));
3549
- return this.parse(new _point__WEBPACK_IMPORTED_MODULE_0__.Point(v[0], v[1]), new _point__WEBPACK_IMPORTED_MODULE_0__.Point(v[2], v[3]), new _point__WEBPACK_IMPORTED_MODULE_0__.Point(v[4], v[5]));
3586
+ let v = values.map((x) => new fraction_1.Fraction(x));
3587
+ return this.parse(new point_1.Point(v[0], v[1]), new point_1.Point(v[2], v[3]), new point_1.Point(v[4], v[5]));
3550
3588
  }
3551
3589
  else if (values.length === 3) {
3552
3590
  if (values.filter((x) => typeof x === 'string').length === 3) {
3553
- return this.parse(...values.map((x) => new _line__WEBPACK_IMPORTED_MODULE_3__.Line(x)));
3591
+ return this.parse(...values.map((x) => new line_1.Line(x)));
3554
3592
  }
3555
3593
  else if (values.filter((x) => x.isLine === true).length === 3) {
3556
3594
  this._lines = {
@@ -3582,15 +3620,15 @@ class Triangle {
3582
3620
  }
3583
3621
  else {
3584
3622
  if (values.filter((x) => x.isPoint === true).length < 3) {
3585
- return this.parse(new _point__WEBPACK_IMPORTED_MODULE_0__.Point(values[0]), new _point__WEBPACK_IMPORTED_MODULE_0__.Point(values[1]), new _point__WEBPACK_IMPORTED_MODULE_0__.Point(values[2]));
3623
+ return this.parse(new point_1.Point(values[0]), new point_1.Point(values[1]), new point_1.Point(values[2]));
3586
3624
  }
3587
3625
  this._A = values[0].clone();
3588
3626
  this._B = values[1].clone();
3589
3627
  this._C = values[2].clone();
3590
3628
  this._lines = {
3591
- 'AB': new _line__WEBPACK_IMPORTED_MODULE_3__.Line(this._A, this._B),
3592
- 'BC': new _line__WEBPACK_IMPORTED_MODULE_3__.Line(this._B, this._C),
3593
- 'AC': new _line__WEBPACK_IMPORTED_MODULE_3__.Line(this._A, this._C)
3629
+ 'AB': new line_1.Line(this._A, this._B),
3630
+ 'BC': new line_1.Line(this._B, this._C),
3631
+ 'AC': new line_1.Line(this._A, this._C)
3594
3632
  };
3595
3633
  }
3596
3634
  }
@@ -3616,9 +3654,9 @@ class Triangle {
3616
3654
  };
3617
3655
  _updateTriangle = () => {
3618
3656
  this._middles = {
3619
- 'AB': new _point__WEBPACK_IMPORTED_MODULE_0__.Point().middleOf(this._A, this._B),
3620
- 'AC': new _point__WEBPACK_IMPORTED_MODULE_0__.Point().middleOf(this._A, this._C),
3621
- 'BC': new _point__WEBPACK_IMPORTED_MODULE_0__.Point().middleOf(this._B, this._C)
3657
+ 'AB': new point_1.Point().middleOf(this._A, this._B),
3658
+ 'AC': new point_1.Point().middleOf(this._A, this._C),
3659
+ 'BC': new point_1.Point().middleOf(this._B, this._C)
3622
3660
  };
3623
3661
  this._remarquables = this._calculateRemarquableLines();
3624
3662
  };
@@ -3634,26 +3672,26 @@ class Triangle {
3634
3672
  return this._A;
3635
3673
  };
3636
3674
  getSegment = (ptName1, ptName2) => {
3637
- return new _vector__WEBPACK_IMPORTED_MODULE_2__.Vector(this.getPointByName(ptName1), this.getPointByName(ptName2));
3675
+ return new vector_1.Vector(this.getPointByName(ptName1), this.getPointByName(ptName2));
3638
3676
  };
3639
3677
  _calculateRemarquableLines = () => {
3640
3678
  let remarquables = {
3641
3679
  'medians': {
3642
- 'A': new _line__WEBPACK_IMPORTED_MODULE_3__.Line(this._A, this._middles.BC),
3643
- 'B': new _line__WEBPACK_IMPORTED_MODULE_3__.Line(this._B, this._middles.AC),
3644
- 'C': new _line__WEBPACK_IMPORTED_MODULE_3__.Line(this._C, this._middles.AB),
3680
+ 'A': new line_1.Line(this._A, this._middles.BC),
3681
+ 'B': new line_1.Line(this._B, this._middles.AC),
3682
+ 'C': new line_1.Line(this._C, this._middles.AB),
3645
3683
  'intersection': null
3646
3684
  },
3647
3685
  'mediators': {
3648
- 'AB': new _line__WEBPACK_IMPORTED_MODULE_3__.Line(this._middles.AB, new _vector__WEBPACK_IMPORTED_MODULE_2__.Vector(this._A, this._B).normal()),
3649
- 'AC': new _line__WEBPACK_IMPORTED_MODULE_3__.Line(this._middles.AC, new _vector__WEBPACK_IMPORTED_MODULE_2__.Vector(this._A, this._C).normal()),
3650
- 'BC': new _line__WEBPACK_IMPORTED_MODULE_3__.Line(this._middles.BC, new _vector__WEBPACK_IMPORTED_MODULE_2__.Vector(this._B, this._C).normal()),
3686
+ 'AB': new line_1.Line(this._middles.AB, new vector_1.Vector(this._A, this._B).normal()),
3687
+ 'AC': new line_1.Line(this._middles.AC, new vector_1.Vector(this._A, this._C).normal()),
3688
+ 'BC': new line_1.Line(this._middles.BC, new vector_1.Vector(this._B, this._C).normal()),
3651
3689
  'intersection': null
3652
3690
  },
3653
3691
  'heights': {
3654
- 'A': new _line__WEBPACK_IMPORTED_MODULE_3__.Line(this._A, new _vector__WEBPACK_IMPORTED_MODULE_2__.Vector(this._B, this._C).normal()),
3655
- 'B': new _line__WEBPACK_IMPORTED_MODULE_3__.Line(this._B, new _vector__WEBPACK_IMPORTED_MODULE_2__.Vector(this._A, this._C).normal()),
3656
- 'C': new _line__WEBPACK_IMPORTED_MODULE_3__.Line(this._C, new _vector__WEBPACK_IMPORTED_MODULE_2__.Vector(this._A, this._B).normal()),
3692
+ 'A': new line_1.Line(this._A, new vector_1.Vector(this._B, this._C).normal()),
3693
+ 'B': new line_1.Line(this._B, new vector_1.Vector(this._A, this._C).normal()),
3694
+ 'C': new line_1.Line(this._C, new vector_1.Vector(this._A, this._B).normal()),
3657
3695
  'intersection': null
3658
3696
  },
3659
3697
  'bisectors': {
@@ -3683,7 +3721,7 @@ class Triangle {
3683
3721
  d1 = tlines.BC;
3684
3722
  d2 = tlines.AC;
3685
3723
  }
3686
- let b1 = new _line__WEBPACK_IMPORTED_MODULE_3__.Line(new _algebra_equation__WEBPACK_IMPORTED_MODULE_4__.Equation(d1.equation.left.clone().multiply(d2.n.simplify().norm), d2.equation.left.clone().multiply(d1.n.simplify().norm)).reorder(true).simplify()), b2 = new _line__WEBPACK_IMPORTED_MODULE_3__.Line(new _algebra_equation__WEBPACK_IMPORTED_MODULE_4__.Equation(d1.equation.left.clone().multiply(d2.n.simplify().norm), d2.equation.left.clone().multiply(d1.n.simplify().norm).opposed()).reorder(true).simplify());
3724
+ let b1 = new line_1.Line(new equation_1.Equation(d1.equation.left.clone().multiply(d2.n.simplify().norm), d2.equation.left.clone().multiply(d1.n.simplify().norm)).reorder(true).simplify()), b2 = new line_1.Line(new equation_1.Equation(d1.equation.left.clone().multiply(d2.n.simplify().norm), d2.equation.left.clone().multiply(d1.n.simplify().norm).opposed()).reorder(true).simplify());
3687
3725
  if (pt === 'A') {
3688
3726
  return b1.hitSegment(this.B, this.C) ? b1 : b2;
3689
3727
  }
@@ -3696,6 +3734,7 @@ class Triangle {
3696
3734
  return b1;
3697
3735
  };
3698
3736
  }
3737
+ exports.Triangle = Triangle;
3699
3738
 
3700
3739
 
3701
3740
  /***/ }),
@@ -3704,30 +3743,24 @@ class Triangle {
3704
3743
  /*!**************************************!*\
3705
3744
  !*** ./src/maths/geometry/vector.ts ***!
3706
3745
  \**************************************/
3707
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
3746
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
3708
3747
 
3709
- __webpack_require__.r(__webpack_exports__);
3710
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
3711
- /* harmony export */ "Vector": () => (/* binding */ Vector)
3712
- /* harmony export */ });
3713
- /* harmony import */ var _coefficients_fraction__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../coefficients/fraction */ "./src/maths/coefficients/fraction.ts");
3714
- /* harmony import */ var _numeric__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../numeric */ "./src/maths/numeric.ts");
3715
-
3716
3748
 
3749
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
3750
+ exports.Vector = void 0;
3751
+ const fraction_1 = __webpack_require__(/*! ../coefficients/fraction */ "./src/maths/coefficients/fraction.ts");
3752
+ const numeric_1 = __webpack_require__(/*! ../numeric */ "./src/maths/numeric.ts");
3717
3753
  class Vector {
3718
3754
  _x;
3719
3755
  _y;
3720
3756
  constructor(...values) {
3721
- this._x = new _coefficients_fraction__WEBPACK_IMPORTED_MODULE_0__.Fraction().zero();
3722
- this._y = new _coefficients_fraction__WEBPACK_IMPORTED_MODULE_0__.Fraction().zero();
3757
+ this._x = new fraction_1.Fraction().zero();
3758
+ this._y = new fraction_1.Fraction().zero();
3723
3759
  if (values !== undefined) {
3724
3760
  this.parse(...values);
3725
3761
  }
3726
3762
  }
3727
3763
  ;
3728
- get isVector() {
3729
- return true;
3730
- }
3731
3764
  get x() {
3732
3765
  return this._x;
3733
3766
  }
@@ -3755,7 +3788,7 @@ class Vector {
3755
3788
  return this;
3756
3789
  }
3757
3790
  if (values.length === 1) {
3758
- if (values[0].isVector) {
3791
+ if (values[0] instanceof Vector) {
3759
3792
  return values[0].clone();
3760
3793
  }
3761
3794
  else {
@@ -3769,10 +3802,10 @@ class Vector {
3769
3802
  return this;
3770
3803
  }
3771
3804
  if (values[0].isFraction || !isNaN(values[0])) {
3772
- this._x = new _coefficients_fraction__WEBPACK_IMPORTED_MODULE_0__.Fraction(values[0]);
3805
+ this._x = new fraction_1.Fraction(values[0]);
3773
3806
  }
3774
3807
  if (values[1].isFraction || !isNaN(values[1])) {
3775
- this._y = new _coefficients_fraction__WEBPACK_IMPORTED_MODULE_0__.Fraction(values[1]);
3808
+ this._y = new fraction_1.Fraction(values[1]);
3776
3809
  }
3777
3810
  }
3778
3811
  return this;
@@ -3794,19 +3827,19 @@ class Vector {
3794
3827
  };
3795
3828
  zero = () => {
3796
3829
  this.reset();
3797
- this._x = new _coefficients_fraction__WEBPACK_IMPORTED_MODULE_0__.Fraction(null);
3798
- this._y = new _coefficients_fraction__WEBPACK_IMPORTED_MODULE_0__.Fraction(null);
3830
+ this._x = new fraction_1.Fraction(null);
3831
+ this._y = new fraction_1.Fraction(null);
3799
3832
  return this;
3800
3833
  };
3801
3834
  one = () => {
3802
- this._x = new _coefficients_fraction__WEBPACK_IMPORTED_MODULE_0__.Fraction();
3803
- this._y = new _coefficients_fraction__WEBPACK_IMPORTED_MODULE_0__.Fraction();
3835
+ this._x = new fraction_1.Fraction();
3836
+ this._y = new fraction_1.Fraction();
3804
3837
  return this;
3805
3838
  };
3806
3839
  _parseString = (value) => {
3807
3840
  let components = value.split(/[,;\s]/g);
3808
- this.x = new _coefficients_fraction__WEBPACK_IMPORTED_MODULE_0__.Fraction(components[0] || null);
3809
- this.y = new _coefficients_fraction__WEBPACK_IMPORTED_MODULE_0__.Fraction(components[1] || null);
3841
+ this.x = new fraction_1.Fraction(components[0] || null);
3842
+ this.y = new fraction_1.Fraction(components[1] || null);
3810
3843
  return this;
3811
3844
  };
3812
3845
  opposed = () => {
@@ -3838,17 +3871,17 @@ class Vector {
3838
3871
  return this.scalarProductWithVector(v).isZero();
3839
3872
  };
3840
3873
  multiplyByScalar = (k) => {
3841
- let scalar = new _coefficients_fraction__WEBPACK_IMPORTED_MODULE_0__.Fraction(k);
3874
+ let scalar = new fraction_1.Fraction(k);
3842
3875
  this._x.multiply(scalar);
3843
3876
  this._y.multiply(scalar);
3844
3877
  return this;
3845
3878
  };
3846
3879
  divideByScalar = (k) => {
3847
- return this.multiplyByScalar(new _coefficients_fraction__WEBPACK_IMPORTED_MODULE_0__.Fraction(k).invert());
3880
+ return this.multiplyByScalar(new fraction_1.Fraction(k).invert());
3848
3881
  };
3849
3882
  simplify = () => {
3850
- return this.multiplyByScalar(_numeric__WEBPACK_IMPORTED_MODULE_1__.Numeric.lcm(this._x.denominator, this._y.denominator))
3851
- .divideByScalar(_numeric__WEBPACK_IMPORTED_MODULE_1__.Numeric.gcd(this._x.numerator, this._y.numerator));
3883
+ return this.multiplyByScalar(numeric_1.Numeric.lcm(this._x.denominator, this._y.denominator))
3884
+ .divideByScalar(numeric_1.Numeric.gcd(this._x.numerator, this._y.numerator));
3852
3885
  };
3853
3886
  angleWith = (V, sharp, radian) => {
3854
3887
  let scalar = this.scalarProductWithVector(V).value, toDegree = radian ? 1 : 180 / Math.PI;
@@ -3858,6 +3891,7 @@ class Vector {
3858
3891
  return toDegree * Math.acos(scalar / (this.norm * V.norm));
3859
3892
  };
3860
3893
  }
3894
+ exports.Vector = Vector;
3861
3895
 
3862
3896
 
3863
3897
  /***/ }),
@@ -3866,12 +3900,11 @@ class Vector {
3866
3900
  /*!******************************!*\
3867
3901
  !*** ./src/maths/numeric.ts ***!
3868
3902
  \******************************/
3869
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
3903
+ /***/ ((__unused_webpack_module, exports) => {
3870
3904
 
3871
- __webpack_require__.r(__webpack_exports__);
3872
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
3873
- /* harmony export */ "Numeric": () => (/* binding */ Numeric)
3874
- /* harmony export */ });
3905
+
3906
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
3907
+ exports.Numeric = void 0;
3875
3908
  class Numeric {
3876
3909
  static round(value, decimals = 2) {
3877
3910
  return Number(Math.round(Number(value + 'e' + decimals)) + 'e-' + decimals);
@@ -3933,6 +3966,7 @@ class Numeric {
3933
3966
  });
3934
3967
  }
3935
3968
  }
3969
+ exports.Numeric = Numeric;
3936
3970
 
3937
3971
 
3938
3972
  /***/ }),
@@ -3941,43 +3975,53 @@ class Numeric {
3941
3975
  /*!***********************************!*\
3942
3976
  !*** ./src/maths/random/index.ts ***!
3943
3977
  \***********************************/
3944
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
3978
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
3945
3979
 
3946
- __webpack_require__.r(__webpack_exports__);
3947
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
3948
- /* harmony export */ "Random": () => (/* binding */ Random)
3949
- /* harmony export */ });
3950
- /* harmony import */ var _rndPolynom__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./rndPolynom */ "./src/maths/random/rndPolynom.ts");
3951
- /* harmony import */ var _rndMonom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./rndMonom */ "./src/maths/random/rndMonom.ts");
3952
- /* harmony import */ var _rndHelpers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./rndHelpers */ "./src/maths/random/rndHelpers.ts");
3953
- /* harmony import */ var _rndTypes__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./rndTypes */ "./src/maths/random/rndTypes.ts");
3954
-
3955
-
3956
-
3957
3980
 
3981
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3982
+ if (k2 === undefined) k2 = k;
3983
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
3984
+ }) : (function(o, m, k, k2) {
3985
+ if (k2 === undefined) k2 = k;
3986
+ o[k2] = m[k];
3987
+ }));
3988
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
3989
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
3990
+ };
3991
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
3992
+ exports.Random = void 0;
3993
+ const rndPolynom_1 = __webpack_require__(/*! ./rndPolynom */ "./src/maths/random/rndPolynom.ts");
3994
+ const rndMonom_1 = __webpack_require__(/*! ./rndMonom */ "./src/maths/random/rndMonom.ts");
3995
+ const rndHelpers_1 = __webpack_require__(/*! ./rndHelpers */ "./src/maths/random/rndHelpers.ts");
3996
+ const rndFraction_1 = __webpack_require__(/*! ./rndFraction */ "./src/maths/random/rndFraction.ts");
3997
+ __exportStar(__webpack_require__(/*! ./rndTypes */ "./src/maths/random/rndTypes.ts"), exports);
3958
3998
  var Random;
3959
3999
  (function (Random) {
3960
4000
  function polynom(config) {
3961
- return (new _rndPolynom__WEBPACK_IMPORTED_MODULE_0__.rndPolynom(config)).generate();
4001
+ return (new rndPolynom_1.rndPolynom(config)).generate();
3962
4002
  }
3963
4003
  Random.polynom = polynom;
3964
4004
  function monom(config) {
3965
- return (new _rndMonom__WEBPACK_IMPORTED_MODULE_1__.rndMonom(config)).generate();
4005
+ return (new rndMonom_1.rndMonom(config)).generate();
3966
4006
  }
3967
4007
  Random.monom = monom;
3968
- function number(from, to) { return _rndHelpers__WEBPACK_IMPORTED_MODULE_2__.rndHelpers.randomInt(from, to); }
4008
+ function fraction(config) {
4009
+ return (new rndFraction_1.rndFraction(config)).generate();
4010
+ }
4011
+ Random.fraction = fraction;
4012
+ function number(from, to) { return rndHelpers_1.rndHelpers.randomInt(from, to); }
3969
4013
  Random.number = number;
3970
- function numberSym(max, allowZero) { return _rndHelpers__WEBPACK_IMPORTED_MODULE_2__.rndHelpers.randomIntSym(max, allowZero); }
4014
+ function numberSym(max, allowZero) { return rndHelpers_1.rndHelpers.randomIntSym(max, allowZero); }
3971
4015
  Random.numberSym = numberSym;
3972
- function bool(percent) { return _rndHelpers__WEBPACK_IMPORTED_MODULE_2__.rndHelpers.randomBool(percent); }
4016
+ function bool(percent) { return rndHelpers_1.rndHelpers.randomBool(percent); }
3973
4017
  Random.bool = bool;
3974
- function array(arr, number) { return _rndHelpers__WEBPACK_IMPORTED_MODULE_2__.rndHelpers.randomArray(arr, number); }
4018
+ function array(arr, number) { return rndHelpers_1.rndHelpers.randomArray(arr, number); }
3975
4019
  Random.array = array;
3976
- function item(arr) { return _rndHelpers__WEBPACK_IMPORTED_MODULE_2__.rndHelpers.randomItem(arr); }
4020
+ function item(arr) { return rndHelpers_1.rndHelpers.randomItem(arr); }
3977
4021
  Random.item = item;
3978
- function shuffle(arr) { _rndHelpers__WEBPACK_IMPORTED_MODULE_2__.rndHelpers.shuffleArray(arr); }
4022
+ function shuffle(arr) { rndHelpers_1.rndHelpers.shuffleArray(arr); }
3979
4023
  Random.shuffle = shuffle;
3980
- })(Random || (Random = {}));
4024
+ })(Random = exports.Random || (exports.Random = {}));
3981
4025
 
3982
4026
 
3983
4027
  /***/ }),
@@ -3986,12 +4030,11 @@ var Random;
3986
4030
  /*!****************************************!*\
3987
4031
  !*** ./src/maths/random/randomCore.ts ***!
3988
4032
  \****************************************/
3989
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
4033
+ /***/ ((__unused_webpack_module, exports) => {
3990
4034
 
3991
- __webpack_require__.r(__webpack_exports__);
3992
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
3993
- /* harmony export */ "randomCore": () => (/* binding */ randomCore)
3994
- /* harmony export */ });
4035
+
4036
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
4037
+ exports.randomCore = void 0;
3995
4038
  class randomCore {
3996
4039
  _config;
3997
4040
  _defaultConfig;
@@ -4009,6 +4052,46 @@ class randomCore {
4009
4052
  return this;
4010
4053
  };
4011
4054
  }
4055
+ exports.randomCore = randomCore;
4056
+
4057
+
4058
+ /***/ }),
4059
+
4060
+ /***/ "./src/maths/random/rndFraction.ts":
4061
+ /*!*****************************************!*\
4062
+ !*** ./src/maths/random/rndFraction.ts ***!
4063
+ \*****************************************/
4064
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
4065
+
4066
+
4067
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
4068
+ exports.rndFraction = void 0;
4069
+ const randomCore_1 = __webpack_require__(/*! ./randomCore */ "./src/maths/random/randomCore.ts");
4070
+ const coefficients_1 = __webpack_require__(/*! ../coefficients */ "./src/maths/coefficients/index.ts");
4071
+ const index_1 = __webpack_require__(/*! ./index */ "./src/maths/random/index.ts");
4072
+ class rndFraction extends randomCore_1.randomCore {
4073
+ constructor(userConfig) {
4074
+ super();
4075
+ this._defaultConfig = {
4076
+ negative: true,
4077
+ reduced: true,
4078
+ zero: true
4079
+ };
4080
+ this._config = this.mergeConfig(userConfig, this._defaultConfig);
4081
+ }
4082
+ generate = () => {
4083
+ let Q = new coefficients_1.Fraction();
4084
+ if (this._config.negative) {
4085
+ Q.numerator = index_1.Random.numberSym(10, this._config.zero);
4086
+ }
4087
+ else {
4088
+ Q.numerator = index_1.Random.number(this._config.zero ? 0 : 1, 10);
4089
+ }
4090
+ Q.denominator = index_1.Random.number(1, 10);
4091
+ return this._config.reduced ? Q.reduce() : Q;
4092
+ };
4093
+ }
4094
+ exports.rndFraction = rndFraction;
4012
4095
 
4013
4096
 
4014
4097
  /***/ }),
@@ -4017,12 +4100,11 @@ class randomCore {
4017
4100
  /*!****************************************!*\
4018
4101
  !*** ./src/maths/random/rndHelpers.ts ***!
4019
4102
  \****************************************/
4020
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
4103
+ /***/ ((__unused_webpack_module, exports) => {
4021
4104
 
4022
- __webpack_require__.r(__webpack_exports__);
4023
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
4024
- /* harmony export */ "rndHelpers": () => (/* binding */ rndHelpers)
4025
- /* harmony export */ });
4105
+
4106
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
4107
+ exports.rndHelpers = void 0;
4026
4108
  class rndHelpers {
4027
4109
  static randomBool(percent = 0.5) {
4028
4110
  return Math.random() < percent;
@@ -4067,6 +4149,7 @@ class rndHelpers {
4067
4149
  return shuffleArray;
4068
4150
  }
4069
4151
  }
4152
+ exports.rndHelpers = rndHelpers;
4070
4153
 
4071
4154
 
4072
4155
  /***/ }),
@@ -4075,19 +4158,15 @@ class rndHelpers {
4075
4158
  /*!**************************************!*\
4076
4159
  !*** ./src/maths/random/rndMonom.ts ***!
4077
4160
  \**************************************/
4078
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
4161
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
4079
4162
 
4080
- __webpack_require__.r(__webpack_exports__);
4081
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
4082
- /* harmony export */ "rndMonom": () => (/* binding */ rndMonom)
4083
- /* harmony export */ });
4084
- /* harmony import */ var _randomCore__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./randomCore */ "./src/maths/random/randomCore.ts");
4085
- /* harmony import */ var _index__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./index */ "./src/maths/random/index.ts");
4086
- /* harmony import */ var _algebra_monom__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../algebra/monom */ "./src/maths/algebra/monom.ts");
4087
-
4088
4163
 
4089
-
4090
- class rndMonom extends _randomCore__WEBPACK_IMPORTED_MODULE_0__.randomCore {
4164
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
4165
+ exports.rndMonom = void 0;
4166
+ const randomCore_1 = __webpack_require__(/*! ./randomCore */ "./src/maths/random/randomCore.ts");
4167
+ const index_1 = __webpack_require__(/*! ./index */ "./src/maths/random/index.ts");
4168
+ const monom_1 = __webpack_require__(/*! ../algebra/monom */ "./src/maths/algebra/monom.ts");
4169
+ class rndMonom extends randomCore_1.randomCore {
4091
4170
  constructor(userConfig) {
4092
4171
  super();
4093
4172
  this._defaultConfig = {
@@ -4099,15 +4178,18 @@ class rndMonom extends _randomCore__WEBPACK_IMPORTED_MODULE_0__.randomCore {
4099
4178
  this._config = this.mergeConfig(userConfig, this._defaultConfig);
4100
4179
  }
4101
4180
  generate = () => {
4102
- let M = new _algebra_monom__WEBPACK_IMPORTED_MODULE_2__.Monom();
4103
- M.coefficient.parse(_index__WEBPACK_IMPORTED_MODULE_1__.Random.numberSym(10, this._config.zero), (this._config.fraction) ? _index__WEBPACK_IMPORTED_MODULE_1__.Random.number(1, 10) : 1).reduce();
4181
+ let M = new monom_1.Monom();
4182
+ M.coefficient = index_1.Random.fraction({
4183
+ zero: this._config.zero,
4184
+ reduced: true
4185
+ });
4104
4186
  if (this._config.letters.length > 1) {
4105
4187
  for (let L of this._config.letters.split('')) {
4106
4188
  M.setLetter(L, 0);
4107
4189
  }
4108
4190
  for (let i = 0; i < this._config.degree; i++) {
4109
- const L = _index__WEBPACK_IMPORTED_MODULE_1__.Random.item(this._config.letters.split(""));
4110
- M.setLetter(L, M.degree(L) + 1);
4191
+ const L = index_1.Random.item(this._config.letters.split(""));
4192
+ M.setLetter(L, M.degree(L).clone().add(1));
4111
4193
  }
4112
4194
  }
4113
4195
  else {
@@ -4116,6 +4198,7 @@ class rndMonom extends _randomCore__WEBPACK_IMPORTED_MODULE_0__.randomCore {
4116
4198
  return M;
4117
4199
  };
4118
4200
  }
4201
+ exports.rndMonom = rndMonom;
4119
4202
 
4120
4203
 
4121
4204
  /***/ }),
@@ -4124,21 +4207,16 @@ class rndMonom extends _randomCore__WEBPACK_IMPORTED_MODULE_0__.randomCore {
4124
4207
  /*!****************************************!*\
4125
4208
  !*** ./src/maths/random/rndPolynom.ts ***!
4126
4209
  \****************************************/
4127
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
4210
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
4128
4211
 
4129
- __webpack_require__.r(__webpack_exports__);
4130
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
4131
- /* harmony export */ "rndPolynom": () => (/* binding */ rndPolynom)
4132
- /* harmony export */ });
4133
- /* harmony import */ var _randomCore__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./randomCore */ "./src/maths/random/randomCore.ts");
4134
- /* harmony import */ var _rndMonom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./rndMonom */ "./src/maths/random/rndMonom.ts");
4135
- /* harmony import */ var _index__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./index */ "./src/maths/random/index.ts");
4136
- /* harmony import */ var _algebra__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../algebra */ "./src/maths/algebra/index.ts");
4137
4212
 
4138
-
4139
-
4140
-
4141
- class rndPolynom extends _randomCore__WEBPACK_IMPORTED_MODULE_0__.randomCore {
4213
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
4214
+ exports.rndPolynom = void 0;
4215
+ const randomCore_1 = __webpack_require__(/*! ./randomCore */ "./src/maths/random/randomCore.ts");
4216
+ const rndMonom_1 = __webpack_require__(/*! ./rndMonom */ "./src/maths/random/rndMonom.ts");
4217
+ const index_1 = __webpack_require__(/*! ./index */ "./src/maths/random/index.ts");
4218
+ const algebra_1 = __webpack_require__(/*! ../algebra */ "./src/maths/algebra/index.ts");
4219
+ class rndPolynom extends randomCore_1.randomCore {
4142
4220
  constructor(userConfig) {
4143
4221
  super();
4144
4222
  this._defaultConfig = {
@@ -4157,9 +4235,9 @@ class rndPolynom extends _randomCore__WEBPACK_IMPORTED_MODULE_0__.randomCore {
4157
4235
  if (this._config.factorable && this._config.degree > 1) {
4158
4236
  return this.factorable();
4159
4237
  }
4160
- let P = new _algebra__WEBPACK_IMPORTED_MODULE_3__.Polynom().empty(), M;
4238
+ let P = new algebra_1.Polynom().empty(), M;
4161
4239
  for (let i = this._config.degree; i >= 0; i--) {
4162
- M = new _rndMonom__WEBPACK_IMPORTED_MODULE_1__.rndMonom({
4240
+ M = new rndMonom_1.rndMonom({
4163
4241
  letters: this._config.letters,
4164
4242
  degree: i,
4165
4243
  fraction: this._config.fraction,
@@ -4171,22 +4249,22 @@ class rndPolynom extends _randomCore__WEBPACK_IMPORTED_MODULE_0__.randomCore {
4171
4249
  P.add(M);
4172
4250
  }
4173
4251
  if (this._config.numberOfMonoms > 0 && this._config.numberOfMonoms < P.length) {
4174
- console.log(P.monoms.length);
4175
- P.monoms = _index__WEBPACK_IMPORTED_MODULE_2__.Random.array(P.monoms, this._config.numberOfMonoms);
4252
+ P.monoms = index_1.Random.array(P.monoms, this._config.numberOfMonoms);
4176
4253
  }
4177
4254
  return P;
4178
4255
  };
4179
4256
  factorable = () => {
4180
- let P = new _algebra__WEBPACK_IMPORTED_MODULE_3__.Polynom().one();
4257
+ let P = new algebra_1.Polynom().one();
4181
4258
  let _factorableConfig = { ...this._config };
4182
4259
  _factorableConfig.degree = 1;
4183
4260
  _factorableConfig.factorable = false;
4184
4261
  for (let i = 0; i < this._config.degree; i++) {
4185
- P.multiply(_index__WEBPACK_IMPORTED_MODULE_2__.Random.polynom(_factorableConfig));
4262
+ P.multiply(index_1.Random.polynom(_factorableConfig));
4186
4263
  }
4187
4264
  return P;
4188
4265
  };
4189
4266
  }
4267
+ exports.rndPolynom = rndPolynom;
4190
4268
 
4191
4269
 
4192
4270
  /***/ }),
@@ -4195,10 +4273,10 @@ class rndPolynom extends _randomCore__WEBPACK_IMPORTED_MODULE_0__.randomCore {
4195
4273
  /*!**************************************!*\
4196
4274
  !*** ./src/maths/random/rndTypes.ts ***!
4197
4275
  \**************************************/
4198
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
4276
+ /***/ ((__unused_webpack_module, exports) => {
4199
4277
 
4200
- __webpack_require__.r(__webpack_exports__);
4201
4278
 
4279
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
4202
4280
 
4203
4281
 
4204
4282
  /***/ }),
@@ -4207,12 +4285,11 @@ __webpack_require__.r(__webpack_exports__);
4207
4285
  /*!**********************************!*\
4208
4286
  !*** ./src/maths/shutingyard.ts ***!
4209
4287
  \**********************************/
4210
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
4288
+ /***/ ((__unused_webpack_module, exports) => {
4211
4289
 
4212
- __webpack_require__.r(__webpack_exports__);
4213
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
4214
- /* harmony export */ "Shutingyard": () => (/* binding */ Shutingyard)
4215
- /* harmony export */ });
4290
+
4291
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
4292
+ exports.Shutingyard = void 0;
4216
4293
  class Shutingyard {
4217
4294
  _rpn = [];
4218
4295
  _mode;
@@ -4442,6 +4519,7 @@ class Shutingyard {
4442
4519
  return this._rpn;
4443
4520
  }
4444
4521
  }
4522
+ exports.Shutingyard = Shutingyard;
4445
4523
 
4446
4524
 
4447
4525
  /***/ })
@@ -4466,79 +4544,46 @@ class Shutingyard {
4466
4544
  /******/ };
4467
4545
  /******/
4468
4546
  /******/ // Execute the module function
4469
- /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
4547
+ /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
4470
4548
  /******/
4471
4549
  /******/ // Return the exports of the module
4472
4550
  /******/ return module.exports;
4473
4551
  /******/ }
4474
4552
  /******/
4475
4553
  /************************************************************************/
4476
- /******/ /* webpack/runtime/define property getters */
4477
- /******/ (() => {
4478
- /******/ // define getter functions for harmony exports
4479
- /******/ __webpack_require__.d = (exports, definition) => {
4480
- /******/ for(var key in definition) {
4481
- /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
4482
- /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
4483
- /******/ }
4484
- /******/ }
4485
- /******/ };
4486
- /******/ })();
4487
- /******/
4488
- /******/ /* webpack/runtime/hasOwnProperty shorthand */
4489
- /******/ (() => {
4490
- /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
4491
- /******/ })();
4492
- /******/
4493
- /******/ /* webpack/runtime/make namespace object */
4494
- /******/ (() => {
4495
- /******/ // define __esModule on exports
4496
- /******/ __webpack_require__.r = (exports) => {
4497
- /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
4498
- /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4499
- /******/ }
4500
- /******/ Object.defineProperty(exports, '__esModule', { value: true });
4501
- /******/ };
4502
- /******/ })();
4503
- /******/
4504
- /************************************************************************/
4505
4554
  var __webpack_exports__ = {};
4506
4555
  // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
4507
4556
  (() => {
4557
+ var exports = __webpack_exports__;
4508
4558
  /*!*********************!*\
4509
4559
  !*** ./src/main.ts ***!
4510
4560
  \*********************/
4511
- __webpack_require__.r(__webpack_exports__);
4512
- /* harmony import */ var _maths_numeric__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./maths/numeric */ "./src/maths/numeric.ts");
4513
- /* harmony import */ var _maths_shutingyard__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./maths/shutingyard */ "./src/maths/shutingyard.ts");
4514
- /* harmony import */ var _maths_random__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./maths/random */ "./src/maths/random/index.ts");
4515
- /* harmony import */ var _maths_coefficients__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./maths/coefficients */ "./src/maths/coefficients/index.ts");
4516
- /* harmony import */ var _maths_algebra__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./maths/algebra */ "./src/maths/algebra/index.ts");
4517
- /* harmony import */ var _maths_geometry__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./maths/geometry */ "./src/maths/geometry/index.ts");
4518
-
4519
-
4520
-
4521
-
4522
-
4523
4561
 
4562
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
4563
+ const numeric_1 = __webpack_require__(/*! ./maths/numeric */ "./src/maths/numeric.ts");
4564
+ const shutingyard_1 = __webpack_require__(/*! ./maths/shutingyard */ "./src/maths/shutingyard.ts");
4565
+ const random_1 = __webpack_require__(/*! ./maths/random */ "./src/maths/random/index.ts");
4566
+ const coefficients_1 = __webpack_require__(/*! ./maths/coefficients */ "./src/maths/coefficients/index.ts");
4567
+ const algebra_1 = __webpack_require__(/*! ./maths/algebra */ "./src/maths/algebra/index.ts");
4568
+ const geometry_1 = __webpack_require__(/*! ./maths/geometry */ "./src/maths/geometry/index.ts");
4524
4569
  window.Pi = {
4525
- ShutingYard: _maths_shutingyard__WEBPACK_IMPORTED_MODULE_1__.Shutingyard,
4526
- Numeric: _maths_numeric__WEBPACK_IMPORTED_MODULE_0__.Numeric,
4527
- Fraction: _maths_coefficients__WEBPACK_IMPORTED_MODULE_3__.Fraction,
4528
- Root: _maths_coefficients__WEBPACK_IMPORTED_MODULE_3__.Nthroot,
4529
- Monom: _maths_algebra__WEBPACK_IMPORTED_MODULE_4__.Monom,
4530
- Polynom: _maths_algebra__WEBPACK_IMPORTED_MODULE_4__.Polynom,
4531
- Equation: _maths_algebra__WEBPACK_IMPORTED_MODULE_4__.Equation,
4532
- LinearSystem: _maths_algebra__WEBPACK_IMPORTED_MODULE_4__.LinearSystem,
4533
- Rational: _maths_algebra__WEBPACK_IMPORTED_MODULE_4__.Rational,
4534
- Logicalset: _maths_algebra__WEBPACK_IMPORTED_MODULE_4__.Logicalset,
4535
- Random: _maths_random__WEBPACK_IMPORTED_MODULE_2__.Random,
4570
+ ShutingYard: shutingyard_1.Shutingyard,
4571
+ Numeric: numeric_1.Numeric,
4572
+ Fraction: coefficients_1.Fraction,
4573
+ Root: coefficients_1.Nthroot,
4574
+ Monom: algebra_1.Monom,
4575
+ Polynom: algebra_1.Polynom,
4576
+ Equation: algebra_1.Equation,
4577
+ LinearSystem: algebra_1.LinearSystem,
4578
+ Rational: algebra_1.Rational,
4579
+ Logicalset: algebra_1.Logicalset,
4580
+ Random: random_1.Random,
4536
4581
  Geometry: {
4537
- Vector: _maths_geometry__WEBPACK_IMPORTED_MODULE_5__.Vector,
4538
- Point: _maths_geometry__WEBPACK_IMPORTED_MODULE_5__.Point,
4539
- Line: _maths_geometry__WEBPACK_IMPORTED_MODULE_5__.Line,
4540
- Triangle: _maths_geometry__WEBPACK_IMPORTED_MODULE_5__.Triangle,
4541
- Circle: _maths_geometry__WEBPACK_IMPORTED_MODULE_5__.Circle
4582
+ Vector: geometry_1.Vector,
4583
+ Point: geometry_1.Point,
4584
+ Line: geometry_1.Line,
4585
+ Triangle: geometry_1.Triangle,
4586
+ Circle: geometry_1.Circle
4542
4587
  }
4543
4588
  };
4544
4589