Function reference · Math

expand

Multiplies out products and powers into a sum of terms.

It distributes products over sums and expands integer powers, all the way down. Functions such as sin(2*x) aren't rewritten, and nothing is evaluated numerically.

Notation

expand(args)

Write it in an expression: nerdamer('expand((x+1)^3)'), or in the Playground.

nerdamer.expand

nerdamer.expand(...args: [x]): Expression

A method on the default import. Arguments can be strings, as in Notation.

Examples

A binomial power.

expand((x+1)^3)
// → 1+3*x+3*x^2+x^3
Open in Playground

A product of sums.

expand((x+y)*(x-y))
// → x^2-y^2
Open in Playground

Functions aren't rewritten.

expand(sin(2*x))
// → sin(2*x)
Open in Playground

← Back to Function reference