## `Type::Interval` -- a property representing intervals

#### Introduction

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

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

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

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

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

#### Call(s)

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

#### Parameters

`a, b` | - | the borders of the interval: arithmetical objects
`domain` | - | a type object such as `Type::Real`, `Type::Integer` or `Type::Rational` representing a subset of the real numbers. The default domain is `Type::Real`.

#### Returns

a `Type` object

#### Related Functions

`assume`, `is`, `testtype`, `Type::Integer`, `Type::Rational`, `Type::Real`

#### Details

- 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`.
- The type object represents a property that may be used in `assume` and `is`. With

  `assume(x, Type::Interval(a, b, domain))`

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

  `is(x, Type::Interval(a, b, domain))`

  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)

                               ]-1, 1[ of Type::Real

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

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

                   [-1, 1] of Type::Real, [-1, 1] of Type::Real

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

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

                            [-10, 10] of Type::Integer

The following call creates the type representing the set of all rational numbers in the interval [0,1):

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

                             [0, 1[ of Type::Rational

#### Example 2

We use intervals as a property. The following call marks x as a real number from the interval [0, 2):

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

Consequently, x^2 + 1 lies in the interval [1, 5):

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

                                    TRUE, TRUE

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

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

Consequently, x^3 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))

                              TRUE, TRUE, TRUE, TRUE

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

                                   FALSE, FALSE

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

                                 UNKNOWN, UNKNOWN

    >> unassume(x):

#### Changes

- the internal structure was revised completely
- the output is changed

Do you have questions or comments?
Copyright © SciFace Software GmbH & Co. KG 2000