浮球精度

时间:2020-06-02 14:20:46

标签: python numpy precision

通过考虑以下代码:

from scipy.special import iv, kv
import numpy as np
M = np.array([[iv(0,600.), kv(0,100.)],[kv(0,100.), iv(0,600.)]])
Msquare = M.dot(M)
mustBeIdentityMatrix = M.dot( np.linalg.inv(Msquare) ).dot(M)
mustBeIdentityMatrix

我希望获得一个单位矩阵[[1,0],[0,1]]。但是事实并非如此。我猜想这是由于在处理Bessel函数生成的大值时出现numpy浮点精度问题。

如何避免这个问题?

0 个答案:

没有答案
相关问题