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

.

.

2020.08.24 Monday (c) All rights reserved by ACHK