Geodesics Using the Method of Christoffel Symbols

July 4, 2025

Project Overview

The objective of this project is to compute and visualize geodesic curves on various surfaces defined by their parametrizations, using Christoffel symbols. For each surface, we carry out the analytical derivation of the geodesic equations as a system of differential equations. We then apply numerical methods to solve these systems and plot the resulting geodesics. Finally, we compare the performance of the methods used and assess which one yields the most reliable results for each surface.

Description of the Mathematical Model

What Is a Geodesic?

A geodesic is the shortest path between two points on a surface or, more generally, in a curved space. In Euclidean geometry, geodesics are straight lines. On curved surfaces, however, they are curves that represent the locally ”straightest” possible paths — generalizations of straight lines in non-Euclidean spaces.

How Do We Find Geodesics?

Given a local parametrization f(u1,u2)\vec{f}(u_1, u_2) of a surface, we can derive a system of second-order differential equations that describe its geodesics by using Christoffel symbols.

 Γijk==12(2fuiujfu)gk,i,j,k=1,2\ \Gamma^k_{ij} = \sum_{\ell=1}^2 \left( \frac{\partial^2 \vec{f}}{\partial u_i \partial u_j} \cdot \frac{\partial \vec{f}}{\partial u_\ell} \right) g^{\ell k}, \quad i,j,k = 1,2

The metric tensor GG is given by:

 G(u1,u2)=[fu1fu1fu1fu2fu2fu1fu2fu2].\ G(u_1, u_2) = \begin{bmatrix} \frac{\partial \vec{f}}{\partial u_1} \cdot \frac{\partial \vec{f}}{\partial u_1} & \frac{\partial \vec{f}}{\partial u_1} \cdot \frac{\partial \vec{f}}{\partial u_2} \\ \frac{\partial \vec{f}}{\partial u_2} \cdot \frac{\partial \vec{f}}{\partial u_1} & \frac{\partial \vec{f}}{\partial u_2} \cdot \frac{\partial \vec{f}}{\partial u_2} \end{bmatrix}.

Once the Christoffel symbols have been computed, the geodesic equations take the form:

 d2ukdt2+i=12j=12Γijkduidtdujdt=0,k=1,2.\ \frac{d^2 u^k}{dt^2} + \sum_{i=1}^{2} \sum_{j=1}^{2} \Gamma^k_{ij} \frac{du^i}{dt} \frac{du^j}{dt} = 0, \quad k = 1, 2.

Two equations considered together represent a system of two second order differential equations whose solutions compute geodesics on a surface. So, this system of differential equations is a tool for explicitly obtaining formulas of geodesics on a surface. This system is frequently solved in everyday life, for example when determining the shortest flight route for an airplane.

Derivation of formulas

Geodesics of a Plane

We proceed to derive the geodesic equations for a plane parametrized by

f(u,v)=p+ua+vb,\vec{f}(u, v) = \vec{p} + u\vec{a} + v\vec{b},

where pR3\vec{p} \in \mathbb{R}^3 is a point and a,bR3\vec{a}, \vec{b} \in \mathbb{R}^3 are linearly independent vectors. The resulting geodesics should correspond to straight lines on the plane.

Step 1: Inverse of the metric tensor

We first compute the inverse of the metric tensor for the parametrized surface.

The partial derivatives of f\vec{f} with respect to the parameters are

fu=a,fv=b.\frac{\partial \vec{f}}{\partial u} = \vec{a}, \quad \frac{\partial \vec{f}}{\partial v} = \vec{b}.

The components of the first fundamental form (metric tensor) G(u,v)G(u, v) are given by the dot products of these partial derivatives:

G=[aaabbabb]=[a2ababb2].G = \begin{bmatrix} \vec{a} \cdot \vec{a} & \vec{a} \cdot \vec{b} \\ \vec{b} \cdot \vec{a} & \vec{b} \cdot \vec{b} \end{bmatrix} = \begin{bmatrix} \|\vec{a}\|^2 & \vec{a} \cdot \vec{b} \\ \vec{a} \cdot \vec{b} & \|\vec{b}\|^2 \end{bmatrix}.

