# Ex 1.21 The dumbbell, 3.3

Structure and Interpretation of Classical Mechanics

.

c. Make a change of coordinates to a coordinate system with center of mass coordinates $\displaystyle{x_{cm}}$, $\displaystyle{y_{cm}}$, angle $\displaystyle{\theta}$, distance between the particles $\displaystyle{c}$, and tension force $\displaystyle{F}$. Write the Lagrangian in these coordinates, and write the Lagrange equations.

~~~

[guess]


(define (KE-particle m v)
(* 1/2 m (square v)))

(define ((L-free-constrained m0 m1 l) local)
(let* ((extract (extract-particle 2))
(p0 (extract local 0))
(q0 (coordinate p0))
(qdot0 (velocity p0))

(p1 (extract local 1))
(q1 (coordinate p1))
(qdot1 (velocity p1))

(F (ref (coordinate local) 4)))

(- (+ (KE-particle m0 qdot0)
(KE-particle m1 qdot1))
(U-constraint q0 q1 F l))))

(define ((extract-particle pieces) local i)
(let* ((indices (apply up (iota pieces (* i pieces))))
(extract (lambda (tuple)
(vector-map (lambda (i)
(ref tuple i))
indices))))
(up (time local)
(extract (coordinate local))
(extract (velocity local)))))

(define (U-constraint q0 q1 F l)
(* (/ F (* 2 l))
(- (square (- q1 q0))
(square l))))

(let ((L (L-free-constrained 'm_0 'm_1 'l))
(q-rect (up (literal-function 'x_0)
(literal-function 'y_0)
(literal-function 'x_1)
(literal-function 'y_1)
(literal-function 'F))))
(show-expression
((compose L (Gamma q-rect)) 't))) $\displaystyle{ \frac{1}{2} m_0 \left( \dot x_0^2 + \dot y_0^2 \right) + \frac{1}{2} m_1 \left( \dot x_1^2 + \dot y_1^2 \right) + \frac{F}{2 l} \left( l^2 - y_1^2 + 2 y_0 y_1 - x_1^2 + 2 x_0 x_1 - y_0^2 - x_0^2 \right) }$ $\displaystyle{ = \frac{1}{2} m_0 \left( \dot x_0^2 + \dot y_0^2 \right) + \frac{1}{2} m_1 \left( \dot x_1^2 + \dot y_1^2 \right) - \frac{F}{2 l} \left[ (y_1 - y_0)^2 + (x_1 - x_0)^2 - l^2 \right] }$


(define ((q->r m0 m1) local)
(let ((q (coordinate local)))
(let ((x_cm (ref q 0))
(y_cm (ref q 1))
(theta (ref q 2))
(c (ref q 3))
(F (ref q 4))
(M (+ m0 m1)))
(let ((x0 (- x_cm (* (/ m1 M) c (cos theta))))
(y0 (- y_cm (* (/ m1 M) c (sin theta))))
(x1 (+ x_cm (* (/ m0 M) c (cos theta))))
(y1 (+ y_cm (* (/ m0 M) c (sin theta)))))
(up x0 y0 x1 y1 F)))))

(let ((q (up (literal-function 'x_cm)
(literal-function 'y_cm)
(literal-function 'theta)
(literal-function 'c)
(literal-function 'F))))
(show-expression (q 't))) (show-expression
(up 't
(up 'x_cm 'y_cm 'theta 'c 'F)
(up 'xdot_cm 'ydot_cm 'thetadot 'cdot 'Fdot))) (show-expression
((q->r 'm_0 'm_1)
(up 't
(up 'x_cm 'y_cm 'theta 'c 'F)
(up 'xdot_cm 'ydot_cm 'thetadot 'cdot 'Fdot)))) (let ((q (up (literal-function 'x_cm)
(literal-function 'y_cm)
(literal-function 'theta)
(literal-function 'c)
(literal-function 'F))))
(show-expression ((q->r 'm_0 'm_1) ((Gamma q) 't)))) (show-expression
((F->C (q->r 'm_0 'm_1))
(up 't
(up 'x_cm 'y_cm 'theta 'c 'F)
(up 'xdot_cm 'ydot_cm 'thetadot 'cdot 'Fdot)))) (define (L-cm m0 m1 l)
(compose
(L-free-constrained m0 m1 l) (F->C (q->r m0 m1))))

(show-expression
((L-cm 'm_0 'm_1 'l)
(up 't
(up 'x_cm 'y_cm 'theta 'c 'F)
(up 'xdot_cm 'ydot_cm 'thetadot 'cdot 'Fdot))))  $\displaystyle{ \frac{1}{\mu} = \frac{1}{m_0} + \frac{1}{m_1} }$ $\displaystyle{ L_{cm} }$ $\displaystyle{ = \frac{ ( c^2 \dot \theta^2 + \dot c^2 ) l m_0 m_1 + (l m_0^2 + 2 l m_0 m_1 + l m_1^2) (\dot x_{cm}^2 + \dot y_{cm}^2) + F ( l^2 - c^2 )(m_0 + m_1) }{2 l (m_0 + m_1)} }$ $\displaystyle{ = \frac{ ( c^2 \dot \theta^2 + \dot c^2 ) l m_0 m_1 + l (m_0 + m_1)^2 (\dot x_{cm}^2 + \dot y_{cm}^2) + F ( l^2 - c^2 )(m_0 + m_1) }{2 l (m_0 + m_1)} }$ $\displaystyle{ = \frac{1}{2} ( c^2 \dot \theta^2 + \dot c^2 ) \mu + \frac{1}{2} (m_0 + m_1) (\dot x_{cm}^2 + \dot y_{cm}^2) + \frac{1}{2l} F ( l^2 - c^2 ) }$


(show-expression
(((Lagrange-equations
(L-cm 'm_0 'm_1 'l))
(up (literal-function 'x_cm)
(literal-function 'y_cm)
(literal-function 'theta)
(literal-function 'c)
(literal-function 'F)))
't)) (show-expression
(((Lagrange-equations
(L-cm 'm_0 'm_1 'l))
(up (literal-function 'x_cm)
(literal-function 'y_cm)
(literal-function 'theta)
(lambda (t) 'l)
(literal-function 'F)))
't)) [guess]

— Me@2021-09-17 06:35:51 AM

.

.