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.


Type and property representing negative numbers

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.


testtype(obj, Type::Negative)
assume(x, Type::Negative)
is(ex, Type::Negative)


Type::Negative represents negative numbers. Type::Negative is a property, too, which can be used in an assume call.

The call testtype(obj, Type::Negative) checks, whether obj is a negative real number and returns TRUE, if it holds, otherwise FALSE.

testtype only performs a syntactical test identifying MuPAD® objects of type DOM_INT, DOM_RAT and DOM_FLOAT and checks, if bool(obj < 0) holds. This does not include arithmetical expressions such as -exp(1), which are not identified as of type Type::Negative.

The call assume(x, Type::Negative) marks the identifier x as a negative real number.

The call is(ex, Type::Negative) derives, whether the expression ex is a negative real number (or this property can be derived).

This type represents a property that can be used in assume and is.

Instead of Type::Negative the assumption can also be assume(x < 0).


Example 1

The following numbers are of type Type::Negative:

testtype(-2, Type::Negative),
testtype(-3/4, Type::Negative),
testtype(-0.123, Type::Negative),
testtype(-1, Type::Negative),
testtype(-1.02, Type::Negative)

The following expressions are exact representations of negative numbers, but syntactically they are not of Type::Negative:

testtype(-exp(1), Type::Negative),
testtype(-PI^2 - 5, Type::Negative),
testtype(-sin(2), Type::Negative)

Example 2

Assume an identifier is negative:

assume(x, Type::Negative):
is(x, Type::Negative)

This is equal to:

assume(x < 0):
is(x < 0)

Also negative numbers are real:

assume(x, Type::Negative):
is(x, Type::Real)

However, real numbers can be negative or not:

assume(x, Type::Real):
is(x, Type::Negative)

delete x:



Any MuPAD object


An identifier or a mathematical expression containing identifiers


An arithmetical expression

Return Values

See testtype, assume and is

See Also

MuPAD Functions

Was this topic helpful?