We will be using the built in discrete Fourier transform routine in
Mathematica. This is what is known as a fast Fourier transform
algorithm, which is written so as to minimize the number of
calculations that are involved. If is
a one dimensional array, Mathematica use the following formula to
produce a new array that represents the Fourier transform:
where . There are three awkward facts about this
formula.
Chop
command.
mytransform = RotateRight[Chop[ Abs[Fourier[mylist]].001], n/2]We can then plot this list using the
ListPlot
command above.
There is also an inverse Fourier transform command,
InverseFourier
. It too has these awkward features, and should
be invoked with
mytransform = RotateRight[Chop[ Abs[InverseFourier[mylist]],001], n/2]
We can compute the convolution of two function by using the fact that the convolution is the inverse Fourier transform of the product of the Fourier transforms of the functions. In symbols,
We can define the convolution of two lists with the command
Convolution[a_,b_]:=Chop[Abs[ InverseFourier[Fourier[a]*Fourier[b]]],.001]Then we can construct the convolution of two arrays with
myconvolution = RotateRight[Convolution[mylist,yourlist],n/2];
These same commands will construct the discrete Fourier transform and convolution in two dimensions with a slight modification. The difficulty is that the we must rotate the resulting arrays in the first coordinate and in the second coordinate.
Let us suppose that we have constructed the two-dimensional Fourier transform as above and called it temp,
temp = Chop[ Abs[Fourier[mylist]],.001]Then the following two commands will center the transform:
dummy=RotateRight[temp,Length[actiontemp]/2]; mytransform=Table[RotateRight[dummy[[i]],Length[dummy]/2],{i,1,Length[dummy]};We can then plot the resulting array using the above plotting commands.