I want to create a symmetric rank four tensor with this kind of symmetry: {1,2} and {3,4}. How can I implement this using "Array"?

v = Array[Subscript[a, ##] &, {5,5,5,5}]


2 Answers 2


You can use this construction, which is an efficient representation (avoiding repeating symmetry-related entries):

sa = SymmetrizedArray[{i_, j_, k_, l_} :> Subscript[a, i, j, k, l], {5, 5, 5, 5}, {Symmetric[{1, 2}], Symmetric[{3, 4}]}]

If you want the ordinary array just do


In this way you can also implement antisymmetries. For example you could have the symmetry

{Symmetric[{1, 2}], Antisymmetric[{3, 4}]}
  • $\begingroup$ Thank you so much! Do you know a way to make it also traceless? For example, I want Sum[sa[[i,l,i,k]],{i,1,5}]=0 $\endgroup$
    – Tony Stack
    Mar 28, 2022 at 15:35
  • $\begingroup$ SymmetrizedArray only handles symmetries under permutations, not trace conditions. There are many different trace conditions that can be imposed. I think you'll have to impose all conditions you want manually and solve the corresponding system of equations, in the direction that @Adam's answer suggests. $\endgroup$
    – jose
    Mar 28, 2022 at 16:48

Does this work?

}][[1]]& @ Array[Subscript[a,##]&,{5,5,5,5}]

Use TensorSymmetry@% to verify


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.