Open In App

Python | sympy.as_leading_term() method

Last Updated : 26 Jul, 2019
Improve
Improve
Like Article
Like
Save
Share
Report

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))


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads