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

I enjoyed so much the example Beginners tutorial, that I wanted to try a similar example for General Relativity.

Despite the fact that I don't know how to define the square-root of the metric's determinant, I get a problem when trying to factorise the variation of the connection

Minimal Notebook

{\alpha,\beta,\gamma,\eta,\lambda,\kappa,\mu,\nu,\rho,\sigma,\tau,\chi#}::Indices(full, position=independent);
{\alpha,\beta,\gamma,\eta,\lambda,\kappa,\mu,\nu,\rho,\sigma,\tau,\chi#}::Integer(0..3);

x::Coordinate.
\delta{#}::Accent.

\partial{#}::PartialDerivative.
\partial{#}::SelfCommuting.

g_{\mu\nu}::Metric. 
g^{\mu\nu}::InverseMetric. 
g_{\mu? \nu?}::Symmetric. 
g^{\mu? \nu?}::Symmetric.

RtoG:= R^{\lambda?}_{\kappa?\mu?\nu?} ->  \partial_{\mu?}{ \Gamma^{\lambda?}_{\kappa?\nu?} }
- \partial_{\nu?}{ \Gamma^{\lambda?}_{\kappa?\mu?} }
+ \Gamma^{\lambda?}_{\eta\mu?} \Gamma^{\eta}_{\kappa?\nu?}
- \Gamma^{\lambda?}_{\eta\nu?} \Gamma^{\eta}_{\kappa?\mu?} ;

Gtog:= \Gamma^{\lambda?}_{\mu?\nu?} -> (1/2) * g^{\lambda?\kappa} ( \partial_{\nu?}{ g_{\kappa\mu?} } + \partial_{\mu?}{ g_{\kappa\nu?} } - \partial_{\kappa}{ g_{\mu?\nu?} } );

trG := { \Gamma^{\mu}_{\mu \rho?} -> \Gamma^{\mu}_{\nu \rho?} \delta^{\nu}_{\mu} , \Gamma^{\mu}_{\rho? \mu} -> \Gamma^{\mu}_{\rho? \nu} \delta^{\nu}_{\mu} };

ddelta := { \partial_{\alpha?}{ \delta^{\mu?}_{\nu?} } -> 0, \partial_{\alpha?}{ \delta_{\mu?}^{\nu?} } -> 0 };

GR :=  \int{ g^{\mu \nu} R^{\lambda}_{\mu \lambda \nu} }{ x };
substitute( GR, RtoG )
substitute(GR, trG, repeat=True)
product_rule(GR)
substitute(GR, ddelta)
vary( GR, $\Gamma^{\mu?}_{\nu? \rho?} -> \delta{\Gamma^{\mu?}_{\nu? \rho?}}$);

distribute(_)
integrate_by_parts(_, $\delta{\Gamma^{\mu?}_{\nu? \rho?}}$)
substitute(GR, ddelta)
collect_terms(_);

factor_out(GR, $\delta{\Gamma^{\mu?}_{\nu? \rho?}}$);

Everything seems OK, until the last line, which returns a RuntimeError: Free indices in different terms in a sum do not match.

Questions

  • Is there an analogous of the rename_indices, from Cadabra 1.x, which allows to factorise the variations?
  • How could one define the square-root of the metric's determinant?
asked in General questions by (6.3k points)

Have you already found a solution for your first question? I am also stuck with a similar problem in Cadabra 1.x.
http://cadabra.science/qa/35/factor_out-algorithm-and-unequal-indices

Please log in or register to answer this question.

...