pimath 0.2.0 → 0.2.2

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/dist/pimath.js CHANGED
@@ -6,7 +6,7 @@ function ut(n) {
6
6
  return e;
7
7
  }
8
8
  function ft(...n) {
9
- const t = J(...n);
9
+ const t = _(...n);
10
10
  return n.map((e) => e / t);
11
11
  }
12
12
  function rt(n) {
@@ -17,7 +17,7 @@ function rt(n) {
17
17
  return s - r;
18
18
  }), [...new Set(i)];
19
19
  }
20
- function J(...n) {
20
+ function _(...n) {
21
21
  const t = function(s, r) {
22
22
  return r === 0 ? s : t(r, s % r);
23
23
  };
@@ -34,7 +34,7 @@ function J(...n) {
34
34
  }
35
35
  function dt(...n) {
36
36
  return n.reduce(function(t, e) {
37
- return Math.abs(t * e / J(t, e));
37
+ return Math.abs(t * e / _(t, e));
38
38
  });
39
39
  }
40
40
  function pt(n, t = 3) {
@@ -74,7 +74,7 @@ const x = {
74
74
  decompose: ut,
75
75
  dividers: rt,
76
76
  divideNumbersByGCD: ft,
77
- gcd: J,
77
+ gcd: _,
78
78
  lcm: dt,
79
79
  numberCorrection: pt,
80
80
  periodic: mt,
@@ -346,13 +346,13 @@ class a {
346
346
  function st(n, t = !0) {
347
347
  return t ? `\\left( ${n} \\right)` : `(${n})`;
348
348
  }
349
- function Y(n) {
349
+ function Q(n) {
350
350
  return n.startsWith("(") && (n = n.substring(1)), n.endsWith(")") && (n = n.substring(0, n.length - 1)), n;
351
351
  }
352
- function j(n, t, e, i, s) {
352
+ function U(n, t, e, i, s) {
353
353
  return n.map((r, o) => r === t ? e : r);
354
354
  }
355
- class O {
355
+ class T {
356
356
  #t;
357
357
  #e;
358
358
  #i;
@@ -361,44 +361,42 @@ class O {
361
361
  return this.#e = 2, this.#t = new a().zero(), this.#i = new a().zero(), t && this.parse(t), this;
362
362
  }
363
363
  parse(t) {
364
- if (t instanceof O)
364
+ if (t instanceof T)
365
365
  return this.index = t.index, this.radical = t.radical.clone(), this.factor = t.factor.clone(), this;
366
366
  if (t instanceof a)
367
367
  return this.index = 2, this.factor = t.clone(), this.radical.one(), this;
368
368
  if (typeof t == "string") {
369
369
  if (t.includes("sqrt"))
370
- return this.#n(t);
370
+ return this.#h(t);
371
371
  if (t.includes("root"))
372
- return this.#r(t);
372
+ return this.#o(t);
373
373
  }
374
374
  return this.index = 2, this.factor = new a(t), this.radical.one(), this;
375
375
  }
376
376
  clone() {
377
- return new O().from(this.index, this.radical, this.factor);
377
+ return new T().from(this.index, this.radical, this.factor);
378
378
  }
379
379
  get tex() {
380
380
  const t = this.#s && this.factor.isPositive() ? "+" : "";
381
- if (this.#i.isZero()) return `${t}${this.#t.tex}`;
382
- if (this.index === 1) return `${t}${this.factor.clone().multiply(this.radical).tex}`;
383
- const e = this.index === 2 ? `\\sqrt{ ${this.#i.tex} }` : `\\sqrt[ ${this.index} ]{ ${this.#i.tex} }`;
384
- return this.#t.isUnit() ? this.#s ? `${this.#t.isOne() ? t : "-"} ${e}` : `${this.#t.isOne() ? "" : "-"}${e}` : `${t}${this.#t.tex} ${e}`;
381
+ if (this.value === 0) return `${t}0`;
382
+ const e = this.#n(this.#t.denominator, this.#i.denominator), i = this.#n(this.#t.numerator, this.#i.numerator) ?? "1";
383
+ return e === null ? `${t}${i}` : `${t}\\frac{ ${i} }{ ${e} }`;
385
384
  }
386
385
  get display() {
387
386
  const t = this.#s && this.factor.isPositive() ? "+" : "";
388
- if (this.#i.isZero()) return `${t}${this.#t.display}`;
389
- if (this.index === 1) return `${t}${this.factor.clone().multiply(this.radical).display}`;
390
- const e = this.index === 2 ? `sqrt(${this.#i.tex})` : `root(${this.index})(${this.#i.display})`;
391
- return this.#t.isUnit() ? `${this.#t.isOne() ? t : "-"}${e}` : `${t}${this.#t.display}${e}`;
387
+ if (this.value === 0) return `${t}0`;
388
+ const e = this.#r(this.#t.denominator, this.#i.denominator, !0), i = this.#r(this.#t.numerator, this.#i.numerator, e !== null) ?? "1";
389
+ return e === null ? `${t}${i}` : `${t}${i}/${e}`;
392
390
  }
393
391
  add(t) {
394
392
  this.reduce();
395
- const e = new O(t).reduce();
393
+ const e = new T(t).reduce();
396
394
  if (this.index !== e.index || !this.radical.isEqual(e.radical))
397
395
  throw new Error("Add can only be done with two same index and radical");
398
396
  return this.factor.add(e.factor), this;
399
397
  }
400
398
  divide(t) {
401
- return this.multiply(new O(t).inverse());
399
+ return this.multiply(new T(t).inverse());
402
400
  }
403
401
  get factor() {
404
402
  return this.#t;
@@ -443,7 +441,7 @@ class O {
443
441
  return this.factor.isZero() || this.radical.isZero();
444
442
  }
445
443
  multiply(t) {
446
- const e = new O(t);
444
+ const e = new T(t);
447
445
  if (this.factor.multiply(e.factor), this.index === e.index)
448
446
  return this.radical.multiply(e.radical), this;
449
447
  if (this.radical.isEqual(e.radical)) {
@@ -484,7 +482,7 @@ class O {
484
482
  return this.root(2);
485
483
  }
486
484
  subtract(t) {
487
- const e = new O(t);
485
+ const e = new T(t);
488
486
  return this.add(e.opposite());
489
487
  }
490
488
  get value() {
@@ -499,16 +497,30 @@ class O {
499
497
  zero() {
500
498
  return this.radical.zero(), this.factor.zero(), this;
501
499
  }
502
- #r(t) {
500
+ #r(t, e, i) {
501
+ const s = this.#e === 2 ? "sqrt" : `root(${this.#e})`, r = [
502
+ t !== 1 && t !== 0 ? t.toString() : null,
503
+ e !== 1 && e !== 0 ? `${s}(${e})` : null
504
+ ].filter((o) => o !== null);
505
+ return r.length === 0 ? null : i && r.length === 2 ? `(${r.join("")})` : r.join("");
506
+ }
507
+ #n(t, e) {
508
+ const i = this.#e === 2 ? "\\sqrt" : `\\sqrt[ ${this.#e} ]`, s = [
509
+ t !== 1 && t !== 0 ? t.toString() : null,
510
+ e !== 1 && e !== 0 ? `${i}{ ${e} }` : null
511
+ ].filter((r) => r !== null);
512
+ return s.length === 0 ? null : s.join(" ");
513
+ }
514
+ #o(t) {
503
515
  const [e, i] = t.split("root"), [s, r] = i.split(")");
504
- return this.index = +Y(s), this.radical = new a(Y(r)), this.factor = e === "" ? new a().one() : new a(e), this;
516
+ return this.index = +Q(s), this.radical = new a(Q(r)), this.factor = e === "" ? new a().one() : new a(e), this;
505
517
  }
506
- #n(t) {
518
+ #h(t) {
507
519
  const [e, i] = t.split("sqrt");
508
- return this.index = 2, this.radical = new a(Y(i)), this.factor = e === "" ? new a().one() : new a(e), this;
520
+ return this.index = 2, this.radical = new a(Q(i)), this.factor = e === "" ? new a().one() : new a(e), this;
509
521
  }
510
522
  }
511
- class $ {
523
+ class C {
512
524
  #t;
513
525
  #e;
514
526
  #i;
@@ -517,7 +529,7 @@ class $ {
517
529
  #n;
518
530
  #o;
519
531
  constructor() {
520
- this.#o = "x", this.#i = !1, this.#e = null, this.#n = null, this.#s = new a().zero(), this.#r = new O(), this.#t = 1;
532
+ this.#o = "x", this.#i = !1, this.#e = null, this.#n = null, this.#s = new a().zero(), this.#r = new T(), this.#t = 1;
521
533
  }
522
534
  get tex() {
523
535
  if (this.#n) return this.#n;
@@ -540,10 +552,10 @@ class $ {
540
552
  this.#e = t;
541
553
  }
542
554
  static fromFraction(t) {
543
- const e = new $();
555
+ const e = new C();
544
556
  e.setExact();
545
557
  const i = new a(t);
546
- return e.display = i.display, e.tex = i.tex, e.fraction = i, e.root = new O(), e;
558
+ return e.display = i.display, e.tex = i.tex, e.fraction = i, e.root = new T(), e;
547
559
  }
548
560
  static fromQuadratic(t, e, i) {
549
561
  const [s, r, o] = [t, e, i].map((m) => new a(m)), h = r.clone().pow(2).subtract(s.clone().multiply(o).multiply(4));
@@ -551,12 +563,12 @@ class $ {
551
563
  return [];
552
564
  if (h.isSquare()) {
553
565
  const m = h.sqrt(), d = r.clone().opposite().subtract(m).divide(s.clone().multiply(2)), y = r.clone().opposite().add(m).divide(s.clone().multiply(2));
554
- return m.isZero() ? [$.fromFraction(d)] : [$.fromFraction(d), $.fromFraction(y)];
566
+ return m.isZero() ? [C.fromFraction(d)] : [C.fromFraction(d), C.fromFraction(y)];
555
567
  }
556
- const c = new $();
557
- c.fraction = r.clone().opposite().divide(s).divide(2), c.root = new O().from(2, h, s.clone().multiply(2).inverse().opposite()), c.setExact(!1);
558
- const f = new $();
559
- return f.fraction = r.clone().opposite().divide(s).divide(2), f.root = new O().from(2, h, s.clone().multiply(2).inverse()), f.setExact(!1), [c, f];
568
+ const c = new C();
569
+ c.fraction = r.clone().opposite().divide(s).divide(2), c.root = new T().from(2, h, s.clone().multiply(2).inverse().opposite()), c.setExact(!1);
570
+ const f = new C();
571
+ return f.fraction = r.clone().opposite().divide(s).divide(2), f.root = new T().from(2, h, s.clone().multiply(2).inverse()), f.setExact(!1), [c, f];
560
572
  }
561
573
  get count() {
562
574
  return this.#t;
@@ -601,7 +613,7 @@ class $ {
601
613
  t !== void 0 && (this.#o = t);
602
614
  }
603
615
  }
604
- class Vt {
616
+ class jt {
605
617
  #t;
606
618
  #e;
607
619
  constructor(t) {
@@ -657,11 +669,11 @@ class R {
657
669
  return this.#c();
658
670
  }
659
671
  #s(t, e) {
660
- const i = new $();
672
+ const i = new C();
661
673
  return i.exact = !1, i.tex = e?.tex ?? null, i.display = e?.display ?? null, i.fraction = new a(t), i.fraction.exact = !1, i.variable = this.#i, i;
662
674
  }
663
675
  #r(t) {
664
- return t instanceof a && !t.exact ? this.#s(t.value) : $.fromFraction(t);
676
+ return t instanceof a && !t.exact ? this.#s(t.value) : C.fromFraction(t);
665
677
  }
666
678
  // Solve using bissection algorithm (approximative solution)
667
679
  #n(t) {
@@ -718,14 +730,14 @@ class R {
718
730
  const s = t.monomByDegree().coefficient, r = t.monomByDegree(0).coefficient;
719
731
  if (r.isZero()) {
720
732
  e.push(this.#r(0));
721
- const d = t.monoms.reduce((C, q) => q.degree().value < C.degree().value ? q : C), y = d.coefficient;
733
+ const d = t.monoms.reduce((q, $) => $.degree().value < q.degree().value ? $ : q), y = d.coefficient;
722
734
  d.clone().divide(y), t.divide(d);
723
735
  }
724
736
  const o = x.dividers(s.value), h = x.dividers(r.value), c = [];
725
737
  for (const d of o)
726
738
  for (const y of h) {
727
- const C = new a(y, d);
728
- c.find((q) => q.value === C.value) || (c.push(C.clone()), c.push(C.opposite().clone()));
739
+ const q = new a(y, d);
740
+ c.find(($) => $.value === q.value) || (c.push(q.clone()), c.push(q.opposite().clone()));
729
741
  }
730
742
  c.forEach((d) => {
731
743
  t.evaluate(d).isZero() && e.push(this.#r(d));
@@ -746,23 +758,23 @@ class R {
746
758
  };
747
759
  }
748
760
  #c() {
749
- const t = this.#e, e = t.monomByDegree(3).coefficient, i = t.monomByDegree(2).coefficient, s = t.monomByDegree(1).coefficient, r = t.monomByDegree(0).coefficient, o = i.clone().divide(e), h = s.clone().divide(e), c = r.clone().divide(e), f = h.clone().subtract(o.clone().pow(2).divide(3)), m = c.clone().subtract(o.clone().multiply(h).divide(3)).add(o.clone().pow(3).multiply(2).divide(27)), d = m.clone().opposite(), y = f.clone().opposite().pow(3).divide(27), C = d.clone().pow(2).subtract(y.clone().multiply(4)).opposite();
750
- if (C.isNegative()) {
751
- const q = m.clone().opposite().add(C.clone().opposite().sqrt()).divide(2).root(3), k = m.clone().opposite().subtract(C.clone().opposite().sqrt()).divide(2).root(3), z = q.clone().add(k).subtract(o.clone().divide(3));
752
- return [this.#r(z)];
761
+ const t = this.#e, e = t.monomByDegree(3).coefficient, i = t.monomByDegree(2).coefficient, s = t.monomByDegree(1).coefficient, r = t.monomByDegree(0).coefficient, o = i.clone().divide(e), h = s.clone().divide(e), c = r.clone().divide(e), f = h.clone().subtract(o.clone().pow(2).divide(3)), m = c.clone().subtract(o.clone().multiply(h).divide(3)).add(o.clone().pow(3).multiply(2).divide(27)), d = m.clone().opposite(), y = f.clone().opposite().pow(3).divide(27), q = d.clone().pow(2).subtract(y.clone().multiply(4)).opposite();
762
+ if (q.isNegative()) {
763
+ const $ = m.clone().opposite().add(q.clone().opposite().sqrt()).divide(2).root(3), k = m.clone().opposite().subtract(q.clone().opposite().sqrt()).divide(2).root(3), I = $.clone().add(k).subtract(o.clone().divide(3));
764
+ return [this.#r(I)];
753
765
  }
754
- if (C.isZero()) {
755
- const q = m.clone().opposite().divide(2).root(3), k = q.clone().opposite().subtract(o.clone().divide(3)), z = q.clone().multiply(2).subtract(o.clone().divide(3));
756
- return k.isEqual(z) ? [this.#r(k)] : [
757
- this.#r(z),
766
+ if (q.isZero()) {
767
+ const $ = m.clone().opposite().divide(2).root(3), k = $.clone().opposite().subtract(o.clone().divide(3)), I = $.clone().multiply(2).subtract(o.clone().divide(3));
768
+ return k.isEqual(I) ? [this.#r(k)] : [
769
+ this.#r(I),
758
770
  this.#r(k)
759
- ].sort((X, M) => X.value - M.value);
771
+ ].sort((Y, M) => Y.value - M.value);
760
772
  }
761
- if (C.isPositive()) {
762
- const q = [], k = f.value, z = m.value, X = o.value;
773
+ if (q.isPositive()) {
774
+ const $ = [], k = f.value, I = m.value, Y = o.value;
763
775
  for (let M = 0; M < 3; M++)
764
- q.push(2 * Math.sqrt(-k / 3) * Math.cos(Math.acos(3 * z / (2 * k) * Math.sqrt(-3 / k)) / 3 + 2 * Math.PI * M / 3) - X / 3);
765
- return q.map((M) => this.#s(M)).sort((M, lt) => M.value - lt.value);
776
+ $.push(2 * Math.sqrt(-k / 3) * Math.cos(Math.acos(3 * I / (2 * k) * Math.sqrt(-3 / k)) / 3 + 2 * Math.PI * M / 3) - Y / 3);
777
+ return $.map((M) => this.#s(M)).sort((M, lt) => M.value - lt.value);
766
778
  }
767
779
  return [];
768
780
  }
@@ -792,23 +804,23 @@ class R {
792
804
  return this.#d(e, i, r);
793
805
  }
794
806
  #d(t, e, i) {
795
- const s = t.clone().multiply(2), r = new $();
807
+ const s = t.clone().multiply(2), r = new C();
796
808
  r.fraction = e.clone().opposite().divide(s.clone()), r.root.radical = i.clone(), r.root.factor = new a().one().divide(s.clone()), r.exact = !0;
797
- const o = new $();
809
+ const o = new C();
798
810
  return o.fraction = e.clone().opposite().divide(s.clone()), o.root.radical = i.clone(), o.root.factor = new a().one().divide(s.clone()).opposite(), o.exact = !0, [r, o].sort((h, c) => h.value - c.value);
799
811
  }
800
812
  }
801
- const _ = {
813
+ const tt = {
802
814
  pi: Math.PI,
803
815
  e: Math.exp(1)
804
816
  };
805
- var u = /* @__PURE__ */ ((n) => (n.VARIABLE = "variable", n.COEFFICIENT = "coefficient", n.OPERATION = "operation", n.CONSTANT = "constant", n.FUNCTION = "function", n.FUNCTION_ARGUMENT = "function-argument", n.MONOM = "monom", n.LEFT_PARENTHESIS = "(", n.RIGHT_PARENTHESIS = ")", n))(u || {}), I = /* @__PURE__ */ ((n) => (n.EXPRESSION = "expression", n.POLYNOM = "polynom", n.SET = "set", n.NUMERIC = "numeric", n))(I || {});
817
+ var u = /* @__PURE__ */ ((n) => (n.VARIABLE = "variable", n.COEFFICIENT = "coefficient", n.OPERATION = "operation", n.CONSTANT = "constant", n.FUNCTION = "function", n.FUNCTION_ARGUMENT = "function-argument", n.MONOM = "monom", n.LEFT_PARENTHESIS = "(", n.RIGHT_PARENTHESIS = ")", n))(u || {}), S = /* @__PURE__ */ ((n) => (n.EXPRESSION = "expression", n.POLYNOM = "polynom", n.SET = "set", n.NUMERIC = "numeric", n))(S || {});
806
818
  function bt(n, t) {
807
819
  if (n.length <= 1)
808
820
  return n;
809
821
  const e = Object.keys(t).filter((d) => t[d].type === u.FUNCTION).map((d) => d);
810
822
  e.sort((d, y) => y.length - d.length);
811
- const i = new RegExp(`^(${e.join("|")})\\(`), s = Object.keys(_);
823
+ const i = new RegExp(`^(${e.join("|")})\\(`), s = Object.keys(tt);
812
824
  s.sort((d, y) => y.length - d.length);
813
825
  const r = new RegExp(`^(${s.join("|")})`), o = /^(\d+(\.\d+)?)/;
814
826
  let h = "", c, f, m;
@@ -876,7 +888,7 @@ const Nt = {
876
888
  sqrt: { precedence: 4, associative: "right", type: u.FUNCTION },
877
889
  nthrt: { precedence: 4, associative: "right", type: u.FUNCTION },
878
890
  ",": { precedence: 2, associative: "left", type: u.FUNCTION_ARGUMENT }
879
- }, Ot = {
891
+ }, Tt = {
880
892
  "^": { precedence: 4, associative: "right", type: u.OPERATION },
881
893
  "*": { precedence: 3, associative: "left", type: u.OPERATION },
882
894
  "/": { precedence: 3, associative: "left", type: u.OPERATION },
@@ -890,7 +902,7 @@ const Nt = {
890
902
  nthrt: { precedence: 4, associative: "right", type: u.FUNCTION },
891
903
  ln: { precedence: 4, associative: "right", type: u.FUNCTION },
892
904
  log: { precedence: 4, associative: "right", type: u.FUNCTION }
893
- }, Tt = {
905
+ }, Ot = {
894
906
  "&": { precedence: 3, associative: "left", type: u.OPERATION },
895
907
  "|": { precedence: 3, associative: "left", type: u.OPERATION },
896
908
  "!": { precedence: 4, associative: "right", type: u.OPERATION },
@@ -903,7 +915,7 @@ class G {
903
915
  #s = [];
904
916
  #r;
905
917
  constructor(t) {
906
- this.#t = typeof t > "u" ? I.POLYNOM : t, this.tokenConfigInitialization();
918
+ this.#t = typeof t > "u" ? S.POLYNOM : t, this.tokenConfigInitialization();
907
919
  }
908
920
  // Getter
909
921
  get rpn() {
@@ -913,7 +925,7 @@ class G {
913
925
  return this.#e.map((t) => t.token);
914
926
  }
915
927
  tokenConfigInitialization() {
916
- return this.#t === I.SET ? (this.#i = Tt, this.#r = !1) : this.#t === I.NUMERIC ? (this.#i = Ot, this.#r = !0) : this.#t === I.EXPRESSION ? (this.#i = At, this.#r = !0) : (this.#i = Nt, this.#r = !0), this.#s = Object.keys(this.#i).sort((t, e) => e.length - t.length), this.#i;
928
+ return this.#t === S.SET ? (this.#i = Ot, this.#r = !1) : this.#t === S.NUMERIC ? (this.#i = Tt, this.#r = !0) : this.#t === S.EXPRESSION ? (this.#i = At, this.#r = !0) : (this.#i = Nt, this.#r = !0), this.#s = Object.keys(this.#i).sort((t, e) => e.length - t.length), this.#i;
917
929
  }
918
930
  /**
919
931
  * Get the next token to analyse.
@@ -934,7 +946,7 @@ class G {
934
946
  i += r, s = this.#i[r].type;
935
947
  break;
936
948
  }
937
- for (const r in _)
949
+ for (const r in tt)
938
950
  if (t.substring(e, e + r.length) === r) {
939
951
  i += r, s = u.CONSTANT;
940
952
  break;
@@ -1035,7 +1047,7 @@ class Ct {
1035
1047
  constructor(t, e) {
1036
1048
  this._expression = t;
1037
1049
  try {
1038
- this._rpn = new G(I.NUMERIC).parse(t, e).rpn;
1050
+ this._rpn = new G(S.NUMERIC).parse(t, e).rpn;
1039
1051
  } catch (i) {
1040
1052
  throw this._rpn = null, this._isValid = !1, console.warn(i), new Error(`There was a problem parsing: ${t}`);
1041
1053
  }
@@ -1076,7 +1088,7 @@ class Ct {
1076
1088
  else if (i.tokenType === u.VARIABLE && t !== void 0)
1077
1089
  Object.hasOwn(t, i.token) && e.push(+t[i.token]);
1078
1090
  else if (i.tokenType === u.CONSTANT)
1079
- e.push(_[i.token]);
1091
+ e.push(tt[i.token]);
1080
1092
  else if (i.tokenType === u.OPERATION) {
1081
1093
  if (i.token === "*") {
1082
1094
  const s = e.pop(), r = e.pop();
@@ -1967,7 +1979,7 @@ class l {
1967
1979
  let e = new Array(2 * t.length + 1).fill("").map((i, s) => s % 2 === 0 ? "" : "z");
1968
1980
  if (e.length === 1) {
1969
1981
  const [i] = this.getCoefficients().map((s) => s.value);
1970
- e = j(e, "", i > 0 ? "+" : "-");
1982
+ e = U(e, "", i > 0 ? "+" : "-");
1971
1983
  } else if (this.degree().isOne()) {
1972
1984
  const [i] = this.getCoefficients().map((s) => s.value);
1973
1985
  e[0] = i > 0 ? "-" : "+", e[1] = "z", e[2] = i > 0 ? "+" : "-";
@@ -2512,7 +2524,7 @@ class b {
2512
2524
  }
2513
2525
  tableOfSigns() {
2514
2526
  const t = this.power.clone().reduce(), e = this.polynom.tableOfSigns();
2515
- return t.isStrictlyNegative() && (e.signs = j(e.signs, "z", "d")), t.denominator % 2 === 0 ? e.signs = j(e.signs, "-", "h") : t.numerator % 2 === 0 && (e.signs = j(e.signs, "-", "+")), { roots: e.roots, signs: e.signs };
2527
+ return t.isStrictlyNegative() && (e.signs = U(e.signs, "z", "d")), t.denominator % 2 === 0 ? e.signs = U(e.signs, "-", "h") : t.numerator % 2 === 0 && (e.signs = U(e.signs, "-", "+")), { roots: e.roots, signs: e.signs };
2516
2528
  }
2517
2529
  get variables() {
2518
2530
  return this.polynom.variables;
@@ -2528,17 +2540,15 @@ class b {
2528
2540
  }
2529
2541
  }
2530
2542
  var D = /* @__PURE__ */ ((n) => (n[n.ROOT = 0] = "ROOT", n[n.POWER = 1] = "POWER", n))(D || {});
2531
- class B {
2543
+ class z {
2532
2544
  #t;
2533
- // Solve steps for TeX output.
2534
- #e = [];
2535
2545
  // Determine the letters in the linear asSystem, usually ['x', 'y']
2536
- #i;
2546
+ #e;
2537
2547
  constructor(...t) {
2538
- return this.#t = [], this.#i = [], t.length > 0 && this.parse(...t), this;
2548
+ return this.#t = [], this.#e = [], t.length > 0 && this.parse(...t), this;
2539
2549
  }
2540
- parse = (...t) => (this.#t = t.map((e) => new v(e)), this.#s(), this);
2541
- clone = () => new B().parse(...this.#t.map((t) => t.clone()));
2550
+ parse = (...t) => (this.#t = t.map((e) => new v(e)), this.#i(), this);
2551
+ clone = () => new z().parse(...this.#t.map((t) => t.clone()));
2542
2552
  get tex() {
2543
2553
  const t = this.clone().reorder();
2544
2554
  return this.buildTex(t.equations);
@@ -2551,15 +2561,21 @@ class B {
2551
2561
  if (t.some((r) => r.length !== i))
2552
2562
  throw new Error("All rows must have the same number of columns");
2553
2563
  const s = e.split("").splice(0, i - 1);
2554
- return new B(
2564
+ return new z(
2555
2565
  ...t.map((r) => {
2556
2566
  const o = new l(s.join(""), ...r);
2557
2567
  return new v(o, 0);
2558
2568
  })
2559
2569
  );
2560
2570
  }
2571
+ static solutionAsDisplay(t) {
2572
+ return `(${t.map((e) => e.display).join(";")})`;
2573
+ }
2574
+ static solutionAsTex(t) {
2575
+ return `\\left( ${t.map((e) => e.tex).join(" ; ")} \\right)`;
2576
+ }
2561
2577
  add(t, e) {
2562
- if (t instanceof B) {
2578
+ if (t instanceof z) {
2563
2579
  const i = t.equations.length;
2564
2580
  if (i !== this.#t.length)
2565
2581
  throw new Error("The number of equations must be the same");
@@ -2602,13 +2618,13 @@ class B {
2602
2618
  return this.#t;
2603
2619
  }
2604
2620
  set equations(t) {
2605
- this.#t = t, this.#s();
2621
+ this.#t = t, this.#i();
2606
2622
  }
2607
2623
  evaluate(t, e) {
2608
2624
  throw new Error("Method not implemented.");
2609
2625
  }
2610
2626
  hasVariable(t) {
2611
- return this.#i.includes(t);
2627
+ return this.#e.includes(t);
2612
2628
  }
2613
2629
  isEqual(t) {
2614
2630
  return this.equations.every((e, i) => e.isEqual(t.equations[i]));
@@ -2617,7 +2633,7 @@ class B {
2617
2633
  return this.variables.length === this.#t.length;
2618
2634
  }
2619
2635
  get matrix() {
2620
- return this.#r();
2636
+ return this.#s();
2621
2637
  }
2622
2638
  mergeEquations(t, e) {
2623
2639
  const i = this.equations[t.id].clone().multiply(t.factor), s = this.equations[e.id].clone().multiply(e.factor);
@@ -2645,16 +2661,6 @@ class B {
2645
2661
  return this;
2646
2662
  };
2647
2663
  solve() {
2648
- const t = [this.tex], e = this.clone();
2649
- for (; e.variables.length > 1; ) {
2650
- const i = e.variables[e.variables.length - 1], s = new B();
2651
- e.solve_compute_factors(i).slice(0, e.variables.length - 1).forEach((o) => {
2652
- s.equations.push(e.mergeEquations(...o));
2653
- }), e.equations = s.equations, t.push(e.tex), e.reduce(), t.push(e.tex);
2654
- }
2655
- return [];
2656
- }
2657
- solveMatrix = () => {
2658
2664
  const [t, e] = this.matrix, i = t.map((s, r) => [...s, e[r]]);
2659
2665
  for (let s = 0; s < t.length; s++) {
2660
2666
  let r = i[s][s].clone();
@@ -2673,11 +2679,11 @@ class B {
2673
2679
  for (let c = 0; c < i[o].length; c++)
2674
2680
  i[o][c].add(i[s][c].clone().multiply(h));
2675
2681
  if (i[o].slice(0, i[o].length - 1).every((c) => c.isZero()))
2676
- return i[o][i[o].length - 1].isZero() ? [new a().infinite()] : [];
2682
+ return i[o][i[o].length - 1].isZero() ? this.#r() : [];
2677
2683
  }
2678
2684
  }
2679
- return i.map((s) => s[s.length - 1]);
2680
- };
2685
+ return this.#r(i);
2686
+ }
2681
2687
  solve_compute_factors(t) {
2682
2688
  const e = [], i = this.equations.map((s) => s.left.monomByLetter(t).coefficient.value);
2683
2689
  return i.forEach((s, r) => {
@@ -2697,7 +2703,7 @@ class B {
2697
2703
  }), e.sort((s, r) => Math.abs(s[0].factor) + Math.abs(s[1].factor) - (Math.abs(r[0].factor) + Math.abs(r[1].factor)));
2698
2704
  }
2699
2705
  subtract(t, e) {
2700
- if (t instanceof B) {
2706
+ if (t instanceof z) {
2701
2707
  const i = t.equations.length;
2702
2708
  if (i !== this.#t.length)
2703
2709
  throw new Error("The number of equations must be the same");
@@ -2712,14 +2718,14 @@ class B {
2712
2718
  return this;
2713
2719
  }
2714
2720
  get variables() {
2715
- return this.#i;
2721
+ return this.#e;
2716
2722
  }
2717
2723
  set variables(t) {
2718
2724
  const e = typeof t == "string" ? t.split("") : [...t];
2719
- e.sort(), this.#i = e;
2725
+ e.sort(), this.#e = e;
2720
2726
  }
2721
- #s = () => (this.#i = this.#t.reduce((t, e) => [.../* @__PURE__ */ new Set([...t, ...e.variables])], []), this.#i.sort(), this);
2722
- #r = () => {
2727
+ #i = () => (this.#e = this.#t.reduce((t, e) => [.../* @__PURE__ */ new Set([...t, ...e.variables])], []), this.#e.sort(), this);
2728
+ #s = () => {
2723
2729
  const t = [], e = [];
2724
2730
  for (const i of this.#t) {
2725
2731
  const s = [], r = i.clone().reorder();
@@ -2731,6 +2737,16 @@ class B {
2731
2737
  }
2732
2738
  return [t, e];
2733
2739
  };
2740
+ #r(t) {
2741
+ const e = [];
2742
+ return t ? (t.forEach((i, s) => {
2743
+ const r = C.fromFraction(i[i.length - 1]);
2744
+ r.variable = this.variables[s], e.push(r);
2745
+ }), e) : (this.variables.forEach((i) => {
2746
+ const s = C.fromFraction(1 / 0);
2747
+ s.variable = i, e.push(s);
2748
+ }), e);
2749
+ }
2734
2750
  }
2735
2751
  class qt {
2736
2752
  #t;
@@ -2741,7 +2757,7 @@ class qt {
2741
2757
  constructor(t) {
2742
2758
  return this.#t = [], t !== void 0 && this.parse(t), this;
2743
2759
  }
2744
- parse = (t) => (this.#t = new G(I.SET).parse(t).rpn, this);
2760
+ parse = (t) => (this.#t = new G(S.SET).parse(t).rpn, this);
2745
2761
  get tex() {
2746
2762
  const t = [];
2747
2763
  for (const e of this.#t)
@@ -3164,7 +3180,7 @@ function Z(n) {
3164
3180
  }, {}), { numerator: s, denominator: r } = t.divide(e).reduce();
3165
3181
  return s !== 1 && (i[s.toString()] = [new b(s, 1)]), r !== 1 && (i[r.toString()] = [new b(r, -1)]), i;
3166
3182
  }
3167
- class S {
3183
+ class B {
3168
3184
  #t = null;
3169
3185
  #e = !0;
3170
3186
  #i = [];
@@ -3181,7 +3197,7 @@ class S {
3181
3197
  e.forEach((s) => {
3182
3198
  i.push(s.clone());
3183
3199
  }), t.push(i);
3184
- }), new S().fromValues(t);
3200
+ }), new B().fromValues(t);
3185
3201
  }
3186
3202
  get tex() {
3187
3203
  if (this.#i.length === 0)
@@ -3227,7 +3243,7 @@ class S {
3227
3243
  }
3228
3244
  characteristic_polynom(t) {
3229
3245
  return t ??= "k", this.clone().subtract(
3230
- new S(this.dimension.rows).one().multiply(new l(t))
3246
+ new B(this.dimension.rows).one().multiply(new l(t))
3231
3247
  ).determinant();
3232
3248
  }
3233
3249
  cofactor(t, e) {
@@ -3304,7 +3320,7 @@ class S {
3304
3320
  inverse() {
3305
3321
  if (!this.canBeInverted())
3306
3322
  throw new Error("The matrix cannot be inverted.");
3307
- const t = new S().fromDimensions(this.dimension.rows, this.dimension.cols);
3323
+ const t = new B().fromDimensions(this.dimension.rows, this.dimension.cols);
3308
3324
  t.forEach((i, s, r) => {
3309
3325
  t.setValue(s, r, this.cofactor(s, r));
3310
3326
  }), t.transpose();
@@ -3342,10 +3358,10 @@ class S {
3342
3358
  }), s;
3343
3359
  }
3344
3360
  multiply(t) {
3345
- if (t instanceof S) {
3361
+ if (t instanceof B) {
3346
3362
  if (!this.canBeMultiplied(t))
3347
3363
  throw new Error("Cannot multiply a matrix with incompatibles dimensions");
3348
- const e = new S(this.dimension.rows, t.dimension.cols);
3364
+ const e = new B(this.dimension.rows, t.dimension.cols);
3349
3365
  return e.forEach((i, s, r) => {
3350
3366
  const o = this.rows[s], h = t.cols[r], c = new l();
3351
3367
  o.forEach((f, m) => {
@@ -3539,7 +3555,7 @@ class w extends P {
3539
3555
  (s, r) => s.add(r.clone().pow(2)),
3540
3556
  new a(0)
3541
3557
  );
3542
- return new O().from(2, i).reduce();
3558
+ return new T().from(2, i).reduce();
3543
3559
  }
3544
3560
  isEqual(t) {
3545
3561
  return this.x.value === t.x.value && this.y.value === t.y.value;
@@ -3661,36 +3677,40 @@ class g extends P {
3661
3677
  return t === 0 ? this : this.divideByScalar(t);
3662
3678
  };
3663
3679
  }
3664
- var L = /* @__PURE__ */ ((n) => (n.None = "none", n.Parallel = "parallel", n.Perpendicular = "perpendicular", n.Tangent = "tangent", n))(L || {}), Q = /* @__PURE__ */ ((n) => (n.None = "none", n.Parallel = "parallel", n.Perpendicular = "perpendicular", n.Tangent = "tangent", n))(Q || {});
3680
+ var L = /* @__PURE__ */ ((n) => (n.None = "none", n.Parallel = "parallel", n.Perpendicular = "perpendicular", n.Tangent = "tangent", n))(L || {}), H = /* @__PURE__ */ ((n) => (n.None = "none", n.Parallel = "parallel", n.Perpendicular = "perpendicular", n.Tangent = "tangent", n))(H || {});
3665
3681
  function ot(n = 0.5) {
3666
3682
  return Math.random() < n;
3667
3683
  }
3668
- function T(n, t, e) {
3684
+ function O(n, t, e) {
3669
3685
  if (t === void 0)
3670
- return n >= 0 ? T(0, n) : T(n, 0);
3686
+ return n >= 0 ? O(0, n) : O(n, 0);
3671
3687
  if (n === t)
3672
3688
  return n;
3673
3689
  if (e === void 0)
3674
3690
  return Math.floor(Math.random() * (t - n + 1) + n);
3675
3691
  if (Math.abs(t - n) <= e.length)
3676
3692
  throw new Error("The number of excluded values is too high.");
3677
- let i = T(n, t);
3693
+ let i = O(n, t);
3678
3694
  for (; e.includes(i); )
3679
- i = T(n, t);
3695
+ i = O(n, t);
3680
3696
  return i;
3681
3697
  }
3682
3698
  function A(n, t) {
3683
- return t === !1 ? ot() ? T(1, n) : -T(1, n) : T(-n, n);
3699
+ return t === !1 ? ot() ? O(1, n) : -O(1, n) : O(-n, n);
3700
+ }
3701
+ function Bt(n, t) {
3702
+ const e = x.pythagoreanTripletsWithTarget(n).filter((i) => t === !0 || !i.includes(0));
3703
+ return e.length === 0 ? null : W(e);
3684
3704
  }
3685
- function Bt(n) {
3705
+ function St(n) {
3686
3706
  let t = x.primes();
3687
- return n !== void 0 && (t = t.filter((e) => e < n)), tt(t);
3707
+ return n !== void 0 && (t = t.filter((e) => e < n)), W(t);
3688
3708
  }
3689
- function St(n, t) {
3709
+ function It(n, t) {
3690
3710
  return t === void 0 && (t = 1), n.length <= 0 ? Object.values(n) : ht(n).slice(0, t);
3691
3711
  }
3692
- function tt(n) {
3693
- return n.length === 0 ? null : n[T(0, n.length - 1)];
3712
+ function W(n) {
3713
+ return n.length === 0 ? null : n[O(0, n.length - 1)];
3694
3714
  }
3695
3715
  function ht(n) {
3696
3716
  const t = Object.values(n);
@@ -3855,7 +3875,7 @@ class E {
3855
3875
  }
3856
3876
  distanceTo(t) {
3857
3877
  const e = t.x.clone().multiply(this.#e).add(t.y.clone().multiply(this.#i)).add(this.#s).abs(), i = this.normal.normSquare;
3858
- return i.isZero() ? new O(0) : new O().from(2, i.inverse(), e);
3878
+ return i.isZero() ? new T(0) : new T().from(2, i.inverse(), e).reduce();
3859
3879
  }
3860
3880
  fromCoefficient(t, e, i) {
3861
3881
  this.#e = new a(t), this.#i = new a(e), this.#s = new a(i);
@@ -4238,7 +4258,7 @@ class V {
4238
4258
  this.#l(e)
4239
4259
  );
4240
4260
  }
4241
- class U {
4261
+ class j {
4242
4262
  #t = null;
4243
4263
  #e = null;
4244
4264
  #i = 1;
@@ -4247,14 +4267,14 @@ class U {
4247
4267
  t.length > 0 && this.parse(...t);
4248
4268
  }
4249
4269
  parse(...t) {
4250
- return typeof t[0] == "string" ? this.fromString(t[0]) : t[0] instanceof v ? this.fromEquation(t[0]) : t[0] instanceof U ? this.copy(t[0]) : t.length === 2 && t[0] instanceof w && t[1] instanceof w ? this.fromCenterPoint(t[0], t[1]) : t.length >= 2 && t[0] instanceof w && (t[1] instanceof a || typeof t[1] == "number") ? this.fromCenterRadius(
4270
+ return typeof t[0] == "string" ? this.fromString(t[0]) : t[0] instanceof v ? this.fromEquation(t[0]) : t[0] instanceof j ? this.copy(t[0]) : t.length === 2 && t[0] instanceof w && t[1] instanceof w ? this.fromCenterPoint(t[0], t[1]) : t.length >= 2 && t[0] instanceof w && (t[1] instanceof a || typeof t[1] == "number") ? this.fromCenterRadius(
4251
4271
  t[0],
4252
4272
  t[1],
4253
4273
  typeof t[2] == "boolean" ? t[2] : !1
4254
4274
  ) : this;
4255
4275
  }
4256
4276
  clone() {
4257
- return new U().fromCenterRadius(
4277
+ return new j().fromCenterRadius(
4258
4278
  this.center.clone(),
4259
4279
  this.squareRadius.clone(),
4260
4280
  !0
@@ -4336,7 +4356,7 @@ class U {
4336
4356
  */
4337
4357
  lineIntersection(t) {
4338
4358
  if (this.#e === null) return [];
4339
- const e = this.center, i = t.d, s = t.OA, r = i.normSquare, o = s.x.clone().subtract(e.x).multiply(i.x).add(s.y.clone().subtract(e.y).multiply(i.y)).multiply(2), h = s.x.clone().subtract(e.x).pow(2).add(s.y.clone().subtract(e.y).pow(2)).subtract(this.squareRadius), c = $.fromQuadratic(r, o, h);
4359
+ const e = this.center, i = t.d, s = t.OA, r = i.normSquare, o = s.x.clone().subtract(e.x).multiply(i.x).add(s.y.clone().subtract(e.y).multiply(i.y)).multiply(2), h = s.x.clone().subtract(e.x).pow(2).add(s.y.clone().subtract(e.y).pow(2)).subtract(this.squareRadius), c = C.fromQuadratic(r, o, h);
4340
4360
  if (c.length === 0) return [];
4341
4361
  if (c.length === 1) {
4342
4362
  const d = s.add(i.clone().multiplyByScalar(c[0].fraction));
@@ -4351,7 +4371,7 @@ class U {
4351
4371
  ].sort((d, y) => i.x.isZero() ? i.y.isPositive() ? d.y.value - y.y.value : y.y.value - d.y.value : i.x.isPositive() ? d.x.value - y.x.value : y.x.value - d.x.value);
4352
4372
  }
4353
4373
  get radius() {
4354
- return new O().from(2, this.#s ?? 0);
4374
+ return new T().from(2, this.#s ?? 0);
4355
4375
  }
4356
4376
  /**
4357
4377
  * Get the relative position between circle and line. It corresponds to the number of intersection.
@@ -4397,10 +4417,10 @@ class U {
4397
4417
  return [new E(e, i, h), new E(e, i, c)];
4398
4418
  };
4399
4419
  }
4400
- class W {
4401
- static PARALLEL = Q.Parallel;
4420
+ class X {
4421
+ static PARALLEL = H.Parallel;
4402
4422
  // A line is defined as the canonical form
4403
- static PERPENDICULAR = Q.Perpendicular;
4423
+ static PERPENDICULAR = H.Perpendicular;
4404
4424
  // ax + by + c = 0
4405
4425
  #t = new w();
4406
4426
  #e = new g();
@@ -4454,7 +4474,7 @@ class W {
4454
4474
  // Mathematical operations
4455
4475
  hitSegment(t, e) {
4456
4476
  const i = this.intersection(
4457
- new W(t, e)
4477
+ new X(t, e)
4458
4478
  );
4459
4479
  return i.hasIntersection ? i.point.x.value >= Math.min(t.x.value, e.x.value) && i.point.x.value <= Math.max(t.x.value, e.x.value) && i.point.y.value >= Math.min(t.y.value, e.y.value) && i.point.y.value <= Math.max(t.y.value, e.y.value) && i.point.z.value >= Math.min(t.z.value, e.z.value) && i.point.z.value <= Math.max(t.z.value, e.z.value) : !1;
4460
4480
  }
@@ -4604,7 +4624,7 @@ class et {
4604
4624
  }
4605
4625
  }
4606
4626
  var at = /* @__PURE__ */ ((n) => (n[n.INTERIOR = 0] = "INTERIOR", n[n.EXTERIOR = 1] = "EXTERIOR", n[n.SECANT = 2] = "SECANT", n[n.TANGENT_INSIDE = 3] = "TANGENT_INSIDE", n[n.TANGENT_OUTSIDE = 4] = "TANGENT_OUTSIDE", n[n.SUPERPOSED = 5] = "SUPERPOSED", n[n.CONCENTRIC = 6] = "CONCENTRIC", n))(at || {});
4607
- class It {
4627
+ class zt {
4608
4628
  #t = void 0;
4609
4629
  #e = void 0;
4610
4630
  #i = void 0;
@@ -4715,12 +4735,12 @@ function F(n) {
4715
4735
  },
4716
4736
  n
4717
4737
  ), e = new a();
4718
- if (t.negative ? e.numerator = A(t.max, t.zero) : e.numerator = T(t.zero ? 0 : 1, t.max), t.natural)
4738
+ if (t.negative ? e.numerator = A(t.max, t.zero) : e.numerator = O(t.zero ? 0 : 1, t.max), t.natural)
4719
4739
  e.denominator = 1;
4720
4740
  else {
4721
4741
  let i = 0;
4722
4742
  for (; e.isRelative() && i < 10; )
4723
- e.denominator = T(1, t.max), i++;
4743
+ e.denominator = O(1, t.max), i++;
4724
4744
  }
4725
4745
  return t.reduced ? e.reduce() : e;
4726
4746
  }
@@ -4742,14 +4762,14 @@ function ct(n) {
4742
4762
  for (const i of t.letters.split(""))
4743
4763
  e.setLetter(i, 0);
4744
4764
  for (let i = 0; i < t.degree; i++) {
4745
- const s = tt(t.letters.split(""));
4765
+ const s = W(t.letters.split(""));
4746
4766
  e.setLetter(s, e.degree(s).clone().add(1));
4747
4767
  }
4748
4768
  } else
4749
4769
  e.setLetter(t.letters, t.degree);
4750
4770
  return e;
4751
4771
  }
4752
- const H = {
4772
+ const K = {
4753
4773
  letters: "x",
4754
4774
  degree: 2,
4755
4775
  fraction: !1,
@@ -4763,10 +4783,10 @@ const H = {
4763
4783
  };
4764
4784
  function it(n) {
4765
4785
  const t = Object.assign(
4766
- H,
4786
+ K,
4767
4787
  n
4768
4788
  );
4769
- if (t.factorable) return zt(H);
4789
+ if (t.factorable) return Pt(K);
4770
4790
  const e = new l().empty();
4771
4791
  let i;
4772
4792
  const s = t.degree ?? 2;
@@ -4777,16 +4797,16 @@ function it(n) {
4777
4797
  fraction: t.fraction,
4778
4798
  zero: r === s ? !1 : t.allowNullMonom
4779
4799
  }), t.unit && s === r && i.coefficient.one(), e.add(i);
4780
- if (t.positive && e.monomByDegree().coefficient.isNegative() && e.monomByDegree().coefficient.opposite(), t.numberOfMonoms && t.numberOfMonoms > 0 && t.numberOfMonoms < e.length)
4800
+ if (t.positive && e.monomByDegree().coefficient.isNegative() && e.opposite(), t.numberOfMonoms && t.numberOfMonoms > 0 && t.numberOfMonoms < e.length)
4781
4801
  for (; e.length > t.numberOfMonoms; ) {
4782
- const r = T(1, e.length - 1);
4802
+ const r = O(1, e.length - 1);
4783
4803
  e.monoms.splice(r, 1);
4784
4804
  }
4785
4805
  return e.reduce();
4786
4806
  }
4787
- function zt(n) {
4807
+ function Pt(n) {
4788
4808
  const t = Object.assign(
4789
- H,
4809
+ K,
4790
4810
  n
4791
4811
  ), e = { ...t };
4792
4812
  e.degree = 1, e.factorable = !1;
@@ -4795,11 +4815,11 @@ function zt(n) {
4795
4815
  i.push(it(e));
4796
4816
  if (n?.commonConstant !== !1) {
4797
4817
  let r = A(10, !1);
4798
- n?.commonConstant === !0 && (r === 1 || r === -1) && (r *= T(2, 5)), r !== 1 && r !== -1 && i.unshift(new l(r));
4818
+ n?.commonConstant === !0 && (r === 1 || r === -1) && (r *= O(2, 5)), r !== 1 && r !== -1 && i.unshift(new l(r));
4799
4819
  }
4800
4820
  return l.xMultiply(...i);
4801
4821
  }
4802
- function Pt(n) {
4822
+ function Rt(n) {
4803
4823
  const t = Object.assign(
4804
4824
  {
4805
4825
  letters: "x",
@@ -4832,7 +4852,7 @@ function Pt(n) {
4832
4852
  }
4833
4853
  return new v(e, 0);
4834
4854
  }
4835
- function K(n) {
4855
+ function J(n) {
4836
4856
  const t = Object.assign(
4837
4857
  {
4838
4858
  axis: !0,
@@ -4844,7 +4864,7 @@ function K(n) {
4844
4864
  ), e = t.axis === "x", i = t.axis === "y", s = t.fraction ? F({ max: t.max, zero: e }) : new a(A(t.max, e)), r = t.fraction ? F({ max: t.max, zero: i }) : new a(A(t.max, i));
4845
4865
  return Number(t.quadrant) === 1 && (s.abs(), r.abs()), Number(t.quadrant) === 2 && (s.isPositive() && s.opposite(), r.isNegative() && r.opposite()), Number(t.quadrant) === 3 && (s.isPositive() && s.opposite(), r.isPositive() && r.opposite()), Number(t.quadrant) === 4 && (s.isNegative() && s.opposite(), r.isPositive() && r.opposite()), new w(s, r);
4846
4866
  }
4847
- function Rt(n) {
4867
+ function Zt(n) {
4848
4868
  const t = Object.assign(
4849
4869
  {
4850
4870
  center: {
@@ -4854,11 +4874,11 @@ function Rt(n) {
4854
4874
  pointsOnCircle: 8
4855
4875
  },
4856
4876
  n
4857
- ), e = K(t.center);
4877
+ ), e = J(t.center);
4858
4878
  let i, s;
4859
- return t.pointsOnCircle === 8 ? (i = T(1, 3), s = i ** 2 + (i + 1) ** 2) : s = T(1, 20), new U(e, s, !0);
4879
+ return t.pointsOnCircle === 8 ? (i = O(1, 3), s = i ** 2 + (i + 1) ** 2) : s = O(1, 20), new j(e, s, !0);
4860
4880
  }
4861
- function Zt(n) {
4881
+ function Dt(n) {
4862
4882
  const t = Object.assign(
4863
4883
  {
4864
4884
  A: {
@@ -4872,7 +4892,7 @@ function Zt(n) {
4872
4892
  e.x = A(10, t.allow?.vertical ?? !0), e.y = A(10, t.allow?.horizontal ?? !0);
4873
4893
  return t.slope === 1 ? e.x.sign() !== e.y.sign() && e.y.opposite() : t.slope === -1 && e.x.sign() !== e.y.sign() && e.y.opposite(), new E().fromPointAndDirection(new g(t.A.x, t.A.y), e);
4874
4894
  }
4875
- function Dt(n) {
4895
+ function Lt(n) {
4876
4896
  const t = Object.assign(
4877
4897
  {
4878
4898
  A: {
@@ -4888,52 +4908,53 @@ function Dt(n) {
4888
4908
  },
4889
4909
  n
4890
4910
  ), e = new w(t.A.x, t.A.y, t.A.z), i = new g(t.direction.x, t.direction.y, t.direction.z);
4891
- return new W(e, i);
4911
+ return new X(e, i);
4892
4912
  }
4893
- const Lt = {
4894
- equation: (n) => Pt(n),
4913
+ const Vt = {
4914
+ equation: (n) => Rt(n),
4895
4915
  polynom: (n) => it(n),
4896
4916
  monom: (n) => ct(n),
4897
4917
  fraction: (n) => F(n),
4898
- number: (n, t, e) => T(n, t, e),
4918
+ number: (n, t, e) => O(n, t, e),
4899
4919
  numberSym: (n, t) => A(n, t),
4900
- prime: (n) => Bt(n),
4920
+ prime: (n) => St(n),
4921
+ triplet: (n, t) => Bt(n, t),
4901
4922
  bool: (n) => ot(n),
4902
- array: (n, t) => St(n, t),
4903
- item: (n) => tt(n),
4923
+ array: (n, t) => It(n, t),
4924
+ item: (n) => W(n),
4904
4925
  shuffle: (n) => ht(n),
4905
- line: (n) => Zt(n),
4906
- line3: (n) => Dt(n),
4907
- vector: (n) => K(n),
4908
- point: (n) => new w(K(n)),
4909
- circle: (n) => Rt(n)
4910
- }, jt = {
4926
+ line: (n) => Dt(n),
4927
+ line3: (n) => Lt(n),
4928
+ vector: (n) => J(n),
4929
+ point: (n) => new w(J(n)),
4930
+ circle: (n) => Zt(n)
4931
+ }, Ft = {
4911
4932
  Numeric: x,
4912
4933
  Fraction: a,
4913
- Root: O,
4934
+ Root: T,
4914
4935
  Monom: p,
4915
4936
  Polynom: l,
4916
4937
  Equation: v,
4917
- Matrix: S,
4918
- LinearSystem: B,
4938
+ Matrix: B,
4939
+ LinearSystem: z,
4919
4940
  Factor: b,
4920
4941
  PolyFactor: N,
4921
4942
  LogicalSet: qt,
4922
- Random: Lt,
4943
+ Random: Vt,
4923
4944
  Geometry: {
4924
4945
  Vector: g,
4925
4946
  Point: w,
4926
4947
  Line: E,
4927
4948
  Triangle: V,
4928
- Circle: U,
4929
- Line3: W,
4949
+ Circle: j,
4950
+ Line3: X,
4930
4951
  Plane3: et,
4931
- Sphere3: It
4952
+ Sphere3: zt
4932
4953
  },
4933
4954
  NumExp: Ct
4934
4955
  };
4935
4956
  export {
4936
- U as Circle,
4957
+ j as Circle,
4937
4958
  v as Equation,
4938
4959
  R as EquationSolver,
4939
4960
  D as FACTOR_DISPLAY,
@@ -4941,10 +4962,10 @@ export {
4941
4962
  b as Factor,
4942
4963
  a as Fraction,
4943
4964
  E as Line,
4944
- W as Line3,
4945
- B as LinearSystem,
4965
+ X as Line3,
4966
+ z as LinearSystem,
4946
4967
  qt as LogicalSet,
4947
- S as Matrix,
4968
+ B as Matrix,
4948
4969
  p as Monom,
4949
4970
  Ct as NumExp,
4950
4971
  x as Numeric,
@@ -4952,17 +4973,17 @@ export {
4952
4973
  w as Point,
4953
4974
  N as PolyFactor,
4954
4975
  l as Polynom,
4955
- Lt as Random,
4956
- O as Root,
4976
+ Vt as Random,
4977
+ T as Root,
4957
4978
  at as SPHERE3_RELATIVE_POSITION,
4958
- $ as Solution,
4959
- It as Sphere3,
4960
- Vt as TableOfSigns,
4979
+ C as Solution,
4980
+ zt as Sphere3,
4981
+ jt as TableOfSigns,
4961
4982
  V as Triangle,
4962
4983
  g as Vector,
4963
4984
  kt as areVectorsColinears,
4964
4985
  $t as areVectorsEquals,
4965
- jt as default,
4986
+ Ft as default,
4966
4987
  Ut as determinantFromVectors,
4967
4988
  Mt as dotProduct
4968
4989
  };