How Can I Use plot2d code for presence of singularities?



On 1/3/2013 9:41 AM, Henry Baker wrote:
> This is why the interval code in my type inference package (section 7.3 in link below) has a union of disjoint intervals, rather than a single interval.
Using unions of disjoint intervals has some advantages --- Mathematica 
and Maple both use this, I think.

Disadvantages include:
Contrary to the needs of some platforms, intervals cannot be stored in a 
fixed size (2 double-floats, e.g.) but
require memory allocation mechanisms.

Computing gets messier.


One alternative is to have exterior intervals.  That is 1/[-1,1] 
becomes  [1, -1]  where the latter represents [-infinity,-1] U [1,infinity].
(or if you join the reals at +- inf, it is all of them except [0,1].

There is an IEEE working group constructing a standard for intervals, 
based on the IEEE 754 float standard.  754 has
NaNs and signed 0 and infinity.

There is a large literature   (see journal Reliable Computing...) on 
intervals and related techniques.

RJF

>
> Unions of disjoint intervals are closed under +,-,*,/, whereas single intervals are not.
>
> http://home.pipeline.com/~hbaker1/Subtypep.html
>
> At 09:23 AM 1/3/2013, Richard Fateman wrote:
>> On 1/3/2013 9:03 AM, Raymond Toy wrote:
>>>>>>>> "Richard" == Richard Fateman <fateman at eecs.berkeley.edu> writes:
>>>      Richard> On 12/24/2012 5:17 PM, Richard Fateman wrote:
>>>      >>
>>>      >> One, in the generic package, even has some code for Maxima to implement
>>>      >> interval evaluation.  (see
>>>      >> http://www.cs.berkeley.edu/~fateman/lisp/generic )
>>>      Richard> oops, http://www.cs.berkeley.edu/~fateman/generic    esp interval.lisp
>>>      Richard> and ninterval.lisp
>>>
>>> I haven't looked at this yet, but how does it handle removable
>>> singularities?  Does it basically give an unbounded interval around
>>> the singularity?  Just curious.
>>>
>>> Ray
>> Here's what happens if you divide by an interval containing zero.
>> I haven't written anything for removable singularities per se.
>>
>> (there are a number of lisp macros and functions used here that are
>> defined in that referenced file).  Basically it punts with an error msg.
>> This code segment gives you some of the feeling for the relative
>> simplicity of the code -- it is probably simpler than it should be from
>> the perspective of robustness.
>>
>> ;;; define division in generic arithmetic (ga) where both arguments are RealIntervals (ri)
>>
>> (defmethod ga::two-arg-/ ((r ri)(s ri))
>>   ;; dividing intervals, try all 4, taking min and max.
>>   ;; for floats we should round down for lo, round up for hi.
>>   ;; could be done faster, e.g. if intervals are 0<lo<hi.
>>   (with-ri2 r s (lo1 hi1)(lo2 hi2)
>>         (if (<= lo2 0 hi2)        ; divisor contains zero
>>         (error "division by interval containing zero ~s" s)
>>         (let ((quos (sort (list (/ lo1 lo2)(/ lo1 hi2)(/ hi1 lo2)(/ hi1 hi2)) #'<)))
>>           (ri (car quos)(fourth quos))))))