Euler-Lagrange equations and partial derivatives



On Thu, 2010-04-22 at 12:22 -0700, dlakelan wrote:
> I want to derive some Euler-Lagrange equations of motion for a
> system. 
> ... Does anyone have any suggestions about how to go 
> about it?

Hi,
here is another suggestion, to add to the ones you already got:

(%i1) display2d:false$

(%i2) dot(u) := block([r], depends(x,t), r:diff(u,t),
                remove(x,dependency), r)$
(%i3) L1: m*dot(x)^2 - k*x^2;
(%o3) m*('diff(x,t,1))^2-k*x^2
(%i4) dot( diff( L1, dot( x ))) - diff( L1, x ) = 0;
(%o4) 2*m*'diff(x,t,2)+2*k*x = 0
(%i5) dot(u) := block([r], depends([x1,x2],t), r:diff(u,t),
                remove([x1,x2],dependency), r)$
(%i6) L2: m1*dot(x1)^2 + m2*dot(x2)^2 - k1*x1^2 - k2*x2^2 - k*(x1-x2)^2;
(%o6) m2*('diff(x2,t,1))^2-k2*x2^2-k*(x1-x2)^2 +
                         m1*('diff(x1,t,1))^2-k1*x1^2
(%i7) dot( diff( L2, dot( x1 ))) - diff( L2, x1 ) = 0;
(%o7) 2*k*(x1-x2)+2*m1*'diff(x1,t,2)+2*k1*x1 = 0
(%i8) dot( diff( L2, dot( x2 ))) - diff( L2, x2 ) = 0;
(%o8) 2*m2*'diff(x2,t,2)+2*k2*x2-2*k*(x1-x2) = 0

Regards,
Jaime