Its inverse is computed by the standard formula for a 2×22 \times 2 matrix:

G1=1a2b2(ab)2[b2ababa2].G^{-1} = \frac{1}{\|\vec{a}\|^2 \|\vec{b}\|^2 - (\vec{a} \cdot \vec{b})^2} \begin{bmatrix} \|\vec{b}\|^2 & -\vec{a} \cdot \vec{b} \\ -\vec{a} \cdot \vec{b} & \|\vec{a}\|^2 \end{bmatrix}.

Step 2: Calculation of Christoffel symbols

Next, we compute the Christoffel symbols. Since all second derivatives of the parametrization f\vec{f} are zero, it follows that all Christoffel symbols Γijk\Gamma^k_{ij} vanish:

Γijk=0for all i,j,k.\Gamma^k_{ij} = 0 \quad \text{for all } i, j, k.

Substituting this into the system of differential equations that describe geodesic curves, we obtain:

d2udt2=0,d2vdt2=0.\frac{d^2 u}{dt^2} = 0, \quad \frac{d^2 v}{dt^2} = 0.

Integrating both equations once with respect to tt, we get:

dudt=c1,u,dvdt=c1,v,\frac{du}{dt} = c_{1,u}, \quad \frac{dv}{dt} = c_{1,v},

where c1,u,c1,vRc_{1,u}, c_{1,v} \in \mathbb{R} are constants of integration.

Integrating again, we obtain:

u(t)=c1,ut+c2,u,v(t)=c1,vt+c2,v,u(t) = c_{1,u} t + c_{2,u}, \quad v(t) = c_{1,v} t + c_{2,v},

where c2,u,c2,vRc_{2,u}, c_{2,v} \in \mathbb{R} are additional constants of integration.

Step 3: Parametrization of the geodesic curve on the surface

Finally, we use the results from step two and substitute them into the original parametrization of the surface. Recall that the surface is parametrized by

f(u,v)=p+ua+vb,\vec{f}(u, v) = \vec{p} + u \vec{a} + v \vec{b},

and from step two we have:

u(t)=c1,ut+c2,u,v(t)=c1,vt+c2,v.u(t) = c_{1,u} t + c_{2,u}, \quad v(t) = c_{1,v} t + c_{2,v}.

Substituting these into f(u,v)\vec{f}(u, v) gives:

f(u(t),v(t))=p+(c1,ut+c2,u)a+(c1,vt+c2,v)b.\vec{f}(u(t), v(t)) = \vec{p} + \left(c_{1,u} t + c_{2,u}\right)\vec{a} + \left(c_{1,v} t + c_{2,v}\right)\vec{b}.

Distributing terms:

f(u(t),v(t))=(p+c2,ua+c2,vb)+t(c1,ua+c1,vb).\vec{f}(u(t), v(t)) = \left(\vec{p} + c_{2,u} \vec{a} + c_{2,v} \vec{b} \right) + t \left(c_{1,u} \vec{a} + c_{1,v} \vec{b} \right).

Define:

r=p+c2,ua+c2,vb,s=c1,ua+c1,vb,\vec{r} = \vec{p} + c_{2,u} \vec{a} + c_{2,v} \vec{b}, \quad \vec{s} = c_{1,u} \vec{a} + c_{1,v} \vec{b},

so that the geodesic curve becomes

f(t)=r+ts.\vec{f}(t) = \vec{r} + t \vec{s}.

This is a straight line in R3\mathbb{R}^3, confirming that geodesics on a parametrized plane are straight lines.

Geodesics of a Sphere

We parametrize a sphere in R3\mathbb{R}^3 by the function

