# Same integral gives different results with assumption

b = 1
k = 12560
r = 500
res = Integrate[Exp[I*k*x*Sin[o]]/(r + x*Sin[o]), {x, -b/2, b/2}]
resab = Abs[res]^2
Plot[resab, {o, -Pi/20, Pi/20}, PlotRange -> Full]


The plot has a maximum value of around 10^-6. Now if you add Assumptions->Im[o]==0 to the integral

res = Integrate[Exp[I*k*x*Sin[o]]/(r + x*Sin[o]), {x, -b/2, b/2},Assumptions->Im[o]==0]


Suddenly the plot has a peak value of around 10^8.What am I doing wrong? (The actual value is supposed to be around 10^-6 using approximation methods). Please Help

• Welcome to Mathematica.SE! 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour and check the faqs! 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 Jan 7 '16 at 20:37

This may happen due to how the integration try to converge. I don't know the exact solution but what I do in such cases is to evaluate numerical value. For your case, using NIntegrate

b = 1
k = 12560
r = 500
Table[
res = NIntegrate[Exp[I*k*x*Sin[o]]/(r + x*Sin[o]), {x, -b/2, b/2}];
{o, Abs[res]^2}, {o, -Pi/20., Pi/20., Pi/200.}];
ListLinePlot[%, PlotRange -> Full] And the actual value is indeed $\sim 10^{-6}$. For a better plot you can use smaller interval.

Sometimes expressing the whole function using either trigonometric or exponential form might help. For example here I express everything with trigonometric function using ExpToTrig.

b = 1
k = 12560
r = 500
res = Integrate[ExpToTrig[Exp[I*k*x*Sin[o]]/(r + x*Sin[o])], {x, -b/2, b/2}]
resab = Abs[res]^2
Plot[resab, {o, -Pi/20, Pi/20}, PlotRange -> Full] And once again $\sim 10^{-6}$ it is.

• One can also do the indefinite integral Integrate[Exp[I*k*x*Sin[o]]/(r + x*Sin[o]), x] and take the limits afterwards. – b.gates.you.know.what Jan 7 '16 at 21:34
• So is it a bug with mathematica? – user40428 Jan 8 '16 at 8:14
• @user40428, I'm not sure if we can call it a bug. I personally consider it as weirdness of the function (oscillatory argument of oscillatory function!) and try to make it less confusing for Mathematica so that it can use one of its smart algorithm :) – Sumit Jan 8 '16 at 9:03
• @b.gatessucks, I think when you a do a definite integral, it doesn't care about convergence to a particular limit, specially for such complicated function. So putting a limit on definite integral sometimes may not work. BTW did you check what happens when you do that to this function ;) – Sumit Jan 8 '16 at 9:08