[SciPy-user] Forcing quad to use endpoints?

Michael McNeil Forbes mforbes@physics.ubc...
Thu Nov 13 17:47:41 CST 2008

Does anyone familiar with the details of QUADPACK have a suggestion  
of a way to force it to used specified endpoints?

I am running into a problem like the following:

def f(p):
     return (400.0/(p*p + 400.0))**2

points = [20.0]
scipy.integrate.quad(f, 0, 1e16, points=points)

(12.853981633974485, 1.4270786368147365e-13)

The answer is actually 15.707963267949529 ~ 20*pi/4.

The problem is that the quadrature points do not include the  
endpoints, so quad does not sample the function sufficiently closely  
to 20.0 to realize that it is still significant there.  Basically, I  
would like to have a way of specifying both potential singularities  
(which is what `points` is for) as well as specifying important  
points that should be included in the quadrature (such as the 20  
above which specifies the typical length-scale for the problem).

I suspect that this is orthogonal to the QUADPACK quadratures, but if  
you have a suggestion, please let me know.


More information about the SciPy-user mailing list