Plotting singular functions



Stavros Macrakis ?????:
>>>4) Print an error message and stop.
>>
>>I now think we should choose (4). Here is my reasoning:
> 
> 
>>1) Plotting functions with singularities is difficult.
> 
> 
> Yes.  Even plotting functions without singularities isn't trivial.  By
> the way, I think we are really talking not only about true
> singularities, but also simple evaluation errors.
>

I've just tried plot2d with function which can't be numerically
evaluated in same area.  At first I thought various sqrt(sin(x)),
sqrt(tan(x)) mimics such function but than I realized that
0 value for sqrt(<negative>) is realpart.
But we can try something like
   gamma(x+%i*(signum(x-a)-signum(x-b)))
since Maxima can't evaluate gamma at imaginary argument.
And Plot2d does the job quite well - [a,b] intervall
remains empty on the plot.

> 
>>2) Research has been done on this problem, so it doesn't make 
>>sense to implement some half-baked impromptu solution.
> 
> 
> I generally agree, but I would rather get something rather than nothing.
> Since we need a quick solution right now, I would suggest replacing the
> singular point with 0.0 and giving a warning.  Just one warning, after
> all the evaluations are done, e.g.
> 
>   Errors in evaluating function being plotted.
>   Substituted 0.0 for error values.
> 
> Even better to say something useful about the error points:
> 
>   Errors in evaluating function being plotted.
>   Of 12345 function evaluations, 7 had errors.
>   First five erroneous points: (0.0,1.23456), (0.0,1.7654), ...  
>   Substituted 0.0 for error values.

Good idea, and I'd like to see similar report for plot2d as well.
And abort ploting if none of evaluation point is successfull.

> 
> The reason I suggest substituting 0 rather than inf is that errors
> aren't necessarily poles.  They may be removable singularities (e.g.
> (exp(x)-exp(-x))/x at x=0), undefined points (e.g. sin(1/x) at x=0),
> etc.  Substituting 0 is less likely to screw up the y axis limits.
> 

I agree completely, it is pity to abolish plot altogether due to
one or several problematic points.  But making something more
sophisticated than 0.0 requires serious work.



-- 
      Vadim V. Zhytnikov

       <vvzhy@mail.ru>
      <vvzhy@netorn.ru>