Type representing rational expressions

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.


testtype(obj, Type::RatExpr(indet, <coeff_type>))


With Type::RatExpr, rational expressions can be identified.

The call testtype(obj, Type::RatExpr(indet)) checks, whether obj is a rational expression in the indeterminante indet, i.e., the quotient of two polynomial expressions in indet. If it is, the result is TRUE, otherwise FALSE.

A rational expression in indet is a expression, and indet occurs only as operand of _plus or _mult expressions and in _power with an integer exponent.

indet must be an identifier, and coeff_type a type for the coefficients of the rational expression.

This type does not represent a property.


Example 1

A polynomial expression in x is also a rational expression in x:

testtype(-x^2 - x + 3, Type::RatExpr(x))

testtype is used to select all rational operands in x with positive integer coefficients:

EX := sin(x) + x^2 - 3*x + 2 + 3/x:
select(EX, testtype, Type::RatExpr(x, Type::PosInt))

delete EX:



Any MuPAD® object


An indeterminante


A type for the coefficientes; a type can be an object of the library Type or one of the possible return values of domtype and type

Return Values

See testtype

See Also

MuPAD Functions