diff --git a/src/Numerics/SpecialFunctions.cs b/src/Numerics/SpecialFunctions.cs
index 49947410..2b5a847c 100644
--- a/src/Numerics/SpecialFunctions.cs
+++ b/src/Numerics/SpecialFunctions.cs
@@ -244,6 +244,29 @@ namespace MathNet.Numerics
return result;
}
+ ///
+ /// Computes the inverse Digamma function: this is the inverse of the logarithm of the gamma function. This function will
+ /// only return solutions that are positive.
+ /// This implementation is based on the bisection method.
+ ///
+ /// The argument of the inverse digamma function.
+ /// The positive solution to the inverse DiGamma function at .
+ public static double DiGammaInv(double p)
+ {
+ if (Double.IsNaN(p))
+ {
+ return Double.NaN;
+ }
+
+ double x = Math.Exp(p);
+ for (double d = 1.0; d > 1.0e-15; d /= 2.0)
+ {
+ x += d * Math.Sign(p - DiGamma(x));
+ }
+
+ return x;
+ }
+
public static double IncompleteGamma(double x, double z, bool reg)
{
throw new NotImplementedException();