I have the following expression
-(((-(L/r1) + L/r2)^2*(L/r1 - L/r3)^2*(-(L/r2) + L/r3)^2)/(1 + 1/r1 + 1/r2 + 1/r3)^2) + (1 + L^2/r1 + ((-(L/r1) + L/r2)*(L/r1 - L/r3))/(1 + 1/r1 + 1/r2 + 1/r3))*
(1 + L^2/r2 + ((-(L/r1) + L/r2)*(-(L/r2) + L/r3))/(1 + 1/r1 + 1/r2 + 1/r3))*(1 + 1/r1 + 1/r2 + 1/r3)*(1 + ((L/r1 - L/r3)*(-(L/r2) + L/r3))/(1 + 1/r1 + 1/r2 + 1/r3) +
L^2/r3)
Which I want to rewrite by collecting according to the inverse powers of r1, r2 and r3. That is, I want to get
1 + (1 + L^2)/r1 + (1 + L^2)/r2 + (1 + L^2)/r3 + (3*L^2 + L^4)/(r1*r2) + (3*L^2 + L^4)/(r1*r3) + (3*L^2 + L^4)/(r2*r3) + (9*L^4 + L^6)/(r1*r2*r3) -
L^6/(r1^2*r2^2) - L^6/(r1^2*r3^2) - L^6/(r2^2*r3^2) + (2*L^6)/(r1*r2*r3^2) + (2*L^6)/(r1*r2^2*r3) + (2*L^6)/(r1^2*r2*r3)
I have done this by hand, but for more complciated expressions I want to use Mathematica. I tried Collect[expression,{r1,r2,r3},Simplify] but it did nothing for me. Also, I do not want to collect in powers of L.






CoefficientList[expression, {1/r1, 1/r2, 1/r3}]Look it up in the help, for the output format – Daniel Huber Dec 28 '20 at 17:58