# Discrete Fourier Transform of a vector defined on a 3D lattice

In my research I need to compute the Discrete Fourier transform of a vector defined on a 3D lattice (a cube) to the "reciprocal" lattice. This is quite new to me so before proceeding i wanted to be sure of the steps.

I know that Mathematica computes the FFT of lists (using Fourier command) so i wanted to use that because it looks simple and fast to perform.

I have three elements (the three vector components) per each node of my lattice. therefore I have three lists (one per each component of the vector) each of this list is a three dimensional array of dimensions {Nx,Ny,Nz}.

So the steps i would do to compute the transformation of my vector would be:

$\bullet$ keep fixed the $y$ and $z$ coordinate

$\bullet$ span all the nodes with different $x$

$\bullet$ for each node add the elements of my vector to three different list (one for each component)

$\bullet$ Once spanned all the nodes in the $x$ direction compute three FFT (one for each list)

$\bullet$ Store each component of the trasformed vector in the correct position in the reciprocal lattice

$\bullet$ Change $y$ (or $z$) and start again

Do this procedure give the correct transformation of the vector?

I hope i was clear

It's much simpler than what you're describing, if I understand you correctly. Assuming the space index comes first, you can simply call Fourier /@ data, where data is your cube of data.

For example:

dat = RandomReal[{0, 1}, {3, 100, 200, 300}];
recipDat = Fourier /@ A;


Otherwise, Transpose the indices so that the spatial index (ie, the one with length 3) comes first, and then Map Fourier on it.

• I'm not sure that what you suggest is the three dimensional fourier transform... for example i know that for two dimensional fourier transforms of a function on a square lattice, you first have to transform the array column by column, then transform the resulting array row by row... – SSC Napoli Feb 22 '15 at 22:49
• @user3810266: What you are describing is the separable property of the multidimensional Fourier transform, similar to how the separability of Gaussian filters leads to the van Ginkel algorithm in image processing. However, Fourier by default applies the transform along each dimension when it is applied to multidimensional data, so such complicated manipulations are unnecessary, since Fourier does them for you by default. – DumpsterDoofus Feb 22 '15 at 23:03
• @user3810266: For more info, search for Fourier in the Documentation Center. Several of the examples illustrate multidimensional FT's, which are all of the form Fourier[arrayInQuestion]. – DumpsterDoofus Feb 22 '15 at 23:06
• So if I do Fourier[threedimarray] where threedimarray is a three dimensional array (like a scalar defined on a cubic lattice) what I get is directly the three dimensional FFT? not just the one dimensional fourier transform along each dimension? – SSC Napoli Feb 22 '15 at 23:18
• @user3810266: So what you're saying is that you have three lists, listX, listY, and listZ, each of which are of Dimensions {Nx, Ny, Nz}? In that case, the original answer still stands, and you can simply call Fourier /@ {listX, listY, listZ} (/@ means Map). Alternately, you can do it list by list, ie recipX = Fourier[listX], recipY = Fourier[listY], recipZ = Fourier[listZ]. – DumpsterDoofus Feb 23 '15 at 14:48