
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.91354546-0.40673664j -0.80901699-0.58778525j -0.66913061-0.74314483j -0.5 -0.8660254j -0.30901699-0.95105652j -0.10452846-0.9945219j 0.10452846-0.9945219j 0.30901699-0.95105652j 0.5 -0.8660254j 0.66913061-0.74314483j 0.80901699-0.58778525j 0.91354546-0.40673664j 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? gb