scipy.special.
euler#
- scipy.special.euler(n)[source]#
尤拉數 E(0), E(1), …, E(n)。
尤拉數 [1] 也被稱為正割數。
因為
euler(n)
會回傳浮點數值,所以對於大的 n 值,它不會給出精確的值。第一個不精確的值是 E(22)。- 參數:
- nint
要傳回的尤拉數的最高索引。
- 回傳值:
- ndarray
尤拉數 [E(0), E(1), …, E(n)]。奇數尤拉數(全為零)也包含在內。
參考文獻
[1]Sequence A122045, The On-Line Encyclopedia of Integer Sequences, https://oeis.org/A122045
[2]Zhang, Shanjie and Jin, Jianming. “Computation of Special Functions”, 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