# Entropy $S$ for canonical (NVT) and isobaric (NPT) ensemble

In case of non-isolates system (NVT or NPT ensemble), I learned I can calculate the entropy,

$$S=-k_B\sum_jp_j\ln(p_j)$$ where $p_j$=probability at $j$ state.

but I saw that the entropy is also can be calculated by

$$S=-k_B\ln(Z).$$

I think this equation applicable for both of isolated system and non-isolated system.

These two equations are same?

• What is "Z" in your final equation. I hope it denotes something like the number of states (one over the number of states, because of the sign). I'm asking because often "Z" denotes the canonical partition function, in which case you would be calculating the free energy divided by the temperature and not the entropy. – hft Mar 27 '15 at 20:07
• This question is answered here: en.wikipedia.org/wiki/Entropy#Statistical_mechanics – lemon Mar 27 '15 at 20:26
• It's not answered exactly there. Unless the OP messed a minus sign and by "Z" meant the number of states. But, I think he didn't mess up the sign and his Z means the statistical distribution function... but, I'm not sure... – hft Mar 27 '15 at 20:38

I learned I can calculate the entropy $$S=-k_B\sum_jp_j\ln(p_j)$$ where $p_j$ is the probability at state $j$.

but I saw that the entropy is also can be calculated by $$S=-k_B\ln(Z)$$ I think this equation applicable for both of isolated system and non isolated system

these two equations are same ?

Given the number of states $\Omega(E,\Delta E)$ within $\Delta E$ of the thermodynamic energy $E$, the entropy is: $$S=k\ln(\Omega)\;.$$

If the quantity $Z$ is defined such that $$\Omega =\frac{1}{Z(E)}\;,$$ I.e., if $Z(E)$ is the statistical distribution function, i.e. $Z(E_n)$ is your probability $p_n$, then $$S=-k\ln(Z)$$

But, we know that the log of the statistical distribution function is a linear function of the constants of motion (actually just $E$, ignoring total momentum and total angular momentum as usual) $$\ln Z(E)=a + bE\;,$$ so that the averaging that was performed to obtain the average energy $E$ $$E=\sum_n Z(E_n)E_n$$ can be "pulled outside" the log $$\ln Z(E)=\sum_n p_n\ln(p_n)\;,$$ where we have written $p_n=Z(E_n)$.

Thus, so too, $$S=-k\sum_n p_n\ln(p_n)$$

• Reviewing this answer over a year later, I feel like I should note that the function "Z" in the above answer is not the "Canonical partition function" (which is also often denoted with a "Z"). I think this treatment is mostly based on the treatment of entropy in Landau and Lifshitz and it's probably best to just go to that source for a more complete explanation. – hft Oct 27 '16 at 22:49