MathGroup Archive 2009

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

Search the Archive

Re: Coefficient Question

poly = 8 (3 + 5 k + 4 x1 + 6 x2 + 45 x3);

Select[Expand[poly], FreeQ[#, Alternatives @@ Variables[poly]] &]

Extract[CoefficientList[poly, Variables[poly]], 
 Array[1 &, Length[Variables[poly]]]]

Array[0 &, Length[Variables[poly]]] /. 
 CoefficientRules[poly, Variables[poly]]

David Park
djmpark at  

From: Scott [mailto:sguthery at] 

I've got the expression


and I want to extract the constant 24.

Yes, I can define a function and then set k and x1 and x2 and x3 to 0
but there has to be easier way, no?

Any suggestions?

Thanks much.

Cheers, Scott

  • Prev by Date: Re: Coefficient Question
  • Next by Date: Re: Subscript[x,1] value do not get cleared using Clear["Global`*"] but get removed using Remove["Global`*]
  • Previous by thread: Re: Coefficient Question
  • Next by thread: WorkingPrecision and NDSolve