This is one of the more important exercises in the chapter. The problem asks for a proof that it's possible to absorb a coordinate transformation directly into the Lagrangian. If you can do this, you can express your paths and your forces in whatever coordinates you like, so long as you can transition between them.
I also found that this exposed, and repaired, my weakness with the functional notation that Sussman and Wisdom have used in the book.
The problem states:
Show by direct calculation that the Lagrange equations for
$L'$ are satisfied if the Lagrange equations for$L$ are satisfied.
Imagine a coordinate transformation
You might imagine that
Now imagine some Lagrangian
\begin{equation} L' \circ \Gamma[q'] = L \circ \Gamma[q] \end{equation}
The function
\begin{equation} \label{eq:1-15-relations} L \circ \Gamma[q] = L \circ C \circ \Gamma[q'] = L' \circ \Gamma[q'] \end{equation}
Function composition is associative, so two facts stare at us from \eqref{eq:1-15-relations}:
\begin{equation} \begin{aligned} L' & = L \circ C \cr \Gamma[q] & = C \circ \Gamma[q'] \end{aligned} \end{equation}
This implies that if we want describe our path in some primed coordinate system (imagine polar coordinates), but we only have a Lagrangian defined in an unprimed coordinate system (like rectangular coordinates), if we can just write down
The goal is to show that if the Lagrange equations hold in the unprimed coordinate system:
\begin{equation} \label{eq:1-15-lagrange} D(\partial_2L \circ \Gamma[q]) - (\partial_1L \circ \Gamma[q]) = 0 \end{equation}
Then they hold in the primed coordinate system:
\begin{equation} \label{eq:lagrange-prime} D(\partial_2L' \circ \Gamma[q']) - (\partial_1L' \circ \Gamma[q']) = 0 \end{equation}
The approach we'll take will be to:
- Write down the form of
$C$ , given some arbitrary$F$ - start calculating the terms of the Lagrange equations in the primed coordinate system using
$L' = L \circ C$ - Keep an eye out for some spot where we can use our assumption that the Lagrange equations hold in the unprimed coordinates.
I'll walk through a solution using "pen and paper", then show how we can run this derivation using Scheme to help us along.
First, some Scheme tools that will help us in both cases.
Equation (1.77) in the book describes how to implement F->C
on page 46.
The following function is a slight redefinition that allows us to use an
(define ((F->C* F) local)
(let ((t (time local))
(x (coordinate local))
(v (velocity local)))
(up t
(F t x)
(+ (((partial 0) F) t x)
(* (((partial 1) F) t x)
v)))))
Next we define qprime
, a function that can represent our unprimed coordinate path function.
The types here all imply that the path has one real coordinate. I did this to make the types easier to understand; the derivation applies equally well to paths with many dimensions.
(define F
(literal-function 'F (-> (X Real Real) Real)))
(define C (F->C* F))
(define L
(literal-function 'L (-> (UP Real Real Real) Real)))
(define qprime
(literal-function 'qprime))
When we apply
(->tex-equation
((compose C (Gamma qprime)) 't))
\begin{equation} \begin{pmatrix} \displaystyle{ t} \cr \cr \displaystyle{ F\left( t, {q}^\prime\left( t \right) \right)} \cr \cr \displaystyle{ D{q}^\prime\left( t \right) {\partial}_{1}F\left( t, {q}^\prime\left( t \right) \right) + {\partial}_{0}F\left( t, {q}^\prime\left( t \right) \right)}\end{pmatrix} \end{equation}
This looks correct. We can also transform the path before passing it to
(define ((to-q F qp) t)
(F t (qp t)))
Subtract the two forms to see that they're equivalent:
(->tex-equations
((- (compose C (Gamma qprime))
(Gamma (to-q F qprime)))
't))
\begin{equation} \begin{pmatrix} \displaystyle{ 0} \cr \cr \displaystyle{ 0} \cr \cr \displaystyle{ 0}\end{pmatrix} \end{equation}
Now that we know Lprime
:
(define q (to-q F qprime))
(define Lprime (compose L C))
Begin by calculating the components of the Lagrange equations in equation \eqref{eq:lagrange-prime}. Examine the
As we discussed above, function composition is associative, so:
\begin{equation} \label{eq:c-l} (L \circ C) \circ \Gamma[q'] = L' \circ \Gamma[q'] \implies L' = L \circ C \end{equation}
Substituting
\begin{equation} \partial_2L' = \partial_2(L \circ C) = ((DL) \circ C) \partial_2 C \end{equation}
I found the next step troubling until I became more comfortable with the functional notation.
The tuple algebra described in Chapter 9 defines multiplication between an up and down tuple as a dot product, or a "contraction" in the book's language. This means that we can expand out the product above:
\begin{equation} (DL \circ C)\partial_2 C = (\partial_0L \circ C)(I_0 \circ \partial_2 C) + (\partial_1L \circ C)(I_1 \circ \partial_2 C) + (\partial_2L \circ C)(I_2 \circ \partial_2 C) \end{equation}
Example the value of
(->tex-equation
(((partial 2) C) (up 't 'xprime 'vprime))
"eq:p2c")
\begin{equation} \begin{pmatrix} \displaystyle{ 0} \cr \cr \displaystyle{ 0} \cr \cr \displaystyle{ {\partial}_{1}F\left( t, {x}^\prime \right)}\end{pmatrix} \label{eq:p2c} \end{equation}
The first two components are 0, leaving us with:
\begin{equation} \partial_2 L' = (DL \circ C)\partial_2 C = (\partial_2L \circ C)(I_2 \circ \partial_2 C) \end{equation}
Compose this quantity with
\begin{equation} \begin{aligned} \partial_2L' \circ \Gamma[q'] & = (\partial_2L \circ C)(I_2 \circ \partial_2 C) \circ \Gamma[q'] \cr & = (\partial_2L \circ C \circ \Gamma[q'])(I_2 \circ \partial_2 C \circ \Gamma[q']) \cr & = (\partial_2L \circ \Gamma[q])(I_2 \circ \partial_2 C \circ \Gamma[q']) \end{aligned} \end{equation}
Take the derivative (with respect to time, remember, from the types):
\begin{equation} D(\partial_2L' \circ \Gamma[q']) = D\left[(\partial_2L \circ \Gamma[q])(I_2 \circ \partial_2 C \circ \Gamma[q'])\right] \end{equation}
Substitute the second term using \eqref{eq:p2c}:
\begin{equation} D(\partial_2L' \circ \Gamma[q']) = D\left[(\partial_2L \circ \Gamma[q])\partial_1F(t, q'(t))\right] \end{equation}
Expand using the product rule:
\begin{equation} \label{eq:ex1-15-dp2l} D(\partial_2L' \circ \Gamma[q']) = \left[ D(\partial_2L \circ \Gamma[q]) \right]\partial_1F(t, q'(t)) + (\partial_2L \circ \Gamma[q])D\left[ \partial_1F(t, q'(t)) \right] \end{equation}
A term from the unprimed Lagrange's equation is peeking. Notice this, but don't make the substitution just yet.
Next, expand the
\begin{equation} \partial_1L' = \partial_1(L \circ C) = ((DL) \circ C) \partial_1 C \end{equation}
Calculate
(->tex-equation
(((partial 1) C) (up 't 'xprime 'vprime)))
\begin{equation} \begin{pmatrix} \displaystyle{ 0} \cr \cr \displaystyle{ {\partial}_{1}F\left( t, {x}^\prime \right)} \cr \cr \displaystyle{ {v}^\prime {{\partial}_{1}}^{2}\left( F \right)\left( t, {x}^\prime \right) + \left( {\partial}_{0} {\partial}_{1} \right)\left( F \right)\left( t, {x}^\prime \right)}\end{pmatrix} \end{equation}
Expand the chain rule out and remove 0 terms, as before:
\begin{equation} \begin{aligned} \partial_1L' & = ((DL) \circ C) \partial_1 C \cr & = (\partial_0L \circ C)(I_0 \circ \partial_1 C) + (\partial_1L \circ C)(I_1 \circ \partial_1 C) + (\partial_2L \circ C)(I_2 \circ \partial_1 C) \cr & = (\partial_1L \circ C)(I_1 \circ \partial_1 C) + (\partial_2L \circ C)(I_2 \circ \partial_1 C) \end{aligned} \end{equation}
Compose
\begin{equation} \begin{aligned} \partial_1L' \circ \Gamma[q'] & = (\partial_1L \circ \Gamma[q])(I_1 \circ \partial_1 C \circ \Gamma[q']) + (\partial_2L \circ \Gamma[q])(I_2 \circ \partial_1 C \circ \Gamma[q']) \cr & = (\partial_1L \circ \Gamma[q])(\partial_1F(t, q'(t))) + (\partial_2L \circ \Gamma[q])D(\partial_1F(t, q'(t))) \end{aligned} \end{equation}
We now have both components of the primed Lagrange equations from \eqref{eq:lagrange-prime}.
Subtract the two terms, extract common factors and use our assumption \eqref{eq:1-15-lagrange} that the original Lagrange equations hold:
\begin{equation} \begin{aligned} D(\partial_2L' \circ \Gamma[q']) - (\partial_1L' \circ \Gamma[q']) & = \left[ D(\partial_2L \circ \Gamma[q]) - (\partial_1L \circ \Gamma[q]) \right] \partial_1F(t, q'(t)) \cr & + \left[ (\partial_2L \circ \Gamma[q]) - (\partial_2L \circ \Gamma[q]) \right] D(\partial_1F(t, q'(t))) \cr & = \left[ D(\partial_2L \circ \Gamma[q]) - (\partial_1L \circ \Gamma[q]) \right] \partial_1F(t, q'(t)) \cr & = 0 \end{aligned} \end{equation}
And boom, we're done! The primed Lagranged equations \eqref{eq:lagrange-prime} hold if the unprimed equations \eqref{eq:1-15-lagrange} hold.
I'm not sure what to make of the new constant terms. The new Lagrange equations are scaled by
Can we use Scheme to pursue the same derivation? If we can write the relationships of the derivation in code, then we'll have a sort of computerized proof that the primed Lagrange equations are valid.
First, consider
(->tex-equation
((compose ((partial 1) Lprime) (Gamma qprime))
't))
\begin{equation} D{q}^\prime\left( t \right) {\partial}_{2}L\left( \begin{pmatrix} \displaystyle{ t} \cr \cr \displaystyle{ F\left( t, {q}^\prime\left( t \right) \right)} \cr \cr \displaystyle{ D{q}^\prime\left( t \right) {\partial}_{1}F\left( t, {q}^\prime\left( t \right) \right) + {\partial}_{0}F\left( t, {q}^\prime\left( t \right) \right)}\end{pmatrix} \right) {{\partial}_{1}}^{2}\left( F \right)\left( t, {q}^\prime\left( t \right) \right) + {\partial}_{1}F\left( t, {q}^\prime\left( t \right) \right) {\partial}_{1}L\left( \begin{pmatrix} \displaystyle{ t} \cr \cr \displaystyle{ F\left( t, {q}^\prime\left( t \right) \right)} \cr \cr \displaystyle{ D{q}^\prime\left( t \right) {\partial}_{1}F\left( t, {q}^\prime\left( t \right) \right) + {\partial}_{0}F\left( t, {q}^\prime\left( t \right) \right)}\end{pmatrix} \right) + {\partial}_{2}L\left( \begin{pmatrix} \displaystyle{ t} \cr \cr \displaystyle{ F\left( t, {q}^\prime\left( t \right) \right)} \cr \cr \displaystyle{ D{q}^\prime\left( t \right) {\partial}_{1}F\left( t, {q}^\prime\left( t \right) \right) + {\partial}_{0}F\left( t, {q}^\prime\left( t \right) \right)}\end{pmatrix} \right) \left( {\partial}_{0} {\partial}_{1} \right)\left( F \right)\left( t, {q}^\prime\left( t \right) \right) \end{equation}
This is completely insane, and already unhelpful. The argument to
(define (->eq expr)
(write-string
(replace-all (->tex-equation* expr)
(->tex* ((Gamma q) 't))
"\\circ \\Gamma[q]")))
Try again:
(->eq
((compose ((partial 1) Lprime) (Gamma qprime))
't))
\begin{equation} D{q}^\prime\left( t \right) {\partial}_{2}L\left( \circ \Gamma[q] \right) {{\partial}_{1}}^{2}\left( F \right)\left( t, {q}^\prime\left( t \right) \right) + {\partial}_{1}F\left( t, {q}^\prime\left( t \right) \right) {\partial}_{1}L\left( \circ \Gamma[q] \right) + {\partial}_{2}L\left( \circ \Gamma[q] \right) \left( {\partial}_{0} {\partial}_{1} \right)\left( F \right)\left( t, {q}^\prime\left( t \right) \right) \end{equation}
Ignore the parentheses around
The
(let* ((factor (((partial 1) F) 't (qprime 't))))
(->eq
((* factor (compose ((partial 1) L) (Gamma q)))
't)))
\begin{equation} {\partial}_{1}F\left( t, {q}^\prime\left( t \right) \right) {\partial}_{1}L\left( \circ \Gamma[q] \right) \end{equation}
Next, consider the
(->eq
((D (compose ((partial 2) Lprime) (Gamma qprime)))
't))
\begin{equation} {\left( D{q}^\prime\left( t \right) \right)}^{2} {\partial}_{1}F\left( t, {q}^\prime\left( t \right) \right) {{\partial}_{1}}^{2}\left( F \right)\left( t, {q}^\prime\left( t \right) \right) {{\partial}_{2}}^{2}\left( L \right)\left( \circ \Gamma[q] \right) + D{q}^\prime\left( t \right) {\left( {\partial}_{1}F\left( t, {q}^\prime\left( t \right) \right) \right)}^{2} \left( {\partial}_{1} {\partial}_{2} \right)\left( L \right)\left( \circ \Gamma[q] \right) + 2 D{q}^\prime\left( t \right) {\partial}_{1}F\left( t, {q}^\prime\left( t \right) \right) \left( {\partial}_{0} {\partial}_{1} \right)\left( F \right)\left( t, {q}^\prime\left( t \right) \right) {{\partial}_{2}}^{2}\left( L \right)\left( \circ \Gamma[q] \right) + {\left( {\partial}_{1}F\left( t, {q}^\prime\left( t \right) \right) \right)}^{2} {D}^{2}{q}^\prime\left( t \right) {{\partial}_{2}}^{2}\left( L \right)\left( \circ \Gamma[q] \right) + {\partial}_{0}F\left( t, {q}^\prime\left( t \right) \right) {\partial}_{1}F\left( t, {q}^\prime\left( t \right) \right) \left( {\partial}_{1} {\partial}_{2} \right)\left( L \right)\left( \circ \Gamma[q] \right) + D{q}^\prime\left( t \right) {\partial}_{2}L\left( \circ \Gamma[q] \right) {{\partial}_{1}}^{2}\left( F \right)\left( t, {q}^\prime\left( t \right) \right) + {\partial}_{1}F\left( t, {q}^\prime\left( t \right) \right) {{\partial}_{2}}^{2}\left( L \right)\left( \circ \Gamma[q] \right) {{\partial}_{0}}^{2}\left( F \right)\left( t, {q}^\prime\left( t \right) \right) + {\partial}_{1}F\left( t, {q}^\prime\left( t \right) \right) \left( {\partial}_{0} {\partial}_{2} \right)\left( L \right)\left( \circ \Gamma[q] \right) + {\partial}_{2}L\left( \circ \Gamma[q] \right) \left( {\partial}_{0} {\partial}_{1} \right)\left( F \right)\left( t, {q}^\prime\left( t \right) \right) \end{equation}
This, again, is total madness. We really want some way to control how Scheme expands terms.
But we know what we're looking for. Expand out the matching term of the unprimed Lagrange equations:
(->eq
((D (compose ((partial 2) L) (Gamma q)))
't))
\begin{equation} {\left( D{q}^\prime\left( t \right) \right)}^{2} {{\partial}_{1}}^{2}\left( F \right)\left( t, {q}^\prime\left( t \right) \right) {{\partial}_{2}}^{2}\left( L \right)\left( \circ \Gamma[q] \right) + D{q}^\prime\left( t \right) {\partial}_{1}F\left( t, {q}^\prime\left( t \right) \right) \left( {\partial}_{1} {\partial}_{2} \right)\left( L \right)\left( \circ \Gamma[q] \right) + 2 D{q}^\prime\left( t \right) \left( {\partial}_{0} {\partial}_{1} \right)\left( F \right)\left( t, {q}^\prime\left( t \right) \right) {{\partial}_{2}}^{2}\left( L \right)\left( \circ \Gamma[q] \right) + {\partial}_{1}F\left( t, {q}^\prime\left( t \right) \right) {D}^{2}{q}^\prime\left( t \right) {{\partial}_{2}}^{2}\left( L \right)\left( \circ \Gamma[q] \right) + {\partial}_{0}F\left( t, {q}^\prime\left( t \right) \right) \left( {\partial}_{1} {\partial}_{2} \right)\left( L \right)\left( \circ \Gamma[q] \right) + {{\partial}_{2}}^{2}\left( L \right)\left( \circ \Gamma[q] \right) {{\partial}_{0}}^{2}\left( F \right)\left( t, {q}^\prime\left( t \right) \right) + \left( {\partial}_{0} {\partial}_{2} \right)\left( L \right)\left( \circ \Gamma[q] \right) \end{equation}
Staring at these two equations, it becomes clear that the first contains the second, multiplied by
Try writing out the primed Lagrange equations, and subtracting the unprimed Lagrange equations, scaled by this factor:
(let* ((primed-lagrange
(- (D (compose ((partial 2) Lprime) (Gamma qprime)))
(compose ((partial 1) Lprime) (Gamma qprime))))
(lagrange
(- (D (compose ((partial 2) L) (Gamma q)))
(compose ((partial 1) L) (Gamma q))))
(factor
(compose coordinate ((partial 1) C) (Gamma qprime))))
(->tex-equation
((- primed-lagrange (* factor lagrange))
't)))
\begin{equation} 0 \end{equation}
Done! It seems that the extra terms on each side exactly cancel. As with the pen and paper derivation, we've shown that the primed Lagranged equations \eqref{eq:lagrange-prime} hold if the unprimed equations \label{eq:1-15-lagrange} hold.
I'm troubled by my lack of intuition around two ideas:
- what is the meaning of the
$\partial_1F(t, q'(t))$ scaling factor? - Both sides acquire a constant
$(\partial_2L \circ \Gamma[q]) \cdot D(\partial_1F(t, q'(t)))$ .
The right factor is a total time derivative. Is this meaningful? We know from later discussion that if we add a total time derivative to the Lagrangian we don't affect the shape of the realizable path.
I learned quite a bit about functional notation from this exercise, and I think that test that the result represents is critical for leaning hard on the coordinate transformations that we'll continue to explore. But I do feel like I'm leaving intuitive cake on the table.