Solution (source code)

= Solution

With <phasors> proportional to $e^{i\omega t}$, the <resistor>, <inductor>, and <capacitor> have <complex impedances> $R$, $i\omega L$, and $1/(i\omega C)$. In a <series circuit> they carry the same <electric current>, so their <voltage> drops add:
$$
\boxed{Z(\omega)=R+i\left(\omega L-\frac1{\omega C}\right).}
$$
The real part describes <Joule heating>; the imaginary part changes sign between capacitive and inductive response, passing through zero at $\omega_0=1/\sqrt{LC}$.