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.
Dom::Interval(l
,r
) Dom::Interval([l]
,r
) Dom::Interval(l
,[r]
) Dom::Interval([l]
,[r]
) Dom::Interval([l, r]
)
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.
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
Standard functions are overloaded to work with intervals.
sin(B), float(sin(B))
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)

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

The right border. If given as a list of one element (the right border), the interval will be created as right closed. 
"one"  the unit element; it equals the onepoint interval [1, 1]. 
"zero"  the zero element; it equals the onepoint interval [0, 0]. 
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.