零阶贝塞尔函数 Python

2 投票
1 回答
2734 浏览
提问于 2025-04-17 14:33

抱歉这个问题有点简单。

我想在Python中实现一个公式。在这个公式里,K_0是零阶修正贝塞尔函数。

在Python中实现K_0的最佳方法是什么?

1 个回答

5

其实你不需要自己去实现这个功能,因为它已经包含在里面了。你可以查看scipy.special模块的文档,特别是这里提到的一些常用的优化版本

>>> import scipy.special
>>> print scipy.special.k0.__doc__
k0(x[, out])

y=k0(x) returns the modified Bessel function of the second kind (sometimes called the third kind) of
order 0 at x.
>>> scipy.special.k0(1)
0.42102443824070823

或者更一般来说:

>>> print scipy.special.kn.__doc__
kn(x1, x2[, out])

y=kn(n,x) returns the modified Bessel function of the second kind (sometimes called the third kind) for
integer order n at x.
>>> scipy.special.kn(0, 1)
0.42102443824070834

撰写回答