Motion of charged particles in electric and magnetic fields