Expand

Expand[expr]

expands out products and positive integer powers in expr.

Expand[expr,patt]

leaves unexpanded any parts of expr that are free of the pattern patt. »

Details and Options

  • Expand works only on positive integer powers.
  • Expand applies only to the top level in expr.
  • Expand[expr,Modulus->p] expands expr reducing the result modulo p. »
  • Expand automatically threads over lists in expr, as well as equations, inequalities and logic functions.

Examples

open allclose all

Basic Examples  (1)

Expand polynomial expressions:

Scope  (4)

Variables need not be symbols:

Some powers can be symbolic:

Expand does not go into subexpressions; ExpandAll does:

Generalizations & Extensions  (3)

Leave parts free of x unexpanded:

Leave parts free of 1+x unexpanded:

Leave anything not matching x[_] unexpanded:

Options  (3)

Modulus  (2)

Work in the field GF(2):

The modulus does not have to be a prime:

Trig  (1)

Expand a trigonometric expression:

Properties & Relations  (3)

Many functions give results in unexpanded form:

Factor is essentially the inverse of Expand:

When no powers are involved, Distribute gives the same results as Expand:

Direct application of the distributive law often generates far more terms than are needed:

Neat Examples  (3)

Create a nested pattern corresponding to an additive cellular automaton (rule 60):

Introduced in 1988
 (1.0)
 |
Updated in 1996
 (3.0)
2007
 (6.0)