# Finding basis of isotropic tensors of rank $n$

I am looking for a way to obtain a basis of isotropic tensors of rank $n$. Actually I am mostly interested in rank $8$ isotropic tensors but maybe you know already a simple algorithm in order to generate them for any rank. I have been reading the following sources:

Isotropic tensor in Wolfram Math World

Kearsley and Fong, 1975

Andrews and Ghoul, 1981

and, e.g., for rank $8$ tensors you have $91$ linearly independent isotropic tensors. Does anyone know how to generate these in an algorithm using the functions of Mathematica? Of course, I can just type those $91$ down, but I thought I could ask before I begin doing that. Thanks!

This kept me busy for a while. This answer is organized in

1) Results

2) Explanations

3) Examples

From the beginning, if you only need the results, under "1) Results" you'll find the index transpositions for the different tensor orders $n$ (also referred to as degree or rank). A Mathematica notebook with all programs and text files with index transpositions for different orders can be downloaded with this link

Explanations and algorithm below.

1) Results: tensor transpositions (see paper of Kearsly and Fong, 1975 for the number of linearly independent isotropic tensors)

Isotropic 4th-order tensors:

Basic isotropic tensor on $b_0 = I \otimes I = I^{\otimes 2}$, i.e., in components $b^0_{ijkl} = \delta_{ij}\delta_{kl}$

Number of linearly independent isotropic tensors: 3

{{1, 2, 3, 4}, {1, 3, 2, 4}, {1, 4, 2, 3}}


Isotropic 5th-order tensors:

Basic isotropic tensor on $b_0 = \epsilon \otimes I$, i.e., in components $b^0_{ijklm} = \epsilon_{ijk}\delta_{lm}$

Number of linearly independent isotropic tensors: 6

{{1, 2, 3, 4, 5}, {1, 2, 4, 3, 5}, {1, 2, 5, 3, 4}, {1, 3, 4, 2, 5}, {1, 3, 5, 2, 4}, {1, 4, 5, 2, 3}}


Isotropic 6th-order tensors:

Basic isotropic tensor on $b_0 = I^{\otimes 3}$

Number of linearly independent isotropic tensors: 15

{{1, 2, 3, 4, 5, 6}, {1, 2, 3, 5, 4, 6}, {1, 2, 3, 6, 4, 5}, {1, 3, 2, 4, 5, 6}, {1, 3, 2, 5, 4, 6}, {1, 3, 2, 6, 4, 5}, {1, 4, 2, 3, 5, 6}, {1, 4, 2, 5, 3, 6}, {1, 4, 2, 6, 3, 5}, {1, 5, 2, 3, 4, 6}, {1, 5, 2, 4, 3, 6}, {1, 5, 2, 6, 3, 4}, {1, 6, 2, 3, 4, 5}, {1, 6, 2, 4, 3, 5}, {1, 6, 2, 5, 3, 4}}


Isotropic 7th-order tensors:

Basic isotropic tensor on $b_0 = \epsilon \otimes I^{\otimes 2}$

Number of linearly independent isotropic tensors: 36

{{1, 2, 3, 4, 5, 6, 7}, {1, 2, 3, 4, 6, 5, 7}, {1, 2, 3, 4, 7, 5, 6}, {1, 2, 4, 3, 5, 6, 7}, {1, 2, 4, 3, 6, 5, 7}, {1, 2, 4, 3, 7, 5, 6}, {1, 2, 5, 3, 4, 6, 7}, {1, 2, 5, 3, 6, 4, 7}, {1, 2, 5, 3, 7, 4, 6}, {1, 2, 6, 3, 4, 5, 7}, {1, 2, 6, 3, 5, 4, 7}, {1, 2, 6, 3, 7, 4, 5}, {1, 2, 7, 3, 4, 5, 6}, {1, 2, 7, 3, 5, 4, 6}, {1, 2, 7, 3, 6, 4, 5}, {1, 3, 4, 2, 5, 6, 7}, {1, 3, 4, 2, 6, 5, 7}, {1, 3, 4, 2, 7, 5, 6}, {1, 3, 5, 2, 4, 6, 7}, {1, 3, 5, 2, 6, 4, 7}, {1, 3, 5, 2, 7, 4, 6}, {1, 3, 6, 2, 4, 5, 7}, {1, 3, 6, 2, 5, 4, 7}, {1, 3, 6, 2, 7, 4, 5}, {1, 3, 7, 2, 4, 5, 6}, {1, 3, 7, 2, 5, 4, 6}, {1, 3, 7, 2, 6, 4, 5}, {1, 4, 5, 2, 3, 6, 7}, {1, 4, 5, 2, 6, 3, 7}, {1, 4, 6, 2, 3, 5, 7}, {1, 4, 6, 2, 5, 3, 7}, {1, 4, 7, 2, 3, 5, 6}, {1, 4, 7, 2, 5, 3, 6}, {1, 5, 6, 2, 3, 4, 7}, {1, 5, 7, 2, 3, 4, 6}, {1, 6, 7, 2, 3, 4, 5}}


Isotropic 8th-order tensors:

Basic isotropic tensor on $b_0 = I^{\otimes 4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{1, 8, 2, 3, 4, 5, 6, 7}, {1, 8, 2, 3, 4, 6, 5, 7}, {1, 8, 2, 3, 4, 7, 5, 6}, {1, 8, 2, 4, 3, 5, 6, 7}, {1, 8, 2, 4, 3, 6, 5, 7}, {1, 8, 2, 4, 3, 7, 5, 6}, {1, 8, 2, 5, 3, 4, 6, 7}, {1, 8, 2, 5, 3, 6, 4, 7}, {1, 8, 2, 6, 3, 4, 5, 7}, {1, 8, 2, 7, 3, 4, 5, 6}}


