Python | sympy.as_two_terms() method
Last Updated :
26 Jul, 2019
With the help of sympy.as_two_terms()
method, we can separate the mathematical expression by constant value in the mathematical expression and return a tuple by using sympy.as_two_terms()
method.
Syntax : sympy.as_two_terms()
Return : Return the tuple of elements separated by constant value.
Example #1 :
In this example we can see that by using sympy.as_two_terms()
method, we are able to get the tuple of elements separated by constant value.
from sympy import *
x, y = symbols( 'x y' )
gfg = ( 3 * x + 5 * y + 6 ).as_two_terms()
print (gfg)
|
Output :
(6, 3*x + 5*y)
Example #2 :
from sympy import *
x, y = symbols( 'x y' )
gfg = (x * * 2 + 4 ).as_two_terms()
print (gfg)
|
Output :
(4, x**2)
Share your thoughts in the comments
Please Login to comment...