DIGAMMA
The digamma function is the first logarithmic derivative of the gamma function and appears in optimization, Bayesian updates, and asymptotic expansions involving gamma terms.
It is defined as:
\psi(x)=\frac{d}{dx}\ln\Gamma(x)
This wrapper evaluates the real-valued digamma function using SciPy’s implementation.
Excel Usage
=DIGAMMA(x)
x(float, required): Real argument for the digamma function.
Returns (float): Digamma function value at the input.
Example 1: Digamma at one
Inputs:
| x |
|---|
| 1 |
Excel formula:
=DIGAMMA(1)
Expected output:
-0.577216
Example 2: Digamma at two
Inputs:
| x |
|---|
| 2 |
Excel formula:
=DIGAMMA(2)
Expected output:
0.422784
Example 3: Digamma at positive fraction
Inputs:
| x |
|---|
| 0.5 |
Excel formula:
=DIGAMMA(0.5)
Expected output:
-1.96351
Example 4: Digamma at larger positive input
Inputs:
| x |
|---|
| 10 |
Excel formula:
=DIGAMMA(10)
Expected output:
2.25175
Python Code
from scipy.special import digamma as scipy_digamma
def digamma(x):
"""
Compute the digamma function for a real input.
See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.special.digamma.html
This example function is provided as-is without any representation of accuracy.
Args:
x (float): Real argument for the digamma function.
Returns:
float: Digamma function value at the input.
"""
try:
return float(scipy_digamma(x))
except Exception as e:
return f"Error: {str(e)}"Online Calculator
Real argument for the digamma function.