xPert on VBundle metric

53 views
Skip to first unread message

Max Banados

unread,
Jul 23, 2025, 1:08:32 PMJul 23
to xAct Tensor Computer Algebra
Dear All, 
I am trying to do perturbative calculations with a metric defined on a VBundle.  
I can't get xPert to expand the perturbations of functions of the VBundle metric. 
I attach simple notebook. Any help will be appreciated! Regards, Max
xpert-vbundle.nb

Juan Margalef

unread,
Aug 2, 2025, 1:30:26 PMAug 2
to xAct Tensor Computer Algebra
Hi Max,

Indeed, xPert is not trained to handle VBundle metrics (they were introduced after xPert was released, and I guess it has not been updated). You can use:

DefMetricVBundlePerturbation[g, h, \[Epsilon]]

where DefMetricVBundlePerturbation is simply DefMetricPerturbation, but removing the parts related to the CovD (that throws the error of your notebook that makes DefMetricPerturbation halt):

DefMetricVBundlePerturbation[metric_, pert_Symbol, param_Symbol : Automatic,options___?OptionQ] :=Module[{vbundle, manifold, indices, pa},
   {pa} = {PrintAs} /. CheckOptions[options] /.  Options[DefMetricPerturbation];
   
   (* Check of metric *)
   If[! MetricQ[metric],Throw@Message[DefMetricPerturbation::unknown, "metric", metric]];

   (* Define parameter if it does not exist yet *)
   If[! ParameterQ[param],
    If[param === Automatic,
     DefParameter[GiveSymbol[PerturbationParameter, metric],PrintAs :> GiveOutputString[PerturbationParameter, metric]],
     DefParameter[param]
     ]
    ];
   
   vbundle = VBundleOfMetric[metric];
   manifold = BaseOfVBundle[vbundle];
   indices = GetIndicesOfVBundle[vbundle, 2];
   DefTensorPerturbation[pert[LI["order"], -indices[[1]], -indices[[2]]],metric[-indices[[1]], -indices[[2]]],DependenciesOfTensor[metric], Symmetric[{2, 3}], PrintAs -> pa];
   $PerturbationParameter = param;
   
   (* Define perturbation definitions *)
   Unprotect[Perturbation, GeneralPerturbation];
   With[{a = indices[[1]], b = indices[[2]]},
    xAct`xPert`Private`DefGenPertInvMetric[vbundle, metric[a, b],pert];
    xAct`xPert`Private`DefGenPertDet[vbundle, metric, pert];
    xAct`xPert`Private`DefGenPertInvMetric[vbundle, metric[a, b],pert];
    ];
   Protect[Perturbation, GeneralPerturbation];
   
   ]; 

More elegant would be to modify xPert so that the same function DefMetricPerturbation handles both cases, but this solution should be good enough, and I hope this helps!

Max Banados

unread,
Aug 2, 2025, 9:53:48 PMAug 2
to xAct Tensor Computer Algebra
Dear Juan, thanks a lot.   
You solution is well above my level of Mathematica/xTensor but I copied and paste your code to my Notebook and it worked, indeed. 
Thank you, 
Max

Juan Margalef

unread,
Aug 2, 2025, 10:33:45 PMAug 2
to xAct Tensor Computer Algebra
I am glad!!

Just for future reference, what I did was to take the file xPert.nb, look for DefMetricPerturbation and erase all the lines that make reference to the CovD and the curvature tensors :D The only thing one has to be careful about is when the functions are not public (the ones that remain blue when you copy the code from the package to your notebook), you have to add  xAct`xPert`Private`

Best,
Juan   
Reply all
Reply to author
Forward
0 new messages