# Nested usage of NIntegrate

I'm trying to compute an integral of f(x,y) such that an integration over "y" is performed inside the integral over "x". My trial is below:

NIntegrate[
1 - Exp[-10^12*0.00085*
NIntegrate[
0.00015*Exp[-y^2]/(
2.21*10^-7 + (((3*10^10)/x - 2.47*10^15)/(1.06*10^11) -
y)^2), {y, -\[Infinity], \[Infinity]},
AccuracyGoal -> \[Infinity],
MaxRecursion -> 200]*1.2*10^-9], {x, 0, 10^-3},
AccuracyGoal -> \[Infinity], MaxRecursion -> 200,
WorkingPrecision -> 100]


Most likely I have a "non-numerical values for all sampling points in the region" error because internal NIntegrate call does not recognize "x" and hence cannot proceed with evaluation. I've tried defining the whole integrand as a function of "x" via

f(x_?NumericQ):= ...


and then integrating it but with no luck. I also tried using Range to define "x" in a "matlabish" way to no avail.

P.S. What puzzles me is that if I call "Plot" instead of NIntegrate (deleting irrelevant options), then all of a sudden it outputs something that looks pretty like an integrand.

nint[x_?NumericQ] :=
NIntegrate[
0.00015*
Exp[-y^2]/(2.21*10^-7 + (((3*10^10)/x - 2.47*10^15)/(1.06*10^11) -
y)^2), {y, -\[Infinity], \[Infinity]}]


e.g.,

nint[.003]

NIntegrate[1 - Exp[-10^12*0.00085*nint[x]*1.2*10^-9], {x, 0, 10^(-3)}]


Usually, when I see exponentiation in an integral, I'll try to scale things so that Exp[big numbers] are avoided. But this seems to work.

• Yes it does - thanks for the idea! Jun 20, 2021 at 9:50