SICM Exercise 1.16
Solution to exercise 1.16 of Structure and Interpretation of Classical Mechanics by Gerald Jay Sussman and Jack Wisdom.
Central force motion
\[V(t; x, y, z) = U\left(\sqrt{x^2 + y^2 + z^2}\right)\]🛈 Note
Find Lagrangians for central force motion in three dimensions in rectangular coordinates and in spherical coordinates. First , find the Lagrangians analytically, then check the results with the computer by generalizing the programs that we have presented.
\[T(t; x, y, z; v_x, v_y, v_z) = \frac{1}{2} m \left(v_x^2 + v_y^2 + v_z^2\right)\]
\[L = T - V = \frac{1}{2} m \left(v_x^2 + v_y^2 + v_z^2\right) - U\left(\sqrt{x^2 + y^2 + z^2}\right)\]
To get the Lagrangian in spherical coordinates, we have to write down the transformations from spherical to rectangular, namely \begin{equation*} x = r \sin \theta \cos \varphi \qquad y = r \sin \theta \sin \varphi \qquad z = r \cos \theta \end{equation*}
To get the velocity transformations we have to take the derivative of the position transformations.
\[v_x = Dx = \dot r \left(\sin \theta \cos \varphi\right) + r\left(\dot \theta \cos \theta \cos \varphi - \dot \varphi \sin \theta \sin \varphi\right)\]\[v_y = Dy = \dot r \left(\sin \theta \sin \varphi\right) + r\left(\dot \theta \cos \theta \sin \varphi + \dot \varphi \sin \theta \cos \varphi\right)\]
\[v_z = Dz = \dot r \cos \theta - r \dot \theta \sin \theta\]
After taking the sum of squares of the velocities we can use the \(\sin^2 a + \cos^2 b = 1\) identitiy to simplify most expressions, the other terms cancel. The expression we are left with is
\[v_x^2 + v_y^2 + v_z^2 = \dot r^2 + r^2 \dot\theta^2 + r^2 \dot\varphi^2 \sin^2\theta\]So the Lagrangian for the spherical system is
\[V(t; r, \theta, \varphi) = U(r)\]\[T(t; r, \theta, \varphi) = \frac{1}{2} m \left(\dot r^2 + r^2 \dot\theta^2 + r^2 \dot\varphi^2 \sin^2\theta \right)\]
\[L = T - V = \frac{1}{2} m \left(\dot r^2 + r^2 \dot\theta^2 + r^2 \dot\varphi^2 \sin^2\theta \right) - U(r)\]
The following code implements this.
(define ((L-central-rectangular m U) local)
(let ((q (coordinate local))
(v (velocity local)))
(- (* 1/2 m (square v))
(U (sqrt (square q))))))
(define ((L-central-spherical m U) local)
(let ((q (coordinate local))
(qdot (velocity local)))
(let ((r (ref q 0)) (theta (ref q 1)) (phi (ref q 2))
(rdot (ref qdot 0)) (thetadot (ref qdot 1)) (phidot (ref qdot 2)))
(- (* 1/2 m
(+ (square rdot)
(square (* r thetadot))
(square (* r phidot (sin theta)))))
(U r)))))
(define (s->r local)
(let ((spherical-tuple (coordinate local)))
(let ((r (ref spherical-tuple 0))
(theta (ref spherical-tuple 1))
(phi (ref spherical-tuple 2)))
(let ((x (* r (sin theta) (cos phi)))
(y (* r (sin theta) (sin phi)))
(z (* r (cos theta))))
(up x y z)))))
(show-expression
(((Lagrange-equations
(L-central-rectangular 'm (literal-function 'U)))
(up (literal-function 'x)
(literal-function 'y)
(literal-function 'z)))
't))
We get the same expressions as in the 2D example in the book (equations 1.62 and 1.63), but now we have a third equation for \(z\).
(show-expression
(((Lagrange-equations
(L-central-spherical 'm (literal-function 'U)))
(up (literal-function 'r)
(literal-function 'theta)
(literal-function 'phi)))
't))
We get quite a complicated expression here. Later we will see that it is correct. Next, we will define a second Lagrangian for the spherical system that uses the coordinate transformation function.
(define (L-central-spherical-2 m U)
(compose (L-central-rectangular m U) (F->C s->r)))
Now we will take the difference of the two Lagrangians in spherical systems.
(show-expression
((-
((Lagrange-equations
(L-central-spherical 'm (literal-function 'U)))
(up (literal-function 'r)
(literal-function 'theta)
(literal-function 'phi)))
((Lagrange-equations
(L-central-spherical-2 'm (literal-function 'U)))
(up (literal-function 'r)
(literal-function 'theta)
(literal-function 'phi))))
't))
]=> (down 0 0 0)
As expected, the difference is zero, proving that the analytically derived Lagrangian is correct.