We present a method for calculating a two-dimensional refractive index field from measured boundary values of beam position and slope. By initially ignoring the dependence of beam trajectories on the index field and using cubic polynomials to approximate these trajectories, we show that the inverse problem can be reduced to set of linear algebraic equations and solved using a numerical algorithm suited for inverting sparse, ill-conditioned linear systems. The beam trajectories are subsequently corrected using an iterative ray trace procedure so that they are consistent with the ray equation inside the calculated index field. We demonstrate the efficacy of our method through computer simulation, where a hypothetical test index field is reconstructed on a 15 x 15 discrete grid using 800 interrogating rays and refractive index errors (RMS) less than 0.5% of the total index range (nmax - nmin) are achieved. In the subsequent error analysis, we identify three primary sources of error contributing to the reconstruction of the index field and assess the importance of data redundancy. The principles developed in our approach are fully extendable to three-dimensional index fields as well as more complex geometries.