# Plotting Integral of Exponential functions

I am trying to Plot an integral equation that involves exponential function. My code is as follow,

w=1;
L[α_] :=
NIntegrate[
1/(k + I*0.1) (
Exp[I*k*x] (Exp[Sqrt[k^2 + α/w^2]*w] - 1) (Exp[k*w] - 1 +
I*0.1) Sqrt[
k^2 + α/
w^2])/((Sqrt[k^2 + α/w^2] + k) (Exp[
Sqrt[k^2 + α/w^2]*w - Exp[k*w]]) + (Sqrt[
k^2 + α/w^2] -
k) (Exp[(k + Sqrt[k^2 + α/w^2]) w] -
1)), {k, -100, 100}];
Plot[{Re[L[10]], Re[L[100]], Re[L[500]]}, {x, -0.45, 0.45},
PlotRange -> Full].


But this integral gives a lot of oscillations which it should not. This is fig 2 in this article "https://arxiv.org/pdf/1508.00836.pdf" and Eq: 38 that I am trying to plot. Any help will be highly appreciated.

• I included w=1;, what are you using? I changed L[alpha_] to L[alpha_,x_] I changed your I*0.1 to I/10and added WorkingPrecision->32 to NIntegrate and changed Plot to ListPlot[Table with exact rational steps, all to see if this is a precision problem. I get errors about NIntegrate not being able to get 32 bits of precision and I still see the oscillations you see. Plotting your integrand shows it doesn't blow up but oscillates wildly so I am guessing that you need to find a way to tell NIntegrate that it has to work much harder to get accurate results from your integrand. – Bill Aug 14 '19 at 4:25
• @Nasser, Thanks for pointing this out. w=1. – Hazoor Imran Aug 14 '19 at 4:26
• Consider the magnitude of the integrand around k == 100: Block[{w = 1, \[Alpha] = 10, x = 0.10}, Plot[ Abs[ 1/(k + I*0.) (Exp[ I*k*x] (Exp[Sqrt[k^2 + \[Alpha]/w^2]*w] - 1) (Exp[k*w] - 1 + I*0.) Sqrt[ k^2 + \[Alpha]/w^2])/((Sqrt[k^2 + \[Alpha]/w^2] + k) (Exp[ Sqrt[k^2 + \[Alpha]/w^2]*w - Exp[k*w]]) + (Sqrt[ k^2 + \[Alpha]/w^2] - k) (Exp[(k + Sqrt[k^2 + \[Alpha]/w^2]) w] - 1)) ], {k, -200, 200}] ] – Michael E2 Aug 15 '19 at 10:56

Regarding the suggestions (thanks @Bill) and using Method -> "LevinRule"

L[\[Alpha]_?NumericQ, x_?NumericQ] :=
NIntegrate[1/(k + I/10) (Exp[I*k*x] (Exp[Sqrt[k^2 + \[Alpha]/w^2]*w] - 1) (Exp[k*w] -1 + I/10) Sqrt[k^2 + \[Alpha]/w^2])/((Sqrt[k^2 + \[Alpha]/w^2] + k) (Exp[Sqrt[k^2 + \[Alpha]/w^2]*w - Exp[k*w]]) + (Sqrt[k^2 + \[Alpha]/w^2] - k) (Exp[(k + Sqrt[k^2 + \[Alpha]/w^2]) w] - 1)), {k, -100,100}
, Method -> "LevinRule"];


the integral can be evaluated and plotted without error message!

L[10, 0.4]
(*68.3565 - 3.11055 I*)

Plot[{Re[L[10, x]] }, {x, -0.45, 0.45}, PlotRange -> Full,Evaluated -> True]


• You should check your function ! – Ulrich Neumann Aug 15 '19 at 5:57
• Thanks, I am still working on it. – Hazoor Imran Aug 16 '19 at 0:38