FeynCalc manual (development version)

Collect2

Collect2[expr, x] collects together terms which are not free of any occurrence of x.

Collect2[expr, {x1, x2, ...}] (or also Collect2[expr, x1, x2, ...]) collects together terms which are not free of any occurrence of x1, x2, ....

The coefficients are put over a common denominator. If expr is expanded before collecting depends on the option Factoring, which may be set to Factor, Factor2, or any other function, which is applied to the coefficients. If expr is already expanded with respect to x (x1, x2, …), the option Expanding can be set to False.

See also

Overview, Isolate.

Examples

Collect2[t1 = a + r a + k^2 f[a] - k f[a] + x/2 - y/w, a]

(k1)kf(a)+a(r+1)+wx2y2w(k-1) k f(a)+a (r+1)+\frac{w x-2 y}{2 w}

Collect2[t1, a, Factoring -> False]

(k2k)f(a)+a(r+1)yw+x2\left(k^2-k\right) f(a)+a (r+1)-\frac{y}{w}+\frac{x}{2}

Collect2[t1, a, Factoring -> Factor]

(k1)kf(a)+a(r+1)+wx2y2w(k-1) k f(a)+a (r+1)+\frac{w x-2 y}{2 w}

Collect2[t1, a, Factoring -> Simplify]

(k1)kf(a)+a(r+1)yw+x2(k-1) k f(a)+a (r+1)-\frac{y}{w}+\frac{x}{2}

Collect2[2 a (b - a) (h - 1) - b^2 (e a - c) + b^2, {a, b}]

2a2(h1)ab2e+2ab(h1)+b2(c+1)-2 a^2 (h-1)-a b^2 e+2 a b (h-1)+b^2 (c+1)

Collect2[Expand[(a - b - c - d)^5], a, IsolateNames -> KK] 
 
FRH[%]

a55a4  KK(19)+10a3  KK(20)10a2  KK(22)+5a  KK(21)KK(23)a^5-5 a^4 \;\text{KK}(19)+10 a^3 \;\text{KK}(20)-10 a^2 \;\text{KK}(22)+5 a \;\text{KK}(21)-\text{KK}(23)

a55a4(b+c+d)+10a3(b+c+d)210a2(b+c+d)3+5a(b+c+d)4(b+c+d)5a^5-5 a^4 (b+c+d)+10 a^3 (b+c+d)^2-10 a^2 (b+c+d)^3+5 a (b+c+d)^4-(b+c+d)^5

The option Head is useful for subsequent manipulations of the output

Collect2[Expand[(a - b - c - d)^5], a, Head -> h]

h(a5)5h(a4)(b+c+d)+10h(a3)(b+c+d)210h(a2)(b+c+d)3+5h(a)(b+c+d)4(b+c+d)5h\left(a^5\right)-5 h\left(a^4\right) (b+c+d)+10 h\left(a^3\right) (b+c+d)^2-10 h\left(a^2\right) (b+c+d)^3+5 h(a) (b+c+d)^4-(b+c+d)^5

Collect2[Expand[(a - b - c - d)^5], a, Head -> {h1, h2}]

h2(1,h1(a5))+h2(5(b+c+d),h1(a4))+h2(10(b+c+d)2,h1(a3))+h2(10(b+c+d)3,h1(a2))+h2(5(b+c+d)4,h1(a))+h2((b+c+d)5,1)\text{h2}\left(1,\text{h1}\left(a^5\right)\right)+\text{h2}\left(-5 (b+c+d),\text{h1}\left(a^4\right)\right)+\text{h2}\left(10 (b+c+d)^2,\text{h1}\left(a^3\right)\right)+\text{h2}\left(-10 (b+c+d)^3,\text{h1}\left(a^2\right)\right)+\text{h2}\left(5 (b+c+d)^4,\text{h1}(a)\right)+\text{h2}\left(-(b+c+d)^5,1\right)

