Mathematica 9 is now available
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.
Mathematica > Mathematics and Algorithms > Formula Manipulation > Algebraic Transformations >

Collect

Collect[expr, x]
collects together terms involving the same powers of objects matching x.
Collect[expr, {x1, x2, ...}]
collects together terms that involve the same powers of objects matching x1, x2, ... .
Collect[expr, var, h]
applies h to the expression that forms the coefficient of each term obtained.
  • Collect[expr, x] effectively writes expr as a polynomial in x or a fractional power of x.
  • Collect[expr, x, Simplify] can be used to simplify each coefficient separately.
  • Collect automatically threads over lists in expr, as well as equations, inequalities and logic functions.
Collect terms involving x:
Collect each power of x:
Simplify each coefficient:
Collect terms involving x:
In[1]:=
Click for copyable input
Out[1]=
 
Collect each power of x:
In[1]:=
Click for copyable input
Out[1]=
Simplify each coefficient:
In[2]:=
Click for copyable input
Out[2]=
A polynomial:
A Puiseux polynomial:
Collect with respect to two variables:
Collect with respect to a pattern:
Collect derivative terms:
Collect over the integers modulo 2:
Expand is effectively the inverse of Collect:
The order of variables matters:
New in 1 | Last modified in 6
Ask a question about this page  |  Suggest an improvement  |  Leave a message for the team