# Ex 1.19 A two-bar linkage

Structure and Interpretation of Classical Mechanics

.

The two-bar linkage shown in figure 1.3 is constrained to move in the plane. It is composed of three small massive bodies interconnected by two massless rigid rods in a uniform gravitational field with vertical acceleration $\displaystyle{g}$. The rods are pinned to the central body by a hinge that allows the linkage to fold. The system is arranged so that the hinge is completely free: the members can go through all configurations without collision. Formulate a Lagrangian that describes the system and find the Lagrange equations of motion. Use the computer to do this, because the equations are rather big.

~~~

[guess]

```
(define ((F->C F) local)
(->local (time local)
(F local)
(+ (((partial 0) F) local)
(* (((partial 1) F) local)
(velocity local)))))

;

(define ((q->r l1 l2) local)
(let ((q (coordinate local)))
(let ((x2 (ref q 0))
(y2 (ref q 1))
(theta (ref q 2))
(phi (ref q 3)))
(let ((x1 (+ x2 (* l1 (cos theta))))
(y1 (+ y2 (* l1 (sin theta))))
(x3 (+ x2 (* l2 (cos phi))))
(y3 (+ y2 (* l2 (sin phi)))))
(up x1 y1 x2 y2 x3 y3)))))

;

(show-expression
((q->r 'l_1 'l_2)
(up 't
(up 'x_2 'y_2 'theta 'phi)

;

(define (KE m vx vy)
(* 1/2 m (+ (square vx) (square vy))))

(define ((T-rect m1 m2 m3) local)
(let ((q (coordinate local))
(v (velocity local)))
(let ((x1dot (ref v 0))
(y1dot (ref v 1))
(x2dot (ref v 2))
(y2dot (ref v 3))
(x3dot (ref v 4))
(y3dot (ref v 5)))
(+ (KE m1 x1dot y1dot)
(KE m2 x2dot y2dot)
(KE m3 x3dot y3dot)))))

(show-expression
((T-rect 'm_1 'm_2 'm_3)
(up 't
(up 'x_1 'y_1 'x_2 'y_2 'x_3 'y_3)
(up 'xdot_1 'ydot_1 'xdot_2 'ydot_2 'xdot_3 'ydot_3))))

;

```

[guess]

— Me@2021-03-12 05:37:27 PM

.

.