@danielsimonjr/mathts-functions 0.2.1 → 0.2.3
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/index.js +140 -184
- package/package.json +71 -71
package/dist/index.js
CHANGED
|
@@ -13667,7 +13667,7 @@ var singularValues = mathTyped12("singularValues", {
|
|
|
13667
13667
|
});
|
|
13668
13668
|
var matrixExpm = mathTyped12("matrixExpm", {
|
|
13669
13669
|
DenseMatrix: (A) => matrixExpmPrimitive(A),
|
|
13670
|
-
"DenseMatrix, Object": (A,
|
|
13670
|
+
"DenseMatrix, Object": (A, _opts) => matrixExpmPrimitive(A),
|
|
13671
13671
|
Array: (A) => {
|
|
13672
13672
|
const D = DenseMatrix.fromArray(A);
|
|
13673
13673
|
return matrixExpmPrimitive(D).toArray();
|
|
@@ -13913,6 +13913,9 @@ var cbrt2 = Math.cbrt || function cbrt3(x) {
|
|
|
13913
13913
|
var expm12 = Math.expm1 || function expm13(x) {
|
|
13914
13914
|
return x >= 2e-4 || x <= -2e-4 ? Math.exp(x) - 1 : x + x * x / 2 + x * x * x / 6;
|
|
13915
13915
|
};
|
|
13916
|
+
function isPowZeroAtInfinity(x, y) {
|
|
13917
|
+
return x * x < 1 && y === Infinity || x * x > 1 && y === -Infinity;
|
|
13918
|
+
}
|
|
13916
13919
|
function formatNumberToBase(n, base, size2) {
|
|
13917
13920
|
const prefixes = { 2: "0b", 8: "0o", 16: "0x" };
|
|
13918
13921
|
const prefix = prefixes[base];
|
|
@@ -16228,6 +16231,22 @@ function pickShallow(object, properties2) {
|
|
|
16228
16231
|
return copy;
|
|
16229
16232
|
}
|
|
16230
16233
|
|
|
16234
|
+
// src/error/MathjsError.ts
|
|
16235
|
+
var MathjsError = class _MathjsError extends Error {
|
|
16236
|
+
isMathjsError = true;
|
|
16237
|
+
/**
|
|
16238
|
+
* Create a MathjsError
|
|
16239
|
+
* @param message Error message
|
|
16240
|
+
*/
|
|
16241
|
+
constructor(message) {
|
|
16242
|
+
super(message);
|
|
16243
|
+
this.name = "MathjsError";
|
|
16244
|
+
if (Error.captureStackTrace) {
|
|
16245
|
+
Error.captureStackTrace(this, _MathjsError);
|
|
16246
|
+
}
|
|
16247
|
+
}
|
|
16248
|
+
};
|
|
16249
|
+
|
|
16231
16250
|
// src/utils/factory.ts
|
|
16232
16251
|
function factory(name256, dependencies256, create, meta) {
|
|
16233
16252
|
function assertAndCreate(scope) {
|
|
@@ -16249,7 +16268,7 @@ function assertDependencies(name256, dependencies256, scope) {
|
|
|
16249
16268
|
const missingDependencies = dependencies256.filter(
|
|
16250
16269
|
(dependency) => scope[dependency] === void 0
|
|
16251
16270
|
);
|
|
16252
|
-
throw new
|
|
16271
|
+
throw new MathjsError(
|
|
16253
16272
|
`Cannot create function "${name256}", some dependencies are missing: ${missingDependencies.map((d) => `"${d}"`).join(", ")}.`
|
|
16254
16273
|
);
|
|
16255
16274
|
}
|
|
@@ -17124,7 +17143,7 @@ function xgcdNumber(a, b) {
|
|
|
17124
17143
|
}
|
|
17125
17144
|
xgcdNumber.signature = n2;
|
|
17126
17145
|
function powNumber(x, y) {
|
|
17127
|
-
if (x
|
|
17146
|
+
if (isPowZeroAtInfinity(x, y)) {
|
|
17128
17147
|
return 0;
|
|
17129
17148
|
}
|
|
17130
17149
|
return Math.pow(x, y);
|
|
@@ -20368,9 +20387,9 @@ var createRandomInt = /* @__PURE__ */ factory(
|
|
|
20368
20387
|
});
|
|
20369
20388
|
}
|
|
20370
20389
|
return typed3(name73, {
|
|
20371
|
-
"": () =>
|
|
20372
|
-
number: (max2) =>
|
|
20373
|
-
"number, number": (min2, max2) =>
|
|
20390
|
+
"": () => _randomInt2(0, 2),
|
|
20391
|
+
number: (max2) => _randomInt2(0, max2),
|
|
20392
|
+
"number, number": (min2, max2) => _randomInt2(min2, max2),
|
|
20374
20393
|
bigint: (max2) => _randomBigint(0n, max2),
|
|
20375
20394
|
"bigint, bigint": _randomBigint,
|
|
20376
20395
|
"Array | Matrix": (size2) => _randomIntMatrix(size2, 0, 1),
|
|
@@ -20380,18 +20399,18 @@ var createRandomInt = /* @__PURE__ */ factory(
|
|
|
20380
20399
|
function _randomIntMatrix(size2, min2, max2) {
|
|
20381
20400
|
const res = randomMatrix(
|
|
20382
20401
|
size2.valueOf(),
|
|
20383
|
-
() =>
|
|
20402
|
+
() => _randomInt2(min2, max2)
|
|
20384
20403
|
);
|
|
20385
20404
|
return isMatrix(size2) ? size2.create(res, "number") : res;
|
|
20386
20405
|
}
|
|
20387
|
-
function
|
|
20406
|
+
function _randomInt2(min2, max2) {
|
|
20388
20407
|
return Math.floor(min2 + rng() * (max2 - min2));
|
|
20389
20408
|
}
|
|
20390
20409
|
function _randomBigint(min2, max2) {
|
|
20391
20410
|
const simpleCutoff = 2n ** 30n;
|
|
20392
20411
|
const width = max2 - min2;
|
|
20393
20412
|
if (width <= simpleCutoff) {
|
|
20394
|
-
return min2 + BigInt(
|
|
20413
|
+
return min2 + BigInt(_randomInt2(0, Number(width)));
|
|
20395
20414
|
}
|
|
20396
20415
|
const bits = log24(width);
|
|
20397
20416
|
let picked = width;
|
|
@@ -20947,75 +20966,80 @@ var createIdentity = /* @__PURE__ */ factory(
|
|
|
20947
20966
|
}
|
|
20948
20967
|
);
|
|
20949
20968
|
|
|
20969
|
+
// src/matrix/utils/zerosAndOnes.ts
|
|
20970
|
+
function createZerosAndOnes(name256, defaultValue, { typed: typed3, config, matrix: matrix2, BigNumber: BigNumber9 }) {
|
|
20971
|
+
return typed3(name256, {
|
|
20972
|
+
"": function() {
|
|
20973
|
+
return config.matrix === "Array" ? _zerosAndOnes([]) : _zerosAndOnes([], "default");
|
|
20974
|
+
},
|
|
20975
|
+
// math.zeros/ones(m, n, p, ..., format)
|
|
20976
|
+
// TODO: more accurate signature '...number | BigNumber, string' as soon as typed-function supports this
|
|
20977
|
+
"...number | BigNumber | string": function(size2) {
|
|
20978
|
+
const last = size2[size2.length - 1];
|
|
20979
|
+
if (typeof last === "string") {
|
|
20980
|
+
const format6 = size2.pop();
|
|
20981
|
+
return _zerosAndOnes(size2, format6);
|
|
20982
|
+
} else if (config.matrix === "Array") {
|
|
20983
|
+
return _zerosAndOnes(size2);
|
|
20984
|
+
} else {
|
|
20985
|
+
return _zerosAndOnes(size2, "default");
|
|
20986
|
+
}
|
|
20987
|
+
},
|
|
20988
|
+
Array: _zerosAndOnes,
|
|
20989
|
+
Matrix: function(size2) {
|
|
20990
|
+
const format6 = size2.storage();
|
|
20991
|
+
return _zerosAndOnes(size2.valueOf(), format6);
|
|
20992
|
+
},
|
|
20993
|
+
"Array | Matrix, string": function(size2, format6) {
|
|
20994
|
+
const sizeArray = Array.isArray(size2) ? size2 : size2.valueOf();
|
|
20995
|
+
return _zerosAndOnes(sizeArray, format6);
|
|
20996
|
+
}
|
|
20997
|
+
});
|
|
20998
|
+
function _zerosAndOnes(size2, format6) {
|
|
20999
|
+
const hasBigNumbers = _normalize(size2);
|
|
21000
|
+
const dflt = hasBigNumbers ? new BigNumber9(defaultValue) : defaultValue;
|
|
21001
|
+
_validate(size2);
|
|
21002
|
+
if (format6) {
|
|
21003
|
+
const m = matrix2(format6);
|
|
21004
|
+
if (size2.length > 0) {
|
|
21005
|
+
return m.resize(size2, dflt);
|
|
21006
|
+
}
|
|
21007
|
+
return m;
|
|
21008
|
+
} else {
|
|
21009
|
+
const arr = [];
|
|
21010
|
+
if (size2.length > 0) {
|
|
21011
|
+
return resize(arr, size2, dflt);
|
|
21012
|
+
}
|
|
21013
|
+
return arr;
|
|
21014
|
+
}
|
|
21015
|
+
}
|
|
21016
|
+
function _normalize(size2) {
|
|
21017
|
+
let hasBigNumbers = false;
|
|
21018
|
+
size2.forEach(function(value, index, arr) {
|
|
21019
|
+
if (isBigNumber(value)) {
|
|
21020
|
+
hasBigNumbers = true;
|
|
21021
|
+
arr[index] = value.toNumber();
|
|
21022
|
+
}
|
|
21023
|
+
});
|
|
21024
|
+
return hasBigNumbers;
|
|
21025
|
+
}
|
|
21026
|
+
function _validate(size2) {
|
|
21027
|
+
size2.forEach(function(value) {
|
|
21028
|
+
if (typeof value !== "number" || !isInteger(value) || value < 0) {
|
|
21029
|
+
throw new Error(`Parameters in function ${name256} must be positive integers`);
|
|
21030
|
+
}
|
|
21031
|
+
});
|
|
21032
|
+
}
|
|
21033
|
+
}
|
|
21034
|
+
|
|
20950
21035
|
// src/matrix/zeros.ts
|
|
20951
21036
|
var name86 = "zeros";
|
|
20952
21037
|
var dependencies86 = ["typed", "config", "matrix", "BigNumber"];
|
|
20953
21038
|
var createZeros = /* @__PURE__ */ factory(
|
|
20954
21039
|
name86,
|
|
20955
21040
|
dependencies86,
|
|
20956
|
-
(
|
|
20957
|
-
return
|
|
20958
|
-
"": function() {
|
|
20959
|
-
return config.matrix === "Array" ? _zeros([]) : _zeros([], "default");
|
|
20960
|
-
},
|
|
20961
|
-
// math.zeros(m, n, p, ..., format)
|
|
20962
|
-
// TODO: more accurate signature '...number | BigNumber, string' as soon as typed-function supports this
|
|
20963
|
-
"...number | BigNumber | string": function(size2) {
|
|
20964
|
-
const last = size2[size2.length - 1];
|
|
20965
|
-
if (typeof last === "string") {
|
|
20966
|
-
const format6 = size2.pop();
|
|
20967
|
-
return _zeros(size2, format6);
|
|
20968
|
-
} else if (config.matrix === "Array") {
|
|
20969
|
-
return _zeros(size2);
|
|
20970
|
-
} else {
|
|
20971
|
-
return _zeros(size2, "default");
|
|
20972
|
-
}
|
|
20973
|
-
},
|
|
20974
|
-
Array: _zeros,
|
|
20975
|
-
Matrix: function(size2) {
|
|
20976
|
-
const format6 = size2.storage();
|
|
20977
|
-
return _zeros(size2.valueOf(), format6);
|
|
20978
|
-
},
|
|
20979
|
-
"Array | Matrix, string": function(size2, format6) {
|
|
20980
|
-
const sizeArray = Array.isArray(size2) ? size2 : size2.valueOf();
|
|
20981
|
-
return _zeros(sizeArray, format6);
|
|
20982
|
-
}
|
|
20983
|
-
});
|
|
20984
|
-
function _zeros(size2, format6) {
|
|
20985
|
-
const hasBigNumbers = _normalize(size2);
|
|
20986
|
-
const defaultValue = hasBigNumbers ? new BigNumber9(0) : 0;
|
|
20987
|
-
_validate(size2);
|
|
20988
|
-
if (format6) {
|
|
20989
|
-
const m = matrix2(format6);
|
|
20990
|
-
if (size2.length > 0) {
|
|
20991
|
-
return m.resize(size2, defaultValue);
|
|
20992
|
-
}
|
|
20993
|
-
return m;
|
|
20994
|
-
} else {
|
|
20995
|
-
const arr = [];
|
|
20996
|
-
if (size2.length > 0) {
|
|
20997
|
-
return resize(arr, size2, defaultValue);
|
|
20998
|
-
}
|
|
20999
|
-
return arr;
|
|
21000
|
-
}
|
|
21001
|
-
}
|
|
21002
|
-
function _normalize(size2) {
|
|
21003
|
-
let hasBigNumbers = false;
|
|
21004
|
-
size2.forEach(function(value, index, arr) {
|
|
21005
|
-
if (isBigNumber(value)) {
|
|
21006
|
-
hasBigNumbers = true;
|
|
21007
|
-
arr[index] = value.toNumber();
|
|
21008
|
-
}
|
|
21009
|
-
});
|
|
21010
|
-
return hasBigNumbers;
|
|
21011
|
-
}
|
|
21012
|
-
function _validate(size2) {
|
|
21013
|
-
size2.forEach(function(value) {
|
|
21014
|
-
if (typeof value !== "number" || !isInteger(value) || value < 0) {
|
|
21015
|
-
throw new Error("Parameters in function zeros must be positive integers");
|
|
21016
|
-
}
|
|
21017
|
-
});
|
|
21018
|
-
}
|
|
21041
|
+
(deps) => {
|
|
21042
|
+
return createZerosAndOnes(name86, 0, deps);
|
|
21019
21043
|
}
|
|
21020
21044
|
);
|
|
21021
21045
|
|
|
@@ -21025,69 +21049,8 @@ var dependencies87 = ["typed", "config", "matrix", "BigNumber"];
|
|
|
21025
21049
|
var createOnes = /* @__PURE__ */ factory(
|
|
21026
21050
|
name87,
|
|
21027
21051
|
dependencies87,
|
|
21028
|
-
(
|
|
21029
|
-
return
|
|
21030
|
-
"": function() {
|
|
21031
|
-
return config.matrix === "Array" ? _ones([]) : _ones([], "default");
|
|
21032
|
-
},
|
|
21033
|
-
// math.ones(m, n, p, ..., format)
|
|
21034
|
-
// TODO: more accurate signature '...number | BigNumber, string' as soon as typed-function supports this
|
|
21035
|
-
"...number | BigNumber | string": function(size2) {
|
|
21036
|
-
const last = size2[size2.length - 1];
|
|
21037
|
-
if (typeof last === "string") {
|
|
21038
|
-
const format6 = size2.pop();
|
|
21039
|
-
return _ones(size2, format6);
|
|
21040
|
-
} else if (config.matrix === "Array") {
|
|
21041
|
-
return _ones(size2);
|
|
21042
|
-
} else {
|
|
21043
|
-
return _ones(size2, "default");
|
|
21044
|
-
}
|
|
21045
|
-
},
|
|
21046
|
-
Array: _ones,
|
|
21047
|
-
Matrix: function(size2) {
|
|
21048
|
-
const format6 = size2.storage();
|
|
21049
|
-
return _ones(size2.valueOf(), format6);
|
|
21050
|
-
},
|
|
21051
|
-
"Array | Matrix, string": function(size2, format6) {
|
|
21052
|
-
const sizeArray = Array.isArray(size2) ? size2 : size2.valueOf();
|
|
21053
|
-
return _ones(sizeArray, format6);
|
|
21054
|
-
}
|
|
21055
|
-
});
|
|
21056
|
-
function _ones(size2, format6) {
|
|
21057
|
-
const hasBigNumbers = _normalize(size2);
|
|
21058
|
-
const defaultValue = hasBigNumbers ? new BigNumber9(1) : 1;
|
|
21059
|
-
_validate(size2);
|
|
21060
|
-
if (format6) {
|
|
21061
|
-
const m = matrix2(format6);
|
|
21062
|
-
if (size2.length > 0) {
|
|
21063
|
-
return m.resize(size2, defaultValue);
|
|
21064
|
-
}
|
|
21065
|
-
return m;
|
|
21066
|
-
} else {
|
|
21067
|
-
const arr = [];
|
|
21068
|
-
if (size2.length > 0) {
|
|
21069
|
-
return resize(arr, size2, defaultValue);
|
|
21070
|
-
}
|
|
21071
|
-
return arr;
|
|
21072
|
-
}
|
|
21073
|
-
}
|
|
21074
|
-
function _normalize(size2) {
|
|
21075
|
-
let hasBigNumbers = false;
|
|
21076
|
-
size2.forEach(function(value, index, arr) {
|
|
21077
|
-
if (isBigNumber(value)) {
|
|
21078
|
-
hasBigNumbers = true;
|
|
21079
|
-
arr[index] = value.toNumber();
|
|
21080
|
-
}
|
|
21081
|
-
});
|
|
21082
|
-
return hasBigNumbers;
|
|
21083
|
-
}
|
|
21084
|
-
function _validate(size2) {
|
|
21085
|
-
size2.forEach(function(value) {
|
|
21086
|
-
if (typeof value !== "number" || !isInteger(value) || value < 0) {
|
|
21087
|
-
throw new Error("Parameters in function ones must be positive integers");
|
|
21088
|
-
}
|
|
21089
|
-
});
|
|
21090
|
-
}
|
|
21052
|
+
(deps) => {
|
|
21053
|
+
return createZerosAndOnes(name87, 1, deps);
|
|
21091
21054
|
}
|
|
21092
21055
|
);
|
|
21093
21056
|
|
|
@@ -23427,14 +23390,7 @@ var createCbrt = /* @__PURE__ */ factory(
|
|
|
23427
23390
|
if (negate) {
|
|
23428
23391
|
x.value = unaryMinus2(x.value);
|
|
23429
23392
|
}
|
|
23430
|
-
|
|
23431
|
-
if (isBigNumber(x.value)) {
|
|
23432
|
-
third = new BigNumber9(1).div(3);
|
|
23433
|
-
} else if (isFraction(x.value)) {
|
|
23434
|
-
third = new Fraction5(1, 3);
|
|
23435
|
-
} else {
|
|
23436
|
-
third = 1 / 3;
|
|
23437
|
-
}
|
|
23393
|
+
const third = _getThird(x.value);
|
|
23438
23394
|
const result = x.pow(third);
|
|
23439
23395
|
if (negate) {
|
|
23440
23396
|
result.value = unaryMinus2(result.value);
|
|
@@ -23442,6 +23398,15 @@ var createCbrt = /* @__PURE__ */ factory(
|
|
|
23442
23398
|
return result;
|
|
23443
23399
|
}
|
|
23444
23400
|
}
|
|
23401
|
+
function _getThird(value) {
|
|
23402
|
+
if (isBigNumber(value)) {
|
|
23403
|
+
return new BigNumber9(1).div(3);
|
|
23404
|
+
} else if (isFraction(value)) {
|
|
23405
|
+
return new Fraction5(1, 3);
|
|
23406
|
+
} else {
|
|
23407
|
+
return 1 / 3;
|
|
23408
|
+
}
|
|
23409
|
+
}
|
|
23445
23410
|
}
|
|
23446
23411
|
);
|
|
23447
23412
|
|
|
@@ -24284,45 +24249,22 @@ function _switch2(mat) {
|
|
|
24284
24249
|
return ret;
|
|
24285
24250
|
}
|
|
24286
24251
|
|
|
24287
|
-
// src/error/ArgumentsError.ts
|
|
24288
|
-
var ArgumentsError = class _ArgumentsError extends Error {
|
|
24289
|
-
fn;
|
|
24290
|
-
count;
|
|
24291
|
-
min;
|
|
24292
|
-
max;
|
|
24293
|
-
isArgumentsError = true;
|
|
24294
|
-
/**
|
|
24295
|
-
* Create an ArgumentsError
|
|
24296
|
-
* @param fn Function name
|
|
24297
|
-
* @param count Actual argument count
|
|
24298
|
-
* @param min Minimum required argument count
|
|
24299
|
-
* @param max Maximum required argument count (optional)
|
|
24300
|
-
*/
|
|
24301
|
-
constructor(fn, count2, min2, max2) {
|
|
24302
|
-
const message = "Wrong number of arguments in function " + fn + " (" + count2 + " provided, " + min2 + (max2 !== void 0 && max2 !== null ? "-" + max2 : "") + " expected)";
|
|
24303
|
-
super(message);
|
|
24304
|
-
this.fn = fn;
|
|
24305
|
-
this.count = count2;
|
|
24306
|
-
this.min = min2;
|
|
24307
|
-
this.max = max2;
|
|
24308
|
-
this.name = "ArgumentsError";
|
|
24309
|
-
if (Error.captureStackTrace) {
|
|
24310
|
-
Error.captureStackTrace(this, _ArgumentsError);
|
|
24311
|
-
}
|
|
24312
|
-
}
|
|
24313
|
-
};
|
|
24314
|
-
|
|
24315
24252
|
// src/matrix/resize.ts
|
|
24316
24253
|
var name117 = "resize";
|
|
24317
|
-
var dependencies117 = ["config", "matrix"];
|
|
24254
|
+
var dependencies117 = ["typed", "config", "matrix"];
|
|
24318
24255
|
var createResize = /* @__PURE__ */ factory(
|
|
24319
24256
|
name117,
|
|
24320
24257
|
dependencies117,
|
|
24321
|
-
({ config, matrix: matrix2 }) => {
|
|
24322
|
-
return
|
|
24323
|
-
|
|
24324
|
-
|
|
24258
|
+
({ typed: typed3, config, matrix: matrix2 }) => {
|
|
24259
|
+
return typed3(name117, {
|
|
24260
|
+
"any, Array | Matrix": function(x, size2) {
|
|
24261
|
+
return _resize2(x, size2);
|
|
24262
|
+
},
|
|
24263
|
+
"any, Array | Matrix, any": function(x, size2, defaultValue) {
|
|
24264
|
+
return _resize2(x, size2, defaultValue);
|
|
24325
24265
|
}
|
|
24266
|
+
});
|
|
24267
|
+
function _resize2(x, size2, defaultValue) {
|
|
24326
24268
|
if (isMatrix(size2)) {
|
|
24327
24269
|
size2 = size2.valueOf();
|
|
24328
24270
|
}
|
|
@@ -24351,7 +24293,8 @@ var createResize = /* @__PURE__ */ factory(
|
|
|
24351
24293
|
const res = resize(x, size2, defaultValue);
|
|
24352
24294
|
return asMatrix ? matrix2(res) : res;
|
|
24353
24295
|
}
|
|
24354
|
-
}
|
|
24296
|
+
}
|
|
24297
|
+
;
|
|
24355
24298
|
function _resizeString(str, size2, defaultChar) {
|
|
24356
24299
|
if (defaultChar !== void 0) {
|
|
24357
24300
|
if (typeof defaultChar !== "string" || defaultChar.length !== 1) {
|
|
@@ -26661,7 +26604,7 @@ var createPow = /* @__PURE__ */ factory(
|
|
|
26661
26604
|
if (isInteger(y) || x >= 0 || config.predictable) {
|
|
26662
26605
|
return powNumber(x, y);
|
|
26663
26606
|
} else {
|
|
26664
|
-
if (x
|
|
26607
|
+
if (isPowZeroAtInfinity(x, y)) {
|
|
26665
26608
|
return 0;
|
|
26666
26609
|
}
|
|
26667
26610
|
return new Complex8(x, 0).pow(y, 0);
|
|
@@ -31978,6 +31921,18 @@ function hasher(args) {
|
|
|
31978
31921
|
return args[0].precision;
|
|
31979
31922
|
}
|
|
31980
31923
|
|
|
31924
|
+
// src/utils/log.ts
|
|
31925
|
+
var warnOnce = /* @__PURE__ */ (() => {
|
|
31926
|
+
const messages = {};
|
|
31927
|
+
return function warnOnce2(...args) {
|
|
31928
|
+
const message = args.join(", ");
|
|
31929
|
+
if (!messages[message]) {
|
|
31930
|
+
messages[message] = true;
|
|
31931
|
+
console.warn("Warning:", ...args);
|
|
31932
|
+
}
|
|
31933
|
+
};
|
|
31934
|
+
})();
|
|
31935
|
+
|
|
31981
31936
|
// src/type/unit/Unit.ts
|
|
31982
31937
|
var name205 = "Unit";
|
|
31983
31938
|
var dependencies205 = [
|
|
@@ -32594,6 +32549,7 @@ var createUnitClass = /* @__PURE__ */ factory(
|
|
|
32594
32549
|
return other;
|
|
32595
32550
|
};
|
|
32596
32551
|
Unit2.prototype.toNumber = function(valuelessUnit) {
|
|
32552
|
+
warnOnce("Unit.toNumber is deprecated. Use Unit.toNumeric instead.");
|
|
32597
32553
|
return toNumber(this.toNumeric(valuelessUnit));
|
|
32598
32554
|
};
|
|
32599
32555
|
Unit2.prototype.toNumeric = function(valuelessUnit) {
|
|
@@ -43188,12 +43144,12 @@ factoryScope.sech = sech;
|
|
|
43188
43144
|
var parseNumberWithConfig = createParseNumberWithConfig(factoryScope);
|
|
43189
43145
|
factoryScope.parseNumberWithConfig = parseNumberWithConfig;
|
|
43190
43146
|
var divideScalar = createDivideScalar(factoryScope);
|
|
43191
|
-
var
|
|
43147
|
+
var _randomInt = createRandomInt(factoryScope);
|
|
43192
43148
|
var mode = createMode(factoryScope);
|
|
43193
43149
|
var prod = createProd(factoryScope);
|
|
43194
|
-
var
|
|
43195
|
-
var
|
|
43196
|
-
var
|
|
43150
|
+
var _bin = createBin(factoryScope);
|
|
43151
|
+
var _hex = createHex(factoryScope);
|
|
43152
|
+
var _oct = createOct(factoryScope);
|
|
43197
43153
|
var hasNumericValue = createHasNumericValue(factoryScope);
|
|
43198
43154
|
var isFinite2 = createIsFinite(factoryScope);
|
|
43199
43155
|
var isZero = createIsZero(factoryScope);
|
|
@@ -44990,7 +44946,7 @@ function _casSimplifyOne(expr) {
|
|
|
44990
44946
|
r = r.replace(/\s*\*\s*1\b/g, "");
|
|
44991
44947
|
r = r.replace(/\b0\s*\+\s*/g, "");
|
|
44992
44948
|
r = r.replace(/\s*\+\s*0\b/g, "");
|
|
44993
|
-
r = r.replace(/\b0\s*\*\s*[
|
|
44949
|
+
r = r.replace(/\b0\s*\*\s*[^+-]*/g, "0");
|
|
44994
44950
|
const numericPattern = /^[\d\s+\-*/().^]+$/;
|
|
44995
44951
|
if (numericPattern.test(r)) {
|
|
44996
44952
|
try {
|
|
@@ -45223,7 +45179,7 @@ function casSimplify(input) {
|
|
|
45223
45179
|
r = r.replace(/\s*\*\s*1\b/g, "");
|
|
45224
45180
|
r = r.replace(/\b0\s*\+\s*/g, "");
|
|
45225
45181
|
r = r.replace(/\s*\+\s*0\b/g, "");
|
|
45226
|
-
r = r.replace(/\b0\s*\*\s*[
|
|
45182
|
+
r = r.replace(/\b0\s*\*\s*[^+-]*/g, "0");
|
|
45227
45183
|
if (/^[\d\s+\-*/().^]+$/.test(r)) {
|
|
45228
45184
|
try {
|
|
45229
45185
|
const jsExpr = r.replace(/\^/g, "**");
|
package/package.json
CHANGED
|
@@ -1,71 +1,71 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@danielsimonjr/mathts-functions",
|
|
3
|
-
"version": "0.2.
|
|
4
|
-
"description": "Mathematical functions for MathTS - arithmetic, algebra, trigonometry, statistics, and more",
|
|
5
|
-
"author": "Daniel Simon Jr.",
|
|
6
|
-
"license": "MIT",
|
|
7
|
-
"type": "module",
|
|
8
|
-
"main": "./dist/index.js",
|
|
9
|
-
"module": "./dist/index.js",
|
|
10
|
-
"types": "./dist/index.d.ts",
|
|
11
|
-
"exports": {
|
|
12
|
-
".": {
|
|
13
|
-
"import": "./dist/index.js",
|
|
14
|
-
"types": "./dist/index.d.ts"
|
|
15
|
-
}
|
|
16
|
-
},
|
|
17
|
-
"files": [
|
|
18
|
-
"dist",
|
|
19
|
-
"README.md"
|
|
20
|
-
],
|
|
21
|
-
"scripts": {
|
|
22
|
-
"build": "tsup src/index.ts --format esm --clean",
|
|
23
|
-
"dev": "tsup src/index.ts --format esm --dts --watch",
|
|
24
|
-
"test": "vitest run",
|
|
25
|
-
"test:watch": "vitest",
|
|
26
|
-
"test:coverage": "vitest run --coverage",
|
|
27
|
-
"typecheck": "tsc --noEmit",
|
|
28
|
-
"lint": "eslint src --ext .ts",
|
|
29
|
-
"lint:fix": "eslint src --ext .ts --fix",
|
|
30
|
-
"clean": "rm -rf dist",
|
|
31
|
-
"build:prod": "tsup src/index.ts --format esm --clean --minify --treeshake"
|
|
32
|
-
},
|
|
33
|
-
"dependencies": {
|
|
34
|
-
"@danielsimonjr/mathts-core": "
|
|
35
|
-
"@danielsimonjr/mathts-expression": "
|
|
36
|
-
"@danielsimonjr/mathts-matrix": "
|
|
37
|
-
"@danielsimonjr/mathts-parallel": "
|
|
38
|
-
"bignumber.js": "^9.1.2",
|
|
39
|
-
"complex.js": "^2.2.5",
|
|
40
|
-
"decimal.js": "^10.4.3",
|
|
41
|
-
"escape-latex": "^1.2.0",
|
|
42
|
-
"fraction.js": "^5.2.1",
|
|
43
|
-
"javascript-natural-sort": "^0.7.1",
|
|
44
|
-
"seedrandom": "^3.0.5",
|
|
45
|
-
"tiny-emitter": "^2.1.0",
|
|
46
|
-
"typed-function": "github:danielsimonjr/typed-function"
|
|
47
|
-
},
|
|
48
|
-
"devDependencies": {
|
|
49
|
-
"@types/node": "^25.5.2",
|
|
50
|
-
"tsup": "^8.0.0",
|
|
51
|
-
"typescript": "^5.3.0",
|
|
52
|
-
"vitest": "^4.1.5"
|
|
53
|
-
},
|
|
54
|
-
"publishConfig": {
|
|
55
|
-
"access": "public"
|
|
56
|
-
},
|
|
57
|
-
"repository": {
|
|
58
|
-
"type": "git",
|
|
59
|
-
"url": "https://github.com/danielsimonjr/mathts",
|
|
60
|
-
"directory": "functions"
|
|
61
|
-
},
|
|
62
|
-
"keywords": [
|
|
63
|
-
"math",
|
|
64
|
-
"typescript",
|
|
65
|
-
"functions",
|
|
66
|
-
"arithmetic",
|
|
67
|
-
"algebra",
|
|
68
|
-
"trigonometry",
|
|
69
|
-
"statistics"
|
|
70
|
-
]
|
|
71
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@danielsimonjr/mathts-functions",
|
|
3
|
+
"version": "0.2.3",
|
|
4
|
+
"description": "Mathematical functions for MathTS - arithmetic, algebra, trigonometry, statistics, and more",
|
|
5
|
+
"author": "Daniel Simon Jr.",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"main": "./dist/index.js",
|
|
9
|
+
"module": "./dist/index.js",
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"import": "./dist/index.js",
|
|
14
|
+
"types": "./dist/index.d.ts"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist",
|
|
19
|
+
"README.md"
|
|
20
|
+
],
|
|
21
|
+
"scripts": {
|
|
22
|
+
"build": "tsup src/index.ts --format esm --clean",
|
|
23
|
+
"dev": "tsup src/index.ts --format esm --dts --watch",
|
|
24
|
+
"test": "vitest run",
|
|
25
|
+
"test:watch": "vitest",
|
|
26
|
+
"test:coverage": "vitest run --coverage",
|
|
27
|
+
"typecheck": "tsc --noEmit",
|
|
28
|
+
"lint": "eslint src --ext .ts",
|
|
29
|
+
"lint:fix": "eslint src --ext .ts --fix",
|
|
30
|
+
"clean": "rm -rf dist",
|
|
31
|
+
"build:prod": "tsup src/index.ts --format esm --clean --minify --treeshake"
|
|
32
|
+
},
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"@danielsimonjr/mathts-core": "0.1.3",
|
|
35
|
+
"@danielsimonjr/mathts-expression": "0.2.2",
|
|
36
|
+
"@danielsimonjr/mathts-matrix": "0.1.4",
|
|
37
|
+
"@danielsimonjr/mathts-parallel": "0.2.1",
|
|
38
|
+
"bignumber.js": "^9.1.2",
|
|
39
|
+
"complex.js": "^2.2.5",
|
|
40
|
+
"decimal.js": "^10.4.3",
|
|
41
|
+
"escape-latex": "^1.2.0",
|
|
42
|
+
"fraction.js": "^5.2.1",
|
|
43
|
+
"javascript-natural-sort": "^0.7.1",
|
|
44
|
+
"seedrandom": "^3.0.5",
|
|
45
|
+
"tiny-emitter": "^2.1.0",
|
|
46
|
+
"typed-function": "github:danielsimonjr/typed-function"
|
|
47
|
+
},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"@types/node": "^25.5.2",
|
|
50
|
+
"tsup": "^8.0.0",
|
|
51
|
+
"typescript": "^5.3.0",
|
|
52
|
+
"vitest": "^4.1.5"
|
|
53
|
+
},
|
|
54
|
+
"publishConfig": {
|
|
55
|
+
"access": "public"
|
|
56
|
+
},
|
|
57
|
+
"repository": {
|
|
58
|
+
"type": "git",
|
|
59
|
+
"url": "https://github.com/danielsimonjr/mathts",
|
|
60
|
+
"directory": "functions"
|
|
61
|
+
},
|
|
62
|
+
"keywords": [
|
|
63
|
+
"math",
|
|
64
|
+
"typescript",
|
|
65
|
+
"functions",
|
|
66
|
+
"arithmetic",
|
|
67
|
+
"algebra",
|
|
68
|
+
"trigonometry",
|
|
69
|
+
"statistics"
|
|
70
|
+
]
|
|
71
|
+
}
|