ENUNCIADO EJEMPLO 14

   Un pendulo doble esta compuesto por dos particulas de masa m unidas entre si y a un punto fijo por sendos hilos sin masa de longitud l. El conjunto se halla en un plano vertical sujeto a su propio peso. Para describir el movimiento se emplearan los angulos phi y theta que forman los hilos con la vertical.

   Paso 0. Reiniciación de las variables del sistema y llamada a los paquetes linalg, plots y plottools.

> restart:

> with(linalg):with(plots):with(plottools):

Warning, the protected names norm and trace have been redefined and unprotected

Warning, the name changecoords has been redefined

Warning, the name arrow has been redefined

> libname:="C:/",libname:

> with(mecapac3d):

   Paso 1. Definimos las coordenadas generalizadas del sistema en una lista que se denominará cg.

> cg:=[phi,theta];

cg := [phi, theta]

   Paso 2. Definición mediante variables de los elementos que forman el sistema mecánico.

> xg1:=[0,l/2*sin(phi),-l/2*cos(phi)]:

> xg2:=[0,l*sin(phi),-l*cos(phi)]:

> v1:=[varilla,xg1,rota(phi,1),M,l];

v1 := [varilla, [0, 1/2*l*sin(phi), -1/2*l*cos(phi)], matrix([[1, 0, 0], [0, cos(phi), -sin(phi)], [0, sin(phi), cos(phi)]]), M, l]

> p1:=[punto,0,l*sin(phi),-l*cos(phi),m];

p1 := [punto, 0, l*sin(phi), -l*cos(phi), m]

> xg3:=[0,l*sin(phi)+l/2*sin(theta),-l*cos(phi)-l/2*cos(theta)]:

> xg4:=[0,l*sin(phi)+l*sin(theta),-l*cos(phi)-l*cos(theta)]:

> v2:=[varilla,xg3,rota(theta,1),M,l];

v2 := [varilla, [0, l*sin(phi)+1/2*l*sin(theta), -l*cos(phi)-1/2*l*cos(theta)], matrix([[1, 0, 0], [0, cos(theta), -sin(theta)], [0, sin(theta), cos(theta)]]), M, l]

> p2:=[punto,0,l*sin(phi)+l*sin(theta),-l*cos(phi)-l*cos(theta),m];

p2 := [punto, 0, l*sin(phi)+l*sin(theta), -l*cos(phi)-l*cos(theta), m]

   Paso 3. Definición de los elementos gráficos que definiran nuestro sistema de ejes.

> a1:=[angulo,[0,l/2*sin(phi),-l*cos(phi)],xg1,xg2,l/4]:

> a2:=[angulo,[0,l*sin(phi)+l/2*sin(theta),-l*cos(phi)-l*cos(theta)],xg3,xg4,l/4]:

> ejeZ:=[vector,[0,0,0],[0,0,l/2],blue]:

> ejeZ2:=[segmento,[0,0,-2*l],[0,0,0],blue]:

> TO := [texto,[0,1,0],"O"]:

> TZ := [texto,[0,1,l/2],"Z"]:

   Paso 4. Definición de la variable sistema que agrupa en una lista todos los elementos anteriores.

> sistema:=[v1,p1,v2,p2,a1,a2,ejeZ,ejeZ2,TO,TZ]:

   Paso 5. Obtención de la energía cinética del sistema mediante fT asignándola a la variable T.

> T:= fT(sistema);

