[Numpy-discussion] Possible typo in numpy.dft.fft docstring

Travis Oliphant oliphant.travis at ieee.org
Thu Jan 26 06:40:08 EST 2006


Rudolph van der Merwe wrote:

>Part of the fft function's docstring currently reads:
>
>"...
>
>The packing of the result is "standard": If A = fft(a, n), then A[0]
>    contains the zero-frequency term, A[1:n/2+1] contains the
>    positive-frequency terms, and A[n/2+1:] contains the negative-frequency
>    terms, in order of decreasingly negative frequency. So for an 8-point
>    transform, the frequencies of the result are [ 0, 1, 2, 3, 4, -3, -2, -1].
>
>..."
>
>Shouldn't the frequency arrangement in the last sentence be
>
>[0, 1, 2, 3, -4, -3, -2, -1]
>
>  
>
>and not
>
>[ 0, 1, 2, 3, 4, -3, -2, -1]
>  
>
Of course these are completely equivalent because of the periodicity of 
the DFT, but the statement A[1:n/2+1] contains the positive-frequency 
terms is consistent with what's given.   It think the issue is that this 
statement is true for both even add odd values of n, while writing it 
the way you propose would require different statements for odd and even 
terms.

I do typically interpret the middle frequency as "negative" though (as 
does fftshift).

-Travis





More information about the NumPy-Discussion mailing list