Suppose that in a plane parallel to the yz-plane, the index of refraction $n$ is a function of the distance from the origin, $R$, i.e., $n = n(R)$.
We know that (e.g., http://aty.sdsu.edu/explain/atmos_refr/invariant.html), that $n(R)R\sin\theta = \mathrm{constant}$ at every point, where $\theta$ is analogous to the "$z$" angles shown in the diagram:
With the relation above I have the information to calculate $\theta$ at every point, but I'd like to recast it into a differential equation that gives me the path of a ray in terms of $y$ and $z$. Is it possible to find a form for $\frac{dz}{dy}$? I could write, for instance, $\theta = \tan^{-1}\left(\frac{z}{y}\right) - \tan^{-1}\left(\frac{dz}{dy}\right)$. Or would I have to parametrize $y$ and $z$? How would I do this? What is the easiest way of numerically finding the path?