# Can't integrate a highly oscillatory integrand

I have a long formula

-0.0579484 kx ((Sin[-3.2 kx] Cos[Sqrt[0.0232723 + kx^2 + ky^2 + kz^2] t])/Sqrt[0.0232723 + kx^2 + ky^2 + kz^2] (Sqrt[0.0232723 + kx^2 + ky^2 + kz^2]/(0.0232723 + kx^2 + ky^2 + 0.00008649 kz^2) + 1/Sqrt[0.0232723 + kx^2 + ky^2 + kz^2] (kx^2 + ky^2 + kz^2)/(-kx^2 - ky^2 - 0.00008649 kz^2)) + (Cos[-3.2 kx] Sin[Sqrt[0.0232723 + kx^2 + ky^2 + kz^2] t])/Sqrt[0.0232723 + kx^2 + ky^2 + kz^2] ((-0.999957 kz)/(0.0232723 + kx^2 + ky^2 + 0.00008649 kz^2) + (-0.999957 kz)/(-kx^2 - ky^2 - 0.00008649 kz^2)) + (Sin[-3.2 kx] Cos[-0.999957 kz t] + Cos[-3.2 kx] Sin[-0.999957  kz t])/(-0.0232723 - kx^2 - ky^2 - 0.00008649 kz^2) + Sin[-3.2 kx] 0.0232723/(0.0232723 + kx^2 + ky^2 + kz^2)1/(-kx^2 - ky^2 - 0.00008649 kz^2))


which I want to integrate over $$\int kx \, ky \, kz$$ and plot over $$t$$.

I can integrate the elements of the sum separately and add them at the end. The elements are

I:

-0.0579484 kx ((Sin[3.2 kx] Cos[Sqrt[0.0232723 + kx^2 + ky^2 + kz^2] t])/Sqrt[0.0232723 + kx^2 + ky^2 + kz^2] Sqrt[0.0232723 + kx^2 + ky^2 + kz^2]/(0.0232723 + kx^2 + ky^2 + 0.00008649 kz^2))


II:

-0.0579484 kx ((Sin[3.2 kx] Cos[Sqrt[0.0232723 + kx^2 + ky^2 + kz^2] t])/Sqrt[0.0232723 + kx^2 + ky^2 + kz^2] 1/Sqrt[0.0232723 + kx^2 + ky^2 + kz^2] (kx^2 + ky^2 + kz^2)/(-kx^2 - ky^2 - 0.00008649 kz^2))


III:

-0.0579484 kx ((Cos[3.2 kx] Sin[Sqrt[0.0232723 + kx^2 + ky^2 + kz^2] t])/Sqrt[0.0232723 + kx^2 + ky^2 + kz^2] (0.999957 kz)/(0.0232723 + kx^2 + ky^2 + 0.00008649 kz^2))


IV:

-0.0579484 kx ((Cos[3.2 kx] Sin[Sqrt[0.0232723 + kx^2 + ky^2 + kz^2] t])/Sqrt[0.0232723 + kx^2 + ky^2 + kz^2] (0.999957 kz)/(-kx^2 - ky^2 - 0.00008649 kz^2))


V:

-0.0579484 kx ((Sin[3.2 kx] Cos[0.999957 kz t] + Cos[3.2 kx] Sin[0.999957  kz t])/(0.0232723 - kx^2 - ky^2 - 0.00008649 kz^2))


VI:

-0.0579484 kx (Sin[3.2 kx] 0.0232723/(0.0232723 + kx^2 + ky^2 + kz^2)1/(-kx^2 - ky^2 - 0.00008649 kz^2))


The V and VI is the only part which I know how to compute with correct results. The method is as follows: First, I Integrate the formula V analytically over $$ky$$ and $$kz$$

f = Assuming[{kz \[Element] Reals && kz != 0 && kx \[Element] Reals && ky \[Element] Reals && t \[Element] Reals}, Integrate[-0.0579484 kx ((Sin[3.2 kx] Cos[0.999957 kz t] + Cos[3.2 kx] Sin[0.999957  kz t])/(0.0232723 - kx^2 - ky^2 - 0.00008649 kz^2)), {kz, -\[Infinity], \[Infinity]}, {ky, -\[Infinity], \[Infinity]}]]


