Suppose I have two kinds of operators $a[i,j],a^\dagger[i,j]$ where i is a non-negative integer and $j=\pm 1$, I want to create a list containing all possible products of

$ a^{(\dagger)}[x_1,j_1]a^{(\dagger)}[x_2,j_2]a^{(\dagger)}[x_3,j_3]...a^{(\dagger)}[x_r,j_r]$

where $a^{(\dagger)}$ could take the value of $a$ or $a^\dagger$

such that

$r+ \sum_{i=1}^{r} |x_i|\leq K $

where K is an integer I need to specify.

The first question is how to create this list?

The second question is what can I do to restrict all elements of this list in a "normal-ordered form" meaning that $a^{\dagger}[i,j]$ is always in front of $a[i,j]$ ([i,j] have the same value for $a, a\dagger$) with the anti-commutation relation $a[i,j] a^\dagger[k,l] +a^\dagger[k,l] a[i,j]=\delta_{ik}\delta_{jl}$ where $\delta_{ij}=1$ if $i=j$ and 0 for other cases.

It would be ideal if I can make all elements having the form


meaning $a^{(\dagger)}[i,j]$ with same $[i,j]$ stays inside a parentheses.

  • $\begingroup$ One possibility: mathematica.stackexchange.com/a/220765/29734 $\endgroup$
    – march
    Sep 20, 2021 at 15:24
  • $\begingroup$ (That's for the normal-ordering stuff, not the list-making stuff.) $\endgroup$
    – march
    Sep 20, 2021 at 15:37
  • 1
    $\begingroup$ For the set of possible $x_i$'s, I believe IntegerPartitions[k - r, k, Range[r]] should work. Or maybe, Flatten[Permutations /@ IntegerPartitions[k - r, k, Range[r]], 1] $\endgroup$
    – march
    Sep 20, 2021 at 15:39
  • $\begingroup$ @march Thank you very much! I'm still trying the normal ordering stuff but the list-making one works perfectly. $\endgroup$
    – Vayne
    Sep 20, 2021 at 18:20
  • $\begingroup$ You might just want IntegerPartitions[k] (or perhaps Rest@IntegerPartitions[k]) to get them all at once. $\endgroup$
    – march
    Sep 20, 2021 at 18:21


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.