pimath 0.1.15 → 0.1.17
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 +229 -259
- package/package.json +1 -1
- package/types/algebra/equation.d.ts +1 -1
- package/types/algebra/equation.d.ts.map +1 -1
- package/types/algebra/monom.d.ts +1 -1
- package/types/algebra/monom.d.ts.map +1 -1
- package/types/algebra/polyFactor.d.ts +1 -0
- package/types/algebra/polyFactor.d.ts.map +1 -1
- package/types/algebra/polynom.d.ts.map +1 -1
- package/types/coefficients/fraction.d.ts.map +1 -1
- package/types/index.d.ts +0 -1
- package/types/index.d.ts.map +1 -1
- package/types/randomization/random.d.ts +9 -9
package/dist/pimath.js
CHANGED
|
@@ -5,14 +5,14 @@ var di = (o) => {
|
|
|
5
5
|
var Pi = (o, e, t) => e in o ? Ii(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
|
|
6
6
|
var a = (o, e, t) => Pi(o, typeof e != "symbol" ? e + "" : e, t), Qt = (o, e, t) => e.has(o) || di("Cannot " + t);
|
|
7
7
|
var s = (o, e, t) => (Qt(o, e, "read from private field"), t ? t.call(o) : e.get(o)), p = (o, e, t) => e.has(o) ? di("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(o) : e.set(o, t), h = (o, e, t, i) => (Qt(o, e, "write to private field"), i ? i.call(o, t) : e.set(o, t), t), q = (o, e, t) => (Qt(o, e, "access private method"), t);
|
|
8
|
-
function
|
|
8
|
+
function Bi(o) {
|
|
9
9
|
const e = mi(o), t = [];
|
|
10
10
|
let i, n;
|
|
11
11
|
for (; e.length > 0; )
|
|
12
12
|
i = e.shift() ?? 1, n = (e.length > 0 ? e.pop() : +i) ?? 1, t.push([i, n]);
|
|
13
13
|
return t;
|
|
14
14
|
}
|
|
15
|
-
function
|
|
15
|
+
function Si(...o) {
|
|
16
16
|
const e = ai(...o);
|
|
17
17
|
return o.map((t) => t / e);
|
|
18
18
|
}
|
|
@@ -67,9 +67,9 @@ function Zi(o, e = 2) {
|
|
|
67
67
|
return +`${Math.round(+`${o}e${e}`)}e-${e}`;
|
|
68
68
|
}
|
|
69
69
|
const G = {
|
|
70
|
-
decompose:
|
|
70
|
+
decompose: Bi,
|
|
71
71
|
dividers: mi,
|
|
72
|
-
divideNumbersByGCD:
|
|
72
|
+
divideNumbersByGCD: Si,
|
|
73
73
|
gcd: ai,
|
|
74
74
|
lcm: Ri,
|
|
75
75
|
numberCorrection: zi,
|
|
@@ -81,7 +81,6 @@ const G = {
|
|
|
81
81
|
var lt, b, w, Re;
|
|
82
82
|
const $ = class $ {
|
|
83
83
|
constructor(e, t) {
|
|
84
|
-
// #region Class fields (2)
|
|
85
84
|
p(this, lt, !1);
|
|
86
85
|
p(this, b, 1);
|
|
87
86
|
p(this, w, 1);
|
|
@@ -219,8 +218,6 @@ const $ = class $ {
|
|
|
219
218
|
});
|
|
220
219
|
a(this, "one", () => (h(this, w, 1), h(this, b, 1), this));
|
|
221
220
|
a(this, "opposite", () => (h(this, w, -s(this, w)), this));
|
|
222
|
-
// #endregion Properties and methods (55)
|
|
223
|
-
// #region Getters And Setters (11)
|
|
224
221
|
a(this, "pow", (e) => {
|
|
225
222
|
if (e instanceof $)
|
|
226
223
|
return this.pow(e.value);
|
|
@@ -289,7 +286,6 @@ const $ = class $ {
|
|
|
289
286
|
const e = s(this, w) / s(this, b);
|
|
290
287
|
return e === 0 ? 0 : e;
|
|
291
288
|
}
|
|
292
|
-
// #endregion Getters And Setters (11)
|
|
293
289
|
};
|
|
294
290
|
lt = new WeakMap(), b = new WeakMap(), w = new WeakMap(), Re = new WeakMap(), a($, "average", (...e) => {
|
|
295
291
|
const t = new $().zero();
|
|
@@ -330,7 +326,7 @@ a($, "unique", (e) => {
|
|
|
330
326
|
});
|
|
331
327
|
let u = $;
|
|
332
328
|
var Z, ee, ie, Ye;
|
|
333
|
-
class
|
|
329
|
+
class yt {
|
|
334
330
|
constructor(...e) {
|
|
335
331
|
p(this, Z);
|
|
336
332
|
p(this, ee);
|
|
@@ -406,22 +402,22 @@ var m = /* @__PURE__ */ ((o) => (o.VARIABLE = "variable", o.COEFFICIENT = "coeff
|
|
|
406
402
|
function Ui(o, e) {
|
|
407
403
|
if (o.length <= 1)
|
|
408
404
|
return o;
|
|
409
|
-
const t = Object.keys(e).filter((
|
|
410
|
-
t.sort((
|
|
405
|
+
const t = Object.keys(e).filter((N) => e[N].type === m.FUNCTION).map((N) => N);
|
|
406
|
+
t.sort((N, L) => L.length - N.length);
|
|
411
407
|
const i = new RegExp(`^(${t.join("|")})\\(`), n = Object.keys(li);
|
|
412
|
-
n.sort((
|
|
408
|
+
n.sort((N, L) => L.length - N.length);
|
|
413
409
|
const r = new RegExp(`^(${n.join("|")})`), l = /^(\d+(\.\d+)?)/;
|
|
414
410
|
let c = "", d, f, g;
|
|
415
411
|
for (; o.length > 0; ) {
|
|
416
412
|
if (d = f, g = void 0, t.length > 0 && i.exec(o)) {
|
|
417
|
-
const
|
|
418
|
-
|
|
413
|
+
const N = t.find((L) => o.startsWith(L));
|
|
414
|
+
N && (g = N + "(", o = o.slice(N.length + 1), f = m.FUNCTION);
|
|
419
415
|
} else if (n.length > 0 && r.exec(o)) {
|
|
420
|
-
const
|
|
421
|
-
|
|
416
|
+
const N = n.find((L) => o.startsWith(L));
|
|
417
|
+
N && (g = N, o = o.slice(N.length), f = m.CONSTANT);
|
|
422
418
|
} else if (l.exec(o)) {
|
|
423
|
-
const
|
|
424
|
-
|
|
419
|
+
const N = l.exec(o);
|
|
420
|
+
N && (g = N[0], o = o.slice(N[0].length), f = m.COEFFICIENT);
|
|
425
421
|
} else
|
|
426
422
|
switch (g = o[0], o = o.slice(1), g) {
|
|
427
423
|
case "(":
|
|
@@ -491,10 +487,10 @@ const Wi = {
|
|
|
491
487
|
"!": { precedence: 4, associative: "right", type: m.OPERATION },
|
|
492
488
|
"-": { precedence: 2, associative: "left", type: m.OPERATION }
|
|
493
489
|
};
|
|
494
|
-
var We, ot, te,
|
|
490
|
+
var We, ot, te, wt, De;
|
|
495
491
|
class Xt {
|
|
496
492
|
constructor(e) {
|
|
497
|
-
rt(this, We), rt(this, ot, []), rt(this, te, {}), rt(this,
|
|
493
|
+
rt(this, We), rt(this, ot, []), rt(this, te, {}), rt(this, wt, []), rt(this, De), be(this, We, typeof e > "u" ? Ze.POLYNOM : e), this.tokenConfigInitialization();
|
|
498
494
|
}
|
|
499
495
|
// Getter
|
|
500
496
|
get rpn() {
|
|
@@ -504,7 +500,7 @@ class Xt {
|
|
|
504
500
|
return _(this, ot).map((e) => e.token);
|
|
505
501
|
}
|
|
506
502
|
tokenConfigInitialization() {
|
|
507
|
-
return _(this, We) === Ze.SET ? (be(this, te, Yi), be(this, De, !1)) : _(this, We) === Ze.NUMERIC ? (be(this, te, Xi), be(this, De, !0)) : _(this, We) === Ze.EXPRESSION ? (be(this, te, Hi), be(this, De, !0)) : (be(this, te, Wi), be(this, De, !0)), be(this,
|
|
503
|
+
return _(this, We) === Ze.SET ? (be(this, te, Yi), be(this, De, !1)) : _(this, We) === Ze.NUMERIC ? (be(this, te, Xi), be(this, De, !0)) : _(this, We) === Ze.EXPRESSION ? (be(this, te, Hi), be(this, De, !0)) : (be(this, te, Wi), be(this, De, !0)), be(this, wt, Object.keys(_(this, te)).sort((e, t) => t.length - e.length)), _(this, te);
|
|
508
504
|
}
|
|
509
505
|
/**
|
|
510
506
|
* Get the next token to analyse.
|
|
@@ -520,7 +516,7 @@ class Xt {
|
|
|
520
516
|
else if (e[t] === ",")
|
|
521
517
|
i = ",", n = m.FUNCTION_ARGUMENT;
|
|
522
518
|
else {
|
|
523
|
-
for (const r of _(this,
|
|
519
|
+
for (const r of _(this, wt))
|
|
524
520
|
if (e.substring(t, t + r.length) === r) {
|
|
525
521
|
i += r, n = _(this, te)[r].type;
|
|
526
522
|
break;
|
|
@@ -573,17 +569,17 @@ class Xt {
|
|
|
573
569
|
break;
|
|
574
570
|
case m.OPERATION:
|
|
575
571
|
if (n.length > 0) {
|
|
576
|
-
let
|
|
577
|
-
for (g = +d;
|
|
578
|
-
(_(this, te)[r].associative === "left" && _(this, te)[r].precedence <= _(this, te)[
|
|
579
|
-
_(this, te)[r].associative === "right" && _(this, te)[r].precedence < _(this, te)[
|
|
572
|
+
let N = n[n.length - 1];
|
|
573
|
+
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,
|
|
574
|
+
(_(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,
|
|
575
|
+
_(this, te)[r].associative === "right" && _(this, te)[r].precedence < _(this, te)[N.token].precedence); ) {
|
|
580
576
|
if (g--, g === 0) {
|
|
581
577
|
console.log("SECURITY LEVEL 2 OPERATION EXIT");
|
|
582
578
|
break;
|
|
583
579
|
}
|
|
584
580
|
if (i.push(n.pop() ?? { token: "", tokenType: m.OPERATION }), n.length === 0)
|
|
585
581
|
break;
|
|
586
|
-
|
|
582
|
+
N = n[n.length - 1];
|
|
587
583
|
}
|
|
588
584
|
}
|
|
589
585
|
n.push({ token: r, tokenType: c });
|
|
@@ -620,7 +616,7 @@ class Xt {
|
|
|
620
616
|
return be(this, ot, i.concat(n.reverse())), this;
|
|
621
617
|
}
|
|
622
618
|
}
|
|
623
|
-
We = /* @__PURE__ */ new WeakMap(), ot = /* @__PURE__ */ new WeakMap(), te = /* @__PURE__ */ new WeakMap(),
|
|
619
|
+
We = /* @__PURE__ */ new WeakMap(), ot = /* @__PURE__ */ new WeakMap(), te = /* @__PURE__ */ new WeakMap(), wt = /* @__PURE__ */ new WeakMap(), De = /* @__PURE__ */ new WeakMap();
|
|
624
620
|
class Qi {
|
|
625
621
|
constructor(e, t) {
|
|
626
622
|
Kt(this, "_rpn"), Kt(this, "_expression"), Kt(this, "_isValid"), this._expression = e;
|
|
@@ -721,7 +717,7 @@ class Qi {
|
|
|
721
717
|
return +e.toFixed(t);
|
|
722
718
|
}
|
|
723
719
|
}
|
|
724
|
-
var T, v, Qe,
|
|
720
|
+
var T, v, Qe, vt, ze, Ot, At;
|
|
725
721
|
const I = class I {
|
|
726
722
|
constructor(e) {
|
|
727
723
|
p(this, Qe);
|
|
@@ -744,7 +740,7 @@ const I = class I {
|
|
|
744
740
|
a(this, "add", (...e) => {
|
|
745
741
|
for (const t of e) {
|
|
746
742
|
const i = t instanceof I ? t : new I(t);
|
|
747
|
-
this.isSameAs(i) ? (this.isZero() && q(this, Qe,
|
|
743
|
+
this.isSameAs(i) ? (this.isZero() && q(this, Qe, vt).call(this, i), s(this, T).add(i.coefficient)) : console.log("Add monom: " + this.display + " is not similar with ", i.display);
|
|
748
744
|
}
|
|
749
745
|
return this;
|
|
750
746
|
});
|
|
@@ -787,7 +783,7 @@ const I = class I {
|
|
|
787
783
|
if (t === !0) {
|
|
788
784
|
if (e instanceof u)
|
|
789
785
|
return s(this, ze).call(this, e.value);
|
|
790
|
-
if (e instanceof
|
|
786
|
+
if (e instanceof yt)
|
|
791
787
|
return new u().invalid();
|
|
792
788
|
if (typeof e == "number")
|
|
793
789
|
return s(this, ze).call(this, e);
|
|
@@ -803,7 +799,7 @@ const I = class I {
|
|
|
803
799
|
const n = {};
|
|
804
800
|
return n[this.variables[0]] = new u(e), this.evaluate(n);
|
|
805
801
|
}
|
|
806
|
-
if (e instanceof
|
|
802
|
+
if (e instanceof yt)
|
|
807
803
|
return new u().invalid();
|
|
808
804
|
if (typeof e == "object") {
|
|
809
805
|
if (this.variables.length === 0)
|
|
@@ -904,8 +900,6 @@ const I = class I {
|
|
|
904
900
|
s(this, v)[t].multiply(e);
|
|
905
901
|
return this;
|
|
906
902
|
});
|
|
907
|
-
// #endregion Properties and methods (31)
|
|
908
|
-
// #region Getters And Setters (11)
|
|
909
903
|
a(this, "primitive", (e) => {
|
|
910
904
|
e === void 0 && (e = "x");
|
|
911
905
|
const t = this.clone();
|
|
@@ -948,7 +942,7 @@ const I = class I {
|
|
|
948
942
|
a(this, "subtract", (...e) => {
|
|
949
943
|
for (const t of e) {
|
|
950
944
|
const i = t instanceof I ? t : new I(t);
|
|
951
|
-
this.isSameAs(i) ? (this.isZero() && q(this, Qe,
|
|
945
|
+
this.isSameAs(i) ? (this.isZero() && q(this, Qe, vt).call(this, i), s(this, T).add(i.clone().coefficient.opposite())) : console.log("Subtract: Is not similar: ", i.display);
|
|
952
946
|
}
|
|
953
947
|
return this;
|
|
954
948
|
});
|
|
@@ -966,7 +960,7 @@ const I = class I {
|
|
|
966
960
|
const i = {};
|
|
967
961
|
return i[this.variables[0]] = new u(e).value, s(this, ze).call(this, i);
|
|
968
962
|
}
|
|
969
|
-
if (e instanceof
|
|
963
|
+
if (e instanceof yt)
|
|
970
964
|
return NaN;
|
|
971
965
|
if (typeof e == "object") {
|
|
972
966
|
if (this.variables.length === 0)
|
|
@@ -978,7 +972,7 @@ const I = class I {
|
|
|
978
972
|
}
|
|
979
973
|
return t;
|
|
980
974
|
});
|
|
981
|
-
p(this,
|
|
975
|
+
p(this, Ot, (e) => {
|
|
982
976
|
const i = new Xt().parse(e).rpn, n = [];
|
|
983
977
|
if (i.length === 0)
|
|
984
978
|
return this.zero(), this;
|
|
@@ -987,10 +981,10 @@ const I = class I {
|
|
|
987
981
|
return this.one(), r.tokenType === m.COEFFICIENT ? this.coefficient = new u(r.token) : r.tokenType === m.VARIABLE && this.setLetter(r.token, 1), this;
|
|
988
982
|
} else
|
|
989
983
|
for (const r of i)
|
|
990
|
-
s(this,
|
|
984
|
+
s(this, At).call(this, n, r);
|
|
991
985
|
return this.one(), this.multiply(n[0]), this;
|
|
992
986
|
});
|
|
993
|
-
p(this,
|
|
987
|
+
p(this, At, (e, t) => {
|
|
994
988
|
var d;
|
|
995
989
|
let i, n, r, l, c;
|
|
996
990
|
if (t.tokenType === m.COEFFICIENT)
|
|
@@ -1023,7 +1017,7 @@ const I = class I {
|
|
|
1023
1017
|
* @param inputStr
|
|
1024
1018
|
*/
|
|
1025
1019
|
parse(e) {
|
|
1026
|
-
return h(this, T, new u()), h(this, v, {}), typeof e == "string" ? s(this,
|
|
1020
|
+
return h(this, T, new u()), h(this, v, {}), typeof e == "string" ? s(this, Ot).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, Qe, vt).call(this, e)), this;
|
|
1027
1021
|
}
|
|
1028
1022
|
/**
|
|
1029
1023
|
* Get the coefficient \\(k\\) of the Monom \\(k\\cdot x^{n}\\)
|
|
@@ -1169,12 +1163,11 @@ const I = class I {
|
|
|
1169
1163
|
}
|
|
1170
1164
|
return i;
|
|
1171
1165
|
}
|
|
1172
|
-
// #endregion Private methods (5)
|
|
1173
1166
|
};
|
|
1174
|
-
T = new WeakMap(), v = new WeakMap(), Qe = new WeakSet(),
|
|
1167
|
+
T = new WeakMap(), v = new WeakMap(), Qe = new WeakSet(), vt = function(e) {
|
|
1175
1168
|
for (const t in e.literal)
|
|
1176
1169
|
s(this, v)[t] = e.literal[t].clone();
|
|
1177
|
-
}, ze = new WeakMap(),
|
|
1170
|
+
}, ze = new WeakMap(), Ot = new WeakMap(), At = new WeakMap(), a(I, "gcd", (...e) => {
|
|
1178
1171
|
for (const r of e)
|
|
1179
1172
|
if (r.containsRationalPower())
|
|
1180
1173
|
return new I().zero();
|
|
@@ -1258,8 +1251,8 @@ ue = new WeakMap(), Fe = new WeakMap(), P = new WeakSet(), ht = function(e, t) {
|
|
|
1258
1251
|
const l = G.dividers(n.value), c = G.dividers(r.value);
|
|
1259
1252
|
for (const f of l)
|
|
1260
1253
|
for (const g of c) {
|
|
1261
|
-
const
|
|
1262
|
-
e.evaluate(
|
|
1254
|
+
const N = new u(g, f);
|
|
1255
|
+
e.evaluate(N).isZero() && !t.find((L) => L.value === N.value) && t.push(q(this, P, ye).call(this, N)), N.opposite(), e.evaluate(N).isZero() && !t.find((L) => L.value === N.value) && t.push(q(this, P, ye).call(this, N));
|
|
1263
1256
|
}
|
|
1264
1257
|
for (const f of t) {
|
|
1265
1258
|
if (f.exact !== !1 && f.exact.isZero())
|
|
@@ -1275,7 +1268,7 @@ ue = new WeakMap(), Fe = new WeakMap(), P = new WeakSet(), ht = function(e, t) {
|
|
|
1275
1268
|
const d = new ui(e, e.clone().parse("0"), s(this, Fe));
|
|
1276
1269
|
return t = t.concat(d.solve()), t.sort((f, g) => f.value - g.value);
|
|
1277
1270
|
}, _t = function() {
|
|
1278
|
-
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)),
|
|
1271
|
+
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(), L = f.clone().opposite().pow(3).divide(27), de = N.clone().pow(2).subtract(L.clone().multiply(4)).opposite();
|
|
1279
1272
|
if (de.isNegative()) {
|
|
1280
1273
|
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));
|
|
1281
1274
|
return [q(this, P, ye).call(this, ge)];
|
|
@@ -1312,7 +1305,7 @@ ue = new WeakMap(), Fe = new WeakMap(), P = new WeakSet(), ht = function(e, t) {
|
|
|
1312
1305
|
}
|
|
1313
1306
|
return q(this, P, xi).call(this, t, i, r);
|
|
1314
1307
|
}, xi = function(e, t, i) {
|
|
1315
|
-
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} `,
|
|
1308
|
+
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} `;
|
|
1316
1309
|
function L(pe, ce, nt, Yt) {
|
|
1317
1310
|
return `\\frac{ ${ce} ${nt}\\sqrt{ ${Yt} } }{ ${pe} }`;
|
|
1318
1311
|
}
|
|
@@ -1326,29 +1319,26 @@ ue = new WeakMap(), Fe = new WeakMap(), P = new WeakSet(), ht = function(e, t) {
|
|
|
1326
1319
|
display: de(c.display, l.display, g.toString(), d.display)
|
|
1327
1320
|
}),
|
|
1328
1321
|
q(this, P, ht).call(this, ge, {
|
|
1329
|
-
tex: L(c.tex, l.tex,
|
|
1330
|
-
display: de(c.display, l.display,
|
|
1322
|
+
tex: L(c.tex, l.tex, N.toString(), d.tex),
|
|
1323
|
+
display: de(c.display, l.display, N.toString(), d.display)
|
|
1331
1324
|
})
|
|
1332
1325
|
].sort((pe, ce) => pe.value - ce.value);
|
|
1333
1326
|
};
|
|
1334
|
-
let
|
|
1327
|
+
let xt = ui;
|
|
1335
1328
|
function pi(o, e = !0) {
|
|
1336
1329
|
return e ? `\\left( ${o} \\right)` : `(${o})`;
|
|
1337
1330
|
}
|
|
1338
|
-
function
|
|
1331
|
+
function Se(o, e, t, i, n) {
|
|
1339
1332
|
return o.map((r, l) => i !== void 0 && l < i || n !== void 0 && l > n ? r : r === e ? t : r);
|
|
1340
1333
|
}
|
|
1341
|
-
var je, y, Ke, ct, Je, ut, Mt, kt, Ct,
|
|
1334
|
+
var je, y, Ke, ct, Je, ut, qt, Mt, kt, _e, Ct, ft, $t, It, Pt, Bt, Ei, St, Rt;
|
|
1342
1335
|
const C = class C {
|
|
1343
1336
|
constructor(e, ...t) {
|
|
1344
|
-
p(this,
|
|
1345
|
-
// #region Class fields (8)
|
|
1337
|
+
p(this, Bt);
|
|
1346
1338
|
p(this, je);
|
|
1347
1339
|
p(this, y);
|
|
1348
1340
|
p(this, Ke);
|
|
1349
1341
|
p(this, ct, !1);
|
|
1350
|
-
// #endregion Constructors (7)
|
|
1351
|
-
// #region Properties and methods (49)
|
|
1352
1342
|
/**
|
|
1353
1343
|
* Parse a string to a polynom.
|
|
1354
1344
|
* @param inputStr
|
|
@@ -1356,7 +1346,7 @@ const C = class C {
|
|
|
1356
1346
|
*/
|
|
1357
1347
|
a(this, "parse", (e, ...t) => {
|
|
1358
1348
|
if (h(this, y, []), h(this, je, []), typeof e == "string")
|
|
1359
|
-
return q(this,
|
|
1349
|
+
return q(this, Bt, Ei).call(this, e, ...t);
|
|
1360
1350
|
if ((typeof e == "number" || e instanceof u || e instanceof k) && t.length === 0)
|
|
1361
1351
|
s(this, y).push(new k(e));
|
|
1362
1352
|
else if (e instanceof k && t.length > 0)
|
|
@@ -1409,7 +1399,7 @@ const C = class C {
|
|
|
1409
1399
|
if (e instanceof u)
|
|
1410
1400
|
return s(this, ut).call(this, e);
|
|
1411
1401
|
if (typeof e == "number" && Number.isSafeInteger(e))
|
|
1412
|
-
return s(this,
|
|
1402
|
+
return s(this, qt).call(this, e);
|
|
1413
1403
|
if (e instanceof k)
|
|
1414
1404
|
return this.divide(new C(e));
|
|
1415
1405
|
if (e instanceof C) {
|
|
@@ -1445,7 +1435,7 @@ const C = class C {
|
|
|
1445
1435
|
});
|
|
1446
1436
|
a(this, "evaluate", (e, t) => {
|
|
1447
1437
|
if (t)
|
|
1448
|
-
return s(this,
|
|
1438
|
+
return s(this, Mt).call(this, e);
|
|
1449
1439
|
const i = new u().zero();
|
|
1450
1440
|
return s(this, y).forEach((n) => {
|
|
1451
1441
|
i.add(n.evaluate(e, t));
|
|
@@ -1472,7 +1462,7 @@ const C = class C {
|
|
|
1472
1462
|
t.push(i.clone()), i.one();
|
|
1473
1463
|
break;
|
|
1474
1464
|
} else {
|
|
1475
|
-
let c = s(this,
|
|
1465
|
+
let c = s(this, Ct).call(this, i, l, e ?? "x");
|
|
1476
1466
|
for (l = i.degree(e).value; c.length > 0; ) {
|
|
1477
1467
|
const d = c[0];
|
|
1478
1468
|
if (!i.isDividableBy(d))
|
|
@@ -1480,8 +1470,8 @@ const C = class C {
|
|
|
1480
1470
|
else {
|
|
1481
1471
|
const f = i.euclidean(d);
|
|
1482
1472
|
t.push(d), i = f.quotient.clone(), c = c.filter((g) => {
|
|
1483
|
-
const
|
|
1484
|
-
return L.isDivisible(he) ?
|
|
1473
|
+
const N = i.monoms[0], L = i.monoms[i.monoms.length - 1], de = g.monoms[0], he = g.monoms[g.monoms.length - 1];
|
|
1474
|
+
return L.isDivisible(he) ? N.isDivisible(de) : !1;
|
|
1485
1475
|
});
|
|
1486
1476
|
}
|
|
1487
1477
|
}
|
|
@@ -1503,7 +1493,7 @@ const C = class C {
|
|
|
1503
1493
|
e.push(t.coefficient.numerator);
|
|
1504
1494
|
return e;
|
|
1505
1495
|
});
|
|
1506
|
-
a(this, "getZeroes", () => this.degree().isZero() ? [] : (this.roots = new
|
|
1496
|
+
a(this, "getZeroes", () => this.degree().isZero() ? [] : (this.roots = new xt(this.clone()).solve(), this.roots));
|
|
1507
1497
|
a(this, "integrate", (e, t, i = "x") => {
|
|
1508
1498
|
const n = this.primitive(i), r = {}, l = {};
|
|
1509
1499
|
return r[i] = new u(e), l[i] = new u(t), n.evaluate(l).subtract(n.evaluate(r));
|
|
@@ -1584,7 +1574,7 @@ const C = class C {
|
|
|
1584
1574
|
r.degree(t).isEqual(e) && i.push(r.clone());
|
|
1585
1575
|
return i;
|
|
1586
1576
|
});
|
|
1587
|
-
a(this, "multiply", (e) => e instanceof C ? s(this,
|
|
1577
|
+
a(this, "multiply", (e) => e instanceof C ? s(this, Pt).call(this, e) : e instanceof u ? s(this, ft).call(this, e) : e instanceof k ? s(this, It).call(this, e) : Number.isSafeInteger(e) && typeof e == "number" ? s(this, $t).call(this, e) : this);
|
|
1588
1578
|
a(this, "one", () => (h(this, y, []), s(this, y).push(new k().one()), this));
|
|
1589
1579
|
// ------------------------------------------
|
|
1590
1580
|
a(this, "opposite", () => (h(this, y, s(this, y).map((e) => e.opposite())), this));
|
|
@@ -1634,8 +1624,6 @@ const C = class C {
|
|
|
1634
1624
|
return 0;
|
|
1635
1625
|
}), this;
|
|
1636
1626
|
});
|
|
1637
|
-
// #endregion Properties and methods (49)
|
|
1638
|
-
// #region Getters And Setters (22)
|
|
1639
1627
|
// ------------------------------------------
|
|
1640
1628
|
/**
|
|
1641
1629
|
* Replace a variable (letter) by a polynom.
|
|
@@ -1671,27 +1659,25 @@ const C = class C {
|
|
|
1671
1659
|
return !1;
|
|
1672
1660
|
}
|
|
1673
1661
|
});
|
|
1674
|
-
// #endregion Getters And Setters (22)
|
|
1675
|
-
// #region Private methods (15)
|
|
1676
1662
|
p(this, ut, (e) => {
|
|
1677
1663
|
for (const t of s(this, y))
|
|
1678
1664
|
t.coefficient.divide(e);
|
|
1679
1665
|
return this;
|
|
1680
1666
|
});
|
|
1681
|
-
p(this,
|
|
1667
|
+
p(this, qt, (e) => {
|
|
1682
1668
|
const t = new u(e);
|
|
1683
1669
|
for (const i of s(this, y))
|
|
1684
1670
|
i.coefficient.divide(t);
|
|
1685
1671
|
return this;
|
|
1686
1672
|
});
|
|
1687
|
-
p(this,
|
|
1673
|
+
p(this, Mt, (e) => {
|
|
1688
1674
|
let t = 0;
|
|
1689
1675
|
return s(this, y).forEach((i) => {
|
|
1690
1676
|
t += i.evaluate(e, !0);
|
|
1691
1677
|
}), t;
|
|
1692
1678
|
});
|
|
1693
|
-
p(this,
|
|
1694
|
-
var
|
|
1679
|
+
p(this, kt, (e) => {
|
|
1680
|
+
var N;
|
|
1695
1681
|
let t, i, n, r, l, c, d, f, g;
|
|
1696
1682
|
if (this.numberOfVars === 1)
|
|
1697
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() ? [
|
|
@@ -1703,7 +1689,7 @@ const C = class C {
|
|
|
1703
1689
|
new C(e).subtract(f.display).multiply(f.denominator)
|
|
1704
1690
|
]) : [this.clone()];
|
|
1705
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))) {
|
|
1706
|
-
const L = new C("x", n.coefficient, r.coefficient, l.coefficient), de = s(
|
|
1692
|
+
const L = new C("x", n.coefficient, r.coefficient, l.coefficient), de = s(N = L, kt).call(N, "x"), he = [];
|
|
1707
1693
|
let ae;
|
|
1708
1694
|
if (de.length >= 2) {
|
|
1709
1695
|
for (const ge of de)
|
|
@@ -1723,7 +1709,7 @@ const C = class C {
|
|
|
1723
1709
|
}
|
|
1724
1710
|
return i === !0 && this.length > 1 && (e === "tex" ? r = `\\left( ${r} \\right)` : r = `(${r})`), r === "" && (r = "0"), r;
|
|
1725
1711
|
});
|
|
1726
|
-
p(this,
|
|
1712
|
+
p(this, Ct, (e, t, i) => {
|
|
1727
1713
|
const n = e.monoms[0].dividers, r = e.monoms[e.monoms.length - 1].dividers, l = [];
|
|
1728
1714
|
return n.forEach((c) => {
|
|
1729
1715
|
c.degree(i).isLeq(t) && r.forEach((d) => {
|
|
@@ -1736,13 +1722,13 @@ const C = class C {
|
|
|
1736
1722
|
t.coefficient.multiply(e);
|
|
1737
1723
|
return this.reduce();
|
|
1738
1724
|
});
|
|
1739
|
-
p(this,
|
|
1740
|
-
p(this,
|
|
1725
|
+
p(this, $t, (e) => s(this, ft).call(this, new u(e)));
|
|
1726
|
+
p(this, It, (e) => {
|
|
1741
1727
|
for (const t of s(this, y))
|
|
1742
1728
|
t.multiply(e);
|
|
1743
1729
|
return this.reduce();
|
|
1744
1730
|
});
|
|
1745
|
-
p(this,
|
|
1731
|
+
p(this, Pt, (e) => {
|
|
1746
1732
|
const t = [];
|
|
1747
1733
|
for (const i of s(this, y))
|
|
1748
1734
|
for (const n of e.monoms)
|
|
@@ -1753,7 +1739,7 @@ const C = class C {
|
|
|
1753
1739
|
* Main parse using a shutting yard class
|
|
1754
1740
|
* @param inputStr
|
|
1755
1741
|
*/
|
|
1756
|
-
p(this,
|
|
1742
|
+
p(this, St, (e) => {
|
|
1757
1743
|
const i = new Xt().parse(e).rpn;
|
|
1758
1744
|
this.zero();
|
|
1759
1745
|
const n = [];
|
|
@@ -1864,23 +1850,23 @@ const C = class C {
|
|
|
1864
1850
|
throw new Error("Some roots cannot be found !");
|
|
1865
1851
|
let n = [""];
|
|
1866
1852
|
if (t.forEach(() => n.push("t", "")), t.length === 0)
|
|
1867
|
-
n =
|
|
1853
|
+
n = Se(n, "", this.monomsByDegree()[0].coefficient.isPositive() ? "+" : "-");
|
|
1868
1854
|
else if (this.degree().isOne()) {
|
|
1869
1855
|
const r = this.monomsByDegree(1)[0].coefficient.sign(), l = t.findIndex((c) => c.value === i[0].value) * 2 + 1;
|
|
1870
|
-
n[l] = "z", n =
|
|
1856
|
+
n[l] = "z", n = Se(n, "", r === 1 ? "-" : "+", 0, l), n = Se(n, "", r === 1 ? "+" : "-", l);
|
|
1871
1857
|
} else {
|
|
1872
1858
|
let r = 0, l, c = "+";
|
|
1873
1859
|
i.forEach((d, f) => {
|
|
1874
1860
|
const g = t.findIndex((L) => L.value === i[f].value);
|
|
1875
|
-
f === 0 && (l = g * 2 + 1, n[l] = "z", n =
|
|
1861
|
+
f === 0 && (l = g * 2 + 1, n[l] = "z", n = Se(
|
|
1876
1862
|
n,
|
|
1877
1863
|
"",
|
|
1878
1864
|
this.evaluate(d.value - 1, !0) < 0 ? "-" : "+",
|
|
1879
1865
|
0,
|
|
1880
1866
|
l
|
|
1881
1867
|
)), r = g * 2 + 1, l = f === i.length - 1 ? n.length : t.findIndex((L) => L.value === i[f + 1].value) * 2 + 1;
|
|
1882
|
-
const
|
|
1883
|
-
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 = Se(n, "", c, r, l), r = +l, l = n.length;
|
|
1884
1870
|
});
|
|
1885
1871
|
}
|
|
1886
1872
|
return { roots: t, signs: n };
|
|
@@ -1897,16 +1883,15 @@ const C = class C {
|
|
|
1897
1883
|
get zeroes() {
|
|
1898
1884
|
return this.getZeroes();
|
|
1899
1885
|
}
|
|
1900
|
-
// #endregion Private methods (15)
|
|
1901
1886
|
};
|
|
1902
|
-
je = new WeakMap(), y = new WeakMap(), Ke = new WeakMap(), ct = new WeakMap(), Je = new WeakMap(), ut = new WeakMap(),
|
|
1887
|
+
je = new WeakMap(), y = new WeakMap(), Ke = new WeakMap(), ct = new WeakMap(), Je = new WeakMap(), ut = new WeakMap(), qt = new WeakMap(), Mt = new WeakMap(), kt = new WeakMap(), _e = new WeakMap(), Ct = new WeakMap(), ft = new WeakMap(), $t = new WeakMap(), It = new WeakMap(), Pt = new WeakMap(), Bt = new WeakSet(), Ei = function(e, ...t) {
|
|
1903
1888
|
if (t.length === 0) {
|
|
1904
1889
|
if (e = "" + e, e !== "" && !isNaN(Number(e))) {
|
|
1905
1890
|
this.empty();
|
|
1906
1891
|
const i = new k(e);
|
|
1907
1892
|
return this.add(i), this;
|
|
1908
1893
|
}
|
|
1909
|
-
return s(this,
|
|
1894
|
+
return s(this, St).call(this, e);
|
|
1910
1895
|
} else if (/^[a-z]+/.test(e)) {
|
|
1911
1896
|
this.empty();
|
|
1912
1897
|
const i = t.map((n) => new u(n));
|
|
@@ -1927,24 +1912,23 @@ je = new WeakMap(), y = new WeakMap(), Ke = new WeakMap(), ct = new WeakMap(), J
|
|
|
1927
1912
|
return this;
|
|
1928
1913
|
} else
|
|
1929
1914
|
return this.zero();
|
|
1930
|
-
},
|
|
1931
|
-
};
|
|
1915
|
+
}, St = new WeakMap(), Rt = new WeakMap();
|
|
1932
1916
|
let A = C;
|
|
1933
|
-
var
|
|
1917
|
+
var Ee, et, Ne, Te;
|
|
1934
1918
|
const we = class we {
|
|
1935
1919
|
constructor(e, t) {
|
|
1936
|
-
p(this, Te);
|
|
1937
|
-
p(this, et, !1);
|
|
1938
1920
|
p(this, Ee);
|
|
1921
|
+
p(this, et, !1);
|
|
1939
1922
|
p(this, Ne);
|
|
1923
|
+
p(this, Te);
|
|
1940
1924
|
if (e instanceof we)
|
|
1941
|
-
h(this,
|
|
1925
|
+
h(this, Ne, e.polynom.clone()), h(this, Te, e.power.clone());
|
|
1942
1926
|
else if (typeof e == "string" && t === void 0) {
|
|
1943
1927
|
const [i, n = "1"] = e.split("^");
|
|
1944
|
-
h(this,
|
|
1928
|
+
h(this, Ne, new A(i)), h(this, Te, new u(n.replace("(", "").replace(")", "")));
|
|
1945
1929
|
} else
|
|
1946
|
-
h(this,
|
|
1947
|
-
return h(this,
|
|
1930
|
+
h(this, Ne, new A(e)), h(this, Te, new u(t ?? 1));
|
|
1931
|
+
return h(this, Ee, 1), this;
|
|
1948
1932
|
}
|
|
1949
1933
|
parse() {
|
|
1950
1934
|
throw new Error("Method not implemented.");
|
|
@@ -1956,10 +1940,10 @@ const we = class we {
|
|
|
1956
1940
|
throw new Error("Adding two factors is not possible");
|
|
1957
1941
|
}
|
|
1958
1942
|
get withPower() {
|
|
1959
|
-
return h(this,
|
|
1943
|
+
return h(this, Ee, 1), this;
|
|
1960
1944
|
}
|
|
1961
1945
|
get withRoot() {
|
|
1962
|
-
return h(this,
|
|
1946
|
+
return h(this, Ee, 0), this;
|
|
1963
1947
|
}
|
|
1964
1948
|
get asSingle() {
|
|
1965
1949
|
return h(this, et, !0), this;
|
|
@@ -1982,7 +1966,7 @@ const we = class we {
|
|
|
1982
1966
|
get display() {
|
|
1983
1967
|
const e = this.power.numerator, t = this.power.denominator;
|
|
1984
1968
|
let i, n;
|
|
1985
|
-
return s(this,
|
|
1969
|
+
return s(this, Ee) === 0 && t > 1 ? (i = `${t === 2 ? "sqrt" : `root(${t})`}(${this.polynom.display})`, n = Math.abs(e) === 1 ? "" : `^(${Math.abs(e)})`) : (i = s(this, et) && this.power.isOne() ? this.polynom.display : pi(this.polynom.display, !1), n = t === 1 && Math.abs(e) === 1 ? "" : `^(${this.power.display})`), i = `${i}${n}`, s(this, Ee) === 0 && e < 0 && (i = `1/(${i})`), i;
|
|
1986
1970
|
}
|
|
1987
1971
|
divide(e) {
|
|
1988
1972
|
if (e instanceof we && this.isSameAs(e))
|
|
@@ -2023,25 +2007,25 @@ const we = class we {
|
|
|
2023
2007
|
throw new Error("The two factors must be the same");
|
|
2024
2008
|
}
|
|
2025
2009
|
one() {
|
|
2026
|
-
return s(this,
|
|
2010
|
+
return s(this, Ne).one(), s(this, Te).one(), this;
|
|
2027
2011
|
}
|
|
2028
2012
|
opposite() {
|
|
2029
2013
|
throw new Error("Method not implemented.");
|
|
2030
2014
|
}
|
|
2031
2015
|
get polynom() {
|
|
2032
|
-
return s(this,
|
|
2016
|
+
return s(this, Ne);
|
|
2033
2017
|
}
|
|
2034
2018
|
set polynom(e) {
|
|
2035
|
-
h(this,
|
|
2019
|
+
h(this, Ne, e);
|
|
2036
2020
|
}
|
|
2037
2021
|
pow(e) {
|
|
2038
2022
|
return this.power.multiply(e), this;
|
|
2039
2023
|
}
|
|
2040
2024
|
get power() {
|
|
2041
|
-
return s(this,
|
|
2025
|
+
return s(this, Te);
|
|
2042
2026
|
}
|
|
2043
2027
|
set power(e) {
|
|
2044
|
-
h(this,
|
|
2028
|
+
h(this, Te, new u(e));
|
|
2045
2029
|
}
|
|
2046
2030
|
primitive() {
|
|
2047
2031
|
throw new Error("Method not implemented.");
|
|
@@ -2061,43 +2045,38 @@ const we = class we {
|
|
|
2061
2045
|
get tex() {
|
|
2062
2046
|
const e = this.power.numerator, t = this.power.denominator;
|
|
2063
2047
|
let i, n;
|
|
2064
|
-
return s(this,
|
|
2048
|
+
return s(this, Ee) === 0 && t > 1 ? (i = `\\sqrt${t === 2 ? "" : `[ ${t} ]`}{ ${this.polynom.tex} }`, n = Math.abs(e) === 1 ? "" : `^{ ${Math.abs(e)} }`) : (i = s(this, et) && this.power.isOne() ? this.polynom.tex : pi(this.polynom.tex), n = t === 1 && Math.abs(e) === 1 ? "" : `^{ ${this.power.tex} }`), i = `${i}${n}`, s(this, Ee) === 0 && e < 0 && (i = `\\frac{ 1 }{ ${i} }`), i;
|
|
2065
2049
|
}
|
|
2066
2050
|
get variables() {
|
|
2067
2051
|
return this.polynom.variables;
|
|
2068
2052
|
}
|
|
2069
2053
|
zero() {
|
|
2070
|
-
return s(this,
|
|
2054
|
+
return s(this, Ne).zero(), s(this, Te).one(), this;
|
|
2071
2055
|
}
|
|
2072
2056
|
tableOfSigns(e) {
|
|
2073
|
-
const t =
|
|
2074
|
-
return t.isStrictlyNegative() && (i.signs =
|
|
2057
|
+
const t = this.power.clone().reduce(), i = this.polynom.tableOfSigns(e);
|
|
2058
|
+
return t.isStrictlyNegative() && (i.signs = Se(i.signs, "z", "d")), t.denominator % 2 === 0 ? i.signs = Se(i.signs, "-", "h") : t.numerator % 2 === 0 && (i.signs = Se(i.signs, "-", "+")), { roots: i.roots, signs: i.signs };
|
|
2075
2059
|
}
|
|
2076
2060
|
};
|
|
2077
|
-
|
|
2061
|
+
Ee = new WeakMap(), et = new WeakMap(), Ne = new WeakMap(), Te = new WeakMap();
|
|
2078
2062
|
let le = we;
|
|
2079
|
-
var He = /* @__PURE__ */ ((o) => (o[o.ROOT = 0] = "ROOT", o[o.POWER = 1] = "POWER", o))(He || {}), Ue,
|
|
2063
|
+
var He = /* @__PURE__ */ ((o) => (o[o.ROOT = 0] = "ROOT", o[o.POWER = 1] = "POWER", o))(He || {}), Ue, E, dt, ti;
|
|
2080
2064
|
const me = class me {
|
|
2081
|
-
// #endregion Class fields (1)
|
|
2082
|
-
// #region Constructors (1)
|
|
2083
2065
|
constructor(...e) {
|
|
2084
|
-
// #region Class fields (1)
|
|
2085
2066
|
p(this, Ue, He.POWER);
|
|
2086
|
-
p(this,
|
|
2067
|
+
p(this, E, []);
|
|
2087
2068
|
return this.parse(...e), this;
|
|
2088
2069
|
}
|
|
2089
|
-
// #endregion Constructors (1)
|
|
2090
|
-
// #region Properties and methods (25)
|
|
2091
2070
|
parse(...e) {
|
|
2092
|
-
return e.length === 0 ? this : (h(this,
|
|
2071
|
+
return e.length === 0 ? this : (h(this, E, []), e.forEach((t) => {
|
|
2093
2072
|
if (typeof t == "string") {
|
|
2094
2073
|
const i = t.split(")(").join(")*(").split("*");
|
|
2095
|
-
s(this,
|
|
2096
|
-
} else t instanceof me ? s(this,
|
|
2074
|
+
s(this, E).push(...i.map((n) => new le(n)));
|
|
2075
|
+
} else t instanceof me ? s(this, E).push(...t.factors.map((i) => i.clone())) : s(this, E).push(new le(t));
|
|
2097
2076
|
}), this);
|
|
2098
2077
|
}
|
|
2099
2078
|
clone() {
|
|
2100
|
-
return new me(...s(this,
|
|
2079
|
+
return new me(...s(this, E).map((e) => e.clone()));
|
|
2101
2080
|
}
|
|
2102
2081
|
static gcd(...e) {
|
|
2103
2082
|
var i;
|
|
@@ -2106,11 +2085,11 @@ const me = class me {
|
|
|
2106
2085
|
if (e.length === 1)
|
|
2107
2086
|
return e[0];
|
|
2108
2087
|
if (e.length === 2)
|
|
2109
|
-
return q(i = me,
|
|
2088
|
+
return q(i = me, dt, ti).call(i, e[0], e[1]);
|
|
2110
2089
|
let t = e[0];
|
|
2111
2090
|
return e.shift(), e.forEach((n) => {
|
|
2112
2091
|
var r;
|
|
2113
|
-
return t = q(r = me,
|
|
2092
|
+
return t = q(r = me, dt, ti).call(r, t, n);
|
|
2114
2093
|
}), t;
|
|
2115
2094
|
}
|
|
2116
2095
|
add(...e) {
|
|
@@ -2118,7 +2097,7 @@ const me = class me {
|
|
|
2118
2097
|
const i = me.gcd(...t);
|
|
2119
2098
|
t = t.map((r) => r.divide(i).reduce());
|
|
2120
2099
|
const n = new A("0");
|
|
2121
|
-
return t.forEach((r) => n.add(r.develop())), h(this,
|
|
2100
|
+
return t.forEach((r) => n.add(r.develop())), h(this, E, [
|
|
2122
2101
|
...i.factors,
|
|
2123
2102
|
new le(n)
|
|
2124
2103
|
]), this;
|
|
@@ -2130,51 +2109,54 @@ const me = class me {
|
|
|
2130
2109
|
return h(this, Ue, He.ROOT), this;
|
|
2131
2110
|
}
|
|
2132
2111
|
degree(e) {
|
|
2133
|
-
return s(this,
|
|
2112
|
+
return s(this, E).reduce((t, i) => t.add(i.degree(e)), new u("0"));
|
|
2134
2113
|
}
|
|
2135
2114
|
get denominator() {
|
|
2136
|
-
return s(this,
|
|
2115
|
+
return s(this, E).filter((e) => e.power.isNegative());
|
|
2137
2116
|
}
|
|
2138
2117
|
derivative() {
|
|
2139
|
-
const e = [], t = s(this,
|
|
2118
|
+
const e = [], t = s(this, E).length;
|
|
2140
2119
|
for (let n = 0; n < t; n++) {
|
|
2141
|
-
const r = s(this,
|
|
2120
|
+
const r = s(this, E).slice(), l = r.splice(n, 1)[0];
|
|
2142
2121
|
e.push(new me(...r).multiply(new me(...l.derivative())));
|
|
2143
2122
|
}
|
|
2144
2123
|
e.forEach((n) => n.reduce());
|
|
2145
2124
|
const i = e.shift();
|
|
2146
|
-
return i !== void 0 && h(this,
|
|
2125
|
+
return i !== void 0 && h(this, E, i.factors), this.add(...e);
|
|
2147
2126
|
}
|
|
2148
2127
|
develop() {
|
|
2149
2128
|
const e = new A("1");
|
|
2150
|
-
return s(this,
|
|
2129
|
+
return s(this, E).forEach((t) => {
|
|
2151
2130
|
e.multiply(t.develop());
|
|
2152
2131
|
}), e;
|
|
2153
2132
|
}
|
|
2154
2133
|
get display() {
|
|
2155
2134
|
let e = [], t = [];
|
|
2156
|
-
if (s(this, Ue) === He.ROOT ? (e = this.numerator, t = this.denominator.map((r) => r.clone().inverse())) : e = s(this,
|
|
2135
|
+
if (s(this, Ue) === He.ROOT ? (e = this.numerator, t = this.denominator.map((r) => r.clone().inverse())) : e = s(this, E), e.length === 0 && (e = [new le("1")]), t.length === 0)
|
|
2157
2136
|
return e.length === 1 ? e[0].asSingle.display : e.map((r) => r.display).join("");
|
|
2158
2137
|
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("");
|
|
2159
2138
|
return `(${i})/(${n})`;
|
|
2160
2139
|
}
|
|
2161
2140
|
divide(e) {
|
|
2162
|
-
return h(this,
|
|
2141
|
+
return h(this, E, s(this, E).concat(e.clone().factors.map((t) => t.inverse()))), this;
|
|
2163
2142
|
}
|
|
2164
2143
|
evaluate(e, t) {
|
|
2165
|
-
return t ? s(this,
|
|
2144
|
+
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"));
|
|
2145
|
+
}
|
|
2146
|
+
getFactors() {
|
|
2147
|
+
return s(this, E);
|
|
2166
2148
|
}
|
|
2167
2149
|
get factors() {
|
|
2168
|
-
return s(this,
|
|
2150
|
+
return s(this, E);
|
|
2169
2151
|
}
|
|
2170
2152
|
set factors(e) {
|
|
2171
|
-
h(this,
|
|
2153
|
+
h(this, E, e);
|
|
2172
2154
|
}
|
|
2173
2155
|
fromPolynom(e, t) {
|
|
2174
|
-
return h(this,
|
|
2156
|
+
return h(this, E, new A(e).factorize(t).map((i) => new le(i))), this;
|
|
2175
2157
|
}
|
|
2176
2158
|
getZeroes() {
|
|
2177
|
-
const e = [].concat(...s(this,
|
|
2159
|
+
const e = [].concat(...s(this, E).map((t) => t.polynom.getZeroes()));
|
|
2178
2160
|
return e.sort((t, i) => t.value - i.value), e.filter(
|
|
2179
2161
|
(t, i, n) => i === n.findIndex(
|
|
2180
2162
|
(r) => r.value === t.value
|
|
@@ -2182,59 +2164,57 @@ const me = class me {
|
|
|
2182
2164
|
);
|
|
2183
2165
|
}
|
|
2184
2166
|
hasVariable(e) {
|
|
2185
|
-
return s(this,
|
|
2167
|
+
return s(this, E).some((t) => t.hasVariable(e));
|
|
2186
2168
|
}
|
|
2187
2169
|
inverse() {
|
|
2188
|
-
return h(this,
|
|
2170
|
+
return h(this, E, s(this, E).map((e) => e.inverse())), this;
|
|
2189
2171
|
}
|
|
2190
2172
|
isEqual(e) {
|
|
2191
2173
|
const t = me.gcd(this, e), i = this.clone().divide(t).reduce(), n = e.clone().divide(t).reduce();
|
|
2192
2174
|
return i.isOne() && n.isOne();
|
|
2193
2175
|
}
|
|
2194
2176
|
isOne() {
|
|
2195
|
-
return s(this,
|
|
2177
|
+
return s(this, E).every((e) => e.isOne());
|
|
2196
2178
|
}
|
|
2197
2179
|
isZero() {
|
|
2198
|
-
return s(this,
|
|
2180
|
+
return s(this, E).every((e) => e.isZero());
|
|
2199
2181
|
}
|
|
2200
2182
|
multiply(...e) {
|
|
2201
2183
|
return e.forEach((t) => {
|
|
2202
|
-
h(this,
|
|
2184
|
+
h(this, E, s(this, E).concat(t.clone().factors));
|
|
2203
2185
|
}), this;
|
|
2204
2186
|
}
|
|
2205
2187
|
get numerator() {
|
|
2206
|
-
return s(this,
|
|
2188
|
+
return s(this, E).filter((e) => e.power.isPositive());
|
|
2207
2189
|
}
|
|
2208
2190
|
one() {
|
|
2209
|
-
return h(this,
|
|
2191
|
+
return h(this, E, [new le("1", "1")]), this;
|
|
2210
2192
|
}
|
|
2211
|
-
// #endregion Properties and methods (25)
|
|
2212
|
-
// #region Getters And Setters (5)
|
|
2213
2193
|
opposite() {
|
|
2214
|
-
const e = s(this,
|
|
2215
|
-
return e >= 0 ? s(this,
|
|
2194
|
+
const e = s(this, E).findIndex((t) => t.display === "(-1)");
|
|
2195
|
+
return e >= 0 ? s(this, E).splice(e, 1) : s(this, E).push(new le("-1", "1")), this;
|
|
2216
2196
|
}
|
|
2217
2197
|
pow(e) {
|
|
2218
|
-
return h(this,
|
|
2198
|
+
return h(this, E, s(this, E).map((t) => t.pow(e))), this;
|
|
2219
2199
|
}
|
|
2220
2200
|
primitive() {
|
|
2221
2201
|
throw new Error("Method not implemented.");
|
|
2222
2202
|
}
|
|
2223
2203
|
reduce() {
|
|
2224
2204
|
const e = Jt(this);
|
|
2225
|
-
return h(this,
|
|
2205
|
+
return h(this, E, Object.values(e).map((t) => {
|
|
2226
2206
|
const i = t[0].polynom, n = t.reduce((r, l) => r.add(l.power), new u("0"));
|
|
2227
2207
|
return new le(i, n.reduce());
|
|
2228
2208
|
}).filter((t) => !t.power.isZero())), this;
|
|
2229
2209
|
}
|
|
2230
2210
|
root(e) {
|
|
2231
|
-
return h(this,
|
|
2211
|
+
return h(this, E, s(this, E).map((t) => t.root(e))), this;
|
|
2232
2212
|
}
|
|
2233
2213
|
sort() {
|
|
2234
|
-
return h(this,
|
|
2214
|
+
return h(this, E, s(this, E).sort((e, t) => e.degree().isLeq(t.degree()) ? -1 : 1)), this;
|
|
2235
2215
|
}
|
|
2236
2216
|
sqrt() {
|
|
2237
|
-
return h(this,
|
|
2217
|
+
return h(this, E, s(this, E).map((e) => e.sqrt())), this;
|
|
2238
2218
|
}
|
|
2239
2219
|
subtract(...e) {
|
|
2240
2220
|
return this.add(...e.map((t) => t.opposite()));
|
|
@@ -2260,28 +2240,25 @@ const me = class me {
|
|
|
2260
2240
|
}
|
|
2261
2241
|
get tex() {
|
|
2262
2242
|
let e = [], t = [];
|
|
2263
|
-
if (s(this, Ue) === He.ROOT ? (e = this.numerator, t = this.denominator.map((r) => r.clone().inverse())) : e = s(this,
|
|
2243
|
+
if (s(this, Ue) === He.ROOT ? (e = this.numerator, t = this.denominator.map((r) => r.clone().inverse())) : e = s(this, E), e.length === 0 && (e = [new le("1")]), t.length === 0)
|
|
2264
2244
|
return e.length === 1 ? e[0].asSingle.tex : e.map((r) => r.tex).join("");
|
|
2265
2245
|
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("");
|
|
2266
2246
|
return `\\frac{ ${i} }{ ${n} }`;
|
|
2267
2247
|
}
|
|
2268
2248
|
get variables() {
|
|
2269
|
-
return s(this,
|
|
2249
|
+
return s(this, E).reduce((e, t) => e.concat(t.variables), []);
|
|
2270
2250
|
}
|
|
2271
|
-
// #endregion Getters And Setters (5)
|
|
2272
|
-
// #region Private methods (1)
|
|
2273
2251
|
zero() {
|
|
2274
|
-
return h(this,
|
|
2252
|
+
return h(this, E, [new le("0", "1")]), this;
|
|
2275
2253
|
}
|
|
2276
|
-
// #endregion Private methods (1)
|
|
2277
2254
|
};
|
|
2278
|
-
Ue = new WeakMap(),
|
|
2255
|
+
Ue = new WeakMap(), E = new WeakMap(), dt = new WeakSet(), ti = function(e, t) {
|
|
2279
2256
|
const i = Jt(e), n = Jt(t), l = Object.keys(i).filter((c) => Object.hasOwn(n, c)).map((c) => {
|
|
2280
|
-
const d = i[c].reduce((g,
|
|
2257
|
+
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"));
|
|
2281
2258
|
return new le(c, u.min(d, f));
|
|
2282
2259
|
});
|
|
2283
2260
|
return new me(...l);
|
|
2284
|
-
}, p(me,
|
|
2261
|
+
}, p(me, dt);
|
|
2285
2262
|
let ei = me;
|
|
2286
2263
|
function Jt(o) {
|
|
2287
2264
|
const e = new u().one(), t = o.factors.reduce((i, n) => {
|
|
@@ -2301,8 +2278,6 @@ const xe = class xe {
|
|
|
2301
2278
|
p(this, M);
|
|
2302
2279
|
// Signe of the equation
|
|
2303
2280
|
p(this, se);
|
|
2304
|
-
// #endregion Constructors (3)
|
|
2305
|
-
// #region Properties and methods (26)
|
|
2306
2281
|
// ------------------------------------------
|
|
2307
2282
|
a(this, "parse", (e) => {
|
|
2308
2283
|
const t = s(this, zt).call(this, e);
|
|
@@ -2401,10 +2376,8 @@ const xe = class xe {
|
|
|
2401
2376
|
*/
|
|
2402
2377
|
a(this, "simplify", () => (this.multiply(G.lcm(...s(this, O).getDenominators(), ...s(this, M).getDenominators())), this.divide(G.gcd(...s(this, O).getNumerators(), ...s(this, M).getNumerators())), this));
|
|
2403
2378
|
// -----------------------------------------------
|
|
2404
|
-
a(this, "solve", () => new
|
|
2379
|
+
a(this, "solve", () => new xt(this.clone()).solve());
|
|
2405
2380
|
a(this, "test", (e) => this.left.evaluate(e).isEqual(this.right.evaluate(e)));
|
|
2406
|
-
// #endregion Getters And Setters (13)
|
|
2407
|
-
// #region Private methods (6)
|
|
2408
2381
|
p(this, zt, (e) => {
|
|
2409
2382
|
if (e.includes("geq"))
|
|
2410
2383
|
return e.includes("\\geq") ? "\\geq" : "geq";
|
|
@@ -2491,8 +2464,6 @@ const xe = class xe {
|
|
|
2491
2464
|
const i = [], n = e.filter((r) => i.includes(r.tex) ? !1 : (i.push(r.tex), !0));
|
|
2492
2465
|
return t === !0 && n.sort((r, l) => r.value - l.value), n;
|
|
2493
2466
|
}
|
|
2494
|
-
// #endregion Properties and methods (26)
|
|
2495
|
-
// #region Getters And Setters (13)
|
|
2496
2467
|
get display() {
|
|
2497
2468
|
return `${s(this, O).display}${this.signAsTex}${s(this, M).display}`;
|
|
2498
2469
|
}
|
|
@@ -2528,7 +2499,6 @@ const xe = class xe {
|
|
|
2528
2499
|
get variables() {
|
|
2529
2500
|
return [...new Set(s(this, M).variables.concat(s(this, O).variables))];
|
|
2530
2501
|
}
|
|
2531
|
-
// #endregion Private methods (6)
|
|
2532
2502
|
};
|
|
2533
2503
|
O = new WeakMap(), M = new WeakMap(), se = new WeakMap(), zt = new WeakMap(), tt = new WeakMap(), Lt = new WeakMap();
|
|
2534
2504
|
let H = xe;
|
|
@@ -2705,12 +2675,12 @@ const Xe = class Xe {
|
|
|
2705
2675
|
};
|
|
2706
2676
|
z = new WeakMap(), Ce = new WeakMap(), Dt = new WeakMap(), Vt = new WeakMap();
|
|
2707
2677
|
let ii = Xe;
|
|
2708
|
-
function
|
|
2678
|
+
function Ki(o, e) {
|
|
2709
2679
|
return o.dimension === e.dimension && o.array.every(
|
|
2710
2680
|
(t, i) => e.array[i].isEqual(t)
|
|
2711
2681
|
);
|
|
2712
2682
|
}
|
|
2713
|
-
function
|
|
2683
|
+
function Ji(o, e) {
|
|
2714
2684
|
if (o.dimension !== e.dimension)
|
|
2715
2685
|
return !1;
|
|
2716
2686
|
const t = e.array[0].value / o.array[0].value;
|
|
@@ -2718,13 +2688,13 @@ function _i(o, e) {
|
|
|
2718
2688
|
(i, n) => e.array[n].value === i.value * t
|
|
2719
2689
|
);
|
|
2720
2690
|
}
|
|
2721
|
-
function
|
|
2691
|
+
function _i(o, e) {
|
|
2722
2692
|
return o.dimension !== e.dimension ? new u().invalid() : o.array.reduce(
|
|
2723
2693
|
(t, i, n) => t.add(i.clone().multiply(e.array[n])),
|
|
2724
2694
|
new u(0)
|
|
2725
2695
|
);
|
|
2726
2696
|
}
|
|
2727
|
-
function
|
|
2697
|
+
function es(...o) {
|
|
2728
2698
|
return o.some((e) => e.dimension !== o[0].dimension) ? new u().invalid() : o[0].dimension === 2 && o.length !== 2 ? new u().invalid() : o[0].dimension === 3 && o.length !== 3 ? new u().invalid() : o[0].dimension === 2 ? o[0].array[0].clone().multiply(o[1].array[1]).subtract(o[0].array[1].clone().multiply(o[1].array[0])) : o[0].array[0].clone().multiply(
|
|
2729
2699
|
o[1].array[1].clone().multiply(o[2].array[2]).subtract(o[1].array[2].clone().multiply(o[2].array[1]))
|
|
2730
2700
|
).subtract(
|
|
@@ -2734,7 +2704,7 @@ function ts(...o) {
|
|
|
2734
2704
|
).add(o[0].array[2].clone().multiply(o[1].array[0].clone().multiply(o[2].array[1]).subtract(o[1].array[1].clone().multiply(o[2].array[0]))));
|
|
2735
2705
|
}
|
|
2736
2706
|
var F, Le;
|
|
2737
|
-
const
|
|
2707
|
+
const Be = class Be {
|
|
2738
2708
|
constructor(...e) {
|
|
2739
2709
|
p(this, F, []);
|
|
2740
2710
|
p(this, Le, !1);
|
|
@@ -2747,15 +2717,15 @@ const Se = class Se {
|
|
|
2747
2717
|
const e = this.norm;
|
|
2748
2718
|
return e === 0 ? this : this.divideByScalar(e);
|
|
2749
2719
|
});
|
|
2750
|
-
a(this, "dot", (e) =>
|
|
2720
|
+
a(this, "dot", (e) => _i(this, e));
|
|
2751
2721
|
a(this, "normal", () => {
|
|
2752
2722
|
if (this.dimension >= 3)
|
|
2753
2723
|
throw new Error("Normal vector can only be determined in 2D");
|
|
2754
2724
|
const e = this.x.clone().opposite(), t = this.y.clone();
|
|
2755
2725
|
return s(this, F)[0] = t, s(this, F)[1] = e, this;
|
|
2756
2726
|
});
|
|
2757
|
-
a(this, "isEqual", (e) =>
|
|
2758
|
-
a(this, "isColinearTo", (e) =>
|
|
2727
|
+
a(this, "isEqual", (e) => Ki(this, e));
|
|
2728
|
+
a(this, "isColinearTo", (e) => Ji(this, e));
|
|
2759
2729
|
a(this, "isNormalTo", (e) => this.dot(e).isZero());
|
|
2760
2730
|
a(this, "multiplyByScalar", (e) => {
|
|
2761
2731
|
const t = new u(e);
|
|
@@ -2861,7 +2831,7 @@ const Se = class Se {
|
|
|
2861
2831
|
if (e.length === 0)
|
|
2862
2832
|
throw new Error("Invalid value");
|
|
2863
2833
|
if (e.length === 1) {
|
|
2864
|
-
if (e[0] instanceof
|
|
2834
|
+
if (e[0] instanceof Be)
|
|
2865
2835
|
return e[0].clone();
|
|
2866
2836
|
if (typeof e[0] == "string")
|
|
2867
2837
|
return this.fromString(e[0]);
|
|
@@ -2869,7 +2839,7 @@ const Se = class Se {
|
|
|
2869
2839
|
}
|
|
2870
2840
|
if (e.length === 2) {
|
|
2871
2841
|
const [t, i] = e;
|
|
2872
|
-
if (t instanceof
|
|
2842
|
+
if (t instanceof Be && i instanceof Be) {
|
|
2873
2843
|
if (t.dimension !== i.dimension)
|
|
2874
2844
|
throw new Error("Vectors must have the same dimension");
|
|
2875
2845
|
return h(this, F, i.array.map((n, r) => n.clone().subtract(t.array[r]))), this;
|
|
@@ -2878,7 +2848,7 @@ const Se = class Se {
|
|
|
2878
2848
|
return h(this, F, e.map((t) => new u(t))), this;
|
|
2879
2849
|
}
|
|
2880
2850
|
clone() {
|
|
2881
|
-
const e = new
|
|
2851
|
+
const e = new Be();
|
|
2882
2852
|
return e.array = this.copy(), e.asPoint = this.asPoint, e;
|
|
2883
2853
|
}
|
|
2884
2854
|
copy() {
|
|
@@ -2897,7 +2867,7 @@ const Se = class Se {
|
|
|
2897
2867
|
cross(e) {
|
|
2898
2868
|
if (this.dimension !== 3 || e.dimension !== 3)
|
|
2899
2869
|
throw new Error("Cross product can only be determined in 3D");
|
|
2900
|
-
return new
|
|
2870
|
+
return new Be(
|
|
2901
2871
|
this.y.clone().multiply(e.z).subtract(this.z.clone().multiply(e.y)),
|
|
2902
2872
|
this.z.clone().multiply(e.x).subtract(this.x.clone().multiply(e.z)),
|
|
2903
2873
|
this.x.clone().multiply(e.y).subtract(this.y.clone().multiply(e.x))
|
|
@@ -2910,7 +2880,7 @@ const Se = class Se {
|
|
|
2910
2880
|
return this.array.every((e, t) => t === 0 ? e.isOne() : e.isZero());
|
|
2911
2881
|
}
|
|
2912
2882
|
distanceTo(e) {
|
|
2913
|
-
const t = new
|
|
2883
|
+
const t = new Be(this, e);
|
|
2914
2884
|
return {
|
|
2915
2885
|
value: t.norm,
|
|
2916
2886
|
fraction: t.normSquare,
|
|
@@ -2919,7 +2889,7 @@ const Se = class Se {
|
|
|
2919
2889
|
}
|
|
2920
2890
|
};
|
|
2921
2891
|
F = new WeakMap(), Le = new WeakMap();
|
|
2922
|
-
let x =
|
|
2892
|
+
let x = Be;
|
|
2923
2893
|
function Ni(o = 0.5) {
|
|
2924
2894
|
return Math.random() < o;
|
|
2925
2895
|
}
|
|
@@ -2940,11 +2910,11 @@ function fe(o, e, t) {
|
|
|
2940
2910
|
function Y(o, e) {
|
|
2941
2911
|
return e === !1 ? Ni() ? fe(1, o) : -fe(1, o) : fe(-o, o);
|
|
2942
2912
|
}
|
|
2943
|
-
function
|
|
2913
|
+
function ts(o) {
|
|
2944
2914
|
let e = G.primes();
|
|
2945
2915
|
return o !== void 0 && (e = e.filter((t) => t < o)), ci(e);
|
|
2946
2916
|
}
|
|
2947
|
-
function
|
|
2917
|
+
function is(o, e) {
|
|
2948
2918
|
return e === void 0 && (e = 1), o.length <= 0 ? Object.values(o) : Ti(o).slice(0, e);
|
|
2949
2919
|
}
|
|
2950
2920
|
function ci(o) {
|
|
@@ -2984,7 +2954,7 @@ class V extends x {
|
|
|
2984
2954
|
return e.array = this.copy(), e.asPoint = !0, e;
|
|
2985
2955
|
}
|
|
2986
2956
|
}
|
|
2987
|
-
var Oi = /* @__PURE__ */ ((o) => (o.None = "none", o.Parallel = "parallel", o.Perpendicular = "perpendicular", o.Tangent = "tangent", o))(Oi || {}), $e,
|
|
2957
|
+
var Oi = /* @__PURE__ */ ((o) => (o.None = "none", o.Parallel = "parallel", o.Perpendicular = "perpendicular", o.Tangent = "tangent", o))(Oi || {}), $e, B, S, U, ne, Q, Ie, ve;
|
|
2988
2958
|
const Ve = class Ve {
|
|
2989
2959
|
/**
|
|
2990
2960
|
* Value can be a mix of:
|
|
@@ -2994,8 +2964,8 @@ const Ve = class Ve {
|
|
|
2994
2964
|
constructor(...e) {
|
|
2995
2965
|
p(this, $e);
|
|
2996
2966
|
// ax + by + c = 0
|
|
2997
|
-
p(this, S);
|
|
2998
2967
|
p(this, B);
|
|
2968
|
+
p(this, S);
|
|
2999
2969
|
p(this, U);
|
|
3000
2970
|
p(this, ne);
|
|
3001
2971
|
p(this, Q);
|
|
@@ -3081,7 +3051,7 @@ const Ve = class Ve {
|
|
|
3081
3051
|
e.left.monomByDegree(0).coefficient
|
|
3082
3052
|
);
|
|
3083
3053
|
});
|
|
3084
|
-
a(this, "fromCoefficient", (e, t, i) => (h(this,
|
|
3054
|
+
a(this, "fromCoefficient", (e, t, i) => (h(this, B, new u(e)), h(this, S, new u(t)), h(this, U, new u(i)), h(this, Q, new x(s(this, S).clone(), s(this, B).clone().opposite())), h(this, ne, new x(new u().zero(), s(this, U).clone())), h(this, Ie, s(this, Q).clone().normal()), this));
|
|
3085
3055
|
a(this, "fromPointAndDirection", (e, t) => (this.fromCoefficient(
|
|
3086
3056
|
t.y,
|
|
3087
3057
|
t.x.clone().opposite(),
|
|
@@ -3093,22 +3063,22 @@ const Ve = class Ve {
|
|
|
3093
3063
|
e.x.clone().multiply(t.x).add(e.y.clone().multiply(t.y)).opposite()
|
|
3094
3064
|
));
|
|
3095
3065
|
a(this, "fromPointAndLine", (e, t, i) => (i === void 0 && (i = "parallel"), i === "parallel" ? this.fromPointAndNormal(e, t.normal) : i === "perpendicular" ? this.fromPointAndNormal(e, t.director) : this));
|
|
3096
|
-
a(this, "clone", () => (h(this,
|
|
3066
|
+
a(this, "clone", () => (h(this, B, s(this, B).clone()), h(this, S, s(this, S).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));
|
|
3097
3067
|
// ------------------------------------------
|
|
3098
3068
|
// Mathematical operations
|
|
3099
3069
|
// ------------------------------------------
|
|
3100
|
-
a(this, "isOnLine", (e) => s(this,
|
|
3101
|
-
s(this,
|
|
3070
|
+
a(this, "isOnLine", (e) => s(this, B).clone().multiply(e.x).add(
|
|
3071
|
+
s(this, S).clone().multiply(e.y)
|
|
3102
3072
|
).add(s(this, U)).isZero());
|
|
3103
3073
|
a(this, "isParallelTo", (e) => this.slope.isEqual(e.slope) && this.height.isNotEqual(e.height));
|
|
3104
3074
|
a(this, "isSameAs", (e) => this.slope.isEqual(e.slope) && this.height.isEqual(e.height));
|
|
3105
3075
|
a(this, "isPerpendicularTo", (e) => this.d.isNormalTo(e.d));
|
|
3106
3076
|
a(this, "isVertical", () => this.slope.isInfinity());
|
|
3107
3077
|
a(this, "simplify", () => {
|
|
3108
|
-
const e = G.lcm(s(this,
|
|
3078
|
+
const e = G.lcm(s(this, B).denominator, s(this, S).denominator, s(this, U).denominator), t = G.gcd(s(this, B).numerator, s(this, S).numerator, s(this, U).numerator);
|
|
3109
3079
|
return this.fromCoefficient(
|
|
3110
|
-
s(this, S).clone().multiply(e).divide(t),
|
|
3111
3080
|
s(this, B).clone().multiply(e).divide(t),
|
|
3081
|
+
s(this, S).clone().multiply(e).divide(t),
|
|
3112
3082
|
s(this, U).clone().multiply(e).divide(t)
|
|
3113
3083
|
), this;
|
|
3114
3084
|
});
|
|
@@ -3116,7 +3086,7 @@ const Ve = class Ve {
|
|
|
3116
3086
|
a(this, "intersection", (e) => {
|
|
3117
3087
|
const t = new V();
|
|
3118
3088
|
let i = !1, n = !1;
|
|
3119
|
-
return s(this,
|
|
3089
|
+
return s(this, S).isZero() || e.b.isZero(), this.isParallelTo(e) ? (t.x = new u().invalid(), t.y = new u().invalid(), i = !0) : this.isSameAs(e) ? (t.x = new u().invalid(), t.y = new u().invalid(), n = !0) : (t.x = s(this, S).clone().multiply(e.c).subtract(s(this, U).clone().multiply(e.b)).divide(s(this, B).clone().multiply(e.b).subtract(s(this, S).clone().multiply(e.a))), t.y = s(this, B).clone().multiply(e.c).subtract(s(this, U).clone().multiply(e.a)).divide(s(this, S).clone().multiply(e.a).subtract(s(this, B).clone().multiply(e.b)))), {
|
|
3120
3090
|
point: t,
|
|
3121
3091
|
hasIntersection: !(i || n),
|
|
3122
3092
|
isParallel: i,
|
|
@@ -3131,21 +3101,21 @@ const Ve = class Ve {
|
|
|
3131
3101
|
const t = this.getEquation().isolate("x"), i = new u(e);
|
|
3132
3102
|
return t instanceof H ? t.right.evaluate({ y: i }) : new u().invalid();
|
|
3133
3103
|
});
|
|
3134
|
-
return h(this,
|
|
3104
|
+
return h(this, B, new u().zero()), h(this, S, 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, $e, !0), e.length > 0 && this.parse(...e), this;
|
|
3135
3105
|
}
|
|
3136
3106
|
get a() {
|
|
3137
|
-
return s(this,
|
|
3107
|
+
return s(this, B);
|
|
3138
3108
|
}
|
|
3139
3109
|
// ------------------------------------------
|
|
3140
3110
|
// Getter and setter
|
|
3141
3111
|
set a(e) {
|
|
3142
|
-
h(this,
|
|
3112
|
+
h(this, B, e);
|
|
3143
3113
|
}
|
|
3144
3114
|
get b() {
|
|
3145
|
-
return s(this,
|
|
3115
|
+
return s(this, S);
|
|
3146
3116
|
}
|
|
3147
3117
|
set b(e) {
|
|
3148
|
-
h(this,
|
|
3118
|
+
h(this, S, e);
|
|
3149
3119
|
}
|
|
3150
3120
|
get c() {
|
|
3151
3121
|
return s(this, U);
|
|
@@ -3170,7 +3140,7 @@ const Ve = class Ve {
|
|
|
3170
3140
|
}
|
|
3171
3141
|
// ------------------------------------------
|
|
3172
3142
|
getEquation() {
|
|
3173
|
-
const e = new H(new A().parse("xy", s(this,
|
|
3143
|
+
const e = new H(new A().parse("xy", s(this, B), s(this, S), s(this, U)), new A("0"));
|
|
3174
3144
|
return s(this, $e) ? e.simplify() : e;
|
|
3175
3145
|
}
|
|
3176
3146
|
// get system(): { x: Equation, y: Equation } {
|
|
@@ -3218,7 +3188,7 @@ const Ve = class Ve {
|
|
|
3218
3188
|
}
|
|
3219
3189
|
default: {
|
|
3220
3190
|
const t = this.getEquation();
|
|
3221
|
-
return s(this,
|
|
3191
|
+
return s(this, B).isNegative() && t.multiply(-1), t.tex;
|
|
3222
3192
|
}
|
|
3223
3193
|
}
|
|
3224
3194
|
}
|
|
@@ -3241,27 +3211,27 @@ const Ve = class Ve {
|
|
|
3241
3211
|
}
|
|
3242
3212
|
default: {
|
|
3243
3213
|
const t = this.getEquation();
|
|
3244
|
-
return s(this,
|
|
3214
|
+
return s(this, B).isNegative() && t.multiply(-1), t.display;
|
|
3245
3215
|
}
|
|
3246
3216
|
}
|
|
3247
3217
|
}
|
|
3248
3218
|
get normal() {
|
|
3249
|
-
return new x(s(this,
|
|
3219
|
+
return new x(s(this, B), s(this, S));
|
|
3250
3220
|
}
|
|
3251
3221
|
get director() {
|
|
3252
3222
|
return s(this, Q).clone();
|
|
3253
3223
|
}
|
|
3254
3224
|
get slope() {
|
|
3255
|
-
return s(this,
|
|
3225
|
+
return s(this, B).clone().opposite().divide(s(this, S));
|
|
3256
3226
|
}
|
|
3257
3227
|
get height() {
|
|
3258
|
-
return s(this, U).clone().opposite().divide(s(this,
|
|
3228
|
+
return s(this, U).clone().opposite().divide(s(this, S));
|
|
3259
3229
|
}
|
|
3260
3230
|
fromPoints(e, t) {
|
|
3261
3231
|
return this.fromPointAndDirection(e, new x(e, t));
|
|
3262
3232
|
}
|
|
3263
3233
|
distanceTo(e) {
|
|
3264
|
-
const t = e.x.clone().multiply(s(this,
|
|
3234
|
+
const t = e.x.clone().multiply(s(this, B)).add(e.y.clone().multiply(s(this, S))).add(s(this, U)).abs(), i = this.normal.normSquare;
|
|
3265
3235
|
if (i.isZero())
|
|
3266
3236
|
return {
|
|
3267
3237
|
value: NaN,
|
|
@@ -3291,13 +3261,13 @@ const Ve = class Ve {
|
|
|
3291
3261
|
canonicalAsFloatCoefficient(e) {
|
|
3292
3262
|
e === void 0 && (e = 2);
|
|
3293
3263
|
let t = "";
|
|
3294
|
-
return s(this,
|
|
3264
|
+
return s(this, B).isZero() || (s(this, B).isOne() ? t = "x" : s(this, B).clone().opposite().isOne() ? t = "-x" : t = s(this, B).value.toFixed(e) + "x"), s(this, S).isZero() || (s(this, S).isPositive() && (t += "+"), t += s(this, S).value.toFixed(e) + "y"), s(this, U).isZero() || (s(this, U).isPositive() && (t += "+"), t += s(this, U).value.toFixed(e)), t + "=0";
|
|
3295
3265
|
}
|
|
3296
3266
|
};
|
|
3297
|
-
$e = new WeakMap(),
|
|
3267
|
+
$e = new WeakMap(), B = new WeakMap(), S = new WeakMap(), U = new WeakMap(), ne = new WeakMap(), Q = new WeakMap(), Ie = new WeakMap(), ve = new WeakMap(), // A line is defined as the canonical form
|
|
3298
3268
|
a(Ve, "PERPENDICULAR", "perpendicular"), a(Ve, "PARALLEL", "parallel");
|
|
3299
3269
|
let D = Ve;
|
|
3300
|
-
var re, j, Oe, Zt, Ft, jt, oe, Ai,
|
|
3270
|
+
var re, j, Oe, Zt, Ft, jt, oe, Ai, bt, qi, Mi, ki, si;
|
|
3301
3271
|
const Ut = class Ut {
|
|
3302
3272
|
constructor(...e) {
|
|
3303
3273
|
p(this, oe);
|
|
@@ -3398,10 +3368,10 @@ const Ut = class Ut {
|
|
|
3398
3368
|
);
|
|
3399
3369
|
}
|
|
3400
3370
|
setRadius(e, t) {
|
|
3401
|
-
return t ? h(this, j, new u(e)) : h(this, j, new u(e).pow(2)), q(this, oe,
|
|
3371
|
+
return t ? h(this, j, new u(e)) : h(this, j, new u(e).pow(2)), q(this, oe, bt).call(this), this;
|
|
3402
3372
|
}
|
|
3403
3373
|
parse(...e) {
|
|
3404
|
-
return q(this, oe, Ai).call(this), typeof e[0] == "string" ? q(this, oe, si).call(this, new H(e[0])) : e[0] instanceof H ? q(this, oe, si).call(this, e[0]) : e[0] instanceof Ut ? q(this, oe, qi).call(this, e[0]) : e[0] instanceof V && e.length > 1 && (e[1] instanceof V ? e[2] instanceof V || q(this, oe, ki).call(this, e[0], e[1]) : (e[1] instanceof u || typeof e[1] == "number") && q(this, oe, Mi).call(this, e[0], e[1], typeof e[2] == "boolean" ? e[2] : !1)), q(this, oe,
|
|
3374
|
+
return q(this, oe, Ai).call(this), typeof e[0] == "string" ? q(this, oe, si).call(this, new H(e[0])) : e[0] instanceof H ? q(this, oe, si).call(this, e[0]) : e[0] instanceof Ut ? q(this, oe, qi).call(this, e[0]) : e[0] instanceof V && e.length > 1 && (e[1] instanceof V ? e[2] instanceof V || q(this, oe, ki).call(this, e[0], e[1]) : (e[1] instanceof u || typeof e[1] == "number") && q(this, oe, Mi).call(this, e[0], e[1], typeof e[2] == "boolean" ? e[2] : !1)), q(this, oe, bt).call(this), this;
|
|
3405
3375
|
}
|
|
3406
3376
|
// private _parseThroughtThreePoints(A: Point, B: Point, C: Point): this {
|
|
3407
3377
|
// const T = new Triangle(A, B, C), mAB = T.remarquables.mediators.AB.clone(),
|
|
@@ -3412,13 +3382,13 @@ const Ut = class Ut {
|
|
|
3412
3382
|
};
|
|
3413
3383
|
re = new WeakMap(), j = new WeakMap(), Oe = new WeakMap(), Zt = new WeakMap(), Ft = new WeakMap(), jt = new WeakMap(), oe = new WeakSet(), Ai = function() {
|
|
3414
3384
|
return h(this, re, void 0), h(this, j, void 0), h(this, Oe, void 0), this;
|
|
3415
|
-
},
|
|
3385
|
+
}, bt = function() {
|
|
3416
3386
|
h(this, Oe, new H(
|
|
3417
3387
|
new A(`(x-(${this.center.x.display}))^2+(y-(${this.center.y.display}))^2`),
|
|
3418
3388
|
new A(this.squareRadius.display)
|
|
3419
3389
|
).moveLeft());
|
|
3420
3390
|
}, qi = function(e) {
|
|
3421
|
-
return h(this, re, e.center.clone()), h(this, j, e.squareRadius.clone()), q(this, oe,
|
|
3391
|
+
return h(this, re, e.center.clone()), h(this, j, e.squareRadius.clone()), q(this, oe, bt).call(this), this;
|
|
3422
3392
|
}, Mi = function(e, t, i) {
|
|
3423
3393
|
return h(this, re, e.clone()), i ? h(this, j, new u(t)) : h(this, j, new u(t).pow(2)), this;
|
|
3424
3394
|
}, ki = function(e, t) {
|
|
@@ -3431,8 +3401,8 @@ re = new WeakMap(), j = new WeakMap(), Oe = new WeakMap(), Zt = new WeakMap(), F
|
|
|
3431
3401
|
}
|
|
3432
3402
|
return this;
|
|
3433
3403
|
};
|
|
3434
|
-
let
|
|
3435
|
-
var X, K, J, it, Ae,
|
|
3404
|
+
let Et = Ut;
|
|
3405
|
+
var X, K, J, it, Ae, pt, Gt, mt, Pe, Wt, st;
|
|
3436
3406
|
const Ht = class Ht {
|
|
3437
3407
|
constructor(...e) {
|
|
3438
3408
|
p(this, X);
|
|
@@ -3440,7 +3410,7 @@ const Ht = class Ht {
|
|
|
3440
3410
|
p(this, J);
|
|
3441
3411
|
p(this, it);
|
|
3442
3412
|
p(this, Ae);
|
|
3443
|
-
p(this,
|
|
3413
|
+
p(this, pt);
|
|
3444
3414
|
// ------------------------------------------
|
|
3445
3415
|
// Creation / parsing functions
|
|
3446
3416
|
// ------------------------------------------
|
|
@@ -3510,13 +3480,13 @@ const Ht = class Ht {
|
|
|
3510
3480
|
AB: new V().middleOf(s(this, X), s(this, K)),
|
|
3511
3481
|
AC: new V().middleOf(s(this, X), s(this, J)),
|
|
3512
3482
|
BC: new V().middleOf(s(this, K), s(this, J))
|
|
3513
|
-
}), h(this,
|
|
3483
|
+
}), h(this, pt, s(this, Wt).call(this));
|
|
3514
3484
|
});
|
|
3515
3485
|
/**
|
|
3516
3486
|
* Get the Vector2D class for the given name
|
|
3517
3487
|
* @param ptName
|
|
3518
3488
|
*/
|
|
3519
|
-
p(this,
|
|
3489
|
+
p(this, mt, (e) => {
|
|
3520
3490
|
switch (e.toUpperCase()) {
|
|
3521
3491
|
case "A":
|
|
3522
3492
|
return s(this, X);
|
|
@@ -3533,8 +3503,8 @@ const Ht = class Ht {
|
|
|
3533
3503
|
* @param ptName2
|
|
3534
3504
|
*/
|
|
3535
3505
|
p(this, Pe, (e, t) => new x(
|
|
3536
|
-
s(this,
|
|
3537
|
-
s(this,
|
|
3506
|
+
s(this, mt).call(this, e),
|
|
3507
|
+
s(this, mt).call(this, t)
|
|
3538
3508
|
));
|
|
3539
3509
|
p(this, Wt, () => {
|
|
3540
3510
|
const e = {
|
|
@@ -3624,10 +3594,10 @@ const Ht = class Ht {
|
|
|
3624
3594
|
return s(this, it);
|
|
3625
3595
|
}
|
|
3626
3596
|
get remarquables() {
|
|
3627
|
-
return s(this,
|
|
3597
|
+
return s(this, pt);
|
|
3628
3598
|
}
|
|
3629
3599
|
};
|
|
3630
|
-
X = new WeakMap(), K = new WeakMap(), J = new WeakMap(), it = new WeakMap(), Ae = new WeakMap(),
|
|
3600
|
+
X = new WeakMap(), K = new WeakMap(), J = new WeakMap(), it = new WeakMap(), Ae = new WeakMap(), pt = new WeakMap(), Gt = new WeakMap(), mt = new WeakMap(), Pe = new WeakMap(), Wt = new WeakMap(), st = new WeakMap();
|
|
3631
3601
|
let ni = Ht;
|
|
3632
3602
|
var R, W;
|
|
3633
3603
|
const at = class at {
|
|
@@ -3738,7 +3708,7 @@ const at = class at {
|
|
|
3738
3708
|
};
|
|
3739
3709
|
R = new WeakMap(), W = new WeakMap(), // A line is defined as the canonical form
|
|
3740
3710
|
a(at, "PERPENDICULAR", "perpendicular"), a(at, "PARALLEL", "parallel");
|
|
3741
|
-
let
|
|
3711
|
+
let Nt = at;
|
|
3742
3712
|
var qe, Ge;
|
|
3743
3713
|
const fi = class fi {
|
|
3744
3714
|
constructor(e) {
|
|
@@ -3833,7 +3803,7 @@ const fi = class fi {
|
|
|
3833
3803
|
qe = new WeakMap(), Ge = new WeakMap();
|
|
3834
3804
|
let ri = fi;
|
|
3835
3805
|
var Me;
|
|
3836
|
-
class
|
|
3806
|
+
class ss {
|
|
3837
3807
|
constructor(...e) {
|
|
3838
3808
|
p(this, Me, []);
|
|
3839
3809
|
return h(this, Me, e), this;
|
|
@@ -3853,11 +3823,11 @@ class ns {
|
|
|
3853
3823
|
determinant() {
|
|
3854
3824
|
if (!this.isSquare())
|
|
3855
3825
|
throw new Error("Matrix is not square");
|
|
3856
|
-
return
|
|
3826
|
+
return es(...this.values);
|
|
3857
3827
|
}
|
|
3858
3828
|
}
|
|
3859
3829
|
Me = new WeakMap();
|
|
3860
|
-
function
|
|
3830
|
+
function Tt(o) {
|
|
3861
3831
|
const e = Object.assign(
|
|
3862
3832
|
{
|
|
3863
3833
|
negative: !0,
|
|
@@ -3887,7 +3857,7 @@ function Ci(o) {
|
|
|
3887
3857
|
},
|
|
3888
3858
|
o
|
|
3889
3859
|
), t = new k();
|
|
3890
|
-
if (t.coefficient =
|
|
3860
|
+
if (t.coefficient = Tt({
|
|
3891
3861
|
zero: e.zero,
|
|
3892
3862
|
reduced: !0,
|
|
3893
3863
|
natural: !e.fraction
|
|
@@ -3902,7 +3872,7 @@ function Ci(o) {
|
|
|
3902
3872
|
t.setLetter(e.letters, e.degree);
|
|
3903
3873
|
return t;
|
|
3904
3874
|
}
|
|
3905
|
-
const
|
|
3875
|
+
const ns = {
|
|
3906
3876
|
letters: "x",
|
|
3907
3877
|
degree: 2,
|
|
3908
3878
|
fraction: !1,
|
|
@@ -3915,7 +3885,7 @@ const rs = {
|
|
|
3915
3885
|
};
|
|
3916
3886
|
function $i(o) {
|
|
3917
3887
|
const e = Object.assign(
|
|
3918
|
-
|
|
3888
|
+
ns,
|
|
3919
3889
|
o
|
|
3920
3890
|
), t = new A().empty();
|
|
3921
3891
|
let i;
|
|
@@ -3933,7 +3903,7 @@ function $i(o) {
|
|
|
3933
3903
|
}
|
|
3934
3904
|
return t;
|
|
3935
3905
|
}
|
|
3936
|
-
function
|
|
3906
|
+
function rs(o) {
|
|
3937
3907
|
const e = Object.assign(
|
|
3938
3908
|
{
|
|
3939
3909
|
letters: "x",
|
|
@@ -3975,10 +3945,10 @@ function oi(o) {
|
|
|
3975
3945
|
quadrant: null
|
|
3976
3946
|
},
|
|
3977
3947
|
o
|
|
3978
|
-
), t = e.axis === "x", i = e.axis === "y", n = e.fraction ?
|
|
3948
|
+
), t = e.axis === "x", i = e.axis === "y", n = e.fraction ? Tt({ max: e.max, zero: t }) : new u(Y(e.max, t)), r = e.fraction ? Tt({ max: e.max, zero: i }) : new u(Y(e.max, i));
|
|
3979
3949
|
return Number(e.quadrant) === 1 && (n.abs(), r.abs()), Number(e.quadrant) === 2 && (n.isPositive() && n.opposite(), r.isNegative() && r.opposite()), Number(e.quadrant) === 3 && (n.isPositive() && n.opposite(), r.isPositive() && r.opposite()), Number(e.quadrant) === 4 && (n.isNegative() && n.opposite(), r.isPositive() && r.opposite()), new V(n, r);
|
|
3980
3950
|
}
|
|
3981
|
-
function
|
|
3951
|
+
function os(o) {
|
|
3982
3952
|
const e = Object.assign(
|
|
3983
3953
|
{
|
|
3984
3954
|
center: {
|
|
@@ -3990,9 +3960,9 @@ function hs(o) {
|
|
|
3990
3960
|
o
|
|
3991
3961
|
), t = oi(e.center);
|
|
3992
3962
|
let i, n;
|
|
3993
|
-
return e.pointsOnCircle === 8 ? (i = fe(1, 3), n = i ** 2 + (i + 1) ** 2) : n = fe(1, 20), new
|
|
3963
|
+
return e.pointsOnCircle === 8 ? (i = fe(1, 3), n = i ** 2 + (i + 1) ** 2) : n = fe(1, 20), new Et(t, n, !0);
|
|
3994
3964
|
}
|
|
3995
|
-
function
|
|
3965
|
+
function hs(o) {
|
|
3996
3966
|
const e = Object.assign(
|
|
3997
3967
|
{
|
|
3998
3968
|
A: {
|
|
@@ -4009,7 +3979,7 @@ function as(o) {
|
|
|
4009
3979
|
t.x = Y(10), t.y = Y(10);
|
|
4010
3980
|
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 D(new x(e.A.x, e.A.y), t);
|
|
4011
3981
|
}
|
|
4012
|
-
function
|
|
3982
|
+
function as(o) {
|
|
4013
3983
|
const e = Object.assign(
|
|
4014
3984
|
{
|
|
4015
3985
|
A: {
|
|
@@ -4025,37 +3995,37 @@ function ls(o) {
|
|
|
4025
3995
|
},
|
|
4026
3996
|
o
|
|
4027
3997
|
), t = new V(e.A.x, e.A.y, e.A.z), i = new x(e.direction.x, e.direction.y, e.direction.z);
|
|
4028
|
-
return new
|
|
3998
|
+
return new Nt(t, i);
|
|
4029
3999
|
}
|
|
4030
|
-
const
|
|
4031
|
-
equation: (o) =>
|
|
4000
|
+
const ls = {
|
|
4001
|
+
equation: (o) => rs(o),
|
|
4032
4002
|
polynom: (o) => $i(o),
|
|
4033
4003
|
monom: (o) => Ci(o),
|
|
4034
|
-
fraction: (o) =>
|
|
4004
|
+
fraction: (o) => Tt(o),
|
|
4035
4005
|
number: (o, e, t) => fe(o, e, t),
|
|
4036
4006
|
numberSym: (o, e) => Y(o, e),
|
|
4037
|
-
prime: (o) =>
|
|
4007
|
+
prime: (o) => ts(o),
|
|
4038
4008
|
bool: (o) => Ni(o),
|
|
4039
|
-
array: (o, e) =>
|
|
4009
|
+
array: (o, e) => is(o, e),
|
|
4040
4010
|
item: (o) => ci(o),
|
|
4041
4011
|
shuffle: (o) => Ti(o),
|
|
4042
|
-
line: (o) =>
|
|
4043
|
-
line3: (o) =>
|
|
4012
|
+
line: (o) => hs(o),
|
|
4013
|
+
line3: (o) => as(o),
|
|
4044
4014
|
vector: (o) => oi(o),
|
|
4045
4015
|
point: (o) => {
|
|
4046
4016
|
const e = oi(o);
|
|
4047
4017
|
return e.asPoint = !0, e;
|
|
4048
4018
|
},
|
|
4049
|
-
circle: (o) =>
|
|
4019
|
+
circle: (o) => os(o)
|
|
4050
4020
|
};
|
|
4051
|
-
var ke,
|
|
4052
|
-
class
|
|
4021
|
+
var ke, gt, hi;
|
|
4022
|
+
class cs {
|
|
4053
4023
|
/**
|
|
4054
4024
|
*
|
|
4055
4025
|
* @param {string} value (optional) Default polynom to parse on class creation
|
|
4056
4026
|
*/
|
|
4057
4027
|
constructor(e) {
|
|
4058
|
-
p(this,
|
|
4028
|
+
p(this, gt);
|
|
4059
4029
|
p(this, ke);
|
|
4060
4030
|
a(this, "parse", (e) => (h(this, ke, new Xt(Ze.SET).parse(e).rpn), this));
|
|
4061
4031
|
return h(this, ke, []), e !== void 0 && this.parse(e), this;
|
|
@@ -4134,20 +4104,20 @@ class us {
|
|
|
4134
4104
|
return s(this, ke).filter((e) => e.tokenType === "variable").map((e) => e.token);
|
|
4135
4105
|
}
|
|
4136
4106
|
vennAB() {
|
|
4137
|
-
return q(this,
|
|
4107
|
+
return q(this, gt, hi).call(this, {
|
|
4138
4108
|
A: ["A", "AB"],
|
|
4139
4109
|
B: ["B", "AB"]
|
|
4140
4110
|
}, ["A", "B", "AB", "E"]);
|
|
4141
4111
|
}
|
|
4142
4112
|
vennABC() {
|
|
4143
|
-
return q(this,
|
|
4113
|
+
return q(this, gt, hi).call(this, {
|
|
4144
4114
|
A: ["A", "AB", "AC", "ABC"],
|
|
4145
4115
|
B: ["B", "AB", "BC", "ABC"],
|
|
4146
4116
|
C: ["C", "AC", "BC", "ABC"]
|
|
4147
4117
|
}, ["A", "B", "C", "AB", "AC", "BC", "ABC", "E"]);
|
|
4148
4118
|
}
|
|
4149
4119
|
}
|
|
4150
|
-
ke = new WeakMap(),
|
|
4120
|
+
ke = new WeakMap(), gt = new WeakSet(), hi = function(e, t) {
|
|
4151
4121
|
const i = [];
|
|
4152
4122
|
let n;
|
|
4153
4123
|
if (t === void 0) {
|
|
@@ -4191,30 +4161,30 @@ ke = new WeakMap(), yt = new WeakSet(), hi = function(e, t) {
|
|
|
4191
4161
|
}
|
|
4192
4162
|
return [...i[0]].sort();
|
|
4193
4163
|
};
|
|
4194
|
-
const
|
|
4164
|
+
const us = {
|
|
4195
4165
|
Vector: x,
|
|
4196
4166
|
Point: V,
|
|
4197
4167
|
Line: D,
|
|
4198
4168
|
Triangle: ni,
|
|
4199
|
-
Circle:
|
|
4200
|
-
Line3:
|
|
4169
|
+
Circle: Et,
|
|
4170
|
+
Line3: Nt,
|
|
4201
4171
|
Plane3: ri
|
|
4202
|
-
},
|
|
4172
|
+
}, ds = {
|
|
4203
4173
|
Numeric: G,
|
|
4204
4174
|
Fraction: u,
|
|
4205
|
-
Root:
|
|
4175
|
+
Root: yt,
|
|
4206
4176
|
Monom: k,
|
|
4207
4177
|
Polynom: A,
|
|
4208
4178
|
Equation: H,
|
|
4209
|
-
Matrix:
|
|
4179
|
+
Matrix: ss,
|
|
4210
4180
|
LinearSystem: ii,
|
|
4211
4181
|
Factor: le,
|
|
4212
4182
|
PolyFactor: ei,
|
|
4213
|
-
LogicalSet:
|
|
4214
|
-
Random:
|
|
4215
|
-
Geometry:
|
|
4183
|
+
LogicalSet: cs,
|
|
4184
|
+
Random: ls,
|
|
4185
|
+
Geometry: us,
|
|
4216
4186
|
NumExp: Qi
|
|
4217
4187
|
};
|
|
4218
4188
|
export {
|
|
4219
|
-
|
|
4189
|
+
ds as default
|
|
4220
4190
|
};
|