on-internet
← Community

Which would be an efficient way to work with an array of polynomials?

Stack Overflow ·

I have a function which given two polynomials, p and q, calculates the integral of p/q between the real numbers a and b. The function I have is$\phi$: import numpy as np def integrate_pdivq(a, b, P, Q, r): """ Calculates the definite integral of P(x)/Q(x) between a and b, assuming gr P<gr Q and that Q have all different roots, all of which have nonzero imaginary part. Parameters: P: list with coefficients of polynomial P. Q: list with coefficients of polynomial Q. r: list with the roots of Q. """ Q_deriv = np.polyder(Q) fracc = ( np.polyval(P, r)/np.polyval(Q_deriv, r) ) inte = ( 0.5 * np.log(

Comments

Sign in or sign up to comment and upvote.

No comments yet.