Re: Question about Coefficient
- To: mathgroup@smc.vnet.net
- Subject: [mg11531] Re: Question about Coefficient
- From: Paul Abbott <paul@physics.uwa.edu.au>
- Date: Fri, 13 Mar 1998 12:22:22 -0500
- Organization: University of Western Australia
- References: <6e83ab$nbs@smc.vnet.net>
Bob McDonald wrote: > I am trying to take a list of polynomials or monomials, say > > {x1 x2^2,x1^3,0} > > and determine the coefficients of each of the monomials. For example, > given > > {x1^3,0,0} > > I want to find that the coefficient of x1^3 is {1,0,0} > > This works using, e.g. > > Coefficient[{x1^2 x2,0,0},x1^2 x2] > > which yields {1,0,0}. ?? I get In[1]:= Coefficient[{x1^2 x2,0,0},x1^2 x2] Out[1]= {0,0,0} > Could someone suggest another function or method for doing this? I think CoefficientList and Variables (or maybe the undocumented MonomialList) would be more useful, e.g., In[2]:= CoefficientList[{x1^2 x2,2x1+x2,3x2},Variables[{x1^2 x2,2x1+x2,3x2}]] Out[2]= {{{0, 0}, {0, 0}, {0, 1}}, {{0, 1}, {2, 0}}, {{0, 3}}} Cheers, Paul ____________________________________________________________________ Paul Abbott Phone: +61-8-9380-2734 Department of Physics Fax: +61-8-9380-1014 The University of Western Australia Nedlands WA 6907 mailto:paul@physics.uwa.edu.au AUSTRALIA http://www.pd.uwa.edu.au/~paul God IS a weakly left-handed dice player ____________________________________________________________________