next | previous | forward | backward | up | top | index | toc | Macaulay2 web site
Macaulay2Doc > The Macaulay2 language > operators > -

- -- a unary or binary operator, usually used for negation or subtraction

Synopsis

Description

In most cases, this operator refers to standard negation or subtraction.

In many cases, the integer 1 can be used as the identity, and scalars function as multiples of the identity. For example, the 1 below refers to the identity matrix and the 2 to twice the identity matrix.

i1 : M = matrix{{1,2,3},{2,3,4},{3,4,6}}

o1 = | 1 2 3 |
     | 2 3 4 |
     | 3 4 6 |

              3        3
o1 : Matrix ZZ  <--- ZZ
i2 : M-1, M-2

o2 = (| 0 2 3 |, | -1 2 3 |)
      | 2 2 4 |  | 2  1 4 |
      | 3 4 5 |  | 3  4 4 |

o2 : Sequence

See also

Ways to use - :

For the programmer

The object - is a keyword.

This operator may be used as a binary operator in an expression like x-y. The user may install binary methods for handling such expressions with code such as

         X - Y := (x,y) -> ...

where X is the class of x and Y is the class of y.

This operator may be used as a prefix unary operator in an expression like -y. The user may install a method for handling such expressions with code such as

           - Y := (y) -> ...

where Y is the class of y.