# Python | sympy.logcombine() method

With the help of `sympy.logcombine()`, we can combine the log terms in the mathematical expression by using the following properties that are listed below.

Properties :
1) log(x*y)=log(x)+log(y)
2) log(x**n)=nlog(x)

Syntax : `sympy.logcombine()`

Return : Return the simplified mathematical expression.

Example #1 :
In this example we can see that by using `sympy.logcombine()`, we are able to combine the log terms in mathematical expression.

 `# import sympy ` `from` `sympy ``import` `*`  ` `  `x, y, z ``=` `symbols(``'x y z'``, positive ``=` `True``) ` `gfg_exp ``=` `log(x) ``+` `log(y) ` `   `  `# Using sympy.logcombine() method ` `gfg_exp ``=` `logcombine(gfg_exp) ` `   `  `print``(gfg_exp) `

Output :

log(x*y)

Example #2 :

 `# import sympy ` `from` `sympy ``import` `*`  ` `  `x, y, z ``=` `symbols(``'x y z'``, positive ``=` `True``) ` `gfg_exp ``=` `5` `*` `log(x) ` `   `  `# Using sympy.logcombine() method ` `gfg_exp ``=` `logcombine(gfg_exp) ` `   `  `print``(gfg_exp) `

Output :

log(x**5)

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.