T := 1/2*M*(1/4*l^2*cos(phi)^2*phi1^2+1/4*l^2*sin(phi)^2*phi1^2)+1/24*phi1^2*M*l^2+1/2*m*(l^2*cos(phi)^2*phi1^2+l^2*sin(phi)^2*phi1^2)+1/2*M*((l*cos(phi)*phi1+1/2*l*cos(theta)*theta1)^2+(l*sin(phi)*ph...T := 1/2*M*(1/4*l^2*cos(phi)^2*phi1^2+1/4*l^2*sin(phi)^2*phi1^2)+1/24*phi1^2*M*l^2+1/2*m*(l^2*cos(phi)^2*phi1^2+l^2*sin(phi)^2*phi1^2)+1/2*M*((l*cos(phi)*phi1+1/2*l*cos(theta)*theta1)^2+(l*sin(phi)*ph...

   Paso 6. Obtención de la energía potencial del sistema mediante fV asignándola a la variable V.

> V:= fV(sistema);

V := -1/2*M*g*l*cos(phi)-m*g*l*cos(phi)+M*g*(-l*cos(phi)-1/2*l*cos(theta))+m*g*(-l*cos(phi)-l*cos(theta))

   Paso 7. Obtención de la lagrangiana como diferencia de energías entre la energía cinética y la potencial.

> L:=T-V;

L := 1/2*M*(1/4*l^2*cos(phi)^2*phi1^2+1/4*l^2*sin(phi)^2*phi1^2)+1/24*phi1^2*M*l^2+1/2*m*(l^2*cos(phi)^2*phi1^2+l^2*sin(phi)^2*phi1^2)+1/2*M*((l*cos(phi)*phi1+1/2*l*cos(theta)*theta1)^2+(l*sin(phi)*ph...L := 1/2*M*(1/4*l^2*cos(phi)^2*phi1^2+1/4*l^2*sin(phi)^2*phi1^2)+1/24*phi1^2*M*l^2+1/2*m*(l^2*cos(phi)^2*phi1^2+l^2*sin(phi)^2*phi1^2)+1/2*M*((l*cos(phi)*phi1+1/2*l*cos(theta)*theta1)^2+(l*sin(phi)*ph...

   Paso 8. Obtención de las ecuaciones de lagrange para las dos coordenadas generalizadas mediante el operador Ec_lag

> ecua:=ec_lag();

ecua := [1/2*M*(1/2*l^2*cos(phi(t))^2*diff(phi(t), `$`(t, 2))+1/2*l^2*sin(phi(t))^2*diff(phi(t), `$`(t, 2)))+1/12*diff(phi(t), `$`(t, 2))*M*l^2+1/2*m*(2*l^2*cos(phi(t))^2*diff(phi(t), `$`(t, 2))+2*l^2...ecua := [1/2*M*(1/2*l^2*cos(phi(t))^2*diff(phi(t), `$`(t, 2))+1/2*l^2*sin(phi(t))^2*diff(phi(t), `$`(t, 2)))+1/12*diff(phi(t), `$`(t, 2))*M*l^2+1/2*m*(2*l^2*cos(phi(t))^2*diff(phi(t), `$`(t, 2))+2*l^2...ecua := [1/2*M*(1/2*l^2*cos(phi(t))^2*diff(phi(t), `$`(t, 2))+1/2*l^2*sin(phi(t))^2*diff(phi(t), `$`(t, 2)))+1/12*diff(phi(t), `$`(t, 2))*M*l^2+1/2*m*(2*l^2*cos(phi(t))^2*diff(phi(t), `$`(t, 2))+2*l^2...ecua := [1/2*M*(1/2*l^2*cos(phi(t))^2*diff(phi(t), `$`(t, 2))+1/2*l^2*sin(phi(t))^2*diff(phi(t), `$`(t, 2)))+1/12*diff(phi(t), `$`(t, 2))*M*l^2+1/2*m*(2*l^2*cos(phi(t))^2*diff(phi(t), `$`(t, 2))+2*l^2...ecua := [1/2*M*(1/2*l^2*cos(phi(t))^2*diff(phi(t), `$`(t, 2))+1/2*l^2*sin(phi(t))^2*diff(phi(t), `$`(t, 2)))+1/12*diff(phi(t), `$`(t, 2))*M*l^2+1/2*m*(2*l^2*cos(phi(t))^2*diff(phi(t), `$`(t, 2))+2*l^2...ecua := [1/2*M*(1/2*l^2*cos(phi(t))^2*diff(phi(t), `$`(t, 2))+1/2*l^2*sin(phi(t))^2*diff(phi(t), `$`(t, 2)))+1/12*diff(phi(t), `$`(t, 2))*M*l^2+1/2*m*(2*l^2*cos(phi(t))^2*diff(phi(t), `$`(t, 2))+2*l^2...ecua := [1/2*M*(1/2*l^2*cos(phi(t))^2*diff(phi(t), `$`(t, 2))+1/2*l^2*sin(phi(t))^2*diff(phi(t), `$`(t, 2)))+1/12*diff(phi(t), `$`(t, 2))*M*l^2+1/2*m*(2*l^2*cos(phi(t))^2*diff(phi(t), `$`(t, 2))+2*l^2...ecua := [1/2*M*(1/2*l^2*cos(phi(t))^2*diff(phi(t), `$`(t, 2))+1/2*l^2*sin(phi(t))^2*diff(phi(t), `$`(t, 2)))+1/12*diff(phi(t), `$`(t, 2))*M*l^2+1/2*m*(2*l^2*cos(phi(t))^2*diff(phi(t), `$`(t, 2))+2*l^2...ecua := [1/2*M*(1/2*l^2*cos(phi(t))^2*diff(phi(t), `$`(t, 2))+1/2*l^2*sin(phi(t))^2*diff(phi(t), `$`(t, 2)))+1/12*diff(phi(t), `$`(t, 2))*M*l^2+1/2*m*(2*l^2*cos(phi(t))^2*diff(phi(t), `$`(t, 2))+2*l^2...ecua := [1/2*M*(1/2*l^2*cos(phi(t))^2*diff(phi(t), `$`(t, 2))+1/2*l^2*sin(phi(t))^2*diff(phi(t), `$`(t, 2)))+1/12*diff(phi(t), `$`(t, 2))*M*l^2+1/2*m*(2*l^2*cos(phi(t))^2*diff(phi(t), `$`(t, 2))+2*l^2...ecua := [1/2*M*(1/2*l^2*cos(phi(t))^2*diff(phi(t), `$`(t, 2))+1/2*l^2*sin(phi(t))^2*diff(phi(t), `$`(t, 2)))+1/12*diff(phi(t), `$`(t, 2))*M*l^2+1/2*m*(2*l^2*cos(phi(t))^2*diff(phi(t), `$`(t, 2))+2*l^2...ecua := [1/2*M*(1/2*l^2*cos(phi(t))^2*diff(phi(t), `$`(t, 2))+1/2*l^2*sin(phi(t))^2*diff(phi(t), `$`(t, 2)))+1/12*diff(phi(t), `$`(t, 2))*M*l^2+1/2*m*(2*l^2*cos(phi(t))^2*diff(phi(t), `$`(t, 2))+2*l^2...ecua := [1/2*M*(1/2*l^2*cos(phi(t))^2*diff(phi(t), `$`(t, 2))+1/2*l^2*sin(phi(t))^2*diff(phi(t), `$`(t, 2)))+1/12*diff(phi(t), `$`(t, 2))*M*l^2+1/2*m*(2*l^2*cos(phi(t))^2*diff(phi(t), `$`(t, 2))+2*l^2...ecua := [1/2*M*(1/2*l^2*cos(phi(t))^2*diff(phi(t), `$`(t, 2))+1/2*l^2*sin(phi(t))^2*diff(phi(t), `$`(t, 2)))+1/12*diff(phi(t), `$`(t, 2))*M*l^2+1/2*m*(2*l^2*cos(phi(t))^2*diff(phi(t), `$`(t, 2))+2*l^2...ecua := [1/2*M*(1/2*l^2*cos(phi(t))^2*diff(phi(t), `$`(t, 2))+1/2*l^2*sin(phi(t))^2*diff(phi(t), `$`(t, 2)))+1/12*diff(phi(t), `$`(t, 2))*M*l^2+1/2*m*(2*l^2*cos(phi(t))^2*diff(phi(t), `$`(t, 2))+2*l^2...

   Paso 9. Asignación de valores numéricos a los parámetros que queden sun asignar para poder proceder a la integración numérica.

> m:=1; M:=9;g:=9.8;l:=3;m2:=0.001:

m := 1

M := 9

g := 9.8

l := 3

   Paso 10. Integración numérica del problema mediante la función fint asignando el resultado a la variable res.

> res:= fint([evalf(0.),evalf(0.),evalf(0.2),evalf(0.2)]):

   Paso 11. Procedemos a realizar una animación del movimiento del conjunto por medio de la función dibu3.

> dibu3(2,70);

[Plot]

>