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

◆ pow() [18/31]

template<typename Scal1 , typename Scal2 , require_any_st_var< Scal1, Scal2 > * = nullptr, require_all_stan_scalar_t< Scal1, Scal2 > * = nullptr>
var stan::math::pow ( const Scal1 &  base,
const Scal2 &  exponent 
)
inline

Return the base raised to the power of the exponent (cmath).

The partial derivatives are

\(\frac{\partial}{\partial x} \mbox{pow}(x, y) = y x^{y-1}\), and

\(\frac{\partial}{\partial y} \mbox{pow}(x, y) = x^y \ \log x\).

\[ \mbox{pow}(x, y) = \begin{cases} x^y & \mbox{if } -\infty\leq x, y \leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN or } y = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{pow}(x, y)}{\partial x} = \begin{cases} yx^{y-1} & \mbox{if } -\infty\leq x\leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN or } y = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{pow}(x, y)}{\partial y} = \begin{cases} x^y\ln x & \mbox{if } -\infty\leq x\leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN or } y = \textrm{NaN} \end{cases} \]

Parameters
baseBase variable.
exponentExponent variable.
Returns
Base raised to the exponent.

Definition at line 71 of file pow.hpp.