# Ex 1.9 Lagrange’s equations

Structure and Interpretation of Classical Mechanics

.

Derive the Lagrange equations for the following systems, showing all of the intermediate steps as in the harmonic oscillator and orbital motion examples.

b. An ideal planar pendulum consists of a bob of mass $\displaystyle{m}$ connected to a pivot by a massless rod of length $\displaystyle{l}$ subject to uniform gravitational acceleration $\displaystyle{g}$. A Lagrangian is $\displaystyle{L(t, \theta, \dot \theta) = \frac{1}{2} m l^2 \dot \theta^2 + mgl \cos \theta}$. The formal parameters of $\displaystyle{L}$ are $\displaystyle{t}$, $\displaystyle{\theta}$, and $\displaystyle{\dot \theta}$; $\displaystyle{\theta}$ measures the angle of the pendulum rod to a plumb line and $\displaystyle{\dot \theta}$ is the angular velocity of the rod.

~~~

\displaystyle{ \begin{aligned} L (t, \xi, \eta) &= \frac{1}{2} m l^2 \eta^2 + m g l \cos \xi \\ \end{aligned}}

\displaystyle{ \begin{aligned} \partial_1 L (t, \xi, \eta) &= - m g l \sin \xi \\ \partial_2 L (t, \xi, \eta) &= m l^2 \eta \\ \end{aligned}}

Put $\displaystyle{q = \theta}$,

\displaystyle{ \begin{aligned} \Gamma[q](t) &= (t; \theta(t); D\theta(t)) \\ \end{aligned}}

\displaystyle{ \begin{aligned} \partial_1 L \circ \Gamma[q] (t) &= - m g l \sin \theta \\ \partial_2 L \circ \Gamma[q] (t) &= m l^2 D \theta \\ \end{aligned}}

The Lagrange equation:

\displaystyle{ \begin{aligned} D ( \partial_2 L \circ \Gamma[q]) - (\partial_1 L \circ \Gamma[q]) &= 0 \\ D ( m l^2 D \theta ) - ( - m g l \sin \theta ) &= 0 \\ D^2 \theta + \frac{g}{l} \sin \theta &= 0 \\ \end{aligned}}

— Me@2020-09-28 05:40:42 PM

.

.

# Ex 1.8.2.5 Implementation of $delta$

Structure and Interpretation of Classical Mechanics

.

Verify that the operators $\displaystyle{D}$ (differentiation) and $\displaystyle{\delta}$ (variation) commute (Equation 1.27) using the scmutils software library:

$\displaystyle{D \delta_{\eta} f [q] = \delta_\eta g[q]}$ with $\displaystyle{g [q] = D ( f[q] )}$

~~~

(define (((delta eta) f) q)
(define (g epsilon)
(f (+ q (* epsilon eta))))
((D g) 0))

