Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Given tensors and their indices, sum over repeated indices
ResourceFunction["EinsteinSummation"][indices,tensors] sums over repeated indices of the tensors. | |
ResourceFunction["EinsteinSummation"][indices→out,tensors] transposes the output if necessary so that the output tensor indices match out. |
Two explicit matrices:
In[1]:= | ![]() |
Contract the second indices of the two matrices:
In[2]:= | ![]() |
Out[2]= | ![]() |
Check:
In[3]:= | ![]() |
Out[3]= | ![]() |
Perform the contraction AikMjk for symbolic tensors A and M:
In[4]:= | ![]() |
Out[4]= | ![]() |
Perform the contraction AikMjk and transpose the output:
In[5]:= | ![]() |
Out[5]= | ![]() |
The indices can be any expression:
In[6]:= | ![]() |
Out[6]= | ![]() |
The number of index specifications must match the number of tensors:
In[7]:= | ![]() |
Out[7]= | ![]() |
If $Assumptions is used to define symbolic tensors, the number of indices must match the tensor rank:
In[8]:= | ![]() |
Out[9]= | ![]() |
This work is licensed under a Creative Commons Attribution 4.0 International License