# [racket] Plot woes

 From: Neil Toronto (neil.toronto at gmail.com) Date: Fri Jun 1 14:01:16 EDT 2012 Previous message: [racket] eval in a module language Next message: [racket] quote-syntax in macro-generator Messages sorted by: [date] [thread] [subject] [author]

```On 05/30/2012 11:12 AM, Jens Axel Søgaard wrote:
> Hi All,
>
> Attached is my version of a 2d-plotter that handles singularities.
> Give it a spin with your favorite ill-behaved functions and
> report back with ones badly handled.

For approaches like this, I think the definition of "well-behaved" is
"locally Lipschitz continuous with Lipschitz constant < K", where K
depends on the constants used to detect discontinuities (e.g.
machine-epsilon, number-of-regions). For everywhere-differentiable
functions, K is the maximum absolute derivative on the domain plotted,
scaled by various plot- and detection-specific factors.

(Yes, "Lipschitz" is like, the most unfortunate name for a mathematical
property EVER. It takes undergraduate math majors a whole semester to
get over it, if they ever do.)

Knowing that, it doesn't take long to find an ill-behaved function. We
just need one that's differentiable but not locally Lipschitz:

(λ (x) (* (expt (abs x) 3/2) (sin (/ x))))

Things like this will always be ill-behaved when plotted on some domain,
no matter how fine the discontinuity detection is.

Further, there are locally and globally Lipschitz functions whose K is
too large. (I didn't spend time finding one, though.) For each one, some
constant assignment in the discontinuity detection will make them plot
nicely. But for any constant assignment, there are infinitely many of them.

</analysis_lesson>

That doesn't mean I won't try something like this. The definition of
"functions without discontinuities that are well-behaved when plotted
non-adaptively" is also "locally Lipschitz continuous with Lipschitz
constant < K", where K depends on different constants like the
discretization step size. I would be perfectly happy with an adaptive
sampler or just discontinuity detection if I could show that its set of
ill-behaved functions is no larger than those for the current sampler.
That'll take some time.

Also, I'm still considering letting users specify discontinuities. That
would allow them to tell plot what kind they are: removable, removable
singularity, right-step, left-step, etc. Those kinds of properties are
pretty much undetectable.

Neil ⊥
```

 Posted on the users mailing list. Previous message: [racket] eval in a module language Next message: [racket] quote-syntax in macro-generator Messages sorted by: [date] [thread] [subject] [author]