Inverse of a tensor in xAct

124 views
Skip to first unread message

Joseph Johnson

unread,
Jun 27, 2020, 11:57:22 AM6/27/20
to xAct Tensor Computer Algebra
I am trying to define a tensor which is the inverse of a predefined tensor. Is it possible to do so in xAct? If yes, how does one go about doing it?

Thanks
Joseph 

Jose

unread,
Jul 4, 2020, 7:34:53 PM7/4/20
to xAct Tensor Computer Algebra
Hi,

In xTensor there is only a predefined concept of inverses for metrics, via the Inv command. For other cases you need to define your own inversion rules. It would be something like this:

Imagine you have a 2-tensor t:

   DefManifold[M, 4, {a, b, c, d}]
   DefTensor[t[-a, b], M]

Then you can introduce its inverse it as:

   DefTensor[it[-a, b], M]

   it /: it[-a_, b_] t[-b_, c_] := delta[-a, c];
   it /: t[-a_, b_] it[-b_, c_] := delta[-a, c];

Now you can do things like:

   In[13]:= it[-b, d] (3 t[-d, a] - it[-d, c] t[-c, a]) // Expand
   Out[13]= 3  delta[-b, a] - it[-b, a]

If you had started with a tensor t[-a, -b], then its inverse would be of the form it[b, c], and so on. If there is a metric, or the tensor has symmetries, you many need a few more definitions.

Is this the type of thing you wanted? Ask again if not.

Cheers,
Jose.

Max Banados

unread,
Jan 2, 2025, 12:53:37 PM1/2/25
to xAct Tensor Computer Algebra
Dear all, 
Following this question I am trying to define the derivative of the inverse. Something like:

it /: PD[-a_]@it[-b_,c_] := - it[-b,d] PD[-a]@t[-d,e] it[-e,c] 

However, the two dummy indices at the right  -d and e create problems in other calculations.
Is there a way to protect these indices?  

I tried using MakeRule but that option ask me for a metric, that I don't have. 

Any ideas?  Thanks
Max

Jose

unread,
Feb 3, 2025, 2:17:17 PM2/3/25
to xAct Tensor Computer Algebra
Hi,

There are two potential problems you may want to address in your definition.

1) To avoid repeated indices, we use Module constructions on the rhs of the definitions, with the list of dummy indices:

<< xAct`xTensor`
$PrePrint = ScreenDollarIndices;
DefManifold[M, 4, {a, b, c, d, e}]

DefTensor[t[-a, b], M]
DefTensor[it[-a, b], M]

it /: PD[-a_]@it[-b_, c_] := Module[{d, e}, -it[-b, d] PD[-a]@t[-d, e] it[-e, c]]

Then even repeating the indices will be OK, because they will be changed by dollar-indices and be renamed in output:

In[12]:= PD[-d][it[-b, e]]
Out[12]= - it[-b, a]  it[-c, e]  PD[-d][t[-a, c]]

2) The second question is that you may want to protect your inputs so that the definitions only work for the required characters (covariant or contravariant). For example the previous definition will fire for PD[-d][it[-b, -c]], but we don't want it, because there is no metric. We typically use _Symbol indices to ensure only true symbols are accepted in general patterns like c_. It would then be:

it /: PD[-a_]@it[-b_, c_Symbol] := Module[{d, e}, -it[-b, d] PD[-a]@t[-d, e] it[-e, c]]

You can also use -a_Symbol and -b_Symbol for consistency, but the truth is that the - sign already takes care of that point.

Cheers,
Jose.
Reply all
Reply to author
Forward
0 new messages