\( \DeclareMathOperator{\abs}{abs} \newcommand{\ensuremath}[1]{\mbox{$#1$}} \)
Geodesics on a Sphere: An Exploration with Maxima/wxMaxima
1 The parametric sphere and intrinsic properties thereof
| (%i3) |
kill(all)$ load(vect)$ load(draw)$ set_draw_defaults(head_angle=10, head_length=0.02, line_width=2, proportional_axes=xyz, nticks=200, xyplane=0, surface_hide=true, point_size=3, point_type=filled_circle, point_size=1)$ |
In this case of the sphere, the parameter \(u\) is colatitude (θ), \( [0, π] \), and \(v\) is longitude (φ), \( [0, 2π] \).
| (%i10) |
f: [sin(u)*cos(v), sin(u)*sin(v), cos(u)]; fu:diff(f,u); fv:diff(f,v); fuu:diff(fu,u); fuv:diff(fu,v); fvu:diff(fv,u); fvv:diff(fv,v); |
\[ \mathbf{f} = \left[ \sin{(u)} \cos{(v)}\mathop{,}\sin{(u)} \sin{(v)}\mathop{,}\cos{(u)}\right] \]
\[ \mathbf{fu} = \left[ \cos{(u)} \cos{(v)}\mathop{,}\cos{(u)} \sin{(v)}\mathop{,}\mathop{-}\sin{(u)}\right] \]
\[ \mathbf{fv} = \left[ \mathop{-}\left( \sin{(u)} \sin{(v)}\right) \mathop{,}\sin{(u)} \cos{(v)}\mathop{,}0\right] \]
\[ \mathbf{fuu} = \left[ \mathop{-}\left( \sin{(u)} \cos{(v)}\right) \mathop{,}\mathop{-}\left( \sin{(u)} \sin{(v)}\right) \mathop{,}\mathop{-}\cos{(u)}\right] \]
\[ \mathbf{fuv} = \left[ \mathop{-}\left( \cos{(u)} \sin{(v)}\right) \mathop{,}\cos{(u)} \cos{(v)}\mathop{,}0\right] \]
\[ \mathbf{fvu} = \left[ \mathop{-}\left( \cos{(u)} \sin{(v)}\right) \mathop{,}\cos{(u)} \cos{(v)}\mathop{,}0\right] \]
\[ \mathbf{fvv} = \left[ \mathop{-}\left( \sin{(u)} \cos{(v)}\right) \mathop{,}\mathop{-}\left( \sin{(u)} \sin{(v)}\right) \mathop{,}0\right] \]
| (%i15) |
E:trigsimp(fu.fu)$ F:trigsimp(fu.fv)$ G:trigsimp(fv.fv)$ g:trigsimp(matrix([fu.fu, fu.fv],[fv.fu, fv.fv])); ginv:trigsimp(invert(g)); |
\[ \mathbf{g} = \begin{bmatrix}1 & 0\\ 0 & {{\sin{(u)}}^{2}}\end{bmatrix}\]
\[ \mathbf{ginv} = \begin{bmatrix}1 & 0\\ 0 & \frac{1}{{{\sin{(u)}}^{2}}}\end{bmatrix}\]
| (%i16) | trigsimp(g.ginv); |
\[ \begin{bmatrix}1 & 0\\ 0 & 1\end{bmatrix}\]
| (%i18) |
tmp:trigsimp(express(fu~fv))$ n:trigsimp(tmp/sqrt(tmp.tmp)); |
\[ \mathbf{n} = \left[ \left| \sin{(u)}\right| \cos{(v)}\mathop{,}\left| \sin{(u)}\right| \sin{(v)}\mathop{,}\frac{\cos{(u)} \sin{(u)}}{\left| \sin{(u)}\right| }\right] \]
| (%i20) |
load(ctensor)$ init_ctensor()$ |
| (%i24) |
dim:2$ ct_coords:[u,v]$ lg:g$ ug:ginv$ |
| (%i25) | christof(mcs)$ |
| (%i34) |
Γ111:mcs[1,1,1]; Γ112:mcs[1,2,1]; Γ121:mcs[2,1,1]; Γ122:mcs[2,2,1]; Γ211:mcs[1,1,2]; Γ212:mcs[1,2,2]; Γ221:mcs[2,1,2]; Γ222:mcs[2,2,2]; |
\[ \Gamma^{1}_{11} = 0\]
\[ \Gamma^{1}_{12} = 0\]
\[ \Gamma^{1}_{21} = 0\]
\[ \Gamma^{1}_{22} = \mathop{-}\left( \cos{(u)} \sin{(u)}\right) \]
\[ \Gamma^{2}_{11} = 0\]
\[ \Gamma^{2}_{12} = \frac{\cos{(u)}}{\sin{(u)}}\]
\[ \Gamma^{2}_{21} = \frac{\cos{(u)}}{\sin{(u)}}\]
\[ \Gamma^{2}_{22} = 0\]
2 The general geodesics of the sphere
The parametric equations are as follows:
\[ u = \arccos(\sqrt{(1-m^2)} \cdot \sin(t/R)) \]
\[ v = \arctan(m \cdot \tan(t/R)) + v0 \]
In this example, we let \( m = -1/2 \), \( v0 = 0 \), and \( R = 1 \). The curve is evaluated on the surface by substituting the parametric forms of \( u \) and \( v \) into the surface equation \( \mathbf{f} \).
Also, to simplify the equations a bit, we limit \( t \in [-\pi/2, \pi/2] \) which puts a nice constraint on \( \cos(t) \).
| (%i38) |
/* We will limit t in our plots to [-π/2, π/2] to simplify the equations */ assume(cos(t)>=0)$ m:-1/2$ c:trigsimp(ev(f, u=acos(sqrt(1-m^2)*sin(t)), v=atan(m*tan(t)))); ct:trigsimp(diff(c,t)); |
\[ c = \left[ \cos{(t)}\mathop{,}\mathop{-}\left( \frac{\sin{(t)}}{2}\right) \mathop{,}\frac{\sqrt{3} \sin{(t)}}{2}\right] \]
\[ ct = \left[ \mathop{-}\sin{(t)}\mathop{,}\mathop{-}\left( \frac{\cos{(t)}}{2}\right) \mathop{,}\frac{\sqrt{3} \cos{(t)}}{2}\right] \]

Click Image for Narrated Video
Link for StageTools Script
| (%i40) | trigreduce(trigsimp(sqrt(ct.ct))); |
\[ 1 \]
| (%i41) | nt:trigsimp(ev(n, u=acos(sqrt(1-m^2)*sin(t)), v=atan(m*tan(t)))); |
\[ \mathbf{nt} = \left[ \cos{(t)}\mathop{,}\mathop{-}\left( \frac{\sin{(t)}}{2}\right) \mathop{,}\frac{\sqrt{3} \sin{(t)}}{2}\right] \]
| (%i42) | trigsimp(nt.nt); |
\[ 1 \]
2.1 The local basis vectors, fu and fv, are now expressed in terms of the geodesic curve parameter t:
| (%i44) |
fut:trigsimp(ev(fu, u=acos(sqrt(1-m^2)*sin(t)), v=atan(m*tan(t)))); fvt:trigsimp(ev(fv, u=acos(sqrt(1-m^2)*sin(t)), v=atan(m*tan(t)))); |
\[ \mathbf{fut} = \left[ \frac{\sqrt{3} \cos{(t)} \sin{(t)}}{\sqrt{3 {{\cos{(t)}}^{2}}\mathop{+}1}}\mathop{,}\mathop{-}\left( \frac{\sqrt{3} {{\sin{(t)}}^{2}}}{2 \sqrt{3 {{\cos{(t)}}^{2}}\mathop{+}1}}\right) \mathop{,}\mathop{-}\left( \frac{\sqrt{3 {{\cos{(t)}}^{2}}\mathop{+}1}}{2}\right) \right] \]
\[ \mathbf{fvt} = \left[ \frac{\sin{(t)}}{2}\mathop{,}\cos{(t)}\mathop{,}0\right] \]

Click Image for Narrated Video
Link for StageTools Script
2.2 Express the tangent to the geodesic curve in terms of the above basis vectors
i.e. \( ct = a \cdot fut + b \cdot fvt \)
The derivatives of the coeffients, \( a, b \), are also determined for later use.
| (%i49) |
a:trigsimp((ct.fut)/(fut.fut)); b:trigsimp((ct.fvt)/(fvt.fvt)); at:trigsimp(diff(a,t)); bt:trigsimp(diff(b,t)); |
\[ a = \mathop{-}\left( \frac{\sqrt{3} \cos{(t)}}{\sqrt{3 {{\cos{(t)}}^{2}}\mathop{+}1}}\right) \]
\[ b = \mathop{-}\left( \frac{2}{3 {{\cos{(t)}}^{2}}\mathop{+}1}\right) \]
\[ at = \frac{\sqrt{3} \sqrt{3 {{\cos{(t)}}^{2}}\mathop{+}1} \sin{(t)}}{9 {{\cos{(t)}}^{4}}\mathop{+}6 {{\cos{(t)}}^{2}}\mathop{+}1}\]
\[ bt = \mathop{-}\left( \frac{12 \cos{(t)} \sin{(t)}}{9 {{\cos{(t)}}^{4}}\mathop{+}6 {{\cos{(t)}}^{2}}\mathop{+}1}\right) \]
| (%i51) |
trigsimp(trigreduce(trigsimp((a*fut+b*fvt)))); ct; |
\[ \left[ \mathop{-}\sin{(t)}\mathop{,}\mathop{-}\left( \frac{\cos{(t)}}{2}\right) \mathop{,}\frac{\sqrt{3} \cos{(t)}}{2}\right] \]
\[ \left[ \mathop{-}\sin{(t)}\mathop{,}\mathop{-}\left( \frac{\cos{(t)}}{2}\right) \mathop{,}\frac{\sqrt{3} \cos{(t)}}{2}\right] \]
3 The Covariant Derivative of the Geodesic Tangent Vector and General Vectors
3.1 The covariant derivative of the geodesic tangent
First, we need to express the \( u,v \) curve parameters in terms of the geodesic curve parameter \( t \):
| (%i53) |
ut:trigsimp(diff(acos(sqrt(1-m^2)*sin(t)),t)); vt:trigsimp(diff(atan(m*tan(t)),t)); |
\[ ut = \mathop{-}\left( \frac{\sqrt{3} \cos{(t)}}{\sqrt{3 {{\cos{(t)}}^{2}}\mathop{+}1}}\right) \]
\[ vt = \mathop{-}\left( \frac{2}{3 {{\cos{(t)}}^{2}}\mathop{+}1}\right) \]
| (%i54) | tmp:(trigsimp((at+Γ111*a*ut + Γ112*a*vt + Γ121*b*ut + Γ122*b*vt)*fut + (bt+Γ211*a*ut + Γ212*a*vt + Γ221*b*ut + Γ222*b*vt)*fvt))$ |
| (%i55) | covd:trigsimp(ev(tmp, u=acos(sqrt(1-m^2)*sin(t)), v=atan(m*tan(t)))); |
\[ \mathbf{covd} = \left[ 0\mathop{,}0\mathop{,}0\right] \]
| (%i56) | dirdiv:trigsimp(diff(ct, t)); |
\[ \mathbf{dirdiv} = \left[ \mathop{-}\cos{(t)}\mathop{,}\frac{\sin{(t)}}{2}\mathop{,}\mathop{-}\left( \frac{\sqrt{3} \sin{(t)}}{2}\right) \right] \]
| (%i57) | covdn:trigsimp(dirdiv-(dirdiv.nt)*nt); |
\[ \mathbf{covdn} = \left[ 0\mathop{,}0\mathop{,}0\right] \]

Click Image for Narrated Video
Link for StageTools Script
3.2 The covariant derivative of a general vector along the geodesic curve
| (%i61) |
a:1; b:1; at:trigsimp(diff(a,t)); bt:trigsimp(diff(b,t)); |
\[ a = 1\]
\[ b = 1\]
\[ at = 0\]
\[ bt = 0\]
| (%i62) | V:trigsimp(a*fut+b*fvt); |
\[ \mathbf{V} = \left[ \frac{\sqrt{3 {{\cos{(t)}}^{2}}\mathop{+}1} \sin{(t)}\mathop{+}2 \sqrt{3} \cos{(t)} \sin{(t)}}{2 \sqrt{3 {{\cos{(t)}}^{2}}\mathop{+}1}}\mathop{,}\frac{2 \cos{(t)} \sqrt{3 {{\cos{(t)}}^{2}}\mathop{+}1}\mathop{-}\sqrt{3} {{\sin{(t)}}^{2}}}{2 \sqrt{3 {{\cos{(t)}}^{2}}\mathop{+}1}}\mathop{,}\mathop{-}\left( \frac{\sqrt{3 {{\cos{(t)}}^{2}}\mathop{+}1}}{2}\right) \right] \]
| (%i63) | tmp:(trigsimp((at+Γ111*a*ut + Γ112*a*vt + Γ121*b*ut + Γ122*b*vt)*fut + (bt+Γ211*a*ut + Γ212*a*vt + Γ221*b*ut + Γ222*b*vt)*fvt))$ |
| (%i64) | covd:trigsimp(ev(tmp, u=acos(sqrt(1-m^2)*sin(t)), v=atan(m*tan(t)))); |
\[ \mathbf{covd} = \left[ \frac{\sqrt{3} {{\cos{(t)}}^{2}}\mathop{-}\sqrt{3}}{{{\left( 3 {{\cos{(t)}}^{2}}\mathop{+}1\right) }^{\frac{3}{2}}}}\mathop{,}\mathop{-}\left( \frac{\sqrt{3 {{\cos{(t)}}^{2}}\mathop{+}1} \left( 9 {{\cos{(t)}}^{2}}\mathop{+}3\right) \sin{(t)}\mathop{+}8 \sqrt{3} \cos{(t)} \sin{(t)}}{\sqrt{3 {{\cos{(t)}}^{2}}\mathop{+}1} \left( 12 {{\cos{(t)}}^{2}}\mathop{+}4\right) }\right) \mathop{,}\mathop{-}\left( \frac{\sqrt{3} \sin{(t)}}{4}\right) \right] \]
We now plot the general vector, \( \mathbf{V} \) (in red), and it's covariant derivative (in black) at several points along the geodesic curve along with the basic vectors (in green). Be sure to view the narrated video for a complete description.

Click Image for Narrated Video
Link for StageTools Script
Is covd perpendicular to the unit normal?
| (%i66) | trigsimp(sqrt(covd.nt)); |
\[ 0\]
| (%i67) | trigsimp(sqrt(V.nt)); |
\[ 0\]
4 Final Comments
Fortunately, exact geodesic equations are possible for the sphere and this allows geodesic properties to be readily explored. For more complex surfaces, however, this will not necessarily be the case.
Created with
wxMaxima
Modified and embedded by L.A.P.
Differential geometry (DG) is a vast subject that cannot be expounded in this simple article. The reader is assumed to have a basic knowledge of DG as this article attempts only to demonstrate the use of Maxima/wxMaxima to eliminate the sheer drudgery of very complex DG computations. Also, graphical plots and narrated videos are given using Geomview/StageTools. These graphics are essential in conveying the underlying DG concepts. After all, geometry, differential or otherwise, has always been primarily visual.
A familiarity with the Maxima syntax is also assumed.
The goal, perhaps, of this article, and my other articles on DG, is to elevate one beyond the tedious mathematical formalism of DG and to provide a more visceral insight.
The actual Maxima/wxMaxima script for this article is located here. Please download to reproduce these results on your own machine.