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

◆ square() [6/7]

var stan::math::square ( const var x)
inline

Return the square of the input variable.

Using square(x) is more efficient than using x * x.

\[ \mbox{square}(x) = \begin{cases} x^2 & \mbox{if } -\infty\leq x \leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{square}(x)}{\partial x} = \begin{cases} 2x & \mbox{if } -\infty\leq x\leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

Parameters
xVariable to square.
Returns
Square of variable.

Definition at line 35 of file square.hpp.