Generalized partition function with angular momentum I'm studying statistical mechanics, and I found this problem in my study material:
Suppose you have a gas consisting of N identical non-interacting atoms in a harmonic trap.  Consider its Hamiltonian as:
$$ H_N = \displaystyle \sum_{i=1}^N \dfrac{\vec{p}^2_i}{2m}+\dfrac{K}{2}\vec{r}_i^2$$
where K is constant. The problem is to build a generalized partition function that preserves angular momentum $\vec{L}= \displaystyle \sum_{i=1}^N \vec{r_i} \times \vec{p_i} $. The problem states to solve in 2 dimensions for simplicity, so my take is $\displaystyle \vec{L}=\hat{z}( \sum_{i=1}^N r_{i1}p_{i2}-r_{i2}p_{i1})$ (with $\vec{r}=(r_1,r_2,0)$ and same for p). So I understand that $L_3 = (r_1p_2-r_2p_1)$ is the quantity to be conserved, besides the energy.
Since there is no interaction, I understand it's safe to assume you can build the generalized partition function for a single particle and simply exponenciate to N to get the total partition function.
So with that in mind, i'd guess the generalized partition function must be of the form:
$$ Z_1 = \dfrac{1}{h^2}\int e^{-\beta H_1-\lambda L_3}d\vec{r} d\vec{p} =\dfrac{1}{h^2}\displaystyle \int e^{-\beta(\frac{p_1^2+p_2^2}{2m}+\frac{K}{2}(r_1^2+r_2^2))-\lambda(r_1p_2-r_2p_1)} dr_1 dr_2 dp_1 dp_2 $$
Now my problem becomes apparent: the angular momentum term gives diverges if I were to take the integration limits from $-\infty$ to $\infty$. So I'm guessing either I must somehow define finite integration limits (but I'm conflicted because there isn't a defined volume in the problem), or go to a discrete version and build $Z_1$ as a sum. I think you could argue there is a maximum distance of displacement given by initial conditions perhaps? But I'm not convinced. I've also tried completing the square for the terms in the exponent to see if it could help, but besides suggesting $\lambda = \beta \omega = \beta \sqrt{\dfrac{K}{m}}$ I cannot get rid of the divergence.
The problem eventually asks to calculate the average values  $\langle r^2\rangle$, $\langle \vec{r} \times \vec{p}\rangle$, and of $\langle \dfrac{\vec{r} \times \vec{p}}{r^2}\rangle$ and then interpret the Lagrange multiplier associated to L, that's why I'm using lagrange multipliers for L in the partition function. Perhaps there is another way to introduce it?
EDIT: I just thought that maybe using the alternate expression for angular momentum for a single point-like particle $L=I \omega = m r^2 \omega$ could solve the issue. Is it safe to use this expression?
 A: maybe I'm looking at it from a too simplistic point of view, but why do you need to introduce Lagrange multipliers? One can simply enforce the value of angular momentum by introducing the restriction to the integration over phase space to some value of $L_3=l_3$
$$ Z = \frac{1}{h^{d-1}}\int\! d^dr d^dp e^{-\beta H(\vec{r}, \vec{p})}\delta(L_3-l_3) $$
which might indeed be recast as a form of Lagrange multiplier but not by adding it to the Hamiltonian but rather to $\beta H$
$$ Z = \frac{1}{h^{d-1}}\int\! d^dr d^dp e^{-\beta H(\vec{r}, \vec{p})}\delta(L_3-l_3) = \frac{1}{h^{d-1}}
\int\! d^dr d^dp \frac{d\lambda}{2\pi} e^{-\beta H(\vec{r}, \vec{p})}e^{-i\lambda (L_3-l_3)}$$
now you can write the Hamiltonian in polar coordinates for the $2d$ case
$$ H = \frac{p_r^2}{2m}+\frac{L_3^2}{2mr^2} + \frac{K}{2}r^2$$
(if I got all the factors right) and then you get the integral
$$Z = \frac{2\pi}{h} \int_0^{\infty} dr \int_{-\infty}^{\infty} dp_r e^{-\beta\left[\frac{p_r^2}{2m}+V(r)\right]}$$ (again assuming I got the Jacobian correctly... not sure about that you might want to recheck it) with $V(r)$ an effective potential $$V(r) = \frac{K}{2}r^2 + \frac{l_3^2}{2mr^2}$$ which you can integrate safely as everything converges
A: I really don't know how to solve your doubt, but I would like to add some points to the discussions that are too long for a comment.
I would definitely add a confining potential (a.k.a. volume of integration $V$). Firstly, its physical meaning is compelling. Secondly, you can use it as a mathematic "trick" and make the limit $V\rightarrow \infty$ if needed. Moreover, some thermodynamic quantities such as energy will not depend on it.
Following the interesting comment by @GiorgioP, it could be very informative to start thinking about the total linear momentum, which should also be conserved. Solving this simpler problem could give insights into the case of angular momentum.
I am somehow confused since you can usually map the use of Lagrangian multipliers to a Legendre transform at the thermodynamic level. As an example, adding the multiplier $\beta$ "is like" working with the Helmholtz free energy at the thermodynamic level. What is the thermodynamic counterpart of this be Lagrangian multiplier? What would be the intensive conjugate parameter of Angular momentum? My intuition is that all dependence on $\lambda$ should vanish.
A: The difference between your approach and @yyy's is analogous to the distinctions between the canonical and microcanonical ensemble for energy. Yours is implicitly assuming that the particles are interacting with a bath with which it can exchange energy and angular momentum while @yyy took the approach that there is no angular momentum exchange, hence the delta function.
Computationally, your approach is simpler as the partition function is simply gaussian and can thus be computed explicitly (to complete his calculations, you’ll need to introduce modified Bessel functions of the second kind). There is of course the caveat that it converges iff
$$
\beta\omega\geq|\lambda|
$$
with $\omega=\sqrt{K/m}$, in this case, you can explicitly calculate
$$
Z= \frac{1}{\hbar^2((\beta\omega)^2-\lambda^2)}
$$
(you’ll notice that the above condition guarantees that it is positive and the limiting case corresponds to the predicted divergence).
At this stage, either you let $\lambda$ be just as you let $\beta$ assuming it is fixed by the bath, or you can solve it so that $\langle L_3\rangle=L_3$. I think the physical interpretation of $\lambda$ would be simpler if you factor out $\beta$ just as you usually do with conjugate variables: $\lambda = \beta \omega'$ (for example pressure for volume, chemical potential for particle number to quote the most famous ones). I suggestively noted $\omega'$ the ratio as it has the dimension of angular velocity, and the above expressions become more transparent.
To compute your average values, it is straightforward by the usual trick of taking the derivatives of $Z$ (except for the third observable, it’s trickier).
For your update, this amounts to going in polar coordinates (both in position and momentum) however, just like in @yyy’s answer, use $L_3=p_\phi$ not your formula.
Hope this helps and tell me if you find some mistakes.
