# Condition for resonance

In my physics courses, we are now primarily treating oscillations in exponential form. When we dealt with oscillating circuits, the lecturer said that resonance was reached when the imaginary part of the impedance was zero, ie. when the current and the voltage are in phase in the circuit. However, I remember from our mechanical oscillations course that the driving force and displacement were out of phase at resonance. How comes that the mechanical-electrical analogy doesn't seem to work here?

As the frequency of the driver is increased the driven system starts to lag behind and at resonance the driven system is $\frac\pi 2$ behind the driver.
At even higher frequencies the phase lag of the driven system relative to the driver tends towards $\pi$.
In such a system at low frequencies the voltage leads the current by $\frac\pi 2$.
As the frequency is increased that current lag is reduced to become zero at current resonance and then tend to the voltage leading the current by $\frac\pi 2$ at frequencies well above the resonant frequency.
The mechanical analogue of electrical current is velocity and of charge is displacement. Velocity (current) leads the displacement (charge) by $\frac\pi 2$ and this is the reason for the the difference in phase at amplitude resonance for the mechanical case and current (velocity) resonance for the electrical case.