3Blue1Brown

(defun 3b1b ()

    (interactive)

    (setq is-python-mode (string= major-mode "python-mode"))

    (if (not is-python-mode)
        (print "This is not a python file.")


        (print buffer-file-name)

        (setq the-command (format "%s %s %s" 
                                "manim -p"
                                buffer-file-name  
                                "JustAShape")) 

        (print the-command)                        

        (shell-command the-command) 
    )  
)

(global-set-key (kbd "C-p") '3b1b)

(global-set-key (kbd "C-/") 'comment-region)

(global-set-key (kbd "C-.") 'uncomment-region)

— Me@2022-06-05 04:00:37 PM

.

.

2022.06.05 Sunday (c) All rights reserved by ACHK

Ex 1.26 Lagrange equations for total time derivatives

Structure and Interpretation of Classical Mechanics

.

Let \displaystyle{F(t, q)} be a function of \displaystyle{t} and \displaystyle{q} only, with total time derivative

\displaystyle{D_t F = \partial_0 F + \partial_1 F \dot Q}

Show explicitly that the Lagrange equations for \displaystyle{D_t F} are identically zero, …

~~~

[guess]

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} \left( \frac{\partial}{\partial \dot q} L (t, q(t), \dot q(t)) \right) - \frac{\partial}{\partial q} L (t, q(t), \dot q(t))    &= 0     \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}  }

.

Put \displaystyle{ D_t F (t, q, Dq, ...) } into the Lagrange equation:

\displaystyle{     \begin{aligned}     &\frac{d}{dt} \left( \frac{\partial}{\partial \dot q}     D_t F (t, q, Dq, ...)  \right) - \frac{\partial}{\partial q}     D_t F (t, q, Dq, ...) \\ \\    &= \frac{d}{dt} \left[ \frac{\partial}{\partial \dot q}     \left( \partial_0 F(t, q, v, a, ...) + \partial_1 F(t, q, v, a, ...) v + \partial_2 F(t, q, v, a, ...) a + ... \right) \right] \\    &- \frac{\partial}{\partial q}     \left( \partial_0 F(t, q, v, a, ...) + \partial_1 F(t, q, v, a, ...) v + \partial_2 F(t, q, v, a, ...) a + ... \right)   \\     \\    &=\frac{d}{dt} \left[        \partial_2 \partial_0 F  + \partial_2 (v \partial_1 F)   + \partial_2 (a \partial_2 F) + ...  \right] \\    &- \left[    \partial_1 \partial_0 F  + \partial_1 (v \partial_1 F)   + \partial_1 (a \partial_2 F) + ... \right]   \\    \\    &= \partial_0 \left[          \partial_1 \partial_0 F  + \partial_1 (v \partial_1 F)   + \partial_1 (a \partial_2 F) + ...  \right] \\     &+ \partial_1 \left[          \partial_1 \partial_0 F  + \partial_1 (v \partial_1 F)   + \partial_1 (a \partial_2 F) + ...   \right] v \\    &+ \partial_2 \left[          \partial_1 \partial_0 F  + \partial_1 (v \partial_1 F)   + \partial_1 (a \partial_2 F) + ...   \right] a + ... \\    &- \left[      \partial_1 \partial_0 F  + \partial_1 (v \partial_1 F)   + \partial_1 (a \partial_2 F) + ...  \right]   \\        \\    &= ... \\     \end{aligned}    }

.

Assume that \displaystyle{\frac{\partial \dot F}{\partial \dot q} = \frac{\partial F}{\partial q}}:

\displaystyle{     \begin{aligned}     &\frac{d}{dt} \left( \frac{\partial}{\partial \dot q}     D_t F (t, q, Dq, ...)  \right) - \frac{\partial}{\partial q}     D_t F (t, q, Dq, ...) \\ \\    &= \frac{d}{dt} \left( \frac{\partial  \dot F }{\partial \dot q}       \right) - \frac{\partial}{\partial q} \frac{d F}{dt}  \\ \\    &= \frac{d}{dt} \left( \frac{\partial F}{\partial q} \right) - \frac{\partial}{\partial q} \frac{dF}{dt} \\ \\    &= \frac{d}{dt} \left( \frac{\partial F}{\partial q} \right) - \frac{\partial}{\partial q} \left( \frac{\partial F}{\partial t}     + \frac{\partial F}{\partial q} \dot q     + \frac{\partial F}{\partial \dot q} \ddot q + ...  \right) \\ \\ \end{aligned}}

