  In the thermodynamics of nanoscopic systems the relation between classical
and quantum mechanical description is of particular importance. To scrutinize
this correspondence we study an anharmonic oscillator driven by a periodic
external force with slowly varying amplitude both classically and within the
framework of quantum mechanics. The energy change of the oscillator induced by
the driving is closely related to the probability distribution of work for the
system. With the amplitude $\lambda(t)$ of the drive increasing from zero to a
maximum $\lambda_{max}$ and then going back to zero again initial and final
Hamiltonian coincide. The main quantity of interest is then the probability
density $P(E_f|E_i)$ for transitions from initial energy $E_i$ to final energy
$E_f$. In the classical case non-diagonal transitions with $E_f\neq E_i$ mainly
arise due to the mechanism of separatrix crossing. We show that approximate
analytical results within the pendulum approximation are in accordance with
numerical simulations. In the quantum case numerically exact results are
complemented with analytical arguments employing Floquet theory. For both
classical and quantum case we provide an intuitive explanation for the periodic
variation of $P(E_f|E_i)$ with the maximal amplitude $\lambda_{max}$ of the
driving.
