collecting terms



After expanding, the polynomial is in general form.  For a polynomial
in general form, I suggest that you use 'coeff' instead of 'ratcoeff' to 
find its coefficients. For some cases, coeff will be faster.  Consider

(%i1)  p : sum(k * x^k,k,1,7000)$
Evaluation took 46.12 seconds (46.12 elapsed)

(%i2) sum(coeff(p,x,k),k,5000,5099)$
Evaluation took 0.87 seconds (0.87 elapsed)

(%i3) sum(ratcoeff(p,x,k),k,5000,5099)$
Evaluation took 27.03 seconds (27.03 elapsed)


Barton