Temperature in statistical mechanics and differentiating entropy In statistical mechanics, the entropy of an isolated system with energy $E$ (with fixed volume $V$ and chemical composition $N$) is defined as $S(E) = k \log \Omega$, where $\Omega$ is the number of microstates with total energy $E$. The temperature $T$ is then defined (in basically all the sources I've been able to find) via the relation $$\left( \frac{\partial S}{ \partial E} \right)_{N, V} = \frac{1}{T}$$
Since entropy is a discrete quantity (being essentially just a counting function), how does one make sense of the derivative?  Is it more correct to replace the derivative by a difference quotient?
 A: The number of microstates is usually so large that we may approximate using a derivative. After all, look at $10^{23}$ molecules in a jar. It is quite easy to think that you are looking at a continuum. 
A: Yes, there is a subtlety there. Also notice that in quantum mechanics we have finely resolved energy eigenstates, and in a typical complicated system all degeneracies are broken so that at any given energy there is at most one state ($\Omega = 1$) but most likely there is no state at exactly that energy ($\Omega = 0$). So it would seem that $\log \Omega$ is never bigger than 0, how can entropy ever be so high as we observe?
In classical mechanics too, if you ask me how many states have energy exactly $E$ I will say zero since a randomly chosen state will almost never exactly match energy $E$.
So there is a quite a mistake with saying "$\Omega$ is the number of states with energy $E$" since essentially this would give $\Omega = 0$. (I have no idea why textbooks say this, it just confuses the learner and they know it is wrong). There are two ways to solve this and to get a real, functioning definition of $S$:


*

*Consider all states between $E$ and $E+\Delta E$, indeed with a finite difference $\Delta E$ --- not too big but not too small. From this you can define a thermodynamic density of states $\nu = \Delta \Omega / \Delta E$. Then, entropy is defined as $S = k \log \nu$ or alternatively as $S = k \log (\Delta \Omega)$, depending on who you ask. Both work. (Perhaps you noticed, there is a problem that either entropy depends on units of energy when we take log of something with units of 1/energy, or, the entropy depends on how big of $\Delta E$ we chose. But this just gives an entropy offset and as long as we are consistent with units, and keep $\Delta E$ the same for all systems, this works out.)

*Consider all states with energy less than $E$ and define this number as $\Omega$. (Sounds strange, I know, but it does work and is quite simply defined.)
The definitions disagree but both are valid; both reproduce thermodynamics in large systems. Interestingly though neither is mathematically satisfactory, and they have real problems for small systems. In particular the "temperature" as defined by $1/(\partial S/\partial E)$ actually fails to have the property that two systems with equal temperature are in equilibrium. And we can even define evil systems with strange density of states where, as $E$ is increased, the value of $T$ fluctuates up and down and up and down.
Can we do any better? Yes, abandon the requirement that a system has exactly specified energy $E$. That was anyways unrealistic since you never perfectly know a system's energy with absolute certainty. If instead you fix the temperature, you get a canonical ensemble for which entropy is uniquely defined (and is mathematically sane).
See wikipedia's microcanonical ensemble for more info (disclaimer: I wrote that article, mostly).
