Why is CoefficientRules
so slow in this example (v10.2 on OS X 10.11.4)?
expr = Sum[x^i, {i, 1, 15}]^30;
CoefficientRules[expr/(expr + expr^2), y]; // TimingAbsoluteTiming
MonomialList[expr/(expr + expr^2), y]; // TimingAbsoluteTiming
CoefficientRules[Expand@(expr/(expr + expr^2)), y]; // TimingAbsoluteTiming
CoefficientList[expr/(expr + expr^2), y]; // TimingAbsoluteTiming
(* Out:
{1.2230883157, Null}
{1.355642334, Null}
{108.86848815, Null}
{0.000042000063, Null}
*)
Note that it does not seem to be related to the similar issue that Coefficient
does not always expand the expression. Also note that the expression to which CoefficientRules[#, y] &
is applied does not actually contain y
.
Is there any clever way of efficiently achieving the result of CoefficientRules
or MonomialList
without parsing the output of CoefficientList
(as I want to generally be able to use this efficiently in the multivariate case)?