[SciPy-User] better cumulative integration routines (like cumtrapz)
Roban Hultman Kramer
roban at astro.columbia.edu
Mon Aug 3 14:21:12 EDT 2009
Hi,
I'm wondering if anyone can recommend a routine for one-dimensional
cumulative numerical integrals. Obviously there is
scipy.integrate.cumtrapz, but I was wondering if anyone knows of an
implementation of a more sophisticated numerical integration algorithm
that can take not just end points, but a whole series of points, and
efficiently approximate the definite integral at each point. In other
words, I have a function f(x), and want the value of the definite
integral from x0 to [x1, x2, x3, x4, ...]
Ideally I would want to be able to specify the desired precision of
the results, and also get an estimate of the achieved precision.
Essentially I'm asking for scipy.integrate.quad, but optimized for a
whole set of points. For the most part my functions are well behaved,
so I don't need fancy singularity-handling, though built-in
infinite-limit handling is great.
The obvious hack is to compute the definite integral separately for
each interval in my series of points, then add them together, but I
was wondering if anyone knows of an algorithm/implementation that does
this efficiently. I'd be willing to work on implementing something
myself, if you have pointers to an algorithm.
Thanks!
-Roban
More information about the SciPy-User
mailing list