An example in using the Riemann package
I started a Mathematica package to performs computations of Riemannian geometry. As an exercise in using it, I present here the computation of the curvature of a 2-sphere embedded in the euclidean space. The package is in development and its content is not meant to be exhaustive. This suffices however to perform some of the most basic computations on (pseudo-)Riemannian real manifolds. The package is available in its own git repository.
For something more general, I recommend you take a look at the excellent SageManifolds.
let us start by defining a background 3-dimensional euclidean space by providing a set of coordinates
One way to embed the 2-sphere in the 3-dimensional euclidean space is to impose that
where
with
The components of the one-form normal to
Once it has been normalised, this turns out to be
The general expression of the projector onto
Here this gives:
Finally, the extrinsic curvature is the Lie derivative of this tensor along the normal vector defined above:
Here this gives:
The mean curvature is given by the trace of this tensor. Here, it is found to be
All the above was done using only vectors (and one-forms) belonging to the (co-)tangent bundle of the surrounding euclidean space without any explicit reference to the local coordinates on
From
where
The induced metric on
which here gives:
Applying a transformation similar to Eq.
and so we recover Eq.