How do computers predict eclipses?
Astronomers first have to work out the orbital mechanics of how Earth and the Moon orbit the Sun under the influences of the gravitational fields of these three bodies. From Newton’s laws of motion, they mathematically work out the motions of these bodies in three-dimensional space, taking into account the fact that these bodies have finite size and are not perfect spheres, and that Earth and its moon are not homogeneous bodies. From careful observation, they then feed into these complex equations the current positions and speeds of Earth and the Moon, and then program the computer to “integrate” these equations forward or backward in time to construct ephemerides of the relative positions of the Moon and Sun as seen from the vantage point of Earth. Eclipses are specific configurations of these bodies that can be identified in the computer runs and captured. Current eclipse forecasts are accurate to less than a minute in time over a time span of hundreds of years.