Thursday, July 9, 2026
HomeLanguagesPython | sympy.expand_log() method

Python | sympy.expand_log() method

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.




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


Output :

log(x) + log(y)

Example #2 :




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


Output :

3*log(x)

Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

2 COMMENTS

Most Popular

Dominic
32519 POSTS0 COMMENTS
Milvus
131 POSTS0 COMMENTS
Nango Kala
6901 POSTS0 COMMENTS
Nicole Veronica
12017 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12111 POSTS0 COMMENTS
Shaida Kate Naidoo
7020 POSTS0 COMMENTS
Ted Musemwa
7263 POSTS0 COMMENTS
Thapelo Manthata
6978 POSTS0 COMMENTS
Umr Jansen
6968 POSTS0 COMMENTS