How to specify the metric used by MakeRule?

333 views
Skip to first unread message

Benedict

unread,
Nov 27, 2020, 10:41:09 AM11/27/20
to xAct Tensor Computer Algebra
I have a 4D spacetime and a 3D (sub-)space. I defined two manifolds:

DefManifold[M, 4, IndexRange[a, n]]
DefManifold[M3, 3, IndexRange[\[Zeta], \[Omicron]]]

and two charts

DefChart[ch, M, {0, 1, 2, 3}, {t[], x[], y[], z[]},  ChartColor -> Purple]
DefChart[ch3, M3, {1, 2, 3}, {x[], y[], z[]}, ChartColor -> Green].

For both spaces I defined metrics:

4D:
DefScalarFunction[aa, PrintAs -> "a"](*Scale factor*)
bgmetricmatrix = aa[t[]]^2 {
    {-1, 0, 0, 0},
    {0, 1, 0, 0},
    {0, 0, 1, 0},
    {0, 0, 0, 1}
    };
bgmetric = CTensor[bgmetricmatrix, {-ch, -ch}];

3D:
bg3metricmatrix = {
   {1, 0, 0},
   {0, 1, 0},
   {0, 0, 1}
   };
bg3metric = CTensor[bg3metricmatrix, {-ch3, -ch3}];

I would like to use the 3D metric to calculate some additional vectors and tensors that will be part of a perturbed 4D metric. Therefore, I have not yet set the metric for my 4D chart, but I have set the metric for the 3D chart:

SetCMetric[bg3metric, ch3, SignatureOfMetric -> {3, 0, 0}]
bg3cd = CovDOfMetric[bg3metric];

Now, I have a vector living in 3D space:
DefTensor[Bv[\[Mu]], M3]

I want this vector to be divergence-free, so I tried using a rule:

DFbvRule = 
  MakeRule[{bg3cd[-\[Mu]][Bv[\[Mu]]], 0}, PatternIndices -> All, 
   MetricOn -> {\[Zeta], \[Eta], \[Theta], \[Iota], \[Kappa], \
\[Lambda], \[Mu], \[Nu], \[Xi], \[Omicron]}];
AutomaticRules[Bv, DFbvRule];

I also tried MetricOn -> All, MetricOn -> IndexRange[\[Zeta], \[Omicron]], and MetricOn -> bg3metric, but all give me a list of errors:












I assume this is because it tries to apply the rule in 4D space!?
How can I set the metric under which the rule applies? Or is it something else I am missing?

Thank you very much in advance! Have a great day!

Benedict

unread,
Nov 29, 2020, 10:01:23 AM11/29/20
to xAct Tensor Computer Algebra
Or maybe I should take a step back. What I actually want to achieve is a 4D flat FLRW metric + a first order perturbation in a scalar-vector-tensor decomposition:

g_mu_nu
=
a^2*
({{-1 , 0 , 0  , 0},
{0 , 1 , 0 , 0},
{0 , 0 , 1 , 0},
{0 , 0 , 0 , 1}}
+
a^2*
({{-2*A , B1        , B2       , B3},
{      B1 , 2*C11 , 2*C12 , 2*C13 },
{      B2 , 2*C21 , 2*C22 , 2*C23 },
{      B3 , 2*C31 , 2*C32 , 2*C33 } }

with A a scalar,
Bi = cd[i] b + Bv_i, b a scalar, cd[i] the derivative wrt the 3D background metric, and Bv_i a divergence-free vector,
Cij = Ct_ij + Cv_(i|j) + f*g_ij + y_|ij with Ct a traceless tensor, Cv a divergence-free vector, f a scalar, g_ij the 3D background metric, and y_|ij = cd[i][cd[j][y]] the derivative wrt the 3D background metric of a scalar.

I attached a notebook to show what I did so far. I had a couple of ideas on how to define the perturbed metric, but none worked out so far, so I hoped someone could help me with this step. Thank you very much in advance.
EoM_MWE.nb

Jose

unread,
Nov 30, 2020, 12:27:33 AM11/30/20
to xAct Tensor Computer Algebra
Hi,

Thanks for reporting this.

The error messages are due to a missing definition:

CCovD[cd_, Zero, _] := cd

Evaluate this before calling MakeRule and the error messages should disappear.

I have never seen CTensor/CCovD used inside MakeRule before, so I advise to check results as much as possible. Note that the combination of using MetricOn -> ... and nonstandard derivatives (CCoV) makes MakeRule nervous and it warns of "Potential problems moving indices on the LHS." This is just saying that indices could be moved inside covariant derivatives without checking that the derivative gives zero on the metric being used to move the indices.

Cheers,
Jose.

Benedict

unread,
Nov 30, 2020, 8:50:50 AM11/30/20
to xAct Tensor Computer Algebra
Thank you very much, Jose. I've seen, you've been busy answering questions here. :)

The error message disappears, when I set

SetCMetric[bg3metric, ch3, SignatureOfMetric -> {3, 0, 0}]
bg3cd = CovDOfMetric[bg3metric]
CCovD[cd_, Zero, _] := cd

but new ones appear:

DFcvRule = 
 MakeRule[{bg3cd[-\[Mu]][Cv[\[Mu]]], 0}, PatternIndices -> All, 
  MetricOn -> All]
AutomaticRules[Cv, DFcvRule]


{HoldPattern[
PDch3[-PatternTest[
Pattern[\[Mu], 
Blank[Symbol]], TangentM3`Q]][
Cv[
PatternTest[
Pattern[\[Mu], 
Blank[Symbol]], TangentM3`Q]]]] :> 
  Module[{}, 
   ContractMetric[
    ContractMetric[
     ContractMetric[0, 
      CTensor[{{1, 0, 0}, {0, 1, 0}, {0, 0, 1}}, {-ch3, -ch3}, 0]], 
     CTensor[{{1, 0, 0}, {0, 1, 0}, {0, 0, 1}}, {-ch3, -ch3}, 0]], 
    CTensor[{{1, 0, 0}, {0, 1, 0}, {0, 0, 1}}, {-ch3, -ch3}, 0]]], 
 HoldPattern[
PDch3[
PatternTest[
Pattern[\[Mu], 
Blank[Symbol]], TangentM3`Q]][
Cv[-PatternTest[
Pattern[\[Mu], 
Blank[Symbol]], TangentM3`Q]]]] :> 
  Module[{}, 
   ContractMetric[
    ContractMetric[
     ContractMetric[0, 
      CTensor[{{1, 0, 0}, {0, 1, 0}, {0, 0, 1}}, {-ch3, -ch3}, 0]], 
     CTensor[{{1, 0, 0}, {0, 1, 0}, {0, 0, 1}}, {-ch3, -ch3}, 0]], 
    CTensor[{{1, 0, 0}, {0, 1, 0}, {0, 0, 1}}, {-ch3, -ch3}, 0]]]}

   Rules {1,2} have been declared as UpValues for Cv.

