View source code
Display the source code in std/mathspecial.d from which thispage was generated on github.
Report a bug
If you spot a problem with this page, click here to create aBugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page.Requires a signed-in GitHub account. This works well for small changes.If you'd like to make larger changes you may want to consider usinglocal clone.
Function std.mathspecial.digamma
Digamma function, Ψ(x)
real digamma(
real x
) pure nothrow @nogc @safe;
Ψ(x), is the logarithmic derivative of the gamma function, Γ(x).
Ψ(x) = d/dx ln|Γ(x)| (the derivative of logGamma(x))
Parameters
| Name | Description |
|---|---|
| x | the domain value |
Returns
It returns Ψ(x).
| x | digamma(x) |
|---|---|
| integer < 0 | NAN |
| ±0.0 | ∓∞ |
| +∞ | +∞ |
| -∞ | NAN |
| NAN | NAN |
See Also
Example
const euler = 0.57721_56649_01532_86060_65121L;
assert(isClose(digamma(1), -euler));
writeln(digamma(+0.)); // -real.infinity
writeln(digamma(-0.)); // +real.infinity
writeln(digamma(+real .infinity)); // +real.infinity
assert(isNaN(digamma(-1)));
assert(isNaN(digamma(-real .infinity)));
Authors
Stephen L. Moshier (original C code). Conversion to D by Don Clugston
License
Copyright © 1999-2026 by the D Language Foundation | Page generated by ddox.