\displaystyle{\begin{aligned}  &= \frac{d}{dt} \left( \frac{\partial F}{\partial q} \right) - \left( \frac{\partial \frac{\partial F}{\partial q}}{\partial t}    + \frac{\partial \frac{\partial F}{\partial q}}{\partial q} \dot q     + \frac{\partial F}{\partial q} \frac{\partial}{\partial q} \dot q     + \frac{\partial \frac{\partial F}{\partial q}}{\partial \dot q} \ddot q     + \frac{\partial F}{\partial \dot q} \frac{\partial}{\partial q}    \ddot q     + ... \right) \\ \\     &= \frac{d}{dt} \left( \frac{\partial F}{\partial q} \right) - \left( \frac{\partial \frac{\partial F}{\partial q}}{\partial t}    + \frac{\partial \frac{\partial F}{\partial q}}{\partial q} \dot q     + \frac{\partial F}{\partial q} (0)    + \frac{\partial \frac{\partial F}{\partial q}}{\partial \dot q} \ddot q     + \frac{\partial F}{\partial \dot q} (0)    + ... \right) \\ \\     &= \frac{d}{dt} \left( \frac{\partial F}{\partial q} \right) -      \left( \frac{\partial \frac{\partial F}{\partial q}}{\partial t}     + \frac{\partial \frac{\partial F}{\partial q}}{\partial q} \dot q     + \frac{\partial \frac{\partial F}{\partial q}}{\partial \dot q} \ddot q + ...  \right) \\ \\    &= \frac{d}{dt} \left( \frac{\partial F}{\partial q} \right) -      \frac{d}{dt} \left( \frac{\partial F}{\partial q} \right)  \\ \\    &= 0 \\ \\     \end{aligned}    }

.

Prove that \displaystyle{\frac{\partial \dot F}{\partial \dot q} = \frac{\partial F}{\partial q}}.

\displaystyle{\begin{aligned}            &\frac{\partial \dot F}{\partial \dot q} \\ \\      &=     \frac{\partial }{\partial \dot q} \left( \frac{\partial F}{\partial t}     + \frac{\partial F}{\partial q} \dot q + \frac{\partial F}{\partial \dot q} \ddot q + ... \right)   \\ \\    &= \frac{\partial }{\partial \dot q} \frac{\partial F}{\partial t}     + \left( \frac{\partial }{\partial \dot q}\frac{\partial F}{\partial q} \right) \dot q   + \frac{\partial F}{\partial q} \frac{\partial }{\partial \dot q}\dot q      + \left( \frac{\partial }{\partial \dot q}\frac{\partial F}{\partial \dot q} \right) \ddot q    + \frac{\partial F}{\partial \dot q} \frac{\partial }{\partial \dot q}\ddot q     + ... \\ \\        &= \frac{\partial }{\partial \dot q} \frac{\partial F}{\partial t}     + \left( \frac{\partial }{\partial \dot q}\frac{\partial F}{\partial q} \right) \dot q   + \frac{\partial F}{\partial q} (1)      + \left( \frac{\partial }{\partial \dot q}\frac{\partial F}{\partial \dot q} \right) \ddot q    + \frac{\partial F}{\partial \dot q} (0)     + ... \\ \\      &= \frac{\partial }{\partial \dot q} \frac{\partial F}{\partial t}     + \left( \frac{\partial }{\partial \dot q}\frac{\partial F}{\partial q} \right)\dot q   + \frac{\partial F}{\partial q}       + \left( \frac{\partial }{\partial \dot q}\frac{\partial F}{\partial \dot q}\right) \ddot q         + ... \\ \\            &=       \left[ \frac{\partial \frac{\partial }{\partial \dot q} F}{\partial t}     + \left( \frac{\partial \frac{\partial }{\partial \dot q} F}{\partial q} \right)\dot q         + \left( \frac{\partial \frac{\partial }{\partial \dot q} F}{\partial \dot q}\right) \ddot q      + ... \right]      + \frac{\partial F}{\partial q}     \\ \\          &= \frac{d}{dt} \frac{\partial F }{\partial \dot q}     + \frac{\partial F}{\partial q}      \\ \\    \end{aligned}}

.

If \displaystyle{ L' = L + D_t F } depends on \displaystyle{ \{t, q, Dq\} } only, then \displaystyle{ F } will depend on \displaystyle{ \{t, q\} } only.

\displaystyle{\begin{aligned}     \frac{\partial \dot F}{\partial \dot q}     &= \frac{d}{dt} \frac{\partial F }{\partial \dot q} + \frac{\partial F}{\partial q} \\ \\     &= \frac{d}{dt} (0) + \frac{\partial F}{\partial q} \\ \\     &= \frac{\partial F}{\partial q} \\ \\     \end{aligned}}

[guess]

— Me@2022-06-03 09:04:37 PM

.

.

2022.06.05 Sunday (c) All rights reserved by ACHK