Then, I numerically integrate the result over $$kx$$

Nf[t_] := NIntegrate[fV2, {kx, -\[Infinity], \[Infinity]}, Method -> "LevinRule"];


(Integrating first over $$kx$$ and $$ky$$ and then numerically over $$kz$$ works too)

Finally I plot the result as

Plot[Nf[t], {t, -2, 2}, PlotRange -> {{-0.2, 0.2}, All}]


The above method was provided here https://mathematica.stackexchange.com/a/276353/88922 and works only for the V and VI case.

For I-IV I tried integrating over $$kx$$, $$ky$$, $$kz$$ separately and for I-II Mathematica doesn't provide any result, for III-IV integrating over $$kx$$ or $$kz$$ gives 0, over $$ky$$ - nothing.

Method of V works on VI as wellAny ideas how to approach the topic? How to integrate the I-IV formulas over $$kx$$, $$ky$$, $$kz$$?

P.S. I couldn't integrate analytically over all of the three k variables at once - no results, and integrating fully numerically is too slow.

• You might try rationalizing all your numbers to exact values and increasing the WorkingPrecision in your NIntegrate statements. Aug 10 at 19:33
• Exact solvers (like Integrate) and inexact coefficients (like decimal-point numbers) sometimes don't mix well (because, for instance, round-off error prevent cancellation of what should be equal terms). So rationalizing as Bill suggested might help with Integrate, too. Aug 10 at 23:37
• The numbers need to stay as they are. Regardless, I tried changing them into integers, or more, putting 1 instead of them to simplify it even more but the results of Integrate are the same - integrals that weren't computing still aren't. Aug 11 at 9:53

Integrate manages one instance eg $$\int dx (\sum \frac{\sin \dots}{\sqrt{\dots}}\dots)$$ but the result is an $$\text{Ei}$$-function of the other variables. So there is no chance to perform further interation steps $$\int( \dots )\ dy \ dz$$ .

NIntegrate needs a threefold integral for any time t, because the algorithm does not accept variables.

Its impossible to put it inside a Plot statement for unspecified t-points, because on has no control of execution times and memory used. A ListPlot for an NIntegrate list over a list of t-values may work.

So, a way is to NIntegrate for a list of t-values over a 3d lattice with relatively few points per sin-period and interpolate the 4d lattice separately to get an interpolating function. For a visual Plot management, relatively small numbers of lattice point numbers are satisfying the objectives.

• I'm not sure if I fully understood what you mean. In the first part you're saying that because of the result of a single integration further ones aren't possible - wouldn't that be true also for the case V - which works just fine with a double integral? Besides, integrals I-IV don't compute with Integrate even for a single variable and I don't know why or what to do with it. In the next part, are you suggesting to deal with the integrals fully numerically but to plot them using ListPlot instead of Plot? Aug 11 at 10:00

It diverges if I am not mistaken. Here are my arguments. Let us expand the integrand

Expand[-0.0579484 kx ((Sin[-3.2 kx] Cos[
Sqrt[0.0232723 + kx^2 + ky^2 + kz^2] t])/
Sqrt[0.0232723 + kx^2 + ky^2 +
kz^2] (Sqrt[
0.0232723 + kx^2 + ky^2 + kz^2]/(0.0232723 + kx^2 + ky^2 +
0.00008649 kz^2) +
1/Sqrt[0.0232723 + kx^2 + ky^2 + kz^2] (kx^2 + ky^2 +
kz^2)/(-kx^2 - ky^2 -
0.00008649 kz^2)) + (Cos[-3.2 kx] Sin[
Sqrt[0.0232723 + kx^2 + ky^2 + kz^2] t])/
Sqrt[0.0232723 + kx^2 + ky^2 +
kz^2] ((-0.999957 kz)/(0.0232723 + kx^2 + ky^2 +
0.00008649 kz^2) + (-0.999957 kz)/(-kx^2 - ky^2 -
0.00008649 kz^2)) + (Sin[-3.2 kx] Cos[-0.999957 kz t] +
Cos[-3.2 kx] Sin[-0.999957 kz t])/(-0.0232723 - kx^2 - ky^2 -
0.00008649 kz^2) +
Sin[-3.2 kx] .0232723/(0.0232723 + kx^2 + ky^2 + kz^2) 1/(-kx^2 -
ky^2 - 0.00008649 kz^2))]


