pimath 0.2.7 → 0.2.8

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
@@ -84,7 +84,7 @@ const b = {
84
84
  greatestPower: xt
85
85
  };
86
86
  var bt = /* @__PURE__ */ ((n) => (n.frac = "frac", n.dfrac = "dfrac", n.tfrac = "tfrac", n))(bt || {});
87
- class h {
87
+ class a {
88
88
  #t = 1;
89
89
  #e = 3;
90
90
  #i = !0;
@@ -99,9 +99,9 @@ class h {
99
99
  * Parse the value to get the numerator and denominator
100
100
  * @param value : number or string to parse to get the fraction
101
101
  */
102
- parse = (t, e) => t === "" ? (this.#s = 0, this.#t = 1, this) : typeof t == "number" && isNaN(t) ? this.invalid() : typeof t == "number" && !isFinite(t) ? (this.infinite(), t < 0 && this.opposite(), this) : typeof t == "string" ? this.fromString(t) : typeof t == "number" && e === void 0 ? this.fromNumber(t) : typeof t == "number" && typeof e == "number" ? this.fromNumbers(t, e) : t instanceof h ? this.copy(t) : this;
102
+ parse = (t, e) => t === "" ? (this.#s = 0, this.#t = 1, this) : typeof t == "number" && isNaN(t) ? this.invalid() : typeof t == "number" && !isFinite(t) ? (this.infinite(), t < 0 && this.opposite(), this) : typeof t == "string" ? this.fromString(t) : typeof t == "number" && e === void 0 ? this.fromNumber(t) : typeof t == "number" && typeof e == "number" ? this.fromNumbers(t, e) : t instanceof a ? this.copy(t) : this;
103
103
  clone = () => {
104
- const t = new h();
104
+ const t = new a();
105
105
  return t.numerator = this.#s, t.denominator = this.#t, t.exact = this.exact, t.#r = this.#r, t.#e = this.#e, t.#n = this.#n, t;
106
106
  };
107
107
  copy(t) {
@@ -121,13 +121,13 @@ class h {
121
121
  }
122
122
  static areEquals = (...t) => t.every((e) => e.isEqual(t[0]));
123
123
  static average = (...t) => {
124
- const e = new h().zero();
124
+ const e = new a().zero();
125
125
  for (const i of t)
126
126
  e.add(i);
127
127
  return e.divide(t.length), e;
128
128
  };
129
129
  static isFraction(t) {
130
- if (t instanceof h || typeof t == "number" && !isNaN(t))
130
+ if (t instanceof a || typeof t == "number" && !isNaN(t))
131
131
  return !0;
132
132
  if (typeof t == "string") {
133
133
  const e = t.split("/");
@@ -136,46 +136,46 @@ class h {
136
136
  return !1;
137
137
  }
138
138
  static max = (...t) => {
139
- let e = new h(t[0]);
139
+ let e = new a(t[0]);
140
140
  for (const i of t) {
141
- const s = new h(i);
141
+ const s = new a(i);
142
142
  s.isGreater(e) && (e = s.clone());
143
143
  }
144
144
  return e;
145
145
  };
146
146
  static min = (...t) => {
147
- let e = new h(t[0]);
147
+ let e = new a(t[0]);
148
148
  for (const i of t) {
149
- const s = new h(i);
149
+ const s = new a(i);
150
150
  s.isLesser(e) && (e = s.clone());
151
151
  }
152
152
  return e;
153
153
  };
154
154
  static sort = (t, e) => {
155
- const s = t.map((r) => r instanceof h ? r : new h(r)).sort((r, o) => r.value - o.value);
155
+ const s = t.map((r) => r instanceof a ? r : new a(r)).sort((r, o) => r.value - o.value);
156
156
  return e && s.reverse(), s;
157
157
  };
158
158
  static toSameDenominateur(...t) {
159
- const e = t.map((s) => new h(s)), i = b.lcm(...e.map((s) => s.denominator));
159
+ const e = t.map((s) => new a(s)), i = b.lcm(...e.map((s) => s.denominator));
160
160
  return e.forEach((s) => s.amplify(i / s.denominator)), e;
161
161
  }
162
162
  static unique = (t) => {
163
163
  const e = {}, i = [];
164
164
  return t.forEach((s) => {
165
- s instanceof h || (s = new h(s)), e[s.clone().reduce().tex] || (i.push(s.clone()), e[s.clone().reduce().tex] = !0);
165
+ s instanceof a || (s = new a(s)), e[s.clone().reduce().tex] || (i.push(s.clone()), e[s.clone().reduce().tex] = !0);
166
166
  }), i;
167
167
  };
168
168
  static xMultiply = (...t) => {
169
- const e = new h();
169
+ const e = new a();
170
170
  return t.forEach((i) => e.multiply(i, !1)), e;
171
171
  };
172
172
  abs = () => (this.#s = Math.abs(this.#s), this.#t = Math.abs(this.#t), this);
173
173
  add = (t) => {
174
- if (t instanceof h) {
174
+ if (t instanceof a) {
175
175
  const e = this.#s, i = this.#t;
176
176
  this.#s = e * t.denominator + t.numerator * i, this.#t = i * t.denominator, this.exact = this.exact && t.exact;
177
177
  } else
178
- return this.add(new h(t));
178
+ return this.add(new a(t));
179
179
  return this.reduce();
180
180
  };
181
181
  amplify = (t) => {
@@ -191,7 +191,7 @@ class h {
191
191
  compare = (t, e) => {
192
192
  e ??= "=";
193
193
  let i;
194
- switch (t instanceof h ? i = t.clone() : i = new h(t), e) {
194
+ switch (t instanceof a ? i = t.clone() : i = new a(t), e) {
195
195
  case ">":
196
196
  return this.value > i.value;
197
197
  case ">=":
@@ -225,7 +225,7 @@ class h {
225
225
  return this.#e = t, this;
226
226
  }
227
227
  divide = (t) => {
228
- const e = new h(t);
228
+ const e = new a(t);
229
229
  if (e.numerator === 0)
230
230
  return this.infinite();
231
231
  const i = this.#s, s = this.#t;
@@ -296,7 +296,7 @@ class h {
296
296
  // Mathematical operations specific to fractions
297
297
  isZero = () => this.#s === 0;
298
298
  multiply = (t, e = !0) => {
299
- const i = new h(t);
299
+ const i = new a(t);
300
300
  return this.#s = this.#s * i.numerator, this.#t = this.#t * i.denominator, this.exact = this.exact && i.exact, e ? this.reduce() : this;
301
301
  };
302
302
  // ------------------------------------------
@@ -309,7 +309,7 @@ class h {
309
309
  one = () => this.fromNumber(1);
310
310
  opposite = () => (this.#s = -this.#s, this);
311
311
  pow = (t) => {
312
- if (t instanceof h)
312
+ if (t instanceof a)
313
313
  return this.pow(t.value);
314
314
  this.reduce(), t < 0 && this.inverse();
315
315
  const e = Math.abs(t), i = Math.pow(this.#s, e), s = Math.pow(this.#t, e), r = Math.floor(i), o = Math.floor(s);
@@ -333,7 +333,7 @@ class h {
333
333
  };
334
334
  sign = () => this.#s * this.#t >= 0 ? 1 : -1;
335
335
  sqrt = () => this.root(2);
336
- subtract = (t) => t instanceof h ? this.add(t.clone().opposite()) : this.add(-t);
336
+ subtract = (t) => t instanceof a ? this.add(t.clone().opposite()) : this.add(-t);
337
337
  get tfrac() {
338
338
  return this.#r = "tfrac", this;
339
339
  }
@@ -373,18 +373,18 @@ function H(n, t) {
373
373
  }
374
374
  return s.push(n.substring(i)), s;
375
375
  }
376
- class T {
376
+ class O {
377
377
  #t;
378
378
  #e;
379
379
  #i;
380
380
  #s = !1;
381
381
  constructor(t) {
382
- return this.#e = 2, this.#t = new h().zero(), this.#i = new h().zero(), t && this.parse(t), this;
382
+ return this.#e = 2, this.#t = new a().zero(), this.#i = new a().zero(), t && this.parse(t), this;
383
383
  }
384
384
  parse(t) {
385
- if (t instanceof T)
385
+ if (t instanceof O)
386
386
  return this.index = t.index, this.radical = t.radical.clone(), this.factor = t.factor.clone(), this;
387
- if (t instanceof h)
387
+ if (t instanceof a)
388
388
  return this.index = 2, this.factor = t.clone(), this.radical.one(), this;
389
389
  if (typeof t == "string") {
390
390
  if (t.includes("sqrt"))
@@ -392,10 +392,10 @@ class T {
392
392
  if (t.includes("root"))
393
393
  return this.#o(t);
394
394
  }
395
- return this.index = 2, this.factor = new h(t), this.radical.one(), this;
395
+ return this.index = 2, this.factor = new a(t), this.radical.one(), this;
396
396
  }
397
397
  clone() {
398
- return new T().from(this.index, this.radical, this.factor);
398
+ return new O().from(this.index, this.radical, this.factor);
399
399
  }
400
400
  get tex() {
401
401
  const t = this.#s && this.factor.isPositive() ? "+" : "", e = t && this.#t.numerator === 1 ? " " : "";
@@ -411,13 +411,13 @@ class T {
411
411
  }
412
412
  add(t) {
413
413
  this.reduce();
414
- const e = new T(t).reduce();
414
+ const e = new O(t).reduce();
415
415
  if (this.index !== e.index || !this.radical.isEqual(e.radical))
416
416
  throw new Error("Add can only be done with two same index and radical");
417
417
  return this.factor.add(e.factor), this;
418
418
  }
419
419
  divide(t) {
420
- return this.multiply(new T(t).inverse());
420
+ return this.multiply(new O(t).inverse());
421
421
  }
422
422
  get factor() {
423
423
  return this.#t;
@@ -426,7 +426,7 @@ class T {
426
426
  this.#t = t;
427
427
  }
428
428
  from(t, e, i) {
429
- return this.index = t, this.radical = new h(e), this.factor = i ? new h(i) : new h().one(), this;
429
+ return this.index = t, this.radical = new a(e), this.factor = i ? new a(i) : new a().one(), this;
430
430
  }
431
431
  /**
432
432
  * convert to root(index)(radical), without factor
@@ -443,7 +443,7 @@ class T {
443
443
  this.#e = t;
444
444
  }
445
445
  get indexAsPow() {
446
- return new h(this.index).inverse();
446
+ return new a(this.index).inverse();
447
447
  }
448
448
  inverse() {
449
449
  return this.factor.inverse(), this.radical.inverse(), this;
@@ -462,7 +462,7 @@ class T {
462
462
  return this.factor.isZero() || this.radical.isZero();
463
463
  }
464
464
  multiply(t) {
465
- const e = new T(t);
465
+ const e = new O(t);
466
466
  if (this.factor.multiply(e.factor), this.index === e.index)
467
467
  return this.radical.multiply(e.radical), this;
468
468
  if (this.radical.isEqual(e.radical)) {
@@ -503,7 +503,7 @@ class T {
503
503
  return this.root(2);
504
504
  }
505
505
  subtract(t) {
506
- const e = new T(t);
506
+ const e = new O(t);
507
507
  return this.add(e.opposite());
508
508
  }
509
509
  get value() {
@@ -536,11 +536,11 @@ class T {
536
536
  const e = /^(.*?)root\((\d+)\)\(?([^)]+)/.exec(t);
537
537
  if (!e) throw new Error(`Invalid root format: "${t}"`);
538
538
  const [, i, s, r] = e;
539
- return this.index = +s, this.radical = new h(r), this.factor = i === "" ? new h().one() : new h(i.trim()), this;
539
+ return this.index = +s, this.radical = new a(r), this.factor = i === "" ? new a().one() : new a(i.trim()), this;
540
540
  }
541
541
  #a(t) {
542
542
  const [e, i] = t.split("sqrt");
543
- return this.index = 2, this.radical = new h(j(i)), this.factor = e === "" ? new h().one() : new h(e), this;
543
+ return this.index = 2, this.radical = new a(j(i)), this.factor = e === "" ? new a().one() : new a(e), this;
544
544
  }
545
545
  }
546
546
  class C {
@@ -552,13 +552,13 @@ class C {
552
552
  #n;
553
553
  #o;
554
554
  constructor() {
555
- this.#o = "x", this.#i = !1, this.#e = null, this.#n = null, this.#s = new h().zero(), this.#r = new T(), this.#t = 1;
555
+ this.#o = "x", this.#i = !1, this.#e = null, this.#n = null, this.#s = new a().zero(), this.#r = new O(), this.#t = 1;
556
556
  }
557
557
  get tex() {
558
558
  if (this.#n) return this.#n;
559
559
  if (this.#r.isZero()) return this.#s.tex;
560
560
  if (this.#s.isZero()) return this.#r.tex;
561
- const [t] = h.toSameDenominateur(this.#s, this.#r.factor), e = this.#r.clone().multiply(t.denominator).reduce(), i = `${t.numerator} ${e.withSign.tex}`;
561
+ const [t] = a.toSameDenominateur(this.#s, this.#r.factor), e = this.#r.clone().multiply(t.denominator).reduce(), i = `${t.numerator} ${e.withSign.tex}`;
562
562
  return t.denominator === 1 ? i : `\\frac{ ${i} }{ ${t.denominator} }`;
563
563
  }
564
564
  set tex(t) {
@@ -568,7 +568,7 @@ class C {
568
568
  if (this.#e) return this.#e;
569
569
  if (this.#r.isZero()) return this.#s.display;
570
570
  if (this.#s.isZero()) return this.#r.display;
571
- const [t] = h.toSameDenominateur(this.#s, this.#r.factor), e = this.#r.clone().multiply(t.denominator).reduce(), i = `${t.numerator}${e.withSign.display}`;
571
+ const [t] = a.toSameDenominateur(this.#s, this.#r.factor), e = this.#r.clone().multiply(t.denominator).reduce(), i = `${t.numerator}${e.withSign.display}`;
572
572
  return t.denominator === 1 ? i : `(${i})/${t.denominator}`;
573
573
  }
574
574
  set display(t) {
@@ -577,21 +577,21 @@ class C {
577
577
  static fromFraction(t) {
578
578
  const e = new C();
579
579
  e.setExact();
580
- const i = new h(t);
581
- return e.display = i.display, e.tex = i.tex, e.fraction = i, e.root = new T(), e;
580
+ const i = new a(t);
581
+ return e.display = i.display, e.tex = i.tex, e.fraction = i, e.root = new O(), e;
582
582
  }
583
583
  static fromQuadratic(t, e, i) {
584
- const [s, r, o] = [t, e, i].map((m) => new h(m)), a = r.clone().pow(2).subtract(s.clone().multiply(o).multiply(4));
585
- if (a.isNegative())
584
+ const [s, r, o] = [t, e, i].map((m) => new a(m)), h = r.clone().pow(2).subtract(s.clone().multiply(o).multiply(4));
585
+ if (h.isNegative())
586
586
  return [];
587
- if (a.isSquare()) {
588
- const m = a.sqrt(), d = r.clone().opposite().subtract(m).divide(s.clone().multiply(2)), v = r.clone().opposite().add(m).divide(s.clone().multiply(2));
587
+ if (h.isSquare()) {
588
+ const m = h.sqrt(), d = r.clone().opposite().subtract(m).divide(s.clone().multiply(2)), v = r.clone().opposite().add(m).divide(s.clone().multiply(2));
589
589
  return m.isZero() ? [C.fromFraction(d)] : [C.fromFraction(d), C.fromFraction(v)];
590
590
  }
591
591
  const c = new C();
592
- c.fraction = r.clone().opposite().divide(s).divide(2), c.root = new T().from(2, a, s.clone().multiply(2).inverse().opposite()), c.setExact(!1);
592
+ 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);
593
593
  const f = new C();
594
- return f.fraction = r.clone().opposite().divide(s).divide(2), f.root = new T().from(2, a, s.clone().multiply(2).inverse()), f.setExact(!1), [c, f];
594
+ 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];
595
595
  }
596
596
  get count() {
597
597
  return this.#t;
@@ -693,15 +693,15 @@ class R {
693
693
  }
694
694
  #s(t, e) {
695
695
  const i = new C();
696
- return i.exact = !1, i.tex = e?.tex ?? null, i.display = e?.display ?? null, i.fraction = new h(t), i.fraction.exact = !1, i.variable = this.#i, i;
696
+ 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;
697
697
  }
698
698
  #r(t) {
699
- return t instanceof h && !t.exact ? this.#s(t.value) : C.fromFraction(t);
699
+ return t instanceof a && !t.exact ? this.#s(t.value) : C.fromFraction(t);
700
700
  }
701
701
  // Solve using bissection algorithm (approximative solution)
702
702
  #n(t) {
703
- const e = [], i = t.degree().value, [s, ...r] = t.getCoefficients(), o = 2 + Math.max(...r.map((f) => f.value / s.value)), a = this.#a(t, o, 100);
704
- return this.#c(a, i).forEach((f) => {
703
+ const e = [], i = t.degree().value, [s, ...r] = t.getCoefficients(), o = 2 + Math.max(...r.map((f) => f.value / s.value)), h = this.#a(t, o, 100);
704
+ return this.#c(h, i).forEach((f) => {
705
705
  const [m, d] = f;
706
706
  if (m === d)
707
707
  e.push(this.#r(m));
@@ -718,21 +718,21 @@ class R {
718
718
  let o;
719
719
  for (; (i - e) / 2 > this.#t; ) {
720
720
  this._++, o = (e + i) / 2;
721
- const a = t.evaluate(o, !0);
722
- if (a === 0)
721
+ const h = t.evaluate(o, !0);
722
+ if (h === 0)
723
723
  return o;
724
- s * a < 0 ? (i = o, r = a) : (e = o, s = a);
724
+ s * h < 0 ? (i = o, r = h) : (e = o, s = h);
725
725
  }
726
726
  return (e + i) / 2;
727
727
  }
728
728
  #a(t, e, i) {
729
729
  const s = [], r = 2 * e / i;
730
730
  for (let o = -e; o <= e; o += r) {
731
- const a = b.numberCorrection(o);
731
+ const h = b.numberCorrection(o);
732
732
  s.push(
733
733
  {
734
- x: a,
735
- fx: t.evaluate(a, !0)
734
+ x: h,
735
+ fx: t.evaluate(h, !0)
736
736
  }
737
737
  );
738
738
  }
@@ -756,10 +756,10 @@ class R {
756
756
  const d = t.monoms.reduce((q, $) => $.degree().value < q.degree().value ? $ : q), v = d.coefficient;
757
757
  d.clone().divide(v), t.divide(d);
758
758
  }
759
- const o = b.dividers(s.value), a = b.dividers(r.value), c = [];
759
+ const o = b.dividers(s.value), h = b.dividers(r.value), c = [];
760
760
  for (const d of o)
761
- for (const v of a) {
762
- const q = new h(v, d);
761
+ for (const v of h) {
762
+ const q = new a(v, d);
763
763
  c.find(($) => $.value === q.value) || (c.push(q.clone()), c.push(q.opposite().clone()));
764
764
  }
765
765
  c.forEach((d) => {
@@ -781,7 +781,7 @@ class R {
781
781
  };
782
782
  }
783
783
  #h() {
784
- 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), a = s.clone().divide(e), c = r.clone().divide(e), f = a.clone().subtract(o.clone().pow(2).divide(3)), m = c.clone().subtract(o.clone().multiply(a).divide(3)).add(o.clone().pow(3).multiply(2).divide(27)), d = m.clone().opposite(), v = f.clone().opposite().pow(3).divide(27), q = d.clone().pow(2).subtract(v.clone().multiply(4)).opposite();
784
+ 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(), v = f.clone().opposite().pow(3).divide(27), q = d.clone().pow(2).subtract(v.clone().multiply(4)).opposite();
785
785
  if (q.isNegative()) {
786
786
  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));
787
787
  return [this.#r(I)];
@@ -814,13 +814,13 @@ class R {
814
814
  if (r.isNegative())
815
815
  return [];
816
816
  if (r.isSquare()) {
817
- const o = r.sqrt(), a = i.clone().opposite().subtract(o).divide(e.clone().multiply(2)), c = i.clone().opposite().add(o).divide(e.clone().multiply(2));
817
+ const o = r.sqrt(), h = i.clone().opposite().subtract(o).divide(e.clone().multiply(2)), c = i.clone().opposite().add(o).divide(e.clone().multiply(2));
818
818
  if (o.isZero()) {
819
- const f = this.#r(a);
819
+ const f = this.#r(h);
820
820
  return f.count = 2, [f];
821
821
  }
822
822
  return [
823
- this.#r(a),
823
+ this.#r(h),
824
824
  this.#r(c)
825
825
  ].sort((f, m) => f.value - m.value);
826
826
  }
@@ -828,9 +828,9 @@ class R {
828
828
  }
829
829
  #d(t, e, i) {
830
830
  const s = t.clone().multiply(2), r = new C();
831
- r.fraction = e.clone().opposite().divide(s.clone()), r.root.radical = i.clone(), r.root.factor = new h().one().divide(s.clone()), r.exact = !0;
831
+ 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;
832
832
  const o = new C();
833
- return o.fraction = e.clone().opposite().divide(s.clone()), o.root.radical = i.clone(), o.root.factor = new h().one().divide(s.clone()).opposite(), o.exact = !0, [r, o].sort((a, c) => a.value - c.value);
833
+ 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);
834
834
  }
835
835
  }
836
836
  const tt = {
@@ -846,7 +846,7 @@ function Et(n, t) {
846
846
  const i = new RegExp(`^(${e.join("|")})\\(`), s = Object.keys(tt);
847
847
  s.sort((d, v) => v.length - d.length);
848
848
  const r = new RegExp(`^(${s.join("|")})`), o = /^(\d+(\.\d+)?)/;
849
- let a = "", c, f, m;
849
+ let h = "", c, f, m;
850
850
  for (e.forEach((d) => {
851
851
  if (n.includes(d)) {
852
852
  const v = new RegExp(`${d}([0-9.]+)`, "g");
@@ -885,9 +885,9 @@ function Et(n, t) {
885
885
  }
886
886
  if (m === void 0 || f === void 0)
887
887
  throw new Error("The token is undefined");
888
- a += Nt(c, f), a += m;
888
+ h += Nt(c, f), h += m;
889
889
  }
890
- return a;
890
+ return h;
891
891
  }
892
892
  function Nt(n, t) {
893
893
  return n === void 0 || n === u.OPERATION || t === u.OPERATION || n === u.LEFT_PARENTHESIS || n === u.FUNCTION || n === u.FUNCTION_ARGUMENT || t === u.RIGHT_PARENTHESIS || t === u.FUNCTION_ARGUMENT ? "" : "*";
@@ -898,7 +898,7 @@ const At = {
898
898
  "/": { precedence: 3, associative: "left", type: u.OPERATION },
899
899
  "+": { precedence: 2, associative: "left", type: u.OPERATION },
900
900
  "-": { precedence: 2, associative: "left", type: u.OPERATION }
901
- }, Tt = {
901
+ }, Ot = {
902
902
  "^": { precedence: 4, associative: "right", type: u.OPERATION },
903
903
  "*": { precedence: 3, associative: "left", type: u.OPERATION },
904
904
  "/": { precedence: 3, associative: "left", type: u.OPERATION },
@@ -911,7 +911,7 @@ const At = {
911
911
  sqrt: { precedence: 4, associative: "right", type: u.FUNCTION },
912
912
  nthrt: { precedence: 4, associative: "right", type: u.FUNCTION },
913
913
  ",": { precedence: 2, associative: "left", type: u.FUNCTION_ARGUMENT }
914
- }, Ot = {
914
+ }, Tt = {
915
915
  "^": { precedence: 4, associative: "right", type: u.OPERATION },
916
916
  "*": { precedence: 3, associative: "left", type: u.OPERATION },
917
917
  "/": { precedence: 3, associative: "left", type: u.OPERATION },
@@ -948,7 +948,7 @@ class W {
948
948
  return this.#e.map((t) => t.token);
949
949
  }
950
950
  tokenConfigInitialization() {
951
- return this.#t === S.SET ? (this.#i = Ct, this.#r = !1) : this.#t === S.NUMERIC ? (this.#i = Ot, this.#r = !0) : this.#t === S.EXPRESSION ? (this.#i = Tt, this.#r = !0) : (this.#i = At, this.#r = !0), this.#s = Object.keys(this.#i).sort((t, e) => e.length - t.length), this.#i;
951
+ return this.#t === S.SET ? (this.#i = Ct, this.#r = !1) : this.#t === S.NUMERIC ? (this.#i = Tt, this.#r = !0) : this.#t === S.EXPRESSION ? (this.#i = Ot, this.#r = !0) : (this.#i = At, this.#r = !0), this.#s = Object.keys(this.#i).sort((t, e) => e.length - t.length), this.#i;
952
952
  }
953
953
  /**
954
954
  * Get the next token to analyse.
@@ -996,7 +996,7 @@ class W {
996
996
  */
997
997
  parse(t, e) {
998
998
  const i = [], s = [];
999
- let r = "", o = 0, a;
999
+ let r = "", o = 0, h;
1000
1000
  (e ?? this.#r) && (t = Et(t, this.#i));
1001
1001
  let c = 50, f;
1002
1002
  for (; o < t.length; ) {
@@ -1004,14 +1004,14 @@ class W {
1004
1004
  console.log("SECURITY LEVEL 1 EXIT");
1005
1005
  break;
1006
1006
  }
1007
- switch ([r, o, a] = this.NextToken(t, o), a) {
1007
+ switch ([r, o, h] = this.NextToken(t, o), h) {
1008
1008
  case u.MONOM:
1009
1009
  case u.COEFFICIENT:
1010
1010
  case u.VARIABLE:
1011
1011
  case u.CONSTANT:
1012
1012
  i.push({
1013
1013
  token: r,
1014
- tokenType: a
1014
+ tokenType: h
1015
1015
  });
1016
1016
  break;
1017
1017
  case u.OPERATION:
@@ -1029,7 +1029,7 @@ class W {
1029
1029
  m = s[s.length - 1];
1030
1030
  }
1031
1031
  }
1032
- s.push({ token: r, tokenType: a });
1032
+ s.push({ token: r, tokenType: h });
1033
1033
  break;
1034
1034
  case u.FUNCTION_ARGUMENT:
1035
1035
  for (f = 50; s[s.length - 1].token !== "(" && s.length > 0; ) {
@@ -1037,11 +1037,11 @@ class W {
1037
1037
  console.log("SECURITY LEVEL 2 FUNCTION ARGUMENT EXIT");
1038
1038
  break;
1039
1039
  }
1040
- i.push(s.pop() ?? { token: r, tokenType: a });
1040
+ i.push(s.pop() ?? { token: r, tokenType: h });
1041
1041
  }
1042
1042
  break;
1043
1043
  case u.LEFT_PARENTHESIS:
1044
- s.push({ token: r, tokenType: a }), t[o] === "-" && i.push({ token: "0", tokenType: u.COEFFICIENT });
1044
+ s.push({ token: r, tokenType: h }), t[o] === "-" && i.push({ token: "0", tokenType: u.COEFFICIENT });
1045
1045
  break;
1046
1046
  case u.RIGHT_PARENTHESIS:
1047
1047
  for (f = 50; s[s.length - 1].token !== "(" && s.length > 1; ) {
@@ -1049,12 +1049,12 @@ class W {
1049
1049
  console.log("SECURITY LEVEL 2 CLOSING PARENTHESIS EXIT");
1050
1050
  break;
1051
1051
  }
1052
- i.push(s.pop() ?? { token: r, tokenType: a });
1052
+ i.push(s.pop() ?? { token: r, tokenType: h });
1053
1053
  }
1054
1054
  s.pop();
1055
1055
  break;
1056
1056
  case u.FUNCTION:
1057
- s.push({ token: r, tokenType: a });
1057
+ s.push({ token: r, tokenType: h });
1058
1058
  break;
1059
1059
  default:
1060
1060
  throw new Error(`Token type ${r} is not handled`);
@@ -1170,7 +1170,7 @@ class p {
1170
1170
  #t;
1171
1171
  #e;
1172
1172
  constructor(t) {
1173
- return this.#t = new h().zero(), this.#e = {}, t !== void 0 && this.parse(t), this;
1173
+ return this.#t = new a().zero(), this.#e = {}, t !== void 0 && this.parse(t), this;
1174
1174
  }
1175
1175
  // -----------------------------------------
1176
1176
  /**
@@ -1178,7 +1178,7 @@ class p {
1178
1178
  * @param inputStr
1179
1179
  */
1180
1180
  parse(t) {
1181
- return this.#t = new h(), this.#e = {}, t instanceof p ? (this.#t = t.#t.clone(), this.#i(t), this) : t instanceof h ? (this.#t = t.clone(), this) : typeof t == "number" ? (this.#t = new h(t), this) : (isNaN(Number(t)) ? this.#a(t) : this.#t = new h(Number(t)), this);
1181
+ return this.#t = new a(), this.#e = {}, t instanceof p ? (this.#t = t.#t.clone(), this.#i(t), this) : t instanceof a ? (this.#t = t.clone(), this) : typeof t == "number" ? (this.#t = new a(t), this) : (isNaN(Number(t)) ? this.#a(t) : this.#t = new a(Number(t)), this);
1182
1182
  }
1183
1183
  /**
1184
1184
  * Clone the current Monom.
@@ -1208,12 +1208,12 @@ class p {
1208
1208
  if (r.containsRationalPower())
1209
1209
  return new p().zero();
1210
1210
  const e = new p(), i = b.gcd(...t.map((r) => r.coefficient.numerator)), s = b.lcm(...t.map((r) => r.coefficient.denominator));
1211
- e.coefficient = new h(i, s).reduce();
1211
+ e.coefficient = new a(i, s).reduce();
1212
1212
  for (const r of t) {
1213
1213
  for (const o in e.literal)
1214
1214
  o in r.literal || e.removeVariable(o);
1215
1215
  for (const o in r.literal)
1216
- !e.hasVariable(o) && r.literal[o].isStrictlyPositive() ? e.literal[o] = r.literal[o].clone() : e.literal[o] = new h(Math.min(r.literal[o].value, e.literal[o].value));
1216
+ !e.hasVariable(o) && r.literal[o].isStrictlyPositive() ? e.literal[o] = r.literal[o].clone() : e.literal[o] = new a(Math.min(r.literal[o].value, e.literal[o].value));
1217
1217
  }
1218
1218
  return e;
1219
1219
  };
@@ -1253,14 +1253,14 @@ class p {
1253
1253
  * @param {Fraction | number | string} F
1254
1254
  */
1255
1255
  set coefficient(t) {
1256
- this.#t = new h(t);
1256
+ this.#t = new a(t);
1257
1257
  }
1258
1258
  containsRationalPower = () => Object.values(this.#e).some((t) => t.isRational());
1259
1259
  /**
1260
1260
  * Get the degree of a monom. If no setLetter is given, the result will be the global degree.
1261
1261
  * @param letter (string) Letter to get to degree (power)
1262
1262
  */
1263
- degree = (t) => this.variables.length === 0 ? new h().zero() : t === void 0 ? Object.values(this.#e).reduce((e, i) => e.clone().add(i)) : this.hasVariable(t) ? this.#e[t].clone() : new h().zero();
1263
+ degree = (t) => this.variables.length === 0 ? new a().zero() : t === void 0 ? Object.values(this.#e).reduce((e, i) => e.clone().add(i)) : this.hasVariable(t) ? this.#e[t].clone() : new a().zero();
1264
1264
  /**
1265
1265
  * Derivative the monom
1266
1266
  * @param letter
@@ -1268,7 +1268,7 @@ class p {
1268
1268
  derivative = (t = "x") => {
1269
1269
  if (this.hasVariable(t)) {
1270
1270
  const e = this.#e[t].clone(), i = this.clone();
1271
- return i.#e[t].subtract(1), i.#t.multiply(new h(e.clone())), i;
1271
+ return i.#e[t].subtract(1), i.#t.multiply(new a(e.clone())), i;
1272
1272
  } else
1273
1273
  return new p().zero();
1274
1274
  };
@@ -1301,17 +1301,17 @@ class p {
1301
1301
  for (const s of t)
1302
1302
  for (const r of e) {
1303
1303
  const o = new p();
1304
- o.coefficient = new h(s), o.literal = r, i.push(o);
1304
+ o.coefficient = new a(s), o.literal = r, i.push(o);
1305
1305
  }
1306
1306
  else if (t.length === 0)
1307
1307
  for (const s of e) {
1308
1308
  const r = new p();
1309
- r.coefficient = new h().one(), r.literal = s, i.push(r);
1309
+ r.coefficient = new a().one(), r.literal = s, i.push(r);
1310
1310
  }
1311
1311
  else
1312
1312
  for (const s of t) {
1313
1313
  const r = new p();
1314
- r.coefficient = new h(s), i.push(r);
1314
+ r.coefficient = new a(s), i.push(r);
1315
1315
  }
1316
1316
  return i.length === 0 ? [new p().one()] : i;
1317
1317
  }
@@ -1322,27 +1322,27 @@ class p {
1322
1322
  */
1323
1323
  evaluate = (t, e) => {
1324
1324
  if (e === !0) {
1325
- if (t instanceof h)
1325
+ if (t instanceof a)
1326
1326
  return this.#s(t.value);
1327
1327
  if (typeof t == "number")
1328
1328
  return this.#s(t);
1329
1329
  if (typeof t == "object") {
1330
1330
  const s = {};
1331
1331
  for (const r in t)
1332
- s[r] = new h(t[r]).value;
1332
+ s[r] = new a(t[r]).value;
1333
1333
  return this.#s(s);
1334
1334
  }
1335
1335
  }
1336
1336
  const i = this.coefficient.clone();
1337
- if (typeof t == "number" || t instanceof h) {
1337
+ if (typeof t == "number" || t instanceof a) {
1338
1338
  const s = {};
1339
- return s[this.variables[0]] = new h(t), this.evaluate(s);
1339
+ return s[this.variables[0]] = new a(t), this.evaluate(s);
1340
1340
  }
1341
1341
  if (typeof t == "object") {
1342
1342
  if (this.variables.length === 0)
1343
1343
  return this.coefficient;
1344
1344
  for (const s in this.#e) {
1345
- const r = new h(t[s]);
1345
+ const r = new a(t[s]);
1346
1346
  i.multiply(r.pow(this.#e[s]));
1347
1347
  }
1348
1348
  }
@@ -1429,9 +1429,9 @@ class p {
1429
1429
  */
1430
1430
  set literalStr(t) {
1431
1431
  for (const e of [...t.matchAll(/([a-z])\^([+-]?[0-9]+)/g)])
1432
- e[1] in this.#e || (this.#e[e[1]] = new h().zero()), this.#e[e[1]].add(+e[2]);
1432
+ e[1] in this.#e || (this.#e[e[1]] = new a().zero()), this.#e[e[1]].add(+e[2]);
1433
1433
  for (const e of [...t.matchAll(/([a-z](?!\^))/g)])
1434
- e[1] in this.#e || (this.#e[e[1]] = new h().zero()), this.#e[e[1]].add(1);
1434
+ e[1] in this.#e || (this.#e[e[1]] = new a().zero()), this.#e[e[1]].add(1);
1435
1435
  }
1436
1436
  /**
1437
1437
  * Multiple multiple monoms to the current monom
@@ -1449,7 +1449,7 @@ class p {
1449
1449
  /**
1450
1450
  * Create a one value monom
1451
1451
  */
1452
- one = () => (this.#t = new h().one(), this.#e = {}, this);
1452
+ one = () => (this.#t = new a().one(), this.#e = {}, this);
1453
1453
  /**
1454
1454
  * Get the opposite
1455
1455
  * Returns a monom.
@@ -1471,7 +1471,7 @@ class p {
1471
1471
  primitive = (t = "x") => {
1472
1472
  const e = this.clone();
1473
1473
  let i;
1474
- return e.hasVariable(t) ? (i = e.degree(t).clone().add(1), e.coefficient = e.coefficient.clone().divide(i), e.setLetter(t, i)) : (e.coefficient.isZero() && (e.coefficient = new h().one()), e.setLetter(t, 1)), e;
1474
+ return e.hasVariable(t) ? (i = e.degree(t).clone().add(1), e.coefficient = e.coefficient.clone().divide(i), e.setLetter(t, i)) : (e.coefficient.isZero() && (e.coefficient = new a().one()), e.setLetter(t, 1)), e;
1475
1475
  };
1476
1476
  reduce = () => {
1477
1477
  this.coefficient.reduce();
@@ -1494,7 +1494,7 @@ class p {
1494
1494
  * @param letter (string) Letter to change
1495
1495
  * @param pow (number) Power of the setLetter (must be positive integer.
1496
1496
  */
1497
- setLetter = (t, e) => e instanceof h ? this.hasVariable(t) && e.isZero() ? (this.removeVariable(t), this) : (this.#e[t] = e.clone(), this) : this.setLetter(t, new h(e));
1497
+ setLetter = (t, e) => e instanceof a ? this.hasVariable(t) && e.isZero() ? (this.removeVariable(t), this) : (this.#e[t] = e.clone(), this) : this.setLetter(t, new a(e));
1498
1498
  /**
1499
1499
  * Return the square root of a monom
1500
1500
  */
@@ -1535,7 +1535,7 @@ class p {
1535
1535
  /**
1536
1536
  * Create a zero value monom
1537
1537
  */
1538
- zero = () => (this.#t = new h().zero(), this.#e = {}, this);
1538
+ zero = () => (this.#t = new a().zero(), this.#e = {}, this);
1539
1539
  #i(t) {
1540
1540
  for (const e in t.literal)
1541
1541
  this.#e[e] = t.literal[e].clone();
@@ -1546,16 +1546,16 @@ class p {
1546
1546
  const i = {}, s = this.variables[0];
1547
1547
  return i[s] = t, this.#s(i);
1548
1548
  }
1549
- if (t instanceof h) {
1549
+ if (t instanceof a) {
1550
1550
  const i = {};
1551
- return i[this.variables[0]] = new h(t).value, this.#s(i);
1551
+ return i[this.variables[0]] = new a(t).value, this.#s(i);
1552
1552
  }
1553
1553
  if (typeof t == "object") {
1554
1554
  if (this.variables.length === 0)
1555
1555
  return this.coefficient.value;
1556
1556
  for (const i in this.#e) {
1557
1557
  const s = t[i];
1558
- s instanceof h ? e *= s.value ** this.#e[i].value : e *= s ** this.#e[i].value;
1558
+ s instanceof a ? e *= s.value ** this.#e[i].value : e *= s ** this.#e[i].value;
1559
1559
  }
1560
1560
  }
1561
1561
  return e;
@@ -1573,20 +1573,20 @@ class p {
1573
1573
  for (let s = 0; s <= this.literal[e].value; s++)
1574
1574
  if (t.length === 0) {
1575
1575
  const r = {};
1576
- r[e] = new h(s), i.push(r);
1576
+ r[e] = new a(s), i.push(r);
1577
1577
  } else
1578
1578
  for (const r of t) {
1579
1579
  const o = {};
1580
- for (const a in r)
1581
- o[a] = r[a];
1582
- o[e] = new h(s), i.push(o);
1580
+ for (const h in r)
1581
+ o[h] = r[h];
1582
+ o[e] = new a(s), i.push(o);
1583
1583
  }
1584
1584
  return i;
1585
1585
  }
1586
1586
  #o = (t, e) => {
1587
- let i, s, r, o, a;
1587
+ let i, s, r, o, h;
1588
1588
  if (e.tokenType === u.COEFFICIENT)
1589
- t.push(new p(new h(e.token)));
1589
+ t.push(new p(new a(e.token)));
1590
1590
  else if (e.tokenType === u.VARIABLE) {
1591
1591
  const c = new p().one();
1592
1592
  c.setLetter(e.token, 1), t.push(c.clone());
@@ -1602,7 +1602,7 @@ class p {
1602
1602
  s = t.pop() ?? new p().one(), i = t.pop() ?? new p().one(), t.push(i.divide(s));
1603
1603
  break;
1604
1604
  case "^": {
1605
- a = t.pop()?.coefficient ?? new h().one(), r = t.pop() ?? new p().one(), o = r.variables[0], o && r.setLetter(o, a), t.push(r);
1605
+ h = t.pop()?.coefficient ?? new a().one(), r = t.pop() ?? new p().one(), o = r.variables[0], o && r.setLetter(o, h), t.push(r);
1606
1606
  break;
1607
1607
  }
1608
1608
  }
@@ -1613,7 +1613,7 @@ class p {
1613
1613
  return this.zero(), this;
1614
1614
  if (i.length === 1) {
1615
1615
  const r = i[0];
1616
- return this.one(), r.tokenType === u.COEFFICIENT ? this.coefficient = new h(r.token) : r.tokenType === u.VARIABLE && this.setLetter(r.token, 1), this;
1616
+ return this.one(), r.tokenType === u.COEFFICIENT ? this.coefficient = new a(r.token) : r.tokenType === u.VARIABLE && this.setLetter(r.token, 1), this;
1617
1617
  } else
1618
1618
  for (const r of i)
1619
1619
  this.#o(s, r);
@@ -1649,7 +1649,7 @@ class l {
1649
1649
  parse(t, ...e) {
1650
1650
  if (this.#i = [], this.#e = [], this.#h(), typeof t == "string")
1651
1651
  return this.#m(t, ...e);
1652
- if ((typeof t == "number" || t instanceof h || t instanceof p) && e.length === 0)
1652
+ if ((typeof t == "number" || t instanceof a || t instanceof p) && e.length === 0)
1653
1653
  this.#i.push(new p(t));
1654
1654
  else if (t instanceof p && e.length > 0)
1655
1655
  this.#i.push(new p(t)), e.forEach((i) => {
@@ -1689,19 +1689,19 @@ class l {
1689
1689
  }
1690
1690
  commonMonom() {
1691
1691
  const t = new p().one(), e = this.gcdNumerator(), i = this.gcdDenominator();
1692
- t.coefficient = new h(e, i);
1692
+ t.coefficient = new a(e, i);
1693
1693
  for (const s of this.variables) {
1694
1694
  t.setLetter(s, this.degree(s));
1695
1695
  for (const r of this.#i)
1696
- if (t.setLetter(s, h.min(r.degree(s), t.degree(s))), t.degree(s).isZero())
1696
+ if (t.setLetter(s, a.min(r.degree(s), t.degree(s))), t.degree(s).isZero())
1697
1697
  break;
1698
1698
  }
1699
1699
  return t;
1700
1700
  }
1701
1701
  degree(t) {
1702
- let e = new h().zero();
1702
+ let e = new a().zero();
1703
1703
  for (const i of this.#i)
1704
- e = h.max(i.degree(t).value, e);
1704
+ e = a.max(i.degree(t).value, e);
1705
1705
  return e;
1706
1706
  }
1707
1707
  derivative(t) {
@@ -1711,7 +1711,7 @@ class l {
1711
1711
  return e.reduce();
1712
1712
  }
1713
1713
  divide(t) {
1714
- if (t instanceof h)
1714
+ if (t instanceof a)
1715
1715
  return this.#o(t);
1716
1716
  if (typeof t == "number" && Number.isSafeInteger(t))
1717
1717
  return this.#a(t);
@@ -1747,15 +1747,15 @@ class l {
1747
1747
  if (!this.degree(e).isNatural() || !t.degree(e).isNatural())
1748
1748
  throw new Error("Euclidean division requires integer degrees");
1749
1749
  const r = t.monomByDegree(void 0, e), o = t.degree(e);
1750
- let a, c = this.degree(e).value - o.value + 1;
1751
- for (; s.degree(e).isGeq(o) && c > 0 && (c--, a = s.monomByDegree(void 0, e).clone().divide(r), !(!a.isZero() && (i.add(a), s.subtract(t.clone().multiply(a)).reduce(), a.degree(e).isZero()))); )
1750
+ let h, c = this.degree(e).value - o.value + 1;
1751
+ for (; s.degree(e).isGeq(o) && c > 0 && (c--, h = s.monomByDegree(void 0, e).clone().divide(r), !(!h.isZero() && (i.add(h), s.subtract(t.clone().multiply(h)).reduce(), h.degree(e).isZero()))); )
1752
1752
  ;
1753
1753
  return i.reduce(), s.reduce(), { quotient: i, reminder: s };
1754
1754
  }
1755
1755
  evaluate(t, e) {
1756
1756
  if (e)
1757
1757
  return this.#c(t);
1758
- const i = new h().zero();
1758
+ const i = new a().zero();
1759
1759
  return this.#i.forEach((s) => {
1760
1760
  i.add(s.evaluate(t, e));
1761
1761
  }), i;
@@ -1776,9 +1776,9 @@ class l {
1776
1776
  return this.#e.length === 0 ? this.#e = [this.clone()] : this.#e.push(e), this.#e;
1777
1777
  if (s.forEach((o) => {
1778
1778
  if (o.exact && o.root.isZero())
1779
- for (let a = 0; a < o.count; a++)
1779
+ for (let h = 0; h < o.count; h++)
1780
1780
  o.fraction.isRational() ? this.#e.push(new l().fromCoefficients(o.fraction.denominator, -o.fraction.numerator)) : this.#e.push(new l().fromCoefficients(1, o.fraction.clone().opposite()));
1781
- }), this.#e.map((o) => o.degree().value).reduce((o, a) => o + a, 0) < this.degree().value) {
1781
+ }), this.#e.map((o) => o.degree().value).reduce((o, h) => o + h, 0) < this.degree().value) {
1782
1782
  const o = l.xMultiply(...this.#e);
1783
1783
  this.#e.push(this.clone().divide(o));
1784
1784
  }
@@ -1792,7 +1792,7 @@ class l {
1792
1792
  const e = this.#t ?? "x";
1793
1793
  return t.reverse().forEach((i, s) => {
1794
1794
  const r = new p();
1795
- r.coefficient = new h(i), r.setLetter(e, s), this.#i.push(r);
1795
+ r.coefficient = new a(i), r.setLetter(e, s), this.#i.push(r);
1796
1796
  }), this.#h(), this.reorder();
1797
1797
  }
1798
1798
  gcdDenominator() {
@@ -1804,7 +1804,7 @@ class l {
1804
1804
  getCoefficients() {
1805
1805
  if (!this.degree().isNatural())
1806
1806
  throw new Error("getCoefficients() requires a polynomial with integer degrees");
1807
- const t = this.clone().reorder(), e = this.degree().value + 1, i = Array.from({ length: e }, () => new h(0));
1807
+ const t = this.clone().reorder(), e = this.degree().value + 1, i = Array.from({ length: e }, () => new a(0));
1808
1808
  return t.monoms.forEach((s) => {
1809
1809
  const r = e - s.degree().value - 1;
1810
1810
  i[r] = s.coefficient.clone();
@@ -1831,7 +1831,7 @@ class l {
1831
1831
  }
1832
1832
  integrate(t, e, i = "x") {
1833
1833
  const s = this.primitive(i), r = {}, o = {};
1834
- return r[i] = new h(t), o[i] = new h(e), s.evaluate(o).subtract(s.evaluate(r));
1834
+ return r[i] = new a(t), o[i] = new a(e), s.evaluate(o).subtract(s.evaluate(r));
1835
1835
  }
1836
1836
  inverse() {
1837
1837
  }
@@ -1884,13 +1884,13 @@ class l {
1884
1884
  return this.#i.length;
1885
1885
  }
1886
1886
  limitTo(t, e) {
1887
- const i = new h(t);
1887
+ const i = new a(t);
1888
1888
  if (i.isFinite()) {
1889
1889
  const f = e ?? this.variables[0] ?? "x";
1890
1890
  return this.evaluate({ [f]: i });
1891
1891
  }
1892
1892
  const s = this.monomByDegree(void 0, e), r = s.coefficient.sign(), o = s.degree(e);
1893
- return o.isZero() ? s.coefficient.clone() : o.isStrictlyPositive() ? i.isPositive() ? r === 1 ? new h().infinite() : new h().infinite().opposite() : (o.value % 2 === 0 ? r : -r) === 1 ? new h().infinite() : new h().infinite().opposite() : new h().zero();
1893
+ return o.isZero() ? s.coefficient.clone() : o.isStrictlyPositive() ? i.isPositive() ? r === 1 ? new a().infinite() : new a().infinite().opposite() : (o.value % 2 === 0 ? r : -r) === 1 ? new a().infinite() : new a().infinite().opposite() : new a().zero();
1894
1894
  }
1895
1895
  monomByDegree(t, e) {
1896
1896
  if (t === void 0)
@@ -1927,7 +1927,7 @@ class l {
1927
1927
  multiply(t) {
1928
1928
  if (t instanceof l)
1929
1929
  return this.#p(t);
1930
- if (t instanceof h)
1930
+ if (t instanceof a)
1931
1931
  return this.#u(t);
1932
1932
  if (t instanceof p)
1933
1933
  return this.#d(t);
@@ -1935,7 +1935,7 @@ class l {
1935
1935
  return this.#f(t);
1936
1936
  if (typeof t == "string")
1937
1937
  try {
1938
- const e = new h(t);
1938
+ const e = new a(t);
1939
1939
  return this.#u(e);
1940
1940
  } catch {
1941
1941
  throw new Error("Cannot multiply by this value.");
@@ -1979,9 +1979,9 @@ class l {
1979
1979
  reorder(t = "x", e = !1) {
1980
1980
  const i = this.variables.filter((s) => s !== t);
1981
1981
  return this.#i.sort(function(s, r) {
1982
- const o = s.degree(t).value, a = r.degree(t).value;
1983
- if (o !== a)
1984
- return e ? o - a : a - o;
1982
+ const o = s.degree(t).value, h = r.degree(t).value;
1983
+ if (o !== h)
1984
+ return e ? o - h : h - o;
1985
1985
  if (i.length > 0)
1986
1986
  for (const c of i) {
1987
1987
  const f = s.degree(c).value, m = r.degree(c).value;
@@ -2084,7 +2084,7 @@ class l {
2084
2084
  return this.#h(), this;
2085
2085
  }
2086
2086
  #a(t) {
2087
- const e = new h(t);
2087
+ const e = new a(t);
2088
2088
  for (const i of this.#i)
2089
2089
  i.coefficient.divide(e);
2090
2090
  return this.#h(), this;
@@ -2100,8 +2100,8 @@ class l {
2100
2100
  for (const o of this.#i) {
2101
2101
  if (o.coefficient.value === 0)
2102
2102
  continue;
2103
- let a;
2104
- s ? a = o.plotFunction : a = t === "tex" ? o.tex : o.display, r += `${o.coefficient.sign() === 1 && (r !== "" || e === !0) ? "+" : ""}${a}`;
2103
+ let h;
2104
+ s ? h = o.plotFunction : h = t === "tex" ? o.tex : o.display, r += `${o.coefficient.sign() === 1 && (r !== "" || e === !0) ? "+" : ""}${h}`;
2105
2105
  }
2106
2106
  return i === !0 && this.length > 1 && (t === "tex" ? r = `\\left( ${r} \\right)` : r = `(${r})`), r === "" && (r = "0"), r;
2107
2107
  }
@@ -2114,7 +2114,7 @@ class l {
2114
2114
  return this.reduce();
2115
2115
  }
2116
2116
  #f(t) {
2117
- return this.#u(new h(t));
2117
+ return this.#u(new a(t));
2118
2118
  }
2119
2119
  #d(t) {
2120
2120
  for (const e of this.#i)
@@ -2138,15 +2138,15 @@ class l {
2138
2138
  return this.#w(t);
2139
2139
  } else if (/^[a-z]+$/.test(t)) {
2140
2140
  this.empty();
2141
- const i = e.map((s) => new h(s));
2141
+ const i = e.map((s) => new a(s));
2142
2142
  if (t.length > 1) {
2143
2143
  const s = t.split("");
2144
2144
  if (i.length > s.length + 1)
2145
2145
  throw new Error(`Too many values: ${s.length} letters but ${i.length} values provided`);
2146
2146
  let r = 0;
2147
2147
  for (const o of i) {
2148
- const a = new p();
2149
- a.coefficient = o.clone(), a.literalStr = s[r] ?? "", this.add(a), r++;
2148
+ const h = new p();
2149
+ h.coefficient = o.clone(), h.literalStr = s[r] ?? "", this.add(h), r++;
2150
2150
  }
2151
2151
  } else {
2152
2152
  let s = i.length - 1;
@@ -2279,7 +2279,7 @@ class x {
2279
2279
  * Get the degree of the equation
2280
2280
  * @param letter
2281
2281
  */
2282
- degree = (t) => h.max(this.#t.degree(t), this.#e.degree(t));
2282
+ degree = (t) => a.max(this.#t.degree(t), this.#e.degree(t));
2283
2283
  /**
2284
2284
  * divide an equation by a given value (transformed as a fraction)
2285
2285
  *
@@ -2295,7 +2295,7 @@ class x {
2295
2295
  * @returns {Equation}
2296
2296
  */
2297
2297
  divide = (t) => {
2298
- const e = new h(t);
2298
+ const e = new a(t);
2299
2299
  return e.isZero() ? this : this.multiply(e.inverse());
2300
2300
  };
2301
2301
  /**
@@ -2369,7 +2369,7 @@ class x {
2369
2369
  * @param value
2370
2370
  */
2371
2371
  multiply = (t) => {
2372
- const e = new h(t);
2372
+ const e = new a(t);
2373
2373
  return this.#t.multiply(e), this.#e.multiply(e), this.#i !== "=" && e.sign() === -1 && this.#n(), this;
2374
2374
  };
2375
2375
  get numberOfVars() {
@@ -2457,7 +2457,7 @@ class y {
2457
2457
  #i;
2458
2458
  #s = !1;
2459
2459
  constructor(t, e) {
2460
- return t instanceof y ? (this.#e = t.polynom.clone(), this.#i = t.power.clone(), e !== void 0 && this.#i.multiply(new h(e))) : t !== void 0 ? (this.#e = new l(t), this.#i = new h(e ?? 1)) : (this.#e = new l(), this.#i = new h(1)), this.#t = 1, this;
2460
+ return t instanceof y ? (this.#e = t.polynom.clone(), this.#i = t.power.clone(), e !== void 0 && this.#i.multiply(new a(e))) : t !== void 0 ? (this.#e = new l(t), this.#i = new a(e ?? 1)) : (this.#e = new l(), this.#i = new a(1)), this.#t = 1, this;
2461
2461
  }
2462
2462
  parse() {
2463
2463
  throw new Error("Method not implemented.");
@@ -2508,7 +2508,7 @@ class y {
2508
2508
  return e ? this.polynom.evaluate(t, !0) ** this.power.value : this.polynom.evaluate(t).pow(this.power);
2509
2509
  }
2510
2510
  fromPolynom(t) {
2511
- return this.#e = new l(t), this.#i = new h(1), this;
2511
+ return this.#e = new l(t), this.#i = new a(1), this;
2512
2512
  }
2513
2513
  hasVariable(t) {
2514
2514
  return this.polynom.hasVariable(t);
@@ -2530,10 +2530,13 @@ class y {
2530
2530
  return this.polynom.isZero();
2531
2531
  }
2532
2532
  multiply(t) {
2533
+ const e = new y(t);
2534
+ if (this.polynom.monoms.length === 1 && this.power.isOne() && e.polynom.monoms.length === 1 && this.power.isOne())
2535
+ return this.polynom.multiply(e.polynom), this;
2533
2536
  if (t instanceof y && this.isSameAs(t))
2534
2537
  return this.power.add(t.power), this;
2535
- const e = new l(t);
2536
- if (this.isSameAs(e))
2538
+ const i = new l(t);
2539
+ if (this.isSameAs(i))
2537
2540
  return this.power.add(1), this;
2538
2541
  throw new Error("The two factors must be the same");
2539
2542
  }
@@ -2556,7 +2559,7 @@ class y {
2556
2559
  return this.#i;
2557
2560
  }
2558
2561
  set power(t) {
2559
- this.#i = new h(t);
2562
+ this.#i = new a(t);
2560
2563
  }
2561
2564
  primitive() {
2562
2565
  throw new Error("Method not implemented.");
@@ -2601,14 +2604,14 @@ class y {
2601
2604
  const i = e ? 1 : -1, s = [], r = /\(([^)]+)\)(?:\^(-?[0-9]+(?:\/[0-9]+)?|\(-?[0-9]+(?:\/[0-9]+)?\)))?|([^(]+)/g;
2602
2605
  for (const o of t.matchAll(r))
2603
2606
  if (o[1] !== void 0) {
2604
- const a = (o[2] ?? "1").replace(/[()]/g, "");
2607
+ const h = (o[2] ?? "1").replace(/[()]/g, "");
2605
2608
  s.push(
2606
2609
  new y(
2607
2610
  new l(o[1]),
2608
- new h(a).multiply(i)
2611
+ new a(h).multiply(i)
2609
2612
  )
2610
2613
  );
2611
- } else o[3]?.trim() && s.push(new y(new l(o[3].trim()), new h(i)));
2614
+ } else o[3]?.trim() && s.push(new y(new l(o[3].trim()), new a(i)));
2612
2615
  return s;
2613
2616
  }
2614
2617
  }
@@ -2680,11 +2683,11 @@ class P {
2680
2683
  }
2681
2684
  o.push(i.join("&"));
2682
2685
  }
2683
- let a = 0;
2684
- return e !== void 0 && e.length > 0 && (a = e[0].length), `\\left\\{\\begin{array}{${"r".repeat(r.length)}cl ${"|l".repeat(a)}}${o.join("\\\\ ")}\\end{array}\\right.`;
2686
+ let h = 0;
2687
+ return e !== void 0 && e.length > 0 && (h = e[0].length), `\\left\\{\\begin{array}{${"r".repeat(r.length)}cl ${"|l".repeat(h)}}${o.join("\\\\ ")}\\end{array}\\right.`;
2685
2688
  };
2686
2689
  degree(t) {
2687
- return h.max(...this.#t.map((e) => e.degree(t)));
2690
+ return a.max(...this.#t.map((e) => e.degree(t)));
2688
2691
  }
2689
2692
  // ------------------------------------------
2690
2693
  get equations() {
@@ -2738,9 +2741,9 @@ class P {
2738
2741
  for (let s = 0; s < t.length; s++) {
2739
2742
  let r = i[s][s].clone();
2740
2743
  if (r.isZero()) {
2741
- const o = i.find((a, c) => c > s && !a[s].isZero());
2744
+ const o = i.find((h, c) => c > s && !h[s].isZero());
2742
2745
  if (o)
2743
- i[s].forEach((a, c) => a.add(o[c])), r = i[s][s].clone();
2746
+ i[s].forEach((h, c) => h.add(o[c])), r = i[s][s].clone();
2744
2747
  else
2745
2748
  throw new Error("Unsolvable...");
2746
2749
  }
@@ -2748,9 +2751,9 @@ class P {
2748
2751
  for (let o = 0; o < t.length; o++) {
2749
2752
  if (o === s)
2750
2753
  continue;
2751
- const a = i[o][s].clone().opposite();
2754
+ const h = i[o][s].clone().opposite();
2752
2755
  for (let c = 0; c < i[o].length; c++)
2753
- i[o][c].add(i[s][c].clone().multiply(a));
2756
+ i[o][c].add(i[s][c].clone().multiply(h));
2754
2757
  if (i[o].slice(0, i[o].length - 1).every((c) => c.isZero()))
2755
2758
  return i[o][i[o].length - 1].isZero() ? this.#r() : [];
2756
2759
  }
@@ -2761,15 +2764,15 @@ class P {
2761
2764
  const e = [], i = this.equations.map((s) => s.left.monomByLetter(t).coefficient.value);
2762
2765
  return i.forEach((s, r) => {
2763
2766
  for (let o = r + 1; o < i.length; o++) {
2764
- const a = b.lcm(s, i[o]), c = s < 0 ? -1 : 1;
2767
+ const h = b.lcm(s, i[o]), c = s < 0 ? -1 : 1;
2765
2768
  e.push([
2766
2769
  {
2767
2770
  id: r,
2768
- factor: c * a / s
2771
+ factor: c * h / s
2769
2772
  },
2770
2773
  {
2771
2774
  id: o,
2772
- factor: -c * a / i[o]
2775
+ factor: -c * h / i[o]
2773
2776
  }
2774
2777
  ]);
2775
2778
  }
@@ -2803,8 +2806,8 @@ class P {
2803
2806
  for (const i of this.#t) {
2804
2807
  const s = [], r = i.clone().reorder();
2805
2808
  for (const o of this.variables) {
2806
- const a = r.left.monomByLetter(o);
2807
- s.push(a.coefficient);
2809
+ const h = r.left.monomByLetter(o);
2810
+ s.push(h.coefficient);
2808
2811
  }
2809
2812
  e.push(r.right.monoms[0].coefficient), t.push(s);
2810
2813
  }
@@ -2942,26 +2945,26 @@ class $t {
2942
2945
  switch (r.token) {
2943
2946
  case "&":
2944
2947
  if (i.length >= 2) {
2945
- const o = i.pop(), a = i.pop();
2946
- a && o && i.push(new Set([...a].filter((c) => o.has(c))));
2948
+ const o = i.pop(), h = i.pop();
2949
+ h && o && i.push(new Set([...h].filter((c) => o.has(c))));
2947
2950
  }
2948
2951
  break;
2949
2952
  case "|":
2950
2953
  if (i.length >= 2) {
2951
- const o = i.pop(), a = i.pop();
2952
- a && o && i.push(/* @__PURE__ */ new Set([...a, ...o]));
2954
+ const o = i.pop(), h = i.pop();
2955
+ h && o && i.push(/* @__PURE__ */ new Set([...h, ...o]));
2953
2956
  }
2954
2957
  break;
2955
2958
  case "-":
2956
2959
  if (i.length >= 2) {
2957
- const o = i.pop(), a = i.pop();
2958
- a && o && i.push(new Set([...a].filter((c) => !o.has(c))));
2960
+ const o = i.pop(), h = i.pop();
2961
+ h && o && i.push(new Set([...h].filter((c) => !o.has(c))));
2959
2962
  }
2960
2963
  break;
2961
2964
  case "!":
2962
2965
  if (i.length >= 1) {
2963
2966
  const o = i.pop();
2964
- o && i.push(new Set([...s].filter((a) => !o.has(a))));
2967
+ o && i.push(new Set([...s].filter((h) => !o.has(h))));
2965
2968
  }
2966
2969
  break;
2967
2970
  }
@@ -2999,16 +3002,16 @@ class N {
2999
3002
  return `(${i})/(${s})`;
3000
3003
  }
3001
3004
  static #i(t, e) {
3002
- const i = Z(t), s = Z(e), o = Object.keys(i).filter((a) => Object.hasOwn(s, a)).map((a) => {
3003
- const c = i[a].reduce((m, d) => m.add(d.power), new h("0")), f = s[a].reduce((m, d) => m.add(d.power), new h("0"));
3004
- return new y(a, h.min(c, f));
3005
+ const i = Z(t), s = Z(e), o = Object.keys(i).filter((h) => Object.hasOwn(s, h)).map((h) => {
3006
+ const c = i[h].reduce((m, d) => m.add(d.power), new a("0")), f = s[h].reduce((m, d) => m.add(d.power), new a("0"));
3007
+ return new y(h, a.min(c, f));
3005
3008
  });
3006
3009
  return new N(...o);
3007
3010
  }
3008
3011
  static #s(t, e) {
3009
- const i = Z(t), s = Z(e), o = [.../* @__PURE__ */ new Set([...Object.keys(i), ...Object.keys(s)])].map((a) => {
3010
- const c = Object.hasOwn(i, a) ? i[a].reduce((m, d) => m.add(d.power), new h("0")) : new h(0), f = Object.hasOwn(s, a) ? s[a].reduce((m, d) => m.add(d.power), new h("0")) : new h(0);
3011
- return new y(a, h.max(c, f));
3012
+ const i = Z(t), s = Z(e), o = [.../* @__PURE__ */ new Set([...Object.keys(i), ...Object.keys(s)])].map((h) => {
3013
+ const c = Object.hasOwn(i, h) ? i[h].reduce((m, d) => m.add(d.power), new a("0")) : new a(0), f = Object.hasOwn(s, h) ? s[h].reduce((m, d) => m.add(d.power), new a("0")) : new a(0);
3014
+ return new y(h, a.max(c, f));
3012
3015
  });
3013
3016
  return new N(...o);
3014
3017
  }
@@ -3031,21 +3034,21 @@ class N {
3031
3034
  return t.shift(), t.forEach((i) => e = N.#s(e, i)), e;
3032
3035
  }
3033
3036
  add(...t) {
3034
- const e = [this.numerator, ...t.map((a) => a.numerator)], i = [this.denominator, ...t.map((a) => a.denominator)];
3037
+ const e = [this.numerator, ...t.map((h) => h.numerator)], i = [this.denominator, ...t.map((h) => h.denominator)];
3035
3038
  let s;
3036
- if (i.some((a) => a.factors.length > 0)) {
3037
- const a = N.lcm(...i);
3039
+ if (i.some((h) => h.factors.length > 0)) {
3040
+ const h = N.lcm(...i);
3038
3041
  e.forEach((c, f) => {
3039
- c.multiply(a.clone().divide(i[f]));
3040
- }), s = a;
3042
+ c.multiply(h.clone().divide(i[f]));
3043
+ }), s = h;
3041
3044
  }
3042
3045
  const r = N.gcd(...e), o = new l(0).add(
3043
- ...e.map((a) => a.divide(r).reduce().develop().factors[0].polynom)
3046
+ ...e.map((h) => h.divide(r).reduce().develop().factors[0].polynom)
3044
3047
  ).reduce();
3045
3048
  return this.#e = [
3046
3049
  ...r.factors,
3047
3050
  new y(o)
3048
- ], s && this.divide(s), this.#e = this.#e.filter((a) => !a.power.isZero()), this;
3051
+ ], s && this.divide(s), this.#e = this.#e.filter((h) => !h.power.isZero()), this;
3049
3052
  }
3050
3053
  get asPower() {
3051
3054
  return this.#t = D.POWER, this;
@@ -3054,7 +3057,7 @@ class N {
3054
3057
  return this.#t = D.ROOT, this;
3055
3058
  }
3056
3059
  degree(t) {
3057
- return this.#e.reduce((e, i) => e.add(i.degree(t)), new h("0"));
3060
+ return this.#e.reduce((e, i) => e.add(i.degree(t)), new a("0"));
3058
3061
  }
3059
3062
  get denominator() {
3060
3063
  return new N(
@@ -3085,15 +3088,15 @@ class N {
3085
3088
  return this.#e = this.#e.concat(t.clone().factors.map((e) => e.inverse())), this;
3086
3089
  }
3087
3090
  evaluate(t, e) {
3088
- return e ? this.#e.reduce((i, s) => i * s.evaluate(t, e), 1) : this.#e.reduce((i, s) => i.multiply(s.evaluate(t)), new h("1"));
3091
+ return e ? this.#e.reduce((i, s) => i * s.evaluate(t, e), 1) : this.#e.reduce((i, s) => i.multiply(s.evaluate(t)), new a("1"));
3089
3092
  }
3090
3093
  factorize(t) {
3091
3094
  const e = [];
3092
3095
  this.#e.forEach((o) => {
3093
- const a = o.polynom.factorize(t);
3094
- if (a.length > 1) {
3096
+ const h = o.polynom.factorize(t);
3097
+ if (h.length > 1) {
3095
3098
  const c = o.power.clone();
3096
- e.push(...a.map((f) => new y(f, c)));
3099
+ e.push(...h.map((f) => new y(f, c)));
3097
3100
  } else
3098
3101
  e.push(o.clone());
3099
3102
  });
@@ -3178,10 +3181,14 @@ class N {
3178
3181
  }
3179
3182
  reduce() {
3180
3183
  const t = Z(this);
3181
- return this.#e = Object.values(t).map((e) => {
3182
- const i = e[0].polynom, s = e.reduce((r, o) => r.add(o.power), new h("0"));
3183
- return new y(i, s.reduce());
3184
- }).filter((e) => !e.power.isZero()), this;
3184
+ this.#e = Object.values(t).map((r) => {
3185
+ const o = r[0].polynom, h = r.reduce((c, f) => c.add(f.power), new a("0"));
3186
+ return new y(o, h.reduce());
3187
+ }).filter((r) => !r.power.isZero());
3188
+ const e = new y(1), i = new y(1), s = this.#e.filter((r) => r.polynom.monoms.length === 1 && r.power.isRelative());
3189
+ return s.length > 0 && (s.forEach((r) => {
3190
+ r.power.isPositive() ? e.multiply(new y(r.polynom.clone().pow(r.power.value))) : i.multiply(new y(r.polynom.clone().pow(-r.power.value)));
3191
+ }), this.#e = this.#e.filter((r) => !(r.polynom.monoms.length === 1 && r.power.isRelative())), i.polynom.isOne() || this.#e.push(i.inverse()), e.polynom.isOne() || this.#e.push(e)), this;
3185
3192
  }
3186
3193
  root(t) {
3187
3194
  return this.#e = this.#e.map((e) => e.root(t)), this;
@@ -3193,15 +3200,23 @@ class N {
3193
3200
  * 3. power of polyfactor
3194
3201
  */
3195
3202
  sort(t) {
3196
- return this.#e.sort((e, i) => {
3203
+ return this.#e.forEach((e) => e.polynom.reorder(t)), this.#e.sort((e, i) => {
3197
3204
  const s = e.power.value, r = i.power.value;
3198
3205
  if (s * r < 0)
3199
3206
  return -s;
3200
- const o = e.polynom.monoms.length, a = i.polynom.monoms.length;
3201
- if (o !== a)
3202
- return o - a;
3207
+ const o = e.polynom.monoms.length, h = i.polynom.monoms.length;
3208
+ if (o !== h)
3209
+ return o - h;
3203
3210
  const c = e.polynom.degree(t).value, f = i.polynom.degree(t).value;
3204
- return c !== f ? c - f : s !== r ? s - r : e.degree().isLeq(i.degree()) ? -1 : 1;
3211
+ if (c !== f)
3212
+ return c - f;
3213
+ if (s !== r)
3214
+ return s - r;
3215
+ if (e.polynom.degree(t).isOne() && i.polynom.degree(t).isOne()) {
3216
+ const m = e.polynom.monoms[1].coefficient.clone().opposite().divide(e.polynom.monoms[0].coefficient).value, d = i.polynom.monoms[1].coefficient.clone().opposite().divide(i.polynom.monoms[0].coefficient).value;
3217
+ return m - d;
3218
+ }
3219
+ return e.degree().isLeq(i.degree()) ? -1 : 1;
3205
3220
  }), this;
3206
3221
  }
3207
3222
  sqrt() {
@@ -3214,18 +3229,18 @@ class N {
3214
3229
  const t = this.getZeroes(), e = t.map((r) => r.value), i = this.factorize().factors.map((r) => ({ factor: new y(r), ...r.tableOfSigns() }));
3215
3230
  return i.forEach((r) => {
3216
3231
  const o = new Array(2 * t.length + 1).fill("");
3217
- let a = r.signs.shift(), c = r.roots.shift();
3232
+ let h = r.signs.shift(), c = r.roots.shift();
3218
3233
  const f = o.map((m, d) => {
3219
3234
  if (d % 2 === 0)
3220
- return a;
3235
+ return h;
3221
3236
  if (c?.value !== e[(d - 1) / 2])
3222
3237
  return "t";
3223
3238
  const v = r.signs.shift();
3224
- return a = r.signs.shift(), c = r.roots.shift(), v;
3239
+ return h = r.signs.shift(), c = r.roots.shift(), v;
3225
3240
  });
3226
3241
  r.roots = t, r.signs = f;
3227
- }), { signs: i.map((r) => [...r.signs]).reduce((r, o) => r.length === 0 ? o : (o.forEach((a, c) => {
3228
- switch (a) {
3242
+ }), { signs: i.map((r) => [...r.signs]).reduce((r, o) => r.length === 0 ? o : (o.forEach((h, c) => {
3243
+ switch (h) {
3229
3244
  case "d":
3230
3245
  r[c] = "d";
3231
3246
  break;
@@ -3253,11 +3268,13 @@ class N {
3253
3268
  }
3254
3269
  }
3255
3270
  function Z(n) {
3256
- const t = new h().one(), e = new h().one(), i = n.factors.reduce((o, a) => {
3257
- if (a.polynom.degree().isZero())
3258
- return a.power.isPositive() ? t.multiply(a.polynom.monoms[0].coefficient) : e.multiply(a.polynom.monoms[0].coefficient), o;
3259
- const c = a.polynom.display;
3260
- return Object.hasOwn(o, c) ? o[c].push(a) : o[c] = [a], o;
3271
+ const t = new a().one(), e = new a().one(), i = n.factors.reduce((o, h) => {
3272
+ if (h.polynom.degree().isZero() && h.power.isRelative()) {
3273
+ const f = h.polynom.monoms[0].coefficient.pow(h.power.clone().abs());
3274
+ return h.power.isPositive() ? t.multiply(f) : e.multiply(f), o;
3275
+ }
3276
+ const c = h.polynom.display;
3277
+ return Object.hasOwn(o, c) ? o[c].push(h) : o[c] = [h], o;
3261
3278
  }, {}), { numerator: s, denominator: r } = t.divide(e).reduce();
3262
3279
  return s !== 1 && (i[s.toString()] = [new y(s, 1)]), r !== 1 && (i[r.toString()] = [new y(r, -1)]), i;
3263
3280
  }
@@ -3433,8 +3450,8 @@ class B {
3433
3450
  const { rows: e, cols: i } = this.dimension, s = Array.from({ length: e }, () => Array.from({ length: i }, () => {
3434
3451
  }));
3435
3452
  return this.#i.forEach((r, o) => {
3436
- r.forEach((a, c) => {
3437
- s[o][c] = t(a, o, c);
3453
+ r.forEach((h, c) => {
3454
+ s[o][c] = t(h, o, c);
3438
3455
  });
3439
3456
  }), s;
3440
3457
  }
@@ -3444,9 +3461,9 @@ class B {
3444
3461
  throw new Error("Cannot multiply a matrix with incompatibles dimensions");
3445
3462
  const e = new B(this.dimension.rows, t.dimension.cols);
3446
3463
  return e.forEach((i, s, r) => {
3447
- const o = this.rows[s], a = t.cols[r], c = new l();
3464
+ const o = this.rows[s], h = t.cols[r], c = new l();
3448
3465
  o.forEach((f, m) => {
3449
- c.add(f.clone().multiply(a[m]));
3466
+ c.add(f.clone().multiply(h[m]));
3450
3467
  }), e.setValue(s, r, c);
3451
3468
  }), this.#i = e.values, this;
3452
3469
  }
@@ -3518,9 +3535,9 @@ function Mt(n, t) {
3518
3535
  );
3519
3536
  }
3520
3537
  function Bt(n, t) {
3521
- return n.dimension !== t.dimension ? new h().invalid() : n.array.reduce(
3538
+ return n.dimension !== t.dimension ? new a().invalid() : n.array.reduce(
3522
3539
  (e, i, s) => e.add(i.clone().multiply(t.array[s])),
3523
- new h(0)
3540
+ new a(0)
3524
3541
  );
3525
3542
  }
3526
3543
  function Ft(...n) {
@@ -3540,7 +3557,7 @@ class z {
3540
3557
  #t = [];
3541
3558
  #e;
3542
3559
  constructor(...t) {
3543
- this.#t = t.map((e) => new h(e));
3560
+ this.#t = t.map((e) => new a(e));
3544
3561
  }
3545
3562
  copy() {
3546
3563
  return this.#t.map((t) => t.clone());
@@ -3557,7 +3574,7 @@ class z {
3557
3574
  fromString(t) {
3558
3575
  t.startsWith("(") && (t = t.substring(1)), t.endsWith(")") && (t = t.substring(0, t.length - 1));
3559
3576
  const e = t.split(/[,;\s]/g).filter((i) => i.trim() !== "");
3560
- return e.length < 2 ? this : (this.#t = e.map((i) => new h(i)), this);
3577
+ return e.length < 2 ? this : (this.#t = e.map((i) => new a(i)), this);
3561
3578
  }
3562
3579
  get onChange() {
3563
3580
  return this.#e;
@@ -3572,20 +3589,20 @@ class z {
3572
3589
  this.#t = this.#t.slice(0, t);
3573
3590
  else if (t > this.dimension)
3574
3591
  for (let e = this.dimension; e < t; e++)
3575
- this.#t.push(new h(0));
3592
+ this.#t.push(new a(0));
3576
3593
  return this;
3577
3594
  }
3578
3595
  get x() {
3579
3596
  return this.#t[0];
3580
3597
  }
3581
3598
  set x(t) {
3582
- this.#t[0] = new h(t), this.#e?.();
3599
+ this.#t[0] = new a(t), this.#e?.();
3583
3600
  }
3584
3601
  get y() {
3585
3602
  return this.#t[1];
3586
3603
  }
3587
3604
  set y(t) {
3588
- this.#t[1] = new h(t), this.#e?.();
3605
+ this.#t[1] = new a(t), this.#e?.();
3589
3606
  }
3590
3607
  get z() {
3591
3608
  if (this.dimension < 3)
@@ -3595,7 +3612,7 @@ class z {
3595
3612
  set z(t) {
3596
3613
  if (this.dimension < 3)
3597
3614
  throw new Error("Vector is not 3D");
3598
- this.#t[2] = new h(t), this.#e?.();
3615
+ this.#t[2] = new a(t), this.#e?.();
3599
3616
  }
3600
3617
  zero = () => (this.#t.forEach((t) => t.zero()), this.#e?.(), this);
3601
3618
  }
@@ -3613,7 +3630,7 @@ class w extends z {
3613
3630
  if (t.length > 1) {
3614
3631
  if (t.some((i) => i instanceof w))
3615
3632
  throw new Error("Creating a point with multiple argument requires an input fraction");
3616
- const e = t.map((i) => new h(i));
3633
+ const e = t.map((i) => new a(i));
3617
3634
  if (e.some((i) => i.isNaN()))
3618
3635
  throw new Error("The given values are not a valid point string (a,b): ");
3619
3636
  this.array = e;
@@ -3634,9 +3651,9 @@ class w extends z {
3634
3651
  throw new Error("The two points must have the same dimensions.");
3635
3652
  const i = this.array.map((s, r) => t.array[r].clone().subtract(s)).reduce(
3636
3653
  (s, r) => s.add(r.clone().pow(2)),
3637
- new h(0)
3654
+ new a(0)
3638
3655
  );
3639
- return new T().from(2, i).reduce();
3656
+ return new O().from(2, i).reduce();
3640
3657
  }
3641
3658
  isEqual(t) {
3642
3659
  return this.x.value === t.x.value && this.y.value === t.y.value;
@@ -3676,7 +3693,7 @@ class g extends z {
3676
3693
  return this.array = i.array.map((s, r) => s.clone().subtract(e.array[r])), this;
3677
3694
  }
3678
3695
  }
3679
- return this.array = t.map((e) => new h(e)), this;
3696
+ return this.array = t.map((e) => new a(e)), this;
3680
3697
  }
3681
3698
  clone() {
3682
3699
  return new g(...this.copy());
@@ -3709,7 +3726,7 @@ class g extends z {
3709
3726
  }
3710
3727
  // ------------------------------------------
3711
3728
  // Creation / parsing functions
3712
- divideByScalar = (t) => this.multiplyByScalar(new h(t).inverse());
3729
+ divideByScalar = (t) => this.multiplyByScalar(new a(t).inverse());
3713
3730
  dot = (t) => Bt(this, t);
3714
3731
  fromString(t) {
3715
3732
  return t.startsWith("((") && t.endsWith("))") ? super.fromString(t.slice(1, -1)) : super.fromString(t);
@@ -3728,14 +3745,14 @@ class g extends z {
3728
3745
  return this.array.every((t) => t.isZero());
3729
3746
  }
3730
3747
  multiplyByScalar = (t) => {
3731
- const e = new h(t);
3748
+ const e = new a(t);
3732
3749
  return this.array.forEach((i) => i.multiply(e)), this;
3733
3750
  };
3734
3751
  get norm() {
3735
3752
  return Math.sqrt(this.normSquare.value);
3736
3753
  }
3737
3754
  get normSquare() {
3738
- return this.array.reduce((t, e) => t.add(e.clone().pow(2)), new h(0));
3755
+ return this.array.reduce((t, e) => t.add(e.clone().pow(2)), new a(0));
3739
3756
  }
3740
3757
  normal = () => {
3741
3758
  if (this.dimension >= 3)
@@ -3747,7 +3764,7 @@ class g extends z {
3747
3764
  opposite = () => (this.array.forEach((t) => t.opposite()), this);
3748
3765
  simplify = () => {
3749
3766
  const t = b.lcm(...this.array.map((i) => i.denominator)), e = b.gcd(...this.array.map((i) => i.numerator));
3750
- return this.multiplyByScalar(new h(t, e)), this.x.isNegative() && this.opposite(), this;
3767
+ return this.multiplyByScalar(new a(t, e)), this.x.isNegative() && this.opposite(), this;
3751
3768
  };
3752
3769
  subtract = (t) => this.add(t.clone().opposite());
3753
3770
  translate(...t) {
@@ -3762,22 +3779,22 @@ var V = /* @__PURE__ */ ((n) => (n.None = "none", n.Parallel = "parallel", n.Per
3762
3779
  function ot(n = 0.5) {
3763
3780
  return Math.random() < n;
3764
3781
  }
3765
- function O(n, t, e) {
3782
+ function T(n, t, e) {
3766
3783
  if (t === void 0)
3767
- return n >= 0 ? O(0, n) : O(n, 0);
3784
+ return n >= 0 ? T(0, n) : T(n, 0);
3768
3785
  if (n === t)
3769
3786
  return n;
3770
3787
  if (e === void 0)
3771
3788
  return Math.floor(Math.random() * (t - n + 1) + n);
3772
3789
  if (Math.abs(t - n) <= e.length)
3773
3790
  throw new Error("The number of excluded values is too high.");
3774
- let i = O(n, t);
3791
+ let i = T(n, t);
3775
3792
  for (; e.includes(i); )
3776
- i = O(n, t);
3793
+ i = T(n, t);
3777
3794
  return i;
3778
3795
  }
3779
3796
  function A(n, t) {
3780
- return t === !1 ? ot() ? O(1, n) : -O(1, n) : O(-n, n);
3797
+ return t === !1 ? ot() ? T(1, n) : -T(1, n) : T(-n, n);
3781
3798
  }
3782
3799
  function St(n, t) {
3783
3800
  const e = b.pythagoreanTripletsWithTarget(n).filter((i) => t === !0 || !i.includes(0));
@@ -3791,7 +3808,7 @@ function Pt(n, t) {
3791
3808
  return t === void 0 && (t = 1), n.length <= 0 ? Object.values(n) : ht(n).slice(0, t);
3792
3809
  }
3793
3810
  function X(n) {
3794
- return n.length === 0 ? null : n[O(0, n.length - 1)];
3811
+ return n.length === 0 ? null : n[T(0, n.length - 1)];
3795
3812
  }
3796
3813
  function ht(n) {
3797
3814
  const t = Object.values(n);
@@ -3819,7 +3836,7 @@ class E {
3819
3836
  * @param values
3820
3837
  */
3821
3838
  constructor(...t) {
3822
- return this.#e = new h().zero(), this.#i = new h().zero(), this.#s = new h().zero(), this.#t = new g(), this.#r = "lr", t.length > 0 && this.parse(...t), this;
3839
+ return this.#e = new a().zero(), this.#i = new a().zero(), this.#s = new a().zero(), this.#t = new g(), this.#r = "lr", t.length > 0 && this.parse(...t), this;
3823
3840
  }
3824
3841
  // ------------------------------------------
3825
3842
  /**
@@ -3849,7 +3866,7 @@ class E {
3849
3866
  if (t[0] instanceof w && t[1] instanceof g)
3850
3867
  return this.fromPointAndDirection(t[0], t[1]);
3851
3868
  }
3852
- return t.length === 3 && t.every((e) => h.isFraction(e)) ? this.fromCoefficient(
3869
+ return t.length === 3 && t.every((e) => a.isFraction(e)) ? this.fromCoefficient(
3853
3870
  t[0],
3854
3871
  t[1],
3855
3872
  t[2]
@@ -3956,16 +3973,16 @@ class E {
3956
3973
  }
3957
3974
  distanceTo(t) {
3958
3975
  const e = t.x.clone().multiply(this.#e).add(t.y.clone().multiply(this.#i)).add(this.#s).abs(), i = this.normal.normSquare;
3959
- return i.isZero() ? new T(0) : new T().from(2, i.inverse(), e).reduce();
3976
+ return i.isZero() ? new O(0) : new O().from(2, i.inverse(), e).reduce();
3960
3977
  }
3961
3978
  fromCoefficient(t, e, i) {
3962
- this.#e = new h(t), this.#i = new h(e), this.#s = new h(i);
3979
+ this.#e = new a(t), this.#i = new a(e), this.#s = new a(i);
3963
3980
  const s = [this.#e, this.#i, this.#s].every((o) => o.exact) ? b.lcm(this.#e.denominator, this.#i.denominator, this.#s.denominator) : 1;
3964
3981
  if (s > 1 && (this.#e.multiply(s).reduce(), this.#i.multiply(s).reduce(), this.#s.multiply(s).reduce()), this.#i.isZero())
3965
3982
  return this.#t = new g(this.#s.clone().divide(this.#e).opposite(), 0), this;
3966
3983
  for (let o = 0; o < this.#i.value; o++) {
3967
- const a = this.#e.clone().divide(this.#i).multiply(o).subtract(this.#s.clone().divide(this.#i)).reduce();
3968
- if (this.#t = new g(o, a), a.isRelative())
3984
+ const h = this.#e.clone().divide(this.#i).multiply(o).subtract(this.#s.clone().divide(this.#i)).reduce();
3985
+ if (this.#t = new g(o, h), h.isRelative())
3969
3986
  return this;
3970
3987
  }
3971
3988
  const r = this.#s.clone().divide(this.#i).opposite().reduce();
@@ -4011,12 +4028,12 @@ class E {
4011
4028
  return new x(new l().parse("xy", this.#e, this.#i, this.#s), new l("0")).simplify();
4012
4029
  }
4013
4030
  getValueAtX = (t) => {
4014
- const e = this.getEquation().isolate("y"), i = new h(t);
4015
- return e instanceof x ? e.right.evaluate({ x: i }) : new h().invalid();
4031
+ const e = this.getEquation().isolate("y"), i = new a(t);
4032
+ return e instanceof x ? e.right.evaluate({ x: i }) : new a().invalid();
4016
4033
  };
4017
4034
  getValueAtY = (t) => {
4018
- const e = this.getEquation().isolate("x"), i = new h(t);
4019
- return e instanceof x ? e.right.evaluate({ y: i }) : new h().invalid();
4035
+ const e = this.getEquation().isolate("x"), i = new a(t);
4036
+ return e instanceof x ? e.right.evaluate({ y: i }) : new a().invalid();
4020
4037
  };
4021
4038
  get height() {
4022
4039
  return this.#s.clone().opposite().divide(this.#i);
@@ -4030,7 +4047,7 @@ class E {
4030
4047
  intersection = (t) => {
4031
4048
  const e = new w();
4032
4049
  let i = !1, s = !1;
4033
- return this.#i.isZero() || t.b.isZero(), this.isParallelTo(t) ? (e.x = new h().invalid(), e.y = new h().invalid(), i = !0) : this.isSameAs(t) ? (e.x = new h().invalid(), e.y = new h().invalid(), s = !0) : (e.x = this.#i.clone().multiply(t.c).subtract(this.#s.clone().multiply(t.b)).divide(this.#e.clone().multiply(t.b).subtract(this.#i.clone().multiply(t.a))), e.y = this.#e.clone().multiply(t.c).subtract(this.#s.clone().multiply(t.a)).divide(this.#i.clone().multiply(t.a).subtract(this.#e.clone().multiply(t.b)))), {
4050
+ return this.#i.isZero() || t.b.isZero(), this.isParallelTo(t) ? (e.x = new a().invalid(), e.y = new a().invalid(), i = !0) : this.isSameAs(t) ? (e.x = new a().invalid(), e.y = new a().invalid(), s = !0) : (e.x = this.#i.clone().multiply(t.c).subtract(this.#s.clone().multiply(t.b)).divide(this.#e.clone().multiply(t.b).subtract(this.#i.clone().multiply(t.a))), e.y = this.#e.clone().multiply(t.c).subtract(this.#s.clone().multiply(t.a)).divide(this.#i.clone().multiply(t.a).subtract(this.#e.clone().multiply(t.b)))), {
4034
4051
  point: e,
4035
4052
  hasIntersection: !(i || s),
4036
4053
  isParallel: i,
@@ -4112,7 +4129,7 @@ class L {
4112
4129
  return this.fromPoints(t[0], t[1], t[2]);
4113
4130
  }
4114
4131
  if (t.length === 6) {
4115
- const e = t.map((i) => new h(i));
4132
+ const e = t.map((i) => new a(i));
4116
4133
  if (e.some((i) => i.isNaN()))
4117
4134
  throw new Error("One of the values is not a valid number");
4118
4135
  return this.fromCoordinates(e[0], e[1], e[2], e[3], e[4], e[5]);
@@ -4185,17 +4202,17 @@ class L {
4185
4202
  }
4186
4203
  fromLines(t, e, i) {
4187
4204
  const s = new E(t).clone(), r = new E(e).clone(), o = new E(i).clone();
4188
- let a = s.intersection(r);
4189
- if (a.hasIntersection)
4190
- this.#e = a.point;
4205
+ let h = s.intersection(r);
4206
+ if (h.hasIntersection)
4207
+ this.#e = h.point;
4191
4208
  else
4192
4209
  return this.#s = !1, this;
4193
- if (a = r.intersection(o), a.hasIntersection)
4194
- this.#i = a.point;
4210
+ if (h = r.intersection(o), h.hasIntersection)
4211
+ this.#i = h.point;
4195
4212
  else
4196
4213
  return this.#s = !1, this;
4197
- if (a = o.intersection(s), a.hasIntersection)
4198
- this.#t = a.point;
4214
+ if (h = o.intersection(s), h.hasIntersection)
4215
+ this.#t = h.point;
4199
4216
  else
4200
4217
  return this.#s = !1, this;
4201
4218
  return this.reset(), this.#r = { AB: s, AC: o, BC: r }, this;
@@ -4306,8 +4323,8 @@ class L {
4306
4323
  let s = new g(), r = new g(), o = new w();
4307
4324
  if (t === "A" ? (o = this.A.clone(), s = i.AB.clone().d, r = i.AC.clone().d) : t === "B" ? (o = this.B.clone(), s = i.AB.clone().d.opposite(), r = i.BC.clone().d) : t === "C" && (o = this.C.clone(), s = i.BC.clone().d.opposite(), r = i.AC.clone().d.opposite()), s === void 0 || r === void 0)
4308
4325
  throw new Error(`The point ${t} does not exist`);
4309
- const a = e ? s.unit().add(r.unit()) : s.unit().subtract(r.unit());
4310
- return new E().fromPointAndDirection(o, a);
4326
+ const h = e ? s.unit().add(r.unit()) : s.unit().subtract(r.unit());
4327
+ return new E().fromPointAndDirection(o, h);
4311
4328
  }
4312
4329
  #c(t, e, i) {
4313
4330
  const s = (e ** 2 + i ** 2 - t ** 2) / (2 * e * i);
@@ -4347,7 +4364,7 @@ class U {
4347
4364
  t.length > 0 && this.parse(...t);
4348
4365
  }
4349
4366
  parse(...t) {
4350
- return typeof t[0] == "string" ? this.fromString(t[0]) : t[0] instanceof x ? 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 h || typeof t[1] == "number") ? this.fromCenterRadius(
4367
+ return typeof t[0] == "string" ? this.fromString(t[0]) : t[0] instanceof x ? 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(
4351
4368
  t[0],
4352
4369
  t[1],
4353
4370
  typeof t[2] == "boolean" ? t[2] : !1
@@ -4391,7 +4408,7 @@ class U {
4391
4408
  return this.#t = t.clone(), this.#s = new g(this.#t, e).normSquare, this.#r(), this;
4392
4409
  }
4393
4410
  fromCenterRadius(t, e, i) {
4394
- return this.#t = t.clone(), i ? this.#s = new h(e) : this.#s = new h(e).pow(2), this.#r(), this;
4411
+ return this.#t = t.clone(), i ? this.#s = new a(e) : this.#s = new a(e).pow(2), this.#r(), this;
4395
4412
  }
4396
4413
  fromEquation(t) {
4397
4414
  if (t.moveLeft(), t.degree("x").value === 2 && t.degree("y").value === 2) {
@@ -4421,7 +4438,7 @@ class U {
4421
4438
  return t.forEach((i) => {
4422
4439
  for (const s of [[1, 1], [-1, 1], [-1, -1], [1, -1]]) {
4423
4440
  const r = this.center.x.clone().add(s[0] * i[0]), o = this.center.y.clone().add(s[1] * i[1]);
4424
- e.every((a) => !a.isEqualXY(r, o)) && e.push(new w(r, o));
4441
+ e.every((h) => !h.isEqualXY(r, o)) && e.push(new w(r, o));
4425
4442
  }
4426
4443
  }), e;
4427
4444
  }
@@ -4436,7 +4453,7 @@ class U {
4436
4453
  */
4437
4454
  lineIntersection(t) {
4438
4455
  if (this.#e === null) return [];
4439
- 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), a = 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, a);
4456
+ 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);
4440
4457
  if (c.length === 0) return [];
4441
4458
  if (c.length === 1) {
4442
4459
  const d = s.add(i.clone().multiplyByScalar(c[0].fraction));
@@ -4451,7 +4468,7 @@ class U {
4451
4468
  ].sort((d, v) => i.x.isZero() ? i.y.isPositive() ? d.y.value - v.y.value : v.y.value - d.y.value : i.x.isPositive() ? d.x.value - v.x.value : v.x.value - d.x.value);
4452
4469
  }
4453
4470
  get radius() {
4454
- return new T().from(2, this.#s ?? 0);
4471
+ return new O().from(2, this.#s ?? 0);
4455
4472
  }
4456
4473
  /**
4457
4474
  * Get the relative position between circle and line. It corresponds to the number of intersection.
@@ -4465,12 +4482,12 @@ class U {
4465
4482
  return e - i > 1e-10 ? 0 : Math.abs(e - i) < 1e-10 ? 1 : 2;
4466
4483
  }
4467
4484
  setRadius(t, e) {
4468
- return e ? this.#s = new h(t) : this.#s = new h(t).pow(2), this.#r(), this;
4485
+ return e ? this.#s = new a(t) : this.#s = new a(t).pow(2), this.#r(), this;
4469
4486
  }
4470
4487
  get squareRadius() {
4471
- return this.#s?.clone() ?? new h(-1);
4488
+ return this.#s?.clone() ?? new a(-1);
4472
4489
  }
4473
- tangents = (t) => t instanceof h ? this.#c(t) : this.isPointOnCircle(t) ? this.#o(t) : this.#t !== null && this.#t.distanceTo(t).value > this.radius.value ? this.#a(t) : [];
4490
+ tangents = (t) => t instanceof a ? this.#c(t) : this.isPointOnCircle(t) ? this.#o(t) : this.#t !== null && this.#t.distanceTo(t).value > this.radius.value ? this.#a(t) : [];
4474
4491
  #r() {
4475
4492
  this.#e = new x(
4476
4493
  new l(`(x-(${this.center.x.display}))^2+(y-(${this.center.y.display}))^2`),
@@ -4493,8 +4510,8 @@ class U {
4493
4510
  });
4494
4511
  };
4495
4512
  #c = (t) => {
4496
- const e = t.numerator, i = -t.denominator, s = this.center.x.clone(), r = this.center.y.clone(), o = this.squareRadius.clone().multiply(t.numerator ** 2 + t.denominator ** 2), a = s.clone().multiply(e).opposite().subtract(r.clone().multiply(i)).add(o.clone().sqrt()), c = s.clone().multiply(e).opposite().subtract(r.clone().multiply(i)).subtract(o.clone().sqrt());
4497
- return [new E(e, i, a), new E(e, i, c)];
4513
+ const e = t.numerator, i = -t.denominator, s = this.center.x.clone(), r = this.center.y.clone(), o = this.squareRadius.clone().multiply(t.numerator ** 2 + t.denominator ** 2), h = s.clone().multiply(e).opposite().subtract(r.clone().multiply(i)).add(o.clone().sqrt()), c = s.clone().multiply(e).opposite().subtract(r.clone().multiply(i)).subtract(o.clone().sqrt());
4514
+ return [new E(e, i, h), new E(e, i, c)];
4498
4515
  };
4499
4516
  }
4500
4517
  class Y {
@@ -4520,11 +4537,11 @@ class Y {
4520
4537
  };
4521
4538
  }
4522
4539
  get display() {
4523
- const t = this.#t.x.display, e = this.#t.y.display, i = this.#t.z.display, s = this.direction.simplify(), r = s.x.display, o = s.y.display, a = s.z.display;
4540
+ const t = this.#t.x.display, e = this.#t.y.display, i = this.#t.z.display, s = this.direction.simplify(), r = s.x.display, o = s.y.display, h = s.z.display;
4524
4541
  return {
4525
4542
  parametric: `${g.asDisplay("x", "y", "z")} = ${g.asDisplay(this.#t.x.display, this.#t.y.display, this.#t.z.display)} + k\\cdot ${g.asDisplay(this.#e.x.display, this.#e.y.display, this.#e.z.display)}`,
4526
4543
  system: "",
4527
- cartesian: `(x-${t})/${r} = (y-${e})/${o} = (z-${i})/${a}`
4544
+ cartesian: `(x-${t})/${r} = (y-${e})/${o} = (z-${i})/${h}`
4528
4545
  };
4529
4546
  }
4530
4547
  get OA() {
@@ -4543,11 +4560,11 @@ class Y {
4543
4560
  return this.#e.clone();
4544
4561
  }
4545
4562
  distanceTo(t) {
4546
- const e = new g(this.#t, t), i = this.direction, s = this.direction.normSquare, r = e.cross(i).normSquare, o = r.clone().divide(s), a = o.clone().sqrt();
4563
+ const e = new g(this.#t, t), i = this.direction, s = this.direction.normSquare, r = e.cross(i).normSquare, o = r.clone().divide(s), h = o.clone().sqrt();
4547
4564
  return {
4548
4565
  value: Math.sqrt(o.value),
4549
4566
  fraction: o.clone().sqrt(),
4550
- tex: a.exact ? a.tex : `\\sqrt{${o.tex}}`
4567
+ tex: h.exact ? h.tex : `\\sqrt{${o.tex}}`
4551
4568
  };
4552
4569
  }
4553
4570
  // ------------------------------------------
@@ -4579,7 +4596,7 @@ class Y {
4579
4596
  return this.#t.clone();
4580
4597
  }
4581
4598
  randomPoint = (t = 5) => {
4582
- const e = this.#t.clone(), i = new h(A(t, !1));
4599
+ const e = this.#t.clone(), i = new a(A(t, !1));
4583
4600
  return new w(
4584
4601
  e.x.clone().add(this.#e.x.clone().multiply(i)),
4585
4602
  e.y.clone().add(this.#e.y.clone().multiply(i)),
@@ -4710,7 +4727,7 @@ class zt {
4710
4727
  #i = void 0;
4711
4728
  #s = 1;
4712
4729
  constructor(t, e) {
4713
- return t && e && (this.#t = t, this.#e = new h(e).clone().pow(2), this.#n()), this;
4730
+ return t && e && (this.#t = t, this.#e = new a(e).clone().pow(2), this.#n()), this;
4714
4731
  }
4715
4732
  fromEquation(t) {
4716
4733
  const e = new x(t).moveLeft().reduce(), i = ["x", "y", "z"];
@@ -4814,13 +4831,13 @@ function G(n) {
4814
4831
  natural: !1
4815
4832
  },
4816
4833
  n
4817
- ), e = new h();
4818
- if (t.negative ? e.numerator = A(t.max, t.zero) : e.numerator = O(t.zero ? 0 : 1, t.max), t.natural)
4834
+ ), e = new a();
4835
+ if (t.negative ? e.numerator = A(t.max, t.zero) : e.numerator = T(t.zero ? 0 : 1, t.max), t.natural)
4819
4836
  e.denominator = 1;
4820
4837
  else {
4821
4838
  let i = 0;
4822
4839
  for (; e.isRelative() && i < 10; )
4823
- e.denominator = O(1, t.max), i++;
4840
+ e.denominator = T(1, t.max), i++;
4824
4841
  }
4825
4842
  return t.reduced ? e.reduce() : e;
4826
4843
  }
@@ -4880,7 +4897,7 @@ function it(n) {
4880
4897
  }), t.unit && s === r && i.coefficient.one(), e.add(i);
4881
4898
  if (t.positive && e.monomByDegree().coefficient.isNegative() && e.opposite(), t.numberOfMonoms && t.numberOfMonoms > 0 && t.numberOfMonoms < e.length)
4882
4899
  for (; e.length > t.numberOfMonoms; ) {
4883
- const r = O(1, e.length - 1);
4900
+ const r = T(1, e.length - 1);
4884
4901
  e.monoms.splice(r, 1);
4885
4902
  }
4886
4903
  return e.reduce();
@@ -4896,7 +4913,7 @@ function Rt(n) {
4896
4913
  i.push(it(e));
4897
4914
  if (n?.commonConstant !== !1) {
4898
4915
  let r = A(10, !1);
4899
- n?.commonConstant === !0 && (r === 1 || r === -1) && (r *= O(2, 5)), r !== 1 && r !== -1 && i.unshift(new l(r));
4916
+ n?.commonConstant === !0 && (r === 1 || r === -1) && (r *= T(2, 5)), r !== 1 && r !== -1 && i.unshift(new l(r));
4900
4917
  }
4901
4918
  return l.xMultiply(...i);
4902
4919
  }
@@ -4942,7 +4959,7 @@ function J(n) {
4942
4959
  quadrant: null
4943
4960
  },
4944
4961
  n
4945
- ), e = t.axis === "x", i = t.axis === "y", s = t.fraction ? G({ max: t.max, zero: e }) : new h(A(t.max, e)), r = t.fraction ? G({ max: t.max, zero: i }) : new h(A(t.max, i));
4962
+ ), e = t.axis === "x", i = t.axis === "y", s = t.fraction ? G({ max: t.max, zero: e }) : new a(A(t.max, e)), r = t.fraction ? G({ max: t.max, zero: i }) : new a(A(t.max, i));
4946
4963
  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);
4947
4964
  }
4948
4965
  function Dt(n) {
@@ -4957,7 +4974,7 @@ function Dt(n) {
4957
4974
  n
4958
4975
  ), e = J(t.center);
4959
4976
  let i, s;
4960
- return t.pointsOnCircle === 8 ? (i = O(1, 3), s = i ** 2 + (i + 1) ** 2) : s = O(1, 20), new U(e, s, !0);
4977
+ return t.pointsOnCircle === 8 ? (i = T(1, 3), s = i ** 2 + (i + 1) ** 2) : s = T(1, 20), new U(e, s, !0);
4961
4978
  }
4962
4979
  function Vt(n) {
4963
4980
  const t = Object.assign(
@@ -4996,7 +5013,7 @@ const Ut = {
4996
5013
  polynom: (n) => it(n),
4997
5014
  monom: (n) => ct(n),
4998
5015
  fraction: (n) => G(n),
4999
- number: (n, t, e) => O(n, t, e),
5016
+ number: (n, t, e) => T(n, t, e),
5000
5017
  numberSym: (n, t) => A(n, t),
5001
5018
  prime: (n) => It(n),
5002
5019
  triplet: (n, t) => St(n, t),
@@ -5011,8 +5028,8 @@ const Ut = {
5011
5028
  circle: (n) => Dt(n)
5012
5029
  }, Gt = {
5013
5030
  Numeric: b,
5014
- Fraction: h,
5015
- Root: T,
5031
+ Fraction: a,
5032
+ Root: O,
5016
5033
  Monom: p,
5017
5034
  Polynom: l,
5018
5035
  Equation: x,
@@ -5041,7 +5058,7 @@ export {
5041
5058
  D as FACTOR_DISPLAY,
5042
5059
  bt as FRAC_TYPE,
5043
5060
  y as Factor,
5044
- h as Fraction,
5061
+ a as Fraction,
5045
5062
  E as Line,
5046
5063
  Y as Line3,
5047
5064
  P as LinearSystem,
@@ -5055,7 +5072,7 @@ export {
5055
5072
  N as PolyFactor,
5056
5073
  l as Polynom,
5057
5074
  Ut as Random,
5058
- T as Root,
5075
+ O as Root,
5059
5076
  at as SPHERE3_RELATIVE_POSITION,
5060
5077
  C as Solution,
5061
5078
  zt as Sphere3,