How to use it
The dark panel is an optical bench one metre wide; each grid square is 10 cm. Choose a preset or build your own setup with the Add buttons. Drag any element to move it. The selected element has a round handle: drag it to rotate the element or to aim a light source.
To study images, add an object arrow and a lens or a curved mirror. Three principal rays leave the tip of the arrow, the image is drawn in orange (solid when real, dashed when virtual), and the Image panel shows the object distance, image distance and magnification. Dashed lines are backward extensions of rays: light only seems to come from there.
Controls
- Mouse and touch: drag an element to move it, its round handle to rotate or aim it, and the handle beyond the tip of the object arrow to change its height.
- Keyboard: focus the bench, then use the arrow keys to move the selected element by 1 cm (1 mm with Shift), Q and E to rotate it by 5° (0.5° with Shift), N and P to select the next or previous element and Delete to remove it.
- Selected element: sliders for focal length, size, refractive index, dispersion, number of rays and wavelength; a checkbox switches a source to white light.
- Display: the grid, backward extensions of rays leaving lenses and mirrors, and weak partial reflections at glass surfaces.
How it works
Reflection. A plane mirror follows the law of reflection: the angle of reflection equals the angle of incidence, both measured from the normal, the line perpendicular to the surface.
Refraction. The glass block and the prism use real refraction at every surface. Where a ray meets glass, the simulator finds the normal and applies Snell’s law, going in and again going out:
Light entering glass with n = 1.5 at 30° continues at 19.47°. From glass to air the ray bends away from the normal, and beyond the critical angle there is no refracted ray:
For n = 1.5 this gives 41.81°. Above it the surface reflects all the light: total internal reflection.
Lenses and curved mirrors use a different, idealised model. Each is an ideal thin element: a ray that meets it at height h above the axis has its slope changed by −h/f, nothing else. This is the paraxial model behind the thin-lens and mirror equations, so all rays from one object point meet in exactly one image point:
m = −di/do = hi/ho
Here f is positive for a converging lens or concave mirror and negative for a diverging lens or convex mirror. A positive di means a real image, a negative one a virtual image; a negative m means the image is inverted. For a spherical mirror f is half the radius of curvature. The Image panel computes di from the equation and, separately, from the point where the traced rays cross. Real thick lenses and spherical mirrors blur that point slightly (spherical aberration); the ideal elements here do not.
Dispersion. In glass the refractive index depends on the wavelength λ. The simulator uses Cauchy’s two-term formula, anchored at yellow light of 589 nm:
White light is traced as seven wavelengths from 420 to 670 nm. Violet has the largest index, so a prism bends it most. With λ in micrometres, B is about 0.004 for crown glass and 0.013 for dense flint glass.
Things to try
- In the first preset, drag the arrow towards the lens. At 20 cm (twice the focal length) the image is as large as the object; closer than 10 cm it turns virtual, upright and enlarged.
- Load the concave mirror and move the arrow between the mirror and F: the image jumps behind the mirror and grows.
- In the prism preset, rotate the prism and raise the dispersion B. Then switch off the white light and change the wavelength.
- In the glass block preset, drag the start of the red ray into the block and rotate it. The Ray path list shows it leaving the glass until the angle inside passes 41.81°.
- Build a telescope: a parallel beam, a converging lens with f = 20 cm and a second one with f = 8 cm placed 28 cm behind it. The beam leaves parallel again, but narrower.
Frequently asked questions
What is the difference between a real and a virtual image?
At a real image the rays actually meet, so it can be caught on a screen. At a virtual image the rays only seem to come from one point when you follow them backwards.
Why does the lens not split white light into colours?
The lenses here are ideal thin lenses with the same focal length for every colour. A real single lens focuses blue light a little closer than red light (chromatic aberration). Only the prism and the glass block are dispersive here.
Why do some rays stop?
A ray ends when it hits the hatched back of a mirror. Tracing also stops after 60 interactions, which only matters for light trapped between mirrors.
What is left out?
This is geometric optics: light travels in straight rays. Diffraction, interference and polarisation are not modelled, a good approximation when everything is much larger than the wavelength of light.