MathGroup Archive 2007

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

Search the Archive

Re: Coefficient...


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...