1
$\begingroup$

I would like to define a tensor $A_i^j$ which is traceless ($A_i^i = 0$) and to obtain $A_i^j \delta^i_j = 0$ with xAct / xTensor / xCoba.

I first tried defining an antisymmetric tensor, since they are automatically traceless, but the final answer of the following code is not zero, but still $A_i^j \delta^i_j$.

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

dim = 3;

DefManifold[M, dim, {i, j, k, l, a, b, c, d}]

DefChart[ch, M, {1, 2, 3}, {x[], y[], z[]}, ChartColor -> Red]

metric = CTensor[DiagonalMatrix[{1, 1, 1}], {-ch, -ch}]

SetCMetric[metric, ch, SignatureOfMetric -> {2, 0, 0}]

DefTensor[A[-i, -j], M, Antisymmetric[{-i, -j}]]

A[-i, -j] metric[i, j]
  1. How can I obtain the answer 0 for the above code?

  2. And how can I define a general traceless tensor, not necessarily antisymmetric?

$\endgroup$
1
  • 1
    $\begingroup$ I ask questions about xact on the xact google group. I searched for traceless in the conversation and found this discussion. I did not check if it could help you but maybe you could look at the other questions in the conversation (first link). $\endgroup$ Oct 19, 2022 at 18:34

1 Answer 1

1
$\begingroup$

You just need to be careful when combining the abstract tensor in $xTensor$ defined by the DefTensor function and you coordinate chart defined in $xCoba$ you can use the following code to attain the right result

A[{a, ch}, {b, ch}] // ComponentArray // ComponentValue // Flatten
A[{a, ch}, {b, ch}] metric[{-a, -ch}, {-b, -ch}] // ContractBasis // ToValues

Which results in the expected $0$.

To make a traceless tensor you can define the tensor as normal and then add a rule

DefTensor[ T[-a,-b], M ];
TFRule = MakeRule[ { T[a,-a], 0 }, PatternIndices->All, MetricOn->All ]; 

Which can be used as any other rule, i.e.

T[a, -a] /. TFRule

results in $0$.

One can also define the rule

TFchRule = Sum[T[{i, ch}, {i, ch}], {i, dim}] -> 0

which works with explicit coordinates in a specific chart, as with A above

T[{a, ch}, {b, ch}] // ComponentArray // ComponentValue // Flatten
T[{a, ch}, {b, ch}] metric[{-a, -ch}, {-b, -ch}] // ContractBasis // ToValues
% /. TFchRule

which returns $0$ as well

$\endgroup$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.