Collect2[Expand[(a - b - c - d)^5], a, Head -> {Identity, h2}] 
 
Cases2[%, h2]

h2(1,a5)+h2(5(b+c+d),a4)+h2(10(b+c+d)2,a3)+h2(10(b+c+d)3,a2)+h2(5(b+c+d)4,a)+h2((b+c+d)5,1)\text{h2}\left(1,a^5\right)+\text{h2}\left(-5 (b+c+d),a^4\right)+\text{h2}\left(10 (b+c+d)^2,a^3\right)+\text{h2}\left(-10 (b+c+d)^3,a^2\right)+\text{h2}\left(5 (b+c+d)^4,a\right)+\text{h2}\left(-(b+c+d)^5,1\right)

{h2(1,a5),h2(5(b+c+d),a4),h2(10(b+c+d)2,a3),h2(10(b+c+d)3,a2),h2(5(b+c+d)4,a),h2((b+c+d)5,1)}\left\{\text{h2}\left(1,a^5\right),\text{h2}\left(-5 (b+c+d),a^4\right),\text{h2}\left(10 (b+c+d)^2,a^3\right),\text{h2}\left(-10 (b+c+d)^3,a^2\right),\text{h2}\left(5 (b+c+d)^4,a\right),\text{h2}\left(-(b+c+d)^5,1\right)\right\}

It is possible to use different factoring functions

Clear[fun] 
 
Collect2[Expand[(a - b - c)^3], a, Factoring -> fun] 
 
% /. fun -> FactorTerms

a3  fun(1)+a2  fun(3b3c)+a  fun(3b2+6bc+3c2)+fun(b33b2c3bc2c3)a^3 \;\text{fun}(1)+a^2 \;\text{fun}(-3 b-3 c)+a \;\text{fun}\left(3 b^2+6 b c+3 c^2\right)+\text{fun}\left(-b^3-3 b^2 c-3 b c^2-c^3\right)

a33a2(b+c)+3a(b2+2bc+c2)b33b2c3bc2c3a^3-3 a^2 (b+c)+3 a \left(b^2+2 b c+c^2\right)-b^3-3 b^2 c-3 b c^2-c^3

Another neat trick is to nest Collect2 using the Factoring option

Collect2[Expand[((a1 + a2 + a3)^3 - (b1 + b2 + b3)^3 - (c1 + c2 + c3)^3)^2], {a1, a2, a3}, 
  Factoring -> Function[x, Collect2[x, {b1, c1}]]]