f(u,v)=[cos(v)sin(u)sin(v)sin(u)cos(u)],(1)\vec{f}(u,v) = \begin{bmatrix} \cos(v) \sin(u) \\ \sin(v) \sin(u) \\ \cos(u) \end{bmatrix}, \tag{1}

where u,vRu, v \in \mathbb{R}. Note that for a bijective correspondence, the parameters uu and vv must lie in the intervals

u[π2,π2],v[0,2π).u \in \left[-\frac{\pi}{2}, \frac{\pi}{2}\right], \quad v \in [0, 2\pi).

Step 1: Inverse of the metric tensor

We start by computing the first derivatives of f\vec{f} with respect to uu and vv, along with their dot products:

fu=(cosvcosu,  sinvcosu,  sinu),fv=(sinvsinu,  cosvsinu,  0).\frac{\partial \vec{f}}{\partial u} = \bigl(\cos v \cos u, \; \sin v \cos u, \; -\sin u \bigr), \quad \frac{\partial \vec{f}}{\partial v} = \bigl(-\sin v \sin u, \; \cos v \sin u, \; 0 \bigr).

Next, we calculate the dot products of these vectors:

fufu=cos2vcos2u+sin2vcos2u+sin2u=cos2u(cos2v+sin2v)+sin2u=cos2u+sin2u=1,\frac{\partial \vec{f}}{\partial u} \cdot \frac{\partial \vec{f}}{\partial u} = \cos^2 v \cos^2 u + \sin^2 v \cos^2 u + \sin^2 u = \cos^2 u ( \cos^2 v + \sin^2 v ) + \sin^2 u = \cos^2 u + \sin^2 u = 1, fufv=fvfu=cosvcosusinvsinu+sinvcosvcosusinu=0,\frac{\partial \vec{f}}{\partial u} \cdot \frac{\partial \vec{f}}{\partial v} = \frac{\partial \vec{f}}{\partial v} \cdot \frac{\partial \vec{f}}{\partial u} = -\cos v \cos u \sin v \sin u + \sin v \cos v \cos u \sin u = 0, fvfv=sin2vsin2u+cos2vsin2u+0=sin2u(sin2v+cos2v)=sin2u.\frac{\partial \vec{f}}{\partial v} \cdot \frac{\partial \vec{f}}{\partial v} = \sin^2 v \sin^2 u + \cos^2 v \sin^2 u + 0 = \sin^2 u (\sin^2 v + \cos^2 v) = \sin^2 u.

Therefore, the first fundamental form (metric tensor) matrix is

G(u,v)=[100sin2u],G(u,v) = \begin{bmatrix} 1 & 0 \\ 0 & \sin^2 u \end{bmatrix},

and its inverse is

G1(u,v)=[100sin2u].G^{-1}(u,v) = \begin{bmatrix} 1 & 0 \\ 0 & \sin^{-2} u \end{bmatrix}.

Step 2: Calculation of Christoffel symbols

We begin by computing the second partial derivatives of f(u,v)\vec{f}(u, v):

2fu2=(cosvsinu,  sinvsinu,  cosu),\frac{\partial^2 \vec{f}}{\partial u^2} = (-\cos v \sin u,\; -\sin v \sin u,\; -\cos u), 2fuv=2fvu=(sinvcosu,  cosvcosu,  0),\frac{\partial^2 \vec{f}}{\partial u \partial v} = \frac{\partial^2 \vec{f}}{\partial v \partial u} = (-\sin v \cos u,\; \cos v \cos u,\; 0), 2fv2=(cosvsinu,  sinvsinu,  0).\frac{\partial^2 \vec{f}}{\partial v^2} = (-\cos v \sin u,\; -\sin v \sin u,\; 0).

The inverse of the metric tensor from earlier is:

G1(u,v)=[100sin2u].G^{-1}(u,v) = \begin{bmatrix} 1 & 0 \\ 0 & \sin^{-2} u \end{bmatrix}.

Using the formula for Christoffel symbols of the first kind:

