Structure and Interpretation of Classical Mechanics
.
c. Make a change of coordinates to a coordinate system with center of mass coordinates
,
, angle
, distance between the particles
, and tension force
. 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[ (y_1 - y_0)^2 + (x_1 - x_0)^2 - l^2 \right] }](https://s0.wp.com/latex.php?latex=%5Cdisplaystyle%7B+%3D+%5Cfrac%7B1%7D%7B2%7D+m_0+%5Cleft%28+%5Cdot+x_0%5E2+%2B+%5Cdot+y_0%5E2+%5Cright%29+%2B+%5Cfrac%7B1%7D%7B2%7D+m_1+%5Cleft%28+%5Cdot+x_1%5E2+%2B+%5Cdot+y_1%5E2+%5Cright%29+-+%5Cfrac%7BF%7D%7B2+l%7D+%5Cleft%5B+%28y_1+-+y_0%29%5E2+%2B+%28x_1+-+x_0%29%5E2+-+l%5E2+%5Cright%5D+%7D&bg=ffffff&fg=333333&s=0&c=20201002)
(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))))






(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
.
.
2021.09.18 Saturday (c) All rights reserved by ACHK
You must be logged in to post a comment.