I am trying to understand why nquad does not appear to handle large limits very well. In the following I am integrating a normal distribution pdf out to fairly large numbers and it seems to break if either limit is especially large, or if one of the limits is numpy.inf. I know I can't expect the integrator to be perfect, but I was surprised that this didn't at least return a warning. I guess I have more to learn about how the integrators work.
import numpy as np
from matplotlib import pyplot as plt
import scipy
from scipy import special
def intFunc(x1):
val = (1/(np.sqrt(2*np.pi)))*np.exp(-(x1**2)/2)
return val
val=scipy.integrate.nquad(intFunc,[[-np.inf,np.inf]])[0]
print("infinity to infinity val ={}".format(val))
val=scipy.integrate.nquad(intFunc,[[-np.inf,10000]])[0]
print("-infinity to 10000 val ={}".format(val))
val=scipy.integrate.nquad(intFunc,[[-np.inf,60]])[0]
print("-infinity to 60 val ={}".format(val))
val=scipy.integrate.nquad(intFunc,[[-60,60]])[0]
print("-60 to 60 val ={}".format(val))
gives
integralLimitTest.py
infinity to infinity val =0.9999999999999997
-infinity to 10000 val =0.0
-infinity to 60 val =2.207242645942812e-66
-60 to 60 val =0.9999999999999999