sympy库的使用(四)指数和对数

首先看这两个等式

 是表达式1的特例,也是成立的

定义域如下

x, y = symbols('x y', positive=True)
n = symbols('n', real=True)

 

1.expand_log展开

其中注意事项和幂函数差不多,不赘述了

x, y = symbols('x y', positive=True)
n = symbols('n', real=True)
expand_log(log(x*y))
expand_log(log(x/y))
expand_log(log(x**2))
expand_log(log(x**n))
expand_log(log(z**2), force=True)

 2.logcombine合并

logcombine(log(x) + log(y))
logcombine(n*log(x))

原文地址:https://www.cnblogs.com/cgmcoding/p/14663627.html