I'm trying to implement a Friedmann-Lemaître-Robertson-Walker metric + a perturbation in a scalar-vector-tensor split in mathematica, using xAct. The S-V-T decomposition comes with some rules for the vector and tensor parts, i.e. the vector is transverse and divergence-free and the tensor is transverse and traceless. How can I implement this?

Divergence-free Vector

Can I make a rule, before I set a metric and have the corresponding covariant derivative? I need to set it before, because it is part of the metric...

Doing it later gives me

DFBRule =   MakeRule[{cd[a][Bv[-a]], 0}, PatternIndices -> All, 
   MetricOn -> All];
** MakeRule: Potential problems moving indices on the LHS.
   Rules {1,1} have been declared as UpValues for Bv.

Traceless Tensor

DefTensor[Ct[a, b], M] knows only the argument symmetric, but not traceless. I thought, maybe, I could redefine it like


But this only throws a couple of errors:

First::nofirst: {} has zero length and no first element.
ToCanonical::noident: Unknown expression not canonicalized: First[{}][-a,-b] .
ToCanonical::noident: Unknown expression not canonicalized: First[{}][-a,-b] .
ChangeFreeIndices::error: Inconsistent number of free indices.
Throw::nocatch: Uncaught Throw[Null] returned to top level.

I also thought about

TFRule = MakeRule[{Ct[a, -a], 0}, PatternIndices -> All, 
   MetricOn -> All];
AutomaticRules[Ct, TFRule];

but I maybe there is a more direct approach to define vectors and tensors right away as divergence-free or trace-free. How can it be done? Thank you very much in advance for your reply!


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.