I was verifying some manual calculations (I made on a white board) of a 4-point DFT done by the recursive Decimation in Time FFT, when I noticed that 2 of my frequency-domain points are switched - while I get {X1, X2, X3, X4}, the output of Wolfram Alpha is {X1, X4, X3, X1}.
I thought I made a mistake, but I checked it a couple of times and I don’t think I have. So naturally I thought of getting the inverse transform, and if it doesn’t produce the original sequence, then the problem would likely be in WA.
Why doesn’t “inverse fft of fft of {0,1,2,3}” produce the original secuence? (3 and 1 are also switched after the inverse transform)
Thanks.
Yep, there is the issue - aside from not performing any scaling on my result, I get the same thing, but the 2nd and the last element are switched.
What am I doing wrong in this DIT FFT butterfly?
sorry, I have no idea what is going wrong. But I have written a minimal recursive fft implementation - i guess this is what you are having in mind with your sketch?!? (just for demonstration purposes, functions can digest only lists of length 2^n, not optimized in any way!). But maybe this is helpful though:
Thanks! Just tried your forward transform code in Wolfram Open Cloud and it produces the same result as I do, when doing the manual calculation. I hope someone from Wolfram can comment on this… I suppose if the inverse transform algorithm expects the order, it’s not a problem, but it is an issue if you want to know which part of the spectra is which, when you are inspecting and manipulating the DFT… Why does the default Fourier function produces the values in a different order?
Seems like the result you are getting corresponds to: Fourier[{0, 1, 2, 3}, FourierParameters -> {1, -1}], this produces the result {6. + 0. I, -2. + 2. I, -2. + 0. I, -2. - 2. I} which is the one you have in your whiteboard.