MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: CoefficientList

  • To: mathgroup at smc.vnet.net
  • Subject: [mg74536] Re: CoefficientList
  • From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
  • Date: Sat, 24 Mar 2007 05:24:33 -0500 (EST)
  • Organization: The Open University, Milton Keynes, UK
  • References: <eu1pgs$ev0$1@smc.vnet.net>

Luke wrote:
> I'm having a little trouble understanding how CoefficientList works
> for multivarate polynomials.  In the Mathematica book, there is this
> example:
> t = (1 + x)^3 (1 - y - x)^2
> 
> Expand[t]
> 1 + x - 2x^2 - 2x^3 + x^4 + x^5 - 2y - 4xy + 4x^3y + 2x^4y + y^2 +
> 3xy^2 + 3x^2y^2 + x^3y^2
> CoefficientList[t,{x,y}]
> {{1, -2, 1}, {1, -4, 3}, {-2, 0, 3}, {-2, 4, 1}, {1, 2, 0}, {1, 0, 0}}
> 
> I am confused as to what each entry of the output of the
> CoefficientList corresponds to.  The Handbook says:
> For multivariate polynomials, CoefficientList gives an array of the
> coefficients for each power of each variable.
> 
> So what exactly do the entries of the first item, {1,-2,1}, correspond
> to?  Is it the 0 order terms? Why three entries then?  Is
> corresponding to the 1, the x, and the -2y?  What is the order of each
> of these lists?  Maybe I'm just being dense, but it isn't immediately
> obvious to me how this is structured, and the Handbook is extremely
> terse in its description.
> 
> Any help would be greatly appreciated.
> 
> Thanks,
> ~Luke
> 
> 

Hi Luke,

Say we have a multivariate polynomial in x and y with highest powers n 
and m, respectively. The function CoefficientList returns a rectangular 
array where the rows correspond to the increasing powers of x (0 to n, 
from top to bottom) and the column columns correspond to the increasing 
powers of y (0 to m, from left to right). Each entry displays the 
corresponding coefficient. For instance,

In[1]:=
p = a + b*x^3 + c*x^2*y + d*x*y^2 + e*y^3;
Exponent[p, {x, y}]
CoefficientList[p, {x, y}]
TableForm[%, TableHeadings -> {{x^0, x^1, x^2, x^3},
     {y^0, y^1, y^2, y^3}}]

Out[2]=
{3, 3}

Out[3]=
{{a, 0, 0, e}, {0, 0, d, 0}, {0, c, 0, 0}, {b, 0, 0, 0}}

Out[4]=

Out[8]//TableForm=

                     2    3
           1   y    y    y

      1    a   0    0    e

      x    0   0    d    0

       2
      x    0   c    0    0

       3
      x    b   0    0    0

HTH,
Jean-Marc


  • Prev by Date: Re: what the beep? - a very strange bug
  • Next by Date: Re: what the beep? - a very strange bug
  • Previous by thread: Re: CoefficientList
  • Next by thread: what the beep? - a very strange bug