pimath 0.1.36 → 0.1.38

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
@@ -1,81 +1,81 @@
1
- function ve(n) {
2
- const e = ce(n), t = [];
1
+ function le(r) {
2
+ const e = ie(r), t = [];
3
3
  let i, s;
4
4
  for (; e.length > 0; )
5
5
  i = e.shift() ?? 1, s = (e.length > 0 ? e.pop() : +i) ?? 1, t.push([i, s]);
6
6
  return t;
7
7
  }
8
- function be(...n) {
9
- const e = ne(...n);
10
- return n.map((t) => t / e);
8
+ function ce(...r) {
9
+ const e = K(...r);
10
+ return r.map((t) => t / e);
11
11
  }
12
- function ce(n) {
13
- const e = Math.abs(n), t = Math.sqrt(e), i = [];
12
+ function ie(r) {
13
+ const e = Math.abs(r), t = Math.sqrt(e), i = [];
14
14
  for (let s = 1; s <= t; s++)
15
- n % s === 0 && (i.push(s), i.push(e / s));
16
- return i.sort(function(s, r) {
17
- return s - r;
15
+ r % s === 0 && (i.push(s), i.push(e / s));
16
+ return i.sort(function(s, n) {
17
+ return s - n;
18
18
  }), [...new Set(i)];
19
19
  }
20
- function ne(...n) {
21
- const e = function(s, r) {
22
- return r === 0 ? s : e(r, s % r);
20
+ function K(...r) {
21
+ const e = function(s, n) {
22
+ return n === 0 ? s : e(n, s % n);
23
23
  };
24
24
  let t = 1, i = 2;
25
- if (n.length === 0)
25
+ if (r.length === 0)
26
26
  return 1;
27
- if (n.length === 1)
28
- return n[0] === 0 ? 1 : n[0];
29
- if (t = e(n[0], n[1]), t === 1)
27
+ if (r.length === 1)
28
+ return r[0] === 0 ? 1 : r[0];
29
+ if (t = e(r[0], r[1]), t === 1)
30
30
  return 1;
31
- for (i = 2; i < n.length && (t = e(t, n[i]), t !== 1); i++)
31
+ for (i = 2; i < r.length && (t = e(t, r[i]), t !== 1); i++)
32
32
  ;
33
33
  return Math.abs(t);
34
34
  }
35
- function xe(...n) {
36
- return n.reduce(function(e, t) {
37
- return Math.abs(e * t / ne(e, t));
35
+ function ue(...r) {
36
+ return r.reduce(function(e, t) {
37
+ return Math.abs(e * t / K(e, t));
38
38
  });
39
39
  }
40
- function Ee(n, e = 3) {
41
- return +n.toFixed(e);
40
+ function fe(r, e = 3) {
41
+ return +r.toFixed(e);
42
42
  }
43
- function Ne(n) {
44
- if (Number.isSafeInteger(n) || n.toString().split(".")[0].length < 10)
43
+ function de(r) {
44
+ if (Number.isSafeInteger(r) || r.toString().split(".")[0].length < 10)
45
45
  return 0;
46
46
  throw new Error("Periodic value: Not implemented yet");
47
47
  }
48
- function Ae(n) {
48
+ function pe(r) {
49
49
  const e = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997, 1009, 1013, 1019, 1021, 1031, 1033, 1039, 1049, 1051, 1061, 1063, 1069, 1087, 1091, 1093, 1097, 1103, 1109, 1117, 1123, 1129, 1151, 1153, 1163, 1171, 1181, 1187, 1193, 1201, 1213, 1217, 1223, 1229, 1231, 1237, 1249, 1259, 1277, 1279, 1283, 1289, 1291, 1297, 1301, 1303, 1307, 1319, 1321, 1327, 1361, 1367, 1373, 1381, 1399, 1409, 1423, 1427, 1429, 1433, 1439, 1447, 1451, 1453, 1459, 1471, 1481, 1483, 1487, 1489, 1493, 1499, 1511, 1523, 1531, 1543, 1549, 1553, 1559, 1567, 1571, 1579, 1583, 1597, 1601, 1607, 1609, 1613, 1619, 1621, 1627, 1637, 1657, 1663, 1667, 1669, 1693, 1697, 1699, 1709, 1721, 1723, 1733, 1741, 1747, 1753, 1759, 1777, 1783, 1787, 1789, 1801, 1811, 1823, 1831, 1847, 1861, 1867, 1871, 1873, 1877, 1879, 1889, 1901, 1907, 1913, 1931, 1933, 1949, 1951, 1973, 1979, 1987, 1993, 1997, 1999, 2003, 2011, 2017, 2027, 2029, 2039, 2053, 2063, 2069, 2081, 2083, 2087, 2089, 2099, 2111, 2113, 2129, 2131, 2137, 2141, 2143, 2153, 2161, 2179, 2203, 2207, 2213, 2221, 2237, 2239, 2243, 2251, 2267, 2269, 2273, 2281, 2287, 2293, 2297, 2309, 2311, 2333, 2339, 2341, 2347, 2351, 2357, 2371, 2377, 2381, 2383, 2389, 2393, 2399, 2411, 2417, 2423, 2437, 2441, 2447, 2459, 2467, 2473, 2477, 2503, 2521, 2531, 2539, 2543, 2549, 2551, 2557, 2579, 2591, 2593, 2609, 2617, 2621, 2633, 2647, 2657, 2659, 2663, 2671, 2677, 2683, 2687, 2689, 2693, 2699, 2707, 2711, 2713, 2719, 2729, 2731, 2741, 2749, 2753, 2767, 2777, 2789, 2791, 2797, 2801, 2803, 2819, 2833, 2837, 2843, 2851, 2857, 2861, 2879, 2887, 2897, 2903, 2909, 2917, 2927, 2939, 2953, 2957, 2963, 2969, 2971, 2999, 3001, 3011, 3019, 3023, 3037, 3041, 3049, 3061, 3067, 3079, 3083, 3089, 3109, 3119, 3121, 3137, 3163, 3167, 3169, 3181, 3187, 3191, 3203, 3209, 3217, 3221, 3229, 3251, 3253, 3257, 3259, 3271, 3299, 3301, 3307, 3313, 3319, 3323, 3329, 3331, 3343, 3347, 3359, 3361, 3371, 3373, 3389, 3391, 3407, 3413, 3433, 3449, 3457, 3461, 3463, 3467, 3469, 3491, 3499, 3511, 3517, 3527, 3529, 3533, 3539, 3541, 3547, 3557, 3559, 3571, 3581, 3583, 3593, 3607, 3613, 3617, 3623, 3631, 3637, 3643, 3659, 3671, 3673, 3677, 3691, 3697, 3701, 3709, 3719, 3727, 3733, 3739, 3761, 3767, 3769, 3779, 3793, 3797, 3803, 3821, 3823, 3833, 3847, 3851, 3853, 3863, 3877, 3881, 3889, 3907, 3911, 3917, 3919, 3923, 3929, 3931, 3943, 3947, 3967, 3989, 4001, 4003, 4007, 4013, 4019, 4021, 4027, 4049, 4051, 4057, 4073, 4079, 4091, 4093, 4099, 4111, 4127, 4129, 4133, 4139, 4153, 4157, 4159, 4177, 4201, 4211, 4217, 4219, 4229, 4231, 4241, 4243, 4253, 4259, 4261, 4271, 4273, 4283, 4289, 4297, 4327, 4337, 4339, 4349, 4357, 4363, 4373, 4391, 4397, 4409, 4421, 4423, 4441, 4447, 4451, 4457, 4463, 4481, 4483, 4493, 4507, 4513, 4517, 4519, 4523, 4547, 4549, 4561, 4567, 4583, 4591, 4597, 4603, 4621, 4637, 4639, 4643, 4649, 4651, 4657, 4663, 4673, 4679, 4691, 4703, 4721, 4723, 4729, 4733, 4751, 4759, 4783, 4787, 4789, 4793, 4799, 4801, 4813, 4817, 4831, 4861, 4871, 4877, 4889, 4903, 4909, 4919, 4931, 4933, 4937, 4943, 4951, 4957, 4967, 4969, 4973, 4987, 4993, 4999, 5003, 5009, 5011, 5021, 5023, 5039, 5051, 5059, 5077, 5081, 5087, 5099, 5101, 5107, 5113, 5119, 5147, 5153, 5167, 5171, 5179, 5189, 5197, 5209, 5227, 5231, 5233, 5237, 5261, 5273, 5279, 5281, 5297, 5303, 5309, 5323, 5333, 5347, 5351, 5381, 5387, 5393, 5399, 5407, 5413, 5417, 5419, 5431, 5437, 5441, 5443, 5449, 5471, 5477, 5479, 5483, 5501, 5503, 5507, 5519, 5521, 5527, 5531, 5557, 5563, 5569, 5573, 5581, 5591, 5623, 5639, 5641, 5647, 5651, 5653, 5657, 5659, 5669, 5683, 5689, 5693, 5701, 5711, 5717, 5737, 5741, 5743, 5749, 5779, 5783, 5791, 5801, 5807, 5813, 5821, 5827, 5839, 5843, 5849, 5851, 5857, 5861, 5867, 5869, 5879, 5881, 5897, 5903, 5923, 5927, 5939, 5953, 5981, 5987, 6007, 6011, 6029, 6037, 6043, 6047, 6053, 6067, 6073, 6079, 6089, 6091, 6101, 6113, 6121, 6131, 6133, 6143, 6151, 6163, 6173, 6197, 6199, 6203, 6211, 6217, 6221, 6229, 6247, 6257, 6263, 6269, 6271, 6277, 6287, 6299, 6301, 6311, 6317, 6323, 6329, 6337, 6343, 6353, 6359, 6361, 6367, 6373, 6379, 6389, 6397, 6421, 6427, 6449, 6451, 6469, 6473, 6481, 6491, 6521, 6529, 6547, 6551, 6553, 6563, 6569, 6571, 6577, 6581, 6599, 6607, 6619, 6637, 6653, 6659, 6661, 6673, 6679, 6689, 6691, 6701, 6703, 6709, 6719, 6733, 6737, 6761, 6763, 6779, 6781, 6791, 6793, 6803, 6823, 6827, 6829, 6833, 6841, 6857, 6863, 6869, 6871, 6883, 6899, 6907, 6911, 6917, 6947, 6949, 6959, 6961, 6967, 6971, 6977, 6983, 6991, 6997, 7001, 7013, 7019, 7027, 7039, 7043, 7057, 7069, 7079, 7103, 7109, 7121, 7127, 7129, 7151, 7159, 7177, 7187, 7193, 7207, 7211, 7213, 7219, 7229, 7237, 7243, 7247, 7253, 7283, 7297, 7307, 7309, 7321, 7331, 7333, 7349, 7351, 7369, 7393, 7411, 7417, 7433, 7451, 7457, 7459, 7477, 7481, 7487, 7489, 7499, 7507, 7517, 7523, 7529, 7537, 7541, 7547, 7549, 7559, 7561, 7573, 7577, 7583, 7589, 7591, 7603, 7607, 7621, 7639, 7643, 7649, 7669, 7673, 7681, 7687, 7691, 7699, 7703, 7717, 7723, 7727, 7741, 7753, 7757, 7759, 7789, 7793, 7817, 7823, 7829, 7841, 7853, 7867, 7873, 7877, 7879, 7883, 7901, 7907, 7919, 7927, 7933, 7937, 7949, 7951, 7963, 7993, 8009, 8011, 8017, 8039, 8053, 8059, 8069, 8081, 8087, 8089, 8093, 8101, 8111, 8117, 8123, 8147, 8161, 8167, 8171, 8179, 8191, 8209, 8219, 8221, 8231, 8233, 8237, 8243, 8263, 8269, 8273, 8287, 8291, 8293, 8297, 8311, 8317, 8329, 8353, 8363, 8369, 8377, 8387, 8389, 8419, 8423, 8429, 8431, 8443, 8447, 8461, 8467, 8501, 8513, 8521, 8527, 8537, 8539, 8543, 8563, 8573, 8581, 8597, 8599, 8609, 8623, 8627, 8629, 8641, 8647, 8663, 8669, 8677, 8681, 8689, 8693, 8699, 8707, 8713, 8719, 8731, 8737, 8741, 8747, 8753, 8761, 8779, 8783, 8803, 8807, 8819, 8821, 8831, 8837, 8839, 8849, 8861, 8863, 8867, 8887, 8893, 8923, 8929, 8933, 8941, 8951, 8963, 8969, 8971, 8999, 9001, 9007, 9011, 9013, 9029, 9041, 9043, 9049, 9059, 9067, 9091, 9103, 9109, 9127, 9133, 9137, 9151, 9157, 9161, 9173, 9181, 9187, 9199, 9203, 9209, 9221, 9227, 9239, 9241, 9257, 9277, 9281, 9283, 9293, 9311, 9319, 9323, 9337, 9341, 9343, 9349, 9371, 9377, 9391, 9397, 9403, 9413, 9419, 9421, 9431, 9433, 9437, 9439, 9461, 9463, 9467, 9473, 9479, 9491, 9497, 9511, 9521, 9533, 9539, 9547, 9551, 9587, 9601, 9613, 9619, 9623, 9629, 9631, 9643, 9649, 9661, 9677, 9679, 9689, 9697, 9719, 9721, 9733, 9739, 9743, 9749, 9767, 9769, 9781, 9787, 9791, 9803, 9811, 9817, 9829, 9833, 9839, 9851, 9857, 9859, 9871, 9883, 9887, 9901, 9907, 9923, 9929, 9931, 9941, 9949, 9967, 9973];
50
- return n === void 0 ? e : e.slice(0, Math.min(e.length, n));
50
+ return r === void 0 ? e : e.slice(0, Math.min(e.length, r));
51
51
  }
52
- function qe(n, e) {
53
- const t = [], i = e === !0 ? +n : n ** 2;
54
- for (let s = 0; s <= n; s++)
55
- for (let r = 0; r <= n; r++)
56
- s ** 2 + r ** 2 === i && t.push([s, r, n]);
52
+ function me(r, e) {
53
+ const t = [], i = e === !0 ? +r : r ** 2;
54
+ for (let s = 0; s <= r; s++)
55
+ for (let n = 0; n <= r; n++)
56
+ s ** 2 + n ** 2 === i && t.push([s, n, r]);
57
57
  return t;
58
58
  }
59
- function Te(n, e = 2) {
60
- return +`${Math.round(+`${n}e${e}`)}e-${e}`;
59
+ function ge(r, e = 2) {
60
+ return +`${Math.round(+`${r}e${e}`)}e-${e}`;
61
61
  }
62
62
  const E = {
63
- decompose: ve,
64
- dividers: ce,
65
- divideNumbersByGCD: be,
66
- gcd: ne,
67
- lcm: xe,
68
- numberCorrection: Ee,
69
- periodic: Ne,
70
- primes: Ae,
71
- pythagoreanTripletsWithTarget: qe,
72
- round: Te
63
+ decompose: le,
64
+ dividers: ie,
65
+ divideNumbersByGCD: ce,
66
+ gcd: K,
67
+ lcm: ue,
68
+ numberCorrection: fe,
69
+ periodic: de,
70
+ primes: pe,
71
+ pythagoreanTripletsWithTarget: me,
72
+ round: ge
73
73
  };
74
- var Oe = /* @__PURE__ */ ((n) => (n.frac = "frac", n.dfrac = "dfrac", n.tfrac = "tfrac", n))(Oe || {});
74
+ var we = /* @__PURE__ */ ((r) => (r.frac = "frac", r.dfrac = "dfrac", r.tfrac = "tfrac", r))(we || {});
75
75
  class a {
76
- #t = !1;
76
+ #i = !1;
77
77
  #e = 1;
78
- #i = 1;
78
+ #t = 1;
79
79
  #s = "frac";
80
80
  constructor(e, t) {
81
81
  return e !== void 0 && this.parse(e, t), this;
@@ -89,37 +89,37 @@ class a {
89
89
  parse = (e, t) => {
90
90
  let i;
91
91
  if (e === "")
92
- return this.#i = 0, this.#e = 1, this;
92
+ return this.#t = 0, this.#e = 1, this;
93
93
  switch (typeof e) {
94
94
  case "string":
95
- if (i = e.split("/"), i.length > 2 && (this.#i = NaN), i.map((s) => s === "" || isNaN(Number(s))).includes(!0) && (this.#i = NaN), i.length === 1)
95
+ if (i = e.split("/"), i.length > 2 && (this.#t = NaN), i.map((s) => s === "" || isNaN(Number(s))).includes(!0) && (this.#t = NaN), i.length === 1)
96
96
  return this.parse(+i[0]);
97
- i.length === 2 ? i[1] === "0" ? (this.#i = NaN, this.#e = 1) : (this.#i = +i[0], this.#e = +i[1]) : (this.#i = NaN, this.#e = 1);
97
+ i.length === 2 ? i[1] === "0" ? (this.#t = NaN, this.#e = 1) : (this.#t = +i[0], this.#e = +i[1]) : (this.#t = NaN, this.#e = 1);
98
98
  break;
99
99
  case "number":
100
100
  if (Number.isSafeInteger(e))
101
- this.#i = +e, t === void 0 || !Number.isSafeInteger(t) ? this.#e = 1 : this.#e = +t;
101
+ this.#t = +e, t === void 0 || !Number.isSafeInteger(t) ? this.#e = 1 : this.#e = +t;
102
102
  else {
103
- const [, s] = e.toString().split("."), r = s ? s.length : 0, o = Math.pow(10, r);
104
- t === void 0 ? (this.#i = e * o, this.#e = o) : Number.isSafeInteger(t) && (this.#i = e * o - Math.floor(e * Math.pow(10, r - t)), this.denominator = o - Math.pow(10, r - t)), this.#i = E.numberCorrection(this.#i), this.#e = E.numberCorrection(this.#e), this.reduce();
103
+ const [, s] = e.toString().split("."), n = s ? s.length : 0, o = Math.pow(10, n);
104
+ t === void 0 ? (this.#t = e * o, this.#e = o) : Number.isSafeInteger(t) && (this.#t = e * o - Math.floor(e * Math.pow(10, n - t)), this.denominator = o - Math.pow(10, n - t)), this.#t = E.numberCorrection(this.#t), this.#e = E.numberCorrection(this.#e), this.reduce();
105
105
  }
106
106
  break;
107
107
  case "object":
108
- e instanceof a && (this.#i = +e.numerator, this.#e = +e.denominator);
108
+ e instanceof a && (this.#t = +e.numerator, this.#e = +e.denominator);
109
109
  break;
110
110
  }
111
111
  return this;
112
112
  };
113
113
  clone = () => {
114
114
  const e = new a();
115
- return e.numerator = +this.#i, e.denominator = +this.#e, e;
115
+ return e.numerator = +this.#t, e.denominator = +this.#e, e;
116
116
  };
117
117
  // Display getter
118
118
  get tex() {
119
- return this.isInfinity() ? `${this.sign() === 1 ? "+" : "-"}\\infty` : this.isExact() ? this.#e === 1 ? `${this.#i}` : this.#i < 0 ? `-\\${this.#s}{ ${-this.#i} }{ ${this.#e} }` : `\\${this.#s}{ ${this.#i} }{ ${this.#e} }` : this.value.toFixed(3);
119
+ return this.isInfinity() ? `${this.sign() === 1 ? "+" : "-"}\\infty` : this.isExact() ? this.#e === 1 ? `${this.#t}` : this.#t < 0 ? `-\\${this.#s}{ ${-this.#t} }{ ${this.#e} }` : `\\${this.#s}{ ${this.#t} }{ ${this.#e} }` : this.value.toFixed(3);
120
120
  }
121
121
  get display() {
122
- return this.isExact() ? this.#e === 1 ? `${this.#i}` : `${this.#i}/${this.#e}` : this.value.toFixed(3);
122
+ return this.isExact() ? this.#e === 1 ? `${this.#t}` : `${this.#t}/${this.#e}` : this.value.toFixed(3);
123
123
  }
124
124
  static average = (...e) => {
125
125
  const t = new a().zero();
@@ -128,11 +128,11 @@ class a {
128
128
  return t.divide(e.length), t;
129
129
  };
130
130
  static isFraction(e) {
131
- if (e instanceof a || typeof e == "number" && !isNaN(e))
131
+ if (e instanceof a || typeof e == "number" && !isNaN(+e))
132
132
  return !0;
133
133
  if (typeof e == "string") {
134
134
  const [t, i] = e.split("/");
135
- return !isNaN(+t) && (i === void 0 || !isNaN(+i));
135
+ return !isNaN(+t) && !isNaN(+i);
136
136
  }
137
137
  return !1;
138
138
  }
@@ -155,7 +155,7 @@ class a {
155
155
  return t;
156
156
  };
157
157
  static sort = (e, t) => {
158
- const s = e.map((r) => r instanceof a ? r : new a(r)).sort((r, o) => r.value - o.value);
158
+ const s = e.map((n) => n instanceof a ? n : new a(n)).sort((n, o) => n.value - o.value);
159
159
  return t && s.reverse(), s;
160
160
  };
161
161
  static unique = (e) => {
@@ -172,16 +172,16 @@ class a {
172
172
  }
173
173
  return t;
174
174
  };
175
- abs = () => (this.#i = Math.abs(this.#i), this.#e = Math.abs(this.#e), this);
175
+ abs = () => (this.#t = Math.abs(this.#t), this.#e = Math.abs(this.#e), this);
176
176
  add = (e) => {
177
177
  if (e instanceof a) {
178
- const t = this.#i, i = this.#e;
179
- this.#i = t * e.denominator + e.numerator * i, this.#e = i * e.denominator;
178
+ const t = this.#t, i = this.#e;
179
+ this.#t = t * e.denominator + e.numerator * i, this.#e = i * e.denominator;
180
180
  } else
181
181
  return this.add(new a(e));
182
182
  return this.reduce();
183
183
  };
184
- amplify = (e) => (Number.isSafeInteger(e) && (this.#i *= e, this.#e *= e), this);
184
+ amplify = (e) => (Number.isSafeInteger(e) && (this.#t *= e, this.#e *= e), this);
185
185
  /**
186
186
  * Simple function to determine if it's a fraction
187
187
  */
@@ -229,73 +229,73 @@ class a {
229
229
  const t = new a(e);
230
230
  if (t.numerator === 0)
231
231
  return new a().infinite();
232
- const i = this.#i, s = this.#e;
233
- return this.#i = i * t.denominator, this.#e = s * t.numerator, this.reduce();
232
+ const i = this.#t, s = this.#e;
233
+ return this.#t = i * t.denominator, this.#e = s * t.numerator, this.reduce();
234
234
  };
235
235
  get frac() {
236
236
  return this.#s = "frac", this;
237
237
  }
238
- infinite = () => (this.#i = 1 / 0, this.#e = 1, this);
239
- invalid = () => (this.#i = NaN, this.#e = 1, this);
238
+ infinite = () => (this.#t = 1 / 0, this.#e = 1, this);
239
+ invalid = () => (this.#t = NaN, this.#e = 1, this);
240
240
  inverse = () => {
241
- const e = +this.#i;
242
- return this.#i = +this.#e, this.#e = e, this;
241
+ const e = +this.#t;
242
+ return this.#t = +this.#e, this.#e = e, this;
243
243
  };
244
- isApproximative = () => this.#t || this.#i.toString().length >= 15 && this.#e.toString().length >= 15;
244
+ isApproximative = () => this.#i || this.#t.toString().length >= 15 && this.#e.toString().length >= 15;
245
245
  isEqual = (e) => this.compare(e, "=");
246
246
  isEven = () => this.isRelative() && this.value % 2 === 0;
247
247
  isExact = () => !this.isApproximative();
248
248
  isFinite = () => !this.isInfinity() && !this.isNaN();
249
249
  isGeq = (e) => this.compare(e, ">=");
250
250
  isGreater = (e) => this.compare(e, ">");
251
- isInfinity = () => Math.abs(this.#i) === 1 / 0;
251
+ isInfinity = () => Math.abs(this.#t) === 1 / 0;
252
252
  isInverted = (e) => this.isEqual(new a().one().divide(e.clone()));
253
253
  isLeq = (e) => this.compare(e, "<=");
254
254
  /* Compare shortcuts */
255
255
  isLesser = (e) => this.compare(e, "<");
256
- isNaN = () => isNaN(this.#i);
256
+ isNaN = () => isNaN(this.#t);
257
257
  isNatural = () => this.isRelative() && this.isPositive();
258
258
  isNegative = () => this.sign() === -1;
259
- isNegativeOne = () => this.#i === -1 && this.#e === 1;
259
+ isNegativeOne = () => this.#t === -1 && this.#e === 1;
260
260
  // ------------------------------------------
261
261
  isNotEqual = (e) => this.compare(e, "<>");
262
- isNotZero = () => this.#i !== 0;
262
+ isNotZero = () => this.#t !== 0;
263
263
  isOdd = () => this.isRelative() && this.value % 2 === 1;
264
- isOne = () => this.#i === 1 && this.#e === 1;
264
+ isOne = () => this.#t === 1 && this.#e === 1;
265
265
  isOpposite = (e) => this.isEqual(e.clone().opposite());
266
266
  isPositive = () => this.sign() === 1;
267
267
  isRational = () => !this.isRelative();
268
- isReduced = () => Math.abs(E.gcd(this.#i, this.#e)) === 1;
268
+ isReduced = () => Math.abs(E.gcd(this.#t, this.#e)) === 1;
269
269
  isRelative = () => this.clone().reduce().denominator === 1;
270
- isSquare = () => Math.sqrt(this.#i) % 1 === 0 && Math.sqrt(this.#e) % 1 === 0;
270
+ isSquare = () => Math.sqrt(this.#t) % 1 === 0 && Math.sqrt(this.#e) % 1 === 0;
271
271
  isStrictlyNegative = () => this.value < 0;
272
272
  isStrictlyPositive = () => this.value > 0;
273
273
  // Mathematical operations specific to fractions
274
- isZero = () => this.#i === 0;
274
+ isZero = () => this.#t === 0;
275
275
  multiply = (e) => {
276
276
  const t = new a(e);
277
- return this.#i = this.#i * t.numerator, this.#e = this.#e * t.denominator, this.reduce();
277
+ return this.#t = this.#t * t.numerator, this.#e = this.#e * t.denominator, this.reduce();
278
278
  };
279
279
  // ------------------------------------------
280
280
  get numerator() {
281
- return this.#i;
281
+ return this.#t;
282
282
  }
283
283
  set numerator(e) {
284
- this.#i = e;
284
+ this.#t = e;
285
285
  }
286
- one = () => (this.#i = 1, this.#e = 1, this);
287
- opposite = () => (this.#i = -this.#i, this);
286
+ one = () => (this.#t = 1, this.#e = 1, this);
287
+ opposite = () => (this.#t = -this.#t, this);
288
288
  pow = (e) => {
289
289
  if (e instanceof a)
290
290
  return this.pow(e.value);
291
291
  this.reduce(), e < 0 && this.inverse();
292
- const t = Math.floor(Math.pow(this.#i, Math.abs(e))), i = Math.floor(Math.pow(this.#e, Math.abs(e)));
293
- return t ** Math.abs(e) === this.#i && i ** Math.abs(e) === this.#e ? (this.#i = this.#i ** Math.abs(e), this.#e = this.#e ** Math.abs(e)) : (this.#i = this.#i ** Math.abs(e), this.#e = this.#e ** Math.abs(e)), this;
292
+ const t = Math.floor(Math.pow(this.#t, Math.abs(e))), i = Math.floor(Math.pow(this.#e, Math.abs(e)));
293
+ return t ** Math.abs(e) === this.#t && i ** Math.abs(e) === this.#e ? (this.#t = this.#t ** Math.abs(e), this.#e = this.#e ** Math.abs(e)) : (this.#t = this.#t ** Math.abs(e), this.#e = this.#e ** Math.abs(e)), this;
294
294
  };
295
295
  // ------------------------------------------
296
296
  reduce = () => {
297
- const e = E.gcd(this.#i, this.#e);
298
- return this.#i = this.#i / e, this.#e = this.#e / e, this.#e < 0 && (this.#e = -this.#e, this.#i = -this.#i), this;
297
+ const e = E.gcd(this.#t, this.#e);
298
+ return this.#t = this.#t / e, this.#e = this.#e / e, this.#e < 0 && (this.#e = -this.#e, this.#t = -this.#t), this;
299
299
  };
300
300
  // ------------------------------------------
301
301
  // Getter and setter
@@ -308,10 +308,10 @@ class a {
308
308
  throw new Error("The root of a negative number must be odd.");
309
309
  const t = this.sign();
310
310
  this.abs(), this.reduce();
311
- const i = Math.floor(Math.pow(this.#i, Math.abs(1 / e))), s = Math.floor(Math.pow(this.#e, Math.abs(1 / e)));
312
- return this.#i = Math.pow(this.#i, Math.abs(1 / e)), this.#e = Math.pow(this.#e, Math.abs(1 / e)), (i !== this.#i || s !== this.#e) && (this.#i = this.#i / this.#e, this.#e = 1, this.#t = !0), this.multiply(t), this;
311
+ const i = Math.floor(Math.pow(this.#t, Math.abs(1 / e))), s = Math.floor(Math.pow(this.#e, Math.abs(1 / e)));
312
+ return this.#t = Math.pow(this.#t, Math.abs(1 / e)), this.#e = Math.pow(this.#e, Math.abs(1 / e)), (i !== this.#t || s !== this.#e) && (this.#t = this.#t / this.#e, this.#e = 1, this.#i = !0), this.multiply(t), this;
313
313
  };
314
- sign = () => this.#i * this.#e >= 0 ? 1 : -1;
314
+ sign = () => this.#t * this.#e >= 0 ? 1 : -1;
315
315
  sqrt = () => this.root(2);
316
316
  subtract = (e) => e instanceof a ? this.add(e.clone().opposite()) : this.add(-e);
317
317
  get texWithSign() {
@@ -321,27 +321,27 @@ class a {
321
321
  return this.#s = "tfrac", this;
322
322
  }
323
323
  get value() {
324
- const e = this.#i / this.#e;
324
+ const e = this.#t / this.#e;
325
325
  return e === 0 ? 0 : e;
326
326
  }
327
- zero = () => (this.#i = 0, this.#e = 1, this);
327
+ zero = () => (this.#t = 0, this.#e = 1, this);
328
328
  }
329
- class X {
330
- #t;
331
- #e;
329
+ class j {
332
330
  #i;
331
+ #e;
332
+ #t;
333
333
  #s;
334
334
  constructor(...e) {
335
- this.#t = 1, this.#i = 1, this.#e = 2, this.#s = !0, e.length > 0 && this.parse(e[0], e[1], e[2]);
335
+ this.#i = 1, this.#t = 1, this.#e = 2, this.#s = !0, e.length > 0 && this.parse(e[0], e[1], e[2]);
336
336
  }
337
337
  // ------------------------------------------
338
338
  // Getter and setter
339
339
  // ------------------------------------------
340
340
  get radical() {
341
- return this.#t;
341
+ return this.#i;
342
342
  }
343
343
  set radical(e) {
344
- this.#t = e;
344
+ this.#i = e;
345
345
  }
346
346
  get nth() {
347
347
  return this.#e;
@@ -350,58 +350,58 @@ class X {
350
350
  Number.isSafeInteger(e) && e >= 2 ? this.#e = e : (console.log("Error setting the nth root"), this.#e = 2);
351
351
  }
352
352
  get coefficient() {
353
- return this.#i;
353
+ return this.#t;
354
354
  }
355
355
  set coefficient(e) {
356
- this.#i = e;
356
+ this.#t = e;
357
357
  }
358
358
  get tex() {
359
359
  let e;
360
- return this.#i === 1 ? e = "" : this.#i === -1 ? e = "-" : e = this.#i.toString(), this.#t === 1 ? `${this.#i}` : this.#e === 2 ? `${e}\\sqrt{${this.#t}}` : `${e}\\sqrt[${this.#e}]{${this.#t}}`;
360
+ return this.#t === 1 ? e = "" : this.#t === -1 ? e = "-" : e = this.#t.toString(), this.#i === 1 ? `${this.#t}` : this.#e === 2 ? `${e}\\sqrt{${this.#i}}` : `${e}\\sqrt[${this.#e}]{${this.#i}}`;
361
361
  }
362
362
  get display() {
363
363
  let e;
364
- return this.#i === 1 ? e = "" : this.#i === -1 ? e = "-" : e = this.#i.toString(), this.#t === 1 ? `${this.#i}` : this.#e === 2 ? `${e}sqrt{${this.#t}}` : `${e}root(${this.#e}){${this.#t}}`;
364
+ return this.#t === 1 ? e = "" : this.#t === -1 ? e = "-" : e = this.#t.toString(), this.#i === 1 ? `${this.#t}` : this.#e === 2 ? `${e}sqrt{${this.#i}}` : `${e}root(${this.#e}){${this.#i}}`;
365
365
  }
366
366
  get value() {
367
- return this.#i * Math.pow(this.#t, 1 / this.#e);
367
+ return this.#t * Math.pow(this.#i, 1 / this.#e);
368
368
  }
369
369
  // ------------------------------------------
370
370
  // Creation / parsing functions
371
371
  // ------------------------------------------
372
- parse = (e, t, i) => (this.#i = i ?? 1, this.#e = t ?? 2, this.#t = e, this.#e % 2 === 0 && this.#t < 0 && (this.#s = !1), this);
372
+ parse = (e, t, i) => (this.#t = i ?? 1, this.#e = t ?? 2, this.#i = e, this.#e % 2 === 0 && this.#i < 0 && (this.#s = !1), this);
373
373
  // ------------------------------------------
374
374
  // Mathematical operations
375
375
  // ------------------------------------------
376
376
  reduce = () => {
377
- let e = Math.floor(Math.pow(this.#t, 1 / this.#e));
377
+ let e = Math.floor(Math.pow(this.#i, 1 / this.#e));
378
378
  for (; e > 1; ) {
379
- if (this.#t % Math.pow(e, this.#e) === 0) {
380
- this.#i *= e, this.#t = this.#t / Math.pow(e, this.#e), e = Math.floor(Math.pow(this.#t, 1 / this.#e));
379
+ if (this.#i % Math.pow(e, this.#e) === 0) {
380
+ this.#t *= e, this.#i = this.#i / Math.pow(e, this.#e), e = Math.floor(Math.pow(this.#i, 1 / this.#e));
381
381
  continue;
382
382
  }
383
383
  e--;
384
384
  }
385
385
  return this;
386
386
  };
387
- multiply = (e) => (this.#t *= e.radical, this.reduce());
387
+ multiply = (e) => (this.#i *= e.radical, this.reduce());
388
388
  // ------------------------------------------
389
389
  // Help functions
390
390
  // ------------------------------------------
391
- hasRadical = () => !(this.#t === 1 || this.#t === 0 || !this.#s);
391
+ hasRadical = () => !(this.#i === 1 || this.#i === 0 || !this.#s);
392
392
  }
393
- class J {
394
- #t;
393
+ class W {
394
+ #i;
395
395
  #e;
396
396
  constructor(e, t, i = "x") {
397
397
  if (this.#e = i, Object.hasOwn(e, "moveLeft")) {
398
398
  const s = e;
399
- this.#t = s.left.clone().subtract(s.right);
399
+ this.#i = s.left.clone().subtract(s.right);
400
400
  } else
401
- this.#t = e.clone().subtract(t ?? 0);
401
+ this.#i = e.clone().subtract(t ?? 0);
402
402
  }
403
403
  solve() {
404
- const e = this.#t.degree().value;
404
+ const e = this.#i.degree().value;
405
405
  if (e === 0)
406
406
  return [];
407
407
  if (e === 1)
@@ -410,15 +410,15 @@ class J {
410
410
  return this.#u();
411
411
  const { solutions: t, polynom: i } = this.#a();
412
412
  return i.degree().isZero() ? t : t.concat(
413
- this.#r(i)
414
- ).sort((s, r) => s.value - r.value);
413
+ this.#n(i)
414
+ ).sort((s, n) => s.value - n.value);
415
415
  }
416
416
  solveAsCardan() {
417
- if (this.#t.degree().value !== 3)
417
+ if (this.#i.degree().value !== 3)
418
418
  throw new Error("The equation is not cubic.");
419
419
  return this.#c();
420
420
  }
421
- #i(e, t) {
421
+ #t(e, t) {
422
422
  return {
423
423
  variable: this.#e,
424
424
  exact: !1,
@@ -429,7 +429,7 @@ class J {
429
429
  }
430
430
  #s(e) {
431
431
  if (e instanceof a && e.isApproximative())
432
- return this.#i(e.value);
432
+ return this.#t(e.value);
433
433
  const t = new a(e);
434
434
  return {
435
435
  variable: this.#e,
@@ -439,24 +439,24 @@ class J {
439
439
  display: t.display
440
440
  };
441
441
  }
442
- #r(e) {
443
- const t = [], i = e.degree().value, s = e.getCoefficients().map((d) => d.value), [r, ...o] = e.getCoefficients(), h = 2 + Math.max(...o.map((d) => d.value / r.value)), l = this.#o(e, h, 100);
442
+ #n(e) {
443
+ const t = [], i = e.degree().value, s = e.getCoefficients().map((d) => d.value), [n, ...o] = e.getCoefficients(), h = 2 + Math.max(...o.map((d) => d.value / n.value)), l = this.#o(e, h, 100);
444
444
  return this.#h(l, i).forEach((d) => {
445
445
  const [m, w] = d;
446
446
  if (m === w)
447
447
  t.push(this.#s(m));
448
448
  else {
449
- const N = this.#n(e, s, m, w);
450
- N !== null && t.push(this.#i(N));
449
+ const N = this.#r(e, s, m, w);
450
+ N !== null && t.push(this.#t(N));
451
451
  }
452
452
  }), t;
453
453
  }
454
- #n(e, t, i, s, r = 1e-10) {
454
+ #r(e, t, i, s, n = 1e-10) {
455
455
  let o = e.evaluate(i, !0), h = e.evaluate(s, !0);
456
456
  if (o * h > 0)
457
457
  return console.log("Pas de racine dans l'intervalle donné"), null;
458
458
  let l;
459
- for (; (s - i) / 2 > r; ) {
459
+ for (; (s - i) / 2 > n; ) {
460
460
  l = (i + s) / 2;
461
461
  const c = e.evaluate(l, !0);
462
462
  if (c === 0)
@@ -466,8 +466,8 @@ class J {
466
466
  return (i + s) / 2;
467
467
  }
468
468
  #o(e, t, i) {
469
- const s = [], r = 2 * t / i;
470
- for (let o = -t; o <= t; o += r) {
469
+ const s = [], n = 2 * t / i;
470
+ for (let o = -t; o <= t; o += n) {
471
471
  const h = E.numberCorrection(o);
472
472
  s.push(
473
473
  {
@@ -481,22 +481,22 @@ class J {
481
481
  #h(e, t) {
482
482
  const i = [];
483
483
  for (let s = 1; s < e.length; s++) {
484
- const r = e[s], o = e[s - 1];
485
- if (r.fx === 0 ? i.push([r.x, r.x]) : r.fx * o.fx < 0 && i.push([o.x, r.x]), i.length === t)
484
+ const n = e[s], o = e[s - 1];
485
+ if (n.fx === 0 ? i.push([n.x, n.x]) : n.fx * o.fx < 0 && i.push([o.x, n.x]), i.length === t)
486
486
  return i;
487
487
  }
488
488
  return i;
489
489
  }
490
490
  #a() {
491
- const e = this.#t.clone(), t = [], i = e.lcmDenominator();
491
+ const e = this.#i.clone(), t = [], i = e.lcmDenominator();
492
492
  i !== 1 && e.multiply(i);
493
- const s = e.monomByDegree().coefficient, r = e.monomByDegree(0).coefficient;
494
- if (r.isZero()) {
493
+ const s = e.monomByDegree().coefficient, n = e.monomByDegree(0).coefficient;
494
+ if (n.isZero()) {
495
495
  t.push(this.#s(0));
496
496
  const m = e.monoms.reduce((N, A) => A.degree().value < N.degree().value ? A : N), w = m.coefficient;
497
497
  m.clone().divide(w), e.divide(m);
498
498
  }
499
- const o = E.dividers(s.value), h = E.dividers(r.value), l = [];
499
+ const o = E.dividers(s.value), h = E.dividers(n.value), l = [];
500
500
  for (const m of o)
501
501
  for (const w of h) {
502
502
  const N = new a(w, m);
@@ -517,110 +517,114 @@ class J {
517
517
  }
518
518
  if (e.degree().isZero() || e.degree().value > 3)
519
519
  return t.sort((m, w) => m.value - w.value), { solutions: t, polynom: e };
520
- const c = e.clone().zero(), d = new J(e, c, this.#e);
520
+ const c = e.clone().zero(), d = new W(e, c, this.#e);
521
521
  return {
522
522
  solutions: t.concat(d.solve()).sort((m, w) => m.value - w.value),
523
523
  polynom: c
524
524
  };
525
525
  }
526
526
  #c() {
527
- const e = this.#t, t = e.monomByDegree(3).coefficient, i = e.monomByDegree(2).coefficient, s = e.monomByDegree(1).coefficient, r = e.monomByDegree(0).coefficient, o = i.clone().divide(t), h = s.clone().divide(t), l = r.clone().divide(t), c = h.clone().subtract(o.clone().pow(2).divide(3)), d = l.clone().subtract(o.clone().multiply(h).divide(3)).add(o.clone().pow(3).multiply(2).divide(27)), m = d.clone().opposite(), w = c.clone().opposite().pow(3).divide(27), N = m.clone().pow(2).subtract(w.clone().multiply(4)).opposite();
527
+ const e = this.#i, t = e.monomByDegree(3).coefficient, i = e.monomByDegree(2).coefficient, s = e.monomByDegree(1).coefficient, n = e.monomByDegree(0).coefficient, o = i.clone().divide(t), h = s.clone().divide(t), l = n.clone().divide(t), c = h.clone().subtract(o.clone().pow(2).divide(3)), d = l.clone().subtract(o.clone().multiply(h).divide(3)).add(o.clone().pow(3).multiply(2).divide(27)), m = d.clone().opposite(), w = c.clone().opposite().pow(3).divide(27), N = m.clone().pow(2).subtract(w.clone().multiply(4)).opposite();
528
528
  if (N.isNegative()) {
529
- const A = d.clone().opposite().add(N.clone().opposite().sqrt()).divide(2).root(3), k = d.clone().opposite().subtract(N.clone().opposite().sqrt()).divide(2).root(3), z = A.clone().add(k).subtract(o.clone().divide(3));
530
- return [this.#s(z)];
529
+ const A = d.clone().opposite().add(N.clone().opposite().sqrt()).divide(2).root(3), C = d.clone().opposite().subtract(N.clone().opposite().sqrt()).divide(2).root(3), O = A.clone().add(C).subtract(o.clone().divide(3));
530
+ return [this.#s(O)];
531
531
  }
532
532
  if (N.isZero()) {
533
- const A = d.clone().opposite().divide(2).root(3), k = A.clone().opposite().subtract(o.clone().divide(3)), z = A.clone().multiply(2).subtract(o.clone().divide(3));
534
- return k.isEqual(z) ? [this.#s(k)] : [
535
- this.#s(z),
536
- this.#s(k)
533
+ const A = d.clone().opposite().divide(2).root(3), C = A.clone().opposite().subtract(o.clone().divide(3)), O = A.clone().multiply(2).subtract(o.clone().divide(3));
534
+ return C.isEqual(O) ? [this.#s(C)] : [
535
+ this.#s(O),
536
+ this.#s(C)
537
537
  ].sort((M, $) => M.value - $.value);
538
538
  }
539
539
  if (N.isPositive()) {
540
- const A = [], k = c.value, z = d.value, M = o.value;
540
+ const A = [], C = c.value, O = d.value, M = o.value;
541
541
  for (let $ = 0; $ < 3; $++)
542
- A.push(2 * Math.sqrt(-k / 3) * Math.cos(Math.acos(3 * z / (2 * k) * Math.sqrt(-3 / k)) / 3 + 2 * Math.PI * $ / 3) - M / 3);
543
- return A.map(($) => this.#i($)).sort(($, V) => $.value - V.value);
542
+ A.push(2 * Math.sqrt(-C / 3) * Math.cos(Math.acos(3 * O / (2 * C) * Math.sqrt(-3 / C)) / 3 + 2 * Math.PI * $ / 3) - M / 3);
543
+ return A.map(($) => this.#t($)).sort(($, S) => $.value - S.value);
544
544
  }
545
545
  return [];
546
546
  }
547
547
  #l() {
548
- const [e, t] = this.#t.getCoefficients(), i = t.opposite().divide(e);
548
+ const [e, t] = this.#i.getCoefficients(), i = t.opposite().divide(e);
549
549
  return [
550
550
  this.#s(i)
551
551
  ];
552
552
  }
553
553
  #u() {
554
- const e = this.#t;
554
+ const e = this.#i;
555
555
  e.monomByDegree().coefficient.isNegative() && e.opposite();
556
- const [t, i, s] = e.getCoefficients(), r = i.clone().pow(2).subtract(t.clone().multiply(s).multiply(4));
557
- if (r.isNegative())
556
+ const [t, i, s] = e.getCoefficients(), n = i.clone().pow(2).subtract(t.clone().multiply(s).multiply(4));
557
+ if (n.isNegative())
558
558
  return [];
559
- if (r.isSquare()) {
560
- const o = r.sqrt(), h = i.clone().opposite().subtract(o).divide(t.clone().multiply(2)), l = i.clone().opposite().add(o).divide(t.clone().multiply(2));
559
+ if (n.isSquare()) {
560
+ const o = n.sqrt(), h = i.clone().opposite().subtract(o).divide(t.clone().multiply(2)), l = i.clone().opposite().add(o).divide(t.clone().multiply(2));
561
561
  return o.isZero() ? [this.#s(h)] : [
562
562
  this.#s(h),
563
563
  this.#s(l)
564
564
  ].sort((c, d) => c.value - d.value);
565
565
  }
566
- return this.#f(t, i, r);
566
+ return this.#f(t, i, n);
567
567
  }
568
568
  #f(e, t, i) {
569
- const s = E.dividers(i.value).filter((M) => Math.sqrt(M) % 1 === 0).map((M) => Math.sqrt(M)).pop() ?? 1, r = E.gcd(2 * e.value, t.value, s) * (e.isNegative() ? -1 : 1), o = t.clone().divide(r).opposite(), h = e.clone().divide(r).multiply(2), l = i.clone().divide(s ** 2), c = Math.abs(s / r), d = s === 1 ? "-" : `-${c} `, m = s === 1 ? "+" : `+${c} `;
570
- function w(M, $, V, te) {
571
- return `\\frac{ ${$} ${V}\\sqrt{ ${te} } }{ ${M} }`;
569
+ const s = E.dividers(i.value).filter((O) => Math.sqrt(O) % 1 === 0).map((O) => Math.sqrt(O)).pop() ?? 1, n = E.gcd(2 * e.value, t.value, s) * (e.isNegative() ? -1 : 1), o = t.clone().divide(n).opposite(), h = e.clone().divide(n).multiply(2), l = Math.abs(s / n), c = `${s === 1 ? "" : l + " "}\\sqrt{ ${i.clone().divide(s ** 2).tex} }`, d = `${s === 1 ? "" : l}sqrt(${i.clone().divide(s ** 2).display})`;
570
+ function m(O, M, $, S) {
571
+ const R = M === "0" ? "" : M, P = $ === "-" || R !== "" ? ` ${$} ` : "";
572
+ return O === "1" ? `${R}${P}${S}` : `\\frac{ ${P}${P}${S} }{ ${O} }`;
572
573
  }
573
- function N(M, $, V, te) {
574
- return `(${$}${V}sqrt(${te}))/${M}`;
574
+ function w(O, M, $, S) {
575
+ const R = M === "0" ? "" : M, P = $ === "-" || R !== "" ? $ : "";
576
+ return O === "1" ? `${R}${P}${S}` : `(${R}${P}${S})/${O}`;
575
577
  }
576
- const A = i.value ** 0.5, k = (-t.value - A) / (2 * e.value), z = (-t.value + A) / (2 * e.value);
578
+ const N = i.value ** 0.5, A = (-t.value - N) / (2 * e.value), C = (-t.value + N) / (2 * e.value);
577
579
  return [
578
- this.#i(
579
- k,
580
+ this.#t(
581
+ A,
580
582
  {
581
- tex: w(h.tex, o.tex, d, l.tex),
582
- display: N(h.display, o.display, d, l.display)
583
+ tex: m(h.tex, o.tex, "-", c),
584
+ display: w(h.display, o.display, "-", d)
583
585
  }
584
586
  ),
585
- this.#i(
586
- z,
587
+ this.#t(
588
+ C,
587
589
  {
588
- tex: w(h.tex, o.tex, m, l.tex),
589
- display: N(h.display, o.display, m, l.display)
590
+ tex: m(h.tex, o.tex, "+", c),
591
+ display: w(h.display, o.display, "+", d)
590
592
  }
591
593
  )
592
- ].sort((M, $) => M.value - $.value);
594
+ ].sort((O, M) => O.value - M.value);
593
595
  }
594
596
  }
595
- var Ce = Object.defineProperty, ue = (n) => {
596
- throw TypeError(n);
597
- }, ke = (n, e, t) => e in n ? Ce(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, ie = (n, e, t) => ke(n, typeof e != "symbol" ? e + "" : e, t), fe = (n, e, t) => e.has(n) || ue("Cannot " + t), O = (n, e, t) => (fe(n, e, "read from private field"), t ? t.call(n) : e.get(n)), j = (n, e, t) => e.has(n) ? ue("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(n) : e.set(n, t), S = (n, e, t, i) => (fe(n, e, "write to private field"), e.set(n, t), t);
598
- const oe = {
597
+ const J = {
599
598
  pi: Math.PI,
600
599
  e: Math.exp(1)
601
600
  };
602
- var f = /* @__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))(f || {}), D = /* @__PURE__ */ ((n) => (n.EXPRESSION = "expression", n.POLYNOM = "polynom", n.SET = "set", n.NUMERIC = "numeric", n))(D || {});
603
- function $e(n, e) {
604
- if (n.length <= 1)
605
- return n;
601
+ var f = /* @__PURE__ */ ((r) => (r.VARIABLE = "variable", r.COEFFICIENT = "coefficient", r.OPERATION = "operation", r.CONSTANT = "constant", r.FUNCTION = "function", r.FUNCTION_ARGUMENT = "function-argument", r.MONOM = "monom", r.LEFT_PARENTHESIS = "(", r.RIGHT_PARENTHESIS = ")", r))(f || {}), z = /* @__PURE__ */ ((r) => (r.EXPRESSION = "expression", r.POLYNOM = "polynom", r.SET = "set", r.NUMERIC = "numeric", r))(z || {});
602
+ function ye(r, e) {
603
+ if (r.length <= 1)
604
+ return r;
606
605
  const t = Object.keys(e).filter((m) => e[m].type === f.FUNCTION).map((m) => m);
607
606
  t.sort((m, w) => w.length - m.length);
608
- const i = new RegExp(`^(${t.join("|")})\\(`), s = Object.keys(oe);
607
+ const i = new RegExp(`^(${t.join("|")})\\(`), s = Object.keys(J);
609
608
  s.sort((m, w) => w.length - m.length);
610
- const r = new RegExp(`^(${s.join("|")})`), o = /^(\d+(\.\d+)?)/;
609
+ const n = new RegExp(`^(${s.join("|")})`), o = /^(\d+(\.\d+)?)/;
611
610
  let h = "", l, c, d;
612
- for (; n.length > 0; ) {
613
- if (l = c, d = void 0, t.length > 0 && i.exec(n)) {
614
- const m = t.find((w) => n.startsWith(w));
615
- m && (d = m + "(", n = n.slice(m.length + 1), c = f.FUNCTION);
616
- } else if (s.length > 0 && r.exec(n)) {
617
- const m = s.find((w) => n.startsWith(w));
618
- m && (d = m, n = n.slice(m.length), c = f.CONSTANT);
619
- } else if (o.exec(n)) {
620
- const m = o.exec(n);
621
- m && (d = m[0], n = n.slice(m[0].length), c = f.COEFFICIENT);
611
+ for (t.forEach((m) => {
612
+ if (r.includes(m)) {
613
+ const w = new RegExp(`${m}([0-9.]+)`, "g");
614
+ r = r.replaceAll(w, `${m}($1)`);
615
+ }
616
+ }); r.length > 0; ) {
617
+ if (l = c, d = void 0, t.length > 0 && i.exec(r)) {
618
+ const m = t.find((w) => r.startsWith(w));
619
+ m && (d = m + "(", r = r.slice(m.length + 1), c = f.FUNCTION);
620
+ } else if (s.length > 0 && n.exec(r)) {
621
+ const m = s.find((w) => r.startsWith(w));
622
+ m && (d = m, r = r.slice(m.length), c = f.CONSTANT);
623
+ } else if (o.exec(r)) {
624
+ const m = o.exec(r);
625
+ m && (d = m[0], r = r.slice(m[0].length), c = f.COEFFICIENT);
622
626
  } else
623
- switch (d = n[0], n = n.slice(1), d) {
627
+ switch (d = r[0], r = r.slice(1), d) {
624
628
  case "(":
625
629
  c = f.LEFT_PARENTHESIS;
626
630
  break;
@@ -642,20 +646,20 @@ function $e(n, e) {
642
646
  }
643
647
  if (d === void 0 || c === void 0)
644
648
  throw new Error("The token is undefined");
645
- h += Be(l, c), h += d;
649
+ h += ve(l, c), h += d;
646
650
  }
647
651
  return h;
648
652
  }
649
- function Be(n, e) {
650
- return n === void 0 || n === f.OPERATION || e === f.OPERATION || n === f.LEFT_PARENTHESIS || n === f.FUNCTION || n === f.FUNCTION_ARGUMENT || e === f.RIGHT_PARENTHESIS || e === f.FUNCTION_ARGUMENT ? "" : "*";
653
+ function ve(r, e) {
654
+ return r === void 0 || r === f.OPERATION || e === f.OPERATION || r === f.LEFT_PARENTHESIS || r === f.FUNCTION || r === f.FUNCTION_ARGUMENT || e === f.RIGHT_PARENTHESIS || e === f.FUNCTION_ARGUMENT ? "" : "*";
651
655
  }
652
- const Me = {
656
+ const be = {
653
657
  "^": { precedence: 4, associative: "right", type: f.OPERATION },
654
658
  "*": { precedence: 3, associative: "left", type: f.OPERATION },
655
659
  "/": { precedence: 3, associative: "left", type: f.OPERATION },
656
660
  "+": { precedence: 2, associative: "left", type: f.OPERATION },
657
661
  "-": { precedence: 2, associative: "left", type: f.OPERATION }
658
- }, Ie = {
662
+ }, xe = {
659
663
  "^": { precedence: 4, associative: "right", type: f.OPERATION },
660
664
  "*": { precedence: 3, associative: "left", type: f.OPERATION },
661
665
  "/": { precedence: 3, associative: "left", type: f.OPERATION },
@@ -668,7 +672,7 @@ const Me = {
668
672
  sqrt: { precedence: 4, associative: "right", type: f.FUNCTION },
669
673
  nthrt: { precedence: 4, associative: "right", type: f.FUNCTION },
670
674
  ",": { precedence: 2, associative: "left", type: f.FUNCTION_ARGUMENT }
671
- }, Se = {
675
+ }, Ee = {
672
676
  "^": { precedence: 4, associative: "right", type: f.OPERATION },
673
677
  "*": { precedence: 3, associative: "left", type: f.OPERATION },
674
678
  "/": { precedence: 3, associative: "left", type: f.OPERATION },
@@ -682,26 +686,30 @@ const Me = {
682
686
  nthrt: { precedence: 4, associative: "right", type: f.FUNCTION },
683
687
  ln: { precedence: 4, associative: "right", type: f.FUNCTION },
684
688
  log: { precedence: 4, associative: "right", type: f.FUNCTION }
685
- }, ze = {
689
+ }, Ne = {
686
690
  "&": { precedence: 3, associative: "left", type: f.OPERATION },
687
691
  "|": { precedence: 3, associative: "left", type: f.OPERATION },
688
692
  "!": { precedence: 4, associative: "right", type: f.OPERATION },
689
693
  "-": { precedence: 2, associative: "left", type: f.OPERATION }
690
694
  };
691
- var L, F, C, Y, R;
692
- class _ {
695
+ class X {
696
+ #i;
697
+ #e = [];
698
+ #t = {};
699
+ #s = [];
700
+ #n;
693
701
  constructor(e) {
694
- j(this, L), j(this, F, []), j(this, C, {}), j(this, Y, []), j(this, R), S(this, L, typeof e > "u" ? D.POLYNOM : e), this.tokenConfigInitialization();
702
+ this.#i = typeof e > "u" ? z.POLYNOM : e, this.tokenConfigInitialization();
695
703
  }
696
704
  // Getter
697
705
  get rpn() {
698
- return O(this, F);
706
+ return this.#e;
699
707
  }
700
708
  get rpnToken() {
701
- return O(this, F).map((e) => e.token);
709
+ return this.#e.map((e) => e.token);
702
710
  }
703
711
  tokenConfigInitialization() {
704
- return O(this, L) === D.SET ? (S(this, C, ze), S(this, R, !1)) : O(this, L) === D.NUMERIC ? (S(this, C, Se), S(this, R, !0)) : O(this, L) === D.EXPRESSION ? (S(this, C, Ie), S(this, R, !0)) : (S(this, C, Me), S(this, R, !0)), S(this, Y, Object.keys(O(this, C)).sort((e, t) => t.length - e.length)), O(this, C);
712
+ return this.#i === z.SET ? (this.#t = Ne, this.#n = !1) : this.#i === z.NUMERIC ? (this.#t = Ee, this.#n = !0) : this.#i === z.EXPRESSION ? (this.#t = xe, this.#n = !0) : (this.#t = be, this.#n = !0), this.#s = Object.keys(this.#t).sort((e, t) => t.length - e.length), this.#t;
705
713
  }
706
714
  /**
707
715
  * Get the next token to analyse.
@@ -717,23 +725,23 @@ class _ {
717
725
  else if (e[t] === ",")
718
726
  i = ",", s = f.FUNCTION_ARGUMENT;
719
727
  else {
720
- for (const r of O(this, Y))
721
- if (e.substring(t, t + r.length) === r) {
722
- i += r, s = O(this, C)[r].type;
728
+ for (const n of this.#s)
729
+ if (e.substring(t, t + n.length) === n) {
730
+ i += n, s = this.#t[n].type;
723
731
  break;
724
732
  }
725
- for (const r in oe)
726
- if (e.substring(t, t + r.length) === r) {
727
- i += r, s = f.CONSTANT;
733
+ for (const n in J)
734
+ if (e.substring(t, t + n.length) === n) {
735
+ i += n, s = f.CONSTANT;
728
736
  break;
729
737
  }
730
738
  if (i === "")
731
739
  if (/[0-9.]/.exec(e[t])) {
732
- const r = /^([0-9.]+)/.exec(e.substring(t));
733
- i = r ? r[0] : "", s = f.COEFFICIENT;
740
+ const n = /^([0-9.]+)/.exec(e.substring(t));
741
+ i = n ? n[0] : "", s = f.COEFFICIENT;
734
742
  } else if (/[a-zA-Z]/.exec(e[t])) {
735
- const r = /^([a-zA-Z])/.exec(e.substring(t));
736
- i = r ? r[0] : "", s = f.VARIABLE;
743
+ const n = /^([a-zA-Z])/.exec(e.substring(t));
744
+ i = n ? n[0] : "", s = f.VARIABLE;
737
745
  } else
738
746
  console.log("Unidentified token", e[t], e, t), i = e[t], s = f.MONOM;
739
747
  }
@@ -749,30 +757,30 @@ class _ {
749
757
  */
750
758
  parse(e, t) {
751
759
  const i = [], s = [];
752
- let r = "", o = 0, h;
753
- (t ?? O(this, R)) && (e = $e(e, O(this, C)));
760
+ let n = "", o = 0, h;
761
+ (t ?? this.#n) && (e = ye(e, this.#t));
754
762
  let l = 50, c;
755
763
  for (; o < e.length; ) {
756
764
  if (l--, l === 0) {
757
765
  console.log("SECURITY LEVEL 1 EXIT");
758
766
  break;
759
767
  }
760
- switch ([r, o, h] = this.NextToken(e, o), h) {
768
+ switch ([n, o, h] = this.NextToken(e, o), h) {
761
769
  case f.MONOM:
762
770
  case f.COEFFICIENT:
763
771
  case f.VARIABLE:
764
772
  case f.CONSTANT:
765
773
  i.push({
766
- token: r,
774
+ token: n,
767
775
  tokenType: h
768
776
  });
769
777
  break;
770
778
  case f.OPERATION:
771
779
  if (s.length > 0) {
772
780
  let d = s[s.length - 1];
773
- for (c = 50; d.token in O(this, C) && //either o1 is left-associative and its precedence is less than or equal to that of o2,
774
- (O(this, C)[r].associative === "left" && O(this, C)[r].precedence <= O(this, C)[d.token].precedence || //or o1 is right associative, and has precedence less than that of o2,
775
- O(this, C)[r].associative === "right" && O(this, C)[r].precedence < O(this, C)[d.token].precedence); ) {
781
+ for (c = 50; d.token in this.#t && //either o1 is left-associative and its precedence is less than or equal to that of o2,
782
+ (this.#t[n].associative === "left" && this.#t[n].precedence <= this.#t[d.token].precedence || //or o1 is right associative, and has precedence less than that of o2,
783
+ this.#t[n].associative === "right" && this.#t[n].precedence < this.#t[d.token].precedence); ) {
776
784
  if (c--, c === 0) {
777
785
  console.log("SECURITY LEVEL 2 OPERATION EXIT");
778
786
  break;
@@ -782,7 +790,7 @@ class _ {
782
790
  d = s[s.length - 1];
783
791
  }
784
792
  }
785
- s.push({ token: r, tokenType: h });
793
+ s.push({ token: n, tokenType: h });
786
794
  break;
787
795
  case f.FUNCTION_ARGUMENT:
788
796
  for (c = 50; s[s.length - 1].token !== "(" && s.length > 0; ) {
@@ -790,11 +798,11 @@ class _ {
790
798
  console.log("SECURITY LEVEL 2 FUNCTION ARGUMENT EXIT");
791
799
  break;
792
800
  }
793
- i.push(s.pop() ?? { token: r, tokenType: h });
801
+ i.push(s.pop() ?? { token: n, tokenType: h });
794
802
  }
795
803
  break;
796
804
  case f.LEFT_PARENTHESIS:
797
- s.push({ token: r, tokenType: h }), e[o] === "-" && i.push({ token: "0", tokenType: f.COEFFICIENT });
805
+ s.push({ token: n, tokenType: h }), e[o] === "-" && i.push({ token: "0", tokenType: f.COEFFICIENT });
798
806
  break;
799
807
  case f.RIGHT_PARENTHESIS:
800
808
  for (c = 50; s[s.length - 1].token !== "(" && s.length > 1; ) {
@@ -802,28 +810,30 @@ class _ {
802
810
  console.log("SECURITY LEVEL 2 CLOSING PARENTHESIS EXIT");
803
811
  break;
804
812
  }
805
- i.push(s.pop() ?? { token: r, tokenType: h });
813
+ i.push(s.pop() ?? { token: n, tokenType: h });
806
814
  }
807
815
  s.pop();
808
816
  break;
809
817
  case f.FUNCTION:
810
- s.push({ token: r, tokenType: h });
818
+ s.push({ token: n, tokenType: h });
811
819
  break;
812
820
  default:
813
- throw new Error(`Token type ${r} is not handled`);
821
+ throw new Error(`Token type ${n} is not handled`);
814
822
  }
815
823
  }
816
- return S(this, F, i.concat(s.reverse())), this;
824
+ return this.#e = i.concat(s.reverse()), this;
817
825
  }
818
826
  }
819
- L = /* @__PURE__ */ new WeakMap(), F = /* @__PURE__ */ new WeakMap(), C = /* @__PURE__ */ new WeakMap(), Y = /* @__PURE__ */ new WeakMap(), R = /* @__PURE__ */ new WeakMap();
820
- class Re {
827
+ class Ae {
828
+ _rpn;
829
+ _expression;
830
+ _isValid;
821
831
  constructor(e, t) {
822
- ie(this, "_rpn"), ie(this, "_expression"), ie(this, "_isValid"), this._expression = e;
832
+ this._expression = e;
823
833
  try {
824
- this._rpn = new _(D.NUMERIC).parse(e, t).rpn;
825
- } catch {
826
- throw this._rpn = null, this._isValid = !1, new Error(`There was a problem parsing: ${e}`);
834
+ this._rpn = new X(z.NUMERIC).parse(e, t).rpn;
835
+ } catch (i) {
836
+ throw this._rpn = null, this._isValid = !1, console.warn(i), new Error(`There was a problem parsing: ${e}`);
827
837
  }
828
838
  }
829
839
  get rpn() {
@@ -862,33 +872,33 @@ class Re {
862
872
  else if (i.tokenType === f.VARIABLE && e !== void 0)
863
873
  Object.hasOwn(e, i.token) && t.push(+e[i.token]);
864
874
  else if (i.tokenType === f.CONSTANT)
865
- t.push(oe[i.token]);
875
+ t.push(J[i.token]);
866
876
  else if (i.tokenType === f.OPERATION) {
867
877
  if (i.token === "*") {
868
- const s = t.pop(), r = t.pop();
869
- if (r === void 0 || s === void 0)
870
- throw this._isValid = !1, new Error(`The multiplication factors ${r ?? "a"} or ${s ?? "b"} are not defined`);
871
- t.push(r * s);
878
+ const s = t.pop(), n = t.pop();
879
+ if (n === void 0 || s === void 0)
880
+ throw this._isValid = !1, new Error(`The multiplication factors ${n ?? "a"} or ${s ?? "b"} are not defined`);
881
+ t.push(n * s);
872
882
  } else if (i.token === "/") {
873
- const s = t.pop(), r = t.pop();
874
- if (r === void 0 || s === void 0)
875
- throw this._isValid = !1, new Error(`The division values ${r ?? "a"} or ${s ?? "b"} are not defined`);
876
- t.push(r / s);
883
+ const s = t.pop(), n = t.pop();
884
+ if (n === void 0 || s === void 0)
885
+ throw this._isValid = !1, new Error(`The division values ${n ?? "a"} or ${s ?? "b"} are not defined`);
886
+ t.push(n / s);
877
887
  } else if (i.token === "+") {
878
- const s = t.pop(), r = t.pop();
879
- if (r === void 0 || s === void 0)
880
- throw this._isValid = !1, new Error(`The addition values ${r ?? "a"} or ${s ?? "b"} are not defined`);
881
- t.push(+r + +s);
888
+ const s = t.pop(), n = t.pop();
889
+ if (n === void 0 || s === void 0)
890
+ throw this._isValid = !1, new Error(`The addition values ${n ?? "a"} or ${s ?? "b"} are not defined`);
891
+ t.push(+n + +s);
882
892
  } else if (i.token === "-") {
883
- const s = t.pop(), r = t.pop() ?? 0;
893
+ const s = t.pop(), n = t.pop() ?? 0;
884
894
  if (s === void 0)
885
895
  throw this._isValid = !1, new Error("The subtraction value b is not defined");
886
- t.push(r - s);
896
+ t.push(n - s);
887
897
  } else if (i.token === "^") {
888
- const s = t.pop(), r = t.pop();
889
- if (r === void 0 || s === void 0)
890
- throw this._isValid = !1, new Error(`The base value ${r ?? "a"} or exponent ${s ?? "b"} are not defined`);
891
- t.push(Math.pow(r, s));
898
+ const s = t.pop(), n = t.pop();
899
+ if (n === void 0 || s === void 0)
900
+ throw this._isValid = !1, new Error(`The base value ${n ?? "a"} or exponent ${s ?? "b"} are not defined`);
901
+ t.push(Math.pow(n, s));
892
902
  }
893
903
  } else if (i.tokenType === f.FUNCTION) {
894
904
  const s = t.pop();
@@ -903,10 +913,10 @@ class Re {
903
913
  else if (i.token === "sqrt")
904
914
  t.push(Math.sqrt(s));
905
915
  else if (i.token === "nthrt") {
906
- const r = t.pop();
907
- if (r === void 0)
916
+ const n = t.pop();
917
+ if (n === void 0)
908
918
  throw this._isValid = !1, new Error("The nthrt function requires two parameters");
909
- s % 2 === 0 && r < 0 ? t.push(NaN) : t.push((r < 0 ? -1 : 1) * Math.pow(Math.abs(r), 1 / s));
919
+ s % 2 === 0 && n < 0 ? t.push(NaN) : t.push((n < 0 ? -1 : 1) * Math.pow(Math.abs(n), 1 / s));
910
920
  } else i.token === "ln" ? t.push(Math.log(s)) : i.token === "log" && t.push(Math.log10(s));
911
921
  }
912
922
  if (t.length === 1)
@@ -918,10 +928,10 @@ class Re {
918
928
  }
919
929
  }
920
930
  class p {
921
- #t;
931
+ #i;
922
932
  #e;
923
933
  constructor(e) {
924
- return this.#t = new a().zero(), this.#e = {}, e !== void 0 && this.parse(e), this;
934
+ return this.#i = new a().zero(), this.#e = {}, e !== void 0 && this.parse(e), this;
925
935
  }
926
936
  // -----------------------------------------
927
937
  /**
@@ -929,14 +939,14 @@ class p {
929
939
  * @param inputStr
930
940
  */
931
941
  parse(e) {
932
- return this.#t = new a(), this.#e = {}, typeof e == "string" ? isNaN(Number(e)) ? this.#r(e) : this.#t = new a(Number(e)) : typeof e == "number" ? this.#t = new a(e) : e instanceof a ? this.#t = e.clone() : e instanceof p && (this.#t = e.#t.clone(), this.#i(e)), this;
942
+ return this.#i = new a(), this.#e = {}, typeof e == "string" ? isNaN(Number(e)) ? this.#n(e) : this.#i = new a(Number(e)) : typeof e == "number" ? this.#i = new a(e) : e instanceof a ? this.#i = e.clone() : e instanceof p && (this.#i = e.#i.clone(), this.#t(e)), this;
933
943
  }
934
944
  /**
935
945
  * Clone the current Monom.
936
946
  */
937
947
  clone = () => {
938
948
  const e = new p();
939
- e.coefficient = this.#t.clone();
949
+ e.coefficient = this.#i.clone();
940
950
  for (const t in this.#e)
941
951
  e.setLetter(t, this.#e[t].clone());
942
952
  return e;
@@ -949,7 +959,7 @@ class p {
949
959
  const t = Object.keys(this.#e).sort();
950
960
  for (const i of t)
951
961
  this.#e[i].isNotZero() && (e += i, this.#e[i].isNotEqual(1) && (e += `^{ ${this.#e[i].tfrac.tex} }`));
952
- return e === "" ? this.#t.value != 0 ? this.#t.frac.tex : "0" : this.#t.value === 1 ? e : this.#t.value === -1 ? `-${e}` : this.#t.value === 0 ? "0" : `${this.#t.frac.tex}${e}`;
962
+ return e === "" ? this.#i.value != 0 ? this.#i.frac.tex : "0" : this.#i.value === 1 ? e : this.#i.value === -1 ? `-${e}` : this.#i.value === 0 ? "0" : `${this.#i.frac.tex}${e}`;
953
963
  }
954
964
  // Display getter
955
965
  /**
@@ -960,19 +970,19 @@ class p {
960
970
  const t = Object.keys(this.#e).sort();
961
971
  for (const i of t)
962
972
  this.#e[i].isNotZero() && (e += i, this.#e[i].isNotEqual(1) && (e += `^(${this.#e[i].display})`));
963
- return e === "" ? this.#t.value != 0 ? this.#t.display : "" : this.#t.value === 1 ? e : this.#t.value === -1 ? `-${e}` : this.#t.value === 0 ? "0" : `${this.#t.display}${e}`;
973
+ return e === "" ? this.#i.value != 0 ? this.#i.display : "" : this.#i.value === 1 ? e : this.#i.value === -1 ? `-${e}` : this.#i.value === 0 ? "0" : `${this.#i.display}${e}`;
964
974
  }
965
975
  static gcd = (...e) => {
966
- for (const r of e)
967
- if (r.containsRationalPower())
976
+ for (const n of e)
977
+ if (n.containsRationalPower())
968
978
  return new p().zero();
969
- const t = new p(), i = E.gcd(...e.map((r) => r.coefficient.numerator)), s = E.lcm(...e.map((r) => r.coefficient.denominator));
979
+ const t = new p(), i = E.gcd(...e.map((n) => n.coefficient.numerator)), s = E.lcm(...e.map((n) => n.coefficient.denominator));
970
980
  t.coefficient = new a(i, s).reduce();
971
- for (const r of e) {
981
+ for (const n of e) {
972
982
  for (const o in t.literal)
973
- o in r.literal || t.literal[o].zero();
974
- for (const o in r.literal)
975
- !t.hasVariable(o) && r.literal[o].isStrictlyPositive() ? t.literal[o] = r.literal[o].clone() : t.literal[o] = new a(Math.min(r.literal[o].value, t.literal[o].value));
983
+ o in n.literal || t.literal[o].zero();
984
+ for (const o in n.literal)
985
+ !t.hasVariable(o) && n.literal[o].isStrictlyPositive() ? t.literal[o] = n.literal[o].clone() : t.literal[o] = new a(Math.min(n.literal[o].value, t.literal[o].value));
976
986
  }
977
987
  return t;
978
988
  };
@@ -993,7 +1003,7 @@ class p {
993
1003
  add = (...e) => {
994
1004
  for (const t of e) {
995
1005
  const i = t instanceof p ? t : new p(t);
996
- this.isSameAs(i) ? (this.isZero() && this.#i(i), this.#t.add(i.coefficient)) : console.log("Add monom: " + this.display + " is not similar with ", i.display);
1006
+ this.isSameAs(i) ? (this.isZero() && this.#t(i), this.#i.add(i.coefficient)) : console.log("Add monom: " + this.display + " is not similar with ", i.display);
997
1007
  }
998
1008
  return this;
999
1009
  };
@@ -1002,14 +1012,14 @@ class p {
1002
1012
  * @returns {Fraction}
1003
1013
  */
1004
1014
  get coefficient() {
1005
- return this.#t;
1015
+ return this.#i;
1006
1016
  }
1007
1017
  /**
1008
1018
  * Set the coefficient \\(k\\) value of the monom
1009
1019
  * @param {Fraction | number | string} F
1010
1020
  */
1011
1021
  set coefficient(e) {
1012
- this.#t = new a(e);
1022
+ this.#i = new a(e);
1013
1023
  }
1014
1024
  containsRationalPower = () => Object.values(this.#e).some((e) => e.isRational());
1015
1025
  /**
@@ -1024,7 +1034,7 @@ class p {
1024
1034
  derivative = (e) => {
1025
1035
  if (e === void 0 && (e = "x"), this.hasVariable(e)) {
1026
1036
  const t = this.#e[e].clone(), i = this.clone();
1027
- return i.#e[e].subtract(1), i.#t.multiply(new a(t.clone())), i;
1037
+ return i.#e[e].subtract(1), i.#i.multiply(new a(t.clone())), i;
1028
1038
  } else
1029
1039
  return new p().zero();
1030
1040
  };
@@ -1035,7 +1045,7 @@ class p {
1035
1045
  divide = (...e) => {
1036
1046
  for (const t of e) {
1037
1047
  const i = t instanceof p ? t : new p(t);
1038
- this.#t.divide(i.coefficient);
1048
+ this.#i.divide(i.coefficient);
1039
1049
  for (const s in i.literal)
1040
1050
  this.#e[s] = this.hasVariable(s) ? this.#e[s].subtract(i.literal[s]) : i.literal[s].clone().opposite(), this.#e[s].isZero() && this.removeVariable(s);
1041
1051
  }
@@ -1055,19 +1065,19 @@ class p {
1055
1065
  const i = [];
1056
1066
  if (t.length > 0 && e.length > 0)
1057
1067
  for (const s of e)
1058
- for (const r of t) {
1068
+ for (const n of t) {
1059
1069
  const o = new p();
1060
- o.coefficient = new a(s), o.literal = r, i.push(o);
1070
+ o.coefficient = new a(s), o.literal = n, i.push(o);
1061
1071
  }
1062
1072
  else if (e.length === 0)
1063
1073
  for (const s of t) {
1064
- const r = new p();
1065
- r.coefficient = new a().one(), r.literal = s, i.push(r);
1074
+ const n = new p();
1075
+ n.coefficient = new a().one(), n.literal = s, i.push(n);
1066
1076
  }
1067
1077
  else
1068
1078
  for (const s of e) {
1069
- const r = new p();
1070
- r.coefficient = new a(s), i.push(r);
1079
+ const n = new p();
1080
+ n.coefficient = new a(s), i.push(n);
1071
1081
  }
1072
1082
  return i.length === 0 ? [new p().one()] : i;
1073
1083
  }
@@ -1080,14 +1090,14 @@ class p {
1080
1090
  if (t === !0) {
1081
1091
  if (e instanceof a)
1082
1092
  return this.#s(e.value);
1083
- if (e instanceof X)
1093
+ if (e instanceof j)
1084
1094
  return new a().invalid();
1085
1095
  if (typeof e == "number")
1086
1096
  return this.#s(e);
1087
1097
  if (typeof e == "object") {
1088
1098
  const s = {};
1089
- for (const r in e)
1090
- s[r] = new a(e[r]).value;
1099
+ for (const n in e)
1100
+ s[n] = new a(e[n]).value;
1091
1101
  return this.#s(s);
1092
1102
  }
1093
1103
  }
@@ -1096,14 +1106,14 @@ class p {
1096
1106
  const s = {};
1097
1107
  return s[this.variables[0]] = new a(e), this.evaluate(s);
1098
1108
  }
1099
- if (e instanceof X)
1109
+ if (e instanceof j)
1100
1110
  return new a().invalid();
1101
1111
  if (typeof e == "object") {
1102
1112
  if (this.variables.length === 0)
1103
1113
  return this.coefficient;
1104
1114
  for (const s in this.#e) {
1105
- const r = new a(e[s]);
1106
- i.multiply(r.pow(this.#e[s]));
1115
+ const n = new a(e[s]);
1116
+ i.multiply(n.pow(this.#e[s]));
1107
1117
  }
1108
1118
  }
1109
1119
  return i;
@@ -1119,7 +1129,7 @@ class p {
1119
1129
  return s.evaluate(t).subtract(s.evaluate(e));
1120
1130
  }
1121
1131
  inverse = () => {
1122
- this.#t.opposite();
1132
+ this.#i.opposite();
1123
1133
  for (const e in this.#e)
1124
1134
  this.#e[e].opposite();
1125
1135
  return this;
@@ -1136,7 +1146,7 @@ class p {
1136
1146
  * Determine if two monoms are equals
1137
1147
  * @param M
1138
1148
  */
1139
- isEqual = (e) => this.isSameAs(e) && this.#t.isEqual(e.coefficient);
1149
+ isEqual = (e) => this.isSameAs(e) && this.#i.isEqual(e.coefficient);
1140
1150
  isLiteralSquare = () => {
1141
1151
  for (const e in this.literal)
1142
1152
  if (this.literal[e].isRational() || this.literal[e].isEven())
@@ -1146,20 +1156,20 @@ class p {
1146
1156
  /**
1147
1157
  * Determine if the monom is one
1148
1158
  */
1149
- isOne = () => this.#t.value === 1 && this.variables.length === 0;
1159
+ isOne = () => this.#i.value === 1 && this.variables.length === 0;
1150
1160
  /**
1151
1161
  * Determine if two monoms are similar
1152
1162
  * @param M
1153
1163
  */
1154
1164
  isSameAs = (e) => {
1155
- const t = this.variables, i = e.variables, s = t.concat(i.filter((r) => !t.includes(r)));
1165
+ const t = this.variables, i = e.variables, s = t.concat(i.filter((n) => !t.includes(n)));
1156
1166
  if (this.isZero() || e.isZero() || t.length === 0 && i.length === 0)
1157
1167
  return !0;
1158
1168
  if (t.length !== i.length)
1159
1169
  return !1;
1160
1170
  if (!this.isZero() && !e.isZero()) {
1161
- for (const r of s)
1162
- if (!this.hasVariable(r) || !e.hasVariable(r) || !this.#e[r].isEqual(e.literal[r]))
1171
+ for (const n of s)
1172
+ if (!this.hasVariable(n) || !e.hasVariable(n) || !this.#e[n].isEqual(e.literal[n]))
1163
1173
  return !1;
1164
1174
  }
1165
1175
  return !0;
@@ -1168,7 +1178,7 @@ class p {
1168
1178
  /**
1169
1179
  * Determine if the monom is null
1170
1180
  */
1171
- isZero = () => this.#t.value === 0;
1181
+ isZero = () => this.#i.value === 0;
1172
1182
  /**
1173
1183
  * Get the literal part of \\(x^{n_1}y^{n_2}\\) as dictionary \\[\\begin{array}{ll}x&=n_1\\\\y&=n_2\\end{array}\\]
1174
1184
  * @returns {literalType}
@@ -1213,7 +1223,7 @@ class p {
1213
1223
  multiply = (...e) => {
1214
1224
  for (const t of e) {
1215
1225
  const i = t instanceof p ? t : new p(t);
1216
- this.#t.multiply(i.coefficient);
1226
+ this.#i.multiply(i.coefficient);
1217
1227
  for (const s in i.literal)
1218
1228
  this.hasVariable(s) ? this.#e[s].add(i.literal[s]) : this.#e[s] = i.literal[s].clone();
1219
1229
  }
@@ -1222,25 +1232,25 @@ class p {
1222
1232
  /**
1223
1233
  * Create a one value monom
1224
1234
  */
1225
- one = () => (this.#t = new a().one(), this.#e = {}, this);
1235
+ one = () => (this.#i = new a().one(), this.#e = {}, this);
1226
1236
  /**
1227
1237
  * Get the opposite
1228
1238
  * Returns a monom.
1229
1239
  */
1230
- opposite = () => (this.#t.opposite(), this);
1240
+ opposite = () => (this.#i.opposite(), this);
1231
1241
  get plotFunction() {
1232
1242
  let e = "";
1233
1243
  const t = Object.keys(this.#e).sort();
1234
1244
  for (const i of t)
1235
1245
  this.#e[i].isNotZero() && (e += (e === "" ? "" : "*") + i, this.#e[i].isNotEqual(1) && (e += `^(${this.#e[i].display})`));
1236
- return e === "" ? this.#t.value != 0 ? this.#t.display : "" : this.#t.value === 1 ? e : this.#t.value === -1 ? `-${e}` : this.#t.value === 0 ? "0" : `${this.#t.display}*${e}`;
1246
+ return e === "" ? this.#i.value != 0 ? this.#i.display : "" : this.#i.value === 1 ? e : this.#i.value === -1 ? `-${e}` : this.#i.value === 0 ? "0" : `${this.#i.display}*${e}`;
1237
1247
  }
1238
1248
  /**
1239
1249
  * Get the pow of a monom.
1240
1250
  * @param nb (number) : Mathematical pow
1241
1251
  */
1242
1252
  pow = (e) => {
1243
- this.#t.pow(e);
1253
+ this.#i.pow(e);
1244
1254
  for (const t in this.#e)
1245
1255
  this.#e[t].multiply(e);
1246
1256
  return this;
@@ -1277,7 +1287,7 @@ class p {
1277
1287
  */
1278
1288
  sqrt = () => {
1279
1289
  if (this.isSquare()) {
1280
- this.#t.sqrt();
1290
+ this.#i.sqrt();
1281
1291
  for (const e in this.#e)
1282
1292
  this.#e[e].clone().divide(2);
1283
1293
  }
@@ -1290,7 +1300,7 @@ class p {
1290
1300
  subtract = (...e) => {
1291
1301
  for (const t of e) {
1292
1302
  const i = t instanceof p ? t : new p(t);
1293
- this.isSameAs(i) ? (this.isZero() && this.#i(i), this.#t.add(i.clone().coefficient.opposite())) : console.log("Subtract: Is not similar: ", i.display);
1303
+ this.isSameAs(i) ? (this.isZero() && this.#t(i), this.#i.add(i.clone().coefficient.opposite())) : console.log("Subtract: Is not similar: ", i.display);
1294
1304
  }
1295
1305
  return this;
1296
1306
  };
@@ -1309,8 +1319,8 @@ class p {
1309
1319
  /**
1310
1320
  * Create a zero value monom
1311
1321
  */
1312
- zero = () => (this.#t = new a().zero(), this.#e = {}, this);
1313
- #i(e) {
1322
+ zero = () => (this.#i = new a().zero(), this.#e = {}, this);
1323
+ #t(e) {
1314
1324
  for (const t in e.literal)
1315
1325
  this.#e[t] = e.literal[t].clone();
1316
1326
  }
@@ -1324,7 +1334,7 @@ class p {
1324
1334
  const i = {};
1325
1335
  return i[this.variables[0]] = new a(e).value, this.#s(i);
1326
1336
  }
1327
- if (e instanceof X)
1337
+ if (e instanceof j)
1328
1338
  return NaN;
1329
1339
  if (typeof e == "object") {
1330
1340
  if (this.variables.length === 0)
@@ -1336,20 +1346,20 @@ class p {
1336
1346
  }
1337
1347
  return t;
1338
1348
  };
1339
- #r = (e) => {
1340
- const i = new _().parse(e).rpn, s = [];
1349
+ #n = (e) => {
1350
+ const i = new X().parse(e).rpn, s = [];
1341
1351
  if (i.length === 0)
1342
1352
  return this.zero(), this;
1343
1353
  if (i.length === 1) {
1344
- const r = i[0];
1345
- return this.one(), r.tokenType === f.COEFFICIENT ? this.coefficient = new a(r.token) : r.tokenType === f.VARIABLE && this.setLetter(r.token, 1), this;
1354
+ const n = i[0];
1355
+ return this.one(), n.tokenType === f.COEFFICIENT ? this.coefficient = new a(n.token) : n.tokenType === f.VARIABLE && this.setLetter(n.token, 1), this;
1346
1356
  } else
1347
- for (const r of i)
1348
- this.#n(s, r);
1357
+ for (const n of i)
1358
+ this.#r(s, n);
1349
1359
  return this.one(), this.multiply(s[0]), this;
1350
1360
  };
1351
- #n = (e, t) => {
1352
- let i, s, r, o, h;
1361
+ #r = (e, t) => {
1362
+ let i, s, n, o, h;
1353
1363
  if (t.tokenType === f.COEFFICIENT)
1354
1364
  e.push(new p(new a(t.token)));
1355
1365
  else if (t.tokenType === f.VARIABLE) {
@@ -1367,7 +1377,7 @@ class p {
1367
1377
  s = e.pop() ?? new p().one(), i = e.pop() ?? new p().one(), e.push(i.divide(s));
1368
1378
  break;
1369
1379
  case "^": {
1370
- h = e.pop()?.coefficient ?? new a().one(), r = e.pop() ?? new p().one(), o = r.variables[0], o && r.setLetter(o, h), e.push(r);
1380
+ h = e.pop()?.coefficient ?? new a().one(), n = e.pop() ?? new p().one(), o = n.variables[0], o && n.setLetter(o, h), e.push(n);
1371
1381
  break;
1372
1382
  }
1373
1383
  }
@@ -1376,44 +1386,44 @@ class p {
1376
1386
  const i = [];
1377
1387
  for (let s = 0; s <= this.literal[t].value; s++)
1378
1388
  if (e.length === 0) {
1379
- const r = {};
1380
- r[t] = new a(s), i.push(r);
1389
+ const n = {};
1390
+ n[t] = new a(s), i.push(n);
1381
1391
  } else
1382
- for (const r of e) {
1392
+ for (const n of e) {
1383
1393
  const o = {};
1384
- for (const h in r)
1385
- o[h] = r[h];
1394
+ for (const h in n)
1395
+ o[h] = n[h];
1386
1396
  o[t] = new a(s), i.push(o);
1387
1397
  }
1388
1398
  return i;
1389
1399
  }
1390
1400
  }
1391
- function le(n, e = !0) {
1392
- return e ? `\\left( ${n} \\right)` : `(${n})`;
1401
+ function te(r, e = !0) {
1402
+ return e ? `\\left( ${r} \\right)` : `(${r})`;
1393
1403
  }
1394
- function Q(n, e, t, i, s) {
1395
- return n.map((r, o) => r === e ? t : r);
1404
+ function U(r, e, t, i, s) {
1405
+ return r.map((n, o) => n === e ? t : n);
1396
1406
  }
1397
- function de(n, e) {
1407
+ function se(r, e) {
1398
1408
  if (!Number.isSafeInteger(e))
1399
1409
  throw new Error("Can only raise item by an integer");
1400
1410
  if (e < 0)
1401
1411
  throw new Error("Can only raise item by a positive integer");
1402
1412
  if (e === 0)
1403
- return n.one();
1404
- const t = n.clone();
1413
+ return r.one();
1414
+ const t = r.clone();
1405
1415
  for (let i = 1; i < e; i++)
1406
- n.multiply(t);
1407
- return n;
1416
+ r.multiply(t);
1417
+ return r;
1408
1418
  }
1409
1419
  class u {
1410
- #t = "x";
1420
+ #i = "x";
1411
1421
  #e;
1412
- #i;
1422
+ #t;
1413
1423
  #s;
1414
- #r = !1;
1424
+ #n = !1;
1415
1425
  constructor(e, ...t) {
1416
- return this.#i = [], this.#e = [], this.#s = [], e !== void 0 && this.parse(e, ...t), this;
1426
+ return this.#t = [], this.#e = [], this.#s = [], e !== void 0 && this.parse(e, ...t), this;
1417
1427
  }
1418
1428
  /**
1419
1429
  * Parse a string to a polynom.
@@ -1421,17 +1431,17 @@ class u {
1421
1431
  * @param values
1422
1432
  */
1423
1433
  parse = (e, ...t) => {
1424
- if (this.#i = [], this.#e = [], typeof e == "string")
1434
+ if (this.#t = [], this.#e = [], typeof e == "string")
1425
1435
  return this.#g(e, ...t);
1426
1436
  if ((typeof e == "number" || e instanceof a || e instanceof p) && t.length === 0)
1427
- this.#i.push(new p(e));
1437
+ this.#t.push(new p(e));
1428
1438
  else if (e instanceof p && t.length > 0)
1429
- this.#i.push(new p(e)), t.forEach((i) => {
1430
- this.#i.push(new p(i));
1439
+ this.#t.push(new p(e)), t.forEach((i) => {
1440
+ this.#t.push(new p(i));
1431
1441
  });
1432
1442
  else if (e instanceof u)
1433
1443
  for (const i of e.monoms)
1434
- this.#i.push(i.clone());
1444
+ this.#t.push(i.clone());
1435
1445
  return this;
1436
1446
  };
1437
1447
  /**
@@ -1439,7 +1449,7 @@ class u {
1439
1449
  */
1440
1450
  clone = () => {
1441
1451
  const e = new u(), t = [];
1442
- for (const i of this.#i)
1452
+ for (const i of this.#t)
1443
1453
  t.push(i.clone());
1444
1454
  return e.monoms = t, e;
1445
1455
  };
@@ -1451,29 +1461,29 @@ class u {
1451
1461
  }
1452
1462
  add = (...e) => {
1453
1463
  for (const t of e)
1454
- t instanceof u ? this.#i = this.#i.concat(t.monoms) : t instanceof p ? this.#i.push(t.clone()) : typeof t == "number" && Number.isSafeInteger(t) ? this.#i.push(new p(t.toString())) : this.#i.push(new p(t));
1464
+ t instanceof u ? this.#t = this.#t.concat(t.monoms) : t instanceof p ? this.#t.push(t.clone()) : typeof t == "number" && Number.isSafeInteger(t) ? this.#t.push(new p(t.toString())) : this.#t.push(new p(t));
1455
1465
  return this.reduce();
1456
1466
  };
1457
1467
  commonMonom = () => {
1458
1468
  const e = new p().one(), t = this.gcdNumerator(), i = this.gcdDenominator(), s = this.degree();
1459
1469
  e.coefficient = new a(t, i);
1460
- for (const r of this.variables) {
1461
- e.setLetter(r, s);
1462
- for (const o of this.#i)
1463
- if (e.setLetter(r, a.min(o.degree(r), e.degree(r))), e.degree(r).isZero())
1470
+ for (const n of this.variables) {
1471
+ e.setLetter(n, s);
1472
+ for (const o of this.#t)
1473
+ if (e.setLetter(n, a.min(o.degree(n), e.degree(n))), e.degree(n).isZero())
1464
1474
  break;
1465
1475
  }
1466
1476
  return e;
1467
1477
  };
1468
1478
  degree = (e) => {
1469
1479
  let t = new a().zero();
1470
- for (const i of this.#i)
1480
+ for (const i of this.#t)
1471
1481
  t = a.max(i.degree(e).value, t);
1472
1482
  return t;
1473
1483
  };
1474
1484
  derivative = (e) => {
1475
1485
  const t = new u();
1476
- for (const i of this.#i)
1486
+ for (const i of this.#t)
1477
1487
  t.add(i.derivative(e));
1478
1488
  return t.reduce();
1479
1489
  };
@@ -1490,13 +1500,13 @@ class u {
1490
1500
  {
1491
1501
  const { quotient: t, reminder: i } = this.euclidean(e);
1492
1502
  if (i.isZero())
1493
- return this.#i = t.monoms, this;
1503
+ return this.#t = t.monoms, this;
1494
1504
  }
1495
1505
  } else if (typeof e == "string")
1496
1506
  return this.divide(new u(e));
1497
1507
  throw new Error(`Cannot divide by ${e}`);
1498
1508
  };
1499
- empty = () => (this.#i = [], this);
1509
+ empty = () => (this.#t = [], this);
1500
1510
  /**
1501
1511
  * Divide the current polynom by another polynom.
1502
1512
  * @param P
@@ -1509,9 +1519,9 @@ class u {
1509
1519
  quotient: this.clone().divide(e).reduce(),
1510
1520
  reminder: new u().zero()
1511
1521
  };
1512
- const r = e.monomByDegree(void 0, t), o = e.degree(t);
1522
+ const n = e.monomByDegree(void 0, t), o = e.degree(t);
1513
1523
  let h, l = this.degree(t).value * 2;
1514
- for (; s.degree(t).isGeq(o) && l > 0 && (l--, h = s.monomByDegree(void 0, t).clone().divide(r), !(!h.isZero() && (i.add(h), s.subtract(e.clone().multiply(h)).reduce(), h.degree(t).isZero()))); )
1524
+ for (; s.degree(t).isGeq(o) && l > 0 && (l--, h = s.monomByDegree(void 0, t).clone().divide(n), !(!h.isZero() && (i.add(h), s.subtract(e.clone().multiply(h)).reduce(), h.degree(t).isZero()))); )
1515
1525
  ;
1516
1526
  return i.reduce(), s.reduce(), { quotient: i, reminder: s };
1517
1527
  };
@@ -1519,7 +1529,7 @@ class u {
1519
1529
  if (t)
1520
1530
  return this.#a(e);
1521
1531
  const i = new a().zero();
1522
- return this.#i.forEach((s) => {
1532
+ return this.#t.forEach((s) => {
1523
1533
  i.add(s.evaluate(e, t));
1524
1534
  }), i;
1525
1535
  };
@@ -1536,9 +1546,9 @@ class u {
1536
1546
  const h = new u(s);
1537
1547
  t = [h.clone()], i = i.euclidean(h).quotient;
1538
1548
  }
1539
- let r = i.degree().clone().multiply(2).value, o = 1;
1540
- for (; r >= 0; )
1541
- if (r--, i.monoms.length < 2) {
1549
+ let n = i.degree().clone().multiply(2).value, o = 1;
1550
+ for (; n >= 0; )
1551
+ if (n--, i.monoms.length < 2) {
1542
1552
  i.isOne() || (t.push(i.clone()), i.one());
1543
1553
  break;
1544
1554
  } else if (i.degree(e).isOne()) {
@@ -1562,11 +1572,11 @@ class u {
1562
1572
  return i.isOne() || t.push(i.clone()), this.#e = t, this.#e;
1563
1573
  };
1564
1574
  fromCoefficients(...e) {
1565
- this.#i = [];
1566
- const t = this.#t ?? "x";
1575
+ this.#t = [];
1576
+ const t = this.#i ?? "x";
1567
1577
  return e.reverse().forEach((i, s) => {
1568
- const r = new p();
1569
- r.coefficient = new a(i), r.setLetter(t, s), this.#i.push(r);
1578
+ const n = new p();
1579
+ n.coefficient = new a(i), n.setLetter(t, s), this.#t.push(n);
1570
1580
  }), this.reorder();
1571
1581
  }
1572
1582
  gcdDenominator = () => E.gcd(...this.getDenominators());
@@ -1574,30 +1584,30 @@ class u {
1574
1584
  getCoefficients() {
1575
1585
  const e = this.clone().reorder(), t = this.degree().value + 1, i = new Array(t).fill(new a(0));
1576
1586
  return e.monoms.forEach((s) => {
1577
- const r = t - s.degree().value - 1;
1578
- i[r] = s.coefficient.clone();
1587
+ const n = t - s.degree().value - 1;
1588
+ i[n] = s.coefficient.clone();
1579
1589
  }), i;
1580
1590
  }
1581
1591
  // Next functions are used for for commonMonom, which is used in the factorize method.
1582
1592
  getDenominators = () => {
1583
1593
  const e = [];
1584
- for (const t of this.#i)
1594
+ for (const t of this.#t)
1585
1595
  e.push(t.coefficient.denominator);
1586
1596
  return e;
1587
1597
  };
1588
1598
  getNumerators = () => {
1589
1599
  const e = [];
1590
- for (const t of this.#i)
1600
+ for (const t of this.#t)
1591
1601
  e.push(t.coefficient.numerator);
1592
1602
  return e;
1593
1603
  };
1594
- getZeroes = () => this.degree().isZero() ? [] : (this.roots = new J(this.clone()).solve(), this.roots);
1604
+ getZeroes = () => this.degree().isZero() ? [] : (this.roots = new W(this.clone()).solve(), this.roots);
1595
1605
  hasVariable(e) {
1596
1606
  return this.variables.includes(e);
1597
1607
  }
1598
1608
  integrate = (e, t, i = "x") => {
1599
- const s = this.primitive(i), r = {}, o = {};
1600
- return r[i] = new a(e), o[i] = new a(t), s.evaluate(o).subtract(s.evaluate(r));
1609
+ const s = this.primitive(i), n = {}, o = {};
1610
+ return n[i] = new a(e), o[i] = new a(t), s.evaluate(o).subtract(s.evaluate(n));
1601
1611
  };
1602
1612
  inverse() {
1603
1613
  }
@@ -1622,14 +1632,14 @@ class u {
1622
1632
  return t.isZero();
1623
1633
  }
1624
1634
  };
1625
- isEqual = (e) => this.#n(e, "=");
1635
+ isEqual = (e) => this.#r(e, "=");
1626
1636
  get isMultiVariable() {
1627
- return this.#i.some((e) => e.variables.length > 1);
1637
+ return this.#t.some((e) => e.variables.length > 1);
1628
1638
  }
1629
1639
  isOne() {
1630
- return this.#i.length === 1 && this.#i[0].coefficient.isOne() && this.degree().isZero();
1640
+ return this.#t.length === 1 && this.#t[0].coefficient.isOne() && this.degree().isZero();
1631
1641
  }
1632
- isOppositeAt = (e) => this.#n(e.clone().opposite(), "=");
1642
+ isOppositeAt = (e) => this.#r(e.clone().opposite(), "=");
1633
1643
  isReduced = (e) => {
1634
1644
  if (!this.isDeveloped(e))
1635
1645
  return !1;
@@ -1641,18 +1651,18 @@ class u {
1641
1651
  return !1;
1642
1652
  return !1;
1643
1653
  };
1644
- isSameAs = (e) => this.#n(e, "same");
1654
+ isSameAs = (e) => this.#r(e, "same");
1645
1655
  isZero() {
1646
- return this.#i.length === 1 && this.#i[0].coefficient.isZero() || this.#i.length === 0;
1656
+ return this.#t.length === 1 && this.#t[0].coefficient.isZero() || this.#t.length === 0;
1647
1657
  }
1648
1658
  lcmDenominator = () => E.lcm(...this.getDenominators());
1649
1659
  lcmNumerator = () => E.lcm(...this.getNumerators());
1650
1660
  get length() {
1651
- return this.#i.length;
1661
+ return this.#t.length;
1652
1662
  }
1653
1663
  letters = () => {
1654
1664
  let e = /* @__PURE__ */ new Set();
1655
- for (const t of this.#i)
1665
+ for (const t of this.#t)
1656
1666
  e = /* @__PURE__ */ new Set([...e, ...t.variables]);
1657
1667
  return [...e];
1658
1668
  };
@@ -1668,7 +1678,7 @@ class u {
1668
1678
  if (e === void 0)
1669
1679
  return this.monomByDegree(this.degree(t), t);
1670
1680
  const i = this.clone().reduce();
1671
- for (const s of i.#i)
1681
+ for (const s of i.#t)
1672
1682
  if (s.degree(t).isEqual(e))
1673
1683
  return s.clone();
1674
1684
  return new p().zero();
@@ -1676,24 +1686,24 @@ class u {
1676
1686
  // Used in LinearSystem.tex
1677
1687
  monomByLetter = (e) => {
1678
1688
  const t = this.clone().reduce();
1679
- for (const i of t.#i)
1689
+ for (const i of t.#t)
1680
1690
  if (i.hasVariable(e))
1681
1691
  return i.clone();
1682
1692
  return new p().zero();
1683
1693
  };
1684
1694
  // ------------------------------------------
1685
1695
  get monoms() {
1686
- return this.#i;
1696
+ return this.#t;
1687
1697
  }
1688
1698
  set monoms(e) {
1689
- this.#i = e;
1699
+ this.#t = e;
1690
1700
  }
1691
1701
  monomsByDegree = (e, t) => {
1692
1702
  if (e === void 0)
1693
1703
  return this.monomsByDegree(this.degree(t));
1694
1704
  const i = [], s = this.clone().reduce();
1695
- for (const r of s.#i)
1696
- r.degree(t).isEqual(e) && i.push(r.clone());
1705
+ for (const n of s.#t)
1706
+ n.degree(t).isEqual(e) && i.push(n.clone());
1697
1707
  return i;
1698
1708
  };
1699
1709
  multiply = (e) => {
@@ -1717,40 +1727,40 @@ class u {
1717
1727
  get numberOfVars() {
1718
1728
  return this.variables.length;
1719
1729
  }
1720
- one = () => (this.#i = [], this.#i.push(new p().one()), this);
1730
+ one = () => (this.#t = [], this.#t.push(new p().one()), this);
1721
1731
  // ------------------------------------------
1722
- opposite = () => (this.#i = this.#i.map((e) => e.opposite()), this);
1732
+ opposite = () => (this.#t = this.#t.map((e) => e.opposite()), this);
1723
1733
  get plotFunction() {
1724
1734
  return this.#l("tex", !1, !1, !0);
1725
1735
  }
1726
- pow = (e) => de(this, e).reduce();
1736
+ pow = (e) => se(this, e).reduce();
1727
1737
  primitive = (e) => {
1728
1738
  const t = new u();
1729
- for (const i of this.#i)
1739
+ for (const i of this.#t)
1730
1740
  t.add(i.primitive(e));
1731
1741
  return t;
1732
1742
  };
1733
1743
  reduce = () => {
1734
1744
  let e = 0;
1735
- for (; e < this.#i.length; ) {
1736
- for (let t = e + 1; t < this.#i.length; t++)
1737
- this.#i[e].isSameAs(this.#i[t]) && (this.#i[e].add(this.#i[t]), this.#i.splice(t, 1), this.#i[e].isZero() && (this.#i[e] = new p().zero()), t--);
1745
+ for (; e < this.#t.length; ) {
1746
+ for (let t = e + 1; t < this.#t.length; t++)
1747
+ this.#t[e].isSameAs(this.#t[t]) && (this.#t[e].add(this.#t[t]), this.#t.splice(t, 1), this.#t[e].isZero() && (this.#t[e] = new p().zero()), t--);
1738
1748
  e++;
1739
1749
  }
1740
- this.#i = this.#i.filter((t) => !t.coefficient.isZero());
1741
- for (const t of this.#i)
1750
+ this.#t = this.#t.filter((t) => !t.coefficient.isZero());
1751
+ for (const t of this.#t)
1742
1752
  t.coefficient.reduce();
1743
1753
  return this.length === 0 ? new u().zero() : this.reorder();
1744
1754
  };
1745
1755
  reorder = (e = "x", t = !1) => {
1746
1756
  const i = this.variables.filter((s) => s !== e);
1747
- return this.#i.sort(function(s, r) {
1748
- const o = s.degree(e).value, h = r.degree(e).value;
1757
+ return this.#t.sort(function(s, n) {
1758
+ const o = s.degree(e).value, h = n.degree(e).value;
1749
1759
  if (o !== h)
1750
1760
  return t ? o - h : h - o;
1751
1761
  if (i.length > 0)
1752
1762
  for (const l of i) {
1753
- const c = s.degree(l).value, d = r.degree(l).value;
1763
+ const c = s.degree(l).value, d = n.degree(l).value;
1754
1764
  if (c !== d)
1755
1765
  return t ? c - d : d - c;
1756
1766
  }
@@ -1765,29 +1775,29 @@ class u {
1765
1775
  replaceBy = (e, t) => {
1766
1776
  let i;
1767
1777
  const s = new u().zero();
1768
- for (const r of this.monoms)
1769
- !r.hasVariable(e) || r.literal[e].isZero() ? s.add(r.clone()) : (i = r.literal[e].clone(), r.removeVariable(e), s.add(t.clone().pow(Math.abs(i.numerator)).multiply(r)));
1770
- return this.#i = s.reduce().monoms, this;
1778
+ for (const n of this.monoms)
1779
+ !n.hasVariable(e) || n.literal[e].isZero() ? s.add(n.clone()) : (i = n.literal[e].clone(), n.removeVariable(e), s.add(t.clone().pow(Math.abs(i.numerator)).multiply(n)));
1780
+ return this.#t = s.reduce().monoms, this;
1771
1781
  };
1772
1782
  // ------------------------------------------
1773
1783
  root() {
1774
1784
  throw new Error("Cannot take the root from a polynom");
1775
1785
  }
1776
1786
  get roots() {
1777
- return this.#r ? this.#s : this.getZeroes();
1787
+ return this.#n ? this.#s : this.getZeroes();
1778
1788
  }
1779
1789
  set roots(e) {
1780
- this.#r = !0, this.#s = e;
1790
+ this.#n = !0, this.#s = e;
1781
1791
  }
1782
1792
  setVariable(e) {
1783
- return this.#t = e, this;
1793
+ return this.#i = e, this;
1784
1794
  }
1785
1795
  sqrt() {
1786
1796
  throw new Error("Cannot take the square root from a polynom");
1787
1797
  }
1788
1798
  subtract = (...e) => {
1789
1799
  for (const t of e)
1790
- t instanceof u ? this.add(t.clone().opposite()) : t instanceof p ? this.#i.push(t.clone().opposite()) : this.#i.push(new p(t).opposite());
1800
+ t instanceof u ? this.add(t.clone().opposite()) : t instanceof p ? this.#t.push(t.clone().opposite()) : this.#t.push(new p(t).opposite());
1791
1801
  return this.reduce();
1792
1802
  };
1793
1803
  tableOfSigns() {
@@ -1795,17 +1805,17 @@ class u {
1795
1805
  let t = new Array(2 * e.length + 1).fill("").map((i, s) => s % 2 === 0 ? "" : "z");
1796
1806
  if (t.length === 1) {
1797
1807
  const [i] = this.getCoefficients().map((s) => s.value);
1798
- t = Q(t, "", i > 0 ? "+" : "-");
1808
+ t = U(t, "", i > 0 ? "+" : "-");
1799
1809
  } else if (this.degree().isOne()) {
1800
1810
  const [i] = this.getCoefficients().map((s) => s.value);
1801
1811
  t[0] = i > 0 ? "-" : "+", t[1] = "z", t[2] = i > 0 ? "+" : "-";
1802
1812
  } else
1803
1813
  [
1804
1814
  e[0].value - 1,
1805
- ...e.map((s, r) => r === e.length - 1 ? e[r].value + 1 : (e[r].value + e[r + 1].value) / 2)
1806
- ].forEach((s, r) => {
1815
+ ...e.map((s, n) => n === e.length - 1 ? e[n].value + 1 : (e[n].value + e[n + 1].value) / 2)
1816
+ ].forEach((s, n) => {
1807
1817
  const o = this.evaluate({ x: s }, !0);
1808
- t[r * 2] = o > 0 ? "+" : "-";
1818
+ t[n * 2] = o > 0 ? "+" : "-";
1809
1819
  });
1810
1820
  return { roots: e, signs: t };
1811
1821
  }
@@ -1815,7 +1825,7 @@ class u {
1815
1825
  }
1816
1826
  get variables() {
1817
1827
  let e = [];
1818
- for (const t of this.#i)
1828
+ for (const t of this.#t)
1819
1829
  e = e.concat(t.variables);
1820
1830
  return e = [...new Set(e)], e.sort(), e;
1821
1831
  }
@@ -1823,43 +1833,43 @@ class u {
1823
1833
  * Set the polynom to zero.
1824
1834
  * @returns {this}
1825
1835
  */
1826
- zero = () => (this.#i = [], this.#i.push(new p().zero()), this);
1836
+ zero = () => (this.#t = [], this.#t.push(new p().zero()), this);
1827
1837
  get zeroes() {
1828
1838
  return this.getZeroes();
1829
1839
  }
1830
- #n = (e, t) => {
1840
+ #r = (e, t) => {
1831
1841
  t ??= "=";
1832
1842
  const i = this.clone().reduce().reorder(), s = e.clone().reduce().reorder();
1833
1843
  switch (t) {
1834
1844
  case "=":
1835
- return i.length !== s.length || !i.degree().isEqual(s.degree()) ? !1 : i.monoms.every((r, o) => r.isEqual(s.monoms[o]));
1845
+ return i.length !== s.length || !i.degree().isEqual(s.degree()) ? !1 : i.monoms.every((n, o) => n.isEqual(s.monoms[o]));
1836
1846
  case "same":
1837
- return i.length !== s.length || !i.degree().isEqual(s.degree()) ? !1 : i.monoms.every((r, o) => r.isSameAs(s.monoms[o]));
1847
+ return i.length !== s.length || !i.degree().isEqual(s.degree()) ? !1 : i.monoms.every((n, o) => n.isSameAs(s.monoms[o]));
1838
1848
  default:
1839
1849
  return !1;
1840
1850
  }
1841
1851
  };
1842
1852
  #o = (e) => {
1843
- for (const t of this.#i)
1853
+ for (const t of this.#t)
1844
1854
  t.coefficient.divide(e);
1845
1855
  return this;
1846
1856
  };
1847
1857
  #h = (e) => {
1848
1858
  const t = new a(e);
1849
- for (const i of this.#i)
1859
+ for (const i of this.#t)
1850
1860
  i.coefficient.divide(t);
1851
1861
  return this;
1852
1862
  };
1853
1863
  #a = (e) => {
1854
1864
  let t = 0;
1855
- return this.#i.forEach((i) => {
1865
+ return this.#t.forEach((i) => {
1856
1866
  t += i.evaluate(e, !0);
1857
1867
  }), t;
1858
1868
  };
1859
1869
  #c = (e) => {
1860
- let t, i, s, r, o, h, l, c, d;
1870
+ let t, i, s, n, o, h, l, c, d;
1861
1871
  if (this.numberOfVars === 1)
1862
- return s = this.monomByDegree(2, e).coefficient, r = this.monomByDegree(1, e).coefficient, o = this.monomByDegree(0, e).coefficient, h = r.clone().pow(2).subtract(s.clone().multiply(o).multiply(4)), h.isZero() ? (l = r.clone().opposite().divide(s.clone().multiply(2)), t = new u(e).subtract(l.display).multiply(l.denominator), i = new u(e).subtract(l.display).multiply(l.denominator), d = s.divide(l.denominator).divide(l.denominator), d.isOne() ? [t, i] : [new u(d.display), t, i]) : h.isPositive() && h.isSquare() ? (l = r.clone().opposite().add(h.clone().sqrt()).divide(s.clone().multiply(2)), c = r.clone().opposite().subtract(h.clone().sqrt()).divide(s.clone().multiply(2)), d = s.divide(l.denominator).divide(c.denominator), d.isOne() ? [
1872
+ return s = this.monomByDegree(2, e).coefficient, n = this.monomByDegree(1, e).coefficient, o = this.monomByDegree(0, e).coefficient, h = n.clone().pow(2).subtract(s.clone().multiply(o).multiply(4)), h.isZero() ? (l = n.clone().opposite().divide(s.clone().multiply(2)), t = new u(e).subtract(l.display).multiply(l.denominator), i = new u(e).subtract(l.display).multiply(l.denominator), d = s.divide(l.denominator).divide(l.denominator), d.isOne() ? [t, i] : [new u(d.display), t, i]) : h.isPositive() && h.isSquare() ? (l = n.clone().opposite().add(h.clone().sqrt()).divide(s.clone().multiply(2)), c = n.clone().opposite().subtract(h.clone().sqrt()).divide(s.clone().multiply(2)), d = s.divide(l.denominator).divide(c.denominator), d.isOne() ? [
1863
1873
  new u(e).subtract(l.display).multiply(l.denominator),
1864
1874
  new u(e).subtract(c.display).multiply(c.denominator)
1865
1875
  ] : [
@@ -1867,56 +1877,56 @@ class u {
1867
1877
  new u(e).subtract(l.display).multiply(l.denominator),
1868
1878
  new u(e).subtract(c.display).multiply(c.denominator)
1869
1879
  ]) : [this.clone()];
1870
- if (s = this.monomByDegree(2, e), r = this.monomByDegree(1, e), o = this.monomByDegree(0, e), s.isLiteralSquare() && o.isLiteralSquare() && r.clone().pow(2).isSameAs(s.clone().multiply(o))) {
1871
- const w = new u("x", s.coefficient, r.coefficient, o.coefficient).#c("x"), N = [];
1880
+ if (s = this.monomByDegree(2, e), n = this.monomByDegree(1, e), o = this.monomByDegree(0, e), s.isLiteralSquare() && o.isLiteralSquare() && n.clone().pow(2).isSameAs(s.clone().multiply(o))) {
1881
+ const w = new u("x", s.coefficient, n.coefficient, o.coefficient).#c("x"), N = [];
1872
1882
  let A;
1873
1883
  if (w.length >= 2) {
1874
- for (const k of w)
1875
- k.degree().isZero() ? N.push(k.clone()) : (A = k.clone(), A.monoms[0].literal = s.literalSqrt, A.monoms[1].literal = o.literalSqrt, N.push(A.clone()));
1884
+ for (const C of w)
1885
+ C.degree().isZero() ? N.push(C.clone()) : (A = C.clone(), A.monoms[0].literal = s.literalSqrt, A.monoms[1].literal = o.literalSqrt, N.push(A.clone()));
1876
1886
  return N;
1877
1887
  }
1878
1888
  }
1879
1889
  return [this.clone()];
1880
1890
  };
1881
1891
  #l = (e, t, i, s) => {
1882
- let r = "";
1883
- for (const o of this.#i) {
1892
+ let n = "";
1893
+ for (const o of this.#t) {
1884
1894
  if (o.coefficient.value === 0)
1885
1895
  continue;
1886
1896
  let h;
1887
- s ? h = o.plotFunction : h = e === "tex" ? o.tex : o.display, r += `${o.coefficient.sign() === 1 && (r !== "" || t === !0) ? "+" : ""}${h}`;
1897
+ s ? h = o.plotFunction : h = e === "tex" ? o.tex : o.display, n += `${o.coefficient.sign() === 1 && (n !== "" || t === !0) ? "+" : ""}${h}`;
1888
1898
  }
1889
- return i === !0 && this.length > 1 && (e === "tex" ? r = `\\left( ${r} \\right)` : r = `(${r})`), r === "" && (r = "0"), r;
1899
+ return i === !0 && this.length > 1 && (e === "tex" ? n = `\\left( ${n} \\right)` : n = `(${n})`), n === "" && (n = "0"), n;
1890
1900
  };
1891
1901
  #u = (e, t, i) => {
1892
- const s = e.monoms[0].dividers, r = e.monoms[e.monoms.length - 1].dividers, o = [];
1902
+ const s = e.monoms[0].dividers, n = e.monoms[e.monoms.length - 1].dividers, o = [];
1893
1903
  return s.forEach((h) => {
1894
- h.degree(i).isLeq(t) && r.forEach((l) => {
1904
+ h.degree(i).isLeq(t) && n.forEach((l) => {
1895
1905
  h.degree(i).isNotEqual(l.degree(i)) && (o.push(new u(h, l)), o.push(new u(h, l.clone().opposite())));
1896
1906
  });
1897
1907
  }), o;
1898
1908
  };
1899
1909
  #f = (e) => {
1900
- for (const t of this.#i)
1910
+ for (const t of this.#t)
1901
1911
  t.coefficient.multiply(e);
1902
1912
  return this.reduce();
1903
1913
  };
1904
1914
  #d = (e) => this.#f(new a(e));
1905
1915
  #p = (e) => {
1906
- for (const t of this.#i)
1916
+ for (const t of this.#t)
1907
1917
  t.multiply(e);
1908
1918
  return this.reduce();
1909
1919
  };
1910
1920
  #m = (e) => {
1911
1921
  const t = [];
1912
- for (const i of this.#i)
1922
+ for (const i of this.#t)
1913
1923
  for (const s of e.monoms)
1914
1924
  t.push(p.xMultiply(i, s));
1915
- return this.#i = t, this.reduce();
1925
+ return this.#t = t, this.reduce();
1916
1926
  };
1917
1927
  #g(e, ...t) {
1918
1928
  if (t.length === 0) {
1919
- if (console.log(e, Number(e)), e !== "" && !isNaN(Number(e))) {
1929
+ if (e !== "" && !isNaN(Number(e))) {
1920
1930
  this.empty();
1921
1931
  const i = new p(Number(e));
1922
1932
  return this.add(i), this;
@@ -1929,16 +1939,16 @@ class u {
1929
1939
  const s = e.split("");
1930
1940
  if (s.length < t.length - 2)
1931
1941
  throw new Error("Too many factors for too few variables !");
1932
- let r = 0;
1942
+ let n = 0;
1933
1943
  for (const o of i) {
1934
1944
  const h = new p();
1935
- h.coefficient = o.clone(), h.literalStr = s[r] || "", this.add(h), r++;
1945
+ h.coefficient = o.clone(), h.literalStr = s[n] || "", this.add(h), n++;
1936
1946
  }
1937
1947
  } else {
1938
1948
  let s = i.length - 1;
1939
- for (const r of i) {
1949
+ for (const n of i) {
1940
1950
  const o = new p();
1941
- o.coefficient = r.clone(), o.literalStr = `${e}^${s}`, this.add(o), s--;
1951
+ o.coefficient = n.clone(), o.literalStr = `${e}^${s}`, this.add(o), s--;
1942
1952
  }
1943
1953
  }
1944
1954
  return this;
@@ -1950,11 +1960,11 @@ class u {
1950
1960
  * @param inputStr
1951
1961
  */
1952
1962
  #w = (e) => {
1953
- const i = new _().parse(e).rpn;
1963
+ const i = new X().parse(e).rpn;
1954
1964
  this.zero();
1955
1965
  const s = [];
1956
- for (const r of i)
1957
- this.#y(s, r);
1966
+ for (const n of i)
1967
+ this.#y(s, n);
1958
1968
  return s.length === 1 && this.add(s[0]), this.reorder();
1959
1969
  };
1960
1970
  #y = (e, t) => {
@@ -1987,8 +1997,8 @@ class u {
1987
1997
  if (i.monoms[0].coefficient.isRelative())
1988
1998
  e.push(s.pow(i.monoms[0].coefficient.value));
1989
1999
  else if (s.monoms.length === 1 && s.monoms[0].coefficient.isOne()) {
1990
- for (const r in s.monoms[0].literal)
1991
- s.monoms[0].literal[r].multiply(i.monoms[0].coefficient);
2000
+ for (const n in s.monoms[0].literal)
2001
+ s.monoms[0].literal[n].multiply(i.monoms[0].coefficient);
1992
2002
  e.push(s);
1993
2003
  } else
1994
2004
  console.error("Cannot have power with fraction");
@@ -2010,13 +2020,13 @@ class u {
2010
2020
  }
2011
2021
  class y {
2012
2022
  // Left part of the equation
2013
- #t;
2023
+ #i;
2014
2024
  // Right part of the equation
2015
2025
  #e;
2016
2026
  // Signe of the equation
2017
- #i;
2027
+ #t;
2018
2028
  constructor(e, t, i) {
2019
- if (this.#t = new u().zero(), this.#e = new u().zero(), this.#i = "=", e !== void 0 && t === void 0) {
2029
+ if (this.#i = new u().zero(), this.#e = new u().zero(), this.#t = "=", e !== void 0 && t === void 0) {
2020
2030
  if (e instanceof y)
2021
2031
  return e.clone();
2022
2032
  typeof e == "string" && this.parse(e);
@@ -2029,10 +2039,10 @@ class y {
2029
2039
  if (t === !1)
2030
2040
  throw new Error("The equation is not valid (no sign found)");
2031
2041
  const i = e.split(t);
2032
- return this.create(new u(i[0]), new u(i[1]), this.#r(t));
2042
+ return this.create(new u(i[0]), new u(i[1]), this.#n(t));
2033
2043
  };
2034
- create = (e, t, i) => (this.#t = e, this.#e = t, this.#i = this.#r(i ?? "="), this);
2035
- clone = () => new y(this.#t.clone(), this.#e.clone(), this.#i);
2044
+ create = (e, t, i) => (this.#i = e, this.#e = t, this.#t = this.#n(i ?? "="), this);
2045
+ clone = () => new y(this.#i.clone(), this.#e.clone(), this.#t);
2036
2046
  /**
2037
2047
  * Add a value to the equation
2038
2048
  * if value is an equation, add the left part to the left part of the equation
@@ -2043,17 +2053,17 @@ class y {
2043
2053
  */
2044
2054
  add(e) {
2045
2055
  if (e instanceof y)
2046
- return this.#t.add(e.left), this.#e.add(e.right), this;
2056
+ return this.#i.add(e.left), this.#e.add(e.right), this;
2047
2057
  if (typeof e == "string" && !y.isEquationString(e))
2048
2058
  return this.add(new y(e));
2049
2059
  const t = new u(e);
2050
- return this.#t.add(t), this.#e.add(t), this;
2060
+ return this.#i.add(t), this.#e.add(t), this;
2051
2061
  }
2052
2062
  /**
2053
2063
  * Get the degree of the equation
2054
2064
  * @param letter
2055
2065
  */
2056
- degree = (e) => a.max(this.#t.degree(e), this.#e.degree(e));
2066
+ degree = (e) => a.max(this.#i.degree(e), this.#e.degree(e));
2057
2067
  /**
2058
2068
  * divide an equation by a given value (transformed as a fraction)
2059
2069
  *
@@ -2079,7 +2089,7 @@ class y {
2079
2089
  * @param asNumeric
2080
2090
  */
2081
2091
  evaluate(e, t) {
2082
- const i = this.#t.evaluate(e, t), s = this.#e.evaluate(e, t);
2092
+ const i = this.#i.evaluate(e, t), s = this.#e.evaluate(e, t);
2083
2093
  return t ? i === s : i.isEqual(s);
2084
2094
  }
2085
2095
  /**
@@ -2089,7 +2099,7 @@ class y {
2089
2099
  hasVariable = (e) => this.variables.includes(e);
2090
2100
  isEqual(e) {
2091
2101
  const t = new y(e);
2092
- return t.left.isEqual(this.#t) && t.right.isEqual(this.#e);
2102
+ return t.left.isEqual(this.#i) && t.right.isEqual(this.#e);
2093
2103
  }
2094
2104
  isLinearTo = (e) => {
2095
2105
  const t = e.clone().moveLeft().simplify().left, i = this.clone().moveLeft().simplify().left;
@@ -2098,7 +2108,7 @@ class y {
2098
2108
  /**
2099
2109
  * Determine if the equation contains more than one letter/variable.
2100
2110
  */
2101
- isMultiVariable = () => this.#t.isMultiVariable || this.#e.isMultiVariable;
2111
+ isMultiVariable = () => this.#i.isMultiVariable || this.#e.isMultiVariable;
2102
2112
  // -----------------------------------------------
2103
2113
  // Equations helpers
2104
2114
  isEqualTo = (e) => {
@@ -2113,79 +2123,79 @@ class y {
2113
2123
  if (!this.degree(e).isOne() || this.isMultiVariable())
2114
2124
  return !1;
2115
2125
  let t;
2116
- this.#t.subtract(this.#e), this.#e.zero();
2117
- const i = [...this.#t.monoms];
2118
- for (const r of i)
2119
- r.hasVariable(e) || (t = r.clone(), this.#t.subtract(t), this.#e.subtract(t));
2120
- if (this.#t.length !== 1)
2126
+ this.#i.subtract(this.#e), this.#e.zero();
2127
+ const i = [...this.#i.monoms];
2128
+ for (const n of i)
2129
+ n.hasVariable(e) || (t = n.clone(), this.#i.subtract(t), this.#e.subtract(t));
2130
+ if (this.#i.length !== 1)
2121
2131
  return !1;
2122
- const s = this.#t.monoms[0].coefficient.clone();
2123
- return this.#t.divide(s), this.#e.divide(s), this;
2132
+ const s = this.#i.monoms[0].coefficient.clone();
2133
+ return this.#i.divide(s), this.#e.divide(s), this;
2124
2134
  };
2125
2135
  // -----------------------------------------------
2126
2136
  // Equations operations
2127
2137
  // -----------------------------------------------
2128
- letters = () => [.../* @__PURE__ */ new Set([...this.#t.letters(), ...this.#e.letters()])];
2138
+ letters = () => [.../* @__PURE__ */ new Set([...this.#i.letters(), ...this.#e.letters()])];
2129
2139
  // -----------------------------------------------
2130
2140
  /**
2131
2141
  * Reorder will move all monoms containing a letter on the left, all the other on the right.
2132
2142
  */
2133
- moveLeft = () => (this.#t.subtract(this.#e), this.#e.zero(), this);
2143
+ moveLeft = () => (this.#i.subtract(this.#e), this.#e.zero(), this);
2134
2144
  /**
2135
2145
  * Multiple an equation by a fraction value.
2136
2146
  * @param value
2137
2147
  */
2138
2148
  multiply = (e) => {
2139
2149
  const t = new a(e);
2140
- return this.#t.multiply(t), this.#e.multiply(t), this.#i !== "=" && t.sign() === -1 && this.#n(), this;
2150
+ return this.#i.multiply(t), this.#e.multiply(t), this.#t !== "=" && t.sign() === -1 && this.#r(), this;
2141
2151
  };
2142
2152
  pow(e) {
2143
- return this.#t.pow(e), this.#e.pow(e), this;
2153
+ return this.#i.pow(e), this.#e.pow(e), this;
2144
2154
  }
2145
- opposite = () => (this.#t = this.#t.opposite(), this.#e = this.#e.opposite(), this);
2155
+ opposite = () => (this.#i = this.#i.opposite(), this.#e = this.#e.opposite(), this);
2146
2156
  reduce() {
2147
- return this.moveLeft(), this.#t.reduce(), this.simplify(), this.#t.monoms[0].coefficient.isNegative() && this.multiply(-1), this;
2157
+ return this.moveLeft(), this.#i.reduce(), this.simplify(), this.#i.monoms[0].coefficient.isNegative() && this.multiply(-1), this;
2148
2158
  }
2149
- reorder = (e) => (this.#t.subtract(this.#e), this.#e.zero(), this.#t.reorder(), e ? this : (this.#t.monoms.filter((t) => t.degree().isZero()).forEach((t) => {
2159
+ reorder = (e) => (this.#i.subtract(this.#e), this.#e.zero(), this.#i.reorder(), e ? this : (this.#i.monoms.filter((t) => t.degree().isZero()).forEach((t) => {
2150
2160
  const i = t.clone();
2151
- this.#t.subtract(i), this.#e.subtract(i);
2152
- }), this.#t.reorder(), this.#e.reorder(), this));
2161
+ this.#i.subtract(i), this.#e.subtract(i);
2162
+ }), this.#i.reorder(), this.#e.reorder(), this));
2153
2163
  // ------------------------------------------
2154
- replaceBy = (e, t) => (this.#t.replaceBy(e, t), this.#e.replaceBy(e, t), this);
2164
+ replaceBy = (e, t) => (this.#i.replaceBy(e, t), this.#e.replaceBy(e, t), this);
2155
2165
  /**
2156
2166
  * Multiply by the lcm denominator and divide by the gcm numerators.
2157
2167
  */
2158
- simplify = () => (this.multiply(E.lcm(...this.#t.getDenominators(), ...this.#e.getDenominators())), this.divide(E.gcd(...this.#t.getNumerators(), ...this.#e.getNumerators())), this);
2168
+ simplify = () => (this.multiply(E.lcm(...this.#i.getDenominators(), ...this.#e.getDenominators())), this.divide(E.gcd(...this.#i.getNumerators(), ...this.#e.getNumerators())), this);
2159
2169
  // -----------------------------------------------
2160
- solve = () => new J(this.clone()).solve();
2170
+ solve = () => new W(this.clone()).solve();
2161
2171
  split() {
2162
- return [this.#t.clone(), this.#e.clone()];
2172
+ return [this.#i.clone(), this.#e.clone()];
2163
2173
  }
2164
2174
  subtract(e) {
2165
2175
  if (e instanceof y)
2166
- return this.#t.subtract(e.left), this.#e.subtract(e.right), this;
2176
+ return this.#i.subtract(e.left), this.#e.subtract(e.right), this;
2167
2177
  if (typeof e == "string" && !y.isEquationString(e))
2168
2178
  return this.subtract(new y(e));
2169
2179
  const t = new u(e);
2170
- return this.#t.subtract(t), this.#e.subtract(t), this;
2180
+ return this.#i.subtract(t), this.#e.subtract(t), this;
2171
2181
  }
2172
2182
  test = (e) => this.left.evaluate(e).isEqual(this.right.evaluate(e));
2173
2183
  static isEquationString(e) {
2174
2184
  return e.includes("=") || e.includes("<") || e.includes(">") || e.includes("<=") || e.includes(">=");
2175
2185
  }
2176
2186
  static makeSolutionsUnique(e, t) {
2177
- const i = [], s = e.filter((r) => i.includes(r.tex) ? !1 : (i.push(r.tex), !0));
2178
- return t === !0 && s.sort((r, o) => r.value - o.value), s;
2187
+ const i = [], s = e.filter((n) => i.includes(n.tex) ? !1 : (i.push(n.tex), !0));
2188
+ return t === !0 && s.sort((n, o) => n.value - o.value), s;
2179
2189
  }
2180
2190
  get display() {
2181
- return `${this.#t.display}${this.signAsTex}${this.#e.display}`;
2191
+ return `${this.#i.display}${this.signAsTex}${this.#e.display}`;
2182
2192
  }
2183
2193
  // Getter and setter
2184
2194
  get left() {
2185
- return this.#t;
2195
+ return this.#i;
2186
2196
  }
2187
2197
  set left(e) {
2188
- this.#t = e;
2198
+ this.#i = e;
2189
2199
  }
2190
2200
  get numberOfVars() {
2191
2201
  return this.variables.length;
@@ -2198,19 +2208,19 @@ class y {
2198
2208
  }
2199
2209
  // ------------------------------------------
2200
2210
  get sign() {
2201
- return this.#i;
2211
+ return this.#t;
2202
2212
  }
2203
2213
  set sign(e) {
2204
- this.#i = this.#r(e);
2214
+ this.#t = this.#n(e);
2205
2215
  }
2206
2216
  get signAsTex() {
2207
- return this.#i === ">=" ? "\\geq" : this.#i === "<=" ? "\\leq" : this.#i;
2217
+ return this.#t === ">=" ? "\\geq" : this.#t === "<=" ? "\\leq" : this.#t;
2208
2218
  }
2209
2219
  get tex() {
2210
- return `${this.#t.tex}${this.signAsTex}${this.#e.tex}`;
2220
+ return `${this.#i.tex}${this.signAsTex}${this.#e.tex}`;
2211
2221
  }
2212
2222
  get variables() {
2213
- return [...new Set(this.#e.variables.concat(this.#t.variables))];
2223
+ return [...new Set(this.#e.variables.concat(this.#i.variables))];
2214
2224
  }
2215
2225
  #s = (e) => {
2216
2226
  if (e.includes("geq"))
@@ -2235,16 +2245,16 @@ class y {
2235
2245
  };
2236
2246
  // -----------------------------------------------
2237
2247
  // Equations solving algorithms
2238
- #r = (e) => e === void 0 ? "=" : e.includes("geq") || e.includes(">=") || e.includes("=>") ? ">=" : e.includes(">") ? ">" : e.includes("leq") || e.includes("<=") || e.includes("=<") ? "<=" : e.includes("<") ? "<" : "=";
2239
- #n = () => this.#i === "=" ? this : this.#i.includes("<") ? (this.#i.replace("<", ">"), this) : this.#i.includes(">") ? (this.#i.replace(">", "<"), this) : this;
2248
+ #n = (e) => e === void 0 ? "=" : e.includes("geq") || e.includes(">=") || e.includes("=>") ? ">=" : e.includes(">") ? ">" : e.includes("leq") || e.includes("<=") || e.includes("=<") ? "<=" : e.includes("<") ? "<" : "=";
2249
+ #r = () => this.#t === "=" ? this : this.#t.includes("<") ? (this.#t.replace("<", ">"), this) : this.#t.includes(">") ? (this.#t.replace(">", "<"), this) : this;
2240
2250
  }
2241
2251
  class x {
2242
- #t;
2243
- #e;
2244
2252
  #i;
2253
+ #e;
2254
+ #t;
2245
2255
  #s = !1;
2246
2256
  constructor(e, t) {
2247
- return e instanceof x ? (this.#e = e.polynom.clone(), this.#i = e.power.clone(), t !== void 0 && this.#i.multiply(new a(t))) : e !== void 0 ? (this.#e = new u(e), this.#i = new a(t ?? 1)) : (this.#e = new u(), this.#i = new a(1)), this.#t = 1, this;
2257
+ return e instanceof x ? (this.#e = e.polynom.clone(), this.#t = e.power.clone(), t !== void 0 && this.#t.multiply(new a(t))) : e !== void 0 ? (this.#e = new u(e), this.#t = new a(t ?? 1)) : (this.#e = new u(), this.#t = new a(1)), this.#i = 1, this;
2248
2258
  }
2249
2259
  parse() {
2250
2260
  throw new Error("Method not implemented.");
@@ -2253,17 +2263,17 @@ class x {
2253
2263
  return new x(this);
2254
2264
  }
2255
2265
  fromPolynom(e) {
2256
- return this.#e = new u(e), this.#i = new a(1), this;
2266
+ return this.#e = new u(e), this.#t = new a(1), this;
2257
2267
  }
2258
2268
  get tex() {
2259
2269
  const e = this.power.numerator, t = this.power.denominator;
2260
2270
  let i, s;
2261
- return this.#t === 0 && t > 1 ? (i = `\\sqrt${t === 2 ? "" : `[ ${t} ]`}{ ${this.polynom.tex} }`, s = e === 1 ? "" : `^{ ${e} }`) : (i = this.#s && this.power.isOne() ? this.polynom.tex : le(this.polynom.tex), s = t === 1 && e === 1 ? "" : `^{ ${this.power.tex} }`), i = `${i}${s}`, this.#t === 0 && e < 0 && (i = `\\frac{ 1 }{ ${i} }`), i;
2271
+ return this.#i === 0 && t > 1 ? (i = `\\sqrt${t === 2 ? "" : `[ ${t} ]`}{ ${this.polynom.tex} }`, s = e === 1 ? "" : `^{ ${e} }`) : (i = this.#s && this.power.isOne() ? this.polynom.tex : te(this.polynom.tex), s = t === 1 && e === 1 ? "" : `^{ ${this.power.tex} }`), i = `${i}${s}`, this.#i === 0 && e < 0 && (i = `\\frac{ 1 }{ ${i} }`), i;
2262
2272
  }
2263
2273
  get display() {
2264
2274
  const e = this.power.numerator, t = this.power.denominator;
2265
2275
  let i, s;
2266
- return this.#t === 0 && t > 1 ? (i = `${t === 2 ? "sqrt" : `root(${t})`}(${this.polynom.display})`, s = e === 1 ? "" : `^(${e})`) : (i = this.#s && this.power.isOne() ? this.polynom.display : le(this.polynom.display, !1), s = t === 1 && e === 1 ? "" : `^(${this.power.display})`), i = `${i}${s}`, this.#t === 0 && e < 0 && (i = `1/(${i})`), i;
2276
+ return this.#i === 0 && t > 1 ? (i = `${t === 2 ? "sqrt" : `root(${t})`}(${this.polynom.display})`, s = e === 1 ? "" : `^(${e})`) : (i = this.#s && this.power.isOne() ? this.polynom.display : te(this.polynom.display, !1), s = t === 1 && e === 1 ? "" : `^(${this.power.display})`), i = `${i}${s}`, this.#i === 0 && e < 0 && (i = `1/(${i})`), i;
2267
2277
  }
2268
2278
  add() {
2269
2279
  throw new Error("Adding two factors is not possible");
@@ -2325,7 +2335,7 @@ class x {
2325
2335
  throw new Error("The two factors must be the same");
2326
2336
  }
2327
2337
  one() {
2328
- return this.#e.one(), this.#i.one(), this;
2338
+ return this.#e.one(), this.#t.one(), this;
2329
2339
  }
2330
2340
  opposite() {
2331
2341
  throw new Error("Method not implemented.");
@@ -2340,10 +2350,10 @@ class x {
2340
2350
  return this.power.multiply(e), this;
2341
2351
  }
2342
2352
  get power() {
2343
- return this.#i;
2353
+ return this.#t;
2344
2354
  }
2345
2355
  set power(e) {
2346
- this.#i = new a(e);
2356
+ this.#t = new a(e);
2347
2357
  }
2348
2358
  primitive() {
2349
2359
  throw new Error("Method not implemented.");
@@ -2362,68 +2372,68 @@ class x {
2362
2372
  }
2363
2373
  tableOfSigns() {
2364
2374
  const e = this.power.clone().reduce(), t = this.polynom.tableOfSigns();
2365
- return e.isStrictlyNegative() && (t.signs = Q(t.signs, "z", "d")), e.denominator % 2 === 0 ? t.signs = Q(t.signs, "-", "h") : e.numerator % 2 === 0 && (t.signs = Q(t.signs, "-", "+")), { roots: t.roots, signs: t.signs };
2375
+ return e.isStrictlyNegative() && (t.signs = U(t.signs, "z", "d")), e.denominator % 2 === 0 ? t.signs = U(t.signs, "-", "h") : e.numerator % 2 === 0 && (t.signs = U(t.signs, "-", "+")), { roots: t.roots, signs: t.signs };
2366
2376
  }
2367
2377
  get variables() {
2368
2378
  return this.polynom.variables;
2369
2379
  }
2370
2380
  get withPower() {
2371
- return this.#t = 1, this;
2381
+ return this.#i = 1, this;
2372
2382
  }
2373
2383
  get withRoot() {
2374
- return this.#t = 0, this;
2384
+ return this.#i = 0, this;
2375
2385
  }
2376
2386
  zero() {
2377
- return this.#e.zero(), this.#i.one(), this;
2387
+ return this.#e.zero(), this.#t.one(), this;
2378
2388
  }
2379
2389
  }
2380
- var G = /* @__PURE__ */ ((n) => (n[n.ROOT = 0] = "ROOT", n[n.POWER = 1] = "POWER", n))(G || {});
2381
- class Z {
2382
- #t;
2390
+ var Z = /* @__PURE__ */ ((r) => (r[r.ROOT = 0] = "ROOT", r[r.POWER = 1] = "POWER", r))(Z || {});
2391
+ class D {
2392
+ #i;
2383
2393
  // Determine the letters in the linear system, usually ['x', 'y']
2384
2394
  #e;
2385
2395
  constructor(...e) {
2386
- return this.#t = [], this.#e = [], e.length > 0 && this.parse(...e), this;
2396
+ return this.#i = [], this.#e = [], e.length > 0 && this.parse(...e), this;
2387
2397
  }
2388
- parse = (...e) => (this.#t = e.map((t) => new y(t)), this.#i(), this);
2389
- clone = () => new Z().parse(...this.#t.map((e) => e.clone()));
2398
+ parse = (...e) => (this.#i = e.map((t) => new y(t)), this.#t(), this);
2399
+ clone = () => new D().parse(...this.#i.map((e) => e.clone()));
2390
2400
  static fromMatrix(e, t = "xyz") {
2391
2401
  const i = e[0].length;
2392
- if (e.some((r) => r.length !== i))
2402
+ if (e.some((n) => n.length !== i))
2393
2403
  throw new Error("All rows must have the same number of columns");
2394
2404
  const s = t.split("").splice(0, i - 1);
2395
- return new Z(
2396
- ...e.map((r) => {
2397
- const o = new u(s.join(""), ...r);
2405
+ return new D(
2406
+ ...e.map((n) => {
2407
+ const o = new u(s.join(""), ...n);
2398
2408
  return new y(o, 0);
2399
2409
  })
2400
2410
  );
2401
2411
  }
2402
2412
  add(e, t) {
2403
- if (e instanceof Z) {
2413
+ if (e instanceof D) {
2404
2414
  const i = e.equations.length;
2405
- if (i !== this.#t.length)
2415
+ if (i !== this.#i.length)
2406
2416
  throw new Error("The number of equations must be the same");
2407
2417
  for (let s = 0; s < i; s++)
2408
- this.#t[s].add(e.equations[s]);
2418
+ this.#i[s].add(e.equations[s]);
2409
2419
  } else {
2410
- if (t === void 0 || t < 0 || t >= this.#t.length)
2420
+ if (t === void 0 || t < 0 || t >= this.#i.length)
2411
2421
  throw new Error("Index out of range");
2412
2422
  const i = new y(e);
2413
- this.#t[t].add(i);
2423
+ this.#i[t].add(i);
2414
2424
  }
2415
2425
  return this;
2416
2426
  }
2417
2427
  buildTex = (e, t) => {
2418
- let i, s, r = [];
2428
+ let i, s, n = [];
2419
2429
  const o = [];
2420
2430
  for (const l of e)
2421
- r = r.concat(l.letters());
2422
- r = [...new Set(r)], r.sort();
2431
+ n = n.concat(l.letters());
2432
+ n = [...new Set(n)], n.sort();
2423
2433
  for (let l = 0; l < e.length; l++) {
2424
2434
  const c = e[l];
2425
2435
  i = [];
2426
- for (const d of r)
2436
+ for (const d of n)
2427
2437
  s = c.left.monomByLetter(d), i.length === 0 ? i.push(s.isZero() ? "" : s.tex) : i.push(s.isZero() ? "" : (s.coefficient.sign() === 1 ? "+" : "") + s.tex);
2428
2438
  if (i.push("="), i.push(c.right.tex), t?.[l] !== void 0) {
2429
2439
  i[i.length - 1] = i[i.length - 1] + " \\phantom{\\quad}";
@@ -2433,20 +2443,20 @@ class Z {
2433
2443
  o.push(i.join("&"));
2434
2444
  }
2435
2445
  let h = 0;
2436
- return t !== void 0 && t.length > 0 && (h = t[0].length), `\\left\\{\\begin{array}{${"r".repeat(r.length)}cl ${"|l".repeat(h)}}${o.join("\\\\ ")}\\end{array}\\right.`;
2446
+ return t !== void 0 && t.length > 0 && (h = t[0].length), `\\left\\{\\begin{array}{${"r".repeat(n.length)}cl ${"|l".repeat(h)}}${o.join("\\\\ ")}\\end{array}\\right.`;
2437
2447
  };
2438
2448
  degree(e) {
2439
- return a.max(...this.#t.map((t) => t.degree(e)));
2449
+ return a.max(...this.#i.map((t) => t.degree(e)));
2440
2450
  }
2441
2451
  get display() {
2442
2452
  return this.tex + "as display";
2443
2453
  }
2444
2454
  // ------------------------------------------
2445
2455
  get equations() {
2446
- return this.#t;
2456
+ return this.#i;
2447
2457
  }
2448
2458
  set equations(e) {
2449
- this.#t = e;
2459
+ this.#i = e;
2450
2460
  }
2451
2461
  evaluate(e, t) {
2452
2462
  throw new Error("Method not implemented.");
@@ -2458,33 +2468,33 @@ class Z {
2458
2468
  return this.equations.every((t, i) => t.isEqual(e.equations[i]));
2459
2469
  }
2460
2470
  get isSolvable() {
2461
- return this.variables.length === this.#t.length;
2471
+ return this.variables.length === this.#i.length;
2462
2472
  }
2463
2473
  get matrix() {
2464
2474
  return this.#s();
2465
2475
  }
2466
2476
  mergeEquations = (e, t, i, s) => {
2467
- const r = e.clone().multiply(new a(i)), o = t.clone().multiply(new a(s));
2468
- return r.left.add(o.left), r.right.add(o.right), r;
2477
+ const n = e.clone().multiply(new a(i)), o = t.clone().multiply(new a(s));
2478
+ return n.left.add(o.left), n.right.add(o.right), n;
2469
2479
  };
2470
2480
  multiply(e, t) {
2471
2481
  if (Array.isArray(e)) {
2472
- if (e.length !== this.#t.length)
2482
+ if (e.length !== this.#i.length)
2473
2483
  throw new Error("The number of values must be the same as the number of equations");
2474
2484
  for (let i = 0; i < e.length; i++)
2475
- this.#t[i].multiply(e[i]);
2485
+ this.#i[i].multiply(e[i]);
2476
2486
  return this;
2477
2487
  }
2478
- if (t === void 0 || t < 0 || t >= this.#t.length)
2488
+ if (t === void 0 || t < 0 || t >= this.#i.length)
2479
2489
  throw new Error("Index out of range");
2480
- return this.#t[t].multiply(e), this;
2490
+ return this.#i[t].multiply(e), this;
2481
2491
  }
2482
2492
  reduce() {
2483
2493
  throw new Error("Method not implemented.");
2484
2494
  }
2485
2495
  // ------------------------------------------
2486
2496
  reorder = () => {
2487
- for (const e of this.#t)
2497
+ for (const e of this.#i)
2488
2498
  e.reorder();
2489
2499
  return this;
2490
2500
  };
@@ -2492,17 +2502,17 @@ class Z {
2492
2502
  return [];
2493
2503
  }
2494
2504
  solveMatrix = () => {
2495
- const [e, t] = this.matrix, i = e.map((s, r) => [...s, t[r]]);
2505
+ const [e, t] = this.matrix, i = e.map((s, n) => [...s, t[n]]);
2496
2506
  for (let s = 0; s < e.length; s++) {
2497
- let r = i[s][s].clone();
2498
- if (r.isZero()) {
2507
+ let n = i[s][s].clone();
2508
+ if (n.isZero()) {
2499
2509
  const o = i.find((h, l) => l > s && !h[s].isZero());
2500
2510
  if (o)
2501
- i[s].forEach((h, l) => h.add(o[l])), r = i[s][s].clone();
2511
+ i[s].forEach((h, l) => h.add(o[l])), n = i[s][s].clone();
2502
2512
  else
2503
2513
  throw new Error("Unsolvable...");
2504
2514
  }
2505
- i[s] = i[s].map((o) => o.divide(r));
2515
+ i[s] = i[s].map((o) => o.divide(n));
2506
2516
  for (let o = 0; o < e.length; o++) {
2507
2517
  if (o === s)
2508
2518
  continue;
@@ -2516,17 +2526,17 @@ class Z {
2516
2526
  return i.map((s) => s[s.length - 1]);
2517
2527
  };
2518
2528
  subtract(e, t) {
2519
- if (e instanceof Z) {
2529
+ if (e instanceof D) {
2520
2530
  const i = e.equations.length;
2521
- if (i !== this.#t.length)
2531
+ if (i !== this.#i.length)
2522
2532
  throw new Error("The number of equations must be the same");
2523
2533
  for (let s = 0; s < i; s++)
2524
- this.#t[s].subtract(e.equations[s]);
2534
+ this.#i[s].subtract(e.equations[s]);
2525
2535
  } else {
2526
- if (t === void 0 || t < 0 || t >= this.#t.length)
2536
+ if (t === void 0 || t < 0 || t >= this.#i.length)
2527
2537
  throw new Error("Index out of range");
2528
2538
  const i = new y(e);
2529
- this.#t[t].subtract(i);
2539
+ this.#i[t].subtract(i);
2530
2540
  }
2531
2541
  return this;
2532
2542
  }
@@ -2541,36 +2551,36 @@ class Z {
2541
2551
  const t = typeof e == "string" ? e.split("") : [...e];
2542
2552
  t.sort(), this.#e = t;
2543
2553
  }
2544
- #i = () => (this.#e = this.#t.reduce((e, t) => [.../* @__PURE__ */ new Set([...e, ...t.variables])], []), this.#e.sort(), this);
2554
+ #t = () => (this.#e = this.#i.reduce((e, t) => [.../* @__PURE__ */ new Set([...e, ...t.variables])], []), this.#e.sort(), this);
2545
2555
  #s = () => {
2546
2556
  const e = [], t = [];
2547
- for (const i of this.#t) {
2548
- const s = [], r = i.clone().reorder();
2557
+ for (const i of this.#i) {
2558
+ const s = [], n = i.clone().reorder();
2549
2559
  for (const o of this.variables) {
2550
- const h = r.left.monomByLetter(o);
2560
+ const h = n.left.monomByLetter(o);
2551
2561
  s.push(h.coefficient);
2552
2562
  }
2553
- t.push(r.right.monoms[0].coefficient), e.push(s);
2563
+ t.push(n.right.monoms[0].coefficient), e.push(s);
2554
2564
  }
2555
2565
  return [e, t];
2556
2566
  };
2557
2567
  }
2558
- class Pe {
2559
- #t;
2568
+ class qe {
2569
+ #i;
2560
2570
  /**
2561
2571
  *
2562
2572
  * @param {string} value (optional) Default polynom to parse on class creation
2563
2573
  */
2564
2574
  constructor(e) {
2565
- return this.#t = [], e !== void 0 && this.parse(e), this;
2575
+ return this.#i = [], e !== void 0 && this.parse(e), this;
2566
2576
  }
2567
- parse = (e) => (this.#t = new _(D.SET).parse(e).rpn, this);
2577
+ parse = (e) => (this.#i = new X(z.SET).parse(e).rpn, this);
2568
2578
  evaluate(e) {
2569
2579
  this.variables.forEach((i) => {
2570
2580
  Object.hasOwn(e, i) || (e[i] = !1);
2571
2581
  });
2572
2582
  const t = [];
2573
- for (const i of this.#t)
2583
+ for (const i of this.#i)
2574
2584
  if (console.log(i), i.tokenType === "variable")
2575
2585
  t.push(e[i.token]);
2576
2586
  else if (i.tokenType === "operation")
@@ -2581,14 +2591,14 @@ class Pe {
2581
2591
  } else
2582
2592
  return !1;
2583
2593
  else {
2584
- const s = t.pop(), r = t.pop();
2585
- if (s !== void 0 && r !== void 0)
2594
+ const s = t.pop(), n = t.pop();
2595
+ if (s !== void 0 && n !== void 0)
2586
2596
  switch (i.token) {
2587
2597
  case "&":
2588
- t.push(s && r);
2598
+ t.push(s && n);
2589
2599
  break;
2590
2600
  case "|":
2591
- t.push(s || r);
2601
+ t.push(s || n);
2592
2602
  break;
2593
2603
  case "-":
2594
2604
  return !1;
@@ -2599,11 +2609,11 @@ class Pe {
2599
2609
  return t.length === 1 && t[0];
2600
2610
  }
2601
2611
  get rpn() {
2602
- return this.#t;
2612
+ return this.#i;
2603
2613
  }
2604
2614
  get tex() {
2605
2615
  const e = [];
2606
- for (const t of this.#t)
2616
+ for (const t of this.#i)
2607
2617
  if (t.tokenType === "variable")
2608
2618
  e.push(t);
2609
2619
  else
@@ -2636,7 +2646,7 @@ class Pe {
2636
2646
  return e[0].token;
2637
2647
  }
2638
2648
  get variables() {
2639
- return this.#t.filter((e) => e.tokenType === "variable").map((e) => e.token);
2649
+ return this.#i.filter((e) => e.tokenType === "variable").map((e) => e.token);
2640
2650
  }
2641
2651
  vennAB() {
2642
2652
  return this.#e(
@@ -2662,18 +2672,18 @@ class Pe {
2662
2672
  let s;
2663
2673
  if (t === void 0) {
2664
2674
  s = /* @__PURE__ */ new Set();
2665
- for (const r in e)
2675
+ for (const n in e)
2666
2676
  s = /* @__PURE__ */ new Set([
2667
2677
  ...s,
2668
- ...e[r] ?? []
2678
+ ...e[n] ?? []
2669
2679
  ]);
2670
2680
  } else
2671
2681
  s = new Set(t);
2672
- for (const r of this.#t)
2673
- if (r.tokenType === "variable")
2674
- e[r.token] === void 0 ? i.push(/* @__PURE__ */ new Set()) : i.push(new Set(e[r.token]));
2682
+ for (const n of this.#i)
2683
+ if (n.tokenType === "variable")
2684
+ e[n.token] === void 0 ? i.push(/* @__PURE__ */ new Set()) : i.push(new Set(e[n.token]));
2675
2685
  else
2676
- switch (r.token) {
2686
+ switch (n.token) {
2677
2687
  case "&":
2678
2688
  if (i.length >= 2) {
2679
2689
  const o = i.pop(), h = i.pop();
@@ -2703,7 +2713,7 @@ class Pe {
2703
2713
  }
2704
2714
  }
2705
2715
  class T {
2706
- #t = G.POWER;
2716
+ #i = Z.POWER;
2707
2717
  #e = [];
2708
2718
  constructor(...e) {
2709
2719
  return this.parse(...e), this;
@@ -2717,30 +2727,30 @@ class T {
2717
2727
  return new T(...this.#e.map((e) => e.clone()));
2718
2728
  }
2719
2729
  get tex() {
2720
- const { num: e, den: t } = this.#r();
2730
+ const { num: e, den: t } = this.#n();
2721
2731
  if (t.length === 0)
2722
- return e.length === 1 ? e[0].asSingle.tex : e.map((r) => r.tex).join("");
2723
- const i = e.length === 1 ? e[0].asSingle.tex : e.map((r) => r.tex).join(""), s = t.length === 1 ? t[0].asSingle.tex : t.map((r) => r.tex).join("");
2732
+ return e.length === 1 ? e[0].asSingle.tex : e.map((n) => n.tex).join("");
2733
+ const i = e.length === 1 ? e[0].asSingle.tex : e.map((n) => n.tex).join(""), s = t.length === 1 ? t[0].asSingle.tex : t.map((n) => n.tex).join("");
2724
2734
  return `\\frac{ ${i} }{ ${s} }`;
2725
2735
  }
2726
2736
  get display() {
2727
- const { num: e, den: t } = this.#r();
2737
+ const { num: e, den: t } = this.#n();
2728
2738
  if (t.length === 0)
2729
2739
  return e.length === 1 ? e[0].asSingle.display : e.map(
2730
- (r, o) => o === 0 && r.polynom.monoms.length === 1 ? r.asSingle.display : r.display
2740
+ (n, o) => o === 0 && n.polynom.monoms.length === 1 ? n.asSingle.display : n.display
2731
2741
  ).join("");
2732
- const i = e.length === 1 ? e[0].asSingle.display : e.map((r) => r.display).join(""), s = t.length === 1 ? t[0].asSingle.display : t.map((r) => r.display).join("");
2742
+ const i = e.length === 1 ? e[0].asSingle.display : e.map((n) => n.display).join(""), s = t.length === 1 ? t[0].asSingle.display : t.map((n) => n.display).join("");
2733
2743
  return `(${i})/(${s})`;
2734
2744
  }
2735
- static #i(e, t) {
2736
- const i = U(e), s = U(t), o = Object.keys(i).filter((h) => Object.hasOwn(s, h)).map((h) => {
2745
+ static #t(e, t) {
2746
+ const i = L(e), s = L(t), o = Object.keys(i).filter((h) => Object.hasOwn(s, h)).map((h) => {
2737
2747
  const l = i[h].reduce((d, m) => d.add(m.power), new a("0")), c = s[h].reduce((d, m) => d.add(m.power), new a("0"));
2738
2748
  return new x(h, a.min(l, c));
2739
2749
  });
2740
2750
  return new T(...o);
2741
2751
  }
2742
2752
  static #s(e, t) {
2743
- const i = U(e), s = U(t), o = [.../* @__PURE__ */ new Set([...Object.keys(i), ...Object.keys(s)])].map((h) => {
2753
+ const i = L(e), s = L(t), o = [.../* @__PURE__ */ new Set([...Object.keys(i), ...Object.keys(s)])].map((h) => {
2744
2754
  const l = Object.hasOwn(i, h) ? i[h].reduce((d, m) => d.add(m.power), new a("0")) : new a(0), c = Object.hasOwn(s, h) ? s[h].reduce((d, m) => d.add(m.power), new a("0")) : new a(0);
2745
2755
  return new x(h, a.max(l, c));
2746
2756
  });
@@ -2752,9 +2762,9 @@ class T {
2752
2762
  if (e.length === 1)
2753
2763
  return e[0];
2754
2764
  if (e.length === 2)
2755
- return T.#i(e[0], e[1]);
2765
+ return T.#t(e[0], e[1]);
2756
2766
  let t = e[0];
2757
- return e.shift(), e.forEach((i) => t = T.#i(t, i)), t;
2767
+ return e.shift(), e.forEach((i) => t = T.#t(t, i)), t;
2758
2768
  }
2759
2769
  static lcm(...e) {
2760
2770
  if (e.length === 0)
@@ -2773,19 +2783,19 @@ class T {
2773
2783
  l.multiply(h.clone().divide(i[c]));
2774
2784
  }), s = h;
2775
2785
  }
2776
- const r = T.gcd(...t), o = new u(0).add(
2777
- ...t.map((h) => h.divide(r).reduce().develop().factors[0].polynom)
2786
+ const n = T.gcd(...t), o = new u(0).add(
2787
+ ...t.map((h) => h.divide(n).reduce().develop().factors[0].polynom)
2778
2788
  ).reduce();
2779
2789
  return this.#e = [
2780
- ...r.factors,
2790
+ ...n.factors,
2781
2791
  new x(o)
2782
2792
  ], s && this.divide(s), this.#e = this.#e.filter((h) => !h.power.isZero()), this;
2783
2793
  }
2784
2794
  get asPower() {
2785
- return this.#t = G.POWER, this;
2795
+ return this.#i = Z.POWER, this;
2786
2796
  }
2787
2797
  get asRoot() {
2788
- return this.#t = G.ROOT, this;
2798
+ return this.#i = Z.ROOT, this;
2789
2799
  }
2790
2800
  degree(e) {
2791
2801
  return this.#e.reduce((t, i) => t.add(i.degree(e)), new a("0"));
@@ -2798,9 +2808,9 @@ class T {
2798
2808
  derivative() {
2799
2809
  const e = [], t = this.#e.length;
2800
2810
  for (let s = 0; s < t; s++) {
2801
- const r = this.#e.slice(), o = r.splice(s, 1)[0].derivative();
2811
+ const n = this.#e.slice(), o = n.splice(s, 1)[0].derivative();
2802
2812
  e.push(
2803
- new T(...r, ...o)
2813
+ new T(...n, ...o)
2804
2814
  );
2805
2815
  }
2806
2816
  e.forEach((s) => s.reduce());
@@ -2831,8 +2841,8 @@ class T {
2831
2841
  } else
2832
2842
  t.push(o.clone());
2833
2843
  });
2834
- const i = new T(...t), s = i.numerator.reduce(), r = i.denominator.reduce();
2835
- return s.divide(r);
2844
+ const i = new T(...t), s = i.numerator.reduce(), n = i.denominator.reduce();
2845
+ return s.divide(n);
2836
2846
  }
2837
2847
  get factors() {
2838
2848
  return this.#e;
@@ -2855,7 +2865,7 @@ class T {
2855
2865
  const e = [].concat(...this.#e.map((t) => t.polynom.getZeroes()));
2856
2866
  return e.sort((t, i) => t.value - i.value), e.filter(
2857
2867
  (t, i, s) => i === s.findIndex(
2858
- (r) => r.value === t.value
2868
+ (n) => n.value === t.value
2859
2869
  )
2860
2870
  );
2861
2871
  }
@@ -2897,9 +2907,9 @@ class T {
2897
2907
  throw new Error("Method not implemented.");
2898
2908
  }
2899
2909
  reduce() {
2900
- const e = U(this);
2910
+ const e = L(this);
2901
2911
  return this.#e = Object.values(e).map((t) => {
2902
- const i = t[0].polynom, s = t.reduce((r, o) => r.add(o.power), new a("0"));
2912
+ const i = t[0].polynom, s = t.reduce((n, o) => n.add(o.power), new a("0"));
2903
2913
  return new x(i, s.reduce());
2904
2914
  }).filter((t) => !t.power.isZero()), this;
2905
2915
  }
@@ -2914,14 +2924,14 @@ class T {
2914
2924
  */
2915
2925
  sort(e) {
2916
2926
  return this.#e.sort((t, i) => {
2917
- const s = t.power.value, r = i.power.value;
2918
- if (s * r < 0)
2927
+ const s = t.power.value, n = i.power.value;
2928
+ if (s * n < 0)
2919
2929
  return -s;
2920
2930
  const o = t.polynom.monoms.length, h = i.polynom.monoms.length;
2921
2931
  if (o !== h)
2922
2932
  return o - h;
2923
2933
  const l = t.polynom.degree(e).value, c = i.polynom.degree(e).value;
2924
- return l !== c ? l - c : s !== r ? s - r : t.degree().isLeq(i.degree()) ? -1 : 1;
2934
+ return l !== c ? l - c : s !== n ? s - n : t.degree().isLeq(i.degree()) ? -1 : 1;
2925
2935
  }), this;
2926
2936
  }
2927
2937
  sqrt() {
@@ -2931,35 +2941,35 @@ class T {
2931
2941
  return this.add(...e.map((t) => t.opposite()));
2932
2942
  }
2933
2943
  tableOfSigns() {
2934
- const e = this.getZeroes(), t = e.map((r) => r.value), i = this.factorize().factors.map((r) => ({ factor: new x(r), ...r.tableOfSigns() }));
2935
- return i.forEach((r) => {
2944
+ const e = this.getZeroes(), t = e.map((n) => n.value), i = this.factorize().factors.map((n) => ({ factor: new x(n), ...n.tableOfSigns() }));
2945
+ return i.forEach((n) => {
2936
2946
  const o = new Array(2 * e.length + 1).fill("");
2937
- let h = r.signs.shift(), l = r.roots.shift();
2947
+ let h = n.signs.shift(), l = n.roots.shift();
2938
2948
  const c = o.map((d, m) => {
2939
2949
  if (m % 2 === 0)
2940
2950
  return h;
2941
2951
  if (l === void 0 || l.value !== t[(m - 1) / 2])
2942
2952
  return "t";
2943
- const w = r.signs.shift();
2944
- return h = r.signs.shift(), l = r.roots.shift(), w;
2953
+ const w = n.signs.shift();
2954
+ return h = n.signs.shift(), l = n.roots.shift(), w;
2945
2955
  });
2946
- r.roots = e, r.signs = c;
2947
- }), { signs: i.map((r) => [...r.signs]).reduce((r, o) => r.length === 0 ? o : (o.forEach((h, l) => {
2956
+ n.roots = e, n.signs = c;
2957
+ }), { signs: i.map((n) => [...n.signs]).reduce((n, o) => n.length === 0 ? o : (o.forEach((h, l) => {
2948
2958
  switch (h) {
2949
2959
  case "d":
2950
- r[l] = "d";
2960
+ n[l] = "d";
2951
2961
  break;
2952
2962
  case "z":
2953
- r[l] = r[l] === "d" ? "d" : "z";
2963
+ n[l] = n[l] === "d" ? "d" : "z";
2954
2964
  break;
2955
2965
  case "h":
2956
- r[l] = "h";
2966
+ n[l] = "h";
2957
2967
  break;
2958
2968
  case "-":
2959
- r[l] = r[l] === "h" ? "h" : r[l] === "-" ? "+" : "-";
2969
+ n[l] = n[l] === "h" ? "h" : n[l] === "-" ? "+" : "-";
2960
2970
  break;
2961
2971
  }
2962
- }), r), []), roots: e, factors: i };
2972
+ }), n), []), roots: e, factors: i };
2963
2973
  }
2964
2974
  get variables() {
2965
2975
  return this.#e.reduce((e, t) => e.concat(t.variables), []);
@@ -2967,24 +2977,24 @@ class T {
2967
2977
  zero() {
2968
2978
  return this.#e = [new x("0", "1")], this;
2969
2979
  }
2970
- #r() {
2980
+ #n() {
2971
2981
  let e, t = [];
2972
- return this.#t === G.ROOT ? (e = this.numerator.factors, t = this.denominator.factors) : e = this.#e, e.length === 0 && (e = [new x("1")]), { num: e, den: t };
2982
+ return this.#i === Z.ROOT ? (e = this.numerator.factors, t = this.denominator.factors) : e = this.#e, e.length === 0 && (e = [new x("1")]), { num: e, den: t };
2973
2983
  }
2974
2984
  }
2975
- function U(n) {
2976
- const e = new a().one(), t = new a().one(), i = n.factors.reduce((o, h) => {
2985
+ function L(r) {
2986
+ const e = new a().one(), t = new a().one(), i = r.factors.reduce((o, h) => {
2977
2987
  if (h.polynom.degree().isZero())
2978
2988
  return h.power.isPositive() ? e.multiply(h.polynom.monoms[0].coefficient) : t.multiply(h.polynom.monoms[0].coefficient), o;
2979
2989
  const l = h.polynom.display;
2980
2990
  return Object.hasOwn(o, l) ? o[l].push(h) : o[l] = [h], o;
2981
- }, {}), { numerator: s, denominator: r } = e.divide(t).reduce();
2982
- return s !== 1 && (i[s.toString()] = [new x(s, 1)]), r !== 1 && (i[r.toString()] = [new x(r, -1)]), i;
2991
+ }, {}), { numerator: s, denominator: n } = e.divide(t).reduce();
2992
+ return s !== 1 && (i[s.toString()] = [new x(s, 1)]), n !== 1 && (i[n.toString()] = [new x(n, -1)]), i;
2983
2993
  }
2984
- class P {
2985
- #t = null;
2994
+ class I {
2995
+ #i = null;
2986
2996
  #e = !0;
2987
- #i = [];
2997
+ #t = [];
2988
2998
  constructor(e, t) {
2989
2999
  return e && (t = t ?? e, this.fromDimensions(e, t)), this;
2990
3000
  }
@@ -2993,31 +3003,31 @@ class P {
2993
3003
  }
2994
3004
  clone() {
2995
3005
  const e = [];
2996
- return this.#i.forEach((t) => {
3006
+ return this.#t.forEach((t) => {
2997
3007
  const i = [];
2998
3008
  t.forEach((s) => {
2999
3009
  i.push(s.clone());
3000
3010
  }), e.push(i);
3001
- }), new P().fromValues(e);
3011
+ }), new I().fromValues(e);
3002
3012
  }
3003
3013
  get tex() {
3004
- if (this.#i.length === 0)
3014
+ if (this.#t.length === 0)
3005
3015
  return "";
3006
3016
  const e = this.#e ? "pmatrix" : "bmatrix", t = [
3007
3017
  `\\begin{${e}}`,
3008
3018
  ...this.rows.map(
3009
- (i) => " " + i.map((s) => this.#t !== null && s.value ? +s.value.toFixed(this.#t) : s.tex).join(" & ") + "\\\\"
3019
+ (i) => " " + i.map((s) => this.#i !== null && s.value ? +s.value.toFixed(this.#i) : s.tex).join(" & ") + "\\\\"
3010
3020
  ),
3011
3021
  `\\end{${e}}`
3012
3022
  ].join(`
3013
3023
  `);
3014
- return this.#t = null, t;
3024
+ return this.#i = null, t;
3015
3025
  }
3016
3026
  get display() {
3017
- if (this.#i.length === 0)
3027
+ if (this.#t.length === 0)
3018
3028
  return "";
3019
- const e = this.#e ? ["(", ")"] : ["[", "]"], t = e[0] + this.map((i) => this.#t !== null && i.value ? +i.value.toFixed(this.#t) : i.display).map((i) => `(${i.join(",")})`).join(",") + e[1];
3020
- return this.#t = null, t;
3029
+ const e = this.#e ? ["(", ")"] : ["[", "]"], t = e[0] + this.map((i) => this.#i !== null && i.value ? +i.value.toFixed(this.#i) : i.display).map((i) => `(${i.join(",")})`).join(",") + e[1];
3030
+ return this.#i = null, t;
3021
3031
  }
3022
3032
  add(e) {
3023
3033
  if (!this.canBeAdded(e))
@@ -3027,14 +3037,14 @@ class P {
3027
3037
  }), this;
3028
3038
  }
3029
3039
  aij(e, t) {
3030
- return e < 0 || e > this.dimension.rows || t < 0 || t > this.dimension.cols ? null : this.#i[e][t];
3040
+ return e < 0 || e > this.dimension.rows || t < 0 || t > this.dimension.cols ? null : this.#t[e][t];
3031
3041
  }
3032
3042
  get bmatrix() {
3033
3043
  return this.#e = !1, this;
3034
3044
  }
3035
3045
  canBeAdded(e) {
3036
- const { rows: t, cols: i } = this.dimension, { rows: s, cols: r } = e.dimension;
3037
- return t === s && i === r;
3046
+ const { rows: t, cols: i } = this.dimension, { rows: s, cols: n } = e.dimension;
3047
+ return t === s && i === n;
3038
3048
  }
3039
3049
  canBeInverted() {
3040
3050
  return !(!this.isSquare() || this.determinant().isZero());
@@ -3044,7 +3054,7 @@ class P {
3044
3054
  }
3045
3055
  characteristic_polynom(e) {
3046
3056
  return e ??= "k", this.clone().subtract(
3047
- new P(this.dimension.rows).one().multiply(new u(e))
3057
+ new I(this.dimension.rows).one().multiply(new u(e))
3048
3058
  ).determinant();
3049
3059
  }
3050
3060
  cofactor(e, t) {
@@ -3063,83 +3073,83 @@ class P {
3063
3073
  if (!this.isSquare())
3064
3074
  throw new Error("Matrix is not square");
3065
3075
  const e = new u();
3066
- return this.#i.length === 1 ? this.#i[0][0].clone() : (this.values[0].forEach((t, i) => {
3076
+ return this.#t.length === 1 ? this.#t[0][0].clone() : (this.values[0].forEach((t, i) => {
3067
3077
  const s = this.cofactor(0, i);
3068
3078
  e.add(t.clone().multiply(s));
3069
3079
  }), e);
3070
3080
  }
3071
3081
  get dimension() {
3072
3082
  return {
3073
- rows: this.#i.length,
3074
- cols: this.#i[0].length
3083
+ rows: this.#t.length,
3084
+ cols: this.#t[0].length
3075
3085
  };
3076
3086
  }
3077
3087
  flat() {
3078
- return this.#i.flat();
3088
+ return this.#t.flat();
3079
3089
  }
3080
3090
  forEach(e) {
3081
- this.#i.forEach((t, i) => {
3082
- t.forEach((s, r) => {
3083
- e(s, i, r);
3091
+ this.#t.forEach((t, i) => {
3092
+ t.forEach((s, n) => {
3093
+ e(s, i, n);
3084
3094
  });
3085
3095
  });
3086
3096
  }
3087
3097
  fromDimensions(e, t) {
3088
- return this.#i = Array.from({ length: e }, () => Array.from({ length: t }, () => new u())), this;
3098
+ return this.#t = Array.from({ length: e }, () => Array.from({ length: t }, () => new u())), this;
3089
3099
  }
3090
3100
  fromString(e) {
3091
3101
  if (e.startsWith("((") && e.endsWith("))"))
3092
3102
  return this.fromString(e.substring(1, e.length - 1));
3093
3103
  const t = e.split("),(");
3094
- return this.#i = t.map((i, s) => s === 0 ? i.substring(1).split(",") : s === t.length - 1 ? i.substring(0, i.length - 1).split(",") : i.split(",")).map(
3104
+ return this.#t = t.map((i, s) => s === 0 ? i.substring(1).split(",") : s === t.length - 1 ? i.substring(0, i.length - 1).split(",") : i.split(",")).map(
3095
3105
  (i) => i.map((s) => new u(s))
3096
3106
  ), this;
3097
3107
  }
3098
3108
  fromValues(e) {
3099
- this.#i = [];
3109
+ this.#t = [];
3100
3110
  const t = e[0].length;
3101
3111
  if (e.some((i) => i.length !== t))
3102
3112
  throw new Error("Each line must be the same length");
3103
3113
  return e.forEach((i) => {
3104
3114
  const s = [];
3105
- i.forEach((r) => {
3106
- s.push(new u(r));
3107
- }), this.#i.push(s);
3115
+ i.forEach((n) => {
3116
+ s.push(new u(n));
3117
+ }), this.#t.push(s);
3108
3118
  }), this;
3109
3119
  }
3110
3120
  fromVectors(...e) {
3111
- this.#i = [];
3121
+ this.#t = [];
3112
3122
  const t = e[0].dimension;
3113
3123
  if (e.some((i) => i.dimension !== t))
3114
3124
  throw new Error("Each vectors must be the same dimension");
3115
3125
  return this.fromDimensions(e[0].dimension, e.length), e.forEach((i, s) => {
3116
- i.array.forEach((r, o) => {
3117
- this.#i[o][s] = new u(r);
3126
+ i.array.forEach((n, o) => {
3127
+ this.#t[o][s] = new u(n);
3118
3128
  });
3119
3129
  }), this;
3120
3130
  }
3121
3131
  inverse() {
3122
3132
  if (!this.canBeInverted())
3123
3133
  throw new Error("The matrix cannot be inverted.");
3124
- const e = new P().fromDimensions(this.dimension.rows, this.dimension.cols);
3125
- e.forEach((i, s, r) => {
3126
- e.setValue(s, r, this.cofactor(s, r));
3134
+ const e = new I().fromDimensions(this.dimension.rows, this.dimension.cols);
3135
+ e.forEach((i, s, n) => {
3136
+ e.setValue(s, n, this.cofactor(s, n));
3127
3137
  }), e.transpose();
3128
3138
  const t = this.determinant();
3129
- return e.forEach((i, s, r) => this.setValue(s, r, i.divide(t).reduce())), this;
3139
+ return e.forEach((i, s, n) => this.setValue(s, n, i.divide(t).reduce())), this;
3130
3140
  }
3131
3141
  isEqual(e) {
3132
3142
  if (!this.canBeAdded(e))
3133
3143
  return !1;
3134
3144
  let t = !0;
3135
- return this.forEach((i, s, r) => {
3136
- t &&= i.isEqual(e.values[s][r]);
3145
+ return this.forEach((i, s, n) => {
3146
+ t &&= i.isEqual(e.values[s][n]);
3137
3147
  }), t;
3138
3148
  }
3139
3149
  isOne() {
3140
- for (let e = 0; e < this.#i.length; e++)
3141
- for (let t = 0; t < this.#i[e].length; t++)
3142
- if (t === e && !this.#i[e][t].isOne() || t !== e && !this.#i[e][t].isZero())
3150
+ for (let e = 0; e < this.#t.length; e++)
3151
+ for (let t = 0; t < this.#t[e].length; t++)
3152
+ if (t === e && !this.#t[e][t].isOne() || t !== e && !this.#t[e][t].isZero())
3143
3153
  return !1;
3144
3154
  return !0;
3145
3155
  }
@@ -3152,23 +3162,23 @@ class P {
3152
3162
  map(e) {
3153
3163
  const { rows: t, cols: i } = this.dimension, s = Array.from({ length: t }, () => Array.from({ length: i }, () => {
3154
3164
  }));
3155
- return this.#i.forEach((r, o) => {
3156
- r.forEach((h, l) => {
3165
+ return this.#t.forEach((n, o) => {
3166
+ n.forEach((h, l) => {
3157
3167
  s[o][l] = e(h, o, l);
3158
3168
  });
3159
3169
  }), s;
3160
3170
  }
3161
3171
  multiply(e) {
3162
- if (e instanceof P) {
3172
+ if (e instanceof I) {
3163
3173
  if (!this.canBeMultiplied(e))
3164
3174
  throw new Error("Cannot multiply a matrix with incompatibles dimensions");
3165
- const t = new P(this.dimension.rows, e.dimension.cols);
3166
- return t.forEach((i, s, r) => {
3167
- const o = this.rows[s], h = e.cols[r], l = new u();
3175
+ const t = new I(this.dimension.rows, e.dimension.cols);
3176
+ return t.forEach((i, s, n) => {
3177
+ const o = this.rows[s], h = e.cols[n], l = new u();
3168
3178
  o.forEach((c, d) => {
3169
3179
  l.add(c.clone().multiply(h[d]));
3170
- }), t.setValue(s, r, l);
3171
- }), this.#i = t.values, this;
3180
+ }), t.setValue(s, n, l);
3181
+ }), this.#t = t.values, this;
3172
3182
  }
3173
3183
  return this.forEach((t, i, s) => {
3174
3184
  this.setValue(i, s, t.multiply(e));
@@ -3188,19 +3198,19 @@ class P {
3188
3198
  return this.#e = !0, this;
3189
3199
  }
3190
3200
  pow(e) {
3191
- return de(this, e);
3201
+ return se(this, e);
3192
3202
  }
3193
3203
  reduce() {
3194
3204
  throw new Error("Not yet implemented");
3195
3205
  }
3196
3206
  get rows() {
3197
- return this.#i;
3207
+ return this.#t;
3198
3208
  }
3199
3209
  setValue(e, t, i) {
3200
- const { rows: s, cols: r } = this.dimension;
3201
- if (e < 0 || e >= s || t < 0 || t >= r)
3202
- throw new Error(`${e}x${t} is out of range (${s}x${r})`);
3203
- return this.#i[e][t] = new u(i), this;
3210
+ const { rows: s, cols: n } = this.dimension;
3211
+ if (e < 0 || e >= s || t < 0 || t >= n)
3212
+ throw new Error(`${e}x${t} is out of range (${s}x${n})`);
3213
+ return this.#t[e][t] = new u(i), this;
3204
3214
  }
3205
3215
  subtract(e) {
3206
3216
  if (!this.canBeAdded(e))
@@ -3210,7 +3220,7 @@ class P {
3210
3220
  }), this;
3211
3221
  }
3212
3222
  toFixed(e) {
3213
- return this.#t = e, this;
3223
+ return this.#i = e, this;
3214
3224
  }
3215
3225
  transpose() {
3216
3226
  return this.clone().forEach((t, i, s) => {
@@ -3218,46 +3228,46 @@ class P {
3218
3228
  }), this;
3219
3229
  }
3220
3230
  get values() {
3221
- return this.#i;
3231
+ return this.#t;
3222
3232
  }
3223
3233
  zero() {
3224
3234
  return this.forEach((e) => e.zero()), this;
3225
3235
  }
3226
3236
  }
3227
- function De(n, e) {
3228
- return n.dimension === e.dimension && n.array.every(
3237
+ function Te(r, e) {
3238
+ return r.dimension === e.dimension && r.array.every(
3229
3239
  (t, i) => e.array[i].isEqual(t)
3230
3240
  );
3231
3241
  }
3232
- function Le(n, e) {
3233
- if (n.dimension !== e.dimension)
3242
+ function Oe(r, e) {
3243
+ if (r.dimension !== e.dimension)
3234
3244
  return !1;
3235
- const t = e.array[0].value / n.array[0].value;
3236
- return n.array.every(
3245
+ const t = e.array[0].value / r.array[0].value;
3246
+ return r.array.every(
3237
3247
  (i, s) => e.array[s].value === i.value * t
3238
3248
  );
3239
3249
  }
3240
- function Ze(n, e) {
3241
- return n.dimension !== e.dimension ? new a().invalid() : n.array.reduce(
3250
+ function Ce(r, e) {
3251
+ return r.dimension !== e.dimension ? new a().invalid() : r.array.reduce(
3242
3252
  (t, i, s) => t.add(i.clone().multiply(e.array[s])),
3243
3253
  new a(0)
3244
3254
  );
3245
3255
  }
3246
- function He(...n) {
3247
- if (n.some((e) => e.dimension !== n[0].dimension))
3256
+ function De(...r) {
3257
+ if (r.some((e) => e.dimension !== r[0].dimension))
3248
3258
  throw new Error("All vectors must have the same dimension");
3249
- if (n[0].dimension !== n.length)
3250
- throw new Error(`The determinant of dimension ${n[0].dimension} must have the same number of vectors (${n.length} given)`);
3251
- return n[0].dimension === 2 ? n[0].array[0].clone().multiply(n[1].array[1]).subtract(n[0].array[1].clone().multiply(n[1].array[0])) : n[0].array[0].clone().multiply(
3252
- n[1].array[1].clone().multiply(n[2].array[2]).subtract(n[1].array[2].clone().multiply(n[2].array[1]))
3259
+ if (r[0].dimension !== r.length)
3260
+ throw new Error(`The determinant of dimension ${r[0].dimension} must have the same number of vectors (${r.length} given)`);
3261
+ return r[0].dimension === 2 ? r[0].array[0].clone().multiply(r[1].array[1]).subtract(r[0].array[1].clone().multiply(r[1].array[0])) : r[0].array[0].clone().multiply(
3262
+ r[1].array[1].clone().multiply(r[2].array[2]).subtract(r[1].array[2].clone().multiply(r[2].array[1]))
3253
3263
  ).subtract(
3254
- n[0].array[1].clone().multiply(
3255
- n[1].array[0].clone().multiply(n[2].array[2]).subtract(n[1].array[2].clone().multiply(n[2].array[0]))
3264
+ r[0].array[1].clone().multiply(
3265
+ r[1].array[0].clone().multiply(r[2].array[2]).subtract(r[1].array[2].clone().multiply(r[2].array[0]))
3256
3266
  )
3257
- ).add(n[0].array[2].clone().multiply(n[1].array[0].clone().multiply(n[2].array[1]).subtract(n[1].array[1].clone().multiply(n[2].array[0]))));
3267
+ ).add(r[0].array[2].clone().multiply(r[1].array[0].clone().multiply(r[2].array[1]).subtract(r[1].array[1].clone().multiply(r[2].array[0]))));
3258
3268
  }
3259
3269
  class g {
3260
- #t = [];
3270
+ #i = [];
3261
3271
  #e = !1;
3262
3272
  constructor(...e) {
3263
3273
  e.length > 0 && this.parse(...e);
@@ -3266,32 +3276,32 @@ class g {
3266
3276
  // Getter and setter
3267
3277
  // ------------------------------------------
3268
3278
  get array() {
3269
- return this.#t;
3279
+ return this.#i;
3270
3280
  }
3271
3281
  set array(e) {
3272
- this.#t = e;
3282
+ this.#i = e;
3273
3283
  }
3274
3284
  get x() {
3275
- return this.#t[0];
3285
+ return this.#i[0];
3276
3286
  }
3277
3287
  set x(e) {
3278
- this.#t[0] = new a(e);
3288
+ this.#i[0] = new a(e);
3279
3289
  }
3280
3290
  get y() {
3281
- return this.#t[1];
3291
+ return this.#i[1];
3282
3292
  }
3283
3293
  set y(e) {
3284
- this.#t[1] = new a(e);
3294
+ this.#i[1] = new a(e);
3285
3295
  }
3286
3296
  get z() {
3287
3297
  if (this.dimension < 3)
3288
3298
  throw new Error("Vector is not 3D");
3289
- return this.#t[2];
3299
+ return this.#i[2];
3290
3300
  }
3291
3301
  set z(e) {
3292
3302
  if (this.dimension < 3)
3293
3303
  throw new Error("Vector is not 3D");
3294
- this.#t[2] = new a(e);
3304
+ this.#i[2] = new a(e);
3295
3305
  }
3296
3306
  get asPoint() {
3297
3307
  return this.#e;
@@ -3315,10 +3325,10 @@ class g {
3315
3325
  if (e < 2)
3316
3326
  throw new Error("Dimension must be at least 2");
3317
3327
  if (e < this.dimension)
3318
- this.#t = this.#t.slice(0, e);
3328
+ this.#i = this.#i.slice(0, e);
3319
3329
  else if (e > this.dimension)
3320
3330
  for (let t = this.dimension; t < e; t++)
3321
- this.#t.push(new a(0));
3331
+ this.#i.push(new a(0));
3322
3332
  return this;
3323
3333
  }
3324
3334
  get dimension() {
@@ -3354,22 +3364,22 @@ class g {
3354
3364
  if (t instanceof g && i instanceof g) {
3355
3365
  if (t.dimension !== i.dimension)
3356
3366
  throw new Error("Vectors must have the same dimension");
3357
- return this.#t = i.array.map((s, r) => s.clone().subtract(t.array[r])), this;
3367
+ return this.#i = i.array.map((s, n) => s.clone().subtract(t.array[n])), this;
3358
3368
  }
3359
3369
  }
3360
- return this.#t = e.map((t) => new a(t)), this;
3370
+ return this.#i = e.map((t) => new a(t)), this;
3361
3371
  }
3362
3372
  clone() {
3363
3373
  const e = new g();
3364
3374
  return e.array = this.copy(), e.asPoint = this.asPoint, e;
3365
3375
  }
3366
3376
  copy() {
3367
- return this.#t.map((e) => e.clone());
3377
+ return this.#i.map((e) => e.clone());
3368
3378
  }
3369
- zero = () => (this.#t.forEach((e) => e.zero()), this);
3379
+ zero = () => (this.#i.forEach((e) => e.zero()), this);
3370
3380
  one = () => (this.zero(), this.x.one(), this);
3371
- opposite = () => (this.#t.forEach((e) => e.opposite()), this);
3372
- add = (e) => (this.#t.forEach((t, i) => t.add(e.array[i])), this);
3381
+ opposite = () => (this.#i.forEach((e) => e.opposite()), this);
3382
+ add = (e) => (this.#i.forEach((t, i) => t.add(e.array[i])), this);
3373
3383
  subtract = (e) => this.add(e.clone().opposite());
3374
3384
  unit = () => {
3375
3385
  const e = this.norm;
@@ -3385,7 +3395,7 @@ class g {
3385
3395
  translate(...e) {
3386
3396
  return this.array.forEach((t, i) => t.add(e[i])), this;
3387
3397
  }
3388
- dot = (e) => Ze(this, e);
3398
+ dot = (e) => Ce(this, e);
3389
3399
  cross(e) {
3390
3400
  if (this.dimension !== 3 || e.dimension !== 3)
3391
3401
  throw new Error("Cross product can only be determined in 3D");
@@ -3399,7 +3409,7 @@ class g {
3399
3409
  if (this.dimension >= 3)
3400
3410
  throw new Error("Normal vector can only be determined in 2D");
3401
3411
  const e = this.x.clone().opposite(), t = this.y.clone();
3402
- return this.#t[0] = t, this.#t[1] = e, this;
3412
+ return this.#i[0] = t, this.#i[1] = e, this;
3403
3413
  };
3404
3414
  isZero() {
3405
3415
  return this.array.every((e) => e.isZero());
@@ -3407,8 +3417,8 @@ class g {
3407
3417
  isOne() {
3408
3418
  return this.array.every((e, t) => t === 0 ? e.isOne() : e.isZero());
3409
3419
  }
3410
- isEqual = (e) => De(this, e);
3411
- isColinearTo = (e) => Le(this, e);
3420
+ isEqual = (e) => Te(this, e);
3421
+ isColinearTo = (e) => Oe(this, e);
3412
3422
  isNormalTo = (e) => this.dot(e).isZero();
3413
3423
  multiplyByScalar = (e) => {
3414
3424
  const t = new a(e);
@@ -3429,7 +3439,7 @@ class g {
3429
3439
  fromString = (e) => {
3430
3440
  e.startsWith("(") && (e = e.substring(1)), e.endsWith(")") && (e = e.substring(0, e.length - 1));
3431
3441
  const t = e.split(/[,;\s]/g).filter((i) => i.trim() !== "");
3432
- return t.length < 2 ? this : (this.#t = t.map((i) => new a(i)), this);
3442
+ return t.length < 2 ? this : (this.#i = t.map((i) => new a(i)), this);
3433
3443
  };
3434
3444
  distanceTo(e) {
3435
3445
  const t = new g(this, e);
@@ -3440,39 +3450,39 @@ class g {
3440
3450
  };
3441
3451
  }
3442
3452
  }
3443
- var I = /* @__PURE__ */ ((n) => (n.None = "none", n.Parallel = "parallel", n.Perpendicular = "perpendicular", n.Tangent = "tangent", n))(I || {}), se = /* @__PURE__ */ ((n) => (n.None = "none", n.Parallel = "parallel", n.Perpendicular = "perpendicular", n.Tangent = "tangent", n))(se || {});
3444
- function pe(n = 0.5) {
3445
- return Math.random() < n;
3453
+ var B = /* @__PURE__ */ ((r) => (r.None = "none", r.Parallel = "parallel", r.Perpendicular = "perpendicular", r.Tangent = "tangent", r))(B || {}), Q = /* @__PURE__ */ ((r) => (r.None = "none", r.Parallel = "parallel", r.Perpendicular = "perpendicular", r.Tangent = "tangent", r))(Q || {});
3454
+ function ne(r = 0.5) {
3455
+ return Math.random() < r;
3446
3456
  }
3447
- function B(n, e, t) {
3457
+ function k(r, e, t) {
3448
3458
  if (e === void 0)
3449
- return n >= 0 ? B(0, n) : B(n, 0);
3450
- if (n === e)
3451
- return n;
3459
+ return r >= 0 ? k(0, r) : k(r, 0);
3460
+ if (r === e)
3461
+ return r;
3452
3462
  if (t === void 0)
3453
- return Math.floor(Math.random() * (e - n + 1) + n);
3454
- if (Math.abs(e - n) <= t.length)
3463
+ return Math.floor(Math.random() * (e - r + 1) + r);
3464
+ if (Math.abs(e - r) <= t.length)
3455
3465
  throw new Error("The number of excluded values is too high.");
3456
- let i = B(n, e);
3466
+ let i = k(r, e);
3457
3467
  for (; t.includes(i); )
3458
- i = B(n, e);
3468
+ i = k(r, e);
3459
3469
  return i;
3460
3470
  }
3461
- function q(n, e) {
3462
- return e === !1 ? pe() ? B(1, n) : -B(1, n) : B(-n, n);
3471
+ function q(r, e) {
3472
+ return e === !1 ? ne() ? k(1, r) : -k(1, r) : k(-r, r);
3463
3473
  }
3464
- function Ve(n) {
3474
+ function $e(r) {
3465
3475
  let e = E.primes();
3466
- return n !== void 0 && (e = e.filter((t) => t < n)), he(e);
3476
+ return r !== void 0 && (e = e.filter((t) => t < r)), _(e);
3467
3477
  }
3468
- function je(n, e) {
3469
- return e === void 0 && (e = 1), n.length <= 0 ? Object.values(n) : me(n).slice(0, e);
3478
+ function ke(r, e) {
3479
+ return e === void 0 && (e = 1), r.length <= 0 ? Object.values(r) : re(r).slice(0, e);
3470
3480
  }
3471
- function he(n) {
3472
- return n.length === 0 ? null : n[B(0, n.length - 1)];
3481
+ function _(r) {
3482
+ return r.length === 0 ? null : r[k(0, r.length - 1)];
3473
3483
  }
3474
- function me(n) {
3475
- const e = Object.values(n);
3484
+ function re(r) {
3485
+ const e = Object.values(r);
3476
3486
  for (let t = e.length - 1; t > 0; t--) {
3477
3487
  const i = Math.floor(Math.random() * (t + 1)), s = e[t];
3478
3488
  e[t] = e[i], e[i] = s;
@@ -3506,16 +3516,16 @@ class v extends g {
3506
3516
  }
3507
3517
  }
3508
3518
  class b {
3509
- static PARALLEL = I.Parallel;
3519
+ static PARALLEL = B.Parallel;
3510
3520
  // A line is defined as the canonical form
3511
- static PERPENDICULAR = I.Perpendicular;
3512
- #t;
3521
+ static PERPENDICULAR = B.Perpendicular;
3522
+ #i;
3513
3523
  // ax + by + c = 0
3514
3524
  #e;
3515
- #i;
3525
+ #t;
3516
3526
  #s;
3517
- #r;
3518
3527
  #n;
3528
+ #r;
3519
3529
  #o = "canonical";
3520
3530
  #h;
3521
3531
  /**
@@ -3524,7 +3534,7 @@ class b {
3524
3534
  * @param values
3525
3535
  */
3526
3536
  constructor(...e) {
3527
- return this.#e = new a().zero(), this.#i = new a().zero(), this.#s = new a().zero(), this.#t = new g(), this.#r = new g(), this.#n = new g(), this.#h = !0, e.length > 0 && this.parse(...e), this;
3537
+ return this.#e = new a().zero(), this.#t = new a().zero(), this.#s = new a().zero(), this.#i = new g(), this.#n = new g(), this.#r = new g(), this.#h = !0, e.length > 0 && this.parse(...e), this;
3528
3538
  }
3529
3539
  // ------------------------------------------
3530
3540
  /**
@@ -3557,12 +3567,12 @@ class b {
3557
3567
  }
3558
3568
  if (e.length === 3) {
3559
3569
  if (e[0] instanceof g && e[1] instanceof g) {
3560
- if (e[2] === I.Perpendicular)
3570
+ if (e[2] === B.Perpendicular)
3561
3571
  return this.fromPointAndNormal(e[0], e[1]);
3562
- if (e[2] === I.Parallel)
3572
+ if (e[2] === B.Parallel)
3563
3573
  return this.fromPointAndDirection(e[0], e[1]);
3564
3574
  }
3565
- return e[0] instanceof g && e[1] instanceof b ? e[2] === I.Parallel || e[2] === null ? this.fromPointAndLine(e[0], e[1], I.Parallel) : this.fromPointAndLine(e[0], e[1], I.Perpendicular) : this.fromCoefficient(
3575
+ return e[0] instanceof g && e[1] instanceof b ? e[2] === B.Parallel || e[2] === null ? this.fromPointAndLine(e[0], e[1], B.Parallel) : this.fromPointAndLine(e[0], e[1], B.Perpendicular) : this.fromCoefficient(
3566
3576
  e[0],
3567
3577
  e[1],
3568
3578
  e[2]
@@ -3572,7 +3582,7 @@ class b {
3572
3582
  };
3573
3583
  // ------------------------------------------
3574
3584
  // Getter and setter
3575
- clone = () => (this.#e = this.#e.clone(), this.#i = this.#i.clone(), this.#s = this.#s.clone(), this.#r = this.#r.clone(), this.#t = this.#t.clone(), this.#n = this.#n.clone(), this);
3585
+ clone = () => (this.#e = this.#e.clone(), this.#t = this.#t.clone(), this.#s = this.#s.clone(), this.#n = this.#n.clone(), this.#i = this.#i.clone(), this.#r = this.#r.clone(), this);
3576
3586
  get tex() {
3577
3587
  const e = this.#o;
3578
3588
  switch (this.#o = "canonical", e) {
@@ -3582,10 +3592,10 @@ class b {
3582
3592
  return this.slope.isInfinity() ? "x=" + this.OA.x.tex : "y=" + new u().parse("x", this.slope, this.height).tex;
3583
3593
  case "parametric":
3584
3594
  case "system": {
3585
- const t = this.#r.clone();
3586
- return this.#h && t.simplify(), e === "parametric" ? `${g.asTex("x", "y")} = ${g.asTex(this.#t.x.tex, this.#t.y.tex)} + k\\cdot ${g.asTex(t.x.tex, t.y.tex)}` : `\\left\\{\\begin{aligned}
3587
- x &= ${new u(this.#t.x).add(new p(this.#r.x).multiply(new p("k"))).reorder("k", !0).tex}\\\\
3588
- y &= ${new u(this.#t.y).add(new p(this.#r.y).multiply(new p("k"))).reorder("k", !0).tex}
3595
+ const t = this.#n.clone();
3596
+ return this.#h && t.simplify(), e === "parametric" ? `${g.asTex("x", "y")} = ${g.asTex(this.#i.x.tex, this.#i.y.tex)} + k\\cdot ${g.asTex(t.x.tex, t.y.tex)}` : `\\left\\{\\begin{aligned}
3597
+ x &= ${new u(this.#i.x).add(new p(this.#n.x).multiply(new p("k"))).reorder("k", !0).tex}\\\\
3598
+ y &= ${new u(this.#i.y).add(new p(this.#n.y).multiply(new p("k"))).reorder("k", !0).tex}
3589
3599
  \\end{aligned}\\right.`;
3590
3600
  }
3591
3601
  default: {
@@ -3602,8 +3612,8 @@ class b {
3602
3612
  case "mxh":
3603
3613
  return this.slope.isInfinity() ? "x=" + this.OA.x.display : "y=" + new u().parse("x", this.slope, this.height).display;
3604
3614
  case "parametric": {
3605
- const t = this.#r.clone();
3606
- return this.#h && t.simplify(), `((x,y))=((${this.#t.x.display},${this.#t.y.display}))+k((${t.x.display},${t.y.display}))`;
3615
+ const t = this.#n.clone();
3616
+ return this.#h && t.simplify(), `((x,y))=((${this.#i.x.display},${this.#i.y.display}))+k((${t.x.display},${t.y.display}))`;
3607
3617
  }
3608
3618
  default: {
3609
3619
  const t = this.getEquation();
@@ -3612,10 +3622,10 @@ class b {
3612
3622
  }
3613
3623
  }
3614
3624
  get OA() {
3615
- return this.#t;
3625
+ return this.#i;
3616
3626
  }
3617
3627
  set OA(e) {
3618
- this.#t = e;
3628
+ this.#i = e;
3619
3629
  }
3620
3630
  get a() {
3621
3631
  return this.#e;
@@ -3624,10 +3634,10 @@ class b {
3624
3634
  this.#e = e;
3625
3635
  }
3626
3636
  get b() {
3627
- return this.#i;
3637
+ return this.#t;
3628
3638
  }
3629
3639
  set b(e) {
3630
- this.#i = e;
3640
+ this.#t = e;
3631
3641
  }
3632
3642
  get c() {
3633
3643
  return this.#s;
@@ -3655,40 +3665,40 @@ class b {
3655
3665
  canonicalAsFloatCoefficient(e) {
3656
3666
  e === void 0 && (e = 2);
3657
3667
  let t = "";
3658
- return this.#e.isZero() || (this.#e.isOne() ? t = "x" : this.#e.clone().opposite().isOne() ? t = "-x" : t = this.#e.value.toFixed(e) + "x"), this.#i.isZero() || (this.#i.isPositive() && (t += "+"), t += this.#i.value.toFixed(e) + "y"), this.#s.isZero() || (this.#s.isPositive() && (t += "+"), t += this.#s.value.toFixed(e)), t + "=0";
3668
+ return this.#e.isZero() || (this.#e.isOne() ? t = "x" : this.#e.clone().opposite().isOne() ? t = "-x" : t = this.#e.value.toFixed(e) + "x"), this.#t.isZero() || (this.#t.isPositive() && (t += "+"), t += this.#t.value.toFixed(e) + "y"), this.#s.isZero() || (this.#s.isPositive() && (t += "+"), t += this.#s.value.toFixed(e)), t + "=0";
3659
3669
  }
3660
3670
  get d() {
3661
- return this.#r;
3671
+ return this.#n;
3662
3672
  }
3663
3673
  set d(e) {
3664
- this.#r = e;
3674
+ this.#n = e;
3665
3675
  }
3666
3676
  get director() {
3667
- return this.#r.clone();
3677
+ return this.#n.clone();
3668
3678
  }
3669
3679
  distanceTo(e) {
3670
- const t = e.x.clone().multiply(this.#e).add(e.y.clone().multiply(this.#i)).add(this.#s).abs(), i = this.normal.normSquare;
3680
+ const t = e.x.clone().multiply(this.#e).add(e.y.clone().multiply(this.#t)).add(this.#s).abs(), i = this.normal.normSquare;
3671
3681
  if (i.isZero())
3672
3682
  return {
3673
3683
  value: NaN,
3674
3684
  tex: "Not a line",
3675
3685
  fraction: new a().infinite()
3676
3686
  };
3677
- const s = t.value / Math.sqrt(i.value), r = t.clone().divide(i.clone().sqrt());
3687
+ const s = t.value / Math.sqrt(i.value), n = t.clone().divide(i.clone().sqrt());
3678
3688
  return i.isSquare() ? {
3679
3689
  value: s,
3680
- tex: r.tex,
3681
- fraction: r
3690
+ tex: n.tex,
3691
+ fraction: n
3682
3692
  } : {
3683
3693
  value: s,
3684
3694
  tex: `\\frac{${t.tex}}{\\sqrt{${i.tex}}}`,
3685
- fraction: r
3695
+ fraction: n
3686
3696
  };
3687
3697
  }
3688
3698
  get equation() {
3689
3699
  return this.#o = "equation", this;
3690
3700
  }
3691
- fromCoefficient = (e, t, i) => (this.#e = new a(e), this.#i = new a(t), this.#s = new a(i), this.#r = new g(this.#i.clone(), this.#e.clone().opposite()), this.#t = new g(new a().zero(), this.#s.clone()), this.#n = this.#r.clone().normal(), this);
3701
+ fromCoefficient = (e, t, i) => (this.#e = new a(e), this.#t = new a(t), this.#s = new a(i), this.#n = new g(this.#t.clone(), this.#e.clone().opposite()), this.#i = new g(new a().zero(), this.#s.clone()), this.#r = this.#n.clone().normal(), this);
3692
3702
  fromEquation = (e) => {
3693
3703
  e.reorder(!0);
3694
3704
  const t = new Set(e.letters());
@@ -3706,8 +3716,8 @@ class b {
3706
3716
  t.y,
3707
3717
  t.x.clone().opposite(),
3708
3718
  e.x.clone().multiply(t.y).subtract(e.y.clone().multiply(t.x)).opposite()
3709
- ), this.#t = e.clone(), this.#r = t.clone(), this.#n = this.#r.clone().normal(), this);
3710
- fromPointAndLine = (e, t, i) => (i === void 0 && (i = I.Parallel), i === I.Parallel ? this.fromPointAndNormal(e, t.normal) : i === I.Perpendicular ? this.fromPointAndNormal(e, t.director) : this);
3719
+ ), this.#i = e.clone(), this.#n = t.clone(), this.#r = this.#n.clone().normal(), this);
3720
+ fromPointAndLine = (e, t, i) => (i === void 0 && (i = B.Parallel), i === B.Parallel ? this.fromPointAndNormal(e, t.normal) : i === B.Perpendicular ? this.fromPointAndNormal(e, t.director) : this);
3711
3721
  fromPointAndNormal = (e, t) => this.fromCoefficient(
3712
3722
  t.x,
3713
3723
  t.y,
@@ -3718,7 +3728,7 @@ class b {
3718
3728
  }
3719
3729
  // ------------------------------------------
3720
3730
  getEquation() {
3721
- const e = new y(new u().parse("xy", this.#e, this.#i, this.#s), new u("0"));
3731
+ const e = new y(new u().parse("xy", this.#e, this.#t, this.#s), new u("0"));
3722
3732
  return this.#h ? e.simplify() : e;
3723
3733
  }
3724
3734
  getValueAtX = (e) => {
@@ -3732,7 +3742,7 @@ class b {
3732
3742
  return t instanceof y ? t.right.evaluate({ y: i }) : new a().invalid();
3733
3743
  };
3734
3744
  get height() {
3735
- return this.#s.clone().opposite().divide(this.#i);
3745
+ return this.#s.clone().opposite().divide(this.#t);
3736
3746
  }
3737
3747
  hitSegment(e, t) {
3738
3748
  const i = this.intersection(
@@ -3743,7 +3753,7 @@ class b {
3743
3753
  intersection = (e) => {
3744
3754
  const t = new v();
3745
3755
  let i = !1, s = !1;
3746
- return this.#i.isZero() || e.b.isZero(), this.isParallelTo(e) ? (t.x = new a().invalid(), t.y = new a().invalid(), i = !0) : this.isSameAs(e) ? (t.x = new a().invalid(), t.y = new a().invalid(), s = !0) : (t.x = this.#i.clone().multiply(e.c).subtract(this.#s.clone().multiply(e.b)).divide(this.#e.clone().multiply(e.b).subtract(this.#i.clone().multiply(e.a))), t.y = this.#e.clone().multiply(e.c).subtract(this.#s.clone().multiply(e.a)).divide(this.#i.clone().multiply(e.a).subtract(this.#e.clone().multiply(e.b)))), {
3756
+ return this.#t.isZero() || e.b.isZero(), this.isParallelTo(e) ? (t.x = new a().invalid(), t.y = new a().invalid(), i = !0) : this.isSameAs(e) ? (t.x = new a().invalid(), t.y = new a().invalid(), s = !0) : (t.x = this.#t.clone().multiply(e.c).subtract(this.#s.clone().multiply(e.b)).divide(this.#e.clone().multiply(e.b).subtract(this.#t.clone().multiply(e.a))), t.y = this.#e.clone().multiply(e.c).subtract(this.#s.clone().multiply(e.a)).divide(this.#t.clone().multiply(e.a).subtract(this.#e.clone().multiply(e.b)))), {
3747
3757
  point: t,
3748
3758
  hasIntersection: !(i || s),
3749
3759
  isParallel: i,
@@ -3752,7 +3762,7 @@ class b {
3752
3762
  };
3753
3763
  // ------------------------------------------
3754
3764
  isOnLine = (e) => this.#e.clone().multiply(e.x).add(
3755
- this.#i.clone().multiply(e.y)
3765
+ this.#t.clone().multiply(e.y)
3756
3766
  ).add(this.#s).isZero();
3757
3767
  isParallelTo = (e) => this.slope.isEqual(e.slope) && this.height.isNotEqual(e.height);
3758
3768
  isPerpendicularTo = (e) => this.d.isNormalTo(e.d);
@@ -3764,10 +3774,10 @@ class b {
3764
3774
  return this.#o = "mxh", this;
3765
3775
  }
3766
3776
  get n() {
3767
- return this.#n;
3777
+ return this.#r;
3768
3778
  }
3769
3779
  get normal() {
3770
- return new g(this.#e, this.#i);
3780
+ return new g(this.#e, this.#t);
3771
3781
  }
3772
3782
  get parametric() {
3773
3783
  return this.#o = "parametric", this;
@@ -3780,7 +3790,7 @@ class b {
3780
3790
  return t;
3781
3791
  };
3782
3792
  randomPoint = (e) => {
3783
- const t = this.#r.clone().multiplyByScalar(q(e === void 0 || e <= 1 ? 3 : e, !1)).add(this.#t);
3793
+ const t = this.#n.clone().multiplyByScalar(q(e === void 0 || e <= 1 ? 3 : e, !1)).add(this.#i);
3784
3794
  return t.asPoint = !0, t;
3785
3795
  };
3786
3796
  get reduceBeforeDisplay() {
@@ -3790,16 +3800,16 @@ class b {
3790
3800
  this.#h = e;
3791
3801
  }
3792
3802
  simplify = () => {
3793
- const e = E.lcm(this.#e.denominator, this.#i.denominator, this.#s.denominator), t = E.gcd(this.#e.numerator, this.#i.numerator, this.#s.numerator);
3803
+ const e = E.lcm(this.#e.denominator, this.#t.denominator, this.#s.denominator), t = E.gcd(this.#e.numerator, this.#t.numerator, this.#s.numerator);
3794
3804
  return this.fromCoefficient(
3795
3805
  this.#e.clone().multiply(e).divide(t),
3796
- this.#i.clone().multiply(e).divide(t),
3806
+ this.#t.clone().multiply(e).divide(t),
3797
3807
  this.#s.clone().multiply(e).divide(t)
3798
3808
  ), this;
3799
3809
  };
3800
- simplifyDirection = () => (this.#r.simplify(), this);
3810
+ simplifyDirection = () => (this.#n.simplify(), this);
3801
3811
  get slope() {
3802
- return this.#e.clone().opposite().divide(this.#i);
3812
+ return this.#e.clone().opposite().divide(this.#t);
3803
3813
  }
3804
3814
  // ------------------------------------------
3805
3815
  // Special functions
@@ -3807,23 +3817,23 @@ class b {
3807
3817
  return this.#o = "system", this;
3808
3818
  }
3809
3819
  }
3810
- class W {
3811
- #t = void 0;
3812
- #e = void 0;
3820
+ class V {
3813
3821
  #i = void 0;
3822
+ #e = void 0;
3823
+ #t = void 0;
3814
3824
  constructor(...e) {
3815
3825
  e.length > 0 && this.parse(...e);
3816
3826
  }
3817
3827
  get center() {
3818
- return this.#t ?? new v();
3828
+ return this.#i ?? new v();
3819
3829
  }
3820
3830
  get squareRadius() {
3821
3831
  return this.#e ?? new a(0);
3822
3832
  }
3823
3833
  get cartesian() {
3824
- if (this.#i === void 0)
3834
+ if (this.#t === void 0)
3825
3835
  throw new Error("Cartesian equation not defined");
3826
- return this.#i;
3836
+ return this.#t;
3827
3837
  }
3828
3838
  get radius() {
3829
3839
  return this.#e === void 0 ? { tex: "", display: "", value: 0 } : this.#e.isSquare() ? {
@@ -3853,34 +3863,34 @@ class W {
3853
3863
  * @returns {number}
3854
3864
  */
3855
3865
  relativePosition = (e) => {
3856
- if (this.#t === void 0 || this.#e === void 0)
3866
+ if (this.#i === void 0 || this.#e === void 0)
3857
3867
  throw new Error("Circle not defined");
3858
- const t = e.distanceTo(this.#t), i = Math.sqrt(this.#e.value);
3868
+ const t = e.distanceTo(this.#i), i = Math.sqrt(this.#e.value);
3859
3869
  return t.value - i > 1e-10 ? 0 : Math.abs(t.value - i) < 1e-10 ? 1 : 2;
3860
3870
  };
3861
3871
  lineIntersection = (e) => {
3862
3872
  const t = [];
3863
- if (this.#i === void 0)
3873
+ if (this.#t === void 0)
3864
3874
  return [];
3865
- const i = this.#i.clone(), s = e.getEquation().clone().isolate("x"), r = e.getEquation().clone().isolate("y");
3866
- return s instanceof y && r instanceof y && (i.replaceBy("y", r.right).simplify(), i.solve()), t;
3875
+ const i = this.#t.clone(), s = e.getEquation().clone().isolate("x"), n = e.getEquation().clone().isolate("y");
3876
+ return s instanceof y && n instanceof y && (i.replaceBy("y", n.right).simplify(), i.solve()), t;
3867
3877
  };
3868
- tangents = (e) => e instanceof a ? this.#n(e) : this.isPointOnCircle(e) ? this.#s(e) : this.#t !== void 0 && this.#t.distanceTo(e).value > this.radius.value ? this.#r(e) : (console.log("No tangents as the point is inside !"), []);
3869
- isPointOnCircle = (e) => this.#i?.test({ x: e.x, y: e.y }) ?? !1;
3878
+ tangents = (e) => e instanceof a ? this.#r(e) : this.isPointOnCircle(e) ? this.#s(e) : this.#i !== void 0 && this.#i.distanceTo(e).value > this.radius.value ? this.#n(e) : (console.log("No tangents as the point is inside !"), []);
3879
+ isPointOnCircle = (e) => this.#t?.test({ x: e.x, y: e.y }) ?? !1;
3870
3880
  getPointsOnCircle = (e) => {
3871
3881
  const t = E.pythagoreanTripletsWithTarget(this.squareRadius.value, !0), i = [];
3872
3882
  return t.forEach((s) => {
3873
- for (const r of [[1, 1], [-1, 1], [-1, -1], [1, -1]])
3883
+ for (const n of [[1, 1], [-1, 1], [-1, -1], [1, -1]])
3874
3884
  i.push(
3875
3885
  new v(
3876
- this.center.x.clone().add(r[0] * s[0]),
3877
- this.center.y.clone().add(r[1] * s[1])
3886
+ this.center.x.clone().add(n[0] * s[0]),
3887
+ this.center.y.clone().add(n[1] * s[1])
3878
3888
  )
3879
3889
  );
3880
3890
  }), i;
3881
3891
  };
3882
3892
  clone() {
3883
- return new W(
3893
+ return new V(
3884
3894
  this.center.clone(),
3885
3895
  this.squareRadius.clone(),
3886
3896
  !0
@@ -3891,46 +3901,46 @@ class W {
3891
3901
  }
3892
3902
  #s = (e) => {
3893
3903
  const t = new g(this.center, e);
3894
- return [new b(e, t, I.Perpendicular)];
3904
+ return [new b(e, t, B.Perpendicular)];
3895
3905
  };
3896
- #r = (e) => {
3897
- const t = this.center.x.clone().subtract(e.x), i = this.center.y.clone().subtract(e.y), s = new u("x"), r = new u("x^2+1");
3898
- return s.multiply(t).subtract(i).pow(2), r.multiply(this.squareRadius), new y(s, r).solve().map((l) => {
3906
+ #n = (e) => {
3907
+ const t = this.center.x.clone().subtract(e.x), i = this.center.y.clone().subtract(e.y), s = new u("x"), n = new u("x^2+1");
3908
+ return s.multiply(t).subtract(i).pow(2), n.multiply(this.squareRadius), new y(s, n).solve().map((l) => {
3899
3909
  let c;
3900
3910
  const d = new y("y", "x");
3901
3911
  return l.exact instanceof a ? (c = e.x.clone().opposite().multiply(l.exact).add(e.y), d.right.multiply(l.exact).add(c)) : (c = e.x.clone().opposite().multiply(l.value).add(e.y), d.right.multiply(l.value).add(c)), new b(d);
3902
3912
  });
3903
3913
  };
3904
- #n = (e) => {
3905
- const t = e.numerator, i = -e.denominator, s = this.center.x.clone(), r = this.center.y.clone(), o = this.squareRadius.clone().multiply(e.numerator ** 2 + e.denominator ** 2), h = s.clone().multiply(t).opposite().subtract(r.clone().multiply(i)).add(o.clone().sqrt()), l = s.clone().multiply(t).opposite().subtract(r.clone().multiply(i)).subtract(o.clone().sqrt());
3914
+ #r = (e) => {
3915
+ const t = e.numerator, i = -e.denominator, s = this.center.x.clone(), n = this.center.y.clone(), o = this.squareRadius.clone().multiply(e.numerator ** 2 + e.denominator ** 2), h = s.clone().multiply(t).opposite().subtract(n.clone().multiply(i)).add(o.clone().sqrt()), l = s.clone().multiply(t).opposite().subtract(n.clone().multiply(i)).subtract(o.clone().sqrt());
3906
3916
  return [new b(t, i, h), new b(t, i, l)];
3907
3917
  };
3908
3918
  #o() {
3909
- return this.#t = void 0, this.#e = void 0, this.#i = void 0, this;
3919
+ return this.#i = void 0, this.#e = void 0, this.#t = void 0, this;
3910
3920
  }
3911
3921
  parse(...e) {
3912
- return this.#o(), typeof e[0] == "string" ? this.#u(new y(e[0])) : e[0] instanceof y ? this.#u(e[0]) : e[0] instanceof W ? this.#a(e[0]) : e[0] instanceof v && e.length > 1 && (e[1] instanceof v ? e[2] instanceof v || this.#l(e[0], e[1]) : (e[1] instanceof a || typeof e[1] == "number") && this.#c(e[0], e[1], typeof e[2] == "boolean" ? e[2] : !1)), this.#h(), this;
3922
+ return this.#o(), typeof e[0] == "string" ? this.#u(new y(e[0])) : e[0] instanceof y ? this.#u(e[0]) : e[0] instanceof V ? this.#a(e[0]) : e[0] instanceof v && e.length > 1 && (e[1] instanceof v ? e[2] instanceof v || this.#l(e[0], e[1]) : (e[1] instanceof a || typeof e[1] == "number") && this.#c(e[0], e[1], typeof e[2] == "boolean" ? e[2] : !1)), this.#h(), this;
3913
3923
  }
3914
3924
  #h() {
3915
- this.#i = new y(
3925
+ this.#t = new y(
3916
3926
  new u(`(x-(${this.center.x.display}))^2+(y-(${this.center.y.display}))^2`),
3917
3927
  new u(this.squareRadius.display)
3918
3928
  ).moveLeft();
3919
3929
  }
3920
3930
  #a(e) {
3921
- return this.#t = e.center.clone(), this.#e = e.squareRadius.clone(), this.#h(), this;
3931
+ return this.#i = e.center.clone(), this.#e = e.squareRadius.clone(), this.#h(), this;
3922
3932
  }
3923
3933
  #c(e, t, i) {
3924
- return this.#t = e.clone(), i ? this.#e = new a(t) : this.#e = new a(t).pow(2), this;
3934
+ return this.#i = e.clone(), i ? this.#e = new a(t) : this.#e = new a(t).pow(2), this;
3925
3935
  }
3926
3936
  #l(e, t) {
3927
- return this.#t = e.clone(), this.#e = new g(this.#t, t).normSquare, this;
3937
+ return this.#i = e.clone(), this.#e = new g(this.#i, t).normSquare, this;
3928
3938
  }
3929
3939
  #u(e) {
3930
3940
  if (e.moveLeft(), e.degree("x").value === 2 && e.degree("y").value === 2) {
3931
3941
  const t = e.left.monomByDegree(2, "x"), i = e.left.monomByDegree(2, "y");
3932
- let s, r, o;
3933
- t.coefficient.isEqual(i.coefficient) ? (e.divide(t.coefficient), s = e.left.monomByDegree(1, "x"), r = e.left.monomByDegree(1, "y"), o = e.left.monomByDegree(0), this.#t = new v(s.coefficient.clone().divide(2).opposite(), r.coefficient.clone().divide(2).opposite()), this.#e = o.coefficient.clone().opposite().add(this.#t.x.clone().pow(2)).add(this.#t.y.clone().pow(2))) : (this.#t = void 0, this.#e = void 0);
3942
+ let s, n, o;
3943
+ t.coefficient.isEqual(i.coefficient) ? (e.divide(t.coefficient), s = e.left.monomByDegree(1, "x"), n = e.left.monomByDegree(1, "y"), o = e.left.monomByDegree(0), this.#i = new v(s.coefficient.clone().divide(2).opposite(), n.coefficient.clone().divide(2).opposite()), this.#e = o.coefficient.clone().opposite().add(this.#i.x.clone().pow(2)).add(this.#i.y.clone().pow(2))) : (this.#i = void 0, this.#e = void 0);
3934
3944
  }
3935
3945
  return this;
3936
3946
  }
@@ -3941,24 +3951,24 @@ class W {
3941
3951
  // return this
3942
3952
  // }
3943
3953
  }
3944
- class ee {
3954
+ class Y {
3945
3955
  // A line is defined as the canonical form
3946
- static PERPENDICULAR = se.Perpendicular;
3947
- static PARALLEL = se.Parallel;
3956
+ static PERPENDICULAR = Q.Perpendicular;
3957
+ static PARALLEL = Q.Parallel;
3948
3958
  // ax + by + c = 0
3949
- #t = new v();
3959
+ #i = new v();
3950
3960
  #e = new g();
3951
3961
  constructor(e, t) {
3952
- return this.#t = e.clone(), this.#e = t.asPoint ? new g(e, t) : t.clone(), this;
3962
+ return this.#i = e.clone(), this.#e = t.asPoint ? new g(e, t) : t.clone(), this;
3953
3963
  }
3954
3964
  get OA() {
3955
- return this.#t;
3965
+ return this.#i;
3956
3966
  }
3957
3967
  set OA(e) {
3958
- this.#t = e;
3968
+ this.#i = e;
3959
3969
  }
3960
3970
  get point() {
3961
- return this.#t.clone();
3971
+ return this.#i.clone();
3962
3972
  }
3963
3973
  get d() {
3964
3974
  return this.#e;
@@ -3968,27 +3978,27 @@ class ee {
3968
3978
  }
3969
3979
  get tex() {
3970
3980
  return {
3971
- parametric: `${g.asTex("x", "y", "z")} = ${g.asTex(this.#t.x.tex, this.#t.y.tex, this.#t.z.tex)} + k\\cdot ${g.asTex(this.#e.x.tex, this.#e.y.tex, this.#e.z.tex)}`,
3981
+ parametric: `${g.asTex("x", "y", "z")} = ${g.asTex(this.#i.x.tex, this.#i.y.tex, this.#i.z.tex)} + k\\cdot ${g.asTex(this.#e.x.tex, this.#e.y.tex, this.#e.z.tex)}`,
3972
3982
  system: `\\left\\{\\begin{aligned}
3973
- x &= ${new u(this.#t.x).add(new p(this.#e.x).multiply(new p("k"))).reorder("k", !0).tex}\\\\
3974
- y &= ${new u(this.#t.y).add(new p(this.#e.y).multiply(new p("k"))).reorder("k", !0).tex}\\\\
3975
- z &= ${new u(this.#t.z).add(new p(this.#e.z).multiply(new p("k"))).reorder("k", !0).tex}
3983
+ x &= ${new u(this.#i.x).add(new p(this.#e.x).multiply(new p("k"))).reorder("k", !0).tex}\\\\
3984
+ y &= ${new u(this.#i.y).add(new p(this.#e.y).multiply(new p("k"))).reorder("k", !0).tex}\\\\
3985
+ z &= ${new u(this.#i.z).add(new p(this.#e.z).multiply(new p("k"))).reorder("k", !0).tex}
3976
3986
  \\end{aligned}\\right.`,
3977
- cartesian: `\\frac{ ${new u("x", 1, this.#t.x.clone().opposite()).tex} }{ ${this.direction.x.tex} } = \\frac{ ${new u("y", 1, this.#t.y.clone().opposite()).tex} }{ ${this.direction.y.tex} } = \\frac{ ${new u("z", 1, this.#t.z.clone().opposite()).tex} }{ ${this.direction.z.tex} }`
3987
+ cartesian: `\\frac{ ${new u("x", 1, this.#i.x.clone().opposite()).tex} }{ ${this.direction.x.tex} } = \\frac{ ${new u("y", 1, this.#i.y.clone().opposite()).tex} }{ ${this.direction.y.tex} } = \\frac{ ${new u("z", 1, this.#i.z.clone().opposite()).tex} }{ ${this.direction.z.tex} }`
3978
3988
  };
3979
3989
  }
3980
3990
  get display() {
3981
- const e = this.#t.x.display, t = 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;
3991
+ const e = this.#i.x.display, t = this.#i.y.display, i = this.#i.z.display, s = this.direction.simplify(), n = s.x.display, o = s.y.display, h = s.z.display;
3982
3992
  return {
3983
- 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)}`,
3993
+ parametric: `${g.asDisplay("x", "y", "z")} = ${g.asDisplay(this.#i.x.display, this.#i.y.display, this.#i.z.display)} + k\\cdot ${g.asDisplay(this.#e.x.display, this.#e.y.display, this.#e.z.display)}`,
3984
3994
  system: "",
3985
- cartesian: `(x-${e})/${r} = (y-${t})/${o} = (z-${i})/${h}`
3995
+ cartesian: `(x-${e})/${n} = (y-${t})/${o} = (z-${i})/${h}`
3986
3996
  };
3987
3997
  }
3988
3998
  get direction() {
3989
3999
  return this.#e.clone();
3990
4000
  }
3991
- clone = () => (this.#e = this.#e.clone(), this.#t = this.#t.clone(), this);
4001
+ clone = () => (this.#e = this.#e.clone(), this.#i = this.#i.clone(), this);
3992
4002
  // ------------------------------------------
3993
4003
  // Mathematical operations
3994
4004
  // ------------------------------------------
@@ -4012,7 +4022,7 @@ class ee {
4012
4022
  throw new Error("Method not implemented.");
4013
4023
  };
4014
4024
  distanceTo(e) {
4015
- const t = new g(this.#t, e), i = this.direction, s = this.direction.normSquare, r = t.cross(i).normSquare, o = r.clone().divide(s), h = o.clone().sqrt();
4025
+ const t = new g(this.#i, e), i = this.direction, s = this.direction.normSquare, n = t.cross(i).normSquare, o = n.clone().divide(s), h = o.clone().sqrt();
4016
4026
  return console.log("CROSS", t.cross(i).display), {
4017
4027
  value: Math.sqrt(o.value),
4018
4028
  fraction: o.clone().sqrt(),
@@ -4021,7 +4031,7 @@ class ee {
4021
4031
  }
4022
4032
  hitSegment(e, t) {
4023
4033
  const i = this.intersection(
4024
- new ee(e, t)
4034
+ new Y(e, t)
4025
4035
  );
4026
4036
  return i.hasIntersection ? i.point.x.value >= Math.min(e.x.value, t.x.value) && i.point.x.value <= Math.max(e.x.value, t.x.value) && i.point.y.value >= Math.min(e.y.value, t.y.value) && i.point.y.value <= Math.max(e.y.value, t.y.value) && i.point.z.value >= Math.min(e.z.value, t.z.value) && i.point.z.value <= Math.max(e.z.value, t.z.value) : !1;
4027
4037
  }
@@ -4042,7 +4052,7 @@ class ee {
4042
4052
  // return new Fraction().invalid()
4043
4053
  // }
4044
4054
  randomPoint = (e = 5) => {
4045
- const t = this.#t.clone(), i = new a(q(e, !1));
4055
+ const t = this.#i.clone(), i = new a(q(e, !1));
4046
4056
  return new v(
4047
4057
  t.x.clone().add(this.#e.x.clone().multiply(i)),
4048
4058
  t.y.clone().add(this.#e.y.clone().multiply(i)),
@@ -4050,17 +4060,17 @@ class ee {
4050
4060
  );
4051
4061
  };
4052
4062
  }
4053
- class ae {
4054
- #t = new g(0, 0, 1);
4063
+ class ee {
4064
+ #i = new g(0, 0, 1);
4055
4065
  #e = new v(0, 0, 0);
4056
4066
  constructor(e) {
4057
4067
  return e && this.parse(e), this;
4058
4068
  }
4059
4069
  get normal() {
4060
- return this.#t;
4070
+ return this.#i;
4061
4071
  }
4062
4072
  set normal(e) {
4063
- this.#t = e, this.#t.asPoint = !1;
4073
+ this.#i = e, this.#i.asPoint = !1;
4064
4074
  }
4065
4075
  get point() {
4066
4076
  return this.#e;
@@ -4069,16 +4079,16 @@ class ae {
4069
4079
  this.#e = e, this.#e.asPoint = !0;
4070
4080
  }
4071
4081
  get a() {
4072
- return this.#t.x;
4082
+ return this.#i.x;
4073
4083
  }
4074
4084
  get b() {
4075
- return this.#t.y;
4085
+ return this.#i.y;
4076
4086
  }
4077
4087
  get c() {
4078
- return this.#t.z;
4088
+ return this.#i.z;
4079
4089
  }
4080
4090
  get d() {
4081
- return this.#t.dot(this.#e).opposite();
4091
+ return this.#i.dot(this.#e).opposite();
4082
4092
  }
4083
4093
  get tex() {
4084
4094
  return new y(
@@ -4104,23 +4114,23 @@ class ae {
4104
4114
  return;
4105
4115
  }
4106
4116
  if (e.equation) {
4107
- const t = e.equation.moveLeft().reduce().left, i = t.monomByLetter("x").coefficient, s = t.monomByLetter("y").coefficient, r = t.monomByLetter("z").coefficient, o = t.monomByDegree(0).coefficient;
4108
- this.normal = new g(i, s, r), i.isNotZero() ? this.point = new v(o.clone().divide(i).opposite(), 0, 0) : s.isNotZero() ? this.point = new v(0, o.clone().divide(s).opposite(), 0) : this.point = new v(0, 0, o.clone().divide(r).opposite());
4117
+ const t = e.equation.moveLeft().reduce().left, i = t.monomByLetter("x").coefficient, s = t.monomByLetter("y").coefficient, n = t.monomByLetter("z").coefficient, o = t.monomByDegree(0).coefficient;
4118
+ this.normal = new g(i, s, n), i.isNotZero() ? this.point = new v(o.clone().divide(i).opposite(), 0, 0) : s.isNotZero() ? this.point = new v(0, o.clone().divide(s).opposite(), 0) : this.point = new v(0, 0, o.clone().divide(n).opposite());
4109
4119
  return;
4110
4120
  }
4111
4121
  if (e.points?.length === 3 && e.points.every((t) => t instanceof g)) {
4112
- const t = e.points[0], i = e.points[1], s = e.points[2], r = new g(t, i), o = new g(t, s);
4113
- this.normal = r.cross(o), this.point = t;
4122
+ const t = e.points[0], i = e.points[1], s = e.points[2], n = new g(t, i), o = new g(t, s);
4123
+ this.normal = n.cross(o), this.point = t;
4114
4124
  return;
4115
4125
  }
4116
4126
  if (e.coefficients?.length === 4) {
4117
- const [t, i, s, r] = e.coefficients;
4118
- this.normal = new g(t, i, s), this.point = new v(0, 0, -r);
4127
+ const [t, i, s, n] = e.coefficients;
4128
+ this.normal = new g(t, i, s), this.point = new v(0, 0, -n);
4119
4129
  return;
4120
4130
  }
4121
4131
  }
4122
4132
  angle(e, t, i) {
4123
- if (e instanceof ae)
4133
+ if (e instanceof ee)
4124
4134
  return this.normal.angle(e.normal, t, i);
4125
4135
  let s;
4126
4136
  if (e instanceof g) {
@@ -4145,21 +4155,21 @@ class ae {
4145
4155
  return this.normal.dot(e).add(this.d).isZero();
4146
4156
  }
4147
4157
  }
4148
- class H {
4149
- #t = new v();
4150
- #e = new v();
4158
+ class F {
4151
4159
  #i = new v();
4160
+ #e = new v();
4161
+ #t = new v();
4152
4162
  #s = {
4153
4163
  AB: new b(),
4154
4164
  AC: new b(),
4155
4165
  BC: new b()
4156
4166
  };
4157
- #r = {
4167
+ #n = {
4158
4168
  AB: new v(),
4159
4169
  AC: new v(),
4160
4170
  BC: new v()
4161
4171
  };
4162
- #n = null;
4172
+ #r = null;
4163
4173
  constructor(...e) {
4164
4174
  return e.length > 0 && this.parse(...e), this;
4165
4175
  }
@@ -4167,13 +4177,13 @@ class H {
4167
4177
  // Getter and setters
4168
4178
  // ------------------------------------------
4169
4179
  get A() {
4170
- return this.#t;
4180
+ return this.#i;
4171
4181
  }
4172
4182
  get B() {
4173
4183
  return this.#e;
4174
4184
  }
4175
4185
  get C() {
4176
- return this.#i;
4186
+ return this.#t;
4177
4187
  }
4178
4188
  get AB() {
4179
4189
  return this.#a("A", "B");
@@ -4206,7 +4216,7 @@ class H {
4206
4216
  return this.#s;
4207
4217
  }
4208
4218
  get remarquables() {
4209
- return this.#n;
4219
+ return this.#r;
4210
4220
  }
4211
4221
  // ------------------------------------------
4212
4222
  // Creation / parsing functions
@@ -4235,35 +4245,35 @@ class H {
4235
4245
  if (e.every((t) => t instanceof b)) {
4236
4246
  const t = e[0].clone(), i = e[1].clone(), s = e[2].clone();
4237
4247
  this.#s = { AB: t, BC: i, AC: s };
4238
- let r = t.intersection(i);
4239
- if (r.hasIntersection)
4240
- this.#e = r.point.clone();
4248
+ let n = t.intersection(i);
4249
+ if (n.hasIntersection)
4250
+ this.#e = n.point.clone();
4241
4251
  else
4242
4252
  throw new Error("Lines do not intersect !");
4243
- if (r = i.intersection(s), r.hasIntersection)
4244
- this.#i = r.point.clone();
4253
+ if (n = i.intersection(s), n.hasIntersection)
4254
+ this.#t = n.point.clone();
4245
4255
  else
4246
4256
  throw new Error("Lines do not intersect !");
4247
- if (r = s.intersection(t), r.hasIntersection)
4248
- this.#t = r.point.clone();
4257
+ if (n = s.intersection(t), n.hasIntersection)
4258
+ this.#i = n.point.clone();
4249
4259
  else
4250
4260
  throw new Error("Lines do not intersect !");
4251
- } else e.every((t) => t instanceof v) && (this.#t = e[0].clone(), this.#e = e[1].clone(), this.#i = e[2].clone(), this.#s = {
4252
- AB: new b(this.#t, this.#e),
4253
- BC: new b(this.#e, this.#i),
4254
- AC: new b(this.#t, this.#i)
4261
+ } else e.every((t) => t instanceof v) && (this.#i = e[0].clone(), this.#e = e[1].clone(), this.#t = e[2].clone(), this.#s = {
4262
+ AB: new b(this.#i, this.#e),
4263
+ BC: new b(this.#e, this.#t),
4264
+ AC: new b(this.#i, this.#t)
4255
4265
  });
4256
- } else if (e.length === 1 && e[0] instanceof H)
4266
+ } else if (e.length === 1 && e[0] instanceof F)
4257
4267
  return e[0].clone();
4258
4268
  return this.#o(), this;
4259
4269
  };
4260
4270
  /**
4261
4271
  * Clone the Triangle class
4262
4272
  */
4263
- clone = () => new H(
4264
- this.#t.clone(),
4273
+ clone = () => new F(
4274
+ this.#i.clone(),
4265
4275
  this.#e.clone(),
4266
- this.#i.clone()
4276
+ this.#t.clone()
4267
4277
  );
4268
4278
  // ------------------------------------------
4269
4279
  // Triangle operations and properties
@@ -4272,11 +4282,11 @@ class H {
4272
4282
  * Generate the Line object for the three segments of the triangle
4273
4283
  */
4274
4284
  #o = () => {
4275
- this.#t.asPoint = !0, this.#e.asPoint = !0, this.#i.asPoint = !0, this.#r = {
4276
- AB: new v().middleOf(this.#t, this.#e),
4277
- AC: new v().middleOf(this.#t, this.#i),
4278
- BC: new v().middleOf(this.#e, this.#i)
4279
- }, this.#n = this.#c();
4285
+ this.#i.asPoint = !0, this.#e.asPoint = !0, this.#t.asPoint = !0, this.#n = {
4286
+ AB: new v().middleOf(this.#i, this.#e),
4287
+ AC: new v().middleOf(this.#i, this.#t),
4288
+ BC: new v().middleOf(this.#e, this.#t)
4289
+ }, this.#r = this.#c();
4280
4290
  };
4281
4291
  /**
4282
4292
  * Get the Vector2D class for the given name
@@ -4285,13 +4295,13 @@ class H {
4285
4295
  #h = (e) => {
4286
4296
  switch (e.toUpperCase()) {
4287
4297
  case "A":
4288
- return this.#t;
4298
+ return this.#i;
4289
4299
  case "B":
4290
4300
  return this.#e;
4291
4301
  case "C":
4292
- return this.#i;
4302
+ return this.#t;
4293
4303
  }
4294
- return this.#t;
4304
+ return this.#i;
4295
4305
  };
4296
4306
  /**
4297
4307
  * Get the vector for the segment given by name.
@@ -4304,28 +4314,28 @@ class H {
4304
4314
  );
4305
4315
  #c = () => {
4306
4316
  const e = {
4307
- A: new b().fromPoints(this.#t, this.#r.BC),
4308
- B: new b().fromPoints(this.#e, this.#r.AC),
4309
- C: new b().fromPoints(this.#i, this.#r.AB),
4317
+ A: new b().fromPoints(this.#i, this.#n.BC),
4318
+ B: new b().fromPoints(this.#e, this.#n.AC),
4319
+ C: new b().fromPoints(this.#t, this.#n.AB),
4310
4320
  intersection: null
4311
4321
  }, t = {
4312
- AB: new b().fromPointAndNormal(this.#r.AB, new g(this.#t, this.#e).normal()),
4313
- AC: new b().fromPointAndNormal(this.#r.AC, new g(this.#t, this.#i).normal()),
4314
- BC: new b().fromPointAndNormal(this.#r.BC, new g(this.#e, this.#i).normal()),
4322
+ AB: new b().fromPointAndNormal(this.#n.AB, new g(this.#i, this.#e).normal()),
4323
+ AC: new b().fromPointAndNormal(this.#n.AC, new g(this.#i, this.#t).normal()),
4324
+ BC: new b().fromPointAndNormal(this.#n.BC, new g(this.#e, this.#t).normal()),
4315
4325
  intersection: null
4316
4326
  }, i = {
4317
- A: new b().fromPointAndNormal(this.#t, new g(this.#e, this.#i).normal()),
4318
- B: new b().fromPointAndNormal(this.#e, new g(this.#t, this.#i).normal()),
4319
- C: new b().fromPointAndNormal(this.#i, new g(this.#t, this.#e).normal()),
4327
+ A: new b().fromPointAndNormal(this.#i, new g(this.#e, this.#t).normal()),
4328
+ B: new b().fromPointAndNormal(this.#e, new g(this.#i, this.#t).normal()),
4329
+ C: new b().fromPointAndNormal(this.#t, new g(this.#i, this.#e).normal()),
4320
4330
  intersection: null
4321
- }, s = this.#l("A"), r = this.#l("B"), o = this.#l("C"), h = {
4331
+ }, s = this.#l("A"), n = this.#l("B"), o = this.#l("C"), h = {
4322
4332
  A: s.internal,
4323
- B: r.internal,
4324
- C: r.internal,
4333
+ B: n.internal,
4334
+ C: n.internal,
4325
4335
  intersection: null
4326
4336
  }, l = {
4327
4337
  A: s.external,
4328
- B: r.external,
4338
+ B: n.external,
4329
4339
  C: o.external,
4330
4340
  intersection: null
4331
4341
  }, c = {
@@ -4342,34 +4352,34 @@ class H {
4342
4352
  let i, s;
4343
4353
  if (e === "A" ? (i = t.AB, s = t.AC) : e === "B" ? (i = t.AB, s = t.BC) : e === "C" && (i = t.BC, s = t.AC), i === void 0 || s === void 0)
4344
4354
  throw new Error(`The point ${e} does not exist`);
4345
- const r = i.n.simplify().norm, o = s.n.simplify().norm, h = i.getEquation().multiply(o), l = s.getEquation().multiply(r), c = new b(h.clone().subtract(l).simplify()), d = new b(l.clone().subtract(h).simplify());
4355
+ const n = i.n.simplify().norm, o = s.n.simplify().norm, h = i.getEquation().multiply(o), l = s.getEquation().multiply(n), c = new b(h.clone().subtract(l).simplify()), d = new b(l.clone().subtract(h).simplify());
4346
4356
  return e === "A" ? c.hitSegment(this.B, this.C) ? { internal: c, external: d } : { internal: d, external: c } : e === "B" ? c.hitSegment(this.A, this.C) ? { internal: c, external: d } : { internal: d, external: c } : e === "C" ? c.hitSegment(this.B, this.A) ? { internal: c, external: d } : { internal: d, external: c } : { internal: c, external: d };
4347
4357
  };
4348
4358
  }
4349
- var ge = /* @__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))(ge || {});
4350
- class Ue {
4351
- #t = void 0;
4352
- #e = void 0;
4359
+ var oe = /* @__PURE__ */ ((r) => (r[r.INTERIOR = 0] = "INTERIOR", r[r.EXTERIOR = 1] = "EXTERIOR", r[r.SECANT = 2] = "SECANT", r[r.TANGENT_INSIDE = 3] = "TANGENT_INSIDE", r[r.TANGENT_OUTSIDE = 4] = "TANGENT_OUTSIDE", r[r.SUPERPOSED = 5] = "SUPERPOSED", r[r.CONCENTRIC = 6] = "CONCENTRIC", r))(oe || {});
4360
+ class Be {
4353
4361
  #i = void 0;
4362
+ #e = void 0;
4363
+ #t = void 0;
4354
4364
  #s = 1;
4355
4365
  constructor(e, t) {
4356
- return e && t && (this.#t = e, this.#e = new a(t).clone().pow(2), this.#n()), this;
4366
+ return e && t && (this.#i = e, this.#e = new a(t).clone().pow(2), this.#r()), this;
4357
4367
  }
4358
4368
  fromEquation(e) {
4359
4369
  const t = new y(e).moveLeft().reduce(), i = ["x", "y", "z"];
4360
- if (i.some((r) => t.degree(r).value !== 2))
4370
+ if (i.some((n) => t.degree(n).value !== 2))
4361
4371
  return this.makeUndefined();
4362
4372
  const s = t.left.monomByDegree(2, "x").coefficient;
4363
- return i.some((r) => t.left.monomByDegree(2, r).coefficient.isNotEqual(s)) ? this.makeUndefined() : (this.#t = new v(
4373
+ return i.some((n) => t.left.monomByDegree(2, n).coefficient.isNotEqual(s)) ? this.makeUndefined() : (this.#i = new v(
4364
4374
  t.left.monomByDegree(1, "x").coefficient.clone().opposite().divide(2),
4365
4375
  t.left.monomByDegree(1, "y").coefficient.clone().opposite().divide(2),
4366
4376
  t.left.monomByDegree(1, "z").coefficient.clone().opposite().divide(2)
4367
- ), this.#e = t.left.monomByDegree(0).coefficient.clone().opposite().add(this.#t.x.clone().pow(2)).add(this.#t.y.clone().pow(2)).add(this.#t.z.clone().pow(2)), this.#n(), this);
4377
+ ), this.#e = t.left.monomByDegree(0).coefficient.clone().opposite().add(this.#i.x.clone().pow(2)).add(this.#i.y.clone().pow(2)).add(this.#i.z.clone().pow(2)), this.#r(), this);
4368
4378
  }
4369
4379
  get center() {
4370
- if (this.#t === void 0)
4380
+ if (this.#i === void 0)
4371
4381
  throw new Error("Sphere3 is undefined");
4372
- return this.#t;
4382
+ return this.#i;
4373
4383
  }
4374
4384
  get squareRadius() {
4375
4385
  if (this.#e === void 0)
@@ -4390,12 +4400,12 @@ class Ue {
4390
4400
  };
4391
4401
  }
4392
4402
  get equation() {
4393
- if (this.#i === void 0)
4403
+ if (this.#t === void 0)
4394
4404
  throw new Error("Sphere3 is undefined");
4395
- return this.#i;
4405
+ return this.#t;
4396
4406
  }
4397
4407
  makeUndefined() {
4398
- return this.#t = void 0, this.#e = void 0, this.#i = void 0, this;
4408
+ return this.#i = void 0, this.#e = void 0, this.#t = void 0, this;
4399
4409
  }
4400
4410
  get centerRadius() {
4401
4411
  return this.#s = 1, this;
@@ -4404,30 +4414,30 @@ class Ue {
4404
4414
  return this.#s = 0, this;
4405
4415
  }
4406
4416
  get tex() {
4407
- return this.#r(!0);
4417
+ return this.#n(!0);
4408
4418
  }
4409
4419
  get display() {
4410
- return this.#r(!1);
4420
+ return this.#n(!1);
4411
4421
  }
4412
- #r = (e) => {
4413
- if (this.#i === void 0)
4422
+ #n = (e) => {
4423
+ if (this.#t === void 0)
4414
4424
  throw new Error("Sphere3 is undefined");
4415
4425
  if (this.#s === 0)
4416
- return e ? this.#i.tex : this.#i.display;
4426
+ return e ? this.#t.tex : this.#t.display;
4417
4427
  const t = [];
4418
4428
  return ["x", "y", "z"].forEach((s) => {
4419
4429
  if (this.center[s].isZero())
4420
4430
  t.push(`${s}^2`);
4421
4431
  else {
4422
- const r = new u(s).subtract(this.center[s]);
4432
+ const n = new u(s).subtract(this.center[s]);
4423
4433
  t.push(
4424
- e ? `\\(${r.tex}\\)^2` : `(${r.display})^2`
4434
+ e ? `\\(${n.tex}\\)^2` : `(${n.display})^2`
4425
4435
  );
4426
4436
  }
4427
4437
  }), t.join("+") + "=" + (e ? this.squareRadius.tex : this.squareRadius.display);
4428
4438
  };
4429
- #n() {
4430
- this.#i = new y(
4439
+ #r() {
4440
+ this.#t = new y(
4431
4441
  new u("x").subtract(this.center.x).pow(2).add(
4432
4442
  new u("y").subtract(this.center.y).pow(2)
4433
4443
  ).add(
@@ -4436,18 +4446,18 @@ class Ue {
4436
4446
  new u(this.squareRadius)
4437
4447
  ).reduce();
4438
4448
  }
4439
- static RELATIVE_POSITION = ge;
4449
+ static RELATIVE_POSITION = oe;
4440
4450
  relativePosition = (e) => {
4441
4451
  const t = this.center.distanceTo(e.center).value, i = this.radius.value, s = e.radius.value;
4442
4452
  return t > i + s ? 1 : t === i + s ? 4 : t === 0 ? i === s ? 5 : 6 : t === Math.abs(i - s) ? 3 : t < Math.abs(i - s) ? 0 : 2;
4443
4453
  };
4444
- isPointOnSphere = (e) => this.#i?.test({
4454
+ isPointOnSphere = (e) => this.#t?.test({
4445
4455
  x: e.x,
4446
4456
  y: e.y,
4447
4457
  z: e.z
4448
4458
  }) ?? !1;
4449
4459
  }
4450
- function K(n) {
4460
+ function G(r) {
4451
4461
  const e = Object.assign(
4452
4462
  {
4453
4463
  negative: !0,
@@ -4456,18 +4466,18 @@ function K(n) {
4456
4466
  zero: !0,
4457
4467
  natural: !1
4458
4468
  },
4459
- n
4469
+ r
4460
4470
  ), t = new a();
4461
- if (e.negative ? t.numerator = q(e.max, e.zero) : t.numerator = B(e.zero ? 0 : 1, e.max), e.natural)
4471
+ if (e.negative ? t.numerator = q(e.max, e.zero) : t.numerator = k(e.zero ? 0 : 1, e.max), e.natural)
4462
4472
  t.denominator = 1;
4463
4473
  else {
4464
4474
  let i = 0;
4465
4475
  for (; t.isRelative() && i < 10; )
4466
- t.denominator = B(1, e.max), i++;
4476
+ t.denominator = k(1, e.max), i++;
4467
4477
  }
4468
4478
  return e.reduced ? t.reduce() : t;
4469
4479
  }
4470
- function we(n) {
4480
+ function he(r) {
4471
4481
  const e = Object.assign(
4472
4482
  {
4473
4483
  letters: "x",
@@ -4475,9 +4485,9 @@ function we(n) {
4475
4485
  fraction: !0,
4476
4486
  zero: !1
4477
4487
  },
4478
- n
4488
+ r
4479
4489
  ), t = new p();
4480
- if (t.coefficient = K({
4490
+ if (t.coefficient = G({
4481
4491
  zero: e.zero,
4482
4492
  reduced: !0,
4483
4493
  natural: !e.fraction
@@ -4485,14 +4495,14 @@ function we(n) {
4485
4495
  for (const i of e.letters.split(""))
4486
4496
  t.setLetter(i, 0);
4487
4497
  for (let i = 0; i < e.degree; i++) {
4488
- const s = he(e.letters.split(""));
4498
+ const s = _(e.letters.split(""));
4489
4499
  t.setLetter(s, t.degree(s).clone().add(1));
4490
4500
  }
4491
4501
  } else
4492
4502
  t.setLetter(e.letters, e.degree);
4493
4503
  return t;
4494
4504
  }
4495
- const Fe = {
4505
+ const Me = {
4496
4506
  letters: "x",
4497
4507
  degree: 2,
4498
4508
  fraction: !1,
@@ -4503,14 +4513,14 @@ const Fe = {
4503
4513
  numberOfMonoms: 0,
4504
4514
  positive: !0
4505
4515
  };
4506
- function ye(n) {
4516
+ function ae(r) {
4507
4517
  const e = Object.assign(
4508
- Fe,
4509
- n
4518
+ Me,
4519
+ r
4510
4520
  ), t = new u().empty();
4511
4521
  let i;
4512
4522
  for (let s = e.degree; s >= 0; s--)
4513
- i = we({
4523
+ i = he({
4514
4524
  letters: e.letters,
4515
4525
  degree: s,
4516
4526
  fraction: e.fraction,
@@ -4518,12 +4528,12 @@ function ye(n) {
4518
4528
  }), e.unit && e.degree === s && i.coefficient.one(), t.add(i);
4519
4529
  if (e.positive && t.monomByDegree().coefficient.isNegative() && t.monomByDegree().coefficient.opposite(), e.numberOfMonoms && e.numberOfMonoms > 0 && e.numberOfMonoms < t.length)
4520
4530
  for (; t.length > e.numberOfMonoms; ) {
4521
- const s = B(1, t.length - 1);
4531
+ const s = k(1, t.length - 1);
4522
4532
  t.monoms.splice(s, 1);
4523
4533
  }
4524
4534
  return t.reduce();
4525
4535
  }
4526
- function Ge(n) {
4536
+ function Se(r) {
4527
4537
  const e = Object.assign(
4528
4538
  {
4529
4539
  letters: "x",
@@ -4542,10 +4552,10 @@ function Ge(n) {
4542
4552
  everything: !1
4543
4553
  }
4544
4554
  },
4545
- n
4555
+ r
4546
4556
  ), t = new u().one();
4547
4557
  for (let i = 0; i < e.degree; i++) {
4548
- const s = ye({
4558
+ const s = ae({
4549
4559
  degree: 1,
4550
4560
  unit: e.unit,
4551
4561
  fraction: e.fraction,
@@ -4556,7 +4566,7 @@ function Ge(n) {
4556
4566
  }
4557
4567
  return new y(t, 0);
4558
4568
  }
4559
- function re(n) {
4569
+ function H(r) {
4560
4570
  const e = Object.assign(
4561
4571
  {
4562
4572
  axis: !0,
@@ -4564,11 +4574,11 @@ function re(n) {
4564
4574
  max: 10,
4565
4575
  quadrant: null
4566
4576
  },
4567
- n
4568
- ), t = e.axis === "x", i = e.axis === "y", s = e.fraction ? K({ max: e.max, zero: t }) : new a(q(e.max, t)), r = e.fraction ? K({ max: e.max, zero: i }) : new a(q(e.max, i));
4569
- return Number(e.quadrant) === 1 && (s.abs(), r.abs()), Number(e.quadrant) === 2 && (s.isPositive() && s.opposite(), r.isNegative() && r.opposite()), Number(e.quadrant) === 3 && (s.isPositive() && s.opposite(), r.isPositive() && r.opposite()), Number(e.quadrant) === 4 && (s.isNegative() && s.opposite(), r.isPositive() && r.opposite()), new v(s, r);
4577
+ r
4578
+ ), t = e.axis === "x", i = e.axis === "y", s = e.fraction ? G({ max: e.max, zero: t }) : new a(q(e.max, t)), n = e.fraction ? G({ max: e.max, zero: i }) : new a(q(e.max, i));
4579
+ return Number(e.quadrant) === 1 && (s.abs(), n.abs()), Number(e.quadrant) === 2 && (s.isPositive() && s.opposite(), n.isNegative() && n.opposite()), Number(e.quadrant) === 3 && (s.isPositive() && s.opposite(), n.isPositive() && n.opposite()), Number(e.quadrant) === 4 && (s.isNegative() && s.opposite(), n.isPositive() && n.opposite()), new v(s, n);
4570
4580
  }
4571
- function We(n) {
4581
+ function Ie(r) {
4572
4582
  const e = Object.assign(
4573
4583
  {
4574
4584
  center: {
@@ -4577,12 +4587,12 @@ function We(n) {
4577
4587
  },
4578
4588
  pointsOnCircle: 8
4579
4589
  },
4580
- n
4581
- ), t = re(e.center);
4590
+ r
4591
+ ), t = H(e.center);
4582
4592
  let i, s;
4583
- return e.pointsOnCircle === 8 ? (i = B(1, 3), s = i ** 2 + (i + 1) ** 2) : s = B(1, 20), new W(t, s, !0);
4593
+ return e.pointsOnCircle === 8 ? (i = k(1, 3), s = i ** 2 + (i + 1) ** 2) : s = k(1, 20), new V(t, s, !0);
4584
4594
  }
4585
- function Xe(n) {
4595
+ function ze(r) {
4586
4596
  const e = Object.assign(
4587
4597
  {
4588
4598
  A: {
@@ -4590,7 +4600,7 @@ function Xe(n) {
4590
4600
  y: q(10)
4591
4601
  }
4592
4602
  },
4593
- n
4603
+ r
4594
4604
  ), t = new g(
4595
4605
  q(10),
4596
4606
  q(10)
@@ -4599,7 +4609,7 @@ function Xe(n) {
4599
4609
  t.x = q(10), t.y = q(10);
4600
4610
  return e.slope === 1 ? t.x.sign() !== t.y.sign() && t.y.opposite() : e.slope === -1 && t.x.sign() !== t.y.sign() && t.y.opposite(), new b().fromPointAndDirection(new g(e.A.x, e.A.y), t);
4601
4611
  }
4602
- function Ye(n) {
4612
+ function Re(r) {
4603
4613
  const e = Object.assign(
4604
4614
  {
4605
4615
  A: {
@@ -4613,85 +4623,85 @@ function Ye(n) {
4613
4623
  z: q(10)
4614
4624
  }
4615
4625
  },
4616
- n
4626
+ r
4617
4627
  ), t = new v(e.A.x, e.A.y, e.A.z), i = new g(e.direction.x, e.direction.y, e.direction.z);
4618
- return new ee(t, i);
4628
+ return new Y(t, i);
4619
4629
  }
4620
- const Qe = {
4621
- equation: (n) => Ge(n),
4622
- polynom: (n) => ye(n),
4623
- monom: (n) => we(n),
4624
- fraction: (n) => K(n),
4625
- number: (n, e, t) => B(n, e, t),
4626
- numberSym: (n, e) => q(n, e),
4627
- prime: (n) => Ve(n),
4628
- bool: (n) => pe(n),
4629
- array: (n, e) => je(n, e),
4630
- item: (n) => he(n),
4631
- shuffle: (n) => me(n),
4632
- line: (n) => Xe(n),
4633
- line3: (n) => Ye(n),
4634
- vector: (n) => re(n),
4635
- point: (n) => {
4636
- const e = re(n);
4630
+ const Pe = {
4631
+ equation: (r) => Se(r),
4632
+ polynom: (r) => ae(r),
4633
+ monom: (r) => he(r),
4634
+ fraction: (r) => G(r),
4635
+ number: (r, e, t) => k(r, e, t),
4636
+ numberSym: (r, e) => q(r, e),
4637
+ prime: (r) => $e(r),
4638
+ bool: (r) => ne(r),
4639
+ array: (r, e) => ke(r, e),
4640
+ item: (r) => _(r),
4641
+ shuffle: (r) => re(r),
4642
+ line: (r) => ze(r),
4643
+ line3: (r) => Re(r),
4644
+ vector: (r) => H(r),
4645
+ point: (r) => {
4646
+ const e = H(r);
4637
4647
  return e.asPoint = !0, e;
4638
4648
  },
4639
- circle: (n) => We(n)
4640
- }, Ke = {
4649
+ circle: (r) => Ie(r)
4650
+ }, Le = {
4641
4651
  Numeric: E,
4642
4652
  Fraction: a,
4643
- Root: X,
4653
+ Root: j,
4644
4654
  Monom: p,
4645
4655
  Polynom: u,
4646
4656
  Equation: y,
4647
- Matrix: P,
4648
- LinearSystem: Z,
4657
+ Matrix: I,
4658
+ LinearSystem: D,
4649
4659
  Factor: x,
4650
4660
  PolyFactor: T,
4651
- LogicalSet: Pe,
4652
- Random: Qe,
4661
+ LogicalSet: qe,
4662
+ Random: Pe,
4653
4663
  Geometry: {
4654
4664
  Vector: g,
4655
4665
  Point: v,
4656
4666
  Line: b,
4657
- Triangle: H,
4658
- Circle: W,
4659
- Line3: ee,
4660
- Plane3: ae,
4661
- Sphere3: Ue
4667
+ Triangle: F,
4668
+ Circle: V,
4669
+ Line3: Y,
4670
+ Plane3: ee,
4671
+ Sphere3: Be
4662
4672
  },
4663
- NumExp: Re
4673
+ NumExp: Ae
4664
4674
  };
4665
4675
  export {
4666
- W as Circle,
4676
+ V as Circle,
4667
4677
  y as Equation,
4668
- J as EquationSolver,
4669
- G as FACTOR_DISPLAY,
4670
- Oe as FRAC_TYPE,
4678
+ W as EquationSolver,
4679
+ Z as FACTOR_DISPLAY,
4680
+ we as FRAC_TYPE,
4671
4681
  x as Factor,
4672
4682
  a as Fraction,
4673
4683
  b as Line,
4674
- ee as Line3,
4675
- Z as LinearSystem,
4676
- Pe as LogicalSet,
4677
- P as Matrix,
4684
+ Y as Line3,
4685
+ D as LinearSystem,
4686
+ qe as LogicalSet,
4687
+ I as Matrix,
4678
4688
  p as Monom,
4679
- X as NthRoot,
4680
- Re as NumExp,
4689
+ j as NthRoot,
4690
+ Ae as NumExp,
4681
4691
  E as Numeric,
4682
- ae as Plane3,
4692
+ ee as Plane3,
4683
4693
  v as Point,
4684
4694
  T as PolyFactor,
4685
4695
  u as Polynom,
4686
- Qe as Random,
4687
- ge as SPHERE3_RELATIVE_POSITION,
4688
- Ue as Sphere3,
4689
- H as Triangle,
4696
+ Pe as Random,
4697
+ oe as SPHERE3_RELATIVE_POSITION,
4698
+ Be as Sphere3,
4699
+ F as Triangle,
4690
4700
  g as Vector,
4691
- Le as areVectorsColinears,
4692
- De as areVectorsEquals,
4693
- Ke as default,
4694
- He as determinantFromVectors,
4695
- Ze as dotProduct
4701
+ Oe as areVectorsColinears,
4702
+ Te as areVectorsEquals,
4703
+ Le as default,
4704
+ De as determinantFromVectors,
4705
+ Ce as dotProduct
4696
4706
  };
4697
4707
  //# sourceMappingURL=pimath.js.map