Plotting singular functions



On Wed, 2004-04-21 at 10:34, Vadim V. Zhytnikov wrote:
> Hi!
> 
> Presently Maxima wraps all plotted expression using
> "coerce-float-fun' (plot.lisp).  The wrapper catches lisp
> errors and returns either floating point value or T
> if expression is singular or not well defined.
> This is more or less OK with 2D plotting. 

<snip>

> Situation with 3D plots isn't so good.

<snip>

Thanks for the summary. I have noticed this problem, also.

On Wed, 2004-04-21 at 11:40, Raymond Toy wrote:

> Not sure what to do here.  I was hoping someone else would do an
> adaptive 3D plotter.  But errors are still a problem.

Yes, we need an adaptive 3D plotter. We also need an adaptive parametric
plotter. Your (Ray's) work on adaptive 2D plotting has spoiled us for
less. I'm going to assume that nobody has the time to work this out
before the upcoming release. I would be happy to be wrong about that.

> Other quick and dirty solution is to make "coerce-float-fun"
> return 0.0 instead of T for singular points.

As Ray pointed out, that would break other routines. Also, returning 0.0
to indicate a singularity is a little too quick-and-dirty for my taste.

I experimented with just checking for numberp on the return value of
coerce-float-fun. That works fine. However, the real problem is that I
don't know what to do when we encounter a singularity in the 3D code. If
there is any easy way to leave a hole in a surface with gnuplot, I
haven't been able find it.

I think we should definitely print a warning when a singularity is
encountered in the 3d plotting routines. After that, I see three
options:

1) Replace the singular point with a large positive value. Since the
singularity may have been -infinity, this answer could be maximally
wrong. (The "singularity" could also be sqrt(-1). A large positive value
isn't a very useful marker for that, either.)

2) Replace the singular point with 0.0. Roughly the same issues as (1).

3) Try to leave the point out of the plot. With gnuplot, at least, this
makes a strange 3d plot.

4) Print an error message and stop.

I'm not sure what to do here.

--Jim