I want to compute the Christoffel-symbol for a given metric. I am using the code here, but I am missing something.
The Chrisfoffel-symbol formula is
$\Gamma^{\mu}_{\phantom{\mu}\nu\sigma}=\frac{1}{2}g^{\mu\alpha}\left\{\frac{\partial g_{\alpha\nu}}{\partial x^{\sigma}}+\frac{\partial g_{\alpha\sigma}}{\partial x^{\nu}}-\frac{\partial g_{\nu\sigma}}{\partial x^{\alpha}}\right\}\quad$
The metric is given to be
$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} $
The provided solution is:
$\Gamma^{1}_{22}=-r$
$\Gamma^{1}_{33}=-r\sin^2(\theta)$
$\Gamma^{2}_{21}=\frac{r}{b^2+r^2}$
$\Gamma^{2}_{33}=-\cos(\theta)\sin(\theta)$
$\Gamma^{3}_{31}=\frac{r}{b^2+r^2}$
$\Gamma^{3}_{32}=\cot(\theta)$
The code I'm using is
xx = {t, x, \[Theta], \[Phi]};
g = { {1,0,0,0},
{0,r^2+b^2,0,0},
{0,0,(r^2+b^2)Sin[\[Theta]]^2,0},
{0,0,0,-1}};
inversemetric = Simplify[Inverse[metric]];
ChristoffelSymbol[g_, xx_] :=
Block[{n, ig, res},
n = 4; ig = InverseMetric[ 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}];
Simplify[ res]
]
But I do not get the desired answer.
What am I missing? Besides, I'd like to learn how could I display the answer once I know how to actually get it.
Note I also checked Artes' solution here but I do not get how to run the code either.
EDIT
After playing around a bit with the Christoffel symbols (which is much more fun when you use Mathematica ;)) I've realized of several features:
If the metric is diagonal then the only way to get a non-zero Christoffel symbol is when any of the indices appears at least twice.
If the metric is diagonal we cannot have any index appearing three times yielding a non-trivial Christoffel symbol. The reason is because $g_{rr}$ is independent of $r$, $g_{\theta \theta}$ is independent of $\theta$, $g_{\phi \phi}$ is independent of $\phi$ and $g_{tt}$ is independent of $t$, which implies $\partial_{\mu} g_{\nu \rho}=0$ when $\mu=\nu=\rho$
Based on 1. and 2. we conclude that (when the metric is diagonal) all non-trivial Christoffel symbols must show repeated indices exactly twice.
inversemetric
that involves an expressionmetric
, butmetric
is undefined and should probably beg
, just above. Further, in the body ofChristoffelSymbol
there is reference to a function calledInverseMetric
(note the capitalization and the arguments in hard brackets) but this function is also undefined. It should maybe just beinversemetric
...? $\endgroup$metric
defined,g
stands for the metric. $\endgroup$sol = ChristoffelSymbol[g, xx]
and then call out a specific solution, for instancesol[[1, 2, 2]]
. $\endgroup$