Mathematical Special Functions
The technical term 'Special Functions' includes several families of transcendental functions, which have important applications in particular branches of mathematics and physics.
The gamma and related functions, and the error function are crucial for mathematical statistics. The Bessel and related functions arise in problems involving wave propagation (especially in optics). Other major categories of special functions include the elliptic integrals (related to the arc length of an ellipse), and the hypergeometric functions.
The Gamma function, Γ(
x) is a generalisation of the factorial function to real and complex numbers. Like
x * Γ(
Mathematically, if z.re > 0 then Γ(z) = ∫0∞ tz-1e-t dt
| || Γ(
|integer > 0|| (
|integer < 0||NAN|
Natural logarithm of the gamma function, Γ(
Returns the base e (2.718...) logarithm of the absolute value of the gamma function of the argument.
logGamma is equivalent to log(fabs(gamma(
|integer <= 0||+∞|
The sign of Γ(
Returns -1 if Γ(
x) < 0, +1 if Γ(
x) > 0, NAN if sign is indeterminate.
Note that this function can be used in conjunction with logGamma(
x) to evaluate gamma for very large values of
beta function is defined as
y) = (Γ(
x) * Γ(
y)) / Γ(
digamma function is the logarithmic derivative of the gamma function.
x) = d/dx logGamma(
Log Minus Digamma function
x) = log(
x) - digamma(
Inverse of the Log Minus Digamma function
Given y, the function finds
x such log(
x) - digamma(
x) = y.
Incomplete beta integral
Returns incomplete beta integral of the arguments, evaluated from zero to
x. The regularized incomplete beta function is defined as
x) = Γ(
b) / ( Γ(
b) ) * ∫0
and is the same as the the cumulative distribution function.
The domain of definition is 0 <=
x <= 1. In this implementation
b are restricted to positive values. The integral from
x to 1 may be obtained by the symmetry relation
x ) =
The integral is evaluated by
a continued fraction expansion or, when
x is small, by
a power series.
Inverse of incomplete beta integral
y, the function finds x such that
b, x) ==
Newton iterations or interval halving is used.
Incomplete gamma integral and its complement
These functions are defined by
gammaIncomplete = ( ∫0
x e-t t
a-1 dt )/ Γ(
x) = 1 -
x) = (∫
x∞ e-t t
a-1 dt )/ Γ(
In this implementation both arguments must be positive. The integral is evaluated by either
a power series or continued fraction expansion, depending on the relative values of
Inverse of complemented incomplete gamma integral
p, the function finds x such that
a, x ) =
The integral is
x) = 2/ √(π) ∫0
x exp( - t2) dt
The magnitude of
x is limited to about 106.56 for IEEE 80-bit arithmetic; 1 or -1 is returned outside this range.
Complementary error function
x) = 1 - erf(
x) = 2/ √(π) ∫
x∞ exp( - t2) dt
This function has high relative accuracy for values of
x far from zero. (For values near zero, use erf(
Normal distribution function.
The normal (or Gaussian, or bell-shaped) distribution is defined as:
x) = 1/√(2π) ∫-∞
x exp( - t2/2) dt = 0.5 + 0.5 * erf(
x/sqrt(2)) = 0.5 * erfc(-
To maintain accuracy at values of
x near 1.0, use
x) = 1.0 -
Inverse of Normal distribution function
Returns the argument, x, for which the area under the Normal probability density function (integrated from minus infinity to x) is equal to
© 1999–2017 The D Language Foundation
Licensed under the Boost License 1.0.