# expansion + exp¶

An expansion which denotes the sum (or disjunction) of both denoted series.

Preconditions:

• Both expansions have the same weightset.

In :
import vcsn
e1 = vcsn.Z.expression('<3>abc+<4>d(a+<3>c)')
x1 = e1.expansion()
e2 = vcsn.Z.expression('<5>abc+<-2>d(<2>a+c)')
x2 = e2.expansion()

In :
x1

Out:
$a \odot \left[\left\langle 3\right\rangle b \, c\right] \oplus d \odot \left[\left\langle 4\right\rangle a + \left\langle 3 \right\rangle \,c\right]$
In :
x2

Out:
$a \odot \left[\left\langle 5\right\rangle b \, c\right] \oplus d \odot \left[\left\langle -2\right\rangle \left\langle 2 \right\rangle \,a + c\right]$
In :
x1 + x2

Out:
$a \odot \left[\left\langle 8\right\rangle b \, c\right] \oplus d \odot \left[\left\langle 4\right\rangle a + \left\langle 3 \right\rangle \,c \oplus \left\langle -2\right\rangle \left\langle 2 \right\rangle \,a + c\right]$

The sum of the expansions is the expansion of the sum.

In :
(e1 + e2).expansion()

Out:
$a \odot \left[\left\langle 8\right\rangle b \, c\right] \oplus d \odot \left[\left\langle 4\right\rangle a + \left\langle 3 \right\rangle \,c \oplus \left\langle -2\right\rangle \left\langle 2 \right\rangle \,a + c\right]$