It was not until the early part of the nineteenth century that scientists established that electricity and magnetism are related phenomena. In 1819, Hans Oersted discovered that a compass needle is deflected when placed near a circuit carrying an electric current. In 1831,