1
如何獲取sympy以簡化表達式,如log(exp(exp(x)))
至exp(x)
?它似乎適用於更簡單的表達式,如exp(log(x))
=>x
。這是一個最小的例子,顯示了我迄今爲止所嘗試的:簡化嵌套指數並用sympy記錄
import sympy
from sympy import exp, log
x = sympy.symbols('x')
a = exp(log(x))
print a
# Gives `x` automatically, no call to simplify needed
b = log(exp(exp(x)))
print sympy.simplify(b), sympy.powsimp(b,deep=True)
# Gives `log(exp(exp(x)))` back, expected `exp(x)`