如何解决为什么 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 举报,一经查实,本站将立刻删除。