Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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

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

True

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

 
discard

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.