mpmath.quad allows the integration to be split into multiple subintervals. However, it then returns an incorrect error estimate. For example:
>>> y,err = quad(lambda x: sign(x), [-0.5, 0.9, 1], maxdegree=2, verbose=True, error=True)
Integrating from -0.5 to 0.9 (degree 1 of 2)
Integrating from -0.5 to 0.9 (degree 2 of 2)
Estimated error: 0.274889
Integrating from 0.9 to 1 (degree 1 of 2)
Integrating from 0.9 to 1 (degree 2 of 2)
Estimated error: 3.35957e-7
Failed to reach full accuracy. Estimated error: 3.35957e-7
>>> err
mpf('3.3595707746405553e-7')
The error estimate returned is always that of the last subinterval. It should be the total error of all subintervals.
mpmath.quadallows the integration to be split into multiple subintervals. However, it then returns an incorrect error estimate. For example:The error estimate returned is always that of the last subinterval. It should be the total error of all subintervals.