This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

-, _negate

Negative of an expression

MuPAD® notebooks are not recommended. Use MATLAB® live scripts instead.

MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.


- x


- 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 .


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:



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

Return Values

Arithmetical expression, a polynomial, or a set.

Overloaded By


See Also

MuPAD Functions

Was this topic helpful?