I have a function and I will need to estimate its definite integral over many different intervals, some of them with endpoints quite close to each other,
\int_a^{b_k} f(x) dx
I could call integrate.quad
afresh for each interval, but that would seem to be quite inefficicent as integrate.quad
will be evaluating the function many times for each call. Is there any way to reuse the points that quad
has already evaluated to make subsequent calls to quad
faster?
(If not with integrate.quad
, perhaps another scipy function or using a different public python library?)
Or perhaps I should cache my previous integral values and just call quad
to compute the difference between the new point and the closest previously computed point?
Note also that the chosen endpoints are not all known in advance, they are chosen adaptively.