Previous Page Next Page Contents

Dom::Interval -- intervals of real numbers

Introduction

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

Introduction

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.

Creating Elements

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

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.

Categories

Cat::Set

, Cat::AbelianMonoid

Related Domains

Type::Interval

Details

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

Method Im: the imaginary part of an interval (this always equals zero)

Method Re: the real part of an interval (this is the interval)

Method contains: containing an element

Method max: maximum of an interval

Method min: minimum of an interval

Method new: create an interval

Method borders: the borders of an interval

Method left: the left border of an interval

Method leftB: the left border of an interval

Method isleftopen: a left open interval

Method isrightopen: a right open interval

Method iszero: null interval

Method op: the operands (borders) of an interval

Method subs: substitution in intervals

Method subsleft: substitute left border

Method subsright: substitute right border

Method subsvals: substitute both borders

Method convert: converting objects to intervals

Method expr: convert intervals to expressions

Method float: convert to floating point interval

Method getElement: one element of an interval

Method simplify: simplify intervals

Method emptycheck: check intervals

Method equal: comparison of intervals

Method map: apply functions to intervals

Method mapBorders: apply functions to the borders of an interval

Method print: printing intervals

Method random: random interval

Method zip: combine intervals

Example 1

First create a closed interval between 0 and 1.

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

Now another open interval between -1 and 1.

>> B:= Dom::Interval(-1, 1)
                                  ]-1, 1[

Intervals can be handled like other objects.

>> A + B, A - B, A*B, A/B
       ]-1, 2[, ]-1, 2[, ]-1, 1[, ]0, infinity[ union ]-infinity, 0[
>> 2*A, 1 - A, (A - 1)^2
                          [0, 2], [0, 1], [0, 1]

Example 2

Standard functions are overloaded to work with intervals.

>> sin(B), float(sin(B))
             ]-sin(1), sin(1)[, ]-0.8414709848, 0.8414709848[

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)
                                  0, [0]
>> Dom::Interval::isleftopen(A), Dom::Interval::subsleft(A, -1)
                              FALSE, [-1, 1]

Super-Domain

Dom::BaseDomain

Changes




Do you have questions or comments?


Copyright © SciFace Software GmbH & Co. KG 2000