Emmy, the Algebra System: Classical Mechanics Chapter One
The following examples are taken from the MIT open-access book Structure and Interpretation of Classical Mechanics (SICM).
Another notebook can be found on the Road to Reality website by Sam Ritchie, the author (along with Colin Smith) of Emmy, the Computer Algebra System.
For interactivity, I have some SICM graphical puzzles.
In adopting MIT-Scheme’s (define ...), I trust that Clojure people will bridge that gap quickly while being sure of the gratitude of all readers of the immutable, dense book.
nil1.4 Computing Actions
First task: Calculate the action for the free particle along a path. Consider the particle moving at uniform speed along a straight line.
(define (test-path t)
(up (+ (* 4 t) 7)
(+ (* 3 t) 5)
(+ (* 2 t) 1)))#'mentat-collective.emmy.sicm-ch01/test-path(show-expression
(Lagrangian-action (L-free-particle 3.0) test-path 0.0 10.0))[hint MAK: the above expression also works in the sidebar, all of the below needs manual copy paste of every expression]
Paths of minimum Action
Show that the action is smaller along a straight-line test path than along nearby paths
(define ((make-η ν t1 t2) t)
(* (- t t1) (- t t2) (ν t)))#'mentat-collective.emmy.sicm-ch01/make-η(define ((varied-free-particle-action mass q ν t1 t2) ε)
(let ((η (make-η ν t1 t2)))
(Lagrangian-action (L-free-particle mass)
(+ q (* ε η)) t1 t2)))#'mentat-collective.emmy.sicm-ch01/varied-free-particle-action((varied-free-particle-action 3.0 test-path (up sin cos square) 0.0 10.0) 0.01)564.1214285776678Simulate lots of the paths in this manner. Proof that the minimum value of the action is the action along the straight path. For this proof it suffices that some optimization parameter is close to zero (need not be exactly zero).
(minimize (varied-free-particle-action 3.0 test-path (up sin cos square) 0.0 10.0) -2 1){:result 5.148901573592488E-8,
:value 434.9999999965733,
:iterations 26,
:converged? true,
:fncalls 27}:end_doCreate data to plot two straight paths in the xy plane. One path is along the x axis (name: path-along-x), the second path leads in all directions.
(define (path-along-x t)
(up (+ (* 5 t) 1)
(* 0 t)
(* 0 t)))#'mentat-collective.emmy.sicm-ch01/path-along-x(define path-points-1
(hash-map "a straight x" (make-path-txyz path-along-x 0 10 8)
"b book" (make-path-txyz test-path 0 10 8)))#'mentat-collective.emmy.sicm-ch01/path-points-1Plot the two paths
(kind/vega-lite
(points-xy->plot path-points-1))Create two variations of the path-along-x. Calculate the action. Show once again that the Lagrangian-action is indeed smallest for the straight path.
(define (make-varied-path ε t0 t1)
(+ path-along-x (* ε (make-η (up #(* 0 %) identity #(* 5.0 (sin %))) t0 t1))))#'mentat-collective.emmy.sicm-ch01/make-varied-path(define small-varied-path (make-varied-path 0.01 0 10))#'mentat-collective.emmy.sicm-ch01/small-varied-path(define large-varied-path (make-varied-path 0.02 0 10))#'mentat-collective.emmy.sicm-ch01/large-varied-path[(Lagrangian-action (L-free-particle 3.0) path-along-x 0.0 10.0)
(Lagrangian-action (L-free-particle 3.0) small-varied-path 0.0 10.0)
(Lagrangian-action (L-free-particle 3.0) large-varied-path 0.0 10.0)][375.0 383.8260332333053 410.30413299914085]Create data to plot the three paths in the xz plane along with their actions.
(define path-points-2
(hash-map "path-along-x" (make-path-txyz path-along-x 0 10 8)
"small-varied-path" (make-path-txyz small-varied-path 0 10 24)
"large-varied-path" (make-path-txyz large-varied-path 0 10 32)))#'mentat-collective.emmy.sicm-ch01/path-points-2Plot the three paths.
(kind/vega-lite
(points-xz->plot path-points-2))Finding trajectories that minimize the action
The SICM library provides a procedure that constructs a one dimensional path (along, say, the z axis) using an interpolation polynomial: (make-path t0 q0 t1 q1 qs), where q0 and q1 are the endpoints, t0 and t1 are the corresponding times, and qs is a list of intermediate points. I give an example (note that the result, initial-path, is itself a function):
(define pi-half (* 0.5 Math/PI))#'mentat-collective.emmy.sicm-ch01/pi-half(define initial-qs [0.1 0.2 0.2])#'mentat-collective.emmy.sicm-ch01/initial-qs(define initial-path (lg/make-path 0 1.0 pi-half 0.0 initial-qs))#'mentat-collective.emmy.sicm-ch01/initial-pathConstruct a parametric action that is just the action computed along that parametric path. Find approximate solution paths of a free particle and the harmonic oszillator respectively (hint: use the SICM procedure multidimensional-minimize).
(define ((parametric-path-actn Lagrangian t0 q0 t1 q1) qs)
(let ((path (lg/make-path t0 q0 t1 q1 qs)))
(Lagrangian-action Lagrangian path t0 t1)))#'mentat-collective.emmy.sicm-ch01/parametric-path-actn(define (fnd-path Lagrangian t0 q0 t1 q1 initial-qs)
(let ((minimizing-qs
(mn/multidimensional-minimize
(parametric-path-actn Lagrangian t0 q0 t1 q1)
initial-qs)))
(lg/make-path t0 q0 t1 q1 minimizing-qs)))#'mentat-collective.emmy.sicm-ch01/fnd-path(define free-path
(fnd-path (L-free-particle 3.0) 0.0 1.0 pi-half 0.0 initial-qs))#'mentat-collective.emmy.sicm-ch01/free-path(define ((L-harmonic m k) local)
(let ((q (coordinate local))
(v (velocity local)))
(- (* 1/2 m (square v))
(* 1/2 k (square q)))))#'mentat-collective.emmy.sicm-ch01/L-harmonic(define harmonic-path
(fnd-path (L-harmonic 1.0 1.0) 0.0 1.0 pi-half 0.0 initial-qs))#'mentat-collective.emmy.sicm-ch01/harmonic-pathMake a plot of these one dimensional paths, this time not in the x-z plane but in the t-z plane. This shows that, upon optimization, the initial-path turns into a streight line and a sinusoidal curve respectively.
(define (make-path-tz fn_t t0 t1 nofsteps)
(map (lambda (t) (up t 0 0 (fn_t t)))
(linear-interpolants-a t0 t1 nofsteps)))#'mentat-collective.emmy.sicm-ch01/make-path-tz(define plot-3
(let ((i (make-path-tz initial-path 0 pi-half 50))
(f (make-path-tz free-path 0 pi-half 50))
(h (make-path-tz harmonic-path 0 pi-half 50)))
(hash-map "orange" i "blue" f "red" h)))#'mentat-collective.emmy.sicm-ch01/plot-3(kind/vega-lite
(points-tz->plot plot-3))Show that your numerically attained harmonic-path approximates the well known analytic solution.
(kind/vega-lite
(points-tz->plot
(hash-map "diff"
(make-path-tz (lambda (t) (- (cos t) (harmonic-path t)))
0 pi-half 35))))Calculate the Lagrange equation of the harmonic oszillator.
(tex (((Lagrange-equations (L-harmonic 'm 'k)) (literal-function 'q)) 't))\[k\,q\left(t\right) + m\,{D}^{2}q\left(t\right)\]
1.5 The Euler-Lagrange Equations
1.5.2 Computing Lagrange’s Equations
The free particle
State the dynamic equation of motion (i.e. the Lagrange equation a.k.a Newton’s second law) of the free particle.
(tex (((Lagrange-equations (L-free-particle 'm)) (literal-function 'q)) 't))\[m\,{D}^{2}q\left(t\right)\]
Check that an arbitrary straight-line path satisfies this equation, i.e. that inserting a straight line for q(t) gives identically zero (strictly speaking the zero covector of three dimensions).
(do
(define (straight-line t)
(up (+ (* 'a t) 'a0)
(+ (* 'b t) 'b0)
(+ (* 'c t) 'c0)))
(tex (((Lagrange-equations (L-free-particle 'm)) straight-line) 't)))\[\begin{bmatrix}\displaystyle{0}&\displaystyle{0}&\displaystyle{0}\end{bmatrix}\]
The harmonic oscillator
State the dynamic equation of motion for the harmonic oszillator with arbitrary mass and spring constant.
(tex (((Lagrange-equations (L-harmonic 'm 'k)) (literal-function 'q)) 't))\[k\,q\left(t\right) + m\,{D}^{2}q\left(t\right)\]
Plug in a sinusoid with arbitrary amplitude \(A\), frequency \(\omega\) and phase \(\phi\) and show that the only solutions allowed are ones where \(\omega = \sqrt{k/m}\)
(do
(define (proposed-solution t)
(* 'A (cos (+ (* 'omega t) 'φ))))
(tex (((Lagrange-equations (L-harmonic 'm 'k)) proposed-solution) 't)))\[- A\,m\,{\omega}^{2}\,\cos\left(\omega\,t + \phi\right) + A\,k\,\cos\left(\omega\,t + \phi\right)\]
Exercise 1.11: Kepler’s third law
Show that a planet in circular orbit satisfies Kepler’s third law \(n^2a^3=G(M_1+m_2)\), where \(n\) is the angular frequency of the orbit and \(a\) is the distance between sun and planet. (Hint: use the reduced mass to construct the Lagrangian)
(define ((gravitational-energy G M_1 m_2) r)
(- (/ (* G M_1 m_2) r)))#'mentat-collective.emmy.sicm-ch01/gravitational-energy(define (circle t)
(up 'a (* 'n t)))#'mentat-collective.emmy.sicm-ch01/circle(tex
(((Lagrange-equations
(lg/L-central-polar
(/ (* 'M_1 'm_2) (+ 'M_1 'm_2))
(gravitational-energy 'G 'M_1 'm_2))) circle) 't))\[\begin{bmatrix}\displaystyle{\frac{- M_1\,{a}^{3}\,m_2\,{n}^{2} + G\,{M_1}^{2}\,m_2 + G\,M_1\,{m_2}^{2}}{M_1\,{a}^{2} + {a}^{2}\,m_2}}&\displaystyle{0}\end{bmatrix}\]
1.6 How to find Lagrangians
Central force field
State the dynamic equation of motion for the uniform acceleration and the central potential, the latter in rectangular as well as in polar coordinates.
(tex (up
(((Lagrange-equations
(lg/L-uniform-acceleration 'm 'g))
(up (literal-function 'x)
(literal-function 'y)))
't)
(((Lagrange-equations
(lg/L-central-rectangular 'm (literal-function 'U)))
(up (literal-function 'x)
(literal-function 'y)))
't)
(((Lagrange-equations
(lg/L-central-polar 'm (literal-function 'U)))
(up (literal-function 'r)
(literal-function 'phi)))
't)))\[\begin{pmatrix}\displaystyle{\begin{bmatrix}\displaystyle{m\,{D}^{2}x\left(t\right)}&\displaystyle{g\,m + m\,{D}^{2}y\left(t\right)}\end{bmatrix}} \cr \cr \displaystyle{\begin{bmatrix}\displaystyle{\frac{m\,{D}^{2}x\left(t\right)\,\sqrt {{\left(x\left(t\right)\right)}^{2} + {\left(y\left(t\right)\right)}^{2}} + x\left(t\right)\,DU\left(\sqrt {{\left(x\left(t\right)\right)}^{2} + {\left(y\left(t\right)\right)}^{2}}\right)}{\sqrt {{\left(x\left(t\right)\right)}^{2} + {\left(y\left(t\right)\right)}^{2}}}}&\displaystyle{\frac{m\,{D}^{2}y\left(t\right)\,\sqrt {{\left(x\left(t\right)\right)}^{2} + {\left(y\left(t\right)\right)}^{2}} + y\left(t\right)\,DU\left(\sqrt {{\left(x\left(t\right)\right)}^{2} + {\left(y\left(t\right)\right)}^{2}}\right)}{\sqrt {{\left(x\left(t\right)\right)}^{2} + {\left(y\left(t\right)\right)}^{2}}}}\end{bmatrix}} \cr \cr \displaystyle{\begin{bmatrix}\displaystyle{- m\,r\left(t\right)\,{\left(D\phi\left(t\right)\right)}^{2} + m\,{D}^{2}r\left(t\right) + DU\left(r\left(t\right)\right)}&\displaystyle{m\,{\left(r\left(t\right)\right)}^{2}\,{D}^{2}\phi\left(t\right) + 2\,m\,r\left(t\right)\,D\phi\left(t\right)\,Dr\left(t\right)}\end{bmatrix}}\end{pmatrix}\]
1.6.1 Coordinate transformations
Calculate the \([\dot x \space \dot y]\) velocity vector in polar coordinates.
(tex (velocity ((F->C p->r) (->local 't (up 'r 'φ) (up 'rdot 'φdot)))))\[\begin{pmatrix}\displaystyle{- r\,\dot {\phi}\,\sin\left(\phi\right) + \dot r\,\cos\left(\phi\right)} \cr \cr \displaystyle{r\,\dot {\phi}\,\cos\left(\phi\right) + \dot r\,\sin\left(\phi\right)}\end{pmatrix}\]
Calculate the lagrangian in polar coordinates twice. Once directly and once via the lagrangian in rectangular coordinates.
(define (L-alternate-central-polar m U)
(compose (lg/L-central-rectangular m U) (F->C p->r)))#'mentat-collective.emmy.sicm-ch01/L-alternate-central-polar(tex
(up ((lg/L-central-polar 'm (literal-function 'U))
(->local 't (up 'r 'φ) (up 'rdot 'φdot)))
((L-alternate-central-polar 'm (literal-function 'U))
(->local 't (up 'r 'φ) (up 'rdot 'φdot)))))2025-12-11T18:54:30.623Z runnervm6qbrg WARN [emmy.util.logic:22] - Assuming (= (sqrt (expt r 2)) (expt r 1)) in simsqrt1
\[\begin{pmatrix}\displaystyle{\frac{1}{2}\,m\,{r}^{2}\,{\dot {\phi}}^{2} + \frac{1}{2}\,m\,{\dot r}^{2} - U\left(r\right)} \cr \cr \displaystyle{\frac{1}{2}\,m\,{r}^{2}\,{\dot {\phi}}^{2} + \frac{1}{2}\,m\,{\dot r}^{2} - U\left(r\right)}\end{pmatrix}\]
Coriolis and centrifugal forces
State, in cartesian coordinates, the Lagrangian for the two dimensional free particle in a rotating coordinate system.
(define L-free-rectangular L-free-particle)#'mentat-collective.emmy.sicm-ch01/L-free-rectangular(define (L-free-polar m)
(compose (L-free-rectangular m) (F->C p->r)))#'mentat-collective.emmy.sicm-ch01/L-free-polar(define ((F Omega) local)
(let ((t (time local))
(r (ref (coordinates local) 0))
(theta (ref (coordinates local) 1)))
(up r (+ theta (* Omega t)))))#'mentat-collective.emmy.sicm-ch01/F(define (L-rotating-polar m Omega)
(compose (L-free-polar m) (F->C (F Omega))))#'mentat-collective.emmy.sicm-ch01/L-rotating-polar(define (r->p local)
(let ((rect-tuple (coordinate local)))
(let ((x (ref rect-tuple 0))
(y (ref rect-tuple 1)))
(let ((r (sqrt (square rect-tuple)))
(phi (atan (/ y x))))
(up r phi)))))#'mentat-collective.emmy.sicm-ch01/r->p(define (L-rotating-rectangular m Omega)
(compose (L-rotating-polar m Omega) (F->C r->p)))#'mentat-collective.emmy.sicm-ch01/L-rotating-rectangular(tex ((L-rotating-rectangular 'm 'Omega)
(up 't (up 'x_r 'y_r) (up 'xdot_r 'ydot_r))))\[\frac{1}{2}\,{\Omega}^{2}\,m\,{x_r}^{2} + \frac{1}{2}\,{\Omega}^{2}\,m\,{y_r}^{2} + \Omega\,m\,x_r\,{\dot y}_r - \Omega\,m\,{\dot x}_r\,y_r + \frac{1}{2}\,m\,{{\dot x}_r}^{2} + \frac{1}{2}\,m\,{{\dot y}_r}^{2}\]
speed up the calculation using a Clojure macro
(defmacro Lrrsm []
(list 'fn ['m 'Omega]
(list 'fn [['t ['x_r 'y_r] ['xdot_r 'ydot_r]]]
(clojure.edn/read-string
(prn-str
(simplify ((L-rotating-rectangular 'm 'Omega)
(up 't (up 'x_r 'y_r) (up 'xdot_r 'ydot_r)))))))))(define L-rotating-rectangular-simp (Lrrsm))#'mentat-collective.emmy.sicm-ch01/L-rotating-rectangular-simp(tex ((L-rotating-rectangular-simp 'm 'Omega)
(up 't (up 'x_r 'y_r) (up 'xdot_r 'ydot_r))))\[\frac{1}{2}\,{\Omega}^{2}\,m\,{x_r}^{2} + \frac{1}{2}\,{\Omega}^{2}\,m\,{y_r}^{2} + \Omega\,m\,x_r\,{\dot y}_r - \Omega\,m\,{\dot x}_r\,y_r + \frac{1}{2}\,m\,{{\dot x}_r}^{2} + \frac{1}{2}\,m\,{{\dot y}_r}^{2}\]
Derive the equations of motion, in which the centrifugal and the coriolis force appear.
(tex
(((Lagrange-equations (L-rotating-rectangular 'm 'Omega))
(up (literal-function 'x_r) (literal-function 'y_r)))
't))2025-12-11T18:54:32.468Z runnervm6qbrg WARN [emmy.polynomial.gcd:108] - Timed out: euclid inner loop after 1.005878527 s
2025-12-11T18:54:32.471Z runnervm6qbrg WARN [emmy.simplify:22] - simplifier timed out: must have been a complicated expression
2025-12-11T18:54:34.492Z runnervm6qbrg WARN [emmy.polynomial.gcd:108] - Timed out: euclid inner loop after 1.010407933 s
2025-12-11T18:54:34.493Z runnervm6qbrg WARN [emmy.simplify:22] - simplifier timed out: must have been a complicated expression
\[\begin{bmatrix}\displaystyle{- {\Omega}^{2}\,m\,x_r\left(t\right) - 2\,\Omega\,m\,Dy_r\left(t\right) + m\,{D}^{2}x_r\left(t\right)}&\displaystyle{- {\Omega}^{2}\,m\,y_r\left(t\right) + 2\,\Omega\,m\,Dx_r\left(t\right) + m\,{D}^{2}y_r\left(t\right)}\end{bmatrix}\]
speed up the calculation
(tex
(((Lagrange-equations (L-rotating-rectangular-simp 'm 'Omega))
(up (literal-function 'x_r) (literal-function 'y_r)))
't))\[\begin{bmatrix}\displaystyle{- {\Omega}^{2}\,m\,x_r\left(t\right) - 2\,\Omega\,m\,Dy_r\left(t\right) + m\,{D}^{2}x_r\left(t\right)}&\displaystyle{- {\Omega}^{2}\,m\,y_r\left(t\right) + 2\,\Omega\,m\,Dx_r\left(t\right) + m\,{D}^{2}y_r\left(t\right)}\end{bmatrix}\]
Plot a clockwise rotating path. (Hints: (1) Use the SICM function “Gamma” to create the triple \((t \: (x \: y) \: (\dot{x} \: \dot{y}))\) which can be transformed, (2) the angular frequency must be negative)
(define (test-path-2d t)
(up
(+ (* 3 t) 7)
(+ (* 5 t) 11)))#'mentat-collective.emmy.sicm-ch01/test-path-2dagain: use Clojure macro as a speed up method
(defmacro rpm []
(list 'fn ['Omega 't]
(clojure.edn/read-string
(prn-str
(simplify
((F->C p->r)
((F->C (F 'Omega))
((F->C r->p)
((Gamma test-path-2d) 't)))))))))(define rotate-path (rpm))#'mentat-collective.emmy.sicm-ch01/rotate-path(define (rotating-path-2d Omega)
(up (lambda (t) (ref (rotate-path Omega t) 1 0))
(lambda (t) (ref (rotate-path Omega t) 1 1))))#'mentat-collective.emmy.sicm-ch01/rotating-path-2d(do
(define NegativeOm -3)
(kind/vega-lite
(points-xy->plot
(hash-map "rotating-path-2d"
(make-path-txyz (rotating-path-2d NegativeOm) 0 3 25)))))Show that this path indeed satiesfies the equations of motion in a rotating coordinate system.
(do
(define Om 'Omega)
(define MinusOm (* -1 Om))
(simplify
(((Lagrange-equations (L-rotating-rectangular-simp 'm Om))
(rotating-path-2d MinusOm))
't)))(down 0 0)1.6.2 Systems with rigid constraints
A pendulum driven at the pivot
State Lagrange’s equation for this system.
(define ((T-pend m l g ys) local)
(let ((t (time local))
(theta (coordinate local))
(thetadot (velocity local)))
(let ((vys (D ys)))
(* 1/2 m
(+ (square (* l thetadot))
(square (vys t))
(* 2 l (vys t) thetadot (sin theta)))))))#'mentat-collective.emmy.sicm-ch01/T-pend(define ((V-pend m l g ys) local)
(let ((t (time local))
(theta (coordinate local)))
(* m g (- (ys t) (* l (cos theta))))))#'mentat-collective.emmy.sicm-ch01/V-pend(define L-pend (- T-pend V-pend))#'mentat-collective.emmy.sicm-ch01/L-pend(define θ (literal-function 'θ))#'mentat-collective.emmy.sicm-ch01/θ(define y_s (literal-function 'y_s))#'mentat-collective.emmy.sicm-ch01/y_s(tex
(((Lagrange-equations (L-pend 'm 'l 'g y_s)) θ) 't))\[g\,l\,m\,\sin\left(\theta\left(t\right)\right) + {l}^{2}\,m\,{D}^{2}\theta\left(t\right) + l\,m\,\sin\left(\theta\left(t\right)\right)\,{D}^{2}y_s\left(t\right)\]
State the Lagrangian
(tex
((L-pend 'm 'l 'g y_s) (->local 't 'θ 'θdot)))\[\frac{1}{2}\,{l}^{2}\,m\,{\dot {\theta}}^{2} + l\,m\,\dot {\theta}\,Dy_s\left(t\right)\,\sin\left(\theta\right) + g\,l\,m\,\cos\left(\theta\right) - g\,m\,y_s\left(t\right) + \frac{1}{2}\,m\,{\left(Dy_s\left(t\right)\right)}^{2}\]
1.6.3 Constraints as Coordinate Transformations
Derive the previous result by using coordinate transformations.
(define ((L-uniform-acceleration m g) local)
(let ((q (coordinate local))
(v (velocity local)))
(let ((y (ref q 1)))
(- (* 1/2 m (square v)) (* m g y)))))#'mentat-collective.emmy.sicm-ch01/L-uniform-acceleration(define ((dp-coordinates l y_s) local)
(let ((t (time local))
(theta (coordinate local)))
(let ((x (* l (sin theta)))
(y (- (y_s t) (* l (cos theta)))))
(up x y))))#'mentat-collective.emmy.sicm-ch01/dp-coordinates(define (L-pend2 m l g y_s)
(comp (L-uniform-acceleration m g)
(F->C (dp-coordinates l y_s))))#'mentat-collective.emmy.sicm-ch01/L-pend2(tex
((L-pend2 'm 'l 'g y_s) (->local 't 'θ 'θdot)))\[\frac{1}{2}\,{l}^{2}\,m\,{\dot {\theta}}^{2} + l\,m\,\dot {\theta}\,Dy_s\left(t\right)\,\sin\left(\theta\right) + g\,l\,m\,\cos\left(\theta\right) - g\,m\,y_s\left(t\right) + \frac{1}{2}\,m\,{\left(Dy_s\left(t\right)\right)}^{2}\]
1.8.3 Central Forces in Three Dimensions
Calculate the z-component of the angular momentum of an arbitrary path in rectangular and spherical coordinates.
(define rectangular-state (up 't
(up 'x 'y 'z)
(up 'xdot 'ydot 'zdot)))#'mentat-collective.emmy.sicm-ch01/rectangular-state(define spherical-state (up 't
(up 'r 'θ 'φ)
(up 'rdot 'θdot 'φdot)))#'mentat-collective.emmy.sicm-ch01/spherical-state(define ((ang-mom-z m) local)
(let ((xyz (coordinates local))
(v (velocities local)))
(ref (cross-product xyz (* m v)) 2)))#'mentat-collective.emmy.sicm-ch01/ang-mom-z(tex
(up
((ang-mom-z 'm) rectangular-state)
((compose (ang-mom-z 'm) (F->C s->r)) spherical-state)))\[\begin{pmatrix}\displaystyle{m\,x\,\dot y - m\,\dot x\,y} \cr \cr \displaystyle{m\,{r}^{2}\,\dot {\phi}\,{\sin}^{2}\left(\theta\right)}\end{pmatrix}\]
Using spherical coordinates, calculate the generalized forces and the generalized momenta of a planet moving in a central potential. Thus show that the momentum conjugate to the third coordinate \(\phi\) is (1) conserved (because the respective force is zero) and (2) identical the z-component of the angular momentum.
(define V (literal-function 'V))#'mentat-collective.emmy.sicm-ch01/V(define (T3-spherical m)
(compose (L-free-rectangular m) (F->C s->r)))#'mentat-collective.emmy.sicm-ch01/T3-spherical(define (L3-central m Vr)
(let ((Vs (lambda (state)
(let ((r (ref (coordinate state) 0)))
(Vr r)))))
(- (T3-spherical m) Vs)))#'mentat-collective.emmy.sicm-ch01/L3-central(tex
(up
(((partial 1) (L3-central 'm V)) spherical-state)
(((partial 2) (L3-central 'm V)) spherical-state)))\[\begin{pmatrix}\displaystyle{\begin{bmatrix}\displaystyle{m\,r\,{\dot {\phi}}^{2}\,{\sin}^{2}\left(\theta\right) + m\,r\,{\dot {\theta}}^{2} - DV\left(r\right)}&\displaystyle{m\,{r}^{2}\,{\dot {\phi}}^{2}\,\sin\left(\theta\right)\,\cos\left(\theta\right)}&\displaystyle{0}\end{bmatrix}} \cr \cr \displaystyle{\begin{bmatrix}\displaystyle{m\,\dot r}&\displaystyle{m\,{r}^{2}\,\dot {\theta}}&\displaystyle{m\,{r}^{2}\,\dot {\phi}\,{\sin}^{2}\left(\theta\right)}\end{bmatrix}}\end{pmatrix}\]
Show that the energy state function computed from the Lagrangian for a central field is in fact T + V.
(tex
(up
((T3-spherical 'm) (->local 't (up 'r 'θ 'φ) (up 'rdot 'θdot 'φdot)))
((Lagrangian->energy (L3-central 'm V)) spherical-state)))\[\begin{pmatrix}\displaystyle{\frac{1}{2}\,m\,{r}^{2}\,{\dot {\phi}}^{2}\,{\sin}^{2}\left(\theta\right) + \frac{1}{2}\,m\,{r}^{2}\,{\dot {\theta}}^{2} + \frac{1}{2}\,m\,{\dot r}^{2}} \cr \cr \displaystyle{\frac{1}{2}\,m\,{r}^{2}\,{\dot {\phi}}^{2}\,{\sin}^{2}\left(\theta\right) + \frac{1}{2}\,m\,{r}^{2}\,{\dot {\theta}}^{2} + \frac{1}{2}\,m\,{\dot r}^{2} + V\left(r\right)}\end{pmatrix}\]
(repl/scittle-sidebar)