# Summation simplification

I have a list of terms of the form

f[1]g[[a,b]]g[[c,d]]g[[e,f]] + f[2]g[[a,f]]g[[e,d]]g[[c,b]] +...

some terms have the same $ggg$ form but have different $f$.. for instance

f[146]g[[a,f]]g[[e,d]]g[[c,b]] + f[21]g[[a,f]]g[[e,d]]g[[c,b]] +...+ f[7]g[[a,f]]g[[e,d]]g[[c,b]]

I'd like to take all the terms in this list that differ only by the front $f$ and leave just one of them, ie: f[146]g[[a,f]]g[[e,d]]g[[c,b]] + f[21]g[[a,f]]g[[e,d]]g[[c,b]] +...+ f[7]g[[a,f]]g[[e,d]]g[[c,b]] should become: f[146]g[[a,f]]g[[e,d]]g[[c,b]]

and it doesn't matter which one is saved!.

Any help will be greatly appreciated! Thank you!!

• g[[a,b]] should never remain unevaluated -- it will either generate an error or evaluate to something else. Do you mean g[a,b] (and so on) instead? – jjc385 May 11 '17 at 21:33