Category:
Using the expression for energy in terms of the canonical partition function and the \(TdS\) equation \[dU=TdS -pdV\] we obtain an expression for the entropy,.<$\newcommand{\pp}[2][]{\frac{\partial #1}{\partial #2}} $
Entropy of system in contact with heat bath
Consider
\begin{eqnarray}d(\ln Z)&=& \pp[\ln Z]{\beta} d\beta + \pp[\ln Z]{V} dv \nonumber\\
&=& - U d\beta + \pp[\ln Z]{V} dv\nonumber\\
&=& \beta dU - d(\beta U) + \pp[\ln Z]{V} dv\\\therefore d(\ln Z + \beta U ) &=& \beta dU + \pp[\ln Z]{V} dV\end{eqnarray}
Next we multiply by $kT=1/\beta$ and rearrange the terms to get \begin{equation} dU = kT d(\ln Z + \beta U ) - kT \pp[\ln Z]{V} dV \label{EQ05} \end{equation} which is to be compared with $TdS= dU + pdV$ written as \begin{equation} dU = T dS - pdV \label{EQ06} \end{equation} we get an expression for the entropy \begin{eqnarray} \boxed{S = k \ln Z + \beta U + \text{const}},\label{EQ07} \end{eqnarray} Since only change in entropy is measured, the constant here is of no significance. The expression \eqref{EQ07} will be called the thermodynamic entropy for canonical ensemble.