📜  Python| sympy.euler() 方法

📅  最后修改于: 2022-05-13 01:55:25.835000             🧑  作者: Mango

Python| sympy.euler() 方法

借助sympy.euler()方法,我们可以在 SymPy 中找到欧拉数和欧拉多项式。

欧拉(n) -

示例 #1:

# import sympy 
from sympy import * n = 4
print("Value of n = {}".format(n))
   
# Use sympy.euler() method 
nth_euler = euler(n)  
      
print("Value of nth euler number : {}".format(nth_euler))  

输出:

Value of n = 4
Value of nth euler number : 5

欧拉(n, k) -

示例 #2:

# import sympy 
from sympy import * n = 5
k = symbols('x')
print("Value of n = {} and k = {}".format(n, k))
   
# Use sympy.euler() method 
nth_euler_poly = euler(n, k)  
      
print("The nth euler polynomial : {}".format(nth_euler_poly))  

输出:

Value of n = 5 and k = x
The nth euler polynomial : x**5 - 5*x**4/2 + 5*x**2/2 - 1/2

示例#3:

# import sympy 
from sympy import * n = 4
k = 3
print("Value of n = {} and k = {}".format(n, k))
   
# Use sympy.euler() method 
nth_euler_poly = euler(n, k)  
      
print("The nth euler polynomial value : {}".format(nth_euler_poly))  

输出:

Value of n = 4 and k = 3
The nth euler polynomial value : 30