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

.

.

2020.08.06 Thursday (c) All rights reserved by ACHK