Automatic Differentiation
 
Loading...
Searching...
No Matches

◆ digamma() [4/7]

double stan::math::digamma ( double  x)
inline

Return the derivative of the log gamma function at the specified value.

\[ \mbox{digamma}(x) = \begin{cases} \textrm{error} & \mbox{if } x\in \{\dots, -3, -2, -1, 0\}\\ \Psi(x) & \mbox{if } x\not\in \{\dots, -3, -2, -1, 0\}\\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{digamma}(x)}{\partial x} = \begin{cases} \textrm{error} & \mbox{if } x\in \{\dots, -3, -2, -1, 0\}\\ \frac{\partial\, \Psi(x)}{\partial x} & \mbox{if } x\not\in \{\dots, -3, -2, -1, 0\}\\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

\[ \Psi(x)=\frac{\Gamma'(x)}{\Gamma(x)} \]

\[ \frac{\partial \, \Psi(x)}{\partial x} = \frac{\Gamma''(x)\Gamma(x)-(\Gamma'(x))^2}{\Gamma^2(x)} \]

The design follows the standard C++ library in returning NaN rather than throwing exceptions.

Parameters
[in]xargument
Returns
derivative of log gamma function at argument

Definition at line 47 of file digamma.hpp.