[racket] Plot woes

From: Eli Barzilay (eli at barzilay.org)
Date: Tue May 22 12:39:57 EDT 2012

Three hours ago, Matthias Felleisen wrote:
> 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.
> Isn't this where a well-specified exception interface could help? It
> won't be fast but at least you can specify singularities as
> exceptions.

Why not just use the built-in exception system of floating point
numbers?  IOW, this problem can be fixed with

  (lambda (x) (/ (exact->inexact x)))

Maybe introduce that as some keyword option, but it looks like for
plots floating point numbers should be the defaults.  Without that,
you get nasty surprises like:

  (plot (function / -249 249)) --> works
  (plot (function / -249 250)) --> error

Also, it looks like the bounds are rounded and exacted, since

  (plot (function / -249.0 250.0))

throws an error too.  If that get dropped, then it can be an indirect
way to ask for floats.

          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                    http://barzilay.org/                   Maze is Life!

Posted on the users mailing list.