Property representing intervals

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.


Type::Interval(a, b, <ndomain>)
Type::Interval([a], b, <ndomain>)
Type::Interval(a, [b], <ndomain>)
Type::Interval([a], [b], <ndomain>)
Type::Interval([a, b], <ndomain>)


Type::Interval(a, b, ...) represents the interval .

Type::Interval([a], b, ...) represents the interval .

Type::Interval(a, [b], ...) represents the interval .

Type::Interval([a], [b], ...) represents the interval .

Type::Interval([a, b], ...) represents the interval .

With the default domain Type::Real, the type object created by Type::Interval represents a real interval, i.e., the set of all real numbers between the border points a and b. If another domain is specified, then the type object represents the intersection of the real interval with the set represented by the domain. E.g., Type::Interval(a, b, Type::Rational) represents the set of all rational numbers between a and b, and Type::Interval([a, b], Type::Residue(0, 2)) represents the set of all even integers between a and b including a and b.

The type object represents a property that may be used in assume and is. With

assume(x, Type::Interval(a, b, ndomain))

the identifier x is marked as a number from the interval represented by the type object. With

is(x, Type::Interval(a, b, ndomain))

one queries, whether x is contained in the interval.

Interval types should not be used in testtype. No MuPAD® object matches these types syntactically, i.e., testtype always returns FALSE.


Example 1

The following type object represents the open interval (- 1, 1):

Type::Interval(-1, 1)

The following calls are equivalent: both create the type representing a closed interval:

Type::Interval([-1], [1]), Type::Interval([-1, 1])

The following call creates the type representing the set of all integers from -10 to 10:

Type::Interval([-10, 10], Type::Integer)

The following call creates the type representing the set of all rational numbers in the interval :

Type::Interval([0], 1, Type::Rational)

The following calls create the types representing the sets of all even/odd integers in the interval :

Type::Interval([-10], [10], Type::Even),
Type::Interval([-10], [10], Type::Odd)

Example 2

We use intervals as a property. The following call marks x as a real number from the interval :

assume(x, Type::Interval([0], 2)):

Consequently, x2 + 1 lies in the interval :

is(x^2 + 1 >= 1), is(x^2 + 1 < 5)

The following call marks x as an integer larger than -10 and smaller than 100:

assume(x, Type::Interval(-10, 100, Type::Integer)):

Consequently, x3 is an integer larger than -730 and smaller than 970300:

is(x^3, Type::Integer), is(x^3 >= -729), is(x^3 < 970300),
is(x^3, Type::Interval(-10^3, 100^3, Type::Integer))

is(x <= -730), is(x^3 >= 970300)

is(x > 0), is(x^3, Type::Interval(0, 10, Type::Integer))



a, b

The borders of the interval: arithmetical objects


A type object such as Type::Real, Type::Integer or Type::Rational representing a subset of the real numbers or a property representing a residue class as Type::Residue(0, 2). The default domain is Type::Real.

Return Values

Type object