Stan Math Library
5.0.0
Automatic Differentiation
|
|
inline |
Return the falling factorial function evaluated at the inputs.
Will throw for NaN x and for negative n
T | Type of x argument. |
x | Argument. |
n | Argument |
std::domain_error | if x is NaN |
std::domain_error | if n is negative |
\[ \mbox{falling\_factorial}(x, n) = \begin{cases} \textrm{error} & \mbox{if } x \leq 0\\ (x)_n & \mbox{if } x > 0 \textrm{ and } -\infty \leq n \leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN or } n = \textrm{NaN} \end{cases} \]
\[ \frac{\partial\, \mbox{falling\_factorial}(x, n)}{\partial x} = \begin{cases} \textrm{error} & \mbox{if } x \leq 0\\ \frac{\partial\, (x)_n}{\partial x} & \mbox{if } x > 0 \textrm{ and } -\infty \leq n \leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN or } n = \textrm{NaN} \end{cases} \]
\[ \frac{\partial\, \mbox{falling\_factorial}(x, n)}{\partial n} = \begin{cases} \textrm{error} & \mbox{if } x \leq 0\\ \frac{\partial\, (x)_n}{\partial n} & \mbox{if } x > 0 \textrm{ and } -\infty \leq n \leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN or } n = \textrm{NaN} \end{cases} \]
\[ (x)_n=\frac{\Gamma(x+1)}{\Gamma(x-n+1)} \]
\[ \frac{\partial \, (x)_n}{\partial x} = (x)_n\Psi(x+1) \]
\[ \frac{\partial \, (x)_n}{\partial n} = -(x)_n\Psi(n+1) \]
Definition at line 64 of file falling_factorial.hpp.