Documentation

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::Rational

Type and property representing rational 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.

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?