It's worth checking the following to make sure that it reproduces what you expect. If not, I can fix it.
First define the indices:
With[{m = 5, k = 3},
indices = Flatten[Permutations /@ IntegerPartitions[5, {3}], 1]
]
(* {{3, 1, 1}, {1, 3, 1}, {1, 1, 3}, {2, 2, 1}, {2, 1, 2}, {1, 2, 2}} *)
We map s
over these sets of indices:
ss = Append[#, v] & /@ Map[s, indices, {2}]
(* {{s[3], s[1], s[1], v}, {s[1], s[3], s[1], v}, {s[1], s[1], s[3], v},
{s[2], s[2], s[1], v}, {s[2], s[1], s[2], v}, {s[1], s[2], s[2], v}} *)
We define a helper-function
comm[x_, y_] = y.x - x.y;
(The flipped definition here is intentional.) We then do:
tem = Fold[comm, Reverse@#] & /@ Map[s, indices, {2}];
which creates a list of commutators, one for each set of indices. Finally, take a take the Total
:
Total @ tem;