Ex 1.22 Driven pendulum, 2.1

Structure and Interpretation of Classical Mechanics

.

Show that the Lagrangian (1.89) …

~~~

[guess]

The Lagrangian (1.89):

Formally, we can reproduce Newton’s equations with the Lagrangian:

\displaystyle{ L(t;x, F; \dot x, \dot F)}

\displaystyle{= \sum_\alpha \frac{1}{2} m_\alpha \dot{\mathbf{x}_\alpha}^2  - V(t, x) - \sum_{\{ \alpha, \beta | \alpha < \beta, \alpha \leftrightarrow \beta \}} \frac{F_{\alpha \beta}}{2 l_{\alpha \beta}} \left[ (\mathbf{x}_\beta - \mathbf{x}_\alpha)^2 - l_{\alpha \beta}^2 \right] }

.


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

(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))))

(define ((U-gravity g m) q)
  (let* ((y (ref q 1)))
    (* m g y))) 

(define ((L-driven-free m l x_s y_s U) local)
  (let* ((extract (extract-particle 2))
	 
     (p (extract local 0))
     (q (coordinate p))
     (qdot (velocity p))
     
     (F (ref (coordinate local) 2)))
  
    (- (KE-particle m qdot)
       (U q)
       (U-constraint (up (x_s (time local)) (y_s (time local)))
		     q
		     F
		     l))))

