Skip to main content

Special Functions

Erf(z:complex)

Evaluate to the error function of a complex number.

The error function is an odd function (

 \operatorname{erf} -z = -
\operatorname{erf} z
) that is used in statistics to calculate probabilities of normally distributed events.

The formula for the error function of a complex number is:

\operatorname{erf} z = \frac{2}{\sqrt{\pi}} \int_0^z e^{-t^2} dt

where z is a complex number.

Erfc(z:complex)

Evaluate to the complementary error function of a complex number.

It is defined as \operatorname{erfc} z = 1 - \operatorname {erf} z.

ErfInv(x:real)

Evaluate to the inverse error function of a real number -1 < x < 1

It is defined as

\operatorname{erf} \left(\operatorname{erf} ^{-1}x\right)
= x
.

Factorial(n)

n!
$$$n!$$
["Factorial", 5]
// -> 120

Factorial2(n)

The double factorial of n:

 n!! = n \cdot (n-2) \cdot (n-4) \times
\cdots
, that is the product of all the positive integers up to n that have the same parity (odd or even) as n.

n!!
$$$n!!$$
["Factorial2", 5]
// -> 15

It can also be written in terms of the \Gamma function:

n!! = 2^{\frac{n}{2}+\frac{1}{4}(1-\cos(\pi n))}\pi^{\frac{1}{4}(\cos(\pi
n)-1)}\Gamma\left(\frac{n}{2}+1\right)

This is not the same as the factorial of the factorial of n (i.e. ((n!)!)).

Reference

Gamma(z)

\\Gamma(n) = (n-1)!
$$$\\Gamma(n) = (n-1)!$$

The Gamma Function is an extension of the factorial function, with its argument shifted by 1, to real and complex numbers.

\operatorname{\Gamma}\left(z\right) = \int\limits_{0}^{\infty} t^{z-1}
\mathrm{e}^{-t} \, \mathrm{d}t
["Gamma", 5]
// 24

GammaLn(z)

\\ln(\\Gamma(z))
$$$\\ln(\\Gamma(z))$$

This function is called gammaln in MatLab and SciPy and LogGamma in Mathematica.

Zeta(s)

\\zeta(s)
$$$\\zeta(s)$$

The Riemann zeta function, defined for complex numbers with real part greater than 1 as:

\zeta(s) = \sum_{n=1}^{\infty} \frac{1}{n^s}

and extended to other values by analytic continuation.

["Zeta", 2]
// ➔ π²/6

Beta(a, b)

\\Beta(a, b)
$$$\\Beta(a, b)$$

The Euler beta function, defined as:

\operatorname{B}(a, b) = \frac{\Gamma(a)\Gamma(b)}{\Gamma(a+b)}

It can also be expressed as an integral:

\operatorname{B}(a, b) = \int_0^1 t^{a-1}(1-t)^{b-1} \, dt
["Beta", 2, 3]
// ➔ 1/12

LambertW(x)

\\operatorname{W}(x)
$$$\\operatorname{W}(x)$$

The Lambert W function, also called the product logarithm. It is the inverse function of f(w) = w e^w.

For a given value x, W(x) is the value w such that w e^w = x.

The derivative of the Lambert W function is:

\frac{d}{dx} W(x) = \frac{W(x)}{x(1 + W(x))}
["LambertW", 1]
// ➔ Ω ≈ 0.5671 (the Omega constant)

Bessel Functions

Bessel functions are solutions to Bessel's differential equation:

x^2 \frac{d^2 y}{dx^2} + x \frac{dy}{dx} + (x^2 - n^2)y = 0

They arise in problems with cylindrical or spherical symmetry.

BesselJ(n, x)

J_n(x)
$$$J_n(x)$$

The Bessel function of the first kind of order n.

The derivative with respect to x is:

\frac{d}{dx} J_n(x) = \frac{1}{2}(J_{n-1}(x) - J_{n+1}(x))
["BesselJ", 0, 1]
// ➔ J₀(1) ≈ 0.7652

BesselY(n, x)

Y_n(x)
$$$Y_n(x)$$

The Bessel function of the second kind of order n, also called the Neumann function.

The derivative with respect to x is:

\frac{d}{dx} Y_n(x) = \frac{1}{2}(Y_{n-1}(x) - Y_{n+1}(x))
["BesselY", 0, 1]
// ➔ Y₀(1) ≈ 0.0883

BesselI(n, x)

I_n(x)
$$$I_n(x)$$

The modified Bessel function of the first kind of order n.

The derivative with respect to x is:

\frac{d}{dx} I_n(x) = \frac{1}{2}(I_{n-1}(x) + I_{n+1}(x))
["BesselI", 0, 1]
// ➔ I₀(1) ≈ 1.2661

BesselK(n, x)

K_n(x)
$$$K_n(x)$$

The modified Bessel function of the second kind of order n, also called the MacDonald function.

The derivative with respect to x is:

\frac{d}{dx} K_n(x) = -\frac{1}{2}(K_{n-1}(x) + K_{n+1}(x))
["BesselK", 0, 1]
// ➔ K₀(1) ≈ 0.4210

Airy Functions

Airy functions are solutions to the Airy differential equation:

\frac{d^2 y}{dx^2} - xy = 0

They arise in physics, particularly in quantum mechanics and optics.

AiryAi(x)

\\operatorname{Ai}(x)
$$$\\operatorname{Ai}(x)$$

The Airy function of the first kind.

It is the solution to the Airy equation that decays exponentially for positive x and oscillates for negative x.

["AiryAi", 0]
// ➔ 1/(3^(2/3) Γ(2/3)) ≈ 0.3550

AiryBi(x)

\\operatorname{Bi}(x)
$$$\\operatorname{Bi}(x)$$

The Airy function of the second kind.

It is the solution to the Airy equation that grows exponentially for positive x and oscillates for negative x.

["AiryBi", 0]
// ➔ 1/(3^(1/6) Γ(2/3)) ≈ 0.6149