Mathematica 9 is now available
Previous section-----Next section

3.3.2 Finding the Structure of a Polynomial

PolynomialQ[expr, x] test whether expr is a polynomial in x
PolynomialQ[expr, { ,  , ... }] test whether expr is a polynomial in the
Variables[poly] a list of the variables in poly
Exponent[poly, x] the maximum exponent with which x appears in poly
Coefficient[poly, expr] the coefficient of expr in poly
Coefficient[poly, expr, n] the coefficient of expr^n in poly
Coefficient[poly, expr, 0] the term in poly independent of expr
CoefficientList[poly, { ,  , ... }]
generate an array of the coefficients of the  in poly

Finding the structure of polynomials written in expanded form.
Here is a polynomial in two variables.

In[1]:=  t = (1 + x)^3 (1 - y - x)^2

Out[1]=

This is the polynomial in expanded form.

In[2]:=  Expand[t]

Out[2]=

PolynomialQ reports that t is a polynomial in x.

In[3]:=  PolynomialQ[t, x]

Out[3]=

This expression, however, is not a polynomial in x.

In[4]:=  PolynomialQ[x + Sin[x], x]

Out[4]=

Variables gives a list of the variables in the polynomial t.

In[5]:=  Variables[t]

Out[5]=

This gives the maximum exponent with which x appears in the polynomial t. For a polynomial in one variable, Exponent gives the degree of the polynomial.

In[6]:=  Exponent[t, x]

Out[6]=

Coefficient[poly, expr] gives the total coefficient with which expr appears in poly. In this case, the result is a sum of two terms.

In[7]:=  Coefficient[t, x^2]

Out[7]=

This is equivalent to Coefficient[t, x^2].

In[8]:=  Coefficient[t, x, 2]

Out[8]=

This picks out the coefficient of  in t.

In[9]:=  Coefficient[t, x, 0]

Out[9]=

CoefficientList gives a list of the coefficients of each power of  , starting with  .

In[10]:=  CoefficientList[1 + 3x^2 + 4x^4, x]

Out[10]=

For multivariate polynomials, CoefficientList gives an array of the coefficients for each power of each variable.

In[11]:=  CoefficientList[t, {x, y}]

Out[11]=

It is important to notice that the functions in this section will work even on polynomials that are not explicitly given in expanded form.

Many of the functions also work on expressions that are not strictly polynomials.

Without giving specific integer values to a, b and c, this expression cannot strictly be considered a polynomial.

In[12]:=  x^a + x^b + y^c

Out[12]=

Exponent[expr, x] still gives the maximum exponent of x in expr, but here has to write the result in symbolic form.

In[13]:=  Exponent[%, x]

Out[13]=



Any questions about topics on this page? Click here to get an individual response.Buy NowMore Information
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.