Ex 1.25 Properties of Dt

Structure and Interpretation of Classical Mechanics

.

The total time derivative \displaystyle{D_t F} is not the derivative of the function \displaystyle{F}. Nevertheless, the total time derivative shares many properties with the derivative. Demonstrate that \displaystyle{D_t} has the following properties …

\displaystyle{D_t (F + G) = D_t F + D_t G}

~~~

Eq. (1.108):

\displaystyle{  D(F \circ \Gamma[q]) = (DF\circ\Gamma[q])D\Gamma[q]   }

Eq. (1.109):

\displaystyle{  DF \circ \Gamma[q] = \left[ \partial_0 F \circ \Gamma[q], \partial_1 F \circ \Gamma[q], \partial_2 F \circ \Gamma[q], ...  \right]   }

Eq. (1.110):

\displaystyle{  \left(D \Gamma[q] \right)(t)   = \left( 1, Dq(t), D^2 q(t), ... \right)  = \begin{bmatrix} 1 \\ Dq(t) \\ D^2 q(t) \\ ... \\ \end{bmatrix} \\   }

.

\displaystyle{  \begin{aligned}  D(F \circ \Gamma[q])(t)   &= (DF\circ\Gamma[q])D\Gamma[q](t) \\   &= \left[ \partial_0 F \circ \Gamma[q], \partial_1 F \circ \Gamma[q], \partial_2 F \circ \Gamma[q], ...  \right]    \begin{bmatrix} 1 \\ Dq(t) \\ D^2 q(t) \\ ... \\ \end{bmatrix}   \\   &= \partial_0 F \circ \Gamma[q] + \partial_1 F \circ \Gamma[q] D q(t) + \partial_2 F \circ \Gamma[q] D^2 q(t) + ...   \\   &= \partial_0 F \circ \Gamma[q] u(t) + \partial_1 F \circ \Gamma[q] D q(t) + \partial_2 F \circ \Gamma[q] D^2 q(t) + ...   \\   \end{aligned}  },

where \displaystyle{u(t) \equiv 1}.

.

\displaystyle{  \begin{aligned}  D(F \circ \Gamma[q])  &= \partial_0 F \circ \Gamma[q] u + \partial_1 F \circ \Gamma[q] D q + \partial_2 F \circ \Gamma[q] D^2 q + ...    \\   &= \partial_0 F \circ \Gamma[q] J_0 \circ \Gamma[q] + \partial_1 F \circ \Gamma[q] J_1 \circ \Gamma[q] + \partial_2 F \circ \Gamma[q] J_2 \circ \Gamma[q] + ...  \\   \end{aligned}  }

where

\displaystyle{  \begin{aligned}  I_0 \circ \Gamma[q] &= t \\ \\  I_{n>0} \circ \Gamma[q]   &= I_{n>0} (t, q, v, a, ...) \\   &= I_{n>0} (t, q, Dq, D^2 q, ...) \\   &= D^{(n-1)} q \\     \\  J_{n} \circ \Gamma[q]   &= D(I_n (t, q, v, a, ...)) \\   \end{aligned}  }

.

The meaning of \displaystyle{\delta_\eta (fg)[q]} is

\displaystyle{\delta_\eta (f[q]g[q])}

— Me@2019-04-27 07:02:38 PM

\displaystyle{  \begin{aligned}  D(F \circ \Gamma[q])  &= \partial_0 F \circ \Gamma[q] J_0 \circ \Gamma[q] + \partial_1 F \circ \Gamma[q] J_1 \circ \Gamma[q] + \partial_2 F \circ \Gamma[q] J_2 \circ \Gamma[q] + ...  \\   &= \left[(\partial_0 F) J_0 + (\partial_1 F) J_1 + (\partial_2 F) J_2 + ... \right] \circ \Gamma[q]   \\   \end{aligned}  }

.
Eq. (1.113):

\displaystyle{  D_t F \circ \Gamma[q] = D(F \circ \Gamma[q])  }

