Python | sympy.expand_log() method
Last Updated :
25 Jun, 2019
With the help of sympy.expand_log()
, we can simplify 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.expand_log()
Return : Return the simplified mathematical expression.
Example #1 :
In this example we can see that by using sympy.expand_log()
, we are able to simplify the log terms in mathematical expression.
from sympy import *
x, y, z = symbols( 'x y z' , positive = True )
gfg_exp = log(x * y)
gfg_exp = expand_log(gfg_exp)
print (gfg_exp)
|
Output :
log(x) + log(y)
Example #2 :
from sympy import *
x, y, z = symbols( 'x y z' , positive = True )
gfg_exp = log(x * * 3 )
gfg_exp = expand_log(gfg_exp)
print (gfg_exp)
|
Output :
3*log(x)
Share your thoughts in the comments
Please Login to comment...