Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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