feat:node-modules
This commit is contained in:
22
node_modules/mathjs/lib/esm/plain/bignumber/arithmetic.js
generated
vendored
Normal file
22
node_modules/mathjs/lib/esm/plain/bignumber/arithmetic.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
var signature1 = 'BigNumber';
|
||||
var signature2 = 'BigNumber, BigNumber';
|
||||
export function absBigNumber(a) {
|
||||
return a.abs();
|
||||
}
|
||||
absBigNumber.signature = signature1;
|
||||
export function addBigNumber(a, b) {
|
||||
return a.add(b);
|
||||
}
|
||||
addBigNumber.signature = signature2;
|
||||
export function subtractBigNumber(a, b) {
|
||||
return a.sub(b);
|
||||
}
|
||||
subtractBigNumber.signature = signature2;
|
||||
export function multiplyBigNumber(a, b) {
|
||||
return a.mul(b);
|
||||
}
|
||||
multiplyBigNumber.signature = signature2;
|
||||
export function divideBigNumber(a, b) {
|
||||
return a.div(b);
|
||||
}
|
||||
divideBigNumber.signature = signature2;
|
||||
9
node_modules/mathjs/lib/esm/plain/bignumber/index.js
generated
vendored
Normal file
9
node_modules/mathjs/lib/esm/plain/bignumber/index.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
import Decimal from 'decimal.js';
|
||||
export * from './arithmetic.js';
|
||||
|
||||
// TODO: this is ugly. Instead, be able to pass your own isBigNumber function to typed?
|
||||
var BigNumber = Decimal.clone();
|
||||
BigNumber.prototype.isBigNumber = true;
|
||||
export function bignumber(x) {
|
||||
return new BigNumber(x);
|
||||
}
|
||||
303
node_modules/mathjs/lib/esm/plain/number/arithmetic.js
generated
vendored
Normal file
303
node_modules/mathjs/lib/esm/plain/number/arithmetic.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
52
node_modules/mathjs/lib/esm/plain/number/bitwise.js
generated
vendored
Normal file
52
node_modules/mathjs/lib/esm/plain/number/bitwise.js
generated
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
import { isInteger } from '../../utils/number.js';
|
||||
var n1 = 'number';
|
||||
var n2 = 'number, number';
|
||||
export function bitAndNumber(x, y) {
|
||||
if (!isInteger(x) || !isInteger(y)) {
|
||||
throw new Error('Integers expected in function bitAnd');
|
||||
}
|
||||
return x & y;
|
||||
}
|
||||
bitAndNumber.signature = n2;
|
||||
export function bitNotNumber(x) {
|
||||
if (!isInteger(x)) {
|
||||
throw new Error('Integer expected in function bitNot');
|
||||
}
|
||||
return ~x;
|
||||
}
|
||||
bitNotNumber.signature = n1;
|
||||
export function bitOrNumber(x, y) {
|
||||
if (!isInteger(x) || !isInteger(y)) {
|
||||
throw new Error('Integers expected in function bitOr');
|
||||
}
|
||||
return x | y;
|
||||
}
|
||||
bitOrNumber.signature = n2;
|
||||
export function bitXorNumber(x, y) {
|
||||
if (!isInteger(x) || !isInteger(y)) {
|
||||
throw new Error('Integers expected in function bitXor');
|
||||
}
|
||||
return x ^ y;
|
||||
}
|
||||
bitXorNumber.signature = n2;
|
||||
export function leftShiftNumber(x, y) {
|
||||
if (!isInteger(x) || !isInteger(y)) {
|
||||
throw new Error('Integers expected in function leftShift');
|
||||
}
|
||||
return x << y;
|
||||
}
|
||||
leftShiftNumber.signature = n2;
|
||||
export function rightArithShiftNumber(x, y) {
|
||||
if (!isInteger(x) || !isInteger(y)) {
|
||||
throw new Error('Integers expected in function rightArithShift');
|
||||
}
|
||||
return x >> y;
|
||||
}
|
||||
rightArithShiftNumber.signature = n2;
|
||||
export function rightLogShiftNumber(x, y) {
|
||||
if (!isInteger(x) || !isInteger(y)) {
|
||||
throw new Error('Integers expected in function rightLogShift');
|
||||
}
|
||||
return x >>> y;
|
||||
}
|
||||
rightLogShiftNumber.signature = n2;
|
||||
33
node_modules/mathjs/lib/esm/plain/number/combinations.js
generated
vendored
Normal file
33
node_modules/mathjs/lib/esm/plain/number/combinations.js
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
import { isInteger } from '../../utils/number.js';
|
||||
import { product } from '../../utils/product.js';
|
||||
export function combinationsNumber(n, k) {
|
||||
if (!isInteger(n) || n < 0) {
|
||||
throw new TypeError('Positive integer value expected in function combinations');
|
||||
}
|
||||
if (!isInteger(k) || k < 0) {
|
||||
throw new TypeError('Positive integer value expected in function combinations');
|
||||
}
|
||||
if (k > n) {
|
||||
throw new TypeError('k must be less than or equal to n');
|
||||
}
|
||||
var nMinusk = n - k;
|
||||
var answer = 1;
|
||||
var firstnumerator = k < nMinusk ? nMinusk + 1 : k + 1;
|
||||
var nextdivisor = 2;
|
||||
var lastdivisor = k < nMinusk ? k : nMinusk;
|
||||
// balance multiplications and divisions to try to keep intermediate values
|
||||
// in exact-integer range as long as possible
|
||||
for (var nextnumerator = firstnumerator; nextnumerator <= n; ++nextnumerator) {
|
||||
answer *= nextnumerator;
|
||||
while (nextdivisor <= lastdivisor && answer % nextdivisor === 0) {
|
||||
answer /= nextdivisor;
|
||||
++nextdivisor;
|
||||
}
|
||||
}
|
||||
// for big n, k, floating point may have caused weirdness in remainder
|
||||
if (nextdivisor <= lastdivisor) {
|
||||
answer /= product(nextdivisor, lastdivisor);
|
||||
}
|
||||
return answer;
|
||||
}
|
||||
combinationsNumber.signature = 'number, number';
|
||||
4
node_modules/mathjs/lib/esm/plain/number/constants.js
generated
vendored
Normal file
4
node_modules/mathjs/lib/esm/plain/number/constants.js
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
export var pi = Math.PI;
|
||||
export var tau = 2 * Math.PI;
|
||||
export var e = Math.E;
|
||||
export var phi = 1.6180339887498948; // eslint-disable-line no-loss-of-precision
|
||||
9
node_modules/mathjs/lib/esm/plain/number/index.js
generated
vendored
Normal file
9
node_modules/mathjs/lib/esm/plain/number/index.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
export * from './arithmetic.js';
|
||||
export * from './bitwise.js';
|
||||
export * from './combinations.js';
|
||||
export * from './constants.js';
|
||||
export * from './logical.js';
|
||||
export * from './relational.js';
|
||||
export * from './probability.js';
|
||||
export * from './trigonometry.js';
|
||||
export * from './utils.js';
|
||||
18
node_modules/mathjs/lib/esm/plain/number/logical.js
generated
vendored
Normal file
18
node_modules/mathjs/lib/esm/plain/number/logical.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
var n1 = 'number';
|
||||
var n2 = 'number, number';
|
||||
export function notNumber(x) {
|
||||
return !x;
|
||||
}
|
||||
notNumber.signature = n1;
|
||||
export function orNumber(x, y) {
|
||||
return !!(x || y);
|
||||
}
|
||||
orNumber.signature = n2;
|
||||
export function xorNumber(x, y) {
|
||||
return !!x !== !!y;
|
||||
}
|
||||
xorNumber.signature = n2;
|
||||
export function andNumber(x, y) {
|
||||
return !!(x && y);
|
||||
}
|
||||
andNumber.signature = n2;
|
||||
75
node_modules/mathjs/lib/esm/plain/number/probability.js
generated
vendored
Normal file
75
node_modules/mathjs/lib/esm/plain/number/probability.js
generated
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
/* eslint-disable no-loss-of-precision */
|
||||
|
||||
import { isInteger } from '../../utils/number.js';
|
||||
import { product } from '../../utils/product.js';
|
||||
export function gammaNumber(n) {
|
||||
var x;
|
||||
if (isInteger(n)) {
|
||||
if (n <= 0) {
|
||||
return isFinite(n) ? Infinity : NaN;
|
||||
}
|
||||
if (n > 171) {
|
||||
return Infinity; // Will overflow
|
||||
}
|
||||
return product(1, n - 1);
|
||||
}
|
||||
if (n < 0.5) {
|
||||
return Math.PI / (Math.sin(Math.PI * n) * gammaNumber(1 - n));
|
||||
}
|
||||
if (n >= 171.35) {
|
||||
return Infinity; // will overflow
|
||||
}
|
||||
if (n > 85.0) {
|
||||
// Extended Stirling Approx
|
||||
var twoN = n * n;
|
||||
var threeN = twoN * n;
|
||||
var fourN = threeN * n;
|
||||
var fiveN = fourN * n;
|
||||
return Math.sqrt(2 * Math.PI / n) * Math.pow(n / Math.E, n) * (1 + 1 / (12 * n) + 1 / (288 * twoN) - 139 / (51840 * threeN) - 571 / (2488320 * fourN) + 163879 / (209018880 * fiveN) + 5246819 / (75246796800 * fiveN * n));
|
||||
}
|
||||
--n;
|
||||
x = gammaP[0];
|
||||
for (var i = 1; i < gammaP.length; ++i) {
|
||||
x += gammaP[i] / (n + i);
|
||||
}
|
||||
var t = n + gammaG + 0.5;
|
||||
return Math.sqrt(2 * Math.PI) * Math.pow(t, n + 0.5) * Math.exp(-t) * x;
|
||||
}
|
||||
gammaNumber.signature = 'number';
|
||||
|
||||
// TODO: comment on the variables g and p
|
||||
|
||||
export var gammaG = 4.7421875;
|
||||
export var gammaP = [0.99999999999999709182, 57.156235665862923517, -59.597960355475491248, 14.136097974741747174, -0.49191381609762019978, 0.33994649984811888699e-4, 0.46523628927048575665e-4, -0.98374475304879564677e-4, 0.15808870322491248884e-3, -0.21026444172410488319e-3, 0.21743961811521264320e-3, -0.16431810653676389022e-3, 0.84418223983852743293e-4, -0.26190838401581408670e-4, 0.36899182659531622704e-5];
|
||||
|
||||
// lgamma implementation ref: https://mrob.com/pub/ries/lanczos-gamma.html#code
|
||||
|
||||
// log(2 * pi) / 2
|
||||
export var lnSqrt2PI = 0.91893853320467274178;
|
||||
export var lgammaG = 5; // Lanczos parameter "g"
|
||||
export var lgammaN = 7; // Range of coefficients "n"
|
||||
|
||||
export var lgammaSeries = [1.000000000190015, 76.18009172947146, -86.50532032941677, 24.01409824083091, -1.231739572450155, 0.1208650973866179e-2, -0.5395239384953e-5];
|
||||
export function lgammaNumber(n) {
|
||||
if (n < 0) return NaN;
|
||||
if (n === 0) return Infinity;
|
||||
if (!isFinite(n)) return n;
|
||||
if (n < 0.5) {
|
||||
// Use Euler's reflection formula:
|
||||
// gamma(z) = PI / (sin(PI * z) * gamma(1 - z))
|
||||
return Math.log(Math.PI / Math.sin(Math.PI * n)) - lgammaNumber(1 - n);
|
||||
}
|
||||
|
||||
// Compute the logarithm of the Gamma function using the Lanczos method
|
||||
|
||||
n = n - 1;
|
||||
var base = n + lgammaG + 0.5; // Base of the Lanczos exponential
|
||||
var sum = lgammaSeries[0];
|
||||
|
||||
// We start with the terms that have the smallest coefficients and largest denominator
|
||||
for (var i = lgammaN - 1; i >= 1; i--) {
|
||||
sum += lgammaSeries[i] / (n + i);
|
||||
}
|
||||
return lnSqrt2PI + (n + 0.5) * Math.log(base) - base + Math.log(sum);
|
||||
}
|
||||
lgammaNumber.signature = 'number';
|
||||
0
node_modules/mathjs/lib/esm/plain/number/relational.js
generated
vendored
Normal file
0
node_modules/mathjs/lib/esm/plain/number/relational.js
generated
vendored
Normal file
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user