I am unable to grasp the following statements which I found in the literature.
For a closed system (no transfer of matter), heat in statistical mechanics is the energy transfer associated with a disordered, microscopic action on the system, associated with jumps in occupation numbers of the quantum energy levels of the system, without change in the values of the energy levels themselves.
Work is the energy transfer associated with an ordered, macroscopic action on the system. If this action acts very slowly, then the adiabatic theorem of quantum mechanics implies that this will not cause jumps between energy levels of the system. In this case, the internal energy of the system only changes due to a change of the system's energy levels. - Wikipedia
Here is what I understand about heat and work:
Consider a gas in a rigid container. The average internal energy E of the system is given by:
$$ E = \Sigma_{i} p_{i}E_{i} $$ $$ p_{i} = n_{i}/N $$
Here, $N$ is the total number of micro states and $n_{i}$ is the number of micro states with energy $E_{i}$.
Suppose I heat the container in a stove, the heat absorbed by the gas manifests as an increase in the random jiggling of particles of the gas. Therefore, $n_{i}$ goes up for those micro states which have a high $E_{i}$, while $E_{i}$ doesn't change for each micro state. This is what the first block quote states.
In another experiment, I don't heat the gas, but compress the container to a new volume by an infinitesimal amount. My understanding is that this would lead to an increased jiggling too. If this is the case, how does doing work on the gas change the energy level $E_{i}$ of each micro state? (According to the second block quote)
Where am I wrong?