Comment #32 on issue 1816 by [email protected]: Adding partial derivatives and taking derivatives with respect to functions
http://code.google.com/p/sympy/issues/detail?id=1816
The problem is that in the conventional presentation of Lagrangian mechanics, we use the same name for completely different objects. There are the variables of the Lagrangian function on the one hand, and the kinematic coordinates on the other. That's why I used q, r to refer to the former.
Now, r and x'(t) are different things, but we are only interested in what happens at the point (q=x(t), r=x'(t)) and we evaluate all relevant functions there.
Perhaps it'll be clearer if I translate my derivation to sympy code?
Derivative(Subs(Derivative(L(x(t), _r, t), _r), Tuple(_r), Tuple(Derivative(x(t), t))), t) - Subs(Derivative(L(_q, Derivative(x(t), t), t), _q), Tuple(_q), Tuple(x(t)))L = Function('L'); x = Function('x') q, r = symbols('q r') L_exp = L(q, r, t) subst = {q: x(t), r: diff(x(t), t), t:t}lagrange_eqn = Derivative(diff(L_exp, r).subs(subst), t) - diff(L_exp, q).subs(subst); lagrange_eqn
lagrange_eqn.subs(L, Lambda((q, r, t), m*r**2/2)).doit()
m*Derivative(x(t), t, t) -- You received this message because you are subscribed to the Google Groups "sympy-issues" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sympy-issues?hl=en.
