Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Simplify expressions containing a symbolic identity tensor
ResourceFunction["IdentityTensorReduce"][expr] converts TensorContract expressions containing symbolic identity tensors into equivalent forms with the identity tensors removed. |
A simple tensor contraction of a tensor with an identity matrix:
| In[1]:= |
| Out[1]= |
TensorReduce does not simplify the tensor:
| In[2]:= |
| Out[2]= |
IdentityTensorReduce simplifies the tensor:
| In[3]:= |
| Out[3]= |
Use Inactive when the dimensions of the identity tensor are explicit:
| In[4]:= |
| Out[4]= |
IdentityTensorReduce simplifies the tensor:
| In[5]:= |
| Out[5]= |
A tensor expression involving SymbolicIdentityArray:
| In[6]:= |
| Out[7]= |
IdentityTensorReduce simplifies the tensor:
| In[8]:= |
| Out[8]= |
Define assumptions for a matrix X and scalars a, b and c:
| In[9]:= |
| In[10]:= |
A tensor expression involving the identity tensor:
| In[11]:= | ![]() |
| Out[11]= |
Contract this tensor with another tensor:
| In[12]:= |
| Out[12]= | ![]() |
Expand the tensor into a sum of tensors:
| In[13]:= |
| Out[13]= | ![]() |
Use IdentityTensorReduce to eliminate contracted identity tensors:
| In[14]:= |
| Out[14]= |
The ResourceFunction "FromTensor" can be used to rewrite this expression in terms of Dot:
| In[15]:= |
| Out[15]= |
This work is licensed under a Creative Commons Attribution 4.0 International License