Function special::digamma [] [src]

pub fn digamma(x: f64) -> f64

Compute the real-valued digamma function.

The formula is as follows:

       d ln(Γ(x))
ψ(x) = ----------
           dx

where Γ is the gamma function. The computation is based on an approximation as described in the reference below.

Examples

use special::digamma;

const EULER_MASCHERONI: f64 = 0.57721566490153286060651209008240243104215933593992;
assert!((digamma(1.0) + EULER_MASCHERONI).abs() < 1e-15);

References

  1. M. J. Beal, Variational algorithms for approximate Bayesian inference. University of London, 2003, pp. 265–266.