Software for Teaching through Interactive Demonstrations about Converging Lenses

In this paper, Software is presented for teaching through interactive demonstrations about lenses. At first we explore lenses constructed by two spherical surfaces. We explore the ray diagrams and wave fronts. Then there is a page for understanding the thick lens model. We introduce a step by step procedure to find the focal length and find the principal planes and finally the use of the focal length and principal points to construct the image. There is a page for finding the position of the image not by the formula but by the method we use on an actual experiment: We move the screen back and forth until we can get the sharpest possible image. This is done by finding the minimum of a standard deviation of the position of the rays for a given position of the screen. Then there is a simulation of an experiment for finding the focal length. This uses a macro to simulate the finding of several image points b for several object points a. These values are used first in the graphical representation of the image point as a function of b and the image points as a function of a. With suitable least square fits we get two lines with parameters that give values for the focal length and principal plane. Then there is a simulation of two experiments of finding the focal length of a lens. The spreadsheet calculates the distance b vs a, the image y, and there ar graphs of y as a function of a and y as a function of b from which we find 1) a hyperbolic fit for y vs a and a linear fit for y vs b from which we calculate the focal distance, 2) it calculates 1/a and 1/b and then finds a linear fit and a parabolic fit for the data. Also we get the same parameters by finding the cuts of lines uniting the point (a,0) and (0,b).. 3) there is a plot of a+b vs a and then the points are fitted with a hyperbola whose asymptotes give the sum of focal length and principal planes. Then there is a page where we can see two lenses for which the shape can change to have a perfect focusing at a given distance. These two lenses are based on Huygens’ ideas, Spherical and Huygen Lenses.


Introduction
The teaching of lenses can be facilitated when the student is having an image of what is being taught.
The teaching of the theory of real lenses is not so easy to follow (Walther, 1996). Students can see the limitations of paraxial optics and very thin lenses. This spreadsheet permits to the student to use 5 kinds of simulation: a) Choose of radii and center of the circle on right. The program does ray tracing of the constructed lens. Except of the ray tracing, the student can observe the wave fronts. b) Paraxial theory of lenses. c) Finding the image at the point of the maximum concentration of rays. d) Experiments for finding the focal length of a lens. e) Lenses that change shape when we change the position of the source or of the image.

Use of the spreadsheet
In the introductory page of the spreadsheet there are several command buttons that are shortcuts to different pages. a) Spherical lenses.

Figure 1. The Screen for Spherical Waves for a Thick Lens
As it can be seen from Figure 1, there are two buttons and a form: The 2 buttons. The button "find location of the sharpest image" activates the sheet "standard deviation of y vs x" where the position of the minimum of the standard deviation of the emerging rays (or in case of imaginary image their backward extrapolation) is found. The form appears after we press the button "SHOW FORM FOR PARAMETERS". On the form "biconvex" there are scroll bars for changing the radii, the position of the centers the index of refraction of the lens and the index of refraction of the medium on the right side of the lens, Also there are buttons for starting, stopping and continuing the movement of wave fronts.
When the wave fronts are stopped the user can move them manually by a scroll bar. There are also buttons for moving to other parts of the worksheet related to biconvex lenses. There is a scroll bar that changes the scale of the graph. The user can change the scale to see more details or less. This is seen in Figure 2 is shown a case of virtual image. The scale was changed to a smaller value than in Figure 1.

Figure 2. A Case of Imaginary Image. The Form Appears When the User Presses "Parameters"
The radius of the circle on the right side, the radius of the circle on the left, the center of the circle on the right side are determined by moving the corresponding scroll bars.
The program calculates the position of the center of the left side so that both circles cut each other at x = 0. There is a limit on the changes of the position of the right circle so that the right circle remains on the right side.  There are scroll bars for the position of the source. The values are shown on the corresponding labels.
Also there is a scroll bar for changing the width of the bundle of rays that is incident on the lens.
The option buttons "point source", "parallel bundle" are for the option of a point source or a parallel bundle of rays from the left.
The form contains a button for finding the position of the sharpest image which has the same function as the button mentioned earlier.
In the case of virtual image the position of the image can be found also by extrapolating the refracted rays to the back. There is a macro in this worksheet which permits the calculation of the image by finding for each x position the corresponding y position of the ray. For each point x the program finds the average of y-position for each ray. Then it calculates the standard deviation for all rays. The graph shows that there is a minimum of the standard deviation. This will be the position where the image is the most clear. For non-paraxial rays this position does not coincide with the one given by the paraxial theory. On the same graph appears a "spot" that resembles the spot formed on a screen from a point source. As we approach the position of the least standard deviation the spot becomes smaller. The spot does not coincide generally with the position of the image from the paraxial theory. The student can study the limitations of the model of paraxial theory by moving to the sheet "THICK LENS MODEL".

