A variational principle and the classical and quantum mechanics of the damped harmonic oscillator Am.A harmonic oscillator subject to the combined effects of damping and pUlsating is represented by a Kanai-Caldirola Hamiltonian. The equations of motion are solved in the Heisenberg picture in the case of weak pulsation. The rotating-wave approximation (R W A) is used to obtain the motion in the neighborhood of the principal resonance. The R W A Schrodinger equation is solved exactly and pseudostationary and quasicoherent states are described. The transition probability between quasicoherent and coherent states is obtained and the gain in energy is discussed.