Skip to main content
5 of 7
deleted 84 characters in body
Dr. belisarius
  • 116.2k
  • 13
  • 205
  • 456
a = Sum[x[r] ((Sum[x[i], {i, n}] - x[r])^2 - Sum[x[i]^2, {i, n}]), {r, n}];

Module[{t0, t1},
 rule = Sum[p__ x[a_]^i_, {a_, n}] :>  p Symbol["s" <> ToString[i /. t1 -> 1]];
 a /. x[k_] -> t0 x[k]^t1 /.Sum[a__, l_List] :>(Sum[#, l] & /@ Expand@a) //. rule /. t0 -> 1
]

(*s1^3 - 3 s1 s2 + s3*)
Dr. belisarius
  • 116.2k
  • 13
  • 205
  • 456