b) Paraxial Theory
The student can study the paraxial theory of the lens by clicking in the introduction the button "PARAXIAL THEORY: THICK LENS MODEL". When the user presses this button, the sheet "THICK LENS MODEL" appears ( Figure 4). The user can press "parameters" follow a step by step  If the user chooses from the introduction or from form "biconvex" sheet, the "thick lens model" a form appears as in Figure 4. If he presses the button INCREASE THE NUMBER OF STEPS to 1, on the screen appears a ray parallel to the x-axis from the right side of the lens. As the ray passes through the lens it undergoes two refractions. On emerging from the lens crosses the x-axis on the left focus of the lens. On a textbox of the form appear the value of the point of the left focus and the value of the left focus derived from the paraxial theory. The distance y of the initial parallel ray and also other parameters (as in the previous case) can be changed by pressing the button "parameters" which is similar to the one in the previous section. If the user wants to change the radii or the indexes of refraction he should press the button "ADJUSTMENT OF GEOMETRICAL PARAMETERS AND INDEXES OF REFRACTION". For the step 1, the student can see that by decreasing the value of y for the parallel ray, the point of intersection of the emerging ray with the x-axis is very near the value of the left focus calculated according to the paraxial model. For the next step 2 there is an extrapolation of the emerging ray to the right. On the next step 3 the incident ray -parallel to the x -axis -is extrapolated to the left. On step 4, the intersection h 1 of the 2 rays is found. This is the first principal point. A line parallel to the y-axis through the first principal point represents the first principal plane. In the 4 next steps the procedure is repeated for a ray incident parallel to the x-axis from the left. So we get the two principal points and the two principal planes, which are shown without the incident rays in step 9. On step 9 are calculated the 2 nodal points. For a lens in the air the 2 nodal points coincide with the principal points. In the case of a lens in the air the focal length of the lens is found by f= (1/n-1) [(n r1 r2)/ (n-1) d +n (r2 -r1)] (Reinhard Jenny, p. 16). The above method is depicted in Rowlands (pp. 1-12, for principal planes, pp. 1-18 for cardinal points).
In the case of a lens for which the left medium has index of refraction n1=1, the lens has index of refraction n2, and the right side has an index of refraction n3 then we do not have one value of focal length, and we find two focal lengths: The focal point f 1 is on the left, and f 2 is on the right. If t is the width of the lens and the radii of the surfaces are R b (for the left surface) and R a (for the right surface) then: Their position are: F_LEFT= h 1 +f 1 , F_RIGHT = h 2 +f 2

Finding the Image
On step 10 are depicted the object (source), the two foci and the two principal planes. In step 11 a line is drawn from the upper point to the source, so that its back extrapolation meets the x-axis in the left focus. The line is drawn up to the principal plane h 1 . From h 1 we draw a line to the right parallel to the x-axis. In the next step (12) a line is drawn from the highest point of the source, parallel to the x-axis up to principal plane h 2 . From h 2 we draw a line that passes through the right focus.
In the spreadsheet the location of the image is found as follows: If the source has a location (x source , y source ) then SO = object (source) distance from the principal plane h 1 . SO= h 1 -x source and SI = image distance from the principal plane h 2 then according to Pedrotti (2014) chapter 18: And the x position of the image x image = h 2 +SI, and

Experiments for Finding the Focal Length
By clicking on the button "finding f by plotting" we go the worksheet "finding f" and appears a form with several buttons: 2 buttons for inserting data and other buttons for working on the data ( Figure 5).
By clicking "insert data (preferably through Macro)" the program asks for how many data (default 8) and then the program inserts the object's distance "a" and the image distance "b" (the program finds the suitable b by the method described on biconvex lenses the sharpest image), and also it determines the image's size y. The worksheet contains 3 graphs: Graph of lines (a i ,0)-(b i ,0) where a i is the source distance from the center of the lens, b i is the distance of the image from the center of the lens, a graph of 1/a vs 1/b with appropriate fit and a graph of a+b vs a.

