lagrangian (mech4),peter.vlasschaert@gmail.com, 26/07/2017
q=general coordinate , q_t= time derivative from general coordinate.

assume(m>0,g>0);
depends(lag,[q,q_t],[q,q_t],t);

eK:1/2*m*(q_t)^2;
eP:m*g*q;

lag:eK-eP;

 Euler-Lagrange equations

p1:single(lag):=diff(lag,q)-diff(diff(lag,q_t),t);

p2:single(lag)=0;

indepent : m => m<> 0

p3:factor(subst(diff(q,t), q_t, p2));

solve: ode2

p4:ode2(p3,q,t);

free fall :t=0 ,q=q0 ,find %k1

menu  => Simplify => Substitute
Expression:part(p4,2)
Old value    : t
New value  : 0

p5:subst(0, t, part(p4,2))=q0;

p6:ev(p4,p5);

free fall :t=0 ,diff(q,t)=v=v0 =0,find %k2

p7:diff(q,t)=diff(part(p4,2),t);

p8:subst(0, t, part(p7,2))=v0;

general : parabolic equation
   y=a*x^2+b*x+c
   y=q,x=t => a,b,c

p9:ev(p6,p8);

a:a=coeff(part(p9,2),t,2);
b:b=coeff(part(p9,2),t,1);
c:c=ev(part(p9,2),t=0);

free fall : v0=0

p10:ev(p9,v0=0);

check :       t=0 ,initial position q=q0 for the free fall.

p11:ev(p10,t=0);