Collect terms by powers of a variable (collect)
Group the terms of an expression by powers of a variable.
How to write it
collect(expr, x)
- expr
- Any expression: a number, a formula, a list or a matrix. Takes an expression.
- x
- The variable to collect by. Takes a variable.
Examples
collect(x^2 y + x^2 z + x, x)In the solver,
Open in the solvercollect(x^2 y + x^2 z + x, x)givesx^2*(y + z) + x.
Related functions
- complex_expand
Expand an expression assuming its variables are real.
- coefficients
List the coefficients of a polynomial, constant term first.
- cyclotomic
Cyclotomic polynomial of a given order.
- cancel
Cancel the common factors of a fraction.
- degree
Degree of a polynomial in a variable.
- apart
Split a rational expression into partial fractions.