Re: Coefficient...
- To: mathgroup at smc.vnet.net
- Subject: [mg79686] Re: Coefficient...
- From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
- Date: Thu, 2 Aug 2007 03:41:28 -0400 (EDT)
- Organization: The Open University, Milton Keynes, UK
- References: <f8n1i0$j87$1@smc.vnet.net>
Bruno Campanini wrote: > Given fx:=ax^2 + dxy + 2cx + bcxz > Coefficient[fx,x] gives dy + 2c + bcz but I only need 2c. > > Without any If clause, is it possible to get Coefficient not > to look on terms containing y or z? > > Bruno > The following might help: In[1]:= fx = a*x^2 + d*x*y + 2*c*x + b*c*x*z; Coefficient[fx, x] Coefficient[Plus @@ Cases[fx, p_ /; FreeQ[p, y] && FreeQ[p, z]], x] Out[2]= 2 c + d y + b c z Out[3]= 2 c Regards, Jean-Marc