MathGroup Archive 1996

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

Search the Archive

Constant term in polynomial?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg3326] Constant term in polynomial?
  • From: bruck at mtha.usc.edu (Ronald Bruck)
  • Date: Mon, 26 Feb 1996 02:57:02 -0500
  • Organization: University of Southern California, Los Angeles, CA
  • Sender: owner-wri-mathgroup at wolfram.com

Arrgh, I feel stupid asking this question, but I can't think how to do it:
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 same
problem:  for fifty variables that's awkward.  I could build the rule using
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 missing?

Or I can introduce an auxiliary variable "one", refer to the polynomial as 
"7 one + 3 x y + y^2", and ask for Coefficient[expr, one].  Gag!  If I ever 
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 could be!

--Ron Bruck



==== [MESSAGE SEPARATOR] ====


  • Prev by Date: Re: [Q] ExtendGraphics ListSurfacePlot3D inconsistent error
  • Next by Date: Constant term in polynomial?
  • Previous by thread: Re: Problem reading binary files - news26.txt [1/1]
  • Next by thread: Constant term in polynomial?