[英]Why does Bessel function in Scipy and EXCEL give different results?
I tried to use Scipy and EXCEL to calculate Bessel function, but they give different results.我尝试使用 Scipy 和 EXCEL 来计算贝塞尔 function,但它们给出了不同的结果。 Do you know why?
你知道为什么吗? Thanks in advance.
提前致谢。
Python code: Python代码:
import scipy.special as ss
result = ss.k1(0.2155481626213)
print(result)
EXCEL (I use the OneDrive Excel web app of today's version) EXCEL(我使用的是今天版本的 OneDrive Excel web 应用程序)
=BESSELK(0,2155481626213; 1)
The result from Python is 4.405746469429914
Python 的结果是
4.405746469429914
The result from Excel is 4,405746474969860
. Excel 的结果是
4,405746474969860
。
Since the error of the result is quite small, the complexity of the numerical calculations and the error propagation can cause the difference.由于结果的误差很小,数值计算的复杂性和误差传播会导致差异。
Side note: even Wolfram Alpha got a different value:4.405746469430.旁注:即使是 Wolfram Alpha 也有不同的值:4.405746469430。
As @HubertusKaiser says;正如@HubertusKaiser 所说; the error is so small that we can assign it to rounding-errors/floating-points.
误差非常小,我们可以将其分配给舍入误差/浮点数。
There's an excelent explanation why 0.1+0.2.= 0.3
for most computers here .对于大多数计算机,这里有一个很好的解释为什么
0.1+0.2.= 0.3
。 Now imagine doing a lot of those "wrong" floating-points calculations, you end up with the error difference you see现在想象做很多那些“错误”的浮点计算,你最终会看到你看到的误差差异
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.