I have a polynomial in $a$ and $b$:

$$(Aa^2 + Bb^2 + Ca + Db + E)^m$$

How can I construct a table of coefficients corresponding to all different products $a^i b^j$ in the expansion for a defined $m$, and another table with the entries $i,j$ so that it is easy to track which coefficient corresponds to which term?

  • $\begingroup$ Can you show why Collect doesn't provide what you want or how to get what you want? $\endgroup$ Apr 9 at 23:21
  • 2
    $\begingroup$ Have you seen CoefficientArrays or CoefficientRules? $\endgroup$
    – Michael E2
    Apr 9 at 23:31
  • $\begingroup$ @MichaelE2, I wasn't aware of CoefficientRules and that assigns the correct coefficients to all monomials as required $\endgroup$
    – Sid
    Apr 9 at 23:41

Here is an example for m==2:

m = 2;
ex = (c20  a^2 + c02 b^2 + c10 a + c01 b + c00)^m;
TableForm[CoefficientList[ex, {a, b}] , 
 TableHeadings -> {Range[0, 2 m], Range[0, 2 m]}]

enter image description here


Not the answer you're looking for? Browse other questions tagged or ask your own question.