(0.00134859 kx Sin[ 3.2 kx])/((-kx^2 - ky^2 - 0.00008649 kz^2) (0.0232723 + kx^2 + ky^2 + kz^2)) + ( 0.0579484 kx Cos[0.999957 kz t] Sin[3.2 kx])/(-0.0232723 - kx^2 - ky^2 - 0.00008649 kz^2) + ( 0.0579484 kx Cos[Sqrt[0.0232723 + kx^2 + ky^2 + kz^2] t] Sin[ 3.2 kx])/(0.0232723 + kx^2 + ky^2 + 0.00008649 kz^2) + ( 0.0579484 kx^3 Cos[Sqrt[0.0232723 + kx^2 + ky^2 + kz^2] t] Sin[ 3.2 kx])/((-kx^2 - ky^2 - 0.00008649 kz^2) (0.0232723 + kx^2 + ky^2 + kz^2)) + ( 0.0579484 kx ky^2 Cos[Sqrt[0.0232723 + kx^2 + ky^2 + kz^2] t] Sin[ 3.2 kx])/((-kx^2 - ky^2 - 0.00008649 kz^2) (0.0232723 + kx^2 + ky^2 + kz^2)) + ( 0.0579484 kx kz^2 Cos[Sqrt[0.0232723 + kx^2 + ky^2 + kz^2] t] Sin[ 3.2 kx])/((-kx^2 - ky^2 - 0.00008649 kz^2) (0.0232723 + kx^2 + ky^2 + kz^2)) + ( 0.0579484 kx Cos[3.2 kx] Sin[0.999957 kz t])/(-0.0232723 - kx^2 - ky^2 - 0.00008649 kz^2) + ( 0.0579459 kx kz Cos[3.2 kx] Sin[ Sqrt[0.0232723 + kx^2 + ky^2 + kz^2] t])/((-kx^2 - ky^2 - 0.00008649 kz^2) Sqrt[0.0232723 + kx^2 + ky^2 + kz^2]) + ( 0.0579459 kx kz Cos[3.2 kx] Sin[ Sqrt[0.0232723 + kx^2 + ky^2 + kz^2] t])/((0.0232723 + kx^2 + ky^2 + 0.00008649 kz^2) Sqrt[0.0232723 + kx^2 + ky^2 + kz^2])

and consider a term of the above sum

0.0579484*kx*Cos[0.999957 kz t]*Sin[3.2 kx]/(-0.0232723 - kx^2 - ky^2 - 0.00008649*kz^2)


Then

Integrate[Rationalize[(0.0579484 kx Cos[0.999957 kz t] Sin[3.2 kx])/
(-0.0232723 -   kx^2 - ky^2 - 0.00008649 kz^2), 0], {ky, -Infinity, Infinity},
Assumptions -> {kx, kz} > -Infinity]


(144871 kx \[Pi] Cos[(999957 kz t)/1000000] Sin[(16 kx)/5])/(250 Sqrt[ 2327230 + 100000000 kx^2 + 8649 kz^2])`

The above expression behaves as $$c_1\sin \left(\frac {16} 5 kx\right)$$ when $$kx\to \infty$$ and $$c_2\sin \left(\frac {16} 5 kx\right)$$ when $$kx\to -\infty$$ , where $$c_1,c_2$$ are real-valued constants. This implies the divergence of its integral over $$kx$$ from $$-\infty$$ to $$\infty$$ if $$kz$$ and $$t$$ are fixed.