why does quad() care about scaling?

3 views
Skip to first unread message

William Crutchfield

unread,
Jan 9, 2026, 4:42:10 PM (10 days ago) Jan 9
to mpmath
mpm.quad(lambda t: mpm.sin(t) * 1.e40, [1, 3], verbose=True)

Integrating from 1 to 3 (degree 1 of 8) Integrating from 1 to 3 (degree 2 of 8) Estimated error: 6.16112e+36 epsilon: 2.18953e-47 result: 1.53029e+40 Integrating from 1 to 3 (degree 3 of 8) Estimated error: 1.0 epsilon: 2.18953e-47 result: 1.53029e+40 Integrating from 1 to 3 (degree 4 of 8) Estimated error: 1.0 epsilon: 2.18953e-47 result: 1.53029e+40 Integrating from 1 to 3 (degree 5 of 8) Estimated error: 1.0 epsilon: 2.18953e-47 result: 1.53029e+40 Integrating from 1 to 3 (degree 6 of 8) Estimated error: 1.0e-10 epsilon: 2.18953e-47 result: 1.53029e+40 Integrating from 1 to 3 (degree 7 of 8) Estimated error: 1.0e-9 epsilon: 2.18953e-47 result: 1.53029e+40 Integrating from 1 to 3 (degree 8 of 8) Estimated error: 1.0e-10 epsilon: 2.18953e-47 result: 1.53029e+40 Failed to reach full accuracy. Estimated error: 1.0e-10

Needless to say, without the 1.e40 scaling quad() does hit full accuracy.

Is quad() iterating until it hits an absolute error target rather than
a relative error target?

Sergey B Kirpichev

unread,
Jan 12, 2026, 3:07:57 AM (7 days ago) Jan 12
to mpm...@googlegroups.com
On Fri, Jan 09, 2026 at 01:28:55PM -0800, William Crutchfield wrote:
> Is quad() iterating until it hits an absolute error target rather than
> a relative error target?

See QuadratureRule.estimate_error().
Reply all
Reply to author
Forward
0 new messages