With the help of sympy.euler() method, we can find the Euler number and Euler polynomial in SymPy.
euler(n) -
Syntax: euler(n)
Parameter:
n – It denotes the nth Euler number.Returns: Returns the nth Euler number.
Example #1:
# import sympy from sympy import * n = 4print("Value of n = {}".format(n)) # Use sympy.euler() method nth_euler = euler(n) print("Value of nth euler number : {}".format(nth_euler)) |
Output:
Value of n = 4 Value of nth euler number : 5
euler(n, k) -
Syntax: euler(n, k)
Parameter:
n – It denotes the order of the Euler polynomial.
k – It denotes the variable in the Euler polynomial.Returns: Returns the expression of the Euler polynomial or its value.
Example #2:
# import sympy from sympy import * n = 5k = 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)) |
Output:
Value of n = 5 and k = x The nth euler polynomial : x**5 - 5*x**4/2 + 5*x**2/2 - 1/2
Example #3:
# import sympy from sympy import * n = 4k = 3print("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)) |
Output:
Value of n = 4 and k = 3 The nth euler polynomial value : 30
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.
Recommended Posts:
- Difference between Method Overloading and Method Overriding in Python
- class method vs static method in Python
- Get() method for dictionaries in Python
- Real-Time Edge Detection using OpenCV in Python | Canny edge detection method
- Python Program to detect the edges of an image using OpenCV | Sobel edge detection method
- Line detection in python with OpenCV | Houghline method
- Python | os._exit() method
- Python | os.WEXITSTATUS() method
- Python | os.abort() method
- Python | os.renames() method
- Python | os.lseek() method
- Python calendar module | formatmonth() method
- Python | PyTorch sin() method
- Python | Sympy Line.is_parallel() method
- Python PIL | GaussianBlur() method
- Python | range() method
- Python | Numpy np.hermefit() method
- Python | Numpy np.hermevander() method
- Python String Title method
- Python groupby method to remove all consecutive duplicates
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

