3.1 Lagrange's Equations
> restart:
> mylib :="D:/LIBS": libname := mylib,libname: with(MBsymba):
Lagrangian Mechanics has a SCALAR approach to problems
> TT := translate(x(t),0,z(t)) * rotate('Z',psi(t)) * rotate('X',phi);
> mybody := make_BODY(TT, m, Ix,Iy,Iz, Iyz,Ixz,Ixy): show(mybody);
> G := origin(TT): show(G);
> myforce := make_FORCE(ground,Fx,Fy,Fz,G,mybody): show(myforce);
> mytorque := make_TORQUE(ground,Mx,My,Mz,mybody): show(mytorque);
kinetic energy
> KE := kinetic_energy(mybody);
potential energy
> _gravity := make_VECTOR(ground,0,0,g): show(_gravity);
> PE := gravitational_energy(mybody);
Lagrange's Equations
Lagrangian function
> L := KE-PE;
since the mechanism has three DOF, three equations of motion must be found
> leqns1 := lagrange(L,x(t),t) - generalized_force({myforce,mytorque},x(t)); 1st
> leqns2 := lagrange(L,z(t),t) - generalized_force({myforce,mytorque},z(t)); 2nd
> leqns3 := lagrange(L,psi(t),t) - generalized_force({myforce,mytorque},psi(t)); 3rd
>
same system, Netwon equtions
> newton_equations ({mybody,myforce,mytorque},ground): show(%);
>
eqnsE := euler_equations ({mybody,myforce,mytorque},CoM(mybody),TT): #show(%);
> collect(Xcomp(eqnsE),[diff(psi(t),t,t), diff(psi(t),t)]);
> collect(Ycomp(eqnsE),[diff(psi(t),t,t), diff(psi(t),t)]);
> collect(Zcomp(eqnsE),[diff(psi(t),t,t), diff(psi(t),t)]);
>