# Suggestions for libraries that can numerically compute geodesics from a given Riemannian metric?

I am dealing with a non-trivial Riemannian metric $$H$$ defined on a particular subset of Euclidean space ($$E \subset \mathbb{R}^n$$). I was able to show the Riemannian manifold $$(E,H)$$ is geodesically complete. I am interested in finding a geodesic that connects arbitrary points. I think this is accomplished via the shooting method...

I was wondering if there were any libraries, preferably in Matlab or Python, dedicated to numerically computing geodesics on manifolds. I rather not re-invent the wheel and instead take advantage of some (hopefully) library with a dedicated community for fixing bugs and adding cool features I haven't thought of.

ManOpt is a great library, but the Manifold object assumes that you have the exponential map readily available. In my case, I do not. I only have a closed-form expression of the Riemannian metric.

I attempted at doing this myself but ran into many difficulties. First, the resulting geodesic ODE seems to be stiff, and hence Ode45 isn't useful. I found that other ODE solvers for stiff equations work nice (to an extent...), but frankly, I'm dealing with stuff I just don't understand. I want a library written by people who do understand these issues. Not to mention, trying to implement the shooting method for solving 2-point boundary problems for the geodesic will be quite difficult.

I would appreciate any help with this.

• It's not obvious to me that shooting is the best way to do this. A blunt way would be to approximate the geodesic as piecewise linear, take as your initial guess the straight line from start to endpoint, and do some numerical optimization for the intermediate points. You could use the built-in optimization routines in scipy for that part. You'll need to apply some quadrature rule in each sub-interval. No need to involve an ODE solver at all. Mar 9 at 6:16
• The people who deal with a very related problem are the ones planning trajectories for space craft: They know start and end points, and need to know how to get from one to the other. I don't know that field well, but it is quite possible that they have tools that get you 90% there. Mar 9 at 17:24
• @WolfgangBangerth Hey you just described just the exact field I am in :) The field is called optimal control theory. However, optimal control theory imo is more complicated than the problem I'm dealing with. Mar 9 at 17:30