# Simplifying only specific parts of polynomial expression

I have this expression :

1/4 (-Inactive[Cj][j]^2 - 2 Inactive[Cj][j]^3) Inactive[
SixJSymbol][{j, j, j}, {j, j, j}] -
1/2 Inactive[Cj][j] Inactive[triple456][j, j, j, j, j, j] As you can see, there is a "not simplified" polynomial in front of the SixJSymbol. I would like Mathematica to replace this part with -(1/4) Inactive[Cj][j]^2 (1 + 2 Inactive[Cj][j]), i.e. $((-1/4)Cj^2(1+2*Cj))$.

I could do this manually, but I want to know if it is possible to tell Mathematica something like : "Consider that I have a polynomial expression in SixJSymbol and triple456, I want that you simplify the factors in front of each of those terms". (If I basically do a Simplify here, I will no longer have a "factorisation" by SixJsymbol and triple456).

Is this possible ? If it is, I would like the simplest way to do it.

Use Collect with Simplify as the third argument:

expr= 1/4 (-Inactive[Cj][j]^2-2 Inactive[Cj][j]^3) Inactive[SixJSymbol][{j,j,j},{j,j,j}] -
1/2 Inactive[Cj][j] Inactive[triple456][j,j,j,j,j,j];

Collect[
expr,
Inactive[SixJSymbol][__] | Inactive[triple456][__],
Simplify
]


-(1/4) Inactive[Cj][ j]^2 (1 + 2 Inactive[Cj][j]) Inactive[SixJSymbol][{j, j, j}, {j, j, j}] - 1/2 Inactive[Cj][j] Inactive[triple456][j, j, j, j, j, j]

• Collect is really magic, thanks ! Jul 11, 2017 at 15:24