# Integration issue with Nintegrate over finite bounds

I have an issue :

NIntegrate[x^2 *Exp[-x^2], {x, 0, Infinity}]


gives out 0.443113

But :

NIntegrate[x^2 *Exp[-x^2], {x, 0, 6857}]


gives an error:

NIntegrate::izero: Integral and error estimates are 0 on all integration subregions. Try increasing the value of the MinRecursion option. If value of integral may be 0, specify a finite value for the AccuracyGoal option.

and a zero as a result

However:

NIntegrate[x^2 *Exp[-x^2], {x, 0, 6855}]

gives the correct answer of 0.443113.

What is the difference of integrating over 6855 or 6857 ? (I am not really aware of the insides of mathematica and how it calculates the integrals numerically).

Addition to my question - how to access the properties of integration and play with the parameters.

Thank you a lot for your help :)

• Note that NIntegrate's message "izero" pretty much tells you how to get a better result. As for "how to access the properties of integration and play with the parameters." -- all of these are answered in the advanced NIntegrate documentation. Jan 28, 2019 at 15:42
• What version have you observed this with? I cannot reproduce your results and message in 11.3: for both sets of limits I get 0.443113 . Jan 28, 2019 at 18:56
• @AntonAntonov One guess is that in V11.3, machine underflow (General::munfl) is used as a signal for recursive subdivision. Certainly a Trace[] indicates that the underflow message is suppressed. Jan 29, 2019 at 3:48
• @AntonAntonov On 11.3, I had to go a little higher than 6857 to induce the problem, but I didn't think it was important enough to highlight in my answer. Jan 29, 2019 at 12:31

x^2*Exp[-x^2] is effectively 0 at most points in your interval.
Reduce[x^2*Exp[-x^2] >= \$MinMachineNumber]

NIntegrate works by sampling the function. If it never finds a nonzero sample, you'll see the error. But the message gives you the advice to fix the problem.
NIntegrate[x^2*Exp[-x^2], {x, 0, 10000}, MinRecursion -> 5]