Mathematica 9 is now available
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.
Mathematica HowTo
How to | Rearrange the Terms of a Polynomial
Mathematica provides many functions to group terms in a polynomial, extract and sort the monomials, display them in various ways, and even process them as arbitrary expression structures.
Define a polynomial in x and exponentials of x:
In[1]:=
Click for copyable input
Out[1]=
Collect the powers of x:
In[2]:=
Click for copyable input
Out[2]=
Group terms that match the pattern; in this case terms that have the same exponential factors are grouped:
In[3]:=
Click for copyable input
Out[3]=
Apply Simplify to the coefficient of each term after collecting the terms:
In[4]:=
Click for copyable input
Out[4]=
    
There are many ways to extract terms from an expression. Here is a polynomial in x:
In[5]:=
Click for copyable input
Out[5]=
Get the coefficient of x^0 (the constant term):
In[6]:=
Click for copyable input
Out[6]=
Get the same term by replacing x with zero, thus eliminating all terms that depend on x:
In[7]:=
Click for copyable input
Out[7]=
    
Get the list of the monomials ordered from high to low powers of x:
In[8]:=
Click for copyable input
Out[8]=
The polynomial will appear in the same order when displayed in TraditionalForm:
In[9]:=
Click for copyable input
Out[9]//TraditionalForm=
Ask a question about this page  |  Suggest an improvement  |  Leave a message for the team