Spherical ray invariant (source code)

= Spherical ray invariant
{title2=$p=n(r)r\sin\psi$}

For a <light ray> in a spherically stratified <refractive index> $n(r)$, $p=n(r)r\sin\psi$ is constant, where $\psi$ is the angle to the radius. Approximate the medium by concentric homogeneous shells. Straight propagation within each shell conserves $r\sin\psi$, the line's distance from the centre; <Snell's law> at each shell boundary conserves $nr\sin\psi$. Passing to the smooth limit proves the result. In an exterior region with $n=1$, $p$ is the distance of the asymptotic straight <light ray> from the centre. Consequently a surface-tangent <light ray> at radius $R$ and <refractive index> $n_s$ has vacuum asymptote at altitude $(n_s-1)R$, provided the <light ray> reaches the exterior without trapping.