The addition of a dielectric object into an electromagnetic cavity has the effect of modifying the resonant frequency. We find that the introduction of a highly polarizable cylinder changes the frequency in a way that is not linear with its volume, which is not expected from perturbation theory in the way it is usually applied. From the Boltzmann-Ehrenfest theorem, the ratio of frequency to the total energy remains constant for an adiabatic change to the oscillating system. The perturbed frequency can be computed accurately from the change in energy associated with the work performed when introducing the cylindrical volume to the cavity.