I writing a bit of code, but the problem is found here:
[IN>] from sympy import*
[IN>] t= Symbol('t')
x1 = Function('x1')(t)
x2 = Function('x2')(t)
y1 = Function('y1')(t)
y2 = Function('y2')(t)
I define my expression:
[IN>] f = (x1.diff(t)*y2.diff(t)- x2.diff(t)*y1.diff(t))
Then, when differentiating the expresion f
wrt. the factors of the first summand I get the
unexpected output:
[IN>] f.diff(y2.diff(t))
[OUT>] Subs(Derivative(x1(t), t), (_xi_2,), (Derivative(y2(t), t),))
but if I differentiate wrt. the second summand factors
[IN>] f.diff(y1.diff(t))
[OUT>] -Derivative(x2(t), t)
I get the desired and expected result. I'm totally baffled by this. Still more, if I change the order of the summands, I get the same result:
[IN>] (-x2.diff(t)*y1.diff(t)+x1.diff(t)*y2.diff(t) ).diff(y2.diff(t))
[OUT>] Subs(Derivative(x1(t), t), (_xi_2,), (Derivative(y2(t), t),))
[IN>] (-x2.diff(t)*y1.diff(t)+x1.diff(t)*y2.diff(t) ).diff(y1.diff(t))
[OUT>] -Derivative(x2(t), t)
But if I exchange the minus `-``sign, the propeblem is now in the other pair of functions:
[IN>] (+x2.diff(t)*y1.diff(t)-x1.diff(t)*y2.diff(t) ).diff(y1.diff(t))
[OUT>] Subs(Derivative(x2(t), t), (_xi_2,), (Derivative(y1(t), t),))