Trajectories in the Schwarzschild space-time
One important aspect of General Relativity is the computation of geodesics from a given metric of space-time. I will go through the details of how it can be done using the Riemann package.
Before tackling the space-time problem, letâs warm up a bit and look at a simpler example in two-dimensional space.
1. Space
We will consider the following line-element:
where
The geodesics are curves satisfying the following general equation
where
For our surface, the equations of geodesics are :
The analytical resolution of these equation needs not concern us at the moment. For purposes of illustration, we can be content with a numerical resolution. In the notebook from the git repository, I define some simple initial conditions

and plot the result as a parametric curve. Anticipating on the computation in space-time, we can plot our result curve on the Flammâs paraboloid representing the following embedding in 3d space:
The function Embedding3D in the preamble to the notebook has been written to serve that visualisation purpose. The geodesic is shown in blue:

2. Space-time
In order to take gravity into account, one must consider the complete space-time metric and restore the time coordinate:
where
In this case, the geodesic equations are:
We can solve these numerically as we did for the purely spatial case. There is however an extra subtlety here as one must not fail to consider one extra constraint stemming frome the principle of equivalence of general relativity. We will first address the case where the particle has mass and then move on to the case of a massless particle.
massive particle
The equivalence principle states that, at any point (event) of space-time, the laws of motion must be reducible to those of special relativity by an adequate choice of local coordinates which corresponds to a free-falling frame of reference. In the case of a massive particle, this amounts to demand that
locally, where

The figure below shows the same trajectory embedded on the surface of Flammâs paraboloid.

massless particle
The discussion on the choice of initial value presented above in the case of a massive particle needs to be modified when the particle has no mass.
Firstly, one must realise that the idea of proper-time is ill-defined for a massless particle and one must decide on another affine parameter to use. Perhaps the most natural choice is simply to use the element of length
which sets a contraint on the spatial part of the metric. Another constraint comes from the fact that massless particle necessarily travel at the speed of light, which entails :
The above two constraints have to be satisfied simultaneously at all points of the trajectory.
The figure below shows one such trajectory in the equatorial plane for a particle starting at

The above clearly demonstrates the effect of space-time curvature on the trajectories of a massless particle. It is perhaps the most stringent departure of general relativity from Newtonian physics that light rays are bent by gravitational fields.
In order to render that fact even more vividly, we can compare our results to that obtained by performing the same computation but setting the Schwarzschildâs radius to

The blue curves is the solution for