a16+6  a2  a15+6  a3  a15+15  a22  a14+15  a32  a14+30  a2  a3  a14+20  a23  a13+20  a33  a13+60  a2  a32  a13+60  a22  a3  a13+(2  b136(b2+b3)  b126(b2+b3)2  b12  c136  c1(c2+c3)26  c12(c2+c3)2(b2+b3+c2+c3)(b22+2  b3  b2c2  b2c3  b2+b32+c22+c32b3  c2b3  c3+2  c2  c3))  a13+15  a24  a12+15  a34  a12+60  a2  a33  a12+90  a22  a32  a12+60  a23  a3  a12+a2(6  b1318(b2+b3)  b1218(b2+b3)2  b16  c1318  c1(c2+c3)218  c12(c2+c3)6(b2+b3+c2+c3)(b22+2  b3  b2c2  b2c3  b2+b32+c22+c32b3  c2b3  c3+2  c2  c3))  a12+a3(6  b1318(b2+b3)  b1218(b2+b3)2  b16  c1318  c1(c2+c3)218  c12(c2+c3)6(b2+b3+c2+c3)(b22+2  b3  b2c2  b2c3  b2+b32+c22+c32b3  c2b3  c3+2  c2  c3))  a12+6  a25  a1+6  a35  a1+30  a2  a34  a1+60  a22  a33  a1+60  a23  a32  a1+30  a24  a3  a1+a2  a3(12  b1336(b2+b3)  b1236(b2+b3)2  b112  c1336  c1(c2+c3)236  c12(c2+c3)12(b2+b3+c2+c3)(b22+2  b3  b2c2  b2c3  b2+b32+c22+c32b3  c2b3  c3+2  c2  c3))  a1+a22(6  b1318(b2+b3)  b1218(b2+b3)2  b16  c1318  c1(c2+c3)218  c12(c2+c3)6(b2+b3+c2+c3)(b22+2  b3  b2c2  b2c3  b2+b32+c22+c32b3  c2b3  c3+2  c2  c3))  a1+a32(6  b1318(b2+b3)  b1218(b2+b3)2  b16  c1318  c1(c2+c3)218  c12(c2+c3)6(b2+b3+c2+c3)(b22+2  b3  b2c2  b2c3  b2+b32+c22+c32b3  c2b3  c3+2  c2  c3))  a1+a26+a36+b16+c16+6  a2  a35+15  a22  a34+20  a23  a33+2  b13  c13+6  b1(b2+b3)2  c13+6  b12(b2+b3)  c13+15  a24  a32+15  b14(b2+b3)2+15  c14(c2+c3)2+6  b13  c1(c2+c3)2+18  b1(b2+b3)2  c1(c2+c3)2+18  b12(b2+b3)  c1(c2+c3)2+(b2+b3+c2+c3)2(b22+2  b3  b2c2  b2c3  b2+b32+c22+c32b3  c2b3  c3+2  c2  c3)2+6  a25  a3+6  b15(b2+b3)+6  c15(c2+c3)+6  b13  c12(c2+c3)+18  b1(b2+b3)2  c12(c2+c3)+18  b12(b2+b3)  c12(c2+c3)+6  b1(b2+b3)2(b2+b3+c2+c3)(b22+2  b3  b2c2  b2c3  b2+b32+c22+c32b3  c2b3  c3+2  c2  c3)+6  c1(c2+c3)2(b2+b3+c2+c3)(b22+2  b3  b2c2  b2c3  b2+b32+c22+c32b3  c2b3  c3+2  c2  c3)+2  b13(10  b23+30  b3  b22+30  b32  b2+10  b33+c23+c33+3  c2  c32+3  c22  c3)+3  b12(b2+b3)(5  b23+15  b3  b22+15  b32  b2+5  b33+2  c23+2  c33+6  c2  c32+6  c22  c3)+3  c12(c2+c3)(2  b23+6  b3  b22+6  b32  b2+2  b33+5  c23+5  c33+15  c2  c32+15  c22  c3)+2  c13(b23+3  b3  b22+3  b32  b2+b33+10  c23+10  c33+30  c2  c32+30  c22  c3)+a2  a32(6  b1318(b2+b3)  b1218(b2+b3)2  b16  c1318  c1(c2+c3)218  c12(c2+c3)6(b2+b3+c2+c3)(b22+2  b3  b2c2  b2c3  b2+b32+c22+c32b3  c2b3  c3+2  c2  c3))+a22  a3(6  b1318(b2+b3)  b1218(b2+b3)2  b16  c1318  c1(c2+c3)218  c12(c2+c3)6(b2+b3+c2+c3)(b22+2  b3  b2c2  b2c3  b2+b32+c22+c32b3  c2b3  c3+2  c2  c3))+a23(2  b136(b2+b3)  b126(b2+b3)2  b12  c136  c1(c2+c3)26  c12(c2+c3)2(b2+b3+c2+c3)(b22+2  b3  b2c2  b2c3  b2+b32+c22+c32b3  c2b3  c3+2  c2  c3))+a33(2  b136(b2+b3)  b126(b2+b3)2  b12  c136  c1(c2+c3)26  c12(c2+c3)2(b2+b3+c2+c3)(b22+2  b3  b2c2  b2c3  b2+b32+c22+c32b3  c2b3  c3+2  c2  c3))\text{a1}^6+6 \;\text{a2} \;\text{a1}^5+6 \;\text{a3} \;\text{a1}^5+15 \;\text{a2}^2 \;\text{a1}^4+15 \;\text{a3}^2 \;\text{a1}^4+30 \;\text{a2} \;\text{a3} \;\text{a1}^4+20 \;\text{a2}^3 \;\text{a1}^3+20 \;\text{a3}^3 \;\text{a1}^3+60 \;\text{a2} \;\text{a3}^2 \;\text{a1}^3+60 \;\text{a2}^2 \;\text{a3} \;\text{a1}^3+\left(-2 \;\text{b1}^3-6 (\text{b2}+\text{b3}) \;\text{b1}^2-6 (\text{b2}+\text{b3})^2 \;\text{b1}-2 \;\text{c1}^3-6 \;\text{c1} (\text{c2}+\text{c3})^2-6 \;\text{c1}^2 (\text{c2}+\text{c3})-2 (\text{b2}+\text{b3}+\text{c2}+\text{c3}) \left(\text{b2}^2+2 \;\text{b3} \;\text{b2}-\text{c2} \;\text{b2}-\text{c3} \;\text{b2}+\text{b3}^2+\text{c2}^2+\text{c3}^2-\text{b3} \;\text{c2}-\text{b3} \;\text{c3}+2 \;\text{c2} \;\text{c3}\right)\right) \;\text{a1}^3+15 \;\text{a2}^4 \;\text{a1}^2+15 \;\text{a3}^4 \;\text{a1}^2+60 \;\text{a2} \;\text{a3}^3 \;\text{a1}^2+90 \;\text{a2}^2 \;\text{a3}^2 \;\text{a1}^2+60 \;\text{a2}^3 \;\text{a3} \;\text{a1}^2+\text{a2} \left(-6 \;\text{b1}^3-18 (\text{b2}+\text{b3}) \;\text{b1}^2-18 (\text{b2}+\text{b3})^2 \;\text{b1}-6 \;\text{c1}^3-18 \;\text{c1} (\text{c2}+\text{c3})^2-18 \;\text{c1}^2 (\text{c2}+\text{c3})-6 (\text{b2}+\text{b3}+\text{c2}+\text{c3}) \left(\text{b2}^2+2 \;\text{b3} \;\text{b2}-\text{c2} \;\text{b2}-\text{c3} \;\text{b2}+\text{b3}^2+\text{c2}^2+\text{c3}^2-\text{b3} \;\text{c2}-\text{b3} \;\text{c3}+2 \;\text{c2} \;\text{c3}\right)\right) \;\text{a1}^2+\text{a3} \left(-6 \;\text{b1}^3-18 (\text{b2}+\text{b3}) \;\text{b1}^2-18 (\text{b2}+\text{b3})^2 \;\text{b1}-6 \;\text{c1}^3-18 \;\text{c1} (\text{c2}+\text{c3})^2-18 \;\text{c1}^2 (\text{c2}+\text{c3})-6 (\text{b2}+\text{b3}+\text{c2}+\text{c3}) \left(\text{b2}^2+2 \;\text{b3} \;\text{b2}-\text{c2} \;\text{b2}-\text{c3} \;\text{b2}+\text{b3}^2+\text{c2}^2+\text{c3}^2-\text{b3} \;\text{c2}-\text{b3} \;\text{c3}+2 \;\text{c2} \;\text{c3}\right)\right) \;\text{a1}^2+6 \;\text{a2}^5 \;\text{a1}+6 \;\text{a3}^5 \;\text{a1}+30 \;\text{a2} \;\text{a3}^4 \;\text{a1}+60 \;\text{a2}^2 \;\text{a3}^3 \;\text{a1}+60 \;\text{a2}^3 \;\text{a3}^2 \;\text{a1}+30 \;\text{a2}^4 \;\text{a3} \;\text{a1}+\text{a2} \;\text{a3} \left(-12 \;\text{b1}^3-36 (\text{b2}+\text{b3}) \;\text{b1}^2-36 (\text{b2}+\text{b3})^2 \;\text{b1}-12 \;\text{c1}^3-36 \;\text{c1} (\text{c2}+\text{c3})^2-36 \;\text{c1}^2 (\text{c2}+\text{c3})-12 (\text{b2}+\text{b3}+\text{c2}+\text{c3}) \left(\text{b2}^2+2 \;\text{b3} \;\text{b2}-\text{c2} \;\text{b2}-\text{c3} \;\text{b2}+\text{b3}^2+\text{c2}^2+\text{c3}^2-\text{b3} \;\text{c2}-\text{b3} \;\text{c3}+2 \;\text{c2} \;\text{c3}\right)\right) \;\text{a1}+\text{a2}^2 \left(-6 \;\text{b1}^3-18 (\text{b2}+\text{b3}) \;\text{b1}^2-18 (\text{b2}+\text{b3})^2 \;\text{b1}-6 \;\text{c1}^3-18 \;\text{c1} (\text{c2}+\text{c3})^2-18 \;\text{c1}^2 (\text{c2}+\text{c3})-6 (\text{b2}+\text{b3}+\text{c2}+\text{c3}) \left(\text{b2}^2+2 \;\text{b3} \;\text{b2}-\text{c2} \;\text{b2}-\text{c3} \;\text{b2}+\text{b3}^2+\text{c2}^2+\text{c3}^2-\text{b3} \;\text{c2}-\text{b3} \;\text{c3}+2 \;\text{c2} \;\text{c3}\right)\right) \;\text{a1}+\text{a3}^2 \left(-6 \;\text{b1}^3-18 (\text{b2}+\text{b3}) \;\text{b1}^2-18 (\text{b2}+\text{b3})^2 \;\text{b1}-6 \;\text{c1}^3-18 \;\text{c1} (\text{c2}+\text{c3})^2-18 \;\text{c1}^2 (\text{c2}+\text{c3})-6 (\text{b2}+\text{b3}+\text{c2}+\text{c3}) \left(\text{b2}^2+2 \;\text{b3} \;\text{b2}-\text{c2} \;\text{b2}-\text{c3} \;\text{b2}+\text{b3}^2+\text{c2}^2+\text{c3}^2-\text{b3} \;\text{c2}-\text{b3} \;\text{c3}+2 \;\text{c2} \;\text{c3}\right)\right) \;\text{a1}+\text{a2}^6+\text{a3}^6+\text{b1}^6+\text{c1}^6+6 \;\text{a2} \;\text{a3}^5+15 \;\text{a2}^2 \;\text{a3}^4+20 \;\text{a2}^3 \;\text{a3}^3+2 \;\text{b1}^3 \;\text{c1}^3+6 \;\text{b1} (\text{b2}+\text{b3})^2 \;\text{c1}^3+6 \;\text{b1}^2 (\text{b2}+\text{b3}) \;\text{c1}^3+15 \;\text{a2}^4 \;\text{a3}^2+15 \;\text{b1}^4 (\text{b2}+\text{b3})^2+15 \;\text{c1}^4 (\text{c2}+\text{c3})^2+6 \;\text{b1}^3 \;\text{c1} (\text{c2}+\text{c3})^2+18 \;\text{b1} (\text{b2}+\text{b3})^2 \;\text{c1} (\text{c2}+\text{c3})^2+18 \;\text{b1}^2 (\text{b2}+\text{b3}) \;\text{c1} (\text{c2}+\text{c3})^2+(\text{b2}+\text{b3}+\text{c2}+\text{c3})^2 \left(\text{b2}^2+2 \;\text{b3} \;\text{b2}-\text{c2} \;\text{b2}-\text{c3} \;\text{b2}+\text{b3}^2+\text{c2}^2+\text{c3}^2-\text{b3} \;\text{c2}-\text{b3} \;\text{c3}+2 \;\text{c2} \;\text{c3}\right)^2+6 \;\text{a2}^5 \;\text{a3}+6 \;\text{b1}^5 (\text{b2}+\text{b3})+6 \;\text{c1}^5 (\text{c2}+\text{c3})+6 \;\text{b1}^3 \;\text{c1}^2 (\text{c2}+\text{c3})+18 \;\text{b1} (\text{b2}+\text{b3})^2 \;\text{c1}^2 (\text{c2}+\text{c3})+18 \;\text{b1}^2 (\text{b2}+\text{b3}) \;\text{c1}^2 (\text{c2}+\text{c3})+6 \;\text{b1} (\text{b2}+\text{b3})^2 (\text{b2}+\text{b3}+\text{c2}+\text{c3}) \left(\text{b2}^2+2 \;\text{b3} \;\text{b2}-\text{c2} \;\text{b2}-\text{c3} \;\text{b2}+\text{b3}^2+\text{c2}^2+\text{c3}^2-\text{b3} \;\text{c2}-\text{b3} \;\text{c3}+2 \;\text{c2} \;\text{c3}\right)+6 \;\text{c1} (\text{c2}+\text{c3})^2 (\text{b2}+\text{b3}+\text{c2}+\text{c3}) \left(\text{b2}^2+2 \;\text{b3} \;\text{b2}-\text{c2} \;\text{b2}-\text{c3} \;\text{b2}+\text{b3}^2+\text{c2}^2+\text{c3}^2-\text{b3} \;\text{c2}-\text{b3} \;\text{c3}+2 \;\text{c2} \;\text{c3}\right)+2 \;\text{b1}^3 \left(10 \;\text{b2}^3+30 \;\text{b3} \;\text{b2}^2+30 \;\text{b3}^2 \;\text{b2}+10 \;\text{b3}^3+\text{c2}^3+\text{c3}^3+3 \;\text{c2} \;\text{c3}^2+3 \;\text{c2}^2 \;\text{c3}\right)+3 \;\text{b1}^2 (\text{b2}+\text{b3}) \left(5 \;\text{b2}^3+15 \;\text{b3} \;\text{b2}^2+15 \;\text{b3}^2 \;\text{b2}+5 \;\text{b3}^3+2 \;\text{c2}^3+2 \;\text{c3}^3+6 \;\text{c2} \;\text{c3}^2+6 \;\text{c2}^2 \;\text{c3}\right)+3 \;\text{c1}^2 (\text{c2}+\text{c3}) \left(2 \;\text{b2}^3+6 \;\text{b3} \;\text{b2}^2+6 \;\text{b3}^2 \;\text{b2}+2 \;\text{b3}^3+5 \;\text{c2}^3+5 \;\text{c3}^3+15 \;\text{c2} \;\text{c3}^2+15 \;\text{c2}^2 \;\text{c3}\right)+2 \;\text{c1}^3 \left(\text{b2}^3+3 \;\text{b3} \;\text{b2}^2+3 \;\text{b3}^2 \;\text{b2}+\text{b3}^3+10 \;\text{c2}^3+10 \;\text{c3}^3+30 \;\text{c2} \;\text{c3}^2+30 \;\text{c2}^2 \;\text{c3}\right)+\text{a2} \;\text{a3}^2 \left(-6 \;\text{b1}^3-18 (\text{b2}+\text{b3}) \;\text{b1}^2-18 (\text{b2}+\text{b3})^2 \;\text{b1}-6 \;\text{c1}^3-18 \;\text{c1} (\text{c2}+\text{c3})^2-18 \;\text{c1}^2 (\text{c2}+\text{c3})-6 (\text{b2}+\text{b3}+\text{c2}+\text{c3}) \left(\text{b2}^2+2 \;\text{b3} \;\text{b2}-\text{c2} \;\text{b2}-\text{c3} \;\text{b2}+\text{b3}^2+\text{c2}^2+\text{c3}^2-\text{b3} \;\text{c2}-\text{b3} \;\text{c3}+2 \;\text{c2} \;\text{c3}\right)\right)+\text{a2}^2 \;\text{a3} \left(-6 \;\text{b1}^3-18 (\text{b2}+\text{b3}) \;\text{b1}^2-18 (\text{b2}+\text{b3})^2 \;\text{b1}-6 \;\text{c1}^3-18 \;\text{c1} (\text{c2}+\text{c3})^2-18 \;\text{c1}^2 (\text{c2}+\text{c3})-6 (\text{b2}+\text{b3}+\text{c2}+\text{c3}) \left(\text{b2}^2+2 \;\text{b3} \;\text{b2}-\text{c2} \;\text{b2}-\text{c3} \;\text{b2}+\text{b3}^2+\text{c2}^2+\text{c3}^2-\text{b3} \;\text{c2}-\text{b3} \;\text{c3}+2 \;\text{c2} \;\text{c3}\right)\right)+\text{a2}^3 \left(-2 \;\text{b1}^3-6 (\text{b2}+\text{b3}) \;\text{b1}^2-6 (\text{b2}+\text{b3})^2 \;\text{b1}-2 \;\text{c1}^3-6 \;\text{c1} (\text{c2}+\text{c3})^2-6 \;\text{c1}^2 (\text{c2}+\text{c3})-2 (\text{b2}+\text{b3}+\text{c2}+\text{c3}) \left(\text{b2}^2+2 \;\text{b3} \;\text{b2}-\text{c2} \;\text{b2}-\text{c3} \;\text{b2}+\text{b3}^2+\text{c2}^2+\text{c3}^2-\text{b3} \;\text{c2}-\text{b3} \;\text{c3}+2 \;\text{c2} \;\text{c3}\right)\right)+\text{a3}^3 \left(-2 \;\text{b1}^3-6 (\text{b2}+\text{b3}) \;\text{b1}^2-6 (\text{b2}+\text{b3})^2 \;\text{b1}-2 \;\text{c1}^3-6 \;\text{c1} (\text{c2}+\text{c3})^2-6 \;\text{c1}^2 (\text{c2}+\text{c3})-2 (\text{b2}+\text{b3}+\text{c2}+\text{c3}) \left(\text{b2}^2+2 \;\text{b3} \;\text{b2}-\text{c2} \;\text{b2}-\text{c3} \;\text{b2}+\text{b3}^2+\text{c2}^2+\text{c3}^2-\text{b3} \;\text{c2}-\text{b3} \;\text{c3}+2 \;\text{c2} \;\text{c3}\right)\right)

The options IsolateFast allows to save some time when Isolating prefactors, provided that no factoring is involved.

ClearAll[h, g, a, b, c]; 
 
exp = Sum[h[i], {i, 1, 200000}]*a + Sum[g[i], {i, 1, 200000}]*b + Sum[j[i], {i, 1, 200000}]*c;
AbsoluteTiming[Collect2[exp, {a, b, c}, Factoring -> False, IsolateNames -> KK, Expanding -> False]]

{2.28593,a  KK(28)+b  KK(29)+c  KK(27)}\{2.28593,a \;\text{KK}(28)+b \;\text{KK}(29)+c \;\text{KK}(27)\}

AbsoluteTiming[Collect2[exp, {a, b, c}, Factoring -> False, IsolateNames -> KK, IsolateFast -> True, Expanding -> False]]

{1.38613,a  KK(28)+b  KK(29)+c  KK(27)}\{1.38613,a \;\text{KK}(28)+b \;\text{KK}(29)+c \;\text{KK}(27)\}

ClearAll[exp]