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

◆ sqrt() [8/10]

var stan::math::sqrt ( const var a)
inline

Return the square root of the specified variable (cmath).

The derivative is defined by

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

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

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

Parameters
aVariable whose square root is taken.
Returns
Square root of variable.

Definition at line 45 of file sqrt.hpp.