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

◆ log() [5/7]

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

Return the natural logarithm of the arithmetic argument.

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

Return the natural logarithm of the complex argument.

Template Parameters
VArithmetic argument
Parameters
[in]xargument
Returns
natural logarithm of the argument
Template Parameters
Vcomplex<Arithmetic> argument
Parameters
[in]xargument
Returns
natural logarithm of the argument

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 27 of file log.hpp.