StatusMany more functions will be added to this module. The naming convention for the distribution functions (gammaIncomplete, etc) is not yet finalized and will probably change.
Sourcestd/mathspecial.d
gamma(realx);| x | Γ(x) |
|---|---|
| NAN | NAN |
| ±0.0 | ±∞ |
| integer > 0 | (x-1)! |
| integer < 0 | NAN |
| +∞ | +∞ |
| -∞ | NAN |
logGamma(realx);| x | logGamma(x) |
|---|---|
| NAN | NAN |
| integer <= 0 | +∞ |
| ±∞ | +∞ |
sgnGamma(realx);realx | the argument of Γ |
NoteThis function can be used in conjunction withlogGamma to evaluate Γ(x) whengamma(x) is too large to be represented as areal.
writeln(sgnGamma(10_000));// 1
beta(realx, realy);realx | the first argument of B |
realy | the second argument of B |
| x | y | beta(x, y) |
|---|---|---|
| NAN | y | NAN |
| -∞ | y | NAN |
| integer < 0 | y | NAN |
| noninteger and x+y even ≤ 0 | noninteger | -0 |
| noninteger and x+y odd ≤ 0 | noninteger | +0 |
| +0 | positive finite | +∞ |
| +0 | +∞ | NAN |
| > 0 | +∞ | +0 |
| -0 | +0 | NAN |
| -0 | > 0 | -∞ |
| noninteger < 0, ⌈x⌉ odd | +∞ | -∞ |
| noninteger < 0, ⌈x⌉ even | +∞ | +∞ |
| noninteger < 0 | ±0 | ±∞ |
writeln(beta(1, 2));// 0.5
digamma(realx);x))realx | the domain value |
| x | digamma(x) |
|---|---|
| integer < 0 | NAN |
| ±0.0 | ∓∞ |
| +∞ | +∞ |
| -∞ | NAN |
| NAN | NAN |
const euler = 0.57721_56649_01532_86060_65121L;assert(isClose(digamma(1), -euler));writeln(digamma(+0.));// -real.infinitywriteln(digamma(-0.));// +real.infinitywriteln(digamma(+real.infinity));// +real.infinityassert(isNaN(digamma(-1)));assert(isNaN(digamma(-real.infinity)));
logmdigamma(realx);logmdigammaInverse(realx);betaIncomplete(reala, realb, realx);betaIncompleteInverse(reala, realb, realy);gammaIncomplete(reala, realx);gammaIncompleteCompl(reala, realx);gammaIncompleteComplInverse(reala, realp);erf(realx);erfc(realx);normalDistribution(realx);Referenceshttp://www.netlib.org/cephes/ldoubdoc.html, G. Marsaglia, "Evaluating the Normal Distribution", Journal of Statistical Software11, (July 2004).
normalDistributionInverse(realp);NoteThis function is only implemented to 80 bit precision.