unexpected behavior with partial derivatives of order greater than one

28 views
Skip to first unread message

J. S. Oishi

unread,
Jul 28, 2014, 5:29:59 PM7/28/14
to sy...@googlegroups.com
Hi all,

I'm using sympy 0.7.4.1, and I've come across an issue I don't quite understand. If I do

from sympy import *
x,z,t = symbols('x, z, t')

psi = Function('psi')(x,z)

j1 = Derivative(psi,x) - Derivative(psi,z)

j1.subs(Derivative(psi,x), t)

I get what I expect, t - d psi/dx. However, if I do the same thing with a second derivative with respect to z, I get the following:

j2 = Derivative(psi,x) - Derivative(psi,z,2)

j2.subs(Derivative(psi,x), t)

it returns t - d^2 t/dz^2. I expect it to return t - d^2 psi/dz^2. Can anyone point me to anything I might be doing wrong? I've tried defining t as a Function, rather than as a symbol (t = Function('t')(x,z)), but that does the exact same thing. I've also tried writing the second derivative in j2 as Derivative(psi,z,z), but that also does the same thing (which I would expect).

I've found this behavior both on my computer with Python 3.3.2 and on the sympy live shell on sympy.org, which is currently SymPy 0.7.4.1 (Python 2.7.5).

Any advice you could provide would be very helpful.


thanks,


Jeff

Sergey Kirpichev

unread,
Jul 29, 2014, 4:15:52 AM7/29/14
to sy...@googlegroups.com
Looks as a bug for me.

Our bugtracker:
https://github.com/sympy/sympy/issues

J. S. Oishi

unread,
Jul 30, 2014, 9:32:26 AM7/30/14
to sy...@googlegroups.com
Thanks, Sergey. I've filed an issue on github.
Reply all
Reply to author
Forward
0 new messages