[racket] Plot woes

From: Jens Axel Søgaard (jensaxel at soegaard.net)
Date: Tue May 22 10:21:29 EDT 2012

2012/5/22 Matthias Felleisen <matthias at ccs.neu.edu>:
> On May 22, 2012, at 8:05 AM, Neil Toronto wrote:
>
>> I've thought of such things before. Unfortunately, plot doesn't know where any
> singularities are, so it can't specifically sample the function at those points. I could > probably allow the user to tell plot where they are, but I can't think of a good API
> for it. I'd want something general enough to handle 1D, 2D and 3D functions,
> which allows the user to specify countably many missing values, and direction of
> (dis)continuity.

It is in no way a simple matter to plot functions with singularities. Especially
not if points are not known in advance. A simple heuristic is better than none
though.

Consider the one dimensional case. Let's for the sake of argument say
that we sample the function f in two values a and b such that f(a) is
below y-min
and f(b) is over y-max.

If there is a singularity between a and b, then the points P(a,f(a))
and Q(b,f(b)) should not be connected, and if there is no singularity
(but a pretty steep ascent)
then the points should be connected.

By sampling points between a and b it ought to be possible to
give a heuristic of whether a singularity has been found or not.

Thinking aloud: Would a comparison of the rate ascent between a and b to the
mean rate of ascent of all sampled pairs of neighbors give anything usable?

If you know any references to papers and/or algorithm
on the subject, then do give a pointer. I was only able to find
this paper of Fateman:

    http://www.cs.berkeley.edu/~fateman/papers/intervalplot.ps

which present a some nice examples of things to look out for.

(Just so I don't forget where I found it)
Matlab code using succesive refinement:

     http://www.stat.colostate.edu/~estep/paov/plotfuns.m

--
Jens Axel Søgaard


Posted on the users mailing list.