Members
(constant) Constants
BigFloat Constants
Flags
Flags for controlling the behavior of BigFloat operations.
libbf :any
The libbf instance.
Type:
- any
throwExceptionOnInvalidOp :boolean
If true, an exception is thrown on invalid operations.
Type:
- boolean
Methods
O(nopt, coefTypeopt) → {Poly}
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
n |
number |
<optional> |
1
|
The order of the truncation. |
coefType |
function |
<optional> |
BigFloat
|
The coefficient type. |
Returns:
- Type
- Poly
X(nopt, coefTypeopt) → {Poly}
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
n |
number |
<optional> |
1
|
The degree of X. |
coefType |
function |
<optional> |
BigFloat
|
The coefficient type. |
Returns:
- Type
- Poly
abs(v, precopt) → {BigFloat}
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
v |
BigFloat | number | string | bigint | |||
prec |
number |
<optional> |
0
|
Returns:
- Type
- BigFloat
acos(v, precopt) → {BigFloat}
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
v |
BigFloat | number | string | bigint | |||
prec |
number |
<optional> |
0
|
Returns:
- Type
- BigFloat
altZeta(s) → {Complex}
Parameters:
| Name | Type | Description |
|---|---|---|
s |
Complex | number | BigFloat |
Returns:
- Type
- Complex
asin(v, precopt) → {BigFloat}
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
v |
BigFloat | number | string | bigint | |||
prec |
number |
<optional> |
0
|
Returns:
- Type
- BigFloat
atan(v, precopt) → {BigFloat}
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
v |
BigFloat | number | string | bigint | |||
prec |
number |
<optional> |
0
|
Returns:
- Type
- BigFloat
atan2(v, precopt) → {BigFloat}
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
v |
BigFloat | number | string | bigint | |||
prec |
number |
<optional> |
0
|
Returns:
- Type
- BigFloat
bernoulli(n) → {BigFloat}
- Description:
Bernoulli numbers B_n using Ramanujan's recursive formula for small n and the Zeta relationship for large n.
Ramanujan's Formula (speeds up recursion): sum_{k=0}^n [ C(6n+3, 6k) * B_{6k} ] = (2n+1)/2
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
n |
number | The index of the Bernoulli number. |
Returns:
- Type
- BigFloat
besseli(nu, z) → {Complex}
- Description:
Modified Bessel function of the first kind I_v(z). Defined by: I_v(z) = (z/2)^v / gamma(v+1) * 0F1(; v+1; z^2/4)
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
nu |
Complex | number | Order |
z |
Complex | number | Complex argument |
Returns:
- Type
- Complex
besselj(nu, z) → {Complex}
- Description:
Bessel function of the first kind J_v(z). Defined by series: J_v(z) = (z/2)^v / gamma(v+1) * 0F1(; v+1; -z^2/4)
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
nu |
Complex | number | Order of the Bessel function |
z |
Complex | number | Complex argument |
Returns:
- Type
- Complex
besselk(nu, z) → {Complex}
- Description:
Modified Bessel function of the second kind K_v(z)
K_v(z) = (pi/2) [I_{-v}(z) - I_v(z)] / sin(vpi)
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
nu |
Complex | number | Order |
z |
Complex | number | Complex argument |
Returns:
- Type
- Complex
bessely(nu, z) → {Complex}
- Description:
Bessel function of the second kind Y_v(z) Uses the mpmath precision trick of limit approximation (perturbation) for integer orders to sidestep exact L'Hôpital evaluation over series.
Y_v(z) =[J_v(z)cos(vpi) - J_{-v}(z)] / sin(vpi)
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
nu |
Complex | number | Order |
z |
Complex | number | Complex argument |
Returns:
- Type
- Complex
beta()
bf(valopt, radixopt, managedopt, constantopt) → {BigFloat}
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
val |
string | number | bigint | BigFloat |
<optional> |
The value to initialize the BigFloat with. |
|
radix |
number |
<optional> |
10
|
The radix to use if |
managed |
boolean |
<optional> |
true
|
Whether the BigFloat should be managed by the garbage collector. |
constant |
boolean |
<optional> |
false
|
Whether the BigFloat is a constant. |
Returns:
- Type
- BigFloat
bigIntSqrt(value) → {bigint|undefined}
- Description:
Calculates the integer square root of a BigInt. Returns undefined if the value is negative or not a perfect square.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
value |
bigint |
Returns:
- Type
- bigint | undefined
ceil(v, precopt) → {BigFloat}
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
v |
BigFloat | number | string | bigint | |||
prec |
number |
<optional> |
0
|
Returns:
- Type
- BigFloat
complex(re, imopt) → {Complex}
- Description:
Creates a new Complex instance.
- Source:
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
re |
number | string | BigFloat | Complex | Real part or Complex object |
|
im |
number | string | BigFloat |
<optional> |
Imaginary part |
Returns:
- Type
- Complex
cos(v, precopt) → {BigFloat}
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
v |
BigFloat | number | string | bigint | |||
prec |
number |
<optional> |
0
|
Returns:
- Type
- BigFloat
decimalPrecision(dpopt) → {number|undefined}
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
dp |
number |
<optional> |
The new precision in decimal digits. If not provided, the function returns the current precision in decimal digits. |
Returns:
- Type
- number | undefined
diff(f, x, nopt, infoopt) → {BigFloat|null}
- Description:
High-precision Numerical Differentiation.
Computes the n-th derivative of function
fat pointxusing thelimitfunction to extrapolate the finite difference quotient as the step sizehapproaches zero.
- Source:
Parameters:
| Name | Type | Attributes | Default | Description | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f |
function | The function to differentiate. Must accept and return BigFloat. |
|||||||||||||||||
x |
number | string | BigFloat | The point at which to compute the derivative. |
|||||||||||||||||
n |
number |
<optional> |
1
|
The order of the derivative (1st, 2nd, etc.). |
|||||||||||||||
info |
Object |
<optional> |
{}
|
Configuration object. Properties
|
Returns:
The n-th derivative at x, or null if convergence fails.
- Type
- BigFloat | null
exp(v, precopt) → {BigFloat}
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
v |
BigFloat | number | string | bigint | |||
prec |
number |
<optional> |
0
|
Returns:
- Type
- BigFloat
factorial() → {Complex|BigFloat}
Returns:
return Complex when n is Complex, otherwize return a BigFloat
floor(v, precopt) → {BigFloat}
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
v |
BigFloat | number | string | bigint | |||
prec |
number |
<optional> |
0
|
Returns:
- Type
- BigFloat
fminbnd(f, _ax, _bx, infoopt) → {BigFloat|null}
- Description:
High-precision Function Minimization using Brent's Method (similar to MATLAB's fminbnd).
This algorithm finds a local minimum of a function of one variable within a fixed interval. It combines Golden Section Search (linear convergence) with Parabolic Interpolation (superlinear convergence) for reliability and speed.
- Source:
Parameters:
| Name | Type | Attributes | Default | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f |
function | The objective function to minimize. Must accept a BigFloat argument and return a BigFloat result. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
_ax |
number | string | BigFloat | The start of the search interval. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
_bx |
number | string | BigFloat | The end of the search interval. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
info |
Object |
<optional> |
{}
|
Configuration and Status object. Updates in-place with statistics (iterations, execution time, error estimate). // --- Input Configuration Properties --- Properties
|
Returns:
Returns the BigFloat x where f(x) is minimized.
Returns null if max steps or time limit exceeded.
- Type
- BigFloat | null
formatDecimal(str, prettyopt) → {string}
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
str |
string | The input string number. |
||
pretty |
boolean |
<optional> |
false
|
pretty print |
Returns:
- The formatted string.
- Type
- string
fpround(v, precopt, rnd_modeopt) → {BigFloat}
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
v |
BigFloat | number | string | bigint | |||
prec |
number |
<optional> |
0
|
|
rnd_mode |
number |
<optional> |
0
|
Returns:
- Type
- BigFloat
frac(nopt, dopt) → {BigFraction}
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
n |
BigFraction | bigint | number | string |
<optional> |
The numerator or the whole value. |
|
d |
bigint | number | string |
<optional> |
1n
|
The denominator. |
Returns:
- Type
- BigFraction
fromDouble(val) → {Object}
- Description:
Rapidly converts a JS Number to BigInt numerator and denominator by directly accessing IEEE 754 bits.
Formula: Value = (-1)^S * (1 + Mantissa/2^52) * 2^(Exponent - 1023)
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
val |
number |
Returns:
- Type
- Object
fzero(f, _a, _b, infoopt) → {BigFloat|null}
- Description:
High-precision Root Finding using the Brent-Dekker Method (similar to MATLAB's fzero).
This algorithm combines the reliability of Bisection, the speed of the Secant method, and the high-order convergence of Inverse Quadratic Interpolation (IQI). It guarantees global convergence while achieving superlinear convergence rates near the root.
- Source:
Parameters:
| Name | Type | Attributes | Default | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f |
function | The target function to find the root of. Must accept a BigFloat argument and return a BigFloat result. The function values at the endpoints must have opposite signs (f(_a) * f(_b) <= 0). |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
_a |
number | string | BigFloat | The start of the search interval (or first initial guess). |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
_b |
number | string | BigFloat | The end of the search interval (or second initial guess). |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
info |
Object |
<optional> |
{}
|
Configuration and Status object. This object configures the execution parameters and is updated in-place with statistical data during and after execution. Properties
|
Returns:
Returns the BigFloat root if the tolerance criteria are met.
Returns null if the maximum steps or time limit is exceeded (a warning is logged to the console).
- Type
- BigFloat | null
gamma(z) → {Complex}
Parameters:
| Name | Type | Description |
|---|---|---|
z |
Complex | number | string | BigFloat |
Returns:
- Type
- Complex
gcd(a, b) → {bigint}
- Description:
Helper function to calculate Greatest Common Divisor (GCD) using Euclidean algorithm.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
a |
bigint | |
b |
bigint |
Returns:
- Type
- bigint
getEpsilon() → {number}
Returns:
- Type
- number
getGcEleLimit() → {number}
Returns:
- Type
- number
getGlobalFlag() → {number}
Returns:
- Type
- number
getPrecision() → {number}
Returns:
- Type
- number
hankel1()
- Description:
Hankel function of the first kind H1_v(z) = J_v(z) + i*Y_v(z)
- Source:
hankel2()
- Description:
Hankel function of the second kind H2_v(z) = J_v(z) - i*Y_v(z)
- Source:
hyp0f1(a, z, max_iteropt) → {Complex}
- Description:
Confluent Hypergeometric Limit Function 0F1(; a; z) Used as the primary power series expansion for Bessel functions.
- Source:
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
a |
Complex | The parameter 'a' (usually nu + 1) |
||
z |
Complex | The complex argument |
||
max_iter |
Number |
<optional> |
10000
|
Returns:
- Type
- Complex
identify(_x, optionsopt) → {string}
- Description:
Identify a high-precision BigFloat as a simple symbolic expression. This function uses the Continued Fraction algorithm to find the best rational approximation p/q for x, x/pi, x^2, etc.
- Source:
Parameters:
| Name | Type | Attributes | Default | Description | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
_x |
BigFloat | number | string | The value to identify. |
||||||||||||||||||||||
options |
Object |
<optional> |
{}
|
Configuration options. Properties
|
Returns:
- A string representation of the identified expression, or the number itself.
- Type
- string
init(m) → {Promise.<boolean>}
Parameters:
| Name | Type | Description |
|---|---|---|
m |
any | The wasm module. |
Returns:
- Type
- Promise.<boolean>
isInteger()
- Description:
Helper to check if a Complex number is strictly an integer. Used to detect singularities in Gamma or branch logic.
- Source:
isReady() → {boolean}
Returns:
- Type
- boolean
lambertw(z, k) → {Complex}
- Description:
High-precision Lambert W function W_k(z). Computes the principal branch W_0(z) by default, or the k-th branch W_k(z).
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
z |
Complex | number | string | BigFloat | The complex argument |
k |
number | Branch index (default 0) |
Returns:
- Type
- Complex
limit(f, point, infoopt) → {BigFloat|null}
- Description:
High-precision Numerical Limit using Richardson Extrapolation.
This function estimates the limit of
f(x)asxapproachespoint. It evaluates the function at a sequence of points converging to the target and uses Richardson extrapolation to eliminate error terms, achieving high precision.
- Source:
Parameters:
| Name | Type | Attributes | Default | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f |
function | The function to evaluate. Must accept a BigFloat argument (x) and return a BigFloat result (f(x)). |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
point |
number | string | BigFloat | The target value to approach. Can be a finite number, or 'inf', '+inf', 'infinity' for positive infinity, '-inf', '-infinity' for negative infinity. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
info |
Object |
<optional> |
{}
|
Configuration and Status object. Properties
|
Returns:
Returns the BigFloat limit value if tolerances are met, or null otherwise.
- Type
- BigFloat | null
linspace(start, end, n)
Parameters:
| Name | Type | Description |
|---|---|---|
start |
BigFloat | Number | string | |
end |
BigFloat | Number | string | |
n |
Number |
Returns:
log(v, precopt) → {BigFloat}
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
v |
BigFloat | number | string | bigint | |||
prec |
number |
<optional> |
0
|
Returns:
- Type
- BigFloat
logGamma(z) → {Complex}
- Description:
High-precision Log-Gamma function ln(Gamma(z)). Essential for large z where Gamma(z) would overflow.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
z |
Complex | number | string | BigFloat |
Returns:
- Type
- Complex
max(…args) → {BigFloat}
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
args |
BigFloat | number | string | bigint |
<repeatable> |
Returns:
- Type
- BigFloat
min(…args) → {BigFloat}
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
args |
BigFloat | number | string | bigint |
<repeatable> |
Returns:
- Type
- BigFloat
neg(v, precopt) → {BigFloat}
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
v |
BigFloat | number | string | bigint | |||
prec |
number |
<optional> |
0
|
Returns:
- Type
- BigFloat
nsum(f, range, infoopt) → {BigFloat|null}
- Description:
High-precision Numerical Summation (Infinite/Finite Series).
This function estimates the sum of
f(n)fornfromstarttoend. For infinite series, it calculates a sequence of partial sums (doubling the number of terms each step) and uses Richardson extrapolation to accelerate convergence.
- Source:
Parameters:
| Name | Type | Attributes | Default | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f |
function | The term function. Must accept a BigFloat argument (n) and return a BigFloat result (f(n)). |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
range |
Array.<(number|string|BigFloat)> | The summation interval [start, end]. e.g., [0, 100] or [1, 'inf']. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
info |
Object |
<optional> |
{}
|
Configuration and Status object. Properties
|
Returns:
Returns the BigFloat sum if converged/completed, or null if failed.
- Type
- BigFloat | null
ode15s(odefun, tspan, y0, infoopt) → {Object|null}
- Description:
High-precision Stiff ODE Solver (Equivalent to MATLAB's ode15s). Variable-Order (1-5), Variable-Step Backward Differentiation Formulas (BDF). Utilizes custom SparseMatrixCSC for high-performance implicit Newton-Raphson iterations.
- Source:
Parameters:
| Name | Type | Attributes | Default | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
odefun |
function | The main function: dydt = odefun(t, y) or returns { M, f }. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
tspan |
Array.<(number|string|BigFloat)> | Interval of integration [t0, tf]. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
y0 |
Array.<(number|string|BigFloat)> | BigFloat | Initial conditions. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
info |
Object |
<optional> |
{}
|
Configuration and Status object.
Properties
|
Returns:
{ t, y, dy } or null on catastrophic failure.
- Type
- Object | null
ode45(odefun, tspan, y0, infoopt) → {Object|null}
- Description:
High-precision ODE Solver using Dormand-Prince method (similar to MATLAB's ode45).
Solves non-stiff differential equations y' = f(t, y). Implementation of the explicit Runge-Kutta (4,5) formula (Dormand-Prince pair). Supports adaptive step size control.
- Source:
Parameters:
| Name | Type | Attributes | Default | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
odefun |
function | The main function to integrate: dydt = odefun(t, y).
- t: BigFloat (current time)
- y: Array |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
tspan |
Array.<(number|string|BigFloat)> | Interval of integration [t0, tf]. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
y0 |
Array.<(number|string|BigFloat)> | BigFloat | Initial conditions. Can be a scalar (converted to array internally) or an array of values. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
info |
Object |
<optional> |
{}
|
Configuration and Status object. Updates in-place with solution data and statistics.
Properties
|
Returns:
Returns { t, y } (references to info.t and info.y) if successful. Returns null if critical errors occur.
- Type
- Object | null
pdepe(m, pdefun, icfun, bcfun, xmesh, tspan, infoopt) → {Array.<Array.<(BigFloat|Array.<BigFloat>)>>}
- Description:
High-performance 1D Parabolic and Elliptic PDE Solver (Equivalent to MATLAB's pdepe). Solves equations of the form: c(x,t,u,Du/Dx) * Du/Dt = x^(-m) * D/Dx( x^m * f(x,t,u,Du/Dx) ) + s(x,t,u,Du/Dx)
NOTE: All user-provided functions (pdefun, icfun, bcfun) MUST return
BigFloatorArray<BigFloat>objects directly. No implicit type conversion is performed.
- Source:
Parameters:
| Name | Type | Attributes | Default | Description | |||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
m |
number | string | Symmetry parameter: 0 (slab), 1 (cylinder), 2 (sphere). |
|||||||||||||||||||||||||||||||||||||||||||||||
pdefun |
function | Equation definitions: {c, f, s} = pdefun(x, t, u, dudx) |
|||||||||||||||||||||||||||||||||||||||||||||||
icfun |
function | Initial conditions: u0 = icfun(x) |
|||||||||||||||||||||||||||||||||||||||||||||||
bcfun |
function | Boundary conditions: {pl, ql, pr, qr} = bcfun(xl, ul, xr, ur, t) |
|||||||||||||||||||||||||||||||||||||||||||||||
xmesh |
Array.<(number|string|BigFloat)> | Spatial grid points[x_0, x_1, ..., x_N] |
|||||||||||||||||||||||||||||||||||||||||||||||
tspan |
Array.<(number|string|BigFloat)> | Time output points[t_0, t_1, ..., t_M] |
|||||||||||||||||||||||||||||||||||||||||||||||
info |
Object |
<optional> |
{}
|
Configuration and Status object forwarded to ode15s. Properties
|
Returns:
- Solution 3D Array strictly returning BigFloat instances.
poly(v, coefTypeopt) → {Poly}
- Description:
Factory function to create a Poly instance from various inputs. Now uses the Scalar class for coefficient parsing and unified representation.
- Source:
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
v |
string | Array.<any> | Object.<string, any> | Map.<string, any> | number | bigint | BigFloat | BigFraction | Complex | Poly | Scalar | |||
coefType |
function |
<optional> |
BigFloat
|
The class used to construct coefficients. |
Returns:
- Type
- Poly
polyStr(v, coefTypeopt) → {Poly}
- Description:
Factory function to create a Poly instance using a State Machine parser. This parser avoids regex for core logic to handle complex nested structures and strict validation.
Supported formats examples:
- Integer/Fraction: "1", "-1", "+-1", "-2/3"
- Variables: "X", "-X", "-2X", "-2*X"
- Exponents: "X^2", "X^-1", "X^(-1)", "X^0"
- Complex in parens: "(-1+i)X", "(3+2i)"
- Big-O: "+O(3)", "O(X^5)"
- Source:
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
v |
string | |||
coefType |
function |
<optional> |
Scalar
|
The class used to wrap/construct coefficients. |
Returns:
- Type
- Poly
polyfit(x, y, order, infoopt) → {Array.<BigFloat>|null}
- Description:
High-precision Polynomial Curve Fitting using Least Squares Method.
Finds the coefficients of a polynomial p(x) of degree n that fits the data, minimizing the sum of the squared errors.
Coefficients are returned in descending powers (MATLAB style): p(x) = c[0]*x^n + c[1]*x^(n-1) + ... + c[n-1]*x + c[n]
- Source:
Parameters:
| Name | Type | Attributes | Default | Description | |||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
x |
Array.<(number|string|BigFloat)> | Array of x-coordinates. |
|||||||||||||||||||||||||||||||||||||||||||||||
y |
Array.<(number|string|BigFloat)> | Array of y-coordinates. |
|||||||||||||||||||||||||||||||||||||||||||||||
order |
number | The degree of the polynomial to fit (n). |
|||||||||||||||||||||||||||||||||||||||||||||||
info |
Object |
<optional> |
{}
|
Configuration and Status object. Properties
|
Returns:
Returns array of BigFloat coefficients if successful, null otherwise.
- Type
- Array.<BigFloat> | null
polyval(p, x) → {BigFloat}
- Description:
Helper: Evaluate polynomial at x (MATLAB polyval style)
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
p |
Array.<BigFloat> | Coefficients [c_n, ..., c_0] |
x |
BigFloat | number |
Returns:
- Type
- BigFloat
popPrecision()
- Description:
Pops the precision from the stack and restores the previous precision.
- Source:
pow(v, b, precopt) → {BigFloat}
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
v |
BigFloat | number | string | bigint | |||
b |
BigFloat | number | string | bigint | |||
prec |
number |
<optional> |
0
|
Returns:
- Type
- BigFloat
primeZeta(s) → {Complex}
- Description:
Prime Zeta Function P(s) = sum_{p \in primes} p^-s. Calculated via Mobius inversion: P(s) = sum_{n=1}^inf (μ(n)/n) * ln(ζ(ns))
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
s |
Complex | number | BigFloat |
Returns:
- Type
- Complex
pushDecimalPrecision(dp)
- Description:
Pushes the current precision to the stack and sets a new precision in decimal digits.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
dp |
number | The new precision in decimal digits. |
pushPrecision(prec)
- Description:
Pushes the current precision to the stack and sets a new precision.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
prec |
number | The new precision in bits. |
quad(f, _a, _bopt, infoopt) → {BigFloat|Complex|null}
- Description:
High-precision Numerical Integration using Tanh-Sinh (Double Exponential) Quadrature.
SOTA level implementation equivalent to mpmath.quad.
- Natively supports finite, half-infinite, and fully infinite bounds.
- Supports Complex variables, endpoints, and complex integrands.
- Supports contour/path integration when
_ais an array of nodes and_bis undefined. - Extremely robust against endpoint singularities (e.g. log(0), 1/0) through smart boundary bypassing.
- Source:
Parameters:
| Name | Type | Attributes | Default | Description | |||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f |
function | The integrand function. Must accept a BigFloat/Complex argument (z) and return a BigFloat/Complex result (f(z)). |
|||||||||||||||||||||||||||||||||||||
_a |
number | string | BigFloat | Complex | Array | The lower limit of integration, or an array of points for contour integration. |
|||||||||||||||||||||||||||||||||||||
_b |
number | string | BigFloat | Complex |
<optional> |
The upper limit of integration (leave undefined for contour path integration). |
||||||||||||||||||||||||||||||||||||
info |
Object |
<optional> |
{}
|
Configuration and Status object. Properties
|
Returns:
Returns the exact integral value, or null if failed.
romberg(f, _a, _b, infoopt) → {BigFloat|null}
- Description:
High-precision Numerical Integration using Romberg's Method.
This function estimates the definite integral of
fover the interval[_a, _b]using Richardson extrapolation applied to the Trapezoidal rule. It iteratively refines the interval width and the order of the polynomial approximation to achieve high precision with relatively few function evaluations.
- Source:
Parameters:
| Name | Type | Attributes | Default | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f |
function | The integrand function. Must accept a BigFloat argument (x) and return a BigFloat result (f(x)). |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
_a |
number | string | BigFloat | The lower limit of integration. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
_b |
number | string | BigFloat | The upper limit of integration. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
info |
Object |
<optional> |
{}
|
Configuration and Status object. Configures execution parameters and stores statistical data during/after execution. Properties
|
Returns:
Returns the BigFloat integral value if tolerances are met.
Returns null if max_step or max_time is reached without convergence.
- Type
- BigFloat | null
roots(_coeffs, infoopt) → {Array.<Complex>|null}
- Description:
Calculates the roots of a polynomial with high precision using the Durand-Kerner method.
This function mimics MATLAB's
rootscommand but supports arbitrary precision BigFloat numbers. It solves forxin the polynomial equation: c[0]*x^n + c[1]*x^(n-1) + ... + c[n] = 0The algorithm iterates simultaneously towards all
nroots, naturally handling complex conjugate pairs.
- Source:
Parameters:
| Name | Type | Attributes | Default | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
_coeffs |
Array.<(number|string|BigFloat|Complex)> | The polynomial coefficients. Must be ordered from highest degree to lowest (e.g., [1, -5, 6] for x^2 - 5x + 6). Leading zeros are automatically removed. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
info |
Object |
<optional> |
{}
|
Configuration and Status object.
Properties
|
Returns:
Returns an array of objects representing complex numbers {re, im}.
Returns null if the solver fails to converge within limits.
- Type
- Array.<Complex> | null
round(v, precopt) → {BigFloat}
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
v |
BigFloat | number | string | bigint | |||
prec |
number |
<optional> |
0
|
Returns:
- Type
- BigFloat
scalar(s) → {Scalar}
Parameters:
| Name | Type | Description |
|---|---|---|
s |
number | bigint | string | BigFraction | BigFloat | Complex | Scalar |
Returns:
- Type
- Scalar
setGcEleLimit(l)
Parameters:
| Name | Type | Description |
|---|---|---|
l |
number |
setGlobalFlag(f)
Parameters:
| Name | Type | Description |
|---|---|---|
f |
number |
setPrecision(p)
Parameters:
| Name | Type | Description |
|---|---|---|
p |
number |
setThrowExceptionOnInvalidOp(f)
Parameters:
| Name | Type | Description |
|---|---|---|
f |
boolean |
shanks(f, infoopt) → {BigFloat|null}
- Description:
High-precision Sequence Limit using Wynn's Epsilon Algorithm (Shanks Transformation).
This function estimates the limit of a sequence
f(n)asnapproaches infinity. It is particularly effective for accelerating the convergence of slowly converging alternating series or sequences.
- Source:
Parameters:
| Name | Type | Attributes | Default | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
info |
Object |
<optional> |
{}
|
Configuration and Status object. Properties
|
Returns:
Returns the BigFloat limit value if tolerances are met, or null otherwise.
- Type
- BigFloat | null
sign(v, precopt) → {BigFloat}
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
v |
BigFloat | number | string | bigint | |||
prec |
number |
<optional> |
0
|
Returns:
- Type
- BigFloat
sin(v, precopt) → {BigFloat}
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
v |
BigFloat | number | string | bigint | |||
prec |
number |
<optional> |
0
|
Returns:
- Type
- BigFloat
solveLinearSystem(A, b) → {Array.<BigFloat>}
- Description:
Helper: Solve Ax = b using Gaussian Elimination with Partial Pivoting
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
A |
Array.<Array.<BigFloat>> | Matrix (modified in place) |
b |
Array.<BigFloat> | Vector (modified in place) |
Returns:
x - Solution vector
- Type
- Array.<BigFloat>
sqrt(v, precopt) → {BigFloat}
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
v |
BigFloat | number | string | bigint | |||
prec |
number |
<optional> |
0
|
Returns:
- Type
- BigFloat
tan(v, precopt) → {BigFloat}
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
v |
BigFloat | number | string | bigint | |||
prec |
number |
<optional> |
0
|
Returns:
- Type
- BigFloat
trunc(v, precopt) → {BigFloat}
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
v |
BigFloat | number | string | bigint | |||
prec |
number |
<optional> |
0
|
Returns:
- Type
- BigFloat
zeta(s, aopt) → {Complex}
- Description:
Computes the Riemann Zeta function ζ(s) or Hurwitz Zeta function ζ(s, a).
Logic:
- Handle pole at s = 1.
- If Re(s) < 0 and a = 1, use the Reflection Formula to mirror into the right half-plane.
- Handle specific Hurwitz reductions (e.g., a = 0.5).
- Use the Euler-Maclaurin summation formula for high-precision results.
- Source:
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
s |
Complex | number | BigFloat | The complex exponent. |
||
a |
Complex | number | BigFloat |
<optional> |
1
|
The shift parameter (default is 1 for Riemann Zeta). |
Returns:
- Type
- Complex