Figure 6. Graph of Image y vs b and vs a
After the preparation of the data appears the chart "Image vs b" (Figure 6) where are depicted with dots the images of the object with circles as a function of the distance b and also as "diamonds" as a function of the distance of the object from the lens. The first set of data has a linear fit through the method of "least squares" and the second set has a fit of a hyperbola. The linear fit gives the following information: the linear fit has the form: Yi=ysource+ti· (b i -k) where ysource is the object's y, b i is the distance of the image from the center of the lens, k is the position of the right principal plane and ti the tangent of the inclination angle and is given by ti = ysource/f_right, so from these two parameters we find the principal plane h_2 and the focal length on the right.
The hyperbolic fit has a form of: y i =-ysource· gama/(di-beta) di=|a i | y. beta = the left focal length+ |h_1| while gama = distance of left focus from left principal plane.
A classic experiment for finding the focal length of lenses and concave mirrors is described by Tyler (1977, pp. 46-47, pp. 52-53).
The first one is presented as used to find the focal length of a concave mirror, but it can be used for the focal length of a lens. The second one is especially valid for thin lenses.
In the worksheet there are two sheets devoted at the experiment of finding the focal length by finding a number of couples of a (the distance of the source from the y-axis) and b (the distance of the image from the y-axis).

Graph of 1/b vs 1/a
In this elementary experiment it is well known that by plotting 1/b vs 1/a the intersection with the axes are equal to the focal length. This is valid only for thin lenses. There exist excel files for finding the focal lengths of thin lenses.

Figure 7. For Narrow Bundle and the Source very near the x-axis All the Curves Almost Coincide
In the case of thick lenses we proceed in a similar way. In the worksheet "find f" there we can input the data manually or we can input the data by using a macro.
If we press the button "GRAPH OF LINES" the spreadsheet plots the lines that join the points (a,0) and (0,b). These lines cut each other for thin lenses on the point (f,f). The other way as mentioned is to plot the 1/b vs 1/a (Figure 7).

Figure 8. Diagram of the Cuts of the Lins (a i ,0)-(0,b i )
This graph is also a result we get by pressing this button. In the graph we get the data, the line we get from paraxial theory of 1/b vs 1/a, a linear fit of the data and a parabolic fit of the data. For the thick lenses the parabolic fit gives in many cases better results than the linear fit. The points where the fit meets the axes are the left focus and the right focus which usually have different values for thick lenses. In paraxial theory we get: 1 = ℎ 1 + 1 +1 ℎ 2 ℎ 1 + 1 ℎ 2 + 2 ℎ_2) +(ℎ 2 + 2 ) From this formula we get that for 1/a=0, 1/b=1/(h 2 +f 2 ) so the intersection of this line give the right focus. For 1/b=0 then 1/a=-1/(f 1 +h 1 ) which corresponds to the left focus. We compare on this graph the  For thin lenses this graph gives the average point (f,f). This option permits a pictorial depiction of the notion of standard deviation (Figure 8). These methods were used in the past for thin lenses (Mihas, 1998).

Figure 9. Plot of the Sum of the Position of the Source and Image vs the Position of the Source
The 2nd experiment uses a plot of a+b vs a.
We use the same buttons to insert the data and the button "a+b vs a" to produce the graph.
We get a hyperbola by fitting the data with the curve y = a² /(a-f) where y=a+b (Figure 9).
From the hyperbola we beta two asymptotes: one perpendicular to the a-axis which passes through -f 1 -h 1 and u=a+(f 2 +h 2 ). So we can determine A (A= -f 1 -h 1 ) and B=-n 3 f 1 +h 2 from the asymptotes and from the minimum we can find f 1 and then h 1 , h 2.
The nodal points coincide with the principal points when the index of refraction on the left of the lens has the same index of refraction as the medium on the right of the lens.