(let* ((U (U-gravity 'g 'm))
       (x_s (literal-function 'x_s))
       (y_s (literal-function 'y_s))
       (L (L-driven-free 'm 'l x_s y_s U))
       (q-rect (up (literal-function 'x)
		           (literal-function 'y)
		           (literal-function 'F))))
  (show-expression
   ((compose L (Gamma q-rect)) 't)))

\displaystyle{     L     =     \frac{1}{2} m \left[(Dx)^2 + (Dy)^2 \right] - mgy     - \frac{F}{2l} \left[ (x-x_s)^2 + (y-y_s)^2 - l^2 \right] }

[guess]

— Me@2022-01-13 01:19:34 PM

.

.

2022.01.14 Friday (c) All rights reserved by ACHK

SICM, 4.2

This was a virtual machine running the installation of MS-DOS 6.22 in the program VMware Player.

VMware Player was able to run virtual machines, but not to create one. Luckily, there was a website that helped me create virtual machine files. A virtual machine file is just a VMware-formatted text file. It defines the specifications of that virtual machine.

Running MS-DOS 6.22 was just for nostalgia. The real reason for learning virtual machines was to use the mechanics software library of the textbook “Structure and Interpretation of Classical Mechanics”. That library was available only for Linux.

— Me@2021-12-31 01:29:46 PM

.

.

2021.12.31 Friday (c) All rights reserved by ACHK

Ex 1.22. Driven pendulum

Structure and Interpretation of Classical Mechanics

.

Show that the Lagrangian (1.89) can be used to describe the driven pendulum, where the position of the pivot is a specified function of time: Derive the equations of motion using the Newtonian constraint force prescription, …

~~~

[guess]

\displaystyle{ \begin{aligned}  m \ddot{y} &= F \cos \theta - mg \\  m \ddot{x} &= - F \sin \theta \\  \end{aligned}}

\displaystyle{ \begin{aligned}  m \ddot{y} &= F \frac{y_s - y}{l} - mg \\  m \ddot{x} &= - F \frac{x - x_s}{l} \\  \sqrt{(x_s - x)^2 + (y_s - y)^2} &= l \\  \end{aligned}}

[guess]

— Me@2021-12-30 09:25:17 AM

.

.

2021.12.30 Thursday (c) All rights reserved by ACHK

Ex 1.21 The dumbbell, 3.4.2

Structure and Interpretation of Classical Mechanics

.

e. Make a Lagrangian (\displaystyle{= T - V}) for the system described with the irredundant generalized coordinates \displaystyle{x_{cm}}, \displaystyle{y_{cm}}, \displaystyle{\theta} and compute the Lagrange equations from this Lagrangian. They should be the same equations as you derived for the same coordinates in part d.

~~~

[guess]


(define ((L-cm m0 m1 l) local)
  (let* ((q (coordinate local))
	 (v (velocity local))
	 (x_cm (ref q 0))
	 (y_cm (ref q 1))
	 (theta (ref q 2))

	 (x_cm_dot (ref v 0))
	 (y_cm_dot (ref v 1))
	 (theta_dot (ref v 2))
	 
	 (M (+ m0 m1))
	 (mu (/ 1 (+ (/ 1 m0) (/ 1 m1)))))

    (+ (* (/ 1 2) M (+ (square x_cm_dot) (square y_cm_dot)))
       (* (/ 1 2) mu (square l) (square theta_dot)))))

\displaystyle{ L_{cm} = \frac{1}{2} (m_0 + m_1) (\dot x_{CM}^2 + \dot y_{CM}^2 ) + \frac{1}{2} \mu l^2 \dot \theta^2 }


(show-expression
 (((Lagrange-equations
    (L-cm 'm_0 'm_1 'l))

   (up (literal-function 'x_cm)
       (literal-function 'y_cm)
       (literal-function 'theta)))
  't))

[guess]

— Me@2021-12-22 01:20:55 PM

.

.

2021.12.22 Wednesday (c) All rights reserved by ACHK

Ex 1.21 The dumbbell, 3.4

Structure and Interpretation of Classical Mechanics

.

e. Make a Lagrangian (\displaystyle{= T - V}) for the system described with the irredundant generalized coordinates \displaystyle{x_{cm}}, \displaystyle{y_{cm}}, \displaystyle{\theta} and compute the Lagrange equations from this Lagrangian. They should be the same equations as you derived for the same coordinates in part d.

~~~

Eq. 1.95:

\displaystyle{ L'(t;q,c,F; \dot q, \dot c, \dot F)}

\displaystyle{ = \sum_\alpha \frac{1}{2} m_\alpha \left( \partial_0 f_\alpha (t, q, c)   + \partial_1 f_\alpha (t, q,c) \dot q + \partial_2 f_\alpha (t, q, c) \dot c \right)^2   }

\displaystyle{   - V(t, f(t,q,c)) - \sum_{\{ \alpha, \beta | \alpha < \beta, \alpha \leftrightarrow \beta \}}   \frac{F_{\alpha \beta}}{2 l_{\alpha \beta}}   \left[   c_{\alpha \beta}^2 - l_{\alpha \beta}^2  \right]  }

.

Eq. 1.97:

\displaystyle{ L''(t,q,\dot q)}

\displaystyle{ = \sum_\alpha \frac{1}{2} m_\alpha \left( \partial_0 f_\alpha (t, q)   + \partial_1 f_\alpha (t, q) \dot q \right)^2 - V(t, f(t,q,l))  }

.

71

Consider a function \displaystyle{g} of, say, three arguments, and let \displaystyle{g_0} be a function of two arguments satisfying \displaystyle{g_0(x, y) = g(x, y, 0)}.

Then \displaystyle{(\partial_0 g_0)(x, y) = (\partial_0 g)(x, y, 0)}.

The substitution of a value in an argument commutes with the taking of the partial derivative with respect to a different argument. In deriving the Lagrange equations for \displaystyle{q} we can set \displaystyle{c = l} and \displaystyle{  \dot c = 0} in the Lagrangian, but we cannot do this in deriving the Lagrange equations associated with \displaystyle{c}, because we have to take derivatives with respect to those arguments.

.

[guess]

\displaystyle{ M = m_1 + m_2 }

\displaystyle{ \frac{1}{\mu} = \frac{1}{m_1} + \frac{1}{m_2} }

\displaystyle{ V = 0 }

.

\displaystyle{ T }

\displaystyle{ = \frac{1}{2} M v^2 + \frac{1}{2} I \omega^2 }

\displaystyle{ = \frac{1}{2} (m_0 + m_1) (\dot x_{CM}^2 + \dot y_{CM}^2 ) + \frac{1}{2} \left( m_1 r_1^2 + m_2 r_2^2 \right) \dot \theta^2 }

\displaystyle{ = \frac{1}{2} (m_0 + m_1) (\dot x_{CM}^2 + \dot y_{CM}^2 ) + \frac{1}{2} \left[ m_1 \left( \frac{m_2 l}{m_1 + m_2} \right)^2 + m_2 \left( \frac{m_1 l}{m_1 + m_2} \right)^2 \right] \dot \theta^2 }

\displaystyle{ = \frac{1}{2} (m_0 + m_1) (\dot x_{CM}^2 + \dot y_{CM}^2 ) + \frac{1}{2} m_1 m_2 \left( \frac{1}{m_1 + m_2} \right)^2   ( m_2 + m_1 ) l^2 \dot \theta^2 }

\displaystyle{ = \frac{1}{2} (m_0 + m_1) (\dot x_{CM}^2 + \dot y_{CM}^2 ) + \frac{1}{2} \frac{m_1 m_2}{m_1 + m_2} l^2 \dot \theta^2 }

\displaystyle{ = \frac{1}{2} (m_0 + m_1) (\dot x_{CM}^2 + \dot y_{CM}^2 ) + \frac{1}{2} \mu l^2 \dot \theta^2 }

[guess]

— Me@2021-11-24 09:58:31 PM

.

.

2021.11.26 Friday (c) All rights reserved by ACHK

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

.

.

2021.09.18 Saturday (c) All rights reserved by ACHK

上山尋寶, 2

重點副作用 6.2 | The non-side-effect-ness of side-effects, 6.2

這段改編自 2010 年 4 月 24 日的對話。

.

其實,我們可以考慮改變方案。雖然有些課題,可能幾個小時,就可以完成,但是,我們可以每個星期,也講不同的課題。

留意,雖然個別課題的成果,只會花幾小時,但是那是指,事先已有課題的情況下。那些有趣而深刻的課題,簡稱「勁題目」,並不會從天而降。那些勁題目本身,大部分情況下,只會在你開始研究,將會花「幾年加幾年」的苦功知識時,才會引發得到。

所以,我們先企圖進攻那些大題目,無論它們長遠是否,對你直接有用;因為,過程之中,自然會引發很多技術細節。而那些技術細節,很多是你直接可用。

例如,剛才因為跟你研究,大學力學課本《Structure and Interpretation of Classical Mechanics》(SICM),而提及到一個程式語言 Scheme programming language。而又因為研究該程式語言,而提及了一個,特別的文字編輯程式 Notepad++。雖然,大學力學和程式語言 Scheme 本身,對你而言,只是工餘興趣,但是,Notepad++ 卻是日常生活也有用。

原初辛苦上山的目的是,傳說中,山頂上的寶藏。但是,上到山頂後,才發現最珍貴的寶藏,反而是沿途找到的那些。

— Me@2021-08-16 04:31:19 PM

.

.

2021.08.16 Monday (c) All rights reserved by ACHK

Ex 1.21 The dumbbell, 3.2

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]

\displaystyle{ \begin{aligned}   m_0 \ddot y_0 &= F \sin \theta \\   m_0 \ddot x_0 &= F \cos \theta \\   m_1 \ddot y_1 &= -F \sin \theta \\   m_1 \ddot x_1 &= -F \cos \theta \\   \end{aligned}}

\displaystyle{ \begin{aligned}   y_{cm} &= \frac{m_0 y_0 + m_1 y_1}{m_0 + m_1} \\   x_{cm} &= \frac{m_0 x_0 + m_1 x_1}{m_0 + m_1} \\   \end{aligned}}

\displaystyle{ \begin{aligned}   \ddot y_{cm} &= \frac{F \sin \theta - F \sin \theta}{m_0 + m_1} = 0 \\   \ddot x_{cm} &= \frac{F \cos \theta - F \cos \theta}{m_0 + m_1} = 0 \\   \end{aligned}}

.

\displaystyle{ \begin{aligned}   y_0 &= y_{cm} - \frac{m_1}{M} c(t) \sin \theta \\   x_0 &= x_{cm} - \frac{m_1}{M} c(t) \cos \theta \\     y_1 &= y_{cm} + \frac{m_0}{M} c(t) \sin \theta \\   x_1 &= x_{cm} + \frac{m_0}{M} c(t) \cos \theta \\   \end{aligned}}

\displaystyle{ \begin{aligned}   x_1 - x_0 &= \frac{m_0}{M} c(t) \cos \theta + \frac{m_1}{M} c(t) \cos \theta \\   &= c(t) \cos \theta \\   \end{aligned}}

\displaystyle{ \begin{aligned}   \dot x_1 - \dot x_0 &= \dot c(t) \cos \theta - c(t) \dot \theta \sin \theta \\   \end{aligned}}

\displaystyle{ \begin{aligned}   \ddot x_1 - \ddot x_0 &=   \ddot c(t) \cos \theta - \dot c(t) \dot \theta \sin \theta   - \dot c(t) \dot \theta \sin \theta - c(t) \ddot \theta \sin \theta - c(t) \dot \theta^2 \cos \theta\\   \end{aligned}}

\displaystyle{ \begin{aligned}   y_1 - y_0 &= c(t) \sin \theta \\   \dot y_1 - \dot y_0 &= \dot c(t) \sin \theta + c(t) \dot \theta \cos \theta \\   \ddot y_1 - \ddot y_0   &=   \ddot c(t) \sin \theta + \dot c(t) \dot \theta \cos \theta   + \dot c(t) \dot \theta \cos \theta + c(t) \ddot \theta \cos \theta - c(t) \dot \theta^2 \sin \theta   \\   \end{aligned}}

.

\displaystyle{ \begin{aligned}   m_0 \ddot y_0 &= F \sin \theta \\   m_0 \ddot x_0 &= F \cos \theta \\   m_1 \ddot y_1 &= -F \sin \theta \\   m_1 \ddot x_1 &= -F \cos \theta \\   \end{aligned}}

When \displaystyle{\dot c(t) = 0} and \displaystyle{\ddot c(t) = 0},

\displaystyle{ \begin{aligned}   \ddot x_1 - \ddot x_0 &= - c(t) \ddot \theta \sin \theta - c(t) \dot \theta^2 \cos \theta \\     - \left( \frac{1}{m_1} + \frac{1}{m_1} \right) F \cos \theta &= - c(t) \ddot \theta \sin \theta - c(t) \dot \theta^2 \cos \theta\\   \end{aligned}}

\displaystyle{ \begin{aligned}     \ddot y_1 - \ddot y_0 &= ... \\     - \left( \frac{1}{m_1} + \frac{1}{m_0} \right) F \sin \theta &= c(t) \ddot \theta \cos \theta - c(t) \dot \theta^2 \sin \theta \\   \end{aligned}}

.

\displaystyle{ \begin{aligned}   \tan \theta &= \frac{ c(t) \ddot \theta \cos \theta - c(t) \dot \theta^2 \sin \theta }{- c(t) \ddot \theta \sin \theta - c(t) \dot \theta^2 \cos \theta} \\   &= \frac{ \ddot \theta - \dot \theta^2 \tan \theta }{- \ddot \theta \tan \theta - \dot \theta^2} \\   \end{aligned}}

\displaystyle{ \begin{aligned}   \tan \theta \left( - \ddot \theta \tan \theta - \dot \theta^2 \right) &= \ddot \theta - \dot \theta^2 \tan \theta \\   &... \\   0 &= \ddot \theta (1 + \tan^2 \theta) \\   \ddot \theta &= 0 \\   \end{aligned}}

.

\displaystyle{ \begin{aligned}   - \left( \frac{1}{m_1} + \frac{1}{m_0} \right) F \sin \theta &= c(t) \ddot \theta \cos \theta - c(t) \dot \theta^2 \sin \theta \\   - \left( \frac{1}{m_1} + \frac{1}{m_1} \right) F \cos \theta &= - c(t) \ddot \theta \sin \theta - c(t) \dot \theta^2 \cos \theta\\   \end{aligned}}

Let \displaystyle{\frac{1}{\mu} = \left( \frac{1}{m_1} + \frac{1}{m_1} \right)} and since \displaystyle{\ddot \theta = 0},

\displaystyle{ \begin{aligned}   - \frac{1}{\mu} F \sin \theta &= - c(t) \dot \theta^2 \sin \theta \\   - \frac{1}{\mu} F \cos \theta &= - c(t) \dot \theta^2 \cos \theta\\   \end{aligned}}

Since \displaystyle{\sin \theta} and \displaystyle{\cos \theta} cannot be both zero at the same time,

\displaystyle{ \begin{aligned}   - \frac{1}{\mu} F &= - c(t) \dot \theta^2 \\   \end{aligned}}

Put \displaystyle{c(t) = l},

\displaystyle{ \begin{aligned}   \frac{1}{\mu} F &= l \dot \theta^2 \\   \dot \theta^2 &= \frac{1}{l \mu} F \\   \end{aligned}}

[guess]

— Me@2021-08-08 05:41:21 PM

.

.

2021.08.10 Tuesday (c) All rights reserved by ACHK

Ex 1.21 The dumbbell, 2.2.2

[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))))

(let ((L (L-free-constrained 'm_0 'm_1 'l)))
  (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 ((local_ 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)))
    local))

(show-expression
 ((compose (local_ 'm_0 'm_1 'l) (Gamma q-rect)) 't))


(define ((p0_ 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)))
    p0))
 
(show-expression
 ((compose (p0_ 'm_0 'm_1 'l) (Gamma q-rect)) 't))


(define ((p1_ 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)))
    p1))
 
(show-expression
 ((compose (p1_ 'm_0 'm_1 'l) (Gamma q-rect)) 't))

[guess]

— based on /sicmutils/sicm-exercises

— Me@2021-04-27 05:03:59 PM

.

.

2021.05.11 Tuesday (c) All rights reserved by ACHK

Ex 1.21 The dumbbell, 2.2.1

Structure and Interpretation of Classical Mechanics

.

b. Write the formal Lagrangian

\displaystyle{L(t;x_0, y_0, x_1, y_1, F; \dot x_0, \dot y_0, \dot x_1, \dot y_1, \dot F)}

such that Lagrange’s equations will yield the Newton’s equations you derived in part a.

~~~

[guess]


(define (U-constraint q0 q1 F l)
  (* (/ F (* 2 l))
     (- (square (- q1 q0))
        (square 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 q-rect
  (up (literal-function 'x_0)
      (literal-function 'y_0)
      (literal-function 'x_1)
      (literal-function 'y_1)
      (literal-function 'F)))

(show-expression q-rect)


(show-expression (q-rect 't))


(show-expression (Gamma q-rect))


(show-expression ((Gamma q-rect) 'w))


(show-expression ((Gamma q-rect) 't))


(show-expression (time ((Gamma q-rect) 't)))


(show-expression (coordinate ((Gamma q-rect) 't)))

[guess]

— based on /sicmutils/sicm-exercises

— Me@2021-04-27 05:03:59 PM

.

.

2021.04.28 Wednesday (c) All rights reserved by ACHK

Ex 1.21 The dumbbell, 3

Structure and Interpretation of Classical Mechanics

.

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

~~~

[guess]

\displaystyle{ \begin{aligned}   y_{cm} &= \frac{m_0 y_0 + m_1 y_1}{m_0 + m_1} \\   x_{cm} &= \frac{m_0 x_0 + m_1 x_1}{m_0 + m_1} \\   \end{aligned}}

\displaystyle{ \begin{aligned}   y_{cm} &= \frac{m_0 y_0 + m_1 (y_0 + c(t) \sin \theta)}{m_0 + m_1} \\   x_{cm} &= \frac{m_0 x_0 + m_1 (x_0 + c(t) \cos \theta)}{m_0 + m_1} \\   \end{aligned}}

.

Let \displaystyle{M = m_0 + m_1}.

\displaystyle{ \begin{aligned}   y_{cm} &= \frac{M y_0 + m_1 c(t) \sin \theta}{M} \\   x_{cm} &= \frac{M x_0 + m_1 c(t) \cos \theta}{M} \\   \end{aligned}}

\displaystyle{ \begin{aligned}   y_0 &= y_{cm} - \frac{m_1}{M} c(t) \sin \theta \\   x_0 &= x_{cm} - \frac{m_1}{M} c(t) \cos \theta \\   \end{aligned}}

\displaystyle{ \begin{aligned}   y_1 &= y_{cm} + \frac{m_0}{M} c(t) \sin \theta \\   x_1 &= x_{cm} + \frac{m_0}{M} c(t) \cos \theta \\   \end{aligned}}

.

The Lagrangian

\displaystyle{ \begin{aligned}   L &= \frac{1}{2} m_0 (\dot x_0^2 + \dot y_0^2) + \frac{1}{2} m_1 (\dot x_1^2 + \dot y_1^2) + \lambda \left[ (x_1(t) - x_0(t))^2 + (y_1(t) - y_0(t))^2 - l^2 \right] \\     &= \frac{1}{2} m_0 (\dot x_0^2 + \dot y_0^2) + \frac{1}{2} m_1 (\dot x_1^2 + \dot y_1^2)   - \frac{F}{2l} \left[ (c(t))^2 - l^2 \right] \\   \end{aligned}}

.

\displaystyle{ \begin{aligned}   \dot y_0 &= \dot y_{cm} - \frac{m_1}{M} \dot c(t) \sin \theta - \frac{m_1}{M} c(t) \dot \theta \cos \theta\\  \dot x_0 &= \dot x_{cm} - \frac{m_1}{M} \dot c(t) \cos \theta - \frac{m_1}{M} c(t) \dot \theta \sin \theta \\   \end{aligned}}

[guess]

— Me@2021-04-17 05:40:46 PM

.

.

2021.04.18 Sunday (c) All rights reserved by ACHK

Ex 1.21 The dumbbell, 2

Structure and Interpretation of Classical Mechanics

.

Notice that these forces of constraint are proportional to the normal to the constraint surface at each instant and thus do no work for motions that obey the constraint.

b. Write the formal Lagrangian

\displaystyle{L(t;x_0, y_0, x_1, y_1, F; \dot x_0, \dot y_0, \dot x_1, \dot y_1, \dot F)}

such that Lagrange’s equations will yield the Newton’s equations you derived in part a.

~~~

[guess]

Eq (1.99):

\displaystyle{L(t;x,\lambda; \dot x, \dot \lambda) = \sum_\alpha \frac{1}{2} m_\alpha \dot{\mathbf{x}}_\alpha^2 - V(t,x) + \lambda \phi(t,x)}

\displaystyle{  \begin{aligned}  L &= \frac{1}{2} m_0 (\dot x_0^2 + \dot y_0^2) + \frac{1}{2} m_1 (\dot x_1^2 + \dot y_1^2) + \lambda \left[ (x_1(t) - x_0(t))^2 + (y_1(t) - y_0(t))^2 - l^2 \right] \\   \end{aligned}}

.

The Lagrange equation:

\displaystyle{ \begin{aligned}   D ( \partial_2 L \circ \Gamma[q]) - (\partial_1 L \circ \Gamma[q]) &= 0 \\   \end{aligned}}

\displaystyle{ \begin{aligned}   \frac{d}{dt} \frac{\partial L}{\partial \dot x_0} - \frac{\partial L}{\partial x_0} &= 0 \\   \frac{d}{dt} \frac{\partial L}{\partial \dot x_1} - \frac{\partial L}{\partial x_1} &= 0 \\   \frac{d}{dt} \frac{\partial L}{\partial \dot y_0} - \frac{\partial L}{\partial y_0} &= 0 \\   \frac{d}{dt} \frac{\partial L}{\partial \dot y_1} - \frac{\partial L}{\partial y_1} &= 0 \\   \frac{d}{dt} \frac{\partial L}{\partial \dot \lambda} - \frac{\partial L}{\partial \lambda} &= 0 \\  \end{aligned}}

\displaystyle{ \begin{aligned}   \frac{d}{dt} \left( m_0 \dot x_0 \right) + \left( \lambda 2 (x_1 - x_0)\right) &= 0 \\   \frac{d}{dt} \left( m_0 \dot x_1 \right) - \left( \lambda 2 (x_1 - x_0)\right) &= 0 \\   \frac{d}{dt} \left( m_0 \dot y_0 \right) + \left( \lambda 2 (y_1 - y_0)\right) &= 0 \\   \frac{d}{dt} \left( m_0 \dot y_1 \right) - \left( \lambda 2 (y_1 - y_0)\right) &= 0 \\   \frac{d}{dt} \left( 0 \right) - \left[ (x_1(t) - x_0(t))^2 + (y_1(t) - y_0(t))^2 - l^2 \right] &= 0 \\  \end{aligned}}

\displaystyle{ \begin{aligned}   m_0 \ddot x_0 &= - 2 \lambda (x_1 - x_0) \\   m_0 \ddot x_1 &= 2 \lambda (x_1 - x_0) \\   m_0 \ddot y_0 &= - 2 \lambda (y_1 - y_0) \\   m_0 \ddot y_1 &= 2 \lambda (y_1 - y_0) \\   (x_1(t) - x_0(t))^2 + (y_1(t) - y_0(t))^2 - l^2 &= 0 \\  \end{aligned}}

.

Let \displaystyle{\lambda = - \frac{F}{2l}}:

\displaystyle{ \begin{aligned}   m_0 \ddot x_0 &= F \frac{(x_1 - x_0)}{l} \\   m_0 \ddot x_1 &= -F \frac{(x_1 - x_0)}{l} \\   m_0 \ddot y_0 &= F \frac{(y_1 - y_0)}{l} \\   m_0 \ddot y_1 &= -F \frac{(y_1 - y_0)}{l} \\   \end{aligned}}

\displaystyle{ \begin{aligned}   m_0 \ddot y_0 &= F \sin \theta \\   m_0 \ddot x_0 &= F \cos \theta \\   m_0 \ddot y_1 &= -F \sin \theta \\   m_0 \ddot x_1 &= -F \cos \theta \\   \end{aligned}}

[guess]

— Me@2021-04-09 11:18:07 PM

.

.

2021.04.10 Saturday (c) All rights reserved by ACHK

Ex 1.21 The dumbbell

Consider two massive particles in the plane constrained by a massless rigid rod to remain a distance l apart, as in figure 1.5.

a. Write Newton’s equations for the balance of forces for the four rectangular coordinates of the two particles, given that the scalar tension in the rod is F.

~~~

[guess]

\displaystyle{m_0 \ddot y_0 = F \sin \theta}

\displaystyle{m_0 \ddot x_0 = F \cos \theta}

\displaystyle{m_1 \ddot y_1 = - F \sin \theta}

\displaystyle{m_1 \ddot x_1 = - F \cos \theta}

[guess]

— Me@2021-04-04 03:51:05 PM

.

.

2021.04.04 Sunday (c) All rights reserved by ACHK

Ex 1.20 Sliding pendulum

Structure and Interpretation of Classical Mechanics

.

Consider a pendulum of length l attached to a support that is free to move horizontally, as shown in figure 1.4. Let the mass of the support be m_1 and the mass of the pendulum be m_2. Formulate a Lagrangian and derive Lagrange’s equations for this system.

~~~

[guess]


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

;

(define ((q->r l y1) local)
  (let ((q (coordinate local)))
    (let ((x1 (ref q 0))
          (theta (ref q 1)))
      (let ((x2 (+ x1 (* l (sin theta))))
            (y2 (- y1 (* l (cos theta)))))
        (up x1 y1 x2 y2)))))

(show-expression
  ((q->r 'l 'y_1) 
     (up 't
         (up 'x_1 'theta)
         (up 'xdot_1 'thetadot))))

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

(define ((T-rect m1 m2) 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)))
      (+ (KE m1 x1dot y1dot)
         (KE m2 x2dot y2dot)))))

(show-expression
 ((T-rect 'm_1 'm_2)
    (up 't
        (up 'x_1 'y_1 'x_2 'y_2)
        (up 'xdot_1 'ydot_1 'xdot_2 'ydot_2))))
 
;

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

(show-expression
 ((U-rect 'g 'm_1 'm_2)
    (up 't
        (up 'x_1 'y_1 'x_2 'y_2)
        (up 'xdot_1 'ydot_1 'xdot_2 'ydot_2))))

;

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

(show-expression
 ((L-rect 'g 'm_1 'm_2)
    (up 't
        (up 'x_1 'y_1 'x_2 'y_2)
        (up 'xdot_1 'ydot_1 'xdot_2 'ydot_2))))

;

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

(show-expression
 ((L-l 'l 'y_1 'g 'm_1 'm_2)
  (->local 't
	   (up 'x_1 'theta)
	   (up 'xdot_1 'thetadot))))

; 

(show-expression
 (((Lagrange-equations
    (L-l 'l 'y_1 'g 'm_1 'm_2))
   (up
    (literal-function 'x_1)
    (literal-function 'theta)))
  't))

;

[guess]

— Me@2021-03-26 08:22:01 PM

.

.

2021.03.28 Sunday (c) All rights reserved by ACHK

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

.

.

2021.03.20 Saturday (c) All rights reserved by ACHK

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)
	     (up 'xdot_2 'ydot_2 'thetadot 'phidot))))

;

(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

.

.

2021.03.14 Sunday (c) All rights reserved by ACHK

Ex 1.18 Bead on a triaxial surface, 2

Structure and Interpretation of Classical Mechanics

.

A bead of mass m moves without friction on a triaxial ellipsoidal surface. In rectangular coordinates the surface satisfies

\displaystyle{\frac{x^2}{a^2} + \frac{y^2}{b^2} + \frac{z^2}{c^2} = 1}

for some constants a, b, and c. Identify suitable generalized coordinates, formulate a Lagrangian, and find Lagrange’s equations.

~~~

[guess]

The generalized coordinates:

\displaystyle{\begin{aligned}  x &= a \sin(\theta )\cos(\varphi),\\  y &= b \sin(\theta )\sin(\varphi),\\  z &= c \cos(\theta),  \end{aligned}}

where

{\displaystyle 0\leq \theta \leq \pi ,\qquad 0\leq \varphi <2\pi .}

.

{\displaystyle {\begin{aligned} \dot x &= a \dot \theta \cos(\theta) \cos(\varphi) - a \dot \varphi\sin(\theta ) \sin(\varphi) \\ \dot y &= b \dot \theta \cos(\theta) \sin(\varphi) + b \dot \varphi \sin(\theta) \cos(\varphi) \\ \dot z &= - c \dot \theta \sin(\theta) \end{aligned}}}


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

;

(define ((e->r a b c) local)
  (let ((q (coordinate local)))
    (let ((theta (ref q 0)) 
          (phi (ref q 1)))
      (let ((x (* a (sin theta) (cos phi)))
	    (y (* b (sin theta) (sin phi)))
	    (z (* c (cos theta))))
        (up x y z)))))

;

(define ((L-rect m) local)
  (let ((q (coordinate local))
        (v (velocity local)))
    (* 1/2 m (square v))))

(define (L-e m a b c)
  (compose (L-rect m) (F->C (e->r a b c))))

;

(show-expression
  ((L-e 'm 'a 'b 'c)
   (->local 't
             (up 'theta 'phi) 
             (up 'thetadot 'phidot))))

;

(show-expression
 (((Lagrange-equations
    (L-e 'm 'a 'b 'c))
   (up (literal-function 'theta) (literal-function 'phi)))
  't))
 

[guess]

— Me@2021-03-01 06:22:50 PM

.

.

2021.03.02 Tuesday (c) All rights reserved by ACHK

Ex 1.18 Bead on a triaxial surface

Structure and Interpretation of Classical Mechanics

.

A bead of mass m moves without friction on a triaxial ellipsoidal surface. In rectangular coordinates the surface satisfies

\displaystyle{\frac{x^2}{a^2} + \frac{y^2}{b^2} + \frac{z^2}{c^2} = 1}

for some constants a, b, and c. Identify suitable generalized coordinates, formulate a Lagrangian, and find Lagrange’s equations.

~~~

[guess]

The generalized coordinates:

{\displaystyle {\begin{aligned}x&=a\sin(\theta )\cos(\varphi),\\y&=b\sin(\theta )\sin(\varphi),\\z&=c\cos(\theta),\end{aligned}}\,\!}

where

{\displaystyle 0\leq \theta \leq \pi ,\qquad 0\leq \varphi <2\pi .}

.

{\displaystyle {\begin{aligned}  \dot x &= a \dot \theta \cos(\theta) \cos(\varphi) - a \dot \varphi\sin(\theta ) \sin(\varphi) \\  \dot y &= b \dot \theta \cos(\theta) \sin(\varphi) + b \dot \varphi \sin(\theta) \cos(\varphi) \\  \dot z &= - c \dot \theta \sin(\theta)   \end{aligned}}}


(define theta (literal-function 'theta))

(define phi (literal-function 'phi))

; 

(define (x t) (* 'a (sin (theta t)) (cos (phi t))))

((D x) 't)

(show-expression ((D x) 't))

;

(define (y t) (* 'b (sin (theta t)) (sin (phi t))))

(show-expression (y 't))

((D y) 't)

(show-expression ((D y) 't))

[guess]

— Me@2021-02-16 07:20:25 AM

.

.

2021.02.18 Thursday (c) All rights reserved by ACHK

Ex 1.17 Bead on a helical wire

Structure and Interpretation of Classical Mechanics

.

A bead of mass m is constrained to move on a frictionless helical wire. The helix is oriented so that its axis is horizontal. The diameter of the helix is d and its pitch (turns per unit length) is h. The system is in a uniform gravitational field with vertical acceleration g. Formulate a Lagrangian that describes the system and find the Lagrange equations of motion.

~~~

[guess]

The coordinates of the bead is

\displaystyle{\left( \frac{d}{2} \cos \theta, \frac{d}{2} \sin \theta, \frac{\theta}{2 \pi} h \right)},

where the \displaystyle{x}-direction is horizontal, the \displaystyle{y}-direction points upwards, and the \displaystyle{z}-direction is along the axis of the helix.

.

Lagrangian \displaystyle{L = T - V}, where the kinetic energy, \displaystyle{T = \frac{1}{2} m \left( \dot x^2 + \dot y^2 + \dot z^2 \right)} and the potential energy, \displaystyle{V = m g y}.

\displaystyle{ (\dot x, \dot y, \dot z) = \left( \frac{-d}{2} (\sin \theta) \dot \theta, \frac{d}{2} (\cos \theta) \dot \theta, \frac{h}{2 \pi} \dot \theta \right)}

\displaystyle{L = \frac{1}{2} m \left( \frac{d^2}{4} + \frac{h^2}{4 \pi^2} \right) \dot \theta^2 - \frac{d}{2} m g \sin \theta}

\displaystyle{\frac{\partial L}{\partial \dot \theta} = m \left( \frac{d^2}{4} + \frac{h^2}{4 \pi^2} \right) \dot \theta}
\displaystyle{\frac{\partial L}{\partial \theta} = - \frac{d}{2} m g \cos \theta}

.

The Lagrange equation:

\displaystyle{ \begin{aligned} D ( \partial_2 L \circ \Gamma[q]) - (\partial_1 L \circ \Gamma[q]) &= 0 \\   \frac{d}{dt} \frac{\partial L}{\partial \dot \theta} - \frac{\partial L}{\partial \theta} &= 0 \\    m \left( \frac{d^2}{4} + \frac{h^2}{4 \pi^2} \right) \ddot{\theta} + \frac{d}{2} m g \cos \theta &= 0 \\   \end{aligned}}

.


(define ((T-hl d h m g) local)
  (let ((t (time local))
        (thetadot (velocity local)))    
    (* 1/8 m (square thetadot) 'H)))

;; (+ (square d) 
;; (/ (square h) (square 'pi))))))

(show-expression
  ((T-hl 'd 'h 'm 'g)
    (->local 't
             'theta
             'thetadot)))

(define ((V-hl d h m g) local)
  (let ((t (time local))
        (theta (coordinate local)))
    (let ((y (* 1/2 d (sin theta))))
      (* m g y))))


(show-expression
  ((V-hl 'd 'h 'm 'g)
    (->local 't
             'theta
             'thetadot)))

(define L-hl (- T-hl V-hl))

(show-expression
  ((L-hl 'd 'h 'm 'g)
    (->local 't
             'theta
             'thetadot)))

(show-expression
 (((Lagrange-equations
    (L-hl 'd 'h 'm 'g))
   (literal-function 'theta))
  't))

[guess]

— Me@2021-02-05 04:23:02 PM

.

.

2021.02.06 Saturday (c) All rights reserved by ACHK

Ex 1.15 Central force motion

Structure and Interpretation of Classical Mechanics

.

Find Lagrangians for central force motion in three dimensions in rectangular coordinates and in spherical coordinates. First, find the Lagrangians analytically, then check the results with the computer by generalizing the programs that we have presented.

~~~

The Lagrangians in rectangular coordinates:

\displaystyle{ \begin{aligned}   &L (t; x, y, x; v_x, v_y, v_z) \\  &= \frac{1}{2} m \left( v_x^2 + v_y^2 + v_z^2 \right) - U \left( \sqrt{x^2 + y^2 + z^2} \right) \\   \end{aligned}}

The Lagrangians in spherical coordinates:

\displaystyle{ \begin{aligned}   &L (t; r, \theta, \phi; \dot r, \dot \theta, \dot \phi) \\  &= \frac{1}{2} m r^2 \dot \phi^2 (\sin \theta)^2 + \frac{1}{2} m \dot \theta^2 r^2 + \frac{1}{2} m \dot r^2 - U (r) \\   &= \frac{1}{2} m \left( \dot r^2 + r^2 \dot \theta^2 + r^2 (\sin^2 \theta) \dot \phi^2 \right) - U (r) \\   \end{aligned}}

.


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

(define (p->r local)
  (let ((polar-tuple (coordinate local)))
    (let ((r (ref polar-tuple 0)) 
          (theta (ref polar-tuple 1))
	  (phi (ref polar-tuple 2)))
      (let ((x (* r (sin theta) (cos phi))) 
            (y (* r (sin theta) (sin phi)))
	    (z (* r (cos theta))))
        (up x y z)))))

(define ((L-central-rectangular m U) local)
  (let ((q (coordinate local))
        (v (velocity local)))
    (- (* 1/2 m (square v))
       (U (sqrt (square q))))))

(define (L-central-polar m U)
  (compose (L-central-rectangular m U) (F->C p->r)))

(show-expression
  ((L-central-polar 'm (literal-function 'U))
   (->local 't 
             (up 'r 'theta 'phi) 
             (up 'rdot 'thetadot 'phidot))))

.

— Me@2021-01-22 02:59:11 PM

.

.

2021.01.22 Friday (c) All rights reserved by ACHK