Ilya Zakharevich on Sun, 20 Jun 1999 17:29:46 -0400 (EDT)


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

Recursive plot


Try [forget about upward bias for a moment, it is not visible with
higher resolution plotting):

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

    1.000 +--***--------**---------**-------------------**---------**--------*+
          |  * *        * *        ***      :           * *        ***       *|
          |  * *        * *       *  *      :           * *       *  *       *|
          |  * **      *  *       *  *      :          *  *       *  *       *|
          |  *  *      *  *       *  *      :          *  **      *  *       *|
          | *   *      *   *      *  *      :          *   *      *  *      * |
          | *   *      *   *     *   *      :          *   *      *  *      * |
          | *   *      *   *     *    *     :   *      *   *     *    *     * |
          | *   *      *   *     *    *     :  * *     *   *     *    *     * |
          | *    *     *   *     *    *     :**  *    *    *     *    *     * |
          | *    *    *     *    *    *     *    *    *    *     *    *     * |
          |*.....*....*.....*....*....*....*:....*....*.....*....*....*.....*.|
          |*     *    *     *    *    *  ** :    *    *     *    *     *   *  |
          |*     *    *     *    *     **   :    *    *     *   *      *   *  |
          |*     *    *     *   *      *    :    *    *     *   *      *   *  |
          |*      *  *      *   *           :     *   *     *   *      *   *  |
          **      *  *      *   *           :     *  *      **  *      *   *  |
          *       *  *      **  *           :     *  *       *  *      *  *   |
          *       *  *       *  *           :     *  *       *  *      ** *   |
          *       *  *       * *            :     *  *       * *        * *   |
          *       ***        * *            :     ***        * *        * *   |
   -1.000 *        **         **            :      **         **        ***   |
          +-------------------*-----------------------------------------------+
          -20.000                                                       20.000

This will happen with any odd function.  

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).

Ilya