Curved rays in gradient index materials are described by differential equations. Numerical methods for solving these equations are compared. Attention is paid to the error estimation for step size control. These algorithms are used to trace rays in materials with an arbitrary refractive index field. This allows the application to the optical design of high power laser optics, where the absorption induced refractive index field is calculated by thermal FEM calculations.