Python | sympy.as_leading_term() method
With the help of sympy.as_leading_term() method, we can see the leading term in the mathematical expression of the variable passed as parameter in the sympy.as_leading_term() method.
Syntax :
sympy.as_leading_term(variable)
Return : Return a function or expression of a leading term.
Example #1 :
In this example we can see that by using sympy.as_leading_term() method, we are able to check the leading term of mathematical function for variable which is passed as parameter.
# import sympy from sympy import * x, y = symbols('x y') # Use sympy.as_leading_term(variable) method gfg = (x**2 + 2 * x*y + y**2).as_leading_term(y) print(gfg) |
Output :
x**2
Example #2 :
# import sympy from sympy import * x, y = symbols('x y') # Use sympy.as_leading_term(variable) method gfg = (x * sin(x)*cos(y) + log(tan(x))).as_leading_term(y) print(gfg) |
Output :
x*sin(x) + log(tan(x))
Recommended Posts:
- class method vs static method in Python
- Python | set() method
- Python | os.dup() method
- Python | next() method
- Python | os.getcwd() method
- Python | os.tcgetpgrp() method
- Python | os.getpgid() method
- Python | os.writev() method
- Python | os.minor() method
- Python | os.major() method
- Python | os.readlink() method
- Python | os.truncate() method
- Python | os.fchmod() method
- Python | sympy.apart() method
- Python | Method Overloading
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.



