Type::NonNegRat

Type and property representing nonnegative rational numbers

Use only in the MuPAD Notebook Interface.

This functionality does not run in MATLAB.

Syntax

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

Description

Type::NonNegRat represents nonnegative rational numbers. Type::NonNegRat is a property, too, which can be used in an assume call.

The call testtype(obj, Type::NonNegRat) checks, whether obj is a nonnegative rational number and returns TRUE, if it holds, otherwise FALSE.

testtype only performs a syntactical test identifying MuPAD® objects of type DOM_INT and DOM_RAT and checks, if bool(obj >= 0) holds.

The call assume(x, Type::NonNegRat) marks the identifier x as a nonnegative rational number.

The call is(ex, Type::NonNegRat) derives, whether the expression ex is a nonnegative rational number (or this property can be derived).

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

Examples

Example 1

The following numbers are of type Type::NonNegRat:

testtype(2, Type::NonNegRat),
testtype(3/4, Type::NonNegRat),
testtype(55/111, Type::NonNegRat),
testtype(0, Type::NonNegRat),
testtype(111/111111, Type::NonNegRat)

Example 2

Assume an identifier is nonnegative rational:

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

Also nonnegative rational numbers are rational:

assume(x, Type::NonNegRat):
is(x, Type::Rational)

However, rational numbers can be nonnegative rational or not:

assume(x, Type::Rational):
is(x, Type::NonNegRat)

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?