Documentation Center

  • Trial Software
  • Product Updates

Type::Negative

Type and property representing negative numbers

Use only in the MuPAD Notebook Interface.

This functionality does not run in MATLAB.

Syntax

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

Description

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

Examples

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:

Parameters

obj

Any MuPAD object

x

An identifier or a mathematical expression containing identifiers

ex

An arithmetical expression

Return Values

See testtype, assume and is

See Also

MuPAD Functions

Was this topic helpful?