I have a function $g(x)$ that looks like this:
ListPlot[Table[{x, g[0.5, x, 3, 1]}, {x, -15, 15, 0.1}],
Joined -> True, ImageSize -> Large, InterpolationOrder -> 2,
PlotRange -> All] // AbsoluteTiming
I am trying to calculate the following integral:
$$\int_{-\infty}^{\infty} \cos (5.5x) g(x) \,dx \tag{1}$$
Naturally, to speed up convergence, I would like to limit the integration to a smaller domain than $(-\infty,\infty)$, which you can see should be justified by the fact that $g(x)$ quickly dies off past $x=5$. So I calculated (1) with the following limited domain:
$$\int_{-L}^{L} \cos (5.5x) g(x) \,dx \tag{2}$$
for increasing values of $L$. Once again, just by looking at the plot of $g(x)$ above, the majority of the integral should come from $-5<x<5$, so I would expect some reasonable convergence. But this is not what I found. In the plot below
testlength =
Table[{L, NIntegrate[Cos[5.5*y]*g[0.5, y, 3., 1.], {y, -L, L}]}, {L,
5., 15., 0.5}]; (*checking convergence in interval size, t=5.5*)
ListPlot[{#[[1]], #[[2]]/2.1571002369282504`*^-6} & /@ testlength,
Joined -> True, ImageSize -> Large, PlotRange -> All,
AxesLabel -> {"L", ""}]
The integral is oscillating symmetrically about $0$ (I checked), and quickly dying off. What's going on here? How is this possible?
Supporting Code:
ClearAll[g];
g[x_?NumericQ, En_?NumericQ, pz_?NumericQ, \[Alpha]_?NumericQ] :=
1./(En^2 + pz^2 + 0.24^2)*
NIntegrate[((Sqrt[
0.316/(1. +
1.2*((k4 + 0.5*En)^2 + kp + (x*pz)^2))^\[Alpha]*0.316/(1. +
1.2*((k4 - 0.5*En)^2 +
kp + ((1. - x)*pz)^2))^\[Alpha]])*((1. - x)*0.316/(1. +
1.2*((k4 + 0.5*En)^2 + kp + (x*pz)^2))^\[Alpha] +
x*0.316/(1. +
1.2*((k4 - 0.5*En)^2 +
kp + ((1. - x)*pz)^2))^\[Alpha]))/(((k4 + 0.5*En)^2 +
kp + (x*pz)^2 + (0.316/(1. +
1.2 ((k4 + 0.5*En)^2 + kp + (x*pz)^2))^\[Alpha])^2)*((k4 -
0.5*En)^2 +
kp + ((1. - x)*
pz)^2 + (0.316/(1. +
1.2*((k4 - 0.5*En)^2 +
kp + ((1. - x)*
pz)^2))^\[Alpha])^2)), {k4, -\[Infinity], \
\[Infinity]}, {kp, 0, \[Infinity]}, Method -> "LocalAdaptive"];





PlotExplorer? It's absent in the docs. – corey979 Jun 25 '18 at 21:28