I’m interested in integrating f(x)\phi(x) over the entire real line, where \phi(x) is the Gaussian/Normal density function. Ordinarily the Gauss-Hermite method in FastGaussQuadrature
would be good for this (with suitable change of variable adjustment). However, the mode of f(x)\phi(x) is sometimes far from 0, e.g., 4. So I think I need something adaptive. Any recommendations? Both the “finding the center and scale of the integrand” and “finding the number of points to use” senses of “adaptive” are of interest.
The adaptive methods I’ve found mostly work only on finite intervals, although QuadGK.quadgk
does say the endpoints can be infinite. There also seem to be more choices among the Cubature related tools, but I don’t currently want to go multi-dimensional (perhaps later).
I’m also a bit tempted to just take the Gauss-Hermite node locations and shift them to match the center of the integrand, but my understanding is that those points come from roots of equations, and so shifting them seems liable to break a lot of the underlying assumptions that motivate using them in the first place. On the other hand, the theoretical result that the GH quadrature can give exact fit to integrals of finite order polynomials is already irrelevant: my f(x) generally includes an exponential term.
I would get estimates of the mode and scale of f(x)\phi(x) numerically.