numpy.i0#
- numpy.i0(x)[源码]#
第一类零阶修改贝塞尔函数。
通常表示为 \(I_0\)。
- 参数:
- xarray_like of float
贝塞尔函数的参数。
- 返回:
- outndarray, shape = x.shape, dtype = float
在 x 的每个元素处计算出的修改贝塞尔函数。
备注
建议使用 scipy 实现而不是此函数:它是一个用 C 编写的 proper ufunc,速度比此函数快一个数量级以上。
我们使用了 Clenshaw [1] 发表并由 Abramowitz 和 Stegun [2] 引用的算法。在该算法中,函数域被划分为两个区间 [0,8] 和 (8,inf),并在每个区间中使用 Chebyshev 多项式展开。使用 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])