Background
Light propagating in an anisotropic medium does not (in general) take a straight-line path between two points. The propagation time between those points, then, is dependent on the total path length and the velocity of light at each point along that path. The path may be determined by the Fermat principle (or principle of least time).
Problem
I'm working with a medium whose index of refraction is a function of depth. More specifically, it has the form:
$$A - Be^{Cz}$$
...where $A,B$ and $C$ are positive constants, and $z$ is depth. I'm given that the time taken for propagation between a point $\langle x_0, y_0, z_0 \rangle$ and a point $\langle x_1, y_1, z_1 \rangle$ (in Cartesian coordinates) is given by the integral:
$$T = \frac{1}{c}\int_{z_0}^{z_1} \sqrt{1 + \bigg(\frac{dx}{dz}\bigg)^2}\times n(z) dz$$
And, hence, may be written in code (here, in Python
) as:
from scipy.integrate import quad
c = 3e8 # Speed of light
def ray_trace(n, pos0, pos1):
path = quad(lambda z: np.sqrt(1 + ((pos1[2]-pos0[2])/(pos1[0]-pos0[0]))**2)
* n(z), pos1[2], pos0[2])
return path[0] / c
It is unclear to me why the integral depends only upon $x$ and $z$. For fixed $x$ and $z$, if $y$ is increased (and thus the distance between the points increased), why is it that the total propagation time does not increase?
I suspect that some error has been made here.