A symplectic, symmetric algorithm for spatial evolution of particles in a time-dependent field