I want to learn how to identify specific Christoffel Symbols and Riemman Tensor components from the general solution provided by Mathematica. Let us work out an example to see what I mean clearly.

Given the following metric

$g_{\mu \nu} = \begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & r^2+b^2 & 0 & 0 \\ 0 & 0 & (r^2+b^2)\sin^2(\theta) & 0 \\ 0 & 0 & 0 & -1 \end{pmatrix} $

Using the following code

ChristoffelSymbol[g_, xx_] := 
 Block[{n, ig, res}, n = Length[xx]; ig = Inverse[g];
  res = Table[(1/2)*
     Sum[ig[[i, s]]*(-D[g[[j, k]], xx[[s]]] + D[g[[j, s]], xx[[k]]] + 
         D[g[[s, k]], xx[[j]]]), {s, 1, n}], {i, 1, n}, {j, 1, n}, {k,
      1, n}];
(* The coordinates *)
xx = {r, θ, ϕ, t};

(* The metric *)
g = {{1, 0, 0, 0}, {0, r^2 + b^2, 0, 0}, {0, 
    0, (r^2 + b^2) Sin[θ]^2, 0}, {0, 0, 0, -1}};

ChristoffelSymbol[g, xx]

We get the general result

enter image description here

So how to identify from such general solution that the symbols are







? (i.e. what code could we use?)

Same story with the Riemann Tensor;

Using the following code

RiemannTensor[g_, xx_] := 
    Block[{n, Chr, res}, 
           n   = 4; Chr = ChristoffelSymbol[ g, xx];
           res = Table[  D[ Chr[[i,k,m]], xx[[l]]] 
                       - D[ Chr[[i,k,l]], xx[[m]]]
                       + Sum[ Chr[[i,s,l]]*Chr[[s,k,m]], {s, 1, n}]
                       - Sum[ Chr[[i,s,m]]*Chr[[s,k,l]], {s, 1, n}], 
                        {i, 1, n}, {k, 1, n}, {l, 1, n}, {m, 1, n}]; 
           Simplify[ res]]

RiemannTensor[g, xx] 

We get the general result

enter image description here

But how to identify the specific $R_{\mu \nu \rho \sigma}$ components?


As Artes pointed out, the provided general solution for the Riemann Tensor is in the form $R^{\mu}_{\nu \sigma \rho}$.

What I really want is $R_{\mu \nu \sigma \rho}=g_{\mu\eta} R^{\eta}_{\phantom{\eta}\nu\sigma\rho}$ so I need to find a code that provides a general solution for the Riemann Tensor in the form $R_{\mu \nu \sigma \rho}$

I naively tried


But this code simply yields the metric and $R^{\mu}_{\nu \sigma \rho}$ together, not $R_{\mu \nu \sigma \rho}$. Could somebody please provide the code that does the job? Thanks.


First of all my apologies for not being clear enough in my original question.

My question is how to identify specific Christoffel symbols out of the general solution provided by Mathematica, which is the following

enter image description here

Imagine we're not given the values of the Christoffel symbols as in my original question. Then how can I know from the above solution that, for instance, $\Gamma^{1}_{22}=-r$?

I have the same issue with the Riemann tensor.

  • 2
    $\begingroup$ You haven't examine carefully this answer. It says RiemannTensor[g, xx][[μ, ν, λ, σ]] represents $R^{\mu}_{\phantom{\mu}\nu\lambda\sigma}=\partial_{\lambda}\Gamma^{\mu}_{\phantom{\mu}\nu\sigma}-\partial_{\sigma} \Gamma^{\mu}_{\phantom{\mu}\nu\lambda}+\Gamma^{\mu}_{\phantom{\mu}\rho\lambda}\Gamma^{\rho}_{\phantom{\mu}\nu\sigma}-\Gamma^{\mu}_{\phantom{\mu}\rho\sigma}\Gamma^{\rho}_{\phantom{\mu}\nu\lambda}\quad$ $\endgroup$
    – Artes
    Jun 23, 2020 at 22:00
  • 1
    $\begingroup$ If you want $R_{\mu\nu\lambda\sigma}$ you have to compute $g_{\mu\eta} R^{\eta}_{\phantom{\eta}\nu\lambda\sigma}$ using the Einstein summation convention. $\endgroup$
    – Artes
    Jun 23, 2020 at 22:06
  • $\begingroup$ @Artes thanks for your comments. I've added an edit to clarify what's my issue. $\endgroup$
    – JD_PM
    Jun 24, 2020 at 9:17
  • $\begingroup$ Hi everyone. Unfortunately I did not explain myself clearly enough and did not get the questions issued. Should I post another question being more specific and erase this one? $\endgroup$
    – JD_PM
    Jun 26, 2020 at 18:39
  • $\begingroup$ Does this answer your question? How to calculate scalar curvature Ricci tensor and Christoffel symbols in Mathematica? $\endgroup$
    – Dunlop
    Jun 28, 2020 at 5:20

1 Answer 1


For the Γ's one way to do it after executing your code.

Γ[α_, β_, γ_] := ChristoffelSymbol[g, xx][[α, β, γ]]

Γ[1, 2, 2]

Γ[1, 3, 3]
(*-r Sin[θ]^2*)


  • $\begingroup$ Bill Watts thanks for your answer! Please note I am asking how to identify specific Christoffel symbols from the general solution. In your answer you assume you've been given the answers and you check them, which is something I learned how to do here:.mathematica.stackexchange.com/questions/224280/…. So how to know that (for instance) $-r$ corresponds to $\Gamma[1,2,2]$ using Mathematica code? $\endgroup$
    – JD_PM
    Jun 24, 2020 at 8:32

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