I need a script to authomatically symmetrize a given polynomial. For example, if the input is
xy
the output should be
(xy+yx)/2
The same principle should work also for higher order polynomial. For example, if the input is
xyz
the output should be
(xyz+xzy+yxz+yzx+zxy+zyx)/6
The input is, in general, a polynomial. If the input is
xy+wz
the output should be
(xy+yx+wz+zw)/2
It may happen that some terms come with some powers. If the input is
x^2 z
the output should be either
(xxz + xxz +xzx+ xzx + zxx + zxx)/6
or
(2x^2z+2xzx+2zx^2)/6
Both these ouputs are good. Thanks in advance for the help.
x y + w z
? $\endgroup$