I have two functions that I need to inverse Fourier transform and I was trying to get Mathematica to help me. I tried simply using theInverseFourierTransform function but, since they're complicated 2D functions it just took 7 hours and gave me nothing! I thought NInverseFourierTransform would be a good alternative but I keep getting error messages. I think I'm using the function correctly because I ran it with a couple of easier functions first to check and the results came out as expected.

The functions look like this:

Uq1[alpha_, oneoverr_, Ge_] := alpha + (1 - alpha)  HeavisideTheta[Dot[Ge, Ge] - oneoverr]);


Uq2[alpha_, oneoverr_, Ge_] := (1 + alpha)/2 + ((1 - alpha)/Pi) ArcTan[ Dot[Ge, Ge] - oneoverr];

where alpha and oneoverr are just constants and Ge should be a 2D vector, but I've just been leaving it as 1D to minimise the evaluation time while I'm trying to find a method that works.

I tried


Plot[NInverseFourierTransform[Uq2[-1, 20, t], t, w], {w, -20, 20}, PlotRange -> All]

and got an error message saying that the integrand evaluated to non numerical values.

I'm sorry it's all a bit rubbish but I'm incredibly new to Mathematica and any help would be greatly appreciated!

  • $\begingroup$ What happens if you replace HeavisideTheta[] with UnitStep[]? $\endgroup$ Commented Apr 23, 2013 at 22:53
  • $\begingroup$ I just tried it and got the same error messages I'm afraid! $\endgroup$
    – Hannah
    Commented Apr 23, 2013 at 23:26
  • $\begingroup$ It seems that t.t has problems because it expects a vector and you are giving it a scalar. $\endgroup$ Commented May 24, 2013 at 2:52

1 Answer 1


The problem may be due to confusion over numerical values and dummy variables.

The documentation states that NInverseFourierTransform[expr,w,t] gives a numerical approximation to the inverse Fourier transform of expr at the numerical value t, where expr is a function of w.

In your question, you have reversed t and w, which is not a real problem since these are just labels.

The first argument passed to NInverseFourierTransform, your function Uq2, must be a function of the variable t. For example, ArcTan[t/Pi] or Sin[a t]. The second argument must be this variable t (type the character "t") in order to tell Mathematica that Uq2 is a function of t. The third argument is a numerical value for w, from -20 to 20 in this case.

Your question does not specify the value you used for t, whether or not it is a dummy variable (the character "t") or a list of numerical values. If your third argument to Uq2 is a 2D or 1D vector of numerical values, then there is no dependence of Uq2 on a variable t and NInverseFourierTransform fails. If the third argument to Uq2 is simply the dummy variable t, then NInverseFourierTransform fails because of Dot[t,t]. Would t$^2$ work here?

Bottom line: what is the value assigned (or not) to t before the Plot statement?

  • $\begingroup$ Uq2 is indeed meant to be a function of t, should I have used t instead of Ge when defining the function or will it not matter? And yes, t is just a variable, it isn't a list of values. Eventually, t should be a 2D vector but I've been using it as an ordinary variable until I get the code right, since I imagine it would take longer to evaluate with a 2D vector as an argument (w then would also have to be changed to a vector). I used the dot product instead of squaring t ready for when it becomes a vector. I've just re-run with t^2 and it is still running - has been for over an hour! $\endgroup$
    – Hannah
    Commented Apr 24, 2013 at 12:46
  • $\begingroup$ @Hannah: Again, NInverseFourierTransform expects its first input argument, in your case Uq2, to be a function of its second input argument, in your case the dummy variable t which has no value. Your comment above first confirms t isn't a list of values, but then contradicts that statement by saying t should be a 2D array of values. $\endgroup$ Commented Apr 26, 2013 at 15:25
  • $\begingroup$ @Hannah: Uq2 is basically ArcTan[some function of t] where t ranges from $-\infty$ to $\infty$. The integral inherent in the Fourier transform is difficult to evaluate because such a Uq2 is virtually constant at -1 or +1. The resulting delicate balance between two infinite areas, one positive and one negative, requires integration skills beyond mine, and it seems you must have this knowledge to guide Mathematica to the correct solution. $\endgroup$ Commented Apr 26, 2013 at 15:26
  • $\begingroup$ Sorry, I didn't explain myself very well regarding the variable 't'. It should be a vector in the sense that when plotted in 3D the functions Uq1 and Uq2 are cylindrical holes at some constant radius about the origin, therefore the function depends on the modulus of a vector, i.e. the distance away from the origin a point is, to decide whether it is to be given the low value inside the hole or the value of 1 outside the hole. The function should depend on the dot product of t with itself with t={x, y} and x, y don't have values, they're variables. $\endgroup$
    – Hannah
    Commented Apr 27, 2013 at 12:38
  • $\begingroup$ I have been looking at just t^2 as this represents taking a slice of the function in the z-x plane. Since the function is symmetric about the origin, if I can find an answer to the t^2 problem I can imagine rotating this solution about the z-axis to build the whole thing. Hope this makes sense! $\endgroup$
    – Hannah
    Commented Apr 27, 2013 at 12:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.