Python | sympy.expand_power_exp() method

With the help of `sympy.expand_power_exp()` method, we can simplify the powers of mathematical expression by using `sympy.expand_power_exp()` method.

Syntax : `sympy.expand_power_exp()`
Return : Return the simplified mathematical expression.

Example #1 :
In this example, we can see that by using `sympy.expand_power_exp()` method, we are able to simplify the powers of mathematical expression.

 `# import sympy ` `from` `sympy ``import` `*`  ` `  `x, y ``=` `symbols(``'x y'``) ` `gfg_exp ``=` `x``*``*``2` `+` `2` `*` `x``*``y ``+` `y``*``*``2` `  `  `# Use sympy.expand_power_exp() method ` `fact ``=` `expand_power_exp(gfg_exp) ` `  `  `print``(fact) `

Output :

x**2 + 2*x*y + y**2

Example #2 :

 `# import sympy ` `from` `sympy ``import` `*`  ` `  `x, y, z ``=` `symbols(``'x y z'``) ` `gfg_exp ``=` `x``*``*``(a ``+` `b) ` `  `  `# Use sympy.expand_power_exp() method ` `fact ``=` `expand_power_exp(gfg_exp) ` `  `  `print``(fact) `

Output :

x**a*x**b

My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

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.

Article Tags :

Be the First to upvote.

Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.