Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2007
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

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


  • Prev by Date: Re: RegionPlot3D & MaxRecursion
  • Next by Date: RE: Where is the Navigate menu item in Workbench 1.1?
  • Previous by thread: Re: Coefficient...
  • Next by thread: Re: Coefficient...