@danielsimonjr/mathts-functions 0.23.0 → 0.24.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/addScalar.d.ts.map +1 -1
- package/dist/arithmetic/subtractScalar.d.ts.map +1 -1
- package/dist/factories/scope.d.ts.map +1 -1
- package/dist/index.js +66 -89
- package/dist/probability/gamma.d.ts +3 -10
- package/dist/probability/gamma.d.ts.map +1 -1
- package/dist/relational/compare.d.ts +2 -1
- package/dist/relational/compare.d.ts.map +1 -1
- package/dist/relational/smaller.d.ts +1 -1
- package/dist/relational/smaller.d.ts.map +1 -1
- package/dist/statistics/corr.d.ts +0 -2
- package/dist/statistics/corr.d.ts.map +1 -1
- package/dist/statistics/quantileSeq.d.ts +1 -1
- package/dist/statistics/quantileSeq.d.ts.map +1 -1
- package/dist/utils/bignumber/nearlyEqual.d.ts.map +1 -1
- package/dist/utils/isPrime.d.ts.map +1 -1
- package/package.json +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addScalar.d.ts","sourceRoot":"","sources":["../../src/arithmetic/addScalar.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"addScalar.d.ts","sourceRoot":"","sources":["../../src/arithmetic/addScalar.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAe/D,UAAU,qBAAqB;IAC7B,KAAK,EAAE,aAAa,CAAC;CACtB;AAKD,eAAO,MAAM,eAAe,+EAwD3B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subtractScalar.d.ts","sourceRoot":"","sources":["../../src/arithmetic/subtractScalar.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"subtractScalar.d.ts","sourceRoot":"","sources":["../../src/arithmetic/subtractScalar.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAe/D,UAAU,0BAA0B;IAClC,KAAK,EAAE,aAAa,CAAC;CACtB;AAKD,eAAO,MAAM,oBAAoB,oFAuDhC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scope.d.ts","sourceRoot":"","sources":["../../src/factories/scope.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"scope.d.ts","sourceRoot":"","sources":["../../src/factories/scope.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAwIH;;;GAGG;AACH,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAoChD,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -17418,7 +17418,12 @@ var factoryScope = {
|
|
|
17418
17418
|
matrix: createMatrixBridge(),
|
|
17419
17419
|
// Helper factory functions (lowercase) — factories call `complex(re, im)` etc.
|
|
17420
17420
|
complex: (re3, im3) => new Complex7(re3, im3),
|
|
17421
|
-
bignumber: (x) =>
|
|
17421
|
+
bignumber: (x) => {
|
|
17422
|
+
if (x instanceof BigNumber8) return x;
|
|
17423
|
+
if (typeof x === "string") return BigNumber8.parse(x);
|
|
17424
|
+
if (typeof x === "number") return BigNumber8.fromNumber(x);
|
|
17425
|
+
return BigNumber8.fromNumber(Number(x.valueOf()));
|
|
17426
|
+
},
|
|
17422
17427
|
fraction: (n, d) => new Fraction3(n, d ?? 1),
|
|
17423
17428
|
number: Number,
|
|
17424
17429
|
// Matrix helper factories
|
|
@@ -18486,7 +18491,7 @@ var createAddScalar = /* @__PURE__ */ factory(
|
|
|
18486
18491
|
return x.add(y);
|
|
18487
18492
|
},
|
|
18488
18493
|
"BigNumber, BigNumber": function(x, y) {
|
|
18489
|
-
return x.
|
|
18494
|
+
return x.add(y);
|
|
18490
18495
|
},
|
|
18491
18496
|
"bigint, bigint": function(x, y) {
|
|
18492
18497
|
return x + y;
|
|
@@ -18810,7 +18815,7 @@ var createSubtractScalar = /* @__PURE__ */ factory(
|
|
|
18810
18815
|
return x.sub(y);
|
|
18811
18816
|
},
|
|
18812
18817
|
"BigNumber, BigNumber": function(x, y) {
|
|
18813
|
-
return x.
|
|
18818
|
+
return x.sub(y);
|
|
18814
18819
|
},
|
|
18815
18820
|
"bigint, bigint": function(x, y) {
|
|
18816
18821
|
return x - y;
|
|
@@ -20036,12 +20041,17 @@ function nearlyEqual2(a, b, relTol = 1e-9, absTol = 0) {
|
|
|
20036
20041
|
return false;
|
|
20037
20042
|
}
|
|
20038
20043
|
if (!x.isFinite() || !y.isFinite()) {
|
|
20039
|
-
return x.
|
|
20044
|
+
return x.equals(y);
|
|
20040
20045
|
}
|
|
20041
|
-
if (x.
|
|
20046
|
+
if (x.equals(y)) {
|
|
20042
20047
|
return true;
|
|
20043
20048
|
}
|
|
20044
|
-
|
|
20049
|
+
const ax = x.abs();
|
|
20050
|
+
const ay = y.abs();
|
|
20051
|
+
const maxAbs = ax.greaterThanOrEqual(ay) ? ax : ay;
|
|
20052
|
+
const relBound = maxAbs.mul(relTol);
|
|
20053
|
+
const diff2 = x.sub(y).abs();
|
|
20054
|
+
return diff2.lessThanOrEqual(relBound) || diff2.lessThanOrEqual(absTol);
|
|
20045
20055
|
}
|
|
20046
20056
|
|
|
20047
20057
|
// src/utils/complex.ts
|
|
@@ -20084,7 +20094,7 @@ var createEqualScalar = /* @__PURE__ */ factory(
|
|
|
20084
20094
|
return nearlyEqual(x, y, config2.relTol, config2.absTol);
|
|
20085
20095
|
},
|
|
20086
20096
|
"BigNumber, BigNumber": function(x, y) {
|
|
20087
|
-
return x.
|
|
20097
|
+
return x.equals(y) || nearlyEqual2(x, y, config2.relTol, config2.absTol);
|
|
20088
20098
|
},
|
|
20089
20099
|
"bigint, bigint": function(x, y) {
|
|
20090
20100
|
return x === y;
|
|
@@ -20976,9 +20986,9 @@ var createIsPrime = /* @__PURE__ */ factory(
|
|
|
20976
20986
|
return true;
|
|
20977
20987
|
},
|
|
20978
20988
|
BigNumber: function(n) {
|
|
20979
|
-
if (n.
|
|
20980
|
-
if (n.mod(2).
|
|
20981
|
-
if (n.
|
|
20989
|
+
if (n.lessThanOrEqual(3)) return n.gt(1);
|
|
20990
|
+
if (n.mod(2).equals(0) || n.mod(3).equals(0)) return false;
|
|
20991
|
+
if (n.lessThan(Math.pow(2, 32))) {
|
|
20982
20992
|
const x = n.toNumber();
|
|
20983
20993
|
for (let i = 5; i * i <= x; i += 6) {
|
|
20984
20994
|
if (x % i === 0 || x % (i + 2) === 0) {
|
|
@@ -20989,8 +20999,8 @@ var createIsPrime = /* @__PURE__ */ factory(
|
|
|
20989
20999
|
}
|
|
20990
21000
|
function modPow(base, exponent, modulus) {
|
|
20991
21001
|
let accumulator = 1;
|
|
20992
|
-
while (!exponent.
|
|
20993
|
-
if (exponent.mod(2).
|
|
21002
|
+
while (!exponent.equals(0)) {
|
|
21003
|
+
if (exponent.mod(2).equals(0)) {
|
|
20994
21004
|
exponent = exponent.div(2);
|
|
20995
21005
|
base = base.mul(base).mod(modulus);
|
|
20996
21006
|
} else {
|
|
@@ -21000,18 +21010,14 @@ var createIsPrime = /* @__PURE__ */ factory(
|
|
|
21000
21010
|
}
|
|
21001
21011
|
return accumulator;
|
|
21002
21012
|
}
|
|
21003
|
-
const Decimal3 = n.constructor.clone({
|
|
21004
|
-
precision: n.toFixed(0).length * 2
|
|
21005
|
-
});
|
|
21006
|
-
n = new Decimal3(n);
|
|
21007
21013
|
let r = 0;
|
|
21008
21014
|
let d = n.sub(1);
|
|
21009
|
-
while (d.mod(2).
|
|
21015
|
+
while (d.mod(2).equals(0)) {
|
|
21010
21016
|
d = d.div(2);
|
|
21011
21017
|
r += 1;
|
|
21012
21018
|
}
|
|
21013
21019
|
let bases = null;
|
|
21014
|
-
if (n.
|
|
21020
|
+
if (n.toBigInt() < 3317044064679887385961981n) {
|
|
21015
21021
|
bases = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41].filter((x) => x < n.toNumber());
|
|
21016
21022
|
} else {
|
|
21017
21023
|
const max2 = Math.min(
|
|
@@ -21026,8 +21032,8 @@ var createIsPrime = /* @__PURE__ */ factory(
|
|
|
21026
21032
|
for (let i = 0; i < bases.length; i += 1) {
|
|
21027
21033
|
const a = bases[i];
|
|
21028
21034
|
const adn = modPow(n.sub(n).add(a), d, n);
|
|
21029
|
-
if (!adn.
|
|
21030
|
-
for (let i2 = 0, x = adn; !x.
|
|
21035
|
+
if (!adn.equals(1)) {
|
|
21036
|
+
for (let i2 = 0, x = adn; !x.equals(n.sub(1)); i2 += 1, x = x.mul(x).mod(n)) {
|
|
21031
21037
|
if (i2 === r - 1) {
|
|
21032
21038
|
return false;
|
|
21033
21039
|
}
|
|
@@ -28401,7 +28407,8 @@ var createCompare = /* @__PURE__ */ factory(
|
|
|
28401
28407
|
return x === y ? 0 : x > y ? 1 : -1;
|
|
28402
28408
|
},
|
|
28403
28409
|
"BigNumber, BigNumber": function(x, y) {
|
|
28404
|
-
|
|
28410
|
+
const cmp = nearlyEqual2(x, y, config2.relTol, config2.absTol) ? 0 : x.compareTo(y);
|
|
28411
|
+
return BigNumber9.fromNumber(cmp);
|
|
28405
28412
|
},
|
|
28406
28413
|
"bigint, bigint": function(x, y) {
|
|
28407
28414
|
return x === y ? 0n : x > y ? 1n : -1n;
|
|
@@ -28585,7 +28592,7 @@ var createLargerEq = /* @__PURE__ */ factory(
|
|
|
28585
28592
|
{
|
|
28586
28593
|
"boolean, boolean": (x, y) => x >= y,
|
|
28587
28594
|
"BigNumber, BigNumber": function(x, y) {
|
|
28588
|
-
return x.
|
|
28595
|
+
return x.greaterThanOrEqual(y) || nearlyEqual2(x, y, config2.relTol, config2.absTol);
|
|
28589
28596
|
},
|
|
28590
28597
|
"bigint, bigint": function(x, y) {
|
|
28591
28598
|
return x >= y;
|
|
@@ -28649,7 +28656,7 @@ var createSmaller = /* @__PURE__ */ factory(
|
|
|
28649
28656
|
});
|
|
28650
28657
|
const compareUnits2 = createCompareUnits({ typed: typed3 });
|
|
28651
28658
|
function bignumSmaller(x, y) {
|
|
28652
|
-
return x.
|
|
28659
|
+
return x.lessThan(y) && !nearlyEqual2(x, y, config2.relTol, config2.absTol);
|
|
28653
28660
|
}
|
|
28654
28661
|
return typed3(
|
|
28655
28662
|
name160,
|
|
@@ -28712,7 +28719,7 @@ var createSmallerEq = /* @__PURE__ */ factory(
|
|
|
28712
28719
|
{
|
|
28713
28720
|
"boolean, boolean": (x, y) => x <= y,
|
|
28714
28721
|
"BigNumber, BigNumber": function(x, y) {
|
|
28715
|
-
return x.
|
|
28722
|
+
return x.lessThanOrEqual(y) || nearlyEqual2(x, y, config2.relTol, config2.absTol);
|
|
28716
28723
|
},
|
|
28717
28724
|
"bigint, bigint": (x, y) => x <= y,
|
|
28718
28725
|
"Fraction, Fraction": (x, y) => x.compare(y) !== 1,
|
|
@@ -29825,13 +29832,12 @@ var createRange = /* @__PURE__ */ factory(
|
|
|
29825
29832
|
|
|
29826
29833
|
// src/probability/gamma.ts
|
|
29827
29834
|
var name174 = "gamma";
|
|
29828
|
-
var dependencies174 = ["typed", "
|
|
29835
|
+
var dependencies174 = ["typed", "multiplyScalar", "pow", "BigNumber", "Complex"];
|
|
29829
29836
|
var createGamma = /* @__PURE__ */ factory(
|
|
29830
29837
|
name174,
|
|
29831
29838
|
dependencies174,
|
|
29832
29839
|
({
|
|
29833
29840
|
typed: typed3,
|
|
29834
|
-
config: config2,
|
|
29835
29841
|
multiplyScalar: _multiplyScalar,
|
|
29836
29842
|
pow: _pow,
|
|
29837
29843
|
BigNumber: BigNumber9,
|
|
@@ -29864,10 +29870,10 @@ var createGamma = /* @__PURE__ */ factory(
|
|
|
29864
29870
|
Complex: gammaComplex,
|
|
29865
29871
|
BigNumber: function(n) {
|
|
29866
29872
|
if (n.isInteger()) {
|
|
29867
|
-
return n.isNegative() || n.isZero() ?
|
|
29873
|
+
return n.isNegative() || n.isZero() ? BigNumber9.fromNumber(Infinity) : bigFactorial(n.sub(1));
|
|
29868
29874
|
}
|
|
29869
29875
|
if (!n.isFinite()) {
|
|
29870
|
-
return
|
|
29876
|
+
return BigNumber9.fromNumber(n.isNegative() ? NaN : Infinity);
|
|
29871
29877
|
}
|
|
29872
29878
|
throw new Error("Integer BigNumber expected");
|
|
29873
29879
|
}
|
|
@@ -29875,22 +29881,13 @@ var createGamma = /* @__PURE__ */ factory(
|
|
|
29875
29881
|
function bigFactorial(n) {
|
|
29876
29882
|
const nNum = n.toNumber();
|
|
29877
29883
|
if (nNum < 8) {
|
|
29878
|
-
return
|
|
29879
|
-
}
|
|
29880
|
-
const precision = config2.precision + (Math.log(nNum) | 0);
|
|
29881
|
-
const Big = BigNumber9.clone({ precision });
|
|
29882
|
-
if (nNum % 2 === 1) {
|
|
29883
|
-
return n.times(bigFactorial(n.minus(1)));
|
|
29884
|
+
return BigNumber9.fromNumber([1, 1, 2, 6, 24, 120, 720, 5040][nNum]);
|
|
29884
29885
|
}
|
|
29885
|
-
let
|
|
29886
|
-
let
|
|
29887
|
-
|
|
29888
|
-
while (p > 2) {
|
|
29889
|
-
p -= 2;
|
|
29890
|
-
sum3 += p;
|
|
29891
|
-
prod2 = prod2.times(new BigNumber9(sum3));
|
|
29886
|
+
let prod2 = BigNumber9.fromNumber(1);
|
|
29887
|
+
for (let k = 2; k <= nNum; k++) {
|
|
29888
|
+
prod2 = prod2.mul(k);
|
|
29892
29889
|
}
|
|
29893
|
-
return
|
|
29890
|
+
return prod2;
|
|
29894
29891
|
}
|
|
29895
29892
|
}
|
|
29896
29893
|
);
|
|
@@ -30735,7 +30732,7 @@ var createFactorial = /* @__PURE__ */ factory(
|
|
|
30735
30732
|
if (n.isNegative()) {
|
|
30736
30733
|
throw new Error("Value must be non-negative");
|
|
30737
30734
|
}
|
|
30738
|
-
return gamma2(n.
|
|
30735
|
+
return gamma2(n.add(1));
|
|
30739
30736
|
},
|
|
30740
30737
|
"Array | Matrix": typed3.referToSelf(
|
|
30741
30738
|
(self) => (n) => deepMap2(n, self)
|
|
@@ -35074,7 +35071,7 @@ var createQuantileSeq = /* @__PURE__ */ factory(
|
|
|
35074
35071
|
}
|
|
35075
35072
|
const index = isNumber(prob) ? prob * (len - 1) : prob.times(len - 1);
|
|
35076
35073
|
const integerPart = isNumber(prob) ? Math.floor(index) : index.floor().toNumber();
|
|
35077
|
-
const fracPart = isNumber(prob) ? index % 1 : index.
|
|
35074
|
+
const fracPart = isNumber(prob) ? index % 1 : index.sub(integerPart);
|
|
35078
35075
|
if (isInteger3(index)) {
|
|
35079
35076
|
return sorted ? flat[index] : partitionSelect2(flat, isNumber(prob) ? index : index.valueOf());
|
|
35080
35077
|
}
|
|
@@ -38033,7 +38030,7 @@ var createLusolve = /* @__PURE__ */ factory(
|
|
|
38033
38030
|
);
|
|
38034
38031
|
|
|
38035
38032
|
// src/statistics/corr.ts
|
|
38036
|
-
|
|
38033
|
+
import { pairwiseSum as pairwiseSum3, pairwiseDot as pairwiseDot3 } from "@danielsimonjr/mathts-core";
|
|
38037
38034
|
function isPlainNumberArray(arr7) {
|
|
38038
38035
|
for (let i = 0; i < arr7.length; i++) {
|
|
38039
38036
|
if (typeof arr7[i] !== "number") {
|
|
@@ -38043,22 +38040,11 @@ function isPlainNumberArray(arr7) {
|
|
|
38043
38040
|
return true;
|
|
38044
38041
|
}
|
|
38045
38042
|
var name239 = "corr";
|
|
38046
|
-
var dependencies239 = [
|
|
38047
|
-
"typed",
|
|
38048
|
-
"matrix",
|
|
38049
|
-
"mean",
|
|
38050
|
-
"sqrt",
|
|
38051
|
-
"sum",
|
|
38052
|
-
"add",
|
|
38053
|
-
"subtract",
|
|
38054
|
-
"multiply",
|
|
38055
|
-
"pow",
|
|
38056
|
-
"divide"
|
|
38057
|
-
];
|
|
38043
|
+
var dependencies239 = ["typed", "matrix", "sqrt", "sum", "subtract", "multiply", "divide"];
|
|
38058
38044
|
var createCorr = /* @__PURE__ */ factory(
|
|
38059
38045
|
name239,
|
|
38060
38046
|
dependencies239,
|
|
38061
|
-
({ typed: typed3, matrix: matrix2, sqrt: sqrt2, sum: sum3,
|
|
38047
|
+
({ typed: typed3, matrix: matrix2, sqrt: sqrt2, sum: sum3, subtract: subtract2, multiply: multiply2, divide: divide2 }) => {
|
|
38062
38048
|
return typed3(name239, {
|
|
38063
38049
|
"Array, Array": function(A, B) {
|
|
38064
38050
|
return _corr(A, B);
|
|
@@ -38094,37 +38080,28 @@ var createCorr = /* @__PURE__ */ factory(
|
|
|
38094
38080
|
}
|
|
38095
38081
|
function correlation(A, B) {
|
|
38096
38082
|
const n = A.length;
|
|
38097
|
-
|
|
38098
|
-
|
|
38099
|
-
|
|
38100
|
-
|
|
38101
|
-
|
|
38102
|
-
|
|
38103
|
-
|
|
38104
|
-
|
|
38105
|
-
|
|
38106
|
-
|
|
38107
|
-
|
|
38108
|
-
|
|
38109
|
-
|
|
38110
|
-
|
|
38111
|
-
|
|
38112
|
-
const
|
|
38113
|
-
const
|
|
38114
|
-
const
|
|
38115
|
-
|
|
38116
|
-
|
|
38117
|
-
);
|
|
38118
|
-
|
|
38119
|
-
const sumYSquare = sum3(B.map((y) => pow2(y, 2)));
|
|
38120
|
-
const numerator = subtract2(multiply2(n, sumXY), multiply2(sumX, sumY));
|
|
38121
|
-
const denominator = sqrt2(
|
|
38122
|
-
multiply2(
|
|
38123
|
-
subtract2(multiply2(n, sumXSquare), pow2(sumX, 2)),
|
|
38124
|
-
subtract2(multiply2(n, sumYSquare), pow2(sumY, 2))
|
|
38125
|
-
)
|
|
38126
|
-
);
|
|
38127
|
-
return divide2(numerator, denominator);
|
|
38083
|
+
if (isPlainNumberArray(A) && isPlainNumberArray(B)) {
|
|
38084
|
+
const meanX2 = pairwiseSum3(A) / n;
|
|
38085
|
+
const meanY2 = pairwiseSum3(B) / n;
|
|
38086
|
+
const dX2 = new Float64Array(n);
|
|
38087
|
+
const dY2 = new Float64Array(n);
|
|
38088
|
+
for (let i = 0; i < n; i++) {
|
|
38089
|
+
dX2[i] = A[i] - meanX2;
|
|
38090
|
+
dY2[i] = B[i] - meanY2;
|
|
38091
|
+
}
|
|
38092
|
+
const sxy2 = pairwiseDot3(dX2, dY2);
|
|
38093
|
+
const sxx2 = pairwiseDot3(dX2, dX2);
|
|
38094
|
+
const syy2 = pairwiseDot3(dY2, dY2);
|
|
38095
|
+
return sxy2 / Math.sqrt(sxx2 * syy2);
|
|
38096
|
+
}
|
|
38097
|
+
const meanX = divide2(sum3(A), n);
|
|
38098
|
+
const meanY = divide2(sum3(B), n);
|
|
38099
|
+
const dX = A.map((x) => subtract2(x, meanX));
|
|
38100
|
+
const dY = B.map((y) => subtract2(y, meanY));
|
|
38101
|
+
const sxy = sum3(dX.map((dx, i) => multiply2(dx, dY[i])));
|
|
38102
|
+
const sxx = sum3(dX.map((dx) => multiply2(dx, dx)));
|
|
38103
|
+
const syy = sum3(dY.map((dy) => multiply2(dy, dy)));
|
|
38104
|
+
return divide2(sxy, sqrt2(multiply2(sxx, syy)));
|
|
38128
38105
|
}
|
|
38129
38106
|
}
|
|
38130
38107
|
);
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { TypedFunction } from '../core/function/typed.js';
|
|
2
|
-
import type { ConfigOptions } from '../core/config.js';
|
|
3
2
|
interface ComplexType {
|
|
4
3
|
re: number;
|
|
5
4
|
im: number;
|
|
@@ -20,21 +19,15 @@ interface BigNumberType {
|
|
|
20
19
|
isNegative(): boolean;
|
|
21
20
|
isZero(): boolean;
|
|
22
21
|
isFinite(): boolean;
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
sub(n: number | BigNumberType): BigNumberType;
|
|
23
|
+
mul(n: number | BigNumberType): BigNumberType;
|
|
25
24
|
toNumber(): number;
|
|
26
|
-
toPrecision(n: number): string;
|
|
27
25
|
}
|
|
28
26
|
interface BigNumberConstructor {
|
|
29
|
-
|
|
30
|
-
precision: number;
|
|
31
|
-
clone(config: {
|
|
32
|
-
precision: number;
|
|
33
|
-
}): BigNumberConstructor;
|
|
27
|
+
fromNumber(n: number): BigNumberType;
|
|
34
28
|
}
|
|
35
29
|
interface GammaDependencies {
|
|
36
30
|
typed: TypedFunction;
|
|
37
|
-
config: ConfigOptions;
|
|
38
31
|
multiplyScalar: TypedFunction;
|
|
39
32
|
pow: TypedFunction;
|
|
40
33
|
BigNumber: BigNumberConstructor;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gamma.d.ts","sourceRoot":"","sources":["../../src/probability/gamma.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"gamma.d.ts","sourceRoot":"","sources":["../../src/probability/gamma.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAG/D,UAAU,WAAW;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,CAAC,CAAC,EAAE,MAAM,GAAG,WAAW,GAAG,WAAW,CAAC;IAC1C,GAAG,CAAC,CAAC,EAAE,MAAM,GAAG,WAAW,CAAC;IAC5B,GAAG,CAAC,CAAC,EAAE,WAAW,GAAG,WAAW,CAAC;IACjC,GAAG,CAAC,CAAC,EAAE,MAAM,GAAG,WAAW,GAAG,WAAW,CAAC;IAC1C,GAAG,IAAI,WAAW,CAAC;IACnB,GAAG,IAAI,WAAW,CAAC;IACnB,GAAG,IAAI,WAAW,CAAC;IACnB,GAAG,CAAC,CAAC,EAAE,WAAW,GAAG,WAAW,CAAC;CAClC;AAED,UAAU,kBAAkB;IAC1B,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM,GAAG,WAAW,CAAC;CAC5C;AAED,UAAU,aAAa;IACrB,SAAS,IAAI,OAAO,CAAC;IACrB,UAAU,IAAI,OAAO,CAAC;IACtB,MAAM,IAAI,OAAO,CAAC;IAClB,QAAQ,IAAI,OAAO,CAAC;IACpB,GAAG,CAAC,CAAC,EAAE,MAAM,GAAG,aAAa,GAAG,aAAa,CAAC;IAC9C,GAAG,CAAC,CAAC,EAAE,MAAM,GAAG,aAAa,GAAG,aAAa,CAAC;IAC9C,QAAQ,IAAI,MAAM,CAAC;CACpB;AAED,UAAU,oBAAoB;IAC5B,UAAU,CAAC,CAAC,EAAE,MAAM,GAAG,aAAa,CAAC;CACtC;AAED,UAAU,iBAAiB;IACzB,KAAK,EAAE,aAAa,CAAC;IACrB,cAAc,EAAE,aAAa,CAAC;IAC9B,GAAG,EAAE,aAAa,CAAC;IACnB,SAAS,EAAE,oBAAoB,CAAC;IAChC,OAAO,EAAE,kBAAkB,CAAC;CAC7B;AAKD,eAAO,MAAM,WAAW,2EAsHvB,CAAC"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { TypedFunction } from '../core/function/typed.js';
|
|
2
2
|
import type { ConfigOptions } from '../core/config.js';
|
|
3
3
|
interface BigNumberType {
|
|
4
|
-
|
|
4
|
+
compareTo(n: BigNumberType): number;
|
|
5
5
|
}
|
|
6
6
|
interface BigNumberConstructor {
|
|
7
7
|
new (value: number | string | BigNumberType): BigNumberType;
|
|
8
|
+
fromNumber(n: number): BigNumberType;
|
|
8
9
|
}
|
|
9
10
|
interface FractionType {
|
|
10
11
|
compare(n: FractionType): number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compare.d.ts","sourceRoot":"","sources":["../../src/relational/compare.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAIvD,UAAU,aAAa;IACrB,
|
|
1
|
+
{"version":3,"file":"compare.d.ts","sourceRoot":"","sources":["../../src/relational/compare.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAIvD,UAAU,aAAa;IACrB,SAAS,CAAC,CAAC,EAAE,aAAa,GAAG,MAAM,CAAC;CACrC;AAED,UAAU,oBAAoB;IAC5B,KAAK,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,aAAa,GAAG,aAAa,CAAC;IAC5D,UAAU,CAAC,CAAC,EAAE,MAAM,GAAG,aAAa,CAAC;CACtC;AAED,UAAU,YAAY;IACpB,OAAO,CAAC,CAAC,EAAE,YAAY,GAAG,MAAM,CAAC;CAClC;AAED,UAAU,mBAAmB;IAC3B,KAAK,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,YAAY,GAAG,YAAY,CAAC;CAC3D;AAED,UAAU,aAAa;IACrB,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;CAC/B;AAED,UAAU,sBAAsB;IAC9B,KAAK,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;CACnC;AAED,UAAU,mBAAmB;IAC3B,KAAK,EAAE,aAAa,CAAC;IACrB,MAAM,EAAE,aAAa,CAAC;IACtB,MAAM,EAAE,aAAa,CAAC;IACtB,WAAW,EAAE,aAAa,CAAC;IAC3B,SAAS,EAAE,oBAAoB,CAAC;IAChC,QAAQ,EAAE,mBAAmB,CAAC;IAC9B,WAAW,EAAE,sBAAsB,CAAC;IACpC,MAAM,EAAE,aAAa,CAAC;CACvB;AAED,UAAU,yBAAyB;IACjC,KAAK,EAAE,aAAa,CAAC;IACrB,MAAM,EAAE,aAAa,CAAC;CACvB;AAcD,eAAO,MAAM,aAAa,6EAiGzB,CAAC;AAEF,eAAO,MAAM,mBAAmB,mFAU/B,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { TypedFunction } from '../core/function/typed.js';
|
|
2
2
|
import type { ConfigOptions } from '../core/config.js';
|
|
3
3
|
interface BigNumberType {
|
|
4
|
-
|
|
4
|
+
lessThan(n: BigNumberType): boolean;
|
|
5
5
|
}
|
|
6
6
|
interface BigNumberFactory {
|
|
7
7
|
(value: unknown): BigNumberType;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"smaller.d.ts","sourceRoot":"","sources":["../../src/relational/smaller.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAIvD,UAAU,aAAa;IACrB,
|
|
1
|
+
{"version":3,"file":"smaller.d.ts","sourceRoot":"","sources":["../../src/relational/smaller.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAIvD,UAAU,aAAa;IACrB,QAAQ,CAAC,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC;CACrC;AAMD,UAAU,gBAAgB;IACxB,CAAC,KAAK,EAAE,OAAO,GAAG,aAAa,CAAC;CACjC;AAED,UAAU,aAAa;IACrB,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;CAC/B;AAED,UAAU,sBAAsB;IAC9B,KAAK,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;CACnC;AAED,UAAU,uBAAuB;IAC/B,KAAK,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;CACnC;AAED,UAAU,mBAAmB;IAC3B,KAAK,EAAE,aAAa,CAAC;IACrB,MAAM,EAAE,aAAa,CAAC;IACtB,SAAS,EAAE,gBAAgB,CAAC;IAC5B,MAAM,EAAE,aAAa,CAAC;IACtB,WAAW,EAAE,sBAAsB,CAAC;IACpC,MAAM,EAAE,aAAa,CAAC;IACtB,YAAY,EAAE,uBAAuB,CAAC;CACvC;AAED,UAAU,yBAAyB;IACjC,KAAK,EAAE,aAAa,CAAC;IACrB,MAAM,EAAE,aAAa,CAAC;CACvB;AAaD,eAAO,MAAM,aAAa,6EAyFzB,CAAC;AAEF,eAAO,MAAM,mBAAmB,mFAU/B,CAAC"}
|
|
@@ -7,10 +7,8 @@ interface CorrDependencies {
|
|
|
7
7
|
matrix: (arr: unknown[]) => MatrixType;
|
|
8
8
|
sqrt: TypedFunction;
|
|
9
9
|
sum: TypedFunction;
|
|
10
|
-
add: TypedFunction;
|
|
11
10
|
subtract: TypedFunction;
|
|
12
11
|
multiply: TypedFunction;
|
|
13
|
-
pow: TypedFunction;
|
|
14
12
|
divide: TypedFunction;
|
|
15
13
|
}
|
|
16
14
|
export declare const createCorr: import("../utils/factory.js").FactoryFunction<CorrDependencies, unknown>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"corr.d.ts","sourceRoot":"","sources":["../../src/statistics/corr.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAG/D,UAAU,UAAU;IAClB,OAAO,IAAI,OAAO,EAAE,CAAC;CACtB;
|
|
1
|
+
{"version":3,"file":"corr.d.ts","sourceRoot":"","sources":["../../src/statistics/corr.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAG/D,UAAU,UAAU;IAClB,OAAO,IAAI,OAAO,EAAE,CAAC;CACtB;AAiBD,UAAU,gBAAgB;IACxB,KAAK,EAAE,aAAa,CAAC;IACrB,MAAM,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,KAAK,UAAU,CAAC;IACvC,IAAI,EAAE,aAAa,CAAC;IACpB,GAAG,EAAE,aAAa,CAAC;IACnB,QAAQ,EAAE,aAAa,CAAC;IACxB,QAAQ,EAAE,aAAa,CAAC;IACxB,MAAM,EAAE,aAAa,CAAC;CACvB;AAED,eAAO,MAAM,UAAU,0EAoGtB,CAAC"}
|
|
@@ -3,7 +3,7 @@ interface BigNumberType {
|
|
|
3
3
|
times(n: number): BigNumberType;
|
|
4
4
|
floor(): BigNumberType;
|
|
5
5
|
toNumber(): number;
|
|
6
|
-
|
|
6
|
+
sub(n: number | BigNumberType): BigNumberType;
|
|
7
7
|
valueOf(): number;
|
|
8
8
|
}
|
|
9
9
|
interface QuantileSeqDependencies {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"quantileSeq.d.ts","sourceRoot":"","sources":["../../src/statistics/quantileSeq.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAO/D,UAAU,aAAa;IACrB,KAAK,CAAC,CAAC,EAAE,MAAM,GAAG,aAAa,CAAC;IAChC,KAAK,IAAI,aAAa,CAAC;IACvB,QAAQ,IAAI,MAAM,CAAC;IACnB,
|
|
1
|
+
{"version":3,"file":"quantileSeq.d.ts","sourceRoot":"","sources":["../../src/statistics/quantileSeq.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAO/D,UAAU,aAAa;IACrB,KAAK,CAAC,CAAC,EAAE,MAAM,GAAG,aAAa,CAAC;IAChC,KAAK,IAAI,aAAa,CAAC;IACvB,QAAQ,IAAI,MAAM,CAAC;IACnB,GAAG,CAAC,CAAC,EAAE,MAAM,GAAG,aAAa,GAAG,aAAa,CAAC;IAC9C,OAAO,IAAI,MAAM,CAAC;CACnB;AAED,UAAU,uBAAuB;IAC/B,KAAK,EAAE,aAAa,CAAC;IACrB,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,aAAa,CAAC;IAC9C,GAAG,EAAE,aAAa,CAAC;IACnB,QAAQ,EAAE,aAAa,CAAC;IACxB,MAAM,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,KAAK,MAAM,GAAG,aAAa,CAAC;IAC3D,QAAQ,EAAE,aAAa,CAAC;IACxB,eAAe,EAAE,aAAa,CAAC;IAC/B,OAAO,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,KAAK,MAAM,CAAC;IAC5C,SAAS,EAAE,aAAa,CAAC;IACzB,OAAO,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC;IAC7C,SAAS,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC;IAC/C,MAAM,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC;IAC5C,SAAS,EAAE,aAAa,CAAC;CAC1B;AAmBD,eAAO,MAAM,iBAAiB,iFAkO7B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nearlyEqual.d.ts","sourceRoot":"","sources":["../../../src/utils/bignumber/nearlyEqual.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"nearlyEqual.d.ts","sourceRoot":"","sources":["../../../src/utils/bignumber/nearlyEqual.ts"],"names":[],"mappings":"AAqCA,wBAAgB,WAAW,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,SAAO,EAAE,MAAM,SAAI,GAAG,OAAO,CAiCtF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isPrime.d.ts","sourceRoot":"","sources":["../../src/utils/isPrime.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"isPrime.d.ts","sourceRoot":"","sources":["../../src/utils/isPrime.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAsB/D,UAAU,mBAAmB;IAC3B,KAAK,EAAE,aAAa,CAAC;CACtB;AAKD,eAAO,MAAM,aAAa,6EA+IzB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@danielsimonjr/mathts-functions",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.24.0",
|
|
4
4
|
"description": "Mathematical functions for MathTS - arithmetic, algebra, trigonometry, statistics, and more",
|
|
5
5
|
"author": "Daniel Simon Jr.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -34,11 +34,11 @@
|
|
|
34
34
|
"build:prod": "tsup src/index.ts --format esm --clean --minify --treeshake"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@danielsimonjr/mathts-core": "^0.
|
|
38
|
-
"@danielsimonjr/mathts-expression": "^0.6.
|
|
37
|
+
"@danielsimonjr/mathts-core": "^0.9.0",
|
|
38
|
+
"@danielsimonjr/mathts-expression": "^0.6.3",
|
|
39
39
|
"@danielsimonjr/mathts-gpu": "^0.2.0",
|
|
40
|
-
"@danielsimonjr/mathts-matrix": "^0.4.
|
|
41
|
-
"@danielsimonjr/mathts-parallel": "^0.5.
|
|
40
|
+
"@danielsimonjr/mathts-matrix": "^0.4.4",
|
|
41
|
+
"@danielsimonjr/mathts-parallel": "^0.5.1",
|
|
42
42
|
"bignumber.js": "^9.1.2",
|
|
43
43
|
"complex.js": "^2.2.5",
|
|
44
44
|
"decimal.js": "^10.4.3",
|