Assume that we have a well-defined real-valued functionf[x,y,z] whose (inverse) Fourier transform is impossible to solve for symbolically and numerically using NIntegrate. I would like to sample the function and use (inverse) DFT (i.e. (Inverse)Fourier) and then use Interpolation to get a function I can further use. Doing this for 1d functions is a bit easier, but I don't really understand how to do it in more dimensions. Any help is appreciated, thanks!

EDIT: I have followed the answer in 2-Dimensional NFourierTransform for the a couple of examples but I don't seem to get it right:

f[x_, y_] := 1/Sqrt[x^2 + y^2]
exact[w1_, w2_] := 1/Sqrt[w2^2 + w1^2]

R = 5.1;
d = 0.005;

x = Join[-Reverse@#, Rest@#] &@Range[0., R, d];
n = Length@x;
m = (n - 1)/2;
k = \[Pi]/(d m) Range[0. - m, m];
X = ConstantArray[x, n];
Y = Transpose@X;

F = f[X, Y];
W = # Transpose@# &@ConstantArray[BlackmanWindow[x/R/2], n];

Developer`PackedArrayQ /@ {X, Y, F, W}

{True, True, True, True}

F // ArrayPlot

enter image description here

F W // ArrayPlot

enter image description here

fF = d^2 RotateRight[#, {m, m}] &@Fourier[#, FourierParameters -> {1, 1}] &@RotateLeft[F W, {m, m}];
res = ListInterpolation[Transpose[fF], {k, k}];
Plot[{Re@res[kx, 0], Re@exact[kx, 0]}, {kx, -3, 3},Exclusions -> None, PlotRange -> 5, ImageSize -> 500]

enter image description here

I understand that the singularity at 0 is making things difficult, but testing for example with

f[x_, y_] := Exp[-x^2 - y^2]
exact[w1_, w2_] :=1/2 Exp[-(w1^2/4) - w2^2/4]

is also not very precise near the origin.

  • $\begingroup$ What have you tried? Do you have a data set in mind? I am not aware of any impediment to using e.g. Fourier on a matrix or higher rank tensor, so it would be good to understand just where you are running into trouble. $\endgroup$ – Daniel Lichtblau Jun 27 '17 at 15:36
  • $\begingroup$ @Daniel Lichtblau: I had difficulties in actually passing all necessary arguments to Fourier. I've added some details of what I've found, see edit. $\endgroup$ – tks Jun 29 '17 at 7:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.