This Mathematica script comes with a blog post on using geometric optics on www.gcamp6f.com.
Check out the associated blog post (will be uploaded soon) for context and explanations.
The Mathematica Notebook (*.nb) can be used with Wolfram Mathematica Online (which can be used for free during a 30 day trial). Alternatively, check out the exported notebook (*.pdf).