I) The Problem

There's a particular metric $[1],[2]$ in general relativity which is written as:

$$ds^{2} = -[c^2-v_{s}^2f(r_{s})^2]dt^2+v_{s}f(r_{s})dtdx+v_{s}f(r_{s})dxdt+ dy^2+dz^2 \tag{1}$$

So my question is:

How can I calculate the Christoffel symbols of this metric using Mathematica or similar software?

II) Important facts before answering to my question and propose code fixing:

Now, everything about that geometry you can find in $[1],[2]$; for the sake of commodity, I'll give important concepts and notation.

Firstly, this metric gives an idea of a "hyperdrive" or a "warp bubble",i.e. a body can move through the point $A$ to point $B$ using just spacetime curvature, given by metric $(1)$; this metric uses the cartesian coordinates $(t,x,y,z)$. I'm saying this because the movement of the bubble could in principle occur in a (spatial) vector direction, but the problem is simplified by assuming a one-dimensional displacement in $x$-axis. Therefore, this implies that the quantity $v_{s}$ (the velocity of the bubble, seen by an external observer) is:

$$v_{s} \equiv v_{s}(t) =: \frac{dx_{s}(t)}{dt} \tag{2}$$

Secondly, the radius from the center of the bubble to the "curvature wall" is given by a function $r_{s}$ which is:

$$r_{s} =: \sqrt{(x-x_{s}(t))^2+y^2+z^2} \tag{3}$$

Finally, the function $f$ is given by:

$$f(r_{s}) =: \frac{tanh[\sigma(r_{s}+R)]-tanh[\sigma(r_{s}-R)]}{2tanh[\sigma R]} \tag{4}$$

Now, $R$ and $\sigma$ are parameters (quantities which we can put in a slider to continuously change); the terms $\sigma(r_{s}+R)$ and $\sigma(r_{s}-R)$ aren't denoting $\sigma(r)$, they are a multiplication of a function ($r_{s}$) by the number (parameter) $\sigma$. The reason for this function can be understood in $[1],[2]$.

III) My (unsuccessful) effort

Now, Christoffel symbols (CS) are "easily" calculated because we have a strong algorithmic process to do it $[3]$. I calculated the Christoffel symbols of this metric "by hand" and my final results turned to be quite right; my outputs are the same as $[2]$, therefore, there's no doubt about the final result of a Mathematica program.

To calculate Christoffel symbols you must declare a metric tensor, calculate the inverse metric tensor and just after that you're able to start the calculations of CS.

The final results which I calculated "by hand" (also in $[2]$) are:

$\Gamma^{0}_{00} = -\frac{\partial_{1}f(r_{s})f(r_{s})v_{s}(t)^3}{c^2}$

$\Gamma^{0}_{01} = \Gamma^{0}_{10} = -\frac{\partial_{1}f(r_{s})f(r_{s})v_{s}(t)^2}{c^2}$

$\Gamma^{0}_{11} = -\frac{v_{s}(t)\partial_{1}f(r_{s})}{c^2}$

$\Gamma^{1}_{00} = \frac{1}{c^2}\Big(\partial_{1}f(r_{s})v_{s}(t)^2f(r_{s})(-c^2+v_{s}(t)^2f(r_{s})^2)+c^2\partial_{0}v_{s}(t)f(r_{s})+c^2\partial_{0}f(r_{s})v_{s}(t)\Big)$

$\Gamma^{1}_{01} = \Gamma^{1}_{10} = \frac{\partial_{1}f(r_{s})f(r_{s})v_{s}(t)^3}{c^2}$

My codes are returning, in fact, the wrong outputs:


    enter image description here

enter image description here


enter image description here enter image description here

IV) Some codes from other people which I tried to adapt

The code isn't mine's, is from Hartle's site $[4]$ in the link called "Christoffel Symbols and Geodesic Equations"

$$ * * * $$

$[1]$ https://arxiv.org/abs/gr-qc/0009013

$[2]$ https://arxiv.org/abs/1202.5708

$[3]$ David McMahon's Relativity Demystified

$[4]$ http://web.physics.ucsb.edu/~gravitybook/mathematica.html

  • 2
    $\begingroup$ I am the moderator of Computational Science SE. I accidentally migrated this question here (even though I personally think it belongs here) without making sure. Let me know if it's not OK. I already asked the OP for this on our community. $\endgroup$
    – Anton
    Commented Mar 31, 2020 at 0:47
  • 2
    $\begingroup$ Please show us the code text rather than screenshot of it so we can easily test. As to typesetting of code, you may want to read the following post: mathematica.meta.stackexchange.com/q/1584/1871. As to Christoffel symbols, I'm not familiar with the topic, but have you read this post?: mathematica.stackexchange.com/q/8895/1871. $\endgroup$
    – xzczd
    Commented Mar 31, 2020 at 2:50
  • $\begingroup$ @AntonMenshov I am not a moderator for Mathematica SE but the post does indeed look like it belongs here. $\endgroup$ Commented Mar 31, 2020 at 15:17

1 Answer 1


Several different codes for routine calculations in general relativity were published here. I will give one of them (sorry, I don’t remember where I got it from). This code accurately reproduces your results (where no typos):

Clear [coord, metric, inversemetric, affine, riemann, ricci, scalar, \
einstein, t, x, y, z]

n = 4;
coord = {t, x, y,z};

metric = {{-c^2 + vs[t]^2 f[t, x, y, z]^2, vs[t] f[t, x, y, z], 0, 
   0}, {vs[t] f[t, x, y, z], 1, 0, 0}, {0, 0, 1, 0}, {0, 0, 0, 1}};

inversemetric = Simplify[Inverse[metric]];

affine := 
  affine = Simplify[
         s]]*(D[metric[[s, j]], coord[[k]]] + 
          D[metric[[s, k]], coord[[j]]] - 
          D[metric[[j, k]], coord[[s]]]), {s, 1, n}], {i, 1, n}, {j, 
      1, n}, {k, 1, n}]];

listaffine := 
  Table[If[UnsameQ[affine[[i, j, k]], 
     0], {ToString[\[CapitalGamma][i - 1, j - 1, k - 1]], 
     affine[[i, j, k]]}], {i, 1, n}, {j, 1, n}, {k, 1, j}];
TableForm[Partition[DeleteCases[Flatten[listaffine], Null], 2], 
 TableSpacing -> {2, 2}]

Figure 1


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.