Γijk=l=12gkl(2fuiujful),\Gamma^k_{ij} = \sum_{l=1}^{2} g^{kl} \left( \frac{\partial^2 \vec{f}}{\partial u^i \partial u^j} \cdot \frac{\partial \vec{f}}{\partial u^l} \right),

we compute the non-zero symbols (all omitted terms below evaluate to zero due to orthogonality or simplification):

Γ111=(2fu2fu)g11+(2fu2fv)g21=0,\Gamma^1_{11} = \left( \frac{\partial^2 \vec{f}}{\partial u^2} \cdot \frac{\partial \vec{f}}{\partial u} \right) g^{11} + \left( \frac{\partial^2 \vec{f}}{\partial u^2} \cdot \frac{\partial \vec{f}}{\partial v} \right) g^{21} = 0, Γ121=Γ211=0,\Gamma^1_{12} = \Gamma^1_{21} = 0, Γ221=(2fv2fu)g11+(2fv2fv)g21=sinucosu,\Gamma^1_{22} = \left( \frac{\partial^2 \vec{f}}{\partial v^2} \cdot \frac{\partial \vec{f}}{\partial u} \right) g^{11} + \left( \frac{\partial^2 \vec{f}}{\partial v^2} \cdot \frac{\partial \vec{f}}{\partial v} \right) g^{21} = -\sin u \cos u, Γ112=0,\Gamma^2_{11} = 0, Γ122=Γ212=cotu,\Gamma^2_{12} = \Gamma^2_{21} = \cot u, Γ222=0.\Gamma^2_{22} = 0.

Step 3: Parametrization of the geodesic curve on the surface

Combining the results from the previous step, we arrive at the system of second-order differential equations that describe the geodesics on the sphere:

d2udt2+Γ221(dvdt)2=0,d2vdt2+Γ122dudtdvdt+Γ212dvdtdudt=0.\frac{d^2 u}{dt^2} + \Gamma^1_{22} \left( \frac{dv}{dt} \right)^2 = 0, \quad \frac{d^2 v}{dt^2} + \Gamma^2_{12} \frac{du}{dt} \frac{dv}{dt} + \Gamma^2_{21} \frac{dv}{dt} \frac{du}{dt} = 0.

Substituting the Christoffel symbols, we get:

d2udt2sinucosu(dvdt)2=0,\frac{d^2 u}{dt^2} - \sin u \cos u \left( \frac{dv}{dt} \right)^2 = 0, d2vdt2+2cotududtdvdt=0.\frac{d^2 v}{dt^2} + 2 \cot u \frac{du}{dt} \frac{dv}{dt} = 0.

Step 4: Conversion into a first-order system

The system of differential equations derived in step three is generally difficult to solve analytically. Therefore, we apply numerical methods to find solutions. To use standard numerical solvers, we first convert the second-order system into a system of first-order differential equations.

We define new variables:

y1=u,y2=dudt,y3=v,y4=dvdt.y_1 = u, \quad y_2 = \frac{du}{dt}, \quad y_3 = v, \quad y_4 = \frac{dv}{dt}.

This yields the following system of first-order differential equations:

dy1dt=y2,dy3dt=y4,dy2dt=siny1cosy1y42,dy4dt=2coty1y2y4.\begin{aligned} \frac{dy_1}{dt} &= y_2, \\ \frac{dy_3}{dt} &= y_4, \\ \frac{dy_2}{dt} &= \sin y_1 \cos y_1 \, y_4^2, \\ \frac{dy_4}{dt} &= -2 \cot y_1 \, y_2 y_4. \end{aligned}

Geodesics of a Torus

Parametrization of the Torus

We parametrize the torus using two angles uu and vv, with u[π2,π2]u \in \left[-\frac{\pi}{2}, \frac{\pi}{2}\right] and v[0,2π)v \in [0, 2\pi). The parametrization is given by:

