Set up a coordinate system to work with - the first one to be set is automatically taken as the differentiation variables for d_, the covariant derivative D_ and the dAlembertian
When Physics is initialized, the default spacetime metric is of Minkowski type. You can see the metric querying Setup, as in Setup(metric);, or directly entering the metric as g_[], with no indices
Check the nonzero components of Christoffel, used to construct the Ricci tensor entering the definition of Einstein: because the default spacetime is of Minkowski type, there are none
Hence
and the same is valid for all the general relativity tensors defined in terms of Christoffel and derivatives of the metric g_.
To set the scenario as a curved spacetime set the metric using Setup, for instance indicating the square of the spacetime interval. In this example, we also choose to work in spherical coordinates, so consider, for instance, the metric defined by
Now when the indices are not numerical, Einstein returns itself after normalizing its second and third indices taking advantage of the symmetry of its indices
To express Einstein in terms of the Ricci tensor using its definition use convert to Ricci
Check the value of for = = 1
Now of for = = 1 (note you enter the value of the contravariant index prefixed by ~)
To compute with a representation for Einstein without actually performing the operation, use the inert form %Einstein. To afterwards perform the operation use value
To have a more compact display in the following examples, suppress the display of the dependency of and have the display of derivatives in jet notation, indexed (see Typesetting)
Compute now the Matrix form of .
As with all the general relativity tensors of the Physics package, you can obtain the same result for the all covariant case by entering the tensor without indices, as in Einstein[].
This is the matrix form of (note the contravariant index , prefixed by ~)
To use this matrix, because its components were computed by already taking into account the (covariant/contravariant) character of its indices, you do not need to indicate furthermore that character. So for we have
Compare with the output obtained entering Einstein[~1, 1] in eq (14)