Python | sympy.powdenest() method
Last Updated :
25 Jun, 2019
With the help of sympy.powdenest()
method, we can simplify the powers of mathematical expression by using identity i.e (x^a)^b=x^ab
.
Syntax : sympy.powdenest()
Return : Return the simplified mathematical expression using identity.
Example #1 :
In this example, we can see that by using sympy.powdenest()
method, we are able to simplify the powers of mathematical expression using identity i.e (x^a)^b=x^ab
.
from sympy import *
x, y = symbols( 'x y' )
gfg_exp = (x * * 2 ) * * 3
fact = powdenest(gfg_exp)
print (fact)
|
Output :
x**6
Example #2 :
from sympy import *
x, y, z, a, b = symbols( 'x y z a b' )
gfg_exp = (x * * (a + b)) * * 2
fact = powdenest(gfg_exp)
print (fact)
|
Output :
x**(2*a + 2*b)
Share your thoughts in the comments
Please Login to comment...