lagrangian (mech1),peter.vlasschaert@gmail.com, 25/07/2017
spring(k)-mass(m) system

kill(all)$
depends(lag,[q,q_t],[q,q_t],t);
/*  ' (=prime),prevent evalution of the equation */
p1:'diff(lag,q)-'diff(diff(lag,q_t),t)=0;

potential Energy (=pE),kinetic Energy(=kE)

pE:1/2*m*(q_t)^2;
kE:k/2*q^2;

definition : Lagrangian =kinetic Energy -potential Energy

p2:lag=kE-pE;

no evalution of differentation operators

p3:ev(p1,p2);

 evalution of differentation operators

p4:ev(p3,diff);

definition : acceleration (velocity,position)

p5:diff(q_t,t)=diff(q,t,2);

p6:ev(p4,p5);

assumption :variables 'physics'

assume(k>0,m>0);

solve : differential equation second order (= ode2)

p7:ode2(p6,q,t);

p8:ev(p6,p7);

evalution of differentation operators

p9:ev(p8,diff);

 simplification of p9

p10:ratsimp(part(p9,1)=part(p9,2));

check solution : p9

p11:is(p10);