Re: coefficient of a polynomial term
- To: mathgroup at smc.vnet.net
- Subject: [mg59361] Re: [mg59339] coefficient of a polynomial term
- From: Bob Hanlon <hanlonr at cox.net>
- Date: Sun, 7 Aug 2005 03:46:55 -0400 (EDT)
- Reply-to: hanlonr at cox.net
- Sender: owner-wri-mathgroup at wolfram.com
poly=2 x^2+3 x*y+4 y^2+x^3 x^3 + 2*x^2 + 3*y*x + 4*y^2 Note that the output order is not the same as input order. Further, both differ from the order in which the terms are stored List@@poly {2*x^2, x^3, 3*x*y, 4*y^2} The usual way to extract coefficients is CoefficientList[poly,{x,y}] {{0, 0, 4}, {0, 3, 0}, {2, 0, 0}, {1, 0, 0}} However, if you want to specify the order of the coefficients Coefficient[poly,#]&/@{x^2,x*y,y^2,x^3} {2,3,4,1} Bob Hanlon > > From: "Tun Myint Aung" <tma at nus.edu.sg> To: mathgroup at smc.vnet.net > Date: 2005/08/06 Sat AM 01:29:28 EDT > Subject: [mg59361] [mg59339] coefficient of a polynomial term > > Dear Mathgroup, > > One more question again! How to extract the coefficient of a polynomial term. For example: > > poly = 2 x^2 +3 x*y +4 y^2+x^3 > > I would like to get 2 for first term, 3 for second term, 4 for third term and so on.. > > Thank everyone for answering my questions > > > With Regards, > > Tun Myint Aung > >