MATHEMATICA TUTORIAL
Finding the Structure of a Polynomial
| PolynomialQ[expr,x] | test whether expr is a polynomial in x |
| PolynomialQ[expr,{x1,x2,...}] | 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 |
| Coefficient[poly,expr,0] | the term in poly independent of expr |
| CoefficientList[poly,{x1,x2,...}] | generate an array of the coefficients of the |
| CoefficientRules[poly,{x1,x2,...}] | get exponent vectors and coefficients of monomials |
Finding the structure of polynomials written in expanded form.
| In[1]:= |
| Out[1]= |
| In[2]:= |
| Out[2]= |
| In[3]:= |
| Out[3]= |
| In[4]:= |
| Out[4]= |
| In[5]:= |
| Out[5]= |
This gives the maximum exponent with which
appears in the polynomial
. For a polynomial in one variable, Exponent gives the degree of the polynomial.
| In[6]:= |
| 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]:= |
| Out[7]= |
This is equivalent to Coefficient[t, x^2].
| In[8]:= |
| Out[8]= |
| In[9]:= |
| Out[9]= |
| In[10]:= |
| Out[10]= |
For multivariate polynomials, CoefficientList gives an array of the coefficients for each power of each variable.
| In[11]:= |
| Out[11]= |
CoefficientRules includes only those monomials that have nonzero coefficients.
| In[12]:= |
| Out[12]= |
It is important to notice that the functions in this tutorial will often 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
,
, and
, this expression cannot strictly be considered a polynomial.
| In[13]:= |
| Out[13]= |
Exponent[expr, x] still gives the maximum exponent of
in expr, but here has to write the result in symbolic form.
| In[14]:= |
| Out[14]= |
