# How to set up the Fourier domain for a Fourier Transform? [duplicate]

I am having trouble understanding how to set up the grid in the Fourier domain, while performing Discrete Fourier Transforms. This might be a very trivial question, but I'd appreciate any help understanding this problem.

I am trying use Fourier transforms to model the propagation of an electric field through space. The steps that I need to perform are:

• Take the Fourier transform of $f(x, z = 0)$ to obtain $f(k, z=0)$
• Multiply $f(k)$ by $\exp[i\,k_z\,d]$ for some propagation distance $d$ with $i = \sqrt{-1}$. Here k_z is defined as:

$$k_z = \sqrt{k^2 - k_x^2}$$ where $k$ is the known wavenumber.

• Inverse Fourier Transform back to obtain $f(x, z=d)$

I have set-up my grid for the x-dimension but I do not understand how I should go about setting up the grid for the k-dimension.

My approach (as obtained from the section on FFT in Computational Methods in Physics by Joel Franklin):

My $x$-grid is defined as $x_i = i\,\,dx$ for $i \in [0,N-1]$ for some number $N$. Now, I define the $k$ space with $k_j = j \times dk$ such that $dk=\frac{1}{dx \,\,N}$. This grid was created to obtain the max value of k allowed by Nyquist's theorem. Then, I execute the following:

(*fields is a list of the values of the field on the x-grid*)
klist = Table[n*dk, {n, -NN/2 , NN/2}];
four = Fourier[fields];
final= InverseFourier[
Table[four[[i]]*Exp[-I*d*Sqrt[k^2 - kxlist[[i]]^2]], {i, 1,
Length[four]}]];


The output of the above code does not give me expected results for the what the field looks like at various distances. I would appreciate any explanation about where the definitions of setting up the k-grid come from and also if someone can point out mistakes in my implementation.

Thanks

• Minor note: N is a protected symbol (used for numerical conversion), so use n instead. – DumpsterDoofus Aug 5 '14 at 21:12
• The FFT outputs positive frequencies first, from zero up to Nyquist, then negative frequencies. See the linked question for more details. – Simon Woods Aug 5 '14 at 21:49
• This one may also help. – Simon Woods Aug 5 '14 at 21:51
• One question: You say you multiply by $\exp(i k d)$, but then in your code you multiply by Exp[-I*d*Sqrt[k^2 - klist[[i]]^2]]. Which one is correct? – DumpsterDoofus Aug 5 '14 at 22:25
• @DumpsterDoofus Sorry about the confusion. I should have been more clear about my definition of k. I want to multiply by exp(i(kz)d) such that kz = Sqrt[k^2 - kxlist[[i]]^2]]. Here, kxlist and kz represent the x and z components of the wavenumber k. I have made the edits to the question. – Sandesh Aug 6 '14 at 13:49

In Mathematica, given a list of datapoints $\mathbf{f}$ whose spatial axis has separation $\Delta$ (or whose temporal axis has time-step $\tau$), $\mathbf{\tilde{f}}=\text{Fourier}[\mathbf{f}]$ is a list of datapoints whose $j^\text{th}$ datapoint corresponds to angular spatial frequency $$k_j=\frac{2\pi(j-1)}{N\Delta}.$$
So for example, the first element of $\mathbf{\tilde{f}}$ corresponds to the zero-frequency (or DC) component, the second corresponds to the component with spatial frequency $2\pi/(N\Delta)$ (in effect, one oscillation per the entire length-$N\Delta$ interval), etc.