-, _negate

Negative of an expression

Use only in the MuPAD Notebook Interface.

This functionality does not run in MATLAB.

Syntax

- x
_negate(x)

Description

- x computes the negative of x.

-x is equivalent to the function call _negate(x). Both calls represent the inverse of the element x of an additive group.

The negative of a number of type Type::Numeric is also a number.

If x is an element of a domain that does not have the _negate method (slot), MuPAD® internally represents -x as x*(-1) = _mult(x, -1).

If x is an element of a domain that has the _negate method (slot), MuPAD uses this method to compute -x.

The difference x - y is equivalent to x + (-y) = _plus (x, _negate(y)).

The negative of a polynomial of type DOM_POLY produces a polynomial. The coefficients of the resulting polynomial are the negatives of the original coefficients.

For finite sets, -X is the set .

Examples

Example 1

Compute the negatives of the following expressions. The negative of an expression is the inverse with respect to + (_plus):

x - x = x + _negate(x)

-1 + x - 2*x + 23

Example 2

Internally, MuPAD represents -x as _mult(x, -1):

type(-x), op(-x, 0), op(-x, 1), op(-x, 2)

Example 3

Compute the negative of a polynomial. The result is a polynomial with the coefficients that are the negatives of the coefficients of the original polynomial:

-poly(x^2 + x - 1, [x])

-poly(x, [x], Dom::Integer)

Example 4

Compute the negative of a finite set. For finite sets, -X is the set :

-{a, b, c}

Example 5

Various library domains such as matrix domains or residue class domains overload _negate:

x := Dom::Matrix(Dom::IntegerMod(7))([2, 10]): x, -x, x + (-x)

delete x:

Parameters

x

An arithmetical expression, a polynomial of type DOM_POLY, or a set

Return Values

Arithmetical expression, a polynomial, or a set.

Overloaded By

x

See Also

MuPAD Functions

Was this topic helpful?