# distribute

Distribute factors over sums.

Rewrite a product of sums as a sum of products, as in
\begin{equation*}
a\,(b+c) \rightarrow a\,b + a\,c\, .
\end{equation*}
This would readex:=a (b+c);
distribute(_);

\(\displaystyle{}a \left(b+c\right)\)

\(\displaystyle{}a b+a c\)

The algorithm in fact works on all objects which carry
the

`Distributable`

property, Op{#}::Distributable;
ex:=Op(A+B);
distribute(_);

\(\displaystyle{}\text{Attached property Distributable to }Op\left(\#\right).\)

\(\displaystyle{}Op\left(A+B\right)\)

\(\displaystyle{}Op\left(A\right)+Op\left(B\right)\)

The primary example of a property which inherits
the

`Distributable`

property
is `PartialDerivative`

. The `distribute`

algorithm
thus also automatically writes out partial derivatives of sums as sums
of partial derivatives,
\partial{#}::PartialDerivative;
ex:=\partial_{m}{A + B + C};
distribute(_);

\(\displaystyle{}\text{Attached property PartialDerivative to }\partial{\#}.\)

\(\displaystyle{}\partial_{m}\left(A+B+C\right)\)

\(\displaystyle{}\partial_{m}{A}+\partial_{m}{B}+\partial_{m}{C}\)