Lenses with Variable Shape (Huygens' Lens)
These lenses are of great significance in modern technology, but also give a model for the lens of the eye which accommodates its back. Also liquid lenses can change their shape by using small electric fields (Hendriks & Kuiper, 2004). Actually the first lens that was studied mathematically was a hyperbolic lens which changes shape depending on the position of the source and the refractive index (Rashed, 1992;Mihas, 2008).
Huygens lens is the lens that was proposed by Christian Huygens (Huygens, 1690) as is a direct application of Fermat's principle. The lens is constructed so that all the rays that are originating from the source and passing through the lens will pass through the focus and the time for the light to move on all ray -paths is the same. This method was incorporated in teaching of optics (Mihas, 2012).
Let us assume that the source of light is located on the left of the lens and the focus on the right ( Figure   10).
To construct the lens we employ the Fermat's principle in the form of the time needed for a ray to move from the source through the lens and then to the focus is constant refraction of the medium after the lens): D 1 + n· D 2 + n 2 D 3 = constant (1) For a given incident ray we can calculate the x 1 , y 1 , D 1 and then to find the point of the pack of the lens (x,y) we use (1) as + n· D 2 +n 2 · D 3 = L where L is already known.
(We have the transformation x' =x-xf so the following relations are done with this transformation so x 1 ' With x'-x' 1 = ξ (so x=x 1 +ξ) equation 2 is written • − = 2 √ ′ 1 2 + 1 2 + 2( ′ 1 + 1 ) + 2 2 = 2 √ + 2 + 2 2 So we get a quadratic equation. We put: = ′ 1 + 1 , For finding the perpendicular at a point on the back of the lens, we need the value of dx/dy. This can be found explicitly by finding the derivatives of x 1 y 1 φ 1 , angle of incidence, angle of refraction, angle of inclination ω, ξ. In the excel file "spherical and Huygens lens", there is a user function which determines the derivative dx/dy at a point (x 2 , y 2 ) of the curve that is determined by the above method.
From the vector joining the points (x1, y1) and (x2, y2) and the perpendicular -dx/dy we find the angle of incidence, the angle of refraction, and the angle of inclination of the emerging ray.  For both spherical and hyperbolic Huygens' lenses the user can change the location of the source of light on the xaxis, the point on the back through which pass the rays, the index of refraction for the lens and the back medium. These changes can be done when the user presses the button "SHOW FORM FOR PARAMETERS". Then a form appears with all the scroll bars and the buttons. Some buttons are put outside the form. When the form appears then the upper graphs which appear (like in Figure 11) are showing the rays and wave fronts from the point (x 0 , 0) to the focal back point (f, 0) while the 3 rd graph shows the rays and wave fronts from the source at (x 0 , y 0 ≠0). There are two buttons that are shown on the right side of the Figure 10 (not located on the form). which permit the user to see also in the upper graphs the rays from the source at y 0 ≠0. Also outside the form are 3 buttons which permit the user to start the movement of the wave fronts and to stop them. A horizontal scroll bar permits the user to move the wave fronts back and forth.
When we impose the condition that the back and the front surfaces meet at x=0 then we have a modified behavior of the spherical surface on the front. Now we get a more classical "Huygens Lens" ( Figure 12).
To draw the rays in the two lenses we use the parametric equations of the circle and the hyperbola. So instead of the form x2+y2=R2 where R is the radius of the circle we use x=-R· cos(φ), y=R· sin(φ). For the case of a hyperbolic lens instead of = • √ ( +2 ) 2 2 − 1 we use x=-2· a+a/cos(φ), y=b· tan(φ).
This permits to use a similar method to calculate the rays. The rays from an object that is located at the point (x 0 , y 0 ) are calculated for both the lens with a spherical surface in front and a hyperbolic surface in front by the same method. We choose a point (x 2 , y 2 ) on the back surface of the lens and we try to find a point (x 1 , y 1 ) on the front surface for which the time from the source (x 0 , y 0 ) to (x 1 , y 1 ) and then to (x 2 , y 2 ) is the least. This is accomplished by a "user's" function. The perpendicular to this point (x 2 , y 2 ) is determined by another "user's" function and then the continuation of the rays to a distant point (not the "focus"). On the basis of the rays we determine the wave fronts.  As it can be seen the hyperbolic lens has a better behavior for a source at y 0 ≠0. The third graph in Figure 11 is used to show the case of rays and wave fronts for the ray having source at (x0, y0) we need more rays in the spherical case to determine the wave fronts.

NOTE: The spreadsheet spherical and Huygens lens with forms AND MACROS.xlsm can be
downloaded from http://www.kyriakosxolio.gr and click on LENSES SPHERICAL AND HUYGENS