Hi,
Thanks
I was able to generate the equations of motions for the Trebuchet and calculate the Lagrangian.
I tried using the equations of Projectile motion as well. But I am not quite sure as to how to combine the equations from Projectile with Air Drag into the Trebuchet equations to animate the projectile to actually leave the Trebuchet and make an impact against something like a wall at a distance say x='constant'.
Is there any specific way to do that?
The equations I got were:
cn = {L1, L2, L3, L4, m1, m2, mb, rg, rc};
(*Coordinates of the short end of the beam*) (*Defined 'a'*)
x1[?_] := L1 *Sin[?];
y1[?_] := -L1 *Cos[?];
(*Coordinates of the long end of the beam:*) (*Defined 'b'*)
x2[?_] := -L2* Sin[?];
y2[?_] := L2 *Cos[?];
(*Coordinates of the center of mass of the Counterweight*) \
(*Defined 'c'*)
x4[?_, ?_] :=
L1* Sin[?] - L4 *Sin[? + ?];
y4[?_, ?_] := -L1 *Cos[?] +
L4* Cos[? + ?];
(*Coordinates of the Projectile end of the Sling *) (*Defined 'd'*)
x3[?_, ?_] := -(L3 *Sin[? - ?] +
L2* Sin[?]);
y3[?_, ?_] := -(L3 *Cos[? - ?] -
L2* Cos[?]);
(* potential energy of the three parts:*)
PE[?_, ?_, ?_] :=
m1 *g* y4[?, ?] + m2 *g* y3[?, ?] -
mb* g* rc *Cos[?];
(* kinetic energy of the three parts:*)
KE[?_, ?_, ?_] :=
0.5*m1*((Dt[x4[?, ?], t, Constants -> cn])^2 + (Dt[
y4[?, ?], t, Constants -> cn])^2
) + 0.5*
m2 *((Dt[x3[?, ?], t, Constants -> cn])^2 + (Dt[
y3[?, ?, Constants -> cn], t])^2) +
(mb/2) *(rg^2)* Dt[?, t, Constants -> cn]^2;
(* the lagrangian*)
Lag = KE - PE;
L[?_, ?_, ?_] :=
KE[?, ?, ?] - PE[?, ?, ?];
(* define what is constant, and the derivatives of the angles, \
denoted by the "d" suffix:*)
EL = L[?, ?, ?] /. {Dt[?, t,
Constants -> {L1, L2, L3, L4, m1, m2, mb, rg, rc}] -> ?d,
Dt[?, t,
Constants -> {L1, L2, L3, L4, m1, m2, mb, rg, rc}] -> ?d,
Dt[?, t,
Constants -> {L1, L2, L3, L4, m1, m2, mb, rg, rc}] -> ?d,
Dt[?, t] -> ?d, Dt[?, t] -> ?d,
Dt[?, t] -> ?d};
eq? =
Simplify[
Dt[D[EL, ?d], t] - D[EL, ?] == 0 /. {Dt[L1, t] -> 0,
Dt[L2, t] -> 0, Dt[L3, t] -> 0, Dt[L4, t] -> 0, Dt[mb, t] -> 0,
Dt[m1, t] -> 0, Dt[m2, t] -> 0, Dt[g, t] -> 0, Dt[rg, t] -> 0,
Dt[rc, t] -> 0,
Dt[?, t] -> ?d, Dt[?, t] -> ?d,
Dt[?, t] -> ?d, Dt[?d, t] -> ?dd,
Dt[?d, t] -> ?dd, Dt[?d, t] -> ?dd}];
eq? =
Simplify[Dt[D[EL, ?d], t] - D[EL, ?] ==
0 /. {Dt[L1, t] -> 0, Dt[L2, t] -> 0, Dt[L3, t] -> 0,
Dt[L4, t] -> 0, Dt[mb, t] -> 0, Dt[m1, t] -> 0, Dt[m2, t] -> 0,
Dt[g, t] -> 0, Dt[rg, t] -> 0, Dt[rc, t] -> 0,
Dt[?, t] -> ?d, Dt[?, t] -> ?d,
Dt[?, t] -> ?d, Dt[?d, t] -> ?dd,
Dt[?d, t] -> ?dd, Dt[?d, t] -> ?dd}];
eq? =
Simplify[Dt[D[EL, ?d], t] - D[EL, ?] ==
0 /. {Dt[L1, t] -> 0, Dt[L2, t] -> 0, Dt[L3, t] -> 0,
Dt[L4, t] -> 0, Dt[mb, t] -> 0, Dt[m1, t] -> 0, Dt[m2, t] -> 0,
Dt[g, t] -> 0, Dt[rg, t] -> 0, Dt[rc, t] -> 0,
Dt[?, t] -> ?d, Dt[?, t] -> ?d,
Dt[?, t] -> ?d, Dt[?d, t] -> ?dd,
Dt[?d, t] -> ?dd, Dt[?, t] -> ?dd}];
sol = Solve[{eq?, eq?, eq?}, {?dd, ?dd, ?dd}];
Thanks