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
and exponentials of
:
| In[2]:= |
| Out[2]= |
Collect the powers of
:
| In[3]:= |
| Out[3]= |
Group terms that match the pattern; in this case terms that have the same exponential factors are grouped:
| In[4]:= |
| Out[4]= |
Apply Simplify to the coefficient of each term after collecting the terms:
| In[5]:= |
| Out[5]= |
There are many ways to extract terms from an expression. Here is a polynomial in
:
| In[6]:= |
| Out[6]= |
Get the coefficient of
(the constant term):
| In[7]:= |
| Out[7]= |
Get the same term by replacing
with zero, thus eliminating all terms that depend on
:
| In[8]:= |
| Out[8]= |
Get the list of the monomials ordered from high to low powers of
:
| In[9]:= |
| Out[9]= |
The polynomial will appear in the same order when displayed in TraditionalForm:
| In[10]:= |
Out[10]//TraditionalForm= | |
