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

.

.

2020.06.24 Wednesday (c) All rights reserved by ACHK

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

d_2020_04_11__11_59_10_AM_

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

.

.

2020.04.11 Saturday (c) All rights reserved by ACHK

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.

d_2020_02_22__16_02_00_PM_

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.

d_2020_02_22__18_12_54_PM_

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

2. Add the following code:


(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)))
 
(fset 'load-scm
      (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)
	 (load-scm)
	 (comint-send-input)))
  (windmove-up)
)
 
(defun cxce ()
  (interactive)
  (save-buffer)
  (windmove-down)
  (load-scm)
  (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.

d_2020_03_11__20_28_27_PM_

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

.

.

2020.03.10 Tuesday (c) All rights reserved by ACHK

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.

d_2020_02_22__16_02_00_PM_

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:

d_2020_02_22__17_08_35_PM_

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.

d_2020_02_22__18_12_12_PM_

12.6 Type the command

(+ 1 1)

to test the system.

d_2020_02_22__18_12_54_PM_

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

M-p

d_2020_02_22__18_19_31_PM_

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

.

.

2020.02.22 Saturday (c) All rights reserved by ACHK

Unix

Linux is headache. It gives you too many choices.

— Me@2011.07.14

.

But Linux is necessary.

— Me@2020-01-23 08:53:29 PM

.

Applicants must also have extensive knowledge of Unix, although they should have sufficiently good programming taste to not consider this an achievement.

— MIT job advertisement

— Hal Abelson

.

.

2020.02.15 Saturday (c) All rights reserved by ACHK

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

.

.

2020.02.09 Sunday (c) All rights reserved by ACHK

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.

d_2020_01_27__16_12_48_PM_

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

.

.

2020.01.26 Sunday (c) All rights reserved by ACHK

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

.

.

2019.12.28 Saturday (c) All rights reserved by ACHK

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

.

.

2019.12.14 Saturday (c) All rights reserved by ACHK

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

.

.

2019.10.13 Sunday (c) All rights reserved by ACHK

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

.

.

2019.06.25 Tuesday (c) All rights reserved by 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

.

.

2019.05.05 Sunday (c) All rights reserved by ACHK

Varying a path

Suppose that we have a function \displaystyle{f[q]} that depends on a path \displaystyle{q}. How does the function vary as the path is varied? Let \displaystyle{q} be a coordinate path and \displaystyle{q + \epsilon \eta} be a varied path, where the function \displaystyle{\eta} is a path-like function that can be added to the path \displaystyle{q}, and the factor \displaystyle{\epsilon} is a scale factor. We define the variation \displaystyle{ \delta_\eta f[q]} of the function \displaystyle{f} on the path \displaystyle{q} by

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

The variation of \displaystyle{f} is a linear approximation to the change in the function \displaystyle{f} for small variations in the path. The variation of \displaystyle{f} depends on \displaystyle{\eta}.

— 1.5.1 Varying a path

— Structure and Interpretation of Classical Mechanics

.

Exercise 1.7. Properties of \displaystyle{\delta}

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

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

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

.

.

2019.04.27 Saturday ACHK

scmutils

In order to run the SICM code, you need to install the scmutils library. Just go to the official page to download the library and follow the official instructions to install it in a Linux operating system.

When you try to run it, your system may give the following error message:

/usr/local/bin/mechanics: line 16: exec: xterm: not found

If so, you should install the program xterm first.

.

Also, in case you like to use Emacs as editor, you can:

Just include the following in your .emacs file:

(defun mechanics ()
  (interactive)
  (run-scheme
    "ROOT/mit-scheme/bin/scheme --library ROOT/mit-scheme/lib"
  ))

Replace ROOT with the directory in which you installed the scmutils software. (Remember to replace it in both places. If it is installed differently on your system, just make sure the string has the form “/path/to/mit-scheme --library /path/to/scmutils-library“.) Restart emacs (or use C-x C-e to evaluate the mechanics defun), and launch the environment with the command M-x mechanics.

— Using GNU Emacs With SCMUtils

— Aaron Maxwell

.

In my Ubuntu 18.04, the paths are:

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

— Me@2019-04-07 02:52:50 PM

.

.

2019.04.07 Sunday (c) All rights reserved by ACHK

Finding trajectories that minimize the action

We have used the variational principle to determine if a given trajectory is realizable. We can also use the variational principle to find trajectories. Given a set of trajectories that are specified by a finite number of parameters, we can search the parameter space looking for the trajectory in the set that best approximates the real trajectory by finding one that minimizes the action. By choosing a good set of approximating functions we can get arbitrarily close to the real trajectory.

— Structure and Interpretation of Classical Mechanics

.

We have used the variational principle to determine if a given trajectory is realizable.

How?

— Me@2019-03-29 04:23:36 PM

.

Check if the action of that given trajectory is stationary or not.

— Me@2019-03-29 04:25:45 PM

.

.

2019.03.29 Friday (c) All rights reserved by ACHK