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

◆ operator-() [13/18]

var stan::math::operator- ( const var a,
const var b 
)
inline

Subtraction operator for variables.

The partial derivatives are defined by

\(\frac{\partial}{\partial x} (x-y) = 1\), and

\(\frac{\partial}{\partial y} (x-y) = -1\).

\[ \mbox{operator-}(x, y) = \begin{cases} x-y & \mbox{if } -\infty\leq x, y \leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN or } y = \textrm{NaN} \end{cases} \]

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

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

Template Parameters
Var1value type of a var
Var2value type of a var
Parameters
aFirst variable operand.
bSecond variable operand.
Returns
Variable result of subtracting the second variable from the first.

Definition at line 56 of file operator_subtraction.hpp.