# Wolfram Function Repository

Instant-use add-on functions for the Wolfram Language

Function Repository Resource:

Transform components of tensors with arbitrary rank with regard to their transformation behavior under any given mapping

Contributed by:
Lars Ulke-Winter

ResourceFunction["TensorCoordinateTransform"][ transform |

Generally *tensor* components (with mixed *n*×*m*-rank) transform from one system to another (*i*→*i*') according to .

The mapping from the old system to the new one is described in the matrix for covariant transformation behavior (tensor components with lower indices) and for so-called contravariant tensor components (depicted with superscript indices).

Summation must be done for the same but opposing indices about the dimensions of the tensor coordinates. The fundamental relationship of the contrary transformation behavior ensures invariance of the tensor object *T* in all systems after contracting all opposing indices (e.g. ). Due to this fact, a distinction of covariant and contravariant transformation behavior is not required in transformation relations with , e.g. in transformations between orthonormal reference systems.

The resulting format is always a normal List.

Unlike TransformedField, the ResourceFunction["TensorCoordinateTransform"] result is not given with respect to a normalized basis by default. Using the option Normalize → True forces a normalized basis.

The matrix *mat** *defines the mapping between two coordinate systems (often their transposed Jacobian).

The following options are supported:

"TransformationBehavior" | "AllContravariant" | transformation behavior of individual components |

"Normalize" | False | whether the components are represented with respect to a normalized basis |

Values allowed by the option "TransformationBehavior" include "AllContravariant", "AllCovariant" and {"Con","Cov",…}.

Apply a rotation transformation to a tensor:

In[1]:= |

Out[1]= |

Rotate vector components about the three axes counterclockwise:

In[2]:= |

Out[2]= |

Change the axis:

In[3]:= |

Out[3]= |

Rotate the rank-2 tensor about the three axes counterclockwise:

In[4]:= |

Out[4]= |

Rotate a rank-4 tensor with three symmetries about the three axes counterclockwise:

In[5]:= |

Out[6]= |

The contravariant vector components with respect to covariant bases are *a*=*v*^{j}*b*_{j}=*v*^{i'}*b*_{i'}. The old system is Cartesian (*a*^{j}=*v*^{j}):

In[7]:= |

Consider a transformation between new *e*_{i'} and old *e*_{j} covariant base vectors *e*_{1'}=2*e*_{1}+3*e*_{2}+1*e*_{3}, *e*_{2'}=1*e*_{1}+2*e*_{2}+2*e*_{3} and *e*_{3'}=1*e*_{1}+2*e*_{3}. Here are the contravariant components *v*^{i'} of the new system:

In[8]:= |

Out[8]= |

They should be the same vector:

In[9]:= |

In[10]:= |

Out[10]= |

In[11]:= |

Out[11]= |

The covariant vector components with respect to contravariant bases are *a*=*v*^{j}*b*_{j}=*v*_{i'}*b*^{j'}

In[12]:= |

Out[12]= |

Find related contravariant base vectors *b*^{i'} by transforming the covariant base in contravariant sense (index juggling *b*_{i'}→*b*^{i'}):

In[13]:= |

Out[13]= |

In[14]:= |

Out[14]= |

In[15]:= |

Out[15]= |

Note that covariant and contravariant base vectors are inverse to each other *b*_{i'}*b*^{j'}=*δ*_{i'}^{j'}:

In[16]:= |

Out[16]= |

Consider the *a*^{i}*b*_{i}≡*c*^{ijkl}*s*_{kl}*t*_{j}*b*_{i}=*c*^{i'j'k'l'}*s*_{k'l'}*t*_{j'}*b*_{i'}≡*a*^{i'}*b*_{i'}-invariant tensors in Cartesian frame:

In[17]:= |

The transformation from Cartesian to local torus coordinates (*i*→*i*'):

In[18]:= |

The torus surface at * α*=

In[19]:= |

Out[19]= |

Transform tensors' different ranks regarding the local torus base with respect to transformation behavior. This is faster than transformation of an entire assembled rank-7 tensor):

In[20]:= |

Local covariant base vector *b*_{i'}:

In[21]:= |

Assemble the tensor term by contracting the right indices *c*^{i'j'k'l'}*s*_{k'l'}*t*_{j'}*b*_{i}≡*a*^{i'}*b*_{i'}:

In[22]:= |

Out[22]= |

In[23]:= |

Out[23]= |

The result should be the same in the Cartesian system:

In[24]:= |

Out[24]= |

If the base vectors are not normalized ("Normalize"→False), i.e. if they have local-dependent lengths (and are not orthogonal in general reference systems either), the corresponding tensor components are transformed according to their co- and contravariant transformation behaviors. This leads to different representations of the same tensor object.

Here is an example of all four transforming possibilities of a rank-2 tensor to a local, non-normalized cylindrical system:

In[25]:= |

All coordinates transform the contravariant *t*^{ij} (default):

In[26]:= |

Out[26]= |

All coordinates transform the covariant *t*_{ij}:

In[27]:= |

Out[27]= |

A tensor object with coordinates of mixed-transformation behavior *t*_{i}^{j}:

In[28]:= |

Out[28]= |

A tensor object with coordinates of opposite mixed-transformation behavior *t*_{j}^{i}:

In[29]:= |

Out[29]= |

Nomenclature referencing all indices together or each index separately is interchangeable:

In[30]:= |

Out[30]= |

This is analogous for the covariant transformation:

In[31]:= |

Out[31]= |

Transformed contravariant vector components with respect to normalized base vectors:

In[32]:= |

Out[32]= |

The same transformed contravariant vector components with respect to non-normalized base vectors (default):

In[33]:= |

Out[33]= |

Transformed covariant normalized base vectors:

In[34]:= |

Out[34]= |

The contraction of the assigned tensors should be produce invariance:

In[35]:= |

Out[35]= |

Tensor components with respect to an orthonormal cylindrical system:

In[36]:= |

Out[35]= |

TransformedField also assumes a normalized base:

In[37]:= |

Out[37]= |

In[38]:= |

Out[38]= |

With orthonormal reference systems (e.g. normalized cylindrical systems), no distinction between co- and contravariant transformation behavior is required:

In[39]:= |

Out[39]= |

In[40]:= |

Hook's general law describes a linear relationship between the components of the rank-2 stress tensor * σ* and the two-stage strain tensor

Components of the general, fully anisotropic stiffness tensor with initial symmetries:

In[41]:= |

Out[37]= |

The number of independent components:

In[42]:= |

Out[42]= |

One plane of symmetry, rotated by 180 degrees, results in the same stiffness:

In[43]:= |

Out[44]= |

This results in a stiffness tensor with fewer independent components:

In[45]:= |

Out[20]= |

Determination and comparison of different material symmetries:

In[46]:= |

In[47]:= |

In[48]:= |

Summary:

In[49]:= |

Out[49]= |

- 1.0.0 – 29 August 2019

This work is licensed under a Creative Commons Attribution 4.0 International License