# Two identical functions give different answers

I am new to mathematica and I hope this is a simple problem. I have two identical functions that only differ by the variable names:

PolarInverseFT[f_, p_, u_, r_, t_] :=
Integrate[
p f Exp[-I 2 π r p Cos[u - t]], {p , 0, ∞}, {u, 0, 2 π} ]

PolarInverseFT2[f_, r_, t_, p_, u_] :=
Integrate[
r f Exp[-I 2 π  p r Cos[t - u]], {r, 0, ∞}, {t, 0, 2 π} ]


I would expect them to behave identically. However,

PolarInverseFT[λ^2/(λ^2 + 4 π^2 p^2), p, u, r, t]


returns the error

-I Sin[2 p π r #1] is not a valid variable

But

PolarInverseFT2[λ^2/(λ^2 + 4 π^2 r^2), r, t, p, u]


gives the correct answer. For other f_ both can return an answer without failing, but the answers differ!

Any help would be greatly appreciated.

• Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Read the faq! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign!
– user9660
Mar 6, 2015 at 11:20
• You can format inline code and code blocks by selecting it and clicking the {} button above the edit window. The edit window help button ? is also useful for learning how to format your questions and answers. Mar 6, 2015 at 11:34
• In general, why including your integration variables in the arguments ? Mar 6, 2015 at 13:02
• @b.gatessucks that was my first thought as well. The integration variables appear in the first argument, so this makes sense ( the second and third arguments in each case must be passed in as undefined symbols ). That said, I obtain different results for the two cases, starting with a clean kernel each time. (not the same error though, the first case returns an unevaluated integral w/v9) Mar 6, 2015 at 15:05
• @b.gatessucks True, but besides the point. I note that the integrals themselves (executed directly and not through the above definitions) exhibit the same strange behavior. Mar 6, 2015 at 15:22

not an answer, just a simpler demonstration of the issue ( version 9.01 )

Integrate[r (1/(1 + 4 Pi^2 r^2)) Exp[-I 2 Pi  r Cos[t - u]],
{r, 0, Infinity}, {t, 0, 2 Pi}]


In the second case I've just copied the expression and changed t to z .. puzzling. It seems in the first case u has been assumed real and the second not.

• In 10.0.0 both expressions return the (same) unevaluated integral. Mar 6, 2015 at 15:33
• This should probably just be a comment...
– rm -rf
Mar 6, 2015 at 16:12
• 10.1 gives a different second answer to 9.0.1 Apr 5, 2015 at 16:33