plot2d(1/x,[x,0,1],[y,0,5]); => division by 0



>>>>> "Felix" == Felix E Klee <felix.klee.maxima@gmx.net> writes:

    Felix> Hi,
    Felix> of course there is a singularity at x=0 but I still would like to plot 
    Felix> functions like this. Are there options that let plot2d ignore singularities?

I've appended a patch that can handle these kinds of plots, using the
adaptive plotting routine that was recently added.  So 

plot2d(1/(x-1),[x,0,2],[y,-100,100])

does something nice.

However,

plot2d(foobar(x), ...)

where foobar is undefined, just wastes time calling foobar 16000 times
and ends up plotting nothing.

This is an artifact of how division by zero is handled.  If errorsw is
non-NIL, instead of an error, maxima does a throw to 'errorsw with a
value of T.  We catch that and the plotting code pretends any
non-number means a discontinuity.  

It would be much nicer if maxima used Lisp's condition system and
signaled more errors more precisely so that, for example, the plotting
routine would only catch things like division by zero, overflow,
underflow, etc.  Other errors would get properly signalled or handled
elsewhere.  I'm pretty sure all Lisps we support has support for
conditions.

I will probably commit this soon, barring objections.

Ray

Attached file: plot.lisp.diff