How Can I Use plot2d code for presence of singularities?
Subject: How Can I Use plot2d code for presence of singularities?
From: Richard Fateman
Date: Thu, 03 Jan 2013 09:23:08 -0800
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
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
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))))))