# Documentation

### This is machine translation

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

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

# `Dom`::`Interval`

Intervals of 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.

## Syntax

```Dom::Interval(`l`, `r`)
Dom::Interval(`[l]`, `r`)
Dom::Interval(`l`, `[r]`)
Dom::Interval(`[l]`, `[r]`)
Dom::Interval(`[l, r]`)
```

## Description

`Dom::Interval` represents the set of all intervals of real numbers.

`Dom::Interval(l, r)` creates the interval of all real numbers between `l` and `r`. If a border is given as a list with `l` or `r` as the sole element, this border will be regarded as a closed border, otherwise the interval does not contain `l` and `r`.

A border can be any arithmetical expression that could represent a real number, e.g., `sqrt(2*x)` and ```a + I```. Properties are ignored.

The domain `Dom::Interval` provides fundamental operations to combine intervals with intervals and other mathematical objects.

The return value can be either an interval of type `Dom::Interval` or the empty set of type `DOM_SET`, if the interval is empty.

Most mathematical operations are overloaded to work with intervals (such as `sin`). If f is a function of n real variables, its extension to intervals is defined to be . The return value of such an operation is in most cases an interval, a union of intervals, a `Dom::ImageSet` or a set. For example, the sine of an interval ```[a, b]``` is the interval `{sin(x), x in [a, b]}` that contains all sine values of the given interval. In general, you should expect the return value to be an interval larger than strictly necessary. Also note that, when using the same interval twice in one formula, the uses are regarded as independent, so `interval1/interval1` does not return the interval `[1, 1]` as you might expect.

The functions overloaded in this way are:

Furthermore, an interval is a special type of set. This is reflected by `Dom::Interval` having the category `Cat::Set`. Among the methods inherited from `Cat::Set`, the following are especially important: `intersect`, `minus` and `union`.

An interval can be open or closed. If one border is given as a list with one element `[x]`, then this element `x` is taken as border and the interval will be created as closed at this side. If the interval should be closed at both sides, one list with the both borders as arguments can be given.

## Superdomain

`Dom::BaseDomain`

## Examples

### Example 1

First create a closed interval between `0` and `1`.

`A:= Dom::Interval([0], [1])`

Now another open interval between `-1` and `1`.

`B:= Dom::Interval(-1, 1)`

Intervals can be handled like other objects.

`A + B, A - B, A*B, A/B`

`2*A, 1 - A, (A - 1)^2`

### Example 2

Standard functions are overloaded to work with intervals.

`sin(B), float(sin(B))`

### Example 3

The next examples shows some technical methods to access and manipulate intervals.

Get the borders and open/closed information about intervals.

```A:= Dom::Interval([0], [1]): Dom::Interval::left(A), Dom::Interval::leftB(A)```

`Dom::Interval::isleftopen(A), Dom::Interval::subsleft(A, -1)`

## Parameters

 `l` The left border. If given as a list of one element (the left border), the interval will be created as left closed. `r` The right border. If given as a list of one element (the right border), the interval will be created as right closed.

## Entries

 "one" the unit element; it equals the one-point interval [1, 1]. "zero" the zero element; it equals the one-point interval [0, 0].

## Methods

expand all

#### Mathematical Methods

`Im(interval)`

`Re(interval)`

`_divide(interval1, interval2)`

Inherited from `Cat::Set`.

`_invert(interval)`

Inherited from `Cat::Set`.

Inherited from `Cat::Set`.

`_negate(interval)`

Inherited from `Cat::Set`.

Inherited from `Cat::Set`.

Inherited from `Cat::Set`.

`abs(interval)`

`arccos(interval)`

`arccosh(interval)`

`arccot(interval)`

`arccoth(interval)`

`arcsin(interval)`

`arcsinh(interval)`

`arctan(interval)`

`arctanh(interval)`

`contains(interval, element)`

`cos(interval)`

`cosh(interval)`

`cot(interval)`

`coth(interval)`

`dirac(interval)`

`exp(interval)`

`heaviside(interval)`

`ln(interval)`

`max(interval, …)`

The maximum of intervals is the set of all possible results of the function `max` when applied to a sequence of arguments consisting of exactly one element of each interval.

`min(interval, …)`

The minimum of intervals is defined analogously to their maximum.

`new(left, right)`

`new([left], right)`

`new(left, [right])`

`new([left], [right])`

`sign(interval)`

`sin(interval)`

`sinh(interval)`

`tan(interval)`

`tanh(interval)`

#### Access Methods

`borders(interval)`

`left(interval)`

`leftB(interval)`

`isleftopen(interval)`

`isrightopen(interval)`

`iszero(interval)`

`op(interval)`

```subs(Interval, equation, …)```

`subsleft(interval, left)`

`subsright(interval, right)`

`subsvals(interval, left, right)`

#### Conversion Methods

`convert(object)`

If the conversion fails, `FAIL` is returned.

`float(interval)`

`getElement(interval)`

`simplify(interval)`

#### Technical Methods

`emptycheck(interval)`

`equal(interval, interval)`

```map(interval, function, <argument, …>)```

```mapBorders(interval, function, <argument, …>)```

`print(interval)`

`random()`

`zip(interval, interval, function)`

## Algorithms

The operand of an object of `Dom::Interval` is an object of the domain `property::IVnat`, which realizes the basic interval arithmetic. This domain is not documented.