Problem with permutation routine when using xTensor/xCoba

67 views
Skip to first unread message

Marco Schreck

unread,
Mar 31, 2025, 11:35:29 AM3/31/25
to xAct Tensor Computer Algebra
Dear all,

I have been using xTensor for some years and recently I have encountered the following problem. I am providing a minimal working example that reproduces the issue on my machine. I am using a MaxBook Air M2 with macOS Ventura 13.2.1 and Mathematica 13.3.0.0.

================== CODE ==================

<< xAct`xTensor`
<< xAct`xCoba`

$PrePrint = ScreenDollarIndices;
$LargeComponentSize = 10^4

DefManifold[M4, 4, {\[Alpha], \[Beta], \[Gamma], \[Delta], \
\[Epsilon], \[Iota], \[Kappa], \[Lambda], \[Mu], \[Nu], \[Chi], \
\[Rho], \[Sigma], \[Upsilon], \[Psi], \[Xi], \[Omega]}]
coords = {t[], r[], \[Theta][], \[Phi][]};
DefScalarFunction[a, PrintAs -> "a"];
MatrixForm[
  gmatrix =
   DiagonalMatrix[{-1, a[t[]]^2, a[t[]]^2 r[]^2,
     a[t[]]^2 r[]^2 Sin[\[Theta][]]^2}]];

DefChart[ch, M4, {0, 1, 2, 3}, coords, ChartColor -> Blue];
g = CTensor[gmatrix, {-ch, -ch}];
SetCMetric[g, ch, SignatureOfMetric -> {3, 1, 0}];
CD = CovDOfMetric[g];

Exp1 = Simplification[
 CD[-\[Rho]][Ricci[CD][-\[Alpha], -\[Beta]]] -
  CD[-\[Beta]][Ricci[CD][-\[Alpha], -\[Rho]]]]

Exp2 = Simplification[
 CD[-\[Mu]][Riemann[CD][\[Mu], -\[Alpha], -\[Beta], -\[Rho]]]]

Exp3 = Simplification[
 CD[-\[Rho]][Ricci[CD][-\[Alpha], -\[Beta]]] -
  CD[-\[Beta]][Ricci[CD][-\[Alpha], -\[Rho]]] +
  CD[-\[Mu]][Riemann[CD][\[Mu], -\[Alpha], -\[Beta], -\[Rho]]]]
 
================== CODE ==================

Evaluating the expressions Exp1 and Exp2 provides results that are equal apart from a global sign. Thus, adding them should produce 0. However, doing so explicitly in Exp3 produces a cryptic error message by a permutation routine.

================== ERROR ==================

During evaluation of In[24]:= TranslatePerm::invalid: InversePerm[xAct`xPerm`Private`MLCanonicalPerm[{1,2,3,4,5},5,xAct`xPerm`Private`tosgslist[xAct`xTensor`Private`Symmetry1D[xAct`xPerm`Private`MathToxPermSym[ZeroSymmetric[{}]],{\[FilledCircle]1->-\[Alpha],\[FilledCircle]2->-\[Beta],\[FilledCircle]3->-\[Rho]}],3,True],{1,2,3},{},{},{},{},{}]] is not a valid permutation.

During evaluation of In[24]:= Throw::nocatch: Uncaught Throw[Null] returned to top level.

Out[24]= Hold[Throw[Null]]

================== ERROR ==================

This is already the second time that I am facing a problem of this kind. I googled it and did not find much except some quite old messages from the era 2008 - 2011. It is indicated that there may be a problem with MathLink and one may have to recompile certain files. Now, given that it is 2025 and I have not encountered recent messages, can this still be the issue here?

Thanks for any support.

Kind regards,

Marco

Jose

unread,
Apr 2, 2025, 12:06:46 AM4/2/25
to xAct Tensor Computer Algebra
Hi,

Thanks for reporting this. I see the problem too, and I need to investigate.

ToCanonical, or Simplification (which is ToCanonical followed by Simplify) should not be used on CTensor objects unless you have scalar components which are themselves contractions of symbolic tensors. Once you have CTensor objects, just use Simplify. If you change your Simplification commands to Simplify, you will get the zero result you expect.

Cheers,
Jose.

Marco Schreck

unread,
Apr 3, 2025, 10:24:27 PM4/3/25
to xAct Tensor Computer Algebra
Dear José,

thank you very much for your reply and for looking into this. Indeed, things work out when using Simplify[]. Simplification[] seems to work in any other case, too, except when the result is the zero tensor.

xAct has been very valuable for my research for several years. There are so many subtleties that one is supposedly only aware of as a programmer of one or more of these packages.

Best regards,

Marco

Reply all
Reply to author
Forward
0 new messages