You could return a floating point "Not a Number"
instead of T from coerce-float-fun. What to do
with plotting is less certain. You might perhaps
plot a function in sections, with holes when there
is a NaN. I don't know of any system that actually
does this. I suspect some systems just remove such
points and connect the adjacent ones, clearly incorrect.
I wrote a system that did interval arithmetic for
plotting. A singular point was generally a very tall
rectangle.
RJF
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. It seems that
> plot2d is smart enough to ignore this non numerical values.
> The only not quite well handled situation is the case
> when plotted expression cannot be evaluated numerically,
> e.g. contains unknown function or variable. In this
> situation plot2d tries hard for quite long time
> to build the plot and finally produces gnuplot error.
>
> Situation with 3D plots isn't so good.
> First, plot3d stores function values into array
> with :element-type = double-float. At least
> on CMUCL and GCL such array refuses to store
> non numerical values such as T and signals lisp error.
> Clisp accepts T into double-float array (I was not
> able to find in CLHS what is the right behavior
> according to ANSI standard). So it is enough to have
> just one singular point to prevent plotting entirely.
> Even with clisp we can't plot - plot3d produces wrong
> maxima.gnuplot file and gnuplot refuses to draw it.
>
> Ideally, some more sophisticated 3D plotting algorithm
> is required which either skips singular point or
> approximate value in it using nearby values.
>
> Other quick and dirty solution is to make "coerce-float-fun"
> return 0.0 instead of T for singular points.
>
> Any ideas?
>
>