Using Symmetrize
I want to transform a tensor to be symmetric under all index permutations for all original entries $\ne 0$. However each entry is normalized by the number of index permutations. How to tell MMA to consider for symmetrizing only values $\ne0$?
a = ConstantArray[0, {3, 3, 3}];
a[[1, 1, 1]] = 1; (* 1 index permutation *)
a[[1, 1, 2]] = 2; (* 3 index permutations *)
a[[1, 2, 3]] = 5; (* 6 index permutations *)
asym = Normal[Symmetrize[a, Symmetric[All]]];
MatrixForm[asym]
To get the desired symmetrized tensor I have to multiply each entry by the number of its index permutations:
Table[asym[[i1,i2,i3]] *= Length[Permutations[{i1,i2,i3}]],{i1,1,3},{i2,1,3},{i3,1,3}];
MatrixForm[asym]
The same I would achieve if I define the symmetric tensor from scratch.
Normal[SymmetrizedArray[{{1,1,1}->1,{1,1,2}->2,{1,2,3}->5},{3,3,3},Symmetric[All]]]
However this method does not apply as there is already a tensor given where only nonzero values shall be symmetrized.
MMA 13