f(u,v)=[X(u,v)Y(u,v)Z(u,v)]=[(R+rcosu)cosv(R+rcosu)sinvrsinu],\vec{f}(u, v) = \begin{bmatrix} X(u, v) \\ Y(u, v) \\ Z(u, v) \end{bmatrix} = \begin{bmatrix} (R + r \cos u) \cos v \\ (R + r \cos u) \sin v \\ r \sin u \end{bmatrix},

where RR is the major radius (distance from the center of the tube to the center of the torus), and rr is the minor radius (radius of the tube).

Step 1: Inverse of the metric tensor

We first compute the partial derivatives of the parametrization f(u,v)\vec{f}(u, v) with respect to uu and vv:

fu=[rsinucosvrsinusinvrcosu],fv=[(R+rcosu)sinv(R+rcosu)cosv0].\frac{\partial \vec{f}}{\partial u} = \begin{bmatrix} - r \sin u \cos v \\ - r \sin u \sin v \\ r \cos u \end{bmatrix}, \quad \frac{\partial \vec{f}}{\partial v} = \begin{bmatrix} - (R + r \cos u) \sin v \\ (R + r \cos u) \cos v \\ 0 \end{bmatrix}.

Now we compute the dot products:

fufu=r2,fufv=0,fvfv=(R+rcosu)2.\begin{aligned} \frac{\partial \vec{f}}{\partial u} \cdot \frac{\partial \vec{f}}{\partial u} &= r^2, \\ \frac{\partial \vec{f}}{\partial u} \cdot \frac{\partial \vec{f}}{\partial v} &= 0, \\ \frac{\partial \vec{f}}{\partial v} \cdot \frac{\partial \vec{f}}{\partial v} &= (R + r \cos u)^2. \end{aligned}

Therefore, the metric tensor is:

G(u,v)=[r200(R+rcosu)2],G1(u,v)=[1r2001(R+rcosu)2].G(u, v) = \begin{bmatrix} r^2 & 0 \\ 0 & (R + r \cos u)^2 \end{bmatrix}, \quad G^{-1}(u, v) = \begin{bmatrix} \frac{1}{r^2} & 0 \\ 0 & \frac{1}{(R + r \cos u)^2} \end{bmatrix}.

Step 2: Calculation of Christoffel symbols

We first compute the second partial derivatives of the parametrization f(u,v)f(u,v):

2fu2=(rcosvcosu,  rsinvcosu,  rsinu)\frac{\partial^2 f}{\partial u^2} = (-r \cos v \cos u,\; -r \sin v \cos u,\; -r \sin u) 2fuv=2fvu=(rsinvsinu,  rcosvsinu,  0)\frac{\partial^2 f}{\partial u \partial v} = \frac{\partial^2 f}{\partial v \partial u} = (r \sin v \sin u,\; -r \cos v \sin u,\; 0) 2fv2=(Rcosvrcosvcosu,  Rsinvrsinvcosu,  0)\frac{\partial^2 f}{\partial v^2} = (-R \cos v - r \cos v \cos u,\; -R \sin v - r \sin v \cos u,\; 0)

The Christoffel symbols (computed as for the sphere) are:

Γ111=0,Γ121=Γ211=0,Γ221=Rsinu+rsinucosur\Gamma^1_{11} = 0, \quad \Gamma^1_{12} = \Gamma^1_{21} = 0, \quad \Gamma^1_{22} = \frac{R \sin u + r \sin u \cos u}{r} Γ112=0,Γ122=Γ212=rsinuR+rcosu,Γ222=0\Gamma^2_{11} = 0, \quad \Gamma^2_{12} = \Gamma^2_{21} = \frac{r \sin u}{R + r \cos u}, \quad \Gamma^2_{22} = 0

Step 3: Parametrization of the geodesic curve on the surface

Finally, we obtain the following system of second-order differential equations for the geodesic curves on the torus:

d2udt2+(Rrsinu+sinucosu)(dvdt)2=0,d2vdt22rsinuR+rcosududtdvdt=0.\begin{aligned} \frac{d^2 u}{dt^2} + \left( \frac{R}{r} \sin u + \sin u \cos u \right) \left( \frac{dv}{dt} \right)^2 &= 0, \\ \frac{d^2 v}{dt^2} - \frac{2r \sin u}{R + r \cos u} \frac{du}{dt} \frac{dv}{dt} &= 0. \end{aligned}

We introduce new variables to rewrite the second-order system as a system of four first-order differential equations:

y1=u,y2=dy1dt,y3=v,y4=dy3dty_1 = u, \quad y_2 = \frac{dy_1}{dt}, \quad y_3 = v, \quad y_4 = \frac{dy_3}{dt}

The resulting first-order system is:

dy1dt=y2dy3dt=y4dy2dt=(Rrsiny1+siny1cosy1)y42dy4dt=2rsiny1R+rcosy1y2y4\begin{aligned} \frac{dy_1}{dt} &= y_2 \\ \frac{dy_3}{dt} &= y_4 \\ \frac{dy_2}{dt} &= -\left( \frac{R}{r} \sin y_1 + \sin y_1 \cos y_1 \right) y_4^2 \\ \frac{dy_4}{dt} &= \frac{2r \sin y_1}{R + r \cos y_1} \cdot y_2 y_4 \end{aligned}

Numerical Methods Used

To compute and plot geodesics on the surface, three numerical methods were employed:

  • Euler's method,
  • Runge-Kutta 4 (RK4) method,
  • Dormand-Prince 5 (DOPRI5) method.

Euler's method is a simple, first-order scheme. While it may be effective in special cases, it is generally unstable and introduces significant numerical error, especially when applied to nonlinear systems such as the geodesic equations. A more reliable approach is to use higher-order or adaptive methods.

Runge-Kutta 4 is a fixed-step, fourth-order method, offering a good balance between accuracy and computational cost. Dormand-Prince 5, on the other hand, is a fifth-order adaptive method. It dynamically adjusts the step size based on local error estimates, improving efficiency and stability in regions where the solution changes rapidly.

In general, the global truncation error of a numerical method of order pp behaves like O(hp)O(h^p), where hh is the step size. This means that halving the step size reduces the error by a factor of approximately 2p2^p. For example:

  • Euler's method (order 1): error scales as O(h)O(h),
  • RK4 (order 4): error scales as O(h4)O(h^4),
  • DOPRI5 (order 5): error scales as O(h5)O(h^5).

Thus, both RK4 and DOPRI5 are expected to outperform Euler's method in terms of accuracy for most cases, particularly when the geodesic path exhibits rapid curvature or complex behavior.

Source Code Description

What follows are explanations of critical source code functionalities contained in the supporting Julia source code file, that were used to put all the theoretical concepts from the previous section into practice.

Euler’s Method

The function euler(f, Y0, tspan, h, p) accepts five arguments: a function ff representing the geodesic equation for the surface, the initial condition vector Y0Y_0, the time interval tspan, the step size hh, and the parameter tuple pp.

The initial condition Y0Y_0 has the form:

Y0=[u1(0)du1dt(0)u2(0)du2dt(0)],Y_0 = \begin{bmatrix} u^1(0) \\ \frac{du^1}{dt}(0) \\ u^2(0) \\ \frac{du^2}{dt}(0) \end{bmatrix},

where u1(0)u^1(0) and u2(0)u^2(0) specify the starting point on the surface in parameter coordinates, and the corresponding derivatives specify the initial direction of the geodesic.

The function's output are the array of steps taken and the array of values of the geodesic at each step.

function euler(f, Y0, tspan, h, p)
    t0, tk = tspan
    t = t0:h:tk
    Y = [Y0]
    du = similar(Y0)
    for ti in t[1:end-1]
        f(du, Y[end], p, ti)
        push!(Y, Y[end] + h * du)
    end
    return t, Y
end

Runge-Kutta 4

The function accepts parameters in the same manner as Euler's method described in subsection Euler’s Method. Its output format is also identical, returning the time steps and the geodesic values at each step. However, it is immediately clear that more computations are involved in each iteration, reflecting the increased accuracy of the fourth-order method.

function rk4(f, Y0, tspan, h, p)
    t0, tk = tspan
    t = t0:h:tk
    Y = [Y0]
    du = similar(Y0)
    for ti in t[1:(end-1)]
        f(du, Y[end], p, ti); k1 = h * du
        f(du, Y[end] + k1/2, p, ti + h/2); k2 = h * du
        f(du, Y[end] + k2/2, p, ti + h/2); k3 = h * du
        f(du, Y[end] + k3, p, ti + h); k4 = h * du
        push!(Y, Y[end] + (k1 + 2*k2 + 2*k3 + k4)/6)
    end
    return t, Y
end

Dormand-Prince 5 (DOPRI5)

The Dormand-Prince 5 method is imported from the Julia package DifferentialEquations.jl. The numerical solution procedure consists of first defining the problem using the ODEProblem constructor, followed by solving it with the solve function. The results are stored in a solution object, from which both the time steps and corresponding geodesic values can be extracted for plotting.

A stringent tolerance of 101210^{-12} is used for both absolute and relative errors to ensure high precision. Tolerances looser than approximately 10610^{-6} can lead to noticeably imprecise geodesics.

To make the solution comparable with fixed-step methods, the option saveat=t_eval is specified, restricting the saved output to fixed time points defined by the vector t_eval. This allows consistent sampling of the solution for visualization and further analysis.

using DifferentialEquations

# Define the ODE problem
prob = ODEProblem(geodesic_torus!, Y0, tspan, p)
# Set evaluation points for solution saving
t_eval = 0:0.01:3.5
# Solve using Dormand-Prince 5 method with strict tolerances
sol = solve(prob, DP5(), abstol=1e-12, reltol=1e-12, saveat=t_eval)	
# Extract time steps and geodesic values
t = sol.t
Y_matrix = hcat(sol.u...)'

Results

Sphere

Initial Conditions

We test three different initial conditions representing geodesics on the sphere:

  • Equatorial geodesic: Y0=[π/2,0.0,0.0,0.5]Y_0 = [\pi/2, 0.0, 0.0, 0.5]
  • Meridional geodesic: Y0=[π/2,0.5,0.0,0.0]Y_0 = [\pi/2, 0.5, 0.0, 0.0]
  • Diagonal geodesic: Y0=[π/2,0.5,0.0,0.5]Y_0 = [\pi/2, 0.5, 0.0, 0.5]

For each initial condition, three step sizes were used: h=1.0h = 1.0, h=0.01h = 0.01, and h=0.0001h = 0.0001.

Equatorial Geodesic

Equatorial geodesic, h=1.0

Equatorial geodesic, h=1.0h=1.0

Equatorial geodesic, h=0.01

Equatorial geodesic, h=0.01h=0.01

Equatorial geodesic, h=0.0001

Equatorial geodesic, h=0.0001h=0.0001

Meridional Geodesic

Meridional geodesic, h=1.0

Meridional geodesic, h=1.0h=1.0

Meridional geodesic, h=0.01

Meridional geodesic, h=0.01h=0.01

Meridional geodesic, h=0.0001

Meridional geodesic, h=0.0001h=0.0001

Diagonal Geodesic

Diagonal geodesic, h=1.0

Diagonal geodesic, h=1.0h=1.0

Diagonal geodesic, h=0.01

Diagonal geodesic, h=0.01h=0.01

Diagonal geodesic, h=0.0001

Diagonal geodesic, h=0.0001h=0.0001

Diagonal Geodesic (Detailed Views)

Diagonal geodesic, h=0.01 (detailed view)

Diagonal geodesic, h=0.01h=0.01 (detailed view)

Diagonal geodesic, h=0.0001 (detailed view)

Diagonal geodesic, h=0.0001h=0.0001 (detailed view)

