[Numpy-discussion] Bug in Numpy FFT reference?
gb at cs.unc.edu
Tue Jul 23 14:24:03 EDT 2002
The example given for real_fft in the FFT section of the Sept 7, 2001
Numpy manual makes no sense to me. The text says
>>> x = cos(arange(30.0)/30.0*2*pi)
>>> print real_fft(x)
[ -1. +0.j 13.69406641+2.91076367j
-0.66913061-0.74314483j -0.5 -0.8660254j
0.5 -0.8660254j 0.66913061-0.74314483j
0.9781476 -0.20791169j 1. +0.j ]
But surely x is a single cycle of a cosine wave and should have a very
sensible and simple FT. Namely [0, 1, 0, 0, 0, ...]
Indeed, running the example using Numeric and FFT produces, within
rounding error, exactly what I would expect.
Why the non-intuitive (and wrong) result in the example text?
More information about the NumPy-Discussion