Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Given a metric, convert between covariant and contravariant components of a tensor
ResourceFunction["TensorIndexJuggling"][tensor,metric] uses metric to convert tensor, having only covariant components (lower indices), into the corresponding tensor with all contravariant components (upper indices). | |
ResourceFunction["TensorIndexJuggling"][tensor,metric,"From"→"AllContravariant","To"→"AllCovariant"] converts tensor, having only contravariant components, into the corresponding tensor with all covariant components. | |
ResourceFunction["TensorIndexJuggling"][tensor,metric,"From"→spec1,"To"→spec2] transforms between upper and lower indices as indicated by "From" and "To". |
Transform a covariant rank-2 tensor in a cylindrical coordinate system to its contravariant form tij→tij:
In[1]:= |
Out[1]= |
Transform a covariant rank-2 tensor in cylindrical coordinates to its mixed form tij→tij:
In[2]:= |
Out[3]= |
Convert tij→tij for a SymmetrizedArray:
In[4]:= |
Out[4]= |
Attempting the conversion tij→tij changes nothing:
In[5]:= |
Out[8]= |
Start with a covariant base:
In[9]:= |
Get the contravariant base through raising the index:
In[10]:= |
Out[10]= |
Check the orthonormality relationship gi·gj=δij:
In[11]:= |
Out[11]= |
Start with the metric for cylindrical coordinates in Euclidean space:
In[12]:= |
Out[10]= |
Get the contravariant components of the metric:
In[13]:= |
Out[11]= |
This result is the same as the Wolfram Language built-in function:
In[14]:= |
Out[15]= |
In[16]:= |
Out[17]= |
Start with the metric for cylindrical coordinates in Euclidean space:
In[18]:= |
Out[73]= |
Define a Cartesian rank-2 tensor:
In[74]:= |
Out[75]= |
Contract the indices:
In[76]:= |
Out[76]= |
Use the resource function TensorCoordinateTransform to transform t to cylindrical coordinates with covariant transformation behavior tij:
In[77]:= |
Out[129]= |
Contraction should not be invariant:
In[130]:= |
Out[130]= |
But contraction of opposing indices should be:
In[131]:= |
Out[131]= |
Start with a rank-6 tensor in a Cartesian basis and form the contraction tijkijkl:
In[132]:= |
Out[132]= |
Transform to an different affine system with given mapping:
In[133]:= |
Contraction of the indices of the same type does not lead to an invariant:
In[134]:= |
Out[134]= |
Contraction of the right opposing index pairs, after index juggling, leads to the same result as in the original coordinate system:
In[135]:= |
Out[135]= |
If the mapping rule between the two coordinate frames exists, index juggling can also be done using the resource function TensorCoordinateTransform. However, if only the metric of the space is available, then TensorIndexJuggling is recommended:
In[136]:= |
Out[136]= |
This work is licensed under a Creative Commons Attribution 4.0 International License