Dom::Interval
-- intervals of
real numbersDom::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.
Dom::Interval(l, r)
Dom::Interval([l], r)
Dom::Interval(l, [r])
Dom::Interval([l], [r])
Dom::Interval([l, r])
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. |
Cat::Set
Dom::Interval
creates real intervals. The domain
Dom::Interval
provides fundamental operations to combine
intervals with intervals and other mathematical objects.Dom::Interval
or the empty set of type DOM_SET
, if the interval is
empty.sin
). If f is a function of
n real variables, its extension to intervals is defined to
be f(J1, ..., Jn):= {f(j1, ...,
jn) ; ji ∈Ji }. 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:
Dom::Interval
having the category Cat::Set
. Among the methods inherited
from Cat::Set
, the following
are especially important: _intersect
, _minus
and _union
.[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.the unit element; it equals the one-point interval [1,1].
the zero element; it equals the one-point interval [0,0].
Im(dom interval)
Im
.Re(dom interval)
Re
.max(dom interval...)
max
.min(dom interval...)
min
.new(Type::Arithmetical left, Type::Arithmetical right)
new(Type::Arithmetical [left], Type::Arithmetical right)
new(Type::Arithmetical left, Type::Arithmetical [right])
new(Type::Arithmetical [left], Type::Arithmetical [right])
left
and right
.borders(dom interval)
left(dom interval)
leftB(dom interval)
isleftopen(dom interval)
TRUE
if the interval is left open.isrightopen(dom interval)
TRUE
if the interval is right
open.op(dom interval)
op
.subsleft(dom interval, Type::Arithmetical left)
interval
by
left
. If the border will be given as list with one
element, the border will be taken as closed.subsright(dom interval, Type::Arithmetical right)
interval
by right
. If the border will be given as list with one
element, the border will be taken as closed.subsvals(dom interval, Type::Arithmetical left, Type::Arithmetical right)
interval
. The
call is the same as in "subsleft"
and
"subsright"
.convert(Any object)
object
to an interval.
Objects that can be converted are numbers, sets, properties, and arbitrary
expressions.FAIL
is returned.expr(dom interval)
expr(dom interval, ident x)
x in
interval
.getElement(dom interval)
simplify(dom interval)
simplify
.emptycheck(dom interval)
map(dom interval, Type::Function function <Any
argument...>)
function
to the given
interval. Additional arguments argument... are passed to the given
function (see map
). The
return value is a Dom::ImageSet
(which may simplify to a
set or a Dom::Interval
).map
.mapBorders(dom interval, Type::Function function <Any
argument...>)
function
to the borders of
interval
. If additional arguments are given,
function
is called with these as second, third, etc.
argument.print(dom interval)
print
.random()
zip(dom interval, dom
interval, Type::Function function)
zip
.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]
Standard functions are overloaded to work with intervals.
>> sin(B), float(sin(B))
]-sin(1), sin(1)[, ]-0.8414709848, 0.8414709848[
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]
Dom::Interval
was complete reorganized
internally.