pimath 0.1.21 → 0.1.22
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 +4 -0
- package/dist/pimath.interface.d.ts +1 -1
- package/dist/pimath.js +134 -128
- package/dist/pimath.js.map +1 -1
- package/package.json +1 -1
package/dist/pimath.js
CHANGED
|
@@ -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 fe, je, I, ot, ye, bi, ti, xi, Ei, Ni;
|
|
395
395
|
const mi = class mi {
|
|
396
396
|
constructor(e, t, i = "x") {
|
|
397
|
-
p(this,
|
|
398
|
-
p(this,
|
|
397
|
+
p(this, I);
|
|
398
|
+
p(this, fe);
|
|
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, fe, n.left.clone().subtract(n.right));
|
|
403
403
|
} else
|
|
404
|
-
h(this,
|
|
404
|
+
h(this, fe, e.clone().subtract(t ?? 0));
|
|
405
405
|
}
|
|
406
406
|
solve() {
|
|
407
|
-
if (s(this,
|
|
408
|
-
return q(this,
|
|
409
|
-
if (s(this,
|
|
410
|
-
return q(this,
|
|
411
|
-
const e = q(this,
|
|
407
|
+
if (s(this, fe).degree().isOne())
|
|
408
|
+
return q(this, I, xi).call(this);
|
|
409
|
+
if (s(this, fe).degree().value === 2)
|
|
410
|
+
return q(this, I, Ei).call(this);
|
|
411
|
+
const e = q(this, I, bi).call(this);
|
|
412
412
|
if (e.length > 0)
|
|
413
413
|
return e;
|
|
414
|
-
if (s(this,
|
|
415
|
-
return q(this,
|
|
414
|
+
if (s(this, fe).degree().value === 3)
|
|
415
|
+
return q(this, I, 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, fe).degree().value !== 3)
|
|
420
420
|
throw new Error("The equation is not cubic.");
|
|
421
|
-
return q(this,
|
|
421
|
+
return q(this, I, ti).call(this);
|
|
422
422
|
}
|
|
423
423
|
};
|
|
424
|
-
|
|
424
|
+
fe = new WeakMap(), je = new WeakMap(), I = new WeakSet(), ot = function(e, t) {
|
|
425
425
|
return {
|
|
426
426
|
variable: s(this, je),
|
|
427
427
|
exact: !1,
|
|
@@ -431,7 +431,7 @@ ue = 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 q(this,
|
|
434
|
+
return q(this, I, 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 @@ ue = 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, fe).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(q(this,
|
|
450
|
+
t.length === 0 && t.push(q(this, I, 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
454
|
const N = new u(g, f);
|
|
455
|
-
e.evaluate(N).isZero() && !t.find((V) => V.value === N.value) && t.push(q(this,
|
|
455
|
+
e.evaluate(N).isZero() && !t.find((V) => V.value === N.value) && t.push(q(this, I, ye).call(this, N)), N.opposite(), e.evaluate(N).isZero() && !t.find((V) => V.value === N.value) && t.push(q(this, I, 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, fe).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 @@ ue = 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,
|
|
472
|
-
if (
|
|
473
|
-
const he = g.clone().opposite().add(
|
|
474
|
-
return [q(this,
|
|
471
|
+
const e = s(this, fe), 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), pe = N.clone().pow(2).subtract(V.clone().multiply(4)).opposite();
|
|
472
|
+
if (pe.isNegative()) {
|
|
473
|
+
const he = g.clone().opposite().add(pe.clone().opposite().sqrt()).divide(2).root(3), ae = g.clone().opposite().subtract(pe.clone().opposite().sqrt()).divide(2).root(3), ge = he.clone().add(ae).subtract(l.clone().divide(3));
|
|
474
|
+
return [q(this, I, ye).call(this, ge)];
|
|
475
475
|
}
|
|
476
|
-
if (
|
|
476
|
+
if (pe.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) ? [q(this,
|
|
479
|
-
q(this,
|
|
480
|
-
q(this,
|
|
481
|
-
].sort((
|
|
478
|
+
return ae.isEqual(ge) ? [q(this, I, ye).call(this, ae)] : [
|
|
479
|
+
q(this, I, ye).call(this, ge),
|
|
480
|
+
q(this, I, ye).call(this, ae)
|
|
481
|
+
].sort((me, ce) => me.value - ce.value);
|
|
482
482
|
}
|
|
483
|
-
if (
|
|
484
|
-
const he = [], ae = f.value, ge = g.value,
|
|
483
|
+
if (pe.isPositive()) {
|
|
484
|
+
const he = [], ae = f.value, ge = g.value, me = l.value;
|
|
485
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) -
|
|
487
|
-
return he.map((ce) => q(this,
|
|
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) - me / 3);
|
|
487
|
+
return he.map((ce) => q(this, I, 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, fe).monomByDegree(0).coefficient.clone().opposite().divide(s(this, fe).monomByDegree(1).coefficient);
|
|
492
492
|
return [
|
|
493
|
-
q(this,
|
|
493
|
+
q(this, I, ye).call(this, e)
|
|
494
494
|
];
|
|
495
495
|
}, Ei = function() {
|
|
496
|
-
const e = s(this,
|
|
496
|
+
const e = s(this, fe), 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() ? [q(this,
|
|
502
|
-
q(this,
|
|
503
|
-
q(this,
|
|
501
|
+
return l.isZero() ? [q(this, I, ye).call(this, c)] : [
|
|
502
|
+
q(this, I, ye).call(this, c),
|
|
503
|
+
q(this, I, ye).call(this, d)
|
|
504
504
|
].sort((f, g) => f.value - g.value);
|
|
505
505
|
}
|
|
506
|
-
return q(this,
|
|
506
|
+
return q(this, I, Ni).call(this, t, i, r);
|
|
507
507
|
}, Ni = function(e, t, i) {
|
|
508
|
-
const n = G.dividers(i.value).filter((
|
|
509
|
-
function V(
|
|
510
|
-
return `\\frac{ ${ce} ${nt}\\sqrt{ ${Kt} } }{ ${
|
|
508
|
+
const n = G.dividers(i.value).filter((me) => Math.sqrt(me) % 1 === 0).map((me) => Math.sqrt(me)).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(me, ce, nt, Kt) {
|
|
510
|
+
return `\\frac{ ${ce} ${nt}\\sqrt{ ${Kt} } }{ ${me} }`;
|
|
511
511
|
}
|
|
512
|
-
function
|
|
513
|
-
return `(${ce}${nt}sqrt(${Kt}))/${
|
|
512
|
+
function pe(me, ce, nt, Kt) {
|
|
513
|
+
return `(${ce}${nt}sqrt(${Kt}))/${me}`;
|
|
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
|
-
q(this,
|
|
517
|
+
q(this, I, ot).call(this, ae, {
|
|
518
518
|
tex: V(c.tex, l.tex, g.toString(), d.tex),
|
|
519
|
-
display:
|
|
519
|
+
display: pe(c.display, l.display, g.toString(), d.display)
|
|
520
520
|
}),
|
|
521
|
-
q(this,
|
|
521
|
+
q(this, I, ot).call(this, ge, {
|
|
522
522
|
tex: V(c.tex, l.tex, N.toString(), d.tex),
|
|
523
|
-
display:
|
|
523
|
+
display: pe(c.display, l.display, N.toString(), d.display)
|
|
524
524
|
})
|
|
525
|
-
].sort((
|
|
525
|
+
].sort((me, ce) => me.value - ce.value);
|
|
526
526
|
};
|
|
527
527
|
let Nt = mi;
|
|
528
528
|
var Gi = Object.defineProperty, Ti = (o) => {
|
|
@@ -852,7 +852,7 @@ class _i {
|
|
|
852
852
|
}
|
|
853
853
|
}
|
|
854
854
|
var T, v, Ye, xt, Le, qt, kt;
|
|
855
|
-
const
|
|
855
|
+
const P = class P {
|
|
856
856
|
constructor(e) {
|
|
857
857
|
p(this, Ye);
|
|
858
858
|
p(this, T);
|
|
@@ -861,7 +861,7 @@ const I = class I {
|
|
|
861
861
|
* Clone the current Monom.
|
|
862
862
|
*/
|
|
863
863
|
a(this, "clone", () => {
|
|
864
|
-
const e = new
|
|
864
|
+
const e = new P();
|
|
865
865
|
e.coefficient = s(this, T).clone();
|
|
866
866
|
for (const t in s(this, v))
|
|
867
867
|
e.setLetter(t, s(this, v)[t].clone());
|
|
@@ -873,7 +873,7 @@ const I = class I {
|
|
|
873
873
|
*/
|
|
874
874
|
a(this, "add", (...e) => {
|
|
875
875
|
for (const t of e) {
|
|
876
|
-
const i = t instanceof
|
|
876
|
+
const i = t instanceof P ? t : new P(t);
|
|
877
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;
|
|
@@ -893,7 +893,7 @@ const I = class I {
|
|
|
893
893
|
const t = s(this, v)[e].clone(), i = this.clone();
|
|
894
894
|
return s(i, v)[e].subtract(1), s(i, T).multiply(new u(t.clone())), i;
|
|
895
895
|
} else
|
|
896
|
-
return new
|
|
896
|
+
return new P().zero();
|
|
897
897
|
});
|
|
898
898
|
/**
|
|
899
899
|
* Divide the current monoms by multiple monoms
|
|
@@ -901,7 +901,7 @@ const I = class I {
|
|
|
901
901
|
*/
|
|
902
902
|
a(this, "divide", (...e) => {
|
|
903
903
|
for (const t of e) {
|
|
904
|
-
const i = t instanceof
|
|
904
|
+
const i = t instanceof P ? t : new P(t);
|
|
905
905
|
s(this, T).divide(i.coefficient);
|
|
906
906
|
for (const n in i.literal)
|
|
907
907
|
s(this, v)[n] = this.hasVariable(n) ? s(this, v)[n].subtract(i.literal[n]) : i.literal[n].clone().opposite(), s(this, v)[n].isZero() && this.removeVariable(n);
|
|
@@ -1008,7 +1008,7 @@ const I = class I {
|
|
|
1008
1008
|
*/
|
|
1009
1009
|
a(this, "multiply", (...e) => {
|
|
1010
1010
|
for (const t of e) {
|
|
1011
|
-
const i = t instanceof
|
|
1011
|
+
const i = t instanceof P ? t : new P(t);
|
|
1012
1012
|
s(this, T).multiply(i.coefficient);
|
|
1013
1013
|
for (const n in i.literal)
|
|
1014
1014
|
this.hasVariable(n) ? s(this, v)[n].add(i.literal[n]) : s(this, v)[n] = i.literal[n].clone();
|
|
@@ -1075,7 +1075,7 @@ const I = class I {
|
|
|
1075
1075
|
*/
|
|
1076
1076
|
a(this, "subtract", (...e) => {
|
|
1077
1077
|
for (const t of e) {
|
|
1078
|
-
const i = t instanceof
|
|
1078
|
+
const i = t instanceof P ? t : new P(t);
|
|
1079
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;
|
|
@@ -1122,23 +1122,23 @@ const I = class I {
|
|
|
1122
1122
|
var d;
|
|
1123
1123
|
let i, n, r, l, c;
|
|
1124
1124
|
if (t.tokenType === m.COEFFICIENT)
|
|
1125
|
-
e.push(new
|
|
1125
|
+
e.push(new P(new u(t.token)));
|
|
1126
1126
|
else if (t.tokenType === m.VARIABLE) {
|
|
1127
|
-
const f = new
|
|
1127
|
+
const f = new P().one();
|
|
1128
1128
|
f.setLetter(t.token, 1), e.push(f.clone());
|
|
1129
1129
|
} else if (t.tokenType === m.OPERATION)
|
|
1130
1130
|
switch (t.token) {
|
|
1131
1131
|
case "-":
|
|
1132
|
-
n = e.pop() ?? new
|
|
1132
|
+
n = e.pop() ?? new P().zero(), i = e.pop() ?? new P().zero(), e.push(i.subtract(n));
|
|
1133
1133
|
break;
|
|
1134
1134
|
case "*":
|
|
1135
|
-
n = e.pop() ?? new
|
|
1135
|
+
n = e.pop() ?? new P().one(), i = e.pop() ?? new P().one(), e.push(i.multiply(n));
|
|
1136
1136
|
break;
|
|
1137
1137
|
case "/":
|
|
1138
|
-
n = e.pop() ?? new
|
|
1138
|
+
n = e.pop() ?? new P().one(), i = e.pop() ?? new P().one(), e.push(i.divide(n));
|
|
1139
1139
|
break;
|
|
1140
1140
|
case "^": {
|
|
1141
|
-
c = ((d = e.pop()) == null ? void 0 : d.coefficient) ?? new u().one(), r = e.pop() ?? new
|
|
1141
|
+
c = ((d = e.pop()) == null ? void 0 : d.coefficient) ?? new u().one(), r = e.pop() ?? new P().one(), l = r.variables[0], l && r.setLetter(l, c), e.push(r);
|
|
1142
1142
|
break;
|
|
1143
1143
|
}
|
|
1144
1144
|
}
|
|
@@ -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
|
|
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 P && (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}\\)
|
|
@@ -1193,20 +1193,20 @@ const I = class I {
|
|
|
1193
1193
|
if (t.length > 0 && e.length > 0)
|
|
1194
1194
|
for (const n of e)
|
|
1195
1195
|
for (const r of t) {
|
|
1196
|
-
const l = new
|
|
1196
|
+
const l = new P();
|
|
1197
1197
|
l.coefficient = new u(n), l.literal = r, i.push(l);
|
|
1198
1198
|
}
|
|
1199
1199
|
else if (e.length === 0)
|
|
1200
1200
|
for (const n of t) {
|
|
1201
|
-
const r = new
|
|
1201
|
+
const r = new P();
|
|
1202
1202
|
r.coefficient = new u().one(), r.literal = n, i.push(r);
|
|
1203
1203
|
}
|
|
1204
1204
|
else
|
|
1205
1205
|
for (const n of e) {
|
|
1206
|
-
const r = new
|
|
1206
|
+
const r = new P();
|
|
1207
1207
|
r.coefficient = new u(n), i.push(r);
|
|
1208
1208
|
}
|
|
1209
|
-
return i.length === 0 ? [new
|
|
1209
|
+
return i.length === 0 ? [new P().one()] : i;
|
|
1210
1210
|
}
|
|
1211
1211
|
integrate(e, t, i) {
|
|
1212
1212
|
const n = this.primitive(i);
|
|
@@ -1301,11 +1301,11 @@ const I = class I {
|
|
|
1301
1301
|
T = new WeakMap(), v = new WeakMap(), Ye = new WeakSet(), xt = function(e) {
|
|
1302
1302
|
for (const t in e.literal)
|
|
1303
1303
|
s(this, v)[t] = e.literal[t].clone();
|
|
1304
|
-
}, Le = new WeakMap(), qt = new WeakMap(), kt = new WeakMap(), a(
|
|
1304
|
+
}, Le = new WeakMap(), qt = new WeakMap(), kt = new WeakMap(), a(P, "gcd", (...e) => {
|
|
1305
1305
|
for (const r of e)
|
|
1306
1306
|
if (r.containsRationalPower())
|
|
1307
|
-
return new
|
|
1308
|
-
const t = new
|
|
1307
|
+
return new P().zero();
|
|
1308
|
+
const t = new P(), i = G.gcd(...e.map((r) => r.coefficient.numerator)), n = G.lcm(...e.map((r) => r.coefficient.denominator));
|
|
1309
1309
|
t.coefficient = new u(i, n).reduce();
|
|
1310
1310
|
for (const r of e) {
|
|
1311
1311
|
for (const l in t.literal)
|
|
@@ -1318,20 +1318,20 @@ T = new WeakMap(), v = new WeakMap(), Ye = new WeakSet(), xt = function(e) {
|
|
|
1318
1318
|
* Multiply two monoms and return a NEW monom.
|
|
1319
1319
|
* @param monoms
|
|
1320
1320
|
*/
|
|
1321
|
-
a(
|
|
1322
|
-
const t = new
|
|
1321
|
+
a(P, "xMultiply", (...e) => {
|
|
1322
|
+
const t = new P().one();
|
|
1323
1323
|
for (const i of e)
|
|
1324
1324
|
t.multiply(i);
|
|
1325
1325
|
return t;
|
|
1326
1326
|
});
|
|
1327
|
-
let M =
|
|
1327
|
+
let M = P;
|
|
1328
1328
|
function wi(o, e = !0) {
|
|
1329
1329
|
return e ? `\\left( ${o} \\right)` : `(${o})`;
|
|
1330
1330
|
}
|
|
1331
1331
|
function Re(o, e, t, i, n) {
|
|
1332
1332
|
return o.map((r, l) => i !== void 0 && l < i || n !== void 0 && l > n ? r : r === e ? t : r);
|
|
1333
1333
|
}
|
|
1334
|
-
var Ue, y, Qe, ut, Ke, ft, Mt, Ct, $t, Je,
|
|
1334
|
+
var Ue, y, Qe, ut, Ke, ft, Mt, Ct, $t, Je, Pt, dt, It, Bt, St, Rt, Oi, zt, Lt;
|
|
1335
1335
|
const C = class C {
|
|
1336
1336
|
constructor(e, ...t) {
|
|
1337
1337
|
p(this, Rt);
|
|
@@ -1462,7 +1462,7 @@ const C = class C {
|
|
|
1462
1462
|
t.push(i.clone()), i.one();
|
|
1463
1463
|
break;
|
|
1464
1464
|
} else {
|
|
1465
|
-
let c = s(this,
|
|
1465
|
+
let c = s(this, Pt).call(this, i, l, e ?? "x");
|
|
1466
1466
|
for (l = i.degree(e).value; c.length > 0; ) {
|
|
1467
1467
|
const d = c[0];
|
|
1468
1468
|
if (!i.isDividableBy(d))
|
|
@@ -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 N = i.monoms[0], V = i.monoms[i.monoms.length - 1],
|
|
1474
|
-
return V.isDivisible(he) ? N.isDivisible(
|
|
1473
|
+
const N = i.monoms[0], V = i.monoms[i.monoms.length - 1], pe = g.monoms[0], he = g.monoms[g.monoms.length - 1];
|
|
1474
|
+
return V.isDivisible(he) ? N.isDivisible(pe) : !1;
|
|
1475
1475
|
});
|
|
1476
1476
|
}
|
|
1477
1477
|
}
|
|
@@ -1574,7 +1574,7 @@ const C = class C {
|
|
|
1574
1574
|
r.degree(t).isEqual(e) && i.push(r.clone());
|
|
1575
1575
|
return i;
|
|
1576
1576
|
});
|
|
1577
|
-
a(this, "multiply", (e) => e instanceof C ? s(this, St).call(this, e) : e instanceof u ? s(this, dt).call(this, e) : e instanceof M ? s(this, Bt).call(this, e) : Number.isSafeInteger(e) && typeof e == "number" ? s(this,
|
|
1577
|
+
a(this, "multiply", (e) => e instanceof C ? s(this, St).call(this, e) : e instanceof u ? s(this, dt).call(this, e) : e instanceof M ? s(this, Bt).call(this, e) : Number.isSafeInteger(e) && typeof e == "number" ? s(this, It).call(this, e) : this);
|
|
1578
1578
|
a(this, "one", () => (h(this, y, []), s(this, y).push(new M().one()), this));
|
|
1579
1579
|
// ------------------------------------------
|
|
1580
1580
|
a(this, "opposite", () => (h(this, y, s(this, y).map((e) => e.opposite())), this));
|
|
@@ -1689,10 +1689,10 @@ 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),
|
|
1692
|
+
const V = new C("x", n.coefficient, r.coefficient, l.coefficient), pe = s(N = V, $t).call(N, "x"), he = [];
|
|
1693
1693
|
let ae;
|
|
1694
|
-
if (
|
|
1695
|
-
for (const ge of
|
|
1694
|
+
if (pe.length >= 2) {
|
|
1695
|
+
for (const ge of pe)
|
|
1696
1696
|
ge.degree().isZero() ? he.push(ge.clone()) : (ae = ge.clone(), ae.monoms[0].literal = n.literalSqrt, ae.monoms[1].literal = l.literalSqrt, he.push(ae.clone()));
|
|
1697
1697
|
return he;
|
|
1698
1698
|
}
|
|
@@ -1709,7 +1709,7 @@ const C = class C {
|
|
|
1709
1709
|
}
|
|
1710
1710
|
return i === !0 && this.length > 1 && (e === "tex" ? r = `\\left( ${r} \\right)` : r = `(${r})`), r === "" && (r = "0"), r;
|
|
1711
1711
|
});
|
|
1712
|
-
p(this,
|
|
1712
|
+
p(this, Pt, (e, t, i) => {
|
|
1713
1713
|
const n = e.monoms[0].dividers, r = e.monoms[e.monoms.length - 1].dividers, l = [];
|
|
1714
1714
|
return n.forEach((c) => {
|
|
1715
1715
|
c.degree(i).isLeq(t) && r.forEach((d) => {
|
|
@@ -1722,7 +1722,7 @@ const C = class C {
|
|
|
1722
1722
|
t.coefficient.multiply(e);
|
|
1723
1723
|
return this.reduce();
|
|
1724
1724
|
});
|
|
1725
|
-
p(this,
|
|
1725
|
+
p(this, It, (e) => s(this, dt).call(this, new u(e)));
|
|
1726
1726
|
p(this, Bt, (e) => {
|
|
1727
1727
|
for (const t of s(this, y))
|
|
1728
1728
|
t.multiply(e);
|
|
@@ -1884,7 +1884,7 @@ const C = class C {
|
|
|
1884
1884
|
return this.getZeroes();
|
|
1885
1885
|
}
|
|
1886
1886
|
};
|
|
1887
|
-
Ue = new WeakMap(), y = new WeakMap(), Qe = new WeakMap(), ut = new WeakMap(), Ke = new WeakMap(), ft = new WeakMap(), Mt = new WeakMap(), Ct = new WeakMap(), $t = new WeakMap(), Je = new WeakMap(),
|
|
1887
|
+
Ue = new WeakMap(), y = new WeakMap(), Qe = new WeakMap(), ut = new WeakMap(), Ke = new WeakMap(), ft = new WeakMap(), Mt = new WeakMap(), Ct = new WeakMap(), $t = new WeakMap(), Je = new WeakMap(), Pt = new WeakMap(), dt = new WeakMap(), It = new WeakMap(), Bt = new WeakMap(), St = new WeakMap(), Rt = new WeakSet(), Oi = function(e, ...t) {
|
|
1888
1888
|
if (t.length === 0) {
|
|
1889
1889
|
if (e = "" + e, e !== "" && !isNaN(Number(e))) {
|
|
1890
1890
|
this.empty();
|
|
@@ -2610,7 +2610,7 @@ Oe = new WeakMap(), pt = new WeakSet(), si = function(e, t) {
|
|
|
2610
2610
|
return [...i[0]].sort();
|
|
2611
2611
|
};
|
|
2612
2612
|
var tt, E, mt, ri, gt, oi;
|
|
2613
|
-
const
|
|
2613
|
+
const ue = class ue {
|
|
2614
2614
|
constructor(...e) {
|
|
2615
2615
|
p(this, gt);
|
|
2616
2616
|
p(this, tt, at.POWER);
|
|
@@ -2622,11 +2622,11 @@ const me = class me {
|
|
|
2622
2622
|
if (typeof t == "string") {
|
|
2623
2623
|
const i = t.split(")(").join(")*(").split("*");
|
|
2624
2624
|
s(this, E).push(...i.map((n) => new le(n)));
|
|
2625
|
-
} else t instanceof
|
|
2625
|
+
} else t instanceof ue ? 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
|
|
2629
|
+
return new ue(...s(this, E).map((e) => e.clone()));
|
|
2630
2630
|
}
|
|
2631
2631
|
get tex() {
|
|
2632
2632
|
const { num: e, den: t } = q(this, gt, oi).call(this);
|
|
@@ -2645,20 +2645,20 @@ const me = class me {
|
|
|
2645
2645
|
static gcd(...e) {
|
|
2646
2646
|
var i;
|
|
2647
2647
|
if (e.length === 0)
|
|
2648
|
-
return new
|
|
2648
|
+
return new ue().one();
|
|
2649
2649
|
if (e.length === 1)
|
|
2650
2650
|
return e[0];
|
|
2651
2651
|
if (e.length === 2)
|
|
2652
|
-
return q(i =
|
|
2652
|
+
return q(i = ue, 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 = q(r =
|
|
2656
|
+
return t = q(r = ue, mt, ri).call(r, t, n);
|
|
2657
2657
|
}), t;
|
|
2658
2658
|
}
|
|
2659
2659
|
add(...e) {
|
|
2660
2660
|
let t = [this, ...e];
|
|
2661
|
-
const i =
|
|
2661
|
+
const i = ue.gcd(...t);
|
|
2662
2662
|
t = t.map((r) => r.divide(i).reduce());
|
|
2663
2663
|
const n = new O("0");
|
|
2664
2664
|
return t.forEach((r) => n.add(r.develop())), h(this, E, [
|
|
@@ -2682,7 +2682,7 @@ const me = class me {
|
|
|
2682
2682
|
const e = [], t = s(this, E).length;
|
|
2683
2683
|
for (let n = 0; n < t; n++) {
|
|
2684
2684
|
const r = s(this, E).slice(), l = r.splice(n, 1)[0];
|
|
2685
|
-
e.push(new
|
|
2685
|
+
e.push(new ue(...r).multiply(new ue(...l.derivative())));
|
|
2686
2686
|
}
|
|
2687
2687
|
e.forEach((n) => n.reduce());
|
|
2688
2688
|
const i = e.shift();
|
|
@@ -2727,7 +2727,7 @@ const me = class me {
|
|
|
2727
2727
|
return h(this, E, s(this, E).map((e) => e.inverse())), this;
|
|
2728
2728
|
}
|
|
2729
2729
|
isEqual(e) {
|
|
2730
|
-
const t =
|
|
2730
|
+
const t = ue.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() {
|
|
@@ -2770,6 +2770,12 @@ const me = class me {
|
|
|
2770
2770
|
sort() {
|
|
2771
2771
|
return h(this, E, s(this, E).sort((e, t) => e.degree().isLeq(t.degree()) ? -1 : 1)), this;
|
|
2772
2772
|
}
|
|
2773
|
+
splitFactors() {
|
|
2774
|
+
return {
|
|
2775
|
+
numerator: new ue(...s(this, E).filter((e) => e.power.isPositive())),
|
|
2776
|
+
denominator: new ue(...s(this, E).filter((e) => e.power.isStrictlyNegative()))
|
|
2777
|
+
};
|
|
2778
|
+
}
|
|
2773
2779
|
sqrt() {
|
|
2774
2780
|
return h(this, E, s(this, E).map((e) => e.sqrt())), this;
|
|
2775
2781
|
}
|
|
@@ -2807,12 +2813,12 @@ tt = new WeakMap(), E = new WeakMap(), mt = new WeakSet(), ri = function(e, t) {
|
|
|
2807
2813
|
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
2814
|
return new le(c, u.min(d, f));
|
|
2809
2815
|
});
|
|
2810
|
-
return new
|
|
2816
|
+
return new ue(...l);
|
|
2811
2817
|
}, gt = new WeakSet(), oi = function() {
|
|
2812
2818
|
let e, t = [];
|
|
2813
2819
|
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
|
-
}, p(
|
|
2815
|
-
let ni =
|
|
2820
|
+
}, p(ue, mt);
|
|
2821
|
+
let ni = ue;
|
|
2816
2822
|
function ei(o) {
|
|
2817
2823
|
const e = new u().one(), t = o.factors.reduce((i, n) => {
|
|
2818
2824
|
if (n.polynom.degree().isZero())
|
|
@@ -3041,22 +3047,22 @@ var we = /* @__PURE__ */ ((o) => (o.None = "none", o.Parallel = "parallel", o.Pe
|
|
|
3041
3047
|
function qi(o = 0.5) {
|
|
3042
3048
|
return Math.random() < o;
|
|
3043
3049
|
}
|
|
3044
|
-
function
|
|
3050
|
+
function de(o, e, t) {
|
|
3045
3051
|
if (e === void 0)
|
|
3046
|
-
return o >= 0 ?
|
|
3052
|
+
return o >= 0 ? de(0, o) : de(o, 0);
|
|
3047
3053
|
if (o === e)
|
|
3048
3054
|
return o;
|
|
3049
3055
|
if (t === void 0)
|
|
3050
3056
|
return Math.floor(Math.random() * (e - o + 1) + o);
|
|
3051
3057
|
if (Math.abs(e - o) <= t.length)
|
|
3052
3058
|
throw new Error("The number of excluded values is too high.");
|
|
3053
|
-
let i =
|
|
3059
|
+
let i = de(o, e);
|
|
3054
3060
|
for (; t.includes(i); )
|
|
3055
|
-
i =
|
|
3061
|
+
i = de(o, e);
|
|
3056
3062
|
return i;
|
|
3057
3063
|
}
|
|
3058
3064
|
function Y(o, e) {
|
|
3059
|
-
return e === !1 ? qi() ?
|
|
3065
|
+
return e === !1 ? qi() ? de(1, o) : -de(1, o) : de(-o, o);
|
|
3060
3066
|
}
|
|
3061
3067
|
function rs(o) {
|
|
3062
3068
|
let e = G.primes();
|
|
@@ -3066,7 +3072,7 @@ function os(o, e) {
|
|
|
3066
3072
|
return e === void 0 && (e = 1), o.length <= 0 ? Object.values(o) : ki(o).slice(0, e);
|
|
3067
3073
|
}
|
|
3068
3074
|
function pi(o) {
|
|
3069
|
-
return o.length === 0 ? null : o[
|
|
3075
|
+
return o.length === 0 ? null : o[de(0, o.length - 1)];
|
|
3070
3076
|
}
|
|
3071
3077
|
function ki(o) {
|
|
3072
3078
|
const e = Object.values(o);
|
|
@@ -3102,7 +3108,7 @@ class B extends x {
|
|
|
3102
3108
|
return e.array = this.copy(), e.asPoint = !0, e;
|
|
3103
3109
|
}
|
|
3104
3110
|
}
|
|
3105
|
-
var
|
|
3111
|
+
var Pe, S, z, U, ne, Q, Ie, be;
|
|
3106
3112
|
const Ze = class Ze {
|
|
3107
3113
|
/**
|
|
3108
3114
|
* Value can be a mix of:
|
|
@@ -3110,14 +3116,14 @@ const Ze = class Ze {
|
|
|
3110
3116
|
* @param values
|
|
3111
3117
|
*/
|
|
3112
3118
|
constructor(...e) {
|
|
3113
|
-
p(this,
|
|
3119
|
+
p(this, Pe);
|
|
3114
3120
|
// ax + by + c = 0
|
|
3115
3121
|
p(this, S);
|
|
3116
3122
|
p(this, z);
|
|
3117
3123
|
p(this, U);
|
|
3118
3124
|
p(this, ne);
|
|
3119
3125
|
p(this, Q);
|
|
3120
|
-
p(this,
|
|
3126
|
+
p(this, Ie);
|
|
3121
3127
|
p(this, be, "canonical");
|
|
3122
3128
|
a(this, "randomPoint", (e) => {
|
|
3123
3129
|
const t = s(this, Q).clone().multiplyByScalar(Y(e === void 0 || e <= 1 ? 3 : e, !1)).add(s(this, ne));
|
|
@@ -3189,19 +3195,19 @@ const Ze = class Ze {
|
|
|
3189
3195
|
e.left.monomByDegree(0).coefficient
|
|
3190
3196
|
);
|
|
3191
3197
|
});
|
|
3192
|
-
a(this, "fromCoefficient", (e, t, i) => (h(this, S, new u(e)), h(this, z, new u(t)), h(this, U, new u(i)), h(this, Q, new x(s(this, z).clone(), s(this, S).clone().opposite())), h(this, ne, new x(new u().zero(), s(this, U).clone())), h(this,
|
|
3198
|
+
a(this, "fromCoefficient", (e, t, i) => (h(this, S, new u(e)), h(this, z, new u(t)), h(this, U, new u(i)), h(this, Q, new x(s(this, z).clone(), s(this, S).clone().opposite())), h(this, ne, new x(new u().zero(), s(this, U).clone())), h(this, Ie, s(this, Q).clone().normal()), this));
|
|
3193
3199
|
a(this, "fromPointAndDirection", (e, t) => (this.fromCoefficient(
|
|
3194
3200
|
t.y,
|
|
3195
3201
|
t.x.clone().opposite(),
|
|
3196
3202
|
e.x.clone().multiply(t.y).subtract(e.y.clone().multiply(t.x)).opposite()
|
|
3197
|
-
), h(this, ne, e.clone()), h(this, Q, t.clone()), h(this,
|
|
3203
|
+
), h(this, ne, e.clone()), h(this, Q, t.clone()), h(this, Ie, s(this, Q).clone().normal()), this));
|
|
3198
3204
|
a(this, "fromPointAndNormal", (e, t) => this.fromCoefficient(
|
|
3199
3205
|
t.x,
|
|
3200
3206
|
t.y,
|
|
3201
3207
|
e.x.clone().multiply(t.x).add(e.y.clone().multiply(t.y)).opposite()
|
|
3202
3208
|
));
|
|
3203
3209
|
a(this, "fromPointAndLine", (e, t, i) => (i === void 0 && (i = we.Parallel), i === we.Parallel ? this.fromPointAndNormal(e, t.normal) : i === we.Perpendicular ? this.fromPointAndNormal(e, t.director) : this));
|
|
3204
|
-
a(this, "clone", () => (h(this, S, s(this, S).clone()), h(this, z, s(this, z).clone()), h(this, U, s(this, U).clone()), h(this, Q, s(this, Q).clone()), h(this, ne, s(this, ne).clone()), h(this,
|
|
3210
|
+
a(this, "clone", () => (h(this, S, s(this, S).clone()), h(this, z, s(this, z).clone()), h(this, U, s(this, U).clone()), h(this, Q, s(this, Q).clone()), h(this, ne, s(this, ne).clone()), h(this, Ie, s(this, Ie).clone()), this));
|
|
3205
3211
|
// ------------------------------------------
|
|
3206
3212
|
// Mathematical operations
|
|
3207
3213
|
// ------------------------------------------
|
|
@@ -3239,7 +3245,7 @@ const Ze = class Ze {
|
|
|
3239
3245
|
const t = this.getEquation().isolate("x"), i = new u(e);
|
|
3240
3246
|
return t instanceof H ? t.right.evaluate({ y: i }) : new u().invalid();
|
|
3241
3247
|
});
|
|
3242
|
-
return h(this, S, new u().zero()), h(this, z, new u().zero()), h(this, U, new u().zero()), h(this, ne, new x()), h(this, Q, new x()), h(this,
|
|
3248
|
+
return h(this, S, new u().zero()), h(this, z, new u().zero()), h(this, U, new u().zero()), h(this, ne, new x()), h(this, Q, new x()), h(this, Ie, new x()), h(this, Pe, !0), e.length > 0 && this.parse(...e), this;
|
|
3243
3249
|
}
|
|
3244
3250
|
get a() {
|
|
3245
3251
|
return s(this, S);
|
|
@@ -3274,12 +3280,12 @@ const Ze = class Ze {
|
|
|
3274
3280
|
h(this, Q, e);
|
|
3275
3281
|
}
|
|
3276
3282
|
get n() {
|
|
3277
|
-
return s(this,
|
|
3283
|
+
return s(this, Ie);
|
|
3278
3284
|
}
|
|
3279
3285
|
// ------------------------------------------
|
|
3280
3286
|
getEquation() {
|
|
3281
3287
|
const e = new H(new O().parse("xy", s(this, S), s(this, z), s(this, U)), new O("0"));
|
|
3282
|
-
return s(this,
|
|
3288
|
+
return s(this, Pe) ? e.simplify() : e;
|
|
3283
3289
|
}
|
|
3284
3290
|
// get system(): { x: Equation, y: Equation } {
|
|
3285
3291
|
// const e1 = new Equation(
|
|
@@ -3319,7 +3325,7 @@ const Ze = class Ze {
|
|
|
3319
3325
|
case "parametric":
|
|
3320
3326
|
case "system": {
|
|
3321
3327
|
const t = s(this, Q).clone();
|
|
3322
|
-
return s(this,
|
|
3328
|
+
return s(this, Pe) && 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
3329
|
x &= ${new O(s(this, ne).x).add(new M(s(this, Q).x).multiply(new M("k"))).reorder("k", !0).tex}\\\\
|
|
3324
3330
|
y &= ${new O(s(this, ne).y).add(new M(s(this, Q).y).multiply(new M("k"))).reorder("k", !0).tex}
|
|
3325
3331
|
\\end{aligned}\\right.`;
|
|
@@ -3331,10 +3337,10 @@ const Ze = class Ze {
|
|
|
3331
3337
|
}
|
|
3332
3338
|
}
|
|
3333
3339
|
get reduceBeforeDisplay() {
|
|
3334
|
-
return s(this,
|
|
3340
|
+
return s(this, Pe);
|
|
3335
3341
|
}
|
|
3336
3342
|
set reduceBeforeDisplay(e) {
|
|
3337
|
-
h(this,
|
|
3343
|
+
h(this, Pe, e);
|
|
3338
3344
|
}
|
|
3339
3345
|
get display() {
|
|
3340
3346
|
const e = s(this, be);
|
|
@@ -3345,7 +3351,7 @@ const Ze = class Ze {
|
|
|
3345
3351
|
return this.slope.isInfinity() ? "x=" + this.OA.x.display : "y=" + new O().parse("x", this.slope, this.height).display;
|
|
3346
3352
|
case "parametric": {
|
|
3347
3353
|
const t = s(this, Q).clone();
|
|
3348
|
-
return s(this,
|
|
3354
|
+
return s(this, Pe) && t.simplify(), `((x,y))=((${s(this, ne).x.display},${s(this, ne).y.display}))+k((${t.x.display},${t.y.display}))`;
|
|
3349
3355
|
}
|
|
3350
3356
|
default: {
|
|
3351
3357
|
const t = this.getEquation();
|
|
@@ -3402,10 +3408,10 @@ const Ze = class Ze {
|
|
|
3402
3408
|
return s(this, S).isZero() || (s(this, S).isOne() ? t = "x" : s(this, S).clone().opposite().isOne() ? t = "-x" : t = s(this, S).value.toFixed(e) + "x"), s(this, z).isZero() || (s(this, z).isPositive() && (t += "+"), t += s(this, z).value.toFixed(e) + "y"), s(this, U).isZero() || (s(this, U).isPositive() && (t += "+"), t += s(this, U).value.toFixed(e)), t + "=0";
|
|
3403
3409
|
}
|
|
3404
3410
|
};
|
|
3405
|
-
|
|
3411
|
+
Pe = new WeakMap(), S = new WeakMap(), z = new WeakMap(), U = new WeakMap(), ne = new WeakMap(), Q = new WeakMap(), Ie = new WeakMap(), be = new WeakMap(), // A line is defined as the canonical form
|
|
3406
3412
|
a(Ze, "PERPENDICULAR", we.Perpendicular), a(Ze, "PARALLEL", we.Parallel);
|
|
3407
3413
|
let R = Ze;
|
|
3408
|
-
var re, j, qe, jt, Ut, Gt, oe, Mi, Et, Ci, $i,
|
|
3414
|
+
var re, j, qe, jt, Ut, Gt, oe, Mi, Et, Ci, $i, Pi, ai;
|
|
3409
3415
|
const Wt = class Wt {
|
|
3410
3416
|
constructor(...e) {
|
|
3411
3417
|
p(this, oe);
|
|
@@ -3509,7 +3515,7 @@ const Wt = class Wt {
|
|
|
3509
3515
|
return t ? h(this, j, new u(e)) : h(this, j, new u(e).pow(2)), q(this, oe, Et).call(this), this;
|
|
3510
3516
|
}
|
|
3511
3517
|
parse(...e) {
|
|
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,
|
|
3518
|
+
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, Pi).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
3519
|
}
|
|
3514
3520
|
// private _parseThroughtThreePoints(A: Point, B: Point, C: Point): this {
|
|
3515
3521
|
// const T = new Triangle(A, B, C), mAB = T.remarquables.mediators.AB.clone(),
|
|
@@ -3529,7 +3535,7 @@ re = new WeakMap(), j = new WeakMap(), qe = new WeakMap(), jt = new WeakMap(), U
|
|
|
3529
3535
|
return h(this, re, e.center.clone()), h(this, j, e.squareRadius.clone()), q(this, oe, Et).call(this), this;
|
|
3530
3536
|
}, $i = function(e, t, i) {
|
|
3531
3537
|
return h(this, re, e.clone()), i ? h(this, j, new u(t)) : h(this, j, new u(t).pow(2)), this;
|
|
3532
|
-
},
|
|
3538
|
+
}, Pi = function(e, t) {
|
|
3533
3539
|
return h(this, re, e.clone()), h(this, j, new x(s(this, re), t).normSquare), this;
|
|
3534
3540
|
}, ai = function(e) {
|
|
3535
3541
|
if (e.moveLeft(), e.degree("x").value === 2 && e.degree("y").value === 2) {
|
|
@@ -3984,16 +3990,16 @@ function Ot(o) {
|
|
|
3984
3990
|
},
|
|
3985
3991
|
o
|
|
3986
3992
|
), t = new u();
|
|
3987
|
-
if (e.negative ? t.numerator = Y(e.max, e.zero) : t.numerator =
|
|
3993
|
+
if (e.negative ? t.numerator = Y(e.max, e.zero) : t.numerator = de(e.zero ? 0 : 1, e.max), e.natural)
|
|
3988
3994
|
t.denominator = 1;
|
|
3989
3995
|
else {
|
|
3990
3996
|
let i = 0;
|
|
3991
3997
|
for (; t.isRelative() && i < 10; )
|
|
3992
|
-
t.denominator =
|
|
3998
|
+
t.denominator = de(1, e.max), i++;
|
|
3993
3999
|
}
|
|
3994
4000
|
return e.reduced ? t.reduce() : t;
|
|
3995
4001
|
}
|
|
3996
|
-
function
|
|
4002
|
+
function Ii(o) {
|
|
3997
4003
|
const e = Object.assign(
|
|
3998
4004
|
{
|
|
3999
4005
|
letters: "x",
|
|
@@ -4036,7 +4042,7 @@ function Bi(o) {
|
|
|
4036
4042
|
), t = new O().empty();
|
|
4037
4043
|
let i;
|
|
4038
4044
|
for (let n = e.degree; n >= 0; n--)
|
|
4039
|
-
i =
|
|
4045
|
+
i = Ii({
|
|
4040
4046
|
letters: e.letters,
|
|
4041
4047
|
degree: n,
|
|
4042
4048
|
fraction: e.fraction,
|
|
@@ -4044,7 +4050,7 @@ function Bi(o) {
|
|
|
4044
4050
|
}), e.unit && e.degree === n && i.coefficient.one(), t.add(i);
|
|
4045
4051
|
if (e.positive && t.monomByDegree().coefficient.isNegative() && t.monomByDegree().coefficient.opposite(), e.numberOfMonoms && e.numberOfMonoms > 0 && e.numberOfMonoms < t.length)
|
|
4046
4052
|
for (; t.length > e.numberOfMonoms; ) {
|
|
4047
|
-
const n =
|
|
4053
|
+
const n = de(1, t.length - 1);
|
|
4048
4054
|
t.monoms.splice(n, 1);
|
|
4049
4055
|
}
|
|
4050
4056
|
return t.reduce();
|
|
@@ -4106,7 +4112,7 @@ function cs(o) {
|
|
|
4106
4112
|
o
|
|
4107
4113
|
), t = ui(e.center);
|
|
4108
4114
|
let i, n;
|
|
4109
|
-
return e.pointsOnCircle === 8 ? (i =
|
|
4115
|
+
return e.pointsOnCircle === 8 ? (i = de(1, 3), n = i ** 2 + (i + 1) ** 2) : n = de(1, 20), new Tt(t, n, !0);
|
|
4110
4116
|
}
|
|
4111
4117
|
function us(o) {
|
|
4112
4118
|
const e = Object.assign(
|
|
@@ -4146,9 +4152,9 @@ function fs(o) {
|
|
|
4146
4152
|
const ds = {
|
|
4147
4153
|
equation: (o) => ls(o),
|
|
4148
4154
|
polynom: (o) => Bi(o),
|
|
4149
|
-
monom: (o) =>
|
|
4155
|
+
monom: (o) => Ii(o),
|
|
4150
4156
|
fraction: (o) => Ot(o),
|
|
4151
|
-
number: (o, e, t) =>
|
|
4157
|
+
number: (o, e, t) => de(o, e, t),
|
|
4152
4158
|
numberSym: (o, e) => Y(o, e),
|
|
4153
4159
|
prime: (o) => rs(o),
|
|
4154
4160
|
bool: (o) => qi(o),
|