({{, (RefLink[TensorSymmetry, paclet:ref/TensorSymmetry])[tensor] 
gives the symmetry of tensor under permutations of its slots.}, {, (RefLink[TensorSymmetry, paclet:ref/TensorSymmetry])[tensor,slots]
gives the symmetry under permutation of the specified list of slots.}})

OpenersNotesSection(Spacer1)Details and Options

(RefLink[TensorSymmetry, paclet:ref/TensorSymmetry]) accepts any type of tensor, either symbolic or explicit, including any type of array.

A general symmetry is specified by a generating set of pairs {perm,ϕ}, where perm is a permutation of the slots of the tensor, and ϕ is a root of unity. Each pair represents a symmetry of the tensor of the form ϕ (RefLink[TensorTranspose, paclet:ref/TensorTranspose])[tensor,perm]==tensor.

Some symmetry specifications have names:

The following options can be given:

For exact and symbolic arrays, the option (RefLink[SameTest, paclet:ref/SameTest])->f indicates that two entries (Subscript[a, ij…]) and (Subscript[a, kl…]) are taken to be equal if f[(Subscript[a, ij…]),(Subscript[a, kl…])] gives (RefLink[True, paclet:ref/True]).

For approximate arrays, the option (RefLink[Tolerance, paclet:ref/Tolerance])->t can be used to indicate that all entries (RefLink[Abs, paclet:ref/Abs])[(Subscript[a, ij…])]≤t are taken to be zero.

For array entries (RefLink[Abs, paclet:ref/Abs])[(Subscript[a, ij…])]>t, equality comparison is done except for the last (Subscript[log, 2])(t/ϵ) bits, where ϵ is (RefLink[$MachineEpsilon, paclet:ref/$MachineEpsilon]) for (RefLink[MachinePrecision, paclet:ref/MachinePrecision]) arrays and (10^(-p)) for arrays of (RefLink[Precision, paclet:ref/Precision]) p.

OpenersPrimaryExamplesSection(Spacer1)Examples  (17)

OpenersExampleSection0(Spacer1)Basic Examples  (2)

A symmetric matrix:

TensorSymmetry[{{a,b},{b,c}}]

An antisymmetric matrix:

TensorSymmetry[{{0,a,b},{-a,0,c},{-b,-c,0}}]

A symmetric array of rank 3:

$Assumptions=A∈Arrays[{5,5,5},Reals,Antisymmetric[{1,2,3}]];

TensorSymmetry[A]

OpenersExampleSection1(Spacer1)Scope  (7)

Find symmetry in an array:

TensorSymmetry[{{{{-6,4,-9},{4,5,5},{-9,5,10}},{{4,-9,1},{-9,2,8},{1,8,-2}},{{-9,1,0},{1,-5,6},{0,6,6}}},{{{4,-9,1},{-9,2,8},{1,8,-2}},{{5,2,-5},{2,-5,7},{-5,7,-3}},{{5,8,6},{8,7,2},{6,2,10}}},{{{-9,1,0},{1,-5,6},{0,6,6}},{{5,8,6},{8,7,2},{6,2,10}},{{10,-2,6},{-2,-3,10},{6,10,-1}}}}]

Find symmetries in complex arrays:

TensorSymmetry[{{{0,-3},{-3 (E^(-((2 I π)/3))),-4}},{{-3 (E^((2 I π)/3)),-4 (E^((2 I π)/3))},{-4 (E^(-((2 I π)/3))),0}}}]

Symmetry of a (RefLink[SymmetrizedArray, paclet:ref/SymmetrizedArray]) object:

a=SymmetrizedArray[{{1,2,3}->7},{4,4,4},Antisymmetric[{1,2,3}]]

TensorSymmetry[a]

Symmetry of a (RefLink[SparseArray, paclet:ref/SparseArray]) object:

a=SparseArray[{{0,7},{-7,0}}]

TensorSymmetry[a]

Specify the symmetry of a symbolic array:

$Assumptions=T∈Arrays[{B,B,B},Reals,Antisymmetric[{1,2,3}]];

TensorSymmetry[T]

Symmetry of its tensor product with itself. Note the exchange symmetry:

TensorSymmetry[T⊗T]

A fully symmetric rank 3 array:

a=Normal@SymmetrizedArray[_:>RandomInteger[10],{2,2,2},Symmetric[All]]

Complete symmetry:

TensorSymmetry[a]

Symmetry in a subset of slots:

