DOM_RAT

Rational Numbers

MuPAD® notebooks will be removed in a future release. 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.

Description

DOM_RAT is the data type of rational numbers.

Examples

Example 1

The operands of a rational number are its numerator and denominator:

op(2/3)

When substituting an operand, the resulting DOM_RAT is again normalized:

subsop(2/3, 2=6)

Function Calls

Using a rational number as a function returns that number unchanged. The function arguments are not evaluated.

Operations

Rational numbers are arithmetical expressions and therefore valid inputs to most MuPAD® functions.

The numerator and denominator of a rational number can be accessed using numer and denom or by using op directly.

Elements of DOM_RAT are always normalized, cf. Example 1.

Operands

A rational number has two operands, which are integers: Its numerator and its denominator.

Element Creation

The division of two integers results in an integer or a rational number.

See Also

MuPAD Domains