为什么 mpmath.quadgl(Gauss–Legendre quadrature) 显示错误的估计误差?

问题描述

我试图计算平凡的积分,但有无限个端点:

import mpmath as mp
def f(x,y):
    return 1/(x**2 + y**2)
mp.quadgl(f,[1,mp.inf],verbose = True,maxdegree = 10)

但是 mpamth 给出了错误的估计误差:

Integrating from 1 to +inf (degree 1 of 10)
Integrating from 1 to +inf (degree 2 of 10)
Estimated error: 1.9373  epsilon: 2.77556e-17  result:  6.78094
Integrating from 1 to +inf (degree 3 of 10)
Estimated error: 1.0  epsilon: 2.77556e-17  result:  8.83306
Integrating from 1 to +inf (degree 4 of 10)
Estimated error: 1.0  epsilon: 2.77556e-17  result:  10.9466
Integrating from 1 to +inf (degree 5 of 10)
Estimated error: 1.0  epsilon: 2.77556e-17  result:  13.0918
Integrating from 1 to +inf (degree 6 of 10)
Estimated error: 1.0  epsilon: 2.77556e-17  result:  15.2531
Integrating from 1 to +inf (degree 7 of 10)
Estimated error: 1.0  epsilon: 2.77556e-17  result:  17.4225
Integrating from 1 to +inf (degree 8 of 10)
Estimated error: 1.0  epsilon: 2.77556e-17  result:  19.596
Integrating from 1 to +inf (degree 9 of 10)
Estimated error: 1.0  epsilon: 2.77556e-17  result:  21.7635
Integrating from 1 to +inf (degree 10 of 10)
Estimated error: 1.0  epsilon: 2.77556e-17  result:  24.0217
Failed to reach full accuracy. Estimated error: 1.0

这是由于无限端点造成的吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)