Boltzmann or Gibbs entropy for the canonical ensemble? For the microcanonical ensemble the entropy, is given by the Boltzmann entropy which equals:
$$S = k_\mathrm{B} \ln(\Omega(E))$$
where $k_\mathrm{B}$ is Boltzmann's constant and $\Omega(E)$ the number of microstates compatible with the macrostate of energy $E$ (there is only one macrostate in the microcanonical ensemble, since energy is fixed).
If we wanted to calculate the entropy for a system in contact with a heat bath (canonical ensemble) would the above formula still be valid? As we know the energy in the canonical ensemble has fluctuations which means that entropy also fluctuates.
Can we calculate the entropy of the canonical ensemble as:
$$\langle S \rangle = k_\mathrm{B} \sum_i P_i\ln(\Omega(E_i))$$
where the index $i$ runs over all the possible macrostates of the system and $P_i$ denotes the probability of the macrostate $i$?
The probability $P(i)$ is just:
$$ P(i) = \frac{\Omega_\mathrm{bath} (E-E_i) \cdot \Omega_\mathrm{system}(E_i)}{\Omega(E)}$$
where $\Omega(E)$ is the number of microstates of the compound system.
Gibbs Entropy
Wikipedia provides another formula for calculating entropy of the system, the Gibbs entropy, which is defined as:
$$S= - k_\mathrm{B} \sum_j p_j \ln (p_j)$$
where the sum goes over all the possible microstates of the system.
Comments

*

*In the special case of the microcanonical ensemble, Gibbs entropy reduces to the Boltzmann entropy.

*All the microstates of a specific macrostate are equiprobable. This allows us to write the above sum as:

$$S = -k_\mathrm{B} \sum_{i=1}^n \left( \sum_{j=1}^{\Omega(E_i)} p_j \ln(p_j) \right) = -k_\mathrm{B} \sum_{i=1}^{n}\Omega(E_i) \cdot C_i$$
since $p_j \ln (p_j)$ is constant for a given $i$, that is given a macrostate $i$ ($i$ runs over macrostates and $j$ over microstates).
The last formula seems similar to the second. Is there any relation between them? More importantly, are both valid for the calculation of entropy in the canonical ensemble?
 A: The Gibbs formula is valid in any ensemble, and will reduce to the standard formulas. The Boltzmann formula only makes sense in the microcanonical ensemble, since otherwise the energy is not known exactly. Your manipulations at the end of your question are a good start towards the formula for the canonical ensemble entropy. I assume you mean that there are $n$ distinct energies labelled by $i$, there are $\Omega(E_i)$ states with energy $E_i$, microstate $j$ occurs with probability $p_j$, and energy $E_i$ occurs with probability $P_i$. Assuming equal probability for microstates with the same energy implies that $p_j = P_i/\Omega(E_i)$. Then we have
$S = -k_B \sum_{i=1}^n \left( \sum_{j=1}^{\Omega(E_i)} p_j \ln(p_j) \right) = -k_B \sum_{i=1}^n \left( \sum_{j=1}^{\Omega(E_i)} \frac{P_i}{\Omega(E_i)} \ln \frac{P_i}{\Omega(E_i)} \right) = k_B \sum_{i=1}^n P_i \ln \Omega(E_i)/P_i.$
This is similar to your second formula, but has $\ln \Omega(E_i)/P_i$ rather than $\ln \Omega(E_i)$. A good sanity check is that if you have only one microstate at each energy, e.g. $\Omega(E_i)=1$, then you should still get a nonzero entropy in the canonical ensemble, but your second formula would have given zero.
