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:

 1 - Exp[-10^12*0.00085*
      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.

Could someone please help me sort these out? Thanks!

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.


1 Answer 1


How about this?

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



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.

  • $\begingroup$ Yes it does - thanks for the idea! $\endgroup$
    – Sasha
    Jun 20, 2021 at 9:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.