Calculates the magnification of an image produced by a lens or mirror, based on object and image distances.