I try to calculate the Einstein tensor of Kaluza-Klein model from this paper. It is given by Equation (55)

$ G_{\alpha\beta} = \frac{\nabla_\beta (\partial_\alpha \phi)}{\phi} - \frac{1}{2\phi^2} \left[ \frac{\partial_4 \phi \partial_4 g_{\alpha\beta}}{\phi} - \partial_4 (\partial_4 g_{\alpha\beta} ) + g^{\gamma\delta} \partial_4 g_{\alpha\gamma} \partial_4 g_{\beta\delta} - \frac{g^{\gamma\delta} \partial_4 g_{\gamma\delta} \partial_4 g_{\alpha \beta}}{2}+ \frac{g_{\alpha\beta}}{4}\left( \partial_4 g^{\gamma\delta} \partial_4 g_{\gamma\delta} + ( g^{\gamma\delta} \partial_4 g_{\gamma\delta})^2 \right) \right], $

where $\alpha,\beta=0, 1, 2,3$. $g_{\alpha\beta} = a^2(t) (-1,1,1,1)~ e^y$, and $\partial_4 = \frac{\partial}{\partial x^4}= \frac{\partial}{\partial x^y}$ is the derivative with respect to an extra fifth dimension.

Here is my trial:

n := 4

coord := {t, r, d, m}

coord[[1]] := t;

metric := {{-a[t]^2 Exp[y], 0, 0, 0}, {0, a[t]^2 Exp[y], 0, 0}, {0, 0,
    a[t]^2 Exp[y], 0}, {0, 0, 0, a[t]^2 Exp[y]}}

inversemetric = Simplify[Inverse[metric]]

Gtensor := Gtensor = Simplify[Table[Sum[D[D[f[t, y], i] j]/f[t, y] - 1/(2 f[t, y]^2 ) (metric[[i, j]]/4 (( inversemetric[[k, s]]*D[metric[[k, s]], y])^2 + 
            D[inversemetric[[k, s]], y]*D[metric[[k, s]], y]) +  
         inversemetric[[k, s]]*D[metric[[i, k]], y]*
          D[metric[[j, s]], y] - 1/2 inversemetric[[k, s]]*D[metric[[i, j]], y]*
          D[metric[[k, s]], y] +(1/f[t, y]) (D[f[t, y], y]*D[metric[[i, j]], y])  - 
         D[D[metric[[i, j]], y], y]), 
             {s, 1, n}], {i, 1, n}, {j, 1, n}, {k, 1, n}]]

Then to make a table of the tensor components I used :

listGtensor := Table[If[UnsameQ[Gtensor[[i, j]]], {ToString[G[i, j]], Gtensor[[i, j]]}] , {i, 1, n}, {j, 1, n}, {k, 1, j}] 

TableForm[Partition[DeleteCases[Flatten[listGtensor], Null], 2], 
 TableSpacing -> {2, 2}]

However I think the output has some problems: I expect to get three tensor components $G_{00}$ and $G_{ij}$ in terms of $g_{00}= -a^2 e^y$ and $g_{ij}= a^2 e^y $, respectively, while $G_{0i}$ will be a function of $f(t,y)$. But I get many different components. Also the table list is messed.

So any help to adjust Gtensor equation and the tabel list.

  • 1
    $\begingroup$ In the future, please don't delete a question and post the exact new one. There is an option to edit the question – use it instead. $\endgroup$
    – Domen
    Oct 3, 2023 at 12:58
  • $\begingroup$ Okay, I thought that is better to present more recent subject. $\endgroup$
    – Dr. phy
    Oct 3, 2023 at 13:00
  • $\begingroup$ Is that first term in your TeX expression for G a covariant derivative? if so, you may need to compute Christoffel symbols. $\endgroup$
    – user87932
    Oct 3, 2023 at 19:18

1 Answer 1


I'm not sure what the $\nabla$ represents in your equation. You seem to treat it as a partial derivative, but it may be a covariant derivative, in which case you'll need some Christoffel symbols to complete this. I just created a covd symbol to represent it for now.

What I did was to break your equation up into individual terms and try to keep to the notation in the TeX equation as much as possible to avoid confusion. This also allows me to debug individual pieces more easily. I also tried to keep the names as short as possible to declutter things. Here's what I ended up with:

