Simulating the electric field and a moving charge