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$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.