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

◆ log() [7/8]

template<typename T , require_stan_scalar_or_eigen_t< T > * = nullptr>
auto stan::math::log ( const var_value< T > &  a)
inline

Return the natural log of the specified variable (cmath).

The derivative is defined by

\(\frac{d}{dx} \log x = \frac{1}{x}\).

\[ \mbox{log}(x) = \begin{cases} \textrm{NaN} & \mbox{if } x < 0\\ \ln(x) & \mbox{if } x \geq 0 \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{log}(x)}{\partial x} = \begin{cases} \textrm{NaN} & \mbox{if } x < 0\\ \frac{1}{x} & \mbox{if } x\geq 0 \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

Template Parameters
TArithmetic or a type inheriting from EigenBase.
Parameters
aVariable whose log is taken.
Returns
Natural log of variable.

Definition at line 51 of file log.hpp.