Skip to main content
[Edit removed during grace period]
Source Link
march
  • 24.2k
  • 2
  • 46
  • 102
Post Undeleted by march
added 444 characters in body
Source Link
march
  • 24.2k
  • 2
  • 46
  • 102

Here's a streamlined version ofIt'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]
 ];]
Dot[##(* {{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}] // Total

(* {{s[3], s[1]., s[1].s[3]., v}, +{s[1], s[3], s[1].s[2].s[2]., v}, +{s[1], s[1]., s[3].s[1]., v},
   +{s[2], s[2]., s[1]., v}, {s[2]., s[1], s[2], v}, +{s[1], s[2]., s[2].s[1]., v}} +*)

We define a helper-function

comm[x_, s[3].s[1]y_] = y.s[1]x - x.vy;

(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;

Here's a streamlined version of it:

With[{m = 5, k = 3},
   indices = Flatten[Permutations /@ IntegerPartitions[5, {3}], 1]
 ];
Dot[##, v] & @@@ Map[s, indices, {2}] // Total

(* s[1].s[1].s[3].v + s[1].s[2].s[2].v + s[1].s[3].s[1].v
   + s[2].s[1].s[2].v + s[2].s[2].s[1].v + s[3].s[1].s[1].v *)

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;
Post Deleted by march
Source Link
march
  • 24.2k
  • 2
  • 46
  • 102

Here's a streamlined version of it:

With[{m = 5, k = 3},
   indices = Flatten[Permutations /@ IntegerPartitions[5, {3}], 1]
 ];
Dot[##, v] & @@@ Map[s, indices, {2}] // Total

(* s[1].s[1].s[3].v + s[1].s[2].s[2].v + s[1].s[3].s[1].v
   + s[2].s[1].s[2].v + s[2].s[2].s[1].v + s[3].s[1].s[1].v *)