# Can a system have varying partition function?

I am not sure if a partition function for a system should be constant or not. If not, what are examples of constrained systems with partition function that varies with the system's state?

Here is a particular example that came to mind:

Consider a closed rigid container of temperature $$T$$, the total number of particles $$N$$ and volume $$V$$ in contact with a reservoir of temperature $$T$$. This container is divided into two sections $$A$$ and $$B$$, separated by a barrier that does not allow particles to pass through. The volumes of two sections $$V_A$$ and $$V_B$$ can vary as long as $$V_A+V_B=V$$. Section $$A$$ is filled with ideal gas of one kind and section $$B$$ is filled with ideal gas of another kind.

The partition function for section $$A$$ is

$$Z_A=e^{N_A} \left(\frac{V_A}{N_A}\right)^{N_A} \left(\frac{2\pi m}{h^2 \beta}\right)^{\frac32 N_A}$$

The partition function for section $$B$$ is

$$Z_B=e^{N_B} \left(\frac{V_B}{N_B}\right)^{N_B} \left(\frac{2\pi m}{h^2 \beta}\right)^{\frac32 N_B}$$

The partition function for the container is

$$Z=Z_AZ_B=e^{N_A+N_B}\left(\frac{V_A}{N_A}\right)^{N_A}\left(\frac{V_B}{N_B}\right)^{N_B}\left(\frac{2\pi m}{h^2 \beta}\right)^{\frac32 (N_A+N_B)}=e^{N}\left(\frac{V_A}{N_A}\right)^{N_A}\left(\frac{V_B}{N_B}\right)^{N_B}\left(\frac{2\pi m}{h^2 \beta}\right)^{\frac32 N}$$

Since the barrier does not allow particle flow, in order to maintain chemical equilibrium, assume that $$N_A+N_B=\frac{N}{2}$$,

$$Z=e^{N}V_A^{\frac{N}{2}}V_B^{\frac{N}{2}}\left(\frac{2}{N}\right)^{N}\left(\frac{2\pi m}{h^2 \beta}\right)^{\frac32 N}$$

It seems like the partition function $$Z$$ varies with values of $$V_A$$ and $$V_B$$ and is maximized when $$V_A=V_B=\frac{V}{2}$$.

Does my example qualify as a constrained system with varying partition function?

• You do not need to assume anything about $N_A$ and $N_B$. They are fixed quantities. Maximization of the partition function as a function of $V_A$ provides the equilibrium condition (equal pressure in the two sub-systems). I would not call it a varying partition function but a constrained partition function. For an equilibrium system, the constraint is either enforced or it is missing. Usually, it is not possible to give a meaning to the partition function if the system is not at equiibrium. Apr 2, 2023 at 12:38
• @GiorgioP-DoomsdayClockIsAt-90 So, can you clarify what do you mean by equilibrium? So, you mean I cannot write a partition function for a system unless it is in thermal, mechanical and chemical equilibrium? In my example, partition function is valid if the interacting systems is in mechanical equilibrium $V_A=V_B=\frac{V}{2}$? Apr 3, 2023 at 2:46
• I think you mean thermodynamic equilibrium, right? Apr 3, 2023 at 2:50
• Yes, I mean thermodynamic equilibrium. The partition function is a quantity that can be written as soon as one has the Hamiltonian of the system. However, it has a physical meaning (as generating function for all the information about thermodynamics) only for systems at the thermodynamic equilibrium. Apr 3, 2023 at 9:48

The partition function of an equilibrium system is a function of $$V$$, $$T$$, $$N$$: $$Z = Z(T,V,N)$$ For multiple systems that do not interact, the total partition function is the product of the individual functions: $$Z(T,V_A,V_B,N_A N_B) = Z(T,V_A,N_A) \cdot Z(T,V_B,N_B)$$ or more compactly $$Z = Z_A\cdot Z_B$$ under the conditions $$T=\text{same in all parts},\quad V_A+V_B=\text{const},\quad N_A+N_B=\text{const}$$ Notice that $$Z$$ of the total system is a function of five variables while the partition function of each part is a function of three.

With $$N_A=N_B=N/2$$ fixed you have shown that the condition $$V_A=V_B=V/2$$ minimizes the free energy of the two-part system. Indeed, your condition amounts to $$P_A=P_B$$, i.e., the two parts in this case are in mechanical equilibrium with each other.

To summarize: The partition function of the two-part system depends not only on the total volume and total number of particles in the entire system, but also on how we partition these properties between the two parts. An arbitrary partitioning of will not produce equilibrium between the parts. Equilibrium is obtained when the partition function (or its log, which is proportional to minus free energy) is maximized. At the maximum the partition function is still a function (not a constant) that depends on three variables, temperature, total volume and total number of particles.

• The (Helmholtz) free energy is not the log of the partition function; it is $-T$ times the log of the partition function. Therefore, in the typical situation of positive temperature, the condition of thermal equilibrium - that the free energy be minimized - corresponds to maximizing the value of the partition function, not minimizing it. Apr 3, 2023 at 2:16
• @tparker Yes, I am writing in condensed form, I mean to say you can work with the free energy or with the log of the partition function. But I will correct it to avoid confusion. Apr 3, 2023 at 10:01
• Your edited answer is still incorrect. At thermal equilibrium, the free energy is minimized and (typically) the partition function is maximized. Apr 3, 2023 at 10:06

This might clarify what is varying. In your formulation, the partition function $$$$Z(V_A) = e^N [V_A(V - V_A)]^{N/2} \left ( \frac{2}{N} \right)^N \left ( \frac{2\pi m}{h^2\beta} \right )^{N/2}$$$$ describes a different system for each value of $$V_A$$. Forcing this to be one system might be artificial but there's an easy way to do that. We can declare that changes in $$V_A$$ instead take us to different microstates. Then there are more microstates to sum over and the partition function becomes $$$$\mathcal{Z} = \int_0^V Z(V_A) dV_A$$$$ which is constant.

• This kind of partition function is useful for describing the probability distribution of microstates with varying $V_A$? Apr 2, 2023 at 12:38
• Yes. Allowing $V_A$ to fluctuate has a simple effect here because, in an ideal gas, the energy of a given microstate is independent of $V_A$. Apr 2, 2023 at 13:32