The Hamilton's optico-mechanical analogy shows that electron beams can be modeled using concepts and mathematical formula of light beams. The electron particle trajectory formula matches the formula for geometrical optics with a suitable electron-optical index of refraction. This index of refraction functions like the material properties of glass in altering the direction ray propagation. In light optics, the refractive index changes abruptly at a surface between regions of constant index: the rays are controlled with the shape of the interface. In the electron-optics, the index varies throughout space and is controlled by electromagnetic fields created outside the electron trajectories.