Sphere Geodesics

differential-geometrygeodesic

I am writing a computer program about differential geometry, and i am stucked with geodesics on sphere.

I used a parametrization

$$
X = Rcos(v)sin(u)
$$

$$
Y = Rcos(u)
$$

$$
Z = Rsin(v)sin(u)
$$

so the metric is:
$$
g_{ij} =
\begin{bmatrix}
R^2 & 0 \\
0 & R^2 sin^2(u)
\end{bmatrix}
$$

after realizing that standard geodesic equation is hard to solve for sphere i solved it by using Euler-Lagrange equation. The result was:

$$
u = cos^{-1}(Bcot(v)) + u_0
$$

where $B$ and $u_0$ are constants. With given endpoints, I solved for $B$ and $u_0$. In my program I wrote a script which shows curve on sphere surface using parametrization of (u,v), so i tried it that way:

$$
v = t
$$

$$
u = cos^{-1}(Bcot(t)) + u_0
$$

where $t$ is a parameter. And here I met 3 problems.

  1. Equation doesn't work for $t=0$, because of the domain of $cot(t)$
  2. Constants cannot be calculated when one of endpoints has v = $k\pi/2$ again because of the domain of the $cot(t)$
  3. Weird behaviour near poles when i finally managed to run a program

Can I avoid this problem? Is it a better way to parametrize? or do i need to code sphere geodesics in other way?

Best Answer

Pick an (oriented) orthonormal basis $e_1,e_2$ for the plane you want, and take $(\cos t)e_1+(\sin t)e_2$. If you like, this specifies the starting point $e_1$ on the unit sphere and the unit tangent vector $e_2$ at that point.