5
$\begingroup$

I have a very simple question about TensorContract command: I'm declaring

$Assumptions = {T \[Element] Arrays[{4, 4, 4, 4}], a \[Element] Arrays[{4, 4}], b \[Element] Arrays[{4, 4}]};

so T is a rank 4 tensor a and b are two rank two tensors. Now I want to do the tensor product and contract them this way

fc=TensorContract[TensorProduct[T, a, b], {{1, 5}, {2, 6}, {3, 7}, {4, 8}}]];

this mean tha all indices are contracted, that is TensorRank[fc]=0. Now I want to do the same operation firstly contractin T with a and then to contract the result, that is a rank 2 tensor with b:

c = TensorContract[TensorProduct[T, a], {{1, 5}, {2, 6}}]];

infact TensorRank[c]=2, now as a rank 2 tensor I would like to contract this wit b

d = TensorContract[TensorProduct[c, b], {{1, 3}, {2, 4}}];

this gives a rank 0 tensor, infact TensorRank[d]=0. Now if I type

d // TensorReduce

I get the error message:

"Contractions {{1,5},{2,6},{3,5},{4,8}} contain repeated levels.

What is happening? How can I do this operation correctly?

$\endgroup$
1
  • $\begingroup$ For other readers, or in case it is still helpful to you: I get no error message running this in Mathematica 12.1, and the result for the reduction of d seems to be equal to fc, up to an inconsequential reordering T a b -> a b T. $\endgroup$
    – Stijn
    Dec 9, 2020 at 16:37

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.

Browse other questions tagged or ask your own question.