借助sympy.expand_log()
,我們可以使用下麵列出的以下屬性來簡化數學表達式中的對數項。
特性:
1)log(x * y)= log(x)+ log(y)
2)log(x ** n)= nlog(x)
用法:sympy.expand_log()
返回:Return the simplified mathematical expression.
範例1:
在這個例子中,我們可以通過使用sympy.expand_log()
,我們能夠簡化數學表達式中的對數項。
# 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)
輸出:
log(x) + log(y)
範例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)
輸出:
3*log(x)
相關用法
- Python next()用法及代碼示例
- Python os.dup()用法及代碼示例
- Python set()用法及代碼示例
- Python os.listdir()用法及代碼示例
- Python os.umask()用法及代碼示例
- Python sympy.eye()用法及代碼示例
- Python os.fstatvfs()用法及代碼示例
- Python os.uname()用法及代碼示例
- Python os.chroot()用法及代碼示例
- Python os.stat()用法及代碼示例
- Python sympy.tan()用法及代碼示例
- Python os.writev()用法及代碼示例
- Python os.write()用法及代碼示例
- Python sympy.sin()用法及代碼示例
注:本文由純淨天空篩選整理自Jitender_1998大神的英文原創作品 Python | sympy.expand_log() method。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。