Empirical Observations

  • The equatorial and meridional geodesic cases show excellent agreement among all three methods (Euler, RK4, DOPRI5) at all step sizes, indicating stable geodesics.
  • For the diagonal geodesic case, Euler's method deviates noticeably at (h = 1.0) and slightly at (h = 0.01), while RK4 and DOPRI5 remain well aligned.
  • At the finest step size (h = 0.0001), all methods align closely even in the diagonal case, confirming that reducing step size improves Euler's accuracy.

Torus

Initial Conditions

We test six distinct initial conditions representing geodesics on the torus:

  • Inner equator: Y0=[π,0.0,0.0,1.0]Y_0 = [\pi, 0.0, 0.0, 1.0]
  • Outer equator: Y0=[0.0,0.0,0.0,1.0]Y_0 = [0.0, 0.0, 0.0, 1.0]
  • Four turns: Y0=[0.0,1.0,0.0,0.1]Y_0 = [0.0, 1.0, 0.0, 0.1]
  • Complex spiral: Y0=[0.0,0.73,0.0,0.1]Y_0 = [0.0, 0.73, 0.0, 0.1]
  • Six turns: Y0=[0.0,0.69,0.0,0.05]Y_0 = [0.0, 0.69, 0.0, 0.05]
  • Triangle: Y0=[0.0,0.485,0.0,0.1]Y_0 = [0.0, 0.485, 0.0, 0.1]

Inner equator, h=1.0

Inner equator, h=1.0h=1.0

Inner equator, h=0.01

Inner equator, h=0.01h=0.01

Inner equator, h=0.0001

Inner equator, h=0.0001h=0.0001

Outer equator, h=1.0

Outer equator, h=1.0h=1.0

Outer equator, h=0.01

Outer equator, h=0.01h=0.01

Outer equator, h=0.0001

Outer equator, h=0.0001h=0.0001

Four turns, h=1.0

Four turns, h=1.0h=1.0

Four turns, h=0.01

Four turns, h=0.01h=0.01

Four turns, h=0.0001

Four turns, h=0.0001h=0.0001

Complex spiral, h=1.0

Complex spiral, h=1.0h=1.0

Complex spiral, h=0.01

Complex spiral, h=0.01h=0.01

Complex spiral, h=0.0001

Complex spiral, h=0.0001h=0.0001

Six turns, h=1.0

Six turns, h=1.0h=1.0

Six turns, h=0.01

Six turns, h=0.01h=0.01

Six turns, h=0.0001

Six turns, h=0.0001h=0.0001

Triangle, h=1.0

Triangle, h=1.0h=1.0

Triangle, h=0.01

Triangle, h=0.01h=0.01

Triangle, h=0.0001

Triangle, h=0.0001h=0.0001

Triangle, h=0.0001 (from above)

Triangle, h=0.0001h=0.0001 (from above)

Empirical Observations

  • Inner and outer equators remain stable across all step sizes and methods.
  • Four turns, complex spiral, six turns, and triangle show significant deviation with Euler at (h = 1.0), partial correction at (h = 0.01), and convergence with RK4/DOPRI5 at (h = 0.0001).

Conclusion

To compute geodesics accurately, higher-order methods such as Runge-Kutta 4 (RK4) and Dormand-Prince 5 (DOPRI5) are the most reliable. In our experiments, their results were nearly identical, with no practical difference in performance.

While simpler methods like Euler's method can match the precision of higher-order methods in specific, uncomplicated cases, they are generally outperformed. However, reducing the step size significantly (e.g., to (h = 0.0001)) allows even Euler’s method to approach the accuracy of RK4 and DOPRI5.

This presents a clear trade-off: Euler’s method is easy to implement but requires very small step sizes to achieve high accuracy, resulting in increased computational cost. Conversely, RK4 and DOPRI5 are more complex but provide stable and accurate results even with larger step sizes (e.g., (h = 0.01)), making them more efficient overall for most applications.


References