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

◆ beta() [1/13]

template<typename T >
fvar< T > stan::math::beta ( const fvar< T > &  x1,
const fvar< T > &  x2 
)
inline

Return fvar with the beta function applied to the specified arguments and its gradient.

The beta function is defined for \(a > 0\) and \(b > 0\) by

\(\mbox{B}(a, b) = \frac{\Gamma(a) \Gamma(b)}{\Gamma(a+b)}\).

\[ \mbox{beta}(\alpha, \beta) = \begin{cases} \int_0^1 u^{\alpha - 1} (1 - u)^{\beta - 1} \, du & \mbox{if } \alpha, \beta>0 \\[6pt] \textrm{NaN} & \mbox{if } \alpha = \textrm{NaN or } \beta = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{beta}(\alpha, \beta)}{\partial \alpha} = \begin{cases} \left(\psi(\alpha)-\psi(\alpha+\beta)\right)*\mbox{beta}(\alpha, \beta) & \mbox{if } \alpha, \beta>0 \\[6pt] \textrm{NaN} & \mbox{if } \alpha = \textrm{NaN or } \beta = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{beta}(\alpha, \beta)}{\partial \beta} = \begin{cases} \left(\psi(\beta)-\psi(\alpha+\beta)\right)*\mbox{beta}(\alpha, \beta) & \mbox{if } \alpha, \beta>0 \\[6pt] \textrm{NaN} & \mbox{if } \alpha = \textrm{NaN or } \beta = \textrm{NaN} \end{cases} \]

Template Parameters
Tinner type of the fvar
Parameters
x1First value
x2Second value
Returns
Fvar with result beta function of arguments and gradients.

Definition at line 51 of file beta.hpp.