numpy.i0#
- numpy.i0(x)[源代码]#
第一类修正贝塞尔函数,0 阶.
通常表示为 \(I_0\) .
- 参数:
- xfloat 类型的 array_like
贝塞尔函数的参数.
- 返回:
- outndarray, shape = x.shape, dtype = float
在 x 的每个元素上计算的修正贝塞尔函数.
注释
建议使用 scipy 实现而不是此函数:它是一个用 C 语言编写的适当的 ufunc,并且速度快了一个数量级以上.
我们使用 Clenshaw [1] 发布的算法,并由 Abramowitz 和 Stegun [2] 引用,该算法将函数域划分为两个区间 [0,8] 和 (8,inf),并且在每个区间中使用切比雪夫多项式展开.使用 IEEE 算法在域 [0,30] 上的相对误差记录 [3] 为峰值为 5.8e-16,均方根为 1.4e-16 (n = 30000).
参考
[1]C. W. Clenshaw, “Chebyshev series for mathematical functions”, in National Physical Laboratory Mathematical Tables, vol. 5, London: Her Majesty’s Stationery Office, 1962.
[2]M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions, 10th printing, New York: Dover, 1964, pp. 379. https://personal.math.ubc.ca/~cbm/aands/page_379.htm
示例
>>> import numpy as np >>> np.i0(0.) array(1.0) >>> np.i0([0, 1, 2, 3]) array([1. , 1.26606588, 2.2795853 , 4.88079259])