2) Explanations

I first need a program in order to generate the basic isotropic tensors of arbitrary order.

Tiso[maxorder_] := Block[
{Id},
If[
EvenQ[maxorder]
,
Id = TensorProduct @@
Table[SparseArray[IdentityMatrix[3]], {i, maxorder/2}];
,
Id = LeviCivitaTensor[3];
If[maxorder > 3,
Id = TensorProduct[Id,
TensorProduct @@
Table[SparseArray[IdentityMatrix[3]], {i, (maxorder - 3)/2}]];
];
];
Id
];


The following program is quite inefficient but does the job for me. For a given tensor order maxorder width corresponding isotropic basic tensor Tiso[maxorder]

1. generate the list of all permutations of corresponding tensor indices, e.g, {{1,2,3,4,5,6},{1,2,3,4,6,5},...}

2. go through all permutations and save only permutations in ttsok which transpose the basic isotropic tensor into a new tensor

3. go through list of saved permutations ttsok and extract all permutations of linearly independent tensors and save them into ttsli

4. return list of permutation ttsli

Code

FindDifferentIsoT[maxorder_] := Module[
{order, Id, tts, ttsok, equal, counter, ttsli, nli, cl, c, csol},
order = Table[i, {i, maxorder}];
(*Build elementary isotropic tensor Id*)
Id = Tiso[maxorder];
(*List of ALL possible index transpositions*)
tts = Permutations[order];
ttsok = {order};
equal = False;
counter = 0;
(*1) Look for different transpositions*)
Do[
(*Check if temporary transposition tts[[
pi]] evaluates Id to one already checked from ttsok*)
While[
(equal == False) && (counter < Length[ttsok]),
counter++;
If[
TensorTranspose[Id, ttsok[[counter]]] ==
TensorTranspose[Id, tts[[pi]]]
, equal = True;
counter =
0;(*If temporary transposition equals to another already saved of Id, then counter will be set to 0,
otherwise after comparing will all saved ones,
counter is equal to the length of that list*)
];
];
(*Save new candidate if transposition delivers new tensor, i.e.,
if counter = Length@ttsok*)
If[counter == Length[ttsok], AppendTo[ttsok, tts[[pi]]]];
counter = 0;
equal = False;
, {pi, 2, Length[tts]}
];
(*2) Check if some tensors are linear dependent, i.e.,
reduce basis*)
ttsli = {order};
Do[
nli = Length[ttsli];
cl = Array[c, {nli + 1}];
csol =
cl /. Quiet[
Solve[Sum[cl[[i]]*TensorTranspose[Id, ttsli[[i]]], {i, nli}] +
cl[[-1]]*TensorTranspose[Id, ttsok[[ti]]] == 0*Id, cl]][[
1]];
If[csol === Table[0, {i, nli + 1}], AppendTo[ttsli, ttsok[[ti]]]];
, {ti, Length[ttsok]}
];
(*Output: list of linear independent transpositions*)
ttsli
];


3) Examples

I will need the full tensor contraction, here referred to as scalar product between tensors $A$ and $B$, defined as $A \cdot B = A_{ij...k} B_{ij...k}$.

sp[A_, B_] := Total[A*B, Infinity];


Try this out for tensors of order n, e.g., n=4. In the following code I first compute the list of linearly independent permutations, build then a basis and compute the metric coefficients of the basis. If the determinant of the metric does NOT vanish, then the tensors are linearly independent, which is here the case (just to check). After that I create some random isotropic tensor and compute the coefficients using the basis in order to represent the random tensor.

(*Choose tensor order*)
n = 4;
(*Search for basis of isotropic tensor of order or*)
list = FindDifferentIsoT[n]
Length[list]
(*Build basis*)
b0 = Tiso[n];
basis = Table[TensorTranspose[b0, list[[i]]], {i, Length[list]}]
(*Check linear independency*)
metric = Table[
sp[basis[[i]], basis[[j]]], {i, Length@list}, {j, Length@list}];
If[Det[metric] == 0, "Problem, linear dependent", "Basis is ok"]
(*Generate random isotropic tensor and obtain coefficients for linear \
combination*)
randc = RandomInteger[2, Length@list];
Print["Random coefficients: ", randc];
randiso = Sum[randc[[i]]*basis[[i]], {i, Length@basis}];
unkc = Array[u, Length@list];
Print[
"Coefficients of Solve[]: "
, unkc /.
Solve[randiso == Sum[unkc[[i]]*basis[[i]], {i, Length@basis}],
unkc][[1]]
];


If you want, you can also compute the list of tensor transpositions, save it in a text file (as in the Mathematica notebook and text files in the online folder) and use them later, e.g., with the following code

list = Import[NotebookDirectory[] <> "order6.txt"];
list = ToExpression[list];
n = Length[list[[1]]];
Print["Imported order: ", n]
Print["Number of basis tensors: ", Length[list]]
(*Build basis*)
b0 = Tiso[n];
basis = Table[TensorTranspose[b0, list[[i]]], {i, Length[list]}];
(*Check linear independency*)
metric = Table[
sp[basis[[i]], basis[[j]]], {i, Length@list}, {j, Length@list}];
If[Det[metric] == 0, "Problem, linear dependent", "Basis is ok"]
(*Generate random isotropic tensor and obtain coefficients for linear \
combination*)
randc = RandomInteger[2, Length@list];
Print["Random coefficients: ", randc];
randiso = Sum[randc[[i]]*basis[[i]], {i, Length@basis}];
unkc = Array[u, Length@list];
Print[
"Coefficients of Solve[]: "
, unkc /.
Solve[randiso == Sum[unkc[[i]]*basis[[i]], {i, Length@basis}],
unkc][[1]]
];