Thanks for the explanation. I figured it had to work like that, but
for some reason it didn't. Turns out it doesn't work if you load xPert
first. Can this be remedied?
Cheers,
Teake
If I may ask, why do you have to deal explicitly with Christoffels? In
your earlier email, you said that you were getting equations of motion
from different Lagrangians. If your are doing metric variation and you
have a Lagrangian built only out of the metric, its determinant, a
metric-compatible connection, and the curvature tensors of that
connection, then you should not have to encounter Christoffel.
What you do is something like this (of course, feel free to ignore my
example if I am guessing wrong about what it is you're doing! but
somebody else may find this code useful):
Needs["xAct`xPert`"];
DefManifold[M, 4, IndexRange[a, q]];
DefMetric[-1, met[-a, -b], CD, PrintAs -> "g", WeightedWithBasis -> AIndex];
DefMetricPerturbation[met, metpert, eps];
PrintAs[metpert] ^= "h";
DefConstantSymbol /@ {c1, c2, c3};
L = Sqrt[-Detmet[]] (c1 RicciScalarCD[] + c2 RicciScalarCD[]^2 + c3
RicciCD[-a, -b] RicciCD[a, b]);
Lpert = ToCanonical@ContractMetric@ExpandPerturbation@Perturbation@L;
VarL = VarD[metpert[LI[1], a, b], CD][Lpert]/Sqrt[-Detmet[]] /.
delta[-LI[1], LI[1]] -> 1 // ContractMetric // SortCovDs //
ToCanonical;
PreferDivOfRule[ tens_ ] := {
expr : (CD[ a_]@CD[b_]@inside_) :> CommuteCovDs[expr, CD, {b, a}] /;
(! FreeQ[inside, tens[___, -a, ___]]),
expr : (CD[-a_]@CD[b_]@inside_) :> CommuteCovDs[expr, CD, {b, a}] /;
(! FreeQ[inside, tens[___, a, ___]])};
EOM = (0 == Collect[
VarL /. PreferDivOfRule[RicciCD] // RicciToEinstein //
EinsteinToRicci // ContractMetric // ToCanonical,
{c1, c2, c3}])
> 0 == c1 (- RicciCD[-a, -b] + 1/2 met[-a, -b] RicciScalarCD[]) + c2 ( ... 4 terms ...) + c3 ( ... 5 terms ... )
No Christoffels appear in the above calculation, since the VarD is
with respect to the metric compatible derivative CD. You can prove to
yourself that this works with a scalar density action, as long as you
include the factor of Sqrt[-Detmet[]].
Cheers
Leo