A Numerical-Analytical Method for Particle Accelerators