And 

DFtRule = 
 MakeRule[{bg3cd[-\[Mu]][Ct[\[Mu], -\[Nu]]], 0}, 
  PatternIndices -> All, MetricOn -> All]
AutomaticRules[Ct, TFRule]

throws

** MakeRule: Potential problems moving indices on the LHS.


Hold[Throw[Null]]
AutomaticRules[Ct, TFRule]

If this is such an uncommon approach: maybe there is a better one to define a perturbed FLRW metric in a S-V-T decomposition?! Thank you very much, again. :)

Jose

unread,
Dec 1, 2020, 2:17:03 AM12/1/20
to xAct Tensor Computer Algebra
Hi again,

I don't get those errors. I'm using this code (with the new tarball of xAct that contains the new definition, and potentially other changes I've implemented since early 2020):

<< xAct`xCoba`

DefManifold[M3, 3, IndexRange[\[Zeta], \[Omicron]]]
DefChart[ch3, M3, {1, 2, 3}, {x[], y[], z[]}, ChartColor -> Green]

bg3metricmatrix = {{1, 0, 0}, {0, 1, 0}, {0, 0, 1}};
bg3metric = CTensor[bg3metricmatrix, {-ch3, -ch3}];

SetCMetric[bg3metric, ch3, SignatureOfMetric -> {3, 0, 0}]
bg3cd = CovDOfMetric[bg3metric];

DefTensor[Bv[\[Mu]], M3]
DFbvRule = MakeRule[{bg3cd[-\[Mu]][Bv[\[Mu]]], 0}, PatternIndices -> All, MetricOn -> All];
AutomaticRules[Bv, DFbvRule];

DefTensor[Cv[\[Mu]], M3]
DFcvRule = MakeRule[{bg3cd[-\[Mu]][Cv[\[Mu]]], 0}, PatternIndices -> All, MetricOn -> All];
AutomaticRules[Cv, DFcvRule]

If you still get errors, can you post full code to reproduce them?

Cheers,
Jose.

Benedict

unread,
Dec 1, 2020, 8:28:03 AM12/1/20
to xAct Tensor Computer Algebra
Please find attached a notebook that shows the errors. I tried first defining everything 3D-related and leaving everything 4D-related out, but the error remains. I also tried loading xCoba instead of xTras, but again, the error remains.
I set up mathematica on this machine, including xAct, no more than two months ago and took everything xAct related from xact.es. When loading xTras, e.g. xTensor v1.1.4 from 16 February 2020 gets loaded, so I assume I'm on the current version.
Thank you very much for your support. :)

EoM_MWE_v2.nb

Jose

unread,
Dec 2, 2020, 5:41:59 PM12/2/20
to xAct Tensor Computer Algebra
Hi again,

If I evaluate this with my current local xAct version I don't get any errors. I'd recommend to re-download and re-install xAct. Sometimes I commit small changes and update the tarballs without changing the versions of the packages, only the dates.

Cheers,
Jose.

Benedict

unread,
Dec 4, 2020, 10:08:38 AM12/4/20
to xAct Tensor Computer Algebra
I redownloaded xAct and the error disappeared! Thank you for your support. :)
Reply all
Reply to author
Forward
0 new messages