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

◆ tgamma() [6/7]

var stan::math::tgamma ( const var a)
inline

Return the Gamma function applied to the specified variable (C99).

The derivative with respect to the argument is

\(\frac{d}{dx} \Gamma(x) = \Gamma(x) \Psi^{(0)}(x)\)

where \(\Psi^{(0)}(x)\) is the digamma function.

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

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

\[ \Gamma(x)=\int_0^{\infty} u^{x - 1} \exp(-u) \, du \]

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

Parameters
aArgument to function.
Returns
The Gamma function applied to the specified argument.

Definition at line 48 of file tgamma.hpp.