scipy.special.
euler#
- scipy.special.euler(n)[源码]#
欧拉数 E(0), E(1), …, E(n)。
欧拉数 [1] 也被称为正割数。
因为
euler(n)
返回浮点数值,所以它不能给出大的 n 的精确值。第一个不精确的值是 E(22)。- 参数:
- nint
要返回的欧拉数的最高索引。
- 返回:
- ndarray
欧拉数 [E(0), E(1), …, E(n)]。包括所有为零的奇数欧拉数。
参考
[1]序列 A122045,整数数列线上大全,https://oeis.org/A122045
[2]张善杰和金建明。“特殊函数的计算”,John Wiley and Sons,1996。https://people.sc.fsu.edu/~jburkardt/f77_src/special_functions/special_functions.html
示例
>>> import numpy as np >>> from scipy.special import euler >>> euler(6) array([ 1., 0., -1., 0., 5., 0., -61.])
>>> euler(13).astype(np.int64) array([ 1, 0, -1, 0, 5, 0, -61, 0, 1385, 0, -50521, 0, 2702765, 0])
>>> euler(22)[-1] # Exact value of E(22) is -69348874393137901. -69348874393137976.0