[SciPy-user] Integrating Array

rgold@lsw.uni-heidelbe... rgold@lsw.uni-heidelbe...
Thu Oct 18 11:35:49 CDT 2007


Hi everybody,

I need to integrate a set of data points stored in a 1-dim array. That
means I can only use scipy.integrate.simps and scipy.integrate.trapz but
these methods are not as accurate as the routines for function-input like
scipy.integrate.quadrature which efficiently use more samples where the
integrand oscillates faster,etc.
The problem is that I need a high accuracy because the integrand IS
oscillating fast!

I already interpolated the data using the scipy.interpolate.splrep but
interestingly it turns out that simpsons rule now produces NANs and I am
left with good old trapz!

Is there a way of implementing quadrature for data-like-arrays?
Still I could try romberg. But then I have to interpolate exactly in such
a way that the "number of samples = positive power of 2) +1" (equally
spaced if I remember correctly).

Is this the best way or does anyone have another idea?

Thanks in advance!
Roman





More information about the SciPy-user mailing list