MathGroup Archive 1996

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

Search the Archive

RE: Constant term in polynomial?

  • To: mathgroup at
  • Subject: [mg3342] RE: [mg3326] Constant term in polynomial?
  • From: "Chandler, Seth" <SChandler at UH.EDU>
  • Date: Thu, 29 Feb 1996 03:23:16 -0500
  • Sender: owner-wri-mathgroup at

How about Select[7+ 3 x y - y ^2,AtomQ]

 Since the other terms in a polynomial will likely have a Times or Power 
head, this might work fairly well.

Seth J. Chandler
Associate Professor of Law
University of Houston Law Center
 > From: mathgroup-adm
To: mathgroup at
 > To: mathgroup
 > Subject: [mg3326] Constant term in polynomial?
 > Date: Monday, February 26, 1996 2:57AM
 > Arrgh, I feel stupid asking this question, but I can't think how to do 
 > how do I find the constant term in a polynomial in several variables in
 > Mathematica?  For example, the "7" in 7 + 3 x y + y^2 ?
 > I suppose one way would be to use
 >    Coefficient[Coefficient[7 + 3 x y + y^2,x,0],y,0].
 > But that's incredibly clunky, especially since I may have fifty or more
 > variables in my real-life problem.
 > I could evaluate the expression under the rule {x->0, y->0}, with the 
 > problem:  for fifty variables that's awkward.  I could build the rule 
 > Variables[expr], but that's clumsy and seems inefficient.
 > First[7 + 3 x y + y^2] will work for this one, since the 7 is present and
 > appears first in the FullForm representation.  But it won't work in
 > First[3 x y + y^2], which returns 3 x y.
 > OK, so I can build a command which computes Variables[First[expr]], and
 > if that's empty, returns 0; otherwise returns First[expr].  Also clunky
 > IMHO, but it seems the most workable--unless there's some trap I'm 
 > Or I can introduce an auxiliary variable "one", refer to the polynomial 
 > "7 one + 3 x y + y^2", and ask for Coefficient[expr, one].  Gag!  If I 
 > want to EVALUATE it, I have to remember to use the rule one->1.
 > There MUST be a standard way to do this, but I can't think of what it 
 > be!
 > --Ron Bruck


  • Prev by Date: Re: Constant term in polynomial?
  • Next by Date: Re: Constant term in polynomial?
  • Previous by thread: Re: Constant term in polynomial?
  • Next by thread: Re: Constant term in polynomial?