Re: Coefficients in expressions
- To: mathgroup at smc.vnet.net
- Subject: [mg16822] Re: [mg16742] Coefficients in expressions
- From: Andrzej Kozlowski <andrzej at tuins.ac.jp>
- Date: Tue, 30 Mar 1999 02:35:21 -0500
- Sender: owner-wri-mathgroup at wolfram.com
A slight correction to the message I sent earlier. The definition of coeffs should be: In[1]:= coeffs[Equal[x_,y_],z_]:=Coefficient[x,z]-Coefficient[y,z]; SetAttributes[coeffs,HoldFirst]; (There is no need for z to be a list as was the case in my origial message!) On Wed, Mar 24, 1999, Virgil Stokes <virgil.stokes at neuro.ki.se> wrote: >I have generated several expressions (equations) in the form of: > > c1*x1 + c2*x1' + c3*x2 + c4*y1+...+a1*x1'+ a2*y1 + a5*x1 +... == f1*z1 +... > >where, the equations can be over 50 lines in length. >I would like to have a procedure (say Coeffs[.]) that would >allow me to specify as input the "names" in the equations. The >output would be all the coefficients for that list of names. >For example, for the above, > > Coeffs[%,x1,x1',y1] > >would output, > > x1: (c1+a5) > x1': (c2+a1) > y1: (c4+a2) > >-- V. Stokes > > Andrzej Kozlowski Toyama International University JAPAN http://sigma.tuins.ac.jp/ http://eri2.tuins.ac.jp/