# Calculating Helmholtz energy (incl degeneracy)

1. Apr 13, 2013

### guest1234

Hi

I'm trying to calculate Helmholtz free energy from definition $\frac{\partial A}{\partial T}=\frac{\partial}{\partial T}(kT\mathrm{ln}\; Z)$. First
$\langle E\rangle=\sum\limits_i p_i E_i=\sum\limits_i E_i\frac{g_i e^{-\beta E_i}}{Z}=\frac{1}{Z}\sum\limits_i E_i g_i e^{-\beta E_i}=-\frac{1}{Z}\sum\limits_i \frac{\partial \left(g_i e^{-\beta E_i}\right)}{\partial\beta}=-\frac{1}{Z}\frac{\partial \left(\sum\limits_i g_i e^{-\beta E_i}\right)}{\partial\beta}=-\frac{1}{Z}\frac{\partial Z}{\partial\beta}=-\frac{\partial\left(\mathrm{ln}\;Z\right)}{\partial\beta}$

Therefore the expected value of internal energy in term of partial derivatives is the same as a non-degenerate one. On the other hand, from the definition of entropy

$S=-k\sum\limits_{i}p_i \mathrm{ln}\;p_i=-k\sum\limits_i \frac{g_i e^{-\beta E_i}}{Z}\mathrm{ln}\left(g_i e^{-\beta E_i }Z^{-1}\right)=-\frac{k}{Z}\sum\limits_i g_i e^{-\beta E_i}(\mathrm{ln}\; g_i -\beta E_i - \mathrm{ln}\;Z)=$

$=\frac{k}{Z}\sum\limits_i\beta E_i g_i e^{-\beta E_i}+\frac{k}{Z}\sum\limits_i\beta \mathrm{ln}\;Z g_i e^{-\beta E_i}-\frac{k}{Z}\sum\limits_i \mathrm{ln}\;g_i g_i e^{-\beta E_i}=k\beta\sum\limits_i\frac{E_i g_i e^{-\beta E_i}}{Z}+\frac{k\mathrm{ln}\;Z}{Z}\sum\limits_i\frac{g_i e^{-\beta E_i}}{Z}-\frac{k}{Z}\sum\limits_i \mathrm{ln}\;g_i g_i e^{-\beta E_i}=$

$=k\beta\langle E \rangle+k\mathrm{ln}\; Z-\frac{k}{Z}\sum\limits_i g_i e^{-\beta E_i}\mathrm{ln}\;g_i$

The last term really bugs me, as we cannot use $\frac{\partial A}{\partial T}=\frac{\partial}{\partial T}(kT\mathrm{ln}\; Z)=k\mathrm{ln}\;Z+kT\frac{\partial}{\partial T}\mathrm{ln}\; Z$ anymore, because

$\frac{\partial (\mathrm{ln}\; Z)}{\partial T}=\frac{1}{Z}\frac{\partial Z}{\partial T}=\frac{1}{Z}\sum\limits_i g_i \frac{\partial}{\partial T}e^{-\frac{E_i}{kT}}=\frac{1}{Z}\sum\limits_i g_i \frac{E_i}{kT^2}e^{-\beta E_i}=\frac{1}{kT^2}\sum\limits_i \frac{g_i E_i e^{-\beta E_i}}{Z}=\frac{\beta\langle E\rangle}{T}$

Am I missing something or is $A=\langle E\rangle-TS$ only (general) way to calculate Helmholtz free energy?