besselI
Compute the modified Bessel function of the first kind I_n(x). The order n must be a non-negative integer.
Type Signatures
number, number
Parameters
Name Type Description
n number The order (non-negative integer)
x number The argument
Returns
number — The modified Bessel function value I_n(x)
Examples
besselI(0 0) besselI(0 1) besselI(1
besselJ
Compute the Bessel function of the first kind J_n(x). The order n must be a non-negative integer.
Type Signatures
number, number
Parameters
Name Type Description
n number The order (non-negative integer)
x number The argument
Returns
number — The Bessel function value J_n(x)
Examples
besselJ(0 0) besselJ(0 1) besselJ(1
besselK
Compute the modified Bessel function of the second kind K_n(x). Only valid for x > 0. Returns Infinity for x = 0.
Type Signatures
number, number
Parameters
Name Type Description
n number The order (non-negative integer)
x number The argument (must be > 0)
Returns
number — The modified Bessel function value K_n(x)
Examples
besselK(0 1) besselK(1 1) besselK(2
besselY
Compute the Bessel function of the second kind Y_n(x). Only valid for x > 0. Returns -Infinity for x = 0.
Type Signatures
number, number
Parameters
Name Type Description
n number The order (non-negative integer)
x number The argument (must be > 0)
Returns
number — The Bessel function value Y_n(x)
Examples
besselY(0 1) besselY(1 2.5) besselY(0
beta
Compute the Beta function B(a, b) = Gamma(a) * Gamma(b) / Gamma(a + b). Both parameters must be positive.
Type Signatures
number, number
Parameters
Name Type Description
a number First parameter (positive)
b number Second parameter (positive)
Returns
number — The Beta function value B(a, b)
Examples
beta(1 1) beta(2 3) beta(0.5
betainc
Compute the regularized incomplete beta function I_x(a, b). x must be in [0, 1], a and b must be positive. Returns values in [0, 1].
Syntax
betainc(x | a | b)
Type Signatures
number, number, number
Parameters
Name Type Description
x number The upper limit (must be in [0, 1])
a number First shape parameter (positive)
b number Second shape parameter (positive)
Returns
number — The regularized incomplete beta function value I_x(a, b)
Examples
betainc(0 2 3) betainc(1 2
chebyshevT
Evaluate the Chebyshev polynomial of the first kind T_n(x) using the three-term recurrence: T_0=1, T_1=x, T_{n+1}=2*x*T_n - T_{n-1}. n must be a non-negative integer.
Type Signatures
number, number
Parameters
Name Type Description
n number The degree, a non-negative integer
x number The argument
Returns
number — The value of the Chebyshev polynomial T_n(x)
Examples
chebyshevT(0 0.5) chebyshevT(1 0.5) chebyshevT(2
cosIntegral
Compute the cosine integral Ci(x) = gamma + ln(x) + integral from 0 to x of (cos(t)-1)/t dt, where gamma is the Euler-Mascheroni constant. Defined for x > 0.
Parameters
Name Type Description
x number A positive real number
Returns
number — The cosine integral Ci(x)
Examples
cosIntegral(1) cosIntegral(2) cosIntegral(pi)
digamma
Compute the digamma (psi) function, the logarithmic derivative of the gamma function: psi(x) = d/dx ln(Gamma(x)). Has poles at non-positive integers.
Parameters
Name Type Description
x number The argument
Returns
number — The digamma function value psi(x)
Examples
digamma(1) digamma(2) digamma(0.5) digamma(10)
ellipticE
Compute the complete elliptic integral of the second kind E(m), where m is the parameter (m = k^2). Uses the Arithmetic-Geometric Mean algorithm.
Parameters
Name Type Description
m number The parameter, 0 <= m <= 1
Returns
number — The complete elliptic integral E(m)
Examples
ellipticE(0) ellipticE(0.5) ellipticE(1)
ellipticK
Compute the complete elliptic integral of the first kind K(m), where m is the parameter (m = k^2). Uses the Arithmetic-Geometric Mean algorithm.
Parameters
Name Type Description
m number The parameter, 0 <= m < 1
Returns
number — The complete elliptic integral K(m)
Examples
ellipticK(0) ellipticK(0.5) ellipticK(0.9)
erf
Compute the erf function of a value using a rational Chebyshev approximations for different intervals of x
Parameters
Name Type Description
x number | Array | Matrix A real number
Returns
number | Array | Matrix — The erf of `x`
Examples
erf(0.2) erf(-0.5) erf(4)
erfc
Compute the complementary error function erfc(x) = 1 - erf(x). Computed directly to avoid cancellation for large x.
Parameters
Name Type Description
x number A real number
Returns
number — The complementary error function value erfc(x)
Examples
erfc(0) erfc(1) erfc(-1) erfc(Infinity)
erfi
Compute the imaginary error function erfi(x) = -i * erf(ix) = (2/sqrt(pi)) * integral from 0 to x of exp(t^2) dt. Unlike erf, erfi is unbounded.
Parameters
Name Type Description
x number A real number
Returns
number — The imaginary error function value erfi(x)
Examples
erfi(0) erfi(1) erfi(-1) erfi(0.5)
expIntegralEi
Compute the exponential integral Ei(x) = -P.V. integral from -x to infinity of e^(-t)/t dt.
Parameters
Name Type Description
x number A nonzero real number
Returns
number — The exponential integral Ei(x)
Examples
expIntegralEi(1) expIntegralEi(2) expIntegralEi(-1)
fresnelC
Compute the Fresnel cosine integral C(x) = integral from 0 to x of cos(pi * t^2 / 2) dt. Approaches 0.5 as x -> Infinity.
Parameters
Name Type Description
x number A real number
Returns
number — The Fresnel cosine integral C(x)
Examples
fresnelC(0) fresnelC(1) fresnelC(-1) fresnelC(Infinity)
fresnelS
Compute the Fresnel sine integral S(x) = integral from 0 to x of sin(pi * t^2 / 2) dt. Approaches 0.5 as x -> Infinity.
Parameters
Name Type Description
x number A real number
Returns
number — The Fresnel sine integral S(x)
Examples
fresnelS(0) fresnelS(1) fresnelS(-1) fresnelS(Infinity)
gammainc
Compute the regularized lower incomplete gamma function P(a, x) = gamma(a, x) / Gamma(a). a must be positive, x must be non-negative.
Type Signatures
number, number
Parameters
Name Type Description
a number The shape parameter (positive)
x number The upper limit (non-negative)
Returns
number — The regularized lower incomplete gamma P(a, x)
Examples
gammainc(1 0) gammainc(1 1) gammainc(2
gammaincp
Compute the regularized upper incomplete gamma function Q(a, x) = 1 - P(a, x) = Gamma(a, x) / Gamma(a). a must be positive, x must be non-negative.
Type Signatures
number, number
Parameters
Name Type Description
a number The shape parameter (positive)
x number The lower limit (non-negative)
Returns
number — The regularized upper incomplete gamma Q(a, x)
Examples
gammaincp(1 0) gammaincp(1 1) gammaincp(2
hermiteH
Type Signatures
number, number
Parameters
Name Type Description
n number The degree, a non-negative integer
x number The argument
Returns
number — The value of the Hermite polynomial H_n(x)
Examples
hermiteH(0 1) hermiteH(1 1) hermiteH(2
laguerreL
Evaluate the Laguerre polynomial L_n(x) using the recurrence: L_0=1, L_1=1-x, (n+1)*L_{n+1}=(2n+1-x)*L_n - n*L_{n-1}. n must be a non-negative integer.
Type Signatures
number, number
Parameters
Name Type Description
n number The degree, a non-negative integer
x number The argument
Returns
number — The value of the Laguerre polynomial L_n(x)
Examples
laguerreL(0 1) laguerreL(1 1) laguerreL(2
lambertW
Compute the Lambert W function W(x), the principal branch W_0. W(x) satisfies W(x)*exp(W(x)) = x. Defined for x >= -1/e.
Parameters
Name Type Description
x number A real number >= -1/e
Returns
number — The Lambert W function value W(x)
Examples
lambertW(0) lambertW(1) lambertW(exp(1))
legendreP
Evaluate the Legendre polynomial P_n(x) using Bonnet\
Type Signatures
number, number
Parameters
Name Type Description
n number The degree, a non-negative integer
x number The argument, typically in [-1, 1]
Returns
number — The value of the Legendre polynomial P_n(x)
Examples
legendreP(0 0.5) legendreP(1 0.5) legendreP(2
logIntegral
Compute the logarithmic integral li(x) = integral from 0 to x of 1/ln(t) dt. Computed via li(x) = Ei(ln(x)). Returns -Infinity at x=1. Defined for x > 0.
Parameters
Name Type Description
x number A real number greater than 1 (or between 0 and 1)
Returns
number — The logarithmic integral li(x)
Examples
logIntegral(2) logIntegral(10) logIntegral(100)
sinIntegral
Compute the sine integral Si(x) = integral from 0 to x of sin(t)/t dt. Approaches pi/2 as x -> Infinity.
Parameters
Name Type Description
x number A real number
Returns
number — The sine integral Si(x)
Examples
sinIntegral(0) sinIntegral(1) sinIntegral(pi)
zeta
Compute the Riemann Zeta Function using an infinite series and Riemann\
Parameters
Name Type Description
s number | Complex | BigNumber A Real, Complex or BigNumber parameter to the Riemann Zeta Function
Returns
number | Complex | BigNumber — The Riemann Zeta of `s`
Examples
zeta(0.2) zeta(-0.5) zeta(4)