The eikonal equation in an attenuating medium has the form of a complex—valued Hamilton—Jacobi equation and must be solved in terms of the complex—valued travel time. A very suitable approximate method for calculating the complex—valued travel time right in real space is represented by the perturbation from the reference travel time calculated along the real—valued reference rays to the complex—valued travel time defined by the complex—valued Hamilton—Jacobi equation. The real—valued reference rays are calculated using the reference Hamiltonian function. The reference Hamiltonian function is constructed using the complex—valued Hamiltonian function corresponding to a given complex—valued Hamilton—Jacobi equation. The ray tracing equations and the corresponding equations of geodesic deviation are often formulated in terms of the eigenvectors of the Christoffel matrix. Unfortunately, a complex—valued Christoffel matrix need not have all three eigenvectors at an S—wave singularity. We thus formulate the ray tracing equations and the corresponding equations of geodesic deviation using the eigenvalues of a complex—valued Christoffel matrix, without the eigenvectors of the Christoffel matrix. The resulting equations for the real—valued reference P—wave rays and the real—valued reference common S—wave rays are applicable everywhere, including S—wave singularities.