TensorSymmetry[a,{2,3}]

Symmetry of an array of zeros:

TensorSymmetry[{{0,0},{0,0}}]

OpenersExampleSection2(Spacer1)Options  (3)

OpenersExampleSubsection0(Spacer1)Assumptions  (1)

Specify locally the properties of the tensors:

TensorSymmetry[T,Assumptions->T∈Arrays[{3,3},Reals,Antisymmetric[{1,2}]]]

With no assumptions, the symmetry is unknown:

TensorSymmetry[T]

OpenersExampleSubsection1(Spacer1)SameTest  (1)

This matrix is symmetric for a positive real x, but (RefLink[TensorSymmetry, paclet:ref/TensorSymmetry]) gives no symmetry:

m={{1,Log[x^2]},{2 Log[x],2}};

TensorSymmetry[m]

Use the option (RefLink[SameTest, paclet:ref/SameTest]) to get the correct answer:

TensorSymmetry[m,SameTest->(Simplify[#1-#2,x>0]==0&)]

OpenersExampleSubsection2(Spacer1)Tolerance  (1)

Generate a fully symmetric random array of depth 4:

SeedRandom[123];

a=Normal@Symmetrize[RandomReal[1,{5,5,5,5}]];

TensorSymmetry[a]

The addition of a small perturbation breaks the symmetry:

a=a+RandomReal[10^-11,{5,5,5,5}];

TensorSymmetry[a]

The symmetry can be recovered by allowing some tolerance:

TensorSymmetry[a,Tolerance->10^-10]

OpenersExampleSection3(Spacer1)Properties & Relations  (5)

Test whether a matrix is symmetric:

m={{a,5},{5,b}};

SymmetricMatrixQ[m]

Find the symmetry of the matrix:

TensorSymmetry[m]

Test whether a matrix is antisymmetric:

m={{0,I},{-I,0}};

AntisymmetricMatrixQ[m]

Find the symmetry of the matrix:

TensorSymmetry[m]

Only a matrix of zeros can be simultaneously symmetric and antisymmetric:

m={{0,0},{0,0}}

SymmetricMatrixQ[m]

AntisymmetricMatrixQ[m]

TensorSymmetry[m]

Generation of special multidimensional symmetric arrays:

CrossMatrix[{5,5,5}]//TensorSymmetry

DiamondMatrix[{5,5,5,5}]//TensorSymmetry

DiskMatrix[{6,6}]//TensorSymmetry

With a different radius, there are other symmetries:

DiskMatrix[{5,4,5}]//TensorSymmetry

DiskMatrix[{4,5,4,5}]//TensorSymmetry

The symmetry of (RefLink[Symmetrize, paclet:ref/Symmetrize])[tensor,sym] is at least sym:

m=RandomInteger[10,{2,2,2,2}];

sm=Normal@Symmetrize[m,Symmetric[{1,2,4}]]

%//TensorSymmetry

In some cases the result of (RefLink[Symmetrize, paclet:ref/Symmetrize])[tensor,sym] may have more symmetry than sym:

Normal@Symmetrize[sm,Symmetric[{3,4}]]

%//TensorSymmetry

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[TensorTranspose, paclet:ref/TensorTranspose])  ▪  (RefLink[Symmetric, paclet:ref/Symmetric])  ▪  (RefLink[Antisymmetric, paclet:ref/Antisymmetric])  ▪  (RefLink[ZeroSymmetric, paclet:ref/ZeroSymmetric])  ▪  (RefLink[SymmetricMatrixQ, paclet:ref/SymmetricMatrixQ])  ▪  (RefLink[AntisymmetricMatrixQ, paclet:ref/AntisymmetricMatrixQ])  ▪  (RefLink[Arrays, paclet:ref/Arrays])  ▪  (RefLink[Matrices, paclet:ref/Matrices])  ▪  (RefLink[Symmetrize, paclet:ref/Symmetrize])}})}})

({{DocumentationFooterIconsRelatedTutorial.png, ({{Tutorials}, {▪(RefLinkPlain[Symbolic Tensors, paclet:tutorial/SymbolicTensors])}, {▪(RefLinkPlain[Tensor Symmetries, paclet:tutorial/TensorSymmetries])}, {▪(RefLinkPlain[Symmetrized Arrays, paclet:tutorial/SymmetrizedArrays])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Symbolic Tensors, paclet:guide/SymbolicTensors])}})}})