Documentation Center

  • Trial Software
  • Product Updates

Type::Real

Type and property representing real numbers

Use only in the MuPAD Notebook Interface.

This functionality does not run in MATLAB.

Syntax

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

Description

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.

Examples

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

getprop(sin(x))

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?