Lensmaker's Equation

f[n_,d_,s1_,s2_]:=(1/((n-1)(s1-s2+((n-1)/n)d s1 s2)))

color[n_,d_,s1_,s2_]:=If[f[n,d,s1,s2]<0&& Abs[s1]>.05 && Abs[s1]>.05,Gray,White]

type[n_,d_,s1_,s2_]:=If[s2<-.05 && s1>.05,"convex",If[s2>.05 && s1<-.05,"concave",If[s2<-.05 && s1<-.05||s2>.05 && s1>.05,"convexo-concave",If[s2<-.05 && Abs[s1]<.05||Abs[s2]<.05 && s1>.05,"plano-convex",If[s2>.05 && Abs[s1]<.05||Abs[s2]<.05 && s1<-.05,"plano-concave",If[Abs[s2]<.05 && Abs[s1]<.05,"flat",""]]]]]]

R1[s1_]:=If[ Abs[s1]<.05,"∞",PaddedForm[N[1/s1],{3,1}]]

R2[s2_]:=If[ Abs[s2]<.05,"∞",PaddedForm[N[1/s2],{3,1}]]

F[n_,d_,s1_,s2_]:=If[f[n,d,s1,s2]>20,"∞",If[f[n,d,s1,s2]<-20,"-∞",PaddedForm[N[f[n,d,s1,s2]],{3,1}]]]

caption[n_,d_,s1_,s2_]:=Style[Row[{type[n,d,s1,s2]," lens: ",Subscript[Style["R",Italic],1]," = " ,R1[s1],"  ",Subscript[Style["R",Italic],2]," = ",R2[s2],"  ",Style["f",Italic]," = ",F[n,d,s1,s2]}],24,Bold,Black]

g[n_,d_,s1_,s2_]:=Graphics[{Table[{color[n,d,s1,s2],Line[{{0,ϵ},{f[n,d,s1,s2],0}}],Thick,Yellow,Line[{{-4,ϵ},{0,ϵ},{4,((f[n,d,s1,s2]-4)/(f[n,d,s1,s2]))ϵ}}]},{ϵ,-.6,.6,.1}],Thickness[.008],Lighter[Gray],Table[Line[{{((
2-d s1-2 (Sqrt[1-(s1^2) (ϵ^2)]))/(2 s1)),ϵ},{((2+d s2-2 (Sqrt[1-(s2^2) (ϵ^2)]))/(2 s2)),ϵ}}],{ϵ,-1,1,.05}]},PlotRange->{{-4,4},{-1.5,1.5}},ImageSize->{600,300},Epilog->Inset[caption[n,d,s1,s2],{0,-1.35}]]

Manipulate[
g[n,d,s1,s2],
{{n,1.65,"refractive index n"},1.0008,2.5,Appearance->"Labeled"},{{d,.5,"thickness of lens d"},.45,.7,Appearance->"Labeled"},{{s1,.3,Row[{"curvature ",1/Subscript[R,1]}]},-.3999,.4001,.001,Appearance->"Labeled"},{{s2,-.3,Row[{"curvature ",1/Subscript[R,2]}]},-.3999,.4001,.001,Appearance->"Labeled"},SaveDefinitions->True]

CAPTION

The lensmaker's equation relates the focal length of a simple lens with the spherical curvature of its two faces: 
(1/f)=(n-1)((1/(Subscript[R, 1]))-(1/(Subscript[R, 2]))+(((n-1)d)/(n (Subscript[R, 1])(Subscript[R, 2])))),
where (Subscript[R, 1]) and (Subscript[R, 2]) represent the radii of curvature of the lens surfaces closest to the light source (on the left) and the object (on the right). The sign of (Subscript[R, i]) is determined by the location of the center of curvature along the optic axis, with the origin at the center of the lens. Thus for a doubly convex lens, (Subscript[R, 1]) is positive while (Subscript[R, 2]) is negative.

The focal length f is positive for a converging lens but negative for a diverging lens, giving a virtual focus, indicated by a cone of gray rays.

The lens index of refraction is given by n. Optical-quality glass has n in the vicinity of 2.65. The top slider enables you to vary n between 1.0008, its value for air, and 3.42, the refractive index of diamond.

The width d represents the distance between the faces of the lens along the optical axis. The value of (Subscript[R, 2]) is restrained by the slider so that the lens faces never intersect anywhere.

The parameters d, (Subscript[R, 1]), (Subscript[R, 2]), and f are to be expressed in the same length units, often cm. The reciprocal 1/f is known as the optical power of the lens, expressed in diopters ((m^(-1))). A converging lens, as shown in the thumbnail, can serve as a simple magnifying glass.

In the thin-lens approximation, the lens width d is small compared to the other lengths and the lensmaker's equation can be simplified to (1/f)=(n-1)((1/(Subscript[R, 1]))-(1/(Subscript[R, 2]))).

THIS NOTEBOOK IS THE SOURCE CODE FROM

"Lensmaker's Equation" from the Wolfram Demonstrations Project
 http://demonstrations.wolfram.com/LensmakersEquation/

Contributed by: S. M. Blinder

A full-function Wolfram Mathematica system (Version 6 or higher) is required to edit this notebook.
GET WOLFRAM MATHEMATICA »

© Wolfram Demonstrations Project & Contributors   |   Terms of Use   |   Make a new version of this Demonstration »