loading...
running...
The science
All distances are in centimetres along the optical axis; light travels left to right and the first element sits at x = 0. In the paraxial (small-angle) approximation every ray is described by its height y and slope θ = dy/ds, and each element changes the slope only:
thin lens or mirror: θ' = θ - y / f, free flight: y' = y + θ s
Tracing two rays from the tip of the object and finding where they meet gives the image; for one element this reproduces the Gaussian lens equation and the magnification:
1/f = 1/do + 1/di, m = hi/ho = -di/do, x x' = f² (Newton)
di > 0 is a real image (rays really meet, a screen shows it, usually inverted); di < 0 is a virtual image (rays only appear to diverge from it, seen through the lens, upright). Three rays are drawn: parallel to the axis (leaves through the far focus), through the lens centre (undeviated) and through the near focus (leaves parallel).
Lens from glass. The thin-lens lensmaker's equation gives f from the refractive index and the two surface radii (signed; a radius of 120 or more is treated as a flat face):
1/f = (n - 1) (1/R1 - 1/R2)
Mirror. A spherical mirror of radius R has f = R/2 (concave positive). The reflection is simulated by unfolding it: the same slope update holds with the ray travelling back the other way. Two lenses separated by s combine as 1/f = 1/f1 + 1/f2 - s/(f1 f2); with s = f1 + f2 the pair is afocal (a telescope) with angular magnification -f1/f2.
Spherical aberration is added as an empirical third-order term: θ' = θ - (y/f)(1 + A (y/a)²) where a is the aperture radius. A marginal ray (y = a) parallel to the axis then crosses the axis at f/(1 + A), so the focus is smeared along the axis and the RMS blur of the spot on the screen has a minimum (the circle of least confusion) in front of the paraxial focus. This is a model of the effect, not a ray trace through real spherical surfaces; other aberrations (coma, astigmatism, chromatic dispersion) are not modelled.
Checks. (1) the image distance from two traced rays equals the lens equation, (2) the traced magnification equals -di/do, (3) Newton's x x' = f² at another object distance, (4) lensmaker f equals the reciprocal of the sum of the two surface powers, (5) marginal-ray focus f/(1 + A), (6) the concave mirror equation (R = 40, do = 30 gives di = 60 on the object side).
Simplifications. Thin elements (no thickness, principal planes coincide), monochromatic light, paraxial optics with the aberration model above, ideal mirror reflectivity, no diffraction or vignetting.