Fast integration of log(2^(P(x)exp(-x^2/2)+1)


I would like to compute \int_0^{x_i}log(2^{P_i(t)exp(-t^2/2)} + 1)dt for a large number of values x_i where P_i is a different polynomial (degree <6) for each x_i value.

The naive approach is to use the function quadgk provided in QuadGK.jl for each value x_i and polynomial P_i. Is there a way to speed-up these multiple integrations by reusing computation from one case to the other?

If I would like to use Gaussian quadrature (FastGaussianQuadrature.jl), what type of nodes would you recommend?

See my answer here: Julia integral calculation - community module or own module?

…though if your polynomials change matters are more difficult.

Could you explain more of the context here? Where do your integrals and polynomials come from?

1 Like

How many is the large number and how broad is their distribution? If you get them all ahead of time, a decent approach would be to sort them, compute the integrals from x[i-1] to x[i] and add them back to get the full intervals.

Sorry, I should have mentioned that the samples x_i as well as the polynomials P_i are independent of each other. Large is about 300-400 different values of x_i.

I guess you never hit the singularity, so if you want to use Gauss quadrature then gausslegendre would probably make the most sense, though it will be a different grid for each x_i