Re: Interval Arithmetic project



----- Original Message ----- 
From: "Raymond Toy" <raymond.toy at ericsson.com>
To: "Richard Fateman" <fateman at EECS.Berkeley.EDU>
Cc: "Robert Dodier" <robert.dodier at gmail.com>; <maxima at math.utexas.edu>
Sent: Wednesday, May 03, 2006 8:27 AM
Subject: Re: Interval Arithmetic project


>>>>>> "Richard" == Richard Fateman <fateman at EECS.Berkeley.EDU> writes:
>
>    Richard> Actually, copying down the rules for   <interval> 
> [op]<interval>  from
>    Richard> some text  or reference work is not hard. In fact, it should 
> be
>    Richard> possible to copy it out of a program or just use existing lisp
>    Richard> code.  There are some subtleties regarding rounding at
>
> CMUCL has such interval code, which SBCL has inherited.  It used to be
> mostly separatable, but is now kind of mashed into CMUCL internals.
> It doesn't, however, do any kind of directed rounding, mostly because
> the interval code handles rationals, single-floats, and double-floats,
> all via numeric contagion.

Directed rounding is not needed for rationals.  It is needed for floats,
otherwise you lose the inclusion property for interval arithmetic, and
you can no longer make the strong claims about the interval result
containing the actual answer.

>
>    Richard> The difficult part is integrating into maxima the rules that
>    Richard> violate the conventions already in maxima, such as
>
>    Richard> x-x -->  0  for all x.
>
>    Richard> This is false for intervals.
>
> What is the result?  [-eps, eps], where eps is a floating-point
> precision of some sort?
>

No,  interval(-1, 1)   - interval(-1,1)  means { x-y |   x is in [-1,1], and 
y is in [-1,1]}
The smallest value in this set is when x=-1, y=1:  -1 - 1 = -2.
The largest value is when x=1, y=-1:  1 - (-1)  or 2.  So

interval(-1,1) - interval(-1,1)  -->  interval(-2,2).

One could try to make a distinction between two intervals that 
coincidentally
have the same endpoints, or two pointers to the same interval. In the latter
case, one could argue that x and y are not independently chosen from [-1,1]
but are the same.  then the set is  {x-x | ....}  and is {0}.

 I suppose one could view every variable as an interval, and the
ones we have been using so far are the intervals with zero width, and
try to make sense of it all.  It works if all the arithmetic is done on
explicit intervals.  If we introduce symbols and do arithmetic like
x-y ,  or x-x,  or x/x,  or   is (x=x)   then there is trouble.

Oh, x-x --> 0   is also false for IEEE float NaN,   Inf, too.

RJF