Home

Special Functions

This package provides a comprehensive collection of special functions based on the OpenSpecFun and OpenLibm libraries.

FunctionDescription
erf(x)error function at x
erfc(x)complementary error function, i.e. the accurate version of 1-erf(x) for large x
erfinv(x)inverse function to erf()
erfcinv(x)inverse function to erfc()
erfi(x)imaginary error function defined as -im * erf(x * im), where im is the imaginary unit
erfcx(x)scaled complementary error function, i.e. accurate exp(x^2) * erfc(x) for large x
dawson(x)scaled imaginary error function, a.k.a. Dawson function, i.e. accurate exp(-x^2) * erfi(x) * sqrt(pi) / 2 for large x
sinint(x)sine integral at x
cosint(x)cosine integral at x
digamma(x)digamma function (i.e. the derivative of lgamma at x)
eta(x)Dirichlet eta function at x
zeta(x)Riemann zeta function at x
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
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
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
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

Installation

The package is available for Julia versions 0.5 and up. To install it, run

Pkg.add("SpecialFunctions")

from the Julia REPL.

Note

Prior to Julia 0.6, most of these functions were available in Julia's Base module. Because of this, the symbols from this package are not exported on Julia 0.5 to avoid name conflicts. In this case, the symbols will need to be explicitly imported or called with the prefix SpecialFunctions. This is not necessary for Julia versions 0.6 and later.

On Julia 0.7, openspecfun is not build as part of Julia. Thus for Julia versions 0.7 and later, installing this package downloads openspecfun. Binaries of openspecfun are available for macOS, Windows, and Linux (glibc >= 2.6). Other systems will need to build the library from source. You can force a build from source by setting an environment variable called JULIA_SPECIALFUNCTIONS_BUILD_SOURCE equal to true before running Pkg.build. This ensures that the library is built locally from source, even if binaries are available. Doing this requires a C compiler (Clang on macOS and FreeBSD, GCC elsewhere) and gfortran. If you always want to build this library from source, consider adding

ENV["JULIA_SPECIALFUNCTIONS_BUILD_SOURCE"] = "true"

to your .juliarc.jl file.