Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

answered 14 years ago

kkumer gravatar image

Yes. It seems that direct differentiation with respect to function is not possible in sage. See also this ticket. You might try the workaround by using variables in place of functions and then subtituting the functions after differentiation e.g.

var('m l g th_fun thdot_fun  t')
th = function('th',t)
L = 1/2*m*l^2*thdot_fun^2 - m*g*l*(1-cos(th_fun))
EulerLagrange = diff(diff(L, thdot_fun).subs(thdot_fun=diff(th)), t) - diff(L, th_fun).subs(th_fun=th)==0
desolve(EulerLagrange, th, ivar=t)