Details
A
stuffle sum of two words is the sum of all words formed by interlacing them, allowing equal-position letters to merge (via the alphabet product).
The stuffle sum is also known as "sticky shuffle sum", "quasi shuffle sum" or "harmonic shuffle sum".
ResourceFunction["StuffleProductExpand"] algebraically converts products of symbolic word objects into the sum of all stuffles of their index words.
Distributes over
Plus, pulls out scalar factors, and acts independently on each multiplicative factor.
Stuffle counts grow combinatorially; limits on depth/terms prevent blow-ups.
Words must appear under a symbolic head (e.g. w[{…}]). Bare lists such as {1,2} are not treated as words (to avoid list arithmetic e.g. {1,2} * {2,3} ⟶ {2,6}).
Handles products of any number of word objects; w[a]w[b]w[c]… expands to the full multi-stuffle (associative and multilinear).
Interprets w[u]^n (with integer n ≥ 0) as the n-fold stuffle power of u i.e. the stuffle of u with itself n times.