Plotting bug?



On 11/29/07, Rob Frohne <frohro at wallawalla.edu> wrote:

> plot2d([realpart(ev(sum(%e^(-2*%i*%pi*f*k),k,-50,50),simpsum))], [f,-2,2],[y,-50,50]);
>
> The problem is that certain ranges give constant and incorrect values on
> the plot.  I can send a screenshot to anyone interested.  If I change
> the f plot range, the blanks disappear and it works.  It also works
> sometimes for different numbers of terms in the sum.

Rob, thanks for this bug report. After trying the above example with
some slightly modified parameters (e.g. summation from -5 to 5, or
change [f, -2, 2] to [f, -2, 2.07]) my guess is that the plotting code is
fooled by symmetry in the summation into believing that the sum is
constant: the plotting code is evaluating the sum at some points -2 + i*4/2^n
from -2 to 2, and, I guess, the values at these points are nearly the
same so the plotting code thinks it is constant. With fewer terms, the
differences are larger, and with a different range, the symmetry is broken.

My advice to you, Rob, is to change the range to something slightly
asymmetric. Does that help?

To Maxima developers -- maybe the plotting heuristic should involve
evaluating at some random points? Not just multiples of (b - a)/2^n.

best

Robert Dodier