Skip to main content
6 of 7
added 4 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 s[i];
 a /. x[k_] -> t0 x[k]^t1 
   /. Sum[a__, l_List] :> (Sum[#, l] & /@ Expand@a) 
   //. rule /.  t0 -> 1 /. t1 -> 1]
 
(*s[1]^3 - 3 s[1] s[2] + s[3]*)
Dr. belisarius
  • 116.2k
  • 13
  • 205
  • 456