Re: Coefficient...
- To: mathgroup at smc.vnet.net
- Subject: [mg79635] Re: [mg79601] Coefficient...
- From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
- Date: Wed, 1 Aug 2007 04:51:17 -0400 (EDT)
- References: <200707311002.GAA19571@smc.vnet.net>
On 31 Jul 2007, at 12:02, 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 > Coefficient itself is not really well suited for this, but you can use either CoefficientList or CoefficientArrays: f = a x^2 + d x y + 2 c x + b c x z CoefficientArrays[f, {x, y, z}][[2, 1]] 2 c CoefficientList[f, {x, y}][[2, 1, 1]] 2 c Andrzej Kozlowski