collects together terms involving the same powers of objects matching x.
collects together terms that involve the same powers of objects matching x1, x2, ….
applies h to the expression that forms the coefficient of each term obtained.
Details and Options
- 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.
Examplesopen allclose all
Basic Examples (2)
Collect terms involving x:
Collect each power of x:
Simplify each coefficient:
A Puiseux polynomial:
Collect with respect to two variables:
Collect with respect to a pattern:
Collect derivative terms:
Collect over the integers modulo 2:
Properties & Relations (2)
Expand is effectively the inverse of Collect:
The order of variables matters:
Introduced in 1988
Updated in 1996