Exercise 1.29: Galilean Invariance
(require [sicmutils.env :refer :all])I'll do this for a single particle, since it's annoying to get the sum going for many; and the Lagrangian is additive, so no problem.
(defn L-free-particle [mass] (fn [local] (let [v (velocity local)] (* (/ 1 2) mass (square v)))))(defn uniform-translate-shift->rect [[t [xprime delta_x delta_v]]] (+ xprime delta_x (* t delta_v)))(defn L-translate-shift [m] (compose (L-free-particle m) (F->C uniform-translate-shift->rect)))First, confirm that if we have a constant, we get what we expected from paper.
(let [q (up (literal-function xprime) (fn [_] Delta_x) (fn [_] Delta_v)) f (compose (L-translate-shift m) (Gamma q))] (f t))We can change this a little to see the extra terms; substract off the free particle Lagrangian, to see the extra stuff.
(let [q (up (literal-function xprime) (fn [_] Delta_x) (fn [_] Delta_v)) L (- (L-translate-shift m) (L-free-particle m)) f (compose L (Gamma q))] (f t))Here's the gnarly version with both entries as actual functions. Can this be a total time derivative? It CANNOT be, because we have a inline_formula not implemented term in there, and we know that total time derivatives have to be linear in the velocities. The function inline_formula not implemented would have had to have a velocity in it, which is not allowed.
(let [q (up (literal-function xprime) (literal-function Delta_x) (literal-function Delta_v)) L (- (L-translate-shift m) (L-free-particle m)) f (compose L (Gamma q))] (f t))Let's simplify by making the inline_formula not implemented constant and see if there's anything so obvious about inline_formula not implemented.
We know that we have a total derivative when inline_formula not implemented is constant, and we know that total time derivatives are linear, so let's substract off the total time derivative and see what happens:
(let [q (fn [dx] (up (literal-function xprime) dx (fn [_] Delta_v))) L (- (L-translate-shift m) (L-free-particle m)) f (fn [dx] (compose L (Gamma (q dx))))] ((- (f (literal-function Delta_x)) (f (fn [_] Delta_x))) t))Take a look. there is a quadratic velocity term in here! We have inline_formula not implemented. This is not allowed in a total time derivative.
SO, only if the shift and uniform translation are constant do we not affect the Lagrangian value.