I have been developing a General Relativity utility for working out the stress tensor coefficients for a given metric and all the related Riemannian coefficients which build up to it:


My code is stable but not yet optimized. I am looking to make use of the Riemann curvature tensor symmetries so that I only need to compute 20 independent coefficients instead of 256 (this is in 4 dimensions). This will massively save on compute time.

My problem:

1.) I can only find indirect information on these independent components through concepts relating to the Bianchi identities.

2.) I cant find explicit instructions for mapping the independent Riemann coefficients to the redundant coefficients.

3.) I am only interested in the coefficients of the form $R^{\rho}_{jkl}$, not $R_{ijkl}$. This is important because I don't want to compute the $R_{ijkl}$ coefficients before the $R^{\rho}_{jkl}$ coefficients since I compute $R_{ijkl}$ from $R^{\rho}_{jkl}$.

What I am looking for:

Instructions/algorithm for knowing Which coefficients are independent? Which coefficients are redundant? Which independent coefficients map to which redundant coefficients?

  • $\begingroup$ I'm confused because a few thousand partial derivatives of simple functions should be nothing to a modern computer. The question of why your code is slow may be more suited to the programming SE. $\endgroup$ – benrg Jan 22 '19 at 18:57
  • $\begingroup$ Since this is a physics question, I will post it on physics SE but if your confused as to why I would seek such optimizations then consider that not all solutions are created equal and the compute time changes dramatically if the metric input is complex enough. In the case of a highly complex metric input, you could imagine how those extra redundant 236 calculations would be great to remove. $\endgroup$ – spacetimeengineer Jan 22 '19 at 19:17
  • $\begingroup$ I think if you restrict attention to the mixed index tensor $R^\mu_{\nu\rho\sigma}$, there are actually 74 independent components as opposed to 20, basically because you can't implement the antisymmetry on the first two indices, and are left with the weaker condition that $R^\mu_{\mu\rho\sigma}=0$. Probably another way to say this is that there really are only 20 independent components, but exactly which components are independent will depend on the form of the metric $g_{\mu\nu}$. Would you be interested in a way to identify the 74 independent components of $R^\mu_{\nu\rho\sigma}$? $\endgroup$ – asperanz Jan 22 '19 at 21:13

As far as I know, it is only the fully covariant form $R_{ijkl}$ or the fully contravariant form $R^{ijkl}$ that have the nice symmetries reducing the number of independent components to 21. (And then the algebraic Bianchi identity reduces the number to 20.)

These tensors are antisymmetric in the first two indices, antisymmetric in the last two indices, and symmetric when the first two are swapped with the last two.

This means that to get the independent components, you can first restrict $ij$ and $kl$ to be the six pairs 01, 02, 03, 12, 13, and 23. You don't have to consider 00, 11, 22, and 33 because these components are zero by antisymmetry. And you don't have to consider, say, 10, because you can swap it to get 01, with a minus sign, again by antisymmetry.

Next, by the symmetry of swapping the first two with the last two, you can restrict $ij$ to be "less than or equal to" $kl$, giving the following 21 components:

$$\begin{matrix} 0101 && 0102 && 0103 && 0112 && 0113 && 0123 \\ && 0202 && 0203 && 0212 && 0213 && 0223 \\ && && 0303 && 0312 && 0313 && 0323 \\ && && && 1212 && 1213 && 1223 \\ && && && && 1313 && 1323 \\ && && && && && 2323 \end{matrix}$$

The algebraic Bianchi identity in four dimensions is a single relation between the three components in which all the indices are different:


so you can consider any one of these three to be redundant and not calculate it "the hard way".

So I think you need to give up on the idea that you are only interested in ${R^i}_{jkl}$. You should instead calculate the 20 components $R_{ijkl}$ above, use the Bianchi identity to get the 21st, and then use symmetry and antisymmetry to get the remaining 236. For example,


because starting with 2103 you can reverse the first two to get 1203, introducing a minus sign because of the antisymmetry, and then swap the first two with the last two to get 0312, which is in the list above.

So, to calculate a component of $R_{ijkl}$, do you have to first compute four components of ${R^i}_{jkl}$ using the standard formula and then contract them with the metric tensor? No! There is a formula (from Wikpedia's List of formulas in Riemannian geometry) which you can use to directly calculate fully-covariant components:

$$R_{iklm}=\frac{1}{2}\left(\frac{\partial^2 g_{im}}{\partial x^k \partial x^l}+\frac{\partial^2 g_{kl}}{\partial x^i \partial x^m}-\frac{\partial^2 g_{il}}{\partial x^k \partial x^m}-\frac{\partial^2 g_{km}}{\partial x^i \partial x^l}\right)+g_{np}({\Gamma^n}_{kl}{\Gamma^p}_{im}-{\Gamma^n}_{km}{\Gamma^p}_{il})$$

So a good strategy would be to

  1. Calculate first derivatives of the metric components, remembering that the metric is symmetric, and cache them.

  2. Use the cached first derivatives to calculate the Christoffel symbols, remembering that they are symmetric on the lower indices, and cache them.

  3. Use the cached first derivatives to calculate second derivatives of the metric, remembering that they are symmetric in the partials, and cache them.

  4. Calculate the 20 independent fully-covariant components of the Riemann tensor using the formula above.

  5. Calculate everything else from these.

If you can show that the Einstein tensor of the Kerr metric vanishes, that will be a good test case.

| cite | improve this answer | |
  • $\begingroup$ This is everything I asked for and more. Great answer! Thanks for providing context and the instructions for computing $R^{i}_{jkl}$ from $R_{\rho jkl}$. $\endgroup$ – spacetimeengineer Jan 23 '19 at 13:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.