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

I took the example from the website and changed it slightly. Now I get an error ("Power with free indices not allowed"). What am I doing wrong?

{u,r,\phi,\theta}::Coordinate;
{\mu,\nu,\rho,\sigma,\lambda,\kappa,\chi,\gamma}::Indices(values={u,r,\phi,\theta}, position=fixed);
\partial{#}::PartialDerivative;
g_{\mu\nu}::Metric.
g^{\mu\nu}::InverseMetric.

ss:= { g_{u u} = -(1-r^2/l^2),   
       g_{u r} = -1, 
       g_{r u} = -1, 
       g_{\theta\theta} = r**2, 
       g_{\phi\phi}=r**2 \sin(\theta)**2
     }.
complete(ss, $g^{\mu\nu}$);

ch:= \Gamma^{\mu}_{\nu\rho} = 1/2 g^{\mu\sigma} ( 
                                   \partial_{\rho}{g_{\nu\sigma}} 
                                  +\partial_{\nu}{g_{\rho\sigma}}
                                  -\partial_{\sigma}{g_{\nu\rho}} ):
evaluate(ch, ss, rhsonly=True);
in General questions by (170 points)

1 Answer

+2 votes
 
Best answer

You wrote $r^2$ as r^2 (in the definition of $g_{u u}$), which means "$r$ with superscript index 2". Write it as r**2. Ditto for $l^2$.

by (76.7k points)
selected by

oh perfect. thanks for the quick answer.

...