## Computing the super $$q$$-shuffle product.

#### The super $$q$$-shuffle product

Let $$\mathsf I$$ be a $$\mathbb Z/2\mathbb Z$$-graded set equipped with a $$\mathbb Z$$-valued inner product $$(,)$$ on $$\mathsf I \times \mathsf I$$; we will call $$i\in \mathsf I$$ a letter and $$\mathsf I$$ the alphabet. We say $$p(i)=0$$ or $$p(i)=1$$ if $$i\in \mathsf I_0$$ or $$i\in \mathsf I_1$$ respectively and call $$p(i)$$ the parity of $$i$$. We extend the inner product and parity to $$\mathbb Z[\mathsf I]$$. The $$\mathbb Q(q)$$-vector space $$\mathsf F$$ is the vector space whose basis is words in $$\mathsf I$$; that is, sequences $$\mathbf i=[i_1i_2i_3\ldots i_n]\in \mathsf I^n$$. This vector space is naturally turned into an algebra with multiplication of basis elements defined by concatenating the words; that is, $[i_1,\ldots, i_n]\cdot [i_{n+1}\ldots i_{n+m}]=[i_1\ldots i_{n+m}].$ (In other words, $$\mathsf F$$ is isomorphic to the algebra of polynomials in $$|\mathsf I|$$ noncommuting variables over the field $$\mathbb Q(q)$$). This algebra naturally has a $$\mathbb Z[\mathsf I]\times \mathbb Z/2\mathbb Z$$-grading where $$|[i_1i_2\ldots i_n]|=i_1+i_2+\ldots+i_n$$ and $$p([i_1i_2\ldots i_n])=p(i_1)+\ldots +p(i_n)$$.

On the other hand, $$\mathsf F$$ has another natural product, called the $$q$$-shuffle and denoted by $$\diamond_q$$. The technical definition of this product is best given recursively. Let $$w,w'$$ be words and $$i,j\in \mathsf I$$. Then $(w\cdot [i])\diamond_q(w'\cdot [j])=(w\diamond_q(w'\cdot[j]))\cdot[i]+ (-1)^{p(j)p(w)+p(j)p(i)}q^{-j\cdot |w|-j\cdot i}((w\cdot[i])\diamond_q w')\cdot[j].$ To understand this product, it is perhaps best to use the example of shuffling two letters together: $$[i]\diamond_q [j]=[ji]+(-1)^{p(i)p(j)}q^{-i\cdot j} [ij]$$. The coefficient of $$[ij]$$ is the cost of not shuffling the $$j$$ past the $$i$$. In general, the shuffle product of two words is the sum over all the ways to interleave the two words scaled by a corresponding cost.

#### Computing shuffles

The following interface allows shuffle products on the letters $$\mathsf I=\{i,j,k\}$$. Use the checkboxes to indicate which letters should have odd parity, and enter the desired integer values of inner products in the corresponding matrix entry. Then type the desired words in $$I$$ you wish to shuffle, and press go. The result will be printed in the box below (though it is very likely a nontrivial shuffle will exceed the box in length!)

$$(,)$$ $$i$$ $$j$$ $$k$$
$$i$$
$$j$$
$$k$$
$$w_1=$$, $$w_2=$$

#### Implementation

This script runs as a .sucgi. It is written in Python. This implementation is done using four classes (representing Monomials, Polynomials, Words, and "Wordnomials").