\displaystyle{  \begin{aligned}  D_t F \circ \Gamma[q]   &= \left[(\partial_0 F) J_0 + (\partial_1 F) J_1 + (\partial_2 F) J_2 + ... \right] \circ \Gamma[q]   \\ \\  D_t F   &= (\partial_0 F) J_0 + (\partial_1 F) J_1 + (\partial_2 F) J_2 + ...    \\   \end{aligned}  }

Eq. (1.114):

\displaystyle{  \begin{aligned}  D_t F (t, q, v, a, ...)   &= \partial_0 F(t, q, v, a, ...) + \partial_1 F(t, q, v, a, ...) v + \partial_2 F(t, q, v, a, ...) a + ...   \\   \end{aligned}  }

.

\displaystyle{  \begin{aligned}  D_t F \circ \Gamma[q] (t)  &= \partial_0 F(t, q, v, a, ...) + \partial_1 F(t, q, v, a, ...) v(t) + \partial_2 F(t, q, v, a, ...) a(t) + ...   \\   \end{aligned}  }

\displaystyle{  \begin{aligned}  &D_t (F + G) \circ \Gamma[q] (t) \\  \end{aligned}  }

\displaystyle{  \begin{aligned}  &= \partial_0 \left[F(t, q, v, a, ...) + G(t, q, v, a, ...)\right] \\    &+ \partial_1 \left[F(t, q, v, a, ...) + G(t, q, v, a, ...)\right] v(t) \\    &+ \partial_2 \left[F(t, q, v, a, ...) + G(t, q, v, a, ...)\right] a(t) + ... \\   \end{aligned}  }

\displaystyle{  \begin{aligned}  &= \left[ \partial_0 F(t, q, v, a, ...) + \partial_0 G(t, q, v, a, ...)\right] \\    &+ \left[ \partial_1 F(t, q, v, a, ...) + \partial_1 G(t, q, v, a, ...)\right] v(t) \\    &+ \left[ \partial_2 F(t, q, v, a, ...) + \partial_2 G(t, q, v, a, ...)\right] a(t) + ... \\   \end{aligned}  }

\displaystyle{  \begin{aligned}  &= \partial_0 F(t, q, v, a, ...) + \partial_1 F(t, q, v, a, ...) v(t) + \partial_2 F(t, q, v, a, ...) a(t) + ... \\    &+ \partial_0 G(t, q, v, a, ...) + \partial_1 G(t, q, v, a, ...) v(t) + \partial_2 G(t, q, v, a, ...) a(t) + ... \\  \end{aligned}  }

\displaystyle{  \begin{aligned}  &= D_t F \circ \Gamma[q] (t) + D_t G \circ \Gamma[q] (t) \\  \end{aligned}  }

.

In short,

\displaystyle{  \begin{aligned}  D_t (F + G) \circ \Gamma[q] (t)   &= D_t F \circ \Gamma[q] (t) + D_t G \circ \Gamma[q] (t) \\   \end{aligned}  }

So

\displaystyle{  \begin{aligned}  D_t (F + G) \circ \Gamma[q] (t)   &= (D_t F + D_t G) \circ \Gamma[q] (t) \\   \\         D_t (F + G) \circ \Gamma[q]    &= (D_t F + D_t G) \circ \Gamma[q]  \\   \\         D_t (F + G)     &= D_t F + D_t G   \\   \end{aligned}  }

— Me@2022-04-20 11:42:52 AM

.

.

2022.04.21 Thursday (c) All rights reserved by ACHK

Ex 1.24 Constraint forces, 1.3

Structure and Interpretation of Classical Mechanics

.

Find the tension in an undriven planar pendulum.

~~~

Tangential component:

\displaystyle{\begin{aligned}  \left(F_{\text{net}}\right)_t &= m a_t \\  - mg \sin \theta &= m l \ddot \theta \\  \end{aligned}}

