# Approximation domains

DomainSets has its roots in the JuliaApproximation community. It is used for example in the packages ApproxFun and BasisFunctions.

## Approximation intervals

There are a number of stateless intervals (i.e. singleton types without data) to represent standard intervals used in approximation theory. The endpoints of these intervals are fixed and hence, at least in principle, known to the compiler.

`DomainSets.UnitInterval`

— Type```
UnitInterval()
UnitInterval{T=Float64}()
```

The closed unit interval `[0,1]`

.

`DomainSets.ChebyshevInterval`

— Type```
ChebyshevInterval()
ChebyshevInterval{T=Float64}()
```

The closed interval `[-1,1]`

.

`DomainSets.HalfLine`

— Type```
HalfLine()
HalfLine{T=Float64,C=:closed}()
```

The positive halfline `[0,∞)`

when `C`

is `:closed`

or `(0,∞)`

when `C`

is `:open`

. The interval is always open at infinity.

See also: `NonnegativeRealLine`

, `PositiveRealLine`

.

`DomainSets.NegativeHalfLine`

— Type```
NegativeHalfLine()
NegativeHalfLine{T=Float64,C=:closed}()
```

The negative halfline `(-∞,0]`

when `C`

is `:closed`

or `(-∞,0)`

when `C`

is `:open`

. The interval is always open at minus infinity.

See also: `NonpositiveRealLine`

, `NegativeRealLine`

.

The types are simple enough that some common set arithmetic operations retain their special structure:

```
julia> HalfLine() ∩ ChebyshevInterval()
0.0 .. 1.0 (Unit)
julia> NegativeHalfLine() \ UnitInterval()
-Inf .. 0.0 (open) (NegativeHalfLine)
```

## The unit cube and other cubes

The product domain associated with any of the fixed intervals remains stateless if the dimension is fixed as well:

```
julia> UnitInterval()^2
UnitSquare()
julia> ChebyshevInterval()^3
(-1.0 .. 1.0 (Chebyshev)) × (-1.0 .. 1.0 (Chebyshev)) × (-1.0 .. 1.0 (Chebyshev))
```

Some special cases are named.

`DomainSets.UnitSquare`

— Type```
UnitSquare()
UnitSquare{T=Float64}()
```

The domain $[0,1]^2$.

`DomainSets.UnitCube`

— Type```
UnitCube()
UnitCube(::Val{N=3})
UnitCube(dim::Int)
```

The `d`

-dimensional domain $[0,1]^d$.