Using Ehrenfest's definition of the order of a phase transition we can relate the behavior around the critical point to various derivatives of the thermodynamical potential. In the canonical ensemble we are using, the thermodynamical potential is Helmholtz' free energy $$ \begin{equation*} F= \langle E\rangle -TS = -kTln Z \end{equation*} $$ meaning $ lnZ = -F/kT = -F\beta$. The energy is given as the first derivative of \( F \) $$ \begin{equation*} \langle E \rangle=-\frac{\partial lnZ}{\partial \beta} =\frac{\partial (\beta F)}{\partial \beta}. \end{equation*} $$ and the specific heat is defined via the second derivative of \( F \) $$ \begin{equation*} C_V=-\frac{1}{kT^2}\frac{\partial^2 (\beta F)}{\partial\beta^2}. \end{equation*} $$