(define q (literal-function 'q (-> Real (UP Real))))

(define eta (literal-function 'eta (-> Real (UP Real))))


.

(define (f q)
(compose (literal-function 'f
(-> (UP Real (UP* Real) (UP* Real)) Real))
(Gamma q)))

(define (g q)
(compose (literal-function 'g
(-> (UP Real (UP* Real) (UP* Real)) Real))
(Gamma q)))


.

(define (g q) (D (f q)))


.

(define LHS ( (D (((delta eta) f) q)) 't))

(define RHS ((((delta eta) g) q) 't))


.

(print-expression LHS)

(show-expression LHS)


.

$\displaystyle{\partial_1 \partial_1 f \left( \begin{bmatrix} t \\ q(t) \\ Dq(t) \end{bmatrix} \right) D q(t) \eta(t) + D^2 q \partial_2 \partial_2 f D \eta + D^2 q \partial_1 \partial_2 f \eta + ... }$

$\displaystyle{... \partial_1 \partial_2 f D \eta D q + D^2 \eta \partial_2 f + \partial_0 \partial_2 f D \eta + \partial_0 \partial_1 f \eta + D \eta \partial_1 f}$

.

(print-expression RHS)

(show-expression RHS)

(- LHS RHS)


— Me@2020-08-24 03:18:21 PM

.

.

# Ex 1.8.2.4 Implementation of $\delta$

Structure and Interpretation of Classical Mechanics

.

Verify the product rule of variation (Equation 1.23) using the
scmutils software library:

$\displaystyle{\delta_\eta \left(f [q] g [q] \right) = \left( \delta_\eta f[q] \right) g[q] + f[q] \delta_\eta g[q]}$

~~~

(define (((delta eta) f) q)
(define (g epsilon)
(f (+ q (* epsilon eta))))
((D g) 0))

(define q (literal-function 'q (-> Real (UP Real))))

(define eta (literal-function 'eta (-> Real (UP Real))))


.

(define (f q)
(compose (literal-function 'f
(-> (UP Real (UP* Real) (UP* Real)) Real))
(Gamma q)))

(define (g q)
(compose (literal-function 'g
(-> (UP Real (UP* Real) (UP* Real)) Real))
(Gamma q)))


.

(define (f_times_g q) (* (f q) (g q)))


.

(define LHS ((((delta eta) f_times_g) q) 't))

(define RHS (+ (* ((((delta eta) f) q) 't) ((g q) 't))
(* ((f q) 't) ((((delta eta) g) q) 't))))


.

(print-expression LHS)

(show-expression LHS)


.

$\displaystyle{g D \eta \partial_2 f + g \eta \partial_1 f + f D \eta \partial_2 g + f \eta \partial_1 g}$

.

(print-expression RHS)

(show-expression RHS)

(- LHS RHS)


— Me@2020-08-06 07:23:27 PM

.

.

# Chain rule of functional variation

Ex 1.8.2.3, Structure and Interpretation of Classical Mechanics

.

\displaystyle{ \begin{aligned} &\delta_\eta F[g[q]] \\ &= \delta_\eta (F \circ g)[q] \\ &= \lim_{\epsilon \to 0} \left( \frac{F[g[q + \epsilon \eta]] - F[g[q]]}{\epsilon} \right) \\ &= \lim_{\epsilon \to 0} \left( \frac{F[g[q] + \epsilon \delta_\eta g[q] + \epsilon^2 (...) + \epsilon^3 (...) + ...]] - F[g[q]]}{\epsilon} \right) \\ &= \lim_{\epsilon \to 0} \left( \frac{F[g[q] + \epsilon \delta_\eta g[q] + \epsilon^2 (... + \epsilon (...) + ...)]] - F[g[q]]}{\epsilon} \right) \\ &= \lim_{\epsilon \to 0} \left( \frac{F[g[q] + \epsilon \delta_\eta g[q] + \epsilon^2 (...)]] - F[g[q]]}{\epsilon} \right) \\ &= \lim_{\epsilon \to 0} \left( \frac{F[g[q] + \epsilon \left(\delta_\eta g[q] + \epsilon (...)\right)]] - F[g[q]]}{\epsilon} \right) \\ &= \lim_{\epsilon \to 0} \left( \frac{F[g[q]] + \epsilon \delta_{\left(\delta_\eta g[q] + \epsilon (...)\right)} F[g[q]] + \epsilon^2 (...) - F[g[q]]}{\epsilon} \right) \\ &= \lim_{\epsilon \to 0} \left( \frac{\epsilon \delta_{\left(\delta_\eta g[q] + \epsilon (...)\right)} F[g[q]] + \epsilon^2 (...)}{\epsilon} \right) \\ &= \lim_{\epsilon \to 0} \left( \delta_{\left(\delta_\eta g[q] + \epsilon (...)\right)} F[g[q]] + \epsilon (...) \right) \\ &= \delta_{ \left( \delta_\eta g[q] \right)} F[g] \\ \end{aligned}}

— Me@2020-07-14 06:00:35 PM

.

.

# SICM, 4

— Me@2020-06-25 07:53:54 PM

.

.

# Ex 1.8.2.2 Implementation of $\delta$

Structure and Interpretation of Classical Mechanics

.

(define (((delta eta) f) q)
(define (g epsilon)
(f (+ q (* epsilon eta))))
((D g) 0))

(define eta (literal-function 'eta))

(define q (literal-function 'q))


— Patrick Eli Catach

.

Code

(define (f q)
(compose (literal-function 'f (-> (UP Real) Real)) q))


and

(define (f q) (compose (literal-function 'f) q))


have the same effect. If you execute

(show-expression ((((delta eta) f) q) 't))


you will get

$\displaystyle{\delta_\eta f[q] = \eta(t) Df(q(t))}$

.

It seems not to make sense, because $\displaystyle{f}$ is functional. Its input is a path function, not a real number. We cannot differentiate it with respect to its argument, which is a path.

It actually make sense in this special case because now

(define (f q)
(compose (literal-function 'f (-> (UP Real) Real)) q))


In other words, $\displaystyle{f}$ is a function of one argument only. And variation itself can be expressed in terms of differentiation:

\displaystyle{ \begin{aligned} g( \epsilon ) &= f[q + \epsilon \eta] \\ \delta_\eta f[q] &= \lim_{\epsilon \to 0} \left( \frac{g(\epsilon) - g(0)}{\epsilon} \right) = D g(0) \\ \end{aligned}}

So

\displaystyle{ \begin{aligned} &\delta_\eta f[q] \\ &= \left. \frac{d}{d \epsilon} f[q + \epsilon \eta] \right|_{x=a} \\ \end{aligned}}

No. This explanation is not correct. Even if $\displaystyle{f}$ is a function of one argument only, it is still a path function. Its input argument is a path, not a number. Different path inputs will give different outputs.

The correct explanation should be the following.

(define (f q) (compose (literal-function 'f) q))

(define eta (literal-function 'eta))

(define q (literal-function 'q))


These lines actually imply that $\displaystyle{f}$ is just a path-independent function.

\displaystyle{ \begin{aligned} \delta_\eta f[q] &= \lim_{\epsilon \to 0} \left( \frac{f[q+\epsilon \eta]-f[q]}{\epsilon} \right) \\ \end{aligned}}

If the function $\displaystyle{f}$ is just a path-independent,

\displaystyle{ \begin{aligned} \delta_\eta f[q] &= \lim_{\epsilon \to 0} \left( \frac{f(q+\epsilon \eta)-f(q)}{\epsilon} \right) \\ \end{aligned}}

For the time $\displaystyle{t}$ that $\displaystyle{\eta(t) \ne 0}$,

\displaystyle{ \begin{aligned} \delta_\eta f[q] &= \eta \lim_{\epsilon \to 0} \left( \frac{f(q+\epsilon \eta)-f(q)}{\epsilon \eta} \right) \\ &= \eta(t) D f(q(t)) \\ \end{aligned}}

So the above lines of code are not correct, because they do not represent a path-dependent function. The correct code (for one-dimensional path $\displaystyle{q(t)}$) should be

(define (((delta eta) f) q)
(define (g epsilon)
(f (+ q (* epsilon eta))))
((D g) 0))

(define (f q)
(compose (literal-function 'f
(-> (UP Real (UP* Real) (UP* Real)) Real))
(Gamma q)))

(define q (literal-function 'q (-> Real (UP Real))))

(define eta (literal-function 'eta (-> Real (UP Real))))

(print-expression ((((delta eta) f) q) 't))

(show-expression ((((delta eta) f) q) 't))


The result is

\displaystyle{ \begin{aligned} &\delta_\eta f[q] \\ &= D \eta(t) \partial_2 f \left( \begin{bmatrix} t \\ q(t) \\ Dq(t) \end{bmatrix} \right) + \eta(t) \partial_1 f \left( \begin{bmatrix} t \\ q(t) \\ Dq(t) \end{bmatrix} \right) \\ \end{aligned}}

But this has a problem. It seems that $\displaystyle{f}$ is still not a function with a path as input. It is just a function with 3 real numbers as inputs.

Note that the path-dependent function $\displaystyle{f}$ is not really a general functional. A general functional can depend on an input function in any ways. For example,

$\displaystyle{F[y] = y(3)}$

$\displaystyle{F[y] = \int_0^1 y(x) dx}$

A functional that defines the arc length of a curve:

$\displaystyle{L[y] = \int_a^b \sqrt{1 + \left( \frac{dy}{dx} \right)^2} dx}$

– The Calculus of Variations

– Brian Keng

The function $\displaystyle{f}$ is not an ordinary function because its input is not a real number, but a path-function $\displaystyle{q(t)}$. In other words, it does not depend on individual values of $\displaystyle{q(t)}$ at different individual times. Instead, its output depends on the whole path $\displaystyle{q(t)}$. However, the function $\displaystyle{f}$ is not a general functional either.

It is not a general functional in the sense that its input is not a general mathematical function, but a (function that represents a) path $\displaystyle{q(t)}$. Also, $\displaystyle{f}$ depends on $\displaystyle{q}$ in a specific way:

(define (f q)
(compose (literal-function 'f
(-> (UP Real (UP* Real) (UP* Real)) Real))
(Gamma q)))


\displaystyle{ \begin{aligned} &f[q] \\ &= f(\Gamma[q]) \\ &= f \left( (t, q(t), Dq(t)) \right) \\ &= f(t, q(t), Dq(t)) \\ \end{aligned}}

So, besides being a (non-general) functional, $\displaystyle{f[q]}$, with a path, $\displaystyle{q}$, as input, $\displaystyle{f}$ can also be regarded as an ordinary function that has 3 real number inputs: $\displaystyle{t}$, $\displaystyle{q(t)}$, and $\displaystyle{Dq(t)}$.

We can vary with respect to a path (the $\displaystyle{q}$ itself), but we cannot differentiate with respect to a path. We can only differentiate with respect to the values of the path $\displaystyle{q(t)}$.

For simplicity, we consider the case that the path $\displaystyle{q(t)}$ is one-dimensional. Only in the sense that $\displaystyle{f}$ can also be regarded as an ordinary function that has 3 real number inputs, it can use the chain rule of ordinary differentiation:

\displaystyle{ \begin{aligned} &\delta_\eta f[q] \\ &= D \eta(t) \partial_2 f \left( \begin{bmatrix} t \\ q(t) \\ Dq(t) \end{bmatrix} \right) + \eta(t) \partial_1 f \left( \begin{bmatrix} t \\ q(t) \\ Dq(t) \end{bmatrix} \right) \\ \end{aligned}}

— Me@2020-06-20 01:17:39 PM

.

.

# Ex 1.8.2.1 Implementation of $\delta$

Structure and Interpretation of Classical Mechanics

.

b. Use your delta procedure to verify the properties of $\displaystyle{\delta}$ listed in exercise 1.7 for simple functions such as implemented by the procedure f:

(define (f q)
(compose
(literal-function ’F
(-> (UP Real (UP* Real) (UP* Real)) Real))
(Gamma q)))


This implements an n-degree-of-freedom path-dependent function that depends on the local tuple of the path at each moment. You can define a literal two-dimensional path by

(define q (literal-function ’q (-> Real (UP Real Real))))


You should compute both sides of the equalities and subtract the results. The answer should be zero.

~~~

(define (((delta eta) f) q)
(define (g epsilon)
(f (+ q (* epsilon eta))))
((D g) 0))

(define (f q)
(compose (literal-function 'f (-> (UP Real Real Real) Real))
(Gamma q)))

(define eta (literal-function 'eta))

(define q (literal-function 'q))

(print-expression ((((delta eta) f) q) 't))


— Patrick Eli Catach

.

(print-expression ((((delta eta) f) q) 't))

(+ (* ((D eta) t) (((partial 2) f) (up t (q t) ((D q) t))))
(* (eta t) (((partial 1) f) (up t (q t) ((D q) t)))))

(show-expression ((((delta eta) f) q) 't))


— Me@2020-04-11 12:01:04 PM

.

.

# scmutils, 3

Structure and Interpretation of Classical Mechanics

Scheme Mechanics Installation for GNU/Linux

.

This post assumes that you have already installed the scmutils library and been able to open it using the standard editor Emacs.

If not, go to the bottom of this post to click the category scmutils, so that you can see all the posts in this scmutils series.

Then go to the post “scmutils, 2.3.2” to follow the installation and setup instructions.

.

After installing and setting up the scmutils library, you can start to use it.

However, what if you want to close the Emacs editor? How to save your scheme program before closing Emacs?

By default, you cannot. So I have written a small program to help. Here is the installation instruction:

1. Go to the end of the .emacs file. Add the following code, if it does not already exist:


(defun mechanics()
(interactive)
(run-scheme
"/usr/local/scmutils/mit-scheme/bin/scheme --library
/usr/local/scmutils/mit-scheme/lib"
))




(fset 'set-working-dir
(lambda (&optional arg) "Keyboard macro."
(interactive "p")
(kmacro-exec-ring-item
(quote ("(set-working-directory-pathname!
\"~/Documents/\")\n" 0 "%d")) arg)))

(lambda (&optional arg) "Keyboard macro."
(interactive "p")
(kmacro-exec-ring-item
(quote ("(load \"tt.scm\")" 0 "%d")) arg)))

(defun mechan ()
(interactive)
(split-window-below)
(windmove-down)
(mechanics)
(set-working-dir)
(comint-send-input)
(windmove-up)
(find-file "~/Documents/tt.scm")
(end-of-buffer)
(windmove-down)
(cond ((file-exists-p "~/Documents/tt.scm")
(interactive)
(comint-send-input)))
(windmove-up)
)

(defun cxce ()
(interactive)
(save-buffer)
(windmove-down)
(comint-send-input)
(windmove-up)
)

(global-set-key (kbd "C-x C-e") 'cxce)



3. Close Emacs. Re-open it.

4. Type the command

M-x mechan


The command M-x means pressing the Alt key and x together. Then type the word mechan.

5. You will see the Emacs editor is split into two windows, one up and one down.

The lower window is the scheme environment. You can type a line of code and the press Enter to execute it.

The upper window is the editor. You can type multiple lines of code and the type

C-x C-e


to execute it. The command C-x C-e means pressing Ctrl and x together and then Ctrl and e.

6. Your scheme code is saved to the following file

"~/Documents/tt.scm"


In case you need to backup your code, backup this file.

— Me@2020-03-10 10:59:45 PM

.

.

# scmutils, 2.3.2

Scheme Mechanics Installation for GNU/Linux

.

Steps:

1. The following steps are tested in Ubuntu 18.04. Prepare Ubuntu 18.04 if you can.

Note: Since the installation of the library scmutils requires the root access of your Linux system, please do NOT use it on your working computer. Instead, create an isolated virtual machine to use it.

.

2. Go to the bottom of this post to click the category scmutils, so that you can see all the posts in this scmutils series.

3. Go to the post titled “scmutils, 2.3” to download

scmutils-20160827-x86-64-gnu-linux

4. Although the official installation guide advises you to install “MIT/GNU Scheme system” before installing scmutils, you do NOT need to install “MIT/GNU Scheme system” at all.

5. Unzip the file scmutils-20160827-x86-64-gnu-linux.

In the following, if you need to copy any commands or programming codes, remember that any number on the left of the vertical green line is NOT part of the code.

6. Run the command

tar xzf scmutils-20160827-x86-64-gnu-linux.tar.gz


to further extract the file.

-x — extract files from an archive;
-f — specify the archive’s name;
-v — show a list of processed files.

— Wikipedia on tar (computing)

Then two folders will be created: bin and scmutils.

7. Run the command

cd bin


to go into the folder.

You will see a file called mechanics.

.

8.1 Run the command

mechanics


You will get the error

mechanics: command not found


8.2 Instead, you should run the command

./mechanics


to specify that the file mechanics is actually in the current folder.

You will get the error

./mechanics: line 16: exec: xterm: not found

It is because your Linux system has not the program xterm yet.

8.3 Run the following command to install it.

sudo apt-get install xterm

8.4 Run the command again:

./mechanics

There will be an xterm window popup, but with an error message inside:

That means you should move the two folders, bin and scmutils, to the pre-defined locations.

.

9.1 Run the command to move the folder scmutils to its pre-defined location:

mv scmutils /usr/local/

You will get the error

mv: cannot move 'scmutils' to '/usr/local/scmutils':
Permission denied

9.2 Try again by

sudo mv scmutils /usr/local/

.

10.1 Go inside the folder bin.

10.2 Move its content to the pre-defined location by this command:

sudo mv mechanics /usr/local/bin/

.

11. Run the command

mechanics

Then you will see the Edwin window is opened. That means, in theory, you system has successfully installed the scmutils library. You can use it within the Edwin window if you like.

However, in practice, it is difficult, because it provides no syntax-highlighting. Also, you cannot use mouse in the Edwin window, so if you want to copy and paste a command or a series of commands, there will be no obvious way to achieve that.

So I suggest you to use the standard Emacs as the editor instead.

.

12.1 If you do not know Emacs, learn its basics.

12.2 Also, learn how to open Emacs’ initialization file, which has the filename

.emacs

After opening the file, you will see that it is just a text file.

12.3 Go to the end of the .emacs file. Add the following code:

(defun mechanics()
(interactive)
(run-scheme
"/usr/local/scmutils/mit-scheme/bin/scheme --library
/usr/local/scmutils/mit-scheme/lib"))


12.4 Save the file. Close Emacs. Then re-open Emacs.

12.5 Within Emacs, type the command

M-x mechanics

M-x means that while the Alt key is pressed down, press also x. Then type the word mechanics.

12.6 Type the command

(+ 1 1)

to test the system.

13. If you want to access your last command without re-typing it, type the command

M-p

— Me@2020-02-22 06:25:47 PM

.

.

# scmutils, 2.3

Within the MIT Scheme environment, it is not the original command line (bash) anymore. I can neither repeat the last command by just pressing the up key once, nor select the last command by mouse in order to copy it.

So I think I have to use an older version of scmutils.

However, this method is not easy to implement, because the author’s website does not provide an older version. Luckily, I have found an old version in my computer. You can download it here:

scmutils-20160827-x86-64-gnu-linux

Note: Since the installation of the library scmutils requires the root access of your Linux system, please do NOT use it on your working computer. Instead, create an isolated virtual machine to use it.

— Me@2020-02-09 10:27:32 PM

.

.

# scmutils, 2.2

Either use an older version of scmutils in order to follow the previous instructions for setting up Emacs for scmutils, or give up using Emacs for scmutils for the time being.

Using command line is the best way to go, so far.

The “using command line” method does not really work.

Within the MIT Scheme environment, it is not the original command line (bash) anymore. I can neither repeat the last command by just pressing the up key once, nor select the last command by mouse in order to copy it.

So I think I have to use an older version of scmutils.

— Me@2020-01-26 07:38:31 PM

.

.

# scmutils, 2

The original method of setting up Emacs for scmutils does not work anymore if you uses the newest (August 2019) version of scmutils, because its installation directories are not the same as those in the previous version.

Either use an older version of scmutils in order to follow the previous instructions for setting up Emacs for scmutils, or give up using Emacs for scmutils for the time being.

Using command line is the best way to go, so far.

Do not use the Edwin editor, since you cannot easily run, edit, or copy existing lines of code, unless you are familiar with it. I do not like it anyway, because after all, it does not provide syntax highlighting.

— Me@2019-12-28 07:50:32 PM

.

.

# Varying the action, 2.2

\displaystyle{ \begin{aligned} &= \int_{t_1}^{t_2} (D L \circ \Gamma[q]) \delta_\eta \Gamma[q] \\ \end{aligned}}

\displaystyle{ \begin{aligned} &= \int_{t_1}^{t_2} [\partial_0 L (t, q, v), \partial_1 L (t, q, v), \partial_2 L (t, q, v)] (0, \eta(t), D\eta(t)) \\ \end{aligned}}

There are two kinds of tuples: up tuples and down tuples. We write tuples as ordered lists of their components; a tuple is delimited by parentheses if it is an up tuple and by square brackets if it is a down tuple.

— Structure and Interpretation of Classical Mechanics

So $\displaystyle{\left[\partial_0 L (t, q, v), \partial_1 L (t, q, v), \partial_2 L (t, q, v)\right] (0, \eta(t), D\eta(t))}$ is really a dot product:

.

\displaystyle{ \begin{aligned} & \int_{t_1}^{t_2} (D L \circ \Gamma[q]) \delta_\eta \Gamma[q] \\ &= \int_{t_1}^{t_2} [\partial_0 L (t, q, v), \partial_1 L (t, q, v), \partial_2 L (t, q, v)] (0, \eta(t), D\eta(t)) \\ &= \int_{t_1}^{t_2} [\partial_1 L (t, q, v) \eta(t) + \partial_2 L (t, q, v) D\eta(t)] \\ \end{aligned}}

— Me@2019-12-14 06:11:22 PM

.

.

# Varying the action, 2.1

Equation (1.28):

$\displaystyle{S[q](t_1, t_2) = \int_{t_1}^{t_2} L \circ \Gamma[q]}$

Equation (1.30):

$\displaystyle{h[q] = L \circ \Gamma[q]}$

$\displaystyle{\delta_\eta S[q](t_1, t_2) = \int_{t_1}^{t_2} \delta_\eta h[q]}$

.

Let $\displaystyle{F}$ be a path-independent function and $\displaystyle{g}$ be a path-dependent function; then

$\displaystyle{\delta_\eta h[q] = \left( DF \circ g[q] \right) \delta_\eta g[q]~~~~~\text{with}~~~~~h[q] = F \circ g[q].~~~~~(1.26)}$

$\displaystyle{\delta_\eta F \circ g[q] = \left( DF \circ g[q] \right) \delta_\eta g[q]}$

.

— 1.5.1 Varying a path

— Structure and Interpretation of Classical Mechanics

.

\displaystyle{ \begin{aligned} &\delta_\eta S[q] (t_1, t_2) \\ &= \int_{t_1}^{t_2} \delta_\eta \left( L \circ \Gamma[q] \right) \\ \end{aligned}}

Assume that $\displaystyle{L}$ is a path-independent function, so that we can use Eq. 1.26:

\displaystyle{ \begin{aligned} &= \int_{t_1}^{t_2} (D L \circ \Gamma[q]) \delta_\eta \Gamma[q] \\ \end{aligned}}

\displaystyle{ \begin{aligned} &= \int_{t_1}^{t_2} (D L \circ \Gamma[q]) (0, \eta(t), D\eta(t)) \\ &= \int_{t_1}^{t_2} (D L \left[ \Gamma[q] \right]) (0, \eta(t), D\eta(t)) \\ \end{aligned}}

Assume that $\displaystyle{L}$ is a path-independent function, so that any value of $\displaystyle{L}$ depends on the value of $\displaystyle{\Gamma}$ at that moment only, instead of depending on the whole path $\displaystyle{\Gamma}$:

\displaystyle{ \begin{aligned} &= \int_{t_1}^{t_2} (D L (\Gamma[q])) (0, \eta(t), D\eta(t)) \\ &= \int_{t_1}^{t_2} (D L (t, q, v)) (0, \eta(t), D\eta(t)) \\ &= \int_{t_1}^{t_2} [\partial_0 L (t, q, v), \partial_1 L (t, q, v), \partial_2 L (t, q, v)] (0, \eta(t), D\eta(t)) \\ \end{aligned}}

What kind of product is it here? Is it just a dot product? Probably not.

\displaystyle{ \begin{aligned} &= \int_{t_1}^{t_2} [\partial_1 L (t, q, v) \eta(t) + \partial_2 L (t, q, v) D\eta(t)] \\ \end{aligned}}

.

— Me@2019-10-12 03:42:01 PM

.

.

# Introduction to Differential Equations

llamaz 1 hour ago [-]

I think the calculus of variations might be a better approach to introducing ODEs in first year.

You can show that by generalizing calculus so the values are functions rather than real numbers, then trying to find a max/min using the functional version of $\displaystyle{\frac{dy}{dx} = 0}$, you end up with an ODE (viz. the Euler-Lagrange equation).

This also motivates Lagrange multipliers which are usually taught around the same time as ODEs. They are similar to the Hamiltonian, which is a synonym for energy and is derived from the Euler-Lagrange equations of a system.

Of course you would brush over most of this mechanics stuff in a single lecture (60 min). But now you’ve motivated ODEs and given the students a reason to solve ODEs with constant coefficients.

— Hacker News

.

.

2019.10.02 Wednesday ACHK

# A Tale of Two L’s

Lagrange’s equations are traditionally written in the form

$\displaystyle{\frac{\mathrm{d}}{\mathrm{d}t} \left ( \frac {\partial L}{\partial \dot{q}} \right ) = \frac {\partial L}{\partial q}}$

or, if we write a separate equation for each component of $\displaystyle{q}$, as

$\displaystyle{\frac{\mathrm{d}}{\mathrm{d}t} \left ( \frac {\partial L}{\partial \dot{q^i}} \right ) = \frac {\partial L}{\partial q^i}}$

In this way of writing Lagrange’s equations the notation does not distinguish between $\displaystyle{L}$, which is a real-valued function of three variables $\displaystyle{(t, q, \dot q)}$, and $\displaystyle{L \circ \Gamma[q]}$, which is a real-valued function of one real variable $\displaystyle{t}$.

— Structure and Interpretation of Classical Mechanics

.

.

2019.09.04 Wednesday ACHK

# Literal numbers

All primitive mathematical procedures are extended to be generic over
symbolic arguments. When given symbolic arguments, these procedures
construct a symbolic representation of the required answer. There are
primitive literal numbers. We can make a literal number that is
represented as an expression by the symbol “a” as follows:

(literal-number 'a)        ==>  (*number* (expression a))


The literal number is an object that has the type of a number, but its
representation as an expression is the symbol “a”.

(type (literal-number 'a))          ==>  *number*

(expression (literal-number 'a))    ==>  a


— SCMUTILS Reference Manual

.

.

2019.08.17 Saturday ACHK

# Ex 1.7 Properties of $\delta$

Let $\displaystyle{F}$ be a path-independent function and $\displaystyle{g}$ be a path-dependent function; then

$\displaystyle{\delta_\eta h[q] = \left( DF \circ g[q] \right) \delta_\eta g[q]~~~~~\text{with}~~~~~h[q] = F \circ g[q].~~~~~(1.26)}$

— 1.5.1 Varying a path

— Structure and Interpretation of Classical Mechanics

.

Prove that

$\displaystyle{\delta_\eta F \circ g[q] = \left( DF \circ g[q] \right) \delta_\eta g[q]}$

~~~

$\displaystyle{RHS = \lim_{\Delta t \to 0} \left( \frac{F \circ g[q](t+\Delta t) - F \circ g[q](t)}{\Delta t} \right) \lim_{\epsilon \to 0} \left( \frac{g[q+\epsilon \eta]-g[q]}{\epsilon} \right)}$

\displaystyle{ \begin{aligned} LHS &= \delta_\eta F \circ g[q] \\ &= \lim_{\epsilon \to 0} \left( \frac{F \circ g[q+\epsilon \eta]-F \circ g[q]}{\epsilon} \right) \\ &= \lim_{\epsilon \to 0} \left( \frac{F \left[ g[q+\epsilon \eta] \right] - F \left[ g[q] \right]}{\epsilon} \right) \\ \end{aligned}}

Since $\displaystyle{F}$ is path-independent,

\displaystyle{ \begin{aligned} LHS &= \lim_{\epsilon \to 0} \left( \frac{F \left( g[q+\epsilon \eta ] \right) - F \left( g[q] \right)}{\epsilon} \right) \\ \end{aligned}}

Let $\displaystyle{ g[q+\epsilon \eta] = g + \Delta g}$.

\displaystyle{ \begin{aligned} LHS &= \lim_{\epsilon \to 0} \left( \frac{F \left( g[q] + \Delta g[q]] \right) - F \left( g[q] \right)}{\epsilon} \right) \\ &= \lim_{\epsilon \to 0} \left( \frac{F \left( g[q] + \Delta g[q]] \right) - F \left( g[q] \right)}{\Delta g[q]}\frac{\Delta g[q]}{\epsilon} \right) \\ \end{aligned}}

When $\displaystyle{ \epsilon \to 0}$, $\displaystyle{ \Delta g \to 0 }$.

\displaystyle{ \begin{aligned} LHS &= \lim_{\substack{\epsilon \to 0 \\ \Delta g \to 0}} \left( \frac{F \left( g[q] + \Delta g[q]] \right) - F \left( g[q] \right)}{\Delta g[q]}\frac{\Delta g[q]}{\epsilon} \right) \\ &= \lim_{\Delta g \to 0} \left( \frac{F \left( g[q] + \Delta g[q]] \right) - F \left( g[q] \right)}{\Delta g[q]} \lim_{\epsilon \to 0} \frac{g[q + \epsilon \eta] - g[q]}{\epsilon} \right) \\ &= DF \left( g[q] \right) \delta_\eta g[q] \\ &= RHS \\ \end{aligned}}

— Me@2019-06-24 10:55:28 PM

.

.

# The Principle of Stationary Action

Varying the action

$\displaystyle{S[q](t_1, t_2) = \int_{t_1}^{t_2} L \circ \Gamma[q]}$

.

The Principle of Stationary Action

$\displaystyle{\delta_\eta S[q] (t_1, t_2) = 0}$

$\delta_\eta S[q] (t_1, t_2) = \int_{t_1}^{t_2} \delta_\eta L \circ \Gamma[q]$

— Structure and Interpretation of Classical Mechanics

.

.

2019.05.13 Monday ACHK

# Ex 1.8 Implementation of $\delta$

\displaystyle{ \begin{aligned} \delta_\eta f[q] &= \lim_{\epsilon \to 0} \left( \frac{f[q+\epsilon \eta]-f[q]}{\epsilon} \right) \\ \end{aligned}}

The variation may be represented in terms of a derivative.

— Structure and Interpretation of Classical Mechanics

\displaystyle{ \begin{aligned} g( \epsilon ) &= f[q + \epsilon \eta] \\ \delta_\eta f[q] &= \lim_{\epsilon \to 0} \left( \frac{g(\epsilon) - g(0)}{\epsilon} \right) \\ &= D g(0) \\ \end{aligned}}

.

A lambda expression evaluates to a procedure. The environment in effect when the lambda expression is evaluated is remembered as part of the procedure; it is called the closing environment.

— Structure and Interpretation of Classical Mechanics

(define (((delta eta) f) q)
(let ((g (lambda (epsilon) (f (+ q (* epsilon eta))))))
((D g) 0)))


— Me@2019-05-05 10:47:46 PM

.

.