Illustrating amazing effects of optics with the computer

Optical systems may be complex to study, especially when they involve media with spatially varying refractive index. A fast, accurate and easy to use Matlab code for solving the iconal equation in such media is presented. It is used for ray-tracing the propagation of light in non-homogeneous media and illustrating some amazing effects in modern physics that cannot be brought to the attention of students without the aid of numerical simulations.