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

◆ pow() [8/11]

template<typename Scal1 , typename Scal2 , require_any_var_t< base_type_t< Scal1 >, base_type_t< Scal2 > > * = nullptr, require_all_stan_scalar_t< Scal1, Scal2 > * = nullptr>
auto 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} \]

Template Parameters
Scal1Either a var, arithmetic, or complex type with an inner var or arithmetic type.
Scal2Either a var, arithmetic, or complex type with an inner var or arithmetic type.
Parameters
baseBase variable.
exponentExponent variable.
Returns
Base raised to the exponent.

Definition at line 75 of file pow.hpp.