Fermat's Principle

Fermat's principle has to do with the path taken by a ray of light through a (possibly inhomogeneous) medium. It states that the path from point A to point B is the one that minimizes the light travel time between those two points. In the case of a homogeneous medium, that translates into the shortest distance between the two points--a straight line--but in general it means that, if the refractive index of the medium is $n(x,y)$ (in two dimensions, for simplicity) then the path $y(x)$ taken by the ray is the one that minimizes

\begin{eqnarray*}
t &=& \int_A^B\,dt\\
&=& \int_A^B\,\frac{ds}{v}\\
&=& \fr...
..._A^B\,n(x,y(x))\,\sqrt{1 +
\left(\frac{dy}{dx}\right)^2}\,dx\,,
\end{eqnarray*}


where $ds^2 = dx^2 + dy^2$. $v(x,y)$ is the local speed of light in the medium. The index of refraction, $n(x,y)$, gives this local speed in the medium in terms of the speed of light in vacuum, $c$.
\begin{displaymath}
v = c / n(x,y)
\end{displaymath} (1)

In the Monte-Carlo approach to this problem, we represent the path $y(x)$ as a series of $N+1$ discrete points $(x_i, y_i)$, and choose a set of $x_i$ values uniformly between $x_0=x_A$ and $x_N=x_B$ (it is not actually necessary to choose the $x_i$ uniformly, as we will see later). We then choose the corresponding $y_i$ randomly, except that $y_0 = y_A$ and $y_N=y_B$. The procedure is simple:

  1. Evaluate the quantity $t$ for the current configuration, as

    \begin{displaymath}
t = \sum_{i=0}^{N-1}\,n(x_i, y_i) \sqrt{dx_i^2+dy_i^2}
\end{displaymath}

    where $dx_i = x_{i+1}-x_i$ and similarly for $dy_i$.
  2. Randomly choose one of the interior points $i$, with $1\le i <
N$.
  3. Randomly change $y_i$ by some amount in the range $[-dy, dy]$, where $dy$ is some characteristic resolution scale of the problem.
  4. Re-evaluate the quantity $t$. If the random change has reduced it from the previous value, accept the change. Otherwise, reject it and restore the previous value of $y_i$.
  5. Go back to step (1), and repeat until some large number of trials fails to reduce $t$.
The procedure will work for any choice of $n(x,y)$ and any initial choice of $y_i$--and, in fact for any problem that can be cast in variational form!

 

Example

 

Here we give details of a specific case of deriving an optical path.

  1. Use Fermat's principle to determine the light path through a transparent medium. The path starts at $(0,0)$ and ends at $(1,1)$. The refractive index of the medium is $n=1.0$ for $x <= 0.5$, and $n=1.5$ for $x > 0.5$. Divide the medium into $N=20$ layers of equal width and let $\{(x_i,y_i), i=0,\ldots,N\}$ represent the path. Start with $y_i = x_i$.

    Randomly choose one value of $i$ and change $y_i$ by a random number uniformly distributed in the range $[-0.1,0.1]$. Accept the change if it reduces the light travel time

    \begin{displaymath}
t = \sum_0^{N-1}\,n_i \sqrt{dx^2 + dy_i^2} / c\,,
\end{displaymath}

    where $n_i$ is the refractive index in layer $i$, $dx = 1/N$, and $dy
= y_{i+1}-y_i$. Stop your calculation when 1000 successive trials fail to reduce $t$. Plot the path you obtain.

2015-02-17