# Ex 1.19 A two-bar linkage, 2

Structure and Interpretation of Classical Mechanics

.

… Formulate a Lagrangian that describes the system and find the Lagrange equations of motion …

~~~

[guess]

```
(define ((U-rect g m1 m2 m3) local)
(let* ((q (coordinate local))
(y1 (ref q 1))
(y2 (ref q 3))
(y3 (ref q 5)))
(* g (+ (* m1 y1)
(* m2 y2)
(* m3 y3)))))

;

(define (L-rect g m1 m2 m3)
(- (T-rect m1 m2 m3) (U-rect g m1 m2 m3)))

(show-expression
((L-rect 'g '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))))

;

(define (L-l l1 l2 g m_1 m_2 m_3)
(compose
(L-rect g m_1 m_2 m_3) (F->C (q->r l1 l2))))

(show-expression
((L-l 'l_1 'l_2 'g 'm_1 'm_2 'm_3)
(->local 't
(up 'x_2 'y_2 'theta 'phi)
(up 'xdot_2 'ydot_2 'thetadot 'phidot))))

;

(show-expression
(((Lagrange-equations
(L-l 'l_1 'l_2 'g 'm_1 'm_2 'm_3))
(up
(literal-function 'x_2)
(literal-function 'y_2)
(literal-function 'theta)
(literal-function 'phi)))
't))

;

```

[guess]

— Me@2021-03-20 05:01:21 PM

.

.