coordList = {t, x, w, z};
coord[i_] := coordList[[i]]

metric = a[t]^2 Exp[y] DiagonalMatrix[{-1, 1, 1, 1}];

invmetric = Inverse@metric;

m[a_, b_] := metric[[a, b]];

im[a_, b_] := invmetric[[a, b]];

d[a_, f_] := D[f, coord[a]];

dDel[b_, f_] := covd[f, coord[b]];

covd[0, x_] := 0;

d4[f_] := D[f, y]

term1[a_, b_] := dDel[b, d[a, f[t, y]]]/f[t, y];

term2[a_, b_] := d4[f[t, y]] d4[m[a, b]]/f[t, y];

term3[a_, b_] := -d4[d4[m[a, b]]];

term4[a_, b_, g_, d_] := im[g, d] (d4[m[a, g] d4[m[b, d]]]);

term5[a_, b_, g_, d_] := -im[g, d] (d4[m[g, d] d4[m[a, b]]])/2;

term6[a_, b_, g_, d_] := 
  m[a, b] (d4[im[g, d]] d4[m[g, d]] + (im[g, d] d4[m[g, d]])^2)/4;

ein[a_, b_] := -(term1[a, b] + term2[a, b] + term3[a, b] + 
       Sum[term4[a, b, g, d] + term5[a, b, g, d] + 
         term6[a, b, g, d], {g, 4}, {d, 4}])/2/f[t, y]^2;

The results are below. (I pasted an image because I can't figure out how to get the outputs in a readable form.)

enter image description here

I don't know if this is what you expected. The terms are quite similar because the metric is the same spatially, and only differs by a sign for time. Three of the four covd terms had a zero and dropped out, since f[t,y] didn't depend on the other coordinates. So it seems reasonable to get the same overall form due to symmetry.


Due to the symmetry of the metric and the fact all spatial derivatives of f[t,y] are 0 (y is the 5-d Kaluza-Klein parameter, not one of the 4-d spatial coordinates), I believe you only need the "ttt" Christoffel symbol. The covariant derivative you're trying to compute is $\nabla_{\beta}(\partial_t f[t,y]) = \partial_{\beta}f[t,y] - \Gamma^\sigma_{\alpha\beta} \partial_{\sigma}f[t,y]$. The only non-zero covariant derivative term is the $\alpha=\beta=t$ case, and the only non-zero derivative of f is the time derivative, so this reduces to $\partial_{t}f[t,y] - \Gamma^t_{tt} \partial_{t}f[t,y]$.

Using the common convention of representing partial derivatives with a comma, $\Gamma^t_{tt} = g^{ts}(g_{st,t} + g_{st,t} - g_{tt,s})/2$. Since g and its inverse are diagonal, $g^{tt} = \frac{1}{g_{tt}}$ and the only non-zero term in the sum over the index s is s=t. We end up with $\Gamma^t_{tt} = (g_{tt,t} + g_{tt,t} - g_{tt,t})/(2 g_{tt}) = g_{tt,t}/(2g_{tt})$ after cancelling terms. Since $g_{tt} = -a(t)^2 \exp^y$, the sign and exponential cancel out and we're left with covd[t,f_] := D[f,t] - a'[t]/a[t]. For you case, since we've already taken the time derivative of f[t,y], you're left with f'' - a'[t] f'[t]/a[t].

That's assuming the $\nabla$ is indeed a covariant derivative, which you should verify.

  • $\begingroup$ Thanks so much for your answer. It’s right $\nabla$ is a covariant derivative. I wonder can covd terms calculated by MA? I mean can MA compute Christoffel symbols? Because the metric terms can be further complicated. $\endgroup$
    – Dr. phy
    Oct 5, 2023 at 9:12
  • 2
    $\begingroup$ There are a number of packages for handling tensors in Mathematica, such as xAct, Gravitas, OGRE, etc. (Those are free.) You can probably find posts on this site to get a more complete list (try clicking on the "tensors" tab under your question - I recall seeing such a list within the past month or two) , or Google for "Mathematica tensor algebra". $\endgroup$
    – user87932
    Oct 5, 2023 at 17:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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