This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.


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


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


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

The call testtype(obj, Type::Real) checks, whether obj is a real number and, if it is, returns TRUE, otherwise FALSE.

testtype only performs a syntactical test identifying MuPAD® objects of type DOM_INT, DOM_RAT and DOM_FLOAT. This does not include arithmetical expressions such as exp(1), which are not identified as of type Type::Real.

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

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

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


Example 1

The following numbers are of type Type::Real:

testtype(2, Type::Real),
testtype(3/4, Type::Real),
testtype(0.123, Type::Real),
testtype(-1, Type::Real),
testtype(-1.02, Type::Real)

The following expressions are exact representations of real numbers, but syntactically they are not of Type::Real:

testtype(exp(1), Type::Real),
testtype(PI^2 + 5, Type::Real),
testtype(sin(2), Type::Real)

The function is performs a semantical, mathematically more useful check:

is(exp(1), Type::Real),
is(PI^2 + 5, Type::Real),
is(sin(2), Type::Real)

Example 2

Integers are real numbers:

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

But real numbers can be integer or not:

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

The sine of a real number is a real number in the interval [- 1, 1]:


delete x:



Any MuPAD object


An identifier or a mathematical expression containing identifiers


An arithmetical expression

Return Values

See testtype, assume and is

See Also

MuPAD Functions

Was this topic helpful?