superkomutator

◼ superkomutator[a, b, n] computes the order-n nested commutator [a, [a, ..., [a, b]]].
◼ superantikomutator[a, b, n] computes the order-n nested anti-commutator {a, {a, ..., {a, b}}}.

◼ See also: komutator, antikomutator.

Further examples

Load sneg and declare c to be a fermionic operator

<< sneg`sneg`;
snegfermionoperators[c];

Nest (anti-)commutators of spin operators

sx = spinx[c[]]
Table[{i, superkomutator[sx, c[CR, UP], i] // Expand}, {i, 0, 5}] // 
      TableForm
Table[{i, superantikomutator[sx, c[CR, UP], i] // Expand}, {i, 0, 5}] // 
      TableForm

sy = spiny[c[]]
Table[{i, superkomutator[sy, c[CR, UP], i] // Expand}, {i, 0, 5}] // 
      TableForm
Table[{i, superantikomutator[sy, c[CR, UP], i] // Expand}, {i, 0, 5}] // 
      TableForm

sz = spinz[c[]]
Table[{i, superkomutator[sz, c[CR, UP], i] // Expand}, {i, 0, 5}] // 
      TableForm
Table[{i, superantikomutator[sz, c[CR, UP], i] // Expand}, {i, 0, 5}] // 
      TableForm