How do I perform the following summation in mathematica? \begin{equation} \Sigma_{m=1}^5 e_{ijklm}A^{mn} \end{equation} I have the $e_{ijklm}$ tensor of rank 5 in 5 dimension as a array and $A^{mn}$ as a 5x5 matrix.


1 Answer 1


Since the sum goes over the last index of $e$ and the first index of $A$, it is directly done by using Dot:

dim = 5;

e = Array[\[ScriptE], Table[dim, {dim}]];

a = Array[\[ScriptA], Table[dim, {2}]];

c = e.a;

Here I defined the arrays with the appropriate dimensions but suppressed the output because it's too long for five dimensions.

Another interesting alternative for more general sums is what I mentioned in this answer, but it requires version 9:

TensorContract[TensorProduct[e, a], {dim, dim+1}] == c


Here the {dim, dim+1} are just the last index of the first factor and the first index of the second factor. The latter can be generalized to sums over say k etc.


Your Answer

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

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