expand
Expands products and powers into sums of terms.
Category: Mathematics > Formula Manipulation and Simplification
Syntax
R = expand(S)
Multiplies out products and integer powers.
Description
expand distributes multiplication over addition, so (x+y)^3 becomes a sum of four terms. It also splits exponentials of sums, exp(x+y), in MATLAB, and applies angle-sum and multiple-angle identities to trigonometric functions. The opposite operations are factor and collect.
Input arguments
S- Symbolic expression, array, or equation.
Output arguments
R- Expanded expression equal to
S.
Example
Expand a polynomial
syms x y
expand((x + y)^3)
expand((x + 1)^2*(x - 2))
Output
ans = x^3 + 3*x^2*y + 3*x*y^2 + y^3
ans = x^3 - 3*x - 2
Notes
In MatLivre expand multiplies out polynomials, but identities for trigonometric, exponential and logarithmic functions (sin(x+y), cos(2*x), exp(x+y)) are not applied.