TITLE: Geodesics that self-intersect at finitely many points
QUESTION [7 upvotes]: Notations
$M$ will denote a smooth manifold and $\nabla$ an affine connection on it. A smooth curve $\gamma\colon I \to M$ will be called a geodesic if it is $\nabla$-parallel along itself, that is $\nabla_{\dot{\gamma}(t)}\dot{\gamma}=0$ for every $t \in I$. A geodesic will be said to be maximal if every proper extension of it is not a geodesic.

It is easy to find examples of maximal geodesics which do not self-intersect, like 
lines in Euclidean plane, or that intersect in infinitely many points, like great circles on the sphere. On the contrary I cannot find examples of geodesics which self-intersect at finitely many points, like the curve below: 


Question Is it possible to determine $M$ and $\nabla$ in such a way that one of the resulting maximal geodesics intersects at finitely many points?

Thank you.

REPLY [7 votes]: I would like to give an answer with a certain mechanical flavor.
Let us consider the Lagrangian $L=K-V$ where $K=\dfrac{x'^2+y'^2}{2}$ and $V=\dfrac{x^2+ a^2y^2}{2},$ with $a\in\mathbb{R}_+,$ which describe a particle in the plane acted upon by a anisotropic spring.
The equations of motion are elementarly solved obtaining $$x=A\cos(t+\phi),\ y(t)=B\sin(at+\psi),$$ with $A,B,\phi,\psi$ arbitrary constants of integrations.
The trajectories of motion are the well-known Lissajous curves; if $a\in\mathbb{Q}$ then they are closed with multiple self-intersctions (see the figure below), otherwise they fill densely a domain of the plane.

Why does this argument answer you question?
By Maupertius' principle, for any $e>0,$ in the invariant submanifold $\Omega:=\{(x,y):V(x,y)<e\},$ the trajectories of motion coincide up to a reparametrization with the the geodesics for the Jacobi metric $g=(e-V)K$ on $\Omega.$