collect: Add support for higher-than-1 order Derivatives
We still can't properly handle multivariate expressions, but the
following should work:
In [1]: a,b=symbols('ab')
In [2]: D = Derivative
In [3]: e = a*D(f(x), x,x) + b*D(f(x), x,x)
In [4]: e
Out[4]:
2 2
d d
a⋅─────(f(x)) + b⋅─────(f(x))
dx dx dx dx
In [5]: collect(e, D(f(x),x))
Out[5]:
d ⎛d ⎞
(a + b)⋅──⎜──(f(x))⎟
dx⎝dx ⎠
Signed-off-by: Kirill Smelkov <kirr@landau.phys.spbu.ru>
Cc: Mateusz Paprocki <mattpap@gmail.com>
Signed-off-by: Ondrej Certik <ondrej@certik.cz>