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.
Asked
Active
Viewed 604 times
1 Answers
7
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.