Inervall Arithmetic

# Interval Arithmetic and Exact Computation

You learn how to do

- interval arithmetic,
- use the exact scalar product in basic form,
- how to obtain exact,
- and verified results.

## Interval Arithmetic

EULER can do interval arithmetic. Intervals are number ranges instead of single numbers. Intervals are entered in the form

        >~a,b~

or

        >interval(a,b)

which generates the closed interval [a,b], whenever a and b are two reals or real vectors. If a matrix contains an interval, the matrix will become an interval matrix. Complex intervals are not implemented.

You may also use the notation

        >~x~

if x is a real or a real matrix. In this case, EULER computes a small interval with non-empty interior, which contains x. Thus ~x,x~ is different from ~x~!

If x is alread of interval type, ~x~ will be identical to x.

You can do all basic and most other operations on intervals. E.g.,

       >~1,2~ * ~2,3~

is the interval of all s*t, where s in [1,2] and t in [2,3]. Thus [2,6]. An operation on one or several intervals results in an interval, which is guaranteed to contain all the possible results, if the operations is performed on all possible members of the intervals.

Some operations do not give the smallest possible interval. I traded speed for accuracy (e.g. sin and cos). However, they will give reasonable intervals for small input intervals. Some other functions do not work for interval input.

Special functions are

       >left(x)

and

       >right(x)

which give the right and left end of an interval.

       >middle(x)

is its middle point and

       >diameter(x)

its diameter. To compute the diameter of an interval vector, use

       >sqrt(sum(diameter(x)^2))

The function

       >expand(x,f)

will expand an interval x, such that the diameter becomes f times bigger. If x is not an interval and real, it will produce an interval with midpoint x and diameter 2*f.

You can, check if an interval is contained in another interval, using

       >x << y

This will return true (1), if the interval x is properly contained in the interval y.

       >x <<= y

tests for proper containment or equality.

You can intersect two intervals with

       >x && y

unless the intersection is empty. This would yield an error. The function

       >intersects(x,y)

tests for empty intersection. An interval containing the union of x and y is constructed with

       >x || y

## Exact Scalar Product

Sometimes it is necessary to compute with higher accuracy. E.g., the solution of a linear system A.x=b can be improved by computing the residuum r=A.x-b and iterating with x=x-A\r. However, this will work only if the residuum is computed with higher accuracy. You can do this in Euler with

        >r=residuum(A,x,b)

The result is exact up to the last digit. Just enter 0 for b, if you just want A.x.

The computation is done using a long accumulator. This is about 10 times slower than A.x-b. You can access the accumulator (two of them for complex values and intervals) directly with

        >accuload(v)

for any vector v. This will compute the exact value of sum(v). The accumulator is not cleared afterwards. You can add another vector with

        >accuadd(v)

Likewise,

        >accuload(v,w); accuadd(v1,w1),

will compute the scalar product of v and w and the scalar product of v1 and w1. These functions return the last value of the accumulator. You can transfer the complete accumulator into a vector with

        >h=accu();

(or accure, accuim, accua, accub for complex values and intervals). Then sum(h) is the value of the accumulator.

## Exact Solutions

There are several functions, which use the exact scalar product. Most are parallel to the less exact but faster counterparts. These functions are explained in the corresponding sections.

E.g., the function

        >xlgs(A,b)

produces an exact solution of the system Ax=b. You may add an additional maximal number of iterations.

## Guaranteed Inclusions

Euler provides some interval procedures, which produce guaranteed inclusions. The underlying algorithms may be found in the work of Rump, Alefeld, Herzberger and Moore. Please refer to the mathematical literature for more information.

        >y=idgl("f",x,y0);

y is then an inclusion of the solution of the differential equation y'=f(x,y). f must be an EULER function with two arguments like

        function f (x,y)
            return x*y;
        endfunction

The parameter x of idgl is a vector of grid points, where the solution is to be computed. The accuracy will depend on the step sizes in x. y0 is a start value at x[1]. The result y is a vector of interval values containing the solution. The function will work in several dimensions.

        >x=ilgs(A,b);
        >x=ilgs(A,b,R);

This is a linear system solver, producing an inclusion of the solution of Ax=b. You may provide a matrix R, which is close to the inverse of A. The procedure may fail.

        >iinv(A);

This produces an inclusion of the inverse of A.

        >ipolyval(p,t)

This computes an inclusion of the value of the polynomial p at t. t may be a vector as usual.

        >inewton("f","f1",~a,b~)

This is the interval Newton method. f must be a function and f1 its derivative. ~a,b~ is a starting interval, which must contain a zero. If it does not contain a zero, there will most probably occur an empty intersection. If the starting interval is replaced by a non-interval real number, the function calls the Newton method and expands the result to an interval, which is taken as a start interval. Of course, f1 must not be zero in ~a,b~. The function returns the inclusion interval and a flag, which is nonzero if the interval is a verified solution.

This function accepts expressions instead of functions. E.g.

        >inewton("x^2-2","2*x",~1,2~);

will compute an inclusion of sqrt(2).

        >newton2("f","f1",x);
        >inewton2("f","f1",x);

newton2 is the Newton method for several dimensions. f must be a function, which computes a 1xn vector f(x) from a 1xn vector x. f1(x) must procude the Jacobian matrix at x. inewton does the same, but produces an interval inclusion. The start interval vector x must contain a solution.