Electromagnetic induction in finite-length cylinders: an exact solution