Classroom Tips and Techniques: Geodesics on a Surface
Robert J. Lopez
Emeritus Professor of Mathematics and Maple Fellow
Maplesoft
Introduction
Recently, Samir Khan, one of Maplesoft's Application Engineers, posted a question from a user who asked how to obtain minimal-length curves on a surface. Samir provided an interesting numeric technique for finding what is essentially a geodesic connecting two points on a surface embedded in
. In this article, we implement a version of Samir's numeric approach, and also show how to obtain the differential equations governing such geodesics. We do this both with the calculus of variations (minimizing the arc length integral) and with tensor calculus techniques implemented in the DifferentialGeometry package.
Astute readers will recall that several months ago, we provided the article Tensor Calculus with the Differential Geometry Package where we found geodesics in the plane when the plane was referred to polar coordinates. In this month's article we find geodesics on a surface embedded in
.
Samir Khan's Numeric Approach
Execute entire worksheet: Click "!!!" icon in the toolbar
Execute stepwise: Click icon to the right (to initialize), then execute each command
|
|
The graph of the surface defined by the function in Table 1
|
Table 1 Function defining a surface in
|
appears in Figure 1.


|
Figure 1 Surface described by the function in Table 1
|
The curve of minimal length connecting the points
and
is approximated by a polygonal line, that is, by a linear spline, with
segments and
equispaced nodes. The
-coordinates of the initial and terminal nodes on this spline are given respectively by
and for the intermediate nodes we have
The
-coordinates at the initial and terminal points are respectively
The
nodes
are then
where the
, are unknown. The length of the approximating spline is given by
which is simply the sum of the lengths of each segment in the spline. This length is minimized with
where the negativity constraints on the
-coordinates are inspired by the values at the initial and terminal points. Hence, the computed nodes are
so the resulting spline can be graphed in Figure 2.

|
Figure 2 Approximate geodesic on the surface in Figure 1
|
Minimize the Arc Length Integral
Arc length is given by the integral
, where
is the parameter along the curve, and
. Since the radicand is necessarily nonzero, we can obtain a geodesic by minimizing the integral whose integrand is
This can be done by solving the Euler-Lagrange equations
which we can obtain in Maple via the computations in Table 2.
In addition to the Euler-Lagrange equations themselves, the EulerLagrange command from the VariationalCalculus package can provide first integrals in which the constants of integration are of the form
. We first removed these first integrals, and extracted the remaining two Euler-Lagrange differential equations, which we solve numerically in Table 3.

|
Table 3 Numeric solution of the Euler-Lagrange differential equations
|
In Figure 3 where we graph the solution of the Euler-Lagrange equations on the surface from Figure 1, we take the precaution of adding
to each
-coordinate along the curve so that it can be seen more clearly. The alternative would have been to make the surface sufficiently transparent that the curve, lying in the surface, would be visible.


|
Figure 3 Solution of the Euler-Lagrange equations superimposed on the surface from Figure 1
|
Geodesics via the Differential Geometry Packages
The GeodesicEquations command in the DifferentialGeometry package will generate the geodesic equations for the surface
embedded in
. The frame for this surface is established with
Now, the metric tensor (first fundamental form) for the surface must be obtained. To this end, we define the surface in radius-vector form via
then compute the tangent basis vectors
as per Table 4.
|
|
Table 4 Natural tangent basis vectors on the embedded surface
|
The components of the covariant metric tensor
are contained in the matrix
the tensor form of which is generated by
The Christoffel symbols of the second kind, namely,
, are obtained with
The individual Christoffel symbols can be extracted with the commands shown in Table 5. The expressions are all lengthy, and have been suppressed.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Table 5 The Christoffel symbols of the second kind
|
The geodesic equations
where
and
, are then generated with
and extracted with
Again, the (very lengthy) outputs have been suppressed. These two differential equations are then solved numerically as in Table 6, just as their counterparts were solved in Table 3.

|
Table 6 Numeric solution of geodesic equations generated by the GeodesicEquations command
|
Figure 4, a graph of the geodesic (raised slightly off the surface) and the surface
, is obtained just as Figure 3 was.


|
Figure 4 Numerically computed geodesic drawn on the surface
|
Legal Notice: ? Maplesoft, a division of Waterloo Maple Inc. 2009. Maplesoft and Maple are trademarks of Waterloo Maple Inc. This application may contain errors and Maplesoft is not liable for any damages resulting from the use of this material. This application is intended for non-commercial, non-profit use only. Contact Maplesoft for permission if you wish to use this application in for-profit activities.