pimath 0.1.20 → 0.1.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/algebra/polyFactor.d.ts +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/pimath.js +163 -160
- package/dist/pimath.js.map +1 -1
- package/package.json +1 -1
package/dist/pimath.js
CHANGED
|
@@ -4,7 +4,7 @@ var yi = (o) => {
|
|
|
4
4
|
};
|
|
5
5
|
var Ri = (o, e, t) => e in o ? Si(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
|
|
6
6
|
var a = (o, e, t) => Ri(o, typeof e != "symbol" ? e + "" : e, t), Jt = (o, e, t) => e.has(o) || yi("Cannot " + t);
|
|
7
|
-
var s = (o, e, t) => (Jt(o, e, "read from private field"), t ? t.call(o) : e.get(o)), p = (o, e, t) => e.has(o) ? yi("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(o) : e.set(o, t), h = (o, e, t, i) => (Jt(o, e, "write to private field"), i ? i.call(o, t) : e.set(o, t), t),
|
|
7
|
+
var s = (o, e, t) => (Jt(o, e, "read from private field"), t ? t.call(o) : e.get(o)), p = (o, e, t) => e.has(o) ? yi("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(o) : e.set(o, t), h = (o, e, t, i) => (Jt(o, e, "write to private field"), i ? i.call(o, t) : e.set(o, t), t), q = (o, e, t) => (Jt(o, e, "access private method"), t);
|
|
8
8
|
function zi(o) {
|
|
9
9
|
const e = vi(o), t = [];
|
|
10
10
|
let i, n;
|
|
@@ -391,37 +391,37 @@ class vt {
|
|
|
391
391
|
}
|
|
392
392
|
}
|
|
393
393
|
Z = new WeakMap(), ee = new WeakMap(), ie = new WeakMap(), Xe = new WeakMap();
|
|
394
|
-
var
|
|
394
|
+
var ue, je, P, ot, ye, bi, ti, xi, Ei, Ni;
|
|
395
395
|
const mi = class mi {
|
|
396
396
|
constructor(e, t, i = "x") {
|
|
397
397
|
p(this, P);
|
|
398
|
-
p(this,
|
|
398
|
+
p(this, ue);
|
|
399
399
|
p(this, je);
|
|
400
400
|
if (h(this, je, i), Object.hasOwn(e, "moveLeft")) {
|
|
401
401
|
const n = e;
|
|
402
|
-
h(this,
|
|
402
|
+
h(this, ue, n.left.clone().subtract(n.right));
|
|
403
403
|
} else
|
|
404
|
-
h(this,
|
|
404
|
+
h(this, ue, e.clone().subtract(t ?? 0));
|
|
405
405
|
}
|
|
406
406
|
solve() {
|
|
407
|
-
if (s(this,
|
|
408
|
-
return
|
|
409
|
-
if (s(this,
|
|
410
|
-
return
|
|
411
|
-
const e =
|
|
407
|
+
if (s(this, ue).degree().isOne())
|
|
408
|
+
return q(this, P, xi).call(this);
|
|
409
|
+
if (s(this, ue).degree().value === 2)
|
|
410
|
+
return q(this, P, Ei).call(this);
|
|
411
|
+
const e = q(this, P, bi).call(this);
|
|
412
412
|
if (e.length > 0)
|
|
413
413
|
return e;
|
|
414
|
-
if (s(this,
|
|
415
|
-
return
|
|
414
|
+
if (s(this, ue).degree().value === 3)
|
|
415
|
+
return q(this, P, ti).call(this);
|
|
416
416
|
throw new Error("The equation degree is too high.");
|
|
417
417
|
}
|
|
418
418
|
solveAsCardan() {
|
|
419
|
-
if (s(this,
|
|
419
|
+
if (s(this, ue).degree().value !== 3)
|
|
420
420
|
throw new Error("The equation is not cubic.");
|
|
421
|
-
return
|
|
421
|
+
return q(this, P, ti).call(this);
|
|
422
422
|
}
|
|
423
423
|
};
|
|
424
|
-
|
|
424
|
+
ue = new WeakMap(), je = new WeakMap(), P = new WeakSet(), ot = function(e, t) {
|
|
425
425
|
return {
|
|
426
426
|
variable: s(this, je),
|
|
427
427
|
exact: !1,
|
|
@@ -431,7 +431,7 @@ ce = new WeakMap(), je = new WeakMap(), P = new WeakSet(), ot = function(e, t) {
|
|
|
431
431
|
};
|
|
432
432
|
}, ye = function(e) {
|
|
433
433
|
if (e instanceof u && e.isApproximative())
|
|
434
|
-
return
|
|
434
|
+
return q(this, P, ot).call(this, e.value);
|
|
435
435
|
const t = new u(e);
|
|
436
436
|
return {
|
|
437
437
|
variable: s(this, je),
|
|
@@ -441,23 +441,23 @@ ce = new WeakMap(), je = new WeakMap(), P = new WeakSet(), ot = function(e, t) {
|
|
|
441
441
|
display: t.display
|
|
442
442
|
};
|
|
443
443
|
}, bi = function() {
|
|
444
|
-
let e = s(this,
|
|
444
|
+
let e = s(this, ue).clone(), t = [];
|
|
445
445
|
const i = e.lcmDenominator();
|
|
446
446
|
i !== 1 && e.multiply(i);
|
|
447
447
|
const n = e.monomByDegree().coefficient;
|
|
448
448
|
let r = e.monomByDegree(0).coefficient;
|
|
449
449
|
for (; r.isZero(); )
|
|
450
|
-
t.length === 0 && t.push(
|
|
450
|
+
t.length === 0 && t.push(q(this, P, ye).call(this, 0)), e = e.divide("x"), r = e.monomByDegree(0).coefficient;
|
|
451
451
|
const l = G.dividers(n.value), c = G.dividers(r.value);
|
|
452
452
|
for (const f of l)
|
|
453
453
|
for (const g of c) {
|
|
454
|
-
const
|
|
455
|
-
e.evaluate(
|
|
454
|
+
const N = new u(g, f);
|
|
455
|
+
e.evaluate(N).isZero() && !t.find((V) => V.value === N.value) && t.push(q(this, P, ye).call(this, N)), N.opposite(), e.evaluate(N).isZero() && !t.find((V) => V.value === N.value) && t.push(q(this, P, ye).call(this, N));
|
|
456
456
|
}
|
|
457
457
|
for (const f of t) {
|
|
458
458
|
if (f.exact !== !1 && f.exact.isZero())
|
|
459
459
|
continue;
|
|
460
|
-
const g = s(this,
|
|
460
|
+
const g = s(this, ue).clone().parse("x", f.exact.denominator, -f.exact.numerator);
|
|
461
461
|
for (; e.isDividableBy(g); )
|
|
462
462
|
e = e.divide(g);
|
|
463
463
|
}
|
|
@@ -468,61 +468,61 @@ ce = new WeakMap(), je = new WeakMap(), P = new WeakSet(), ot = function(e, t) {
|
|
|
468
468
|
const d = new mi(e, e.clone().parse("0"), s(this, je));
|
|
469
469
|
return t = t.concat(d.solve()), t.sort((f, g) => f.value - g.value);
|
|
470
470
|
}, ti = function() {
|
|
471
|
-
const e = s(this,
|
|
471
|
+
const e = s(this, ue), t = e.monomByDegree(3).coefficient, i = e.monomByDegree(2).coefficient, n = e.monomByDegree(1).coefficient, r = e.monomByDegree(0).coefficient, l = i.clone().divide(t), c = n.clone().divide(t), d = r.clone().divide(t), f = c.clone().subtract(l.clone().pow(2).divide(3)), g = d.clone().subtract(l.clone().multiply(c).divide(3)).add(l.clone().pow(3).multiply(2).divide(27)), N = g.clone().opposite(), V = f.clone().opposite().pow(3).divide(27), de = N.clone().pow(2).subtract(V.clone().multiply(4)).opposite();
|
|
472
472
|
if (de.isNegative()) {
|
|
473
473
|
const he = g.clone().opposite().add(de.clone().opposite().sqrt()).divide(2).root(3), ae = g.clone().opposite().subtract(de.clone().opposite().sqrt()).divide(2).root(3), ge = he.clone().add(ae).subtract(l.clone().divide(3));
|
|
474
|
-
return [
|
|
474
|
+
return [q(this, P, ye).call(this, ge)];
|
|
475
475
|
}
|
|
476
476
|
if (de.isZero()) {
|
|
477
477
|
const he = g.clone().opposite().divide(2).root(3), ae = he.clone().opposite().subtract(l.clone().divide(3)), ge = he.clone().multiply(2).subtract(l.clone().divide(3));
|
|
478
|
-
return ae.isEqual(ge) ? [
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
].sort((pe,
|
|
478
|
+
return ae.isEqual(ge) ? [q(this, P, ye).call(this, ae)] : [
|
|
479
|
+
q(this, P, ye).call(this, ge),
|
|
480
|
+
q(this, P, ye).call(this, ae)
|
|
481
|
+
].sort((pe, ce) => pe.value - ce.value);
|
|
482
482
|
}
|
|
483
483
|
if (de.isPositive()) {
|
|
484
484
|
const he = [], ae = f.value, ge = g.value, pe = l.value;
|
|
485
|
-
for (let
|
|
486
|
-
he.push(2 * Math.sqrt(-ae / 3) * Math.cos(Math.acos(3 * ge / (2 * ae) * Math.sqrt(-3 / ae)) / 3 + 2 * Math.PI *
|
|
487
|
-
return he.map((
|
|
485
|
+
for (let ce = 0; ce < 3; ce++)
|
|
486
|
+
he.push(2 * Math.sqrt(-ae / 3) * Math.cos(Math.acos(3 * ge / (2 * ae) * Math.sqrt(-3 / ae)) / 3 + 2 * Math.PI * ce / 3) - pe / 3);
|
|
487
|
+
return he.map((ce) => q(this, P, ot).call(this, ce)).sort((ce, nt) => ce.value - nt.value);
|
|
488
488
|
}
|
|
489
489
|
return [];
|
|
490
490
|
}, xi = function() {
|
|
491
|
-
const e = s(this,
|
|
491
|
+
const e = s(this, ue).monomByDegree(0).coefficient.clone().opposite().divide(s(this, ue).monomByDegree(1).coefficient);
|
|
492
492
|
return [
|
|
493
|
-
|
|
493
|
+
q(this, P, ye).call(this, e)
|
|
494
494
|
];
|
|
495
495
|
}, Ei = function() {
|
|
496
|
-
const e = s(this,
|
|
496
|
+
const e = s(this, ue), t = e.monomByDegree(2).coefficient, i = e.monomByDegree(1).coefficient, n = e.monomByDegree(0).coefficient, r = i.clone().pow(2).subtract(t.clone().multiply(n).multiply(4));
|
|
497
497
|
if (r.isNegative())
|
|
498
498
|
return [];
|
|
499
499
|
if (r.isSquare()) {
|
|
500
500
|
const l = r.sqrt(), c = i.clone().opposite().add(l).divide(t.clone().multiply(2)), d = i.clone().opposite().subtract(l).divide(t.clone().multiply(2));
|
|
501
|
-
return l.isZero() ? [
|
|
502
|
-
|
|
503
|
-
|
|
501
|
+
return l.isZero() ? [q(this, P, ye).call(this, c)] : [
|
|
502
|
+
q(this, P, ye).call(this, c),
|
|
503
|
+
q(this, P, ye).call(this, d)
|
|
504
504
|
].sort((f, g) => f.value - g.value);
|
|
505
505
|
}
|
|
506
|
-
return
|
|
506
|
+
return q(this, P, Ni).call(this, t, i, r);
|
|
507
507
|
}, Ni = function(e, t, i) {
|
|
508
|
-
const n = G.dividers(i.value).filter((pe) => Math.sqrt(pe) % 1 === 0).map((pe) => Math.sqrt(pe)).pop() ?? 1, r = G.gcd(2 * e.value, t.value, n) * (e.isNegative() ? -1 : 1), l = t.clone().divide(r).opposite(), c = e.clone().divide(r).multiply(2), d = i.clone().divide(n ** 2), f = Math.abs(n / r), g = n === 1 ? "-" : `-${f} `,
|
|
509
|
-
function V(pe,
|
|
510
|
-
return `\\frac{ ${
|
|
508
|
+
const n = G.dividers(i.value).filter((pe) => Math.sqrt(pe) % 1 === 0).map((pe) => Math.sqrt(pe)).pop() ?? 1, r = G.gcd(2 * e.value, t.value, n) * (e.isNegative() ? -1 : 1), l = t.clone().divide(r).opposite(), c = e.clone().divide(r).multiply(2), d = i.clone().divide(n ** 2), f = Math.abs(n / r), g = n === 1 ? "-" : `-${f} `, N = n === 1 ? "+" : `+${f} `;
|
|
509
|
+
function V(pe, ce, nt, Kt) {
|
|
510
|
+
return `\\frac{ ${ce} ${nt}\\sqrt{ ${Kt} } }{ ${pe} }`;
|
|
511
511
|
}
|
|
512
|
-
function de(pe,
|
|
513
|
-
return `(${
|
|
512
|
+
function de(pe, ce, nt, Kt) {
|
|
513
|
+
return `(${ce}${nt}sqrt(${Kt}))/${pe}`;
|
|
514
514
|
}
|
|
515
515
|
const he = i.value ** 0.5, ae = (-t.value - he) / (2 * e.value), ge = (-t.value + he) / (2 * e.value);
|
|
516
516
|
return [
|
|
517
|
-
|
|
517
|
+
q(this, P, ot).call(this, ae, {
|
|
518
518
|
tex: V(c.tex, l.tex, g.toString(), d.tex),
|
|
519
519
|
display: de(c.display, l.display, g.toString(), d.display)
|
|
520
520
|
}),
|
|
521
|
-
|
|
522
|
-
tex: V(c.tex, l.tex,
|
|
523
|
-
display: de(c.display, l.display,
|
|
521
|
+
q(this, P, ot).call(this, ge, {
|
|
522
|
+
tex: V(c.tex, l.tex, N.toString(), d.tex),
|
|
523
|
+
display: de(c.display, l.display, N.toString(), d.display)
|
|
524
524
|
})
|
|
525
|
-
].sort((pe,
|
|
525
|
+
].sort((pe, ce) => pe.value - ce.value);
|
|
526
526
|
};
|
|
527
527
|
let Nt = mi;
|
|
528
528
|
var Gi = Object.defineProperty, Ti = (o) => {
|
|
@@ -536,22 +536,22 @@ var m = /* @__PURE__ */ ((o) => (o.VARIABLE = "variable", o.COEFFICIENT = "coeff
|
|
|
536
536
|
function Hi(o, e) {
|
|
537
537
|
if (o.length <= 1)
|
|
538
538
|
return o;
|
|
539
|
-
const t = Object.keys(e).filter((
|
|
540
|
-
t.sort((
|
|
539
|
+
const t = Object.keys(e).filter((N) => e[N].type === m.FUNCTION).map((N) => N);
|
|
540
|
+
t.sort((N, V) => V.length - N.length);
|
|
541
541
|
const i = new RegExp(`^(${t.join("|")})\\(`), n = Object.keys(di);
|
|
542
|
-
n.sort((
|
|
542
|
+
n.sort((N, V) => V.length - N.length);
|
|
543
543
|
const r = new RegExp(`^(${n.join("|")})`), l = /^(\d+(\.\d+)?)/;
|
|
544
544
|
let c = "", d, f, g;
|
|
545
545
|
for (; o.length > 0; ) {
|
|
546
546
|
if (d = f, g = void 0, t.length > 0 && i.exec(o)) {
|
|
547
|
-
const
|
|
548
|
-
|
|
547
|
+
const N = t.find((V) => o.startsWith(V));
|
|
548
|
+
N && (g = N + "(", o = o.slice(N.length + 1), f = m.FUNCTION);
|
|
549
549
|
} else if (n.length > 0 && r.exec(o)) {
|
|
550
|
-
const
|
|
551
|
-
|
|
550
|
+
const N = n.find((V) => o.startsWith(V));
|
|
551
|
+
N && (g = N, o = o.slice(N.length), f = m.CONSTANT);
|
|
552
552
|
} else if (l.exec(o)) {
|
|
553
|
-
const
|
|
554
|
-
|
|
553
|
+
const N = l.exec(o);
|
|
554
|
+
N && (g = N[0], o = o.slice(N[0].length), f = m.COEFFICIENT);
|
|
555
555
|
} else
|
|
556
556
|
switch (g = o[0], o = o.slice(1), g) {
|
|
557
557
|
case "(":
|
|
@@ -703,17 +703,17 @@ class Qt {
|
|
|
703
703
|
break;
|
|
704
704
|
case m.OPERATION:
|
|
705
705
|
if (n.length > 0) {
|
|
706
|
-
let
|
|
707
|
-
for (g = +d;
|
|
708
|
-
(_(this, te)[r].associative === "left" && _(this, te)[r].precedence <= _(this, te)[
|
|
709
|
-
_(this, te)[r].associative === "right" && _(this, te)[r].precedence < _(this, te)[
|
|
706
|
+
let N = n[n.length - 1];
|
|
707
|
+
for (g = +d; N.token in _(this, te) && //either o1 is left-associative and its precedence is less than or equal to that of o2,
|
|
708
|
+
(_(this, te)[r].associative === "left" && _(this, te)[r].precedence <= _(this, te)[N.token].precedence || //or o1 is right associative, and has precedence less than that of o2,
|
|
709
|
+
_(this, te)[r].associative === "right" && _(this, te)[r].precedence < _(this, te)[N.token].precedence); ) {
|
|
710
710
|
if (g--, g === 0) {
|
|
711
711
|
console.log("SECURITY LEVEL 2 OPERATION EXIT");
|
|
712
712
|
break;
|
|
713
713
|
}
|
|
714
714
|
if (i.push(n.pop() ?? { token: "", tokenType: m.OPERATION }), n.length === 0)
|
|
715
715
|
break;
|
|
716
|
-
|
|
716
|
+
N = n[n.length - 1];
|
|
717
717
|
}
|
|
718
718
|
}
|
|
719
719
|
n.push({ token: r, tokenType: c });
|
|
@@ -874,7 +874,7 @@ const I = class I {
|
|
|
874
874
|
a(this, "add", (...e) => {
|
|
875
875
|
for (const t of e) {
|
|
876
876
|
const i = t instanceof I ? t : new I(t);
|
|
877
|
-
this.isSameAs(i) ? (this.isZero() &&
|
|
877
|
+
this.isSameAs(i) ? (this.isZero() && q(this, Ye, xt).call(this, i), s(this, T).add(i.coefficient)) : console.log("Add monom: " + this.display + " is not similar with ", i.display);
|
|
878
878
|
}
|
|
879
879
|
return this;
|
|
880
880
|
});
|
|
@@ -1076,7 +1076,7 @@ const I = class I {
|
|
|
1076
1076
|
a(this, "subtract", (...e) => {
|
|
1077
1077
|
for (const t of e) {
|
|
1078
1078
|
const i = t instanceof I ? t : new I(t);
|
|
1079
|
-
this.isSameAs(i) ? (this.isZero() &&
|
|
1079
|
+
this.isSameAs(i) ? (this.isZero() && q(this, Ye, xt).call(this, i), s(this, T).add(i.clone().coefficient.opposite())) : console.log("Subtract: Is not similar: ", i.display);
|
|
1080
1080
|
}
|
|
1081
1081
|
return this;
|
|
1082
1082
|
});
|
|
@@ -1151,7 +1151,7 @@ const I = class I {
|
|
|
1151
1151
|
* @param inputStr
|
|
1152
1152
|
*/
|
|
1153
1153
|
parse(e) {
|
|
1154
|
-
return h(this, T, new u()), h(this, v, {}), typeof e == "string" ? s(this, qt).call(this, e) : typeof e == "number" ? h(this, T, new u(e)) : e instanceof u ? h(this, T, e.clone()) : e instanceof I && (h(this, T, s(e, T).clone()),
|
|
1154
|
+
return h(this, T, new u()), h(this, v, {}), typeof e == "string" ? s(this, qt).call(this, e) : typeof e == "number" ? h(this, T, new u(e)) : e instanceof u ? h(this, T, e.clone()) : e instanceof I && (h(this, T, s(e, T).clone()), q(this, Ye, xt).call(this, e)), this;
|
|
1155
1155
|
}
|
|
1156
1156
|
/**
|
|
1157
1157
|
* Get the coefficient \\(k\\) of the Monom \\(k\\cdot x^{n}\\)
|
|
@@ -1346,7 +1346,7 @@ const C = class C {
|
|
|
1346
1346
|
*/
|
|
1347
1347
|
a(this, "parse", (e, ...t) => {
|
|
1348
1348
|
if (h(this, y, []), h(this, Ue, []), typeof e == "string")
|
|
1349
|
-
return
|
|
1349
|
+
return q(this, Rt, Oi).call(this, e, ...t);
|
|
1350
1350
|
if ((typeof e == "number" || e instanceof u || e instanceof M) && t.length === 0)
|
|
1351
1351
|
s(this, y).push(new M(e));
|
|
1352
1352
|
else if (e instanceof M && t.length > 0)
|
|
@@ -1470,8 +1470,8 @@ const C = class C {
|
|
|
1470
1470
|
else {
|
|
1471
1471
|
const f = i.euclidean(d);
|
|
1472
1472
|
t.push(d), i = f.quotient.clone(), c = c.filter((g) => {
|
|
1473
|
-
const
|
|
1474
|
-
return V.isDivisible(he) ?
|
|
1473
|
+
const N = i.monoms[0], V = i.monoms[i.monoms.length - 1], de = g.monoms[0], he = g.monoms[g.monoms.length - 1];
|
|
1474
|
+
return V.isDivisible(he) ? N.isDivisible(de) : !1;
|
|
1475
1475
|
});
|
|
1476
1476
|
}
|
|
1477
1477
|
}
|
|
@@ -1677,7 +1677,7 @@ const C = class C {
|
|
|
1677
1677
|
}), t;
|
|
1678
1678
|
});
|
|
1679
1679
|
p(this, $t, (e) => {
|
|
1680
|
-
var
|
|
1680
|
+
var N;
|
|
1681
1681
|
let t, i, n, r, l, c, d, f, g;
|
|
1682
1682
|
if (this.numberOfVars === 1)
|
|
1683
1683
|
return n = this.monomByDegree(2, e).coefficient, r = this.monomByDegree(1, e).coefficient, l = this.monomByDegree(0, e).coefficient, c = r.clone().pow(2).subtract(n.clone().multiply(l).multiply(4)), c.isZero() ? (d = r.clone().opposite().divide(n.clone().multiply(2)), t = new C(e).subtract(d.display).multiply(d.denominator), i = new C(e).subtract(d.display).multiply(d.denominator), g = n.divide(d.denominator).divide(d.denominator), g.isOne() ? [t, i] : [new C(g.display), t, i]) : c.isPositive() && c.isSquare() ? (d = r.clone().opposite().add(c.clone().sqrt()).divide(n.clone().multiply(2)), f = r.clone().opposite().subtract(c.clone().sqrt()).divide(n.clone().multiply(2)), g = n.divide(d.denominator).divide(f.denominator), g.isOne() ? [
|
|
@@ -1689,7 +1689,7 @@ const C = class C {
|
|
|
1689
1689
|
new C(e).subtract(f.display).multiply(f.denominator)
|
|
1690
1690
|
]) : [this.clone()];
|
|
1691
1691
|
if (n = this.monomByDegree(2, e), r = this.monomByDegree(1, e), l = this.monomByDegree(0, e), n.isLiteralSquare() && l.isLiteralSquare() && r.clone().pow(2).isSameAs(n.clone().multiply(l))) {
|
|
1692
|
-
const V = new C("x", n.coefficient, r.coefficient, l.coefficient), de = s(
|
|
1692
|
+
const V = new C("x", n.coefficient, r.coefficient, l.coefficient), de = s(N = V, $t).call(N, "x"), he = [];
|
|
1693
1693
|
let ae;
|
|
1694
1694
|
if (de.length >= 2) {
|
|
1695
1695
|
for (const ge of de)
|
|
@@ -1865,8 +1865,8 @@ const C = class C {
|
|
|
1865
1865
|
0,
|
|
1866
1866
|
l
|
|
1867
1867
|
)), r = g * 2 + 1, l = f === i.length - 1 ? n.length : t.findIndex((V) => V.value === i[f + 1].value) * 2 + 1;
|
|
1868
|
-
const
|
|
1869
|
-
c = this.evaluate(
|
|
1868
|
+
const N = f === i.length - 1 ? d.value + 1 : (d.value + i[f + 1].value) / 2;
|
|
1869
|
+
c = this.evaluate(N, !0) < 0 ? "-" : "+", n[r] = "z", n = Re(n, "", c, r, l), r = +l, l = n.length;
|
|
1870
1870
|
});
|
|
1871
1871
|
}
|
|
1872
1872
|
return { roots: t, signs: n };
|
|
@@ -1913,7 +1913,7 @@ Ue = new WeakMap(), y = new WeakMap(), Qe = new WeakMap(), ut = new WeakMap(), K
|
|
|
1913
1913
|
} else
|
|
1914
1914
|
return this.zero();
|
|
1915
1915
|
}, zt = new WeakMap(), Lt = new WeakMap();
|
|
1916
|
-
let
|
|
1916
|
+
let O = C;
|
|
1917
1917
|
var A, k, se, Dt, _e, Vt;
|
|
1918
1918
|
const Ee = class Ee {
|
|
1919
1919
|
constructor(e, t, i) {
|
|
@@ -1929,7 +1929,7 @@ const Ee = class Ee {
|
|
|
1929
1929
|
if (t === !1)
|
|
1930
1930
|
throw new Error("The equation is not valid (no sign found)");
|
|
1931
1931
|
const i = e.split(t);
|
|
1932
|
-
return this.create(new
|
|
1932
|
+
return this.create(new O(i[0]), new O(i[1]), s(this, _e).call(this, t));
|
|
1933
1933
|
});
|
|
1934
1934
|
a(this, "create", (e, t, i) => (h(this, A, e), h(this, k, t), h(this, se, s(this, _e).call(this, i ?? "=")), this));
|
|
1935
1935
|
a(this, "clone", () => new Ee(s(this, A).clone(), s(this, k).clone(), s(this, se)));
|
|
@@ -2048,11 +2048,11 @@ const Ee = class Ee {
|
|
|
2048
2048
|
// Equations solving algorithms
|
|
2049
2049
|
p(this, _e, (e) => e === void 0 ? "=" : e.includes("geq") || e.includes(">=") || e.includes("=>") ? ">=" : e.includes(">") ? ">" : e.includes("leq") || e.includes("<=") || e.includes("=<") ? "<=" : e.includes("<") ? "<" : "=");
|
|
2050
2050
|
p(this, Vt, () => s(this, se) === "=" ? this : s(this, se).includes("<") ? (s(this, se).replace("<", ">"), this) : s(this, se).includes(">") ? (s(this, se).replace(">", "<"), this) : this);
|
|
2051
|
-
if (h(this, A, new
|
|
2051
|
+
if (h(this, A, new O().zero()), h(this, k, new O().zero()), h(this, se, "="), e !== void 0 && t === void 0) {
|
|
2052
2052
|
if (e instanceof Ee)
|
|
2053
2053
|
return e.clone();
|
|
2054
2054
|
typeof e == "string" && this.parse(e);
|
|
2055
|
-
} else e !== void 0 && t !== void 0 && (this.left = new
|
|
2055
|
+
} else e !== void 0 && t !== void 0 && (this.left = new O(e), this.right = new O(t));
|
|
2056
2056
|
return i !== void 0 && (this.sign = i), this;
|
|
2057
2057
|
}
|
|
2058
2058
|
/**
|
|
@@ -2068,7 +2068,7 @@ const Ee = class Ee {
|
|
|
2068
2068
|
return s(this, A).add(e.left), s(this, k).add(e.right), this;
|
|
2069
2069
|
if (typeof e == "string" && !Ee.isEquationString(e))
|
|
2070
2070
|
return this.add(new Ee(e));
|
|
2071
|
-
const t = new
|
|
2071
|
+
const t = new O(e);
|
|
2072
2072
|
return s(this, A).add(t), s(this, k).add(t), this;
|
|
2073
2073
|
}
|
|
2074
2074
|
/**
|
|
@@ -2099,7 +2099,7 @@ const Ee = class Ee {
|
|
|
2099
2099
|
return s(this, A).subtract(e.left), s(this, k).subtract(e.right), this;
|
|
2100
2100
|
if (typeof e == "string" && !Ee.isEquationString(e))
|
|
2101
2101
|
return this.subtract(new Ee(e));
|
|
2102
|
-
const t = new
|
|
2102
|
+
const t = new O(e);
|
|
2103
2103
|
return s(this, A).subtract(t), s(this, k).subtract(t), this;
|
|
2104
2104
|
}
|
|
2105
2105
|
static isEquationString(e) {
|
|
@@ -2158,9 +2158,9 @@ const ve = class ve {
|
|
|
2158
2158
|
h(this, Te, e.polynom.clone()), h(this, Ae, e.power.clone());
|
|
2159
2159
|
else if (typeof e == "string" && t === void 0) {
|
|
2160
2160
|
const [i, n = "1"] = e.split("^");
|
|
2161
|
-
h(this, Te, new
|
|
2161
|
+
h(this, Te, new O(i)), h(this, Ae, new u(n.replace("(", "").replace(")", "")));
|
|
2162
2162
|
} else
|
|
2163
|
-
h(this, Te, new
|
|
2163
|
+
h(this, Te, new O(e)), h(this, Ae, new u(t ?? 1));
|
|
2164
2164
|
return h(this, Ne, 1), this;
|
|
2165
2165
|
}
|
|
2166
2166
|
parse() {
|
|
@@ -2203,7 +2203,7 @@ const ve = class ve {
|
|
|
2203
2203
|
divide(e) {
|
|
2204
2204
|
if (e instanceof ve && this.isSameAs(e))
|
|
2205
2205
|
return this.power.subtract(e.power), this;
|
|
2206
|
-
const t = new
|
|
2206
|
+
const t = new O(e);
|
|
2207
2207
|
if (this.isSameAs(t))
|
|
2208
2208
|
return this.power.subtract(1), this;
|
|
2209
2209
|
throw new Error("The two factors must be the same");
|
|
@@ -2225,7 +2225,7 @@ const ve = class ve {
|
|
|
2225
2225
|
}
|
|
2226
2226
|
isSameAs(e) {
|
|
2227
2227
|
let t;
|
|
2228
|
-
return e instanceof ve ? t = e.polynom : e instanceof
|
|
2228
|
+
return e instanceof ve ? t = e.polynom : e instanceof O ? t = e : t = new O(e), this.polynom.isEqual(t);
|
|
2229
2229
|
}
|
|
2230
2230
|
isZero() {
|
|
2231
2231
|
return this.polynom.isZero();
|
|
@@ -2233,7 +2233,7 @@ const ve = class ve {
|
|
|
2233
2233
|
multiply(e) {
|
|
2234
2234
|
if (e instanceof ve && this.isSameAs(e))
|
|
2235
2235
|
return this.power.add(e.power), this;
|
|
2236
|
-
const t = new
|
|
2236
|
+
const t = new O(e);
|
|
2237
2237
|
if (this.isSameAs(t))
|
|
2238
2238
|
return this.power.add(1), this;
|
|
2239
2239
|
throw new Error("The two factors must be the same");
|
|
@@ -2292,7 +2292,7 @@ const ve = class ve {
|
|
|
2292
2292
|
}
|
|
2293
2293
|
};
|
|
2294
2294
|
Ne = new WeakMap(), Te = new WeakMap(), Ae = new WeakMap(), et = new WeakMap();
|
|
2295
|
-
let
|
|
2295
|
+
let le = ve;
|
|
2296
2296
|
var at = /* @__PURE__ */ ((o) => (o[o.ROOT = 0] = "ROOT", o[o.POWER = 1] = "POWER", o))(at || {}), D, $e, Zt, Ft;
|
|
2297
2297
|
const He = class He {
|
|
2298
2298
|
constructor(...e) {
|
|
@@ -2371,7 +2371,7 @@ const He = class He {
|
|
|
2371
2371
|
const n = t.split("").splice(0, i - 1);
|
|
2372
2372
|
return new He(
|
|
2373
2373
|
...e.map((r) => {
|
|
2374
|
-
const l = new
|
|
2374
|
+
const l = new O(n.join(""), ...r);
|
|
2375
2375
|
return new H(l, 0);
|
|
2376
2376
|
})
|
|
2377
2377
|
);
|
|
@@ -2552,13 +2552,13 @@ class es {
|
|
|
2552
2552
|
return s(this, Oe).filter((e) => e.tokenType === "variable").map((e) => e.token);
|
|
2553
2553
|
}
|
|
2554
2554
|
vennAB() {
|
|
2555
|
-
return
|
|
2555
|
+
return q(this, pt, si).call(this, {
|
|
2556
2556
|
A: ["A", "AB"],
|
|
2557
2557
|
B: ["B", "AB"]
|
|
2558
2558
|
}, ["A", "B", "AB", "E"]);
|
|
2559
2559
|
}
|
|
2560
2560
|
vennABC() {
|
|
2561
|
-
return
|
|
2561
|
+
return q(this, pt, si).call(this, {
|
|
2562
2562
|
A: ["A", "AB", "AC", "ABC"],
|
|
2563
2563
|
B: ["B", "AB", "BC", "ABC"],
|
|
2564
2564
|
C: ["C", "AC", "BC", "ABC"]
|
|
@@ -2609,34 +2609,34 @@ Oe = new WeakMap(), pt = new WeakSet(), si = function(e, t) {
|
|
|
2609
2609
|
}
|
|
2610
2610
|
return [...i[0]].sort();
|
|
2611
2611
|
};
|
|
2612
|
-
var tt,
|
|
2612
|
+
var tt, E, mt, ri, gt, oi;
|
|
2613
2613
|
const me = class me {
|
|
2614
2614
|
constructor(...e) {
|
|
2615
2615
|
p(this, gt);
|
|
2616
2616
|
p(this, tt, at.POWER);
|
|
2617
|
-
p(this,
|
|
2617
|
+
p(this, E, []);
|
|
2618
2618
|
return this.parse(...e), this;
|
|
2619
2619
|
}
|
|
2620
2620
|
parse(...e) {
|
|
2621
|
-
return e.length === 0 ? this : (h(this,
|
|
2621
|
+
return e.length === 0 ? this : (h(this, E, []), e.forEach((t) => {
|
|
2622
2622
|
if (typeof t == "string") {
|
|
2623
2623
|
const i = t.split(")(").join(")*(").split("*");
|
|
2624
|
-
s(this,
|
|
2625
|
-
} else t instanceof me ? s(this,
|
|
2624
|
+
s(this, E).push(...i.map((n) => new le(n)));
|
|
2625
|
+
} else t instanceof me ? s(this, E).push(...t.factors.map((i) => i.clone())) : s(this, E).push(new le(t));
|
|
2626
2626
|
}), this);
|
|
2627
2627
|
}
|
|
2628
2628
|
clone() {
|
|
2629
|
-
return new me(...s(this,
|
|
2629
|
+
return new me(...s(this, E).map((e) => e.clone()));
|
|
2630
2630
|
}
|
|
2631
2631
|
get tex() {
|
|
2632
|
-
const { num: e, den: t } =
|
|
2632
|
+
const { num: e, den: t } = q(this, gt, oi).call(this);
|
|
2633
2633
|
if (t.length === 0)
|
|
2634
2634
|
return e.length === 1 ? e[0].asSingle.tex : e.map((r) => r.tex).join("");
|
|
2635
2635
|
const i = e.length === 1 ? e[0].asSingle.tex : e.map((r) => r.tex).join(""), n = t.length === 1 ? t[0].asSingle.tex : t.map((r) => r.tex).join("");
|
|
2636
2636
|
return `\\frac{ ${i} }{ ${n} }`;
|
|
2637
2637
|
}
|
|
2638
2638
|
get display() {
|
|
2639
|
-
const { num: e, den: t } =
|
|
2639
|
+
const { num: e, den: t } = q(this, gt, oi).call(this);
|
|
2640
2640
|
if (t.length === 0)
|
|
2641
2641
|
return e.length === 1 ? e[0].asSingle.display : e.map((r) => r.display).join("");
|
|
2642
2642
|
const i = e.length === 1 ? e[0].asSingle.display : e.map((r) => r.display).join(""), n = t.length === 1 ? t[0].asSingle.display : t.map((r) => r.display).join("");
|
|
@@ -2649,21 +2649,21 @@ const me = class me {
|
|
|
2649
2649
|
if (e.length === 1)
|
|
2650
2650
|
return e[0];
|
|
2651
2651
|
if (e.length === 2)
|
|
2652
|
-
return
|
|
2652
|
+
return q(i = me, mt, ri).call(i, e[0], e[1]);
|
|
2653
2653
|
let t = e[0];
|
|
2654
2654
|
return e.shift(), e.forEach((n) => {
|
|
2655
2655
|
var r;
|
|
2656
|
-
return t =
|
|
2656
|
+
return t = q(r = me, mt, ri).call(r, t, n);
|
|
2657
2657
|
}), t;
|
|
2658
2658
|
}
|
|
2659
2659
|
add(...e) {
|
|
2660
2660
|
let t = [this, ...e];
|
|
2661
2661
|
const i = me.gcd(...t);
|
|
2662
2662
|
t = t.map((r) => r.divide(i).reduce());
|
|
2663
|
-
const n = new
|
|
2664
|
-
return t.forEach((r) => n.add(r.develop())), h(this,
|
|
2663
|
+
const n = new O("0");
|
|
2664
|
+
return t.forEach((r) => n.add(r.develop())), h(this, E, [
|
|
2665
2665
|
...i.factors,
|
|
2666
|
-
new
|
|
2666
|
+
new le(n)
|
|
2667
2667
|
]), this;
|
|
2668
2668
|
}
|
|
2669
2669
|
get asPower() {
|
|
@@ -2673,47 +2673,47 @@ const me = class me {
|
|
|
2673
2673
|
return h(this, tt, at.ROOT), this;
|
|
2674
2674
|
}
|
|
2675
2675
|
degree(e) {
|
|
2676
|
-
return s(this,
|
|
2676
|
+
return s(this, E).reduce((t, i) => t.add(i.degree(e)), new u("0"));
|
|
2677
2677
|
}
|
|
2678
2678
|
get denominator() {
|
|
2679
|
-
return s(this,
|
|
2679
|
+
return s(this, E).filter((e) => e.power.isNegative());
|
|
2680
2680
|
}
|
|
2681
2681
|
derivative() {
|
|
2682
|
-
const e = [], t = s(this,
|
|
2682
|
+
const e = [], t = s(this, E).length;
|
|
2683
2683
|
for (let n = 0; n < t; n++) {
|
|
2684
|
-
const r = s(this,
|
|
2684
|
+
const r = s(this, E).slice(), l = r.splice(n, 1)[0];
|
|
2685
2685
|
e.push(new me(...r).multiply(new me(...l.derivative())));
|
|
2686
2686
|
}
|
|
2687
2687
|
e.forEach((n) => n.reduce());
|
|
2688
2688
|
const i = e.shift();
|
|
2689
|
-
return i !== void 0 && h(this,
|
|
2689
|
+
return i !== void 0 && h(this, E, i.factors), this.add(...e);
|
|
2690
2690
|
}
|
|
2691
2691
|
develop() {
|
|
2692
|
-
const e = new
|
|
2693
|
-
return s(this,
|
|
2692
|
+
const e = new O("1");
|
|
2693
|
+
return s(this, E).forEach((t) => {
|
|
2694
2694
|
e.multiply(t.develop());
|
|
2695
2695
|
}), e;
|
|
2696
2696
|
}
|
|
2697
2697
|
divide(e) {
|
|
2698
|
-
return h(this,
|
|
2698
|
+
return h(this, E, s(this, E).concat(e.clone().factors.map((t) => t.inverse()))), this;
|
|
2699
2699
|
}
|
|
2700
2700
|
evaluate(e, t) {
|
|
2701
|
-
return t ? s(this,
|
|
2701
|
+
return t ? s(this, E).reduce((i, n) => i * n.evaluate(e, t), 1) : s(this, E).reduce((i, n) => i.multiply(n.evaluate(e)), new u("1"));
|
|
2702
2702
|
}
|
|
2703
2703
|
get factors() {
|
|
2704
|
-
return s(this,
|
|
2704
|
+
return s(this, E);
|
|
2705
2705
|
}
|
|
2706
2706
|
set factors(e) {
|
|
2707
|
-
h(this,
|
|
2707
|
+
h(this, E, e);
|
|
2708
2708
|
}
|
|
2709
|
-
fromPolynom(e, t) {
|
|
2710
|
-
return h(this,
|
|
2709
|
+
fromPolynom(e, t, i) {
|
|
2710
|
+
return h(this, E, new O(e).factorize(i).map((n) => new le(n))), t && new O(t).factorize(i).forEach((n) => s(this, E).push(new le(n, -1))), this;
|
|
2711
2711
|
}
|
|
2712
2712
|
getFactors() {
|
|
2713
|
-
return s(this,
|
|
2713
|
+
return s(this, E);
|
|
2714
2714
|
}
|
|
2715
2715
|
getZeroes() {
|
|
2716
|
-
const e = [].concat(...s(this,
|
|
2716
|
+
const e = [].concat(...s(this, E).map((t) => t.polynom.getZeroes()));
|
|
2717
2717
|
return e.sort((t, i) => t.value - i.value), e.filter(
|
|
2718
2718
|
(t, i, n) => i === n.findIndex(
|
|
2719
2719
|
(r) => r.value === t.value
|
|
@@ -2721,63 +2721,63 @@ const me = class me {
|
|
|
2721
2721
|
);
|
|
2722
2722
|
}
|
|
2723
2723
|
hasVariable(e) {
|
|
2724
|
-
return s(this,
|
|
2724
|
+
return s(this, E).some((t) => t.hasVariable(e));
|
|
2725
2725
|
}
|
|
2726
2726
|
inverse() {
|
|
2727
|
-
return h(this,
|
|
2727
|
+
return h(this, E, s(this, E).map((e) => e.inverse())), this;
|
|
2728
2728
|
}
|
|
2729
2729
|
isEqual(e) {
|
|
2730
2730
|
const t = me.gcd(this, e), i = this.clone().divide(t).reduce(), n = e.clone().divide(t).reduce();
|
|
2731
2731
|
return i.isOne() && n.isOne();
|
|
2732
2732
|
}
|
|
2733
2733
|
isOne() {
|
|
2734
|
-
return s(this,
|
|
2734
|
+
return s(this, E).every((e) => e.isOne());
|
|
2735
2735
|
}
|
|
2736
2736
|
isZero() {
|
|
2737
|
-
return s(this,
|
|
2737
|
+
return s(this, E).every((e) => e.isZero());
|
|
2738
2738
|
}
|
|
2739
2739
|
multiply(...e) {
|
|
2740
2740
|
return e.forEach((t) => {
|
|
2741
|
-
h(this,
|
|
2741
|
+
h(this, E, s(this, E).concat(t.clone().factors));
|
|
2742
2742
|
}), this;
|
|
2743
2743
|
}
|
|
2744
2744
|
get numerator() {
|
|
2745
|
-
return s(this,
|
|
2745
|
+
return s(this, E).filter((e) => e.power.isPositive());
|
|
2746
2746
|
}
|
|
2747
2747
|
one() {
|
|
2748
|
-
return h(this,
|
|
2748
|
+
return h(this, E, [new le("1", "1")]), this;
|
|
2749
2749
|
}
|
|
2750
2750
|
opposite() {
|
|
2751
|
-
const e = s(this,
|
|
2752
|
-
return e >= 0 ? s(this,
|
|
2751
|
+
const e = s(this, E).findIndex((t) => t.display === "(-1)");
|
|
2752
|
+
return e >= 0 ? s(this, E).splice(e, 1) : s(this, E).push(new le("-1", "1")), this;
|
|
2753
2753
|
}
|
|
2754
2754
|
pow(e) {
|
|
2755
|
-
return h(this,
|
|
2755
|
+
return h(this, E, s(this, E).map((t) => t.pow(e))), this;
|
|
2756
2756
|
}
|
|
2757
2757
|
primitive() {
|
|
2758
2758
|
throw new Error("Method not implemented.");
|
|
2759
2759
|
}
|
|
2760
2760
|
reduce() {
|
|
2761
2761
|
const e = ei(this);
|
|
2762
|
-
return h(this,
|
|
2762
|
+
return h(this, E, Object.values(e).map((t) => {
|
|
2763
2763
|
const i = t[0].polynom, n = t.reduce((r, l) => r.add(l.power), new u("0"));
|
|
2764
|
-
return new
|
|
2764
|
+
return new le(i, n.reduce());
|
|
2765
2765
|
}).filter((t) => !t.power.isZero())), this;
|
|
2766
2766
|
}
|
|
2767
2767
|
root(e) {
|
|
2768
|
-
return h(this,
|
|
2768
|
+
return h(this, E, s(this, E).map((t) => t.root(e))), this;
|
|
2769
2769
|
}
|
|
2770
2770
|
sort() {
|
|
2771
|
-
return h(this,
|
|
2771
|
+
return h(this, E, s(this, E).sort((e, t) => e.degree().isLeq(t.degree()) ? -1 : 1)), this;
|
|
2772
2772
|
}
|
|
2773
2773
|
sqrt() {
|
|
2774
|
-
return h(this,
|
|
2774
|
+
return h(this, E, s(this, E).map((e) => e.sqrt())), this;
|
|
2775
2775
|
}
|
|
2776
2776
|
subtract(...e) {
|
|
2777
2777
|
return this.add(...e.map((t) => t.opposite()));
|
|
2778
2778
|
}
|
|
2779
2779
|
tableOfSigns() {
|
|
2780
|
-
const e = this.getZeroes(), t = this.factors.map((n) => ({ factor: new
|
|
2780
|
+
const e = this.getZeroes(), t = this.factors.map((n) => ({ factor: new le(n), ...n.tableOfSigns(e) }));
|
|
2781
2781
|
return { signs: t.map((n) => n.signs).reduce((n, r) => (n.length === 0 ? n = r : r.forEach((l, c) => {
|
|
2782
2782
|
switch (l) {
|
|
2783
2783
|
case "d":
|
|
@@ -2796,21 +2796,21 @@ const me = class me {
|
|
|
2796
2796
|
}), n), []), roots: e, factors: t };
|
|
2797
2797
|
}
|
|
2798
2798
|
get variables() {
|
|
2799
|
-
return s(this,
|
|
2799
|
+
return s(this, E).reduce((e, t) => e.concat(t.variables), []);
|
|
2800
2800
|
}
|
|
2801
2801
|
zero() {
|
|
2802
|
-
return h(this,
|
|
2802
|
+
return h(this, E, [new le("0", "1")]), this;
|
|
2803
2803
|
}
|
|
2804
2804
|
};
|
|
2805
|
-
tt = new WeakMap(),
|
|
2805
|
+
tt = new WeakMap(), E = new WeakMap(), mt = new WeakSet(), ri = function(e, t) {
|
|
2806
2806
|
const i = ei(e), n = ei(t), l = Object.keys(i).filter((c) => Object.hasOwn(n, c)).map((c) => {
|
|
2807
|
-
const d = i[c].reduce((g,
|
|
2808
|
-
return new
|
|
2807
|
+
const d = i[c].reduce((g, N) => g.add(N.power), new u("0")), f = n[c].reduce((g, N) => g.add(N.power), new u("0"));
|
|
2808
|
+
return new le(c, u.min(d, f));
|
|
2809
2809
|
});
|
|
2810
2810
|
return new me(...l);
|
|
2811
2811
|
}, gt = new WeakSet(), oi = function() {
|
|
2812
2812
|
let e, t = [];
|
|
2813
|
-
return s(this, tt) === at.ROOT ? (e = this.numerator, t = this.denominator.map((i) => i.clone().inverse())) : e = s(this,
|
|
2813
|
+
return s(this, tt) === at.ROOT ? (e = this.numerator, t = this.denominator.map((i) => i.clone().inverse())) : e = s(this, E), e.length === 0 && (e = [new le("1")]), { num: e, den: t };
|
|
2814
2814
|
}, p(me, mt);
|
|
2815
2815
|
let ni = me;
|
|
2816
2816
|
function ei(o) {
|
|
@@ -2820,7 +2820,7 @@ function ei(o) {
|
|
|
2820
2820
|
const r = n.polynom.display;
|
|
2821
2821
|
return Object.hasOwn(i, r) ? i[r].push(n) : i[r] = [n], i;
|
|
2822
2822
|
}, {});
|
|
2823
|
-
return e.isOne() || (t[e.display] = [new
|
|
2823
|
+
return e.isOne() || (t[e.display] = [new le(e.display, 1)]), t;
|
|
2824
2824
|
}
|
|
2825
2825
|
function ts(o, e) {
|
|
2826
2826
|
return o.dimension === e.dimension && o.array.every(
|
|
@@ -3278,7 +3278,7 @@ const Ze = class Ze {
|
|
|
3278
3278
|
}
|
|
3279
3279
|
// ------------------------------------------
|
|
3280
3280
|
getEquation() {
|
|
3281
|
-
const e = new H(new
|
|
3281
|
+
const e = new H(new O().parse("xy", s(this, S), s(this, z), s(this, U)), new O("0"));
|
|
3282
3282
|
return s(this, Ie) ? e.simplify() : e;
|
|
3283
3283
|
}
|
|
3284
3284
|
// get system(): { x: Equation, y: Equation } {
|
|
@@ -3315,13 +3315,13 @@ const Ze = class Ze {
|
|
|
3315
3315
|
case "equation":
|
|
3316
3316
|
return this.getEquation().reorder().tex;
|
|
3317
3317
|
case "mxh":
|
|
3318
|
-
return this.slope.isInfinity() ? "x=" + this.OA.x.tex : "y=" + new
|
|
3318
|
+
return this.slope.isInfinity() ? "x=" + this.OA.x.tex : "y=" + new O().parse("x", this.slope, this.height).tex;
|
|
3319
3319
|
case "parametric":
|
|
3320
3320
|
case "system": {
|
|
3321
3321
|
const t = s(this, Q).clone();
|
|
3322
3322
|
return s(this, Ie) && t.simplify(), e === "parametric" ? `${x.asTex("x", "y")} = ${x.asTex(s(this, ne).x.tex, s(this, ne).y.tex)} + k\\cdot ${x.asTex(t.x.tex, t.y.tex)}` : `\\left\\{\\begin{aligned}
|
|
3323
|
-
x &= ${new
|
|
3324
|
-
y &= ${new
|
|
3323
|
+
x &= ${new O(s(this, ne).x).add(new M(s(this, Q).x).multiply(new M("k"))).reorder("k", !0).tex}\\\\
|
|
3324
|
+
y &= ${new O(s(this, ne).y).add(new M(s(this, Q).y).multiply(new M("k"))).reorder("k", !0).tex}
|
|
3325
3325
|
\\end{aligned}\\right.`;
|
|
3326
3326
|
}
|
|
3327
3327
|
default: {
|
|
@@ -3342,7 +3342,7 @@ const Ze = class Ze {
|
|
|
3342
3342
|
case "equation":
|
|
3343
3343
|
return this.getEquation().reorder().display;
|
|
3344
3344
|
case "mxh":
|
|
3345
|
-
return this.slope.isInfinity() ? "x=" + this.OA.x.display : "y=" + new
|
|
3345
|
+
return this.slope.isInfinity() ? "x=" + this.OA.x.display : "y=" + new O().parse("x", this.slope, this.height).display;
|
|
3346
3346
|
case "parametric": {
|
|
3347
3347
|
const t = s(this, Q).clone();
|
|
3348
3348
|
return s(this, Ie) && t.simplify(), `((x,y))=((${s(this, ne).x.display},${s(this, ne).y.display}))+k((${t.x.display},${t.y.display}))`;
|
|
@@ -3452,7 +3452,7 @@ const Wt = class Wt {
|
|
|
3452
3452
|
return [new R(e, t, we.Perpendicular)];
|
|
3453
3453
|
});
|
|
3454
3454
|
p(this, Ut, (e) => {
|
|
3455
|
-
const t = this.center.x.clone().subtract(e.x), i = this.center.y.clone().subtract(e.y), n = new
|
|
3455
|
+
const t = this.center.x.clone().subtract(e.x), i = this.center.y.clone().subtract(e.y), n = new O("x"), r = new O("x^2+1");
|
|
3456
3456
|
return n.multiply(t).subtract(i).pow(2), r.multiply(this.squareRadius), new H(n, r).solve().map((d) => {
|
|
3457
3457
|
let f;
|
|
3458
3458
|
const g = new H("y", "x");
|
|
@@ -3506,10 +3506,10 @@ const Wt = class Wt {
|
|
|
3506
3506
|
);
|
|
3507
3507
|
}
|
|
3508
3508
|
setRadius(e, t) {
|
|
3509
|
-
return t ? h(this, j, new u(e)) : h(this, j, new u(e).pow(2)),
|
|
3509
|
+
return t ? h(this, j, new u(e)) : h(this, j, new u(e).pow(2)), q(this, oe, Et).call(this), this;
|
|
3510
3510
|
}
|
|
3511
3511
|
parse(...e) {
|
|
3512
|
-
return
|
|
3512
|
+
return q(this, oe, Mi).call(this), typeof e[0] == "string" ? q(this, oe, ai).call(this, new H(e[0])) : e[0] instanceof H ? q(this, oe, ai).call(this, e[0]) : e[0] instanceof Wt ? q(this, oe, Ci).call(this, e[0]) : e[0] instanceof B && e.length > 1 && (e[1] instanceof B ? e[2] instanceof B || q(this, oe, Ii).call(this, e[0], e[1]) : (e[1] instanceof u || typeof e[1] == "number") && q(this, oe, $i).call(this, e[0], e[1], typeof e[2] == "boolean" ? e[2] : !1)), q(this, oe, Et).call(this), this;
|
|
3513
3513
|
}
|
|
3514
3514
|
// private _parseThroughtThreePoints(A: Point, B: Point, C: Point): this {
|
|
3515
3515
|
// const T = new Triangle(A, B, C), mAB = T.remarquables.mediators.AB.clone(),
|
|
@@ -3522,11 +3522,11 @@ re = new WeakMap(), j = new WeakMap(), qe = new WeakMap(), jt = new WeakMap(), U
|
|
|
3522
3522
|
return h(this, re, void 0), h(this, j, void 0), h(this, qe, void 0), this;
|
|
3523
3523
|
}, Et = function() {
|
|
3524
3524
|
h(this, qe, new H(
|
|
3525
|
-
new
|
|
3526
|
-
new
|
|
3525
|
+
new O(`(x-(${this.center.x.display}))^2+(y-(${this.center.y.display}))^2`),
|
|
3526
|
+
new O(this.squareRadius.display)
|
|
3527
3527
|
).moveLeft());
|
|
3528
3528
|
}, Ci = function(e) {
|
|
3529
|
-
return h(this, re, e.center.clone()), h(this, j, e.squareRadius.clone()),
|
|
3529
|
+
return h(this, re, e.center.clone()), h(this, j, e.squareRadius.clone()), q(this, oe, Et).call(this), this;
|
|
3530
3530
|
}, $i = function(e, t, i) {
|
|
3531
3531
|
return h(this, re, e.clone()), i ? h(this, j, new u(t)) : h(this, j, new u(t).pow(2)), this;
|
|
3532
3532
|
}, Ii = function(e, t) {
|
|
@@ -3614,11 +3614,11 @@ const lt = class lt {
|
|
|
3614
3614
|
return {
|
|
3615
3615
|
parametric: `${x.asTex("x", "y", "z")} = ${x.asTex(s(this, L).x.tex, s(this, L).y.tex, s(this, L).z.tex)} + k\\cdot ${x.asTex(s(this, W).x.tex, s(this, W).y.tex, s(this, W).z.tex)}`,
|
|
3616
3616
|
system: `\\left\\{\\begin{aligned}
|
|
3617
|
-
x &= ${new
|
|
3618
|
-
y &= ${new
|
|
3619
|
-
z &= ${new
|
|
3617
|
+
x &= ${new O(s(this, L).x).add(new M(s(this, W).x).multiply(new M("k"))).reorder("k", !0).tex}\\\\
|
|
3618
|
+
y &= ${new O(s(this, L).y).add(new M(s(this, W).y).multiply(new M("k"))).reorder("k", !0).tex}\\\\
|
|
3619
|
+
z &= ${new O(s(this, L).z).add(new M(s(this, W).z).multiply(new M("k"))).reorder("k", !0).tex}
|
|
3620
3620
|
\\end{aligned}\\right.`,
|
|
3621
|
-
cartesian: `\\frac{ ${new
|
|
3621
|
+
cartesian: `\\frac{ ${new O("x", 1, s(this, L).x.clone().opposite()).tex} }{ ${this.direction.x.tex} } = \\frac{ ${new O("y", 1, s(this, L).y.clone().opposite()).tex} }{ ${this.direction.y.tex} } = \\frac{ ${new O("z", 1, s(this, L).z.clone().opposite()).tex} }{ ${this.direction.z.tex} }`
|
|
3622
3622
|
};
|
|
3623
3623
|
}
|
|
3624
3624
|
get display() {
|
|
@@ -3708,8 +3708,8 @@ const gi = class gi {
|
|
|
3708
3708
|
}
|
|
3709
3709
|
get tex() {
|
|
3710
3710
|
return new H(
|
|
3711
|
-
new
|
|
3712
|
-
new
|
|
3711
|
+
new O("xyz", this.a, this.b, this.c, this.d),
|
|
3712
|
+
new O(0)
|
|
3713
3713
|
).reduce().tex;
|
|
3714
3714
|
}
|
|
3715
3715
|
parse(e) {
|
|
@@ -4033,7 +4033,7 @@ function Bi(o) {
|
|
|
4033
4033
|
const e = Object.assign(
|
|
4034
4034
|
as,
|
|
4035
4035
|
o
|
|
4036
|
-
), t = new
|
|
4036
|
+
), t = new O().empty();
|
|
4037
4037
|
let i;
|
|
4038
4038
|
for (let n = e.degree; n >= 0; n--)
|
|
4039
4039
|
i = Pi({
|
|
@@ -4069,7 +4069,7 @@ function ls(o) {
|
|
|
4069
4069
|
}
|
|
4070
4070
|
},
|
|
4071
4071
|
o
|
|
4072
|
-
), t = new
|
|
4072
|
+
), t = new O().one();
|
|
4073
4073
|
for (let i = 0; i < e.degree; i++) {
|
|
4074
4074
|
const n = Bi({
|
|
4075
4075
|
degree: 1,
|
|
@@ -4168,11 +4168,11 @@ const ds = {
|
|
|
4168
4168
|
Fraction: u,
|
|
4169
4169
|
Root: vt,
|
|
4170
4170
|
Monom: M,
|
|
4171
|
-
Polynom:
|
|
4171
|
+
Polynom: O,
|
|
4172
4172
|
Equation: H,
|
|
4173
4173
|
Matrix: hs,
|
|
4174
4174
|
LinearSystem: ii,
|
|
4175
|
-
Factor:
|
|
4175
|
+
Factor: le,
|
|
4176
4176
|
PolyFactor: ni,
|
|
4177
4177
|
LogicalSet: es,
|
|
4178
4178
|
Random: ds,
|
|
@@ -4192,7 +4192,7 @@ export {
|
|
|
4192
4192
|
H as Equation,
|
|
4193
4193
|
Nt as EquationSolver,
|
|
4194
4194
|
at as FACTOR_DISPLAY,
|
|
4195
|
-
|
|
4195
|
+
le as Factor,
|
|
4196
4196
|
u as Fraction,
|
|
4197
4197
|
R as Line,
|
|
4198
4198
|
At as Line3,
|
|
@@ -4201,10 +4201,13 @@ export {
|
|
|
4201
4201
|
hs as Matrix,
|
|
4202
4202
|
M as Monom,
|
|
4203
4203
|
vt as NthRoot,
|
|
4204
|
+
_i as NumExp,
|
|
4205
|
+
G as Numeric,
|
|
4204
4206
|
li as Plane3,
|
|
4205
4207
|
B as Point,
|
|
4206
4208
|
ni as PolyFactor,
|
|
4207
|
-
|
|
4209
|
+
O as Polynom,
|
|
4210
|
+
ds as Random,
|
|
4208
4211
|
ci as Triangle,
|
|
4209
4212
|
x as Vector,
|
|
4210
4213
|
is as areVectorsColinears,
|