Functions

Here the Special Functions are listed according to the structure of NIST Digital Library of Mathematical Functions.

Gamma Function

FunctionDescription
gamma(z)gamma function $\Gamma(z)$
loggamma(x)accurate log(gamma(x)) for large x
logabsgamma(x)accurate log(abs(gamma(x))) for large x
logfactorial(x)accurate log(factorial(x)) for large x; same as loggamma(x+1) for x > 1, zero otherwise
digamma(x)digamma function (i.e. the derivative of loggamma at x)
invdigamma(x)invdigamma function (i.e. inverse of digamma function at x using fixed-point iteration algorithm)
trigamma(x)trigamma function (i.e the logarithmic second derivative of gamma at x)
polygamma(m,x)polygamma function (i.e the (m+1)-th derivative of the loggamma function at x)
gamma(a,z)upper incomplete gamma function $\Gamma(a,z)$
loggamma(a,z)accurate log(gamma(a,x)) for large arguments
gamma_inc(a,x,IND)incomplete gamma function ratio P(a,x) and Q(a,x) (i.e evaluates P(a,x) and Q(a,x)for accuracy specified by IND and returns tuple (p,q))
gamma_inc_inv(a,p,q)inverse of incomplete gamma function ratio P(a,x) and Q(a,x) (i.e evaluates x given P(a,x)=p and Q(a,x)=q
beta(x,y)beta function at x,y
logbeta(x,y)accurate log(beta(x,y)) for large x or y
logabsbeta(x,y)accurate log(abs(beta(x,y))) for large x or y
logabsbinomial(x,y)accurate log(abs(binomial(n,k))) for large n and k near n/2
beta_inc(a,b,x,y)incomplete beta function ratio Ix(a,b) and Iy(a,b) (i.e evaluates Ix(a,b) and Iy(a,b) and returns tuple (p,q))
beta_inc_inv(a,b,p,q)Inverse of the incomplete beta function (i.e evaluates x given $I_{x}(a, b) = p$)

Exponential and Trigonometric Integrals

FunctionDescription
expint(ν, z)exponential integral $\operatorname{E}_\nu(z)$
expinti(x)exponential integral $\operatorname{Ei}(x)$
expintx(x)scaled exponential integral $e^z \operatorname{E}_\nu(z)$
sinint(x)sine integral $\operatorname{Si}(x)$
cosint(x)cosine integral $\operatorname{Ci}(x)$

Error Functions, Dawson’s and Fresnel Integrals

FunctionDescription
erf(x)error function at $x$
erf(x,y)accurate version of $\operatorname{erf}(y) - \operatorname{erf}(x)$
erfc(x)complementary error function, i.e. the accurate version of $1-\operatorname{erf}(x)$ for large $x$
erfcinv(x)inverse function to erfc()
erfcx(x)scaled complementary error function, i.e. accurate $e^{x^2} \operatorname{erfc}(x)$ for large $x$
logerfc(x)log of the complementary error function, i.e. accurate $\operatorname{ln}(\operatorname{erfc}(x))$ for large $x$
logerfcx(x)log of the scaled complementary error function, i.e. accurate $\operatorname{ln}(\operatorname{erfcx}(x))$ for large negative $x$
erfi(x)imaginary error function defined as $-i \operatorname{erf}(ix)$
erfinv(x)inverse function to erf()
dawson(x)scaled imaginary error function, a.k.a. Dawson function, i.e. accurate $\frac{\sqrt{\pi}}{2} e^{-x^2} \operatorname{erfi}(x)$ for large $x$
faddeeva(x)Faddeeva function, equivalent to $\operatorname{erfcx}(-ix)$
FunctionDescription
airyai(z)Airy Ai function at z
airyaiprime(z)derivative of the Airy Ai function at z
airybi(z)Airy Bi function at z
airybiprime(z)derivative of the Airy Bi function at z
airyaix(z), airyaiprimex(z), airybix(z), airybiprimex(z)scaled Airy Ai function and kth derivatives at z

Bessel Functions

FunctionDescription
besselj(nu,z)Bessel function of the first kind of order nu at z
besselj0(z)besselj(0,z)
besselj1(z)besselj(1,z)
besseljx(nu,z)scaled Bessel function of the first kind of order nu at z
sphericalbesselj(nu,z)Spherical Bessel function of the first kind of order nu at z
bessely(nu,z)Bessel function of the second kind of order nu at z
bessely0(z)bessely(0,z)
bessely1(z)bessely(1,z)
besselyx(nu,z)scaled Bessel function of the second kind of order nu at z
sphericalbessely(nu,z)Spherical Bessel function of the second kind of order nu at z
besselh(nu,k,z)Bessel function of the third kind (a.k.a. Hankel function) of order nu at z; k must be either 1 or 2
hankelh1(nu,z)besselh(nu, 1, z)
hankelh1x(nu,z)scaled besselh(nu, 1, z)
hankelh2(nu,z)besselh(nu, 2, z)
hankelh2x(nu,z)scaled besselh(nu, 2, z)
besseli(nu,z)modified Bessel function of the first kind of order nu at z
besselix(nu,z)scaled modified Bessel function of the first kind of order nu at z
besselk(nu,z)modified Bessel function of the second kind of order nu at z
besselkx(nu,z)scaled modified Bessel function of the second kind of order nu at z
jinc(x)scaled Bessel function of the first kind divided by x. A.k.a. sombrero or besinc

Elliptic Integrals

FunctionDescription
ellipk(m)complete elliptic integral of 1st kind $K(m)$
ellipe(m)complete elliptic integral of 2nd kind $E(m)$
FunctionDescription
eta(x)Dirichlet eta function at x
zeta(x)Riemann zeta function at x