@danielsimonjr/mathts-functions 0.13.2 → 0.14.0
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/arithmetic/cbrt.d.ts.map +1 -1
- package/dist/config-api.d.ts +11 -0
- package/dist/config-api.d.ts.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +203 -171
- package/dist/special/zeta.d.ts.map +1 -1
- package/dist/typed/algebra.d.ts.map +1 -1
- package/dist/typed/arithmetic.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1695,11 +1695,28 @@ var cube = mathTyped2("cube", {
|
|
|
1695
1695
|
return out;
|
|
1696
1696
|
}
|
|
1697
1697
|
});
|
|
1698
|
+
function cbrtAllRoots(z) {
|
|
1699
|
+
const arg3 = z.arg() / 3;
|
|
1700
|
+
const r = Math.cbrt(z.abs());
|
|
1701
|
+
const rotate2 = (theta) => new Complex(r, 0).mul(new Complex(0, theta).exp());
|
|
1702
|
+
return [rotate2(arg3), rotate2(arg3 + Math.PI * 2 / 3), rotate2(arg3 - Math.PI * 2 / 3)];
|
|
1703
|
+
}
|
|
1698
1704
|
var cbrt = mathTyped2("cbrt", {
|
|
1699
1705
|
number: (a) => Math.cbrt(a),
|
|
1700
1706
|
Complex: (a) => a.pow(1 / 3),
|
|
1701
1707
|
BigNumber: (a) => a.cbrt(),
|
|
1702
1708
|
Dual: (a) => a.powConst(1 / 3),
|
|
1709
|
+
// Two-argument allRoots forms (mathjs parity). When `allRoots` is true, all
|
|
1710
|
+
// three complex cube roots are returned (principal first); otherwise the
|
|
1711
|
+
// principal complex root. The real `number` case routes through the complex
|
|
1712
|
+
// path exactly like mathjs `cbrt(8, true)` → [2, -1±i√3].
|
|
1713
|
+
"number, boolean": (a, allRoots) => {
|
|
1714
|
+
const z = new Complex(a, 0);
|
|
1715
|
+
return allRoots ? cbrtAllRoots(z) : cbrtAllRoots(z)[0];
|
|
1716
|
+
},
|
|
1717
|
+
"Complex, boolean": (a, allRoots) => {
|
|
1718
|
+
return allRoots ? cbrtAllRoots(a) : cbrtAllRoots(a)[0];
|
|
1719
|
+
},
|
|
1703
1720
|
// Parallel array cbrt
|
|
1704
1721
|
Float64Array: async (a) => {
|
|
1705
1722
|
if (computePool.shouldParallelize(a.length)) {
|
|
@@ -9250,11 +9267,12 @@ function substitute(expr, vars) {
|
|
|
9250
9267
|
function expand(expr) {
|
|
9251
9268
|
let result = expr;
|
|
9252
9269
|
result = result.replace(/\(([^()]+)\)\^2/g, "($1)*($1)");
|
|
9270
|
+
const splitTerms = (factor2) => factor2.replace(/\s*-\s*/g, " + -").split(/\s*\+\s*/).map((t) => t.trim()).filter((t) => t !== "");
|
|
9253
9271
|
const mulPattern = /\(([^()]+)\)\s*\*\s*\(([^()]+)\)/g;
|
|
9254
9272
|
let match;
|
|
9255
9273
|
while ((match = mulPattern.exec(result)) !== null) {
|
|
9256
|
-
const leftTerms = match[1]
|
|
9257
|
-
const rightTerms = match[2]
|
|
9274
|
+
const leftTerms = splitTerms(match[1]);
|
|
9275
|
+
const rightTerms = splitTerms(match[2]);
|
|
9258
9276
|
const products = [];
|
|
9259
9277
|
for (const l of leftTerms) {
|
|
9260
9278
|
for (const r of rightTerms) {
|
|
@@ -17224,9 +17242,9 @@ var createExpm1 = /* @__PURE__ */ factory(
|
|
|
17224
17242
|
);
|
|
17225
17243
|
|
|
17226
17244
|
// src/utils/bigint.ts
|
|
17227
|
-
function promoteLogarithm(log162, numberLog,
|
|
17245
|
+
function promoteLogarithm(log162, numberLog, config2, cplx) {
|
|
17228
17246
|
return function(b) {
|
|
17229
|
-
if (b > 0 ||
|
|
17247
|
+
if (b > 0 || config2.predictable) {
|
|
17230
17248
|
if (b <= 0) return NaN;
|
|
17231
17249
|
const s = b.toString(16);
|
|
17232
17250
|
const s15 = s.substring(0, 15);
|
|
@@ -17243,7 +17261,7 @@ var log16 = log10Number(16);
|
|
|
17243
17261
|
var createLog10 = /* @__PURE__ */ factory(
|
|
17244
17262
|
name6,
|
|
17245
17263
|
dependencies6,
|
|
17246
|
-
({ typed: typed3, config, Complex: Complex12 }) => {
|
|
17264
|
+
({ typed: typed3, config: config2, Complex: Complex12 }) => {
|
|
17247
17265
|
function complexLog(c) {
|
|
17248
17266
|
return c.log().div(Math.LN10);
|
|
17249
17267
|
}
|
|
@@ -17252,16 +17270,16 @@ var createLog10 = /* @__PURE__ */ factory(
|
|
|
17252
17270
|
}
|
|
17253
17271
|
return typed3(name6, {
|
|
17254
17272
|
number: function(x) {
|
|
17255
|
-
if (x >= 0 ||
|
|
17273
|
+
if (x >= 0 || config2.predictable) {
|
|
17256
17274
|
return log10Number(x);
|
|
17257
17275
|
} else {
|
|
17258
17276
|
return complexLogNumber(x);
|
|
17259
17277
|
}
|
|
17260
17278
|
},
|
|
17261
|
-
bigint: promoteLogarithm(log16, log10Number,
|
|
17279
|
+
bigint: promoteLogarithm(log16, log10Number, config2, complexLogNumber),
|
|
17262
17280
|
Complex: complexLog,
|
|
17263
17281
|
BigNumber: function(x) {
|
|
17264
|
-
if (!x.isNegative() ||
|
|
17282
|
+
if (!x.isNegative() || config2.predictable) {
|
|
17265
17283
|
return x.log();
|
|
17266
17284
|
} else {
|
|
17267
17285
|
return complexLogNumber(x.toNumber());
|
|
@@ -17280,22 +17298,22 @@ var dependencies7 = ["typed", "config", "Complex"];
|
|
|
17280
17298
|
var createLog2 = /* @__PURE__ */ factory(
|
|
17281
17299
|
name7,
|
|
17282
17300
|
dependencies7,
|
|
17283
|
-
({ typed: typed3, config, Complex: Complex12 }) => {
|
|
17301
|
+
({ typed: typed3, config: config2, Complex: Complex12 }) => {
|
|
17284
17302
|
function complexLog2Number(x) {
|
|
17285
17303
|
return _log2Complex(new Complex12(x, 0));
|
|
17286
17304
|
}
|
|
17287
17305
|
return typed3(name7, {
|
|
17288
17306
|
number: function(x) {
|
|
17289
|
-
if (x >= 0 ||
|
|
17307
|
+
if (x >= 0 || config2.predictable) {
|
|
17290
17308
|
return log2Number(x);
|
|
17291
17309
|
} else {
|
|
17292
17310
|
return complexLog2Number(x);
|
|
17293
17311
|
}
|
|
17294
17312
|
},
|
|
17295
|
-
bigint: promoteLogarithm(4, log2Number,
|
|
17313
|
+
bigint: promoteLogarithm(4, log2Number, config2, complexLog2Number),
|
|
17296
17314
|
Complex: _log2Complex,
|
|
17297
17315
|
BigNumber: function(x) {
|
|
17298
|
-
if (!x.isNegative() ||
|
|
17316
|
+
if (!x.isNegative() || config2.predictable) {
|
|
17299
17317
|
return x.log(2);
|
|
17300
17318
|
} else {
|
|
17301
17319
|
return complexLog2Number(x.toNumber());
|
|
@@ -17383,14 +17401,14 @@ var dependencies10 = ["config", "typed", "Complex"];
|
|
|
17383
17401
|
var createSqrt = /* @__PURE__ */ factory(
|
|
17384
17402
|
name10,
|
|
17385
17403
|
dependencies10,
|
|
17386
|
-
({ config, typed: typed3, Complex: Complex12 }) => {
|
|
17404
|
+
({ config: config2, typed: typed3, Complex: Complex12 }) => {
|
|
17387
17405
|
return typed3("sqrt", {
|
|
17388
17406
|
number: _sqrtNumber,
|
|
17389
17407
|
Complex: function(x) {
|
|
17390
17408
|
return x.sqrt();
|
|
17391
17409
|
},
|
|
17392
17410
|
BigNumber: function(x) {
|
|
17393
|
-
if (!x.isNegative() ||
|
|
17411
|
+
if (!x.isNegative() || config2.predictable) {
|
|
17394
17412
|
return x.sqrt();
|
|
17395
17413
|
} else {
|
|
17396
17414
|
return _sqrtNumber(x.toNumber());
|
|
@@ -17403,7 +17421,7 @@ var createSqrt = /* @__PURE__ */ factory(
|
|
|
17403
17421
|
function _sqrtNumber(x) {
|
|
17404
17422
|
if (isNaN(x)) {
|
|
17405
17423
|
return NaN;
|
|
17406
|
-
} else if (x >= 0 ||
|
|
17424
|
+
} else if (x >= 0 || config2.predictable) {
|
|
17407
17425
|
return Math.sqrt(x);
|
|
17408
17426
|
} else {
|
|
17409
17427
|
return new Complex12(x, 0).sqrt();
|
|
@@ -17486,7 +17504,7 @@ var dependencies13 = ["typed", "config", "?bignumber"];
|
|
|
17486
17504
|
var createUnaryMinus = /* @__PURE__ */ factory(
|
|
17487
17505
|
name13,
|
|
17488
17506
|
dependencies13,
|
|
17489
|
-
({ typed: typed3, config, bignumber: bignumber2 }) => {
|
|
17507
|
+
({ typed: typed3, config: config2, bignumber: bignumber2 }) => {
|
|
17490
17508
|
return typed3(name13, {
|
|
17491
17509
|
number: unaryMinusNumber,
|
|
17492
17510
|
"Complex | BigNumber | Fraction": (x) => x.neg(),
|
|
@@ -17499,7 +17517,7 @@ var createUnaryMinus = /* @__PURE__ */ factory(
|
|
|
17499
17517
|
boolean: function(x) {
|
|
17500
17518
|
const numValue = x ? 1 : 0;
|
|
17501
17519
|
const negValue = -numValue;
|
|
17502
|
-
const numberType =
|
|
17520
|
+
const numberType = config2?.number || "number";
|
|
17503
17521
|
switch (numberType) {
|
|
17504
17522
|
case "BigNumber":
|
|
17505
17523
|
if (!bignumber2) {
|
|
@@ -18534,8 +18552,8 @@ var dependencies30 = ["typed", "config", "?on"];
|
|
|
18534
18552
|
var createPickRandom = /* @__PURE__ */ factory(
|
|
18535
18553
|
name30,
|
|
18536
18554
|
dependencies30,
|
|
18537
|
-
({ typed: typed3, config, on }) => {
|
|
18538
|
-
let rng = createRng(
|
|
18555
|
+
({ typed: typed3, config: config2, on }) => {
|
|
18556
|
+
let rng = createRng(config2.randomSeed);
|
|
18539
18557
|
if (on) {
|
|
18540
18558
|
on("config", function(curr, prev) {
|
|
18541
18559
|
if (curr.randomSeed !== prev.randomSeed) {
|
|
@@ -18635,8 +18653,8 @@ var dependencies31 = ["typed", "config", "?on"];
|
|
|
18635
18653
|
var createRandom = /* @__PURE__ */ factory(
|
|
18636
18654
|
name31,
|
|
18637
18655
|
dependencies31,
|
|
18638
|
-
({ typed: typed3, config, on }) => {
|
|
18639
|
-
let rng = createRng(
|
|
18656
|
+
({ typed: typed3, config: config2, on }) => {
|
|
18657
|
+
let rng = createRng(config2.randomSeed);
|
|
18640
18658
|
if (on) {
|
|
18641
18659
|
on("config", function(curr, prev) {
|
|
18642
18660
|
if (curr.randomSeed !== prev.randomSeed) {
|
|
@@ -18715,7 +18733,7 @@ var dependencies32 = ["typed", "config"];
|
|
|
18715
18733
|
var createEqualScalar = /* @__PURE__ */ factory(
|
|
18716
18734
|
name32,
|
|
18717
18735
|
dependencies32,
|
|
18718
|
-
({ typed: typed3, config }) => {
|
|
18736
|
+
({ typed: typed3, config: config2 }) => {
|
|
18719
18737
|
const compareUnits2 = createCompareUnits({ typed: typed3 });
|
|
18720
18738
|
return typed3(
|
|
18721
18739
|
name32,
|
|
@@ -18724,10 +18742,10 @@ var createEqualScalar = /* @__PURE__ */ factory(
|
|
|
18724
18742
|
return x === y;
|
|
18725
18743
|
},
|
|
18726
18744
|
"number, number": function(x, y) {
|
|
18727
|
-
return nearlyEqual(x, y,
|
|
18745
|
+
return nearlyEqual(x, y, config2.relTol, config2.absTol);
|
|
18728
18746
|
},
|
|
18729
18747
|
"BigNumber, BigNumber": function(x, y) {
|
|
18730
|
-
return x.eq(y) || nearlyEqual2(x, y,
|
|
18748
|
+
return x.eq(y) || nearlyEqual2(x, y, config2.relTol, config2.absTol);
|
|
18731
18749
|
},
|
|
18732
18750
|
"bigint, bigint": function(x, y) {
|
|
18733
18751
|
return x === y;
|
|
@@ -18736,7 +18754,7 @@ var createEqualScalar = /* @__PURE__ */ factory(
|
|
|
18736
18754
|
return x.equals(y);
|
|
18737
18755
|
},
|
|
18738
18756
|
"Complex, Complex": function(x, y) {
|
|
18739
|
-
return complexEquals(x, y,
|
|
18757
|
+
return complexEquals(x, y, config2.relTol, config2.absTol);
|
|
18740
18758
|
}
|
|
18741
18759
|
},
|
|
18742
18760
|
compareUnits2
|
|
@@ -18941,10 +18959,10 @@ var dependencies36 = ["typed", "config", "Complex"];
|
|
|
18941
18959
|
var createAcos = /* @__PURE__ */ factory(
|
|
18942
18960
|
name36,
|
|
18943
18961
|
dependencies36,
|
|
18944
|
-
({ typed: typed3, config, Complex: Complex12 }) => {
|
|
18962
|
+
({ typed: typed3, config: config2, Complex: Complex12 }) => {
|
|
18945
18963
|
return typed3(name36, {
|
|
18946
18964
|
number: function(x) {
|
|
18947
|
-
if (x >= -1 && x <= 1 ||
|
|
18965
|
+
if (x >= -1 && x <= 1 || config2.predictable) {
|
|
18948
18966
|
return Math.acos(x);
|
|
18949
18967
|
} else {
|
|
18950
18968
|
return new Complex12(x, 0).acos();
|
|
@@ -18966,10 +18984,10 @@ var dependencies37 = ["typed", "config", "Complex"];
|
|
|
18966
18984
|
var createAcosh = /* @__PURE__ */ factory(
|
|
18967
18985
|
name37,
|
|
18968
18986
|
dependencies37,
|
|
18969
|
-
({ typed: typed3, config, Complex: Complex12 }) => {
|
|
18987
|
+
({ typed: typed3, config: config2, Complex: Complex12 }) => {
|
|
18970
18988
|
return typed3(name37, {
|
|
18971
18989
|
number: function(x) {
|
|
18972
|
-
if (x >= 1 ||
|
|
18990
|
+
if (x >= 1 || config2.predictable) {
|
|
18973
18991
|
return acoshNumber(x);
|
|
18974
18992
|
}
|
|
18975
18993
|
if (x <= -1) {
|
|
@@ -19012,10 +19030,10 @@ var dependencies39 = ["typed", "config", "Complex", "BigNumber"];
|
|
|
19012
19030
|
var createAcoth = /* @__PURE__ */ factory(
|
|
19013
19031
|
name39,
|
|
19014
19032
|
dependencies39,
|
|
19015
|
-
({ typed: typed3, config, Complex: Complex12, BigNumber: BigNumber9 }) => {
|
|
19033
|
+
({ typed: typed3, config: config2, Complex: Complex12, BigNumber: BigNumber9 }) => {
|
|
19016
19034
|
return typed3(name39, {
|
|
19017
19035
|
number: function(x) {
|
|
19018
|
-
if (x >= 1 || x <= -1 ||
|
|
19036
|
+
if (x >= 1 || x <= -1 || config2.predictable) {
|
|
19019
19037
|
return acothNumber(x);
|
|
19020
19038
|
}
|
|
19021
19039
|
return new Complex12(x, 0).acoth();
|
|
@@ -19036,10 +19054,10 @@ var dependencies40 = ["typed", "config", "Complex", "BigNumber"];
|
|
|
19036
19054
|
var createAcsc = /* @__PURE__ */ factory(
|
|
19037
19055
|
name40,
|
|
19038
19056
|
dependencies40,
|
|
19039
|
-
({ typed: typed3, config, Complex: Complex12, BigNumber: BigNumber9 }) => {
|
|
19057
|
+
({ typed: typed3, config: config2, Complex: Complex12, BigNumber: BigNumber9 }) => {
|
|
19040
19058
|
return typed3(name40, {
|
|
19041
19059
|
number: function(x) {
|
|
19042
|
-
if (x <= -1 || x >= 1 ||
|
|
19060
|
+
if (x <= -1 || x >= 1 || config2.predictable) {
|
|
19043
19061
|
return acscNumber(x);
|
|
19044
19062
|
}
|
|
19045
19063
|
return new Complex12(x, 0).acsc();
|
|
@@ -19079,10 +19097,10 @@ var dependencies42 = ["typed", "config", "Complex", "BigNumber"];
|
|
|
19079
19097
|
var createAsec = /* @__PURE__ */ factory(
|
|
19080
19098
|
name42,
|
|
19081
19099
|
dependencies42,
|
|
19082
|
-
({ typed: typed3, config, Complex: Complex12, BigNumber: BigNumber9 }) => {
|
|
19100
|
+
({ typed: typed3, config: config2, Complex: Complex12, BigNumber: BigNumber9 }) => {
|
|
19083
19101
|
return typed3(name42, {
|
|
19084
19102
|
number: function(x) {
|
|
19085
|
-
if (x <= -1 || x >= 1 ||
|
|
19103
|
+
if (x <= -1 || x >= 1 || config2.predictable) {
|
|
19086
19104
|
return asecNumber(x);
|
|
19087
19105
|
}
|
|
19088
19106
|
return new Complex12(x, 0).asec();
|
|
@@ -19103,12 +19121,12 @@ var dependencies43 = ["typed", "config", "Complex", "BigNumber"];
|
|
|
19103
19121
|
var createAsech = /* @__PURE__ */ factory(
|
|
19104
19122
|
name43,
|
|
19105
19123
|
dependencies43,
|
|
19106
|
-
({ typed: typed3, config, Complex: Complex12, BigNumber: BigNumber9 }) => {
|
|
19124
|
+
({ typed: typed3, config: config2, Complex: Complex12, BigNumber: BigNumber9 }) => {
|
|
19107
19125
|
return typed3(name43, {
|
|
19108
19126
|
number: function(x) {
|
|
19109
|
-
if (x <= 1 && x >= -1 ||
|
|
19127
|
+
if (x <= 1 && x >= -1 || config2.predictable) {
|
|
19110
19128
|
const xInv = 1 / x;
|
|
19111
|
-
if (xInv > 0 ||
|
|
19129
|
+
if (xInv > 0 || config2.predictable) {
|
|
19112
19130
|
return asechNumber(x);
|
|
19113
19131
|
}
|
|
19114
19132
|
const ret = Math.sqrt(xInv * xInv - 1);
|
|
@@ -19132,10 +19150,10 @@ var dependencies44 = ["typed", "config", "Complex"];
|
|
|
19132
19150
|
var createAsin = /* @__PURE__ */ factory(
|
|
19133
19151
|
name44,
|
|
19134
19152
|
dependencies44,
|
|
19135
|
-
({ typed: typed3, config, Complex: Complex12 }) => {
|
|
19153
|
+
({ typed: typed3, config: config2, Complex: Complex12 }) => {
|
|
19136
19154
|
return typed3(name44, {
|
|
19137
19155
|
number: function(x) {
|
|
19138
|
-
if (x >= -1 && x <= 1 ||
|
|
19156
|
+
if (x >= -1 && x <= 1 || config2.predictable) {
|
|
19139
19157
|
return Math.asin(x);
|
|
19140
19158
|
} else {
|
|
19141
19159
|
return new Complex12(x, 0).asin();
|
|
@@ -19197,10 +19215,10 @@ var dependencies47 = ["typed", "config", "Complex"];
|
|
|
19197
19215
|
var createAtanh = /* @__PURE__ */ factory(
|
|
19198
19216
|
name47,
|
|
19199
19217
|
dependencies47,
|
|
19200
|
-
({ typed: typed3, config, Complex: Complex12 }) => {
|
|
19218
|
+
({ typed: typed3, config: config2, Complex: Complex12 }) => {
|
|
19201
19219
|
return typed3(name47, {
|
|
19202
19220
|
number: function(x) {
|
|
19203
|
-
if (x <= 1 && x >= -1 ||
|
|
19221
|
+
if (x <= 1 && x >= -1 || config2.predictable) {
|
|
19204
19222
|
return atanhNumber(x);
|
|
19205
19223
|
}
|
|
19206
19224
|
return new Complex12(x, 0).atanh();
|
|
@@ -19526,10 +19544,10 @@ var dependencies64 = ["typed", "config"];
|
|
|
19526
19544
|
var createIsNegative = /* @__PURE__ */ factory(
|
|
19527
19545
|
name64,
|
|
19528
19546
|
dependencies64,
|
|
19529
|
-
({ typed: typed3, config }) => {
|
|
19547
|
+
({ typed: typed3, config: config2 }) => {
|
|
19530
19548
|
return typed3(name64, {
|
|
19531
|
-
number: (x) => nearlyEqual(x, 0,
|
|
19532
|
-
BigNumber: (x) => nearlyEqual2(x, new x.constructor(0),
|
|
19549
|
+
number: (x) => nearlyEqual(x, 0, config2.relTol, config2.absTol) ? false : isNegativeNumber(x),
|
|
19550
|
+
BigNumber: (x) => nearlyEqual2(x, new x.constructor(0), config2.relTol, config2.absTol) ? false : x.isNeg() && !x.isZero() && !x.isNaN(),
|
|
19533
19551
|
bigint: (x) => x < 0n,
|
|
19534
19552
|
Fraction: (x) => x.s < 0n,
|
|
19535
19553
|
// It's enough to decide on the sign
|
|
@@ -19566,10 +19584,10 @@ var dependencies66 = ["typed", "config"];
|
|
|
19566
19584
|
var createIsPositive = /* @__PURE__ */ factory(
|
|
19567
19585
|
name66,
|
|
19568
19586
|
dependencies66,
|
|
19569
|
-
({ typed: typed3, config }) => {
|
|
19587
|
+
({ typed: typed3, config: config2 }) => {
|
|
19570
19588
|
return typed3(name66, {
|
|
19571
|
-
number: (x) => nearlyEqual(x, 0,
|
|
19572
|
-
BigNumber: (x) => nearlyEqual2(x, new x.constructor(0),
|
|
19589
|
+
number: (x) => nearlyEqual(x, 0, config2.relTol, config2.absTol) ? false : isPositiveNumber(x),
|
|
19590
|
+
BigNumber: (x) => nearlyEqual2(x, new x.constructor(0), config2.relTol, config2.absTol) ? false : !x.isNeg() && !x.isZero() && !x.isNaN(),
|
|
19573
19591
|
bigint: (x) => x > 0n,
|
|
19574
19592
|
Fraction: (x) => x.s > 0n && x.n > 0n,
|
|
19575
19593
|
Unit: typed3.referToSelf(
|
|
@@ -19788,7 +19806,7 @@ var dependencies71 = ["typed", "config", "numeric"];
|
|
|
19788
19806
|
var createUnaryPlus = /* @__PURE__ */ factory(
|
|
19789
19807
|
name71,
|
|
19790
19808
|
dependencies71,
|
|
19791
|
-
({ typed: typed3, config, numeric: numeric2 }) => {
|
|
19809
|
+
({ typed: typed3, config: config2, numeric: numeric2 }) => {
|
|
19792
19810
|
return typed3(name71, {
|
|
19793
19811
|
number: unaryPlusNumber,
|
|
19794
19812
|
Complex: function(x) {
|
|
@@ -19811,10 +19829,10 @@ var createUnaryPlus = /* @__PURE__ */ factory(
|
|
|
19811
19829
|
(self) => (x) => deepMap2(x, self, true)
|
|
19812
19830
|
),
|
|
19813
19831
|
boolean: function(x) {
|
|
19814
|
-
return numeric2(x ? 1 : 0,
|
|
19832
|
+
return numeric2(x ? 1 : 0, config2.number);
|
|
19815
19833
|
},
|
|
19816
19834
|
string: function(x) {
|
|
19817
|
-
return numeric2(x, safeNumberType(x,
|
|
19835
|
+
return numeric2(x, safeNumberType(x, config2));
|
|
19818
19836
|
}
|
|
19819
19837
|
});
|
|
19820
19838
|
}
|
|
@@ -19944,8 +19962,8 @@ var dependencies73 = ["typed", "config", "log2", "?on"];
|
|
|
19944
19962
|
var createRandomInt = /* @__PURE__ */ factory(
|
|
19945
19963
|
name73,
|
|
19946
19964
|
dependencies73,
|
|
19947
|
-
({ typed: typed3, config, log2: log23, on }) => {
|
|
19948
|
-
let rng = createRng(
|
|
19965
|
+
({ typed: typed3, config: config2, log2: log23, on }) => {
|
|
19966
|
+
let rng = createRng(config2.randomSeed);
|
|
19949
19967
|
if (on) {
|
|
19950
19968
|
on("config", function(curr, prev) {
|
|
19951
19969
|
if (curr.randomSeed !== prev.randomSeed) {
|
|
@@ -20237,12 +20255,12 @@ var dependencies82 = ["config", "?bignumber"];
|
|
|
20237
20255
|
var createParseNumberWithConfig = /* @__PURE__ */ factory(
|
|
20238
20256
|
name82,
|
|
20239
20257
|
dependencies82,
|
|
20240
|
-
({ config, bignumber: bignumber2 }) => {
|
|
20258
|
+
({ config: config2, bignumber: bignumber2 }) => {
|
|
20241
20259
|
function parseNumberWithConfig2(str) {
|
|
20242
20260
|
if (typeof str !== "string") {
|
|
20243
20261
|
throw new TypeError(`parseNumberWithConfig expects string, got ${typeof str}`);
|
|
20244
20262
|
}
|
|
20245
|
-
const numberType =
|
|
20263
|
+
const numberType = config2.number || "number";
|
|
20246
20264
|
switch (numberType) {
|
|
20247
20265
|
case "BigNumber":
|
|
20248
20266
|
if (!bignumber2) {
|
|
@@ -20457,22 +20475,22 @@ var dependencies85 = ["typed", "config", "matrix", "BigNumber", "DenseMatrix", "
|
|
|
20457
20475
|
var createIdentity = /* @__PURE__ */ factory(
|
|
20458
20476
|
name85,
|
|
20459
20477
|
dependencies85,
|
|
20460
|
-
({ typed: typed3, config, matrix: matrix2, BigNumber: BigNumber9, DenseMatrix: DenseMatrix6, SparseMatrix }) => {
|
|
20478
|
+
({ typed: typed3, config: config2, matrix: matrix2, BigNumber: BigNumber9, DenseMatrix: DenseMatrix6, SparseMatrix }) => {
|
|
20461
20479
|
return typed3(name85, {
|
|
20462
20480
|
"": function() {
|
|
20463
|
-
return
|
|
20481
|
+
return config2.matrix === "Matrix" ? matrix2([]) : [];
|
|
20464
20482
|
},
|
|
20465
20483
|
string: function(format6) {
|
|
20466
20484
|
return matrix2(format6);
|
|
20467
20485
|
},
|
|
20468
20486
|
"number | BigNumber": function(rows) {
|
|
20469
|
-
return _identity(rows, rows,
|
|
20487
|
+
return _identity(rows, rows, config2.matrix === "Matrix" ? "dense" : void 0);
|
|
20470
20488
|
},
|
|
20471
20489
|
"number | BigNumber, string": function(rows, format6) {
|
|
20472
20490
|
return _identity(rows, rows, format6);
|
|
20473
20491
|
},
|
|
20474
20492
|
"number | BigNumber, number | BigNumber": function(rows, cols) {
|
|
20475
|
-
return _identity(rows, cols,
|
|
20493
|
+
return _identity(rows, cols, config2.matrix === "Matrix" ? "dense" : void 0);
|
|
20476
20494
|
},
|
|
20477
20495
|
"number | BigNumber, number | BigNumber, string": function(rows, cols, format6) {
|
|
20478
20496
|
return _identity(rows, cols, format6);
|
|
@@ -20535,10 +20553,10 @@ var createIdentity = /* @__PURE__ */ factory(
|
|
|
20535
20553
|
);
|
|
20536
20554
|
|
|
20537
20555
|
// src/matrix/utils/zerosAndOnes.ts
|
|
20538
|
-
function createZerosAndOnes(name254, defaultValue, { typed: typed3, config, matrix: matrix2, BigNumber: BigNumber9 }) {
|
|
20556
|
+
function createZerosAndOnes(name254, defaultValue, { typed: typed3, config: config2, matrix: matrix2, BigNumber: BigNumber9 }) {
|
|
20539
20557
|
return typed3(name254, {
|
|
20540
20558
|
"": function() {
|
|
20541
|
-
return
|
|
20559
|
+
return config2.matrix === "Array" ? _zerosAndOnes([]) : _zerosAndOnes([], "default");
|
|
20542
20560
|
},
|
|
20543
20561
|
// math.zeros/ones(m, n, p, ..., format)
|
|
20544
20562
|
// TODO: more accurate signature '...number | BigNumber, string' as soon as typed-function supports this
|
|
@@ -20547,7 +20565,7 @@ function createZerosAndOnes(name254, defaultValue, { typed: typed3, config, matr
|
|
|
20547
20565
|
if (typeof last === "string") {
|
|
20548
20566
|
const format6 = size2.pop();
|
|
20549
20567
|
return _zerosAndOnes(size2, format6);
|
|
20550
|
-
} else if (
|
|
20568
|
+
} else if (config2.matrix === "Array") {
|
|
20551
20569
|
return _zerosAndOnes(size2);
|
|
20552
20570
|
} else {
|
|
20553
20571
|
return _zerosAndOnes(size2, "default");
|
|
@@ -23027,7 +23045,7 @@ var createCbrt = /* @__PURE__ */ factory(
|
|
|
23027
23045
|
name105,
|
|
23028
23046
|
dependencies105,
|
|
23029
23047
|
({
|
|
23030
|
-
config,
|
|
23048
|
+
config: config2,
|
|
23031
23049
|
typed: typed3,
|
|
23032
23050
|
isNegative: isNegative2,
|
|
23033
23051
|
unaryMinus: unaryMinus2,
|
|
@@ -23038,8 +23056,14 @@ var createCbrt = /* @__PURE__ */ factory(
|
|
|
23038
23056
|
}) => {
|
|
23039
23057
|
return typed3(name105, {
|
|
23040
23058
|
number: cbrtNumber,
|
|
23041
|
-
//
|
|
23042
|
-
//
|
|
23059
|
+
// The two-argument real form. mathjs assumes typed-function synthesizes
|
|
23060
|
+
// this from `Complex, boolean` via a number→Complex conversion, but the
|
|
23061
|
+
// MathTS typed instance does not, so it is registered explicitly: route
|
|
23062
|
+
// through the complex cube-root path (all three roots when allRoots, the
|
|
23063
|
+
// principal Complex root otherwise) — matching mathjs `cbrt(8, true)`.
|
|
23064
|
+
"number, boolean": function(x, allRoots) {
|
|
23065
|
+
return _cbrtComplex(new Complex12(x, 0), allRoots);
|
|
23066
|
+
},
|
|
23043
23067
|
Complex: _cbrtComplex,
|
|
23044
23068
|
"Complex, boolean": _cbrtComplex,
|
|
23045
23069
|
BigNumber: function(x) {
|
|
@@ -23057,7 +23081,7 @@ var createCbrt = /* @__PURE__ */ factory(
|
|
|
23057
23081
|
new Complex12(cbrtNumber(abs2), 0).mul(new Complex12(0, arg3 + Math.PI * 2 / 3).exp()),
|
|
23058
23082
|
new Complex12(cbrtNumber(abs2), 0).mul(new Complex12(0, arg3 - Math.PI * 2 / 3).exp())
|
|
23059
23083
|
];
|
|
23060
|
-
return
|
|
23084
|
+
return config2.matrix === "Array" ? all : matrix2(all);
|
|
23061
23085
|
} else {
|
|
23062
23086
|
return principal;
|
|
23063
23087
|
}
|
|
@@ -23333,7 +23357,7 @@ var dependencies110 = [
|
|
|
23333
23357
|
var createRound = /* @__PURE__ */ factory(
|
|
23334
23358
|
name110,
|
|
23335
23359
|
dependencies110,
|
|
23336
|
-
({ typed: typed3, config, matrix: matrix2, equalScalar: equalScalar3, zeros: zeros2, BigNumber: BigNumber9, DenseMatrix: DenseMatrix6 }) => {
|
|
23360
|
+
({ typed: typed3, config: config2, matrix: matrix2, equalScalar: equalScalar3, zeros: zeros2, BigNumber: BigNumber9, DenseMatrix: DenseMatrix6 }) => {
|
|
23337
23361
|
const matAlgo11xS0s = createMatAlgo11xS0s({ typed: typed3, equalScalar: equalScalar3 });
|
|
23338
23362
|
const matAlgo12xSfs = createMatAlgo12xSfs({ typed: typed3, DenseMatrix: DenseMatrix6 });
|
|
23339
23363
|
const matAlgo14xDs = createMatAlgo14xDs({ typed: typed3 });
|
|
@@ -23342,17 +23366,17 @@ var createRound = /* @__PURE__ */ factory(
|
|
|
23342
23366
|
}
|
|
23343
23367
|
return typed3(name110, {
|
|
23344
23368
|
number: function(x) {
|
|
23345
|
-
const xEpsilon = roundNumber(x, toExponent(
|
|
23346
|
-
const xSelected = nearlyEqual(x, xEpsilon,
|
|
23369
|
+
const xEpsilon = roundNumber(x, toExponent(config2.relTol));
|
|
23370
|
+
const xSelected = nearlyEqual(x, xEpsilon, config2.relTol, config2.absTol) ? xEpsilon : x;
|
|
23347
23371
|
return roundNumber(xSelected);
|
|
23348
23372
|
},
|
|
23349
23373
|
"number, number": function(x, n) {
|
|
23350
|
-
const epsilonExponent = toExponent(
|
|
23374
|
+
const epsilonExponent = toExponent(config2.relTol);
|
|
23351
23375
|
if (n >= epsilonExponent) {
|
|
23352
23376
|
return roundNumber(x, n);
|
|
23353
23377
|
}
|
|
23354
23378
|
const xEpsilon = roundNumber(x, epsilonExponent);
|
|
23355
|
-
const xSelected = nearlyEqual(x, xEpsilon,
|
|
23379
|
+
const xSelected = nearlyEqual(x, xEpsilon, config2.relTol, config2.absTol) ? xEpsilon : x;
|
|
23356
23380
|
return roundNumber(xSelected, n);
|
|
23357
23381
|
},
|
|
23358
23382
|
"number, BigNumber": function(x, n) {
|
|
@@ -23378,20 +23402,20 @@ var createRound = /* @__PURE__ */ factory(
|
|
|
23378
23402
|
return x.round(_n);
|
|
23379
23403
|
},
|
|
23380
23404
|
BigNumber: function(x) {
|
|
23381
|
-
const xEpsilon = new BigNumber9(x).toDecimalPlaces(toExponent(
|
|
23382
|
-
const xSelected = nearlyEqual2(x, xEpsilon,
|
|
23405
|
+
const xEpsilon = new BigNumber9(x).toDecimalPlaces(toExponent(config2.relTol));
|
|
23406
|
+
const xSelected = nearlyEqual2(x, xEpsilon, config2.relTol, config2.absTol) ? xEpsilon : x;
|
|
23383
23407
|
return xSelected.toDecimalPlaces(0);
|
|
23384
23408
|
},
|
|
23385
23409
|
"BigNumber, BigNumber": function(x, n) {
|
|
23386
23410
|
if (!n.isInteger()) {
|
|
23387
23411
|
throw new TypeError(NO_INT);
|
|
23388
23412
|
}
|
|
23389
|
-
const epsilonExponent = toExponent(
|
|
23413
|
+
const epsilonExponent = toExponent(config2.relTol);
|
|
23390
23414
|
if (n >= epsilonExponent) {
|
|
23391
23415
|
return x.toDecimalPlaces(n.toNumber());
|
|
23392
23416
|
}
|
|
23393
23417
|
const xEpsilon = x.toDecimalPlaces(epsilonExponent);
|
|
23394
|
-
const xSelected = nearlyEqual2(x, xEpsilon,
|
|
23418
|
+
const xSelected = nearlyEqual2(x, xEpsilon, config2.relTol, config2.absTol) ? xEpsilon : x;
|
|
23395
23419
|
return xSelected.toDecimalPlaces(n.toNumber());
|
|
23396
23420
|
},
|
|
23397
23421
|
// bigints can't be rounded
|
|
@@ -23481,11 +23505,11 @@ var dependencies111 = ["typed", "config", "matrix", "BigNumber"];
|
|
|
23481
23505
|
var createXgcd = /* @__PURE__ */ factory(
|
|
23482
23506
|
name111,
|
|
23483
23507
|
dependencies111,
|
|
23484
|
-
({ typed: typed3, config, matrix: matrix2, BigNumber: BigNumber9 }) => {
|
|
23508
|
+
({ typed: typed3, config: config2, matrix: matrix2, BigNumber: BigNumber9 }) => {
|
|
23485
23509
|
return typed3(name111, {
|
|
23486
23510
|
"number, number": function(a, b) {
|
|
23487
23511
|
const res = xgcdNumber(a, b);
|
|
23488
|
-
return
|
|
23512
|
+
return config2.matrix === "Array" ? res : matrix2(res);
|
|
23489
23513
|
},
|
|
23490
23514
|
"BigNumber, BigNumber": _xgcdBigNumber
|
|
23491
23515
|
// TODO: implement support for Fraction
|
|
@@ -23521,7 +23545,7 @@ var createXgcd = /* @__PURE__ */ factory(
|
|
|
23521
23545
|
} else {
|
|
23522
23546
|
res = [a, !a.isZero() ? lastx : 0, lasty];
|
|
23523
23547
|
}
|
|
23524
|
-
return
|
|
23548
|
+
return config2.matrix === "Array" ? res : matrix2(res);
|
|
23525
23549
|
}
|
|
23526
23550
|
}
|
|
23527
23551
|
);
|
|
@@ -23533,7 +23557,7 @@ var nlg16 = Math.log(16);
|
|
|
23533
23557
|
var createLog = /* @__PURE__ */ factory(
|
|
23534
23558
|
name112,
|
|
23535
23559
|
dependencies112,
|
|
23536
|
-
({ typed: typed3, typeOf: typeOf3, config, divideScalar: divideScalar2, Complex: Complex12 }) => {
|
|
23560
|
+
({ typed: typed3, typeOf: typeOf3, config: config2, divideScalar: divideScalar2, Complex: Complex12 }) => {
|
|
23537
23561
|
function complexLog(c) {
|
|
23538
23562
|
return c.log();
|
|
23539
23563
|
}
|
|
@@ -23542,16 +23566,16 @@ var createLog = /* @__PURE__ */ factory(
|
|
|
23542
23566
|
}
|
|
23543
23567
|
return typed3(name112, {
|
|
23544
23568
|
number: function(x) {
|
|
23545
|
-
if (x >= 0 ||
|
|
23569
|
+
if (x >= 0 || config2.predictable) {
|
|
23546
23570
|
return logNumber(x);
|
|
23547
23571
|
} else {
|
|
23548
23572
|
return complexLogNumber(x);
|
|
23549
23573
|
}
|
|
23550
23574
|
},
|
|
23551
|
-
bigint: promoteLogarithm(nlg16, logNumber,
|
|
23575
|
+
bigint: promoteLogarithm(nlg16, logNumber, config2, complexLogNumber),
|
|
23552
23576
|
Complex: complexLog,
|
|
23553
23577
|
BigNumber: function(x) {
|
|
23554
|
-
if (!x.isNegative() ||
|
|
23578
|
+
if (!x.isNegative() || config2.predictable) {
|
|
23555
23579
|
return x.ln();
|
|
23556
23580
|
} else {
|
|
23557
23581
|
return complexLogNumber(x.toNumber());
|
|
@@ -23939,7 +23963,7 @@ var dependencies117 = ["typed", "config", "matrix"];
|
|
|
23939
23963
|
var createResize = /* @__PURE__ */ factory(
|
|
23940
23964
|
name117,
|
|
23941
23965
|
dependencies117,
|
|
23942
|
-
({ typed: typed3, config, matrix: matrix2 }) => {
|
|
23966
|
+
({ typed: typed3, config: config2, matrix: matrix2 }) => {
|
|
23943
23967
|
return typed3(name117, {
|
|
23944
23968
|
"any, Array | Matrix": function(x, size2) {
|
|
23945
23969
|
return _resize2(x, size2);
|
|
@@ -23961,7 +23985,7 @@ var createResize = /* @__PURE__ */ factory(
|
|
|
23961
23985
|
if (typeof x === "string") {
|
|
23962
23986
|
return _resizeString(x, sz, defaultValue);
|
|
23963
23987
|
}
|
|
23964
|
-
const asMatrix = Array.isArray(x) ? false :
|
|
23988
|
+
const asMatrix = Array.isArray(x) ? false : config2.matrix !== "Array";
|
|
23965
23989
|
if (sz.length === 0) {
|
|
23966
23990
|
let scalar = x;
|
|
23967
23991
|
while (Array.isArray(scalar)) {
|
|
@@ -24260,7 +24284,7 @@ var createBernoulli = /* @__PURE__ */ factory(
|
|
|
24260
24284
|
dependencies119,
|
|
24261
24285
|
({
|
|
24262
24286
|
typed: typed3,
|
|
24263
|
-
config,
|
|
24287
|
+
config: config2,
|
|
24264
24288
|
isInteger: _isInteger,
|
|
24265
24289
|
number: number2,
|
|
24266
24290
|
BigNumber: BigNumber9,
|
|
@@ -24288,9 +24312,9 @@ var createBernoulli = /* @__PURE__ */ factory(
|
|
|
24288
24312
|
(a, b) => a.div(b)
|
|
24289
24313
|
),
|
|
24290
24314
|
BigNumber: (index) => {
|
|
24291
|
-
if (
|
|
24315
|
+
if (config2.precision !== cachedPrecision) {
|
|
24292
24316
|
bigCache = [void 0];
|
|
24293
|
-
cachedPrecision =
|
|
24317
|
+
cachedPrecision = config2.precision;
|
|
24294
24318
|
}
|
|
24295
24319
|
return _bernoulli(
|
|
24296
24320
|
number2(index),
|
|
@@ -24995,7 +25019,7 @@ var dependencies128 = ["typed", "config", "add", "numeric", "parseNumberWithConf
|
|
|
24995
25019
|
var createSum = /* @__PURE__ */ factory(
|
|
24996
25020
|
name128,
|
|
24997
25021
|
dependencies128,
|
|
24998
|
-
({ typed: typed3, config, add: add2, numeric: numeric2, parseNumberWithConfig: parseNumberWithConfig2 }) => {
|
|
25022
|
+
({ typed: typed3, config: config2, add: add2, numeric: numeric2, parseNumberWithConfig: parseNumberWithConfig2 }) => {
|
|
24999
25023
|
return typed3(name128, {
|
|
25000
25024
|
// sum(string) - single string input
|
|
25001
25025
|
string: function(x) {
|
|
@@ -25040,7 +25064,7 @@ var createSum = /* @__PURE__ */ factory(
|
|
|
25040
25064
|
}
|
|
25041
25065
|
});
|
|
25042
25066
|
if (sum3 === void 0) {
|
|
25043
|
-
sum3 = numeric2(0,
|
|
25067
|
+
sum3 = numeric2(0, config2.number);
|
|
25044
25068
|
}
|
|
25045
25069
|
return sum3;
|
|
25046
25070
|
}
|
|
@@ -25289,12 +25313,12 @@ var bigTen = new Decimal(10);
|
|
|
25289
25313
|
var createFloorNumber = /* @__PURE__ */ factory(
|
|
25290
25314
|
name133,
|
|
25291
25315
|
["typed", "config", "round"],
|
|
25292
|
-
({ typed: typed3, config, round: round2 }) => {
|
|
25316
|
+
({ typed: typed3, config: config2, round: round2 }) => {
|
|
25293
25317
|
function _floorNumber(x) {
|
|
25294
25318
|
const f = Math.floor(x);
|
|
25295
25319
|
const r = round2(x);
|
|
25296
25320
|
if (f === r) return f;
|
|
25297
|
-
if (nearlyEqual(x, r,
|
|
25321
|
+
if (nearlyEqual(x, r, config2.relTol, config2.absTol) && !nearlyEqual(x, f, config2.relTol, config2.absTol)) {
|
|
25298
25322
|
return r;
|
|
25299
25323
|
}
|
|
25300
25324
|
return f;
|
|
@@ -25317,13 +25341,13 @@ var createFloorNumber = /* @__PURE__ */ factory(
|
|
|
25317
25341
|
var createFloor = /* @__PURE__ */ factory(
|
|
25318
25342
|
name133,
|
|
25319
25343
|
dependencies133,
|
|
25320
|
-
({ typed: typed3, config, round: round2, matrix: matrix2, equalScalar: equalScalar3, zeros: zeros2, DenseMatrix: DenseMatrix6 }) => {
|
|
25344
|
+
({ typed: typed3, config: config2, round: round2, matrix: matrix2, equalScalar: equalScalar3, zeros: zeros2, DenseMatrix: DenseMatrix6 }) => {
|
|
25321
25345
|
const matAlgo11xS0s = createMatAlgo11xS0s({ typed: typed3, equalScalar: equalScalar3 });
|
|
25322
25346
|
const matAlgo12xSfs = createMatAlgo12xSfs({ typed: typed3, DenseMatrix: DenseMatrix6 });
|
|
25323
25347
|
const matAlgo14xDs = createMatAlgo14xDs({ typed: typed3 });
|
|
25324
|
-
const floorNumber = createFloorNumber({ typed: typed3, config, round: round2 });
|
|
25348
|
+
const floorNumber = createFloorNumber({ typed: typed3, config: config2, round: round2 });
|
|
25325
25349
|
function _bigFloor(x) {
|
|
25326
|
-
const bne = (a, b) => nearlyEqual2(a, b,
|
|
25350
|
+
const bne = (a, b) => nearlyEqual2(a, b, config2.relTol, config2.absTol);
|
|
25327
25351
|
const f = x.floor();
|
|
25328
25352
|
const r = round2(x);
|
|
25329
25353
|
if (f.eq(r)) return f;
|
|
@@ -25530,10 +25554,10 @@ var dependencies135 = [
|
|
|
25530
25554
|
var createMod = /* @__PURE__ */ factory(
|
|
25531
25555
|
name135,
|
|
25532
25556
|
dependencies135,
|
|
25533
|
-
({ typed: typed3, config, round: round2, matrix: matrix2, equalScalar: equalScalar3, zeros: zeros2, DenseMatrix: DenseMatrix6, concat: concat3 }) => {
|
|
25557
|
+
({ typed: typed3, config: config2, round: round2, matrix: matrix2, equalScalar: equalScalar3, zeros: zeros2, DenseMatrix: DenseMatrix6, concat: concat3 }) => {
|
|
25534
25558
|
const floor2 = createFloor({
|
|
25535
25559
|
typed: typed3,
|
|
25536
|
-
config,
|
|
25560
|
+
config: config2,
|
|
25537
25561
|
round: round2,
|
|
25538
25562
|
matrix: matrix2,
|
|
25539
25563
|
equalScalar: equalScalar3,
|
|
@@ -25831,7 +25855,7 @@ var createGcd = /* @__PURE__ */ factory(
|
|
|
25831
25855
|
({
|
|
25832
25856
|
typed: typed3,
|
|
25833
25857
|
matrix: matrix2,
|
|
25834
|
-
config,
|
|
25858
|
+
config: config2,
|
|
25835
25859
|
round: round2,
|
|
25836
25860
|
equalScalar: equalScalar3,
|
|
25837
25861
|
zeros: zeros2,
|
|
@@ -25841,7 +25865,7 @@ var createGcd = /* @__PURE__ */ factory(
|
|
|
25841
25865
|
}) => {
|
|
25842
25866
|
const mod2 = createMod({
|
|
25843
25867
|
typed: typed3,
|
|
25844
|
-
config,
|
|
25868
|
+
config: config2,
|
|
25845
25869
|
round: round2,
|
|
25846
25870
|
matrix: matrix2,
|
|
25847
25871
|
equalScalar: equalScalar3,
|
|
@@ -26098,10 +26122,10 @@ var dependencies142 = ["typed", "config", "divideScalar", "log", "Complex"];
|
|
|
26098
26122
|
var createLog1p = /* @__PURE__ */ factory(
|
|
26099
26123
|
name142,
|
|
26100
26124
|
dependencies142,
|
|
26101
|
-
({ typed: typed3, config, divideScalar: divideScalar2, log: log3, Complex: Complex12 }) => {
|
|
26125
|
+
({ typed: typed3, config: config2, divideScalar: divideScalar2, log: log3, Complex: Complex12 }) => {
|
|
26102
26126
|
return typed3(name142, {
|
|
26103
26127
|
number: function(x) {
|
|
26104
|
-
if (x >= -1 ||
|
|
26128
|
+
if (x >= -1 || config2.predictable) {
|
|
26105
26129
|
return log1p2(x);
|
|
26106
26130
|
} else {
|
|
26107
26131
|
return _log1pComplex(new Complex12(x, 0));
|
|
@@ -26110,7 +26134,7 @@ var createLog1p = /* @__PURE__ */ factory(
|
|
|
26110
26134
|
Complex: _log1pComplex,
|
|
26111
26135
|
BigNumber: function(x) {
|
|
26112
26136
|
const y = x.plus(1);
|
|
26113
|
-
if (!y.isNegative() ||
|
|
26137
|
+
if (!y.isNegative() || config2.predictable) {
|
|
26114
26138
|
return y.ln();
|
|
26115
26139
|
} else {
|
|
26116
26140
|
return _log1pComplex(new Complex12(x.toNumber(), 0));
|
|
@@ -26272,7 +26296,7 @@ var createPow = /* @__PURE__ */ factory(
|
|
|
26272
26296
|
dependencies144,
|
|
26273
26297
|
({
|
|
26274
26298
|
typed: typed3,
|
|
26275
|
-
config,
|
|
26299
|
+
config: config2,
|
|
26276
26300
|
identity: identity2,
|
|
26277
26301
|
multiply: multiply2,
|
|
26278
26302
|
matrix: matrix2,
|
|
@@ -26287,7 +26311,7 @@ var createPow = /* @__PURE__ */ factory(
|
|
|
26287
26311
|
return x.pow(y);
|
|
26288
26312
|
},
|
|
26289
26313
|
"BigNumber, BigNumber": function(x, y) {
|
|
26290
|
-
if (y.isInteger() || x.gte(0) ||
|
|
26314
|
+
if (y.isInteger() || x.gte(0) || config2.predictable) {
|
|
26291
26315
|
return x.pow(y);
|
|
26292
26316
|
} else {
|
|
26293
26317
|
return new Complex12(x.toNumber(), 0).pow(y.toNumber(), 0);
|
|
@@ -26299,7 +26323,7 @@ var createPow = /* @__PURE__ */ factory(
|
|
|
26299
26323
|
if (result != null) {
|
|
26300
26324
|
return result;
|
|
26301
26325
|
}
|
|
26302
|
-
if (
|
|
26326
|
+
if (config2.predictable) {
|
|
26303
26327
|
throw new Error("Result of pow is non-rational and cannot be expressed as a fraction");
|
|
26304
26328
|
} else {
|
|
26305
26329
|
return _pow(x.valueOf(), y.valueOf());
|
|
@@ -26318,7 +26342,7 @@ var createPow = /* @__PURE__ */ factory(
|
|
|
26318
26342
|
}
|
|
26319
26343
|
});
|
|
26320
26344
|
function _pow(x, y) {
|
|
26321
|
-
if (
|
|
26345
|
+
if (config2.predictable && !isInteger(y) && x < 0) {
|
|
26322
26346
|
try {
|
|
26323
26347
|
const yFrac = fraction2(y);
|
|
26324
26348
|
const yNum = number2(yFrac);
|
|
@@ -26330,10 +26354,10 @@ var createPow = /* @__PURE__ */ factory(
|
|
|
26330
26354
|
} catch {
|
|
26331
26355
|
}
|
|
26332
26356
|
}
|
|
26333
|
-
if (
|
|
26357
|
+
if (config2.predictable && (x < -1 && y === Infinity || x > -1 && x < 0 && y === -Infinity)) {
|
|
26334
26358
|
return NaN;
|
|
26335
26359
|
}
|
|
26336
|
-
if (isInteger(y) || x >= 0 ||
|
|
26360
|
+
if (isInteger(y) || x >= 0 || config2.predictable) {
|
|
26337
26361
|
return powNumber(x, y);
|
|
26338
26362
|
} else {
|
|
26339
26363
|
if (isPowZeroAtInfinity(x, y)) {
|
|
@@ -26390,12 +26414,12 @@ var bigTen2 = new Decimal2(10);
|
|
|
26390
26414
|
var createCeilNumber = /* @__PURE__ */ factory(
|
|
26391
26415
|
name145,
|
|
26392
26416
|
["typed", "config", "round"],
|
|
26393
|
-
({ typed: typed3, config, round: round2 }) => {
|
|
26417
|
+
({ typed: typed3, config: config2, round: round2 }) => {
|
|
26394
26418
|
function _ceilNumber(x) {
|
|
26395
26419
|
const c = Math.ceil(x);
|
|
26396
26420
|
const r = round2(x);
|
|
26397
26421
|
if (c === r) return c;
|
|
26398
|
-
if (nearlyEqual(x, r,
|
|
26422
|
+
if (nearlyEqual(x, r, config2.relTol, config2.absTol) && !nearlyEqual(x, c, config2.relTol, config2.absTol)) {
|
|
26399
26423
|
return r;
|
|
26400
26424
|
}
|
|
26401
26425
|
return c;
|
|
@@ -26418,13 +26442,13 @@ var createCeilNumber = /* @__PURE__ */ factory(
|
|
|
26418
26442
|
var createCeil = /* @__PURE__ */ factory(
|
|
26419
26443
|
name145,
|
|
26420
26444
|
dependencies145,
|
|
26421
|
-
({ typed: typed3, config, round: round2, matrix: matrix2, equalScalar: equalScalar3, zeros: zeros2, DenseMatrix: DenseMatrix6 }) => {
|
|
26445
|
+
({ typed: typed3, config: config2, round: round2, matrix: matrix2, equalScalar: equalScalar3, zeros: zeros2, DenseMatrix: DenseMatrix6 }) => {
|
|
26422
26446
|
const matAlgo11xS0s = createMatAlgo11xS0s({ typed: typed3, equalScalar: equalScalar3 });
|
|
26423
26447
|
const matAlgo12xSfs = createMatAlgo12xSfs({ typed: typed3, DenseMatrix: DenseMatrix6 });
|
|
26424
26448
|
const matAlgo14xDs = createMatAlgo14xDs({ typed: typed3 });
|
|
26425
|
-
const ceilNumber = createCeilNumber({ typed: typed3, config, round: round2 });
|
|
26449
|
+
const ceilNumber = createCeilNumber({ typed: typed3, config: config2, round: round2 });
|
|
26426
26450
|
function _bigCeil(x) {
|
|
26427
|
-
const bne = (a, b) => nearlyEqual2(a, b,
|
|
26451
|
+
const bne = (a, b) => nearlyEqual2(a, b, config2.relTol, config2.absTol);
|
|
26428
26452
|
const c = x.ceil();
|
|
26429
26453
|
const r = round2(x);
|
|
26430
26454
|
if (c.eq(r)) return c;
|
|
@@ -27030,7 +27054,7 @@ var createCompare = /* @__PURE__ */ factory(
|
|
|
27030
27054
|
dependencies155,
|
|
27031
27055
|
({
|
|
27032
27056
|
typed: typed3,
|
|
27033
|
-
config,
|
|
27057
|
+
config: config2,
|
|
27034
27058
|
equalScalar: equalScalar3,
|
|
27035
27059
|
matrix: matrix2,
|
|
27036
27060
|
BigNumber: BigNumber9,
|
|
@@ -27049,13 +27073,13 @@ var createCompare = /* @__PURE__ */ factory(
|
|
|
27049
27073
|
const compareUnits2 = createCompareUnits({ typed: typed3 });
|
|
27050
27074
|
return typed3(
|
|
27051
27075
|
name155,
|
|
27052
|
-
createCompareNumber({ typed: typed3, config }),
|
|
27076
|
+
createCompareNumber({ typed: typed3, config: config2 }),
|
|
27053
27077
|
{
|
|
27054
27078
|
"boolean, boolean": function(x, y) {
|
|
27055
27079
|
return x === y ? 0 : x > y ? 1 : -1;
|
|
27056
27080
|
},
|
|
27057
27081
|
"BigNumber, BigNumber": function(x, y) {
|
|
27058
|
-
return nearlyEqual2(x, y,
|
|
27082
|
+
return nearlyEqual2(x, y, config2.relTol, config2.absTol) ? new BigNumber9(0) : new BigNumber9(x.cmp(y));
|
|
27059
27083
|
},
|
|
27060
27084
|
"bigint, bigint": function(x, y) {
|
|
27061
27085
|
return x === y ? 0n : x > y ? 1n : -1n;
|
|
@@ -27079,10 +27103,10 @@ var createCompare = /* @__PURE__ */ factory(
|
|
|
27079
27103
|
var createCompareNumber = /* @__PURE__ */ factory(
|
|
27080
27104
|
name155,
|
|
27081
27105
|
["typed", "config"],
|
|
27082
|
-
({ typed: typed3, config }) => {
|
|
27106
|
+
({ typed: typed3, config: config2 }) => {
|
|
27083
27107
|
return typed3(name155, {
|
|
27084
27108
|
"number, number": function(x, y) {
|
|
27085
|
-
return nearlyEqual(x, y,
|
|
27109
|
+
return nearlyEqual(x, y, config2.relTol, config2.absTol) ? 0 : x > y ? 1 : -1;
|
|
27086
27110
|
}
|
|
27087
27111
|
});
|
|
27088
27112
|
}
|
|
@@ -27165,7 +27189,7 @@ var dependencies158 = [
|
|
|
27165
27189
|
var createLarger = /* @__PURE__ */ factory(
|
|
27166
27190
|
name158,
|
|
27167
27191
|
dependencies158,
|
|
27168
|
-
({ typed: typed3, config, bignumber: bignumber2, matrix: matrix2, DenseMatrix: DenseMatrix6, concat: concat3, SparseMatrix }) => {
|
|
27192
|
+
({ typed: typed3, config: config2, bignumber: bignumber2, matrix: matrix2, DenseMatrix: DenseMatrix6, concat: concat3, SparseMatrix }) => {
|
|
27169
27193
|
const matAlgo03xDSf = createMatAlgo03xDSf({ typed: typed3 });
|
|
27170
27194
|
const matAlgo07xSSf = createMatAlgo07xSSf({ typed: typed3, SparseMatrix });
|
|
27171
27195
|
const matAlgo12xSfs = createMatAlgo12xSfs({ typed: typed3, DenseMatrix: DenseMatrix6 });
|
|
@@ -27176,11 +27200,11 @@ var createLarger = /* @__PURE__ */ factory(
|
|
|
27176
27200
|
});
|
|
27177
27201
|
const compareUnits2 = createCompareUnits({ typed: typed3 });
|
|
27178
27202
|
function bignumLarger(x, y) {
|
|
27179
|
-
return x.gt(y) && !nearlyEqual2(x, y,
|
|
27203
|
+
return x.gt(y) && !nearlyEqual2(x, y, config2.relTol, config2.absTol);
|
|
27180
27204
|
}
|
|
27181
27205
|
return typed3(
|
|
27182
27206
|
name158,
|
|
27183
|
-
createLargerNumber({ typed: typed3, config }),
|
|
27207
|
+
createLargerNumber({ typed: typed3, config: config2 }),
|
|
27184
27208
|
{
|
|
27185
27209
|
"boolean, boolean": (x, y) => x > y,
|
|
27186
27210
|
"BigNumber, BigNumber": bignumLarger,
|
|
@@ -27208,10 +27232,10 @@ var createLarger = /* @__PURE__ */ factory(
|
|
|
27208
27232
|
var createLargerNumber = /* @__PURE__ */ factory(
|
|
27209
27233
|
name158,
|
|
27210
27234
|
["typed", "config"],
|
|
27211
|
-
({ typed: typed3, config }) => {
|
|
27235
|
+
({ typed: typed3, config: config2 }) => {
|
|
27212
27236
|
return typed3(name158, {
|
|
27213
27237
|
"number, number": function(x, y) {
|
|
27214
|
-
return x > y && !nearlyEqual(x, y,
|
|
27238
|
+
return x > y && !nearlyEqual(x, y, config2.relTol, config2.absTol);
|
|
27215
27239
|
}
|
|
27216
27240
|
});
|
|
27217
27241
|
}
|
|
@@ -27223,7 +27247,7 @@ var dependencies159 = ["typed", "config", "matrix", "DenseMatrix", "concat", "Sp
|
|
|
27223
27247
|
var createLargerEq = /* @__PURE__ */ factory(
|
|
27224
27248
|
name159,
|
|
27225
27249
|
dependencies159,
|
|
27226
|
-
({ typed: typed3, config, matrix: matrix2, DenseMatrix: DenseMatrix6, concat: concat3, SparseMatrix }) => {
|
|
27250
|
+
({ typed: typed3, config: config2, matrix: matrix2, DenseMatrix: DenseMatrix6, concat: concat3, SparseMatrix }) => {
|
|
27227
27251
|
const matAlgo03xDSf = createMatAlgo03xDSf({ typed: typed3 });
|
|
27228
27252
|
const matAlgo07xSSf = createMatAlgo07xSSf({ typed: typed3, SparseMatrix });
|
|
27229
27253
|
const matAlgo12xSfs = createMatAlgo12xSfs({ typed: typed3, DenseMatrix: DenseMatrix6 });
|
|
@@ -27235,11 +27259,11 @@ var createLargerEq = /* @__PURE__ */ factory(
|
|
|
27235
27259
|
const compareUnits2 = createCompareUnits({ typed: typed3 });
|
|
27236
27260
|
return typed3(
|
|
27237
27261
|
name159,
|
|
27238
|
-
createLargerEqNumber({ typed: typed3, config }),
|
|
27262
|
+
createLargerEqNumber({ typed: typed3, config: config2 }),
|
|
27239
27263
|
{
|
|
27240
27264
|
"boolean, boolean": (x, y) => x >= y,
|
|
27241
27265
|
"BigNumber, BigNumber": function(x, y) {
|
|
27242
|
-
return x.gte(y) || nearlyEqual2(x, y,
|
|
27266
|
+
return x.gte(y) || nearlyEqual2(x, y, config2.relTol, config2.absTol);
|
|
27243
27267
|
},
|
|
27244
27268
|
"bigint, bigint": function(x, y) {
|
|
27245
27269
|
return x >= y;
|
|
@@ -27261,10 +27285,10 @@ var createLargerEq = /* @__PURE__ */ factory(
|
|
|
27261
27285
|
var createLargerEqNumber = /* @__PURE__ */ factory(
|
|
27262
27286
|
name159,
|
|
27263
27287
|
["typed", "config"],
|
|
27264
|
-
({ typed: typed3, config }) => {
|
|
27288
|
+
({ typed: typed3, config: config2 }) => {
|
|
27265
27289
|
return typed3(name159, {
|
|
27266
27290
|
"number, number": function(x, y) {
|
|
27267
|
-
return x >= y || nearlyEqual(x, y,
|
|
27291
|
+
return x >= y || nearlyEqual(x, y, config2.relTol, config2.absTol);
|
|
27268
27292
|
}
|
|
27269
27293
|
});
|
|
27270
27294
|
}
|
|
@@ -27286,7 +27310,7 @@ var createSmaller = /* @__PURE__ */ factory(
|
|
|
27286
27310
|
dependencies160,
|
|
27287
27311
|
({
|
|
27288
27312
|
typed: typed3,
|
|
27289
|
-
config,
|
|
27313
|
+
config: config2,
|
|
27290
27314
|
bignumber: bignumber2,
|
|
27291
27315
|
matrix: matrix2,
|
|
27292
27316
|
DenseMatrix: DenseMatrix6,
|
|
@@ -27303,11 +27327,11 @@ var createSmaller = /* @__PURE__ */ factory(
|
|
|
27303
27327
|
});
|
|
27304
27328
|
const compareUnits2 = createCompareUnits({ typed: typed3 });
|
|
27305
27329
|
function bignumSmaller(x, y) {
|
|
27306
|
-
return x.lt(y) && !nearlyEqual2(x, y,
|
|
27330
|
+
return x.lt(y) && !nearlyEqual2(x, y, config2.relTol, config2.absTol);
|
|
27307
27331
|
}
|
|
27308
27332
|
return typed3(
|
|
27309
27333
|
name160,
|
|
27310
|
-
createSmallerNumber({ typed: typed3, config }),
|
|
27334
|
+
createSmallerNumber({ typed: typed3, config: config2 }),
|
|
27311
27335
|
{
|
|
27312
27336
|
"boolean, boolean": (x, y) => x < y,
|
|
27313
27337
|
"BigNumber, BigNumber": bignumSmaller,
|
|
@@ -27335,10 +27359,10 @@ var createSmaller = /* @__PURE__ */ factory(
|
|
|
27335
27359
|
var createSmallerNumber = /* @__PURE__ */ factory(
|
|
27336
27360
|
name160,
|
|
27337
27361
|
["typed", "config"],
|
|
27338
|
-
({ typed: typed3, config }) => {
|
|
27362
|
+
({ typed: typed3, config: config2 }) => {
|
|
27339
27363
|
return typed3(name160, {
|
|
27340
27364
|
"number, number": function(x, y) {
|
|
27341
|
-
return x < y && !nearlyEqual(x, y,
|
|
27365
|
+
return x < y && !nearlyEqual(x, y, config2.relTol, config2.absTol);
|
|
27342
27366
|
}
|
|
27343
27367
|
});
|
|
27344
27368
|
}
|
|
@@ -27350,7 +27374,7 @@ var dependencies161 = ["typed", "config", "matrix", "DenseMatrix", "concat", "Sp
|
|
|
27350
27374
|
var createSmallerEq = /* @__PURE__ */ factory(
|
|
27351
27375
|
name161,
|
|
27352
27376
|
dependencies161,
|
|
27353
|
-
({ typed: typed3, config, matrix: matrix2, DenseMatrix: DenseMatrix6, concat: concat3, SparseMatrix }) => {
|
|
27377
|
+
({ typed: typed3, config: config2, matrix: matrix2, DenseMatrix: DenseMatrix6, concat: concat3, SparseMatrix }) => {
|
|
27354
27378
|
const matAlgo03xDSf = createMatAlgo03xDSf({ typed: typed3 });
|
|
27355
27379
|
const matAlgo07xSSf = createMatAlgo07xSSf({ typed: typed3, SparseMatrix });
|
|
27356
27380
|
const matAlgo12xSfs = createMatAlgo12xSfs({ typed: typed3, DenseMatrix: DenseMatrix6 });
|
|
@@ -27362,11 +27386,11 @@ var createSmallerEq = /* @__PURE__ */ factory(
|
|
|
27362
27386
|
const compareUnits2 = createCompareUnits({ typed: typed3 });
|
|
27363
27387
|
return typed3(
|
|
27364
27388
|
name161,
|
|
27365
|
-
createSmallerEqNumber({ typed: typed3, config }),
|
|
27389
|
+
createSmallerEqNumber({ typed: typed3, config: config2 }),
|
|
27366
27390
|
{
|
|
27367
27391
|
"boolean, boolean": (x, y) => x <= y,
|
|
27368
27392
|
"BigNumber, BigNumber": function(x, y) {
|
|
27369
|
-
return x.lte(y) || nearlyEqual2(x, y,
|
|
27393
|
+
return x.lte(y) || nearlyEqual2(x, y, config2.relTol, config2.absTol);
|
|
27370
27394
|
},
|
|
27371
27395
|
"bigint, bigint": (x, y) => x <= y,
|
|
27372
27396
|
"Fraction, Fraction": (x, y) => x.compare(y) !== 1,
|
|
@@ -27386,10 +27410,10 @@ var createSmallerEq = /* @__PURE__ */ factory(
|
|
|
27386
27410
|
var createSmallerEqNumber = /* @__PURE__ */ factory(
|
|
27387
27411
|
name161,
|
|
27388
27412
|
["typed", "config"],
|
|
27389
|
-
({ typed: typed3, config }) => {
|
|
27413
|
+
({ typed: typed3, config: config2 }) => {
|
|
27390
27414
|
return typed3(name161, {
|
|
27391
27415
|
"number, number": function(x, y) {
|
|
27392
|
-
return x <= y || nearlyEqual(x, y,
|
|
27416
|
+
return x <= y || nearlyEqual(x, y, config2.relTol, config2.absTol);
|
|
27393
27417
|
}
|
|
27394
27418
|
});
|
|
27395
27419
|
}
|
|
@@ -28322,7 +28346,7 @@ var createRange = /* @__PURE__ */ factory(
|
|
|
28322
28346
|
dependencies173,
|
|
28323
28347
|
({
|
|
28324
28348
|
typed: typed3,
|
|
28325
|
-
config,
|
|
28349
|
+
config: config2,
|
|
28326
28350
|
matrix: matrix2,
|
|
28327
28351
|
bignumber: bignumber2,
|
|
28328
28352
|
smaller: smaller2,
|
|
@@ -28416,7 +28440,7 @@ var createRange = /* @__PURE__ */ factory(
|
|
|
28416
28440
|
}
|
|
28417
28441
|
});
|
|
28418
28442
|
function _out(arr7) {
|
|
28419
|
-
if (
|
|
28443
|
+
if (config2.matrix === "Matrix") {
|
|
28420
28444
|
return matrix2 ? matrix2(arr7) : noMatrix();
|
|
28421
28445
|
}
|
|
28422
28446
|
return arr7;
|
|
@@ -28426,7 +28450,7 @@ var createRange = /* @__PURE__ */ factory(
|
|
|
28426
28450
|
if (!r) {
|
|
28427
28451
|
throw new SyntaxError('String "' + str + '" is no valid range');
|
|
28428
28452
|
}
|
|
28429
|
-
if (
|
|
28453
|
+
if (config2.number === "BigNumber") {
|
|
28430
28454
|
if (bignumber2 === void 0) {
|
|
28431
28455
|
noBignumber();
|
|
28432
28456
|
}
|
|
@@ -28485,7 +28509,7 @@ var createGamma = /* @__PURE__ */ factory(
|
|
|
28485
28509
|
dependencies174,
|
|
28486
28510
|
({
|
|
28487
28511
|
typed: typed3,
|
|
28488
|
-
config,
|
|
28512
|
+
config: config2,
|
|
28489
28513
|
multiplyScalar: _multiplyScalar,
|
|
28490
28514
|
pow: _pow,
|
|
28491
28515
|
BigNumber: BigNumber9,
|
|
@@ -28531,7 +28555,7 @@ var createGamma = /* @__PURE__ */ factory(
|
|
|
28531
28555
|
if (nNum < 8) {
|
|
28532
28556
|
return new BigNumber9([1, 1, 2, 6, 24, 120, 720, 5040][nNum]);
|
|
28533
28557
|
}
|
|
28534
|
-
const precision =
|
|
28558
|
+
const precision = config2.precision + (Math.log(nNum) | 0);
|
|
28535
28559
|
const Big = BigNumber9.clone({ precision });
|
|
28536
28560
|
if (nNum % 2 === 1) {
|
|
28537
28561
|
return n.times(bigFactorial(n.minus(1)));
|
|
@@ -28739,7 +28763,7 @@ var dependencies177 = ["typed", "config", "numeric", "larger", "isNaN"];
|
|
|
28739
28763
|
var createMax = /* @__PURE__ */ factory(
|
|
28740
28764
|
name177,
|
|
28741
28765
|
dependencies177,
|
|
28742
|
-
({ typed: typed3, config, numeric: numeric2, larger: larger2, isNaN: mathIsNaN }) => {
|
|
28766
|
+
({ typed: typed3, config: config2, numeric: numeric2, larger: larger2, isNaN: mathIsNaN }) => {
|
|
28743
28767
|
return typed3(name177, {
|
|
28744
28768
|
// max([a, b, c, d, ...])
|
|
28745
28769
|
"Array | Matrix": _max,
|
|
@@ -28796,7 +28820,7 @@ var createMax = /* @__PURE__ */ factory(
|
|
|
28796
28820
|
throw new Error("Cannot calculate max of an empty array");
|
|
28797
28821
|
}
|
|
28798
28822
|
if (typeof res === "string") {
|
|
28799
|
-
res = numeric2(res, safeNumberType(res,
|
|
28823
|
+
res = numeric2(res, safeNumberType(res, config2));
|
|
28800
28824
|
}
|
|
28801
28825
|
return res;
|
|
28802
28826
|
}
|
|
@@ -28818,7 +28842,7 @@ var dependencies178 = ["typed", "config", "numeric", "smaller", "isNaN"];
|
|
|
28818
28842
|
var createMin = /* @__PURE__ */ factory(
|
|
28819
28843
|
name178,
|
|
28820
28844
|
dependencies178,
|
|
28821
|
-
({ typed: typed3, config, numeric: numeric2, smaller: smaller2, isNaN: mathIsNaN }) => {
|
|
28845
|
+
({ typed: typed3, config: config2, numeric: numeric2, smaller: smaller2, isNaN: mathIsNaN }) => {
|
|
28822
28846
|
return typed3(name178, {
|
|
28823
28847
|
// min([a, b, c, d, ...])
|
|
28824
28848
|
"Array | Matrix": _min,
|
|
@@ -28875,7 +28899,7 @@ var createMin = /* @__PURE__ */ factory(
|
|
|
28875
28899
|
throw new Error("Cannot calculate min of an empty array");
|
|
28876
28900
|
}
|
|
28877
28901
|
if (typeof min2 === "string") {
|
|
28878
|
-
min2 = numeric2(min2, safeNumberType(min2,
|
|
28902
|
+
min2 = numeric2(min2, safeNumberType(min2, config2));
|
|
28879
28903
|
}
|
|
28880
28904
|
return min2;
|
|
28881
28905
|
}
|
|
@@ -30156,7 +30180,7 @@ var createSimplifyConstant = /* @__PURE__ */ factory(
|
|
|
30156
30180
|
dependencies193,
|
|
30157
30181
|
({
|
|
30158
30182
|
typed: typed3,
|
|
30159
|
-
config,
|
|
30183
|
+
config: config2,
|
|
30160
30184
|
mathWithTransform,
|
|
30161
30185
|
matrix: matrix2,
|
|
30162
30186
|
parse: parse3,
|
|
@@ -30256,7 +30280,7 @@ var createSimplifyConstant = /* @__PURE__ */ factory(
|
|
|
30256
30280
|
}
|
|
30257
30281
|
const _toNumber = typed3({
|
|
30258
30282
|
"string, Object": function(s, options) {
|
|
30259
|
-
const numericType = safeNumberType(s,
|
|
30283
|
+
const numericType = safeNumberType(s, config2);
|
|
30260
30284
|
if (numericType === "BigNumber") {
|
|
30261
30285
|
if (bignumber2 === void 0) {
|
|
30262
30286
|
noBignumber();
|
|
@@ -30305,7 +30329,7 @@ var createSimplifyConstant = /* @__PURE__ */ factory(
|
|
|
30305
30329
|
return new OperatorNode("-", "unaryMinus", [n]);
|
|
30306
30330
|
}
|
|
30307
30331
|
function _fractionToNode(f) {
|
|
30308
|
-
const fromBigInt = (value) =>
|
|
30332
|
+
const fromBigInt = (value) => config2.number === "BigNumber" && bignumber2 ? bignumber2(value) : Number(value);
|
|
30309
30333
|
const signBigInt = BigInt(f.s);
|
|
30310
30334
|
const numeratorValue = signBigInt * f.n;
|
|
30311
30335
|
const numeratorNode = numeratorValue < 0n ? new OperatorNode("-", "unaryMinus", [new ConstantNode(fromBigInt(-numeratorValue))]) : new ConstantNode(fromBigInt(numeratorValue));
|
|
@@ -33140,7 +33164,7 @@ var createIntersect = /* @__PURE__ */ factory(
|
|
|
33140
33164
|
dependencies217,
|
|
33141
33165
|
({
|
|
33142
33166
|
typed: typed3,
|
|
33143
|
-
config,
|
|
33167
|
+
config: config2,
|
|
33144
33168
|
abs: abs2,
|
|
33145
33169
|
add: add2,
|
|
33146
33170
|
addScalar: addScalar2,
|
|
@@ -33268,7 +33292,7 @@ var createIntersect = /* @__PURE__ */ factory(
|
|
|
33268
33292
|
multiplyScalar2(d2[0], d1[1])
|
|
33269
33293
|
);
|
|
33270
33294
|
if (isZero2(det2)) return null;
|
|
33271
|
-
if (smaller2(abs2(det2),
|
|
33295
|
+
if (smaller2(abs2(det2), config2.relTol)) {
|
|
33272
33296
|
return null;
|
|
33273
33297
|
}
|
|
33274
33298
|
const d20o11 = multiplyScalar2(d2[0], o1[1]);
|
|
@@ -35252,7 +35276,7 @@ var createZeta = /* @__PURE__ */ factory(
|
|
|
35252
35276
|
dependencies235,
|
|
35253
35277
|
({
|
|
35254
35278
|
typed: typed3,
|
|
35255
|
-
config,
|
|
35279
|
+
config: config2,
|
|
35256
35280
|
multiply: multiply2,
|
|
35257
35281
|
pow: pow2,
|
|
35258
35282
|
divide: divide2,
|
|
@@ -35282,7 +35306,7 @@ var createZeta = /* @__PURE__ */ factory(
|
|
|
35282
35306
|
s,
|
|
35283
35307
|
(value) => new BigNumber9(value),
|
|
35284
35308
|
() => {
|
|
35285
|
-
return Math.abs(Math.log10(
|
|
35309
|
+
return Math.abs(Math.log10(config2.relTol));
|
|
35286
35310
|
}
|
|
35287
35311
|
),
|
|
35288
35312
|
Complex: zetaComplex
|
|
@@ -35303,7 +35327,7 @@ var createZeta = /* @__PURE__ */ factory(
|
|
|
35303
35327
|
if (s.re === 0 && s.im === 0) {
|
|
35304
35328
|
return new Complex12(-0.5);
|
|
35305
35329
|
}
|
|
35306
|
-
if (s.re === 1) {
|
|
35330
|
+
if (s.re === 1 && s.im === 0) {
|
|
35307
35331
|
return new Complex12(NaN, NaN);
|
|
35308
35332
|
}
|
|
35309
35333
|
if (s.re === Infinity && s.im === 0) {
|
|
@@ -35883,7 +35907,7 @@ function flattenToFloat649(matrix2, rows, cols) {
|
|
|
35883
35907
|
return result;
|
|
35884
35908
|
}
|
|
35885
35909
|
function createRealSymmetric({
|
|
35886
|
-
config,
|
|
35910
|
+
config: config2,
|
|
35887
35911
|
addScalar: addScalar2,
|
|
35888
35912
|
subtract: subtract2,
|
|
35889
35913
|
abs: abs2,
|
|
@@ -35908,7 +35932,7 @@ function createRealSymmetric({
|
|
|
35908
35932
|
if (typeof a === "number" && typeof b === "number") return a <= b;
|
|
35909
35933
|
return a.lte(b);
|
|
35910
35934
|
}
|
|
35911
|
-
function main(arr7, _N, prec =
|
|
35935
|
+
function main(arr7, _N, prec = config2.relTol, type, computeVectors) {
|
|
35912
35936
|
if (type === "number") {
|
|
35913
35937
|
return diag2(arr7, prec, computeVectors);
|
|
35914
35938
|
}
|
|
@@ -36029,7 +36053,7 @@ function createRealSymmetric({
|
|
|
36029
36053
|
}
|
|
36030
36054
|
function getTheta(aii, ajj, aij) {
|
|
36031
36055
|
const denom = ajj - aii;
|
|
36032
|
-
if (Math.abs(denom) <=
|
|
36056
|
+
if (Math.abs(denom) <= config2.relTol) {
|
|
36033
36057
|
return Math.PI / 4;
|
|
36034
36058
|
} else {
|
|
36035
36059
|
return 0.5 * Math.atan(2 * aij / (ajj - aii));
|
|
@@ -36037,7 +36061,7 @@ function createRealSymmetric({
|
|
|
36037
36061
|
}
|
|
36038
36062
|
function getThetaBig(aii, ajj, aij) {
|
|
36039
36063
|
const denom = subtract2(ajj, aii);
|
|
36040
|
-
if (bigLte(abs2(denom), bignumber2(
|
|
36064
|
+
if (bigLte(abs2(denom), bignumber2(config2.relTol))) {
|
|
36041
36065
|
return bignumber2(-1).acos().div(4);
|
|
36042
36066
|
} else {
|
|
36043
36067
|
return multiplyScalar2(
|
|
@@ -36248,7 +36272,7 @@ var createEigs = /* @__PURE__ */ factory(
|
|
|
36248
36272
|
name237,
|
|
36249
36273
|
dependencies237,
|
|
36250
36274
|
({
|
|
36251
|
-
config,
|
|
36275
|
+
config: config2,
|
|
36252
36276
|
typed: typed3,
|
|
36253
36277
|
matrix: matrix2,
|
|
36254
36278
|
addScalar: addScalar2,
|
|
@@ -36283,7 +36307,7 @@ var createEigs = /* @__PURE__ */ factory(
|
|
|
36283
36307
|
dot: dot3
|
|
36284
36308
|
}) => {
|
|
36285
36309
|
const doRealSymmetric = createRealSymmetric({
|
|
36286
|
-
config,
|
|
36310
|
+
config: config2,
|
|
36287
36311
|
addScalar: addScalar2,
|
|
36288
36312
|
subtract: subtract2,
|
|
36289
36313
|
abs: abs2,
|
|
@@ -36351,7 +36375,7 @@ var createEigs = /* @__PURE__ */ factory(
|
|
|
36351
36375
|
});
|
|
36352
36376
|
function doEigs(mat, opts = {}) {
|
|
36353
36377
|
const computeVectors = "eigenvectors" in opts ? opts.eigenvectors : true;
|
|
36354
|
-
const prec = opts.precision ??
|
|
36378
|
+
const prec = opts.precision ?? config2.relTol;
|
|
36355
36379
|
const result = computeValuesAndVectors(mat, prec, computeVectors);
|
|
36356
36380
|
if (opts.matricize) {
|
|
36357
36381
|
result.values = matrix2(result.values);
|
|
@@ -37810,7 +37834,7 @@ var createDerivative = /* @__PURE__ */ factory(
|
|
|
37810
37834
|
dependencies244,
|
|
37811
37835
|
({
|
|
37812
37836
|
typed: typed3,
|
|
37813
|
-
config,
|
|
37837
|
+
config: config2,
|
|
37814
37838
|
parse: parse3,
|
|
37815
37839
|
simplify: simplify2,
|
|
37816
37840
|
equal: equal2,
|
|
@@ -38339,7 +38363,7 @@ var createDerivative = /* @__PURE__ */ factory(
|
|
|
38339
38363
|
}
|
|
38340
38364
|
});
|
|
38341
38365
|
function createConstantNode2(value, valueType) {
|
|
38342
|
-
return new ConstantNode(numeric2(value, valueType || safeNumberType(String(value),
|
|
38366
|
+
return new ConstantNode(numeric2(value, valueType || safeNumberType(String(value), config2)));
|
|
38343
38367
|
}
|
|
38344
38368
|
return derivative2;
|
|
38345
38369
|
}
|
|
@@ -39104,7 +39128,7 @@ var createRotationMatrix = /* @__PURE__ */ factory(
|
|
|
39104
39128
|
dependencies249,
|
|
39105
39129
|
({
|
|
39106
39130
|
typed: typed3,
|
|
39107
|
-
config,
|
|
39131
|
+
config: config2,
|
|
39108
39132
|
multiplyScalar: multiplyScalar2,
|
|
39109
39133
|
addScalar: addScalar2,
|
|
39110
39134
|
unaryMinus: unaryMinus2,
|
|
@@ -39118,13 +39142,13 @@ var createRotationMatrix = /* @__PURE__ */ factory(
|
|
|
39118
39142
|
}) => {
|
|
39119
39143
|
return typed3(name249, {
|
|
39120
39144
|
"": function() {
|
|
39121
|
-
return
|
|
39145
|
+
return config2.matrix === "Matrix" ? matrix2([]) : [];
|
|
39122
39146
|
},
|
|
39123
39147
|
string: function(format6) {
|
|
39124
39148
|
return matrix2(format6);
|
|
39125
39149
|
},
|
|
39126
39150
|
"number | BigNumber | Complex | Unit": function(theta) {
|
|
39127
|
-
return _rotationMatrix2x2(theta,
|
|
39151
|
+
return _rotationMatrix2x2(theta, config2.matrix === "Matrix" ? "dense" : void 0);
|
|
39128
39152
|
},
|
|
39129
39153
|
"number | BigNumber | Complex | Unit, string": function(theta, format6) {
|
|
39130
39154
|
return _rotationMatrix2x2(theta, format6);
|
|
@@ -39136,7 +39160,7 @@ var createRotationMatrix = /* @__PURE__ */ factory(
|
|
|
39136
39160
|
},
|
|
39137
39161
|
"number | BigNumber | Complex | Unit, Matrix": function(theta, v) {
|
|
39138
39162
|
_validateVector(v);
|
|
39139
|
-
const storageType = v.storage() || (
|
|
39163
|
+
const storageType = v.storage() || (config2.matrix === "Matrix" ? "dense" : void 0);
|
|
39140
39164
|
return _rotationMatrix3x3(theta, v, storageType);
|
|
39141
39165
|
},
|
|
39142
39166
|
"number | BigNumber | Complex | Unit, Array, string": function(theta, v, format6) {
|
|
@@ -39667,8 +39691,8 @@ function unitFactory(name254, valueStr, unitStr) {
|
|
|
39667
39691
|
return factory(
|
|
39668
39692
|
name254,
|
|
39669
39693
|
dependencies254,
|
|
39670
|
-
({ config, Unit: Unit2, BigNumber: BigNumber9 }) => {
|
|
39671
|
-
const value =
|
|
39694
|
+
({ config: config2, Unit: Unit2, BigNumber: BigNumber9 }) => {
|
|
39695
|
+
const value = config2.number === "BigNumber" ? new BigNumber9(valueStr) : parseFloat(valueStr);
|
|
39672
39696
|
const unit2 = new Unit2(value, unitStr);
|
|
39673
39697
|
unit2.fixPrefix = true;
|
|
39674
39698
|
return unit2;
|
|
@@ -39680,8 +39704,8 @@ function numberFactory(name254, value) {
|
|
|
39680
39704
|
return factory(
|
|
39681
39705
|
name254,
|
|
39682
39706
|
dependencies254,
|
|
39683
|
-
({ config, BigNumber: BigNumber9 }) => {
|
|
39684
|
-
return
|
|
39707
|
+
({ config: config2, BigNumber: BigNumber9 }) => {
|
|
39708
|
+
return config2.number === "BigNumber" ? new BigNumber9(value) : value;
|
|
39685
39709
|
}
|
|
39686
39710
|
);
|
|
39687
39711
|
}
|
|
@@ -42307,6 +42331,13 @@ function casFactor(input) {
|
|
|
42307
42331
|
}).then((r) => r.result);
|
|
42308
42332
|
}
|
|
42309
42333
|
|
|
42334
|
+
// src/config-api.ts
|
|
42335
|
+
function config(options) {
|
|
42336
|
+
const shared = factoryScope.config;
|
|
42337
|
+
if (options) Object.assign(shared, options);
|
|
42338
|
+
return { ...shared };
|
|
42339
|
+
}
|
|
42340
|
+
|
|
42310
42341
|
// src/help.ts
|
|
42311
42342
|
import { createHelpClass, embeddedDocs } from "@danielsimonjr/mathts-expression";
|
|
42312
42343
|
var savedConfig = {};
|
|
@@ -43772,6 +43803,7 @@ export {
|
|
|
43772
43803
|
concat2 as concat,
|
|
43773
43804
|
cond,
|
|
43774
43805
|
conductanceQuantum,
|
|
43806
|
+
config,
|
|
43775
43807
|
conj,
|
|
43776
43808
|
connectedComponents,
|
|
43777
43809
|
convexHull,
|