How Can I Use plot2d code for presence of singularities?



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.

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))))))