Re: CoefficientList
- To: mathgroup at smc.vnet.net
- Subject: [mg74532] Re: [mg74479] CoefficientList
- From: Bob Hanlon <hanlonr at cox.net>
- Date: Sat, 24 Mar 2007 05:22:20 -0500 (EST)
- Reply-to: hanlonr at cox.net
t = (1 + x)^3 (1 - y - x)^2;
c=CoefficientList[t,{x,y}];
t == x^Range[0,5].c.y^Range[0,2] ==
Sum[c[[i+1,j+1]]*x^i*y^j,{i,0,5},{j,0,2}]//
Simplify
True
{1,-2,1} are coefficients for the terms {x^0*y^0, x^0*y^1, x^0*y^2}
Bob Hanlon
---- Luke <hazelnusse at gmail.com> 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
>
>