Negative
Negative
Negative[ expr ] applies the minus sign to an expression.
Usages
Negative[ expr ]
Negative[ expr ] represents -expr. Writing -x in a script gives the same result as Negative[x]. For a positive number, the minus sign is applied directly; otherwise the expression is kept as Negative[ expr ] and displayed with a minus sign.
| Example | in | out |
|---|---|---|
| A positive integer. | Negative[ 3 ] |
-3 |
| A positive decimal number. | Negative[ 2.5 ] |
-2.5 |
| An expression is kept as it is. | Negative[ Pi ] |
Negative[Pi] |
-x is the same as Negative[x]. |
-x |
Negative[x] |
| A list: each element is negated. | Negative[ {1, 2} ] |
{-1, -2} |
| Example | in | rendered |
|---|---|---|
The constant -π. |
Negative[ Pi ] |
|
A product with -π. |
3 Negative[ Pi ] |
|
| A sum with a negative number is displayed as a subtraction. | x + Negative[3] |
Details
- Double minus:
Negative[ -3 ]is not simplified to3; it staysNegative[-3]. Numericalcalculates the value:Numerical[ Negative[Pi] ]gives-3.14159265359.