Snell's law at each air–water boundary:
n_air sin(i) = n_water(λ) sin(r)
Primary-ray deviation for two refractions and one internal reflection:
D(i, λ) = π + 2i − 4r
α = π − D = 4r − 2i
Stationary rainbow ray, found by setting dD/di = 0:
cos²(i*) = (n² − 1) / 3
i* = acos(√((n² − 1)/3))
This has an interior solution only for 1 < n < 2. The 589 nm readout classifies the reference wavelength; close to either boundary, dispersion can leave only part of the spectrum with a stationary ray. The rainbow is a caustic: neighbouring rays bunch in direction, not at one point on the droplet.
Dispersion model: a two-point Cauchy fit, n(λ) = s(A + B/λ²), with λ in micrometres, A ≈ 1.3244 and B ≈ 0.00297 μm². It is anchored to n = 1.333 at 589 nm and approximately 1.343 at 400 nm. The slider changes only s.
Simplifications: spherical drop, parallel sunlight, air index set to 1, geometric optics, one internal reflection, and an idealized visible spectrum. Polarization-dependent Fresnel brightness, absorption, multiple scattering, the finite solar disc and diffraction are not simulated. The diameter control is illustrative; in this model it does not change the angle.
A missing caustic means the one-reflection stationary solution is absent; it does not mean that the droplet stops refracting or reflecting light. This independent educational simulation is not affiliated with a university, museum, or optics manufacturer.