Ilya Zakharevich on Sun, 2 Sep 2001 14:08:17 -0400

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: plotminmax written/query for Jacobian functions

On Sun, Sep 02, 2001 at 08:45:37PM +0300, Juhana Sadeharju wrote:
> >From:	Ilya Zakharevich <>
> >
> >> their peak values, but plot() shows only the locations.
> >
> >... but shows them better.  In the spring I had an idea on how to
> >increase the horizontal resolution twice (by better placements of ':'
> It would be worth of combine plot() and plotminmax() for getting
> best of both, but correctness of the graph should be the goal
> (plot() simply shows wrong graph).

Then plotminmax() also shows a wrong graph.  There is no way to find a
correct graph.

The difference is that plot() *always* shows the correct *values* at
the grid points; while plotminmax() *time to time* shows a usable
*C^O-approximation to the graph* of the function.

> Hopefully the plotminmax() will be included to GP if plot() stays
> unfixed.

There is nothing to "fix" in plot().  But the placement of ':'s can be
indeed improved using a heuristical algorithm - similarly to what you

One remark: plot() is very valuable as a quick way to get a graph of a
very-long-to-calculate function (possible with ploth() too, but you
need more parameters).  The agressive oversampling (64x) you use does
not help with "correctness", but would disable this usage.

My idea was to use 2x oversampling, and increase oversampling only if
the "middle" value is not between the "grid" values.  Maybe it is
better to use a more aggressive algorithm, as in "middle value is not
in the middle third of the interval between the values at the grid".
Or add something like "or if the values are more than 3 screen units apart".

A couple of heuristics like this, and plot()'s speed can be preserved,
while showing good C^0-approximations with almost the same probability
as your algorithm.