Skip to main content
updated to AbsoluteTiming and added more info on the system
Source Link

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)?

Why is CoefficientRules so slow in this example (v10.2)?

expr = Sum[x^i, {i, 1, 15}]^30;
CoefficientRules[expr/(expr + expr^2), y]; // Timing
MonomialList[expr/(expr + expr^2), y]; // Timing
CoefficientRules[Expand@(expr/(expr + expr^2)), y]; // Timing
CoefficientList[expr/(expr + expr^2), y]; // Timing

(* Out: 
 {1.22308, Null}
 {1.3556, Null}
 {10.868, Null}
 {0.000042, 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)?

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]; // AbsoluteTiming
MonomialList[expr/(expr + expr^2), y]; // AbsoluteTiming
CoefficientRules[Expand@(expr/(expr + expr^2)), y]; // AbsoluteTiming
CoefficientList[expr/(expr + expr^2), y]; // AbsoluteTiming

(* Out: 
    {1.83157, Null}
    {1.42334, Null}
    {8.48815, Null}
    {0.000063, 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)?

added 8 characters in body
Source Link

Why is CoefficientRules so slow in this example (v10.2)?

expr = Sum[x^i, {i, 1, 15}]^30;
CoefficientRules[expr/(expr + expr^2), y]; // Timing
MonomialList[expr/(expr + expr^2), y]; // Timing
CoefficientRules[Expand@(expr/(expr + expr^2)), y]; // Timing
CoefficientList[expr/(expr + expr^2), y]; // Timing

(* Out: 
 {1.22308, Null}
 {1.3556, Null}
 {10.868, Null}
 {0.000042, 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)?

Why is CoefficientRules so slow in this example?

expr = Sum[x^i, {i, 1, 15}]^30;
CoefficientRules[expr/(expr + expr^2), y]; // Timing
MonomialList[expr/(expr + expr^2), y]; // Timing
CoefficientRules[Expand@(expr/(expr + expr^2)), y]; // Timing
CoefficientList[expr/(expr + expr^2), y]; // Timing

(* Out: 
 {1.22308, Null}
 {1.3556, Null}
 {10.868, Null}
 {0.000042, 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)?

Why is CoefficientRules so slow in this example (v10.2)?

expr = Sum[x^i, {i, 1, 15}]^30;
CoefficientRules[expr/(expr + expr^2), y]; // Timing
MonomialList[expr/(expr + expr^2), y]; // Timing
CoefficientRules[Expand@(expr/(expr + expr^2)), y]; // Timing
CoefficientList[expr/(expr + expr^2), y]; // Timing

(* Out: 
 {1.22308, Null}
 {1.3556, Null}
 {10.868, Null}
 {0.000042, 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)?

Formatted code
Source Link
MarcoB
  • 67.7k
  • 18
  • 96
  • 198

Why is CoefficientRules workingCoefficientRules so slow in this example?

In[572]:= 
expr = Sum[x^i, {i, 1, 15}]^30;
CoefficientRules[expr/(expr + expr^2), y]; // Timing
MonomialList[expr/(expr + expr^2), y]; // Timing
CoefficientRules[Expand@(expr/(expr + expr^2)), y]; // Timing
CoefficientList[expr/(expr + expr^2), y]; // Timing

Out[573]=(* Out: 
 {1.22308, Null}
 
Out[574]= {1.3556, Null}
 
Out[575]= {10.868, Null}
 
Out[576]= {0.000042, 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]& 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)?

Why is CoefficientRules working so slow in this example?

In[572]:= 
expr = Sum[x^i, {i, 1, 15}]^30;
CoefficientRules[expr/(expr + expr^2), y]; // Timing
MonomialList[expr/(expr + expr^2), y]; // Timing
CoefficientRules[Expand@(expr/(expr + expr^2)), y]; // Timing
CoefficientList[expr/(expr + expr^2), y]; // Timing

Out[573]= {1.22308, Null}
 
Out[574]= {1.3556, Null}
 
Out[575]= {10.868, Null}
 
Out[576]= {0.000042, 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)?

Why is CoefficientRules so slow in this example?

expr = Sum[x^i, {i, 1, 15}]^30;
CoefficientRules[expr/(expr + expr^2), y]; // Timing
MonomialList[expr/(expr + expr^2), y]; // Timing
CoefficientRules[Expand@(expr/(expr + expr^2)), y]; // Timing
CoefficientList[expr/(expr + expr^2), y]; // Timing

(* Out: 
 {1.22308, Null}
 {1.3556, Null}
 {10.868, Null}
 {0.000042, 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)?

Source Link
Loading