This project involves performing thin lens calculations using a matrix representation of optical elements. See the slides for an explanation of the details. The end result is that we have two matrix operators for refraction and translation transitions:
Where $n_l$ and $n_r$ are the indices of refraction on the left and right (respectively) of the refractive interface. $R$ is the radius of curvature of the refractive interface (positive if the center of curvature is to the right, negative to the left). $y_0$ is the height of the ray before the transition, $\alpha_0$ is the angle (in radians) of the ray before the transition. $L$ is the length of the translation. Various combinations of these two operators can describe very complicated lens systems easily!
Here's the example worked out in the slides:
In [1]:
import numpy as np
import matplotlib.pyplot as pl
In [2]:
ng=1.5 # index of glass
na=1.0 # index of air
h=0.01 # start with ray 1.0 cm above axis
R=0.15 # radius of curvature of lens
ray1 = np.array([[h],[0.0]])
ray1
Out[2]:
In [3]:
T1 = np.array([[1.0, 3.0],
[0.0, 1.0]
])
T1
Out[3]:
In [4]:
ray2 = T1.dot(ray1) # matrix multiplication is handled by the "dot" method of an array
ray2
Out[4]:
In [5]:
R1 = np.array([[1.0, 0.0], # entering the curved surface
[(na-ng)/(ng*R), na/ng]])
R1
Out[5]:
In [6]:
ray3 = R1.dot(ray2)
ray3
Out[6]:
In [7]:
R2 = np.array([[1.0,0.0], # exiting the planer surface
[0.0, ng/na]])
R2
Out[7]:
In [8]:
ray4=R2.dot(ray3)
ray4
Out[8]:
In [9]:
fl=-ray4[0,0]/ray4[1,0] # calculate the focal length from the height and angle of the ray.
fl
Out[9]:
In [10]:
na*R/(ng-na) # compare to the "lens makers" equation result.
Out[10]:
In [11]:
M = R2.dot(R1.dot(T1)) # system matrix
M
Out[11]:
In [12]:
M.dot(ray1) # system acting on ray1
Out[12]:
In [12]: