The current research introduces a comparison study of the utilization of artificial neural networks (ANN) and genetic programming (GP) for predicting the optical behavior of different materials. The experimental data for a variety of materials, including semiconductors, insulators, oxides, and halides are extracted and utilized in ANN and GP as inputs. Simulation and prediction processes are carried out based on ANN and GP techniques. The most important aim presented in the current research is to obtain two equations of n as a function of Eg by the two based on ANN and GP models. The first numerical equation is obtained based on the ANN model exhibiting mean squared error (MSE) does not exceed 1. The second nonlinear equation is obtained based on the GP model with an acceptable fitness value. The estimated results based on the proposed approaches ANN and GP presented a great match with their targets. It demonstrated that the trained results including simulated and predicted results based on ANN and GP introduce excellent fitting compared with alike results obtained based on the conventional theoretical techniques. The mean absolute percentage error values prove that the ANN model is significantly more accurate than the GP model. Since lower error values suggest better prediction, hence it is clear that ANN performed better than GP. The equation derived by the ANN model is utilized to predict the refractive index for binary and ternary compounds. The values of the refractive index have been predicted for materials for which measurements have been made practically as a test step to ensure the accuracy of the results obtained through the deduced mathematical equations. Then, the application of these equations was generalized to materials that were not measured experimentally. A detailed discussion of the modeling results is introduced and proved that ANN and GP models are effective and successful tools for predicting the refractive index for different types of materials.