Hi:
source code:
import sympy
x=sympy.symbols('x')
y=sympy.exp(x)
f=sympy.symbols('f',cls=sympy.Function)(y)
import IPython.display
IPython.display.Math(sympy.latex(f.diff(x,2)).replace('e^{x}','{e^{x}}'))#corrcet#replace is to work arround the latex output of e^{x}
IPython.display.Math(sympy.latex(f.diff(x,2).doit()).replace('e^{x}','{e^{x}}'))#not corrcet#where is the leading 2 come from in the first term?
IPython.display.Math(sympy.latex(f.diff(x).diff(x)).replace('e^{x}','{e^{x}}'))#correct
IPython.display.Math(sympy.latex(f.diff(x).diff(x).doit()).replace('e^{x}','{e^{x}}'))#not correct#where is the leading 2 come from in the first term?
IPython.display.Math(sympy.latex(f.diff(x).doit()).replace('e^{x}','{e^{x}}'))#correct
IPython.display.Math(sympy.latex(f.diff(x).doit().diff(x)).replace('e^{x}','{e^{x}}'))#not correct#the df(xi)/d(xi) should not exist
IPython.display.Math(sympy.latex(f.diff(y,2)).replace('e^{x}','{e^{x}}'))#not correct##where is the leading 2 come from?
IPython.display.Math(sympy.latex(f.diff(y).doit().diff(y).doit()).replace('e^{x}','{e^{x}}'))#correct
output:
Fom out [1] to out[6] show all the doit give incorrect answer, out[7] and out[8] show that doit give the correct answer. I want o ask whether it is a sympy bug or sympy has a special interpretation about such behavior?