Stan Math Library
4.9.0
Automatic Differentiation
|
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} \]
a | Variable whose square root is taken. |