pimath 0.1.27 → 0.1.29
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/algebra/linearSystem.d.ts +3 -3
- package/dist/geometry/index.d.ts +1 -0
- package/dist/geometry/plane3.d.ts +1 -0
- package/dist/geometry/sphere3.d.ts +33 -0
- package/dist/index.d.ts +2 -1
- package/dist/pimath.js +1031 -911
- package/dist/pimath.js.map +1 -1
- package/dist/randomization/algebra/rndPolynom.d.ts +1 -1
- package/package.json +1 -1
package/dist/pimath.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
1
|
+
var Gi = Object.defineProperty;
|
|
2
|
+
var Ni = (o) => {
|
|
3
3
|
throw TypeError(o);
|
|
4
4
|
};
|
|
5
|
-
var
|
|
6
|
-
var a = (o, e, t) =>
|
|
7
|
-
var s = (o, e, t) => (
|
|
8
|
-
function
|
|
9
|
-
const e =
|
|
5
|
+
var Wi = (o, e, t) => e in o ? Gi(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
|
|
6
|
+
var a = (o, e, t) => Wi(o, typeof e != "symbol" ? e + "" : e, t), ri = (o, e, t) => e.has(o) || Ni("Cannot " + t);
|
|
7
|
+
var s = (o, e, t) => (ri(o, e, "read from private field"), t ? t.call(o) : e.get(o)), m = (o, e, t) => e.has(o) ? Ni("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(o) : e.set(o, t), h = (o, e, t, i) => (ri(o, e, "write to private field"), i ? i.call(o, t) : e.set(o, t), t), A = (o, e, t) => (ri(o, e, "access private method"), t);
|
|
8
|
+
function Xi(o) {
|
|
9
|
+
const e = Ai(o), t = [];
|
|
10
10
|
let i, n;
|
|
11
11
|
for (; e.length > 0; )
|
|
12
12
|
i = e.shift() ?? 1, n = (e.length > 0 ? e.pop() : +i) ?? 1, t.push([i, n]);
|
|
13
13
|
return t;
|
|
14
14
|
}
|
|
15
|
-
function
|
|
16
|
-
const e =
|
|
15
|
+
function Yi(...o) {
|
|
16
|
+
const e = wi(...o);
|
|
17
17
|
return o.map((t) => t / e);
|
|
18
18
|
}
|
|
19
|
-
function
|
|
19
|
+
function Ai(o) {
|
|
20
20
|
const e = Math.abs(o), t = Math.sqrt(e), i = [];
|
|
21
21
|
for (let n = 1; n <= t; n++)
|
|
22
22
|
o % n === 0 && (i.push(n), i.push(e / n));
|
|
@@ -24,7 +24,7 @@ function wi(o) {
|
|
|
24
24
|
return n - r;
|
|
25
25
|
}), [...new Set(i)];
|
|
26
26
|
}
|
|
27
|
-
function
|
|
27
|
+
function wi(...o) {
|
|
28
28
|
const e = function(n, r) {
|
|
29
29
|
return r === 0 ? n : e(r, n % r);
|
|
30
30
|
};
|
|
@@ -39,52 +39,52 @@ function ui(...o) {
|
|
|
39
39
|
;
|
|
40
40
|
return Math.abs(t);
|
|
41
41
|
}
|
|
42
|
-
function
|
|
42
|
+
function Qi(...o) {
|
|
43
43
|
return o.reduce(function(e, t) {
|
|
44
|
-
return Math.abs(e * t /
|
|
44
|
+
return Math.abs(e * t / wi(e, t));
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
|
-
function
|
|
47
|
+
function Hi(o, e = 3) {
|
|
48
48
|
return +o.toFixed(e);
|
|
49
49
|
}
|
|
50
|
-
function
|
|
50
|
+
function Ki(o) {
|
|
51
51
|
if (Number.isSafeInteger(o) || o.toString().split(".")[0].length < 10)
|
|
52
52
|
return 0;
|
|
53
53
|
throw new Error("Periodic value: Not implemented yet");
|
|
54
54
|
}
|
|
55
|
-
function
|
|
55
|
+
function Ji(o) {
|
|
56
56
|
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];
|
|
57
57
|
return o === void 0 ? e : e.slice(0, Math.min(e.length, o));
|
|
58
58
|
}
|
|
59
|
-
function
|
|
59
|
+
function _i(o, e) {
|
|
60
60
|
const t = [], i = e === !0 ? +o : o ** 2;
|
|
61
61
|
for (let n = 0; n <= o; n++)
|
|
62
62
|
for (let r = 0; r <= o; r++)
|
|
63
63
|
n ** 2 + r ** 2 === i && t.push([n, r, o]);
|
|
64
64
|
return t;
|
|
65
65
|
}
|
|
66
|
-
function
|
|
66
|
+
function es(o, e = 2) {
|
|
67
67
|
return +`${Math.round(+`${o}e${e}`)}e-${e}`;
|
|
68
68
|
}
|
|
69
|
-
const
|
|
70
|
-
decompose:
|
|
71
|
-
dividers:
|
|
72
|
-
divideNumbersByGCD:
|
|
73
|
-
gcd:
|
|
74
|
-
lcm:
|
|
75
|
-
numberCorrection:
|
|
76
|
-
periodic:
|
|
77
|
-
primes:
|
|
78
|
-
pythagoreanTripletsWithTarget:
|
|
79
|
-
round:
|
|
69
|
+
const G = {
|
|
70
|
+
decompose: Xi,
|
|
71
|
+
dividers: Ai,
|
|
72
|
+
divideNumbersByGCD: Yi,
|
|
73
|
+
gcd: wi,
|
|
74
|
+
lcm: Qi,
|
|
75
|
+
numberCorrection: Hi,
|
|
76
|
+
periodic: Ki,
|
|
77
|
+
primes: Ji,
|
|
78
|
+
pythagoreanTripletsWithTarget: _i,
|
|
79
|
+
round: es
|
|
80
80
|
};
|
|
81
|
-
var
|
|
82
|
-
const
|
|
81
|
+
var mt, x, v, Le;
|
|
82
|
+
const B = class B {
|
|
83
83
|
constructor(e, t) {
|
|
84
|
-
m(this,
|
|
84
|
+
m(this, mt, !1);
|
|
85
85
|
m(this, x, 1);
|
|
86
86
|
m(this, v, 1);
|
|
87
|
-
m(this,
|
|
87
|
+
m(this, Le, "frac");
|
|
88
88
|
// ------------------------------------------
|
|
89
89
|
/**
|
|
90
90
|
* Parse the value to get the numerator and denominator
|
|
@@ -114,22 +114,22 @@ const $ = class $ {
|
|
|
114
114
|
}
|
|
115
115
|
break;
|
|
116
116
|
case "object":
|
|
117
|
-
e instanceof
|
|
117
|
+
e instanceof B && (h(this, v, +e.numerator), h(this, x, +e.denominator));
|
|
118
118
|
break;
|
|
119
119
|
}
|
|
120
120
|
return this;
|
|
121
121
|
});
|
|
122
122
|
a(this, "clone", () => {
|
|
123
|
-
const e = new
|
|
123
|
+
const e = new B();
|
|
124
124
|
return e.numerator = +s(this, v), e.denominator = +s(this, x), e;
|
|
125
125
|
});
|
|
126
126
|
a(this, "abs", () => (h(this, v, Math.abs(s(this, v))), h(this, x, Math.abs(s(this, x))), this));
|
|
127
127
|
a(this, "add", (e) => {
|
|
128
|
-
if (e instanceof
|
|
128
|
+
if (e instanceof B) {
|
|
129
129
|
const t = s(this, v), i = s(this, x);
|
|
130
130
|
h(this, v, t * e.denominator + e.numerator * i), h(this, x, i * e.denominator);
|
|
131
131
|
} else
|
|
132
|
-
return this.add(new
|
|
132
|
+
return this.add(new B(e));
|
|
133
133
|
return this.reduce();
|
|
134
134
|
});
|
|
135
135
|
a(this, "amplify", (e) => (Number.isSafeInteger(e) && (h(this, v, s(this, v) * e), h(this, x, s(this, x) * e)), this));
|
|
@@ -146,7 +146,7 @@ const $ = class $ {
|
|
|
146
146
|
a(this, "compare", (e, t) => {
|
|
147
147
|
t === void 0 && (t = "=");
|
|
148
148
|
let i;
|
|
149
|
-
switch (e instanceof
|
|
149
|
+
switch (e instanceof B ? i = e.clone() : i = new B(e), t) {
|
|
150
150
|
case ">":
|
|
151
151
|
return this.value > i.value;
|
|
152
152
|
case ">=":
|
|
@@ -168,9 +168,9 @@ const $ = class $ {
|
|
|
168
168
|
}
|
|
169
169
|
});
|
|
170
170
|
a(this, "divide", (e) => {
|
|
171
|
-
const t = new
|
|
171
|
+
const t = new B(e);
|
|
172
172
|
if (t.numerator === 0)
|
|
173
|
-
return new
|
|
173
|
+
return new B().infinite();
|
|
174
174
|
const i = +s(this, v), n = +s(this, x);
|
|
175
175
|
return h(this, v, i * t.denominator), h(this, x, n * t.numerator), this.reduce();
|
|
176
176
|
});
|
|
@@ -180,7 +180,7 @@ const $ = class $ {
|
|
|
180
180
|
const e = +s(this, v);
|
|
181
181
|
return h(this, v, +s(this, x)), h(this, x, e), this;
|
|
182
182
|
});
|
|
183
|
-
a(this, "isApproximative", () => s(this,
|
|
183
|
+
a(this, "isApproximative", () => s(this, mt) || s(this, v).toString().length >= 15 && s(this, x).toString().length >= 15);
|
|
184
184
|
a(this, "isEqual", (e) => this.compare(e, "="));
|
|
185
185
|
a(this, "isEven", () => this.isRelative() && this.value % 2 === 0);
|
|
186
186
|
a(this, "isExact", () => !this.isApproximative());
|
|
@@ -188,7 +188,7 @@ const $ = class $ {
|
|
|
188
188
|
a(this, "isGeq", (e) => this.compare(e, ">="));
|
|
189
189
|
a(this, "isGreater", (e) => this.compare(e, ">"));
|
|
190
190
|
a(this, "isInfinity", () => Math.abs(s(this, v)) === 1 / 0);
|
|
191
|
-
a(this, "isInverted", (e) => this.isEqual(new
|
|
191
|
+
a(this, "isInverted", (e) => this.isEqual(new B().one().divide(e.clone())));
|
|
192
192
|
a(this, "isLeq", (e) => this.compare(e, "<="));
|
|
193
193
|
/* Compare shortcuts */
|
|
194
194
|
a(this, "isLesser", (e) => this.compare(e, "<"));
|
|
@@ -204,7 +204,7 @@ const $ = class $ {
|
|
|
204
204
|
a(this, "isOpposite", (e) => this.isEqual(e.clone().opposite()));
|
|
205
205
|
a(this, "isPositive", () => this.sign() === 1);
|
|
206
206
|
a(this, "isRational", () => !this.isRelative());
|
|
207
|
-
a(this, "isReduced", () => Math.abs(
|
|
207
|
+
a(this, "isReduced", () => Math.abs(G.gcd(s(this, v), s(this, x))) === 1);
|
|
208
208
|
a(this, "isRelative", () => this.clone().reduce().denominator === 1);
|
|
209
209
|
a(this, "isSquare", () => Math.sqrt(s(this, v)) % 1 === 0 && Math.sqrt(s(this, x)) % 1 === 0);
|
|
210
210
|
a(this, "isStrictlyNegative", () => this.value < 0);
|
|
@@ -212,13 +212,13 @@ const $ = class $ {
|
|
|
212
212
|
// Mathematical operations specific to fractions
|
|
213
213
|
a(this, "isZero", () => s(this, v) === 0);
|
|
214
214
|
a(this, "multiply", (e) => {
|
|
215
|
-
const t = new
|
|
215
|
+
const t = new B(e);
|
|
216
216
|
return h(this, v, s(this, v) * t.numerator), h(this, x, s(this, x) * t.denominator), this.reduce();
|
|
217
217
|
});
|
|
218
218
|
a(this, "one", () => (h(this, v, 1), h(this, x, 1), this));
|
|
219
219
|
a(this, "opposite", () => (h(this, v, -s(this, v)), this));
|
|
220
220
|
a(this, "pow", (e) => {
|
|
221
|
-
if (e instanceof
|
|
221
|
+
if (e instanceof B)
|
|
222
222
|
return this.pow(e.value);
|
|
223
223
|
this.reduce(), e < 0 && this.inverse();
|
|
224
224
|
const t = Math.floor(Math.pow(s(this, v), Math.abs(e))), i = Math.floor(Math.pow(s(this, x), Math.abs(e)));
|
|
@@ -226,7 +226,7 @@ const $ = class $ {
|
|
|
226
226
|
});
|
|
227
227
|
// ------------------------------------------
|
|
228
228
|
a(this, "reduce", () => {
|
|
229
|
-
const e =
|
|
229
|
+
const e = G.gcd(s(this, v), s(this, x));
|
|
230
230
|
return h(this, v, s(this, v) / e), h(this, x, s(this, x) / e), s(this, x) < 0 && (h(this, x, -s(this, x)), h(this, v, -s(this, v))), this;
|
|
231
231
|
});
|
|
232
232
|
a(this, "root", (e) => {
|
|
@@ -239,13 +239,13 @@ const $ = class $ {
|
|
|
239
239
|
const t = this.sign();
|
|
240
240
|
this.abs(), this.reduce();
|
|
241
241
|
const i = Math.floor(Math.pow(s(this, v), Math.abs(1 / e))), n = Math.floor(Math.pow(s(this, x), Math.abs(1 / e)));
|
|
242
|
-
return h(this, v, Math.pow(s(this, v), Math.abs(1 / e))), h(this, x, Math.pow(s(this, x), Math.abs(1 / e))), (i !== s(this, v) || n !== s(this, x)) && (h(this, v, s(this, v) / s(this, x)), h(this, x, 1), h(this,
|
|
242
|
+
return h(this, v, Math.pow(s(this, v), Math.abs(1 / e))), h(this, x, Math.pow(s(this, x), Math.abs(1 / e))), (i !== s(this, v) || n !== s(this, x)) && (h(this, v, s(this, v) / s(this, x)), h(this, x, 1), h(this, mt, !0)), this.multiply(t), this;
|
|
243
243
|
});
|
|
244
244
|
// ------------------------------------------
|
|
245
245
|
// Getter and setter
|
|
246
246
|
a(this, "sign", () => s(this, v) * s(this, x) >= 0 ? 1 : -1);
|
|
247
247
|
a(this, "sqrt", () => this.root(2));
|
|
248
|
-
a(this, "subtract", (e) => e instanceof
|
|
248
|
+
a(this, "subtract", (e) => e instanceof B ? this.add(e.clone().opposite()) : this.add(-e));
|
|
249
249
|
a(this, "zero", () => (h(this, v, 0), h(this, x, 1), this));
|
|
250
250
|
return e !== void 0 && this.parse(e, t), this;
|
|
251
251
|
}
|
|
@@ -256,13 +256,13 @@ const $ = class $ {
|
|
|
256
256
|
h(this, x, e);
|
|
257
257
|
}
|
|
258
258
|
get dfrac() {
|
|
259
|
-
return h(this,
|
|
259
|
+
return h(this, Le, "dfrac"), this;
|
|
260
260
|
}
|
|
261
261
|
get display() {
|
|
262
262
|
return this.isExact() ? s(this, x) === 1 ? `${s(this, v)}` : `${s(this, v)}/${s(this, x)}` : this.value.toFixed(3);
|
|
263
263
|
}
|
|
264
264
|
get frac() {
|
|
265
|
-
return h(this,
|
|
265
|
+
return h(this, Le, "frac"), this;
|
|
266
266
|
}
|
|
267
267
|
// ------------------------------------------
|
|
268
268
|
get numerator() {
|
|
@@ -273,97 +273,97 @@ const $ = class $ {
|
|
|
273
273
|
}
|
|
274
274
|
// Display getter
|
|
275
275
|
get tex() {
|
|
276
|
-
return this.isInfinity() ? `${this.sign() === 1 ? "+" : "-"}\\infty` : this.isExact() ? s(this, x) === 1 ? `${s(this, v)}` : s(this, v) < 0 ? `-\\${s(this,
|
|
276
|
+
return this.isInfinity() ? `${this.sign() === 1 ? "+" : "-"}\\infty` : this.isExact() ? s(this, x) === 1 ? `${s(this, v)}` : s(this, v) < 0 ? `-\\${s(this, Le)}{ ${-s(this, v)} }{ ${s(this, x)} }` : `\\${s(this, Le)}{ ${s(this, v)} }{ ${s(this, x)} }` : this.value.toFixed(3);
|
|
277
277
|
}
|
|
278
278
|
get texWithSign() {
|
|
279
279
|
return this.isPositive() ? `+${this.tex}` : this.tex;
|
|
280
280
|
}
|
|
281
281
|
get tfrac() {
|
|
282
|
-
return h(this,
|
|
282
|
+
return h(this, Le, "tfrac"), this;
|
|
283
283
|
}
|
|
284
284
|
get value() {
|
|
285
285
|
const e = s(this, v) / s(this, x);
|
|
286
286
|
return e === 0 ? 0 : e;
|
|
287
287
|
}
|
|
288
288
|
};
|
|
289
|
-
|
|
290
|
-
const t = new
|
|
289
|
+
mt = new WeakMap(), x = new WeakMap(), v = new WeakMap(), Le = new WeakMap(), a(B, "average", (...e) => {
|
|
290
|
+
const t = new B().zero();
|
|
291
291
|
for (const i of e)
|
|
292
292
|
t.add(i);
|
|
293
293
|
return t.divide(e.length), t;
|
|
294
|
-
}), a(
|
|
295
|
-
let t = new
|
|
294
|
+
}), a(B, "max", (...e) => {
|
|
295
|
+
let t = new B(e[0]);
|
|
296
296
|
for (const i of e) {
|
|
297
|
-
const n = new
|
|
297
|
+
const n = new B(i);
|
|
298
298
|
n.isGreater(t) && (t = n.clone());
|
|
299
299
|
}
|
|
300
300
|
return t;
|
|
301
|
-
}), a(
|
|
302
|
-
let t = new
|
|
301
|
+
}), a(B, "min", (...e) => {
|
|
302
|
+
let t = new B(e[0]);
|
|
303
303
|
for (const i of e) {
|
|
304
|
-
const n = new
|
|
304
|
+
const n = new B(i);
|
|
305
305
|
n.isLesser(t) && (t = n.clone());
|
|
306
306
|
}
|
|
307
307
|
return t;
|
|
308
|
-
}), a(
|
|
309
|
-
const n = e.map((r) => r instanceof
|
|
308
|
+
}), a(B, "sort", (e, t) => {
|
|
309
|
+
const n = e.map((r) => r instanceof B ? r : new B(r)).sort((r, l) => r.value - l.value);
|
|
310
310
|
return t && n.reverse(), n;
|
|
311
311
|
}), // ------------------------------------------
|
|
312
312
|
// Compare functions
|
|
313
|
-
a(
|
|
313
|
+
a(B, "unique", (e) => {
|
|
314
314
|
const t = {}, i = [];
|
|
315
315
|
return e.forEach((n) => {
|
|
316
|
-
n instanceof
|
|
316
|
+
n instanceof B || (n = new B(n)), t[n.clone().reduce().tex] || (i.push(n.clone()), t[n.tex] = !0);
|
|
317
317
|
}), i;
|
|
318
|
-
}), a(
|
|
319
|
-
const t = new
|
|
318
|
+
}), a(B, "xMultiply", (...e) => {
|
|
319
|
+
const t = new B();
|
|
320
320
|
for (const i of e) {
|
|
321
|
-
const n = new
|
|
321
|
+
const n = new B(i);
|
|
322
322
|
t.numerator = t.numerator * n.numerator, t.denominator = t.denominator * n.denominator;
|
|
323
323
|
}
|
|
324
324
|
return t;
|
|
325
325
|
});
|
|
326
|
-
let u =
|
|
327
|
-
var
|
|
328
|
-
class
|
|
326
|
+
let u = B;
|
|
327
|
+
var F, ie, re, Je;
|
|
328
|
+
class At {
|
|
329
329
|
constructor(...e) {
|
|
330
|
-
m(this,
|
|
330
|
+
m(this, F);
|
|
331
331
|
m(this, ie);
|
|
332
332
|
m(this, re);
|
|
333
|
-
m(this,
|
|
333
|
+
m(this, Je);
|
|
334
334
|
// ------------------------------------------
|
|
335
335
|
// Creation / parsing functions
|
|
336
336
|
// ------------------------------------------
|
|
337
|
-
a(this, "parse", (e, t, i) => (h(this, re, i ?? 1), h(this, ie, t ?? 2), h(this,
|
|
337
|
+
a(this, "parse", (e, t, i) => (h(this, re, i ?? 1), h(this, ie, t ?? 2), h(this, F, e), s(this, ie) % 2 === 0 && s(this, F) < 0 && h(this, Je, !1), this));
|
|
338
338
|
// ------------------------------------------
|
|
339
339
|
// Mathematical operations
|
|
340
340
|
// ------------------------------------------
|
|
341
341
|
a(this, "reduce", () => {
|
|
342
|
-
let e = Math.floor(Math.pow(s(this,
|
|
342
|
+
let e = Math.floor(Math.pow(s(this, F), 1 / s(this, ie)));
|
|
343
343
|
for (; e > 1; ) {
|
|
344
|
-
if (s(this,
|
|
345
|
-
h(this, re, s(this, re) * e), h(this,
|
|
344
|
+
if (s(this, F) % Math.pow(e, s(this, ie)) === 0) {
|
|
345
|
+
h(this, re, s(this, re) * e), h(this, F, s(this, F) / Math.pow(e, s(this, ie))), e = Math.floor(Math.pow(s(this, F), 1 / s(this, ie)));
|
|
346
346
|
continue;
|
|
347
347
|
}
|
|
348
348
|
e--;
|
|
349
349
|
}
|
|
350
350
|
return this;
|
|
351
351
|
});
|
|
352
|
-
a(this, "multiply", (e) => (h(this,
|
|
352
|
+
a(this, "multiply", (e) => (h(this, F, s(this, F) * e.radical), this.reduce()));
|
|
353
353
|
// ------------------------------------------
|
|
354
354
|
// Help functions
|
|
355
355
|
// ------------------------------------------
|
|
356
|
-
a(this, "hasRadical", () => !(s(this,
|
|
357
|
-
h(this,
|
|
356
|
+
a(this, "hasRadical", () => !(s(this, F) === 1 || s(this, F) === 0 || !s(this, Je)));
|
|
357
|
+
h(this, F, 1), h(this, re, 1), h(this, ie, 2), h(this, Je, !0), e.length > 0 && this.parse(e[0], e[1], e[2]);
|
|
358
358
|
}
|
|
359
359
|
// ------------------------------------------
|
|
360
360
|
// Getter and setter
|
|
361
361
|
// ------------------------------------------
|
|
362
362
|
get radical() {
|
|
363
|
-
return s(this,
|
|
363
|
+
return s(this, F);
|
|
364
364
|
}
|
|
365
365
|
set radical(e) {
|
|
366
|
-
h(this,
|
|
366
|
+
h(this, F, e);
|
|
367
367
|
}
|
|
368
368
|
get nth() {
|
|
369
369
|
return s(this, ie);
|
|
@@ -379,24 +379,24 @@ class vt {
|
|
|
379
379
|
}
|
|
380
380
|
get tex() {
|
|
381
381
|
let e;
|
|
382
|
-
return s(this, re) === 1 ? e = "" : s(this, re) === -1 ? e = "-" : e = s(this, re).toString(), s(this,
|
|
382
|
+
return s(this, re) === 1 ? e = "" : s(this, re) === -1 ? e = "-" : e = s(this, re).toString(), s(this, F) === 1 ? `${s(this, re)}` : s(this, ie) === 2 ? `${e}\\sqrt{${s(this, F)}}` : `${e}\\sqrt[${s(this, ie)}]{${s(this, F)}}`;
|
|
383
383
|
}
|
|
384
384
|
get display() {
|
|
385
385
|
let e;
|
|
386
|
-
return s(this, re) === 1 ? e = "" : s(this, re) === -1 ? e = "-" : e = s(this, re).toString(), s(this,
|
|
386
|
+
return s(this, re) === 1 ? e = "" : s(this, re) === -1 ? e = "-" : e = s(this, re).toString(), s(this, F) === 1 ? `${s(this, re)}` : s(this, ie) === 2 ? `${e}sqrt{${s(this, F)}}` : `${e}root(${s(this, ie)}){${s(this, F)}}`;
|
|
387
387
|
}
|
|
388
388
|
get value() {
|
|
389
|
-
return s(this, re) * Math.pow(s(this,
|
|
389
|
+
return s(this, re) * Math.pow(s(this, F), 1 / s(this, ie));
|
|
390
390
|
}
|
|
391
391
|
}
|
|
392
|
-
|
|
393
|
-
var K,
|
|
394
|
-
const
|
|
392
|
+
F = new WeakMap(), ie = new WeakMap(), re = new WeakMap(), Je = new WeakMap();
|
|
393
|
+
var K, Ge, M, Qe, ye, Ti, Oi, Ci, ki, Mi, $i, Bi;
|
|
394
|
+
const xi = class xi {
|
|
395
395
|
constructor(e, t, i = "x") {
|
|
396
|
-
m(this,
|
|
396
|
+
m(this, M);
|
|
397
397
|
m(this, K);
|
|
398
|
-
m(this,
|
|
399
|
-
if (h(this,
|
|
398
|
+
m(this, Ge);
|
|
399
|
+
if (h(this, Ge, i), Object.hasOwn(e, "moveLeft")) {
|
|
400
400
|
const n = e;
|
|
401
401
|
h(this, K, n.left.clone().subtract(n.right));
|
|
402
402
|
} else
|
|
@@ -407,43 +407,43 @@ const pi = class pi {
|
|
|
407
407
|
if (e === 0)
|
|
408
408
|
return [];
|
|
409
409
|
if (e === 1)
|
|
410
|
-
return A(this,
|
|
410
|
+
return A(this, M, Mi).call(this);
|
|
411
411
|
if (e === 2)
|
|
412
|
-
return A(this,
|
|
413
|
-
const t = A(this,
|
|
414
|
-
return t.length > 0 ? t : A(this,
|
|
412
|
+
return A(this, M, $i).call(this);
|
|
413
|
+
const t = A(this, M, Ci).call(this);
|
|
414
|
+
return t.length > 0 ? t : A(this, M, Ti).call(this);
|
|
415
415
|
}
|
|
416
416
|
solveAsCardan() {
|
|
417
417
|
if (s(this, K).degree().value !== 3)
|
|
418
418
|
throw new Error("The equation is not cubic.");
|
|
419
|
-
return A(this,
|
|
419
|
+
return A(this, M, ki).call(this);
|
|
420
420
|
}
|
|
421
421
|
};
|
|
422
|
-
K = new WeakMap(),
|
|
422
|
+
K = new WeakMap(), Ge = new WeakMap(), M = new WeakSet(), Qe = function(e, t) {
|
|
423
423
|
return {
|
|
424
|
-
variable: s(this,
|
|
424
|
+
variable: s(this, Ge),
|
|
425
425
|
exact: !1,
|
|
426
426
|
value: +e.toFixed(10),
|
|
427
427
|
tex: (t == null ? void 0 : t.tex) ?? "",
|
|
428
428
|
display: (t == null ? void 0 : t.display) ?? ""
|
|
429
429
|
};
|
|
430
|
-
},
|
|
430
|
+
}, ye = function(e) {
|
|
431
431
|
if (e instanceof u && e.isApproximative())
|
|
432
|
-
return A(this,
|
|
432
|
+
return A(this, M, Qe).call(this, e.value);
|
|
433
433
|
const t = new u(e);
|
|
434
434
|
return {
|
|
435
|
-
variable: s(this,
|
|
435
|
+
variable: s(this, Ge),
|
|
436
436
|
exact: t,
|
|
437
437
|
value: t.value,
|
|
438
438
|
tex: t.tex,
|
|
439
439
|
display: t.display
|
|
440
440
|
};
|
|
441
|
-
},
|
|
441
|
+
}, Ti = function() {
|
|
442
442
|
const e = [];
|
|
443
443
|
s(this, K).degree().value;
|
|
444
444
|
const t = s(this, K).getCoefficients().map((p) => p.value), [i, ...n] = s(this, K).getCoefficients(), r = 1 + Math.max(...n.map((p) => p.value / i.value)), c = 2 * r / 100, f = [];
|
|
445
445
|
for (let p = -r; p <= r; p += c) {
|
|
446
|
-
const w =
|
|
446
|
+
const w = G.numberCorrection(p);
|
|
447
447
|
f.push(
|
|
448
448
|
{
|
|
449
449
|
x: w,
|
|
@@ -459,15 +459,15 @@ K = new WeakMap(), Fe = new WeakMap(), C = new WeakSet(), Ge = function(e, t) {
|
|
|
459
459
|
p.x
|
|
460
460
|
]));
|
|
461
461
|
}), d.forEach((p) => {
|
|
462
|
-
const [w,
|
|
463
|
-
if (w ===
|
|
464
|
-
e.push(A(this,
|
|
462
|
+
const [w, L] = p;
|
|
463
|
+
if (w === L)
|
|
464
|
+
e.push(A(this, M, ye).call(this, w));
|
|
465
465
|
else {
|
|
466
|
-
const ce = A(this,
|
|
467
|
-
ce !== null && e.push(A(this,
|
|
466
|
+
const ce = A(this, M, Oi).call(this, t, w, L);
|
|
467
|
+
ce !== null && e.push(A(this, M, Qe).call(this, ce));
|
|
468
468
|
}
|
|
469
469
|
}), e;
|
|
470
|
-
},
|
|
470
|
+
}, Oi = function(e, t, i, n = 1e-10) {
|
|
471
471
|
let r = s(this, K).evaluate(t, !0), l = s(this, K).evaluate(i, !0);
|
|
472
472
|
if (r * l > 0)
|
|
473
473
|
return console.log("Pas de racine dans l'intervalle donné"), null;
|
|
@@ -480,19 +480,19 @@ K = new WeakMap(), Fe = new WeakMap(), C = new WeakSet(), Ge = function(e, t) {
|
|
|
480
480
|
r * f < 0 ? (i = c, l = f) : (t = c, r = f);
|
|
481
481
|
}
|
|
482
482
|
return (t + i) / 2;
|
|
483
|
-
},
|
|
483
|
+
}, Ci = function() {
|
|
484
484
|
let e = s(this, K).clone(), t = [];
|
|
485
485
|
const i = e.lcmDenominator();
|
|
486
486
|
i !== 1 && e.multiply(i);
|
|
487
487
|
const n = e.monomByDegree().coefficient;
|
|
488
488
|
let r = e.monomByDegree(0).coefficient;
|
|
489
489
|
for (; r.isZero(); )
|
|
490
|
-
t.length === 0 && t.push(A(this,
|
|
491
|
-
const l =
|
|
490
|
+
t.length === 0 && t.push(A(this, M, ye).call(this, 0)), e = e.divide("x"), r = e.monomByDegree(0).coefficient;
|
|
491
|
+
const l = G.dividers(n.value), c = G.dividers(r.value);
|
|
492
492
|
for (const d of l)
|
|
493
493
|
for (const p of c) {
|
|
494
494
|
const w = new u(p, d);
|
|
495
|
-
e.evaluate(w).isZero() && !t.find((
|
|
495
|
+
e.evaluate(w).isZero() && !t.find((L) => L.value === w.value) && t.push(A(this, M, ye).call(this, w)), w.opposite(), e.evaluate(w).isZero() && !t.find((L) => L.value === w.value) && t.push(A(this, M, ye).call(this, w));
|
|
496
496
|
}
|
|
497
497
|
for (const d of t) {
|
|
498
498
|
if (d.exact !== !1 && d.exact.isZero())
|
|
@@ -505,89 +505,89 @@ K = new WeakMap(), Fe = new WeakMap(), C = new WeakSet(), Ge = function(e, t) {
|
|
|
505
505
|
return t.sort((d, p) => d.value - p.value);
|
|
506
506
|
if (e.degree().value > 3)
|
|
507
507
|
return [];
|
|
508
|
-
const f = new
|
|
508
|
+
const f = new xi(e, e.clone().parse("0"), s(this, Ge));
|
|
509
509
|
return t = t.concat(f.solve()), t.sort((d, p) => d.value - p.value);
|
|
510
|
-
},
|
|
511
|
-
const e = s(this, K), t = e.monomByDegree(3).coefficient, i = e.monomByDegree(2).coefficient, n = e.monomByDegree(1).coefficient, r = e.monomByDegree(0).coefficient, l = i.clone().divide(t), c = n.clone().divide(t), f = r.clone().divide(t), d = c.clone().subtract(l.clone().pow(2).divide(3)), p = f.clone().subtract(l.clone().multiply(c).divide(3)).add(l.clone().pow(3).multiply(2).divide(27)), w = p.clone().opposite(),
|
|
510
|
+
}, ki = function() {
|
|
511
|
+
const e = s(this, K), t = e.monomByDegree(3).coefficient, i = e.monomByDegree(2).coefficient, n = e.monomByDegree(1).coefficient, r = e.monomByDegree(0).coefficient, l = i.clone().divide(t), c = n.clone().divide(t), f = r.clone().divide(t), d = c.clone().subtract(l.clone().pow(2).divide(3)), p = f.clone().subtract(l.clone().multiply(c).divide(3)).add(l.clone().pow(3).multiply(2).divide(27)), w = p.clone().opposite(), L = d.clone().opposite().pow(3).divide(27), ce = w.clone().pow(2).subtract(L.clone().multiply(4)).opposite();
|
|
512
512
|
if (ce.isNegative()) {
|
|
513
|
-
const ue = p.clone().opposite().add(ce.clone().opposite().sqrt()).divide(2).root(3), fe = p.clone().opposite().subtract(ce.clone().opposite().sqrt()).divide(2).root(3),
|
|
514
|
-
return [A(this,
|
|
513
|
+
const ue = p.clone().opposite().add(ce.clone().opposite().sqrt()).divide(2).root(3), fe = p.clone().opposite().subtract(ce.clone().opposite().sqrt()).divide(2).root(3), we = ue.clone().add(fe).subtract(l.clone().divide(3));
|
|
514
|
+
return [A(this, M, ye).call(this, we)];
|
|
515
515
|
}
|
|
516
516
|
if (ce.isZero()) {
|
|
517
|
-
const ue = p.clone().opposite().divide(2).root(3), fe = ue.clone().opposite().subtract(l.clone().divide(3)),
|
|
518
|
-
return fe.isEqual(
|
|
519
|
-
A(this,
|
|
520
|
-
A(this,
|
|
521
|
-
].sort((
|
|
517
|
+
const ue = p.clone().opposite().divide(2).root(3), fe = ue.clone().opposite().subtract(l.clone().divide(3)), we = ue.clone().multiply(2).subtract(l.clone().divide(3));
|
|
518
|
+
return fe.isEqual(we) ? [A(this, M, ye).call(this, fe)] : [
|
|
519
|
+
A(this, M, ye).call(this, we),
|
|
520
|
+
A(this, M, ye).call(this, fe)
|
|
521
|
+
].sort((ge, pe) => ge.value - pe.value);
|
|
522
522
|
}
|
|
523
523
|
if (ce.isPositive()) {
|
|
524
|
-
const ue = [], fe = d.value,
|
|
525
|
-
for (let
|
|
526
|
-
ue.push(2 * Math.sqrt(-fe / 3) * Math.cos(Math.acos(3 *
|
|
527
|
-
return ue.map((
|
|
524
|
+
const ue = [], fe = d.value, we = p.value, ge = l.value;
|
|
525
|
+
for (let pe = 0; pe < 3; pe++)
|
|
526
|
+
ue.push(2 * Math.sqrt(-fe / 3) * Math.cos(Math.acos(3 * we / (2 * fe) * Math.sqrt(-3 / fe)) / 3 + 2 * Math.PI * pe / 3) - ge / 3);
|
|
527
|
+
return ue.map((pe) => A(this, M, Qe).call(this, pe)).sort((pe, lt) => pe.value - lt.value);
|
|
528
528
|
}
|
|
529
529
|
return [];
|
|
530
|
-
},
|
|
530
|
+
}, Mi = function() {
|
|
531
531
|
const [e, t] = s(this, K).getCoefficients(), i = t.opposite().divide(e);
|
|
532
532
|
return [
|
|
533
|
-
A(this,
|
|
533
|
+
A(this, M, ye).call(this, i)
|
|
534
534
|
];
|
|
535
|
-
},
|
|
535
|
+
}, $i = function() {
|
|
536
536
|
const e = s(this, K), [t, i, n] = e.getCoefficients(), r = i.clone().pow(2).subtract(t.clone().multiply(n).multiply(4));
|
|
537
537
|
if (r.isNegative())
|
|
538
538
|
return [];
|
|
539
539
|
if (r.isSquare()) {
|
|
540
540
|
const l = r.sqrt(), c = i.clone().opposite().add(l).divide(t.clone().multiply(2)), f = i.clone().opposite().subtract(l).divide(t.clone().multiply(2));
|
|
541
|
-
return l.isZero() ? [A(this,
|
|
542
|
-
A(this,
|
|
543
|
-
A(this,
|
|
541
|
+
return l.isZero() ? [A(this, M, ye).call(this, c)] : [
|
|
542
|
+
A(this, M, ye).call(this, c),
|
|
543
|
+
A(this, M, ye).call(this, f)
|
|
544
544
|
].sort((d, p) => d.value - p.value);
|
|
545
545
|
}
|
|
546
|
-
return A(this,
|
|
547
|
-
},
|
|
548
|
-
const n =
|
|
549
|
-
function
|
|
550
|
-
return `\\frac{ ${
|
|
546
|
+
return A(this, M, Bi).call(this, t, i, r);
|
|
547
|
+
}, Bi = function(e, t, i) {
|
|
548
|
+
const n = G.dividers(i.value).filter((ge) => Math.sqrt(ge) % 1 === 0).map((ge) => Math.sqrt(ge)).pop() ?? 1, r = G.gcd(2 * e.value, t.value, n) * (e.isNegative() ? -1 : 1), l = t.clone().divide(r).opposite(), c = e.clone().divide(r).multiply(2), f = i.clone().divide(n ** 2), d = Math.abs(n / r), p = n === 1 ? "-" : `-${d} `, w = n === 1 ? "+" : `+${d} `;
|
|
549
|
+
function L(ge, pe, lt, ni) {
|
|
550
|
+
return `\\frac{ ${pe} ${lt}\\sqrt{ ${ni} } }{ ${ge} }`;
|
|
551
551
|
}
|
|
552
|
-
function ce(
|
|
553
|
-
return `(${
|
|
552
|
+
function ce(ge, pe, lt, ni) {
|
|
553
|
+
return `(${pe}${lt}sqrt(${ni}))/${ge}`;
|
|
554
554
|
}
|
|
555
|
-
const ue = i.value ** 0.5, fe = (-t.value - ue) / (2 * e.value),
|
|
555
|
+
const ue = i.value ** 0.5, fe = (-t.value - ue) / (2 * e.value), we = (-t.value + ue) / (2 * e.value);
|
|
556
556
|
return [
|
|
557
|
-
A(this,
|
|
558
|
-
tex:
|
|
557
|
+
A(this, M, Qe).call(this, fe, {
|
|
558
|
+
tex: L(c.tex, l.tex, p.toString(), f.tex),
|
|
559
559
|
display: ce(c.display, l.display, p.toString(), f.display)
|
|
560
560
|
}),
|
|
561
|
-
A(this,
|
|
562
|
-
tex:
|
|
561
|
+
A(this, M, Qe).call(this, we, {
|
|
562
|
+
tex: L(c.tex, l.tex, w.toString(), f.tex),
|
|
563
563
|
display: ce(c.display, l.display, w.toString(), f.display)
|
|
564
564
|
})
|
|
565
|
-
].sort((
|
|
565
|
+
].sort((ge, pe) => ge.value - pe.value);
|
|
566
566
|
};
|
|
567
|
-
let
|
|
568
|
-
var
|
|
567
|
+
let Mt = xi;
|
|
568
|
+
var ts = Object.defineProperty, Pi = (o) => {
|
|
569
569
|
throw TypeError(o);
|
|
570
|
-
},
|
|
571
|
-
const
|
|
570
|
+
}, is = (o, e, t) => e in o ? ts(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t, oi = (o, e, t) => is(o, typeof e != "symbol" ? e + "" : e, t), Si = (o, e, t) => e.has(o) || Pi("Cannot " + t), te = (o, e, t) => (Si(o, e, "read from private field"), t ? t.call(o) : e.get(o)), ct = (o, e, t) => e.has(o) ? Pi("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(o) : e.set(o, t), Ne = (o, e, t, i) => (Si(o, e, "write to private field"), e.set(o, t), t);
|
|
571
|
+
const vi = {
|
|
572
572
|
pi: Math.PI,
|
|
573
573
|
e: Math.exp(1)
|
|
574
574
|
};
|
|
575
|
-
var g = /* @__PURE__ */ ((o) => (o.VARIABLE = "variable", o.COEFFICIENT = "coefficient", o.OPERATION = "operation", o.CONSTANT = "constant", o.FUNCTION = "function", o.FUNCTION_ARGUMENT = "function-argument", o.MONOM = "monom", o.LEFT_PARENTHESIS = "(", o.RIGHT_PARENTHESIS = ")", o))(g || {}),
|
|
576
|
-
function
|
|
575
|
+
var g = /* @__PURE__ */ ((o) => (o.VARIABLE = "variable", o.COEFFICIENT = "coefficient", o.OPERATION = "operation", o.CONSTANT = "constant", o.FUNCTION = "function", o.FUNCTION_ARGUMENT = "function-argument", o.MONOM = "monom", o.LEFT_PARENTHESIS = "(", o.RIGHT_PARENTHESIS = ")", o))(g || {}), Ue = /* @__PURE__ */ ((o) => (o.EXPRESSION = "expression", o.POLYNOM = "polynom", o.SET = "set", o.NUMERIC = "numeric", o))(Ue || {});
|
|
576
|
+
function ss(o, e) {
|
|
577
577
|
if (o.length <= 1)
|
|
578
578
|
return o;
|
|
579
579
|
const t = Object.keys(e).filter((w) => e[w].type === g.FUNCTION).map((w) => w);
|
|
580
|
-
t.sort((w,
|
|
581
|
-
const i = new RegExp(`^(${t.join("|")})\\(`), n = Object.keys(
|
|
582
|
-
n.sort((w,
|
|
580
|
+
t.sort((w, L) => L.length - w.length);
|
|
581
|
+
const i = new RegExp(`^(${t.join("|")})\\(`), n = Object.keys(vi);
|
|
582
|
+
n.sort((w, L) => L.length - w.length);
|
|
583
583
|
const r = new RegExp(`^(${n.join("|")})`), l = /^(\d+(\.\d+)?)/;
|
|
584
584
|
let c = "", f, d, p;
|
|
585
585
|
for (; o.length > 0; ) {
|
|
586
586
|
if (f = d, p = void 0, t.length > 0 && i.exec(o)) {
|
|
587
|
-
const w = t.find((
|
|
587
|
+
const w = t.find((L) => o.startsWith(L));
|
|
588
588
|
w && (p = w + "(", o = o.slice(w.length + 1), d = g.FUNCTION);
|
|
589
589
|
} else if (n.length > 0 && r.exec(o)) {
|
|
590
|
-
const w = n.find((
|
|
590
|
+
const w = n.find((L) => o.startsWith(L));
|
|
591
591
|
w && (p = w, o = o.slice(w.length), d = g.CONSTANT);
|
|
592
592
|
} else if (l.exec(o)) {
|
|
593
593
|
const w = l.exec(o);
|
|
@@ -615,20 +615,20 @@ function Qi(o, e) {
|
|
|
615
615
|
}
|
|
616
616
|
if (p === void 0 || d === void 0)
|
|
617
617
|
throw new Error("The token is undefined");
|
|
618
|
-
c +=
|
|
618
|
+
c += ns(f, d), c += p;
|
|
619
619
|
}
|
|
620
620
|
return c;
|
|
621
621
|
}
|
|
622
|
-
function
|
|
622
|
+
function ns(o, e) {
|
|
623
623
|
return o === void 0 || o === g.OPERATION || e === g.OPERATION || o === g.LEFT_PARENTHESIS || o === g.FUNCTION || o === g.FUNCTION_ARGUMENT || e === g.RIGHT_PARENTHESIS || e === g.FUNCTION_ARGUMENT ? "" : "*";
|
|
624
624
|
}
|
|
625
|
-
const
|
|
625
|
+
const rs = {
|
|
626
626
|
"^": { precedence: 4, associative: "right", type: g.OPERATION },
|
|
627
627
|
"*": { precedence: 3, associative: "left", type: g.OPERATION },
|
|
628
628
|
"/": { precedence: 3, associative: "left", type: g.OPERATION },
|
|
629
629
|
"+": { precedence: 2, associative: "left", type: g.OPERATION },
|
|
630
630
|
"-": { precedence: 2, associative: "left", type: g.OPERATION }
|
|
631
|
-
},
|
|
631
|
+
}, os = {
|
|
632
632
|
"^": { precedence: 4, associative: "right", type: g.OPERATION },
|
|
633
633
|
"*": { precedence: 3, associative: "left", type: g.OPERATION },
|
|
634
634
|
"/": { precedence: 3, associative: "left", type: g.OPERATION },
|
|
@@ -641,7 +641,7 @@ const Ji = {
|
|
|
641
641
|
sqrt: { precedence: 4, associative: "right", type: g.FUNCTION },
|
|
642
642
|
nthrt: { precedence: 4, associative: "right", type: g.FUNCTION },
|
|
643
643
|
",": { precedence: 2, associative: "left", type: g.FUNCTION_ARGUMENT }
|
|
644
|
-
},
|
|
644
|
+
}, hs = {
|
|
645
645
|
"^": { precedence: 4, associative: "right", type: g.OPERATION },
|
|
646
646
|
"*": { precedence: 3, associative: "left", type: g.OPERATION },
|
|
647
647
|
"/": { precedence: 3, associative: "left", type: g.OPERATION },
|
|
@@ -655,26 +655,26 @@ const Ji = {
|
|
|
655
655
|
nthrt: { precedence: 4, associative: "right", type: g.FUNCTION },
|
|
656
656
|
ln: { precedence: 4, associative: "right", type: g.FUNCTION },
|
|
657
657
|
log: { precedence: 4, associative: "right", type: g.FUNCTION }
|
|
658
|
-
},
|
|
658
|
+
}, as = {
|
|
659
659
|
"&": { precedence: 3, associative: "left", type: g.OPERATION },
|
|
660
660
|
"|": { precedence: 3, associative: "left", type: g.OPERATION },
|
|
661
661
|
"!": { precedence: 4, associative: "right", type: g.OPERATION },
|
|
662
662
|
"-": { precedence: 2, associative: "left", type: g.OPERATION }
|
|
663
663
|
};
|
|
664
|
-
var He,
|
|
665
|
-
class
|
|
664
|
+
var He, ft, ne, Tt, Fe;
|
|
665
|
+
class si {
|
|
666
666
|
constructor(e) {
|
|
667
|
-
|
|
667
|
+
ct(this, He), ct(this, ft, []), ct(this, ne, {}), ct(this, Tt, []), ct(this, Fe), Ne(this, He, typeof e > "u" ? Ue.POLYNOM : e), this.tokenConfigInitialization();
|
|
668
668
|
}
|
|
669
669
|
// Getter
|
|
670
670
|
get rpn() {
|
|
671
|
-
return te(this,
|
|
671
|
+
return te(this, ft);
|
|
672
672
|
}
|
|
673
673
|
get rpnToken() {
|
|
674
|
-
return te(this,
|
|
674
|
+
return te(this, ft).map((e) => e.token);
|
|
675
675
|
}
|
|
676
676
|
tokenConfigInitialization() {
|
|
677
|
-
return te(this, He) ===
|
|
677
|
+
return te(this, He) === Ue.SET ? (Ne(this, ne, as), Ne(this, Fe, !1)) : te(this, He) === Ue.NUMERIC ? (Ne(this, ne, hs), Ne(this, Fe, !0)) : te(this, He) === Ue.EXPRESSION ? (Ne(this, ne, os), Ne(this, Fe, !0)) : (Ne(this, ne, rs), Ne(this, Fe, !0)), Ne(this, Tt, Object.keys(te(this, ne)).sort((e, t) => t.length - e.length)), te(this, ne);
|
|
678
678
|
}
|
|
679
679
|
/**
|
|
680
680
|
* Get the next token to analyse.
|
|
@@ -690,12 +690,12 @@ class Kt {
|
|
|
690
690
|
else if (e[t] === ",")
|
|
691
691
|
i = ",", n = g.FUNCTION_ARGUMENT;
|
|
692
692
|
else {
|
|
693
|
-
for (const r of te(this,
|
|
693
|
+
for (const r of te(this, Tt))
|
|
694
694
|
if (e.substring(t, t + r.length) === r) {
|
|
695
695
|
i += r, n = te(this, ne)[r].type;
|
|
696
696
|
break;
|
|
697
697
|
}
|
|
698
|
-
for (const r in
|
|
698
|
+
for (const r in vi)
|
|
699
699
|
if (e.substring(t, t + r.length) === r) {
|
|
700
700
|
i += r, n = g.CONSTANT;
|
|
701
701
|
break;
|
|
@@ -723,7 +723,7 @@ class Kt {
|
|
|
723
723
|
parse(e, t) {
|
|
724
724
|
const i = [], n = [];
|
|
725
725
|
let r = "", l = 0, c;
|
|
726
|
-
(t ?? te(this,
|
|
726
|
+
(t ?? te(this, Fe)) && (e = ss(e, te(this, ne)));
|
|
727
727
|
const f = 50;
|
|
728
728
|
let d = 50, p;
|
|
729
729
|
for (; l < e.length; ) {
|
|
@@ -787,15 +787,15 @@ class Kt {
|
|
|
787
787
|
throw new Error(`Token type ${r} is not handled`);
|
|
788
788
|
}
|
|
789
789
|
}
|
|
790
|
-
return
|
|
790
|
+
return Ne(this, ft, i.concat(n.reverse())), this;
|
|
791
791
|
}
|
|
792
792
|
}
|
|
793
|
-
He = /* @__PURE__ */ new WeakMap(),
|
|
794
|
-
class
|
|
793
|
+
He = /* @__PURE__ */ new WeakMap(), ft = /* @__PURE__ */ new WeakMap(), ne = /* @__PURE__ */ new WeakMap(), Tt = /* @__PURE__ */ new WeakMap(), Fe = /* @__PURE__ */ new WeakMap();
|
|
794
|
+
class ls {
|
|
795
795
|
constructor(e, t) {
|
|
796
|
-
|
|
796
|
+
oi(this, "_rpn"), oi(this, "_expression"), oi(this, "_isValid"), this._expression = e;
|
|
797
797
|
try {
|
|
798
|
-
this._rpn = new
|
|
798
|
+
this._rpn = new si(Ue.NUMERIC).parse(e, t).rpn;
|
|
799
799
|
} catch {
|
|
800
800
|
throw this._rpn = null, this._isValid = !1, new Error(`There was a problem parsing: ${e}`);
|
|
801
801
|
}
|
|
@@ -836,7 +836,7 @@ class is {
|
|
|
836
836
|
else if (i.tokenType === g.VARIABLE && e !== void 0)
|
|
837
837
|
Object.hasOwn(e, i.token) && t.push(+e[i.token]);
|
|
838
838
|
else if (i.tokenType === g.CONSTANT)
|
|
839
|
-
t.push(
|
|
839
|
+
t.push(vi[i.token]);
|
|
840
840
|
else if (i.tokenType === g.OPERATION) {
|
|
841
841
|
if (i.token === "*") {
|
|
842
842
|
const n = t.pop(), r = t.pop();
|
|
@@ -891,17 +891,17 @@ class is {
|
|
|
891
891
|
return +e.toFixed(t);
|
|
892
892
|
}
|
|
893
893
|
}
|
|
894
|
-
var T, b,
|
|
895
|
-
const
|
|
894
|
+
var T, b, _e, Ot, Ze, St, It;
|
|
895
|
+
const P = class P {
|
|
896
896
|
constructor(e) {
|
|
897
|
-
m(this,
|
|
897
|
+
m(this, _e);
|
|
898
898
|
m(this, T);
|
|
899
899
|
m(this, b);
|
|
900
900
|
/**
|
|
901
901
|
* Clone the current Monom.
|
|
902
902
|
*/
|
|
903
903
|
a(this, "clone", () => {
|
|
904
|
-
const e = new
|
|
904
|
+
const e = new P();
|
|
905
905
|
e.coefficient = s(this, T).clone();
|
|
906
906
|
for (const t in s(this, b))
|
|
907
907
|
e.setLetter(t, s(this, b)[t].clone());
|
|
@@ -913,8 +913,8 @@ const I = class I {
|
|
|
913
913
|
*/
|
|
914
914
|
a(this, "add", (...e) => {
|
|
915
915
|
for (const t of e) {
|
|
916
|
-
const i = t instanceof
|
|
917
|
-
this.isSameAs(i) ? (this.isZero() && A(this,
|
|
916
|
+
const i = t instanceof P ? t : new P(t);
|
|
917
|
+
this.isSameAs(i) ? (this.isZero() && A(this, _e, Ot).call(this, i), s(this, T).add(i.coefficient)) : console.log("Add monom: " + this.display + " is not similar with ", i.display);
|
|
918
918
|
}
|
|
919
919
|
return this;
|
|
920
920
|
});
|
|
@@ -933,7 +933,7 @@ const I = class I {
|
|
|
933
933
|
const t = s(this, b)[e].clone(), i = this.clone();
|
|
934
934
|
return s(i, b)[e].subtract(1), s(i, T).multiply(new u(t.clone())), i;
|
|
935
935
|
} else
|
|
936
|
-
return new
|
|
936
|
+
return new P().zero();
|
|
937
937
|
});
|
|
938
938
|
/**
|
|
939
939
|
* Divide the current monoms by multiple monoms
|
|
@@ -941,7 +941,7 @@ const I = class I {
|
|
|
941
941
|
*/
|
|
942
942
|
a(this, "divide", (...e) => {
|
|
943
943
|
for (const t of e) {
|
|
944
|
-
const i = t instanceof
|
|
944
|
+
const i = t instanceof P ? t : new P(t);
|
|
945
945
|
s(this, T).divide(i.coefficient);
|
|
946
946
|
for (const n in i.literal)
|
|
947
947
|
s(this, b)[n] = this.hasVariable(n) ? s(this, b)[n].subtract(i.literal[n]) : i.literal[n].clone().opposite(), s(this, b)[n].isZero() && this.removeVariable(n);
|
|
@@ -956,16 +956,16 @@ const I = class I {
|
|
|
956
956
|
a(this, "evaluate", (e, t) => {
|
|
957
957
|
if (t === !0) {
|
|
958
958
|
if (e instanceof u)
|
|
959
|
-
return s(this,
|
|
960
|
-
if (e instanceof
|
|
959
|
+
return s(this, Ze).call(this, e.value);
|
|
960
|
+
if (e instanceof At)
|
|
961
961
|
return new u().invalid();
|
|
962
962
|
if (typeof e == "number")
|
|
963
|
-
return s(this,
|
|
963
|
+
return s(this, Ze).call(this, e);
|
|
964
964
|
if (typeof e == "object") {
|
|
965
965
|
const n = {};
|
|
966
966
|
for (const r in e)
|
|
967
967
|
n[r] = new u(e[r]).value;
|
|
968
|
-
return s(this,
|
|
968
|
+
return s(this, Ze).call(this, n);
|
|
969
969
|
}
|
|
970
970
|
}
|
|
971
971
|
const i = this.coefficient.clone();
|
|
@@ -973,7 +973,7 @@ const I = class I {
|
|
|
973
973
|
const n = {};
|
|
974
974
|
return n[this.variables[0]] = new u(e), this.evaluate(n);
|
|
975
975
|
}
|
|
976
|
-
if (e instanceof
|
|
976
|
+
if (e instanceof At)
|
|
977
977
|
return new u().invalid();
|
|
978
978
|
if (typeof e == "object") {
|
|
979
979
|
if (this.variables.length === 0)
|
|
@@ -1048,7 +1048,7 @@ const I = class I {
|
|
|
1048
1048
|
*/
|
|
1049
1049
|
a(this, "multiply", (...e) => {
|
|
1050
1050
|
for (const t of e) {
|
|
1051
|
-
const i = t instanceof
|
|
1051
|
+
const i = t instanceof P ? t : new P(t);
|
|
1052
1052
|
s(this, T).multiply(i.coefficient);
|
|
1053
1053
|
for (const n in i.literal)
|
|
1054
1054
|
this.hasVariable(n) ? s(this, b)[n].add(i.literal[n]) : s(this, b)[n] = i.literal[n].clone();
|
|
@@ -1115,8 +1115,8 @@ const I = class I {
|
|
|
1115
1115
|
*/
|
|
1116
1116
|
a(this, "subtract", (...e) => {
|
|
1117
1117
|
for (const t of e) {
|
|
1118
|
-
const i = t instanceof
|
|
1119
|
-
this.isSameAs(i) ? (this.isZero() && A(this,
|
|
1118
|
+
const i = t instanceof P ? t : new P(t);
|
|
1119
|
+
this.isSameAs(i) ? (this.isZero() && A(this, _e, Ot).call(this, i), s(this, T).add(i.clone().coefficient.opposite())) : console.log("Subtract: Is not similar: ", i.display);
|
|
1120
1120
|
}
|
|
1121
1121
|
return this;
|
|
1122
1122
|
});
|
|
@@ -1124,17 +1124,17 @@ const I = class I {
|
|
|
1124
1124
|
* Create a zero value monom
|
|
1125
1125
|
*/
|
|
1126
1126
|
a(this, "zero", () => (h(this, T, new u().zero()), h(this, b, {}), this));
|
|
1127
|
-
m(this,
|
|
1127
|
+
m(this, Ze, (e) => {
|
|
1128
1128
|
let t = this.coefficient.value;
|
|
1129
1129
|
if (typeof e == "number") {
|
|
1130
1130
|
const i = {}, n = this.variables[0];
|
|
1131
|
-
return i[n] = e, s(this,
|
|
1131
|
+
return i[n] = e, s(this, Ze).call(this, i);
|
|
1132
1132
|
}
|
|
1133
1133
|
if (e instanceof u) {
|
|
1134
1134
|
const i = {};
|
|
1135
|
-
return i[this.variables[0]] = new u(e).value, s(this,
|
|
1135
|
+
return i[this.variables[0]] = new u(e).value, s(this, Ze).call(this, i);
|
|
1136
1136
|
}
|
|
1137
|
-
if (e instanceof
|
|
1137
|
+
if (e instanceof At)
|
|
1138
1138
|
return NaN;
|
|
1139
1139
|
if (typeof e == "object") {
|
|
1140
1140
|
if (this.variables.length === 0)
|
|
@@ -1146,8 +1146,8 @@ const I = class I {
|
|
|
1146
1146
|
}
|
|
1147
1147
|
return t;
|
|
1148
1148
|
});
|
|
1149
|
-
m(this,
|
|
1150
|
-
const i = new
|
|
1149
|
+
m(this, St, (e) => {
|
|
1150
|
+
const i = new si().parse(e).rpn, n = [];
|
|
1151
1151
|
if (i.length === 0)
|
|
1152
1152
|
return this.zero(), this;
|
|
1153
1153
|
if (i.length === 1) {
|
|
@@ -1155,30 +1155,30 @@ const I = class I {
|
|
|
1155
1155
|
return this.one(), r.tokenType === g.COEFFICIENT ? this.coefficient = new u(r.token) : r.tokenType === g.VARIABLE && this.setLetter(r.token, 1), this;
|
|
1156
1156
|
} else
|
|
1157
1157
|
for (const r of i)
|
|
1158
|
-
s(this,
|
|
1158
|
+
s(this, It).call(this, n, r);
|
|
1159
1159
|
return this.one(), this.multiply(n[0]), this;
|
|
1160
1160
|
});
|
|
1161
|
-
m(this,
|
|
1161
|
+
m(this, It, (e, t) => {
|
|
1162
1162
|
var f;
|
|
1163
1163
|
let i, n, r, l, c;
|
|
1164
1164
|
if (t.tokenType === g.COEFFICIENT)
|
|
1165
|
-
e.push(new
|
|
1165
|
+
e.push(new P(new u(t.token)));
|
|
1166
1166
|
else if (t.tokenType === g.VARIABLE) {
|
|
1167
|
-
const d = new
|
|
1167
|
+
const d = new P().one();
|
|
1168
1168
|
d.setLetter(t.token, 1), e.push(d.clone());
|
|
1169
1169
|
} else if (t.tokenType === g.OPERATION)
|
|
1170
1170
|
switch (t.token) {
|
|
1171
1171
|
case "-":
|
|
1172
|
-
n = e.pop() ?? new
|
|
1172
|
+
n = e.pop() ?? new P().zero(), i = e.pop() ?? new P().zero(), e.push(i.subtract(n));
|
|
1173
1173
|
break;
|
|
1174
1174
|
case "*":
|
|
1175
|
-
n = e.pop() ?? new
|
|
1175
|
+
n = e.pop() ?? new P().one(), i = e.pop() ?? new P().one(), e.push(i.multiply(n));
|
|
1176
1176
|
break;
|
|
1177
1177
|
case "/":
|
|
1178
|
-
n = e.pop() ?? new
|
|
1178
|
+
n = e.pop() ?? new P().one(), i = e.pop() ?? new P().one(), e.push(i.divide(n));
|
|
1179
1179
|
break;
|
|
1180
1180
|
case "^": {
|
|
1181
|
-
c = ((f = e.pop()) == null ? void 0 : f.coefficient) ?? new u().one(), r = e.pop() ?? new
|
|
1181
|
+
c = ((f = e.pop()) == null ? void 0 : f.coefficient) ?? new u().one(), r = e.pop() ?? new P().one(), l = r.variables[0], l && r.setLetter(l, c), e.push(r);
|
|
1182
1182
|
break;
|
|
1183
1183
|
}
|
|
1184
1184
|
}
|
|
@@ -1191,7 +1191,7 @@ const I = class I {
|
|
|
1191
1191
|
* @param inputStr
|
|
1192
1192
|
*/
|
|
1193
1193
|
parse(e) {
|
|
1194
|
-
return h(this, T, new u()), h(this, b, {}), typeof e == "string" ? s(this,
|
|
1194
|
+
return h(this, T, new u()), h(this, b, {}), typeof e == "string" ? s(this, St).call(this, e) : typeof e == "number" ? h(this, T, new u(e)) : e instanceof u ? h(this, T, e.clone()) : e instanceof P && (h(this, T, s(e, T).clone()), A(this, _e, Ot).call(this, e)), this;
|
|
1195
1195
|
}
|
|
1196
1196
|
/**
|
|
1197
1197
|
* Get the coefficient \\(k\\) of the Monom \\(k\\cdot x^{n}\\)
|
|
@@ -1225,7 +1225,7 @@ const I = class I {
|
|
|
1225
1225
|
return [this.clone()];
|
|
1226
1226
|
if (this.coefficient.numerator > 1e6)
|
|
1227
1227
|
return [this.clone()];
|
|
1228
|
-
const e =
|
|
1228
|
+
const e = G.dividers(Math.abs(this.coefficient.numerator));
|
|
1229
1229
|
let t = [];
|
|
1230
1230
|
for (const n in this.literal)
|
|
1231
1231
|
t = this._getLiteralDividers(t, n);
|
|
@@ -1233,20 +1233,20 @@ const I = class I {
|
|
|
1233
1233
|
if (t.length > 0 && e.length > 0)
|
|
1234
1234
|
for (const n of e)
|
|
1235
1235
|
for (const r of t) {
|
|
1236
|
-
const l = new
|
|
1236
|
+
const l = new P();
|
|
1237
1237
|
l.coefficient = new u(n), l.literal = r, i.push(l);
|
|
1238
1238
|
}
|
|
1239
1239
|
else if (e.length === 0)
|
|
1240
1240
|
for (const n of t) {
|
|
1241
|
-
const r = new
|
|
1241
|
+
const r = new P();
|
|
1242
1242
|
r.coefficient = new u().one(), r.literal = n, i.push(r);
|
|
1243
1243
|
}
|
|
1244
1244
|
else
|
|
1245
1245
|
for (const n of e) {
|
|
1246
|
-
const r = new
|
|
1246
|
+
const r = new P();
|
|
1247
1247
|
r.coefficient = new u(n), i.push(r);
|
|
1248
1248
|
}
|
|
1249
|
-
return i.length === 0 ? [new
|
|
1249
|
+
return i.length === 0 ? [new P().one()] : i;
|
|
1250
1250
|
}
|
|
1251
1251
|
integrate(e, t, i) {
|
|
1252
1252
|
const n = this.primitive(i);
|
|
@@ -1337,14 +1337,14 @@ const I = class I {
|
|
|
1337
1337
|
return i;
|
|
1338
1338
|
}
|
|
1339
1339
|
};
|
|
1340
|
-
T = new WeakMap(), b = new WeakMap(),
|
|
1340
|
+
T = new WeakMap(), b = new WeakMap(), _e = new WeakSet(), Ot = function(e) {
|
|
1341
1341
|
for (const t in e.literal)
|
|
1342
1342
|
s(this, b)[t] = e.literal[t].clone();
|
|
1343
|
-
},
|
|
1343
|
+
}, Ze = new WeakMap(), St = new WeakMap(), It = new WeakMap(), a(P, "gcd", (...e) => {
|
|
1344
1344
|
for (const r of e)
|
|
1345
1345
|
if (r.containsRationalPower())
|
|
1346
|
-
return new
|
|
1347
|
-
const t = new
|
|
1346
|
+
return new P().zero();
|
|
1347
|
+
const t = new P(), i = G.gcd(...e.map((r) => r.coefficient.numerator)), n = G.lcm(...e.map((r) => r.coefficient.denominator));
|
|
1348
1348
|
t.coefficient = new u(i, n).reduce();
|
|
1349
1349
|
for (const r of e) {
|
|
1350
1350
|
for (const l in t.literal)
|
|
@@ -1357,42 +1357,42 @@ T = new WeakMap(), b = new WeakMap(), Qe = new WeakSet(), xt = function(e) {
|
|
|
1357
1357
|
* Multiply two monoms and return a NEW monom.
|
|
1358
1358
|
* @param monoms
|
|
1359
1359
|
*/
|
|
1360
|
-
a(
|
|
1361
|
-
const t = new
|
|
1360
|
+
a(P, "xMultiply", (...e) => {
|
|
1361
|
+
const t = new P().one();
|
|
1362
1362
|
for (const i of e)
|
|
1363
1363
|
t.multiply(i);
|
|
1364
1364
|
return t;
|
|
1365
1365
|
});
|
|
1366
|
-
let
|
|
1367
|
-
function
|
|
1366
|
+
let k = P;
|
|
1367
|
+
function qi(o, e = !0) {
|
|
1368
1368
|
return e ? `\\left( ${o} \\right)` : `(${o})`;
|
|
1369
1369
|
}
|
|
1370
|
-
function
|
|
1370
|
+
function Ct(o, e, t, i, n) {
|
|
1371
1371
|
return o.map((r, l) => r === e ? t : r);
|
|
1372
1372
|
}
|
|
1373
|
-
var
|
|
1374
|
-
const
|
|
1373
|
+
var We, y, et, gt, tt, yt, zt, Rt, Dt, it, Lt, wt, Zt, Vt, Ft, jt, Ii, Ut, Gt;
|
|
1374
|
+
const $ = class $ {
|
|
1375
1375
|
constructor(e, ...t) {
|
|
1376
|
-
m(this,
|
|
1377
|
-
m(this,
|
|
1376
|
+
m(this, jt);
|
|
1377
|
+
m(this, We);
|
|
1378
1378
|
m(this, y);
|
|
1379
|
-
m(this,
|
|
1380
|
-
m(this,
|
|
1379
|
+
m(this, et);
|
|
1380
|
+
m(this, gt, !1);
|
|
1381
1381
|
/**
|
|
1382
1382
|
* Parse a string to a polynom.
|
|
1383
1383
|
* @param inputStr
|
|
1384
1384
|
* @param values
|
|
1385
1385
|
*/
|
|
1386
1386
|
a(this, "parse", (e, ...t) => {
|
|
1387
|
-
if (h(this, y, []), h(this,
|
|
1388
|
-
return A(this,
|
|
1389
|
-
if ((typeof e == "number" || e instanceof u || e instanceof
|
|
1390
|
-
s(this, y).push(new
|
|
1391
|
-
else if (e instanceof
|
|
1392
|
-
s(this, y).push(new
|
|
1393
|
-
s(this, y).push(new
|
|
1387
|
+
if (h(this, y, []), h(this, We, []), typeof e == "string")
|
|
1388
|
+
return A(this, jt, Ii).call(this, e, ...t);
|
|
1389
|
+
if ((typeof e == "number" || e instanceof u || e instanceof k) && t.length === 0)
|
|
1390
|
+
s(this, y).push(new k(e));
|
|
1391
|
+
else if (e instanceof k && t.length > 0)
|
|
1392
|
+
s(this, y).push(new k(e)), t.forEach((i) => {
|
|
1393
|
+
s(this, y).push(new k(i));
|
|
1394
1394
|
});
|
|
1395
|
-
else if (e instanceof
|
|
1395
|
+
else if (e instanceof $)
|
|
1396
1396
|
for (const i of e.monoms)
|
|
1397
1397
|
s(this, y).push(i.clone());
|
|
1398
1398
|
return this;
|
|
@@ -1401,18 +1401,18 @@ const P = class P {
|
|
|
1401
1401
|
* Clone the polynom
|
|
1402
1402
|
*/
|
|
1403
1403
|
a(this, "clone", () => {
|
|
1404
|
-
const e = new
|
|
1404
|
+
const e = new $(), t = [];
|
|
1405
1405
|
for (const i of s(this, y))
|
|
1406
1406
|
t.push(i.clone());
|
|
1407
1407
|
return e.monoms = t, e;
|
|
1408
1408
|
});
|
|
1409
1409
|
a(this, "add", (...e) => {
|
|
1410
1410
|
for (const t of e)
|
|
1411
|
-
t instanceof
|
|
1411
|
+
t instanceof $ ? h(this, y, s(this, y).concat(t.monoms)) : t instanceof k ? s(this, y).push(t.clone()) : typeof t == "number" && Number.isSafeInteger(t) ? s(this, y).push(new k(t.toString())) : s(this, y).push(new k(t));
|
|
1412
1412
|
return this.reduce();
|
|
1413
1413
|
});
|
|
1414
1414
|
a(this, "commonMonom", () => {
|
|
1415
|
-
const e = new
|
|
1415
|
+
const e = new k().one(), t = this.gcdNumerator(), i = this.gcdDenominator(), n = this.degree();
|
|
1416
1416
|
e.coefficient = new u(t, i);
|
|
1417
1417
|
for (const r of this.variables) {
|
|
1418
1418
|
e.setLetter(r, n);
|
|
@@ -1429,28 +1429,28 @@ const P = class P {
|
|
|
1429
1429
|
return t;
|
|
1430
1430
|
});
|
|
1431
1431
|
a(this, "derivative", (e) => {
|
|
1432
|
-
const t = new
|
|
1432
|
+
const t = new $();
|
|
1433
1433
|
for (const i of s(this, y))
|
|
1434
1434
|
t.add(i.derivative(e));
|
|
1435
1435
|
return t.reduce();
|
|
1436
1436
|
});
|
|
1437
1437
|
a(this, "divide", (e) => {
|
|
1438
1438
|
if (e instanceof u)
|
|
1439
|
-
return s(this,
|
|
1439
|
+
return s(this, yt).call(this, e);
|
|
1440
1440
|
if (typeof e == "number" && Number.isSafeInteger(e))
|
|
1441
|
-
return s(this,
|
|
1442
|
-
if (e instanceof
|
|
1443
|
-
return this.divide(new
|
|
1444
|
-
if (e instanceof
|
|
1441
|
+
return s(this, zt).call(this, e);
|
|
1442
|
+
if (e instanceof k)
|
|
1443
|
+
return this.divide(new $(e));
|
|
1444
|
+
if (e instanceof $) {
|
|
1445
1445
|
if (e.monoms.length === 1 && e.variables.length === 0)
|
|
1446
|
-
return s(this,
|
|
1446
|
+
return s(this, yt).call(this, e.monoms[0].coefficient);
|
|
1447
1447
|
{
|
|
1448
1448
|
const { quotient: t, reminder: i } = this.euclidean(e);
|
|
1449
1449
|
if (i.isZero())
|
|
1450
1450
|
return h(this, y, t.monoms), this;
|
|
1451
1451
|
}
|
|
1452
1452
|
} else if (typeof e == "string")
|
|
1453
|
-
return this.divide(new
|
|
1453
|
+
return this.divide(new $(e));
|
|
1454
1454
|
throw new Error(`Cannot divide by ${e}`);
|
|
1455
1455
|
});
|
|
1456
1456
|
a(this, "empty", () => (h(this, y, []), this));
|
|
@@ -1460,11 +1460,11 @@ const P = class P {
|
|
|
1460
1460
|
* returns {quotient: Polynom, reminder: Polynom}
|
|
1461
1461
|
*/
|
|
1462
1462
|
a(this, "euclidean", (e) => {
|
|
1463
|
-
const t = e.variables[0], i = new
|
|
1463
|
+
const t = e.variables[0], i = new $().zero(), n = this.clone().reorder(t);
|
|
1464
1464
|
if (e.variables.length === 0)
|
|
1465
1465
|
return {
|
|
1466
1466
|
quotient: this.clone().divide(e).reduce(),
|
|
1467
|
-
reminder: new
|
|
1467
|
+
reminder: new $().zero()
|
|
1468
1468
|
};
|
|
1469
1469
|
const r = e.monomByDegree(void 0, t), l = e.degree(t);
|
|
1470
1470
|
let c, f = this.degree(t).value * 2;
|
|
@@ -1474,7 +1474,7 @@ const P = class P {
|
|
|
1474
1474
|
});
|
|
1475
1475
|
a(this, "evaluate", (e, t) => {
|
|
1476
1476
|
if (t)
|
|
1477
|
-
return s(this,
|
|
1477
|
+
return s(this, Rt).call(this, e);
|
|
1478
1478
|
const i = new u().zero();
|
|
1479
1479
|
return s(this, y).forEach((n) => {
|
|
1480
1480
|
i.add(n.evaluate(e, t));
|
|
@@ -1489,7 +1489,7 @@ const P = class P {
|
|
|
1489
1489
|
let t = [], i = this.clone().reorder();
|
|
1490
1490
|
const n = i.commonMonom();
|
|
1491
1491
|
if (i.monomByDegree().coefficient.isStrictlyNegative() && n.coefficient.isStrictlyPositive() && !n.isOne() && n.opposite(), !n.isOne()) {
|
|
1492
|
-
const c = new
|
|
1492
|
+
const c = new $(n);
|
|
1493
1493
|
t = [c.clone()], i = i.euclidean(c).quotient;
|
|
1494
1494
|
}
|
|
1495
1495
|
let r = i.degree().clone().multiply(2).value, l = 1;
|
|
@@ -1501,7 +1501,7 @@ const P = class P {
|
|
|
1501
1501
|
t.push(i.clone()), i.one();
|
|
1502
1502
|
break;
|
|
1503
1503
|
} else {
|
|
1504
|
-
let c = s(this,
|
|
1504
|
+
let c = s(this, Lt).call(this, i, l, e ?? "x");
|
|
1505
1505
|
for (l = i.degree(e).value; c.length > 0; ) {
|
|
1506
1506
|
const f = c[0];
|
|
1507
1507
|
if (!i.isDividableBy(f))
|
|
@@ -1509,16 +1509,16 @@ const P = class P {
|
|
|
1509
1509
|
else {
|
|
1510
1510
|
const d = i.euclidean(f);
|
|
1511
1511
|
t.push(f), i = d.quotient.clone(), c = c.filter((p) => {
|
|
1512
|
-
const w = i.monoms[0],
|
|
1513
|
-
return
|
|
1512
|
+
const w = i.monoms[0], L = i.monoms[i.monoms.length - 1], ce = p.monoms[0], ue = p.monoms[p.monoms.length - 1];
|
|
1513
|
+
return L.isDivisible(ue) ? w.isDivisible(ce) : !1;
|
|
1514
1514
|
});
|
|
1515
1515
|
}
|
|
1516
1516
|
}
|
|
1517
1517
|
}
|
|
1518
|
-
return i.isOne() || t.push(i.clone()), h(this,
|
|
1518
|
+
return i.isOne() || t.push(i.clone()), h(this, We, t), s(this, We);
|
|
1519
1519
|
});
|
|
1520
|
-
a(this, "gcdDenominator", () =>
|
|
1521
|
-
a(this, "gcdNumerator", () =>
|
|
1520
|
+
a(this, "gcdDenominator", () => G.gcd(...this.getDenominators()));
|
|
1521
|
+
a(this, "gcdNumerator", () => G.gcd(...this.getNumerators()));
|
|
1522
1522
|
// Next functions are used for for commonMonom, which is used in the factorize method.
|
|
1523
1523
|
a(this, "getDenominators", () => {
|
|
1524
1524
|
const e = [];
|
|
@@ -1532,7 +1532,7 @@ const P = class P {
|
|
|
1532
1532
|
e.push(t.coefficient.numerator);
|
|
1533
1533
|
return e;
|
|
1534
1534
|
});
|
|
1535
|
-
a(this, "getZeroes", () => this.degree().isZero() ? [] : (this.roots = new
|
|
1535
|
+
a(this, "getZeroes", () => this.degree().isZero() ? [] : (this.roots = new Mt(this.clone()).solve(), this.roots));
|
|
1536
1536
|
a(this, "integrate", (e, t, i = "x") => {
|
|
1537
1537
|
const n = this.primitive(i), r = {}, l = {};
|
|
1538
1538
|
return r[i] = new u(e), l[i] = new u(t), n.evaluate(l).subtract(n.evaluate(r));
|
|
@@ -1543,7 +1543,7 @@ const P = class P {
|
|
|
1543
1543
|
if (i.includes("(") || i.includes(")"))
|
|
1544
1544
|
return !1;
|
|
1545
1545
|
try {
|
|
1546
|
-
t = new
|
|
1546
|
+
t = new $(e);
|
|
1547
1547
|
} catch {
|
|
1548
1548
|
return !1;
|
|
1549
1549
|
}
|
|
@@ -1558,12 +1558,12 @@ const P = class P {
|
|
|
1558
1558
|
return t.isZero();
|
|
1559
1559
|
}
|
|
1560
1560
|
});
|
|
1561
|
-
a(this, "isEqual", (e) => s(this,
|
|
1562
|
-
a(this, "isOppositeAt", (e) => s(this,
|
|
1561
|
+
a(this, "isEqual", (e) => s(this, tt).call(this, e, "="));
|
|
1562
|
+
a(this, "isOppositeAt", (e) => s(this, tt).call(this, e.clone().opposite(), "="));
|
|
1563
1563
|
a(this, "isReduced", (e) => {
|
|
1564
1564
|
if (!this.isDeveloped(e))
|
|
1565
1565
|
return !1;
|
|
1566
|
-
const t = new
|
|
1566
|
+
const t = new $(e);
|
|
1567
1567
|
if (t.monoms.length > this.monoms.length)
|
|
1568
1568
|
return !1;
|
|
1569
1569
|
for (const i of t.monoms)
|
|
@@ -1571,9 +1571,9 @@ const P = class P {
|
|
|
1571
1571
|
return !1;
|
|
1572
1572
|
return !1;
|
|
1573
1573
|
});
|
|
1574
|
-
a(this, "isSameAs", (e) => s(this,
|
|
1575
|
-
a(this, "lcmDenominator", () =>
|
|
1576
|
-
a(this, "lcmNumerator", () =>
|
|
1574
|
+
a(this, "isSameAs", (e) => s(this, tt).call(this, e, "same"));
|
|
1575
|
+
a(this, "lcmDenominator", () => G.lcm(...this.getDenominators()));
|
|
1576
|
+
a(this, "lcmNumerator", () => G.lcm(...this.getNumerators()));
|
|
1577
1577
|
a(this, "letters", () => {
|
|
1578
1578
|
let e = /* @__PURE__ */ new Set();
|
|
1579
1579
|
for (const t of s(this, y))
|
|
@@ -1595,7 +1595,7 @@ const P = class P {
|
|
|
1595
1595
|
for (const n of s(i, y))
|
|
1596
1596
|
if (n.degree(t).isEqual(e))
|
|
1597
1597
|
return n.clone();
|
|
1598
|
-
return new
|
|
1598
|
+
return new k().zero();
|
|
1599
1599
|
});
|
|
1600
1600
|
// Used in LinearSystem.tex
|
|
1601
1601
|
a(this, "monomByLetter", (e) => {
|
|
@@ -1603,7 +1603,7 @@ const P = class P {
|
|
|
1603
1603
|
for (const i of s(t, y))
|
|
1604
1604
|
if (i.hasVariable(e))
|
|
1605
1605
|
return i.clone();
|
|
1606
|
-
return new
|
|
1606
|
+
return new k().zero();
|
|
1607
1607
|
});
|
|
1608
1608
|
a(this, "monomsByDegree", (e, t) => {
|
|
1609
1609
|
if (e === void 0)
|
|
@@ -1613,8 +1613,8 @@ const P = class P {
|
|
|
1613
1613
|
r.degree(t).isEqual(e) && i.push(r.clone());
|
|
1614
1614
|
return i;
|
|
1615
1615
|
});
|
|
1616
|
-
a(this, "multiply", (e) => e instanceof
|
|
1617
|
-
a(this, "one", () => (h(this, y, []), s(this, y).push(new
|
|
1616
|
+
a(this, "multiply", (e) => e instanceof $ ? s(this, Ft).call(this, e) : e instanceof u ? s(this, wt).call(this, e) : e instanceof k ? s(this, Vt).call(this, e) : Number.isSafeInteger(e) && typeof e == "number" ? s(this, Zt).call(this, e) : this);
|
|
1617
|
+
a(this, "one", () => (h(this, y, []), s(this, y).push(new k().one()), this));
|
|
1618
1618
|
// ------------------------------------------
|
|
1619
1619
|
a(this, "opposite", () => (h(this, y, s(this, y).map((e) => e.opposite())), this));
|
|
1620
1620
|
a(this, "pow", (e) => {
|
|
@@ -1623,14 +1623,14 @@ const P = class P {
|
|
|
1623
1623
|
if (e < 0)
|
|
1624
1624
|
return this.zero();
|
|
1625
1625
|
if (e === 0)
|
|
1626
|
-
return new
|
|
1626
|
+
return new $();
|
|
1627
1627
|
const t = this.clone();
|
|
1628
1628
|
for (let i = 1; i < e; i++)
|
|
1629
1629
|
this.multiply(t);
|
|
1630
1630
|
return this.reduce();
|
|
1631
1631
|
});
|
|
1632
1632
|
a(this, "primitive", (e) => {
|
|
1633
|
-
const t = new
|
|
1633
|
+
const t = new $();
|
|
1634
1634
|
for (const i of s(this, y))
|
|
1635
1635
|
t.add(i.primitive(e));
|
|
1636
1636
|
return t;
|
|
@@ -1639,13 +1639,13 @@ const P = class P {
|
|
|
1639
1639
|
let e = 0;
|
|
1640
1640
|
for (; e < s(this, y).length; ) {
|
|
1641
1641
|
for (let t = e + 1; t < s(this, y).length; t++)
|
|
1642
|
-
s(this, y)[e].isSameAs(s(this, y)[t]) && (s(this, y)[e].add(s(this, y)[t]), s(this, y).splice(t, 1), s(this, y)[e].isZero() && (s(this, y)[e] = new
|
|
1642
|
+
s(this, y)[e].isSameAs(s(this, y)[t]) && (s(this, y)[e].add(s(this, y)[t]), s(this, y).splice(t, 1), s(this, y)[e].isZero() && (s(this, y)[e] = new k().zero()), t--);
|
|
1643
1643
|
e++;
|
|
1644
1644
|
}
|
|
1645
1645
|
h(this, y, s(this, y).filter((t) => !t.coefficient.isZero()));
|
|
1646
1646
|
for (const t of s(this, y))
|
|
1647
1647
|
t.coefficient.reduce();
|
|
1648
|
-
return this.length === 0 ? new
|
|
1648
|
+
return this.length === 0 ? new $().zero() : this.reorder();
|
|
1649
1649
|
});
|
|
1650
1650
|
// ------------------------------------------
|
|
1651
1651
|
a(this, "reorder", (e = "x", t) => {
|
|
@@ -1671,22 +1671,22 @@ const P = class P {
|
|
|
1671
1671
|
*/
|
|
1672
1672
|
a(this, "replaceBy", (e, t) => {
|
|
1673
1673
|
let i;
|
|
1674
|
-
const n = new
|
|
1674
|
+
const n = new $().zero();
|
|
1675
1675
|
for (const r of this.monoms)
|
|
1676
1676
|
!r.hasVariable(e) || r.literal[e].isZero() ? n.add(r.clone()) : (i = r.literal[e].clone(), r.removeVariable(e), n.add(t.clone().pow(Math.abs(i.numerator)).multiply(r)));
|
|
1677
1677
|
return h(this, y, n.reduce().monoms), this;
|
|
1678
1678
|
});
|
|
1679
1679
|
a(this, "subtract", (...e) => {
|
|
1680
1680
|
for (const t of e)
|
|
1681
|
-
t instanceof
|
|
1681
|
+
t instanceof $ ? this.add(t.clone().opposite()) : t instanceof k ? s(this, y).push(t.clone().opposite()) : s(this, y).push(new k(t).opposite());
|
|
1682
1682
|
return this.reduce();
|
|
1683
1683
|
});
|
|
1684
1684
|
/**
|
|
1685
1685
|
* Set the polynom to zero.
|
|
1686
1686
|
* @returns {this}
|
|
1687
1687
|
*/
|
|
1688
|
-
a(this, "zero", () => (h(this, y, []), s(this, y).push(new
|
|
1689
|
-
m(this,
|
|
1688
|
+
a(this, "zero", () => (h(this, y, []), s(this, y).push(new k().zero()), this));
|
|
1689
|
+
m(this, tt, (e, t) => {
|
|
1690
1690
|
t === void 0 && (t = "=");
|
|
1691
1691
|
const i = this.clone().reduce().reorder(), n = e.clone().reduce().reorder();
|
|
1692
1692
|
switch (t) {
|
|
@@ -1698,47 +1698,47 @@ const P = class P {
|
|
|
1698
1698
|
return !1;
|
|
1699
1699
|
}
|
|
1700
1700
|
});
|
|
1701
|
-
m(this,
|
|
1701
|
+
m(this, yt, (e) => {
|
|
1702
1702
|
for (const t of s(this, y))
|
|
1703
1703
|
t.coefficient.divide(e);
|
|
1704
1704
|
return this;
|
|
1705
1705
|
});
|
|
1706
|
-
m(this,
|
|
1706
|
+
m(this, zt, (e) => {
|
|
1707
1707
|
const t = new u(e);
|
|
1708
1708
|
for (const i of s(this, y))
|
|
1709
1709
|
i.coefficient.divide(t);
|
|
1710
1710
|
return this;
|
|
1711
1711
|
});
|
|
1712
|
-
m(this,
|
|
1712
|
+
m(this, Rt, (e) => {
|
|
1713
1713
|
let t = 0;
|
|
1714
1714
|
return s(this, y).forEach((i) => {
|
|
1715
1715
|
t += i.evaluate(e, !0);
|
|
1716
1716
|
}), t;
|
|
1717
1717
|
});
|
|
1718
|
-
m(this,
|
|
1718
|
+
m(this, Dt, (e) => {
|
|
1719
1719
|
var w;
|
|
1720
1720
|
let t, i, n, r, l, c, f, d, p;
|
|
1721
1721
|
if (this.numberOfVars === 1)
|
|
1722
|
-
return n = this.monomByDegree(2, e).coefficient, r = this.monomByDegree(1, e).coefficient, l = this.monomByDegree(0, e).coefficient, c = r.clone().pow(2).subtract(n.clone().multiply(l).multiply(4)), c.isZero() ? (f = r.clone().opposite().divide(n.clone().multiply(2)), t = new
|
|
1723
|
-
new
|
|
1724
|
-
new
|
|
1722
|
+
return n = this.monomByDegree(2, e).coefficient, r = this.monomByDegree(1, e).coefficient, l = this.monomByDegree(0, e).coefficient, c = r.clone().pow(2).subtract(n.clone().multiply(l).multiply(4)), c.isZero() ? (f = r.clone().opposite().divide(n.clone().multiply(2)), t = new $(e).subtract(f.display).multiply(f.denominator), i = new $(e).subtract(f.display).multiply(f.denominator), p = n.divide(f.denominator).divide(f.denominator), p.isOne() ? [t, i] : [new $(p.display), t, i]) : c.isPositive() && c.isSquare() ? (f = r.clone().opposite().add(c.clone().sqrt()).divide(n.clone().multiply(2)), d = r.clone().opposite().subtract(c.clone().sqrt()).divide(n.clone().multiply(2)), p = n.divide(f.denominator).divide(d.denominator), p.isOne() ? [
|
|
1723
|
+
new $(e).subtract(f.display).multiply(f.denominator),
|
|
1724
|
+
new $(e).subtract(d.display).multiply(d.denominator)
|
|
1725
1725
|
] : [
|
|
1726
|
-
new
|
|
1727
|
-
new
|
|
1728
|
-
new
|
|
1726
|
+
new $(p.display),
|
|
1727
|
+
new $(e).subtract(f.display).multiply(f.denominator),
|
|
1728
|
+
new $(e).subtract(d.display).multiply(d.denominator)
|
|
1729
1729
|
]) : [this.clone()];
|
|
1730
1730
|
if (n = this.monomByDegree(2, e), r = this.monomByDegree(1, e), l = this.monomByDegree(0, e), n.isLiteralSquare() && l.isLiteralSquare() && r.clone().pow(2).isSameAs(n.clone().multiply(l))) {
|
|
1731
|
-
const
|
|
1731
|
+
const L = new $("x", n.coefficient, r.coefficient, l.coefficient), ce = s(w = L, Dt).call(w, "x"), ue = [];
|
|
1732
1732
|
let fe;
|
|
1733
1733
|
if (ce.length >= 2) {
|
|
1734
|
-
for (const
|
|
1735
|
-
|
|
1734
|
+
for (const we of ce)
|
|
1735
|
+
we.degree().isZero() ? ue.push(we.clone()) : (fe = we.clone(), fe.monoms[0].literal = n.literalSqrt, fe.monoms[1].literal = l.literalSqrt, ue.push(fe.clone()));
|
|
1736
1736
|
return ue;
|
|
1737
1737
|
}
|
|
1738
1738
|
}
|
|
1739
1739
|
return [this.clone()];
|
|
1740
1740
|
});
|
|
1741
|
-
m(this,
|
|
1741
|
+
m(this, it, (e, t, i, n) => {
|
|
1742
1742
|
let r = "";
|
|
1743
1743
|
for (const l of s(this, y)) {
|
|
1744
1744
|
if (l.coefficient.value === 0)
|
|
@@ -1748,51 +1748,51 @@ const P = class P {
|
|
|
1748
1748
|
}
|
|
1749
1749
|
return i === !0 && this.length > 1 && (e === "tex" ? r = `\\left( ${r} \\right)` : r = `(${r})`), r === "" && (r = "0"), r;
|
|
1750
1750
|
});
|
|
1751
|
-
m(this,
|
|
1751
|
+
m(this, Lt, (e, t, i) => {
|
|
1752
1752
|
const n = e.monoms[0].dividers, r = e.monoms[e.monoms.length - 1].dividers, l = [];
|
|
1753
1753
|
return n.forEach((c) => {
|
|
1754
1754
|
c.degree(i).isLeq(t) && r.forEach((f) => {
|
|
1755
|
-
c.degree(i).isNotEqual(f.degree(i)) && (l.push(new
|
|
1755
|
+
c.degree(i).isNotEqual(f.degree(i)) && (l.push(new $(c, f)), l.push(new $(c, f.clone().opposite())));
|
|
1756
1756
|
});
|
|
1757
1757
|
}), l;
|
|
1758
1758
|
});
|
|
1759
|
-
m(this,
|
|
1759
|
+
m(this, wt, (e) => {
|
|
1760
1760
|
for (const t of s(this, y))
|
|
1761
1761
|
t.coefficient.multiply(e);
|
|
1762
1762
|
return this.reduce();
|
|
1763
1763
|
});
|
|
1764
|
-
m(this,
|
|
1765
|
-
m(this,
|
|
1764
|
+
m(this, Zt, (e) => s(this, wt).call(this, new u(e)));
|
|
1765
|
+
m(this, Vt, (e) => {
|
|
1766
1766
|
for (const t of s(this, y))
|
|
1767
1767
|
t.multiply(e);
|
|
1768
1768
|
return this.reduce();
|
|
1769
1769
|
});
|
|
1770
|
-
m(this,
|
|
1770
|
+
m(this, Ft, (e) => {
|
|
1771
1771
|
const t = [];
|
|
1772
1772
|
for (const i of s(this, y))
|
|
1773
1773
|
for (const n of e.monoms)
|
|
1774
|
-
t.push(
|
|
1774
|
+
t.push(k.xMultiply(i, n));
|
|
1775
1775
|
return h(this, y, t), this.reduce();
|
|
1776
1776
|
});
|
|
1777
1777
|
/**
|
|
1778
1778
|
* Main parse using a shutting yard class
|
|
1779
1779
|
* @param inputStr
|
|
1780
1780
|
*/
|
|
1781
|
-
m(this,
|
|
1782
|
-
const i = new
|
|
1781
|
+
m(this, Ut, (e) => {
|
|
1782
|
+
const i = new si().parse(e).rpn;
|
|
1783
1783
|
this.zero();
|
|
1784
1784
|
const n = [];
|
|
1785
1785
|
for (const r of i)
|
|
1786
|
-
s(this,
|
|
1786
|
+
s(this, Gt).call(this, n, r);
|
|
1787
1787
|
return n.length === 1 && this.add(n[0]), this.reorder();
|
|
1788
1788
|
});
|
|
1789
|
-
m(this,
|
|
1789
|
+
m(this, Gt, (e, t) => {
|
|
1790
1790
|
switch (t.tokenType) {
|
|
1791
1791
|
case g.COEFFICIENT:
|
|
1792
|
-
e.push(new
|
|
1792
|
+
e.push(new $(t.token));
|
|
1793
1793
|
break;
|
|
1794
1794
|
case g.VARIABLE:
|
|
1795
|
-
e.push(new
|
|
1795
|
+
e.push(new $().add(new k(t.token)));
|
|
1796
1796
|
break;
|
|
1797
1797
|
case g.CONSTANT:
|
|
1798
1798
|
console.log("Actually, not supported - will be added later !");
|
|
@@ -1836,19 +1836,19 @@ const P = class P {
|
|
|
1836
1836
|
break;
|
|
1837
1837
|
}
|
|
1838
1838
|
});
|
|
1839
|
-
return h(this, y, []), h(this,
|
|
1839
|
+
return h(this, y, []), h(this, We, []), h(this, et, []), e !== void 0 && this.parse(e, ...t), this;
|
|
1840
1840
|
}
|
|
1841
1841
|
get tex() {
|
|
1842
|
-
return s(this,
|
|
1842
|
+
return s(this, it).call(this, "tex");
|
|
1843
1843
|
}
|
|
1844
1844
|
get display() {
|
|
1845
|
-
return s(this,
|
|
1845
|
+
return s(this, it).call(this);
|
|
1846
1846
|
}
|
|
1847
1847
|
fromCoefficients(...e) {
|
|
1848
1848
|
h(this, y, []);
|
|
1849
1849
|
const t = "x";
|
|
1850
1850
|
return e.reverse().forEach((i, n) => {
|
|
1851
|
-
const r = new
|
|
1851
|
+
const r = new k();
|
|
1852
1852
|
r.coefficient = new u(i), r.setLetter(t, n), s(this, y).push(r);
|
|
1853
1853
|
}), this;
|
|
1854
1854
|
}
|
|
@@ -1887,16 +1887,16 @@ const P = class P {
|
|
|
1887
1887
|
return this.variables.length;
|
|
1888
1888
|
}
|
|
1889
1889
|
get plotFunction() {
|
|
1890
|
-
return s(this,
|
|
1890
|
+
return s(this, it).call(this, "tex", !1, !1, !0);
|
|
1891
1891
|
}
|
|
1892
1892
|
root() {
|
|
1893
1893
|
throw new Error("Cannot take the root from a polynom");
|
|
1894
1894
|
}
|
|
1895
1895
|
get roots() {
|
|
1896
|
-
return s(this,
|
|
1896
|
+
return s(this, gt) ? s(this, et) : this.getZeroes();
|
|
1897
1897
|
}
|
|
1898
1898
|
set roots(e) {
|
|
1899
|
-
h(this,
|
|
1899
|
+
h(this, gt, !0), h(this, et, e);
|
|
1900
1900
|
}
|
|
1901
1901
|
sqrt() {
|
|
1902
1902
|
throw new Error("Cannot take the square root from a polynom");
|
|
@@ -1906,7 +1906,7 @@ const P = class P {
|
|
|
1906
1906
|
let t = new Array(2 * e.length + 1).fill("").map((i, n) => n % 2 === 0 ? "" : "z");
|
|
1907
1907
|
if (t.length === 1) {
|
|
1908
1908
|
const [i] = this.getCoefficients().map((n) => n.value);
|
|
1909
|
-
t =
|
|
1909
|
+
t = Ct(t, "", i > 0 ? "+" : "-");
|
|
1910
1910
|
} else if (this.degree().isOne()) {
|
|
1911
1911
|
const [i] = this.getCoefficients().map((n) => n.value);
|
|
1912
1912
|
t[0] = i > 0 ? "-" : "+", t[1] = "z", t[2] = i > 0 ? "+" : "-";
|
|
@@ -1930,14 +1930,14 @@ const P = class P {
|
|
|
1930
1930
|
return this.getZeroes();
|
|
1931
1931
|
}
|
|
1932
1932
|
};
|
|
1933
|
-
|
|
1933
|
+
We = new WeakMap(), y = new WeakMap(), et = new WeakMap(), gt = new WeakMap(), tt = new WeakMap(), yt = new WeakMap(), zt = new WeakMap(), Rt = new WeakMap(), Dt = new WeakMap(), it = new WeakMap(), Lt = new WeakMap(), wt = new WeakMap(), Zt = new WeakMap(), Vt = new WeakMap(), Ft = new WeakMap(), jt = new WeakSet(), Ii = function(e, ...t) {
|
|
1934
1934
|
if (t.length === 0) {
|
|
1935
1935
|
if (e = "" + e, e !== "" && !isNaN(Number(e))) {
|
|
1936
1936
|
this.empty();
|
|
1937
|
-
const i = new
|
|
1937
|
+
const i = new k(e);
|
|
1938
1938
|
return this.add(i), this;
|
|
1939
1939
|
}
|
|
1940
|
-
return s(this,
|
|
1940
|
+
return s(this, Ut).call(this, e);
|
|
1941
1941
|
} else if (/^[a-z]+/.test(e)) {
|
|
1942
1942
|
this.empty();
|
|
1943
1943
|
const i = t.map((n) => new u(n));
|
|
@@ -1947,45 +1947,45 @@ je = new WeakMap(), y = new WeakMap(), Ke = new WeakMap(), ft = new WeakMap(), J
|
|
|
1947
1947
|
throw new Error("Too many factors for too few variables !");
|
|
1948
1948
|
let r = 0;
|
|
1949
1949
|
for (const l of i) {
|
|
1950
|
-
const c = new
|
|
1950
|
+
const c = new k();
|
|
1951
1951
|
c.coefficient = l.clone(), c.literalStr = n[r] || "", this.add(c), r++;
|
|
1952
1952
|
}
|
|
1953
1953
|
} else {
|
|
1954
1954
|
let n = i.length - 1;
|
|
1955
1955
|
for (const r of i) {
|
|
1956
|
-
const l = new
|
|
1956
|
+
const l = new k();
|
|
1957
1957
|
l.coefficient = r.clone(), l.literalStr = `${e}^${n}`, this.add(l), n--;
|
|
1958
1958
|
}
|
|
1959
1959
|
}
|
|
1960
1960
|
return this;
|
|
1961
1961
|
} else
|
|
1962
1962
|
return this.zero();
|
|
1963
|
-
},
|
|
1964
|
-
let
|
|
1965
|
-
var
|
|
1966
|
-
const
|
|
1963
|
+
}, Ut = new WeakMap(), Gt = new WeakMap();
|
|
1964
|
+
let N = $;
|
|
1965
|
+
var O, C, oe, Wt, st, Xt;
|
|
1966
|
+
const qe = class qe {
|
|
1967
1967
|
constructor(e, t, i) {
|
|
1968
1968
|
// Left part of the equation
|
|
1969
|
-
m(this,
|
|
1969
|
+
m(this, O);
|
|
1970
1970
|
// Right part of the equation
|
|
1971
|
-
m(this,
|
|
1971
|
+
m(this, C);
|
|
1972
1972
|
// Signe of the equation
|
|
1973
1973
|
m(this, oe);
|
|
1974
1974
|
// ------------------------------------------
|
|
1975
1975
|
a(this, "parse", (e) => {
|
|
1976
|
-
const t = s(this,
|
|
1976
|
+
const t = s(this, Wt).call(this, e);
|
|
1977
1977
|
if (t === !1)
|
|
1978
1978
|
throw new Error("The equation is not valid (no sign found)");
|
|
1979
1979
|
const i = e.split(t);
|
|
1980
|
-
return this.create(new
|
|
1980
|
+
return this.create(new N(i[0]), new N(i[1]), s(this, st).call(this, t));
|
|
1981
1981
|
});
|
|
1982
|
-
a(this, "create", (e, t, i) => (h(this,
|
|
1983
|
-
a(this, "clone", () => new
|
|
1982
|
+
a(this, "create", (e, t, i) => (h(this, O, e), h(this, C, t), h(this, oe, s(this, st).call(this, i ?? "=")), this));
|
|
1983
|
+
a(this, "clone", () => new qe(s(this, O).clone(), s(this, C).clone(), s(this, oe)));
|
|
1984
1984
|
/**
|
|
1985
1985
|
* Get the degree of the equation
|
|
1986
1986
|
* @param letter
|
|
1987
1987
|
*/
|
|
1988
|
-
a(this, "degree", (e) => u.max(s(this,
|
|
1988
|
+
a(this, "degree", (e) => u.max(s(this, O).degree(e), s(this, C).degree(e)));
|
|
1989
1989
|
/**
|
|
1990
1990
|
* divide an equation by a given value (transformed as a fraction)
|
|
1991
1991
|
*
|
|
@@ -2016,7 +2016,7 @@ const Ne = class Ne {
|
|
|
2016
2016
|
/**
|
|
2017
2017
|
* Determine if the equation contains more than one letter/variable.
|
|
2018
2018
|
*/
|
|
2019
|
-
a(this, "isMultiVariable", () => s(this,
|
|
2019
|
+
a(this, "isMultiVariable", () => s(this, O).isMultiVariable || s(this, C).isMultiVariable);
|
|
2020
2020
|
// -----------------------------------------------
|
|
2021
2021
|
// Equations helpers
|
|
2022
2022
|
a(this, "isEqualTo", (e) => {
|
|
@@ -2031,47 +2031,47 @@ const Ne = class Ne {
|
|
|
2031
2031
|
if (!this.degree(e).isOne() || this.isMultiVariable())
|
|
2032
2032
|
return !1;
|
|
2033
2033
|
let t;
|
|
2034
|
-
s(this,
|
|
2035
|
-
const i = [...s(this,
|
|
2034
|
+
s(this, O).subtract(s(this, C)), s(this, C).zero();
|
|
2035
|
+
const i = [...s(this, O).monoms];
|
|
2036
2036
|
for (const r of i)
|
|
2037
|
-
r.hasVariable(e) || (t = r.clone(), s(this,
|
|
2038
|
-
if (s(this,
|
|
2037
|
+
r.hasVariable(e) || (t = r.clone(), s(this, O).subtract(t), s(this, C).subtract(t));
|
|
2038
|
+
if (s(this, O).length !== 1)
|
|
2039
2039
|
return !1;
|
|
2040
|
-
const n = s(this,
|
|
2041
|
-
return s(this,
|
|
2040
|
+
const n = s(this, O).monoms[0].coefficient.clone();
|
|
2041
|
+
return s(this, O).divide(n), s(this, C).divide(n), this;
|
|
2042
2042
|
});
|
|
2043
2043
|
// -----------------------------------------------
|
|
2044
2044
|
// Equations operations
|
|
2045
2045
|
// -----------------------------------------------
|
|
2046
|
-
a(this, "letters", () => [.../* @__PURE__ */ new Set([...s(this,
|
|
2046
|
+
a(this, "letters", () => [.../* @__PURE__ */ new Set([...s(this, O).letters(), ...s(this, C).letters()])]);
|
|
2047
2047
|
// -----------------------------------------------
|
|
2048
2048
|
/**
|
|
2049
2049
|
* Reorder will move all monoms containing a letter on the left, all the other on the right.
|
|
2050
2050
|
*/
|
|
2051
|
-
a(this, "moveLeft", () => (s(this,
|
|
2051
|
+
a(this, "moveLeft", () => (s(this, O).subtract(s(this, C)), s(this, C).zero(), this));
|
|
2052
2052
|
/**
|
|
2053
2053
|
* Multiple an equation by a fraction value.
|
|
2054
2054
|
* @param value
|
|
2055
2055
|
*/
|
|
2056
2056
|
a(this, "multiply", (e) => {
|
|
2057
2057
|
const t = new u(e);
|
|
2058
|
-
return s(this,
|
|
2058
|
+
return s(this, O).multiply(t), s(this, C).multiply(t), s(this, oe) !== "=" && t.sign() === -1 && s(this, Xt).call(this), this;
|
|
2059
2059
|
});
|
|
2060
|
-
a(this, "opposite", () => (h(this,
|
|
2061
|
-
a(this, "reorder", (e) => (s(this,
|
|
2060
|
+
a(this, "opposite", () => (h(this, O, s(this, O).opposite()), h(this, C, s(this, C).opposite()), this));
|
|
2061
|
+
a(this, "reorder", (e) => (s(this, O).subtract(s(this, C)), s(this, C).zero(), s(this, O).reorder(), e ? this : (s(this, O).monoms.filter((t) => t.degree().isZero()).forEach((t) => {
|
|
2062
2062
|
const i = t.clone();
|
|
2063
|
-
s(this,
|
|
2064
|
-
}), s(this,
|
|
2063
|
+
s(this, O).subtract(i), s(this, C).subtract(i);
|
|
2064
|
+
}), s(this, O).reorder(), s(this, C).reorder(), this)));
|
|
2065
2065
|
// ------------------------------------------
|
|
2066
|
-
a(this, "replaceBy", (e, t) => (s(this,
|
|
2066
|
+
a(this, "replaceBy", (e, t) => (s(this, O).replaceBy(e, t), s(this, C).replaceBy(e, t), this));
|
|
2067
2067
|
/**
|
|
2068
2068
|
* Multiply by the lcm denominator and divide by the gcm numerators.
|
|
2069
2069
|
*/
|
|
2070
|
-
a(this, "simplify", () => (this.multiply(
|
|
2070
|
+
a(this, "simplify", () => (this.multiply(G.lcm(...s(this, O).getDenominators(), ...s(this, C).getDenominators())), this.divide(G.gcd(...s(this, O).getNumerators(), ...s(this, C).getNumerators())), this));
|
|
2071
2071
|
// -----------------------------------------------
|
|
2072
|
-
a(this, "solve", () => new
|
|
2072
|
+
a(this, "solve", () => new Mt(this.clone()).solve());
|
|
2073
2073
|
a(this, "test", (e) => this.left.evaluate(e).isEqual(this.right.evaluate(e)));
|
|
2074
|
-
m(this,
|
|
2074
|
+
m(this, Wt, (e) => {
|
|
2075
2075
|
if (e.includes("geq"))
|
|
2076
2076
|
return e.includes("\\geq") ? "\\geq" : "geq";
|
|
2077
2077
|
if (e.includes("leq"))
|
|
@@ -2094,13 +2094,13 @@ const Ne = class Ne {
|
|
|
2094
2094
|
});
|
|
2095
2095
|
// -----------------------------------------------
|
|
2096
2096
|
// Equations solving algorithms
|
|
2097
|
-
m(this,
|
|
2098
|
-
m(this,
|
|
2099
|
-
if (h(this,
|
|
2100
|
-
if (e instanceof
|
|
2097
|
+
m(this, st, (e) => e === void 0 ? "=" : e.includes("geq") || e.includes(">=") || e.includes("=>") ? ">=" : e.includes(">") ? ">" : e.includes("leq") || e.includes("<=") || e.includes("=<") ? "<=" : e.includes("<") ? "<" : "=");
|
|
2098
|
+
m(this, Xt, () => s(this, oe) === "=" ? this : s(this, oe).includes("<") ? (s(this, oe).replace("<", ">"), this) : s(this, oe).includes(">") ? (s(this, oe).replace(">", "<"), this) : this);
|
|
2099
|
+
if (h(this, O, new N().zero()), h(this, C, new N().zero()), h(this, oe, "="), e !== void 0 && t === void 0) {
|
|
2100
|
+
if (e instanceof qe)
|
|
2101
2101
|
return e.clone();
|
|
2102
2102
|
typeof e == "string" && this.parse(e);
|
|
2103
|
-
} else e !== void 0 && t !== void 0 && (this.left = new
|
|
2103
|
+
} else e !== void 0 && t !== void 0 && (this.left = new N(e), this.right = new N(t));
|
|
2104
2104
|
return i !== void 0 && (this.sign = i), this;
|
|
2105
2105
|
}
|
|
2106
2106
|
/**
|
|
@@ -2112,12 +2112,12 @@ const Ne = class Ne {
|
|
|
2112
2112
|
* @param value | Polynom | Monom | Fraction | string | monom
|
|
2113
2113
|
*/
|
|
2114
2114
|
add(e) {
|
|
2115
|
-
if (e instanceof
|
|
2116
|
-
return s(this,
|
|
2117
|
-
if (typeof e == "string" && !
|
|
2118
|
-
return this.add(new
|
|
2119
|
-
const t = new
|
|
2120
|
-
return s(this,
|
|
2115
|
+
if (e instanceof qe)
|
|
2116
|
+
return s(this, O).add(e.left), s(this, C).add(e.right), this;
|
|
2117
|
+
if (typeof e == "string" && !qe.isEquationString(e))
|
|
2118
|
+
return this.add(new qe(e));
|
|
2119
|
+
const t = new N(e);
|
|
2120
|
+
return s(this, O).add(t), s(this, C).add(t), this;
|
|
2121
2121
|
}
|
|
2122
2122
|
/**
|
|
2123
2123
|
* Create an Equation using two polynoms.
|
|
@@ -2126,29 +2126,29 @@ const Ne = class Ne {
|
|
|
2126
2126
|
* @param asNumeric
|
|
2127
2127
|
*/
|
|
2128
2128
|
evaluate(e, t) {
|
|
2129
|
-
const i = s(this,
|
|
2129
|
+
const i = s(this, O).evaluate(e, t), n = s(this, C).evaluate(e, t);
|
|
2130
2130
|
return t ? i === n : i.isEqual(n);
|
|
2131
2131
|
}
|
|
2132
2132
|
isEqual(e) {
|
|
2133
|
-
const t = new
|
|
2134
|
-
return t.left.isEqual(s(this,
|
|
2133
|
+
const t = new qe(e);
|
|
2134
|
+
return t.left.isEqual(s(this, O)) && t.right.isEqual(s(this, C));
|
|
2135
2135
|
}
|
|
2136
2136
|
pow(e) {
|
|
2137
|
-
return s(this,
|
|
2137
|
+
return s(this, O).pow(e), s(this, C).pow(e), this;
|
|
2138
2138
|
}
|
|
2139
2139
|
reduce() {
|
|
2140
|
-
return this.moveLeft(), s(this,
|
|
2140
|
+
return this.moveLeft(), s(this, O).reduce(), this.simplify(), s(this, O).monoms[0].coefficient.isNegative() && this.multiply(-1), this;
|
|
2141
2141
|
}
|
|
2142
2142
|
split() {
|
|
2143
|
-
return [s(this,
|
|
2143
|
+
return [s(this, O).clone(), s(this, C).clone()];
|
|
2144
2144
|
}
|
|
2145
2145
|
subtract(e) {
|
|
2146
|
-
if (e instanceof
|
|
2147
|
-
return s(this,
|
|
2148
|
-
if (typeof e == "string" && !
|
|
2149
|
-
return this.subtract(new
|
|
2150
|
-
const t = new
|
|
2151
|
-
return s(this,
|
|
2146
|
+
if (e instanceof qe)
|
|
2147
|
+
return s(this, O).subtract(e.left), s(this, C).subtract(e.right), this;
|
|
2148
|
+
if (typeof e == "string" && !qe.isEquationString(e))
|
|
2149
|
+
return this.subtract(new qe(e));
|
|
2150
|
+
const t = new N(e);
|
|
2151
|
+
return s(this, O).subtract(t), s(this, C).subtract(t), this;
|
|
2152
2152
|
}
|
|
2153
2153
|
static isEquationString(e) {
|
|
2154
2154
|
return e.includes("=") || e.includes("<") || e.includes(">") || e.includes("<=") || e.includes(">=");
|
|
@@ -2158,85 +2158,85 @@ const Ne = class Ne {
|
|
|
2158
2158
|
return t === !0 && n.sort((r, l) => r.value - l.value), n;
|
|
2159
2159
|
}
|
|
2160
2160
|
get display() {
|
|
2161
|
-
return `${s(this,
|
|
2161
|
+
return `${s(this, O).display}${this.signAsTex}${s(this, C).display}`;
|
|
2162
2162
|
}
|
|
2163
2163
|
// Getter and setter
|
|
2164
2164
|
get left() {
|
|
2165
|
-
return s(this,
|
|
2165
|
+
return s(this, O);
|
|
2166
2166
|
}
|
|
2167
2167
|
set left(e) {
|
|
2168
|
-
h(this,
|
|
2168
|
+
h(this, O, e);
|
|
2169
2169
|
}
|
|
2170
2170
|
get numberOfVars() {
|
|
2171
2171
|
return this.variables.length;
|
|
2172
2172
|
}
|
|
2173
2173
|
get right() {
|
|
2174
|
-
return s(this,
|
|
2174
|
+
return s(this, C);
|
|
2175
2175
|
}
|
|
2176
2176
|
set right(e) {
|
|
2177
|
-
h(this,
|
|
2177
|
+
h(this, C, e);
|
|
2178
2178
|
}
|
|
2179
2179
|
// ------------------------------------------
|
|
2180
2180
|
get sign() {
|
|
2181
2181
|
return s(this, oe);
|
|
2182
2182
|
}
|
|
2183
2183
|
set sign(e) {
|
|
2184
|
-
h(this, oe, s(this,
|
|
2184
|
+
h(this, oe, s(this, st).call(this, e));
|
|
2185
2185
|
}
|
|
2186
2186
|
get signAsTex() {
|
|
2187
2187
|
return s(this, oe) === ">=" ? "\\geq" : s(this, oe) === "<=" ? "\\leq" : s(this, oe);
|
|
2188
2188
|
}
|
|
2189
2189
|
get tex() {
|
|
2190
|
-
return `${s(this,
|
|
2190
|
+
return `${s(this, O).tex}${this.signAsTex}${s(this, C).tex}`;
|
|
2191
2191
|
}
|
|
2192
2192
|
get variables() {
|
|
2193
|
-
return [...new Set(s(this,
|
|
2193
|
+
return [...new Set(s(this, C).variables.concat(s(this, O).variables))];
|
|
2194
2194
|
}
|
|
2195
2195
|
};
|
|
2196
|
-
|
|
2197
|
-
let
|
|
2198
|
-
var
|
|
2199
|
-
const
|
|
2196
|
+
O = new WeakMap(), C = new WeakMap(), oe = new WeakMap(), Wt = new WeakMap(), st = new WeakMap(), Xt = new WeakMap();
|
|
2197
|
+
let V = qe;
|
|
2198
|
+
var Ce, Ae, xe, nt;
|
|
2199
|
+
const be = class be {
|
|
2200
2200
|
constructor(e, t) {
|
|
2201
|
-
m(this,
|
|
2201
|
+
m(this, Ce);
|
|
2202
2202
|
m(this, Ae);
|
|
2203
|
-
m(this,
|
|
2204
|
-
m(this,
|
|
2205
|
-
return e instanceof
|
|
2203
|
+
m(this, xe);
|
|
2204
|
+
m(this, nt, !1);
|
|
2205
|
+
return e instanceof be ? (h(this, Ae, e.polynom.clone()), h(this, xe, e.power.clone()), t !== void 0 && s(this, xe).multiply(new u(t))) : e !== void 0 ? (h(this, Ae, new N(e)), h(this, xe, new u(t ?? 1))) : (h(this, Ae, new N()), h(this, xe, new u(1))), h(this, Ce, 1), this;
|
|
2206
2206
|
}
|
|
2207
2207
|
parse() {
|
|
2208
2208
|
throw new Error("Method not implemented.");
|
|
2209
2209
|
}
|
|
2210
2210
|
clone() {
|
|
2211
|
-
return new
|
|
2211
|
+
return new be(this);
|
|
2212
2212
|
}
|
|
2213
2213
|
fromPolynom(e) {
|
|
2214
|
-
return h(this, Ae, new
|
|
2214
|
+
return h(this, Ae, new N(e)), h(this, xe, new u(1)), this;
|
|
2215
2215
|
}
|
|
2216
2216
|
get tex() {
|
|
2217
2217
|
const e = this.power.numerator, t = this.power.denominator;
|
|
2218
2218
|
let i, n;
|
|
2219
|
-
return s(this,
|
|
2219
|
+
return s(this, Ce) === 0 && t > 1 ? (i = `\\sqrt${t === 2 ? "" : `[ ${t} ]`}{ ${this.polynom.tex} }`, n = e === 1 ? "" : `^{ ${e} }`) : (i = s(this, nt) && this.power.isOne() ? this.polynom.tex : qi(this.polynom.tex), n = t === 1 && e === 1 ? "" : `^{ ${this.power.tex} }`), i = `${i}${n}`, s(this, Ce) === 0 && e < 0 && (i = `\\frac{ 1 }{ ${i} }`), i;
|
|
2220
2220
|
}
|
|
2221
2221
|
get display() {
|
|
2222
2222
|
const e = this.power.numerator, t = this.power.denominator;
|
|
2223
2223
|
let i, n;
|
|
2224
|
-
return s(this,
|
|
2224
|
+
return s(this, Ce) === 0 && t > 1 ? (i = `${t === 2 ? "sqrt" : `root(${t})`}(${this.polynom.display})`, n = e === 1 ? "" : `^(${e})`) : (i = s(this, nt) && this.power.isOne() ? this.polynom.display : qi(this.polynom.display, !1), n = t === 1 && e === 1 ? "" : `^(${this.power.display})`), i = `${i}${n}`, s(this, Ce) === 0 && e < 0 && (i = `1/(${i})`), i;
|
|
2225
2225
|
}
|
|
2226
2226
|
add() {
|
|
2227
2227
|
throw new Error("Adding two factors is not possible");
|
|
2228
2228
|
}
|
|
2229
2229
|
get asSingle() {
|
|
2230
|
-
return h(this,
|
|
2230
|
+
return h(this, nt, !0), this;
|
|
2231
2231
|
}
|
|
2232
2232
|
degree(e) {
|
|
2233
2233
|
return this.polynom.degree(e).multiply(this.power);
|
|
2234
2234
|
}
|
|
2235
2235
|
derivative() {
|
|
2236
|
-
return this.power.isZero() ? [new
|
|
2237
|
-
new
|
|
2238
|
-
new
|
|
2239
|
-
new
|
|
2236
|
+
return this.power.isZero() ? [new be("0")] : this.power.isOne() ? [new be(this.polynom.clone().derivative())] : [
|
|
2237
|
+
new be(this.power.clone()),
|
|
2238
|
+
new be(this.polynom.clone().derivative()),
|
|
2239
|
+
new be(this.polynom.clone(), this.power.clone().subtract(1))
|
|
2240
2240
|
];
|
|
2241
2241
|
}
|
|
2242
2242
|
develop() {
|
|
@@ -2245,9 +2245,9 @@ const ve = class ve {
|
|
|
2245
2245
|
throw new Error("The power must be a natural number");
|
|
2246
2246
|
}
|
|
2247
2247
|
divide(e) {
|
|
2248
|
-
if (e instanceof
|
|
2248
|
+
if (e instanceof be && this.isSameAs(e))
|
|
2249
2249
|
return this.power.subtract(e.power), this;
|
|
2250
|
-
const t = new
|
|
2250
|
+
const t = new N(e);
|
|
2251
2251
|
if (this.isSameAs(t))
|
|
2252
2252
|
return this.power.subtract(1), this;
|
|
2253
2253
|
throw new Error("The two factors must be the same");
|
|
@@ -2269,21 +2269,21 @@ const ve = class ve {
|
|
|
2269
2269
|
}
|
|
2270
2270
|
isSameAs(e) {
|
|
2271
2271
|
let t;
|
|
2272
|
-
return e instanceof
|
|
2272
|
+
return e instanceof be ? t = e.polynom : e instanceof N ? t = e : t = new N(e), this.polynom.isEqual(t);
|
|
2273
2273
|
}
|
|
2274
2274
|
isZero() {
|
|
2275
2275
|
return this.polynom.isZero();
|
|
2276
2276
|
}
|
|
2277
2277
|
multiply(e) {
|
|
2278
|
-
if (e instanceof
|
|
2278
|
+
if (e instanceof be && this.isSameAs(e))
|
|
2279
2279
|
return this.power.add(e.power), this;
|
|
2280
|
-
const t = new
|
|
2280
|
+
const t = new N(e);
|
|
2281
2281
|
if (this.isSameAs(t))
|
|
2282
2282
|
return this.power.add(1), this;
|
|
2283
2283
|
throw new Error("The two factors must be the same");
|
|
2284
2284
|
}
|
|
2285
2285
|
one() {
|
|
2286
|
-
return s(this, Ae).one(), s(this,
|
|
2286
|
+
return s(this, Ae).one(), s(this, xe).one(), this;
|
|
2287
2287
|
}
|
|
2288
2288
|
opposite() {
|
|
2289
2289
|
throw new Error("Method not implemented.");
|
|
@@ -2298,10 +2298,10 @@ const ve = class ve {
|
|
|
2298
2298
|
return this.power.multiply(e), this;
|
|
2299
2299
|
}
|
|
2300
2300
|
get power() {
|
|
2301
|
-
return s(this,
|
|
2301
|
+
return s(this, xe);
|
|
2302
2302
|
}
|
|
2303
2303
|
set power(e) {
|
|
2304
|
-
h(this,
|
|
2304
|
+
h(this, xe, new u(e));
|
|
2305
2305
|
}
|
|
2306
2306
|
primitive() {
|
|
2307
2307
|
throw new Error("Method not implemented.");
|
|
@@ -2320,31 +2320,31 @@ const ve = class ve {
|
|
|
2320
2320
|
}
|
|
2321
2321
|
tableOfSigns() {
|
|
2322
2322
|
const e = this.power.clone().reduce(), t = this.polynom.tableOfSigns();
|
|
2323
|
-
return e.isStrictlyNegative() && (t.signs =
|
|
2323
|
+
return e.isStrictlyNegative() && (t.signs = Ct(t.signs, "z", "d")), e.denominator % 2 === 0 ? t.signs = Ct(t.signs, "-", "h") : e.numerator % 2 === 0 && (t.signs = Ct(t.signs, "-", "+")), { roots: t.roots, signs: t.signs };
|
|
2324
2324
|
}
|
|
2325
2325
|
get variables() {
|
|
2326
2326
|
return this.polynom.variables;
|
|
2327
2327
|
}
|
|
2328
2328
|
get withPower() {
|
|
2329
|
-
return h(this,
|
|
2329
|
+
return h(this, Ce, 1), this;
|
|
2330
2330
|
}
|
|
2331
2331
|
get withRoot() {
|
|
2332
|
-
return h(this,
|
|
2332
|
+
return h(this, Ce, 0), this;
|
|
2333
2333
|
}
|
|
2334
2334
|
zero() {
|
|
2335
|
-
return s(this, Ae).zero(), s(this,
|
|
2335
|
+
return s(this, Ae).zero(), s(this, xe).one(), this;
|
|
2336
2336
|
}
|
|
2337
2337
|
};
|
|
2338
|
-
|
|
2339
|
-
let se =
|
|
2340
|
-
var
|
|
2341
|
-
const
|
|
2338
|
+
Ce = new WeakMap(), Ae = new WeakMap(), xe = new WeakMap(), nt = new WeakMap();
|
|
2339
|
+
let se = be;
|
|
2340
|
+
var dt = /* @__PURE__ */ ((o) => (o[o.ROOT = 0] = "ROOT", o[o.POWER = 1] = "POWER", o))(dt || {}), Z, Se, Yt, Qt;
|
|
2341
|
+
const Ke = class Ke {
|
|
2342
2342
|
constructor(...e) {
|
|
2343
|
-
m(this,
|
|
2343
|
+
m(this, Z);
|
|
2344
2344
|
// Determine the letters in the linear system, usually ['x', 'y']
|
|
2345
|
-
m(this,
|
|
2346
|
-
a(this, "parse", (...e) => (h(this,
|
|
2347
|
-
a(this, "clone", () => new
|
|
2345
|
+
m(this, Se);
|
|
2346
|
+
a(this, "parse", (...e) => (h(this, Z, e.map((t) => new V(t))), s(this, Yt).call(this), this));
|
|
2347
|
+
a(this, "clone", () => new Ke().parse(...s(this, Z).map((e) => e.clone())));
|
|
2348
2348
|
a(this, "buildTex", (e, t) => {
|
|
2349
2349
|
let i, n, r = [];
|
|
2350
2350
|
const l = [];
|
|
@@ -2372,14 +2372,21 @@ const Xe = class Xe {
|
|
|
2372
2372
|
});
|
|
2373
2373
|
// ------------------------------------------
|
|
2374
2374
|
a(this, "reorder", () => {
|
|
2375
|
-
for (const e of s(this,
|
|
2375
|
+
for (const e of s(this, Z))
|
|
2376
2376
|
e.reorder();
|
|
2377
2377
|
return this;
|
|
2378
2378
|
});
|
|
2379
2379
|
a(this, "solveMatrix", () => {
|
|
2380
2380
|
const [e, t] = this.matrix, i = e.map((n, r) => [...n, t[r]]);
|
|
2381
2381
|
for (let n = 0; n < e.length; n++) {
|
|
2382
|
-
|
|
2382
|
+
let r = i[n][n].clone();
|
|
2383
|
+
if (r.isZero()) {
|
|
2384
|
+
const l = i.find((c, f) => f > n && !c[n].isZero());
|
|
2385
|
+
if (l)
|
|
2386
|
+
i[n].forEach((c, f) => c.add(l[f])), r = i[n][n].clone();
|
|
2387
|
+
else
|
|
2388
|
+
throw new Error("Unsolvable...");
|
|
2389
|
+
}
|
|
2383
2390
|
i[n] = i[n].map((l) => l.divide(r));
|
|
2384
2391
|
for (let l = 0; l < e.length; l++) {
|
|
2385
2392
|
if (l === n)
|
|
@@ -2393,10 +2400,10 @@ const Xe = class Xe {
|
|
|
2393
2400
|
}
|
|
2394
2401
|
return i.map((n) => n[n.length - 1]);
|
|
2395
2402
|
});
|
|
2396
|
-
m(this,
|
|
2397
|
-
m(this,
|
|
2403
|
+
m(this, Yt, () => (h(this, Se, s(this, Z).reduce((e, t) => [.../* @__PURE__ */ new Set([...e, ...t.variables])], [])), s(this, Se).sort(), this));
|
|
2404
|
+
m(this, Qt, () => {
|
|
2398
2405
|
const e = [], t = [];
|
|
2399
|
-
for (const i of s(this,
|
|
2406
|
+
for (const i of s(this, Z)) {
|
|
2400
2407
|
const n = [], r = i.clone().reorder();
|
|
2401
2408
|
for (const l of this.variables) {
|
|
2402
2409
|
const c = r.left.monomByLetter(l);
|
|
@@ -2406,74 +2413,74 @@ const Xe = class Xe {
|
|
|
2406
2413
|
}
|
|
2407
2414
|
return [e, t];
|
|
2408
2415
|
});
|
|
2409
|
-
return h(this,
|
|
2416
|
+
return h(this, Z, []), h(this, Se, []), e.length > 0 && this.parse(...e), this;
|
|
2410
2417
|
}
|
|
2411
2418
|
static fromMatrix(e, t = "xyz") {
|
|
2412
2419
|
const i = e[0].length;
|
|
2413
2420
|
if (e.some((r) => r.length !== i))
|
|
2414
2421
|
throw new Error("All rows must have the same number of columns");
|
|
2415
2422
|
const n = t.split("").splice(0, i - 1);
|
|
2416
|
-
return new
|
|
2423
|
+
return new Ke(
|
|
2417
2424
|
...e.map((r) => {
|
|
2418
|
-
const l = new
|
|
2419
|
-
return new
|
|
2425
|
+
const l = new N(n.join(""), ...r);
|
|
2426
|
+
return new V(l, 0);
|
|
2420
2427
|
})
|
|
2421
2428
|
);
|
|
2422
2429
|
}
|
|
2423
2430
|
add(e, t) {
|
|
2424
|
-
if (e instanceof
|
|
2431
|
+
if (e instanceof Ke) {
|
|
2425
2432
|
const i = e.equations.length;
|
|
2426
|
-
if (i !== s(this,
|
|
2433
|
+
if (i !== s(this, Z).length)
|
|
2427
2434
|
throw new Error("The number of equations must be the same");
|
|
2428
2435
|
for (let n = 0; n < i; n++)
|
|
2429
|
-
s(this,
|
|
2436
|
+
s(this, Z)[n].add(e.equations[n]);
|
|
2430
2437
|
} else {
|
|
2431
|
-
if (t === void 0 || t < 0 || t >= s(this,
|
|
2438
|
+
if (t === void 0 || t < 0 || t >= s(this, Z).length)
|
|
2432
2439
|
throw new Error("Index out of range");
|
|
2433
|
-
const i = new
|
|
2434
|
-
s(this,
|
|
2440
|
+
const i = new V(e);
|
|
2441
|
+
s(this, Z)[t].add(i);
|
|
2435
2442
|
}
|
|
2436
2443
|
return this;
|
|
2437
2444
|
}
|
|
2438
2445
|
degree(e) {
|
|
2439
|
-
return u.max(...s(this,
|
|
2446
|
+
return u.max(...s(this, Z).map((t) => t.degree(e)));
|
|
2440
2447
|
}
|
|
2441
2448
|
get display() {
|
|
2442
2449
|
return this.tex + "as display";
|
|
2443
2450
|
}
|
|
2444
2451
|
// ------------------------------------------
|
|
2445
2452
|
get equations() {
|
|
2446
|
-
return s(this,
|
|
2453
|
+
return s(this, Z);
|
|
2447
2454
|
}
|
|
2448
2455
|
set equations(e) {
|
|
2449
|
-
h(this,
|
|
2456
|
+
h(this, Z, e);
|
|
2450
2457
|
}
|
|
2451
2458
|
evaluate(e, t) {
|
|
2452
2459
|
throw new Error("Method not implemented.");
|
|
2453
2460
|
}
|
|
2454
2461
|
hasVariable(e) {
|
|
2455
|
-
return s(this,
|
|
2462
|
+
return s(this, Se).includes(e);
|
|
2456
2463
|
}
|
|
2457
2464
|
isEqual(e) {
|
|
2458
2465
|
return this.equations.every((t, i) => t.isEqual(e.equations[i]));
|
|
2459
2466
|
}
|
|
2460
2467
|
get isSolvable() {
|
|
2461
|
-
return this.variables.length === s(this,
|
|
2468
|
+
return this.variables.length === s(this, Z).length;
|
|
2462
2469
|
}
|
|
2463
2470
|
get matrix() {
|
|
2464
|
-
return s(this,
|
|
2471
|
+
return s(this, Qt).call(this);
|
|
2465
2472
|
}
|
|
2466
2473
|
multiply(e, t) {
|
|
2467
2474
|
if (Array.isArray(e)) {
|
|
2468
|
-
if (e.length !== s(this,
|
|
2475
|
+
if (e.length !== s(this, Z).length)
|
|
2469
2476
|
throw new Error("The number of values must be the same as the number of equations");
|
|
2470
2477
|
for (let i = 0; i < e.length; i++)
|
|
2471
|
-
s(this,
|
|
2478
|
+
s(this, Z)[i].multiply(e[i]);
|
|
2472
2479
|
return this;
|
|
2473
2480
|
}
|
|
2474
|
-
if (t === void 0 || t < 0 || t >= s(this,
|
|
2481
|
+
if (t === void 0 || t < 0 || t >= s(this, Z).length)
|
|
2475
2482
|
throw new Error("Index out of range");
|
|
2476
|
-
return s(this,
|
|
2483
|
+
return s(this, Z)[t].multiply(e), this;
|
|
2477
2484
|
}
|
|
2478
2485
|
reduce() {
|
|
2479
2486
|
throw new Error("Method not implemented.");
|
|
@@ -2482,17 +2489,17 @@ const Xe = class Xe {
|
|
|
2482
2489
|
return [];
|
|
2483
2490
|
}
|
|
2484
2491
|
subtract(e, t) {
|
|
2485
|
-
if (e instanceof
|
|
2492
|
+
if (e instanceof Ke) {
|
|
2486
2493
|
const i = e.equations.length;
|
|
2487
|
-
if (i !== s(this,
|
|
2494
|
+
if (i !== s(this, Z).length)
|
|
2488
2495
|
throw new Error("The number of equations must be the same");
|
|
2489
2496
|
for (let n = 0; n < i; n++)
|
|
2490
|
-
s(this,
|
|
2497
|
+
s(this, Z)[n].subtract(e.equations[n]);
|
|
2491
2498
|
} else {
|
|
2492
|
-
if (t === void 0 || t < 0 || t >= s(this,
|
|
2499
|
+
if (t === void 0 || t < 0 || t >= s(this, Z).length)
|
|
2493
2500
|
throw new Error("Index out of range");
|
|
2494
|
-
const i = new
|
|
2495
|
-
s(this,
|
|
2501
|
+
const i = new V(e);
|
|
2502
|
+
s(this, Z)[t].subtract(i);
|
|
2496
2503
|
}
|
|
2497
2504
|
return this;
|
|
2498
2505
|
}
|
|
@@ -2501,33 +2508,33 @@ const Xe = class Xe {
|
|
|
2501
2508
|
return this.buildTex(e.equations);
|
|
2502
2509
|
}
|
|
2503
2510
|
get variables() {
|
|
2504
|
-
return s(this,
|
|
2511
|
+
return s(this, Se);
|
|
2505
2512
|
}
|
|
2506
2513
|
set variables(e) {
|
|
2507
2514
|
const t = typeof e == "string" ? e.split("") : [...e];
|
|
2508
|
-
t.sort(), h(this,
|
|
2515
|
+
t.sort(), h(this, Se, t);
|
|
2509
2516
|
}
|
|
2510
2517
|
};
|
|
2511
|
-
|
|
2512
|
-
let
|
|
2513
|
-
var
|
|
2514
|
-
class
|
|
2518
|
+
Z = new WeakMap(), Se = new WeakMap(), Yt = new WeakMap(), Qt = new WeakMap();
|
|
2519
|
+
let hi = Ke;
|
|
2520
|
+
var ke, vt, ai;
|
|
2521
|
+
class cs {
|
|
2515
2522
|
/**
|
|
2516
2523
|
*
|
|
2517
2524
|
* @param {string} value (optional) Default polynom to parse on class creation
|
|
2518
2525
|
*/
|
|
2519
2526
|
constructor(e) {
|
|
2520
|
-
m(this,
|
|
2521
|
-
m(this,
|
|
2522
|
-
a(this, "parse", (e) => (h(this,
|
|
2523
|
-
return h(this,
|
|
2527
|
+
m(this, vt);
|
|
2528
|
+
m(this, ke);
|
|
2529
|
+
a(this, "parse", (e) => (h(this, ke, new si(Ue.SET).parse(e).rpn), this));
|
|
2530
|
+
return h(this, ke, []), e !== void 0 && this.parse(e), this;
|
|
2524
2531
|
}
|
|
2525
2532
|
evaluate(e) {
|
|
2526
2533
|
this.variables.forEach((i) => {
|
|
2527
2534
|
Object.hasOwn(e, i) || (e[i] = !1);
|
|
2528
2535
|
});
|
|
2529
2536
|
const t = [];
|
|
2530
|
-
for (const i of s(this,
|
|
2537
|
+
for (const i of s(this, ke))
|
|
2531
2538
|
if (console.log(i), i.tokenType === "variable")
|
|
2532
2539
|
t.push(e[i.token]);
|
|
2533
2540
|
else if (i.tokenType === "operation")
|
|
@@ -2556,11 +2563,11 @@ class ss {
|
|
|
2556
2563
|
return t.length === 1 && t[0];
|
|
2557
2564
|
}
|
|
2558
2565
|
get rpn() {
|
|
2559
|
-
return s(this,
|
|
2566
|
+
return s(this, ke);
|
|
2560
2567
|
}
|
|
2561
2568
|
get tex() {
|
|
2562
2569
|
const e = [];
|
|
2563
|
-
for (const t of s(this,
|
|
2570
|
+
for (const t of s(this, ke))
|
|
2564
2571
|
if (t.tokenType === "variable")
|
|
2565
2572
|
e.push(t);
|
|
2566
2573
|
else
|
|
@@ -2593,23 +2600,23 @@ class ss {
|
|
|
2593
2600
|
return e[0].token;
|
|
2594
2601
|
}
|
|
2595
2602
|
get variables() {
|
|
2596
|
-
return s(this,
|
|
2603
|
+
return s(this, ke).filter((e) => e.tokenType === "variable").map((e) => e.token);
|
|
2597
2604
|
}
|
|
2598
2605
|
vennAB() {
|
|
2599
|
-
return A(this,
|
|
2606
|
+
return A(this, vt, ai).call(this, {
|
|
2600
2607
|
A: ["A", "AB"],
|
|
2601
2608
|
B: ["B", "AB"]
|
|
2602
2609
|
}, ["A", "B", "AB", "E"]);
|
|
2603
2610
|
}
|
|
2604
2611
|
vennABC() {
|
|
2605
|
-
return A(this,
|
|
2612
|
+
return A(this, vt, ai).call(this, {
|
|
2606
2613
|
A: ["A", "AB", "AC", "ABC"],
|
|
2607
2614
|
B: ["B", "AB", "BC", "ABC"],
|
|
2608
2615
|
C: ["C", "AC", "BC", "ABC"]
|
|
2609
2616
|
}, ["A", "B", "C", "AB", "AC", "BC", "ABC", "E"]);
|
|
2610
2617
|
}
|
|
2611
2618
|
}
|
|
2612
|
-
|
|
2619
|
+
ke = new WeakMap(), vt = new WeakSet(), ai = function(e, t) {
|
|
2613
2620
|
const i = [];
|
|
2614
2621
|
let n;
|
|
2615
2622
|
if (t === void 0) {
|
|
@@ -2621,7 +2628,7 @@ Oe = new WeakMap(), mt = new WeakSet(), ii = function(e, t) {
|
|
|
2621
2628
|
]);
|
|
2622
2629
|
} else
|
|
2623
2630
|
n = new Set(t);
|
|
2624
|
-
for (const r of s(this,
|
|
2631
|
+
for (const r of s(this, ke))
|
|
2625
2632
|
if (r.tokenType === "variable")
|
|
2626
2633
|
e[r.token] === void 0 ? i.push(/* @__PURE__ */ new Set()) : i.push(new Set(e[r.token]));
|
|
2627
2634
|
else
|
|
@@ -2653,31 +2660,31 @@ Oe = new WeakMap(), mt = new WeakSet(), ii = function(e, t) {
|
|
|
2653
2660
|
}
|
|
2654
2661
|
return [...i[0]].sort();
|
|
2655
2662
|
};
|
|
2656
|
-
var
|
|
2657
|
-
const
|
|
2663
|
+
var rt, q, Ye, ci, zi, bt, ui;
|
|
2664
|
+
const Y = class Y {
|
|
2658
2665
|
constructor(...e) {
|
|
2659
|
-
m(this,
|
|
2660
|
-
m(this,
|
|
2661
|
-
m(this,
|
|
2666
|
+
m(this, bt);
|
|
2667
|
+
m(this, rt, dt.POWER);
|
|
2668
|
+
m(this, q, []);
|
|
2662
2669
|
return this.parse(...e), this;
|
|
2663
2670
|
}
|
|
2664
2671
|
parse(...e) {
|
|
2665
|
-
return h(this,
|
|
2666
|
-
t instanceof
|
|
2672
|
+
return h(this, q, []), e.length === 0 ? this : (e.forEach((t) => {
|
|
2673
|
+
t instanceof Y ? s(this, q).push(...t.factors.map((i) => i.clone())) : s(this, q).push(new se(t));
|
|
2667
2674
|
}), this);
|
|
2668
2675
|
}
|
|
2669
2676
|
clone() {
|
|
2670
|
-
return new
|
|
2677
|
+
return new Y(...s(this, q).map((e) => e.clone()));
|
|
2671
2678
|
}
|
|
2672
2679
|
get tex() {
|
|
2673
|
-
const { num: e, den: t } = A(this,
|
|
2680
|
+
const { num: e, den: t } = A(this, bt, ui).call(this);
|
|
2674
2681
|
if (t.length === 0)
|
|
2675
2682
|
return e.length === 1 ? e[0].asSingle.tex : e.map((r) => r.tex).join("");
|
|
2676
2683
|
const i = e.length === 1 ? e[0].asSingle.tex : e.map((r) => r.tex).join(""), n = t.length === 1 ? t[0].asSingle.tex : t.map((r) => r.tex).join("");
|
|
2677
2684
|
return `\\frac{ ${i} }{ ${n} }`;
|
|
2678
2685
|
}
|
|
2679
2686
|
get display() {
|
|
2680
|
-
const { num: e, den: t } = A(this,
|
|
2687
|
+
const { num: e, den: t } = A(this, bt, ui).call(this);
|
|
2681
2688
|
if (t.length === 0)
|
|
2682
2689
|
return e.length === 1 ? e[0].asSingle.display : e.map(
|
|
2683
2690
|
(r, l) => l === 0 && r.polynom.monoms.length === 1 ? r.asSingle.display : r.display
|
|
@@ -2688,88 +2695,88 @@ const X = class X {
|
|
|
2688
2695
|
static gcd(...e) {
|
|
2689
2696
|
var i;
|
|
2690
2697
|
if (e.length === 0)
|
|
2691
|
-
return new
|
|
2698
|
+
return new Y().one();
|
|
2692
2699
|
if (e.length === 1)
|
|
2693
2700
|
return e[0];
|
|
2694
2701
|
if (e.length === 2)
|
|
2695
|
-
return A(i =
|
|
2702
|
+
return A(i = Y, Ye, ci).call(i, e[0], e[1]);
|
|
2696
2703
|
let t = e[0];
|
|
2697
2704
|
return e.shift(), e.forEach((n) => {
|
|
2698
2705
|
var r;
|
|
2699
|
-
return t = A(r =
|
|
2706
|
+
return t = A(r = Y, Ye, ci).call(r, t, n);
|
|
2700
2707
|
}), t;
|
|
2701
2708
|
}
|
|
2702
2709
|
static lcm(...e) {
|
|
2703
2710
|
if (e.length === 0)
|
|
2704
|
-
return new
|
|
2711
|
+
return new Y().one();
|
|
2705
2712
|
if (e.length === 1)
|
|
2706
2713
|
return e[0];
|
|
2707
2714
|
let t = e[0];
|
|
2708
2715
|
return e.shift(), e.forEach((i) => {
|
|
2709
2716
|
var n;
|
|
2710
|
-
return t = A(n =
|
|
2717
|
+
return t = A(n = Y, Ye, zi).call(n, t, i);
|
|
2711
2718
|
}), t;
|
|
2712
2719
|
}
|
|
2713
2720
|
add(...e) {
|
|
2714
2721
|
const t = [this.numerator, ...e.map((c) => c.numerator)], i = [this.denominator, ...e.map((c) => c.denominator)];
|
|
2715
2722
|
let n;
|
|
2716
2723
|
if (i.some((c) => c.factors.length > 0)) {
|
|
2717
|
-
const c =
|
|
2724
|
+
const c = Y.lcm(...i);
|
|
2718
2725
|
t.forEach((f, d) => {
|
|
2719
2726
|
f.multiply(c.clone().divide(i[d]));
|
|
2720
2727
|
}), n = c;
|
|
2721
2728
|
}
|
|
2722
|
-
const r =
|
|
2729
|
+
const r = Y.gcd(...t), l = new N(0).add(
|
|
2723
2730
|
...t.map((c) => c.divide(r).reduce().develop().factors[0].polynom)
|
|
2724
2731
|
).reduce();
|
|
2725
|
-
return h(this,
|
|
2732
|
+
return h(this, q, [
|
|
2726
2733
|
...r.factors,
|
|
2727
2734
|
new se(l)
|
|
2728
|
-
]), n && this.divide(n), h(this,
|
|
2735
|
+
]), n && this.divide(n), h(this, q, s(this, q).filter((c) => !c.power.isZero())), this;
|
|
2729
2736
|
}
|
|
2730
2737
|
get asPower() {
|
|
2731
|
-
return h(this,
|
|
2738
|
+
return h(this, rt, dt.POWER), this;
|
|
2732
2739
|
}
|
|
2733
2740
|
get asRoot() {
|
|
2734
|
-
return h(this,
|
|
2741
|
+
return h(this, rt, dt.ROOT), this;
|
|
2735
2742
|
}
|
|
2736
2743
|
degree(e) {
|
|
2737
|
-
return s(this,
|
|
2744
|
+
return s(this, q).reduce((t, i) => t.add(i.degree(e)), new u("0"));
|
|
2738
2745
|
}
|
|
2739
2746
|
get denominator() {
|
|
2740
|
-
return new
|
|
2741
|
-
...s(this,
|
|
2747
|
+
return new Y(
|
|
2748
|
+
...s(this, q).filter((e) => e.power.isNegative()).map((e) => e.clone().inverse())
|
|
2742
2749
|
);
|
|
2743
2750
|
}
|
|
2744
2751
|
derivative() {
|
|
2745
|
-
const e = [], t = s(this,
|
|
2752
|
+
const e = [], t = s(this, q).length;
|
|
2746
2753
|
for (let n = 0; n < t; n++) {
|
|
2747
|
-
const r = s(this,
|
|
2754
|
+
const r = s(this, q).slice(), l = r.splice(n, 1)[0].derivative();
|
|
2748
2755
|
e.push(
|
|
2749
|
-
new
|
|
2756
|
+
new Y(...r, ...l)
|
|
2750
2757
|
);
|
|
2751
2758
|
}
|
|
2752
2759
|
e.forEach((n) => n.reduce());
|
|
2753
2760
|
const i = e.shift();
|
|
2754
|
-
return i !== void 0 && h(this,
|
|
2761
|
+
return i !== void 0 && h(this, q, i.factors), this.add(...e);
|
|
2755
2762
|
}
|
|
2756
2763
|
develop() {
|
|
2757
|
-
const e = new
|
|
2764
|
+
const e = new N("1"), t = new N("1");
|
|
2758
2765
|
return this.numerator.factors.forEach((i) => {
|
|
2759
2766
|
e.multiply(i.develop());
|
|
2760
2767
|
}), this.denominator.factors.forEach((i) => {
|
|
2761
2768
|
t.multiply(i.develop());
|
|
2762
|
-
}), new
|
|
2769
|
+
}), new Y().fromPolynom(e, t);
|
|
2763
2770
|
}
|
|
2764
2771
|
divide(e) {
|
|
2765
|
-
return h(this,
|
|
2772
|
+
return h(this, q, s(this, q).concat(e.clone().factors.map((t) => t.inverse()))), this;
|
|
2766
2773
|
}
|
|
2767
2774
|
evaluate(e, t) {
|
|
2768
|
-
return t ? s(this,
|
|
2775
|
+
return t ? s(this, q).reduce((i, n) => i * n.evaluate(e, t), 1) : s(this, q).reduce((i, n) => i.multiply(n.evaluate(e)), new u("1"));
|
|
2769
2776
|
}
|
|
2770
2777
|
factorize(e) {
|
|
2771
2778
|
const t = [];
|
|
2772
|
-
s(this,
|
|
2779
|
+
s(this, q).forEach((l) => {
|
|
2773
2780
|
const c = l.polynom.factorize(e);
|
|
2774
2781
|
if (c.length > 1) {
|
|
2775
2782
|
const f = l.power.clone();
|
|
@@ -2777,28 +2784,28 @@ const X = class X {
|
|
|
2777
2784
|
} else
|
|
2778
2785
|
t.push(l.clone());
|
|
2779
2786
|
});
|
|
2780
|
-
const i = new
|
|
2787
|
+
const i = new Y(...t), n = i.numerator.reduce(), r = i.denominator.reduce();
|
|
2781
2788
|
return n.divide(r);
|
|
2782
2789
|
}
|
|
2783
2790
|
get factors() {
|
|
2784
|
-
return s(this,
|
|
2791
|
+
return s(this, q);
|
|
2785
2792
|
}
|
|
2786
2793
|
set factors(e) {
|
|
2787
|
-
h(this,
|
|
2794
|
+
h(this, q, e);
|
|
2788
2795
|
}
|
|
2789
2796
|
fromPolynom(e, t) {
|
|
2790
|
-
if (h(this,
|
|
2791
|
-
const i = new
|
|
2797
|
+
if (h(this, q, [new se(new N(e))]), t) {
|
|
2798
|
+
const i = new N(t);
|
|
2792
2799
|
if (i.isOne())
|
|
2793
2800
|
return this;
|
|
2794
2801
|
if (i.isZero())
|
|
2795
2802
|
throw new Error("Cannot divide by zero");
|
|
2796
|
-
s(this,
|
|
2803
|
+
s(this, q).push(new se(i, -1));
|
|
2797
2804
|
}
|
|
2798
2805
|
return this;
|
|
2799
2806
|
}
|
|
2800
2807
|
getZeroes() {
|
|
2801
|
-
const e = [].concat(...s(this,
|
|
2808
|
+
const e = [].concat(...s(this, q).map((t) => t.polynom.getZeroes()));
|
|
2802
2809
|
return e.sort((t, i) => t.value - i.value), e.filter(
|
|
2803
2810
|
(t, i, n) => i === n.findIndex(
|
|
2804
2811
|
(r) => r.value === t.value
|
|
@@ -2806,51 +2813,51 @@ const X = class X {
|
|
|
2806
2813
|
);
|
|
2807
2814
|
}
|
|
2808
2815
|
hasVariable(e) {
|
|
2809
|
-
return s(this,
|
|
2816
|
+
return s(this, q).some((t) => t.hasVariable(e));
|
|
2810
2817
|
}
|
|
2811
2818
|
inverse() {
|
|
2812
|
-
return h(this,
|
|
2819
|
+
return h(this, q, s(this, q).map((e) => e.inverse())), this;
|
|
2813
2820
|
}
|
|
2814
2821
|
isEqual(e) {
|
|
2815
|
-
const t =
|
|
2822
|
+
const t = Y.gcd(this, e), i = this.clone().divide(t).reduce(), n = e.clone().divide(t).reduce();
|
|
2816
2823
|
return i.isOne() && n.isOne();
|
|
2817
2824
|
}
|
|
2818
2825
|
isOne() {
|
|
2819
|
-
return s(this,
|
|
2826
|
+
return s(this, q).every((e) => e.isOne());
|
|
2820
2827
|
}
|
|
2821
2828
|
isZero() {
|
|
2822
|
-
return s(this,
|
|
2829
|
+
return s(this, q).every((e) => e.isZero());
|
|
2823
2830
|
}
|
|
2824
2831
|
multiply(...e) {
|
|
2825
2832
|
return e.forEach((t) => {
|
|
2826
|
-
h(this,
|
|
2833
|
+
h(this, q, s(this, q).concat(t.clone().factors));
|
|
2827
2834
|
}), this;
|
|
2828
2835
|
}
|
|
2829
2836
|
get numerator() {
|
|
2830
|
-
return new
|
|
2837
|
+
return new Y(...s(this, q).filter((e) => e.power.isPositive()));
|
|
2831
2838
|
}
|
|
2832
2839
|
one() {
|
|
2833
|
-
return h(this,
|
|
2840
|
+
return h(this, q, [new se("1", "1")]), this;
|
|
2834
2841
|
}
|
|
2835
2842
|
opposite() {
|
|
2836
|
-
const e = s(this,
|
|
2837
|
-
return e >= 0 ? s(this,
|
|
2843
|
+
const e = s(this, q).findIndex((t) => t.display === "(-1)");
|
|
2844
|
+
return e >= 0 ? s(this, q).splice(e, 1) : s(this, q).push(new se("-1", "1")), this;
|
|
2838
2845
|
}
|
|
2839
2846
|
pow(e) {
|
|
2840
|
-
return h(this,
|
|
2847
|
+
return h(this, q, s(this, q).map((t) => t.pow(e))), this;
|
|
2841
2848
|
}
|
|
2842
2849
|
primitive() {
|
|
2843
2850
|
throw new Error("Method not implemented.");
|
|
2844
2851
|
}
|
|
2845
2852
|
reduce() {
|
|
2846
|
-
const e =
|
|
2847
|
-
return h(this,
|
|
2853
|
+
const e = ut(this);
|
|
2854
|
+
return h(this, q, Object.values(e).map((t) => {
|
|
2848
2855
|
const i = t[0].polynom, n = t.reduce((r, l) => r.add(l.power), new u("0"));
|
|
2849
2856
|
return new se(i, n.reduce());
|
|
2850
2857
|
}).filter((t) => !t.power.isZero())), this;
|
|
2851
2858
|
}
|
|
2852
2859
|
root(e) {
|
|
2853
|
-
return h(this,
|
|
2860
|
+
return h(this, q, s(this, q).map((t) => t.root(e))), this;
|
|
2854
2861
|
}
|
|
2855
2862
|
/**
|
|
2856
2863
|
* Reoarder the factors using :
|
|
@@ -2859,7 +2866,7 @@ const X = class X {
|
|
|
2859
2866
|
* 3. power of polyfactor
|
|
2860
2867
|
*/
|
|
2861
2868
|
sort(e) {
|
|
2862
|
-
return s(this,
|
|
2869
|
+
return s(this, q).sort((t, i) => {
|
|
2863
2870
|
const n = t.power.value, r = i.power.value;
|
|
2864
2871
|
if (n * r < 0)
|
|
2865
2872
|
return -n;
|
|
@@ -2871,7 +2878,7 @@ const X = class X {
|
|
|
2871
2878
|
}), this;
|
|
2872
2879
|
}
|
|
2873
2880
|
sqrt() {
|
|
2874
|
-
return h(this,
|
|
2881
|
+
return h(this, q, s(this, q).map((e) => e.sqrt())), this;
|
|
2875
2882
|
}
|
|
2876
2883
|
subtract(...e) {
|
|
2877
2884
|
return this.add(...e.map((t) => t.opposite()));
|
|
@@ -2886,8 +2893,8 @@ const X = class X {
|
|
|
2886
2893
|
return c;
|
|
2887
2894
|
if (f === void 0 || f.value !== t[(w - 1) / 2])
|
|
2888
2895
|
return "t";
|
|
2889
|
-
const
|
|
2890
|
-
return c = r.signs.shift(), f = r.roots.shift(),
|
|
2896
|
+
const L = r.signs.shift();
|
|
2897
|
+
return c = r.signs.shift(), f = r.roots.shift(), L;
|
|
2891
2898
|
});
|
|
2892
2899
|
r.roots = e, r.signs = d;
|
|
2893
2900
|
}), { signs: i.map((r) => r.signs).reduce((r, l) => r.length === 0 ? l : (l.forEach((c, f) => {
|
|
@@ -2908,30 +2915,30 @@ const X = class X {
|
|
|
2908
2915
|
}), r), []), roots: e, factors: i };
|
|
2909
2916
|
}
|
|
2910
2917
|
get variables() {
|
|
2911
|
-
return s(this,
|
|
2918
|
+
return s(this, q).reduce((e, t) => e.concat(t.variables), []);
|
|
2912
2919
|
}
|
|
2913
2920
|
zero() {
|
|
2914
|
-
return h(this,
|
|
2921
|
+
return h(this, q, [new se("0", "1")]), this;
|
|
2915
2922
|
}
|
|
2916
2923
|
};
|
|
2917
|
-
|
|
2918
|
-
const i =
|
|
2924
|
+
rt = new WeakMap(), q = new WeakMap(), Ye = new WeakSet(), ci = function(e, t) {
|
|
2925
|
+
const i = ut(e), n = ut(t), l = Object.keys(i).filter((c) => Object.hasOwn(n, c)).map((c) => {
|
|
2919
2926
|
const f = i[c].reduce((p, w) => p.add(w.power), new u("0")), d = n[c].reduce((p, w) => p.add(w.power), new u("0"));
|
|
2920
2927
|
return new se(c, u.min(f, d));
|
|
2921
2928
|
});
|
|
2922
|
-
return new
|
|
2923
|
-
},
|
|
2924
|
-
const i =
|
|
2929
|
+
return new Y(...l);
|
|
2930
|
+
}, zi = function(e, t) {
|
|
2931
|
+
const i = ut(e), n = ut(t), l = [.../* @__PURE__ */ new Set([...Object.keys(i), ...Object.keys(n)])].map((c) => {
|
|
2925
2932
|
const f = Object.hasOwn(i, c) ? i[c].reduce((p, w) => p.add(w.power), new u("0")) : new u(0), d = Object.hasOwn(n, c) ? n[c].reduce((p, w) => p.add(w.power), new u("0")) : new u(0);
|
|
2926
2933
|
return new se(c, u.max(f, d));
|
|
2927
2934
|
});
|
|
2928
|
-
return new
|
|
2929
|
-
},
|
|
2935
|
+
return new Y(...l);
|
|
2936
|
+
}, bt = new WeakSet(), ui = function() {
|
|
2930
2937
|
let e, t = [];
|
|
2931
|
-
return s(this,
|
|
2932
|
-
}, m(
|
|
2933
|
-
let
|
|
2934
|
-
function
|
|
2938
|
+
return s(this, rt) === dt.ROOT ? (e = this.numerator.factors, t = this.denominator.factors) : e = s(this, q), e.length === 0 && (e = [new se("1")]), { num: e, den: t };
|
|
2939
|
+
}, m(Y, Ye);
|
|
2940
|
+
let li = Y;
|
|
2941
|
+
function ut(o) {
|
|
2935
2942
|
const e = new u().one(), t = new u().one(), i = o.factors.reduce((l, c) => {
|
|
2936
2943
|
if (c.polynom.degree().isZero())
|
|
2937
2944
|
return c.power.isPositive() ? e.multiply(c.polynom.monoms[0].coefficient) : t.multiply(c.polynom.monoms[0].coefficient), l;
|
|
@@ -2940,12 +2947,12 @@ function ht(o) {
|
|
|
2940
2947
|
}, {}), { numerator: n, denominator: r } = e.divide(t).reduce();
|
|
2941
2948
|
return n !== 1 && (i[n.toString()] = [new se(n, 1)]), r !== 1 && (i[r.toString()] = [new se(r, -1)]), i;
|
|
2942
2949
|
}
|
|
2943
|
-
function
|
|
2950
|
+
function us(o, e) {
|
|
2944
2951
|
return o.dimension === e.dimension && o.array.every(
|
|
2945
2952
|
(t, i) => e.array[i].isEqual(t)
|
|
2946
2953
|
);
|
|
2947
2954
|
}
|
|
2948
|
-
function
|
|
2955
|
+
function fs(o, e) {
|
|
2949
2956
|
if (o.dimension !== e.dimension)
|
|
2950
2957
|
return !1;
|
|
2951
2958
|
const t = e.array[0].value / o.array[0].value;
|
|
@@ -2953,13 +2960,13 @@ function rs(o, e) {
|
|
|
2953
2960
|
(i, n) => e.array[n].value === i.value * t
|
|
2954
2961
|
);
|
|
2955
2962
|
}
|
|
2956
|
-
function
|
|
2963
|
+
function ds(o, e) {
|
|
2957
2964
|
return o.dimension !== e.dimension ? new u().invalid() : o.array.reduce(
|
|
2958
2965
|
(t, i, n) => t.add(i.clone().multiply(e.array[n])),
|
|
2959
2966
|
new u(0)
|
|
2960
2967
|
);
|
|
2961
2968
|
}
|
|
2962
|
-
function
|
|
2969
|
+
function ps(...o) {
|
|
2963
2970
|
if (o.some((e) => e.dimension !== o[0].dimension))
|
|
2964
2971
|
throw new Error("All vectors must have the same dimension");
|
|
2965
2972
|
if (o[0].dimension !== o.length)
|
|
@@ -2972,29 +2979,29 @@ function hs(...o) {
|
|
|
2972
2979
|
)
|
|
2973
2980
|
).add(o[0].array[2].clone().multiply(o[1].array[0].clone().multiply(o[2].array[1]).subtract(o[1].array[1].clone().multiply(o[2].array[0]))));
|
|
2974
2981
|
}
|
|
2975
|
-
var
|
|
2976
|
-
const
|
|
2982
|
+
var j, Ve;
|
|
2983
|
+
const De = class De {
|
|
2977
2984
|
constructor(...e) {
|
|
2978
|
-
m(this,
|
|
2979
|
-
m(this,
|
|
2980
|
-
a(this, "zero", () => (s(this,
|
|
2985
|
+
m(this, j, []);
|
|
2986
|
+
m(this, Ve, !1);
|
|
2987
|
+
a(this, "zero", () => (s(this, j).forEach((e) => e.zero()), this));
|
|
2981
2988
|
a(this, "one", () => (this.zero(), this.x.one(), this));
|
|
2982
|
-
a(this, "opposite", () => (s(this,
|
|
2983
|
-
a(this, "add", (e) => (s(this,
|
|
2989
|
+
a(this, "opposite", () => (s(this, j).forEach((e) => e.opposite()), this));
|
|
2990
|
+
a(this, "add", (e) => (s(this, j).forEach((t, i) => t.add(e.array[i])), this));
|
|
2984
2991
|
a(this, "subtract", (e) => this.add(e.clone().opposite()));
|
|
2985
2992
|
a(this, "unit", () => {
|
|
2986
2993
|
const e = this.norm;
|
|
2987
2994
|
return e === 0 ? this : this.divideByScalar(e);
|
|
2988
2995
|
});
|
|
2989
|
-
a(this, "dot", (e) =>
|
|
2996
|
+
a(this, "dot", (e) => ds(this, e));
|
|
2990
2997
|
a(this, "normal", () => {
|
|
2991
2998
|
if (this.dimension >= 3)
|
|
2992
2999
|
throw new Error("Normal vector can only be determined in 2D");
|
|
2993
3000
|
const e = this.x.clone().opposite(), t = this.y.clone();
|
|
2994
|
-
return s(this,
|
|
3001
|
+
return s(this, j)[0] = t, s(this, j)[1] = e, this;
|
|
2995
3002
|
});
|
|
2996
|
-
a(this, "isEqual", (e) =>
|
|
2997
|
-
a(this, "isColinearTo", (e) =>
|
|
3003
|
+
a(this, "isEqual", (e) => us(this, e));
|
|
3004
|
+
a(this, "isColinearTo", (e) => fs(this, e));
|
|
2998
3005
|
a(this, "isNormalTo", (e) => this.dot(e).isZero());
|
|
2999
3006
|
a(this, "multiplyByScalar", (e) => {
|
|
3000
3007
|
const t = new u(e);
|
|
@@ -3002,9 +3009,9 @@ const Be = class Be {
|
|
|
3002
3009
|
});
|
|
3003
3010
|
a(this, "divideByScalar", (e) => this.multiplyByScalar(new u(e).inverse()));
|
|
3004
3011
|
a(this, "simplify", () => this.multiplyByScalar(
|
|
3005
|
-
|
|
3012
|
+
G.lcm(...this.array.map((e) => e.denominator))
|
|
3006
3013
|
).divideByScalar(
|
|
3007
|
-
|
|
3014
|
+
G.gcd(...this.array.map((e) => e.numerator))
|
|
3008
3015
|
).multiplyByScalar(
|
|
3009
3016
|
this.x.isNegative() ? -1 : 1
|
|
3010
3017
|
));
|
|
@@ -3015,7 +3022,7 @@ const Be = class Be {
|
|
|
3015
3022
|
a(this, "fromString", (e) => {
|
|
3016
3023
|
e.startsWith("(") && (e = e.substring(1)), e.endsWith(")") && (e = e.substring(0, e.length - 1));
|
|
3017
3024
|
const t = e.split(/[,;\s]/g).filter((i) => i.trim() !== "");
|
|
3018
|
-
return t.length < 2 ? this : (h(this,
|
|
3025
|
+
return t.length < 2 ? this : (h(this, j, t.map((i) => new u(i))), this);
|
|
3019
3026
|
});
|
|
3020
3027
|
e.length > 0 && this.parse(...e);
|
|
3021
3028
|
}
|
|
@@ -3023,38 +3030,38 @@ const Be = class Be {
|
|
|
3023
3030
|
// Getter and setter
|
|
3024
3031
|
// ------------------------------------------
|
|
3025
3032
|
get array() {
|
|
3026
|
-
return s(this,
|
|
3033
|
+
return s(this, j);
|
|
3027
3034
|
}
|
|
3028
3035
|
set array(e) {
|
|
3029
|
-
h(this,
|
|
3036
|
+
h(this, j, e);
|
|
3030
3037
|
}
|
|
3031
3038
|
get x() {
|
|
3032
|
-
return s(this,
|
|
3039
|
+
return s(this, j)[0];
|
|
3033
3040
|
}
|
|
3034
3041
|
set x(e) {
|
|
3035
|
-
s(this,
|
|
3042
|
+
s(this, j)[0] = new u(e);
|
|
3036
3043
|
}
|
|
3037
3044
|
get y() {
|
|
3038
|
-
return s(this,
|
|
3045
|
+
return s(this, j)[1];
|
|
3039
3046
|
}
|
|
3040
3047
|
set y(e) {
|
|
3041
|
-
s(this,
|
|
3048
|
+
s(this, j)[1] = new u(e);
|
|
3042
3049
|
}
|
|
3043
3050
|
get z() {
|
|
3044
3051
|
if (this.dimension < 3)
|
|
3045
3052
|
throw new Error("Vector is not 3D");
|
|
3046
|
-
return s(this,
|
|
3053
|
+
return s(this, j)[2];
|
|
3047
3054
|
}
|
|
3048
3055
|
set z(e) {
|
|
3049
3056
|
if (this.dimension < 3)
|
|
3050
3057
|
throw new Error("Vector is not 3D");
|
|
3051
|
-
s(this,
|
|
3058
|
+
s(this, j)[2] = new u(e);
|
|
3052
3059
|
}
|
|
3053
3060
|
get asPoint() {
|
|
3054
|
-
return s(this,
|
|
3061
|
+
return s(this, Ve);
|
|
3055
3062
|
}
|
|
3056
3063
|
set asPoint(e) {
|
|
3057
|
-
h(this,
|
|
3064
|
+
h(this, Ve, e);
|
|
3058
3065
|
}
|
|
3059
3066
|
get normSquare() {
|
|
3060
3067
|
return this.array.reduce((e, t) => e.add(t.clone().pow(2)), new u(0));
|
|
@@ -3063,19 +3070,19 @@ const Be = class Be {
|
|
|
3063
3070
|
return Math.sqrt(this.normSquare.value);
|
|
3064
3071
|
}
|
|
3065
3072
|
get tex() {
|
|
3066
|
-
return s(this,
|
|
3073
|
+
return s(this, Ve) ? `\\left(${this.array.map((e) => e.tex).join(";")}\\right)` : `\\begin{pmatrix} ${this.array.map((e) => e.tex).join(" \\\\ ")} \\end{pmatrix}`;
|
|
3067
3074
|
}
|
|
3068
3075
|
get display() {
|
|
3069
|
-
return s(this,
|
|
3076
|
+
return s(this, Ve) ? `(${this.array.map((e) => e.display).join(";")})` : `((${this.array.map((e) => e.display).join(",")}))`;
|
|
3070
3077
|
}
|
|
3071
3078
|
setDimension(e = 2) {
|
|
3072
3079
|
if (e < 2)
|
|
3073
3080
|
throw new Error("Dimension must be at least 2");
|
|
3074
3081
|
if (e < this.dimension)
|
|
3075
|
-
h(this,
|
|
3082
|
+
h(this, j, s(this, j).slice(0, e));
|
|
3076
3083
|
else if (e > this.dimension)
|
|
3077
3084
|
for (let t = this.dimension; t < e; t++)
|
|
3078
|
-
s(this,
|
|
3085
|
+
s(this, j).push(new u(0));
|
|
3079
3086
|
return this;
|
|
3080
3087
|
}
|
|
3081
3088
|
get dimension() {
|
|
@@ -3094,13 +3101,13 @@ const Be = class Be {
|
|
|
3094
3101
|
return `((${e.join(",")}))`;
|
|
3095
3102
|
}
|
|
3096
3103
|
defineAsPoint(e) {
|
|
3097
|
-
return h(this,
|
|
3104
|
+
return h(this, Ve, e !== !1), this;
|
|
3098
3105
|
}
|
|
3099
3106
|
parse(...e) {
|
|
3100
3107
|
if (e.length === 0)
|
|
3101
3108
|
throw new Error("Invalid value");
|
|
3102
3109
|
if (e.length === 1) {
|
|
3103
|
-
if (e[0] instanceof
|
|
3110
|
+
if (e[0] instanceof De)
|
|
3104
3111
|
return e[0].clone();
|
|
3105
3112
|
if (typeof e[0] == "string")
|
|
3106
3113
|
return this.fromString(e[0]);
|
|
@@ -3108,20 +3115,20 @@ const Be = class Be {
|
|
|
3108
3115
|
}
|
|
3109
3116
|
if (e.length === 2) {
|
|
3110
3117
|
const [t, i] = e;
|
|
3111
|
-
if (t instanceof
|
|
3118
|
+
if (t instanceof De && i instanceof De) {
|
|
3112
3119
|
if (t.dimension !== i.dimension)
|
|
3113
3120
|
throw new Error("Vectors must have the same dimension");
|
|
3114
|
-
return h(this,
|
|
3121
|
+
return h(this, j, i.array.map((n, r) => n.clone().subtract(t.array[r]))), this;
|
|
3115
3122
|
}
|
|
3116
3123
|
}
|
|
3117
|
-
return h(this,
|
|
3124
|
+
return h(this, j, e.map((t) => new u(t))), this;
|
|
3118
3125
|
}
|
|
3119
3126
|
clone() {
|
|
3120
|
-
const e = new
|
|
3127
|
+
const e = new De();
|
|
3121
3128
|
return e.array = this.copy(), e.asPoint = this.asPoint, e;
|
|
3122
3129
|
}
|
|
3123
3130
|
copy() {
|
|
3124
|
-
return s(this,
|
|
3131
|
+
return s(this, j).map((e) => e.clone());
|
|
3125
3132
|
}
|
|
3126
3133
|
middleOf(e, t) {
|
|
3127
3134
|
if (e.dimension !== t.dimension)
|
|
@@ -3136,7 +3143,7 @@ const Be = class Be {
|
|
|
3136
3143
|
cross(e) {
|
|
3137
3144
|
if (this.dimension !== 3 || e.dimension !== 3)
|
|
3138
3145
|
throw new Error("Cross product can only be determined in 3D");
|
|
3139
|
-
return new
|
|
3146
|
+
return new De(
|
|
3140
3147
|
this.y.clone().multiply(e.z).subtract(this.z.clone().multiply(e.y)),
|
|
3141
3148
|
this.z.clone().multiply(e.x).subtract(this.x.clone().multiply(e.z)),
|
|
3142
3149
|
this.x.clone().multiply(e.y).subtract(this.y.clone().multiply(e.x))
|
|
@@ -3149,7 +3156,7 @@ const Be = class Be {
|
|
|
3149
3156
|
return this.array.every((e, t) => t === 0 ? e.isOne() : e.isZero());
|
|
3150
3157
|
}
|
|
3151
3158
|
distanceTo(e) {
|
|
3152
|
-
const t = new
|
|
3159
|
+
const t = new De(this, e);
|
|
3153
3160
|
return {
|
|
3154
3161
|
value: t.norm,
|
|
3155
3162
|
fraction: t.normSquare,
|
|
@@ -3157,40 +3164,40 @@ const Be = class Be {
|
|
|
3157
3164
|
};
|
|
3158
3165
|
}
|
|
3159
3166
|
};
|
|
3160
|
-
|
|
3161
|
-
let E =
|
|
3162
|
-
var
|
|
3163
|
-
function
|
|
3167
|
+
j = new WeakMap(), Ve = new WeakMap();
|
|
3168
|
+
let E = De;
|
|
3169
|
+
var ve = /* @__PURE__ */ ((o) => (o.None = "none", o.Parallel = "parallel", o.Perpendicular = "perpendicular", o.Tangent = "tangent", o))(ve || {}), fi = /* @__PURE__ */ ((o) => (o.None = "none", o.Parallel = "parallel", o.Perpendicular = "perpendicular", o.Tangent = "tangent", o))(fi || {});
|
|
3170
|
+
function Ri(o = 0.5) {
|
|
3164
3171
|
return Math.random() < o;
|
|
3165
3172
|
}
|
|
3166
|
-
function
|
|
3173
|
+
function me(o, e, t) {
|
|
3167
3174
|
if (e === void 0)
|
|
3168
|
-
return o >= 0 ?
|
|
3175
|
+
return o >= 0 ? me(0, o) : me(o, 0);
|
|
3169
3176
|
if (o === e)
|
|
3170
3177
|
return o;
|
|
3171
3178
|
if (t === void 0)
|
|
3172
3179
|
return Math.floor(Math.random() * (e - o + 1) + o);
|
|
3173
3180
|
if (Math.abs(e - o) <= t.length)
|
|
3174
3181
|
throw new Error("The number of excluded values is too high.");
|
|
3175
|
-
let i =
|
|
3182
|
+
let i = me(o, e);
|
|
3176
3183
|
for (; t.includes(i); )
|
|
3177
|
-
i =
|
|
3184
|
+
i = me(o, e);
|
|
3178
3185
|
return i;
|
|
3179
3186
|
}
|
|
3180
|
-
function
|
|
3181
|
-
return e === !1 ?
|
|
3187
|
+
function H(o, e) {
|
|
3188
|
+
return e === !1 ? Ri() ? me(1, o) : -me(1, o) : me(-o, o);
|
|
3182
3189
|
}
|
|
3183
|
-
function
|
|
3184
|
-
let e =
|
|
3185
|
-
return o !== void 0 && (e = e.filter((t) => t < o)),
|
|
3190
|
+
function ms(o) {
|
|
3191
|
+
let e = G.primes();
|
|
3192
|
+
return o !== void 0 && (e = e.filter((t) => t < o)), bi(e);
|
|
3186
3193
|
}
|
|
3187
|
-
function
|
|
3188
|
-
return e === void 0 && (e = 1), o.length <= 0 ? Object.values(o) :
|
|
3194
|
+
function gs(o, e) {
|
|
3195
|
+
return e === void 0 && (e = 1), o.length <= 0 ? Object.values(o) : Di(o).slice(0, e);
|
|
3189
3196
|
}
|
|
3190
|
-
function
|
|
3191
|
-
return o.length === 0 ? null : o[
|
|
3197
|
+
function bi(o) {
|
|
3198
|
+
return o.length === 0 ? null : o[me(0, o.length - 1)];
|
|
3192
3199
|
}
|
|
3193
|
-
function
|
|
3200
|
+
function Di(o) {
|
|
3194
3201
|
const e = Object.values(o);
|
|
3195
3202
|
for (let t = e.length - 1; t > 0; t--) {
|
|
3196
3203
|
const i = Math.floor(Math.random() * (t + 1)), n = e[t];
|
|
@@ -3224,32 +3231,32 @@ class S extends E {
|
|
|
3224
3231
|
return e.array = this.copy(), e.asPoint = !0, e;
|
|
3225
3232
|
}
|
|
3226
3233
|
}
|
|
3227
|
-
var
|
|
3228
|
-
const
|
|
3234
|
+
var Ie, I, R, W, he, J, ze, Ee;
|
|
3235
|
+
const je = class je {
|
|
3229
3236
|
/**
|
|
3230
3237
|
* Value can be a mix of:
|
|
3231
3238
|
*
|
|
3232
3239
|
* @param values
|
|
3233
3240
|
*/
|
|
3234
3241
|
constructor(...e) {
|
|
3235
|
-
m(this,
|
|
3242
|
+
m(this, Ie);
|
|
3236
3243
|
// ax + by + c = 0
|
|
3237
|
-
m(this,
|
|
3238
|
-
m(this,
|
|
3244
|
+
m(this, I);
|
|
3245
|
+
m(this, R);
|
|
3239
3246
|
m(this, W);
|
|
3240
3247
|
m(this, he);
|
|
3241
3248
|
m(this, J);
|
|
3242
|
-
m(this,
|
|
3243
|
-
m(this,
|
|
3249
|
+
m(this, ze);
|
|
3250
|
+
m(this, Ee, "canonical");
|
|
3244
3251
|
a(this, "randomPoint", (e) => {
|
|
3245
|
-
const t = s(this, J).clone().multiplyByScalar(
|
|
3252
|
+
const t = s(this, J).clone().multiplyByScalar(H(e === void 0 || e <= 1 ? 3 : e, !1)).add(s(this, he));
|
|
3246
3253
|
return t.asPoint = !0, t;
|
|
3247
3254
|
});
|
|
3248
3255
|
a(this, "randomNearPoint", (e) => {
|
|
3249
3256
|
const t = this.randomPoint(e);
|
|
3250
3257
|
let i = 10;
|
|
3251
3258
|
for (; this.isOnLine(t) && i > 0; )
|
|
3252
|
-
t.x.add(
|
|
3259
|
+
t.x.add(H(1, !1)), t.y.add(H(1, !1)), i--;
|
|
3253
3260
|
return t;
|
|
3254
3261
|
});
|
|
3255
3262
|
// ------------------------------------------
|
|
@@ -3264,13 +3271,13 @@ const De = class De {
|
|
|
3264
3271
|
if (e.length === 0)
|
|
3265
3272
|
return this;
|
|
3266
3273
|
if (e.length === 1) {
|
|
3267
|
-
if (e[0] instanceof
|
|
3274
|
+
if (e[0] instanceof je)
|
|
3268
3275
|
return this.fromCoefficient(e[0].a, e[0].b, e[0].c);
|
|
3269
|
-
if (e[0] instanceof
|
|
3276
|
+
if (e[0] instanceof V)
|
|
3270
3277
|
return this.fromEquation(e[0]);
|
|
3271
3278
|
if (typeof e[0] == "string")
|
|
3272
3279
|
try {
|
|
3273
|
-
const t = new
|
|
3280
|
+
const t = new V(e[0]);
|
|
3274
3281
|
return this.parse(t);
|
|
3275
3282
|
} catch {
|
|
3276
3283
|
return this;
|
|
@@ -3285,12 +3292,12 @@ const De = class De {
|
|
|
3285
3292
|
}
|
|
3286
3293
|
if (e.length === 3) {
|
|
3287
3294
|
if (e[0] instanceof E && e[1] instanceof E) {
|
|
3288
|
-
if (e[2] ===
|
|
3295
|
+
if (e[2] === ve.Perpendicular)
|
|
3289
3296
|
return this.fromPointAndNormal(e[0], e[1]);
|
|
3290
|
-
if (e[2] ===
|
|
3297
|
+
if (e[2] === ve.Parallel)
|
|
3291
3298
|
return this.fromPointAndDirection(e[0], e[1]);
|
|
3292
3299
|
}
|
|
3293
|
-
return e[0] instanceof E && e[1] instanceof
|
|
3300
|
+
return e[0] instanceof E && e[1] instanceof je ? e[2] === ve.Parallel || e[2] === null ? this.fromPointAndLine(e[0], e[1], ve.Parallel) : this.fromPointAndLine(e[0], e[1], ve.Perpendicular) : this.fromCoefficient(
|
|
3294
3301
|
e[0],
|
|
3295
3302
|
e[1],
|
|
3296
3303
|
e[2]
|
|
@@ -3311,34 +3318,34 @@ const De = class De {
|
|
|
3311
3318
|
e.left.monomByDegree(0).coefficient
|
|
3312
3319
|
);
|
|
3313
3320
|
});
|
|
3314
|
-
a(this, "fromCoefficient", (e, t, i) => (h(this,
|
|
3321
|
+
a(this, "fromCoefficient", (e, t, i) => (h(this, I, new u(e)), h(this, R, new u(t)), h(this, W, new u(i)), h(this, J, new E(s(this, R).clone(), s(this, I).clone().opposite())), h(this, he, new E(new u().zero(), s(this, W).clone())), h(this, ze, s(this, J).clone().normal()), this));
|
|
3315
3322
|
a(this, "fromPointAndDirection", (e, t) => (this.fromCoefficient(
|
|
3316
3323
|
t.y,
|
|
3317
3324
|
t.x.clone().opposite(),
|
|
3318
3325
|
e.x.clone().multiply(t.y).subtract(e.y.clone().multiply(t.x)).opposite()
|
|
3319
|
-
), h(this, he, e.clone()), h(this, J, t.clone()), h(this,
|
|
3326
|
+
), h(this, he, e.clone()), h(this, J, t.clone()), h(this, ze, s(this, J).clone().normal()), this));
|
|
3320
3327
|
a(this, "fromPointAndNormal", (e, t) => this.fromCoefficient(
|
|
3321
3328
|
t.x,
|
|
3322
3329
|
t.y,
|
|
3323
3330
|
e.x.clone().multiply(t.x).add(e.y.clone().multiply(t.y)).opposite()
|
|
3324
3331
|
));
|
|
3325
|
-
a(this, "fromPointAndLine", (e, t, i) => (i === void 0 && (i =
|
|
3326
|
-
a(this, "clone", () => (h(this,
|
|
3332
|
+
a(this, "fromPointAndLine", (e, t, i) => (i === void 0 && (i = ve.Parallel), i === ve.Parallel ? this.fromPointAndNormal(e, t.normal) : i === ve.Perpendicular ? this.fromPointAndNormal(e, t.director) : this));
|
|
3333
|
+
a(this, "clone", () => (h(this, I, s(this, I).clone()), h(this, R, s(this, R).clone()), h(this, W, s(this, W).clone()), h(this, J, s(this, J).clone()), h(this, he, s(this, he).clone()), h(this, ze, s(this, ze).clone()), this));
|
|
3327
3334
|
// ------------------------------------------
|
|
3328
3335
|
// Mathematical operations
|
|
3329
3336
|
// ------------------------------------------
|
|
3330
|
-
a(this, "isOnLine", (e) => s(this,
|
|
3331
|
-
s(this,
|
|
3337
|
+
a(this, "isOnLine", (e) => s(this, I).clone().multiply(e.x).add(
|
|
3338
|
+
s(this, R).clone().multiply(e.y)
|
|
3332
3339
|
).add(s(this, W)).isZero());
|
|
3333
3340
|
a(this, "isParallelTo", (e) => this.slope.isEqual(e.slope) && this.height.isNotEqual(e.height));
|
|
3334
3341
|
a(this, "isSameAs", (e) => this.slope.isEqual(e.slope) && this.height.isEqual(e.height));
|
|
3335
3342
|
a(this, "isPerpendicularTo", (e) => this.d.isNormalTo(e.d));
|
|
3336
3343
|
a(this, "isVertical", () => this.slope.isInfinity());
|
|
3337
3344
|
a(this, "simplify", () => {
|
|
3338
|
-
const e =
|
|
3345
|
+
const e = G.lcm(s(this, I).denominator, s(this, R).denominator, s(this, W).denominator), t = G.gcd(s(this, I).numerator, s(this, R).numerator, s(this, W).numerator);
|
|
3339
3346
|
return this.fromCoefficient(
|
|
3340
|
-
s(this,
|
|
3341
|
-
s(this,
|
|
3347
|
+
s(this, I).clone().multiply(e).divide(t),
|
|
3348
|
+
s(this, R).clone().multiply(e).divide(t),
|
|
3342
3349
|
s(this, W).clone().multiply(e).divide(t)
|
|
3343
3350
|
), this;
|
|
3344
3351
|
});
|
|
@@ -3346,7 +3353,7 @@ const De = class De {
|
|
|
3346
3353
|
a(this, "intersection", (e) => {
|
|
3347
3354
|
const t = new S();
|
|
3348
3355
|
let i = !1, n = !1;
|
|
3349
|
-
return s(this,
|
|
3356
|
+
return s(this, R).isZero() || e.b.isZero(), this.isParallelTo(e) ? (t.x = new u().invalid(), t.y = new u().invalid(), i = !0) : this.isSameAs(e) ? (t.x = new u().invalid(), t.y = new u().invalid(), n = !0) : (t.x = s(this, R).clone().multiply(e.c).subtract(s(this, W).clone().multiply(e.b)).divide(s(this, I).clone().multiply(e.b).subtract(s(this, R).clone().multiply(e.a))), t.y = s(this, I).clone().multiply(e.c).subtract(s(this, W).clone().multiply(e.a)).divide(s(this, R).clone().multiply(e.a).subtract(s(this, I).clone().multiply(e.b)))), {
|
|
3350
3357
|
point: t,
|
|
3351
3358
|
hasIntersection: !(i || n),
|
|
3352
3359
|
isParallel: i,
|
|
@@ -3355,27 +3362,27 @@ const De = class De {
|
|
|
3355
3362
|
});
|
|
3356
3363
|
a(this, "getValueAtX", (e) => {
|
|
3357
3364
|
const t = this.getEquation().isolate("y"), i = new u(e);
|
|
3358
|
-
return t instanceof
|
|
3365
|
+
return t instanceof V ? t.right.evaluate({ x: i }) : new u().invalid();
|
|
3359
3366
|
});
|
|
3360
3367
|
a(this, "getValueAtY", (e) => {
|
|
3361
3368
|
const t = this.getEquation().isolate("x"), i = new u(e);
|
|
3362
|
-
return t instanceof
|
|
3369
|
+
return t instanceof V ? t.right.evaluate({ y: i }) : new u().invalid();
|
|
3363
3370
|
});
|
|
3364
|
-
return h(this,
|
|
3371
|
+
return h(this, I, new u().zero()), h(this, R, new u().zero()), h(this, W, new u().zero()), h(this, he, new E()), h(this, J, new E()), h(this, ze, new E()), h(this, Ie, !0), e.length > 0 && this.parse(...e), this;
|
|
3365
3372
|
}
|
|
3366
3373
|
get a() {
|
|
3367
|
-
return s(this,
|
|
3374
|
+
return s(this, I);
|
|
3368
3375
|
}
|
|
3369
3376
|
// ------------------------------------------
|
|
3370
3377
|
// Getter and setter
|
|
3371
3378
|
set a(e) {
|
|
3372
|
-
h(this,
|
|
3379
|
+
h(this, I, e);
|
|
3373
3380
|
}
|
|
3374
3381
|
get b() {
|
|
3375
|
-
return s(this,
|
|
3382
|
+
return s(this, R);
|
|
3376
3383
|
}
|
|
3377
3384
|
set b(e) {
|
|
3378
|
-
h(this,
|
|
3385
|
+
h(this, R, e);
|
|
3379
3386
|
}
|
|
3380
3387
|
get c() {
|
|
3381
3388
|
return s(this, W);
|
|
@@ -3396,12 +3403,12 @@ const De = class De {
|
|
|
3396
3403
|
h(this, J, e);
|
|
3397
3404
|
}
|
|
3398
3405
|
get n() {
|
|
3399
|
-
return s(this,
|
|
3406
|
+
return s(this, ze);
|
|
3400
3407
|
}
|
|
3401
3408
|
// ------------------------------------------
|
|
3402
3409
|
getEquation() {
|
|
3403
|
-
const e = new
|
|
3404
|
-
return s(this,
|
|
3410
|
+
const e = new V(new N().parse("xy", s(this, I), s(this, R), s(this, W)), new N("0"));
|
|
3411
|
+
return s(this, Ie) ? e.simplify() : e;
|
|
3405
3412
|
}
|
|
3406
3413
|
// get system(): { x: Equation, y: Equation } {
|
|
3407
3414
|
// const e1 = new Equation(
|
|
@@ -3417,81 +3424,81 @@ const De = class De {
|
|
|
3417
3424
|
// return { x: e1, y: e2 }
|
|
3418
3425
|
// }
|
|
3419
3426
|
get canonical() {
|
|
3420
|
-
return h(this,
|
|
3427
|
+
return h(this, Ee, "canonical"), this;
|
|
3421
3428
|
}
|
|
3422
3429
|
get equation() {
|
|
3423
|
-
return h(this,
|
|
3430
|
+
return h(this, Ee, "equation"), this;
|
|
3424
3431
|
}
|
|
3425
3432
|
get mxh() {
|
|
3426
|
-
return h(this,
|
|
3433
|
+
return h(this, Ee, "mxh"), this;
|
|
3427
3434
|
}
|
|
3428
3435
|
get parametric() {
|
|
3429
|
-
return h(this,
|
|
3436
|
+
return h(this, Ee, "parametric"), this;
|
|
3430
3437
|
}
|
|
3431
3438
|
get system() {
|
|
3432
|
-
return h(this,
|
|
3439
|
+
return h(this, Ee, "system"), this;
|
|
3433
3440
|
}
|
|
3434
3441
|
get tex() {
|
|
3435
|
-
const e = s(this,
|
|
3436
|
-
switch (h(this,
|
|
3442
|
+
const e = s(this, Ee);
|
|
3443
|
+
switch (h(this, Ee, "canonical"), e) {
|
|
3437
3444
|
case "equation":
|
|
3438
3445
|
return this.getEquation().reorder().tex;
|
|
3439
3446
|
case "mxh":
|
|
3440
|
-
return this.slope.isInfinity() ? "x=" + this.OA.x.tex : "y=" + new
|
|
3447
|
+
return this.slope.isInfinity() ? "x=" + this.OA.x.tex : "y=" + new N().parse("x", this.slope, this.height).tex;
|
|
3441
3448
|
case "parametric":
|
|
3442
3449
|
case "system": {
|
|
3443
3450
|
const t = s(this, J).clone();
|
|
3444
|
-
return s(this,
|
|
3445
|
-
x &= ${new
|
|
3446
|
-
y &= ${new
|
|
3451
|
+
return s(this, Ie) && t.simplify(), e === "parametric" ? `${E.asTex("x", "y")} = ${E.asTex(s(this, he).x.tex, s(this, he).y.tex)} + k\\cdot ${E.asTex(t.x.tex, t.y.tex)}` : `\\left\\{\\begin{aligned}
|
|
3452
|
+
x &= ${new N(s(this, he).x).add(new k(s(this, J).x).multiply(new k("k"))).reorder("k", !0).tex}\\\\
|
|
3453
|
+
y &= ${new N(s(this, he).y).add(new k(s(this, J).y).multiply(new k("k"))).reorder("k", !0).tex}
|
|
3447
3454
|
\\end{aligned}\\right.`;
|
|
3448
3455
|
}
|
|
3449
3456
|
default: {
|
|
3450
3457
|
const t = this.getEquation();
|
|
3451
|
-
return s(this,
|
|
3458
|
+
return s(this, I).isNegative() && t.multiply(-1), t.tex;
|
|
3452
3459
|
}
|
|
3453
3460
|
}
|
|
3454
3461
|
}
|
|
3455
3462
|
get reduceBeforeDisplay() {
|
|
3456
|
-
return s(this,
|
|
3463
|
+
return s(this, Ie);
|
|
3457
3464
|
}
|
|
3458
3465
|
set reduceBeforeDisplay(e) {
|
|
3459
|
-
h(this,
|
|
3466
|
+
h(this, Ie, e);
|
|
3460
3467
|
}
|
|
3461
3468
|
get display() {
|
|
3462
|
-
const e = s(this,
|
|
3463
|
-
switch (h(this,
|
|
3469
|
+
const e = s(this, Ee);
|
|
3470
|
+
switch (h(this, Ee, "canonical"), e) {
|
|
3464
3471
|
case "equation":
|
|
3465
3472
|
return this.getEquation().reorder().display;
|
|
3466
3473
|
case "mxh":
|
|
3467
|
-
return this.slope.isInfinity() ? "x=" + this.OA.x.display : "y=" + new
|
|
3474
|
+
return this.slope.isInfinity() ? "x=" + this.OA.x.display : "y=" + new N().parse("x", this.slope, this.height).display;
|
|
3468
3475
|
case "parametric": {
|
|
3469
3476
|
const t = s(this, J).clone();
|
|
3470
|
-
return s(this,
|
|
3477
|
+
return s(this, Ie) && t.simplify(), `((x,y))=((${s(this, he).x.display},${s(this, he).y.display}))+k((${t.x.display},${t.y.display}))`;
|
|
3471
3478
|
}
|
|
3472
3479
|
default: {
|
|
3473
3480
|
const t = this.getEquation();
|
|
3474
|
-
return s(this,
|
|
3481
|
+
return s(this, I).isNegative() && t.multiply(-1), t.display;
|
|
3475
3482
|
}
|
|
3476
3483
|
}
|
|
3477
3484
|
}
|
|
3478
3485
|
get normal() {
|
|
3479
|
-
return new E(s(this,
|
|
3486
|
+
return new E(s(this, I), s(this, R));
|
|
3480
3487
|
}
|
|
3481
3488
|
get director() {
|
|
3482
3489
|
return s(this, J).clone();
|
|
3483
3490
|
}
|
|
3484
3491
|
get slope() {
|
|
3485
|
-
return s(this,
|
|
3492
|
+
return s(this, I).clone().opposite().divide(s(this, R));
|
|
3486
3493
|
}
|
|
3487
3494
|
get height() {
|
|
3488
|
-
return s(this, W).clone().opposite().divide(s(this,
|
|
3495
|
+
return s(this, W).clone().opposite().divide(s(this, R));
|
|
3489
3496
|
}
|
|
3490
3497
|
fromPoints(e, t) {
|
|
3491
3498
|
return this.fromPointAndDirection(e, new E(e, t));
|
|
3492
3499
|
}
|
|
3493
3500
|
distanceTo(e) {
|
|
3494
|
-
const t = e.x.clone().multiply(s(this,
|
|
3501
|
+
const t = e.x.clone().multiply(s(this, I)).add(e.y.clone().multiply(s(this, R))).add(s(this, W)).abs(), i = this.normal.normSquare;
|
|
3495
3502
|
if (i.isZero())
|
|
3496
3503
|
return {
|
|
3497
3504
|
value: NaN,
|
|
@@ -3511,7 +3518,7 @@ const De = class De {
|
|
|
3511
3518
|
}
|
|
3512
3519
|
hitSegment(e, t) {
|
|
3513
3520
|
const i = this.intersection(
|
|
3514
|
-
new
|
|
3521
|
+
new je().fromPoints(e, t)
|
|
3515
3522
|
);
|
|
3516
3523
|
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) : !1;
|
|
3517
3524
|
}
|
|
@@ -3521,44 +3528,44 @@ const De = class De {
|
|
|
3521
3528
|
canonicalAsFloatCoefficient(e) {
|
|
3522
3529
|
e === void 0 && (e = 2);
|
|
3523
3530
|
let t = "";
|
|
3524
|
-
return s(this,
|
|
3531
|
+
return s(this, I).isZero() || (s(this, I).isOne() ? t = "x" : s(this, I).clone().opposite().isOne() ? t = "-x" : t = s(this, I).value.toFixed(e) + "x"), s(this, R).isZero() || (s(this, R).isPositive() && (t += "+"), t += s(this, R).value.toFixed(e) + "y"), s(this, W).isZero() || (s(this, W).isPositive() && (t += "+"), t += s(this, W).value.toFixed(e)), t + "=0";
|
|
3525
3532
|
}
|
|
3526
3533
|
};
|
|
3527
|
-
|
|
3528
|
-
a(
|
|
3529
|
-
let
|
|
3530
|
-
var ae,
|
|
3531
|
-
const
|
|
3534
|
+
Ie = new WeakMap(), I = new WeakMap(), R = new WeakMap(), W = new WeakMap(), he = new WeakMap(), J = new WeakMap(), ze = new WeakMap(), Ee = new WeakMap(), // A line is defined as the canonical form
|
|
3535
|
+
a(je, "PERPENDICULAR", ve.Perpendicular), a(je, "PARALLEL", ve.Parallel);
|
|
3536
|
+
let z = je;
|
|
3537
|
+
var ae, U, Me, Ht, Kt, Jt, le, Li, kt, Zi, Vi, Fi, di;
|
|
3538
|
+
const _t = class _t {
|
|
3532
3539
|
constructor(...e) {
|
|
3533
3540
|
m(this, le);
|
|
3534
3541
|
m(this, ae);
|
|
3535
|
-
m(this,
|
|
3536
|
-
m(this,
|
|
3542
|
+
m(this, U);
|
|
3543
|
+
m(this, Me);
|
|
3537
3544
|
/**
|
|
3538
3545
|
* Get the relative position between circle and line. It corresponds to the number of intersection.
|
|
3539
3546
|
* @param {Line} L
|
|
3540
3547
|
* @returns {number}
|
|
3541
3548
|
*/
|
|
3542
3549
|
a(this, "relativePosition", (e) => {
|
|
3543
|
-
if (s(this, ae) === void 0 || s(this,
|
|
3550
|
+
if (s(this, ae) === void 0 || s(this, U) === void 0)
|
|
3544
3551
|
throw new Error("Circle not defined");
|
|
3545
|
-
const t = e.distanceTo(s(this, ae)), i = Math.sqrt(s(this,
|
|
3552
|
+
const t = e.distanceTo(s(this, ae)), i = Math.sqrt(s(this, U).value);
|
|
3546
3553
|
return t.value - i > 1e-10 ? 0 : Math.abs(t.value - i) < 1e-10 ? 1 : 2;
|
|
3547
3554
|
});
|
|
3548
3555
|
a(this, "lineIntersection", (e) => {
|
|
3549
3556
|
const t = [];
|
|
3550
|
-
if (s(this,
|
|
3557
|
+
if (s(this, Me) === void 0)
|
|
3551
3558
|
return [];
|
|
3552
|
-
const i = s(this,
|
|
3553
|
-
return n instanceof
|
|
3559
|
+
const i = s(this, Me).clone(), n = e.getEquation().clone().isolate("x"), r = e.getEquation().clone().isolate("y");
|
|
3560
|
+
return n instanceof V && r instanceof V && (i.replaceBy("y", r.right).simplify(), i.solve()), t;
|
|
3554
3561
|
});
|
|
3555
|
-
a(this, "tangents", (e) => e instanceof u ? s(this,
|
|
3562
|
+
a(this, "tangents", (e) => e instanceof u ? s(this, Jt).call(this, e) : this.isPointOnCircle(e) ? s(this, Ht).call(this, e) : s(this, ae) !== void 0 && s(this, ae).distanceTo(e).value > this.radius.value ? s(this, Kt).call(this, e) : (console.log("No tangents as the point is inside !"), []));
|
|
3556
3563
|
a(this, "isPointOnCircle", (e) => {
|
|
3557
3564
|
var t;
|
|
3558
|
-
return ((t = s(this,
|
|
3565
|
+
return ((t = s(this, Me)) == null ? void 0 : t.test({ x: e.x, y: e.y })) ?? !1;
|
|
3559
3566
|
});
|
|
3560
3567
|
a(this, "getPointsOnCircle", (e) => {
|
|
3561
|
-
const t =
|
|
3568
|
+
const t = G.pythagoreanTripletsWithTarget(this.squareRadius.value, !0), i = [];
|
|
3562
3569
|
return t.forEach((n) => {
|
|
3563
3570
|
for (const r of [[1, 1], [-1, 1], [-1, -1], [1, -1]])
|
|
3564
3571
|
i.push(
|
|
@@ -3569,21 +3576,21 @@ const Ht = class Ht {
|
|
|
3569
3576
|
);
|
|
3570
3577
|
}), i;
|
|
3571
3578
|
});
|
|
3572
|
-
m(this,
|
|
3579
|
+
m(this, Ht, (e) => {
|
|
3573
3580
|
const t = new E(this.center, e);
|
|
3574
|
-
return [new
|
|
3581
|
+
return [new z(e, t, ve.Perpendicular)];
|
|
3575
3582
|
});
|
|
3576
|
-
m(this,
|
|
3577
|
-
const t = this.center.x.clone().subtract(e.x), i = this.center.y.clone().subtract(e.y), n = new
|
|
3578
|
-
return n.multiply(t).subtract(i).pow(2), r.multiply(this.squareRadius), new
|
|
3583
|
+
m(this, Kt, (e) => {
|
|
3584
|
+
const t = this.center.x.clone().subtract(e.x), i = this.center.y.clone().subtract(e.y), n = new N("x"), r = new N("x^2+1");
|
|
3585
|
+
return n.multiply(t).subtract(i).pow(2), r.multiply(this.squareRadius), new V(n, r).solve().map((f) => {
|
|
3579
3586
|
let d;
|
|
3580
|
-
const p = new
|
|
3581
|
-
return f.exact instanceof u ? (d = e.x.clone().opposite().multiply(f.exact).add(e.y), p.right.multiply(f.exact).add(d)) : (d = e.x.clone().opposite().multiply(f.value).add(e.y), p.right.multiply(f.value).add(d)), new
|
|
3587
|
+
const p = new V("y", "x");
|
|
3588
|
+
return f.exact instanceof u ? (d = e.x.clone().opposite().multiply(f.exact).add(e.y), p.right.multiply(f.exact).add(d)) : (d = e.x.clone().opposite().multiply(f.value).add(e.y), p.right.multiply(f.value).add(d)), new z(p);
|
|
3582
3589
|
});
|
|
3583
3590
|
});
|
|
3584
|
-
m(this,
|
|
3591
|
+
m(this, Jt, (e) => {
|
|
3585
3592
|
const t = e.numerator, i = -e.denominator, n = this.center.x.clone(), r = this.center.y.clone(), l = this.squareRadius.clone().multiply(e.numerator ** 2 + e.denominator ** 2), c = n.clone().multiply(t).opposite().subtract(r.clone().multiply(i)).add(l.clone().sqrt()), f = n.clone().multiply(t).opposite().subtract(r.clone().multiply(i)).subtract(l.clone().sqrt());
|
|
3586
|
-
return [new
|
|
3593
|
+
return [new z(t, i, c), new z(t, i, f)];
|
|
3587
3594
|
});
|
|
3588
3595
|
e.length > 0 && this.parse(...e);
|
|
3589
3596
|
}
|
|
@@ -3591,22 +3598,22 @@ const Ht = class Ht {
|
|
|
3591
3598
|
return s(this, ae) ?? new S();
|
|
3592
3599
|
}
|
|
3593
3600
|
get squareRadius() {
|
|
3594
|
-
return s(this,
|
|
3601
|
+
return s(this, U) ?? new u(0);
|
|
3595
3602
|
}
|
|
3596
3603
|
get cartesian() {
|
|
3597
|
-
if (s(this,
|
|
3604
|
+
if (s(this, Me) === void 0)
|
|
3598
3605
|
throw new Error("Cartesian equation not defined");
|
|
3599
|
-
return s(this,
|
|
3606
|
+
return s(this, Me);
|
|
3600
3607
|
}
|
|
3601
3608
|
get radius() {
|
|
3602
|
-
return s(this,
|
|
3603
|
-
tex: s(this,
|
|
3604
|
-
display: s(this,
|
|
3605
|
-
value: s(this,
|
|
3609
|
+
return s(this, U) === void 0 ? { tex: "", display: "", value: 0 } : s(this, U).isSquare() ? {
|
|
3610
|
+
tex: s(this, U).clone().sqrt().tex,
|
|
3611
|
+
display: s(this, U).clone().sqrt().display,
|
|
3612
|
+
value: s(this, U).clone().sqrt().value
|
|
3606
3613
|
} : {
|
|
3607
|
-
tex: `\\sqrt{${s(this,
|
|
3608
|
-
display: `sqrt(${s(this,
|
|
3609
|
-
value: s(this,
|
|
3614
|
+
tex: `\\sqrt{${s(this, U).tex}}`,
|
|
3615
|
+
display: `sqrt(${s(this, U).display})`,
|
|
3616
|
+
value: s(this, U).clone().sqrt().value
|
|
3610
3617
|
};
|
|
3611
3618
|
}
|
|
3612
3619
|
get tex() {
|
|
@@ -3621,17 +3628,17 @@ const Ht = class Ht {
|
|
|
3621
3628
|
return this.center.x.isZero() ? e = "x^2" : e = `(x${this.center.x.isNegative() ? "+" : "-"}${this.center.x.clone().abs().tex})^2`, this.center.y.isZero() ? t = "y^2" : t = `(y${this.center.y.isNegative() ? "+" : "-"}${this.center.y.clone().abs().tex})^2`, `${e}+${t}=${this.squareRadius.display}`;
|
|
3622
3629
|
}
|
|
3623
3630
|
clone() {
|
|
3624
|
-
return new
|
|
3631
|
+
return new _t(
|
|
3625
3632
|
this.center.clone(),
|
|
3626
3633
|
this.squareRadius.clone(),
|
|
3627
3634
|
!0
|
|
3628
3635
|
);
|
|
3629
3636
|
}
|
|
3630
3637
|
setRadius(e, t) {
|
|
3631
|
-
return t ? h(this,
|
|
3638
|
+
return t ? h(this, U, new u(e)) : h(this, U, new u(e).pow(2)), A(this, le, kt).call(this), this;
|
|
3632
3639
|
}
|
|
3633
3640
|
parse(...e) {
|
|
3634
|
-
return A(this, le,
|
|
3641
|
+
return A(this, le, Li).call(this), typeof e[0] == "string" ? A(this, le, di).call(this, new V(e[0])) : e[0] instanceof V ? A(this, le, di).call(this, e[0]) : e[0] instanceof _t ? A(this, le, Zi).call(this, e[0]) : e[0] instanceof S && e.length > 1 && (e[1] instanceof S ? e[2] instanceof S || A(this, le, Fi).call(this, e[0], e[1]) : (e[1] instanceof u || typeof e[1] == "number") && A(this, le, Vi).call(this, e[0], e[1], typeof e[2] == "boolean" ? e[2] : !1)), A(this, le, kt).call(this), this;
|
|
3635
3642
|
}
|
|
3636
3643
|
// private _parseThroughtThreePoints(A: Point, B: Point, C: Point): this {
|
|
3637
3644
|
// const T = new Triangle(A, B, C), mAB = T.remarquables.mediators.AB.clone(),
|
|
@@ -3640,35 +3647,35 @@ const Ht = class Ht {
|
|
|
3640
3647
|
// return this
|
|
3641
3648
|
// }
|
|
3642
3649
|
};
|
|
3643
|
-
ae = new WeakMap(),
|
|
3644
|
-
return h(this, ae, void 0), h(this,
|
|
3645
|
-
},
|
|
3646
|
-
h(this,
|
|
3647
|
-
new
|
|
3648
|
-
new
|
|
3650
|
+
ae = new WeakMap(), U = new WeakMap(), Me = new WeakMap(), Ht = new WeakMap(), Kt = new WeakMap(), Jt = new WeakMap(), le = new WeakSet(), Li = function() {
|
|
3651
|
+
return h(this, ae, void 0), h(this, U, void 0), h(this, Me, void 0), this;
|
|
3652
|
+
}, kt = function() {
|
|
3653
|
+
h(this, Me, new V(
|
|
3654
|
+
new N(`(x-(${this.center.x.display}))^2+(y-(${this.center.y.display}))^2`),
|
|
3655
|
+
new N(this.squareRadius.display)
|
|
3649
3656
|
).moveLeft());
|
|
3650
|
-
},
|
|
3651
|
-
return h(this, ae, e.center.clone()), h(this,
|
|
3652
|
-
},
|
|
3653
|
-
return h(this, ae, e.clone()), i ? h(this,
|
|
3654
|
-
},
|
|
3655
|
-
return h(this, ae, e.clone()), h(this,
|
|
3656
|
-
},
|
|
3657
|
+
}, Zi = function(e) {
|
|
3658
|
+
return h(this, ae, e.center.clone()), h(this, U, e.squareRadius.clone()), A(this, le, kt).call(this), this;
|
|
3659
|
+
}, Vi = function(e, t, i) {
|
|
3660
|
+
return h(this, ae, e.clone()), i ? h(this, U, new u(t)) : h(this, U, new u(t).pow(2)), this;
|
|
3661
|
+
}, Fi = function(e, t) {
|
|
3662
|
+
return h(this, ae, e.clone()), h(this, U, new E(s(this, ae), t).normSquare), this;
|
|
3663
|
+
}, di = function(e) {
|
|
3657
3664
|
if (e.moveLeft(), e.degree("x").value === 2 && e.degree("y").value === 2) {
|
|
3658
3665
|
const t = e.left.monomByDegree(2, "x"), i = e.left.monomByDegree(2, "y");
|
|
3659
3666
|
let n, r, l;
|
|
3660
|
-
t.coefficient.isEqual(i.coefficient) ? (e.divide(t.coefficient), n = e.left.monomByDegree(1, "x"), r = e.left.monomByDegree(1, "y"), l = e.left.monomByDegree(0), h(this, ae, new S(n.coefficient.clone().divide(2).opposite(), r.coefficient.clone().divide(2).opposite())), h(this,
|
|
3667
|
+
t.coefficient.isEqual(i.coefficient) ? (e.divide(t.coefficient), n = e.left.monomByDegree(1, "x"), r = e.left.monomByDegree(1, "y"), l = e.left.monomByDegree(0), h(this, ae, new S(n.coefficient.clone().divide(2).opposite(), r.coefficient.clone().divide(2).opposite())), h(this, U, l.coefficient.clone().opposite().add(s(this, ae).x.clone().pow(2)).add(s(this, ae).y.clone().pow(2)))) : (h(this, ae, void 0), h(this, U, void 0));
|
|
3661
3668
|
}
|
|
3662
3669
|
return this;
|
|
3663
3670
|
};
|
|
3664
|
-
let
|
|
3665
|
-
var
|
|
3666
|
-
const
|
|
3671
|
+
let $t = _t;
|
|
3672
|
+
var D, X;
|
|
3673
|
+
const pt = class pt {
|
|
3667
3674
|
constructor(e, t) {
|
|
3668
3675
|
// ax + by + c = 0
|
|
3669
|
-
m(this,
|
|
3670
|
-
m(this,
|
|
3671
|
-
a(this, "clone", () => (h(this,
|
|
3676
|
+
m(this, D, new S());
|
|
3677
|
+
m(this, X, new E());
|
|
3678
|
+
a(this, "clone", () => (h(this, X, s(this, X).clone()), h(this, D, s(this, D).clone()), this));
|
|
3672
3679
|
// ------------------------------------------
|
|
3673
3680
|
// Mathematical operations
|
|
3674
3681
|
// ------------------------------------------
|
|
@@ -3708,54 +3715,54 @@ const ct = class ct {
|
|
|
3708
3715
|
// return new Fraction().invalid()
|
|
3709
3716
|
// }
|
|
3710
3717
|
a(this, "randomPoint", (e = 5) => {
|
|
3711
|
-
const t = s(this,
|
|
3718
|
+
const t = s(this, D).clone(), i = new u(H(e, !1));
|
|
3712
3719
|
return new S(
|
|
3713
|
-
t.x.clone().add(s(this,
|
|
3714
|
-
t.y.clone().add(s(this,
|
|
3715
|
-
t.z.clone().add(s(this,
|
|
3720
|
+
t.x.clone().add(s(this, X).x.clone().multiply(i)),
|
|
3721
|
+
t.y.clone().add(s(this, X).y.clone().multiply(i)),
|
|
3722
|
+
t.z.clone().add(s(this, X).z.clone().multiply(i))
|
|
3716
3723
|
);
|
|
3717
3724
|
});
|
|
3718
|
-
return h(this,
|
|
3725
|
+
return h(this, D, e.clone()), h(this, X, t.asPoint ? new E(e, t) : t.clone()), this;
|
|
3719
3726
|
}
|
|
3720
3727
|
get OA() {
|
|
3721
|
-
return s(this,
|
|
3728
|
+
return s(this, D);
|
|
3722
3729
|
}
|
|
3723
3730
|
set OA(e) {
|
|
3724
|
-
h(this,
|
|
3731
|
+
h(this, D, e);
|
|
3725
3732
|
}
|
|
3726
3733
|
get point() {
|
|
3727
|
-
return s(this,
|
|
3734
|
+
return s(this, D).clone();
|
|
3728
3735
|
}
|
|
3729
3736
|
get d() {
|
|
3730
|
-
return s(this,
|
|
3737
|
+
return s(this, X);
|
|
3731
3738
|
}
|
|
3732
3739
|
set d(e) {
|
|
3733
|
-
h(this,
|
|
3740
|
+
h(this, X, e);
|
|
3734
3741
|
}
|
|
3735
3742
|
get tex() {
|
|
3736
3743
|
return {
|
|
3737
|
-
parametric: `${E.asTex("x", "y", "z")} = ${E.asTex(s(this,
|
|
3744
|
+
parametric: `${E.asTex("x", "y", "z")} = ${E.asTex(s(this, D).x.tex, s(this, D).y.tex, s(this, D).z.tex)} + k\\cdot ${E.asTex(s(this, X).x.tex, s(this, X).y.tex, s(this, X).z.tex)}`,
|
|
3738
3745
|
system: `\\left\\{\\begin{aligned}
|
|
3739
|
-
x &= ${new
|
|
3740
|
-
y &= ${new
|
|
3741
|
-
z &= ${new
|
|
3746
|
+
x &= ${new N(s(this, D).x).add(new k(s(this, X).x).multiply(new k("k"))).reorder("k", !0).tex}\\\\
|
|
3747
|
+
y &= ${new N(s(this, D).y).add(new k(s(this, X).y).multiply(new k("k"))).reorder("k", !0).tex}\\\\
|
|
3748
|
+
z &= ${new N(s(this, D).z).add(new k(s(this, X).z).multiply(new k("k"))).reorder("k", !0).tex}
|
|
3742
3749
|
\\end{aligned}\\right.`,
|
|
3743
|
-
cartesian: `\\frac{ ${new
|
|
3750
|
+
cartesian: `\\frac{ ${new N("x", 1, s(this, D).x.clone().opposite()).tex} }{ ${this.direction.x.tex} } = \\frac{ ${new N("y", 1, s(this, D).y.clone().opposite()).tex} }{ ${this.direction.y.tex} } = \\frac{ ${new N("z", 1, s(this, D).z.clone().opposite()).tex} }{ ${this.direction.z.tex} }`
|
|
3744
3751
|
};
|
|
3745
3752
|
}
|
|
3746
3753
|
get display() {
|
|
3747
|
-
const e = s(this,
|
|
3754
|
+
const e = s(this, D).x.display, t = s(this, D).y.display, i = s(this, D).z.display, n = this.direction.simplify(), r = n.x.display, l = n.y.display, c = n.z.display;
|
|
3748
3755
|
return {
|
|
3749
|
-
parametric: `${E.asDisplay("x", "y", "z")} = ${E.asDisplay(s(this,
|
|
3756
|
+
parametric: `${E.asDisplay("x", "y", "z")} = ${E.asDisplay(s(this, D).x.display, s(this, D).y.display, s(this, D).z.display)} + k\\cdot ${E.asDisplay(s(this, X).x.display, s(this, X).y.display, s(this, X).z.display)}`,
|
|
3750
3757
|
system: "",
|
|
3751
3758
|
cartesian: `(x-${e})/${r} = (y-${t})/${l} = (z-${i})/${c}`
|
|
3752
3759
|
};
|
|
3753
3760
|
}
|
|
3754
3761
|
get direction() {
|
|
3755
|
-
return s(this,
|
|
3762
|
+
return s(this, X).clone();
|
|
3756
3763
|
}
|
|
3757
3764
|
distanceTo(e) {
|
|
3758
|
-
const t = new E(s(this,
|
|
3765
|
+
const t = new E(s(this, D), e), i = this.direction, n = this.direction.normSquare, r = t.cross(i).normSquare, l = r.clone().divide(n), c = l.clone().sqrt();
|
|
3759
3766
|
return console.log("CROSS", t.cross(i).display), {
|
|
3760
3767
|
value: Math.sqrt(l.value),
|
|
3761
3768
|
fraction: l.clone().sqrt(),
|
|
@@ -3764,76 +3771,82 @@ const ct = class ct {
|
|
|
3764
3771
|
}
|
|
3765
3772
|
hitSegment(e, t) {
|
|
3766
3773
|
const i = this.intersection(
|
|
3767
|
-
new
|
|
3774
|
+
new pt(e, t)
|
|
3768
3775
|
);
|
|
3769
3776
|
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;
|
|
3770
3777
|
}
|
|
3771
3778
|
};
|
|
3772
|
-
|
|
3773
|
-
a(
|
|
3774
|
-
let
|
|
3775
|
-
var
|
|
3776
|
-
class
|
|
3779
|
+
D = new WeakMap(), X = new WeakMap(), // A line is defined as the canonical form
|
|
3780
|
+
a(pt, "PERPENDICULAR", fi.Perpendicular), a(pt, "PARALLEL", fi.Parallel);
|
|
3781
|
+
let Bt = pt;
|
|
3782
|
+
var $e;
|
|
3783
|
+
class ys {
|
|
3777
3784
|
constructor(...e) {
|
|
3778
|
-
m(this,
|
|
3779
|
-
return h(this,
|
|
3785
|
+
m(this, $e, []);
|
|
3786
|
+
return h(this, $e, e), this;
|
|
3780
3787
|
}
|
|
3781
3788
|
get values() {
|
|
3782
|
-
return s(this,
|
|
3789
|
+
return s(this, $e);
|
|
3783
3790
|
}
|
|
3784
3791
|
get array() {
|
|
3785
|
-
return s(this,
|
|
3792
|
+
return s(this, $e).map((e) => e.array);
|
|
3786
3793
|
}
|
|
3787
3794
|
get dimension() {
|
|
3788
|
-
return [s(this,
|
|
3795
|
+
return [s(this, $e).length, s(this, $e)[0].dimension];
|
|
3789
3796
|
}
|
|
3790
3797
|
isSquare() {
|
|
3791
|
-
return s(this,
|
|
3798
|
+
return s(this, $e).length === s(this, $e)[0].dimension;
|
|
3792
3799
|
}
|
|
3793
3800
|
determinant() {
|
|
3794
3801
|
if (!this.isSquare())
|
|
3795
3802
|
throw new Error("Matrix is not square");
|
|
3796
|
-
return
|
|
3803
|
+
return ps(...this.values);
|
|
3797
3804
|
}
|
|
3798
3805
|
}
|
|
3799
|
-
|
|
3800
|
-
var
|
|
3801
|
-
const
|
|
3806
|
+
$e = new WeakMap();
|
|
3807
|
+
var Be, Xe;
|
|
3808
|
+
const Ei = class Ei {
|
|
3802
3809
|
constructor(e) {
|
|
3803
|
-
m(this,
|
|
3804
|
-
m(this,
|
|
3810
|
+
m(this, Be, new E(0, 0, 1));
|
|
3811
|
+
m(this, Xe, new S(0, 0, 0));
|
|
3805
3812
|
return e && this.parse(e), this;
|
|
3806
3813
|
}
|
|
3807
3814
|
get normal() {
|
|
3808
|
-
return s(this,
|
|
3815
|
+
return s(this, Be);
|
|
3809
3816
|
}
|
|
3810
3817
|
set normal(e) {
|
|
3811
|
-
h(this,
|
|
3818
|
+
h(this, Be, e), s(this, Be).asPoint = !1;
|
|
3812
3819
|
}
|
|
3813
3820
|
get point() {
|
|
3814
|
-
return s(this,
|
|
3821
|
+
return s(this, Xe);
|
|
3815
3822
|
}
|
|
3816
3823
|
set point(e) {
|
|
3817
|
-
h(this,
|
|
3824
|
+
h(this, Xe, e), s(this, Xe).asPoint = !0;
|
|
3818
3825
|
}
|
|
3819
3826
|
get a() {
|
|
3820
|
-
return s(this,
|
|
3827
|
+
return s(this, Be).x;
|
|
3821
3828
|
}
|
|
3822
3829
|
get b() {
|
|
3823
|
-
return s(this,
|
|
3830
|
+
return s(this, Be).y;
|
|
3824
3831
|
}
|
|
3825
3832
|
get c() {
|
|
3826
|
-
return s(this,
|
|
3833
|
+
return s(this, Be).z;
|
|
3827
3834
|
}
|
|
3828
3835
|
get d() {
|
|
3829
|
-
return s(this,
|
|
3836
|
+
return s(this, Be).dot(s(this, Xe)).opposite();
|
|
3830
3837
|
}
|
|
3831
3838
|
get tex() {
|
|
3832
|
-
return new
|
|
3833
|
-
new
|
|
3834
|
-
new
|
|
3839
|
+
return new V(
|
|
3840
|
+
new N("xyz", this.a, this.b, this.c, this.d),
|
|
3841
|
+
new N(0)
|
|
3835
3842
|
).reduce().tex;
|
|
3836
3843
|
}
|
|
3844
|
+
get display() {
|
|
3845
|
+
return new V(
|
|
3846
|
+
new N("xyz", this.a, this.b, this.c, this.d),
|
|
3847
|
+
new N(0)
|
|
3848
|
+
).reduce().display;
|
|
3849
|
+
}
|
|
3837
3850
|
parse(e) {
|
|
3838
3851
|
var t, i, n;
|
|
3839
3852
|
if (e.point && e.normal) {
|
|
@@ -3863,7 +3876,7 @@ const mi = class mi {
|
|
|
3863
3876
|
}
|
|
3864
3877
|
}
|
|
3865
3878
|
angle(e, t, i) {
|
|
3866
|
-
if (e instanceof
|
|
3879
|
+
if (e instanceof Ei)
|
|
3867
3880
|
return this.normal.angle(e.normal, t, i);
|
|
3868
3881
|
let n;
|
|
3869
3882
|
if (e instanceof E) {
|
|
@@ -3888,25 +3901,25 @@ const mi = class mi {
|
|
|
3888
3901
|
return this.normal.dot(e).add(this.d).isZero();
|
|
3889
3902
|
}
|
|
3890
3903
|
};
|
|
3891
|
-
|
|
3892
|
-
let
|
|
3893
|
-
var
|
|
3894
|
-
const
|
|
3904
|
+
Be = new WeakMap(), Xe = new WeakMap();
|
|
3905
|
+
let pi = Ei;
|
|
3906
|
+
var Q, _, ee, ot, Pe, xt, ei, Et, Re, ti, ht;
|
|
3907
|
+
const ii = class ii {
|
|
3895
3908
|
constructor(...e) {
|
|
3896
|
-
m(this,
|
|
3909
|
+
m(this, Q, new S());
|
|
3897
3910
|
m(this, _, new S());
|
|
3898
3911
|
m(this, ee, new S());
|
|
3899
|
-
m(this,
|
|
3900
|
-
AB: new
|
|
3901
|
-
AC: new
|
|
3902
|
-
BC: new
|
|
3912
|
+
m(this, ot, {
|
|
3913
|
+
AB: new z(),
|
|
3914
|
+
AC: new z(),
|
|
3915
|
+
BC: new z()
|
|
3903
3916
|
});
|
|
3904
|
-
m(this,
|
|
3917
|
+
m(this, Pe, {
|
|
3905
3918
|
AB: new S(),
|
|
3906
3919
|
AC: new S(),
|
|
3907
3920
|
BC: new S()
|
|
3908
3921
|
});
|
|
3909
|
-
m(this,
|
|
3922
|
+
m(this, xt, null);
|
|
3910
3923
|
// ------------------------------------------
|
|
3911
3924
|
// Creation / parsing functions
|
|
3912
3925
|
// ------------------------------------------
|
|
@@ -3929,11 +3942,11 @@ const Qt = class Qt {
|
|
|
3929
3942
|
} else if (e.length === 3) {
|
|
3930
3943
|
if (e.every((t) => typeof t == "string"))
|
|
3931
3944
|
return this.parse(
|
|
3932
|
-
...e.map((t) => new
|
|
3945
|
+
...e.map((t) => new z(t))
|
|
3933
3946
|
);
|
|
3934
|
-
if (e.every((t) => t instanceof
|
|
3947
|
+
if (e.every((t) => t instanceof z)) {
|
|
3935
3948
|
const t = e[0].clone(), i = e[1].clone(), n = e[2].clone();
|
|
3936
|
-
h(this,
|
|
3949
|
+
h(this, ot, { AB: t, BC: i, AC: n });
|
|
3937
3950
|
let r = t.intersection(i);
|
|
3938
3951
|
if (r.hasIntersection)
|
|
3939
3952
|
h(this, _, r.point.clone());
|
|
@@ -3944,23 +3957,23 @@ const Qt = class Qt {
|
|
|
3944
3957
|
else
|
|
3945
3958
|
throw new Error("Lines do not intersect !");
|
|
3946
3959
|
if (r = n.intersection(t), r.hasIntersection)
|
|
3947
|
-
h(this,
|
|
3960
|
+
h(this, Q, r.point.clone());
|
|
3948
3961
|
else
|
|
3949
3962
|
throw new Error("Lines do not intersect !");
|
|
3950
|
-
} else e.every((t) => t instanceof S) && (h(this,
|
|
3951
|
-
AB: new
|
|
3952
|
-
BC: new
|
|
3953
|
-
AC: new
|
|
3963
|
+
} else e.every((t) => t instanceof S) && (h(this, Q, e[0].clone()), h(this, _, e[1].clone()), h(this, ee, e[2].clone()), h(this, ot, {
|
|
3964
|
+
AB: new z(s(this, Q), s(this, _)),
|
|
3965
|
+
BC: new z(s(this, _), s(this, ee)),
|
|
3966
|
+
AC: new z(s(this, Q), s(this, ee))
|
|
3954
3967
|
}));
|
|
3955
|
-
} else if (e.length === 1 && e[0] instanceof
|
|
3968
|
+
} else if (e.length === 1 && e[0] instanceof ii)
|
|
3956
3969
|
return e[0].clone();
|
|
3957
|
-
return s(this,
|
|
3970
|
+
return s(this, ei).call(this), this;
|
|
3958
3971
|
});
|
|
3959
3972
|
/**
|
|
3960
3973
|
* Clone the Triangle class
|
|
3961
3974
|
*/
|
|
3962
|
-
a(this, "clone", () => new
|
|
3963
|
-
s(this,
|
|
3975
|
+
a(this, "clone", () => new ii(
|
|
3976
|
+
s(this, Q).clone(),
|
|
3964
3977
|
s(this, _).clone(),
|
|
3965
3978
|
s(this, ee).clone()
|
|
3966
3979
|
));
|
|
@@ -3970,54 +3983,54 @@ const Qt = class Qt {
|
|
|
3970
3983
|
/**
|
|
3971
3984
|
* Generate the Line object for the three segments of the triangle
|
|
3972
3985
|
*/
|
|
3973
|
-
m(this,
|
|
3974
|
-
s(this,
|
|
3975
|
-
AB: new S().middleOf(s(this,
|
|
3976
|
-
AC: new S().middleOf(s(this,
|
|
3986
|
+
m(this, ei, () => {
|
|
3987
|
+
s(this, Q).asPoint = !0, s(this, _).asPoint = !0, s(this, ee).asPoint = !0, h(this, Pe, {
|
|
3988
|
+
AB: new S().middleOf(s(this, Q), s(this, _)),
|
|
3989
|
+
AC: new S().middleOf(s(this, Q), s(this, ee)),
|
|
3977
3990
|
BC: new S().middleOf(s(this, _), s(this, ee))
|
|
3978
|
-
}), h(this,
|
|
3991
|
+
}), h(this, xt, s(this, ti).call(this));
|
|
3979
3992
|
});
|
|
3980
3993
|
/**
|
|
3981
3994
|
* Get the Vector2D class for the given name
|
|
3982
3995
|
* @param ptName
|
|
3983
3996
|
*/
|
|
3984
|
-
m(this,
|
|
3997
|
+
m(this, Et, (e) => {
|
|
3985
3998
|
switch (e.toUpperCase()) {
|
|
3986
3999
|
case "A":
|
|
3987
|
-
return s(this,
|
|
4000
|
+
return s(this, Q);
|
|
3988
4001
|
case "B":
|
|
3989
4002
|
return s(this, _);
|
|
3990
4003
|
case "C":
|
|
3991
4004
|
return s(this, ee);
|
|
3992
4005
|
}
|
|
3993
|
-
return s(this,
|
|
4006
|
+
return s(this, Q);
|
|
3994
4007
|
});
|
|
3995
4008
|
/**
|
|
3996
4009
|
* Get the vector for the segment given by name.
|
|
3997
4010
|
* @param ptName1
|
|
3998
4011
|
* @param ptName2
|
|
3999
4012
|
*/
|
|
4000
|
-
m(this,
|
|
4001
|
-
s(this,
|
|
4002
|
-
s(this,
|
|
4013
|
+
m(this, Re, (e, t) => new E(
|
|
4014
|
+
s(this, Et).call(this, e),
|
|
4015
|
+
s(this, Et).call(this, t)
|
|
4003
4016
|
));
|
|
4004
|
-
m(this,
|
|
4017
|
+
m(this, ti, () => {
|
|
4005
4018
|
const e = {
|
|
4006
|
-
A: new
|
|
4007
|
-
B: new
|
|
4008
|
-
C: new
|
|
4019
|
+
A: new z().fromPoints(s(this, Q), s(this, Pe).BC),
|
|
4020
|
+
B: new z().fromPoints(s(this, _), s(this, Pe).AC),
|
|
4021
|
+
C: new z().fromPoints(s(this, ee), s(this, Pe).AB),
|
|
4009
4022
|
intersection: null
|
|
4010
4023
|
}, t = {
|
|
4011
|
-
AB: new
|
|
4012
|
-
AC: new
|
|
4013
|
-
BC: new
|
|
4024
|
+
AB: new z().fromPointAndNormal(s(this, Pe).AB, new E(s(this, Q), s(this, _)).normal()),
|
|
4025
|
+
AC: new z().fromPointAndNormal(s(this, Pe).AC, new E(s(this, Q), s(this, ee)).normal()),
|
|
4026
|
+
BC: new z().fromPointAndNormal(s(this, Pe).BC, new E(s(this, _), s(this, ee)).normal()),
|
|
4014
4027
|
intersection: null
|
|
4015
4028
|
}, i = {
|
|
4016
|
-
A: new
|
|
4017
|
-
B: new
|
|
4018
|
-
C: new
|
|
4029
|
+
A: new z().fromPointAndNormal(s(this, Q), new E(s(this, _), s(this, ee)).normal()),
|
|
4030
|
+
B: new z().fromPointAndNormal(s(this, _), new E(s(this, Q), s(this, ee)).normal()),
|
|
4031
|
+
C: new z().fromPointAndNormal(s(this, ee), new E(s(this, Q), s(this, _)).normal()),
|
|
4019
4032
|
intersection: null
|
|
4020
|
-
}, n = s(this,
|
|
4033
|
+
}, n = s(this, ht).call(this, "A"), r = s(this, ht).call(this, "B"), l = s(this, ht).call(this, "C"), c = {
|
|
4021
4034
|
A: n.internal,
|
|
4022
4035
|
B: r.internal,
|
|
4023
4036
|
C: r.internal,
|
|
@@ -4036,12 +4049,12 @@ const Qt = class Qt {
|
|
|
4036
4049
|
};
|
|
4037
4050
|
return d.medians.intersection = d.medians.A.intersection(d.medians.B).point, d.mediators.intersection = d.mediators.AB.intersection(d.mediators.BC).point, d.heights.intersection = d.heights.A.intersection(d.heights.B).point, d.bisectors.intersection = d.bisectors.A.intersection(d.bisectors.B).point, d;
|
|
4038
4051
|
});
|
|
4039
|
-
m(this,
|
|
4052
|
+
m(this, ht, (e) => {
|
|
4040
4053
|
const t = this.lines;
|
|
4041
4054
|
let i, n;
|
|
4042
4055
|
if (e === "A" ? (i = t.AB, n = t.AC) : e === "B" ? (i = t.AB, n = t.BC) : e === "C" && (i = t.BC, n = t.AC), i === void 0 || n === void 0)
|
|
4043
4056
|
throw new Error(`The point ${e} does not exist`);
|
|
4044
|
-
const r = i.n.simplify().norm, l = n.n.simplify().norm, c = i.getEquation().multiply(l), f = n.getEquation().multiply(r), d = new
|
|
4057
|
+
const r = i.n.simplify().norm, l = n.n.simplify().norm, c = i.getEquation().multiply(l), f = n.getEquation().multiply(r), d = new z(c.clone().subtract(f).simplify()), p = new z(f.clone().subtract(c).simplify());
|
|
4045
4058
|
return e === "A" ? d.hitSegment(this.B, this.C) ? { internal: d, external: p } : { internal: p, external: d } : e === "B" ? d.hitSegment(this.A, this.C) ? { internal: d, external: p } : { internal: p, external: d } : e === "C" ? d.hitSegment(this.B, this.A) ? { internal: d, external: p } : { internal: p, external: d } : { internal: d, external: p };
|
|
4046
4059
|
});
|
|
4047
4060
|
return e.length > 0 && this.parse(...e), this;
|
|
@@ -4050,7 +4063,7 @@ const Qt = class Qt {
|
|
|
4050
4063
|
// Getter and setters
|
|
4051
4064
|
// ------------------------------------------
|
|
4052
4065
|
get A() {
|
|
4053
|
-
return s(this,
|
|
4066
|
+
return s(this, Q);
|
|
4054
4067
|
}
|
|
4055
4068
|
get B() {
|
|
4056
4069
|
return s(this, _);
|
|
@@ -4059,22 +4072,22 @@ const Qt = class Qt {
|
|
|
4059
4072
|
return s(this, ee);
|
|
4060
4073
|
}
|
|
4061
4074
|
get AB() {
|
|
4062
|
-
return s(this,
|
|
4075
|
+
return s(this, Re).call(this, "A", "B");
|
|
4063
4076
|
}
|
|
4064
4077
|
get BA() {
|
|
4065
|
-
return s(this,
|
|
4078
|
+
return s(this, Re).call(this, "B", "A");
|
|
4066
4079
|
}
|
|
4067
4080
|
get BC() {
|
|
4068
|
-
return s(this,
|
|
4081
|
+
return s(this, Re).call(this, "B", "C");
|
|
4069
4082
|
}
|
|
4070
4083
|
get CB() {
|
|
4071
|
-
return s(this,
|
|
4084
|
+
return s(this, Re).call(this, "C", "B");
|
|
4072
4085
|
}
|
|
4073
4086
|
get AC() {
|
|
4074
|
-
return s(this,
|
|
4087
|
+
return s(this, Re).call(this, "A", "C");
|
|
4075
4088
|
}
|
|
4076
4089
|
get CA() {
|
|
4077
|
-
return s(this,
|
|
4090
|
+
return s(this, Re).call(this, "C", "A");
|
|
4078
4091
|
}
|
|
4079
4092
|
get isRectangle() {
|
|
4080
4093
|
return !!(this.AB.isNormalTo(this.BC) || this.AB.isNormalTo(this.AC) || this.BC.isNormalTo(this.AC));
|
|
@@ -4086,15 +4099,119 @@ const Qt = class Qt {
|
|
|
4086
4099
|
return this.AB.normSquare.isEqual(this.BC.normSquare) || this.AB.normSquare.isEqual(this.AC.normSquare) || this.BC.normSquare.isEqual(this.AC.normSquare);
|
|
4087
4100
|
}
|
|
4088
4101
|
get lines() {
|
|
4089
|
-
return s(this,
|
|
4102
|
+
return s(this, ot);
|
|
4090
4103
|
}
|
|
4091
4104
|
get remarquables() {
|
|
4092
|
-
return s(this,
|
|
4105
|
+
return s(this, xt);
|
|
4093
4106
|
}
|
|
4094
4107
|
};
|
|
4095
|
-
|
|
4096
|
-
let
|
|
4097
|
-
|
|
4108
|
+
Q = new WeakMap(), _ = new WeakMap(), ee = new WeakMap(), ot = new WeakMap(), Pe = new WeakMap(), xt = new WeakMap(), ei = new WeakMap(), Et = new WeakMap(), Re = new WeakMap(), ti = new WeakMap(), ht = new WeakMap();
|
|
4109
|
+
let mi = ii;
|
|
4110
|
+
var ws = /* @__PURE__ */ ((o) => (o[o.INTERIOR = 0] = "INTERIOR", o[o.EXTERIOR = 1] = "EXTERIOR", o[o.SECANT = 2] = "SECANT", o[o.TANGENT_INSIDE = 3] = "TANGENT_INSIDE", o[o.TANGENT_OUTSIDE = 4] = "TANGENT_OUTSIDE", o[o.SUPERPOSED = 5] = "SUPERPOSED", o[o.CONCENTRIC = 6] = "CONCENTRIC", o))(ws || {}), Te, de, Oe, at, Nt, qt, gi;
|
|
4111
|
+
class vs {
|
|
4112
|
+
constructor(e, t) {
|
|
4113
|
+
m(this, qt);
|
|
4114
|
+
m(this, Te);
|
|
4115
|
+
m(this, de);
|
|
4116
|
+
m(this, Oe);
|
|
4117
|
+
m(this, at, 1);
|
|
4118
|
+
m(this, Nt, (e) => {
|
|
4119
|
+
if (s(this, Oe) === void 0)
|
|
4120
|
+
throw new Error("Sphere3 is undefined");
|
|
4121
|
+
if (s(this, at) === 0)
|
|
4122
|
+
return e ? s(this, Oe).tex : s(this, Oe).display;
|
|
4123
|
+
const t = [];
|
|
4124
|
+
return ["x", "y", "z"].forEach((n) => {
|
|
4125
|
+
if (this.center[n].isZero())
|
|
4126
|
+
t.push(`${n}^2`);
|
|
4127
|
+
else {
|
|
4128
|
+
const r = new N(n).subtract(this.center[n]);
|
|
4129
|
+
t.push(
|
|
4130
|
+
e ? `\\(${r.tex}\\)^2` : `(${r.display})^2`
|
|
4131
|
+
);
|
|
4132
|
+
}
|
|
4133
|
+
}), t.join("+") + "=" + (e ? this.squareRadius.tex : this.squareRadius.display);
|
|
4134
|
+
});
|
|
4135
|
+
a(this, "relativePosition", (e) => {
|
|
4136
|
+
const t = this.center.distanceTo(e.center).value, i = this.radius.value, n = e.radius.value;
|
|
4137
|
+
return t > i + n ? 1 : t === i + n ? 4 : t === Math.abs(i - n) ? 3 : t < Math.abs(i - n) ? 0 : t === 0 ? i === n ? 5 : 6 : 2;
|
|
4138
|
+
});
|
|
4139
|
+
a(this, "isPointOnSphere", (e) => {
|
|
4140
|
+
var t;
|
|
4141
|
+
return ((t = s(this, Oe)) == null ? void 0 : t.test({
|
|
4142
|
+
x: e.x,
|
|
4143
|
+
y: e.y,
|
|
4144
|
+
z: e.z
|
|
4145
|
+
})) ?? !1;
|
|
4146
|
+
});
|
|
4147
|
+
return e && t && (h(this, Te, e), h(this, de, new u(t).clone().pow(2)), A(this, qt, gi).call(this)), this;
|
|
4148
|
+
}
|
|
4149
|
+
fromPolynom(e) {
|
|
4150
|
+
const t = new V(e).moveLeft().reduce(), i = ["x", "y", "z"];
|
|
4151
|
+
if (i.some((r) => t.degree(r).value !== 2))
|
|
4152
|
+
return this.makeUndefined();
|
|
4153
|
+
const n = t.left.monomByDegree(2, "x").coefficient;
|
|
4154
|
+
return i.some((r) => t.left.monomByDegree(2, r).coefficient.isNotEqual(n)) ? this.makeUndefined() : (h(this, Te, new S(
|
|
4155
|
+
t.left.monomByDegree(1, "x").coefficient.clone().opposite().divide(2),
|
|
4156
|
+
t.left.monomByDegree(1, "y").coefficient.clone().opposite().divide(2),
|
|
4157
|
+
t.left.monomByDegree(1, "z").coefficient.clone().opposite().divide(2)
|
|
4158
|
+
)), h(this, de, t.left.monomByDegree(0).coefficient.clone().opposite().add(s(this, Te).x.clone().pow(2)).add(s(this, Te).y.clone().pow(2)).add(s(this, Te).z.clone().pow(2))), A(this, qt, gi).call(this), this);
|
|
4159
|
+
}
|
|
4160
|
+
get center() {
|
|
4161
|
+
if (s(this, Te) === void 0)
|
|
4162
|
+
throw new Error("Sphere3 is undefined");
|
|
4163
|
+
return s(this, Te);
|
|
4164
|
+
}
|
|
4165
|
+
get squareRadius() {
|
|
4166
|
+
if (s(this, de) === void 0)
|
|
4167
|
+
throw new Error("Sphere3 is undefined");
|
|
4168
|
+
return s(this, de);
|
|
4169
|
+
}
|
|
4170
|
+
get radius() {
|
|
4171
|
+
if (s(this, de) === void 0)
|
|
4172
|
+
throw new Error("Sphere3 is undefined");
|
|
4173
|
+
return s(this, de).isSquare() ? {
|
|
4174
|
+
tex: s(this, de).clone().sqrt().tex,
|
|
4175
|
+
display: s(this, de).clone().sqrt().display,
|
|
4176
|
+
value: s(this, de).clone().sqrt().value
|
|
4177
|
+
} : {
|
|
4178
|
+
tex: `\\sqrt{${s(this, de).tex}}`,
|
|
4179
|
+
display: `sqrt(${s(this, de).display})`,
|
|
4180
|
+
value: s(this, de).clone().sqrt().value
|
|
4181
|
+
};
|
|
4182
|
+
}
|
|
4183
|
+
get equation() {
|
|
4184
|
+
if (s(this, Oe) === void 0)
|
|
4185
|
+
throw new Error("Sphere3 is undefined");
|
|
4186
|
+
return s(this, Oe);
|
|
4187
|
+
}
|
|
4188
|
+
makeUndefined() {
|
|
4189
|
+
return h(this, Te, void 0), h(this, de, void 0), h(this, Oe, void 0), this;
|
|
4190
|
+
}
|
|
4191
|
+
get centerRadius() {
|
|
4192
|
+
return h(this, at, 1), this;
|
|
4193
|
+
}
|
|
4194
|
+
get developped() {
|
|
4195
|
+
return h(this, at, 0), this;
|
|
4196
|
+
}
|
|
4197
|
+
get tex() {
|
|
4198
|
+
return s(this, Nt).call(this, !0);
|
|
4199
|
+
}
|
|
4200
|
+
get display() {
|
|
4201
|
+
return s(this, Nt).call(this, !1);
|
|
4202
|
+
}
|
|
4203
|
+
}
|
|
4204
|
+
Te = new WeakMap(), de = new WeakMap(), Oe = new WeakMap(), at = new WeakMap(), Nt = new WeakMap(), qt = new WeakSet(), gi = function() {
|
|
4205
|
+
h(this, Oe, new V(
|
|
4206
|
+
new N("x").subtract(this.center.x).pow(2).add(
|
|
4207
|
+
new N("y").subtract(this.center.y).pow(2)
|
|
4208
|
+
).add(
|
|
4209
|
+
new N("z").subtract(this.center.z).pow(2)
|
|
4210
|
+
),
|
|
4211
|
+
new N(this.squareRadius)
|
|
4212
|
+
).reduce());
|
|
4213
|
+
};
|
|
4214
|
+
function Pt(o) {
|
|
4098
4215
|
const e = Object.assign(
|
|
4099
4216
|
{
|
|
4100
4217
|
negative: !0,
|
|
@@ -4105,16 +4222,16 @@ function qt(o) {
|
|
|
4105
4222
|
},
|
|
4106
4223
|
o
|
|
4107
4224
|
), t = new u();
|
|
4108
|
-
if (e.negative ? t.numerator =
|
|
4225
|
+
if (e.negative ? t.numerator = H(e.max, e.zero) : t.numerator = me(e.zero ? 0 : 1, e.max), e.natural)
|
|
4109
4226
|
t.denominator = 1;
|
|
4110
4227
|
else {
|
|
4111
4228
|
let i = 0;
|
|
4112
4229
|
for (; t.isRelative() && i < 10; )
|
|
4113
|
-
t.denominator =
|
|
4230
|
+
t.denominator = me(1, e.max), i++;
|
|
4114
4231
|
}
|
|
4115
4232
|
return e.reduced ? t.reduce() : t;
|
|
4116
4233
|
}
|
|
4117
|
-
function
|
|
4234
|
+
function ji(o) {
|
|
4118
4235
|
const e = Object.assign(
|
|
4119
4236
|
{
|
|
4120
4237
|
letters: "x",
|
|
@@ -4123,8 +4240,8 @@ function Ri(o) {
|
|
|
4123
4240
|
zero: !1
|
|
4124
4241
|
},
|
|
4125
4242
|
o
|
|
4126
|
-
), t = new
|
|
4127
|
-
if (t.coefficient =
|
|
4243
|
+
), t = new k();
|
|
4244
|
+
if (t.coefficient = Pt({
|
|
4128
4245
|
zero: e.zero,
|
|
4129
4246
|
reduced: !0,
|
|
4130
4247
|
natural: !e.fraction
|
|
@@ -4132,14 +4249,14 @@ function Ri(o) {
|
|
|
4132
4249
|
for (const i of e.letters.split(""))
|
|
4133
4250
|
t.setLetter(i, 0);
|
|
4134
4251
|
for (let i = 0; i < e.degree; i++) {
|
|
4135
|
-
const n =
|
|
4252
|
+
const n = bi(e.letters.split(""));
|
|
4136
4253
|
t.setLetter(n, t.degree(n).clone().add(1));
|
|
4137
4254
|
}
|
|
4138
4255
|
} else
|
|
4139
4256
|
t.setLetter(e.letters, e.degree);
|
|
4140
4257
|
return t;
|
|
4141
4258
|
}
|
|
4142
|
-
const
|
|
4259
|
+
const bs = {
|
|
4143
4260
|
letters: "x",
|
|
4144
4261
|
degree: 2,
|
|
4145
4262
|
fraction: !1,
|
|
@@ -4150,14 +4267,14 @@ const us = {
|
|
|
4150
4267
|
numberOfMonoms: 0,
|
|
4151
4268
|
positive: !0
|
|
4152
4269
|
};
|
|
4153
|
-
function
|
|
4270
|
+
function Ui(o) {
|
|
4154
4271
|
const e = Object.assign(
|
|
4155
|
-
|
|
4272
|
+
bs,
|
|
4156
4273
|
o
|
|
4157
|
-
), t = new
|
|
4274
|
+
), t = new N().empty();
|
|
4158
4275
|
let i;
|
|
4159
4276
|
for (let n = e.degree; n >= 0; n--)
|
|
4160
|
-
i =
|
|
4277
|
+
i = ji({
|
|
4161
4278
|
letters: e.letters,
|
|
4162
4279
|
degree: n,
|
|
4163
4280
|
fraction: e.fraction,
|
|
@@ -4165,12 +4282,12 @@ function zi(o) {
|
|
|
4165
4282
|
}), e.unit && e.degree === n && i.coefficient.one(), t.add(i);
|
|
4166
4283
|
if (e.positive && t.monomByDegree().coefficient.isNegative() && t.monomByDegree().coefficient.opposite(), e.numberOfMonoms && e.numberOfMonoms > 0 && e.numberOfMonoms < t.length)
|
|
4167
4284
|
for (; t.length > e.numberOfMonoms; ) {
|
|
4168
|
-
const n =
|
|
4285
|
+
const n = me(1, t.length - 1);
|
|
4169
4286
|
t.monoms.splice(n, 1);
|
|
4170
4287
|
}
|
|
4171
4288
|
return t.reduce();
|
|
4172
4289
|
}
|
|
4173
|
-
function
|
|
4290
|
+
function xs(o) {
|
|
4174
4291
|
const e = Object.assign(
|
|
4175
4292
|
{
|
|
4176
4293
|
letters: "x",
|
|
@@ -4190,9 +4307,9 @@ function fs(o) {
|
|
|
4190
4307
|
}
|
|
4191
4308
|
},
|
|
4192
4309
|
o
|
|
4193
|
-
), t = new
|
|
4310
|
+
), t = new N().one();
|
|
4194
4311
|
for (let i = 0; i < e.degree; i++) {
|
|
4195
|
-
const n =
|
|
4312
|
+
const n = Ui({
|
|
4196
4313
|
degree: 1,
|
|
4197
4314
|
unit: e.unit,
|
|
4198
4315
|
fraction: e.fraction,
|
|
@@ -4201,9 +4318,9 @@ function fs(o) {
|
|
|
4201
4318
|
});
|
|
4202
4319
|
t.multiply(n);
|
|
4203
4320
|
}
|
|
4204
|
-
return new
|
|
4321
|
+
return new V(t, 0);
|
|
4205
4322
|
}
|
|
4206
|
-
function
|
|
4323
|
+
function yi(o) {
|
|
4207
4324
|
const e = Object.assign(
|
|
4208
4325
|
{
|
|
4209
4326
|
axis: !0,
|
|
@@ -4212,10 +4329,10 @@ function ci(o) {
|
|
|
4212
4329
|
quadrant: null
|
|
4213
4330
|
},
|
|
4214
4331
|
o
|
|
4215
|
-
), t = e.axis === "x", i = e.axis === "y", n = e.fraction ?
|
|
4332
|
+
), t = e.axis === "x", i = e.axis === "y", n = e.fraction ? Pt({ max: e.max, zero: t }) : new u(H(e.max, t)), r = e.fraction ? Pt({ max: e.max, zero: i }) : new u(H(e.max, i));
|
|
4216
4333
|
return Number(e.quadrant) === 1 && (n.abs(), r.abs()), Number(e.quadrant) === 2 && (n.isPositive() && n.opposite(), r.isNegative() && r.opposite()), Number(e.quadrant) === 3 && (n.isPositive() && n.opposite(), r.isPositive() && r.opposite()), Number(e.quadrant) === 4 && (n.isNegative() && n.opposite(), r.isPositive() && r.opposite()), new S(n, r);
|
|
4217
4334
|
}
|
|
4218
|
-
function
|
|
4335
|
+
function Es(o) {
|
|
4219
4336
|
const e = Object.assign(
|
|
4220
4337
|
{
|
|
4221
4338
|
center: {
|
|
@@ -4225,116 +4342,119 @@ function ds(o) {
|
|
|
4225
4342
|
pointsOnCircle: 8
|
|
4226
4343
|
},
|
|
4227
4344
|
o
|
|
4228
|
-
), t =
|
|
4345
|
+
), t = yi(e.center);
|
|
4229
4346
|
let i, n;
|
|
4230
|
-
return e.pointsOnCircle === 8 ? (i =
|
|
4347
|
+
return e.pointsOnCircle === 8 ? (i = me(1, 3), n = i ** 2 + (i + 1) ** 2) : n = me(1, 20), new $t(t, n, !0);
|
|
4231
4348
|
}
|
|
4232
|
-
function
|
|
4349
|
+
function Ns(o) {
|
|
4233
4350
|
const e = Object.assign(
|
|
4234
4351
|
{
|
|
4235
4352
|
A: {
|
|
4236
|
-
x:
|
|
4237
|
-
y:
|
|
4353
|
+
x: H(10),
|
|
4354
|
+
y: H(10)
|
|
4238
4355
|
}
|
|
4239
4356
|
},
|
|
4240
4357
|
o
|
|
4241
4358
|
), t = new E(
|
|
4242
|
-
|
|
4243
|
-
|
|
4359
|
+
H(10),
|
|
4360
|
+
H(10)
|
|
4244
4361
|
);
|
|
4245
4362
|
for (; t.isNull; )
|
|
4246
|
-
t.x =
|
|
4247
|
-
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
|
|
4363
|
+
t.x = H(10), t.y = H(10);
|
|
4364
|
+
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 z().fromPointAndDirection(new E(e.A.x, e.A.y), t);
|
|
4248
4365
|
}
|
|
4249
|
-
function
|
|
4366
|
+
function qs(o) {
|
|
4250
4367
|
const e = Object.assign(
|
|
4251
4368
|
{
|
|
4252
4369
|
A: {
|
|
4253
|
-
x:
|
|
4254
|
-
y:
|
|
4255
|
-
z:
|
|
4370
|
+
x: H(10),
|
|
4371
|
+
y: H(10),
|
|
4372
|
+
z: H(10)
|
|
4256
4373
|
},
|
|
4257
4374
|
direction: {
|
|
4258
|
-
x:
|
|
4259
|
-
y:
|
|
4260
|
-
z:
|
|
4375
|
+
x: H(10),
|
|
4376
|
+
y: H(10),
|
|
4377
|
+
z: H(10)
|
|
4261
4378
|
}
|
|
4262
4379
|
},
|
|
4263
4380
|
o
|
|
4264
4381
|
), t = new S(e.A.x, e.A.y, e.A.z), i = new E(e.direction.x, e.direction.y, e.direction.z);
|
|
4265
|
-
return new
|
|
4382
|
+
return new Bt(t, i);
|
|
4266
4383
|
}
|
|
4267
|
-
const
|
|
4268
|
-
equation: (o) =>
|
|
4269
|
-
polynom: (o) =>
|
|
4270
|
-
monom: (o) =>
|
|
4271
|
-
fraction: (o) =>
|
|
4272
|
-
number: (o, e, t) =>
|
|
4273
|
-
numberSym: (o, e) =>
|
|
4274
|
-
prime: (o) =>
|
|
4275
|
-
bool: (o) =>
|
|
4276
|
-
array: (o, e) =>
|
|
4277
|
-
item: (o) =>
|
|
4278
|
-
shuffle: (o) =>
|
|
4279
|
-
line: (o) =>
|
|
4280
|
-
line3: (o) =>
|
|
4281
|
-
vector: (o) =>
|
|
4384
|
+
const As = {
|
|
4385
|
+
equation: (o) => xs(o),
|
|
4386
|
+
polynom: (o) => Ui(o),
|
|
4387
|
+
monom: (o) => ji(o),
|
|
4388
|
+
fraction: (o) => Pt(o),
|
|
4389
|
+
number: (o, e, t) => me(o, e, t),
|
|
4390
|
+
numberSym: (o, e) => H(o, e),
|
|
4391
|
+
prime: (o) => ms(o),
|
|
4392
|
+
bool: (o) => Ri(o),
|
|
4393
|
+
array: (o, e) => gs(o, e),
|
|
4394
|
+
item: (o) => bi(o),
|
|
4395
|
+
shuffle: (o) => Di(o),
|
|
4396
|
+
line: (o) => Ns(o),
|
|
4397
|
+
line3: (o) => qs(o),
|
|
4398
|
+
vector: (o) => yi(o),
|
|
4282
4399
|
point: (o) => {
|
|
4283
|
-
const e =
|
|
4400
|
+
const e = yi(o);
|
|
4284
4401
|
return e.asPoint = !0, e;
|
|
4285
4402
|
},
|
|
4286
|
-
circle: (o) =>
|
|
4287
|
-
},
|
|
4288
|
-
Numeric:
|
|
4403
|
+
circle: (o) => Es(o)
|
|
4404
|
+
}, Os = {
|
|
4405
|
+
Numeric: G,
|
|
4289
4406
|
Fraction: u,
|
|
4290
|
-
Root:
|
|
4291
|
-
Monom:
|
|
4292
|
-
Polynom:
|
|
4293
|
-
Equation:
|
|
4294
|
-
Matrix:
|
|
4295
|
-
LinearSystem:
|
|
4407
|
+
Root: At,
|
|
4408
|
+
Monom: k,
|
|
4409
|
+
Polynom: N,
|
|
4410
|
+
Equation: V,
|
|
4411
|
+
Matrix: ys,
|
|
4412
|
+
LinearSystem: hi,
|
|
4296
4413
|
Factor: se,
|
|
4297
|
-
PolyFactor:
|
|
4298
|
-
LogicalSet:
|
|
4299
|
-
Random:
|
|
4414
|
+
PolyFactor: li,
|
|
4415
|
+
LogicalSet: cs,
|
|
4416
|
+
Random: As,
|
|
4300
4417
|
Geometry: {
|
|
4301
4418
|
Vector: E,
|
|
4302
4419
|
Point: S,
|
|
4303
|
-
Line:
|
|
4304
|
-
Triangle:
|
|
4305
|
-
Circle:
|
|
4306
|
-
Line3:
|
|
4307
|
-
Plane3:
|
|
4420
|
+
Line: z,
|
|
4421
|
+
Triangle: mi,
|
|
4422
|
+
Circle: $t,
|
|
4423
|
+
Line3: Bt,
|
|
4424
|
+
Plane3: pi,
|
|
4425
|
+
Sphere3: vs
|
|
4308
4426
|
},
|
|
4309
|
-
NumExp:
|
|
4427
|
+
NumExp: ls
|
|
4310
4428
|
};
|
|
4311
4429
|
export {
|
|
4312
|
-
|
|
4313
|
-
|
|
4314
|
-
|
|
4315
|
-
|
|
4430
|
+
$t as Circle,
|
|
4431
|
+
V as Equation,
|
|
4432
|
+
Mt as EquationSolver,
|
|
4433
|
+
dt as FACTOR_DISPLAY,
|
|
4316
4434
|
se as Factor,
|
|
4317
4435
|
u as Fraction,
|
|
4318
|
-
|
|
4319
|
-
|
|
4320
|
-
|
|
4321
|
-
|
|
4322
|
-
|
|
4323
|
-
|
|
4324
|
-
|
|
4325
|
-
|
|
4326
|
-
|
|
4327
|
-
|
|
4436
|
+
z as Line,
|
|
4437
|
+
Bt as Line3,
|
|
4438
|
+
hi as LinearSystem,
|
|
4439
|
+
cs as LogicalSet,
|
|
4440
|
+
ys as Matrix,
|
|
4441
|
+
k as Monom,
|
|
4442
|
+
At as NthRoot,
|
|
4443
|
+
ls as NumExp,
|
|
4444
|
+
G as Numeric,
|
|
4445
|
+
pi as Plane3,
|
|
4328
4446
|
S as Point,
|
|
4329
|
-
|
|
4330
|
-
|
|
4331
|
-
|
|
4332
|
-
|
|
4447
|
+
li as PolyFactor,
|
|
4448
|
+
N as Polynom,
|
|
4449
|
+
As as Random,
|
|
4450
|
+
ws as SPHERE3_RELATIVE_POSITION,
|
|
4451
|
+
vs as Sphere3,
|
|
4452
|
+
mi as Triangle,
|
|
4333
4453
|
E as Vector,
|
|
4334
|
-
|
|
4335
|
-
|
|
4336
|
-
|
|
4337
|
-
|
|
4338
|
-
|
|
4454
|
+
fs as areVectorsColinears,
|
|
4455
|
+
us as areVectorsEquals,
|
|
4456
|
+
Os as default,
|
|
4457
|
+
ps as determinant,
|
|
4458
|
+
ds as dotProduct
|
|
4339
4459
|
};
|
|
4340
4460
|
//# sourceMappingURL=pimath.js.map
|