pimath 0.1.38 → 0.1.40
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 +190 -161
- package/dist/pimath.js.map +1 -1
- package/package.json +4 -2
- package/src/algebra/equation.ts +556 -0
- package/src/algebra/equationSolver.ts +539 -0
- package/src/algebra/factor.ts +339 -0
- package/src/algebra/index.ts +11 -0
- package/src/algebra/linearSystem.ts +388 -0
- package/src/algebra/logicalset.ts +256 -0
- package/src/algebra/matrix.ts +474 -0
- package/src/algebra/monom.ts +1015 -0
- package/src/algebra/operations.ts +24 -0
- package/src/algebra/polyFactor.ts +668 -0
- package/src/algebra/polynom.ts +1394 -0
- package/src/analyze/solution.ts +115 -0
- package/src/analyze/tableOfSigns.ts +30 -0
- package/src/coefficients/fraction.ts +678 -0
- package/src/coefficients/index.ts +4 -0
- package/src/coefficients/nthRoot.ts +149 -0
- package/src/coefficients/root.ts +299 -0
- package/src/geometry/circle.ts +386 -0
- package/src/geometry/geomMath.ts +70 -0
- package/src/geometry/index.ts +10 -0
- package/src/geometry/line.ts +677 -0
- package/src/geometry/line3.ts +206 -0
- package/src/geometry/plane3.ts +170 -0
- package/src/geometry/point.ts +66 -0
- package/src/geometry/sphere3.ts +214 -0
- package/src/geometry/triangle.ts +354 -0
- package/src/geometry/vector.ts +341 -0
- package/src/helpers.ts +35 -0
- package/src/index.ts +60 -0
- package/src/numeric.ts +199 -0
- package/src/pimath.interface.ts +160 -0
- package/src/randomization/algebra/rndEquation.ts +41 -0
- package/src/randomization/algebra/rndMonom.ts +39 -0
- package/src/randomization/algebra/rndPolynom.ts +86 -0
- package/src/randomization/coefficient/rndFraction.ts +38 -0
- package/src/randomization/geometry/rndCircle.ts +27 -0
- package/src/randomization/geometry/rndLine.ts +37 -0
- package/src/randomization/geometry/rndLine3.ts +27 -0
- package/src/randomization/geometry/rndVector.ts +63 -0
- package/src/randomization/random.ts +91 -0
- package/src/randomization/rndHelpers.ts +102 -0
- package/src/randomization/rndTypes.ts +63 -0
- package/types/algebra/equationSolver.d.ts +3 -0
- package/types/algebra/equationSolver.d.ts.map +1 -1
- package/types/algebra/polyFactor.d.ts +5 -0
- package/types/algebra/polyFactor.d.ts.map +1 -1
- package/types/analyze/solution.d.ts +21 -0
- package/types/analyze/solution.d.ts.map +1 -0
- package/types/analyze/tableOfSigns.d.ts +9 -0
- package/types/analyze/tableOfSigns.d.ts.map +1 -0
- package/types/coefficients/fraction.d.ts +1 -1
- package/types/coefficients/fraction.d.ts.map +1 -1
- package/types/coefficients/root.d.ts +38 -0
- package/types/coefficients/root.d.ts.map +1 -0
- package/types/geometry/point.d.ts +1 -1
- package/types/geometry/point.d.ts.map +1 -1
- package/types/helpers.d.ts +1 -0
- package/types/helpers.d.ts.map +1 -1
- package/types/index.d.ts +1 -0
- package/types/index.d.ts.map +1 -1
- package/types/numeric.d.ts +2 -0
- package/types/numeric.d.ts.map +1 -1
- package/types/pimath.interface.d.ts +26 -26
- package/types/pimath.interface.d.ts.map +1 -1
package/dist/pimath.js
CHANGED
|
@@ -59,6 +59,14 @@ function me(r, e) {
|
|
|
59
59
|
function ge(r, e = 2) {
|
|
60
60
|
return +`${Math.round(+`${r}e${e}`)}e-${e}`;
|
|
61
61
|
}
|
|
62
|
+
function we(r, e) {
|
|
63
|
+
let t = Math.floor(Math.pow(r, 1 / e)), i = r, s = 1;
|
|
64
|
+
for (; t > 1; ) {
|
|
65
|
+
const n = Math.pow(t, e);
|
|
66
|
+
i % n ? (s *= t, i = i / n, t = Math.floor(Math.pow(i, 1 / e))) : t--;
|
|
67
|
+
}
|
|
68
|
+
return s;
|
|
69
|
+
}
|
|
62
70
|
const E = {
|
|
63
71
|
decompose: le,
|
|
64
72
|
dividers: ie,
|
|
@@ -69,9 +77,10 @@ const E = {
|
|
|
69
77
|
periodic: de,
|
|
70
78
|
primes: pe,
|
|
71
79
|
pythagoreanTripletsWithTarget: me,
|
|
72
|
-
round: ge
|
|
80
|
+
round: ge,
|
|
81
|
+
greatestPower: we
|
|
73
82
|
};
|
|
74
|
-
var
|
|
83
|
+
var ye = /* @__PURE__ */ ((r) => (r.frac = "frac", r.dfrac = "dfrac", r.tfrac = "tfrac", r))(ye || {});
|
|
75
84
|
class a {
|
|
76
85
|
#i = !1;
|
|
77
86
|
#e = 1;
|
|
@@ -238,8 +247,8 @@ class a {
|
|
|
238
247
|
infinite = () => (this.#t = 1 / 0, this.#e = 1, this);
|
|
239
248
|
invalid = () => (this.#t = NaN, this.#e = 1, this);
|
|
240
249
|
inverse = () => {
|
|
241
|
-
const e =
|
|
242
|
-
return this.#t =
|
|
250
|
+
const e = this.sign(), t = Math.abs(this.#t);
|
|
251
|
+
return this.#t = Math.abs(this.#e) * e, this.#e = t, this;
|
|
243
252
|
};
|
|
244
253
|
isApproximative = () => this.#i || this.#t.toString().length >= 15 && this.#e.toString().length >= 15;
|
|
245
254
|
isEqual = (e) => this.compare(e, "=");
|
|
@@ -326,7 +335,7 @@ class a {
|
|
|
326
335
|
}
|
|
327
336
|
zero = () => (this.#t = 0, this.#e = 1, this);
|
|
328
337
|
}
|
|
329
|
-
class
|
|
338
|
+
class U {
|
|
330
339
|
#i;
|
|
331
340
|
#e;
|
|
332
341
|
#t;
|
|
@@ -390,82 +399,96 @@ class j {
|
|
|
390
399
|
// ------------------------------------------
|
|
391
400
|
hasRadical = () => !(this.#i === 1 || this.#i === 0 || !this.#s);
|
|
392
401
|
}
|
|
393
|
-
class
|
|
402
|
+
class V {
|
|
394
403
|
#i;
|
|
395
404
|
#e;
|
|
405
|
+
#t;
|
|
406
|
+
#s;
|
|
396
407
|
constructor(e, t, i = "x") {
|
|
397
|
-
if (this.#e = i, Object.hasOwn(e, "moveLeft")) {
|
|
408
|
+
if (this.#s = i, this.#e = 1e-4, this.#i = 0, Object.hasOwn(e, "moveLeft")) {
|
|
398
409
|
const s = e;
|
|
399
|
-
this.#
|
|
410
|
+
this.#t = s.left.clone().subtract(s.right);
|
|
400
411
|
} else
|
|
401
|
-
this.#
|
|
412
|
+
this.#t = e.clone().subtract(t ?? 0);
|
|
413
|
+
}
|
|
414
|
+
get bissectionCompexityCounter() {
|
|
415
|
+
return this.#i;
|
|
416
|
+
}
|
|
417
|
+
get bissectionDeltaX() {
|
|
418
|
+
return this.#e;
|
|
419
|
+
}
|
|
420
|
+
set bissectionDeltaX(e) {
|
|
421
|
+
this.#e = e;
|
|
402
422
|
}
|
|
403
423
|
solve() {
|
|
404
|
-
const e = this.#
|
|
424
|
+
const e = this.#t.degree().value;
|
|
405
425
|
if (e === 0)
|
|
406
426
|
return [];
|
|
407
427
|
if (e === 1)
|
|
408
|
-
return this.#
|
|
428
|
+
return this.#f();
|
|
409
429
|
if (e === 2)
|
|
410
|
-
return this.#
|
|
411
|
-
const { solutions: t, polynom: i } = this.#
|
|
412
|
-
return i.degree().isZero() ? t : t.concat(
|
|
413
|
-
|
|
414
|
-
)
|
|
430
|
+
return this.#d();
|
|
431
|
+
const { solutions: t, polynom: i } = this.#l();
|
|
432
|
+
return i.degree().isZero() ? t : i.degree().value <= 2 ? t.concat(
|
|
433
|
+
new V(i.clone()).solve()
|
|
434
|
+
) : (this.#i = 0, t.concat(
|
|
435
|
+
this.#o(i)
|
|
436
|
+
).sort((s, n) => s.value - n.value));
|
|
415
437
|
}
|
|
416
438
|
solveAsCardan() {
|
|
417
|
-
if (this.#
|
|
439
|
+
if (this.#t.degree().value !== 3)
|
|
418
440
|
throw new Error("The equation is not cubic.");
|
|
419
|
-
return this.#
|
|
441
|
+
return this.#u();
|
|
420
442
|
}
|
|
421
|
-
#
|
|
443
|
+
#n(e, t) {
|
|
422
444
|
return {
|
|
423
|
-
variable: this.#
|
|
445
|
+
variable: this.#s,
|
|
424
446
|
exact: !1,
|
|
425
447
|
value: +e.toFixed(10),
|
|
426
448
|
tex: t?.tex ?? "",
|
|
427
449
|
display: t?.display ?? ""
|
|
428
450
|
};
|
|
429
451
|
}
|
|
430
|
-
#
|
|
452
|
+
#r(e) {
|
|
431
453
|
if (e instanceof a && e.isApproximative())
|
|
432
|
-
return this.#
|
|
454
|
+
return this.#n(e.value);
|
|
433
455
|
const t = new a(e);
|
|
434
456
|
return {
|
|
435
|
-
variable: this.#
|
|
457
|
+
variable: this.#s,
|
|
436
458
|
exact: t,
|
|
437
459
|
value: t.value,
|
|
438
460
|
tex: t.tex,
|
|
439
461
|
display: t.display
|
|
440
462
|
};
|
|
441
463
|
}
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
464
|
+
// Solve using bissection algorithm (approximative solution)
|
|
465
|
+
#o(e) {
|
|
466
|
+
const t = [], i = e.degree().value, [s, ...n] = e.getCoefficients(), o = 2 + Math.max(...n.map((c) => c.value / s.value)), h = this.#a(e, o, 100);
|
|
467
|
+
return this.#c(h, i).forEach((c) => {
|
|
468
|
+
const [d, m] = c;
|
|
469
|
+
if (d === m)
|
|
470
|
+
t.push(this.#r(d));
|
|
448
471
|
else {
|
|
449
|
-
const
|
|
450
|
-
|
|
472
|
+
const w = this.#h(e, d, m);
|
|
473
|
+
w !== null && t.push(this.#n(w));
|
|
451
474
|
}
|
|
452
|
-
}), t;
|
|
475
|
+
}), console.log("COMPLEXITY: ", this.#i), t;
|
|
453
476
|
}
|
|
454
|
-
#
|
|
455
|
-
let
|
|
456
|
-
if (
|
|
477
|
+
#h(e, t, i) {
|
|
478
|
+
let s = e.evaluate(t, !0), n = e.evaluate(i, !0);
|
|
479
|
+
if (s * n > 0)
|
|
457
480
|
return console.log("Pas de racine dans l'intervalle donné"), null;
|
|
458
|
-
let
|
|
459
|
-
for (; (
|
|
460
|
-
|
|
461
|
-
const
|
|
462
|
-
if (
|
|
463
|
-
return
|
|
464
|
-
|
|
481
|
+
let o;
|
|
482
|
+
for (; (i - t) / 2 > this.#e; ) {
|
|
483
|
+
this.#i++, o = (t + i) / 2;
|
|
484
|
+
const h = e.evaluate(o, !0);
|
|
485
|
+
if (h === 0)
|
|
486
|
+
return o;
|
|
487
|
+
s * h < 0 ? (i = o, n = h) : (t = o, s = h);
|
|
465
488
|
}
|
|
466
|
-
return (
|
|
489
|
+
return (t + i) / 2;
|
|
467
490
|
}
|
|
468
|
-
#
|
|
491
|
+
#a(e, t, i) {
|
|
469
492
|
const s = [], n = 2 * t / i;
|
|
470
493
|
for (let o = -t; o <= t; o += n) {
|
|
471
494
|
const h = E.numberCorrection(o);
|
|
@@ -478,7 +501,7 @@ class W {
|
|
|
478
501
|
}
|
|
479
502
|
return s;
|
|
480
503
|
}
|
|
481
|
-
#
|
|
504
|
+
#c(e, t) {
|
|
482
505
|
const i = [];
|
|
483
506
|
for (let s = 1; s < e.length; s++) {
|
|
484
507
|
const n = e[s], o = e[s - 1];
|
|
@@ -487,12 +510,12 @@ class W {
|
|
|
487
510
|
}
|
|
488
511
|
return i;
|
|
489
512
|
}
|
|
490
|
-
#
|
|
491
|
-
const e = this.#
|
|
513
|
+
#l() {
|
|
514
|
+
const e = this.#t.clone(), t = [], i = e.lcmDenominator();
|
|
492
515
|
i !== 1 && e.multiply(i);
|
|
493
516
|
const s = e.monomByDegree().coefficient, n = e.monomByDegree(0).coefficient;
|
|
494
517
|
if (n.isZero()) {
|
|
495
|
-
t.push(this.#
|
|
518
|
+
t.push(this.#r(0));
|
|
496
519
|
const m = e.monoms.reduce((N, A) => A.degree().value < N.degree().value ? A : N), w = m.coefficient;
|
|
497
520
|
m.clone().divide(w), e.divide(m);
|
|
498
521
|
}
|
|
@@ -503,7 +526,7 @@ class W {
|
|
|
503
526
|
l.find((A) => A.value === N.value) || (l.push(N.clone()), l.push(N.opposite().clone()));
|
|
504
527
|
}
|
|
505
528
|
l.forEach((m) => {
|
|
506
|
-
e.evaluate(m).isZero() && t.push(this.#
|
|
529
|
+
e.evaluate(m).isZero() && t.push(this.#r(m));
|
|
507
530
|
});
|
|
508
531
|
for (const m of t) {
|
|
509
532
|
if (m.exact.isZero())
|
|
@@ -517,74 +540,74 @@ class W {
|
|
|
517
540
|
}
|
|
518
541
|
if (e.degree().isZero() || e.degree().value > 3)
|
|
519
542
|
return t.sort((m, w) => m.value - w.value), { solutions: t, polynom: e };
|
|
520
|
-
const c = e.clone().zero(), d = new
|
|
543
|
+
const c = e.clone().zero(), d = new V(e, c, this.#s);
|
|
521
544
|
return {
|
|
522
545
|
solutions: t.concat(d.solve()).sort((m, w) => m.value - w.value),
|
|
523
546
|
polynom: c
|
|
524
547
|
};
|
|
525
548
|
}
|
|
526
|
-
#
|
|
527
|
-
const e = this.#
|
|
549
|
+
#u() {
|
|
550
|
+
const e = this.#t, t = e.monomByDegree(3).coefficient, i = e.monomByDegree(2).coefficient, s = e.monomByDegree(1).coefficient, n = e.monomByDegree(0).coefficient, o = i.clone().divide(t), h = s.clone().divide(t), l = n.clone().divide(t), c = h.clone().subtract(o.clone().pow(2).divide(3)), d = l.clone().subtract(o.clone().multiply(h).divide(3)).add(o.clone().pow(3).multiply(2).divide(27)), m = d.clone().opposite(), w = c.clone().opposite().pow(3).divide(27), N = m.clone().pow(2).subtract(w.clone().multiply(4)).opposite();
|
|
528
551
|
if (N.isNegative()) {
|
|
529
552
|
const A = d.clone().opposite().add(N.clone().opposite().sqrt()).divide(2).root(3), C = d.clone().opposite().subtract(N.clone().opposite().sqrt()).divide(2).root(3), O = A.clone().add(C).subtract(o.clone().divide(3));
|
|
530
|
-
return [this.#
|
|
553
|
+
return [this.#r(O)];
|
|
531
554
|
}
|
|
532
555
|
if (N.isZero()) {
|
|
533
556
|
const A = d.clone().opposite().divide(2).root(3), C = A.clone().opposite().subtract(o.clone().divide(3)), O = A.clone().multiply(2).subtract(o.clone().divide(3));
|
|
534
|
-
return C.isEqual(O) ? [this.#
|
|
535
|
-
this.#
|
|
536
|
-
this.#
|
|
557
|
+
return C.isEqual(O) ? [this.#r(C)] : [
|
|
558
|
+
this.#r(O),
|
|
559
|
+
this.#r(C)
|
|
537
560
|
].sort((M, $) => M.value - $.value);
|
|
538
561
|
}
|
|
539
562
|
if (N.isPositive()) {
|
|
540
563
|
const A = [], C = c.value, O = d.value, M = o.value;
|
|
541
564
|
for (let $ = 0; $ < 3; $++)
|
|
542
565
|
A.push(2 * Math.sqrt(-C / 3) * Math.cos(Math.acos(3 * O / (2 * C) * Math.sqrt(-3 / C)) / 3 + 2 * Math.PI * $ / 3) - M / 3);
|
|
543
|
-
return A.map(($) => this.#
|
|
566
|
+
return A.map(($) => this.#n($)).sort(($, I) => $.value - I.value);
|
|
544
567
|
}
|
|
545
568
|
return [];
|
|
546
569
|
}
|
|
547
|
-
#
|
|
548
|
-
const [e, t] = this.#
|
|
570
|
+
#f() {
|
|
571
|
+
const [e, t] = this.#t.getCoefficients(), i = t.opposite().divide(e);
|
|
549
572
|
return [
|
|
550
|
-
this.#
|
|
573
|
+
this.#r(i)
|
|
551
574
|
];
|
|
552
575
|
}
|
|
553
|
-
#
|
|
554
|
-
const e = this.#
|
|
576
|
+
#d() {
|
|
577
|
+
const e = this.#t;
|
|
555
578
|
e.monomByDegree().coefficient.isNegative() && e.opposite();
|
|
556
579
|
const [t, i, s] = e.getCoefficients(), n = i.clone().pow(2).subtract(t.clone().multiply(s).multiply(4));
|
|
557
580
|
if (n.isNegative())
|
|
558
581
|
return [];
|
|
559
582
|
if (n.isSquare()) {
|
|
560
583
|
const o = n.sqrt(), h = i.clone().opposite().subtract(o).divide(t.clone().multiply(2)), l = i.clone().opposite().add(o).divide(t.clone().multiply(2));
|
|
561
|
-
return o.isZero() ? [this.#
|
|
562
|
-
this.#
|
|
563
|
-
this.#
|
|
584
|
+
return o.isZero() ? [this.#r(h)] : [
|
|
585
|
+
this.#r(h),
|
|
586
|
+
this.#r(l)
|
|
564
587
|
].sort((c, d) => c.value - d.value);
|
|
565
588
|
}
|
|
566
|
-
return this.#
|
|
589
|
+
return this.#p(t, i, n);
|
|
567
590
|
}
|
|
568
|
-
#
|
|
591
|
+
#p(e, t, i) {
|
|
569
592
|
const s = E.dividers(i.value).filter((O) => Math.sqrt(O) % 1 === 0).map((O) => Math.sqrt(O)).pop() ?? 1, n = E.gcd(2 * e.value, t.value, s) * (e.isNegative() ? -1 : 1), o = t.clone().divide(n).opposite(), h = e.clone().divide(n).multiply(2), l = Math.abs(s / n), c = `${s === 1 ? "" : l + " "}\\sqrt{ ${i.clone().divide(s ** 2).tex} }`, d = `${s === 1 ? "" : l}sqrt(${i.clone().divide(s ** 2).display})`;
|
|
570
|
-
function m(O, M, $,
|
|
593
|
+
function m(O, M, $, I) {
|
|
571
594
|
const R = M === "0" ? "" : M, P = $ === "-" || R !== "" ? ` ${$} ` : "";
|
|
572
|
-
return O === "1" ? `${R}${P}${
|
|
595
|
+
return O === "1" ? `${R}${P}${I}` : `\\frac{ ${P}${P}${I} }{ ${O} }`;
|
|
573
596
|
}
|
|
574
|
-
function w(O, M, $,
|
|
597
|
+
function w(O, M, $, I) {
|
|
575
598
|
const R = M === "0" ? "" : M, P = $ === "-" || R !== "" ? $ : "";
|
|
576
|
-
return O === "1" ? `${R}${P}${
|
|
599
|
+
return O === "1" ? `${R}${P}${I}` : `(${R}${P}${I})/${O}`;
|
|
577
600
|
}
|
|
578
601
|
const N = i.value ** 0.5, A = (-t.value - N) / (2 * e.value), C = (-t.value + N) / (2 * e.value);
|
|
579
602
|
return [
|
|
580
|
-
this.#
|
|
603
|
+
this.#n(
|
|
581
604
|
A,
|
|
582
605
|
{
|
|
583
606
|
tex: m(h.tex, o.tex, "-", c),
|
|
584
607
|
display: w(h.display, o.display, "-", d)
|
|
585
608
|
}
|
|
586
609
|
),
|
|
587
|
-
this.#
|
|
610
|
+
this.#n(
|
|
588
611
|
C,
|
|
589
612
|
{
|
|
590
613
|
tex: m(h.tex, o.tex, "+", c),
|
|
@@ -599,7 +622,7 @@ const J = {
|
|
|
599
622
|
e: Math.exp(1)
|
|
600
623
|
};
|
|
601
624
|
var f = /* @__PURE__ */ ((r) => (r.VARIABLE = "variable", r.COEFFICIENT = "coefficient", r.OPERATION = "operation", r.CONSTANT = "constant", r.FUNCTION = "function", r.FUNCTION_ARGUMENT = "function-argument", r.MONOM = "monom", r.LEFT_PARENTHESIS = "(", r.RIGHT_PARENTHESIS = ")", r))(f || {}), z = /* @__PURE__ */ ((r) => (r.EXPRESSION = "expression", r.POLYNOM = "polynom", r.SET = "set", r.NUMERIC = "numeric", r))(z || {});
|
|
602
|
-
function
|
|
625
|
+
function ve(r, e) {
|
|
603
626
|
if (r.length <= 1)
|
|
604
627
|
return r;
|
|
605
628
|
const t = Object.keys(e).filter((m) => e[m].type === f.FUNCTION).map((m) => m);
|
|
@@ -646,20 +669,20 @@ function ye(r, e) {
|
|
|
646
669
|
}
|
|
647
670
|
if (d === void 0 || c === void 0)
|
|
648
671
|
throw new Error("The token is undefined");
|
|
649
|
-
h +=
|
|
672
|
+
h += be(l, c), h += d;
|
|
650
673
|
}
|
|
651
674
|
return h;
|
|
652
675
|
}
|
|
653
|
-
function
|
|
676
|
+
function be(r, e) {
|
|
654
677
|
return r === void 0 || r === f.OPERATION || e === f.OPERATION || r === f.LEFT_PARENTHESIS || r === f.FUNCTION || r === f.FUNCTION_ARGUMENT || e === f.RIGHT_PARENTHESIS || e === f.FUNCTION_ARGUMENT ? "" : "*";
|
|
655
678
|
}
|
|
656
|
-
const
|
|
679
|
+
const xe = {
|
|
657
680
|
"^": { precedence: 4, associative: "right", type: f.OPERATION },
|
|
658
681
|
"*": { precedence: 3, associative: "left", type: f.OPERATION },
|
|
659
682
|
"/": { precedence: 3, associative: "left", type: f.OPERATION },
|
|
660
683
|
"+": { precedence: 2, associative: "left", type: f.OPERATION },
|
|
661
684
|
"-": { precedence: 2, associative: "left", type: f.OPERATION }
|
|
662
|
-
},
|
|
685
|
+
}, Ee = {
|
|
663
686
|
"^": { precedence: 4, associative: "right", type: f.OPERATION },
|
|
664
687
|
"*": { precedence: 3, associative: "left", type: f.OPERATION },
|
|
665
688
|
"/": { precedence: 3, associative: "left", type: f.OPERATION },
|
|
@@ -672,7 +695,7 @@ const be = {
|
|
|
672
695
|
sqrt: { precedence: 4, associative: "right", type: f.FUNCTION },
|
|
673
696
|
nthrt: { precedence: 4, associative: "right", type: f.FUNCTION },
|
|
674
697
|
",": { precedence: 2, associative: "left", type: f.FUNCTION_ARGUMENT }
|
|
675
|
-
},
|
|
698
|
+
}, Ne = {
|
|
676
699
|
"^": { precedence: 4, associative: "right", type: f.OPERATION },
|
|
677
700
|
"*": { precedence: 3, associative: "left", type: f.OPERATION },
|
|
678
701
|
"/": { precedence: 3, associative: "left", type: f.OPERATION },
|
|
@@ -686,13 +709,13 @@ const be = {
|
|
|
686
709
|
nthrt: { precedence: 4, associative: "right", type: f.FUNCTION },
|
|
687
710
|
ln: { precedence: 4, associative: "right", type: f.FUNCTION },
|
|
688
711
|
log: { precedence: 4, associative: "right", type: f.FUNCTION }
|
|
689
|
-
},
|
|
712
|
+
}, Ae = {
|
|
690
713
|
"&": { precedence: 3, associative: "left", type: f.OPERATION },
|
|
691
714
|
"|": { precedence: 3, associative: "left", type: f.OPERATION },
|
|
692
715
|
"!": { precedence: 4, associative: "right", type: f.OPERATION },
|
|
693
716
|
"-": { precedence: 2, associative: "left", type: f.OPERATION }
|
|
694
717
|
};
|
|
695
|
-
class
|
|
718
|
+
class W {
|
|
696
719
|
#i;
|
|
697
720
|
#e = [];
|
|
698
721
|
#t = {};
|
|
@@ -709,7 +732,7 @@ class X {
|
|
|
709
732
|
return this.#e.map((e) => e.token);
|
|
710
733
|
}
|
|
711
734
|
tokenConfigInitialization() {
|
|
712
|
-
return this.#i === z.SET ? (this.#t =
|
|
735
|
+
return this.#i === z.SET ? (this.#t = Ae, this.#n = !1) : this.#i === z.NUMERIC ? (this.#t = Ne, this.#n = !0) : this.#i === z.EXPRESSION ? (this.#t = Ee, this.#n = !0) : (this.#t = xe, this.#n = !0), this.#s = Object.keys(this.#t).sort((e, t) => t.length - e.length), this.#t;
|
|
713
736
|
}
|
|
714
737
|
/**
|
|
715
738
|
* Get the next token to analyse.
|
|
@@ -758,7 +781,7 @@ class X {
|
|
|
758
781
|
parse(e, t) {
|
|
759
782
|
const i = [], s = [];
|
|
760
783
|
let n = "", o = 0, h;
|
|
761
|
-
(t ?? this.#n) && (e =
|
|
784
|
+
(t ?? this.#n) && (e = ve(e, this.#t));
|
|
762
785
|
let l = 50, c;
|
|
763
786
|
for (; o < e.length; ) {
|
|
764
787
|
if (l--, l === 0) {
|
|
@@ -824,14 +847,14 @@ class X {
|
|
|
824
847
|
return this.#e = i.concat(s.reverse()), this;
|
|
825
848
|
}
|
|
826
849
|
}
|
|
827
|
-
class
|
|
850
|
+
class qe {
|
|
828
851
|
_rpn;
|
|
829
852
|
_expression;
|
|
830
853
|
_isValid;
|
|
831
854
|
constructor(e, t) {
|
|
832
855
|
this._expression = e;
|
|
833
856
|
try {
|
|
834
|
-
this._rpn = new
|
|
857
|
+
this._rpn = new W(z.NUMERIC).parse(e, t).rpn;
|
|
835
858
|
} catch (i) {
|
|
836
859
|
throw this._rpn = null, this._isValid = !1, console.warn(i), new Error(`There was a problem parsing: ${e}`);
|
|
837
860
|
}
|
|
@@ -1090,7 +1113,7 @@ class p {
|
|
|
1090
1113
|
if (t === !0) {
|
|
1091
1114
|
if (e instanceof a)
|
|
1092
1115
|
return this.#s(e.value);
|
|
1093
|
-
if (e instanceof
|
|
1116
|
+
if (e instanceof U)
|
|
1094
1117
|
return new a().invalid();
|
|
1095
1118
|
if (typeof e == "number")
|
|
1096
1119
|
return this.#s(e);
|
|
@@ -1106,7 +1129,7 @@ class p {
|
|
|
1106
1129
|
const s = {};
|
|
1107
1130
|
return s[this.variables[0]] = new a(e), this.evaluate(s);
|
|
1108
1131
|
}
|
|
1109
|
-
if (e instanceof
|
|
1132
|
+
if (e instanceof U)
|
|
1110
1133
|
return new a().invalid();
|
|
1111
1134
|
if (typeof e == "object") {
|
|
1112
1135
|
if (this.variables.length === 0)
|
|
@@ -1334,7 +1357,7 @@ class p {
|
|
|
1334
1357
|
const i = {};
|
|
1335
1358
|
return i[this.variables[0]] = new a(e).value, this.#s(i);
|
|
1336
1359
|
}
|
|
1337
|
-
if (e instanceof
|
|
1360
|
+
if (e instanceof U)
|
|
1338
1361
|
return NaN;
|
|
1339
1362
|
if (typeof e == "object") {
|
|
1340
1363
|
if (this.variables.length === 0)
|
|
@@ -1347,7 +1370,7 @@ class p {
|
|
|
1347
1370
|
return t;
|
|
1348
1371
|
};
|
|
1349
1372
|
#n = (e) => {
|
|
1350
|
-
const i = new
|
|
1373
|
+
const i = new W().parse(e).rpn, s = [];
|
|
1351
1374
|
if (i.length === 0)
|
|
1352
1375
|
return this.zero(), this;
|
|
1353
1376
|
if (i.length === 1) {
|
|
@@ -1401,7 +1424,7 @@ class p {
|
|
|
1401
1424
|
function te(r, e = !0) {
|
|
1402
1425
|
return e ? `\\left( ${r} \\right)` : `(${r})`;
|
|
1403
1426
|
}
|
|
1404
|
-
function
|
|
1427
|
+
function F(r, e, t, i, s) {
|
|
1405
1428
|
return r.map((n, o) => n === e ? t : n);
|
|
1406
1429
|
}
|
|
1407
1430
|
function se(r, e) {
|
|
@@ -1601,7 +1624,7 @@ class u {
|
|
|
1601
1624
|
e.push(t.coefficient.numerator);
|
|
1602
1625
|
return e;
|
|
1603
1626
|
};
|
|
1604
|
-
getZeroes = () => this.degree().isZero() ? [] : (this.roots = new
|
|
1627
|
+
getZeroes = () => this.degree().isZero() ? [] : (this.roots = new V(this.clone()).solve(), this.roots);
|
|
1605
1628
|
hasVariable(e) {
|
|
1606
1629
|
return this.variables.includes(e);
|
|
1607
1630
|
}
|
|
@@ -1805,7 +1828,7 @@ class u {
|
|
|
1805
1828
|
let t = new Array(2 * e.length + 1).fill("").map((i, s) => s % 2 === 0 ? "" : "z");
|
|
1806
1829
|
if (t.length === 1) {
|
|
1807
1830
|
const [i] = this.getCoefficients().map((s) => s.value);
|
|
1808
|
-
t =
|
|
1831
|
+
t = F(t, "", i > 0 ? "+" : "-");
|
|
1809
1832
|
} else if (this.degree().isOne()) {
|
|
1810
1833
|
const [i] = this.getCoefficients().map((s) => s.value);
|
|
1811
1834
|
t[0] = i > 0 ? "-" : "+", t[1] = "z", t[2] = i > 0 ? "+" : "-";
|
|
@@ -1960,7 +1983,7 @@ class u {
|
|
|
1960
1983
|
* @param inputStr
|
|
1961
1984
|
*/
|
|
1962
1985
|
#w = (e) => {
|
|
1963
|
-
const i = new
|
|
1986
|
+
const i = new W().parse(e).rpn;
|
|
1964
1987
|
this.zero();
|
|
1965
1988
|
const s = [];
|
|
1966
1989
|
for (const n of i)
|
|
@@ -2167,7 +2190,7 @@ class y {
|
|
|
2167
2190
|
*/
|
|
2168
2191
|
simplify = () => (this.multiply(E.lcm(...this.#i.getDenominators(), ...this.#e.getDenominators())), this.divide(E.gcd(...this.#i.getNumerators(), ...this.#e.getNumerators())), this);
|
|
2169
2192
|
// -----------------------------------------------
|
|
2170
|
-
solve = () => new
|
|
2193
|
+
solve = () => new V(this.clone()).solve();
|
|
2171
2194
|
split() {
|
|
2172
2195
|
return [this.#i.clone(), this.#e.clone()];
|
|
2173
2196
|
}
|
|
@@ -2372,7 +2395,7 @@ class x {
|
|
|
2372
2395
|
}
|
|
2373
2396
|
tableOfSigns() {
|
|
2374
2397
|
const e = this.power.clone().reduce(), t = this.polynom.tableOfSigns();
|
|
2375
|
-
return e.isStrictlyNegative() && (t.signs =
|
|
2398
|
+
return e.isStrictlyNegative() && (t.signs = F(t.signs, "z", "d")), e.denominator % 2 === 0 ? t.signs = F(t.signs, "-", "h") : e.numerator % 2 === 0 && (t.signs = F(t.signs, "-", "+")), { roots: t.roots, signs: t.signs };
|
|
2376
2399
|
}
|
|
2377
2400
|
get variables() {
|
|
2378
2401
|
return this.polynom.variables;
|
|
@@ -2565,7 +2588,7 @@ class D {
|
|
|
2565
2588
|
return [e, t];
|
|
2566
2589
|
};
|
|
2567
2590
|
}
|
|
2568
|
-
class
|
|
2591
|
+
class Te {
|
|
2569
2592
|
#i;
|
|
2570
2593
|
/**
|
|
2571
2594
|
*
|
|
@@ -2574,7 +2597,7 @@ class qe {
|
|
|
2574
2597
|
constructor(e) {
|
|
2575
2598
|
return this.#i = [], e !== void 0 && this.parse(e), this;
|
|
2576
2599
|
}
|
|
2577
|
-
parse = (e) => (this.#i = new
|
|
2600
|
+
parse = (e) => (this.#i = new W(z.SET).parse(e).rpn, this);
|
|
2578
2601
|
evaluate(e) {
|
|
2579
2602
|
this.variables.forEach((i) => {
|
|
2580
2603
|
Object.hasOwn(e, i) || (e[i] = !1);
|
|
@@ -2861,6 +2884,12 @@ class T {
|
|
|
2861
2884
|
}
|
|
2862
2885
|
return this;
|
|
2863
2886
|
}
|
|
2887
|
+
/**
|
|
2888
|
+
* Get the roots of the PolyFactor.
|
|
2889
|
+
*/
|
|
2890
|
+
getRoots() {
|
|
2891
|
+
return [];
|
|
2892
|
+
}
|
|
2864
2893
|
getZeroes() {
|
|
2865
2894
|
const e = [].concat(...this.#e.map((t) => t.polynom.getZeroes()));
|
|
2866
2895
|
return e.sort((t, i) => t.value - i.value), e.filter(
|
|
@@ -2991,7 +3020,7 @@ function L(r) {
|
|
|
2991
3020
|
}, {}), { numerator: s, denominator: n } = e.divide(t).reduce();
|
|
2992
3021
|
return s !== 1 && (i[s.toString()] = [new x(s, 1)]), n !== 1 && (i[n.toString()] = [new x(n, -1)]), i;
|
|
2993
3022
|
}
|
|
2994
|
-
class
|
|
3023
|
+
class S {
|
|
2995
3024
|
#i = null;
|
|
2996
3025
|
#e = !0;
|
|
2997
3026
|
#t = [];
|
|
@@ -3008,7 +3037,7 @@ class I {
|
|
|
3008
3037
|
t.forEach((s) => {
|
|
3009
3038
|
i.push(s.clone());
|
|
3010
3039
|
}), e.push(i);
|
|
3011
|
-
}), new
|
|
3040
|
+
}), new S().fromValues(e);
|
|
3012
3041
|
}
|
|
3013
3042
|
get tex() {
|
|
3014
3043
|
if (this.#t.length === 0)
|
|
@@ -3054,7 +3083,7 @@ class I {
|
|
|
3054
3083
|
}
|
|
3055
3084
|
characteristic_polynom(e) {
|
|
3056
3085
|
return e ??= "k", this.clone().subtract(
|
|
3057
|
-
new
|
|
3086
|
+
new S(this.dimension.rows).one().multiply(new u(e))
|
|
3058
3087
|
).determinant();
|
|
3059
3088
|
}
|
|
3060
3089
|
cofactor(e, t) {
|
|
@@ -3131,7 +3160,7 @@ class I {
|
|
|
3131
3160
|
inverse() {
|
|
3132
3161
|
if (!this.canBeInverted())
|
|
3133
3162
|
throw new Error("The matrix cannot be inverted.");
|
|
3134
|
-
const e = new
|
|
3163
|
+
const e = new S().fromDimensions(this.dimension.rows, this.dimension.cols);
|
|
3135
3164
|
e.forEach((i, s, n) => {
|
|
3136
3165
|
e.setValue(s, n, this.cofactor(s, n));
|
|
3137
3166
|
}), e.transpose();
|
|
@@ -3169,10 +3198,10 @@ class I {
|
|
|
3169
3198
|
}), s;
|
|
3170
3199
|
}
|
|
3171
3200
|
multiply(e) {
|
|
3172
|
-
if (e instanceof
|
|
3201
|
+
if (e instanceof S) {
|
|
3173
3202
|
if (!this.canBeMultiplied(e))
|
|
3174
3203
|
throw new Error("Cannot multiply a matrix with incompatibles dimensions");
|
|
3175
|
-
const t = new
|
|
3204
|
+
const t = new S(this.dimension.rows, e.dimension.cols);
|
|
3176
3205
|
return t.forEach((i, s, n) => {
|
|
3177
3206
|
const o = this.rows[s], h = e.cols[n], l = new u();
|
|
3178
3207
|
o.forEach((c, d) => {
|
|
@@ -3234,12 +3263,12 @@ class I {
|
|
|
3234
3263
|
return this.forEach((e) => e.zero()), this;
|
|
3235
3264
|
}
|
|
3236
3265
|
}
|
|
3237
|
-
function
|
|
3266
|
+
function Oe(r, e) {
|
|
3238
3267
|
return r.dimension === e.dimension && r.array.every(
|
|
3239
3268
|
(t, i) => e.array[i].isEqual(t)
|
|
3240
3269
|
);
|
|
3241
3270
|
}
|
|
3242
|
-
function
|
|
3271
|
+
function Ce(r, e) {
|
|
3243
3272
|
if (r.dimension !== e.dimension)
|
|
3244
3273
|
return !1;
|
|
3245
3274
|
const t = e.array[0].value / r.array[0].value;
|
|
@@ -3247,13 +3276,13 @@ function Oe(r, e) {
|
|
|
3247
3276
|
(i, s) => e.array[s].value === i.value * t
|
|
3248
3277
|
);
|
|
3249
3278
|
}
|
|
3250
|
-
function
|
|
3279
|
+
function $e(r, e) {
|
|
3251
3280
|
return r.dimension !== e.dimension ? new a().invalid() : r.array.reduce(
|
|
3252
3281
|
(t, i, s) => t.add(i.clone().multiply(e.array[s])),
|
|
3253
3282
|
new a(0)
|
|
3254
3283
|
);
|
|
3255
3284
|
}
|
|
3256
|
-
function
|
|
3285
|
+
function Le(...r) {
|
|
3257
3286
|
if (r.some((e) => e.dimension !== r[0].dimension))
|
|
3258
3287
|
throw new Error("All vectors must have the same dimension");
|
|
3259
3288
|
if (r[0].dimension !== r.length)
|
|
@@ -3395,7 +3424,7 @@ class g {
|
|
|
3395
3424
|
translate(...e) {
|
|
3396
3425
|
return this.array.forEach((t, i) => t.add(e[i])), this;
|
|
3397
3426
|
}
|
|
3398
|
-
dot = (e) =>
|
|
3427
|
+
dot = (e) => $e(this, e);
|
|
3399
3428
|
cross(e) {
|
|
3400
3429
|
if (this.dimension !== 3 || e.dimension !== 3)
|
|
3401
3430
|
throw new Error("Cross product can only be determined in 3D");
|
|
@@ -3417,8 +3446,8 @@ class g {
|
|
|
3417
3446
|
isOne() {
|
|
3418
3447
|
return this.array.every((e, t) => t === 0 ? e.isOne() : e.isZero());
|
|
3419
3448
|
}
|
|
3420
|
-
isEqual = (e) =>
|
|
3421
|
-
isColinearTo = (e) =>
|
|
3449
|
+
isEqual = (e) => Oe(this, e);
|
|
3450
|
+
isColinearTo = (e) => Ce(this, e);
|
|
3422
3451
|
isNormalTo = (e) => this.dot(e).isZero();
|
|
3423
3452
|
multiplyByScalar = (e) => {
|
|
3424
3453
|
const t = new a(e);
|
|
@@ -3471,11 +3500,11 @@ function k(r, e, t) {
|
|
|
3471
3500
|
function q(r, e) {
|
|
3472
3501
|
return e === !1 ? ne() ? k(1, r) : -k(1, r) : k(-r, r);
|
|
3473
3502
|
}
|
|
3474
|
-
function
|
|
3503
|
+
function ke(r) {
|
|
3475
3504
|
let e = E.primes();
|
|
3476
3505
|
return r !== void 0 && (e = e.filter((t) => t < r)), _(e);
|
|
3477
3506
|
}
|
|
3478
|
-
function
|
|
3507
|
+
function Be(r, e) {
|
|
3479
3508
|
return e === void 0 && (e = 1), r.length <= 0 ? Object.values(r) : re(r).slice(0, e);
|
|
3480
3509
|
}
|
|
3481
3510
|
function _(r) {
|
|
@@ -3491,10 +3520,10 @@ function re(r) {
|
|
|
3491
3520
|
}
|
|
3492
3521
|
class v extends g {
|
|
3493
3522
|
constructor(...e) {
|
|
3494
|
-
super(), e.length > 0 && this.parse(...e);
|
|
3523
|
+
super(), this.asPoint = !0, e.length > 0 && this.parse(...e);
|
|
3495
3524
|
}
|
|
3496
3525
|
parse(...e) {
|
|
3497
|
-
if (
|
|
3526
|
+
if (e.length === 1) {
|
|
3498
3527
|
if (e[0] instanceof g)
|
|
3499
3528
|
return this.array = e[0].copy(), this;
|
|
3500
3529
|
if (typeof e[0] == "string")
|
|
@@ -3817,7 +3846,7 @@ class b {
|
|
|
3817
3846
|
return this.#o = "system", this;
|
|
3818
3847
|
}
|
|
3819
3848
|
}
|
|
3820
|
-
class
|
|
3849
|
+
class j {
|
|
3821
3850
|
#i = void 0;
|
|
3822
3851
|
#e = void 0;
|
|
3823
3852
|
#t = void 0;
|
|
@@ -3890,7 +3919,7 @@ class V {
|
|
|
3890
3919
|
}), i;
|
|
3891
3920
|
};
|
|
3892
3921
|
clone() {
|
|
3893
|
-
return new
|
|
3922
|
+
return new j(
|
|
3894
3923
|
this.center.clone(),
|
|
3895
3924
|
this.squareRadius.clone(),
|
|
3896
3925
|
!0
|
|
@@ -3919,7 +3948,7 @@ class V {
|
|
|
3919
3948
|
return this.#i = void 0, this.#e = void 0, this.#t = void 0, this;
|
|
3920
3949
|
}
|
|
3921
3950
|
parse(...e) {
|
|
3922
|
-
return this.#o(), typeof e[0] == "string" ? this.#u(new y(e[0])) : e[0] instanceof y ? this.#u(e[0]) : e[0] instanceof
|
|
3951
|
+
return this.#o(), typeof e[0] == "string" ? this.#u(new y(e[0])) : e[0] instanceof y ? this.#u(e[0]) : e[0] instanceof j ? this.#a(e[0]) : e[0] instanceof v && e.length > 1 && (e[1] instanceof v ? e[2] instanceof v || this.#l(e[0], e[1]) : (e[1] instanceof a || typeof e[1] == "number") && this.#c(e[0], e[1], typeof e[2] == "boolean" ? e[2] : !1)), this.#h(), this;
|
|
3923
3952
|
}
|
|
3924
3953
|
#h() {
|
|
3925
3954
|
this.#t = new y(
|
|
@@ -4155,7 +4184,7 @@ class ee {
|
|
|
4155
4184
|
return this.normal.dot(e).add(this.d).isZero();
|
|
4156
4185
|
}
|
|
4157
4186
|
}
|
|
4158
|
-
class
|
|
4187
|
+
class G {
|
|
4159
4188
|
#i = new v();
|
|
4160
4189
|
#e = new v();
|
|
4161
4190
|
#t = new v();
|
|
@@ -4263,14 +4292,14 @@ class F {
|
|
|
4263
4292
|
BC: new b(this.#e, this.#t),
|
|
4264
4293
|
AC: new b(this.#i, this.#t)
|
|
4265
4294
|
});
|
|
4266
|
-
} else if (e.length === 1 && e[0] instanceof
|
|
4295
|
+
} else if (e.length === 1 && e[0] instanceof G)
|
|
4267
4296
|
return e[0].clone();
|
|
4268
4297
|
return this.#o(), this;
|
|
4269
4298
|
};
|
|
4270
4299
|
/**
|
|
4271
4300
|
* Clone the Triangle class
|
|
4272
4301
|
*/
|
|
4273
|
-
clone = () => new
|
|
4302
|
+
clone = () => new G(
|
|
4274
4303
|
this.#i.clone(),
|
|
4275
4304
|
this.#e.clone(),
|
|
4276
4305
|
this.#t.clone()
|
|
@@ -4357,7 +4386,7 @@ class F {
|
|
|
4357
4386
|
};
|
|
4358
4387
|
}
|
|
4359
4388
|
var oe = /* @__PURE__ */ ((r) => (r[r.INTERIOR = 0] = "INTERIOR", r[r.EXTERIOR = 1] = "EXTERIOR", r[r.SECANT = 2] = "SECANT", r[r.TANGENT_INSIDE = 3] = "TANGENT_INSIDE", r[r.TANGENT_OUTSIDE = 4] = "TANGENT_OUTSIDE", r[r.SUPERPOSED = 5] = "SUPERPOSED", r[r.CONCENTRIC = 6] = "CONCENTRIC", r))(oe || {});
|
|
4360
|
-
class
|
|
4389
|
+
class Me {
|
|
4361
4390
|
#i = void 0;
|
|
4362
4391
|
#e = void 0;
|
|
4363
4392
|
#t = void 0;
|
|
@@ -4457,7 +4486,7 @@ class Be {
|
|
|
4457
4486
|
z: e.z
|
|
4458
4487
|
}) ?? !1;
|
|
4459
4488
|
}
|
|
4460
|
-
function
|
|
4489
|
+
function X(r) {
|
|
4461
4490
|
const e = Object.assign(
|
|
4462
4491
|
{
|
|
4463
4492
|
negative: !0,
|
|
@@ -4487,7 +4516,7 @@ function he(r) {
|
|
|
4487
4516
|
},
|
|
4488
4517
|
r
|
|
4489
4518
|
), t = new p();
|
|
4490
|
-
if (t.coefficient =
|
|
4519
|
+
if (t.coefficient = X({
|
|
4491
4520
|
zero: e.zero,
|
|
4492
4521
|
reduced: !0,
|
|
4493
4522
|
natural: !e.fraction
|
|
@@ -4502,7 +4531,7 @@ function he(r) {
|
|
|
4502
4531
|
t.setLetter(e.letters, e.degree);
|
|
4503
4532
|
return t;
|
|
4504
4533
|
}
|
|
4505
|
-
const
|
|
4534
|
+
const Ie = {
|
|
4506
4535
|
letters: "x",
|
|
4507
4536
|
degree: 2,
|
|
4508
4537
|
fraction: !1,
|
|
@@ -4515,7 +4544,7 @@ const Me = {
|
|
|
4515
4544
|
};
|
|
4516
4545
|
function ae(r) {
|
|
4517
4546
|
const e = Object.assign(
|
|
4518
|
-
|
|
4547
|
+
Ie,
|
|
4519
4548
|
r
|
|
4520
4549
|
), t = new u().empty();
|
|
4521
4550
|
let i;
|
|
@@ -4575,10 +4604,10 @@ function H(r) {
|
|
|
4575
4604
|
quadrant: null
|
|
4576
4605
|
},
|
|
4577
4606
|
r
|
|
4578
|
-
), t = e.axis === "x", i = e.axis === "y", s = e.fraction ?
|
|
4607
|
+
), t = e.axis === "x", i = e.axis === "y", s = e.fraction ? X({ max: e.max, zero: t }) : new a(q(e.max, t)), n = e.fraction ? X({ max: e.max, zero: i }) : new a(q(e.max, i));
|
|
4579
4608
|
return Number(e.quadrant) === 1 && (s.abs(), n.abs()), Number(e.quadrant) === 2 && (s.isPositive() && s.opposite(), n.isNegative() && n.opposite()), Number(e.quadrant) === 3 && (s.isPositive() && s.opposite(), n.isPositive() && n.opposite()), Number(e.quadrant) === 4 && (s.isNegative() && s.opposite(), n.isPositive() && n.opposite()), new v(s, n);
|
|
4580
4609
|
}
|
|
4581
|
-
function
|
|
4610
|
+
function ze(r) {
|
|
4582
4611
|
const e = Object.assign(
|
|
4583
4612
|
{
|
|
4584
4613
|
center: {
|
|
@@ -4590,9 +4619,9 @@ function Ie(r) {
|
|
|
4590
4619
|
r
|
|
4591
4620
|
), t = H(e.center);
|
|
4592
4621
|
let i, s;
|
|
4593
|
-
return e.pointsOnCircle === 8 ? (i = k(1, 3), s = i ** 2 + (i + 1) ** 2) : s = k(1, 20), new
|
|
4622
|
+
return e.pointsOnCircle === 8 ? (i = k(1, 3), s = i ** 2 + (i + 1) ** 2) : s = k(1, 20), new j(t, s, !0);
|
|
4594
4623
|
}
|
|
4595
|
-
function
|
|
4624
|
+
function Re(r) {
|
|
4596
4625
|
const e = Object.assign(
|
|
4597
4626
|
{
|
|
4598
4627
|
A: {
|
|
@@ -4609,7 +4638,7 @@ function ze(r) {
|
|
|
4609
4638
|
t.x = q(10), t.y = q(10);
|
|
4610
4639
|
return e.slope === 1 ? t.x.sign() !== t.y.sign() && t.y.opposite() : e.slope === -1 && t.x.sign() !== t.y.sign() && t.y.opposite(), new b().fromPointAndDirection(new g(e.A.x, e.A.y), t);
|
|
4611
4640
|
}
|
|
4612
|
-
function
|
|
4641
|
+
function Pe(r) {
|
|
4613
4642
|
const e = Object.assign(
|
|
4614
4643
|
{
|
|
4615
4644
|
A: {
|
|
@@ -4627,81 +4656,81 @@ function Re(r) {
|
|
|
4627
4656
|
), t = new v(e.A.x, e.A.y, e.A.z), i = new g(e.direction.x, e.direction.y, e.direction.z);
|
|
4628
4657
|
return new Y(t, i);
|
|
4629
4658
|
}
|
|
4630
|
-
const
|
|
4659
|
+
const De = {
|
|
4631
4660
|
equation: (r) => Se(r),
|
|
4632
4661
|
polynom: (r) => ae(r),
|
|
4633
4662
|
monom: (r) => he(r),
|
|
4634
|
-
fraction: (r) =>
|
|
4663
|
+
fraction: (r) => X(r),
|
|
4635
4664
|
number: (r, e, t) => k(r, e, t),
|
|
4636
4665
|
numberSym: (r, e) => q(r, e),
|
|
4637
|
-
prime: (r) =>
|
|
4666
|
+
prime: (r) => ke(r),
|
|
4638
4667
|
bool: (r) => ne(r),
|
|
4639
|
-
array: (r, e) =>
|
|
4668
|
+
array: (r, e) => Be(r, e),
|
|
4640
4669
|
item: (r) => _(r),
|
|
4641
4670
|
shuffle: (r) => re(r),
|
|
4642
|
-
line: (r) =>
|
|
4643
|
-
line3: (r) =>
|
|
4671
|
+
line: (r) => Re(r),
|
|
4672
|
+
line3: (r) => Pe(r),
|
|
4644
4673
|
vector: (r) => H(r),
|
|
4645
4674
|
point: (r) => {
|
|
4646
4675
|
const e = H(r);
|
|
4647
4676
|
return e.asPoint = !0, e;
|
|
4648
4677
|
},
|
|
4649
|
-
circle: (r) =>
|
|
4650
|
-
},
|
|
4678
|
+
circle: (r) => ze(r)
|
|
4679
|
+
}, Ze = {
|
|
4651
4680
|
Numeric: E,
|
|
4652
4681
|
Fraction: a,
|
|
4653
|
-
Root:
|
|
4682
|
+
Root: U,
|
|
4654
4683
|
Monom: p,
|
|
4655
4684
|
Polynom: u,
|
|
4656
4685
|
Equation: y,
|
|
4657
|
-
Matrix:
|
|
4686
|
+
Matrix: S,
|
|
4658
4687
|
LinearSystem: D,
|
|
4659
4688
|
Factor: x,
|
|
4660
4689
|
PolyFactor: T,
|
|
4661
|
-
LogicalSet:
|
|
4662
|
-
Random:
|
|
4690
|
+
LogicalSet: Te,
|
|
4691
|
+
Random: De,
|
|
4663
4692
|
Geometry: {
|
|
4664
4693
|
Vector: g,
|
|
4665
4694
|
Point: v,
|
|
4666
4695
|
Line: b,
|
|
4667
|
-
Triangle:
|
|
4668
|
-
Circle:
|
|
4696
|
+
Triangle: G,
|
|
4697
|
+
Circle: j,
|
|
4669
4698
|
Line3: Y,
|
|
4670
4699
|
Plane3: ee,
|
|
4671
|
-
Sphere3:
|
|
4700
|
+
Sphere3: Me
|
|
4672
4701
|
},
|
|
4673
|
-
NumExp:
|
|
4702
|
+
NumExp: qe
|
|
4674
4703
|
};
|
|
4675
4704
|
export {
|
|
4676
|
-
|
|
4705
|
+
j as Circle,
|
|
4677
4706
|
y as Equation,
|
|
4678
|
-
|
|
4707
|
+
V as EquationSolver,
|
|
4679
4708
|
Z as FACTOR_DISPLAY,
|
|
4680
|
-
|
|
4709
|
+
ye as FRAC_TYPE,
|
|
4681
4710
|
x as Factor,
|
|
4682
4711
|
a as Fraction,
|
|
4683
4712
|
b as Line,
|
|
4684
4713
|
Y as Line3,
|
|
4685
4714
|
D as LinearSystem,
|
|
4686
|
-
|
|
4687
|
-
|
|
4715
|
+
Te as LogicalSet,
|
|
4716
|
+
S as Matrix,
|
|
4688
4717
|
p as Monom,
|
|
4689
|
-
|
|
4690
|
-
|
|
4718
|
+
U as NthRoot,
|
|
4719
|
+
qe as NumExp,
|
|
4691
4720
|
E as Numeric,
|
|
4692
4721
|
ee as Plane3,
|
|
4693
4722
|
v as Point,
|
|
4694
4723
|
T as PolyFactor,
|
|
4695
4724
|
u as Polynom,
|
|
4696
|
-
|
|
4725
|
+
De as Random,
|
|
4697
4726
|
oe as SPHERE3_RELATIVE_POSITION,
|
|
4698
|
-
|
|
4699
|
-
|
|
4727
|
+
Me as Sphere3,
|
|
4728
|
+
G as Triangle,
|
|
4700
4729
|
g as Vector,
|
|
4701
|
-
|
|
4702
|
-
|
|
4703
|
-
|
|
4704
|
-
|
|
4705
|
-
|
|
4730
|
+
Ce as areVectorsColinears,
|
|
4731
|
+
Oe as areVectorsEquals,
|
|
4732
|
+
Ze as default,
|
|
4733
|
+
Le as determinantFromVectors,
|
|
4734
|
+
$e as dotProduct
|
|
4706
4735
|
};
|
|
4707
4736
|
//# sourceMappingURL=pimath.js.map
|