[SciPy-user] slow integrals

Eric Emsellem emsellem at obs.univ-lyon1.fr
Wed Jun 7 05:18:29 CDT 2006


Hi!

I am performing a double integration using scipy.integrate.quad and it 
seems rather slow in fact so I would like to know if there is any way to 
make it more efficient (I have a pure C version of that integral and it 
is much faster, maybe by a factor of more than 10!).

I am doing this integral as:

result = scipy.integrate.quad(IntlosMu1, -Inf, Inf,...)

so an integral between - and + infinity.
The Integrand (IntlosMu1) is itself an integral which I am computing 
using a direct Quadrature (it is an integral on an adimensional variable 
T which varies between 0 and 1).
So I compute once and for all the abs and weight for the quadrature using

[Xquad, Wquad] = real(scipy.special.orthogonal.ps_roots(Nquad))

and then I pass on Xquad and Wquad as parameters to 
scipy.integrate.quad, to be used in the integrand.

(One last note: I am computing this double integral many many times on 
different points so I really need efficiency here...)

So the questions I have are:
- can you already see something wrong with this in terms of efficiency? 
(I doubt it since I don't provide much info, but just in case)
- are there other integration scheme I could use to do that ?
- how should I try to test things and see where the bottleneck is?

thanks a lot for any input on all this!

all the best

Eric



More information about the SciPy-user mailing list