Welcome to Cadabra Q&A, where you can ask questions and receive answers from other members of the community.
+2 votes

Let's use the Schwarzschild spacetime notebook as an example, using these lines:

{r,t,\phi,\theta}::Coordinate; 
{\mu,\nu,\rho,\sigma,\lambda,\kappa,\chi,\gamma}::Indices(values={t,r,\phi,\theta}, position=fixed);
\partial{#}::PartialDerivative; 
g_{\mu\nu}::Metric. 
g^{\mu\nu}::InverseMetric.
ss:= { g_{t t} = -(1-2 M/r), g_{r r} = 1/(1-2 M/r), g_{\theta\theta} = r**2, g_{\phi\phi}=r**2 sin(\theta)**2 }. 
complete(ss, $g^{\mu\nu}$);

So, we have $g_{\mu \nu}$ and $g^{\mu \nu}$ completely determined and we should be able to explicitly calculate its determinant and trace. How would one do it properly in Cadabra?

in General questions by (180 points)

1 Answer

+2 votes
 
Best answer

There's a Determinant property now which you can use together with complete to compute determinants, as in https://cadabra.science/manual/Determinant.html .

by (82.5k points)
selected by

How to calculate trace?

In the same way, e.g. in the above example

T::Trace(g_{m n});
complete(rl, $T$);

Note that this traces over lower indices (a trace over mixed indices would produce the dimension '3').

...