I am using scipy.integrate.quad(f, a, b, args=(c,)) to integrate function f between a and b, adding another parameter c. You can think about f as
f = lambda x, y: x*y
As I understand it, the function requires a, b, c to be float values. However, I have many integrals to solve, all with the same function, just over vectors of a, b, and c. Iterating through all the vectors is quite inefficient. Is there any way to speed up / vectorize this operation?
Alas, this is not supported by integrate.quad.
You might find better luck with using gaussian quadratures yourself: scipy.integra.fixed_quad chokes on array_like input, but the lower-level routines which compute roots and weights should work. See "Roots and weights for orthogonal polynomials" section here.
YMMV though.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With