Karim BELABAS on Tue, 29 Jun 1999 14:59:29 +0200 (MET DST)

 Re: Recursive plot

```[Ilya:]
> Try [forget about upward bias for a moment, it is not visible with
> higher resolution plotting):
>
> ? ploth(x=-20,20,sin(x),2)
>
> [ nice picture, completely wrong in the center ]
>
> This will happen with any odd function.

in a symmetric interval

> The algo of subdivision works like this: it breaks the interval into
> 14 subintervals, then looks on consecuitive pairs of intervals, and
> checks whether 3 points corresponding to 3 ends of these intervals are
> approximately on the same line.  However, the middle pair of intervals
> is centered at 0, and for an odd function the points will be *always*
> on the same line.  Thus the middle interval is never subdivided.
>
> Possible solution: instead of checking consecuitive pairs of intervals
> (1st and 2nd, then 3rd and 4th, then 5th and 6th, etc), check all the
> adjacent pairs of intervals (1st and 2nd, then 2nd and 3rd, then 3rd
> and 4th, etc).

Other solution:

ploth(x=-20,21,sin(x),2)

or

ploth(x=-20,20,sin(x),2, 7) /* any (big enough!) odd number will do */

I'm documenting your example, but I don't consider it a bug. By [craftily
chosing the parameters / being extremely unlucky], you'll be able to fool the
recursive engine. It is much faster but less reliable, hence one should give
it another try using slightly different parameters.

Karim.
__
Karim Belabas                    email: Karim.Belabas@math.u-psud.fr
Dep. de Mathematiques, Bat. 425
Universite Paris-Sud             Tel: (00 33) 1 69 15 57 48
F-91405 Orsay (France)           Fax: (00 33) 1 69 15 60 19
--