Re: matrix of coefficients?

*To*: mathgroup at christensen.cybernetics.net*Subject*: Re: matrix of coefficients?*From*: Richard Mercer <richard at rmercer.wright.edu>*Date*: Tue, 25 Oct 1994 08:29:08 -0400

> Dear mathgroupers: > > If varsN = a list of N variables, and if exprsN = a list > of of N expressions, each one linear in the variables of > varsN, > > Is there some operator (that I haven't found yet), or > some clever way to use a nonobvious operator, to get the > matrix of coefficients? > > I'm doing it, but it is not a pretty sight. I just have > a feeling there must be some neat way to do this very > commonly needed operation. Thanks- Martin McClain, > Chemistry, Wayne State University, Detroit > I agree. What you want is Outer[Coefficient,exprsN,varsN] In[11]:= exprsN = {3x + 4y + 5z, 6x + 7y + 8z, 9x + 10y + 11z}; varsN = {x,y,z}; Outer[Coefficient,exprsN,varsN] Out[13]= {{3, 4, 5}, {6, 7, 8}, {9, 10, 11}} Try it! ********************************************************************* Richard Mercer 513-873-2191 office Department of Mathematics and Statistics 513-873-2785 message Wright State University 513-429-2179 fax Dayton, OH 45435 NeXTmail welcome! richard at rmercer.wright.edu or rmercer at desire.wright.edu *********************************************************************