Is there some idea to get the coefficients for a very complicated, huge, and explicit polynomial expression to avoid insufficient memory problem? I am trying to use GroebnerBasis`DistributedTermsList and CoefficientRules. One problem I find is, their obtained coefficients are also expanded.

exp = (t1 + t2)^3 x1 + (t2 t1)^4 x1 x1 ;


  CoefficientRules[exp, {x1}]
  {{2} -> t1^4 t2^4, {1} -> t1^3 + 3 t1^2 t2 + 3 t1 t2^2 + t2^3}

Is there a simple way or option to get,

   {{2} -> (t2 t1)^4, {1} -> (t1 + t2)^3}

In this case, I think probably it is useful for the treatment of the huge expressions using CoefficientRules.

  • $\begingroup$ FullSimplify[CoefficientRules[exp, {x1}]]? $\endgroup$ – kglr Jun 10 '19 at 5:27
  • 1
    $\begingroup$ Try CoefficientList instead. $\endgroup$ – bbgodfrey Jun 10 '19 at 5:35
  • 2
    $\begingroup$ Note that the size of the output may not be the determining factor in the amount of memory used to obtain the output. $\endgroup$ – bbgodfrey Jun 10 '19 at 5:49
  • $\begingroup$ @kglr It works for this simple example. But I actually want to deal with the huge expressions in this way. $\endgroup$ – Orders Jun 10 '19 at 6:02
  • $\begingroup$ @bbgodfrey Yes, CoefficientList is a good choice. Thanks. Any idea to extract the coefficient of handle huge amounts of expressions? Sorry, this is a too general question. $\endgroup$ – Orders Jun 10 '19 at 6:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.