Radial component:

\displaystyle{\begin{aligned}  \left(F_{\text{net}}\right)_r &= m a_r \\  F(t) - mg \cos \theta &= m l \dot \theta^2 \\  \end{aligned}}

— Me@2022-04-10 04:22:27 PM

.

.

2022.04.10 Sunday (c) All rights reserved by ACHK

C and Lisp

numeromancer on Jan 25, 2010 [-]

In every art there is a dichotomy between the practical and the theoretical, and each has their fundamentals. In Comp. Sci., those two sets of fundamentals are these: sets of machine instructions, which come in several varieties; and lambda calculus, or one of the equivalent (by Church’s Thesis) formal systems. C and Lisp are similar in that they represent the first steps in each case to reach the other: C is a level above machine code, providing some abstraction and portability to the use of machine code, the fundamental elements of practical computing; lisp is a level above lambda calculus, providing a practical system for using functions, the fundamental elements of theoretical computing.

In short, mastery of C is concomitant with the ability to measure the cost of computation (sometimes, regardless of the value of it); mastery of Lisp is concomitant with the ability to measure the value of computation (sometimes, regardless of the cost).

Since C and Lisp lie on opposite borders of the universe of computation, knowing both will allow you to better measure the scope of that universe.

— Ask HN: Why does learning lisp make you a better C-programmer?

— Hacker News

.

.

2022.04.07 Thursday ACHK

Ex 1.24 Constraint forces, 1.2

Ex 1.22 Driven pendulum, 3.2

Structure and Interpretation of Classical Mechanics

.

Find the tension in an undriven planar pendulum.

~~~

[guess]


(define ((q->r x_s y_s l) local)
  (let* ((q (coordinate local))
         (t (time local))
         (theta (ref q 0))
         (c (ref q 1))
         (F (ref q 2)))
    (up (+ (x_s t) (* c (sin theta)))
        (- (y_s t) (* c (cos theta)))
        F)))

