Lens Aberrations

Manipulate[
r=f/(2*stop);
alpha2=alpha*Degree; (* alpha image side *)
alpha1=ArcSin[Sin[alpha2]/n];(* alpha lens side *)
tg1=Tan[alpha1];
tg2=Tan[alpha2];
ϕ=(nm-1)*Pi;
sp=Table[Module[{ϕi,ρi,fi},fi=Sqrt[(i-1)/(nr-1)]; ρi=r*fi;ϕi=ϕ*fi;{ρi*Cos[ϕi], ρi*Sin[ϕi]}],{i,nr}];
(* list of spiral positions *)
foc=Map[hit[#[[1]],#[[2]],r,f,n,alpha1,df]&,sp];(* focal plane positions *)
lens=Module[{thick=r*0.3,points=60,dr,cur,dx,ri}, (* graphical representation of the lens *)
dr=thick*0.2;
dx=2 r/(points-1);
cur=Table[ri=-r+(i-1)*dx;{ri,system[ri,0,r,f,n][[1]]},{i,points}];
AppendTo[cur,{r+dr,-thick}];
AppendTo[cur,{-r-dr,-thick}];
AppendTo[cur,{-r,0}];
Polygon[cur]
];(* lens *)
rays=Module[{lin,dx,ri,p0i,p1i,p2i,p3i,q0i,q1i,q2i,q3i,low,dyi,sysi,si,sni,sf,λi},
(* graphical representation of the rays *)
dx=2 r/(nm-1);
low=-r*0.3; (*  -thick from previous function *)
lin=Table[
ri=-r+(i-1)*dx;
sysi=system[ri,0,r,f,n];
p2i={ri,0,sysi[[1]]};
dyi=p2i[[3]]-low;
p1i={ri-dyi*tg1,0,low};
p0i={p1i[[1]]+2*low*tg2,0,3*low};
si=nor[p2i-p1i]*n;
sni=snell[si,sysi[[2]],1.];
sf=sni[[1]];
λi=If[sni[[2]],(f+df-p2i[[3]])/sf[[3]],0.5*r];
p3i=p2i+sf*λi;
q0i={p0i[[1]],p0i[[3]]};
q1i={p1i[[1]],p1i[[3]]};
q2i={p2i[[1]],p2i[[3]]};
q3i={p3i[[1]],p3i[[3]]};
{q0i,q1i,q2i,q3i},
{i,nm}]; (* lin *)
lin
];(*rays *)
g1=ListLinePlot[foc,AspectRatio->1,
ImageSize->{400,460},
ImagePadding->{{10,10},{10,10}},
If[markPoints,PlotMarkers->Automatic,PlotMarkers->None],
If[auto,
PlotRange->All,
PlotRange->{{-0.5*field,0.5*field},{-0.25*field,field}}
] (* If auto *)
] ;(* g1 *)
Switch[mode,
showSpiral,
Quiet@Show[
Graphics[
{
LightBlue,
Tooltip[Disk[{0,0},r],"convex lens surface"]
}
],(*Graphics *)
ListPlot[sp,Joined->True,
If[markPoints,PlotMarkers->Automatic,PlotMarkers->None],
ImageSize->{400,460},
ImagePadding->{{10,10},{10,10}},
AspectRatio->1
](* Listplot *),
Axes->True,
AxesLabel->{x,y}
](* Show *),
showLens,
Quiet@Graphics[
{
LightBlue,
Tooltip[lens,"a plano\[Hyphen]convex hyperbolic lens, which is free of o\[Hyphen]axis spherical aberration"],Blue,
Tooltip[Line[rays],"a meridional ray" ],Black,
Tooltip[Line[{{-r,f+df},{r+(f+df)*tg1*1.2,f+df}}],
"image plane: the intersection of the rays with this plane defines the point image"]
},
ImageSize->{400,460},
ImagePadding->{{10,10},{10,10}}
] (* Graphics *),
showImage,Quiet@g1 
],(*Switch *)
{{nr,256,Tooltip["(Subscript[n, rays])",
"number of rays used to form the point image"]},10,1000,5, Appearance->"Labeled",ImageSize->Tiny,
Enabled->Switch[mode,showLens,False,showImage,True,showSpiral,True]},
{{nm,11,Tooltip["(Subscript[n, meridional])",
"number of meridional rays, which equals the number of intersections of the spiral with the x axis in mode 'spiral'"]},
3,101,2, Appearance->"Labeled",ImageSize->Tiny},
Delimiter,
{{mode,showLens,Tooltip["mode",
"select view"]},{showLens->
Tooltip["lens","shows the plano\[Hyphen]convex lens under consideration together with meridional rays"],
showImage->
Tooltip["point image","shows where the computed rays intersect the image plane (i.e., the plane selected by the df slider)"],
showSpiral->
Tooltip["spiral","shows where the rays that form the point image intersect the convex surface of the lens"]}},
{{auto,True,Tooltip["auto frame",
"toggles between autoframing and using field"]},{False,True},ImageSize->Tiny,
Enabled->Switch[mode,showLens,False,showImage,True,showSpiral,False]},
{{markPoints,False,Tooltip["mark rays",
"toggles between marking rays by dots or not"]},{False,True},ImageSize->Tiny,
Enabled->Switch[mode,showLens,False,showImage,True,showSpiral,True]},
Delimiter,
{{n,1.5,Tooltip["n",
"index of refraction of the lens material"]},1.42 ,2.5,0.01, Appearance->"Labeled",ImageSize->Tiny,
Enabled->Switch[mode,showLens,True,showImage,True,showSpiral,False]},
{{stop,1.4,Tooltip["f-number",
"(focal length)/(lens diameter); focal length is 100"]},0.5,8.0,0.1, Appearance->"Labeled",ImageSize->Tiny},
{{alpha,10.0,Tooltip["α/degree",
"angle (in degrees) between the incident parallel rays and the optical axis"]},0.0,12.0,0.01, Appearance->"Labeled",ImageSize->Tiny,Enabled->Switch[mode,showLens,True,showImage,True,showSpiral,False]},
{{df,0.0,Tooltip["df",
"defocus: shift of the image plane versus the focal plane"]},-10.,10.,0.01, Appearance->"Labeled",ImageSize->Tiny,
Enabled->Switch[mode,showLens,True,showImage,True,showSpiral,False]},
{{field,0.1,Tooltip["field",
"size of the field of view in the image plane, active only if \"auto frame\" is not selected"]},
0.001,30.0,0.01, Appearance->"Labeled",ImageSize->Tiny,
Enabled->Switch[mode,showLens,False,showImage,!auto,showSpiral,False]},
{{f,100.0},ControlType->None},
{alpha1,ControlType->None},
{alpha2,ControlType->None},
{tg1,ControlType->None},
{tg2,ControlType->None},
{ϕ,ControlType->None},
{sp,ControlType->None},
{foc,ControlType->None},
{r,ControlType->None},
{g1,ControlType->None},
{lens,ControlType->None},
{rays,ControlType->None},
TrackedSymbols->True,
SynchronousUpdating -> True,
Initialization :> (
nor[v__]:=v/Norm[v];
system[x_,y_,rl_,fl_,nl_]:=Module[{ρ,root,z,normal},
ρ=(Sqrt[(fl^2)+(rl^2)]);
root=(Sqrt[(fl^2) (1+(nl^2))+(rl^2)-2 fl  nl  ρ+(-1+(nl^2)) ((x^2)+(y^2))]);
z= (nl  ρ -fl-root)/(nl^2-1);
normal=nor[{x/root,y/root,1}];
{z,normal}
];
(* decomposes s into a component parallel to the unitvector nn and a component orthogonal to it *)
dec[s__,nn__]:=Module[{nsn},nsn=nn*Dot[s,nn];{nsn,s-nsn}];
(* Snell's law: nn normal vector, si initial ray vector ni*(unitvector of incoming ray direction). Return value is
nf*(unitvector of outgoing ray direction) *)
snell[si__,nn__,nf_]:=Module[{sn,c1,c2,xx,c1f},sn=dec[si,nn];c1=sn[[1]];c2=sn[[2]];xx=nf^2-Norm[c2]^2;
If[xx<0,{c2-c1,False},{ c2+Sqrt[xx]*nn,True}  ]];(* accounting for total reflection *)
(* where the ray hits the 'plane fl + dfl' *)
hit[x_,y_,rl_,fl_,nl_,alpha1l_,dfl_]:=Module[{sys,si,nn,sf,sn,pf,λ,reg},
sys=system[x,y,rl,fl,nl];
nn=sys[[2]];
si={0,Sin[alpha1l],Cos[alpha1l]}*nl;
sn=snell[si,nn,1.];
sf=sn[[1]];
reg=sn[[2]];
If[reg,
pf={x,y,sys[[1]]};
λ=(fl+dfl-pf[[3]])/sf[[3]];
{x+sf[[1]]*λ,y+sf[[2]]*λ},
Missing["total reflection"]
](*If*)
]
),
ControlPlacement->Left,
TrackedSymbols->True,
AutorunSequencing->{7,8}
]

CAPTION

This Demonstration shows how a plano-convex lens acts on a bundle of parallel light rays. Ideally, a collecting lens would deflect all these rays to meet at a single point. If the rays are parallel to the optical axis, this can indeed be achieved by a convex lens surface in the form of a rotating hyperbola, which was already known to Descartes, Huygens, and Newton. For parallel bundles that form a small angle with the optical axis, the concentration to a point holds only approximately. When deflected into an extended light spot, the oblique rays form surprisingly complex and beautiful patterns that can be studied by mode set to "point image".

Compared with the usual spot diagrams delivered by optical design software, the dots are connected by lines. This allows us to trace the dot-producing ray from its starting point. Since the intersections of the rays with the last lens surface are arranged to form a spiral (setting mode to "spiral" shows this), the dots in the image plane form an image of this spiral that can exhibit surprising features.

For large openings (small f-numbers), some rays will undergo total reflection and thus not reach the image plane. In this case one finds the image curve interrupted. Setting mode to "lens" shows a total view, producing the lens, some rays, and the imaging plane.

Note that the light comes from below, for example, in a conventional microscope.

The action of each control is described by a tooltip.

DETAILS

This Demonstration shows that the ideal on-axis focusing property fades away farther from the axis. So, to show optical aberrations in a simple optical system, a plano-convex lens with a spherical surface can suffice. With the hyperbolic lens, however, much of the interesting associated history is covered in the brilliant book by Burnett [1]. Aristotle already posed the problem of a perfectly focusing curve, "the anaclastic", for which a hyperbola is a solution. Kepler was the first to find this solution, although without a correct proof. Descartes was the first to give a valid proof that a plano-convex hyperbolic lens (with geometric data matching the refractive index in a manner derived by him) has the property of focusing axis-parallel rays exactly at one point. Descartes held the opinion that a telescope with such a hyperbolic objective lens would show "whether there are animals on the moon". He did not foresee the limitations caused by the complicating factors of light dispersion and diffraction. The destructive effect of the former—the colored fringes from chromatic aberration—were known to Descartes. He thought, however, that they originate from imperfections of the manual lens grinding process and hoped to get rid of these by ingenious mechanical grinding machines that he designed. He spent much time and energy finding craftsmen willing and capable of building such machines. He thought that using machines would be the only way to make a hyperbolic surface profile with sufficient accuracy. It may be surprising that most modern texts on optics say little about hyperbolic lenses. Fortunately the subject is covered, for example in http://www.ece.tamu.edu/People/bios/hemmer_files/16-lens.ppt.

Snapshot 1: a hyperbolic lens in which the hyperbola is close to its asymptotes

Snapshot 2: on axis, where the computed rays intersect the image plane; the deviation from perfect focusing is due to numerical noise

Snapshot 3: only 0.1 degrees off-axis: the computed rays form an extended light spot dominated by a coma

Snapshot 4: 0.3 degrees off-axis and 4% out of focus: astigmatism becomes noticeable

Snapshot 5: where the computed rays intersect the hyperbolic lens surface

Reference

[1] D. G. Burnett, Descartes and the Hyperbolic Quest: Lens Making Machines and Their Significance in the Seventeenth Century, Philadelphia: American Philosophical Society, 2005.

THIS NOTEBOOK IS THE SOURCE CODE FROM

"Lens Aberrations" from the Wolfram Demonstrations Project
 http://demonstrations.wolfram.com/LensAberrations/

Contributed by: Ulrich Mutze

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 »