# Dom::Interval

Intervals of real numbers

### Use only in the MuPAD Notebook Interface.

This functionality does not run in MATLAB.

## 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].

expand all

## Mathematical Methods

### `Im` — Imaginary part of an interval (this always equals zero)

`Im(interval)`

### `Re` — Real part of an interval (this is the interval)

`Re(interval)`

### `_divide` — Divide intervals

`_divide(interval1, interval2)`

### `_intersect` — Intersection of sets

Inherited from `Cat::Set`.

### `_invert` — Invert intervals

`_invert(interval)`

### `_minus` — Set of subtractions

Inherited from `Cat::Set`.

### `_mult` — Set of product of set elements

Inherited from `Cat::Set`.

### `_negate` — Negate intervals

`_negate(interval)`

### `_plus` — Set of sums of set elements

Inherited from `Cat::Set`.

### `_power` — Pointwise power

Inherited from `Cat::Set`.

### `_union` — Union of sets

Inherited from `Cat::Set`.

### `abs` — Absolute value of intervals

`abs(interval)`

### `arccos` — Inverse cosine of intervals

`arccos(interval)`

### `arccosh` — Area cosine of intervals

`arccosh(interval)`

### `arccot` — Inverse cotangent of intervals

`arccot(interval)`

### `arccoth` — Area cotangent of intervals

`arccoth(interval)`

### `arcsin` — Inverse sine of intervals

`arcsin(interval)`

### `arcsinh` — Area sine of intervals

`arcsinh(interval)`

### `arctan` — Inverse tangent of intervals

`arctan(interval)`

### `arctanh` — Area tangent of intervals

`arctanh(interval)`

### `contains` — Containing an element

`contains(interval, element)`

### `cos` — Cosinu of intervals

`cos(interval)`

### `cosh` — Hyperbolic cosinus of intervals

`cosh(interval)`

### `cot` — Cotangent of intervals

`cot(interval)`

### `coth` — Hyperbolic cotangent of intervals

`coth(interval)`

### `dirac` — Dirac distribution of an interval

`dirac(interval)`

### `exp` — Exponential function of an interval

`exp(interval)`

### `heaviside` — Heaviside function

`heaviside(interval)`

### `ln` — Natural logarithm of an interval

`ln(interval)`

### `max` — Maximum of an 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` — Minimum of an interval

`min(interval, …)`

The minimum of intervals is defined analogously to their maximum.

### `new` — Create an interval

`new(left, right)`

`new([left], right)`

`new(left, [right])`

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

### `sign` — Signum of an interval

`sign(interval)`

### `sin` — Sine of intervals

`sin(interval)`

### `sinh` — Hyperbolic sine of intervals

`sinh(interval)`

### `tan` — Tangent of intervals

`tan(interval)`

### `tanh` — Hyperbolic tangent of intervals

`tanh(interval)`

## Access Methods

### `borders` — Border of an interval

`borders(interval)`

### `left` — Left border of an interval

`left(interval)`

### `leftB` — Left border of an interval

`leftB(interval)`

### `isleftopen` — Left open interval

`isleftopen(interval)`

### `isrightopen` — Right open interval

`isrightopen(interval)`

### `iszero` — Null interval

`iszero(interval)`

### `op` — Operand (borders) of an interval

`op(interval)`

### `subs` — Substitution in intervals

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

### `subsleft` — Substitute left border

`subsleft(interval, left)`

### `subsright` — Substitute right border

`subsright(interval, right)`

### `subsvals` — Substitute both borders

`subsvals(interval, left, right)`

## Conversion Methods

### `convert` — Converting objects to intervals

`convert(object)`

If the conversion fails, `FAIL` is returned.

### `float` — Convert to floating-point interval

`float(interval)`

### `getElement` — One element of an interval

`getElement(interval)`

### `simplify` — Simplify intervals

`simplify(interval)`

## Technical Methods

### `emptycheck` — Check intervals

`emptycheck(interval)`

### `equal` — Comparison of intervals

`equal(interval, interval)`

### `map` — Apply functions to intervals

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

### `mapBorders` — Apply functions to the borders of an interval

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

### `print` — Printing intervals

`print(interval)`

### `random` — Random interval

`random()`

### `zip` — Combine intervals

`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.