pimath 0.2.13 → 0.2.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/pimath.js +856 -1882
- package/dist/pimath.js.map +1 -1
- package/package.json +2 -2
- package/src/algebra/equation.ts +562 -558
- package/src/algebra/equationSolver.ts +489 -489
- package/src/algebra/factor.ts +396 -392
- package/src/algebra/linearSystem.ts +446 -442
- package/src/algebra/matrix.ts +515 -511
- package/src/algebra/monom.ts +932 -928
- package/src/algebra/polyFactor.ts +724 -720
- package/src/algebra/polynom.ts +1233 -1229
- package/src/coefficients/fraction.ts +907 -748
- package/src/coefficients/root.ts +500 -359
- package/src/geometry/TupleN.ts +129 -129
- package/src/geometry/circle.ts +455 -455
- package/src/geometry/line.ts +658 -654
- package/src/geometry/point.ts +105 -105
- package/src/geometry/sphere3.ts +2 -2
- package/src/geometry/triangle.ts +488 -488
- package/src/geometry/vector.ts +230 -226
- package/src/numeric.ts +136 -51
- package/src/pimath.interface.ts +2 -0
- package/types/algebra/equation.d.ts +1 -0
- package/types/algebra/equation.d.ts.map +1 -1
- package/types/algebra/equationSolver.d.ts.map +1 -1
- package/types/algebra/factor.d.ts +1 -0
- package/types/algebra/factor.d.ts.map +1 -1
- package/types/algebra/linearSystem.d.ts +1 -0
- package/types/algebra/linearSystem.d.ts.map +1 -1
- package/types/algebra/matrix.d.ts +6 -5
- package/types/algebra/matrix.d.ts.map +1 -1
- package/types/algebra/monom.d.ts +1 -0
- package/types/algebra/monom.d.ts.map +1 -1
- package/types/algebra/polyFactor.d.ts +1 -0
- package/types/algebra/polyFactor.d.ts.map +1 -1
- package/types/algebra/polynom.d.ts +1 -0
- package/types/algebra/polynom.d.ts.map +1 -1
- package/types/coefficients/fraction.d.ts +62 -53
- package/types/coefficients/fraction.d.ts.map +1 -1
- package/types/coefficients/root.d.ts +3 -0
- package/types/coefficients/root.d.ts.map +1 -1
- package/types/geometry/TupleN.d.ts +1 -1
- package/types/geometry/TupleN.d.ts.map +1 -1
- package/types/geometry/circle.d.ts.map +1 -1
- package/types/geometry/line.d.ts +1 -0
- package/types/geometry/line.d.ts.map +1 -1
- package/types/geometry/point.d.ts.map +1 -1
- package/types/geometry/sphere3.d.ts +2 -2
- package/types/geometry/sphere3.d.ts.map +1 -1
- package/types/geometry/triangle.d.ts.map +1 -1
- package/types/geometry/vector.d.ts +1 -0
- package/types/geometry/vector.d.ts.map +1 -1
- package/types/index.d.ts +3 -3
- package/types/numeric.d.ts +4 -4
- package/types/numeric.d.ts.map +1 -1
- package/types/pimath.interface.d.ts +1 -0
- package/types/pimath.interface.d.ts.map +1 -1
- package/types/primes.data.d.ts +2 -0
- package/types/primes.data.d.ts.map +1 -0
package/dist/pimath.js
CHANGED
|
@@ -3,1318 +3,99 @@ var e = class extends Error {
|
|
|
3
3
|
constructor(e, t) {
|
|
4
4
|
super(e, t), this.name = new.target.name;
|
|
5
5
|
}
|
|
6
|
-
}, t = class extends e {}, n = class extends e {}, r = class extends e {}, i = class extends e {}, a = class extends e {}, o = class extends e {}, s = class extends e {};
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
}, t = class extends e {}, n = class extends e {}, r = class extends e {}, i = class extends e {}, a = class extends e {}, o = class extends e {}, s = class extends e {}, c = 1e4, l;
|
|
7
|
+
function u(e) {
|
|
8
|
+
let t = new Uint8Array(e + 1), n = [];
|
|
9
|
+
for (let r = 2; r <= e; r++) if (t[r] === 0) {
|
|
10
|
+
n.push(r);
|
|
11
|
+
for (let n = r * r; n <= e; n += r) t[n] = 1;
|
|
12
|
+
}
|
|
13
|
+
return n;
|
|
14
|
+
}
|
|
15
|
+
function d(e) {
|
|
16
|
+
let t = ee(e), n = [], r, i;
|
|
11
17
|
for (; t.length > 0;) r = t.shift() ?? 1, i = (t.length > 0 ? t.pop() : +r) ?? 1, n.push([r, i]);
|
|
12
18
|
return n;
|
|
13
19
|
}
|
|
14
|
-
function
|
|
15
|
-
let t =
|
|
20
|
+
function f(...e) {
|
|
21
|
+
let t = p(...e);
|
|
16
22
|
return e.map((e) => e / t);
|
|
17
23
|
}
|
|
18
|
-
function
|
|
24
|
+
function ee(e) {
|
|
25
|
+
if (!Number.isInteger(e)) throw new i(`dividers expects a finite integer, got ${e}`);
|
|
19
26
|
let t = Math.abs(e), n = Math.sqrt(t), r = [];
|
|
20
27
|
for (let i = 1; i <= n; i++) e % i === 0 && (r.push(i), r.push(t / i));
|
|
21
28
|
return r.sort(function(e, t) {
|
|
22
29
|
return e - t;
|
|
23
30
|
}), [...new Set(r)];
|
|
24
31
|
}
|
|
25
|
-
function
|
|
32
|
+
function p(...e) {
|
|
26
33
|
let t = function(e, n) {
|
|
27
34
|
return isNaN(e) || isNaN(n) ? NaN : n === 0 ? e : e === 0 ? n : t(n, e % n);
|
|
28
35
|
}, n = 1, r = 2;
|
|
29
36
|
if (e.length === 0) return 1;
|
|
30
|
-
if (e.length === 1) return e[0] === 0 ? 1 : e[0];
|
|
37
|
+
if (e.length === 1) return e[0] === 0 ? 1 : Math.abs(e[0]);
|
|
31
38
|
if (n = t(e[0], e[1]), n === 1) return 1;
|
|
32
39
|
for (r = 2; r < e.length && (n = t(n, e[r]), n !== 1); r++);
|
|
33
40
|
return Math.abs(n);
|
|
34
41
|
}
|
|
35
|
-
function
|
|
42
|
+
function te(...e) {
|
|
36
43
|
return e.reduce(function(e, t) {
|
|
37
|
-
return Math.abs(e
|
|
38
|
-
});
|
|
44
|
+
return Math.abs(e / p(e, t) * t);
|
|
45
|
+
}, 1);
|
|
39
46
|
}
|
|
40
|
-
function
|
|
41
|
-
|
|
47
|
+
function ne(e, t = 3) {
|
|
48
|
+
let n = Math.min(100, Math.max(0, Math.trunc(t)));
|
|
49
|
+
return +e.toFixed(n);
|
|
42
50
|
}
|
|
43
|
-
function
|
|
44
|
-
|
|
45
|
-
throw new a("Periodic value: Not implemented yet");
|
|
51
|
+
function re(e) {
|
|
52
|
+
return l ??= u(c), e === void 0 ? [...l] : l.slice(0, Math.min(l.length, e));
|
|
46
53
|
}
|
|
47
|
-
function
|
|
48
|
-
let t = [
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
5,
|
|
52
|
-
7,
|
|
53
|
-
11,
|
|
54
|
-
13,
|
|
55
|
-
17,
|
|
56
|
-
19,
|
|
57
|
-
23,
|
|
58
|
-
29,
|
|
59
|
-
31,
|
|
60
|
-
37,
|
|
61
|
-
41,
|
|
62
|
-
43,
|
|
63
|
-
47,
|
|
64
|
-
53,
|
|
65
|
-
59,
|
|
66
|
-
61,
|
|
67
|
-
67,
|
|
68
|
-
71,
|
|
69
|
-
73,
|
|
70
|
-
79,
|
|
71
|
-
83,
|
|
72
|
-
89,
|
|
73
|
-
97,
|
|
74
|
-
101,
|
|
75
|
-
103,
|
|
76
|
-
107,
|
|
77
|
-
109,
|
|
78
|
-
113,
|
|
79
|
-
127,
|
|
80
|
-
131,
|
|
81
|
-
137,
|
|
82
|
-
139,
|
|
83
|
-
149,
|
|
84
|
-
151,
|
|
85
|
-
157,
|
|
86
|
-
163,
|
|
87
|
-
167,
|
|
88
|
-
173,
|
|
89
|
-
179,
|
|
90
|
-
181,
|
|
91
|
-
191,
|
|
92
|
-
193,
|
|
93
|
-
197,
|
|
94
|
-
199,
|
|
95
|
-
211,
|
|
96
|
-
223,
|
|
97
|
-
227,
|
|
98
|
-
229,
|
|
99
|
-
233,
|
|
100
|
-
239,
|
|
101
|
-
241,
|
|
102
|
-
251,
|
|
103
|
-
257,
|
|
104
|
-
263,
|
|
105
|
-
269,
|
|
106
|
-
271,
|
|
107
|
-
277,
|
|
108
|
-
281,
|
|
109
|
-
283,
|
|
110
|
-
293,
|
|
111
|
-
307,
|
|
112
|
-
311,
|
|
113
|
-
313,
|
|
114
|
-
317,
|
|
115
|
-
331,
|
|
116
|
-
337,
|
|
117
|
-
347,
|
|
118
|
-
349,
|
|
119
|
-
353,
|
|
120
|
-
359,
|
|
121
|
-
367,
|
|
122
|
-
373,
|
|
123
|
-
379,
|
|
124
|
-
383,
|
|
125
|
-
389,
|
|
126
|
-
397,
|
|
127
|
-
401,
|
|
128
|
-
409,
|
|
129
|
-
419,
|
|
130
|
-
421,
|
|
131
|
-
431,
|
|
132
|
-
433,
|
|
133
|
-
439,
|
|
134
|
-
443,
|
|
135
|
-
449,
|
|
136
|
-
457,
|
|
137
|
-
461,
|
|
138
|
-
463,
|
|
139
|
-
467,
|
|
140
|
-
479,
|
|
141
|
-
487,
|
|
142
|
-
491,
|
|
143
|
-
499,
|
|
144
|
-
503,
|
|
145
|
-
509,
|
|
146
|
-
521,
|
|
147
|
-
523,
|
|
148
|
-
541,
|
|
149
|
-
547,
|
|
150
|
-
557,
|
|
151
|
-
563,
|
|
152
|
-
569,
|
|
153
|
-
571,
|
|
154
|
-
577,
|
|
155
|
-
587,
|
|
156
|
-
593,
|
|
157
|
-
599,
|
|
158
|
-
601,
|
|
159
|
-
607,
|
|
160
|
-
613,
|
|
161
|
-
617,
|
|
162
|
-
619,
|
|
163
|
-
631,
|
|
164
|
-
641,
|
|
165
|
-
643,
|
|
166
|
-
647,
|
|
167
|
-
653,
|
|
168
|
-
659,
|
|
169
|
-
661,
|
|
170
|
-
673,
|
|
171
|
-
677,
|
|
172
|
-
683,
|
|
173
|
-
691,
|
|
174
|
-
701,
|
|
175
|
-
709,
|
|
176
|
-
719,
|
|
177
|
-
727,
|
|
178
|
-
733,
|
|
179
|
-
739,
|
|
180
|
-
743,
|
|
181
|
-
751,
|
|
182
|
-
757,
|
|
183
|
-
761,
|
|
184
|
-
769,
|
|
185
|
-
773,
|
|
186
|
-
787,
|
|
187
|
-
797,
|
|
188
|
-
809,
|
|
189
|
-
811,
|
|
190
|
-
821,
|
|
191
|
-
823,
|
|
192
|
-
827,
|
|
193
|
-
829,
|
|
194
|
-
839,
|
|
195
|
-
853,
|
|
196
|
-
857,
|
|
197
|
-
859,
|
|
198
|
-
863,
|
|
199
|
-
877,
|
|
200
|
-
881,
|
|
201
|
-
883,
|
|
202
|
-
887,
|
|
203
|
-
907,
|
|
204
|
-
911,
|
|
205
|
-
919,
|
|
206
|
-
929,
|
|
207
|
-
937,
|
|
208
|
-
941,
|
|
209
|
-
947,
|
|
210
|
-
953,
|
|
211
|
-
967,
|
|
212
|
-
971,
|
|
213
|
-
977,
|
|
214
|
-
983,
|
|
215
|
-
991,
|
|
216
|
-
997,
|
|
217
|
-
1009,
|
|
218
|
-
1013,
|
|
219
|
-
1019,
|
|
220
|
-
1021,
|
|
221
|
-
1031,
|
|
222
|
-
1033,
|
|
223
|
-
1039,
|
|
224
|
-
1049,
|
|
225
|
-
1051,
|
|
226
|
-
1061,
|
|
227
|
-
1063,
|
|
228
|
-
1069,
|
|
229
|
-
1087,
|
|
230
|
-
1091,
|
|
231
|
-
1093,
|
|
232
|
-
1097,
|
|
233
|
-
1103,
|
|
234
|
-
1109,
|
|
235
|
-
1117,
|
|
236
|
-
1123,
|
|
237
|
-
1129,
|
|
238
|
-
1151,
|
|
239
|
-
1153,
|
|
240
|
-
1163,
|
|
241
|
-
1171,
|
|
242
|
-
1181,
|
|
243
|
-
1187,
|
|
244
|
-
1193,
|
|
245
|
-
1201,
|
|
246
|
-
1213,
|
|
247
|
-
1217,
|
|
248
|
-
1223,
|
|
249
|
-
1229,
|
|
250
|
-
1231,
|
|
251
|
-
1237,
|
|
252
|
-
1249,
|
|
253
|
-
1259,
|
|
254
|
-
1277,
|
|
255
|
-
1279,
|
|
256
|
-
1283,
|
|
257
|
-
1289,
|
|
258
|
-
1291,
|
|
259
|
-
1297,
|
|
260
|
-
1301,
|
|
261
|
-
1303,
|
|
262
|
-
1307,
|
|
263
|
-
1319,
|
|
264
|
-
1321,
|
|
265
|
-
1327,
|
|
266
|
-
1361,
|
|
267
|
-
1367,
|
|
268
|
-
1373,
|
|
269
|
-
1381,
|
|
270
|
-
1399,
|
|
271
|
-
1409,
|
|
272
|
-
1423,
|
|
273
|
-
1427,
|
|
274
|
-
1429,
|
|
275
|
-
1433,
|
|
276
|
-
1439,
|
|
277
|
-
1447,
|
|
278
|
-
1451,
|
|
279
|
-
1453,
|
|
280
|
-
1459,
|
|
281
|
-
1471,
|
|
282
|
-
1481,
|
|
283
|
-
1483,
|
|
284
|
-
1487,
|
|
285
|
-
1489,
|
|
286
|
-
1493,
|
|
287
|
-
1499,
|
|
288
|
-
1511,
|
|
289
|
-
1523,
|
|
290
|
-
1531,
|
|
291
|
-
1543,
|
|
292
|
-
1549,
|
|
293
|
-
1553,
|
|
294
|
-
1559,
|
|
295
|
-
1567,
|
|
296
|
-
1571,
|
|
297
|
-
1579,
|
|
298
|
-
1583,
|
|
299
|
-
1597,
|
|
300
|
-
1601,
|
|
301
|
-
1607,
|
|
302
|
-
1609,
|
|
303
|
-
1613,
|
|
304
|
-
1619,
|
|
305
|
-
1621,
|
|
306
|
-
1627,
|
|
307
|
-
1637,
|
|
308
|
-
1657,
|
|
309
|
-
1663,
|
|
310
|
-
1667,
|
|
311
|
-
1669,
|
|
312
|
-
1693,
|
|
313
|
-
1697,
|
|
314
|
-
1699,
|
|
315
|
-
1709,
|
|
316
|
-
1721,
|
|
317
|
-
1723,
|
|
318
|
-
1733,
|
|
319
|
-
1741,
|
|
320
|
-
1747,
|
|
321
|
-
1753,
|
|
322
|
-
1759,
|
|
323
|
-
1777,
|
|
324
|
-
1783,
|
|
325
|
-
1787,
|
|
326
|
-
1789,
|
|
327
|
-
1801,
|
|
328
|
-
1811,
|
|
329
|
-
1823,
|
|
330
|
-
1831,
|
|
331
|
-
1847,
|
|
332
|
-
1861,
|
|
333
|
-
1867,
|
|
334
|
-
1871,
|
|
335
|
-
1873,
|
|
336
|
-
1877,
|
|
337
|
-
1879,
|
|
338
|
-
1889,
|
|
339
|
-
1901,
|
|
340
|
-
1907,
|
|
341
|
-
1913,
|
|
342
|
-
1931,
|
|
343
|
-
1933,
|
|
344
|
-
1949,
|
|
345
|
-
1951,
|
|
346
|
-
1973,
|
|
347
|
-
1979,
|
|
348
|
-
1987,
|
|
349
|
-
1993,
|
|
350
|
-
1997,
|
|
351
|
-
1999,
|
|
352
|
-
2003,
|
|
353
|
-
2011,
|
|
354
|
-
2017,
|
|
355
|
-
2027,
|
|
356
|
-
2029,
|
|
357
|
-
2039,
|
|
358
|
-
2053,
|
|
359
|
-
2063,
|
|
360
|
-
2069,
|
|
361
|
-
2081,
|
|
362
|
-
2083,
|
|
363
|
-
2087,
|
|
364
|
-
2089,
|
|
365
|
-
2099,
|
|
366
|
-
2111,
|
|
367
|
-
2113,
|
|
368
|
-
2129,
|
|
369
|
-
2131,
|
|
370
|
-
2137,
|
|
371
|
-
2141,
|
|
372
|
-
2143,
|
|
373
|
-
2153,
|
|
374
|
-
2161,
|
|
375
|
-
2179,
|
|
376
|
-
2203,
|
|
377
|
-
2207,
|
|
378
|
-
2213,
|
|
379
|
-
2221,
|
|
380
|
-
2237,
|
|
381
|
-
2239,
|
|
382
|
-
2243,
|
|
383
|
-
2251,
|
|
384
|
-
2267,
|
|
385
|
-
2269,
|
|
386
|
-
2273,
|
|
387
|
-
2281,
|
|
388
|
-
2287,
|
|
389
|
-
2293,
|
|
390
|
-
2297,
|
|
391
|
-
2309,
|
|
392
|
-
2311,
|
|
393
|
-
2333,
|
|
394
|
-
2339,
|
|
395
|
-
2341,
|
|
396
|
-
2347,
|
|
397
|
-
2351,
|
|
398
|
-
2357,
|
|
399
|
-
2371,
|
|
400
|
-
2377,
|
|
401
|
-
2381,
|
|
402
|
-
2383,
|
|
403
|
-
2389,
|
|
404
|
-
2393,
|
|
405
|
-
2399,
|
|
406
|
-
2411,
|
|
407
|
-
2417,
|
|
408
|
-
2423,
|
|
409
|
-
2437,
|
|
410
|
-
2441,
|
|
411
|
-
2447,
|
|
412
|
-
2459,
|
|
413
|
-
2467,
|
|
414
|
-
2473,
|
|
415
|
-
2477,
|
|
416
|
-
2503,
|
|
417
|
-
2521,
|
|
418
|
-
2531,
|
|
419
|
-
2539,
|
|
420
|
-
2543,
|
|
421
|
-
2549,
|
|
422
|
-
2551,
|
|
423
|
-
2557,
|
|
424
|
-
2579,
|
|
425
|
-
2591,
|
|
426
|
-
2593,
|
|
427
|
-
2609,
|
|
428
|
-
2617,
|
|
429
|
-
2621,
|
|
430
|
-
2633,
|
|
431
|
-
2647,
|
|
432
|
-
2657,
|
|
433
|
-
2659,
|
|
434
|
-
2663,
|
|
435
|
-
2671,
|
|
436
|
-
2677,
|
|
437
|
-
2683,
|
|
438
|
-
2687,
|
|
439
|
-
2689,
|
|
440
|
-
2693,
|
|
441
|
-
2699,
|
|
442
|
-
2707,
|
|
443
|
-
2711,
|
|
444
|
-
2713,
|
|
445
|
-
2719,
|
|
446
|
-
2729,
|
|
447
|
-
2731,
|
|
448
|
-
2741,
|
|
449
|
-
2749,
|
|
450
|
-
2753,
|
|
451
|
-
2767,
|
|
452
|
-
2777,
|
|
453
|
-
2789,
|
|
454
|
-
2791,
|
|
455
|
-
2797,
|
|
456
|
-
2801,
|
|
457
|
-
2803,
|
|
458
|
-
2819,
|
|
459
|
-
2833,
|
|
460
|
-
2837,
|
|
461
|
-
2843,
|
|
462
|
-
2851,
|
|
463
|
-
2857,
|
|
464
|
-
2861,
|
|
465
|
-
2879,
|
|
466
|
-
2887,
|
|
467
|
-
2897,
|
|
468
|
-
2903,
|
|
469
|
-
2909,
|
|
470
|
-
2917,
|
|
471
|
-
2927,
|
|
472
|
-
2939,
|
|
473
|
-
2953,
|
|
474
|
-
2957,
|
|
475
|
-
2963,
|
|
476
|
-
2969,
|
|
477
|
-
2971,
|
|
478
|
-
2999,
|
|
479
|
-
3001,
|
|
480
|
-
3011,
|
|
481
|
-
3019,
|
|
482
|
-
3023,
|
|
483
|
-
3037,
|
|
484
|
-
3041,
|
|
485
|
-
3049,
|
|
486
|
-
3061,
|
|
487
|
-
3067,
|
|
488
|
-
3079,
|
|
489
|
-
3083,
|
|
490
|
-
3089,
|
|
491
|
-
3109,
|
|
492
|
-
3119,
|
|
493
|
-
3121,
|
|
494
|
-
3137,
|
|
495
|
-
3163,
|
|
496
|
-
3167,
|
|
497
|
-
3169,
|
|
498
|
-
3181,
|
|
499
|
-
3187,
|
|
500
|
-
3191,
|
|
501
|
-
3203,
|
|
502
|
-
3209,
|
|
503
|
-
3217,
|
|
504
|
-
3221,
|
|
505
|
-
3229,
|
|
506
|
-
3251,
|
|
507
|
-
3253,
|
|
508
|
-
3257,
|
|
509
|
-
3259,
|
|
510
|
-
3271,
|
|
511
|
-
3299,
|
|
512
|
-
3301,
|
|
513
|
-
3307,
|
|
514
|
-
3313,
|
|
515
|
-
3319,
|
|
516
|
-
3323,
|
|
517
|
-
3329,
|
|
518
|
-
3331,
|
|
519
|
-
3343,
|
|
520
|
-
3347,
|
|
521
|
-
3359,
|
|
522
|
-
3361,
|
|
523
|
-
3371,
|
|
524
|
-
3373,
|
|
525
|
-
3389,
|
|
526
|
-
3391,
|
|
527
|
-
3407,
|
|
528
|
-
3413,
|
|
529
|
-
3433,
|
|
530
|
-
3449,
|
|
531
|
-
3457,
|
|
532
|
-
3461,
|
|
533
|
-
3463,
|
|
534
|
-
3467,
|
|
535
|
-
3469,
|
|
536
|
-
3491,
|
|
537
|
-
3499,
|
|
538
|
-
3511,
|
|
539
|
-
3517,
|
|
540
|
-
3527,
|
|
541
|
-
3529,
|
|
542
|
-
3533,
|
|
543
|
-
3539,
|
|
544
|
-
3541,
|
|
545
|
-
3547,
|
|
546
|
-
3557,
|
|
547
|
-
3559,
|
|
548
|
-
3571,
|
|
549
|
-
3581,
|
|
550
|
-
3583,
|
|
551
|
-
3593,
|
|
552
|
-
3607,
|
|
553
|
-
3613,
|
|
554
|
-
3617,
|
|
555
|
-
3623,
|
|
556
|
-
3631,
|
|
557
|
-
3637,
|
|
558
|
-
3643,
|
|
559
|
-
3659,
|
|
560
|
-
3671,
|
|
561
|
-
3673,
|
|
562
|
-
3677,
|
|
563
|
-
3691,
|
|
564
|
-
3697,
|
|
565
|
-
3701,
|
|
566
|
-
3709,
|
|
567
|
-
3719,
|
|
568
|
-
3727,
|
|
569
|
-
3733,
|
|
570
|
-
3739,
|
|
571
|
-
3761,
|
|
572
|
-
3767,
|
|
573
|
-
3769,
|
|
574
|
-
3779,
|
|
575
|
-
3793,
|
|
576
|
-
3797,
|
|
577
|
-
3803,
|
|
578
|
-
3821,
|
|
579
|
-
3823,
|
|
580
|
-
3833,
|
|
581
|
-
3847,
|
|
582
|
-
3851,
|
|
583
|
-
3853,
|
|
584
|
-
3863,
|
|
585
|
-
3877,
|
|
586
|
-
3881,
|
|
587
|
-
3889,
|
|
588
|
-
3907,
|
|
589
|
-
3911,
|
|
590
|
-
3917,
|
|
591
|
-
3919,
|
|
592
|
-
3923,
|
|
593
|
-
3929,
|
|
594
|
-
3931,
|
|
595
|
-
3943,
|
|
596
|
-
3947,
|
|
597
|
-
3967,
|
|
598
|
-
3989,
|
|
599
|
-
4001,
|
|
600
|
-
4003,
|
|
601
|
-
4007,
|
|
602
|
-
4013,
|
|
603
|
-
4019,
|
|
604
|
-
4021,
|
|
605
|
-
4027,
|
|
606
|
-
4049,
|
|
607
|
-
4051,
|
|
608
|
-
4057,
|
|
609
|
-
4073,
|
|
610
|
-
4079,
|
|
611
|
-
4091,
|
|
612
|
-
4093,
|
|
613
|
-
4099,
|
|
614
|
-
4111,
|
|
615
|
-
4127,
|
|
616
|
-
4129,
|
|
617
|
-
4133,
|
|
618
|
-
4139,
|
|
619
|
-
4153,
|
|
620
|
-
4157,
|
|
621
|
-
4159,
|
|
622
|
-
4177,
|
|
623
|
-
4201,
|
|
624
|
-
4211,
|
|
625
|
-
4217,
|
|
626
|
-
4219,
|
|
627
|
-
4229,
|
|
628
|
-
4231,
|
|
629
|
-
4241,
|
|
630
|
-
4243,
|
|
631
|
-
4253,
|
|
632
|
-
4259,
|
|
633
|
-
4261,
|
|
634
|
-
4271,
|
|
635
|
-
4273,
|
|
636
|
-
4283,
|
|
637
|
-
4289,
|
|
638
|
-
4297,
|
|
639
|
-
4327,
|
|
640
|
-
4337,
|
|
641
|
-
4339,
|
|
642
|
-
4349,
|
|
643
|
-
4357,
|
|
644
|
-
4363,
|
|
645
|
-
4373,
|
|
646
|
-
4391,
|
|
647
|
-
4397,
|
|
648
|
-
4409,
|
|
649
|
-
4421,
|
|
650
|
-
4423,
|
|
651
|
-
4441,
|
|
652
|
-
4447,
|
|
653
|
-
4451,
|
|
654
|
-
4457,
|
|
655
|
-
4463,
|
|
656
|
-
4481,
|
|
657
|
-
4483,
|
|
658
|
-
4493,
|
|
659
|
-
4507,
|
|
660
|
-
4513,
|
|
661
|
-
4517,
|
|
662
|
-
4519,
|
|
663
|
-
4523,
|
|
664
|
-
4547,
|
|
665
|
-
4549,
|
|
666
|
-
4561,
|
|
667
|
-
4567,
|
|
668
|
-
4583,
|
|
669
|
-
4591,
|
|
670
|
-
4597,
|
|
671
|
-
4603,
|
|
672
|
-
4621,
|
|
673
|
-
4637,
|
|
674
|
-
4639,
|
|
675
|
-
4643,
|
|
676
|
-
4649,
|
|
677
|
-
4651,
|
|
678
|
-
4657,
|
|
679
|
-
4663,
|
|
680
|
-
4673,
|
|
681
|
-
4679,
|
|
682
|
-
4691,
|
|
683
|
-
4703,
|
|
684
|
-
4721,
|
|
685
|
-
4723,
|
|
686
|
-
4729,
|
|
687
|
-
4733,
|
|
688
|
-
4751,
|
|
689
|
-
4759,
|
|
690
|
-
4783,
|
|
691
|
-
4787,
|
|
692
|
-
4789,
|
|
693
|
-
4793,
|
|
694
|
-
4799,
|
|
695
|
-
4801,
|
|
696
|
-
4813,
|
|
697
|
-
4817,
|
|
698
|
-
4831,
|
|
699
|
-
4861,
|
|
700
|
-
4871,
|
|
701
|
-
4877,
|
|
702
|
-
4889,
|
|
703
|
-
4903,
|
|
704
|
-
4909,
|
|
705
|
-
4919,
|
|
706
|
-
4931,
|
|
707
|
-
4933,
|
|
708
|
-
4937,
|
|
709
|
-
4943,
|
|
710
|
-
4951,
|
|
711
|
-
4957,
|
|
712
|
-
4967,
|
|
713
|
-
4969,
|
|
714
|
-
4973,
|
|
715
|
-
4987,
|
|
716
|
-
4993,
|
|
717
|
-
4999,
|
|
718
|
-
5003,
|
|
719
|
-
5009,
|
|
720
|
-
5011,
|
|
721
|
-
5021,
|
|
722
|
-
5023,
|
|
723
|
-
5039,
|
|
724
|
-
5051,
|
|
725
|
-
5059,
|
|
726
|
-
5077,
|
|
727
|
-
5081,
|
|
728
|
-
5087,
|
|
729
|
-
5099,
|
|
730
|
-
5101,
|
|
731
|
-
5107,
|
|
732
|
-
5113,
|
|
733
|
-
5119,
|
|
734
|
-
5147,
|
|
735
|
-
5153,
|
|
736
|
-
5167,
|
|
737
|
-
5171,
|
|
738
|
-
5179,
|
|
739
|
-
5189,
|
|
740
|
-
5197,
|
|
741
|
-
5209,
|
|
742
|
-
5227,
|
|
743
|
-
5231,
|
|
744
|
-
5233,
|
|
745
|
-
5237,
|
|
746
|
-
5261,
|
|
747
|
-
5273,
|
|
748
|
-
5279,
|
|
749
|
-
5281,
|
|
750
|
-
5297,
|
|
751
|
-
5303,
|
|
752
|
-
5309,
|
|
753
|
-
5323,
|
|
754
|
-
5333,
|
|
755
|
-
5347,
|
|
756
|
-
5351,
|
|
757
|
-
5381,
|
|
758
|
-
5387,
|
|
759
|
-
5393,
|
|
760
|
-
5399,
|
|
761
|
-
5407,
|
|
762
|
-
5413,
|
|
763
|
-
5417,
|
|
764
|
-
5419,
|
|
765
|
-
5431,
|
|
766
|
-
5437,
|
|
767
|
-
5441,
|
|
768
|
-
5443,
|
|
769
|
-
5449,
|
|
770
|
-
5471,
|
|
771
|
-
5477,
|
|
772
|
-
5479,
|
|
773
|
-
5483,
|
|
774
|
-
5501,
|
|
775
|
-
5503,
|
|
776
|
-
5507,
|
|
777
|
-
5519,
|
|
778
|
-
5521,
|
|
779
|
-
5527,
|
|
780
|
-
5531,
|
|
781
|
-
5557,
|
|
782
|
-
5563,
|
|
783
|
-
5569,
|
|
784
|
-
5573,
|
|
785
|
-
5581,
|
|
786
|
-
5591,
|
|
787
|
-
5623,
|
|
788
|
-
5639,
|
|
789
|
-
5641,
|
|
790
|
-
5647,
|
|
791
|
-
5651,
|
|
792
|
-
5653,
|
|
793
|
-
5657,
|
|
794
|
-
5659,
|
|
795
|
-
5669,
|
|
796
|
-
5683,
|
|
797
|
-
5689,
|
|
798
|
-
5693,
|
|
799
|
-
5701,
|
|
800
|
-
5711,
|
|
801
|
-
5717,
|
|
802
|
-
5737,
|
|
803
|
-
5741,
|
|
804
|
-
5743,
|
|
805
|
-
5749,
|
|
806
|
-
5779,
|
|
807
|
-
5783,
|
|
808
|
-
5791,
|
|
809
|
-
5801,
|
|
810
|
-
5807,
|
|
811
|
-
5813,
|
|
812
|
-
5821,
|
|
813
|
-
5827,
|
|
814
|
-
5839,
|
|
815
|
-
5843,
|
|
816
|
-
5849,
|
|
817
|
-
5851,
|
|
818
|
-
5857,
|
|
819
|
-
5861,
|
|
820
|
-
5867,
|
|
821
|
-
5869,
|
|
822
|
-
5879,
|
|
823
|
-
5881,
|
|
824
|
-
5897,
|
|
825
|
-
5903,
|
|
826
|
-
5923,
|
|
827
|
-
5927,
|
|
828
|
-
5939,
|
|
829
|
-
5953,
|
|
830
|
-
5981,
|
|
831
|
-
5987,
|
|
832
|
-
6007,
|
|
833
|
-
6011,
|
|
834
|
-
6029,
|
|
835
|
-
6037,
|
|
836
|
-
6043,
|
|
837
|
-
6047,
|
|
838
|
-
6053,
|
|
839
|
-
6067,
|
|
840
|
-
6073,
|
|
841
|
-
6079,
|
|
842
|
-
6089,
|
|
843
|
-
6091,
|
|
844
|
-
6101,
|
|
845
|
-
6113,
|
|
846
|
-
6121,
|
|
847
|
-
6131,
|
|
848
|
-
6133,
|
|
849
|
-
6143,
|
|
850
|
-
6151,
|
|
851
|
-
6163,
|
|
852
|
-
6173,
|
|
853
|
-
6197,
|
|
854
|
-
6199,
|
|
855
|
-
6203,
|
|
856
|
-
6211,
|
|
857
|
-
6217,
|
|
858
|
-
6221,
|
|
859
|
-
6229,
|
|
860
|
-
6247,
|
|
861
|
-
6257,
|
|
862
|
-
6263,
|
|
863
|
-
6269,
|
|
864
|
-
6271,
|
|
865
|
-
6277,
|
|
866
|
-
6287,
|
|
867
|
-
6299,
|
|
868
|
-
6301,
|
|
869
|
-
6311,
|
|
870
|
-
6317,
|
|
871
|
-
6323,
|
|
872
|
-
6329,
|
|
873
|
-
6337,
|
|
874
|
-
6343,
|
|
875
|
-
6353,
|
|
876
|
-
6359,
|
|
877
|
-
6361,
|
|
878
|
-
6367,
|
|
879
|
-
6373,
|
|
880
|
-
6379,
|
|
881
|
-
6389,
|
|
882
|
-
6397,
|
|
883
|
-
6421,
|
|
884
|
-
6427,
|
|
885
|
-
6449,
|
|
886
|
-
6451,
|
|
887
|
-
6469,
|
|
888
|
-
6473,
|
|
889
|
-
6481,
|
|
890
|
-
6491,
|
|
891
|
-
6521,
|
|
892
|
-
6529,
|
|
893
|
-
6547,
|
|
894
|
-
6551,
|
|
895
|
-
6553,
|
|
896
|
-
6563,
|
|
897
|
-
6569,
|
|
898
|
-
6571,
|
|
899
|
-
6577,
|
|
900
|
-
6581,
|
|
901
|
-
6599,
|
|
902
|
-
6607,
|
|
903
|
-
6619,
|
|
904
|
-
6637,
|
|
905
|
-
6653,
|
|
906
|
-
6659,
|
|
907
|
-
6661,
|
|
908
|
-
6673,
|
|
909
|
-
6679,
|
|
910
|
-
6689,
|
|
911
|
-
6691,
|
|
912
|
-
6701,
|
|
913
|
-
6703,
|
|
914
|
-
6709,
|
|
915
|
-
6719,
|
|
916
|
-
6733,
|
|
917
|
-
6737,
|
|
918
|
-
6761,
|
|
919
|
-
6763,
|
|
920
|
-
6779,
|
|
921
|
-
6781,
|
|
922
|
-
6791,
|
|
923
|
-
6793,
|
|
924
|
-
6803,
|
|
925
|
-
6823,
|
|
926
|
-
6827,
|
|
927
|
-
6829,
|
|
928
|
-
6833,
|
|
929
|
-
6841,
|
|
930
|
-
6857,
|
|
931
|
-
6863,
|
|
932
|
-
6869,
|
|
933
|
-
6871,
|
|
934
|
-
6883,
|
|
935
|
-
6899,
|
|
936
|
-
6907,
|
|
937
|
-
6911,
|
|
938
|
-
6917,
|
|
939
|
-
6947,
|
|
940
|
-
6949,
|
|
941
|
-
6959,
|
|
942
|
-
6961,
|
|
943
|
-
6967,
|
|
944
|
-
6971,
|
|
945
|
-
6977,
|
|
946
|
-
6983,
|
|
947
|
-
6991,
|
|
948
|
-
6997,
|
|
949
|
-
7001,
|
|
950
|
-
7013,
|
|
951
|
-
7019,
|
|
952
|
-
7027,
|
|
953
|
-
7039,
|
|
954
|
-
7043,
|
|
955
|
-
7057,
|
|
956
|
-
7069,
|
|
957
|
-
7079,
|
|
958
|
-
7103,
|
|
959
|
-
7109,
|
|
960
|
-
7121,
|
|
961
|
-
7127,
|
|
962
|
-
7129,
|
|
963
|
-
7151,
|
|
964
|
-
7159,
|
|
965
|
-
7177,
|
|
966
|
-
7187,
|
|
967
|
-
7193,
|
|
968
|
-
7207,
|
|
969
|
-
7211,
|
|
970
|
-
7213,
|
|
971
|
-
7219,
|
|
972
|
-
7229,
|
|
973
|
-
7237,
|
|
974
|
-
7243,
|
|
975
|
-
7247,
|
|
976
|
-
7253,
|
|
977
|
-
7283,
|
|
978
|
-
7297,
|
|
979
|
-
7307,
|
|
980
|
-
7309,
|
|
981
|
-
7321,
|
|
982
|
-
7331,
|
|
983
|
-
7333,
|
|
984
|
-
7349,
|
|
985
|
-
7351,
|
|
986
|
-
7369,
|
|
987
|
-
7393,
|
|
988
|
-
7411,
|
|
989
|
-
7417,
|
|
990
|
-
7433,
|
|
991
|
-
7451,
|
|
992
|
-
7457,
|
|
993
|
-
7459,
|
|
994
|
-
7477,
|
|
995
|
-
7481,
|
|
996
|
-
7487,
|
|
997
|
-
7489,
|
|
998
|
-
7499,
|
|
999
|
-
7507,
|
|
1000
|
-
7517,
|
|
1001
|
-
7523,
|
|
1002
|
-
7529,
|
|
1003
|
-
7537,
|
|
1004
|
-
7541,
|
|
1005
|
-
7547,
|
|
1006
|
-
7549,
|
|
1007
|
-
7559,
|
|
1008
|
-
7561,
|
|
1009
|
-
7573,
|
|
1010
|
-
7577,
|
|
1011
|
-
7583,
|
|
1012
|
-
7589,
|
|
1013
|
-
7591,
|
|
1014
|
-
7603,
|
|
1015
|
-
7607,
|
|
1016
|
-
7621,
|
|
1017
|
-
7639,
|
|
1018
|
-
7643,
|
|
1019
|
-
7649,
|
|
1020
|
-
7669,
|
|
1021
|
-
7673,
|
|
1022
|
-
7681,
|
|
1023
|
-
7687,
|
|
1024
|
-
7691,
|
|
1025
|
-
7699,
|
|
1026
|
-
7703,
|
|
1027
|
-
7717,
|
|
1028
|
-
7723,
|
|
1029
|
-
7727,
|
|
1030
|
-
7741,
|
|
1031
|
-
7753,
|
|
1032
|
-
7757,
|
|
1033
|
-
7759,
|
|
1034
|
-
7789,
|
|
1035
|
-
7793,
|
|
1036
|
-
7817,
|
|
1037
|
-
7823,
|
|
1038
|
-
7829,
|
|
1039
|
-
7841,
|
|
1040
|
-
7853,
|
|
1041
|
-
7867,
|
|
1042
|
-
7873,
|
|
1043
|
-
7877,
|
|
1044
|
-
7879,
|
|
1045
|
-
7883,
|
|
1046
|
-
7901,
|
|
1047
|
-
7907,
|
|
1048
|
-
7919,
|
|
1049
|
-
7927,
|
|
1050
|
-
7933,
|
|
1051
|
-
7937,
|
|
1052
|
-
7949,
|
|
1053
|
-
7951,
|
|
1054
|
-
7963,
|
|
1055
|
-
7993,
|
|
1056
|
-
8009,
|
|
1057
|
-
8011,
|
|
1058
|
-
8017,
|
|
1059
|
-
8039,
|
|
1060
|
-
8053,
|
|
1061
|
-
8059,
|
|
1062
|
-
8069,
|
|
1063
|
-
8081,
|
|
1064
|
-
8087,
|
|
1065
|
-
8089,
|
|
1066
|
-
8093,
|
|
1067
|
-
8101,
|
|
1068
|
-
8111,
|
|
1069
|
-
8117,
|
|
1070
|
-
8123,
|
|
1071
|
-
8147,
|
|
1072
|
-
8161,
|
|
1073
|
-
8167,
|
|
1074
|
-
8171,
|
|
1075
|
-
8179,
|
|
1076
|
-
8191,
|
|
1077
|
-
8209,
|
|
1078
|
-
8219,
|
|
1079
|
-
8221,
|
|
1080
|
-
8231,
|
|
1081
|
-
8233,
|
|
1082
|
-
8237,
|
|
1083
|
-
8243,
|
|
1084
|
-
8263,
|
|
1085
|
-
8269,
|
|
1086
|
-
8273,
|
|
1087
|
-
8287,
|
|
1088
|
-
8291,
|
|
1089
|
-
8293,
|
|
1090
|
-
8297,
|
|
1091
|
-
8311,
|
|
1092
|
-
8317,
|
|
1093
|
-
8329,
|
|
1094
|
-
8353,
|
|
1095
|
-
8363,
|
|
1096
|
-
8369,
|
|
1097
|
-
8377,
|
|
1098
|
-
8387,
|
|
1099
|
-
8389,
|
|
1100
|
-
8419,
|
|
1101
|
-
8423,
|
|
1102
|
-
8429,
|
|
1103
|
-
8431,
|
|
1104
|
-
8443,
|
|
1105
|
-
8447,
|
|
1106
|
-
8461,
|
|
1107
|
-
8467,
|
|
1108
|
-
8501,
|
|
1109
|
-
8513,
|
|
1110
|
-
8521,
|
|
1111
|
-
8527,
|
|
1112
|
-
8537,
|
|
1113
|
-
8539,
|
|
1114
|
-
8543,
|
|
1115
|
-
8563,
|
|
1116
|
-
8573,
|
|
1117
|
-
8581,
|
|
1118
|
-
8597,
|
|
1119
|
-
8599,
|
|
1120
|
-
8609,
|
|
1121
|
-
8623,
|
|
1122
|
-
8627,
|
|
1123
|
-
8629,
|
|
1124
|
-
8641,
|
|
1125
|
-
8647,
|
|
1126
|
-
8663,
|
|
1127
|
-
8669,
|
|
1128
|
-
8677,
|
|
1129
|
-
8681,
|
|
1130
|
-
8689,
|
|
1131
|
-
8693,
|
|
1132
|
-
8699,
|
|
1133
|
-
8707,
|
|
1134
|
-
8713,
|
|
1135
|
-
8719,
|
|
1136
|
-
8731,
|
|
1137
|
-
8737,
|
|
1138
|
-
8741,
|
|
1139
|
-
8747,
|
|
1140
|
-
8753,
|
|
1141
|
-
8761,
|
|
1142
|
-
8779,
|
|
1143
|
-
8783,
|
|
1144
|
-
8803,
|
|
1145
|
-
8807,
|
|
1146
|
-
8819,
|
|
1147
|
-
8821,
|
|
1148
|
-
8831,
|
|
1149
|
-
8837,
|
|
1150
|
-
8839,
|
|
1151
|
-
8849,
|
|
1152
|
-
8861,
|
|
1153
|
-
8863,
|
|
1154
|
-
8867,
|
|
1155
|
-
8887,
|
|
1156
|
-
8893,
|
|
1157
|
-
8923,
|
|
1158
|
-
8929,
|
|
1159
|
-
8933,
|
|
1160
|
-
8941,
|
|
1161
|
-
8951,
|
|
1162
|
-
8963,
|
|
1163
|
-
8969,
|
|
1164
|
-
8971,
|
|
1165
|
-
8999,
|
|
1166
|
-
9001,
|
|
1167
|
-
9007,
|
|
1168
|
-
9011,
|
|
1169
|
-
9013,
|
|
1170
|
-
9029,
|
|
1171
|
-
9041,
|
|
1172
|
-
9043,
|
|
1173
|
-
9049,
|
|
1174
|
-
9059,
|
|
1175
|
-
9067,
|
|
1176
|
-
9091,
|
|
1177
|
-
9103,
|
|
1178
|
-
9109,
|
|
1179
|
-
9127,
|
|
1180
|
-
9133,
|
|
1181
|
-
9137,
|
|
1182
|
-
9151,
|
|
1183
|
-
9157,
|
|
1184
|
-
9161,
|
|
1185
|
-
9173,
|
|
1186
|
-
9181,
|
|
1187
|
-
9187,
|
|
1188
|
-
9199,
|
|
1189
|
-
9203,
|
|
1190
|
-
9209,
|
|
1191
|
-
9221,
|
|
1192
|
-
9227,
|
|
1193
|
-
9239,
|
|
1194
|
-
9241,
|
|
1195
|
-
9257,
|
|
1196
|
-
9277,
|
|
1197
|
-
9281,
|
|
1198
|
-
9283,
|
|
1199
|
-
9293,
|
|
1200
|
-
9311,
|
|
1201
|
-
9319,
|
|
1202
|
-
9323,
|
|
1203
|
-
9337,
|
|
1204
|
-
9341,
|
|
1205
|
-
9343,
|
|
1206
|
-
9349,
|
|
1207
|
-
9371,
|
|
1208
|
-
9377,
|
|
1209
|
-
9391,
|
|
1210
|
-
9397,
|
|
1211
|
-
9403,
|
|
1212
|
-
9413,
|
|
1213
|
-
9419,
|
|
1214
|
-
9421,
|
|
1215
|
-
9431,
|
|
1216
|
-
9433,
|
|
1217
|
-
9437,
|
|
1218
|
-
9439,
|
|
1219
|
-
9461,
|
|
1220
|
-
9463,
|
|
1221
|
-
9467,
|
|
1222
|
-
9473,
|
|
1223
|
-
9479,
|
|
1224
|
-
9491,
|
|
1225
|
-
9497,
|
|
1226
|
-
9511,
|
|
1227
|
-
9521,
|
|
1228
|
-
9533,
|
|
1229
|
-
9539,
|
|
1230
|
-
9547,
|
|
1231
|
-
9551,
|
|
1232
|
-
9587,
|
|
1233
|
-
9601,
|
|
1234
|
-
9613,
|
|
1235
|
-
9619,
|
|
1236
|
-
9623,
|
|
1237
|
-
9629,
|
|
1238
|
-
9631,
|
|
1239
|
-
9643,
|
|
1240
|
-
9649,
|
|
1241
|
-
9661,
|
|
1242
|
-
9677,
|
|
1243
|
-
9679,
|
|
1244
|
-
9689,
|
|
1245
|
-
9697,
|
|
1246
|
-
9719,
|
|
1247
|
-
9721,
|
|
1248
|
-
9733,
|
|
1249
|
-
9739,
|
|
1250
|
-
9743,
|
|
1251
|
-
9749,
|
|
1252
|
-
9767,
|
|
1253
|
-
9769,
|
|
1254
|
-
9781,
|
|
1255
|
-
9787,
|
|
1256
|
-
9791,
|
|
1257
|
-
9803,
|
|
1258
|
-
9811,
|
|
1259
|
-
9817,
|
|
1260
|
-
9829,
|
|
1261
|
-
9833,
|
|
1262
|
-
9839,
|
|
1263
|
-
9851,
|
|
1264
|
-
9857,
|
|
1265
|
-
9859,
|
|
1266
|
-
9871,
|
|
1267
|
-
9883,
|
|
1268
|
-
9887,
|
|
1269
|
-
9901,
|
|
1270
|
-
9907,
|
|
1271
|
-
9923,
|
|
1272
|
-
9929,
|
|
1273
|
-
9931,
|
|
1274
|
-
9941,
|
|
1275
|
-
9949,
|
|
1276
|
-
9967,
|
|
1277
|
-
9973
|
|
1278
|
-
];
|
|
1279
|
-
return e === void 0 ? t : t.slice(0, Math.min(t.length, e));
|
|
1280
|
-
}
|
|
1281
|
-
function re(e, t) {
|
|
1282
|
-
let n = [], r = t === !0 ? +e : e ** 2;
|
|
1283
|
-
for (let t = 0; t <= e; t++) for (let i = 0; i <= e; i++) t ** 2 + i ** 2 === r && n.push([
|
|
54
|
+
function ie(e, t) {
|
|
55
|
+
let n = t === !0 ? e : e ** 2, r = t === !0 ? Math.sqrt(e) : e, i = [];
|
|
56
|
+
for (let e = 0; e <= r; e++) for (let t = 0; t <= r; t++) e ** 2 + t ** 2 === n && i.push([
|
|
57
|
+
e,
|
|
1284
58
|
t,
|
|
1285
|
-
|
|
1286
|
-
e
|
|
59
|
+
r
|
|
1287
60
|
]);
|
|
1288
|
-
return
|
|
61
|
+
return i;
|
|
1289
62
|
}
|
|
1290
|
-
function
|
|
1291
|
-
let n = Math.round(Number(`${e}e${
|
|
1292
|
-
return Number(`${
|
|
63
|
+
function ae(e, t = 2) {
|
|
64
|
+
let n = Math.trunc(t), r = Math.round(Number(`${e}e${n}`));
|
|
65
|
+
return Number(`${r}e${-n}`);
|
|
1293
66
|
}
|
|
1294
|
-
function
|
|
1295
|
-
|
|
67
|
+
function m(e, t) {
|
|
68
|
+
if (t <= 0) return 1;
|
|
69
|
+
if (e < 0) return t % 2 == 1 ? -m(-e, t) : 1;
|
|
70
|
+
let n = Math.floor(e ** (1 / t));
|
|
1296
71
|
for (; n > 1;) {
|
|
1297
|
-
let
|
|
1298
|
-
if (
|
|
72
|
+
let r = n ** +t;
|
|
73
|
+
if (e % r === 0) return r;
|
|
1299
74
|
n--;
|
|
1300
75
|
}
|
|
1301
76
|
return 1;
|
|
1302
77
|
}
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
78
|
+
function h(e, t) {
|
|
79
|
+
if (t <= 0) return NaN;
|
|
80
|
+
if (e < 0) return t % 2 == 1 ? -h(-e, t) : NaN;
|
|
81
|
+
let n = e ** (1 / t), r = Math.round(n);
|
|
82
|
+
return r ** +t === e ? r : n;
|
|
83
|
+
}
|
|
84
|
+
var g = Object.freeze({
|
|
85
|
+
decompose: d,
|
|
86
|
+
dividers: ee,
|
|
87
|
+
divideNumbersByGCD: f,
|
|
88
|
+
gcd: p,
|
|
89
|
+
lcm: te,
|
|
90
|
+
numberCorrection: ne,
|
|
91
|
+
primes: re,
|
|
92
|
+
pythagoreanTripletsWithTarget: ie,
|
|
93
|
+
round: ae,
|
|
94
|
+
greatestPower: m,
|
|
95
|
+
nthRoot: h
|
|
96
|
+
}), oe = /* @__PURE__ */ function(e) {
|
|
1316
97
|
return e.frac = "frac", e.dfrac = "dfrac", e.tfrac = "tfrac", e;
|
|
1317
|
-
}({}),
|
|
98
|
+
}({}), _ = class e {
|
|
1318
99
|
#e = 1;
|
|
1319
100
|
#t = 3;
|
|
1320
101
|
#n = !0;
|
|
@@ -1324,11 +105,13 @@ var p = {
|
|
|
1324
105
|
constructor(e, t) {
|
|
1325
106
|
return e !== void 0 && this.parse(e, t), this;
|
|
1326
107
|
}
|
|
1327
|
-
parse
|
|
1328
|
-
|
|
108
|
+
parse(t, n) {
|
|
109
|
+
return t === "" ? (this.#r = 0, this.#e = 1, this) : typeof t == "number" && isNaN(t) ? this.invalid() : typeof t == "number" && !isFinite(t) ? (this.infinite(), t < 0 && this.opposite(), this) : typeof t == "string" ? this.fromString(t) : typeof t == "number" && n === void 0 ? this.fromNumber(t) : typeof t == "number" && typeof n == "number" ? this.fromNumbers(t, n) : t instanceof e ? this.copy(t) : this;
|
|
110
|
+
}
|
|
111
|
+
clone() {
|
|
1329
112
|
let t = new e();
|
|
1330
113
|
return t.numerator = this.#r, t.denominator = this.#e, t.exact = this.exact, t.#i = this.#i, t.#t = this.#t, t.#a = this.#a, t;
|
|
1331
|
-
}
|
|
114
|
+
}
|
|
1332
115
|
copy(e) {
|
|
1333
116
|
return this.#r = e.numerator, this.#e = e.denominator, this.#n = e.exact, this;
|
|
1334
117
|
}
|
|
@@ -1342,12 +125,14 @@ var p = {
|
|
|
1342
125
|
let e = this.#a && this.isPositive() ? "+" : "";
|
|
1343
126
|
return this.exact ? this.#e === 1 ? `${e}${this.#r}` : `${e}${this.#r}/${this.#e}` : e + this.value.toFixed(this.#t);
|
|
1344
127
|
}
|
|
1345
|
-
static areEquals
|
|
1346
|
-
|
|
128
|
+
static areEquals(...e) {
|
|
129
|
+
return e.every((t) => t.isEqual(e[0]));
|
|
130
|
+
}
|
|
131
|
+
static average(...t) {
|
|
1347
132
|
let n = new e().zero();
|
|
1348
133
|
for (let e of t) n.add(e);
|
|
1349
134
|
return n.divide(t.length), n;
|
|
1350
|
-
}
|
|
135
|
+
}
|
|
1351
136
|
static isFraction(t) {
|
|
1352
137
|
if (t instanceof e || typeof t == "number" && !isNaN(t)) return !0;
|
|
1353
138
|
if (typeof t == "string") {
|
|
@@ -1356,53 +141,56 @@ var p = {
|
|
|
1356
141
|
}
|
|
1357
142
|
return !1;
|
|
1358
143
|
}
|
|
1359
|
-
static max
|
|
144
|
+
static max(...t) {
|
|
1360
145
|
let n = new e(t[0]);
|
|
1361
146
|
for (let r of t) {
|
|
1362
147
|
let t = new e(r);
|
|
1363
148
|
t.isGreater(n) && (n = t.clone());
|
|
1364
149
|
}
|
|
1365
150
|
return n;
|
|
1366
|
-
}
|
|
1367
|
-
static min
|
|
151
|
+
}
|
|
152
|
+
static min(...t) {
|
|
1368
153
|
let n = new e(t[0]);
|
|
1369
154
|
for (let r of t) {
|
|
1370
155
|
let t = new e(r);
|
|
1371
156
|
t.isLesser(n) && (n = t.clone());
|
|
1372
157
|
}
|
|
1373
158
|
return n;
|
|
1374
|
-
}
|
|
1375
|
-
static sort
|
|
159
|
+
}
|
|
160
|
+
static sort(t, n) {
|
|
1376
161
|
let r = t.map((t) => t instanceof e ? t : new e(t)).sort((e, t) => e.value - t.value);
|
|
1377
162
|
return n && r.reverse(), r;
|
|
1378
|
-
}
|
|
163
|
+
}
|
|
1379
164
|
static toSameDenominateur(...t) {
|
|
1380
|
-
let n = t.map((t) => new e(t)), r =
|
|
165
|
+
let n = t.map((t) => new e(t)), r = g.lcm(...n.map((e) => e.denominator));
|
|
1381
166
|
return n.forEach((e) => e.amplify(r / e.denominator)), n;
|
|
1382
167
|
}
|
|
1383
|
-
static unique
|
|
168
|
+
static unique(t) {
|
|
1384
169
|
let n = {}, r = [];
|
|
1385
170
|
return t.forEach((t) => {
|
|
1386
171
|
t instanceof e || (t = new e(t)), n[t.clone().reduce().tex] || (r.push(t.clone()), n[t.clone().reduce().tex] = !0);
|
|
1387
172
|
}), r;
|
|
1388
|
-
}
|
|
1389
|
-
static xMultiply
|
|
173
|
+
}
|
|
174
|
+
static xMultiply(...t) {
|
|
1390
175
|
let n = new e();
|
|
1391
176
|
return t.forEach((e) => n.multiply(e, !1)), n;
|
|
1392
|
-
}
|
|
1393
|
-
abs
|
|
1394
|
-
|
|
177
|
+
}
|
|
178
|
+
abs() {
|
|
179
|
+
return this.#r = Math.abs(this.#r), this.#e = Math.abs(this.#e), this;
|
|
180
|
+
}
|
|
181
|
+
add(t) {
|
|
1395
182
|
if (t instanceof e) {
|
|
1396
183
|
let e = this.#r, n = this.#e;
|
|
1397
184
|
this.#r = e * t.denominator + t.numerator * n, this.#e = n * t.denominator, this.exact = this.exact && t.exact;
|
|
1398
185
|
} else return this.add(new e(t));
|
|
1399
186
|
return this.reduce();
|
|
1400
|
-
}
|
|
1401
|
-
amplify
|
|
187
|
+
}
|
|
188
|
+
amplify(e) {
|
|
1402
189
|
if (!Number.isSafeInteger(e)) throw new i("The amplification factor must be a safe integer.");
|
|
190
|
+
if (e === 0) throw new i("The amplification factor cannot be zero.");
|
|
1403
191
|
return this.#r *= e, this.#e *= e, this;
|
|
1404
|
-
}
|
|
1405
|
-
compare
|
|
192
|
+
}
|
|
193
|
+
compare(t, n) {
|
|
1406
194
|
n ??= "=";
|
|
1407
195
|
let r;
|
|
1408
196
|
switch (r = t instanceof e ? t.clone() : new e(t), n) {
|
|
@@ -1418,122 +206,228 @@ var p = {
|
|
|
1418
206
|
case "<>": return this.#r * r.denominator !== r.numerator * this.#e;
|
|
1419
207
|
default: return !1;
|
|
1420
208
|
}
|
|
1421
|
-
}
|
|
209
|
+
}
|
|
1422
210
|
get denominator() {
|
|
1423
211
|
return this.#e;
|
|
1424
212
|
}
|
|
1425
213
|
set denominator(e) {
|
|
1426
214
|
this.#e = e;
|
|
1427
215
|
}
|
|
1428
|
-
get
|
|
216
|
+
get asDfrac() {
|
|
1429
217
|
return this.#i = "dfrac", this;
|
|
1430
218
|
}
|
|
1431
219
|
digits(e) {
|
|
1432
220
|
return this.#t = e, this;
|
|
1433
221
|
}
|
|
1434
|
-
divide
|
|
222
|
+
divide(t) {
|
|
1435
223
|
let n = new e(t);
|
|
1436
|
-
if (n.numerator === 0)
|
|
224
|
+
if (n.numerator === 0) {
|
|
225
|
+
let e = this.sign();
|
|
226
|
+
return this.infinite(), e === -1 ? this.opposite() : this;
|
|
227
|
+
}
|
|
1437
228
|
let r = this.#r, i = this.#e;
|
|
1438
229
|
return this.#r = r * n.denominator, this.#e = i * n.numerator, this.exact = this.exact && n.exact, this.reduce();
|
|
1439
|
-
}
|
|
230
|
+
}
|
|
1440
231
|
get exact() {
|
|
1441
232
|
return this.#n;
|
|
1442
233
|
}
|
|
1443
234
|
set exact(e) {
|
|
1444
235
|
this.#n = e;
|
|
1445
236
|
}
|
|
1446
|
-
get
|
|
237
|
+
get asFrac() {
|
|
1447
238
|
return this.#i = "frac", this;
|
|
1448
239
|
}
|
|
1449
240
|
fromNumber(e) {
|
|
1450
241
|
if (Number.isSafeInteger(e)) return this.#r = e, this.#e = 1, this.#n = !0, this;
|
|
242
|
+
if (e.toString().includes("e") || e.toString().includes("E")) throw new i(`Exponential notation is not supported: ${e}`);
|
|
1451
243
|
let [, t] = e.toString().split("."), n = t ? t.length : 0, r = 10 ** n;
|
|
1452
|
-
return this.#r = e * r, this.#e = r, this.#r =
|
|
244
|
+
return this.#r = e * r, this.#e = r, this.#r = g.numberCorrection(this.#r), this.#e = g.numberCorrection(this.#e), this.reduce(), this.#n = n < 10, this;
|
|
1453
245
|
}
|
|
1454
246
|
fromNumbers(e, t) {
|
|
1455
|
-
return Number.isSafeInteger(e) && Number.isSafeInteger(t) ? (this.#r = e, this.#e = t, this.#n = !0, this) : this.fromNumber(e / t);
|
|
247
|
+
return t === 0 ? e === 0 ? this.invalid() : e < 0 ? this.infinite().opposite() : this.infinite() : Number.isSafeInteger(e) && Number.isSafeInteger(t) ? (this.#r = e, this.#e = t, this.#n = !0, this) : this.fromNumber(e / t);
|
|
1456
248
|
}
|
|
1457
249
|
fromPeriodic(e, t) {
|
|
1458
250
|
let [, n] = e.toString().split(/[.,]/), r = n ? n.length : 0;
|
|
1459
251
|
if (!Number.isSafeInteger(t) || t <= 0) throw new i("The periodic length must be a positive integer.");
|
|
1460
252
|
if (t > r) throw new i(`The periodic length (${t}) cannot exceed the number of decimal digits (${r}).`);
|
|
1461
|
-
let a = 10 ** r;
|
|
1462
|
-
return this.#r =
|
|
253
|
+
let a = 10 ** r, o = 10 ** (r - t), s = +e, c = s < 0 ? -1 : 1, l = Math.abs(s);
|
|
254
|
+
return this.#r = c * Math.round(l * a - Math.floor(l * o)), this.#e = a - o, this.#n = !0, this.reduce();
|
|
1463
255
|
}
|
|
1464
256
|
fromString(e) {
|
|
1465
|
-
let t =
|
|
1466
|
-
|
|
257
|
+
let t = /^([+-]?)(\d*)\.(\d*)\((\d+)\)$/.exec(e);
|
|
258
|
+
if (t) {
|
|
259
|
+
let [, e, n, r, i] = t, a = `${n || "0"}.${r}${i}`;
|
|
260
|
+
return this.fromPeriodic(a, i.length), e === "-" && this.opposite(), this.reduce();
|
|
261
|
+
}
|
|
262
|
+
if (e.includes("(") || e.includes(")")) return this.invalid();
|
|
263
|
+
let n = e.split("/").map(Number);
|
|
264
|
+
return this.#n = !0, n.length > 2 || n.some((e) => isNaN(e)) ? (this.#r = NaN, this) : n.length === 1 ? this.fromNumber(+e) : this.fromNumbers(n[0], n[1]);
|
|
1467
265
|
}
|
|
1468
|
-
infinite
|
|
1469
|
-
|
|
1470
|
-
|
|
266
|
+
infinite() {
|
|
267
|
+
return this.#r = Infinity, this.#e = 1, this.exact = !0, this;
|
|
268
|
+
}
|
|
269
|
+
invalid() {
|
|
270
|
+
return this.#r = NaN, this.#e = 1, this.exact = !0, this;
|
|
271
|
+
}
|
|
272
|
+
inverse() {
|
|
1471
273
|
let e = this.sign(), t = Math.abs(this.#r);
|
|
1472
274
|
return this.#r = Math.abs(this.#e) * e, this.#e = t, this;
|
|
1473
|
-
}
|
|
1474
|
-
isEqual
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
275
|
+
}
|
|
276
|
+
isEqual(e) {
|
|
277
|
+
return this.compare(e, "=");
|
|
278
|
+
}
|
|
279
|
+
isEven() {
|
|
280
|
+
return this.isRelative() && this.value % 2 == 0;
|
|
281
|
+
}
|
|
282
|
+
isFinite() {
|
|
283
|
+
return !this.isInfinity() && !this.isNaN();
|
|
284
|
+
}
|
|
285
|
+
isGeq(e) {
|
|
286
|
+
return this.compare(e, ">=");
|
|
287
|
+
}
|
|
288
|
+
isGreater(e) {
|
|
289
|
+
return this.compare(e, ">");
|
|
290
|
+
}
|
|
291
|
+
isInfinity() {
|
|
292
|
+
return Math.abs(this.#r) === Infinity;
|
|
293
|
+
}
|
|
294
|
+
isLeq(e) {
|
|
295
|
+
return this.compare(e, "<=");
|
|
296
|
+
}
|
|
297
|
+
isLesser(e) {
|
|
298
|
+
return this.compare(e, "<");
|
|
299
|
+
}
|
|
300
|
+
isNaN() {
|
|
301
|
+
return isNaN(this.#r);
|
|
302
|
+
}
|
|
303
|
+
isNatural() {
|
|
304
|
+
return this.isRelative() && this.isPositive();
|
|
305
|
+
}
|
|
306
|
+
isNegative() {
|
|
307
|
+
return this.sign() === -1;
|
|
308
|
+
}
|
|
309
|
+
isNotEqual(e) {
|
|
310
|
+
return this.compare(e, "<>");
|
|
311
|
+
}
|
|
312
|
+
isNotZero() {
|
|
313
|
+
return this.#r !== 0;
|
|
314
|
+
}
|
|
315
|
+
isOdd() {
|
|
316
|
+
return this.isRelative() && Math.abs(this.value % 2) === 1;
|
|
317
|
+
}
|
|
318
|
+
isOne() {
|
|
319
|
+
return this.#r === 1 && this.#e === 1;
|
|
320
|
+
}
|
|
321
|
+
isPeriodic() {
|
|
322
|
+
if (!this.exact || !this.isFinite()) return !1;
|
|
323
|
+
let e = Math.abs(this.clone().reduce().denominator);
|
|
324
|
+
for (; e % 2 == 0;) e /= 2;
|
|
325
|
+
for (; e % 5 == 0;) e /= 5;
|
|
326
|
+
return e !== 1;
|
|
327
|
+
}
|
|
328
|
+
isPositive() {
|
|
329
|
+
return this.sign() === 1;
|
|
330
|
+
}
|
|
331
|
+
isRational() {
|
|
332
|
+
return this.exact && this.isFinite();
|
|
333
|
+
}
|
|
334
|
+
hasFractionalPart() {
|
|
335
|
+
return this.exact && !this.isRelative();
|
|
336
|
+
}
|
|
337
|
+
isReduced() {
|
|
338
|
+
return Math.abs(g.gcd(this.#r, this.#e)) === 1;
|
|
339
|
+
}
|
|
340
|
+
isRelative() {
|
|
341
|
+
return this.exact && this.clone().reduce().denominator === 1;
|
|
342
|
+
}
|
|
343
|
+
isSquare() {
|
|
344
|
+
let e = this.clone().reduce();
|
|
345
|
+
if (e.isNegative()) return !1;
|
|
346
|
+
let t = Math.abs(e.numerator), n = Math.abs(e.denominator), r = Math.round(Math.sqrt(t)), i = Math.round(Math.sqrt(n));
|
|
347
|
+
return r * r === t && i * i === n;
|
|
348
|
+
}
|
|
349
|
+
isStrictlyNegative() {
|
|
350
|
+
return this.value < 0;
|
|
351
|
+
}
|
|
352
|
+
isStrictlyPositive() {
|
|
353
|
+
return this.value > 0;
|
|
354
|
+
}
|
|
1496
355
|
isUnit() {
|
|
1497
356
|
return Math.abs(this.#r) === 1 && this.#e === 1;
|
|
1498
357
|
}
|
|
1499
|
-
isZero
|
|
1500
|
-
|
|
358
|
+
isZero() {
|
|
359
|
+
return this.#r === 0;
|
|
360
|
+
}
|
|
361
|
+
multiply(t, n = !0) {
|
|
1501
362
|
let r = new e(t);
|
|
1502
363
|
return this.#r *= r.numerator, this.#e *= r.denominator, this.exact = this.exact && r.exact, n ? this.reduce() : this;
|
|
1503
|
-
}
|
|
364
|
+
}
|
|
1504
365
|
get numerator() {
|
|
1505
366
|
return this.#r;
|
|
1506
367
|
}
|
|
1507
368
|
set numerator(e) {
|
|
1508
369
|
this.#r = e;
|
|
1509
370
|
}
|
|
1510
|
-
one
|
|
1511
|
-
|
|
1512
|
-
|
|
371
|
+
one() {
|
|
372
|
+
return this.fromNumber(1);
|
|
373
|
+
}
|
|
374
|
+
opposite() {
|
|
375
|
+
return this.#r = -this.#r, this;
|
|
376
|
+
}
|
|
377
|
+
pow(t) {
|
|
1513
378
|
if (t instanceof e) return this.pow(t.value);
|
|
1514
379
|
this.reduce(), t < 0 && this.inverse();
|
|
1515
|
-
let n = Math.abs(t)
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
380
|
+
let n = Math.abs(t);
|
|
381
|
+
if (Number.isInteger(n)) return this.#r = Math.round(this.#r ** +n), this.#e = Math.round(this.#e ** +n), this;
|
|
382
|
+
let r = Math.round(this.#r ** +n), i = Math.round(this.#e ** +n);
|
|
383
|
+
return Math.round(r ** (1 / n)) === this.#r && Math.round(i ** (1 / n)) === this.#e ? (this.#r = r, this.#e = i) : (this.#r = this.#r ** +n / this.#e ** +n, this.#e = 1, this.exact = !1), this;
|
|
384
|
+
}
|
|
385
|
+
reduce() {
|
|
386
|
+
let e = g.gcd(this.#r, this.#e);
|
|
1520
387
|
return this.#r /= e, this.#e /= e, this.#e < 0 && (this.#e = -this.#e, this.#r = -this.#r), this;
|
|
1521
|
-
}
|
|
1522
|
-
root
|
|
388
|
+
}
|
|
389
|
+
root(e) {
|
|
1523
390
|
if (e === 0) return this;
|
|
1524
391
|
if (!Number.isSafeInteger(e)) throw new i("The root must be an integer.");
|
|
1525
|
-
if (
|
|
392
|
+
if (this.isNegative() && e % 2 == 0) throw new r("The root of a negative number must be odd.");
|
|
393
|
+
e < 0 && this.inverse();
|
|
1526
394
|
let t = this.sign();
|
|
1527
395
|
this.abs(), this.reduce();
|
|
1528
|
-
let n = Math.
|
|
1529
|
-
return this.#r
|
|
1530
|
-
}
|
|
1531
|
-
sign
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
396
|
+
let n = Math.abs(e), a = Math.round(this.#r ** (1 / n)), o = Math.round(this.#e ** (1 / n));
|
|
397
|
+
return a ** +n === this.#r && o ** +n === this.#e ? (this.#r = a, this.#e = o) : (this.#r = this.#r ** (1 / n) / this.#e ** (1 / n), this.#e = 1, this.exact = !1), this.multiply(t), this;
|
|
398
|
+
}
|
|
399
|
+
sign() {
|
|
400
|
+
return this.#r * this.#e >= 0 ? 1 : -1;
|
|
401
|
+
}
|
|
402
|
+
sqrt() {
|
|
403
|
+
return this.root(2);
|
|
404
|
+
}
|
|
405
|
+
subtract(t) {
|
|
406
|
+
return t instanceof e ? this.add(t.clone().opposite()) : this.add(-t);
|
|
407
|
+
}
|
|
408
|
+
get asTfrac() {
|
|
1535
409
|
return this.#i = "tfrac", this;
|
|
1536
410
|
}
|
|
411
|
+
toRepeatingDecimal() {
|
|
412
|
+
if (!this.exact || !this.isFinite()) throw new i("Cannot decompose a non-exact or infinite fraction.");
|
|
413
|
+
let e = this.clone().reduce(), t = e.sign(), n = Math.abs(e.numerator), r = Math.abs(e.denominator), a = Math.floor(n / r).toString(), o = n % r, s = [], c = /* @__PURE__ */ new Map(), l = -1;
|
|
414
|
+
for (; o !== 0;) {
|
|
415
|
+
let e = c.get(o);
|
|
416
|
+
if (e !== void 0) {
|
|
417
|
+
l = e;
|
|
418
|
+
break;
|
|
419
|
+
}
|
|
420
|
+
c.set(o, s.length), o *= 10, s.push(Math.floor(o / r)), o %= r;
|
|
421
|
+
}
|
|
422
|
+
let u = (l === -1 ? s : s.slice(0, l)).join(""), d = l === -1 ? "" : s.slice(l).join("");
|
|
423
|
+
return {
|
|
424
|
+
sign: t,
|
|
425
|
+
integerPart: a,
|
|
426
|
+
nonPeriodic: u,
|
|
427
|
+
periodic: d,
|
|
428
|
+
periodLength: d.length
|
|
429
|
+
};
|
|
430
|
+
}
|
|
1537
431
|
get value() {
|
|
1538
432
|
let e = this.#r / this.#e;
|
|
1539
433
|
return e === 0 ? 0 : e;
|
|
@@ -1544,70 +438,52 @@ var p = {
|
|
|
1544
438
|
get withoutSign() {
|
|
1545
439
|
return this.#a = !1, this;
|
|
1546
440
|
}
|
|
1547
|
-
zero
|
|
1548
|
-
|
|
1549
|
-
//#endregion
|
|
1550
|
-
//#region src/helpers.ts
|
|
1551
|
-
function se(e, t = !0) {
|
|
1552
|
-
return t ? `\\left( ${e} \\right)` : `(${e})`;
|
|
1553
|
-
}
|
|
1554
|
-
function h(e) {
|
|
1555
|
-
if (!e.startsWith("(") || !e.endsWith(")")) return e;
|
|
1556
|
-
let t = 0;
|
|
1557
|
-
for (let n = 0; n < e.length - 1; n++) if (e[n] === "(" ? t++ : e[n] === ")" && t--, t === 0) return e;
|
|
1558
|
-
return e.slice(1, -1);
|
|
1559
|
-
}
|
|
1560
|
-
function g(e, t, n, r, i) {
|
|
1561
|
-
return e.map((e, a) => r !== void 0 && a < r || i !== void 0 && a > i ? e : e === t ? n : e);
|
|
1562
|
-
}
|
|
1563
|
-
function _(e, t) {
|
|
1564
|
-
if (t.length !== 1) throw new i(`splitChar must be a single character, got: "${t}"`);
|
|
1565
|
-
let n = 0, r = 0, a = [];
|
|
1566
|
-
for (let i = 0; i < e.length; i++) {
|
|
1567
|
-
let o = e[i];
|
|
1568
|
-
o === "(" ? n++ : o === ")" ? n-- : o === t && n === 0 && (a.push(e.substring(r, i)), r = i + 1);
|
|
441
|
+
zero() {
|
|
442
|
+
return this.fromNumber(0);
|
|
1569
443
|
}
|
|
1570
|
-
|
|
1571
|
-
}
|
|
1572
|
-
//#endregion
|
|
1573
|
-
//#region src/coefficients/root.ts
|
|
1574
|
-
var v = class e {
|
|
444
|
+
}, v = class e {
|
|
1575
445
|
#e;
|
|
1576
446
|
#t;
|
|
1577
447
|
#n;
|
|
1578
448
|
#r = !1;
|
|
1579
449
|
constructor(e) {
|
|
1580
|
-
return this.#t = 2, this.#e = new
|
|
450
|
+
return this.#t = 2, this.#e = new _().zero(), this.#n = new _().zero(), e !== void 0 && this.parse(e), this;
|
|
1581
451
|
}
|
|
1582
452
|
parse(t) {
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
return this.index = 2, this.factor =
|
|
453
|
+
return t instanceof e ? this.copy(t) : t instanceof _ ? this.fromFraction(t) : typeof t == "string" ? this.fromString(t) : this.#i(t);
|
|
454
|
+
}
|
|
455
|
+
copy(e) {
|
|
456
|
+
return this.index = e.index, this.radical = e.radical.clone(), this.factor = e.factor.clone(), this;
|
|
457
|
+
}
|
|
458
|
+
fromFraction(e) {
|
|
459
|
+
return this.index = 2, this.factor = e.clone(), this.radical.one(), this;
|
|
460
|
+
}
|
|
461
|
+
fromString(e) {
|
|
462
|
+
return e.includes("sqrt") ? this.#f(e) : e.includes("root") ? this.#d(e) : this.#i(e);
|
|
463
|
+
}
|
|
464
|
+
#i(e) {
|
|
465
|
+
let n = new _(e);
|
|
466
|
+
if (n.isNaN()) throw new t(`Cannot parse "${e}" as a root or fraction`);
|
|
467
|
+
return this.index = 2, this.factor = n, this.radical.one(), this;
|
|
1590
468
|
}
|
|
1591
469
|
clone() {
|
|
1592
|
-
|
|
470
|
+
let t = new e().from(this.index, this.radical, this.factor);
|
|
471
|
+
return t.#r = this.#r, t;
|
|
1593
472
|
}
|
|
1594
473
|
get tex() {
|
|
1595
474
|
let e = this.#r && this.factor.isPositive() ? "+" : "", t = e && this.#e.numerator === 1 ? " " : "";
|
|
1596
|
-
if (this.
|
|
1597
|
-
let n = this.#
|
|
475
|
+
if (this.isZero()) return `${e}0`;
|
|
476
|
+
let n = this.#l(this.#e.denominator, this.#n.denominator), r = this.#l(this.#e.numerator, this.#n.numerator) ?? "1";
|
|
1598
477
|
return n === null ? `${e}${t}${r}` : `${e}${t}\\frac{ ${r} }{ ${n} }`;
|
|
1599
478
|
}
|
|
1600
479
|
get display() {
|
|
1601
480
|
let e = this.#r && this.factor.isPositive() ? "+" : "";
|
|
1602
|
-
if (this.
|
|
1603
|
-
let t = this.#
|
|
481
|
+
if (this.isZero()) return `${e}0`;
|
|
482
|
+
let t = this.#c(this.#e.denominator, this.#n.denominator, !0), n = this.#c(this.#e.numerator, this.#n.numerator, t !== null) ?? "1";
|
|
1604
483
|
return t === null ? `${e}${n}` : `${e}${n}/${t}`;
|
|
1605
484
|
}
|
|
1606
|
-
add(
|
|
1607
|
-
this
|
|
1608
|
-
let n = new e(t).reduce();
|
|
1609
|
-
if (this.index !== n.index || !this.radical.isEqual(n.radical)) throw new r("Add can only be done with two same index and radical");
|
|
1610
|
-
return this.factor.add(n.factor), this;
|
|
485
|
+
add(e) {
|
|
486
|
+
return this.#s(e, !1);
|
|
1611
487
|
}
|
|
1612
488
|
divide(t) {
|
|
1613
489
|
return this.multiply(new e(t).inverse());
|
|
@@ -1618,8 +494,17 @@ var v = class e {
|
|
|
1618
494
|
set factor(e) {
|
|
1619
495
|
this.#e = e;
|
|
1620
496
|
}
|
|
1621
|
-
from(e,
|
|
1622
|
-
|
|
497
|
+
from(e, n, r) {
|
|
498
|
+
this.index = e;
|
|
499
|
+
let i = new _(n);
|
|
500
|
+
if (i.isNaN()) throw new t(`Cannot build a root from an invalid radical: "${n}"`);
|
|
501
|
+
if (this.radical = i, r === void 0) this.factor = new _().one();
|
|
502
|
+
else {
|
|
503
|
+
let e = new _(r);
|
|
504
|
+
if (e.isNaN()) throw new t(`Cannot build a root from an invalid factor: "${r}"`);
|
|
505
|
+
this.factor = e;
|
|
506
|
+
}
|
|
507
|
+
return this;
|
|
1623
508
|
}
|
|
1624
509
|
group() {
|
|
1625
510
|
return this.radical.multiply(this.factor.pow(this.index)), this.factor.one(), this;
|
|
@@ -1632,13 +517,23 @@ var v = class e {
|
|
|
1632
517
|
this.#t = e;
|
|
1633
518
|
}
|
|
1634
519
|
get indexAsPow() {
|
|
1635
|
-
return new
|
|
520
|
+
return new _(this.index).inverse();
|
|
1636
521
|
}
|
|
1637
522
|
inverse() {
|
|
1638
523
|
return this.factor.inverse(), this.radical.inverse(), this;
|
|
1639
524
|
}
|
|
1640
525
|
isEqual(e) {
|
|
1641
|
-
|
|
526
|
+
if (this.isZero() && e.isZero()) return !0;
|
|
527
|
+
if (!this.#a() || !e.#a() || this.#o() !== e.#o()) return !1;
|
|
528
|
+
let t = g.lcm(this.index, e.index), n = this.factor.clone().abs().pow(t).multiply(this.radical.clone().abs().pow(t / this.index)), r = e.factor.clone().abs().pow(t).multiply(e.radical.clone().abs().pow(t / e.index));
|
|
529
|
+
return n.isEqual(r);
|
|
530
|
+
}
|
|
531
|
+
#a() {
|
|
532
|
+
return !(this.radical.isNegative() && this.index % 2 == 0);
|
|
533
|
+
}
|
|
534
|
+
#o() {
|
|
535
|
+
let e = this.index % 2 == 1 ? this.radical.sign() : 1;
|
|
536
|
+
return this.factor.sign() * e;
|
|
1642
537
|
}
|
|
1643
538
|
isOne() {
|
|
1644
539
|
return this.factor.isOne() && this.radical.isOne();
|
|
@@ -1651,13 +546,14 @@ var v = class e {
|
|
|
1651
546
|
return this.factor.isZero() || this.radical.isZero();
|
|
1652
547
|
}
|
|
1653
548
|
multiply(t) {
|
|
1654
|
-
let n = new e(t);
|
|
1655
|
-
if (
|
|
1656
|
-
if (
|
|
1657
|
-
|
|
1658
|
-
|
|
549
|
+
let n = this.clone(), i = new e(t);
|
|
550
|
+
if (n.index !== i.index && !n.radical.isEqual(i.radical)) throw new r("Multiply can only be done if radical or index as equals.");
|
|
551
|
+
if (n.factor.multiply(i.factor), n.index === i.index) n.radical.multiply(i.radical);
|
|
552
|
+
else {
|
|
553
|
+
let e = n.indexAsPow.add(i.indexAsPow).reduce();
|
|
554
|
+
n.index = e.denominator, n.radical = n.radical.pow(e.numerator);
|
|
1659
555
|
}
|
|
1660
|
-
|
|
556
|
+
return this.parse(n);
|
|
1661
557
|
}
|
|
1662
558
|
one() {
|
|
1663
559
|
return this.radical.one(), this.factor.one(), this;
|
|
@@ -1667,7 +563,7 @@ var v = class e {
|
|
|
1667
563
|
}
|
|
1668
564
|
pow(e) {
|
|
1669
565
|
this.factor.pow(e);
|
|
1670
|
-
let t =
|
|
566
|
+
let t = g.gcd(this.index, e);
|
|
1671
567
|
return this.index /= t, this.radical.pow(e / t), this;
|
|
1672
568
|
}
|
|
1673
569
|
get radical() {
|
|
@@ -1677,12 +573,12 @@ var v = class e {
|
|
|
1677
573
|
this.#n = e;
|
|
1678
574
|
}
|
|
1679
575
|
reduce() {
|
|
1680
|
-
if (this.radical.
|
|
1681
|
-
let e = this.radical.denominator;
|
|
1682
|
-
this.radical
|
|
576
|
+
if (this.radical.hasFractionalPart()) {
|
|
577
|
+
let e = this.radical.numerator, t = this.radical.denominator;
|
|
578
|
+
this.radical = new _(e * t ** (this.index - 1)), this.factor.divide(t);
|
|
1683
579
|
}
|
|
1684
|
-
let e =
|
|
1685
|
-
return this.factor.multiply(e
|
|
580
|
+
let e = g.greatestPower(this.radical.value, this.index);
|
|
581
|
+
return this.factor.multiply(g.nthRoot(e, this.index)), this.radical.divide(e), this;
|
|
1686
582
|
}
|
|
1687
583
|
root(e) {
|
|
1688
584
|
return this.group(), this.index *= e, this;
|
|
@@ -1690,12 +586,17 @@ var v = class e {
|
|
|
1690
586
|
sqrt() {
|
|
1691
587
|
return this.root(2);
|
|
1692
588
|
}
|
|
1693
|
-
subtract(
|
|
1694
|
-
|
|
1695
|
-
|
|
589
|
+
subtract(e) {
|
|
590
|
+
return this.#s(e, !0);
|
|
591
|
+
}
|
|
592
|
+
#s(t, n) {
|
|
593
|
+
let i = this.clone().reduce(), a = new e(t).reduce();
|
|
594
|
+
if (i.index !== a.index || !i.radical.isEqual(a.radical)) throw new r("Roots must share the same index and radical to be added or subtracted");
|
|
595
|
+
return n ? i.factor.subtract(a.factor) : i.factor.add(a.factor), this.parse(i);
|
|
1696
596
|
}
|
|
1697
597
|
get value() {
|
|
1698
|
-
|
|
598
|
+
let e = this.radical.value;
|
|
599
|
+
return e < 0 ? this.index % 2 == 0 ? NaN : g.numberCorrection(this.factor.value * -((-e) ** (1 / this.index))) : g.numberCorrection(this.factor.value * e ** (1 / this.index));
|
|
1699
600
|
}
|
|
1700
601
|
get withSign() {
|
|
1701
602
|
return this.#r = !0, this;
|
|
@@ -1706,23 +607,43 @@ var v = class e {
|
|
|
1706
607
|
zero() {
|
|
1707
608
|
return this.radical.zero(), this.factor.zero(), this;
|
|
1708
609
|
}
|
|
1709
|
-
#
|
|
1710
|
-
let r = this.#t === 2 ? "sqrt" : `root(${this.#t})
|
|
1711
|
-
return
|
|
610
|
+
#c(e, t, n) {
|
|
611
|
+
let r = this.#t === 2 ? "sqrt" : `root(${this.#t})`;
|
|
612
|
+
return this.#u(e, t, {
|
|
613
|
+
radical: (e) => `${r}(${e})`,
|
|
614
|
+
separator: "",
|
|
615
|
+
wrap: n
|
|
616
|
+
});
|
|
1712
617
|
}
|
|
1713
|
-
#
|
|
1714
|
-
let n = this.#t === 2 ? "\\sqrt" : `\\sqrt[ ${this.#t} ]
|
|
1715
|
-
return
|
|
618
|
+
#l(e, t) {
|
|
619
|
+
let n = this.#t === 2 ? "\\sqrt" : `\\sqrt[ ${this.#t} ]`;
|
|
620
|
+
return this.#u(e, t, {
|
|
621
|
+
radical: (e) => `${n}{ ${e} }`,
|
|
622
|
+
separator: " "
|
|
623
|
+
});
|
|
1716
624
|
}
|
|
1717
|
-
#
|
|
625
|
+
#u(e, t, n) {
|
|
626
|
+
let r = [e === 1 || e === 0 ? null : e === -1 ? "-" : e.toString(), t !== 1 && t !== 0 ? n.radical(t) : null].filter((e) => e !== null);
|
|
627
|
+
return r.length === 0 ? null : n.wrap && r.length === 2 ? `(${r.join(n.separator)})` : r.join(n.separator);
|
|
628
|
+
}
|
|
629
|
+
#d(e) {
|
|
1718
630
|
let n = /^(.*?)root\((\d+)\)\(?([^)]+)/.exec(e);
|
|
1719
631
|
if (!n) throw new t(`Invalid root format: "${e}"`);
|
|
1720
632
|
let [, r, i, a] = n;
|
|
1721
|
-
return this.index = +i, this.radical = new
|
|
633
|
+
return this.index = +i, this.radical = new _(a), this.factor = r === "" ? new _().one() : new _(r.trim()), this;
|
|
1722
634
|
}
|
|
1723
|
-
#
|
|
1724
|
-
let
|
|
1725
|
-
|
|
635
|
+
#f(e) {
|
|
636
|
+
let n = /^\((.+)\)\/(\d+)$/.exec(e);
|
|
637
|
+
if (n) return this.#f(n[1]), this.factor.divide(+n[2]), this;
|
|
638
|
+
let r = /^([+-]?\d*(?:\/\d+)?)sqrt(?:\((-?\d+(?:\/\d+)?)\)|(\d+))(?:\/(\d+))?$/.exec(e);
|
|
639
|
+
if (!r) throw new t(`Invalid sqrt format: "${e}"`);
|
|
640
|
+
let i = r[1], a = r.at(2), o = r.at(3), s = r.at(4);
|
|
641
|
+
this.index = 2, this.radical = new _(a ?? o ?? "");
|
|
642
|
+
let c;
|
|
643
|
+
if (i === "" || i === "+" || i === "-") c = new _(i === "-" ? -1 : 1);
|
|
644
|
+
else if (/^[+-]?\d+(?:\/\d+)?$/.test(i)) c = new _(i);
|
|
645
|
+
else throw new t(`Invalid sqrt format: "${e}"`);
|
|
646
|
+
return s !== void 0 && c.divide(+s), this.factor = c, this;
|
|
1726
647
|
}
|
|
1727
648
|
}, y = class e {
|
|
1728
649
|
#e;
|
|
@@ -1733,13 +654,13 @@ var v = class e {
|
|
|
1733
654
|
#a;
|
|
1734
655
|
#o;
|
|
1735
656
|
constructor() {
|
|
1736
|
-
this.#o = "x", this.#n = !1, this.#t = null, this.#a = null, this.#r = new
|
|
657
|
+
this.#o = "x", this.#n = !1, this.#t = null, this.#a = null, this.#r = new _().zero(), this.#i = new v(), this.#e = 1;
|
|
1737
658
|
}
|
|
1738
659
|
get tex() {
|
|
1739
660
|
if (this.#a) return this.#a;
|
|
1740
661
|
if (this.#i.isZero()) return this.#r.tex;
|
|
1741
662
|
if (this.#r.isZero()) return this.#i.tex;
|
|
1742
|
-
let [e] =
|
|
663
|
+
let [e] = _.toSameDenominateur(this.#r, this.#i.factor), t = this.#i.clone().multiply(e.denominator).reduce(), n = `${e.numerator} ${t.withSign.tex}`;
|
|
1743
664
|
return e.denominator === 1 ? n : `\\frac{ ${n} }{ ${e.denominator} }`;
|
|
1744
665
|
}
|
|
1745
666
|
set tex(e) {
|
|
@@ -1749,7 +670,7 @@ var v = class e {
|
|
|
1749
670
|
if (this.#t) return this.#t;
|
|
1750
671
|
if (this.#i.isZero()) return this.#r.display;
|
|
1751
672
|
if (this.#r.isZero()) return this.#i.display;
|
|
1752
|
-
let [e] =
|
|
673
|
+
let [e] = _.toSameDenominateur(this.#r, this.#i.factor), t = this.#i.clone().multiply(e.denominator).reduce(), n = `${e.numerator}${t.withSign.display}`;
|
|
1753
674
|
return e.denominator === 1 ? n : `(${n})/${e.denominator}`;
|
|
1754
675
|
}
|
|
1755
676
|
set display(e) {
|
|
@@ -1758,7 +679,7 @@ var v = class e {
|
|
|
1758
679
|
static fromFraction(t) {
|
|
1759
680
|
let n = new e();
|
|
1760
681
|
n.setExact();
|
|
1761
|
-
let r = new
|
|
682
|
+
let r = new _(t);
|
|
1762
683
|
return n.display = r.display, n.tex = r.tex, n.fraction = r, n.root = new v(), n;
|
|
1763
684
|
}
|
|
1764
685
|
static fromQuadratic(t, n, r) {
|
|
@@ -1766,7 +687,7 @@ var v = class e {
|
|
|
1766
687
|
t,
|
|
1767
688
|
n,
|
|
1768
689
|
r
|
|
1769
|
-
].map((e) => new
|
|
690
|
+
].map((e) => new _(e)), s = a.clone().pow(2).subtract(i.clone().multiply(o).multiply(4));
|
|
1770
691
|
if (s.isNegative()) return [];
|
|
1771
692
|
if (s.isSquare()) {
|
|
1772
693
|
let t = s.sqrt(), n = a.clone().opposite().subtract(t).divide(i.clone().multiply(2)), r = a.clone().opposite().add(t).divide(i.clone().multiply(2));
|
|
@@ -1819,11 +740,11 @@ var v = class e {
|
|
|
1819
740
|
set variable(e) {
|
|
1820
741
|
e !== void 0 && (this.#o = e);
|
|
1821
742
|
}
|
|
1822
|
-
},
|
|
743
|
+
}, se = class {
|
|
1823
744
|
#e;
|
|
1824
745
|
#t;
|
|
1825
746
|
constructor(e) {
|
|
1826
|
-
this.#e = e instanceof
|
|
747
|
+
this.#e = e instanceof L || e instanceof F ? new L(e) : new L().fromPolynom(e), this.#t = this.#e.getRoots();
|
|
1827
748
|
}
|
|
1828
749
|
get fx() {
|
|
1829
750
|
return this.#e;
|
|
@@ -1866,10 +787,10 @@ var v = class e {
|
|
|
1866
787
|
}
|
|
1867
788
|
#r(e, t) {
|
|
1868
789
|
let n = new y();
|
|
1869
|
-
return n.exact = !1, n.tex = t?.tex ?? null, n.display = t?.display ?? null, n.fraction = new
|
|
790
|
+
return n.exact = !1, n.tex = t?.tex ?? null, n.display = t?.display ?? null, n.fraction = new _(e), n.fraction.exact = !1, n.variable = this.#n, n;
|
|
1870
791
|
}
|
|
1871
792
|
#i(e) {
|
|
1872
|
-
return e instanceof
|
|
793
|
+
return e instanceof _ && !e.exact ? this.#r(e.value) : y.fromFraction(e);
|
|
1873
794
|
}
|
|
1874
795
|
#a(e) {
|
|
1875
796
|
let t = [], n = e.degree().value, [r, ...i] = e.getCoefficients(), a = 2 + Math.max(...i.map((e) => e.value / r.value)), o = this.#s(e, a, 100);
|
|
@@ -1897,7 +818,7 @@ var v = class e {
|
|
|
1897
818
|
#s(e, t, n) {
|
|
1898
819
|
let r = [], i = 2 * t / n;
|
|
1899
820
|
for (let n = -t; n <= t; n += i) {
|
|
1900
|
-
let t =
|
|
821
|
+
let t = g.numberCorrection(n);
|
|
1901
822
|
r.push({
|
|
1902
823
|
x: t,
|
|
1903
824
|
fx: e.evaluate(t, !0)
|
|
@@ -1922,9 +843,9 @@ var v = class e {
|
|
|
1922
843
|
let e = t.monoms.reduce((e, t) => t.degree().value < e.degree().value ? t : e), r = e.coefficient;
|
|
1923
844
|
e.clone().divide(r), t.divide(e);
|
|
1924
845
|
}
|
|
1925
|
-
let o =
|
|
846
|
+
let o = g.dividers(i.value), s = g.dividers(a.value), c = [];
|
|
1926
847
|
for (let e of o) for (let t of s) {
|
|
1927
|
-
let n = new
|
|
848
|
+
let n = new _(t, e);
|
|
1928
849
|
c.find((e) => e.value === n.value) || (c.push(n.clone()), c.push(n.opposite().clone()));
|
|
1929
850
|
}
|
|
1930
851
|
c.forEach((e) => {
|
|
@@ -1983,15 +904,15 @@ var v = class e {
|
|
|
1983
904
|
}
|
|
1984
905
|
#p(e, t, n) {
|
|
1985
906
|
let r = e.clone().multiply(2), i = new y();
|
|
1986
|
-
i.fraction = t.clone().opposite().divide(r.clone()), i.root.radical = n.clone(), i.root.factor = new
|
|
907
|
+
i.fraction = t.clone().opposite().divide(r.clone()), i.root.radical = n.clone(), i.root.factor = new _().one().divide(r.clone()), i.exact = !0;
|
|
1987
908
|
let a = new y();
|
|
1988
|
-
return a.fraction = t.clone().opposite().divide(r.clone()), a.root.radical = n.clone(), a.root.factor = new
|
|
909
|
+
return a.fraction = t.clone().opposite().divide(r.clone()), a.root.radical = n.clone(), a.root.factor = new _().one().divide(r.clone()).opposite(), a.exact = !0, [i, a].sort((e, t) => e.value - t.value);
|
|
1989
910
|
}
|
|
1990
|
-
},
|
|
911
|
+
}, ce = class extends Error {
|
|
1991
912
|
constructor(e, t) {
|
|
1992
913
|
super(e, t), this.name = new.target.name;
|
|
1993
914
|
}
|
|
1994
|
-
}, x = class extends
|
|
915
|
+
}, x = class extends ce {}, S = class extends ce {}, le = class extends S {}, C = {
|
|
1995
916
|
pi: Math.PI,
|
|
1996
917
|
e: Math.exp(1)
|
|
1997
918
|
}, w = /* @__PURE__ */ function(e) {
|
|
@@ -1999,7 +920,7 @@ var v = class e {
|
|
|
1999
920
|
}({}), T = /* @__PURE__ */ function(e) {
|
|
2000
921
|
return e.EXPRESSION = "expression", e.POLYNOM = "polynom", e.SET = "set", e.NUMERIC = "numeric", e;
|
|
2001
922
|
}({});
|
|
2002
|
-
function
|
|
923
|
+
function ue(e, t) {
|
|
2003
924
|
if (e = e.replace(/\s+/g, ""), e.length <= 1) return e;
|
|
2004
925
|
let n = Object.keys(t).filter((e) => t[e].type === w.FUNCTION).map((e) => e);
|
|
2005
926
|
n.sort((e, t) => t.length - e.length);
|
|
@@ -2045,14 +966,14 @@ function de(e, t) {
|
|
|
2045
966
|
default: l = w.VARIABLE;
|
|
2046
967
|
}
|
|
2047
968
|
if (u === void 0 || l === void 0) throw Error("The token is undefined");
|
|
2048
|
-
s +=
|
|
969
|
+
s += de(c, l), s += u;
|
|
2049
970
|
}
|
|
2050
971
|
return s;
|
|
2051
972
|
}
|
|
2052
|
-
function
|
|
973
|
+
function de(e, t) {
|
|
2053
974
|
return e === void 0 || e === w.OPERATION || t === w.OPERATION || e === w.LEFT_PARENTHESIS || e === w.FUNCTION || e === w.FUNCTION_ARGUMENT || t === w.RIGHT_PARENTHESIS || t === w.FUNCTION_ARGUMENT ? "" : "*";
|
|
2054
975
|
}
|
|
2055
|
-
var
|
|
976
|
+
var fe = {
|
|
2056
977
|
"^": {
|
|
2057
978
|
precedence: 4,
|
|
2058
979
|
associative: "right",
|
|
@@ -2167,12 +1088,12 @@ var pe = {
|
|
|
2167
1088
|
};
|
|
2168
1089
|
function E(...e) {
|
|
2169
1090
|
let t = {};
|
|
2170
|
-
for (let n of e) t[n] =
|
|
1091
|
+
for (let n of e) t[n] = fe[n];
|
|
2171
1092
|
return t;
|
|
2172
1093
|
}
|
|
2173
|
-
var
|
|
2174
|
-
for (let [e, t] of Object.entries(
|
|
2175
|
-
var
|
|
1094
|
+
var pe = {};
|
|
1095
|
+
for (let [e, t] of Object.entries(fe)) t.type === w.FUNCTION && (pe[e] = t.arity ?? 1);
|
|
1096
|
+
var me = E("^", "*", "/", "+", "-"), he = E("^", "*", "/", "+", "-", "%", "sin", "cos", "tan", "asin", "acos", "atan", "sqrt", "nthrt", "ln", "log", "logn"), ge = he, _e = E("&", "|", "!", "-"), D = class {
|
|
2176
1097
|
#e;
|
|
2177
1098
|
#t = [];
|
|
2178
1099
|
#n = {};
|
|
@@ -2188,7 +1109,7 @@ var he = E("^", "*", "/", "+", "-"), D = E("^", "*", "/", "+", "-", "%", "sin",
|
|
|
2188
1109
|
return this.#t.map((e) => e.token);
|
|
2189
1110
|
}
|
|
2190
1111
|
tokenConfigInitialization() {
|
|
2191
|
-
return this.#e === T.SET ? (this.#n = _e, this.#i = !1) : this.#e === T.NUMERIC ? (this.#n =
|
|
1112
|
+
return this.#e === T.SET ? (this.#n = _e, this.#i = !1) : this.#e === T.NUMERIC ? (this.#n = he, this.#i = !0) : this.#e === T.EXPRESSION ? (this.#n = ge, this.#i = !0) : (this.#n = me, this.#i = !0), this.#r = Object.keys(this.#n).sort((e, t) => t.length - e.length), this.#n;
|
|
2192
1113
|
}
|
|
2193
1114
|
NextToken(e, t) {
|
|
2194
1115
|
let n, r;
|
|
@@ -2221,7 +1142,7 @@ var he = E("^", "*", "/", "+", "-"), D = E("^", "*", "/", "+", "-", "%", "sin",
|
|
|
2221
1142
|
}
|
|
2222
1143
|
parse(e, t) {
|
|
2223
1144
|
let n = [], r = [], i = 0;
|
|
2224
|
-
for ((t ?? this.#i) && (e =
|
|
1145
|
+
for ((t ?? this.#i) && (e = ue(e, this.#n)); i < e.length;) {
|
|
2225
1146
|
let t = i, { token: a, nextPos: o, type: s } = this.NextToken(e, i);
|
|
2226
1147
|
if (i = o, i <= t) throw new x(`Parser stalled at position ${t} in "${e}"`);
|
|
2227
1148
|
switch (s) {
|
|
@@ -2234,7 +1155,10 @@ var he = E("^", "*", "/", "+", "-"), D = E("^", "*", "/", "+", "-", "%", "sin",
|
|
|
2234
1155
|
});
|
|
2235
1156
|
break;
|
|
2236
1157
|
case w.OPERATION:
|
|
2237
|
-
if (r.length
|
|
1158
|
+
if (n.length === 0 && r.length === 0 && (a === "-" || a === "+") && n.push({
|
|
1159
|
+
token: "0",
|
|
1160
|
+
tokenType: w.COEFFICIENT
|
|
1161
|
+
}), r.length > 0) {
|
|
2238
1162
|
let e = r[r.length - 1];
|
|
2239
1163
|
for (; e.token in this.#n && (this.#n[a].associative === "left" && this.#n[a].precedence <= this.#n[e.token].precedence || this.#n[a].associative === "right" && this.#n[a].precedence < this.#n[e.token].precedence) && (n.push(r.pop() ?? {
|
|
2240
1164
|
token: "",
|
|
@@ -2282,13 +1206,13 @@ var he = E("^", "*", "/", "+", "-"), D = E("^", "*", "/", "+", "-", "%", "sin",
|
|
|
2282
1206
|
if (r.some((e) => e.token === "(")) throw new x(`Mismatched parentheses (unclosed '(') in "${e}"`);
|
|
2283
1207
|
return this.#t = n.concat(r.reverse()), this;
|
|
2284
1208
|
}
|
|
2285
|
-
},
|
|
1209
|
+
}, ve = class {
|
|
2286
1210
|
_rpn;
|
|
2287
1211
|
_expression;
|
|
2288
1212
|
constructor(e, t) {
|
|
2289
1213
|
this._expression = e;
|
|
2290
1214
|
try {
|
|
2291
|
-
this._rpn = new
|
|
1215
|
+
this._rpn = new D(T.NUMERIC).parse(e, t).rpn;
|
|
2292
1216
|
} catch (t) {
|
|
2293
1217
|
throw new x(`There was a problem parsing: ${e}`, { cause: t });
|
|
2294
1218
|
}
|
|
@@ -2320,7 +1244,7 @@ var he = E("^", "*", "/", "+", "-"), D = E("^", "*", "/", "+", "-", "%", "sin",
|
|
|
2320
1244
|
--e;
|
|
2321
1245
|
break;
|
|
2322
1246
|
case w.FUNCTION: {
|
|
2323
|
-
let n =
|
|
1247
|
+
let n = pe[t.token] ?? 1;
|
|
2324
1248
|
if (e < n) return !1;
|
|
2325
1249
|
e += 1 - n;
|
|
2326
1250
|
break;
|
|
@@ -2333,7 +1257,7 @@ var he = E("^", "*", "/", "+", "-"), D = E("^", "*", "/", "+", "-", "%", "sin",
|
|
|
2333
1257
|
let t = [];
|
|
2334
1258
|
for (let n of this._rpn) if (n.tokenType === w.COEFFICIENT) t.push(+n.token);
|
|
2335
1259
|
else if (n.tokenType === w.VARIABLE) {
|
|
2336
|
-
if (e === void 0 || !Object.hasOwn(e, n.token)) throw new
|
|
1260
|
+
if (e === void 0 || !Object.hasOwn(e, n.token)) throw new le(`Missing value for variable "${n.token}"`);
|
|
2337
1261
|
t.push(e[n.token]);
|
|
2338
1262
|
} else if (n.tokenType === w.CONSTANT) t.push(C[n.token]);
|
|
2339
1263
|
else if (n.tokenType === w.OPERATION) {
|
|
@@ -2350,8 +1274,8 @@ var he = E("^", "*", "/", "+", "-"), D = E("^", "*", "/", "+", "-", "%", "sin",
|
|
|
2350
1274
|
if (n === void 0 || e === void 0) throw new S(`The addition values ${n ?? "a"} or ${e ?? "b"} are not defined`);
|
|
2351
1275
|
t.push(n + e);
|
|
2352
1276
|
} else if (n.token === "-") {
|
|
2353
|
-
let e = t.pop(), n = t.pop()
|
|
2354
|
-
if (e === void 0) throw new S(
|
|
1277
|
+
let e = t.pop(), n = t.pop();
|
|
1278
|
+
if (n === void 0 || e === void 0) throw new S(`The subtraction values ${n ?? "a"} or ${e ?? "b"} are not defined`);
|
|
2355
1279
|
t.push(n - e);
|
|
2356
1280
|
} else if (n.token === "%") {
|
|
2357
1281
|
let e = t.pop(), n = t.pop();
|
|
@@ -2390,14 +1314,17 @@ var he = E("^", "*", "/", "+", "-"), D = E("^", "*", "/", "+", "-", "%", "sin",
|
|
|
2390
1314
|
_numberCorrection(e, t = 8) {
|
|
2391
1315
|
return +e.toFixed(t);
|
|
2392
1316
|
}
|
|
2393
|
-
},
|
|
1317
|
+
}, O = class e {
|
|
2394
1318
|
#e;
|
|
2395
1319
|
#t;
|
|
2396
1320
|
constructor(e) {
|
|
2397
|
-
return this.#e = new
|
|
1321
|
+
return this.#e = new _().zero(), this.#t = {}, e !== void 0 && this.parse(e), this;
|
|
2398
1322
|
}
|
|
2399
1323
|
parse(t) {
|
|
2400
|
-
return this.#e = new
|
|
1324
|
+
return this.#e = new _(), this.#t = {}, t instanceof e ? (this.#e = t.#e.clone(), this.#n(t), this) : t instanceof _ ? (this.#e = t.clone(), this) : typeof t == "number" ? (this.#e = new _(t), this) : (isNaN(Number(t)) ? this.#s(t) : this.#e = new _(Number(t)), this);
|
|
1325
|
+
}
|
|
1326
|
+
copy() {
|
|
1327
|
+
throw new a("copy() is not yet implemented for Monom");
|
|
2401
1328
|
}
|
|
2402
1329
|
clone = () => {
|
|
2403
1330
|
let t = new e();
|
|
@@ -2414,10 +1341,10 @@ var he = E("^", "*", "/", "+", "-"), D = E("^", "*", "/", "+", "-", "%", "sin",
|
|
|
2414
1341
|
static gcd = (...t) => {
|
|
2415
1342
|
for (let n of t) if (n.containsRationalPower()) return new e().zero();
|
|
2416
1343
|
let n = new e();
|
|
2417
|
-
n.coefficient = new
|
|
1344
|
+
n.coefficient = new _(g.gcd(...t.map((e) => e.coefficient.numerator)), g.lcm(...t.map((e) => e.coefficient.denominator))).reduce();
|
|
2418
1345
|
for (let e of t) {
|
|
2419
1346
|
for (let t in n.literal) t in e.literal || n.removeVariable(t);
|
|
2420
|
-
for (let t in e.literal) !n.hasVariable(t) && e.literal[t].isStrictlyPositive() ? n.literal[t] = e.literal[t].clone() : n.literal[t] = new
|
|
1347
|
+
for (let t in e.literal) !n.hasVariable(t) && e.literal[t].isStrictlyPositive() ? n.literal[t] = e.literal[t].clone() : n.literal[t] = new _(Math.min(e.literal[t].value, n.literal[t].value));
|
|
2421
1348
|
}
|
|
2422
1349
|
return n;
|
|
2423
1350
|
};
|
|
@@ -2438,14 +1365,14 @@ var he = E("^", "*", "/", "+", "-"), D = E("^", "*", "/", "+", "-", "%", "sin",
|
|
|
2438
1365
|
return this.#e;
|
|
2439
1366
|
}
|
|
2440
1367
|
set coefficient(e) {
|
|
2441
|
-
this.#e = new
|
|
1368
|
+
this.#e = new _(e);
|
|
2442
1369
|
}
|
|
2443
|
-
containsRationalPower = () => Object.values(this.#t).some((e) => e.
|
|
2444
|
-
degree = (e) => this.variables.length === 0 ? new
|
|
1370
|
+
containsRationalPower = () => Object.values(this.#t).some((e) => e.hasFractionalPart());
|
|
1371
|
+
degree = (e) => this.variables.length === 0 ? new _().zero() : e === void 0 ? Object.values(this.#t).reduce((e, t) => e.clone().add(t)) : this.hasVariable(e) ? this.#t[e].clone() : new _().zero();
|
|
2445
1372
|
derivative = (t = "x") => {
|
|
2446
1373
|
if (this.hasVariable(t)) {
|
|
2447
1374
|
let e = this.#t[t].clone(), n = this.clone();
|
|
2448
|
-
return n.#t[t].subtract(1), n.#e.multiply(new
|
|
1375
|
+
return n.#t[t].subtract(1), n.#e.multiply(new _(e.clone())), n;
|
|
2449
1376
|
}
|
|
2450
1377
|
return new e().zero();
|
|
2451
1378
|
};
|
|
@@ -2459,42 +1386,42 @@ var he = E("^", "*", "/", "+", "-"), D = E("^", "*", "/", "+", "-", "%", "sin",
|
|
|
2459
1386
|
};
|
|
2460
1387
|
get dividers() {
|
|
2461
1388
|
if (!this.coefficient.isRelative() || this.containsRationalPower() || this.coefficient.numerator > 1e6) return [this.clone()];
|
|
2462
|
-
let t =
|
|
1389
|
+
let t = g.dividers(Math.abs(this.coefficient.numerator)), n = [];
|
|
2463
1390
|
for (let e in this.literal) n = this.#a(n, e);
|
|
2464
1391
|
let r = [];
|
|
2465
1392
|
if (n.length > 0 && t.length > 0) for (let i of t) for (let t of n) {
|
|
2466
1393
|
let n = new e();
|
|
2467
|
-
n.coefficient = new
|
|
1394
|
+
n.coefficient = new _(i), n.literal = t, r.push(n);
|
|
2468
1395
|
}
|
|
2469
1396
|
else if (t.length === 0) for (let t of n) {
|
|
2470
1397
|
let n = new e();
|
|
2471
|
-
n.coefficient = new
|
|
1398
|
+
n.coefficient = new _().one(), n.literal = t, r.push(n);
|
|
2472
1399
|
}
|
|
2473
1400
|
else for (let n of t) {
|
|
2474
1401
|
let t = new e();
|
|
2475
|
-
t.coefficient = new
|
|
1402
|
+
t.coefficient = new _(n), r.push(t);
|
|
2476
1403
|
}
|
|
2477
1404
|
return r.length === 0 ? [new e().one()] : r;
|
|
2478
1405
|
}
|
|
2479
1406
|
evaluate = (e, t) => {
|
|
2480
1407
|
if (t === !0) {
|
|
2481
|
-
if (e instanceof
|
|
1408
|
+
if (e instanceof _) return this.#r(e.value);
|
|
2482
1409
|
if (typeof e == "number") return this.#r(e);
|
|
2483
1410
|
if (typeof e == "object") {
|
|
2484
1411
|
let t = {};
|
|
2485
|
-
for (let n in e) t[n] = new
|
|
1412
|
+
for (let n in e) t[n] = new _(e[n]).value;
|
|
2486
1413
|
return this.#r(t);
|
|
2487
1414
|
}
|
|
2488
1415
|
}
|
|
2489
1416
|
let n = this.coefficient.clone();
|
|
2490
|
-
if (typeof e == "number" || e instanceof
|
|
1417
|
+
if (typeof e == "number" || e instanceof _) {
|
|
2491
1418
|
let t = {};
|
|
2492
|
-
return t[this.variables[0]] = new
|
|
1419
|
+
return t[this.variables[0]] = new _(e), this.evaluate(t);
|
|
2493
1420
|
}
|
|
2494
1421
|
if (typeof e == "object") {
|
|
2495
1422
|
if (this.variables.length === 0) return this.coefficient;
|
|
2496
1423
|
for (let t in this.#t) {
|
|
2497
|
-
let r = new
|
|
1424
|
+
let r = new _(e[t]);
|
|
2498
1425
|
n.multiply(r.pow(this.#t[t]));
|
|
2499
1426
|
}
|
|
2500
1427
|
}
|
|
@@ -2514,11 +1441,11 @@ var he = E("^", "*", "/", "+", "-"), D = E("^", "*", "/", "+", "-", "%", "sin",
|
|
|
2514
1441
|
if (e.degree().isStrictlyPositive()) {
|
|
2515
1442
|
for (let t of e.variables) if (!this.degree(t).isGeq(e.degree(t))) return !1;
|
|
2516
1443
|
}
|
|
2517
|
-
return this.coefficient.
|
|
1444
|
+
return this.coefficient.hasFractionalPart() || e.coefficient.hasFractionalPart() ? !0 : this.coefficient.clone().divide(e.coefficient).isRelative();
|
|
2518
1445
|
};
|
|
2519
1446
|
isEqual = (e) => this.isSameAs(e) && this.#e.isEqual(e.coefficient);
|
|
2520
1447
|
isLiteralSquare = () => {
|
|
2521
|
-
for (let e in this.literal) if (this.literal[e].
|
|
1448
|
+
for (let e in this.literal) if (this.literal[e].hasFractionalPart() || this.literal[e].isOdd()) return !1;
|
|
2522
1449
|
return !0;
|
|
2523
1450
|
};
|
|
2524
1451
|
isOne = () => this.#e.value === 1 && this.variables.length === 0;
|
|
@@ -2540,8 +1467,8 @@ var he = E("^", "*", "/", "+", "-"), D = E("^", "*", "/", "+", "-", "%", "sin",
|
|
|
2540
1467
|
this.#t = e;
|
|
2541
1468
|
}
|
|
2542
1469
|
set literalStr(e) {
|
|
2543
|
-
for (let t of [...e.matchAll(/([a-z])\^([+-]?[0-9]+)/g)]) t[1] in this.#t || (this.#t[t[1]] = new
|
|
2544
|
-
for (let t of [...e.matchAll(/([a-z](?!\^))/g)]) t[1] in this.#t || (this.#t[t[1]] = new
|
|
1470
|
+
for (let t of [...e.matchAll(/([a-z])\^([+-]?[0-9]+)/g)]) t[1] in this.#t || (this.#t[t[1]] = new _().zero()), this.#t[t[1]].add(+t[2]);
|
|
1471
|
+
for (let t of [...e.matchAll(/([a-z](?!\^))/g)]) t[1] in this.#t || (this.#t[t[1]] = new _().zero()), this.#t[t[1]].add(1);
|
|
2545
1472
|
}
|
|
2546
1473
|
multiply = (...t) => {
|
|
2547
1474
|
for (let n of t) {
|
|
@@ -2551,7 +1478,7 @@ var he = E("^", "*", "/", "+", "-"), D = E("^", "*", "/", "+", "-", "%", "sin",
|
|
|
2551
1478
|
}
|
|
2552
1479
|
return this;
|
|
2553
1480
|
};
|
|
2554
|
-
one = () => (this.#e = new
|
|
1481
|
+
one = () => (this.#e = new _().one(), this.#t = {}, this);
|
|
2555
1482
|
opposite = () => (this.#e.opposite(), this);
|
|
2556
1483
|
get plotFunction() {
|
|
2557
1484
|
return this.#i("plot");
|
|
@@ -2563,7 +1490,7 @@ var he = E("^", "*", "/", "+", "-"), D = E("^", "*", "/", "+", "-", "%", "sin",
|
|
|
2563
1490
|
};
|
|
2564
1491
|
primitive = (e = "x") => {
|
|
2565
1492
|
let t = this.clone(), n;
|
|
2566
|
-
return t.hasVariable(e) ? (n = t.degree(e).clone().add(1), t.coefficient = t.coefficient.clone().divide(n), t.setLetter(e, n)) : (t.coefficient.isZero() && (t.coefficient = new
|
|
1493
|
+
return t.hasVariable(e) ? (n = t.degree(e).clone().add(1), t.coefficient = t.coefficient.clone().divide(n), t.setLetter(e, n)) : (t.coefficient.isZero() && (t.coefficient = new _().one()), t.setLetter(e, 1)), t;
|
|
2567
1494
|
};
|
|
2568
1495
|
reduce = () => {
|
|
2569
1496
|
this.coefficient.reduce();
|
|
@@ -2576,7 +1503,7 @@ var he = E("^", "*", "/", "+", "-"), D = E("^", "*", "/", "+", "-", "%", "sin",
|
|
|
2576
1503
|
root = () => {
|
|
2577
1504
|
throw new a("Method not implemented.");
|
|
2578
1505
|
};
|
|
2579
|
-
setLetter = (e, t) => t instanceof
|
|
1506
|
+
setLetter = (e, t) => t instanceof _ ? this.hasVariable(e) && t.isZero() ? (this.removeVariable(e), this) : (this.#t[e] = t.clone(), this) : this.setLetter(e, new _(t));
|
|
2580
1507
|
sqrt = () => {
|
|
2581
1508
|
if (this.isSquare()) {
|
|
2582
1509
|
this.#e.sqrt();
|
|
@@ -2598,7 +1525,7 @@ var he = E("^", "*", "/", "+", "-"), D = E("^", "*", "/", "+", "-", "%", "sin",
|
|
|
2598
1525
|
n.isZero() || e.push(t);
|
|
2599
1526
|
}), e.sort(), e;
|
|
2600
1527
|
}
|
|
2601
|
-
zero = () => (this.#e = new
|
|
1528
|
+
zero = () => (this.#e = new _().zero(), this.#t = {}, this);
|
|
2602
1529
|
#n(e) {
|
|
2603
1530
|
for (let t in e.literal) this.#t[t] = e.literal[t].clone();
|
|
2604
1531
|
}
|
|
@@ -2608,40 +1535,40 @@ var he = E("^", "*", "/", "+", "-"), D = E("^", "*", "/", "+", "-", "%", "sin",
|
|
|
2608
1535
|
let t = {}, n = this.variables[0];
|
|
2609
1536
|
return t[n] = e, this.#r(t);
|
|
2610
1537
|
}
|
|
2611
|
-
if (e instanceof
|
|
1538
|
+
if (e instanceof _) {
|
|
2612
1539
|
let t = {};
|
|
2613
|
-
return t[this.variables[0]] = new
|
|
1540
|
+
return t[this.variables[0]] = new _(e).value, this.#r(t);
|
|
2614
1541
|
}
|
|
2615
1542
|
if (typeof e == "object") {
|
|
2616
1543
|
if (this.variables.length === 0) return this.coefficient.value;
|
|
2617
1544
|
for (let n in this.#t) {
|
|
2618
1545
|
let r = e[n];
|
|
2619
|
-
r instanceof
|
|
1546
|
+
r instanceof _ ? t *= r.value ** this.#t[n].value : t *= r ** this.#t[n].value;
|
|
2620
1547
|
}
|
|
2621
1548
|
}
|
|
2622
1549
|
return t;
|
|
2623
1550
|
};
|
|
2624
1551
|
#i = (e) => {
|
|
2625
1552
|
let t = "", n = Object.keys(this.#t).sort();
|
|
2626
|
-
for (let r of n) this.#t[r].isNotZero() && (e === "plot" && t !== "" && (t += "*"), t += r, this.#t[r].isNotEqual(1) && (t += e === "tex" ? `^{ ${this.#t[r].
|
|
2627
|
-
let r = e === "tex" ? this.#e.
|
|
1553
|
+
for (let r of n) this.#t[r].isNotZero() && (e === "plot" && t !== "" && (t += "*"), t += r, this.#t[r].isNotEqual(1) && (t += e === "tex" ? `^{ ${this.#t[r].asTfrac.tex} }` : `^(${this.#t[r].display})`));
|
|
1554
|
+
let r = e === "tex" ? this.#e.asFrac.tex : this.#e.display;
|
|
2628
1555
|
return t === "" ? this.#e.value === 0 ? "0" : r : this.#e.value === 1 ? t : this.#e.value === -1 ? `-${t}` : this.#e.value === 0 ? "0" : e === "plot" ? `${r}*${t}` : `${r}${t}`;
|
|
2629
1556
|
};
|
|
2630
1557
|
#a(e, t) {
|
|
2631
1558
|
let n = [];
|
|
2632
1559
|
for (let r = 0; r <= this.literal[t].value; r++) if (e.length === 0) {
|
|
2633
1560
|
let e = {};
|
|
2634
|
-
e[t] = new
|
|
1561
|
+
e[t] = new _(r), n.push(e);
|
|
2635
1562
|
} else for (let i of e) {
|
|
2636
1563
|
let e = {};
|
|
2637
1564
|
for (let t in i) e[t] = i[t];
|
|
2638
|
-
e[t] = new
|
|
1565
|
+
e[t] = new _(r), n.push(e);
|
|
2639
1566
|
}
|
|
2640
1567
|
return n;
|
|
2641
1568
|
}
|
|
2642
1569
|
#o = (t, n) => {
|
|
2643
1570
|
let r, i, a, o, s;
|
|
2644
|
-
if (n.tokenType === w.COEFFICIENT) t.push(new e(new
|
|
1571
|
+
if (n.tokenType === w.COEFFICIENT) t.push(new e(new _(n.token)));
|
|
2645
1572
|
else if (n.tokenType === w.VARIABLE) {
|
|
2646
1573
|
let r = new e().one();
|
|
2647
1574
|
r.setLetter(n.token, 1), t.push(r.clone());
|
|
@@ -2655,13 +1582,13 @@ var he = E("^", "*", "/", "+", "-"), D = E("^", "*", "/", "+", "-", "%", "sin",
|
|
|
2655
1582
|
case "/":
|
|
2656
1583
|
i = t.pop() ?? new e().one(), r = t.pop() ?? new e().one(), t.push(r.divide(i));
|
|
2657
1584
|
break;
|
|
2658
|
-
case "^": s = t.pop()?.coefficient ?? new
|
|
1585
|
+
case "^": s = t.pop()?.coefficient ?? new _().one(), a = t.pop() ?? new e().one(), o = a.variables[0], o && a.setLetter(o, s), t.push(a);
|
|
2659
1586
|
}
|
|
2660
1587
|
};
|
|
2661
1588
|
#s = (e) => {
|
|
2662
1589
|
let n;
|
|
2663
1590
|
try {
|
|
2664
|
-
n = new
|
|
1591
|
+
n = new D().parse(e);
|
|
2665
1592
|
} catch (n) {
|
|
2666
1593
|
throw new t(`Cannot parse "${e}" as a Monom`, { cause: n });
|
|
2667
1594
|
}
|
|
@@ -2669,15 +1596,38 @@ var he = E("^", "*", "/", "+", "-"), D = E("^", "*", "/", "+", "-", "%", "sin",
|
|
|
2669
1596
|
if (r.length === 0) return this.zero(), this;
|
|
2670
1597
|
if (r.length === 1) {
|
|
2671
1598
|
let e = r[0];
|
|
2672
|
-
return this.one(), e.tokenType === w.COEFFICIENT ? this.coefficient = new
|
|
1599
|
+
return this.one(), e.tokenType === w.COEFFICIENT ? this.coefficient = new _(e.token) : e.tokenType === w.VARIABLE && this.setLetter(e.token, 1), this;
|
|
2673
1600
|
}
|
|
2674
1601
|
for (let e of r) this.#o(i, e);
|
|
2675
1602
|
return this.one(), this.multiply(i[0]), this;
|
|
2676
1603
|
};
|
|
2677
1604
|
};
|
|
2678
1605
|
//#endregion
|
|
2679
|
-
//#region src/
|
|
1606
|
+
//#region src/helpers.ts
|
|
1607
|
+
function ye(e, t = !0) {
|
|
1608
|
+
return t ? `\\left( ${e} \\right)` : `(${e})`;
|
|
1609
|
+
}
|
|
1610
|
+
function k(e) {
|
|
1611
|
+
if (!e.startsWith("(") || !e.endsWith(")")) return e;
|
|
1612
|
+
let t = 0;
|
|
1613
|
+
for (let n = 0; n < e.length - 1; n++) if (e[n] === "(" ? t++ : e[n] === ")" && t--, t === 0) return e;
|
|
1614
|
+
return e.slice(1, -1);
|
|
1615
|
+
}
|
|
1616
|
+
function A(e, t, n, r, i) {
|
|
1617
|
+
return e.map((e, a) => r !== void 0 && a < r || i !== void 0 && a > i ? e : e === t ? n : e);
|
|
1618
|
+
}
|
|
2680
1619
|
function j(e, t) {
|
|
1620
|
+
if (t.length !== 1) throw new i(`splitChar must be a single character, got: "${t}"`);
|
|
1621
|
+
let n = 0, r = 0, a = [];
|
|
1622
|
+
for (let i = 0; i < e.length; i++) {
|
|
1623
|
+
let o = e[i];
|
|
1624
|
+
o === "(" ? n++ : o === ")" ? n-- : o === t && n === 0 && (a.push(e.substring(r, i)), r = i + 1);
|
|
1625
|
+
}
|
|
1626
|
+
return a.push(e.substring(r)), a;
|
|
1627
|
+
}
|
|
1628
|
+
//#endregion
|
|
1629
|
+
//#region src/algebra/operations.ts
|
|
1630
|
+
function M(e, t) {
|
|
2681
1631
|
if (!Number.isSafeInteger(t)) throw new i("Can only raise item by an integer");
|
|
2682
1632
|
if (t < 0) throw new i("Can only raise item by a positive integer");
|
|
2683
1633
|
if (t === 0) return e.one();
|
|
@@ -2687,7 +1637,7 @@ function j(e, t) {
|
|
|
2687
1637
|
}
|
|
2688
1638
|
//#endregion
|
|
2689
1639
|
//#region src/algebra/polynom.ts
|
|
2690
|
-
var
|
|
1640
|
+
var N = class e {
|
|
2691
1641
|
#e = "x";
|
|
2692
1642
|
#t;
|
|
2693
1643
|
#n;
|
|
@@ -2698,13 +1648,16 @@ var M = class e {
|
|
|
2698
1648
|
}
|
|
2699
1649
|
parse(t, ...n) {
|
|
2700
1650
|
if (this.#n = [], this.#t = [], this.#u(), typeof t == "string") return this.#h(t, ...n);
|
|
2701
|
-
if ((typeof t == "number" || t instanceof
|
|
2702
|
-
else if (t instanceof
|
|
2703
|
-
this.#n.push(new
|
|
1651
|
+
if ((typeof t == "number" || t instanceof _ || t instanceof O) && n.length === 0) this.#n.push(new O(t));
|
|
1652
|
+
else if (t instanceof O && n.length > 0) this.#n.push(new O(t)), n.forEach((e) => {
|
|
1653
|
+
this.#n.push(new O(e));
|
|
2704
1654
|
});
|
|
2705
1655
|
else if (t instanceof e) for (let e of t.monoms) this.#n.push(e.clone());
|
|
2706
1656
|
return this;
|
|
2707
1657
|
}
|
|
1658
|
+
copy() {
|
|
1659
|
+
throw new a("copy() is not yet implemented for Polynom");
|
|
1660
|
+
}
|
|
2708
1661
|
clone() {
|
|
2709
1662
|
let t = new e(), n = [];
|
|
2710
1663
|
t.#e = this.#e;
|
|
@@ -2724,21 +1677,21 @@ var M = class e {
|
|
|
2724
1677
|
}), n;
|
|
2725
1678
|
}
|
|
2726
1679
|
add(...t) {
|
|
2727
|
-
for (let n of t) n instanceof e ? this.#n = this.#n.concat(n.monoms.map((e) => e.clone())) : n instanceof
|
|
1680
|
+
for (let n of t) n instanceof e ? this.#n = this.#n.concat(n.monoms.map((e) => e.clone())) : n instanceof O ? this.#n.push(n.clone()) : typeof n == "number" && Number.isSafeInteger(n) ? this.#n.push(new O(n.toString())) : this.#n.push(new O(n));
|
|
2728
1681
|
return this.reduce();
|
|
2729
1682
|
}
|
|
2730
1683
|
commonMonom() {
|
|
2731
|
-
let e = new
|
|
2732
|
-
e.coefficient = new
|
|
1684
|
+
let e = new O().one();
|
|
1685
|
+
e.coefficient = new _(this.gcdNumerator(), this.gcdDenominator());
|
|
2733
1686
|
for (let t of this.variables) {
|
|
2734
1687
|
e.setLetter(t, this.degree(t));
|
|
2735
|
-
for (let n of this.#n) if (e.setLetter(t,
|
|
1688
|
+
for (let n of this.#n) if (e.setLetter(t, _.min(n.degree(t), e.degree(t))), e.degree(t).isZero()) break;
|
|
2736
1689
|
}
|
|
2737
1690
|
return e;
|
|
2738
1691
|
}
|
|
2739
1692
|
degree(e) {
|
|
2740
|
-
let t = new
|
|
2741
|
-
for (let n of this.#n) t =
|
|
1693
|
+
let t = new _().zero();
|
|
1694
|
+
for (let n of this.#n) t = _.max(n.degree(e).value, t);
|
|
2742
1695
|
return t;
|
|
2743
1696
|
}
|
|
2744
1697
|
derivative(t) {
|
|
@@ -2747,9 +1700,9 @@ var M = class e {
|
|
|
2747
1700
|
return n.reduce();
|
|
2748
1701
|
}
|
|
2749
1702
|
divide(t) {
|
|
2750
|
-
if (t instanceof
|
|
1703
|
+
if (t instanceof _) return this.#o(t);
|
|
2751
1704
|
if (typeof t == "number" && Number.isSafeInteger(t)) return this.#s(t);
|
|
2752
|
-
if (t instanceof
|
|
1705
|
+
if (t instanceof O) return this.divide(new e(t));
|
|
2753
1706
|
if (t instanceof e) {
|
|
2754
1707
|
if (t.monoms.length === 1 && t.variables.length === 0) return this.#o(t.monoms[0].coefficient);
|
|
2755
1708
|
{
|
|
@@ -2778,7 +1731,7 @@ var M = class e {
|
|
|
2778
1731
|
}
|
|
2779
1732
|
evaluate(e, t) {
|
|
2780
1733
|
if (t) return this.#c(e);
|
|
2781
|
-
let n = new
|
|
1734
|
+
let n = new _().zero();
|
|
2782
1735
|
return this.#n.forEach((r) => {
|
|
2783
1736
|
n.add(r.evaluate(e, t));
|
|
2784
1737
|
}), n;
|
|
@@ -2790,7 +1743,7 @@ var M = class e {
|
|
|
2790
1743
|
let i = new b(n).solve();
|
|
2791
1744
|
if (i.length === 0) return this.#t.length === 0 ? this.#t = [this.clone()] : this.#t.push(n), this.#t;
|
|
2792
1745
|
if (i.forEach((t) => {
|
|
2793
|
-
if (t.exact && t.root.isZero()) for (let n = 0; n < t.count; n++) t.fraction.
|
|
1746
|
+
if (t.exact && t.root.isZero()) for (let n = 0; n < t.count; n++) t.fraction.hasFractionalPart() ? this.#t.push(new e().fromCoefficients(t.fraction.denominator, -t.fraction.numerator)) : this.#t.push(new e().fromCoefficients(1, t.fraction.clone().opposite()));
|
|
2794
1747
|
}), this.#t.map((e) => e.degree().value).reduce((e, t) => e + t, 0) < this.degree().value) {
|
|
2795
1748
|
let t = e.xMultiply(...this.#t);
|
|
2796
1749
|
this.#t.push(this.clone().divide(t));
|
|
@@ -2804,19 +1757,19 @@ var M = class e {
|
|
|
2804
1757
|
this.#n = [];
|
|
2805
1758
|
let t = this.#e ?? "x";
|
|
2806
1759
|
return e.reverse().forEach((e, n) => {
|
|
2807
|
-
let r = new
|
|
2808
|
-
r.coefficient = new
|
|
1760
|
+
let r = new O();
|
|
1761
|
+
r.coefficient = new _(e), r.setLetter(t, n), this.#n.push(r);
|
|
2809
1762
|
}), this.#u(), this.reorder();
|
|
2810
1763
|
}
|
|
2811
1764
|
gcdDenominator() {
|
|
2812
|
-
return
|
|
1765
|
+
return g.gcd(...this.getDenominators());
|
|
2813
1766
|
}
|
|
2814
1767
|
gcdNumerator() {
|
|
2815
|
-
return
|
|
1768
|
+
return g.gcd(...this.getNumerators());
|
|
2816
1769
|
}
|
|
2817
1770
|
getCoefficients() {
|
|
2818
1771
|
if (!this.degree().isNatural()) throw new r("getCoefficients() requires a polynomial with integer degrees");
|
|
2819
|
-
let e = this.clone().reorder(), t = this.degree().value + 1, n = Array.from({ length: t }, () => new
|
|
1772
|
+
let e = this.clone().reorder(), t = this.degree().value + 1, n = Array.from({ length: t }, () => new _(0));
|
|
2820
1773
|
return e.monoms.forEach((e) => {
|
|
2821
1774
|
let r = t - e.degree().value - 1;
|
|
2822
1775
|
n[r] = e.coefficient.clone();
|
|
@@ -2840,7 +1793,7 @@ var M = class e {
|
|
|
2840
1793
|
}
|
|
2841
1794
|
integrate(e, t, n = "x") {
|
|
2842
1795
|
let r = this.primitive(n), i = {}, a = {};
|
|
2843
|
-
return i[n] = new
|
|
1796
|
+
return i[n] = new _(e), a[n] = new _(t), r.evaluate(a).subtract(r.evaluate(i));
|
|
2844
1797
|
}
|
|
2845
1798
|
inverse() {}
|
|
2846
1799
|
isDeveloped(t) {
|
|
@@ -2878,33 +1831,33 @@ var M = class e {
|
|
|
2878
1831
|
return this.#n.length === 1 && this.#n[0].coefficient.isZero() || this.#n.length === 0;
|
|
2879
1832
|
}
|
|
2880
1833
|
lcmDenominator() {
|
|
2881
|
-
return
|
|
1834
|
+
return g.lcm(...this.getDenominators());
|
|
2882
1835
|
}
|
|
2883
1836
|
lcmNumerator() {
|
|
2884
|
-
return
|
|
1837
|
+
return g.lcm(...this.getNumerators());
|
|
2885
1838
|
}
|
|
2886
1839
|
get length() {
|
|
2887
1840
|
return this.#n.length;
|
|
2888
1841
|
}
|
|
2889
1842
|
limitTo(e, t) {
|
|
2890
|
-
let n = new
|
|
1843
|
+
let n = new _(e);
|
|
2891
1844
|
if (n.isFinite()) {
|
|
2892
1845
|
let e = t ?? this.variables[0] ?? "x";
|
|
2893
1846
|
return this.evaluate({ [e]: n });
|
|
2894
1847
|
}
|
|
2895
1848
|
let r = this.monomByDegree(void 0, t), i = r.coefficient.sign(), a = r.degree(t);
|
|
2896
|
-
return a.isZero() ? r.coefficient.clone() : a.isStrictlyPositive() ? n.isPositive() ? i === 1 ? new
|
|
1849
|
+
return a.isZero() ? r.coefficient.clone() : a.isStrictlyPositive() ? n.isPositive() ? i === 1 ? new _().infinite() : new _().infinite().opposite() : (a.value % 2 == 0 ? i : -i) === 1 ? new _().infinite() : new _().infinite().opposite() : new _().zero();
|
|
2897
1850
|
}
|
|
2898
1851
|
monomByDegree(e, t) {
|
|
2899
1852
|
if (e === void 0) return this.monomByDegree(this.degree(t), t);
|
|
2900
1853
|
let n = this.clone().reduce();
|
|
2901
1854
|
for (let r of n.#n) if (r.degree(t).isEqual(e)) return r.clone();
|
|
2902
|
-
return new
|
|
1855
|
+
return new O().zero();
|
|
2903
1856
|
}
|
|
2904
1857
|
monomByLetter(e) {
|
|
2905
1858
|
let t = this.clone().reduce();
|
|
2906
1859
|
for (let n of t.#n) if (n.hasVariable(e)) return n.clone();
|
|
2907
|
-
return new
|
|
1860
|
+
return new O().zero();
|
|
2908
1861
|
}
|
|
2909
1862
|
get monoms() {
|
|
2910
1863
|
return this.#n;
|
|
@@ -2920,11 +1873,11 @@ var M = class e {
|
|
|
2920
1873
|
}
|
|
2921
1874
|
multiply(t) {
|
|
2922
1875
|
if (t instanceof e) return this.#m(t);
|
|
2923
|
-
if (t instanceof
|
|
2924
|
-
if (t instanceof
|
|
1876
|
+
if (t instanceof _) return this.#d(t);
|
|
1877
|
+
if (t instanceof O) return this.#p(t);
|
|
2925
1878
|
if (Number.isSafeInteger(t) && typeof t == "number") return this.#f(t);
|
|
2926
1879
|
if (typeof t == "string") try {
|
|
2927
|
-
let e = new
|
|
1880
|
+
let e = new _(t);
|
|
2928
1881
|
return this.#d(e);
|
|
2929
1882
|
} catch (e) {
|
|
2930
1883
|
throw new r("Cannot multiply by this value.", { cause: e });
|
|
@@ -2935,7 +1888,7 @@ var M = class e {
|
|
|
2935
1888
|
return this.variables.length;
|
|
2936
1889
|
}
|
|
2937
1890
|
one() {
|
|
2938
|
-
return this.#n = [], this.#n.push(new
|
|
1891
|
+
return this.#n = [], this.#n.push(new O().one()), this.#u(), this;
|
|
2939
1892
|
}
|
|
2940
1893
|
opposite() {
|
|
2941
1894
|
return this.#n = this.#n.map((e) => e.opposite()), this.#u(), this;
|
|
@@ -2944,7 +1897,7 @@ var M = class e {
|
|
|
2944
1897
|
return this.#l("tex", !1, !1, !0);
|
|
2945
1898
|
}
|
|
2946
1899
|
pow(e) {
|
|
2947
|
-
return
|
|
1900
|
+
return M(this, e).reduce();
|
|
2948
1901
|
}
|
|
2949
1902
|
primitive(t) {
|
|
2950
1903
|
let n = new e();
|
|
@@ -2954,7 +1907,7 @@ var M = class e {
|
|
|
2954
1907
|
reduce() {
|
|
2955
1908
|
let e = 0;
|
|
2956
1909
|
for (; e < this.#n.length;) {
|
|
2957
|
-
for (let t = e + 1; t < this.#n.length; t++) this.#n[e].isSameAs(this.#n[t]) && (this.#n[e].add(this.#n[t]), this.#n.splice(t, 1), this.#n[e].isZero() && (this.#n[e] = new
|
|
1910
|
+
for (let t = e + 1; t < this.#n.length; t++) this.#n[e].isSameAs(this.#n[t]) && (this.#n[e].add(this.#n[t]), this.#n.splice(t, 1), this.#n[e].isZero() && (this.#n[e] = new O().zero()), t--);
|
|
2958
1911
|
e++;
|
|
2959
1912
|
}
|
|
2960
1913
|
this.#n = this.#n.filter((e) => !e.coefficient.isZero());
|
|
@@ -2998,14 +1951,14 @@ var M = class e {
|
|
|
2998
1951
|
throw new r("Cannot take the square root from a polynom");
|
|
2999
1952
|
}
|
|
3000
1953
|
subtract(...t) {
|
|
3001
|
-
for (let n of t) n instanceof e ? this.add(n.clone().opposite()) : n instanceof
|
|
1954
|
+
for (let n of t) n instanceof e ? this.add(n.clone().opposite()) : n instanceof O ? this.#n.push(n.clone().opposite()) : this.#n.push(new O(n).opposite());
|
|
3002
1955
|
return this.reduce();
|
|
3003
1956
|
}
|
|
3004
1957
|
tableOfSigns() {
|
|
3005
1958
|
let e = this.roots, t = Array(2 * e.length + 1).fill("").map((e, t) => t % 2 == 0 ? "" : "z");
|
|
3006
1959
|
if (t.length === 1) {
|
|
3007
1960
|
let [e] = this.getCoefficients().map((e) => e.value);
|
|
3008
|
-
t =
|
|
1961
|
+
t = A(t, "", e > 0 ? "+" : "-");
|
|
3009
1962
|
} else if (this.degree().isOne()) {
|
|
3010
1963
|
let [e] = this.getCoefficients().map((e) => e.value);
|
|
3011
1964
|
t[0] = e > 0 ? "-" : "+", t[1] = "z", t[2] = e > 0 ? "+" : "-";
|
|
@@ -3025,7 +1978,7 @@ var M = class e {
|
|
|
3025
1978
|
return [...new Set(this.#n.flatMap((e) => e.variables))].sort();
|
|
3026
1979
|
}
|
|
3027
1980
|
zero() {
|
|
3028
|
-
return this.#n = [], this.#n.push(new
|
|
1981
|
+
return this.#n = [], this.#n.push(new O().zero()), this.#u(), this;
|
|
3029
1982
|
}
|
|
3030
1983
|
get zeroes() {
|
|
3031
1984
|
return this.getZeroes();
|
|
@@ -3044,7 +1997,7 @@ var M = class e {
|
|
|
3044
1997
|
return this.#u(), this;
|
|
3045
1998
|
}
|
|
3046
1999
|
#s(e) {
|
|
3047
|
-
let t = new
|
|
2000
|
+
let t = new _(e);
|
|
3048
2001
|
for (let e of this.#n) e.coefficient.divide(t);
|
|
3049
2002
|
return this.#u(), this;
|
|
3050
2003
|
}
|
|
@@ -3071,7 +2024,7 @@ var M = class e {
|
|
|
3071
2024
|
return this.reduce();
|
|
3072
2025
|
}
|
|
3073
2026
|
#f(e) {
|
|
3074
|
-
return this.#d(new
|
|
2027
|
+
return this.#d(new _(e));
|
|
3075
2028
|
}
|
|
3076
2029
|
#p(e) {
|
|
3077
2030
|
for (let t of this.#n) t.multiply(e);
|
|
@@ -3079,33 +2032,33 @@ var M = class e {
|
|
|
3079
2032
|
}
|
|
3080
2033
|
#m(e) {
|
|
3081
2034
|
let t = [];
|
|
3082
|
-
for (let n of this.#n) for (let r of e.monoms) t.push(
|
|
2035
|
+
for (let n of this.#n) for (let r of e.monoms) t.push(O.xMultiply(n, r));
|
|
3083
2036
|
return this.#n = t, this.reduce();
|
|
3084
2037
|
}
|
|
3085
2038
|
#h(e, ...t) {
|
|
3086
2039
|
if (t.length === 0) {
|
|
3087
2040
|
if (e !== "" && !isNaN(Number(e))) {
|
|
3088
2041
|
this.empty();
|
|
3089
|
-
let t = new
|
|
2042
|
+
let t = new O(Number(e));
|
|
3090
2043
|
return this.add(t), this;
|
|
3091
2044
|
}
|
|
3092
2045
|
return this.#_(e);
|
|
3093
2046
|
}
|
|
3094
2047
|
if (/^[a-z]+$/.test(e)) {
|
|
3095
2048
|
this.empty();
|
|
3096
|
-
let n = t.map((e) => new
|
|
2049
|
+
let n = t.map((e) => new _(e));
|
|
3097
2050
|
if (e.length > 1) {
|
|
3098
2051
|
let t = e.split("");
|
|
3099
2052
|
if (n.length > t.length + 1) throw new i(`Too many values: ${t.length} letters but ${n.length} values provided`);
|
|
3100
2053
|
let r = 0;
|
|
3101
2054
|
for (let e of n) {
|
|
3102
|
-
let n = new
|
|
2055
|
+
let n = new O();
|
|
3103
2056
|
n.coefficient = e.clone(), n.literalStr = t[r] ?? "", this.add(n), r++;
|
|
3104
2057
|
}
|
|
3105
2058
|
} else {
|
|
3106
2059
|
let t = n.length - 1;
|
|
3107
2060
|
for (let r of n) {
|
|
3108
|
-
let n = new
|
|
2061
|
+
let n = new O();
|
|
3109
2062
|
n.coefficient = r.clone(), n.literalStr = `${e}^${t}`, this.add(n), t--;
|
|
3110
2063
|
}
|
|
3111
2064
|
}
|
|
@@ -3119,7 +2072,7 @@ var M = class e {
|
|
|
3119
2072
|
n.push(new e(i.token));
|
|
3120
2073
|
break;
|
|
3121
2074
|
case w.VARIABLE:
|
|
3122
|
-
n.push(new e().add(new
|
|
2075
|
+
n.push(new e().add(new O(i.token)));
|
|
3123
2076
|
break;
|
|
3124
2077
|
case w.CONSTANT: throw new t("Unsupported CONSTANT token in Polynom parser");
|
|
3125
2078
|
case w.OPERATION:
|
|
@@ -3152,7 +2105,7 @@ var M = class e {
|
|
|
3152
2105
|
#_(e) {
|
|
3153
2106
|
let n;
|
|
3154
2107
|
try {
|
|
3155
|
-
n = new
|
|
2108
|
+
n = new D().parse(e);
|
|
3156
2109
|
} catch (n) {
|
|
3157
2110
|
throw new t(`Cannot parse "${e}" as a Polynom`, { cause: n });
|
|
3158
2111
|
}
|
|
@@ -3162,23 +2115,26 @@ var M = class e {
|
|
|
3162
2115
|
for (let e of r) this.#g(i, e);
|
|
3163
2116
|
return i.length === 1 && this.add(i[0]), this.reorder();
|
|
3164
2117
|
}
|
|
3165
|
-
},
|
|
2118
|
+
}, P = class e {
|
|
3166
2119
|
#e;
|
|
3167
2120
|
#t;
|
|
3168
2121
|
#n;
|
|
3169
2122
|
constructor(t, n, r) {
|
|
3170
|
-
if (this.#e = new
|
|
2123
|
+
if (this.#e = new N().zero(), this.#t = new N().zero(), this.#n = "=", t !== void 0 && n === void 0) {
|
|
3171
2124
|
if (t instanceof e) return t.clone();
|
|
3172
2125
|
typeof t == "string" && this.parse(t);
|
|
3173
|
-
} else t !== void 0 && n !== void 0 && (this.left = new
|
|
2126
|
+
} else t !== void 0 && n !== void 0 && (this.left = new N(t), this.right = new N(n));
|
|
3174
2127
|
return r !== void 0 && (this.sign = r), this;
|
|
3175
2128
|
}
|
|
3176
2129
|
parse = (e) => {
|
|
3177
2130
|
let n = this.#r(e);
|
|
3178
2131
|
if (n === !1) throw new t("The equation is not valid (no sign found)");
|
|
3179
2132
|
let r = e.split(n);
|
|
3180
|
-
return this.create(new
|
|
2133
|
+
return this.create(new N(r[0]), new N(r[1]), this.#i(n));
|
|
3181
2134
|
};
|
|
2135
|
+
copy() {
|
|
2136
|
+
throw new a("copy() is not yet implemented for Equation");
|
|
2137
|
+
}
|
|
3182
2138
|
clone = () => new e(this.#e.clone(), this.#t.clone(), this.#n);
|
|
3183
2139
|
get tex() {
|
|
3184
2140
|
return `${this.#e.tex}${this.signAsTex}${this.#t.tex}`;
|
|
@@ -3196,13 +2152,13 @@ var M = class e {
|
|
|
3196
2152
|
add(t) {
|
|
3197
2153
|
if (t instanceof e) return this.#e.add(t.left), this.#t.add(t.right), this;
|
|
3198
2154
|
if (typeof t == "string" && !e.isEquationString(t)) return this.add(new e(t));
|
|
3199
|
-
let n = new
|
|
2155
|
+
let n = new N(t);
|
|
3200
2156
|
return this.#e.add(n), this.#t.add(n), this;
|
|
3201
2157
|
}
|
|
3202
2158
|
create = (e, t, n) => (this.#e = e, this.#t = t, this.#n = this.#i(n ?? "="), this);
|
|
3203
|
-
degree = (e) =>
|
|
2159
|
+
degree = (e) => _.max(this.#e.degree(e), this.#t.degree(e));
|
|
3204
2160
|
divide = (e) => {
|
|
3205
|
-
let t = new
|
|
2161
|
+
let t = new _(e);
|
|
3206
2162
|
return t.isZero() ? this : this.multiply(t.inverse());
|
|
3207
2163
|
};
|
|
3208
2164
|
evaluate(e, t) {
|
|
@@ -3242,7 +2198,7 @@ var M = class e {
|
|
|
3242
2198
|
letters = () => [.../* @__PURE__ */ new Set([...this.#e.variables, ...this.#t.variables])];
|
|
3243
2199
|
moveLeft = () => (this.#e.subtract(this.#t), this.#t.zero(), this);
|
|
3244
2200
|
multiply = (e) => {
|
|
3245
|
-
let t = new
|
|
2201
|
+
let t = new _(e);
|
|
3246
2202
|
return this.#e.multiply(t), this.#t.multiply(t), this.#n !== "=" && t.sign() === -1 && this.#a(), this;
|
|
3247
2203
|
};
|
|
3248
2204
|
get numberOfVars() {
|
|
@@ -3275,7 +2231,7 @@ var M = class e {
|
|
|
3275
2231
|
get signAsTex() {
|
|
3276
2232
|
return this.#n === ">=" ? "\\geq" : this.#n === "<=" ? "\\leq" : this.#n;
|
|
3277
2233
|
}
|
|
3278
|
-
simplify = () => (this.multiply(
|
|
2234
|
+
simplify = () => (this.multiply(g.lcm(...this.#e.getDenominators(), ...this.#t.getDenominators())), this.divide(g.gcd(...this.#e.getNumerators(), ...this.#t.getNumerators())), this);
|
|
3279
2235
|
solve = () => new b(this.clone()).solve();
|
|
3280
2236
|
split() {
|
|
3281
2237
|
return [this.#e.clone(), this.#t.clone()];
|
|
@@ -3283,7 +2239,7 @@ var M = class e {
|
|
|
3283
2239
|
subtract(t) {
|
|
3284
2240
|
if (t instanceof e) return this.#e.subtract(t.left), this.#t.subtract(t.right), this;
|
|
3285
2241
|
if (typeof t == "string" && !e.isEquationString(t)) return this.subtract(new e(t));
|
|
3286
|
-
let n = new
|
|
2242
|
+
let n = new N(t);
|
|
3287
2243
|
return this.#e.subtract(n), this.#t.subtract(n), this;
|
|
3288
2244
|
}
|
|
3289
2245
|
test = (e) => this.left.evaluate(e).isEqual(this.right.evaluate(e));
|
|
@@ -3304,27 +2260,30 @@ var M = class e {
|
|
|
3304
2260
|
};
|
|
3305
2261
|
#i = (e) => e === void 0 ? "=" : e.includes("geq") || e.includes(">=") || e.includes("=>") ? ">=" : e.includes(">") ? ">" : e.includes("leq") || e.includes("<=") || e.includes("=<") ? "<=" : e.includes("<") ? "<" : "=";
|
|
3306
2262
|
#a = () => this.#n === "=" ? this : this.#n.includes("<") ? (this.#n.replace("<", ">"), this) : (this.#n.includes(">") && this.#n.replace(">", "<"), this);
|
|
3307
|
-
},
|
|
2263
|
+
}, F = class e {
|
|
3308
2264
|
#e;
|
|
3309
2265
|
#t;
|
|
3310
2266
|
#n;
|
|
3311
2267
|
#r = !1;
|
|
3312
2268
|
constructor(t, n) {
|
|
3313
|
-
return t instanceof e ? (this.#t = t.polynom.clone(), this.#n = t.power.clone(), n !== void 0 && this.#n.multiply(new
|
|
2269
|
+
return t instanceof e ? (this.#t = t.polynom.clone(), this.#n = t.power.clone(), n !== void 0 && this.#n.multiply(new _(n))) : t === void 0 ? (this.#t = new N(), this.#n = new _(1)) : (this.#t = new N(t), this.#n = new _(n ?? 1)), this.#e = 1, this;
|
|
3314
2270
|
}
|
|
3315
2271
|
parse() {
|
|
3316
2272
|
throw new a("Method not implemented.");
|
|
3317
2273
|
}
|
|
2274
|
+
copy() {
|
|
2275
|
+
throw new a("copy() is not yet implemented for Factor");
|
|
2276
|
+
}
|
|
3318
2277
|
clone() {
|
|
3319
2278
|
return new e(this);
|
|
3320
2279
|
}
|
|
3321
2280
|
get tex() {
|
|
3322
2281
|
let e = this.power.numerator, t = this.power.denominator, n, r;
|
|
3323
|
-
return this.#e === 0 && t > 1 ? (n = `\\sqrt${t === 2 ? "" : `[ ${t} ]`}{ ${this.polynom.tex} }`, r = e === 1 ? "" : `^{ ${e} }`) : (n = this.#r && this.power.isOne() ? this.polynom.tex :
|
|
2282
|
+
return this.#e === 0 && t > 1 ? (n = `\\sqrt${t === 2 ? "" : `[ ${t} ]`}{ ${this.polynom.tex} }`, r = e === 1 ? "" : `^{ ${e} }`) : (n = this.#r && this.power.isOne() ? this.polynom.tex : ye(this.polynom.tex), r = t === 1 && e === 1 ? "" : `^{ ${this.power.tex} }`), n = `${n}${r}`, this.#e === 0 && e < 0 && (n = `\\frac{ 1 }{ ${n} }`), n;
|
|
3324
2283
|
}
|
|
3325
2284
|
get display() {
|
|
3326
2285
|
let e = this.power.numerator, t = this.power.denominator, n, r;
|
|
3327
|
-
return this.#e === 0 && t > 1 ? (n = `${t === 2 ? "sqrt" : `root(${t})`}(${this.polynom.display})`, r = e === 1 ? "" : `^(${e})`) : (n = this.#r && this.power.isOne() ? this.polynom.display :
|
|
2286
|
+
return this.#e === 0 && t > 1 ? (n = `${t === 2 ? "sqrt" : `root(${t})`}(${this.polynom.display})`, r = e === 1 ? "" : `^(${e})`) : (n = this.#r && this.power.isOne() ? this.polynom.display : ye(this.polynom.display, !1), r = t === 1 && e === 1 ? "" : `^(${this.power.display})`), n = `${n}${r}`, this.#e === 0 && e < 0 && (n = `1/(${n})`), n;
|
|
3328
2287
|
}
|
|
3329
2288
|
add() {
|
|
3330
2289
|
throw new r("Adding two factors is not possible");
|
|
@@ -3348,7 +2307,7 @@ var M = class e {
|
|
|
3348
2307
|
}
|
|
3349
2308
|
divide(t) {
|
|
3350
2309
|
if (t instanceof e && this.isSameAs(t)) return this.power.subtract(t.power), this;
|
|
3351
|
-
let n = new
|
|
2310
|
+
let n = new N(t);
|
|
3352
2311
|
if (this.isSameAs(n)) return this.power.subtract(1), this;
|
|
3353
2312
|
throw new r("The two factors must be the same");
|
|
3354
2313
|
}
|
|
@@ -3356,7 +2315,7 @@ var M = class e {
|
|
|
3356
2315
|
return t ? this.polynom.evaluate(e, !0) ** this.power.value : this.polynom.evaluate(e).pow(this.power);
|
|
3357
2316
|
}
|
|
3358
2317
|
fromPolynom(e) {
|
|
3359
|
-
return this.#t = new
|
|
2318
|
+
return this.#t = new N(e), this.#n = new _(1), this;
|
|
3360
2319
|
}
|
|
3361
2320
|
hasVariable(e) {
|
|
3362
2321
|
return this.polynom.hasVariable(e);
|
|
@@ -3372,7 +2331,7 @@ var M = class e {
|
|
|
3372
2331
|
}
|
|
3373
2332
|
isSameAs(t) {
|
|
3374
2333
|
let n;
|
|
3375
|
-
return n = t instanceof e ? t.polynom : t instanceof
|
|
2334
|
+
return n = t instanceof e ? t.polynom : t instanceof N ? t : new N(t), this.polynom.isEqual(n);
|
|
3376
2335
|
}
|
|
3377
2336
|
isZero() {
|
|
3378
2337
|
return this.polynom.isZero();
|
|
@@ -3381,7 +2340,7 @@ var M = class e {
|
|
|
3381
2340
|
let n = new e(t);
|
|
3382
2341
|
if (this.polynom.monoms.length === 1 && this.power.isOne() && n.polynom.monoms.length === 1 && this.power.isOne()) return this.polynom.multiply(n.polynom), this;
|
|
3383
2342
|
if (t instanceof e && this.isSameAs(t)) return this.power.add(t.power), this;
|
|
3384
|
-
let i = new
|
|
2343
|
+
let i = new N(t);
|
|
3385
2344
|
if (this.isSameAs(i)) return this.power.add(1), this;
|
|
3386
2345
|
throw new r("The two factors must be the same");
|
|
3387
2346
|
}
|
|
@@ -3404,7 +2363,7 @@ var M = class e {
|
|
|
3404
2363
|
return this.#n;
|
|
3405
2364
|
}
|
|
3406
2365
|
set power(e) {
|
|
3407
|
-
this.#n = new
|
|
2366
|
+
this.#n = new _(e);
|
|
3408
2367
|
}
|
|
3409
2368
|
primitive() {
|
|
3410
2369
|
throw new a("Method not implemented.");
|
|
@@ -3423,7 +2382,7 @@ var M = class e {
|
|
|
3423
2382
|
}
|
|
3424
2383
|
tableOfSigns() {
|
|
3425
2384
|
let e = this.power.clone().reduce(), t = this.polynom.tableOfSigns();
|
|
3426
|
-
return e.isStrictlyNegative() && (t.signs =
|
|
2385
|
+
return e.isStrictlyNegative() && (t.signs = A(t.signs, "z", "d")), e.denominator % 2 == 0 ? t.signs = A(t.signs, "-", "h") : e.numerator % 2 == 0 && (t.signs = A(t.signs, "-", "+")), {
|
|
3427
2386
|
roots: t.roots,
|
|
3428
2387
|
signs: t.signs
|
|
3429
2388
|
};
|
|
@@ -3441,9 +2400,9 @@ var M = class e {
|
|
|
3441
2400
|
return this.#t.zero(), this.#n.one(), this;
|
|
3442
2401
|
}
|
|
3443
2402
|
static checkParseAsFactors(e) {
|
|
3444
|
-
let t =
|
|
2403
|
+
let t = j(e, "+");
|
|
3445
2404
|
if (t[0] === "" && t.shift(), t.length > 1) return !1;
|
|
3446
|
-
let n =
|
|
2405
|
+
let n = j(e, "-");
|
|
3447
2406
|
return n[0] === "" && n.shift(), !(n.length > 1);
|
|
3448
2407
|
}
|
|
3449
2408
|
static factorsFromString(t, n = !0) {
|
|
@@ -3451,19 +2410,22 @@ var M = class e {
|
|
|
3451
2410
|
let r = n ? 1 : -1, i = [];
|
|
3452
2411
|
for (let n of t.matchAll(/\(([^)]+)\)(?:\^(-?[0-9]+(?:\/[0-9]+)?|\(-?[0-9]+(?:\/[0-9]+)?\)))?|([^(]+)/g)) if (n[1] !== void 0) {
|
|
3453
2412
|
let t = (n[2] ?? "1").replace(/[()]/g, "");
|
|
3454
|
-
i.push(new e(new
|
|
3455
|
-
} else n[3]?.trim() && i.push(new e(new
|
|
2413
|
+
i.push(new e(new N(n[1]), new _(t).multiply(r)));
|
|
2414
|
+
} else n[3]?.trim() && i.push(new e(new N(n[3].trim()), new _(r)));
|
|
3456
2415
|
return i;
|
|
3457
2416
|
}
|
|
3458
|
-
},
|
|
2417
|
+
}, I = /* @__PURE__ */ function(e) {
|
|
3459
2418
|
return e[e.ROOT = 0] = "ROOT", e[e.POWER = 1] = "POWER", e;
|
|
3460
|
-
}({}),
|
|
2419
|
+
}({}), be = class e {
|
|
3461
2420
|
#e;
|
|
3462
2421
|
#t;
|
|
3463
2422
|
constructor(...e) {
|
|
3464
2423
|
return this.#e = [], this.#t = [], e.length > 0 && this.parse(...e), this;
|
|
3465
2424
|
}
|
|
3466
|
-
parse = (...e) => (this.#e = e.map((e) => new
|
|
2425
|
+
parse = (...e) => (this.#e = e.map((e) => new P(e)), this.#n(), this);
|
|
2426
|
+
copy() {
|
|
2427
|
+
throw new a("copy() is not yet implemented for LinearSystem");
|
|
2428
|
+
}
|
|
3467
2429
|
clone = () => new e().parse(...this.#e.map((e) => e.clone()));
|
|
3468
2430
|
get tex() {
|
|
3469
2431
|
let e = this.clone().reorder();
|
|
@@ -3476,7 +2438,7 @@ var M = class e {
|
|
|
3476
2438
|
let i = t[0].length;
|
|
3477
2439
|
if (t.some((e) => e.length !== i)) throw new n("All rows must have the same number of columns");
|
|
3478
2440
|
let a = r.split("").splice(0, i - 1);
|
|
3479
|
-
return new e(...t.map((e) => new
|
|
2441
|
+
return new e(...t.map((e) => new P(new N(a.join(""), ...e), 0)));
|
|
3480
2442
|
}
|
|
3481
2443
|
static solutionAsDisplay(e) {
|
|
3482
2444
|
return `(${e.map((e) => e.display).join(";")})`;
|
|
@@ -3491,7 +2453,7 @@ var M = class e {
|
|
|
3491
2453
|
for (let n = 0; n < e; n++) this.#e[n].add(t.equations[n]);
|
|
3492
2454
|
} else {
|
|
3493
2455
|
if (r === void 0 || r < 0 || r >= this.#e.length) throw new o("Index out of range");
|
|
3494
|
-
let e = new
|
|
2456
|
+
let e = new P(t);
|
|
3495
2457
|
this.#e[r].add(e);
|
|
3496
2458
|
}
|
|
3497
2459
|
return this;
|
|
@@ -3514,7 +2476,7 @@ var M = class e {
|
|
|
3514
2476
|
return t !== void 0 && t.length > 0 && (o = t[0].length), `\\left\\{\\begin{array}{${"r".repeat(i.length)}cl ${"|l".repeat(o)}}${a.join("\\\\ ")}\\end{array}\\right.`;
|
|
3515
2477
|
};
|
|
3516
2478
|
degree(e) {
|
|
3517
|
-
return
|
|
2479
|
+
return _.max(...this.#e.map((t) => t.degree(e)));
|
|
3518
2480
|
}
|
|
3519
2481
|
get equations() {
|
|
3520
2482
|
return this.#e;
|
|
@@ -3580,7 +2542,7 @@ var M = class e {
|
|
|
3580
2542
|
let t = [], n = this.equations.map((t) => t.left.monomByLetter(e).coefficient.value);
|
|
3581
2543
|
return n.forEach((e, r) => {
|
|
3582
2544
|
for (let i = r + 1; i < n.length; i++) {
|
|
3583
|
-
let a =
|
|
2545
|
+
let a = g.lcm(e, n[i]), o = e < 0 ? -1 : 1;
|
|
3584
2546
|
t.push([{
|
|
3585
2547
|
id: r,
|
|
3586
2548
|
factor: o * a / e
|
|
@@ -3598,7 +2560,7 @@ var M = class e {
|
|
|
3598
2560
|
for (let n = 0; n < e; n++) this.#e[n].subtract(t.equations[n]);
|
|
3599
2561
|
} else {
|
|
3600
2562
|
if (r === void 0 || r < 0 || r >= this.#e.length) throw new o("Index out of range");
|
|
3601
|
-
let e = new
|
|
2563
|
+
let e = new P(t);
|
|
3602
2564
|
this.#e[r].subtract(e);
|
|
3603
2565
|
}
|
|
3604
2566
|
return this;
|
|
@@ -3633,14 +2595,14 @@ var M = class e {
|
|
|
3633
2595
|
n.variable = e, t.push(n);
|
|
3634
2596
|
}), t);
|
|
3635
2597
|
}
|
|
3636
|
-
},
|
|
2598
|
+
}, xe = class {
|
|
3637
2599
|
#e;
|
|
3638
2600
|
constructor(e) {
|
|
3639
2601
|
return this.#e = [], e !== void 0 && this.parse(e), this;
|
|
3640
2602
|
}
|
|
3641
2603
|
parse = (e) => {
|
|
3642
2604
|
try {
|
|
3643
|
-
this.#e = new
|
|
2605
|
+
this.#e = new D(T.SET).parse(e).rpn;
|
|
3644
2606
|
} catch (n) {
|
|
3645
2607
|
throw new t(`Cannot parse "${e}" as a LogicalSet`, { cause: n });
|
|
3646
2608
|
}
|
|
@@ -3793,8 +2755,8 @@ var M = class e {
|
|
|
3793
2755
|
}
|
|
3794
2756
|
return [...n[0]].sort();
|
|
3795
2757
|
}
|
|
3796
|
-
},
|
|
3797
|
-
#e =
|
|
2758
|
+
}, L = class e {
|
|
2759
|
+
#e = I.POWER;
|
|
3798
2760
|
#t = [];
|
|
3799
2761
|
constructor(...e) {
|
|
3800
2762
|
return this.parse(...e), this;
|
|
@@ -3802,9 +2764,12 @@ var M = class e {
|
|
|
3802
2764
|
parse(...t) {
|
|
3803
2765
|
return this.#t = [], t.length === 0 || t.forEach((t) => {
|
|
3804
2766
|
if (typeof t == "string") return this.fromString(t);
|
|
3805
|
-
t instanceof e ? this.#t.push(...t.factors.map((e) => e.clone())) : this.#t.push(new
|
|
2767
|
+
t instanceof e ? this.#t.push(...t.factors.map((e) => e.clone())) : this.#t.push(new F(t));
|
|
3806
2768
|
}), this;
|
|
3807
2769
|
}
|
|
2770
|
+
copy() {
|
|
2771
|
+
throw new a("copy() is not yet implemented for PolyFactor");
|
|
2772
|
+
}
|
|
3808
2773
|
clone() {
|
|
3809
2774
|
return new e(...this.#t.map((e) => e.clone()));
|
|
3810
2775
|
}
|
|
@@ -3817,16 +2782,16 @@ var M = class e {
|
|
|
3817
2782
|
return t.length === 0 ? e.length === 1 ? e[0].asSingle.display : e.map((e, t) => t === 0 && e.polynom.monoms.length === 1 ? e.asSingle.display : e.display).join("") : `(${e.length === 1 ? e[0].asSingle.display : e.map((e) => e.display).join("")})/(${t.length === 1 ? t[0].asSingle.display : t.map((e) => e.display).join("")})`;
|
|
3818
2783
|
}
|
|
3819
2784
|
static #n(t, n) {
|
|
3820
|
-
let r =
|
|
3821
|
-
let t = r[e].reduce((e, t) => e.add(t.power), new
|
|
3822
|
-
return new
|
|
2785
|
+
let r = R(t), i = R(n), a = Object.keys(r).filter((e) => Object.hasOwn(i, e)).map((e) => {
|
|
2786
|
+
let t = r[e].reduce((e, t) => e.add(t.power), new _("0")), n = i[e].reduce((e, t) => e.add(t.power), new _("0"));
|
|
2787
|
+
return new F(e, _.min(t, n));
|
|
3823
2788
|
});
|
|
3824
2789
|
return new e(...a);
|
|
3825
2790
|
}
|
|
3826
2791
|
static #r(t, n) {
|
|
3827
|
-
let r =
|
|
3828
|
-
let t = Object.hasOwn(r, e) ? r[e].reduce((e, t) => e.add(t.power), new
|
|
3829
|
-
return new
|
|
2792
|
+
let r = R(t), i = R(n), a = [.../* @__PURE__ */ new Set([...Object.keys(r), ...Object.keys(i)])].map((e) => {
|
|
2793
|
+
let t = Object.hasOwn(r, e) ? r[e].reduce((e, t) => e.add(t.power), new _("0")) : new _(0), n = Object.hasOwn(i, e) ? i[e].reduce((e, t) => e.add(t.power), new _("0")) : new _(0);
|
|
2794
|
+
return new F(e, _.max(t, n));
|
|
3830
2795
|
});
|
|
3831
2796
|
return new e(...a);
|
|
3832
2797
|
}
|
|
@@ -3851,17 +2816,17 @@ var M = class e {
|
|
|
3851
2816
|
e.multiply(t.clone().divide(r[n]));
|
|
3852
2817
|
}), i = t;
|
|
3853
2818
|
}
|
|
3854
|
-
let a = e.gcd(...n), o = new
|
|
3855
|
-
return this.#t = [...a.factors, new
|
|
2819
|
+
let a = e.gcd(...n), o = new N(0).add(...n.map((e) => e.divide(a).reduce().develop().factors[0].polynom)).reduce();
|
|
2820
|
+
return this.#t = [...a.factors, new F(o)], i && this.divide(i), this.#t = this.#t.filter((e) => !e.power.isZero()), this;
|
|
3856
2821
|
}
|
|
3857
2822
|
get asPower() {
|
|
3858
|
-
return this.#e =
|
|
2823
|
+
return this.#e = I.POWER, this;
|
|
3859
2824
|
}
|
|
3860
2825
|
get asRoot() {
|
|
3861
|
-
return this.#e =
|
|
2826
|
+
return this.#e = I.ROOT, this;
|
|
3862
2827
|
}
|
|
3863
2828
|
degree(e) {
|
|
3864
|
-
return this.#t.reduce((t, n) => t.add(n.degree(e)), new
|
|
2829
|
+
return this.#t.reduce((t, n) => t.add(n.degree(e)), new _("0"));
|
|
3865
2830
|
}
|
|
3866
2831
|
get denominator() {
|
|
3867
2832
|
return new e(...this.#t.filter((e) => e.power.isNegative()).map((e) => e.clone().inverse()));
|
|
@@ -3877,7 +2842,7 @@ var M = class e {
|
|
|
3877
2842
|
return r !== void 0 && (this.#t = r.factors), this.add(...t);
|
|
3878
2843
|
}
|
|
3879
2844
|
develop() {
|
|
3880
|
-
let t = new
|
|
2845
|
+
let t = new N("1"), n = new N("1");
|
|
3881
2846
|
return this.numerator.factors.forEach((e) => {
|
|
3882
2847
|
t.multiply(e.develop());
|
|
3883
2848
|
}), this.denominator.factors.forEach((e) => {
|
|
@@ -3888,7 +2853,7 @@ var M = class e {
|
|
|
3888
2853
|
return this.#t = this.#t.concat(e.clone().factors.map((e) => e.inverse())), this;
|
|
3889
2854
|
}
|
|
3890
2855
|
evaluate(e, t) {
|
|
3891
|
-
return t ? this.#t.reduce((n, r) => n * r.evaluate(e, t), 1) : this.#t.reduce((t, n) => t.multiply(n.evaluate(e)), new
|
|
2856
|
+
return t ? this.#t.reduce((n, r) => n * r.evaluate(e, t), 1) : this.#t.reduce((t, n) => t.multiply(n.evaluate(e)), new _("1"));
|
|
3892
2857
|
}
|
|
3893
2858
|
factorize(t) {
|
|
3894
2859
|
let n = [];
|
|
@@ -3896,7 +2861,7 @@ var M = class e {
|
|
|
3896
2861
|
let r = e.polynom.factorize(t);
|
|
3897
2862
|
if (r.length > 1) {
|
|
3898
2863
|
let t = e.power.clone();
|
|
3899
|
-
n.push(...r.map((e) => new
|
|
2864
|
+
n.push(...r.map((e) => new F(e, t)));
|
|
3900
2865
|
} else n.push(e.clone());
|
|
3901
2866
|
});
|
|
3902
2867
|
let r = new e(...n), i = r.numerator.reduce(), a = r.denominator.reduce();
|
|
@@ -3909,20 +2874,20 @@ var M = class e {
|
|
|
3909
2874
|
this.#t = e;
|
|
3910
2875
|
}
|
|
3911
2876
|
fromPolynom(e, t) {
|
|
3912
|
-
if (this.#t = [new
|
|
3913
|
-
let e = new
|
|
2877
|
+
if (this.#t = [new F(new N(e))], t) {
|
|
2878
|
+
let e = new N(t);
|
|
3914
2879
|
if (e.isOne()) return this;
|
|
3915
2880
|
if (e.isZero()) throw new r("Cannot divide by zero");
|
|
3916
|
-
this.#t.push(new
|
|
2881
|
+
this.#t.push(new F(e, -1));
|
|
3917
2882
|
}
|
|
3918
2883
|
return this;
|
|
3919
2884
|
}
|
|
3920
2885
|
fromString(e) {
|
|
3921
2886
|
this.#t = [];
|
|
3922
|
-
let [n, ...r] =
|
|
2887
|
+
let [n, ...r] = j(e, "/");
|
|
3923
2888
|
if (n === "") throw new t("Parsing a PolyFactor from a string requires a numerator");
|
|
3924
2889
|
if (r.length > 1) throw new t("Parsing a PolyFactor from a string only allows max one signe \"/\"");
|
|
3925
|
-
return this.#t = r.length === 0 ?
|
|
2890
|
+
return this.#t = r.length === 0 ? F.factorsFromString(k(n), !0) : [...F.factorsFromString(k(n), !0), ...F.factorsFromString(k(r[0]), !1)], this;
|
|
3926
2891
|
}
|
|
3927
2892
|
getRoots() {
|
|
3928
2893
|
return [];
|
|
@@ -3957,11 +2922,11 @@ var M = class e {
|
|
|
3957
2922
|
return new e(...this.#t.filter((e) => e.power.isPositive()));
|
|
3958
2923
|
}
|
|
3959
2924
|
one() {
|
|
3960
|
-
return this.#t = [new
|
|
2925
|
+
return this.#t = [new F("1", "1")], this;
|
|
3961
2926
|
}
|
|
3962
2927
|
opposite() {
|
|
3963
2928
|
let e = this.#t.findIndex((e) => e.display === "(-1)");
|
|
3964
|
-
return e >= 0 ? this.#t.splice(e, 1) : this.#t.push(new
|
|
2929
|
+
return e >= 0 ? this.#t.splice(e, 1) : this.#t.push(new F("-1", "1")), this;
|
|
3965
2930
|
}
|
|
3966
2931
|
pow(e) {
|
|
3967
2932
|
return this.#t = this.#t.map((t) => t.pow(e)), this;
|
|
@@ -3970,14 +2935,14 @@ var M = class e {
|
|
|
3970
2935
|
throw new a("Method not implemented.");
|
|
3971
2936
|
}
|
|
3972
2937
|
reduce() {
|
|
3973
|
-
let e =
|
|
2938
|
+
let e = R(this);
|
|
3974
2939
|
this.#t = Object.values(e).map((e) => {
|
|
3975
2940
|
let t = e[0].polynom;
|
|
3976
|
-
return new
|
|
2941
|
+
return new F(t, e.reduce((e, t) => e.add(t.power), new _("0")).reduce());
|
|
3977
2942
|
}).filter((e) => !e.power.isZero());
|
|
3978
|
-
let t = new
|
|
2943
|
+
let t = new F(1), n = new F(1), r = this.#t.filter((e) => e.polynom.monoms.length === 1 && e.power.isRelative());
|
|
3979
2944
|
return r.length > 0 && (r.forEach((e) => {
|
|
3980
|
-
e.power.isPositive() ? t.multiply(new
|
|
2945
|
+
e.power.isPositive() ? t.multiply(new F(e.polynom.clone().pow(e.power.value))) : n.multiply(new F(e.polynom.clone().pow(-e.power.value)));
|
|
3981
2946
|
}), this.#t = this.#t.filter((e) => !(e.polynom.monoms.length === 1 && e.power.isRelative())), n.polynom.isOne() || this.#t.push(n.inverse()), t.polynom.isOne() || this.#t.push(t)), this;
|
|
3982
2947
|
}
|
|
3983
2948
|
root(e) {
|
|
@@ -4001,7 +2966,7 @@ var M = class e {
|
|
|
4001
2966
|
}
|
|
4002
2967
|
tableOfSigns() {
|
|
4003
2968
|
let e = this.getZeroes(), t = e.map((e) => e.value), n = this.factorize().factors.map((e) => ({
|
|
4004
|
-
factor: new
|
|
2969
|
+
factor: new F(e),
|
|
4005
2970
|
...e.tableOfSigns()
|
|
4006
2971
|
}));
|
|
4007
2972
|
return n.forEach((n) => {
|
|
@@ -4035,18 +3000,18 @@ var M = class e {
|
|
|
4035
3000
|
return this.#t.reduce((e, t) => e.concat(t.variables), []);
|
|
4036
3001
|
}
|
|
4037
3002
|
zero() {
|
|
4038
|
-
return this.#t = [new
|
|
3003
|
+
return this.#t = [new F("0", "1")], this;
|
|
4039
3004
|
}
|
|
4040
3005
|
#i() {
|
|
4041
3006
|
let e, t = [];
|
|
4042
|
-
return this.#e ===
|
|
3007
|
+
return this.#e === I.ROOT ? (e = this.numerator.factors, t = this.denominator.factors) : e = this.#t, e.length === 0 && (e = [new F("1")]), {
|
|
4043
3008
|
num: e,
|
|
4044
3009
|
den: t
|
|
4045
3010
|
};
|
|
4046
3011
|
}
|
|
4047
3012
|
};
|
|
4048
|
-
function
|
|
4049
|
-
let t = new
|
|
3013
|
+
function R(e) {
|
|
3014
|
+
let t = new _().one(), n = new _().one(), r = e.factors.reduce((e, r) => {
|
|
4050
3015
|
if (r.polynom.degree().isZero() && r.power.isRelative()) {
|
|
4051
3016
|
let i = r.polynom.monoms[0].coefficient.pow(r.power.clone().abs());
|
|
4052
3017
|
return r.power.isPositive() ? t.multiply(i) : n.multiply(i), e;
|
|
@@ -4054,11 +3019,11 @@ function z(e) {
|
|
|
4054
3019
|
let i = r.polynom.display;
|
|
4055
3020
|
return Object.hasOwn(e, i) ? e[i].push(r) : e[i] = [r], e;
|
|
4056
3021
|
}, {}), { numerator: i, denominator: a } = t.divide(n).reduce();
|
|
4057
|
-
return i !== 1 && (r[i.toString()] = [new
|
|
3022
|
+
return i !== 1 && (r[i.toString()] = [new F(i, 1)]), a !== 1 && (r[a.toString()] = [new F(a, -1)]), r;
|
|
4058
3023
|
}
|
|
4059
3024
|
//#endregion
|
|
4060
3025
|
//#region src/algebra/matrix.ts
|
|
4061
|
-
var
|
|
3026
|
+
var Se = class e {
|
|
4062
3027
|
#e = null;
|
|
4063
3028
|
#t = 0;
|
|
4064
3029
|
#n = [];
|
|
@@ -4068,6 +3033,9 @@ var ve = class e {
|
|
|
4068
3033
|
parse(e) {
|
|
4069
3034
|
return this.fromValues(e);
|
|
4070
3035
|
}
|
|
3036
|
+
copy() {
|
|
3037
|
+
throw new a("copy() is not yet implemented for Matrix");
|
|
3038
|
+
}
|
|
4071
3039
|
clone() {
|
|
4072
3040
|
let t = [];
|
|
4073
3041
|
return this.#n.forEach((e) => {
|
|
@@ -4106,10 +3074,10 @@ var ve = class e {
|
|
|
4106
3074
|
aij(e, t) {
|
|
4107
3075
|
return e < 0 || e > this.dimension.rows || t < 0 || t > this.dimension.cols ? null : this.#n[e][t];
|
|
4108
3076
|
}
|
|
4109
|
-
get
|
|
3077
|
+
get asBmatrix() {
|
|
4110
3078
|
return this.#t = 1, this;
|
|
4111
3079
|
}
|
|
4112
|
-
get
|
|
3080
|
+
get asBraceMatrix() {
|
|
4113
3081
|
return this.#t = 2, this;
|
|
4114
3082
|
}
|
|
4115
3083
|
canBeAdded(e) {
|
|
@@ -4123,7 +3091,7 @@ var ve = class e {
|
|
|
4123
3091
|
return this.dimension.cols === e.dimension.rows;
|
|
4124
3092
|
}
|
|
4125
3093
|
characteristic_polynom(t) {
|
|
4126
|
-
return t ??= "k", this.clone().subtract(new e(this.dimension.rows).one().multiply(new
|
|
3094
|
+
return t ??= "k", this.clone().subtract(new e(this.dimension.rows).one().multiply(new N(t))).determinant();
|
|
4127
3095
|
}
|
|
4128
3096
|
cofactor(e, t) {
|
|
4129
3097
|
let n = this.clone();
|
|
@@ -4132,14 +3100,14 @@ var ve = class e {
|
|
|
4132
3100
|
}), n.determinant().multiply((-1) ** (e + t));
|
|
4133
3101
|
}
|
|
4134
3102
|
get cols() {
|
|
4135
|
-
let e = Array.from({ length: this.dimension.cols }, () => Array.from({ length: this.dimension.rows }, () => new
|
|
3103
|
+
let e = Array.from({ length: this.dimension.cols }, () => Array.from({ length: this.dimension.rows }, () => new N()));
|
|
4136
3104
|
return this.forEach((t, n, r) => {
|
|
4137
3105
|
e[r][n] = t;
|
|
4138
3106
|
}), e;
|
|
4139
3107
|
}
|
|
4140
3108
|
determinant() {
|
|
4141
3109
|
if (!this.isSquare()) throw new n("Matrix is not square");
|
|
4142
|
-
let e = new
|
|
3110
|
+
let e = new N();
|
|
4143
3111
|
return this.#n.length === 1 ? this.#n[0][0].clone() : (this.values[0].forEach((t, n) => {
|
|
4144
3112
|
let r = this.cofactor(0, n);
|
|
4145
3113
|
e.add(t.clone().multiply(r));
|
|
@@ -4162,12 +3130,12 @@ var ve = class e {
|
|
|
4162
3130
|
});
|
|
4163
3131
|
}
|
|
4164
3132
|
fromDimensions(e, t) {
|
|
4165
|
-
return this.#n = Array.from({ length: e }, () => Array.from({ length: t }, () => new
|
|
3133
|
+
return this.#n = Array.from({ length: e }, () => Array.from({ length: t }, () => new N())), this;
|
|
4166
3134
|
}
|
|
4167
3135
|
fromString(e) {
|
|
4168
3136
|
if (e.startsWith("((") && e.endsWith("))")) return this.fromString(e.substring(1, e.length - 1));
|
|
4169
3137
|
let t = e.split("),(");
|
|
4170
|
-
return this.#n = t.map((e, n) => n === 0 ? e.substring(1).split(",") : n === t.length - 1 ? e.substring(0, e.length - 1).split(",") : e.split(",")).map((e) => e.map((e) => new
|
|
3138
|
+
return this.#n = t.map((e, n) => n === 0 ? e.substring(1).split(",") : n === t.length - 1 ? e.substring(0, e.length - 1).split(",") : e.split(",")).map((e) => e.map((e) => new N(e))), this;
|
|
4171
3139
|
}
|
|
4172
3140
|
fromValues(e) {
|
|
4173
3141
|
this.#n = [];
|
|
@@ -4176,7 +3144,7 @@ var ve = class e {
|
|
|
4176
3144
|
return e.forEach((e) => {
|
|
4177
3145
|
let t = [];
|
|
4178
3146
|
e.forEach((e) => {
|
|
4179
|
-
t.push(new
|
|
3147
|
+
t.push(new N(e));
|
|
4180
3148
|
}), this.#n.push(t);
|
|
4181
3149
|
}), this;
|
|
4182
3150
|
}
|
|
@@ -4186,7 +3154,7 @@ var ve = class e {
|
|
|
4186
3154
|
if (e.some((e) => e.dimension !== t)) throw new n("Each vectors must be the same dimension");
|
|
4187
3155
|
return this.fromDimensions(e[0].dimension, e.length), e.forEach((e, t) => {
|
|
4188
3156
|
e.array.forEach((e, n) => {
|
|
4189
|
-
this.#n[n][t] = new
|
|
3157
|
+
this.#n[n][t] = new N(e);
|
|
4190
3158
|
});
|
|
4191
3159
|
}), this;
|
|
4192
3160
|
}
|
|
@@ -4229,7 +3197,7 @@ var ve = class e {
|
|
|
4229
3197
|
if (!this.canBeMultiplied(t)) throw new n("Cannot multiply a matrix with incompatibles dimensions");
|
|
4230
3198
|
let r = new e(this.dimension.rows, t.dimension.cols);
|
|
4231
3199
|
return r.forEach((e, n, i) => {
|
|
4232
|
-
let a = this.rows[n], o = t.cols[i], s = new
|
|
3200
|
+
let a = this.rows[n], o = t.cols[i], s = new N();
|
|
4233
3201
|
a.forEach((e, t) => {
|
|
4234
3202
|
s.add(e.clone().multiply(o[t]));
|
|
4235
3203
|
}), r.setValue(n, i, s);
|
|
@@ -4249,17 +3217,17 @@ var ve = class e {
|
|
|
4249
3217
|
e.opposite();
|
|
4250
3218
|
}), this;
|
|
4251
3219
|
}
|
|
4252
|
-
get
|
|
3220
|
+
get asPmatrix() {
|
|
4253
3221
|
return this.#t = 0, this;
|
|
4254
3222
|
}
|
|
4255
|
-
get
|
|
3223
|
+
get asVmatrix() {
|
|
4256
3224
|
return this.#t = 3, this;
|
|
4257
3225
|
}
|
|
4258
|
-
get
|
|
3226
|
+
get asDoubleVmatrix() {
|
|
4259
3227
|
return this.#t = 4, this;
|
|
4260
3228
|
}
|
|
4261
3229
|
pow(e) {
|
|
4262
|
-
return
|
|
3230
|
+
return M(this, e);
|
|
4263
3231
|
}
|
|
4264
3232
|
reduce() {
|
|
4265
3233
|
throw new a("Not yet implemented");
|
|
@@ -4270,7 +3238,7 @@ var ve = class e {
|
|
|
4270
3238
|
setValue(e, t, n) {
|
|
4271
3239
|
let { rows: r, cols: i } = this.dimension;
|
|
4272
3240
|
if (e < 0 || e >= r || t < 0 || t >= i) throw new o(`${e}x${t} is out of range (${r}x${i})`);
|
|
4273
|
-
return this.#n[e][t] = new
|
|
3241
|
+
return this.#n[e][t] = new N(n), this;
|
|
4274
3242
|
}
|
|
4275
3243
|
subtract(e) {
|
|
4276
3244
|
if (!this.canBeAdded(e)) throw new n("Cannot subtract a matrix with different dimensions.");
|
|
@@ -4295,31 +3263,31 @@ var ve = class e {
|
|
|
4295
3263
|
};
|
|
4296
3264
|
//#endregion
|
|
4297
3265
|
//#region src/geometry/geomMath.ts
|
|
4298
|
-
function
|
|
3266
|
+
function Ce(e, t) {
|
|
4299
3267
|
return e.dimension === t.dimension && e.array.every((e, n) => t.array[n].isEqual(e));
|
|
4300
3268
|
}
|
|
4301
|
-
function
|
|
3269
|
+
function we(e, t) {
|
|
4302
3270
|
if (e.dimension !== t.dimension) return !1;
|
|
4303
3271
|
let n = t.array[0].value / e.array[0].value;
|
|
4304
3272
|
return e.array.every((e, r) => t.array[r].value === e.value * n);
|
|
4305
3273
|
}
|
|
4306
|
-
function
|
|
4307
|
-
return e.dimension === t.dimension ? e.array.reduce((e, n, r) => e.add(n.clone().multiply(t.array[r])), new
|
|
3274
|
+
function Te(e, t) {
|
|
3275
|
+
return e.dimension === t.dimension ? e.array.reduce((e, n, r) => e.add(n.clone().multiply(t.array[r])), new _(0)) : new _().invalid();
|
|
4308
3276
|
}
|
|
4309
|
-
function
|
|
3277
|
+
function Ee(...e) {
|
|
4310
3278
|
if (e.some((t) => t.dimension !== e[0].dimension)) throw new n("All vectors must have the same dimension");
|
|
4311
3279
|
if (e[0].dimension !== e.length) throw new n(`The determinant of dimension ${e[0].dimension} must have the same number of vectors (${e.length} given)`);
|
|
4312
3280
|
return e[0].dimension === 2 ? e[0].array[0].clone().multiply(e[1].array[1]).subtract(e[0].array[1].clone().multiply(e[1].array[0])) : e[0].array[0].clone().multiply(e[1].array[1].clone().multiply(e[2].array[2]).subtract(e[1].array[2].clone().multiply(e[2].array[1]))).subtract(e[0].array[1].clone().multiply(e[1].array[0].clone().multiply(e[2].array[2]).subtract(e[1].array[2].clone().multiply(e[2].array[0])))).add(e[0].array[2].clone().multiply(e[1].array[0].clone().multiply(e[2].array[1]).subtract(e[1].array[1].clone().multiply(e[2].array[0]))));
|
|
4313
3281
|
}
|
|
4314
3282
|
//#endregion
|
|
4315
3283
|
//#region src/geometry/TupleN.ts
|
|
4316
|
-
var
|
|
3284
|
+
var z = class {
|
|
4317
3285
|
#e = [];
|
|
4318
3286
|
#t;
|
|
4319
3287
|
constructor(...e) {
|
|
4320
|
-
this.#e = e.map((e) => new
|
|
3288
|
+
this.#e = e.map((e) => new _(e));
|
|
4321
3289
|
}
|
|
4322
|
-
|
|
3290
|
+
cloneCoordinates() {
|
|
4323
3291
|
return this.#e.map((e) => e.clone());
|
|
4324
3292
|
}
|
|
4325
3293
|
get array() {
|
|
@@ -4334,7 +3302,7 @@ var B = class {
|
|
|
4334
3302
|
fromString(e) {
|
|
4335
3303
|
e.startsWith("(") && (e = e.substring(1)), e.endsWith(")") && (e = e.substring(0, e.length - 1));
|
|
4336
3304
|
let t = e.split(/[,;\s]/g).filter((e) => e.trim() !== "");
|
|
4337
|
-
return t.length < 2 || (this.#e = t.map((e) => new
|
|
3305
|
+
return t.length < 2 || (this.#e = t.map((e) => new _(e))), this;
|
|
4338
3306
|
}
|
|
4339
3307
|
get onChange() {
|
|
4340
3308
|
return this.#t;
|
|
@@ -4345,20 +3313,20 @@ var B = class {
|
|
|
4345
3313
|
setDimension(e = 2) {
|
|
4346
3314
|
if (e < 2) throw new n("Dimension must be at least 2");
|
|
4347
3315
|
if (e < this.dimension) this.#e = this.#e.slice(0, e);
|
|
4348
|
-
else if (e > this.dimension) for (let t = this.dimension; t < e; t++) this.#e.push(new
|
|
3316
|
+
else if (e > this.dimension) for (let t = this.dimension; t < e; t++) this.#e.push(new _(0));
|
|
4349
3317
|
return this;
|
|
4350
3318
|
}
|
|
4351
3319
|
get x() {
|
|
4352
3320
|
return this.#e[0];
|
|
4353
3321
|
}
|
|
4354
3322
|
set x(e) {
|
|
4355
|
-
this.#e[0] = new
|
|
3323
|
+
this.#e[0] = new _(e), this.#t?.();
|
|
4356
3324
|
}
|
|
4357
3325
|
get y() {
|
|
4358
3326
|
return this.#e[1];
|
|
4359
3327
|
}
|
|
4360
3328
|
set y(e) {
|
|
4361
|
-
this.#e[1] = new
|
|
3329
|
+
this.#e[1] = new _(e), this.#t?.();
|
|
4362
3330
|
}
|
|
4363
3331
|
get z() {
|
|
4364
3332
|
if (this.dimension < 3) throw new n("Vector is not 3D");
|
|
@@ -4366,28 +3334,28 @@ var B = class {
|
|
|
4366
3334
|
}
|
|
4367
3335
|
set z(e) {
|
|
4368
3336
|
if (this.dimension < 3) throw new n("Vector is not 3D");
|
|
4369
|
-
this.#e[2] = new
|
|
3337
|
+
this.#e[2] = new _(e), this.#t?.();
|
|
4370
3338
|
}
|
|
4371
3339
|
zero = () => (this.#e.forEach((e) => e.zero()), this.#t?.(), this);
|
|
4372
|
-
},
|
|
3340
|
+
}, B = class e extends z {
|
|
4373
3341
|
constructor(...e) {
|
|
4374
3342
|
super(), e.length > 0 && this.parse(...e);
|
|
4375
3343
|
}
|
|
4376
3344
|
parse(...n) {
|
|
4377
3345
|
if (n.length === 1) {
|
|
4378
|
-
if (n[0] instanceof
|
|
3346
|
+
if (n[0] instanceof z) return this.array = n[0].cloneCoordinates(), this;
|
|
4379
3347
|
if (typeof n[0] == "string") return this.fromString(n[0]), this;
|
|
4380
3348
|
}
|
|
4381
3349
|
if (n.length > 1) {
|
|
4382
3350
|
if (n.some((t) => t instanceof e)) throw new i("Creating a point with multiple argument requires an input fraction");
|
|
4383
|
-
let r = n.map((e) => new
|
|
3351
|
+
let r = n.map((e) => new _(e));
|
|
4384
3352
|
if (r.some((e) => e.isNaN())) throw new t("The given values are not a valid point string (a,b): ");
|
|
4385
3353
|
this.array = r;
|
|
4386
3354
|
}
|
|
4387
3355
|
return this;
|
|
4388
3356
|
}
|
|
4389
3357
|
clone() {
|
|
4390
|
-
return new e(...this.
|
|
3358
|
+
return new e(...this.cloneCoordinates());
|
|
4391
3359
|
}
|
|
4392
3360
|
get tex() {
|
|
4393
3361
|
return `\\left(${this.array.map((e) => e.tex).join(";")}\\right)`;
|
|
@@ -4397,7 +3365,7 @@ var B = class {
|
|
|
4397
3365
|
}
|
|
4398
3366
|
distanceTo(e) {
|
|
4399
3367
|
if (this.dimension !== e.dimension) throw new n("The two points must have the same dimensions.");
|
|
4400
|
-
let t = this.array.map((t, n) => e.array[n].clone().subtract(t)).reduce((e, t) => e.add(t.clone().pow(2)), new
|
|
3368
|
+
let t = this.array.map((t, n) => e.array[n].clone().subtract(t)).reduce((e, t) => e.add(t.clone().pow(2)), new _(0));
|
|
4401
3369
|
return new v().from(2, t).reduce();
|
|
4402
3370
|
}
|
|
4403
3371
|
isEqual(e) {
|
|
@@ -4412,28 +3380,31 @@ var B = class {
|
|
|
4412
3380
|
this.array.push(e.clone().add(t.array[n]).divide(2));
|
|
4413
3381
|
}), this;
|
|
4414
3382
|
}
|
|
4415
|
-
},
|
|
3383
|
+
}, V = class e extends z {
|
|
4416
3384
|
constructor(...e) {
|
|
4417
3385
|
return super(), e.length > 0 && this.parse(...e), this;
|
|
4418
3386
|
}
|
|
4419
3387
|
parse(...e) {
|
|
4420
3388
|
if (e.length === 0) throw new i("Invalid value");
|
|
4421
3389
|
if (e.length === 1) {
|
|
4422
|
-
if (e[0] instanceof
|
|
3390
|
+
if (e[0] instanceof z) return this.array = e[0].cloneCoordinates(), this;
|
|
4423
3391
|
if (typeof e[0] == "string") return this.fromString(e[0]);
|
|
4424
3392
|
throw new i("Invalid value");
|
|
4425
3393
|
}
|
|
4426
3394
|
if (e.length === 2) {
|
|
4427
3395
|
let [t, r] = e;
|
|
4428
|
-
if (t instanceof
|
|
3396
|
+
if (t instanceof z && r instanceof z) {
|
|
4429
3397
|
if (t.dimension !== r.dimension) throw new n("Vectors must have the same dimension");
|
|
4430
3398
|
return this.array = r.array.map((e, n) => e.clone().subtract(t.array[n])), this;
|
|
4431
3399
|
}
|
|
4432
3400
|
}
|
|
4433
|
-
return this.array = e.map((e) => new
|
|
3401
|
+
return this.array = e.map((e) => new _(e)), this;
|
|
4434
3402
|
}
|
|
4435
3403
|
clone() {
|
|
4436
|
-
return new e(...this.
|
|
3404
|
+
return new e(...this.cloneCoordinates());
|
|
3405
|
+
}
|
|
3406
|
+
copy() {
|
|
3407
|
+
throw new a("copy() is not yet implemented for Vector");
|
|
4437
3408
|
}
|
|
4438
3409
|
get tex() {
|
|
4439
3410
|
return `\\begin{pmatrix} ${this.array.map((e) => e.tex).join(" \\\\ ")} \\end{pmatrix}`;
|
|
@@ -4456,13 +3427,13 @@ var B = class {
|
|
|
4456
3427
|
if (this.dimension !== 3 || t.dimension !== 3) throw new n("Cross product can only be determined in 3D");
|
|
4457
3428
|
return new e(this.y.clone().multiply(t.z).subtract(this.z.clone().multiply(t.y)), this.z.clone().multiply(t.x).subtract(this.x.clone().multiply(t.z)), this.x.clone().multiply(t.y).subtract(this.y.clone().multiply(t.x)));
|
|
4458
3429
|
}
|
|
4459
|
-
divideByScalar = (e) => this.multiplyByScalar(new
|
|
4460
|
-
dot = (e) =>
|
|
3430
|
+
divideByScalar = (e) => this.multiplyByScalar(new _(e).inverse());
|
|
3431
|
+
dot = (e) => Te(this, e);
|
|
4461
3432
|
fromString(e) {
|
|
4462
3433
|
return e.startsWith("((") && e.endsWith("))") ? super.fromString(e.slice(1, -1)) : super.fromString(e);
|
|
4463
3434
|
}
|
|
4464
|
-
isColinearTo = (e) =>
|
|
4465
|
-
isEqual = (e) =>
|
|
3435
|
+
isColinearTo = (e) => we(this, e);
|
|
3436
|
+
isEqual = (e) => Ce(this, e);
|
|
4466
3437
|
isNormalTo = (e) => this.dot(e).isZero();
|
|
4467
3438
|
get isNull() {
|
|
4468
3439
|
return this.array.every((e) => e.isZero());
|
|
@@ -4474,14 +3445,14 @@ var B = class {
|
|
|
4474
3445
|
return this.array.every((e) => e.isZero());
|
|
4475
3446
|
}
|
|
4476
3447
|
multiplyByScalar = (e) => {
|
|
4477
|
-
let t = new
|
|
3448
|
+
let t = new _(e);
|
|
4478
3449
|
return this.array.forEach((e) => e.multiply(t)), this;
|
|
4479
3450
|
};
|
|
4480
3451
|
get norm() {
|
|
4481
3452
|
return Math.sqrt(this.normSquare.value);
|
|
4482
3453
|
}
|
|
4483
3454
|
get normSquare() {
|
|
4484
|
-
return this.array.reduce((e, t) => e.add(t.clone().pow(2)), new
|
|
3455
|
+
return this.array.reduce((e, t) => e.add(t.clone().pow(2)), new _(0));
|
|
4485
3456
|
}
|
|
4486
3457
|
normal = () => {
|
|
4487
3458
|
if (this.dimension >= 3) throw new n("Normal vector can only be determined in 2D");
|
|
@@ -4491,8 +3462,8 @@ var B = class {
|
|
|
4491
3462
|
one = () => (this.zero(), this.x.one(), this);
|
|
4492
3463
|
opposite = () => (this.array.forEach((e) => e.opposite()), this);
|
|
4493
3464
|
simplify = () => {
|
|
4494
|
-
let e =
|
|
4495
|
-
return this.multiplyByScalar(new
|
|
3465
|
+
let e = g.lcm(...this.array.map((e) => e.denominator)), t = g.gcd(...this.array.map((e) => e.numerator));
|
|
3466
|
+
return this.multiplyByScalar(new _(e, t)), this.x.isNegative() && this.opposite(), this;
|
|
4496
3467
|
};
|
|
4497
3468
|
subtract = (e) => this.add(e.clone().opposite());
|
|
4498
3469
|
translate(...e) {
|
|
@@ -4502,43 +3473,43 @@ var B = class {
|
|
|
4502
3473
|
let e = this.norm;
|
|
4503
3474
|
return e === 0 ? this : this.divideByScalar(e);
|
|
4504
3475
|
};
|
|
4505
|
-
},
|
|
3476
|
+
}, H = /* @__PURE__ */ function(e) {
|
|
4506
3477
|
return e.None = "none", e.Parallel = "parallel", e.Perpendicular = "perpendicular", e.Tangent = "tangent", e;
|
|
4507
|
-
}({}),
|
|
3478
|
+
}({}), De = /* @__PURE__ */ function(e) {
|
|
4508
3479
|
return e.None = "none", e.Parallel = "parallel", e.Perpendicular = "perpendicular", e.Tangent = "tangent", e;
|
|
4509
3480
|
}({});
|
|
4510
3481
|
//#endregion
|
|
4511
3482
|
//#region src/randomization/rndHelpers.ts
|
|
4512
|
-
function
|
|
3483
|
+
function Oe(e = .5) {
|
|
4513
3484
|
return Math.random() < e;
|
|
4514
3485
|
}
|
|
4515
|
-
function
|
|
4516
|
-
if (t === void 0) return e >= 0 ?
|
|
3486
|
+
function U(e, t, n) {
|
|
3487
|
+
if (t === void 0) return e >= 0 ? U(0, e) : U(e, 0);
|
|
4517
3488
|
if (e === t) return e;
|
|
4518
3489
|
if (n === void 0) return Math.floor(Math.random() * (t - e + 1) + e);
|
|
4519
3490
|
if (Math.abs(t - e) <= n.length) throw new i("The number of excluded values is too high.");
|
|
4520
|
-
let r =
|
|
4521
|
-
for (; n.includes(r);) r =
|
|
3491
|
+
let r = U(e, t);
|
|
3492
|
+
for (; n.includes(r);) r = U(e, t);
|
|
4522
3493
|
return r;
|
|
4523
3494
|
}
|
|
4524
|
-
function
|
|
4525
|
-
return t === !1 ?
|
|
3495
|
+
function W(e, t) {
|
|
3496
|
+
return t === !1 ? Oe() ? U(1, e) : -U(1, e) : U(-e, e);
|
|
4526
3497
|
}
|
|
4527
|
-
function
|
|
4528
|
-
let n =
|
|
4529
|
-
return n.length === 0 ? null :
|
|
3498
|
+
function ke(e, t) {
|
|
3499
|
+
let n = g.pythagoreanTripletsWithTarget(e).filter((e) => t === !0 || !e.includes(0));
|
|
3500
|
+
return n.length === 0 ? null : G(n);
|
|
4530
3501
|
}
|
|
4531
|
-
function
|
|
4532
|
-
let t =
|
|
4533
|
-
return e !== void 0 && (t = t.filter((t) => t < e)),
|
|
3502
|
+
function Ae(e) {
|
|
3503
|
+
let t = g.primes();
|
|
3504
|
+
return e !== void 0 && (t = t.filter((t) => t < e)), G(t);
|
|
4534
3505
|
}
|
|
4535
|
-
function
|
|
4536
|
-
return t === void 0 && (t = 1), e.length <= 0 ? Object.values(e) :
|
|
3506
|
+
function je(e, t) {
|
|
3507
|
+
return t === void 0 && (t = 1), e.length <= 0 ? Object.values(e) : Me(e).slice(0, t);
|
|
4537
3508
|
}
|
|
4538
|
-
function
|
|
4539
|
-
return e.length === 0 ? null : e[
|
|
3509
|
+
function G(e) {
|
|
3510
|
+
return e.length === 0 ? null : e[U(0, e.length - 1)];
|
|
4540
3511
|
}
|
|
4541
|
-
function
|
|
3512
|
+
function Me(e) {
|
|
4542
3513
|
let t = Object.values(e);
|
|
4543
3514
|
for (let e = t.length - 1; e > 0; e--) {
|
|
4544
3515
|
let n = Math.floor(Math.random() * (e + 1)), r = t[e];
|
|
@@ -4548,9 +3519,9 @@ function Oe(e) {
|
|
|
4548
3519
|
}
|
|
4549
3520
|
//#endregion
|
|
4550
3521
|
//#region src/geometry/line.ts
|
|
4551
|
-
var
|
|
4552
|
-
static PARALLEL =
|
|
4553
|
-
static PERPENDICULAR =
|
|
3522
|
+
var K = class e {
|
|
3523
|
+
static PARALLEL = H.Parallel;
|
|
3524
|
+
static PERPENDICULAR = H.Perpendicular;
|
|
4554
3525
|
#e;
|
|
4555
3526
|
#t;
|
|
4556
3527
|
#n;
|
|
@@ -4558,36 +3529,39 @@ var q = class e {
|
|
|
4558
3529
|
#i;
|
|
4559
3530
|
#a = 1;
|
|
4560
3531
|
constructor(...e) {
|
|
4561
|
-
return this.#t = new
|
|
3532
|
+
return this.#t = new _().zero(), this.#n = new _().zero(), this.#r = new _().zero(), this.#e = new V(), this.#i = "lr", e.length > 0 && this.parse(...e), this;
|
|
4562
3533
|
}
|
|
4563
3534
|
parse = (...n) => {
|
|
4564
3535
|
if (n.length === 0) return this;
|
|
4565
3536
|
if (n.length === 1) {
|
|
4566
3537
|
if (n[0] instanceof e) return this.fromCoefficient(n[0].a, n[0].b, n[0].c);
|
|
4567
|
-
if (n[0] instanceof
|
|
3538
|
+
if (n[0] instanceof P) return this.fromEquation(n[0]);
|
|
4568
3539
|
if (typeof n[0] == "string") try {
|
|
4569
|
-
let e = new
|
|
3540
|
+
let e = new P(n[0]);
|
|
4570
3541
|
return this.parse(e);
|
|
4571
3542
|
} catch (e) {
|
|
4572
3543
|
throw new t(`Cannot parse "${n[0]}" as a Line`, { cause: e });
|
|
4573
3544
|
}
|
|
4574
3545
|
}
|
|
4575
3546
|
if (n.length === 2) {
|
|
4576
|
-
if (n[0] instanceof
|
|
4577
|
-
if (n[0] instanceof
|
|
3547
|
+
if (n[0] instanceof B && n[1] instanceof B) return this.fromPoints(n[0], n[1]);
|
|
3548
|
+
if (n[0] instanceof B && n[1] instanceof V) return this.fromPointAndDirection(n[0], n[1]);
|
|
4578
3549
|
}
|
|
4579
|
-
return n.length === 3 && n.every((e) =>
|
|
3550
|
+
return n.length === 3 && n.every((e) => _.isFraction(e)) ? this.fromCoefficient(n[0], n[1], n[2]) : (console.warn("Something wrong happened while creating the line"), console.warn(n), this);
|
|
4580
3551
|
};
|
|
3552
|
+
copy() {
|
|
3553
|
+
throw new a("copy() is not yet implemented for Line");
|
|
3554
|
+
}
|
|
4581
3555
|
clone = () => new e().fromCoefficient(this.#t, this.#n, this.#r);
|
|
4582
3556
|
get tex() {
|
|
4583
3557
|
let e = this.#a;
|
|
4584
3558
|
switch (this.#a = 1, e) {
|
|
4585
3559
|
case 0: return this.getEquation().reorder().tex;
|
|
4586
|
-
case 2: return this.slope.isInfinity() ? "x=" + this.OA.x.tex : "y=" + new
|
|
3560
|
+
case 2: return this.slope.isInfinity() ? "x=" + this.OA.x.tex : "y=" + new N().parse("x", this.slope, this.height).tex;
|
|
4587
3561
|
case 3:
|
|
4588
3562
|
case 4: {
|
|
4589
3563
|
let t = this.d.clone().simplify();
|
|
4590
|
-
return e === 3 ? `${
|
|
3564
|
+
return e === 3 ? `${V.asTex("x", "y")} = ${V.asTex(this.#e.x.tex, this.#e.y.tex)} + k\\cdot ${V.asTex(t.x.tex, t.y.tex)}` : `\\left\\{\\begin{aligned}\n\tx &= ${new N(this.#e.x).add(new O(t.x).multiply(new O("k"))).reorder("k", !0).tex}\\\\\n\ty &= ${new N(this.#e.y).add(new O(t.y).multiply(new O("k"))).reorder("k", !0).tex}\n\\end{aligned}\\right.`;
|
|
4591
3565
|
}
|
|
4592
3566
|
default: {
|
|
4593
3567
|
let e = this.getEquation();
|
|
@@ -4599,13 +3573,13 @@ var q = class e {
|
|
|
4599
3573
|
let e = this.#a;
|
|
4600
3574
|
switch (this.#a = 1, e) {
|
|
4601
3575
|
case 0: return this.getEquation().reorder().display;
|
|
4602
|
-
case 2: return this.slope.isInfinity() ? "x=" + this.OA.x.display : "y=" + new
|
|
3576
|
+
case 2: return this.slope.isInfinity() ? "x=" + this.OA.x.display : "y=" + new N().parse("x", this.slope, this.height).display;
|
|
4603
3577
|
case 3: {
|
|
4604
3578
|
let e = this.d.clone().simplify();
|
|
4605
3579
|
return `((x,y))=((${this.#e.x.display},${this.#e.y.display}))+k((${e.x.display},${e.y.display}))`;
|
|
4606
3580
|
}
|
|
4607
3581
|
case 4: {
|
|
4608
|
-
let e = this.d.clone().simplify(), t = new
|
|
3582
|
+
let e = this.d.clone().simplify(), t = new N(this.#e.x).add(new O(e.x).multiply(new O("k"))).reorder("k", !0), n = new N(this.#e.y).add(new O(e.y).multiply(new O("k"))).reorder("k", !0);
|
|
4609
3583
|
return `{(x,=,${t.display}),(y,=,${n.display}):}`;
|
|
4610
3584
|
}
|
|
4611
3585
|
default: {
|
|
@@ -4658,7 +3632,7 @@ var q = class e {
|
|
|
4658
3632
|
return this.#t.isZero() || (t = this.#t.isOne() ? "x" : this.#t.clone().opposite().isOne() ? "-x" : this.#t.value.toFixed(e) + "x"), this.#n.isZero() || (this.#n.isPositive() && (t += "+"), t += this.#n.value.toFixed(e) + "y"), this.#r.isZero() || (this.#r.isPositive() && (t += "+"), t += this.#r.value.toFixed(e)), t + "=0";
|
|
4659
3633
|
}
|
|
4660
3634
|
get d() {
|
|
4661
|
-
let e = new
|
|
3635
|
+
let e = new V(this.#n.clone(), this.#t.clone().opposite());
|
|
4662
3636
|
return (this.#i === "lr" && e.x.isNegative() || this.#i === "rl" && e.x.isPositive()) && e.opposite(), e;
|
|
4663
3637
|
}
|
|
4664
3638
|
set d(e) {
|
|
@@ -4672,19 +3646,19 @@ var q = class e {
|
|
|
4672
3646
|
return n.isZero() ? new v(0) : new v().from(2, n.inverse(), t).reduce();
|
|
4673
3647
|
}
|
|
4674
3648
|
fromCoefficient(e, t, n) {
|
|
4675
|
-
this.#t = new
|
|
3649
|
+
this.#t = new _(e), this.#n = new _(t), this.#r = new _(n);
|
|
4676
3650
|
let r = [
|
|
4677
3651
|
this.#t,
|
|
4678
3652
|
this.#n,
|
|
4679
3653
|
this.#r
|
|
4680
|
-
].every((e) => e.exact) ?
|
|
4681
|
-
if (r > 1 && (this.#t.multiply(r).reduce(), this.#n.multiply(r).reduce(), this.#r.multiply(r).reduce()), this.#n.isZero()) return this.#e = new
|
|
3654
|
+
].every((e) => e.exact) ? g.lcm(this.#t.denominator, this.#n.denominator, this.#r.denominator) : 1;
|
|
3655
|
+
if (r > 1 && (this.#t.multiply(r).reduce(), this.#n.multiply(r).reduce(), this.#r.multiply(r).reduce()), this.#n.isZero()) return this.#e = new V(this.#r.clone().divide(this.#t).opposite(), 0), this;
|
|
4682
3656
|
for (let e = 0; e < this.#n.value; e++) {
|
|
4683
3657
|
let t = this.#t.clone().divide(this.#n).multiply(e).subtract(this.#r.clone().divide(this.#n)).reduce();
|
|
4684
|
-
if (this.#e = new
|
|
3658
|
+
if (this.#e = new V(e, t), t.isRelative()) return this;
|
|
4685
3659
|
}
|
|
4686
3660
|
let i = this.#r.clone().divide(this.#n).opposite().reduce();
|
|
4687
|
-
return this.#e = new
|
|
3661
|
+
return this.#e = new V(0, i), this;
|
|
4688
3662
|
}
|
|
4689
3663
|
fromEquation(e) {
|
|
4690
3664
|
e.reorder(!0);
|
|
@@ -4702,23 +3676,23 @@ var q = class e {
|
|
|
4702
3676
|
fromPointAndDirection(e, t) {
|
|
4703
3677
|
return this.#i = t.x.isPositive() ? "lr" : "rl", this.fromPointAndNormal(e, t.clone().normal());
|
|
4704
3678
|
}
|
|
4705
|
-
fromPointAndLine(e, t, n =
|
|
4706
|
-
return n ===
|
|
3679
|
+
fromPointAndLine(e, t, n = H.Parallel) {
|
|
3680
|
+
return n === H.Perpendicular ? this.fromPointAndNormal(e, t.director) : this.fromPointAndNormal(e, t.normal);
|
|
4707
3681
|
}
|
|
4708
|
-
fromPointAndNormal = (e, t) => t.isZero() ? (console.warn("Normal vector is null."), this) : (this.fromCoefficient(t.x, t.y, e.x.clone().multiply(t.x).add(e.y.clone().multiply(t.y)).opposite()), this.#e = new
|
|
3682
|
+
fromPointAndNormal = (e, t) => t.isZero() ? (console.warn("Normal vector is null."), this) : (this.fromCoefficient(t.x, t.y, e.x.clone().multiply(t.x).add(e.y.clone().multiply(t.y)).opposite()), this.#e = new V(e.clone()), this);
|
|
4709
3683
|
fromPoints(e, t) {
|
|
4710
|
-
return this.fromPointAndNormal(e, new
|
|
3684
|
+
return this.fromPointAndNormal(e, new V(e, t).normal());
|
|
4711
3685
|
}
|
|
4712
3686
|
getEquation() {
|
|
4713
|
-
return new
|
|
3687
|
+
return new P(new N().parse("xy", this.#t, this.#n, this.#r), new N("0")).simplify();
|
|
4714
3688
|
}
|
|
4715
3689
|
getValueAtX = (e) => {
|
|
4716
|
-
let t = this.getEquation().isolate("y"), n = new
|
|
4717
|
-
return t instanceof
|
|
3690
|
+
let t = this.getEquation().isolate("y"), n = new _(e);
|
|
3691
|
+
return t instanceof P ? t.right.evaluate({ x: n }) : new _().invalid();
|
|
4718
3692
|
};
|
|
4719
3693
|
getValueAtY = (e) => {
|
|
4720
|
-
let t = this.getEquation().isolate("x"), n = new
|
|
4721
|
-
return t instanceof
|
|
3694
|
+
let t = this.getEquation().isolate("x"), n = new _(e);
|
|
3695
|
+
return t instanceof P ? t.right.evaluate({ y: n }) : new _().invalid();
|
|
4722
3696
|
};
|
|
4723
3697
|
get height() {
|
|
4724
3698
|
return this.#r.clone().opposite().divide(this.#n);
|
|
@@ -4728,8 +3702,8 @@ var q = class e {
|
|
|
4728
3702
|
return r.hasIntersection ? r.point.x.value >= Math.min(t.x.value, n.x.value) && r.point.x.value <= Math.max(t.x.value, n.x.value) && r.point.y.value >= Math.min(t.y.value, n.y.value) && r.point.y.value <= Math.max(t.y.value, n.y.value) : !1;
|
|
4729
3703
|
}
|
|
4730
3704
|
intersection = (e) => {
|
|
4731
|
-
let t = new
|
|
4732
|
-
return this.#n.isZero() || e.b.isZero(), this.isParallelTo(e) ? (t.x = new
|
|
3705
|
+
let t = new B(), n = !1, r = !1;
|
|
3706
|
+
return this.#n.isZero() || e.b.isZero(), this.isParallelTo(e) ? (t.x = new _().invalid(), t.y = new _().invalid(), n = !0) : this.isSameAs(e) ? (t.x = new _().invalid(), t.y = new _().invalid(), r = !0) : (t.x = this.#n.clone().multiply(e.c).subtract(this.#r.clone().multiply(e.b)).divide(this.#t.clone().multiply(e.b).subtract(this.#n.clone().multiply(e.a))), t.y = this.#t.clone().multiply(e.c).subtract(this.#r.clone().multiply(e.a)).divide(this.#n.clone().multiply(e.a).subtract(this.#t.clone().multiply(e.b)))), {
|
|
4733
3707
|
point: t,
|
|
4734
3708
|
hasIntersection: !(n || r),
|
|
4735
3709
|
isParallel: n,
|
|
@@ -4750,25 +3724,25 @@ var q = class e {
|
|
|
4750
3724
|
return this.d.normal();
|
|
4751
3725
|
}
|
|
4752
3726
|
get normal() {
|
|
4753
|
-
return new
|
|
3727
|
+
return new V(this.#t, this.#n);
|
|
4754
3728
|
}
|
|
4755
3729
|
randomNearPoint = (e) => {
|
|
4756
3730
|
let t = this.randomPoint(e), n = 10;
|
|
4757
|
-
for (; this.isOnLine(t) && n > 0;) t.x.add(
|
|
3731
|
+
for (; this.isOnLine(t) && n > 0;) t.x.add(W(1, !1)), t.y.add(W(1, !1)), n--;
|
|
4758
3732
|
return t;
|
|
4759
3733
|
};
|
|
4760
|
-
randomPoint = (e) => new
|
|
3734
|
+
randomPoint = (e) => new B(this.d.clone().multiplyByScalar(W(e === void 0 || e <= 1 ? 3 : e, !1)).add(this.#e));
|
|
4761
3735
|
simplify = () => {
|
|
4762
|
-
let e =
|
|
3736
|
+
let e = g.lcm(this.#t.denominator, this.#n.denominator, this.#r.denominator), t = g.gcd(this.#t.numerator, this.#n.numerator, this.#r.numerator);
|
|
4763
3737
|
return this.fromCoefficient(this.#t.clone().multiply(e).divide(t), this.#n.clone().multiply(e).divide(t), this.#r.clone().multiply(e).divide(t)), this;
|
|
4764
3738
|
};
|
|
4765
3739
|
get slope() {
|
|
4766
3740
|
return this.#t.clone().opposite().divide(this.#n);
|
|
4767
3741
|
}
|
|
4768
|
-
},
|
|
4769
|
-
#e = new
|
|
4770
|
-
#t = new
|
|
4771
|
-
#n = new
|
|
3742
|
+
}, q = class e {
|
|
3743
|
+
#e = new B();
|
|
3744
|
+
#t = new B();
|
|
3745
|
+
#n = new B();
|
|
4772
3746
|
#r = !1;
|
|
4773
3747
|
#i = null;
|
|
4774
3748
|
#a = !0;
|
|
@@ -4789,11 +3763,11 @@ var q = class e {
|
|
|
4789
3763
|
let [e, n, r] = t;
|
|
4790
3764
|
return this.fromLines(e, n, r);
|
|
4791
3765
|
}
|
|
4792
|
-
if (t.every((e) => e instanceof
|
|
4793
|
-
if (t.every((e) => e instanceof
|
|
3766
|
+
if (t.every((e) => e instanceof K)) return this.fromLines(t[0], t[1], t[2]);
|
|
3767
|
+
if (t.every((e) => e instanceof B)) return this.fromPoints(t[0], t[1], t[2]);
|
|
4794
3768
|
}
|
|
4795
3769
|
if (t.length === 6) {
|
|
4796
|
-
let e = t.map((e) => new
|
|
3770
|
+
let e = t.map((e) => new _(e));
|
|
4797
3771
|
if (e.some((e) => e.isNaN())) throw new i("One of the values is not a valid number");
|
|
4798
3772
|
return this.fromCoordinates(e[0], e[1], e[2], e[3], e[4], e[5]);
|
|
4799
3773
|
}
|
|
@@ -4846,10 +3820,10 @@ var q = class e {
|
|
|
4846
3820
|
return this.#a = !0, this;
|
|
4847
3821
|
}
|
|
4848
3822
|
fromCoordinates(e, t, n, r, i, a) {
|
|
4849
|
-
return this.fromPoints(new
|
|
3823
|
+
return this.fromPoints(new B(e, t), new B(n, r), new B(i, a));
|
|
4850
3824
|
}
|
|
4851
3825
|
fromLines(e, t, n) {
|
|
4852
|
-
let r = new
|
|
3826
|
+
let r = new K(e).clone(), i = new K(t).clone(), a = new K(n).clone(), o = r.intersection(i);
|
|
4853
3827
|
if (o.hasIntersection) this.#t = o.point;
|
|
4854
3828
|
else return this.#r = !1, this;
|
|
4855
3829
|
if (o = i.intersection(a), o.hasIntersection) this.#n = o.point;
|
|
@@ -4892,7 +3866,7 @@ var q = class e {
|
|
|
4892
3866
|
}
|
|
4893
3867
|
getHeights() {
|
|
4894
3868
|
if (!this.#o.heights) {
|
|
4895
|
-
let e = new
|
|
3869
|
+
let e = new K().fromPointAndNormal(this.#e, new V(this.#t, this.#n)), t = new K().fromPointAndNormal(this.#t, new V(this.#e, this.#n)), n = new K().fromPointAndNormal(this.#n, new V(this.#e, this.#t)), r = e.intersection(t).point;
|
|
4896
3870
|
this.#o.heights = {
|
|
4897
3871
|
A: e,
|
|
4898
3872
|
B: t,
|
|
@@ -4905,7 +3879,7 @@ var q = class e {
|
|
|
4905
3879
|
getMedians() {
|
|
4906
3880
|
let e = this.getMiddles();
|
|
4907
3881
|
if (!this.#o.medians) {
|
|
4908
|
-
let t = new
|
|
3882
|
+
let t = new K().fromPoints(this.#e, e.BC), n = new K().fromPoints(this.#t, e.AC), r = new K().fromPoints(this.#n, e.AB), i = t.intersection(n).point;
|
|
4909
3883
|
this.#o.medians = {
|
|
4910
3884
|
A: t,
|
|
4911
3885
|
B: n,
|
|
@@ -4918,7 +3892,7 @@ var q = class e {
|
|
|
4918
3892
|
getMediators() {
|
|
4919
3893
|
let e = this.getMiddles();
|
|
4920
3894
|
if (!this.#o.mediators) {
|
|
4921
|
-
let t = new
|
|
3895
|
+
let t = new K().fromPointAndNormal(e.BC, new V(this.#t, this.#n)), n = new K().fromPointAndNormal(e.AC, new V(this.#e, this.#n)), r = new K().fromPointAndNormal(e.AB, new V(this.#e, this.#t)), i = t.intersection(n).point;
|
|
4922
3896
|
this.#o.mediators = {
|
|
4923
3897
|
a: t,
|
|
4924
3898
|
b: n,
|
|
@@ -4930,9 +3904,9 @@ var q = class e {
|
|
|
4930
3904
|
}
|
|
4931
3905
|
getMiddles() {
|
|
4932
3906
|
return {
|
|
4933
|
-
AB: new
|
|
4934
|
-
AC: new
|
|
4935
|
-
BC: new
|
|
3907
|
+
AB: new B().middleOf(this.#e, this.#t),
|
|
3908
|
+
AC: new B().middleOf(this.#e, this.#n),
|
|
3909
|
+
BC: new B().middleOf(this.#t, this.#n)
|
|
4936
3910
|
};
|
|
4937
3911
|
}
|
|
4938
3912
|
getPoints() {
|
|
@@ -4971,9 +3945,9 @@ var q = class e {
|
|
|
4971
3945
|
}
|
|
4972
3946
|
get lines() {
|
|
4973
3947
|
return this.#i === null && (this.#i = {
|
|
4974
|
-
AB: new
|
|
4975
|
-
BC: new
|
|
4976
|
-
AC: new
|
|
3948
|
+
AB: new K(this.#e, this.#t),
|
|
3949
|
+
BC: new K(this.#t, this.#n),
|
|
3950
|
+
AC: new K(this.#e, this.#n)
|
|
4977
3951
|
}), this.#i;
|
|
4978
3952
|
}
|
|
4979
3953
|
medianA() {
|
|
@@ -4998,14 +3972,14 @@ var q = class e {
|
|
|
4998
3972
|
}, this;
|
|
4999
3973
|
}
|
|
5000
3974
|
#s(e, t = !0) {
|
|
5001
|
-
let n = this.lines, r = new
|
|
3975
|
+
let n = this.lines, r = new V(), i = new V(), a = new B();
|
|
5002
3976
|
if (e === "A" ? (a = this.A.clone(), r = n.AB.clone().d, i = n.AC.clone().d) : e === "B" ? (a = this.B.clone(), r = n.AB.clone().d.opposite(), i = n.BC.clone().d) : e === "C" && (a = this.C.clone(), r = n.BC.clone().d.opposite(), i = n.AC.clone().d.opposite()), r === void 0 || i === void 0) throw new o(`The point ${e} does not exist`);
|
|
5003
3977
|
let s = t ? r.unit().add(i.unit()) : r.unit().subtract(i.unit());
|
|
5004
|
-
return new
|
|
3978
|
+
return new K().fromPointAndDirection(a, s);
|
|
5005
3979
|
}
|
|
5006
3980
|
#c(e, t, n) {
|
|
5007
3981
|
let r = (t ** 2 + n ** 2 - e ** 2) / (2 * t * n);
|
|
5008
|
-
return this.#a ? Math.acos(r) :
|
|
3982
|
+
return this.#a ? Math.acos(r) : g.numberCorrection(Math.acos(r) * 180 / Math.PI);
|
|
5009
3983
|
}
|
|
5010
3984
|
#l = (e) => {
|
|
5011
3985
|
switch (e.toUpperCase()) {
|
|
@@ -5015,8 +3989,8 @@ var q = class e {
|
|
|
5015
3989
|
}
|
|
5016
3990
|
return this.#e;
|
|
5017
3991
|
};
|
|
5018
|
-
#u = (e, t) => new
|
|
5019
|
-
},
|
|
3992
|
+
#u = (e, t) => new V(this.#l(e), this.#l(t));
|
|
3993
|
+
}, J = class e {
|
|
5020
3994
|
#e = null;
|
|
5021
3995
|
#t = null;
|
|
5022
3996
|
#n = 1;
|
|
@@ -5025,7 +3999,7 @@ var q = class e {
|
|
|
5025
3999
|
e.length > 0 && this.parse(...e);
|
|
5026
4000
|
}
|
|
5027
4001
|
parse(...t) {
|
|
5028
|
-
return typeof t[0] == "string" ? this.fromString(t[0]) : t[0] instanceof
|
|
4002
|
+
return typeof t[0] == "string" ? this.fromString(t[0]) : t[0] instanceof P ? this.fromEquation(t[0]) : t[0] instanceof e ? this.copy(t[0]) : t.length === 2 && t[0] instanceof B && t[1] instanceof B ? this.fromCenterPoint(t[0], t[1]) : t.length >= 2 && t[0] instanceof B && (t[1] instanceof _ || typeof t[1] == "number") ? this.fromCenterRadius(t[0], t[1], typeof t[2] == "boolean" && t[2]) : this;
|
|
5029
4003
|
}
|
|
5030
4004
|
clone() {
|
|
5031
4005
|
return new e().fromCenterRadius(this.center.clone(), this.squareRadius.clone(), !0);
|
|
@@ -5050,36 +4024,36 @@ var q = class e {
|
|
|
5050
4024
|
return this.#n = 1, this;
|
|
5051
4025
|
}
|
|
5052
4026
|
get center() {
|
|
5053
|
-
return this.#e ?? new
|
|
4027
|
+
return this.#e ?? new B();
|
|
5054
4028
|
}
|
|
5055
4029
|
get equation() {
|
|
5056
|
-
return this.#t?.clone() ?? new
|
|
4030
|
+
return this.#t?.clone() ?? new P("0=0");
|
|
5057
4031
|
}
|
|
5058
4032
|
fromCenterPoint(e, t) {
|
|
5059
|
-
return this.#e = e.clone(), this.#r = new
|
|
4033
|
+
return this.#e = e.clone(), this.#r = new V(this.#e, t).normSquare, this.#i(), this;
|
|
5060
4034
|
}
|
|
5061
4035
|
fromCenterRadius(e, t, n) {
|
|
5062
|
-
return this.#e = e.clone(), this.#r = n ? new
|
|
4036
|
+
return this.#e = e.clone(), this.#r = n ? new _(t) : new _(t).pow(2), this.#i(), this;
|
|
5063
4037
|
}
|
|
5064
4038
|
fromEquation(e) {
|
|
5065
4039
|
if (e.moveLeft(), e.degree("x").value === 2 && e.degree("y").value === 2) {
|
|
5066
4040
|
let t = e.left.monomByDegree(2, "x"), n = e.left.monomByDegree(2, "y"), r, i, a;
|
|
5067
|
-
if (t.coefficient.isEqual(n.coefficient)) return e.divide(t.coefficient), r = e.left.monomByDegree(1, "x"), i = e.left.monomByDegree(1, "y"), a = e.left.monomByDegree(0), this.#e = new
|
|
4041
|
+
if (t.coefficient.isEqual(n.coefficient)) return e.divide(t.coefficient), r = e.left.monomByDegree(1, "x"), i = e.left.monomByDegree(1, "y"), a = e.left.monomByDegree(0), this.#e = new B(r.coefficient.clone().divide(2).opposite(), i.coefficient.clone().divide(2).opposite()), this.#r = a.coefficient.clone().opposite().add(this.#e.x.clone().pow(2)).add(this.#e.y.clone().pow(2)), this.#i(), this;
|
|
5068
4042
|
this.#a();
|
|
5069
4043
|
}
|
|
5070
4044
|
return this;
|
|
5071
4045
|
}
|
|
5072
4046
|
fromPoints(e, t, n) {
|
|
5073
|
-
let r = new
|
|
4047
|
+
let r = new q(e, t, n);
|
|
5074
4048
|
if (!r.isValid || !r.remarquables) return this.#a(), this;
|
|
5075
4049
|
let i = r.getMediators().c.clone(), a = r.getMediators().b.clone();
|
|
5076
4050
|
return this.fromCenterPoint(i.intersection(a).point, e);
|
|
5077
4051
|
}
|
|
5078
4052
|
fromString(e) {
|
|
5079
|
-
return this.fromEquation(new
|
|
4053
|
+
return this.fromEquation(new P(e));
|
|
5080
4054
|
}
|
|
5081
4055
|
getPointsOnCircle() {
|
|
5082
|
-
let e =
|
|
4056
|
+
let e = g.pythagoreanTripletsWithTarget(this.squareRadius.value, !0), t = [];
|
|
5083
4057
|
return e.forEach((e) => {
|
|
5084
4058
|
for (let n of [
|
|
5085
4059
|
[1, 1],
|
|
@@ -5088,7 +4062,7 @@ var q = class e {
|
|
|
5088
4062
|
[1, -1]
|
|
5089
4063
|
]) {
|
|
5090
4064
|
let r = this.center.x.clone().add(n[0] * e[0]), i = this.center.y.clone().add(n[1] * e[1]);
|
|
5091
|
-
t.every((e) => !e.isEqualXY(r, i)) && t.push(new
|
|
4065
|
+
t.every((e) => !e.isEqualXY(r, i)) && t.push(new B(r, i));
|
|
5092
4066
|
}
|
|
5093
4067
|
}), t;
|
|
5094
4068
|
}
|
|
@@ -5105,10 +4079,10 @@ var q = class e {
|
|
|
5105
4079
|
if (s.length === 0) return [];
|
|
5106
4080
|
if (s.length === 1) {
|
|
5107
4081
|
let e = r.add(n.clone().multiplyByScalar(s[0].fraction));
|
|
5108
|
-
return [new
|
|
4082
|
+
return [new B(e.x, e.y)];
|
|
5109
4083
|
}
|
|
5110
4084
|
let c = s[0].exact ? r.clone().add(n.clone().multiplyByScalar(s[0].fraction)) : r.clone().add(n.clone().multiplyByScalar(s[0].value)), l = s[1].exact ? r.clone().add(n.clone().multiplyByScalar(s[1].fraction)) : r.clone().add(n.clone().multiplyByScalar(s[1].value));
|
|
5111
|
-
return [new
|
|
4085
|
+
return [new B(c.x, c.y), new B(l.x, l.y)].sort((e, t) => n.x.isZero() ? n.y.isPositive() ? e.y.value - t.y.value : t.y.value - e.y.value : n.x.isPositive() ? e.x.value - t.x.value : t.x.value - e.x.value);
|
|
5112
4086
|
}
|
|
5113
4087
|
get radius() {
|
|
5114
4088
|
return new v().from(2, this.#r ?? 0);
|
|
@@ -5119,57 +4093,57 @@ var q = class e {
|
|
|
5119
4093
|
return t - n > 1e-10 ? 0 : Math.abs(t - n) < 1e-10 ? 1 : 2;
|
|
5120
4094
|
}
|
|
5121
4095
|
setRadius(e, t) {
|
|
5122
|
-
return this.#r = t ? new
|
|
4096
|
+
return this.#r = t ? new _(e) : new _(e).pow(2), this.#i(), this;
|
|
5123
4097
|
}
|
|
5124
4098
|
get squareRadius() {
|
|
5125
|
-
return this.#r?.clone() ?? new
|
|
4099
|
+
return this.#r?.clone() ?? new _(-1);
|
|
5126
4100
|
}
|
|
5127
|
-
tangents = (e) => e instanceof
|
|
4101
|
+
tangents = (e) => e instanceof _ ? this.#c(e) : this.isPointOnCircle(e) ? this.#o(e) : this.#e !== null && this.#e.distanceTo(e).value > this.radius.value ? this.#s(e) : [];
|
|
5128
4102
|
#i() {
|
|
5129
|
-
this.#t = new
|
|
4103
|
+
this.#t = new P(new N(`(x-(${this.center.x.display}))^2+(y-(${this.center.y.display}))^2`), new N(this.squareRadius.display)).moveLeft();
|
|
5130
4104
|
}
|
|
5131
4105
|
#a() {
|
|
5132
4106
|
this.#e = null, this.#r = null, this.#t = null;
|
|
5133
4107
|
}
|
|
5134
4108
|
#o = (e) => {
|
|
5135
|
-
let t = new
|
|
5136
|
-
return [new
|
|
4109
|
+
let t = new V(this.center, e);
|
|
4110
|
+
return [new K().fromPointAndNormal(e, t)];
|
|
5137
4111
|
};
|
|
5138
4112
|
#s = (e) => {
|
|
5139
|
-
let t = this.center.x.clone().subtract(e.x), n = this.center.y.clone().subtract(e.y), r = new
|
|
5140
|
-
return r.multiply(t).subtract(n).pow(2), i.multiply(this.squareRadius), new
|
|
5141
|
-
let n, r = new
|
|
5142
|
-
return t.exact ? (n = e.x.clone().opposite().multiply(t.fraction).add(e.y), r.right.multiply(t.fraction).add(n)) : (n = e.x.clone().opposite().multiply(t.value).add(e.y), r.right.multiply(t.value).add(n)), new
|
|
4113
|
+
let t = this.center.x.clone().subtract(e.x), n = this.center.y.clone().subtract(e.y), r = new N("x"), i = new N("x^2+1");
|
|
4114
|
+
return r.multiply(t).subtract(n).pow(2), i.multiply(this.squareRadius), new P(r, i).solve().map((t) => {
|
|
4115
|
+
let n, r = new P("y", "x");
|
|
4116
|
+
return t.exact ? (n = e.x.clone().opposite().multiply(t.fraction).add(e.y), r.right.multiply(t.fraction).add(n)) : (n = e.x.clone().opposite().multiply(t.value).add(e.y), r.right.multiply(t.value).add(n)), new K(r);
|
|
5143
4117
|
});
|
|
5144
4118
|
};
|
|
5145
4119
|
#c = (e) => {
|
|
5146
4120
|
let t = e.numerator, n = -e.denominator, r = this.center.x.clone(), i = this.center.y.clone(), a = this.squareRadius.clone().multiply(e.numerator ** 2 + e.denominator ** 2), o = r.clone().multiply(t).opposite().subtract(i.clone().multiply(n)).add(a.clone().sqrt()), s = r.clone().multiply(t).opposite().subtract(i.clone().multiply(n)).subtract(a.clone().sqrt());
|
|
5147
|
-
return [new
|
|
4121
|
+
return [new K(t, n, o), new K(t, n, s)];
|
|
5148
4122
|
};
|
|
5149
|
-
},
|
|
5150
|
-
static PARALLEL =
|
|
5151
|
-
static PERPENDICULAR =
|
|
5152
|
-
#e = new
|
|
5153
|
-
#t = new
|
|
4123
|
+
}, Y = class e {
|
|
4124
|
+
static PARALLEL = De.Parallel;
|
|
4125
|
+
static PERPENDICULAR = De.Perpendicular;
|
|
4126
|
+
#e = new B();
|
|
4127
|
+
#t = new V();
|
|
5154
4128
|
constructor(e, t) {
|
|
5155
|
-
return this.#e = e.clone(), this.#t = t instanceof
|
|
4129
|
+
return this.#e = e.clone(), this.#t = t instanceof B ? new V(e, t) : t.clone(), this;
|
|
5156
4130
|
}
|
|
5157
4131
|
clone = () => (this.#t = this.#t.clone(), this.#e = this.#e.clone(), this);
|
|
5158
4132
|
get tex() {
|
|
5159
4133
|
return {
|
|
5160
|
-
parametric: `${
|
|
4134
|
+
parametric: `${V.asTex("x", "y", "z")} = ${V.asTex(this.#e.x.tex, this.#e.y.tex, this.#e.z.tex)} + k\\cdot ${V.asTex(this.#t.x.tex, this.#t.y.tex, this.#t.z.tex)}`,
|
|
5161
4135
|
system: `\\left\\{\\begin{aligned}
|
|
5162
|
-
x &= ${new
|
|
5163
|
-
y &= ${new
|
|
5164
|
-
z &= ${new
|
|
4136
|
+
x &= ${new N(this.#e.x).add(new O(this.#t.x).multiply(new O("k"))).reorder("k", !0).tex}\\\\
|
|
4137
|
+
y &= ${new N(this.#e.y).add(new O(this.#t.y).multiply(new O("k"))).reorder("k", !0).tex}\\\\
|
|
4138
|
+
z &= ${new N(this.#e.z).add(new O(this.#t.z).multiply(new O("k"))).reorder("k", !0).tex}
|
|
5165
4139
|
\\end{aligned}\\right.`,
|
|
5166
|
-
cartesian: `\\frac{ ${new
|
|
4140
|
+
cartesian: `\\frac{ ${new N("x", 1, this.#e.x.clone().opposite()).tex} }{ ${this.direction.x.tex} } = \\frac{ ${new N("y", 1, this.#e.y.clone().opposite()).tex} }{ ${this.direction.y.tex} } = \\frac{ ${new N("z", 1, this.#e.z.clone().opposite()).tex} }{ ${this.direction.z.tex} }`
|
|
5167
4141
|
};
|
|
5168
4142
|
}
|
|
5169
4143
|
get display() {
|
|
5170
4144
|
let e = this.#e.x.display, t = this.#e.y.display, n = this.#e.z.display, r = this.direction.simplify(), i = r.x.display, a = r.y.display, o = r.z.display;
|
|
5171
4145
|
return {
|
|
5172
|
-
parametric: `${
|
|
4146
|
+
parametric: `${V.asDisplay("x", "y", "z")} = ${V.asDisplay(this.#e.x.display, this.#e.y.display, this.#e.z.display)} + k\\cdot ${V.asDisplay(this.#t.x.display, this.#t.y.display, this.#t.z.display)}`,
|
|
5173
4147
|
system: "",
|
|
5174
4148
|
cartesian: `(x-${e})/${i} = (y-${t})/${a} = (z-${n})/${o}`
|
|
5175
4149
|
};
|
|
@@ -5190,7 +4164,7 @@ var q = class e {
|
|
|
5190
4164
|
return this.#t.clone();
|
|
5191
4165
|
}
|
|
5192
4166
|
distanceTo(e) {
|
|
5193
|
-
let t = new
|
|
4167
|
+
let t = new V(this.#e, e), n = this.direction, r = this.direction.normSquare, i = t.cross(n).normSquare.clone().divide(r), a = i.clone().sqrt();
|
|
5194
4168
|
return {
|
|
5195
4169
|
value: Math.sqrt(i.value),
|
|
5196
4170
|
fraction: i.clone().sqrt(),
|
|
@@ -5221,15 +4195,15 @@ var q = class e {
|
|
|
5221
4195
|
return this.#e.clone();
|
|
5222
4196
|
}
|
|
5223
4197
|
randomPoint = (e = 5) => {
|
|
5224
|
-
let t = this.#e.clone(), n = new
|
|
5225
|
-
return new
|
|
4198
|
+
let t = this.#e.clone(), n = new _(W(e, !1));
|
|
4199
|
+
return new B(t.x.clone().add(this.#t.x.clone().multiply(n)), t.y.clone().add(this.#t.y.clone().multiply(n)), t.z.clone().add(this.#t.z.clone().multiply(n)));
|
|
5226
4200
|
};
|
|
5227
4201
|
simplify = () => {
|
|
5228
4202
|
throw new a("Method not implemented.");
|
|
5229
4203
|
};
|
|
5230
|
-
},
|
|
5231
|
-
#e = new
|
|
5232
|
-
#t = new
|
|
4204
|
+
}, Ne = class e {
|
|
4205
|
+
#e = new V(0, 0, 1);
|
|
4206
|
+
#t = new B(0, 0, 0);
|
|
5233
4207
|
constructor(e) {
|
|
5234
4208
|
return e && this.parse(e), this;
|
|
5235
4209
|
}
|
|
@@ -5246,25 +4220,25 @@ var q = class e {
|
|
|
5246
4220
|
}
|
|
5247
4221
|
if (e.equation) {
|
|
5248
4222
|
let t = e.equation.moveLeft().reduce().left, n = t.monomByLetter("x").coefficient, r = t.monomByLetter("y").coefficient, i = t.monomByLetter("z").coefficient, a = t.monomByDegree(0).coefficient;
|
|
5249
|
-
this.normal = new
|
|
4223
|
+
this.normal = new V(n, r, i), this.point = n.isNotZero() ? new B(a.clone().divide(n).opposite(), 0, 0) : r.isNotZero() ? new B(0, a.clone().divide(r).opposite(), 0) : new B(0, 0, a.clone().divide(i).opposite());
|
|
5250
4224
|
return;
|
|
5251
4225
|
}
|
|
5252
|
-
if (e.points?.length === 3 && e.points.every((e) => e instanceof
|
|
5253
|
-
let t = e.points[0], n = e.points[1], r = e.points[2], i = new
|
|
4226
|
+
if (e.points?.length === 3 && e.points.every((e) => e instanceof V)) {
|
|
4227
|
+
let t = e.points[0], n = e.points[1], r = e.points[2], i = new V(t, n), a = new V(t, r);
|
|
5254
4228
|
this.normal = i.cross(a), this.point = t;
|
|
5255
4229
|
return;
|
|
5256
4230
|
}
|
|
5257
4231
|
if (e.coefficients?.length === 4) {
|
|
5258
4232
|
let [t, n, r, i] = e.coefficients;
|
|
5259
|
-
this.normal = new
|
|
4233
|
+
this.normal = new V(t, n, r), this.point = new B(0, 0, -i);
|
|
5260
4234
|
return;
|
|
5261
4235
|
}
|
|
5262
4236
|
}
|
|
5263
4237
|
get tex() {
|
|
5264
|
-
return new
|
|
4238
|
+
return new P(new N("xyz", this.a, this.b, this.c, this.d), new N(0)).reduce().tex;
|
|
5265
4239
|
}
|
|
5266
4240
|
get display() {
|
|
5267
|
-
return new
|
|
4241
|
+
return new P(new N("xyz", this.a, this.b, this.c, this.d), new N(0)).reduce().display;
|
|
5268
4242
|
}
|
|
5269
4243
|
get a() {
|
|
5270
4244
|
return this.#e.x;
|
|
@@ -5272,7 +4246,7 @@ var q = class e {
|
|
|
5272
4246
|
angle(t, r, i) {
|
|
5273
4247
|
if (t instanceof e) return this.normal.angle(t.normal, r, i);
|
|
5274
4248
|
let a;
|
|
5275
|
-
if (t instanceof
|
|
4249
|
+
if (t instanceof V) {
|
|
5276
4250
|
if (t.dimension !== 3) throw new n("Vector is not 3D");
|
|
5277
4251
|
a = t;
|
|
5278
4252
|
} else a = t.direction;
|
|
@@ -5292,10 +4266,10 @@ var q = class e {
|
|
|
5292
4266
|
}
|
|
5293
4267
|
intersectWithLine(e) {
|
|
5294
4268
|
let { point: t, direction: n } = e, r = this.normal.dot(t).add(this.d).divide(this.normal.dot(n).opposite());
|
|
5295
|
-
return new
|
|
4269
|
+
return new B(new V(t).add(n.clone().multiplyByScalar(r)));
|
|
5296
4270
|
}
|
|
5297
4271
|
intersectWithPlane(e) {
|
|
5298
|
-
throw this.normal.cross(e.normal), new
|
|
4272
|
+
throw this.normal.cross(e.normal), new B(0, 0, 0), new a("Intersection with plane not yet implemented !");
|
|
5299
4273
|
}
|
|
5300
4274
|
isPointOnPlane(e) {
|
|
5301
4275
|
return this.normal.dot(e).add(this.d).isZero();
|
|
@@ -5304,33 +4278,33 @@ var q = class e {
|
|
|
5304
4278
|
return this.#e;
|
|
5305
4279
|
}
|
|
5306
4280
|
set normal(e) {
|
|
5307
|
-
this.#e = new
|
|
4281
|
+
this.#e = new V(e);
|
|
5308
4282
|
}
|
|
5309
4283
|
get point() {
|
|
5310
4284
|
return this.#t;
|
|
5311
4285
|
}
|
|
5312
4286
|
set point(e) {
|
|
5313
|
-
this.#t = new
|
|
4287
|
+
this.#t = new B(e);
|
|
5314
4288
|
}
|
|
5315
|
-
},
|
|
4289
|
+
}, X = /* @__PURE__ */ function(e) {
|
|
5316
4290
|
return e[e.INTERIOR = 0] = "INTERIOR", e[e.EXTERIOR = 1] = "EXTERIOR", e[e.SECANT = 2] = "SECANT", e[e.TANGENT_INSIDE = 3] = "TANGENT_INSIDE", e[e.TANGENT_OUTSIDE = 4] = "TANGENT_OUTSIDE", e[e.SUPERPOSED = 5] = "SUPERPOSED", e[e.CONCENTRIC = 6] = "CONCENTRIC", e;
|
|
5317
|
-
}({}),
|
|
4291
|
+
}({}), Pe = class {
|
|
5318
4292
|
#e = void 0;
|
|
5319
4293
|
#t = void 0;
|
|
5320
4294
|
#n = void 0;
|
|
5321
4295
|
#r = 1;
|
|
5322
4296
|
constructor(e, t) {
|
|
5323
|
-
return e && t && (this.#e = e, this.#t = new
|
|
4297
|
+
return e && t && (this.#e = e, this.#t = new _(t).clone().pow(2), this.#a()), this;
|
|
5324
4298
|
}
|
|
5325
4299
|
fromEquation(e) {
|
|
5326
|
-
let t = new
|
|
4300
|
+
let t = new P(e).moveLeft().reduce(), n = [
|
|
5327
4301
|
"x",
|
|
5328
4302
|
"y",
|
|
5329
4303
|
"z"
|
|
5330
4304
|
];
|
|
5331
4305
|
if (n.some((e) => t.degree(e).value !== 2)) return this.makeUndefined();
|
|
5332
4306
|
let r = t.left.monomByDegree(2, "x").coefficient;
|
|
5333
|
-
return n.some((e) => t.left.monomByDegree(2, e).coefficient.isNotEqual(r)) ? this.makeUndefined() : (this.#e = new
|
|
4307
|
+
return n.some((e) => t.left.monomByDegree(2, e).coefficient.isNotEqual(r)) ? this.makeUndefined() : (this.#e = new B(t.left.monomByDegree(1, "x").coefficient.clone().opposite().divide(2), t.left.monomByDegree(1, "y").coefficient.clone().opposite().divide(2), t.left.monomByDegree(1, "z").coefficient.clone().opposite().divide(2)), this.#t = t.left.monomByDegree(0).coefficient.clone().opposite().add(this.#e.x.clone().pow(2)).add(this.#e.y.clone().pow(2)).add(this.#e.z.clone().pow(2)), this.#a(), this);
|
|
5334
4308
|
}
|
|
5335
4309
|
get center() {
|
|
5336
4310
|
if (this.#e === void 0) throw new s("Sphere3 is undefined");
|
|
@@ -5359,10 +4333,10 @@ var q = class e {
|
|
|
5359
4333
|
makeUndefined() {
|
|
5360
4334
|
return this.#e = void 0, this.#t = void 0, this.#n = void 0, this;
|
|
5361
4335
|
}
|
|
5362
|
-
get
|
|
4336
|
+
get asCenterRadius() {
|
|
5363
4337
|
return this.#r = 1, this;
|
|
5364
4338
|
}
|
|
5365
|
-
get
|
|
4339
|
+
get asDeveloped() {
|
|
5366
4340
|
return this.#r = 0, this;
|
|
5367
4341
|
}
|
|
5368
4342
|
get tex() {
|
|
@@ -5382,15 +4356,15 @@ var q = class e {
|
|
|
5382
4356
|
].forEach((n) => {
|
|
5383
4357
|
if (this.center[n].isZero()) t.push(`${n}^2`);
|
|
5384
4358
|
else {
|
|
5385
|
-
let r = new
|
|
4359
|
+
let r = new N(n).subtract(this.center[n]);
|
|
5386
4360
|
t.push(e ? `\\(${r.tex}\\)^2` : `(${r.display})^2`);
|
|
5387
4361
|
}
|
|
5388
4362
|
}), t.join("+") + "=" + (e ? this.squareRadius.tex : this.squareRadius.display);
|
|
5389
4363
|
};
|
|
5390
4364
|
#a() {
|
|
5391
|
-
this.#n = new
|
|
4365
|
+
this.#n = new P(new N("x").subtract(this.center.x).pow(2).add(new N("y").subtract(this.center.y).pow(2)).add(new N("z").subtract(this.center.z).pow(2)), new N(this.squareRadius)).reduce();
|
|
5392
4366
|
}
|
|
5393
|
-
static RELATIVE_POSITION =
|
|
4367
|
+
static RELATIVE_POSITION = X;
|
|
5394
4368
|
relativePosition = (e) => {
|
|
5395
4369
|
let t = this.center.distanceTo(e.center).value, n = this.radius.value, r = e.radius.value;
|
|
5396
4370
|
return t > n + r ? 1 : t === n + r ? 4 : t === 0 ? n === r ? 5 : 6 : t === Math.abs(n - r) ? 3 : t < Math.abs(n - r) ? 0 : 2;
|
|
@@ -5410,23 +4384,23 @@ function Z(e) {
|
|
|
5410
4384
|
reduced: !0,
|
|
5411
4385
|
zero: !0,
|
|
5412
4386
|
natural: !1
|
|
5413
|
-
}, e), n = new
|
|
5414
|
-
if (n.numerator = t.negative ?
|
|
4387
|
+
}, e), n = new _();
|
|
4388
|
+
if (n.numerator = t.negative ? W(t.max, t.zero) : U(+!t.zero, t.max), t.natural) n.denominator = 1;
|
|
5415
4389
|
else {
|
|
5416
4390
|
let e = 0;
|
|
5417
|
-
for (; n.isRelative() && e < 10;) n.denominator =
|
|
4391
|
+
for (; n.isRelative() && e < 10;) n.denominator = U(1, t.max), e++;
|
|
5418
4392
|
}
|
|
5419
4393
|
return t.reduced ? n.reduce() : n;
|
|
5420
4394
|
}
|
|
5421
4395
|
//#endregion
|
|
5422
4396
|
//#region src/randomization/algebra/rndMonom.ts
|
|
5423
|
-
function
|
|
4397
|
+
function Fe(e) {
|
|
5424
4398
|
let t = Object.assign({
|
|
5425
4399
|
letters: "x",
|
|
5426
4400
|
degree: 2,
|
|
5427
4401
|
fraction: !0,
|
|
5428
4402
|
zero: !1
|
|
5429
|
-
}, e), n = new
|
|
4403
|
+
}, e), n = new O();
|
|
5430
4404
|
if (n.coefficient = Z(Object.assign({}, {
|
|
5431
4405
|
zero: t.zero,
|
|
5432
4406
|
reduced: !0,
|
|
@@ -5434,7 +4408,7 @@ function Me(e) {
|
|
|
5434
4408
|
}, typeof t.fraction == "boolean" ? {} : t.fraction)), t.letters.length > 1) {
|
|
5435
4409
|
for (let e of t.letters.split("")) n.setLetter(e, 0);
|
|
5436
4410
|
for (let e = 0; e < t.degree; e++) {
|
|
5437
|
-
let e =
|
|
4411
|
+
let e = G(t.letters.split(""));
|
|
5438
4412
|
n.setLetter(e, n.degree(e).clone().add(1));
|
|
5439
4413
|
}
|
|
5440
4414
|
} else n.setLetter(t.letters, t.degree);
|
|
@@ -5442,7 +4416,7 @@ function Me(e) {
|
|
|
5442
4416
|
}
|
|
5443
4417
|
//#endregion
|
|
5444
4418
|
//#region src/randomization/algebra/rndPolynom.ts
|
|
5445
|
-
var
|
|
4419
|
+
var Ie = {
|
|
5446
4420
|
letters: "x",
|
|
5447
4421
|
degree: 2,
|
|
5448
4422
|
fraction: !1,
|
|
@@ -5455,35 +4429,35 @@ var Ne = {
|
|
|
5455
4429
|
positive: !0
|
|
5456
4430
|
};
|
|
5457
4431
|
function Q(e) {
|
|
5458
|
-
let t = Object.assign({},
|
|
5459
|
-
if (t.factorable) return
|
|
5460
|
-
let n = new
|
|
5461
|
-
for (let e = i; e >= 0; e--) r =
|
|
4432
|
+
let t = Object.assign({}, Ie, e);
|
|
4433
|
+
if (t.factorable) return Le(t);
|
|
4434
|
+
let n = new N().empty(), r, i = t.degree ?? 2;
|
|
4435
|
+
for (let e = i; e >= 0; e--) r = Fe({
|
|
5462
4436
|
letters: t.letters,
|
|
5463
4437
|
degree: e,
|
|
5464
4438
|
fraction: t.fraction,
|
|
5465
4439
|
zero: e !== i && t.allowNullMonom
|
|
5466
4440
|
}), t.unit && i === e && r.coefficient.one(), n.add(r);
|
|
5467
4441
|
if (t.positive && n.monomByDegree().coefficient.isNegative() && n.opposite(), t.numberOfMonoms && t.numberOfMonoms > 0 && t.numberOfMonoms < n.length) for (; n.length > t.numberOfMonoms;) {
|
|
5468
|
-
let e =
|
|
4442
|
+
let e = U(1, n.length - 1);
|
|
5469
4443
|
n.monoms.splice(e, 1);
|
|
5470
4444
|
}
|
|
5471
4445
|
return n.reduce();
|
|
5472
4446
|
}
|
|
5473
|
-
function
|
|
5474
|
-
let t = Object.assign(
|
|
4447
|
+
function Le(e) {
|
|
4448
|
+
let t = Object.assign(Ie, e), n = { ...t };
|
|
5475
4449
|
n.degree = 1, n.factorable = !1;
|
|
5476
4450
|
let r = [], i = t.degree ?? 2;
|
|
5477
4451
|
for (; r.length < i;) r.push(Q(n));
|
|
5478
4452
|
if (e?.commonConstant !== !1) {
|
|
5479
|
-
let t =
|
|
5480
|
-
e?.commonConstant === !0 && (t === 1 || t === -1) && (t *=
|
|
4453
|
+
let t = W(10, !1);
|
|
4454
|
+
e?.commonConstant === !0 && (t === 1 || t === -1) && (t *= U(2, 5)), t !== 1 && t !== -1 && r.unshift(new N(t));
|
|
5481
4455
|
}
|
|
5482
|
-
return
|
|
4456
|
+
return N.xMultiply(...r);
|
|
5483
4457
|
}
|
|
5484
4458
|
//#endregion
|
|
5485
4459
|
//#region src/randomization/algebra/rndEquation.ts
|
|
5486
|
-
function
|
|
4460
|
+
function Re(e) {
|
|
5487
4461
|
let t = Object.assign({
|
|
5488
4462
|
letters: "x",
|
|
5489
4463
|
degree: 1,
|
|
@@ -5500,7 +4474,7 @@ function Fe(e) {
|
|
|
5500
4474
|
nothing: !1,
|
|
5501
4475
|
everything: !1
|
|
5502
4476
|
}
|
|
5503
|
-
}, e), n = new
|
|
4477
|
+
}, e), n = new N().one();
|
|
5504
4478
|
for (let e = 0; e < t.degree; e++) {
|
|
5505
4479
|
let e = Q({
|
|
5506
4480
|
degree: 1,
|
|
@@ -5511,7 +4485,7 @@ function Fe(e) {
|
|
|
5511
4485
|
});
|
|
5512
4486
|
n.multiply(e);
|
|
5513
4487
|
}
|
|
5514
|
-
return new
|
|
4488
|
+
return new P(n, 0);
|
|
5515
4489
|
}
|
|
5516
4490
|
//#endregion
|
|
5517
4491
|
//#region src/randomization/geometry/rndPoint.ts
|
|
@@ -5524,15 +4498,15 @@ function $(e) {
|
|
|
5524
4498
|
}, e), n = t.axis === "x", r = t.axis === "y", i = t.fraction ? Z({
|
|
5525
4499
|
max: t.max,
|
|
5526
4500
|
zero: n
|
|
5527
|
-
}) : new
|
|
4501
|
+
}) : new _(W(t.max, n)), a = t.fraction ? Z({
|
|
5528
4502
|
max: t.max,
|
|
5529
4503
|
zero: r
|
|
5530
|
-
}) : new
|
|
5531
|
-
return Number(t.quadrant) === 1 && (i.abs(), a.abs()), Number(t.quadrant) === 2 && (i.isPositive() && i.opposite(), a.isNegative() && a.opposite()), Number(t.quadrant) === 3 && (i.isPositive() && i.opposite(), a.isPositive() && a.opposite()), Number(t.quadrant) === 4 && (i.isNegative() && i.opposite(), a.isPositive() && a.opposite()), new
|
|
4504
|
+
}) : new _(W(t.max, r));
|
|
4505
|
+
return Number(t.quadrant) === 1 && (i.abs(), a.abs()), Number(t.quadrant) === 2 && (i.isPositive() && i.opposite(), a.isNegative() && a.opposite()), Number(t.quadrant) === 3 && (i.isPositive() && i.opposite(), a.isPositive() && a.opposite()), Number(t.quadrant) === 4 && (i.isNegative() && i.opposite(), a.isPositive() && a.opposite()), new B(i, a);
|
|
5532
4506
|
}
|
|
5533
4507
|
//#endregion
|
|
5534
4508
|
//#region src/randomization/geometry/rndCircle.ts
|
|
5535
|
-
function
|
|
4509
|
+
function ze(e) {
|
|
5536
4510
|
let t = Object.assign({
|
|
5537
4511
|
center: {
|
|
5538
4512
|
x: {
|
|
@@ -5546,77 +4520,77 @@ function Ie(e) {
|
|
|
5546
4520
|
},
|
|
5547
4521
|
pointsOnCircle: 8
|
|
5548
4522
|
}, e), n = $(t.center), r, i;
|
|
5549
|
-
return t.pointsOnCircle === 8 ? (r =
|
|
4523
|
+
return t.pointsOnCircle === 8 ? (r = U(1, 3), i = r ** 2 + (r + 1) ** 2) : i = U(1, 20), new J(n, i, !0);
|
|
5550
4524
|
}
|
|
5551
4525
|
//#endregion
|
|
5552
4526
|
//#region src/randomization/geometry/rndLine.ts
|
|
5553
|
-
function
|
|
4527
|
+
function Be(e) {
|
|
5554
4528
|
let t = Object.assign({ A: {
|
|
5555
|
-
x:
|
|
5556
|
-
y:
|
|
5557
|
-
} }, e), n = new
|
|
5558
|
-
for (; n.isNull;) n.x =
|
|
5559
|
-
return t.slope === 1 ? n.x.sign() !== n.y.sign() && n.y.opposite() : t.slope === -1 && n.x.sign() !== n.y.sign() && n.y.opposite(), new
|
|
4529
|
+
x: W(10),
|
|
4530
|
+
y: W(10)
|
|
4531
|
+
} }, e), n = new V(0, 0);
|
|
4532
|
+
for (; n.isNull;) n.x = W(10, t.allow?.vertical ?? !0), n.y = W(10, t.allow?.horizontal ?? !0);
|
|
4533
|
+
return t.slope === 1 ? n.x.sign() !== n.y.sign() && n.y.opposite() : t.slope === -1 && n.x.sign() !== n.y.sign() && n.y.opposite(), new K().fromPointAndDirection(new V(t.A.x, t.A.y), n);
|
|
5560
4534
|
}
|
|
5561
4535
|
//#endregion
|
|
5562
4536
|
//#region src/randomization/geometry/rndLine3.ts
|
|
5563
|
-
function
|
|
4537
|
+
function Ve(e) {
|
|
5564
4538
|
let t = Object.assign({
|
|
5565
4539
|
A: {
|
|
5566
|
-
x:
|
|
5567
|
-
y:
|
|
5568
|
-
z:
|
|
4540
|
+
x: W(10),
|
|
4541
|
+
y: W(10),
|
|
4542
|
+
z: W(10)
|
|
5569
4543
|
},
|
|
5570
4544
|
direction: {
|
|
5571
|
-
x:
|
|
5572
|
-
y:
|
|
5573
|
-
z:
|
|
4545
|
+
x: W(10),
|
|
4546
|
+
y: W(10),
|
|
4547
|
+
z: W(10)
|
|
5574
4548
|
}
|
|
5575
4549
|
}, e);
|
|
5576
|
-
return new
|
|
4550
|
+
return new Y(new B(t.A.x, t.A.y, t.A.z), new V(t.direction.x, t.direction.y, t.direction.z));
|
|
5577
4551
|
}
|
|
5578
4552
|
//#endregion
|
|
5579
4553
|
//#region src/randomization/random.ts
|
|
5580
|
-
var
|
|
5581
|
-
equation: (e) =>
|
|
4554
|
+
var He = {
|
|
4555
|
+
equation: (e) => Re(e),
|
|
5582
4556
|
polynom: (e) => Q(e),
|
|
5583
|
-
monom: (e) =>
|
|
4557
|
+
monom: (e) => Fe(e),
|
|
5584
4558
|
fraction: (e) => Z(e),
|
|
5585
|
-
number: (e, t, n) =>
|
|
5586
|
-
numberSym: (e, t) =>
|
|
5587
|
-
prime: (e) =>
|
|
5588
|
-
triplet: (e, t) =>
|
|
5589
|
-
bool: (e) =>
|
|
5590
|
-
array: (e, t) =>
|
|
5591
|
-
item: (e) =>
|
|
5592
|
-
shuffle: (e) =>
|
|
5593
|
-
line: (e) =>
|
|
5594
|
-
line3: (e) =>
|
|
5595
|
-
vector: (e) => new
|
|
4559
|
+
number: (e, t, n) => U(e, t, n),
|
|
4560
|
+
numberSym: (e, t) => W(e, t),
|
|
4561
|
+
prime: (e) => Ae(e),
|
|
4562
|
+
triplet: (e, t) => ke(e, t),
|
|
4563
|
+
bool: (e) => Oe(e),
|
|
4564
|
+
array: (e, t) => je(e, t),
|
|
4565
|
+
item: (e) => G(e),
|
|
4566
|
+
shuffle: (e) => Me(e),
|
|
4567
|
+
line: (e) => Be(e),
|
|
4568
|
+
line3: (e) => Ve(e),
|
|
4569
|
+
vector: (e) => new V($(e)),
|
|
5596
4570
|
point: (e) => $(e),
|
|
5597
|
-
circle: (e) =>
|
|
5598
|
-
},
|
|
5599
|
-
Numeric:
|
|
5600
|
-
Fraction:
|
|
4571
|
+
circle: (e) => ze(e)
|
|
4572
|
+
}, Ue = {
|
|
4573
|
+
Numeric: g,
|
|
4574
|
+
Fraction: _,
|
|
5601
4575
|
Root: v,
|
|
5602
|
-
Monom:
|
|
5603
|
-
Polynom:
|
|
5604
|
-
Equation:
|
|
5605
|
-
Matrix:
|
|
5606
|
-
LinearSystem:
|
|
5607
|
-
Factor:
|
|
5608
|
-
PolyFactor:
|
|
5609
|
-
LogicalSet:
|
|
5610
|
-
Random:
|
|
4576
|
+
Monom: O,
|
|
4577
|
+
Polynom: N,
|
|
4578
|
+
Equation: P,
|
|
4579
|
+
Matrix: Se,
|
|
4580
|
+
LinearSystem: be,
|
|
4581
|
+
Factor: F,
|
|
4582
|
+
PolyFactor: L,
|
|
4583
|
+
LogicalSet: xe,
|
|
4584
|
+
Random: He,
|
|
5611
4585
|
Geometry: {
|
|
5612
|
-
Vector:
|
|
5613
|
-
Point:
|
|
5614
|
-
Line:
|
|
5615
|
-
Triangle:
|
|
5616
|
-
Circle:
|
|
5617
|
-
Line3:
|
|
5618
|
-
Plane3:
|
|
5619
|
-
Sphere3:
|
|
4586
|
+
Vector: V,
|
|
4587
|
+
Point: B,
|
|
4588
|
+
Line: K,
|
|
4589
|
+
Triangle: q,
|
|
4590
|
+
Circle: J,
|
|
4591
|
+
Line3: Y,
|
|
4592
|
+
Plane3: Ne,
|
|
4593
|
+
Sphere3: Pe
|
|
5620
4594
|
},
|
|
5621
4595
|
Errors: {
|
|
5622
4596
|
PiMathError: e,
|
|
@@ -5628,9 +4602,9 @@ var ze = {
|
|
|
5628
4602
|
IndexError: o,
|
|
5629
4603
|
StateError: s
|
|
5630
4604
|
},
|
|
5631
|
-
NumExp:
|
|
4605
|
+
NumExp: ve
|
|
5632
4606
|
};
|
|
5633
4607
|
//#endregion
|
|
5634
|
-
export {
|
|
4608
|
+
export { J as Circle, n as DimensionError, P as Equation, b as EquationSolver, I as FACTOR_DISPLAY, oe as FRAC_TYPE, F as Factor, _ as Fraction, o as IndexError, i as InvalidArgumentError, K as Line, Y as Line3, be as LinearSystem, xe as LogicalSet, r as MathError, Se as Matrix, O as Monom, a as NotImplementedError, ve as NumExp, g as Numeric, t as ParseError, e as PiMathError, Ne as Plane3, B as Point, L as PolyFactor, N as Polynom, He as Random, v as Root, X as SPHERE3_RELATIVE_POSITION, y as Solution, Pe as Sphere3, s as StateError, se as TableOfSigns, q as Triangle, V as Vector, we as areVectorsColinears, Ce as areVectorsEquals, Ue as default, Ee as determinantFromVectors, Te as dotProduct };
|
|
5635
4609
|
|
|
5636
4610
|
//# sourceMappingURL=pimath.js.map
|