Scope (5)
Expand the 3-way shuffle of words:
Expand a 2 × 3 shuffle:
An empty word is treated as an identity:
ShuffleProductExpand distributes an expression linearly before expanding:
Shuffle independently by head and multiply the results:
Applications (9)
Cellular Automaton (5)
Use ShuffleProductExpand to enumerate all t-step LR-paths. Shuffles of Parity by displacement gives the exact Rule-90 row, matching CellularAutomaton[90].
Define a function that enumerates all length-t words over {L, R} via shuffle powers, with an explicit empty word only when t==0:
Define a displacement functional that maps a word to its net shift:
Build the length-(2t+1) parity row by counting words at each displacement k and taking Mod 2:
Construct a centered single-1 initial condition of length 2t+1 for comparison with CellularAutomaton:
Verify that every shuffle-predicted row equals the CellularAutomaton row over a range of times:
Game Theory (4)
Model a race i.e., a competition to act first by order, by encoding A and B moves as words (A has m moves, B has n). Use ShuffleProductExpand to enumerate all possible orderings, then compute the preemption probability by counting schedules that start with {A,A} (A wins the race).
Enumerate all interleavings of m A's and n B's via shuffle powers:
Declare the preemption predicate - the schedule starts with (A,A):
Compute the preemption probability for a concrete case m=3,n=8:
Confirm with the closed form:
Properties and Relations (10)
Shuffle product expansion is commutative:
Shuffle product expansion is associative:
Upon shuffling words of lengths m and n, every term has length m+n:
Relate term count to binomial/multinomial coefficients - for two words of lengths m and n, the shuffle product contains Binomial[m+n,m] (same as Binomial[m+n,n] or Multinomial[m,n]) terms:
Similarly for more factors - for words of lengths n1, n2, …, nk, the shuffle product contains Multinomial[n1,n2,…,nk] terms:
Expanding an already shuffled sum changes nothing (indempotence):
Reverse both inputs to reverse every shuffled word (reversal symmetry):
Reproduce shuffles of two words via multiset permutations. Generate A/B slot "skeletons" with permutations of a multiset and fill them left-to-right:
The filled lists match result from ShuffleProductExpand:
Reproduce two-word shuffles via Tuples: generate all length-m+n A/B slot sequences with exactly m A's, then fill them left → right from u/v:
Reproduce shuffles via choosing positions. Choose positions for the first word with Subsets[Range[m+n],{m}] and stream-fill A/B letters across the slots:
The filled lists match result from ShuffleProductExpand: