Skip to main content
2 of 7
deleted 170 characters in body
Dr. belisarius
  • 116.2k
  • 13
  • 205
  • 456

Probably the following two rules can be collapsed into one. Anyway:

rulTimes = Sum[p__  x[a_]^i_, {a_, n}] -> p  Symbol["s" <> ToString@i];
rulNaked = Sum[     x[a_]^i_, {a_, n}] ->    Symbol["s" <> ToString@i];

a = Sum[x[r] ((Sum[x[i], {i, n}] - x[r])^2 - Sum[x[i]^2, {i, n}]), {r, n}];
a /. Sum[a__, l_List] :> (Sum[#, l] & /@ Expand@a) /. rulNaked /. rulTimes

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