I understand that at resonance, a spring-mass-damper system will only require input energy from a forcing that matches the energy dissipated per cycle by the damper.
Let's say that you have a system with a natural frequency $f_o$, are forcing it at some frequency that is roughly twice that frequency, and I let the system get to a steady state so that it is oscillating as a sinusoid with some amplitude and frequency ($x(t)=X\sin{(\omega t+\phi)}$). I have simulated this exact thing a bunch, and find that the net work done by the harmonic forcing ($\int_0^T F\sin{(\omega t)}\dot{x} dt$) over a period is equal to the net work done by the damper ($\int_0^T c\dot{x}^2 dt$).
Since the system isn't at resonance, I would think that inertial and elastic work should not exactly cancel over a period and the forcing should have to do extra work to compensate for this off-resonance behavior. How would I show this mathematically? Every time I try to do this, I find that the net work of the forcing exactly equals the work dissipated by the damper (which I am aware is just conservation of energy). If I try to integrate the power associated with the mass movement ($\int_0^T m\ddot{x}\dot{x} dt$) or the power associated with the spring ($\int_0^T kx\dot{x} dt$), both of these integrals give 0 over a period. What is happening with energy exchange between the mass kinetic energy and the spring elastic energy when you are at steady state oscillations away from resonance?