I have been using SymPy to expand the terms of a complex partial differential equation and would like to use the collect function to gather terms. However, it seems to have a problem dealing with second (or higher order) derivatives where the variables of differentiation differ.
In the code example below collect(expr6...
works, but collect(expr7 ...
does not, returning the error message "NotImplementedError: Improve MV Derivative support in collect"
. The error is clearly related to the psi.diff(x,y)
difference in the two cases. Is it obvious to anyone what I need to do to have collect(expr7 ...
work?
cheers
Richard
Example:
from sympy import *
psi = Function("psi") (x,y,z,t)
expr6=2*psi.diff(x,x)+3*U*psi.diff(x)+5*psi.diff(y)
expr7=2*psi.diff(x,y)+3*U*psi.diff(x)+5*psi.diff(y)
collect(expr6, psi.diff(x),evaluate=False, exact=False) # works
#collect(expr7, psi.diff(x),evaluate=False, exact=False)
# throws an error: NotImplementedError: Improve MV Derivative support in collect