# Nested NIntegrate with variable limits

Im trying to integrate the following:

$$\int_{-1}^{1}\int_{-1}^{1}\int_{-1}^{x} J_{3/4}(x^2 z)J_{1/4}(y^2z) dy dz dx$$

i1[x_?NumericQ, z_?NumericQ] :=
i1[x, z] = NIntegrate[BesselJ[1/4, y^2 z], {y, -1, x}]
i2[x_?NumericQ] :=
i2[x] = NIntegrate[BesselJ[3/4, x^2 z] i1[x, z], {z, -1, 1}]
NIntegrate[i2[x], {x, -1, 1}]


Is this correct? And if so, is there any other way to make this faster?

• Have you tried it as a multiple integral? How precise do you want the answer? – Michael E2 Sep 8 '16 at 11:39
• I haven't tried it. However, my post is just something that looks similar to my original problem and my original problem is something that needs numerical integration. I just want a result that does not show this: Numerical integration converging too slowly; suspect one of the \ following: singularity, value of the integration is 0, highly \ oscillatory integrand, or WorkingPrecision too small. – PhilCsar Sep 8 '16 at 11:42

I believe the integral is 0 exactly, by symmetry (z -> -z):

FullSimplify[
BesselJ[3/4, x^2 z] BesselJ[1/4, y^2 z] +
BesselJ[3/4, x^2 (-z)] BesselJ[1/4, y^2 (-z)],
{x, y, z} ∈ Reals]
(*  0  *)


Numerical test: Set it up so that the "EvenOddSubdivision" strategy may be applied to the z-integral:

NIntegrate[BesselJ[3/4, x^2 z] BesselJ[1/4, y^2 z],
{x, -1, 1}, {y, -1, x}, {z, -1, 1},
Method -> {"EvenOddSubdivision",
Method -> {"LobattoKronrodRule", "GaussPoints" -> 5}},
MaxRecursion -> 0, AccuracyGoal -> 16]
(*  1.9636*10^-18  *)


(You need to set a finite AccuracyGoal to avoid a convergence warning.)

• Thanks. But is the code right? – PhilCsar Sep 8 '16 at 11:59
• @PhilCsar Do you mean did Mathematica make a mistake? Or are you suggesting I messed up the cut & paste of the integrand? -- The interval -1 <= z <= 1 is symmetric with respect to the reflection z -> -z, so the integral over {z, -1, 0} cancels the integral over {z, 0, 1}....if there's no error in my copying. It agrees with numerical tests, up to the error in numerical integration which is somewhat large (<0.001). – Michael E2 Sep 8 '16 at 12:04
• Im just asking if my code is correct because Im not sure if I used NumericQ correctly :D – PhilCsar Sep 8 '16 at 12:07
• @PhilCsar It seems right, but it will be slow. – Michael E2 Sep 8 '16 at 12:09
• @PhilCsar If an integral is zero, NIntegrate will always give a convergence warning unless you set a finite AccuracyGoal to however many digits you want verified are zero. – Michael E2 Sep 8 '16 at 12:20