Documentation Center

  • Trial Software
  • Product Updates

Type::Rational

Type and property representing rational numbers

Use only in the MuPAD Notebook Interface.

This functionality does not run in MATLAB.

Syntax

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

Description

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

The call testtype(obj, Type::Rational) checks, whether obj is a 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.

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

The call is(ex, Type::Rational) derives, whether the expression ex is a 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::Rational:

testtype(2, Type::Rational),
testtype(3/4, Type::Rational),
testtype(-1/2, Type::Rational),
testtype(-1, Type::Rational),
testtype(1024/11111, Type::Rational)

Example 2

Integers are rational:

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

However, rational numbers can be integer or not:

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

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?