(let* ((xs (literal-function 'x_s))
       (ys (literal-function 'y_s))
       (q (up (literal-function 'theta)
              (literal-function 'c)
              (literal-function 'F))))
  (show-expression ((compose (q->r xs ys 'l) (Gamma q)) 't)))


(define (L-theta m l x_s y_s U)
  (compose
   (L-driven-free m l x_s y_s U) (F->C (q->r x_s y_s l))))

(let* ((U (U-gravity 'g 'm))
       (xs (literal-function 'x_s))
       (ys (literal-function 'y_s))
       (q (up (literal-function 'theta)
              (literal-function 'c)             
              (literal-function 'F)))
       (L (L-theta 'm 'l xs ys U)))
  (show-expression (L ((Gamma q) 't))))
(/
 (+ (* l m ((D x_s) t) (c t) ((D theta) t) (cos (theta t)))
    (* 1/2 l m (expt (c t) 2) (expt ((D theta) t) 2))
    (* l m (c t) ((D theta) t) (sin (theta t)) ((D y_s) t))
    (* g l m (c t) (cos (theta t)))
    (* l m ((D x_s) t) ((D c) t) (sin (theta t)))
    (* -1 l m ((D c) t) (cos (theta t)) ((D y_s) t))
    (* -1 g l m (y_s t))
    (* 1/2 l m (expt ((D x_s) t) 2))
    (* 1/2 l m (expt ((D c) t) 2))
    (* 1/2 l m (expt ((D y_s) t) 2))
    (* 1/2 (expt l 2) (F t))
    (* -1/2 (expt (c t) 2) (F t)))
 l)

(let* ((U (U-gravity 'g 'm))
       (xs (literal-function 'x_s))
       (ys (literal-function 'y_s))
       (q (up (literal-function 'theta)
              (literal-function 'c)
              (literal-function 'F)))
       (L (L-theta 'm 'l xs ys U)))
  (show-expression (((Lagrange-equations L) q) 't)))

.


(let* ((U (U-gravity 'g 'm))
       (xs (lambda (t) 0))
       (ys (lambda (t) 'l))
       (q (up (literal-function 'theta)
              (lambda (t) 'l)
              (literal-function 'F)))
       (L (L-theta 'm 'l xs ys U)))
  (show-expression (((Lagrange-equations L) q) 't)))

.

\displaystyle{F(t) = l m \left[D \theta(t)\right]^2 + g m \cos \theta(t)}

.

[guess]

— Me@2022-04-05 04:16:51 PM

.

.

2022.04.05 Tuesday (c) All rights reserved by ACHK

Ex 1.22 Driven pendulum, 3.1

Ex 1.24 Constraint forces, 1.1

Structure and Interpretation of Classical Mechanics

.

~~~

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

.

\displaystyle{ \begin{aligned}  y_s &= l \\  x_s &= 0 \\  \end{aligned}}

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

.


(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] }


(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
   (((Lagrange-equations L) q-rect) 't)))

\displaystyle{ \begin{aligned} mD^2x(t) + \frac{F(t)}{l} \left[x(t) - x_s(t)\right] &= 0 \\ mg + m D^2y(t) + \frac{F(t)}{l} [y(t) - y_s(t)] &= 0 \\ -l^2 + [y(t)-y_s(t)]^2 + [x(t)-x_s(t)]^2 &= 0 \\ \end{aligned}}


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

(define ((q->r x_s y_s l) local)
  (let* ((q (coordinate local))
         (t (time local))
         (theta (ref q 0))
         (F (ref q 1)))
    (up (+ (x_s t) (* l (sin theta)))
        (- (y_s t) (* l (cos theta)))
        F)))

(let ((q (up (literal-function 'theta)             
             (literal-function 'F))))
  (show-expression (q 't)))


(let* ((x_s (literal-function 'x_s))
       (y_s (literal-function 'y_s))
       (q (up (literal-function 'theta)             
              (literal-function 'F))))
  (show-expression ((Gamma q) 't)))


(let* ((xs (literal-function 'x_s))
       (ys (literal-function 'y_s))
       (q (up (literal-function 'theta)             
              (literal-function 'F))))
  (show-expression ((compose (q->r xs ys 'l) (Gamma q)) 't)))


(let* ((xs (literal-function 'x_s))
       (ys (literal-function 'y_s))
       (q (up (literal-function 'theta)             
              (literal-function 'F))))
  (show-expression ((F->C (q->r xs ys 'l)) ((Gamma q) 't))))



(define (L-theta m l x_s y_s U)
  (compose
   (L-driven-free m l x_s y_s U) (F->C (q->r x_s y_s l))))

(let* ((U (U-gravity 'g 'm))
       (xs (literal-function 'x_s))
       (ys (literal-function 'y_s))
       (q (up (literal-function 'theta)             
              (literal-function 'F))))
  (show-expression ((Gamma
                    (compose (q->r xs ys 'l) (Gamma q)))
                    't)))



(let* ((U (U-gravity 'g 'm))
       (xs (literal-function 'x_s))
       (ys (literal-function 'y_s))
       (q (up (literal-function 'theta)             
              (literal-function 'F))))
  (show-expression (U ((compose (q->r xs ys 'l) (Gamma q)) 't))))


(let* ((U (U-gravity 'g 'm))
       (xs (literal-function 'x_s))
       (ys (literal-function 'y_s))
       (q (up (literal-function 'theta)             
              (literal-function 'F))))
  (show-expression ((L-driven-free 'm 'l xs ys U)
		    ((Gamma (compose (q->r xs ys 'l) (Gamma q))) 't))))




(let* ((U (U-gravity 'g 'm))
       (xs (literal-function 'x_s))
       (ys (literal-function 'y_s))
       (q (up (literal-function 'theta)             
              (literal-function 'F))))
  (show-expression ((L-theta 'm 'l xs ys U) ((Gamma q) 't))))

\displaystyle{ \begin{aligned}   L_\theta     &=   \frac{1}{2} m (D x_s(t))^2  + \frac{1}{2} m (D y_s(t))^2  -  m g \left[ y_s(t) - l \cos \theta(t)  \right] \\  &+ \frac{1}{2} m l^2 (D \theta(t))^2   + lm D \theta(t) \left[     D x_s(t) \cos \theta(t) + \sin \theta(t) D y_s(t)  \right]    \\   \end{aligned}}

[guess]

— Me@2022-03-24 04:38:10 PM

.

.

2022.03.26 Saturday (c) All rights reserved by ACHK

Ex 1.23 Fill in the details

Structure and Interpretation of Classical Mechanics

.

Show that the Lagrange equations for Lagrangian (1.97) are the same as the Lagrange equations for Lagrangian (1.95) with the substitution \displaystyle{c(t) = l}, \displaystyle{Dc(t) = D^2 c(t) = 0}.

~~~

[guess]

The Lagrange equation:

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

.

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

.

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] }

.

\displaystyle{ \begin{aligned}   &L'(t;q,c,F; \dot q, \dot c, \dot F) \\   &= L'(t;\{q_{\alpha i}\}, \{c_{\alpha \beta}\}, \{F_{\alpha \beta}\}; \{\dot q_{\alpha i}\}, \{\dot c_{\alpha \beta}\}, \{\dot F_{\alpha \beta}\})  \\   \end{aligned}}

\displaystyle{ \begin{aligned}     &= \sum_\alpha \frac{1}{2} m_\alpha \left( \partial_0 f_\alpha (t;\{q_{\alpha i}\}, \{c_{\alpha \beta}\}) + \partial_1 f_\alpha (t;\{q_{\alpha i}\}, \{c_{\alpha \beta}\}) \dot q + \partial_2 f_\alpha (t;\{q_{\alpha i}\}, \{c_{\alpha \beta}\}) \dot c \right)^2 \\     &- V(t, f(t;\{q_{\alpha i}\}, \{c_{\alpha \beta}\})) - \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] \\    \end{aligned}}

\displaystyle{ \begin{aligned}     &= \sum_\alpha \frac{1}{2} m_\alpha \left( \frac{\partial f_\alpha}{\partial t} + \sum_i \frac{\partial f_\alpha}{\partial q_{\alpha i}} \dot q_{\alpha i} + \sum_\beta \frac{\partial f_\alpha}{\partial c_{\alpha \beta}} \dot c_{\alpha \beta} \right)^2 \\     &- V(t, f(t;\{q_{\alpha i}\}, \{c_{\alpha \beta}\})) - \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] \\    \end{aligned}}

.

Consider the mass \displaystyle{m_\alpha}:

\displaystyle{ \begin{aligned} \frac{d}{dt} \left( \frac{\partial L}{\partial \dot q_{\alpha i}} \right) - \frac{\partial L}{\partial q_{\alpha i}} &= 0 \\ \end{aligned}}

\displaystyle{ \begin{aligned} \frac{d}{dt} \left( \frac{\partial L}{\partial \dot c_{\alpha \beta}} \right) - \frac{\partial L}{\partial c_{\alpha \beta}} &= 0 \\ \end{aligned}}

.

\displaystyle{ \begin{aligned}   &\frac{\partial L}{\partial q_{\alpha i}} \\    &= \frac{\partial}{\partial q_{\alpha i}}     \left[ \sum_\alpha \frac{1}{2} m_\alpha \left( \frac{\partial f_\alpha}{\partial t} + \sum_j \frac{\partial f_\alpha}{\partial q_{\alpha j}} \dot q_{\alpha j} + \sum_\beta \frac{\partial f_\alpha}{\partial c_{\alpha \beta}} \dot c_{\alpha \beta} \right)^2     - V(t, f) \right] - 0 \\    &=       \sum_\alpha \frac{1}{2} m_\alpha \frac{\partial}{\partial q_{\alpha i}} \left( G \right)^2     - \frac{\partial}{\partial q_{\alpha i}} V(t, f(t;\{q_{\alpha j}\}, \{c_{\alpha \beta}\}))   \\    &=   \sum_\alpha m_\alpha     G    \frac{\partial G}{\partial q_{\alpha i}}     - \frac{\partial V}{\partial q_{\alpha i}}    \\      \end{aligned}}

.

\displaystyle{ \begin{aligned}     G &= \left( \frac{\partial f_\alpha}{\partial t} + \sum_j \frac{\partial f_\alpha}{\partial q_{\alpha j}} \dot q_{\alpha j} + \sum_\beta \frac{\partial f_\alpha}{\partial c_{\alpha \beta}} \dot c_{\alpha \beta} \right) \\    \frac{\partial G}{\partial q_{\alpha i}}     &= \frac{\partial}{\partial q_{\alpha i}} \left( \frac{\partial f_\alpha}{\partial t} + \sum_j \frac{\partial f_\alpha}{\partial q_{\alpha j}} \dot q_{\alpha j} + \sum_\beta \frac{\partial f_\alpha}{\partial c_{\alpha \beta}} \dot c_{\alpha \beta} \right) \\    &= \left( \frac{\partial}{\partial q_{\alpha i}} \frac{\partial f_\alpha}{\partial t} + \sum_j \frac{\partial}{\partial q_{\alpha i}} \frac{\partial f_\alpha}{\partial q_{\alpha j}} \dot q_{\alpha j} + \sum_\beta \frac{\partial}{\partial q_{\alpha i}} \frac{\partial f_\alpha}{\partial c_{\alpha \beta}} \dot c_{\alpha \beta} \right) \\      \end{aligned}}

[guess]

— Me@2022-03-06 05:24:18 PM

.

.

2022.03.07 Monday (c) All rights reserved by ACHK

程式員頭腦 15

數學教育 7

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

.

But while you don’t literally need math for most kinds of hacking, in the sense of knowing 1001 tricks for differentiating formulas, math is very much worth studying for its own sake. It’s a valuable source of metaphors for almost any kind of work.[3] I wish I’d studied more math in college for that reason.

[3] Eric Raymond says the best metaphors for hackers are in set theory, combinatorics, and graph theory.

— Undergraduation

— March 2005

— Paul Graham

.

(安:另外,他提的另一個,有關學習數學的要點是,即使假設你在大學中,學到的數學,在日常生活中沒有用,單單是為獲取,那些嶄新的元素概念本身,就已經能夠令你有超能力;令你有一些,常人沒有的思考工具、比喻語言。)

.

那和我之前,叫你學 programming(電腦編程),意思是一樣的。

那本 programming 教科書《SICP》(Structure and Interpretation of Computer Programs),竟然教曉我,時間的定義和數字的定義等。

— Me@2022-02-13 10:46:08 AM

.

.

2022.02.13 Sunday (c) All rights reserved by ACHK

Ex 1.22 Driven pendulum, 2.2

Structure and Interpretation of Classical Mechanics

.

Derive the equations of motion using the Newtonian constraint force prescription, and show that they are the same as the Lagrange equations.

~~~

[guess]


(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
   (((Lagrange-equations L) q-rect) 't)))

.

.

\displaystyle{ \begin{aligned}   mD^2x(t) + \frac{F(t)}{l} \left[x(t) - x_s(t)\right] &= 0 \\   mg + m D^2y(t) + \frac{F(t)}{l} [y(t) - y_s(t)] &= 0 \\   -l^2 + [y(t)-y_s(t)]^2 + [x(t)-x_s(t)]^2 &= 0 \\  \end{aligned}}

[guess]

— Me@2022-02-08 10:04:45 AM

.

.

2022.02.08 Tuesday (c) All rights reserved by ACHK

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