Ray Optics

David McIntyre
13 January 2017

Initialization

SetOptions[Plot,BaseStyle->{FontFamily->"Arial",FontSize->12},PlotStyle->{{Black,AbsoluteThickness[1.5]}},AxesStyle->{{Black,AbsoluteThickness[0.5]},{Black,AbsoluteThickness[0.5]}},TicksStyle->{{Black,AbsoluteThickness[0.5]},{Black,AbsoluteThickness[0.5]}}];

Off[General::spell]

Off[General::spell1]

imgsz=600;

ctrl-9 to start inline formula and ctrl-0 to end. ctrl-_ to begin subscript, ctrl-space to end. esc-alpha-esc to enter Greek letters.  Spell checker for symbol names turned off since many have similar names.

Ray optics

Ray Matrices (this is different from Hecht, see Saleh & Teich, Fundamentals of Photonics or http://www.photonics.byu.edu/ABCD_Matrix_tut.phtml).
Each optical ray is characterized by the height h of the ray (measured from the optical axis) and the angle θ of the ray (measured with respect to the optical axis).  These 2 numbers (even thoough they have different units) are combined onto a ray vector.  This vector is modified by optical elements that can change the height and/or angle.  The modification of any element is characterized by a 2x2 matrix M, such that output = M x input:

(({{(Subscript[y, out])}, {(Subscript[θ, out])}}))=(({{A, B}, {C, D}}))(({{(Subscript[y, in])}, {(Subscript[θ, in])}}))

For a THIN LENS,  M=(({{1, 0}, {-(1/f), 1}}))

For air of length L, M=(({{1, L}, {0, 1}}))

For a system with multiple elements (Subscript[M, 1]), (Subscript[M, 2,   ])etc, the system matrix is (Subscript[M, sys])= ... (Subscript[M, 2])(Subscript[M, 1]),    with the products taken in inverse order because element 1 acts first, etc.

Air[L_]:={{1,L},{0,1}}

Lens[f_]:={{1,0},{-1/f,1}}

Object at 2f from lens, giving image at 2f

(* d1:air, f1:lens, d2:air *)
d1=20;
f1=10;
d2=20;
M=-d2/d1;
(* height of object (arbitrary) *)     h=1;
 (* radius for drawing lens (for show) *)  r=3;
 (* thickness of lens *)  dr=0.9;
 (* size of lens *)   f=4;
(* angle of central ray *) angle1=-h/d1;
(* angle of parallel ray *) angle2=0;
(* angle of ray thru focus *) angle3=-h/(d1-f1);
 (* initial ray vectors combined *)  ray0={{h,angle1},{h,angle2},{h,angle3}};
  (* ray vector as f(z) at beginning *)  ray0z=Map[Air[z].#&,ray0];
 (* ray vector at input to first lens *) ray1i=Map[Air[d1].#&,ray0];
 (* ray vector at output of first lens *)  ray1o=Map[Lens[f1].#&,ray1i];
 (* ray vector as f(z) after first lens *)  ray1z=Map[Air[z-d1].#&,ray1o];
(*plot rays*)
 (* before lens *) p0=Plot[ray0z[[All,1]],{z,0,d1}];
 (* after lens *)  p1=Plot[ray1z[[All,1]],{z,d1,d1+d2}];
Show[p0,p1,PlotRange->{{0,40},{-2.5,2.5}},Axes->False,ImageSize->imgsz,
Epilog->{Black,AbsoluteThickness[2],
 (* lens*) Circle[{d1-r+dr,0},r,{-Pi/f,Pi/f}],
Circle[{d1+r-dr,0},r,{Pi-Pi/f,Pi+Pi/f}],
(* object *)  AbsoluteThickness[1],Arrow[{{0,0},{0,h}}],
(* image *)  Arrow[{{d1+d2,0},{d1+d2,M*h}}],
Text["2f",{10,-2}],
AbsoluteThickness[0.5],Arrow[{{9,-2},{0,-2}}],Arrow[{{11,-2},{20,-2}}],
 (* optical axis *)  AbsoluteThickness[1],Dashing[Medium],Line[{{0,0},{40,0}}]}]

Object arbitrary

(* d1:air, f1:lens, d2:air *)
d1=25;
f1=10;
d2=f1*d1/(d1-f1);
M=-d2/d1;
(* height of object (arbitrary) *)     h=1;
 (* radius for drawing lens (for show) *)  r=3;
 (* thickness of lens *)  dr=0.9;
 (* size of lens *)   f=4;
(* angle of central ray *) angle1=-h/d1;
(* angle of parallel ray *) angle2=0;
(* angle of ray thru focus *) angle3=-h/(d1-f1);
 (* initial ray vectors combined *)  ray0={{h,angle1},{h,angle2},{h,angle3}};
  (* ray vector as f(z) at beginning *)  ray0z=Map[Air[z].#&,ray0];
 (* ray vector at input to first lens *) ray1i=Map[Air[d1].#&,ray0];
 (* ray vector at output of first lens *)  ray1o=Map[Lens[f1].#&,ray1i];
 (* ray vector as f(z) after first lens *)  ray1z=Map[Air[z-d1].#&,ray1o];
(*plot rays*)
 (* before lens *) p0=Plot[ray0z[[All,1]],{z,0,d1}];
 (* after lens *)  p1=Plot[ray1z[[All,1]],{z,d1,d1+d2}];
Show[p0,p1,PlotRange->{{0,d1+d2},{-2.5,2.5}},Axes->False,ImageSize->imgsz,
Epilog->{Black,AbsoluteThickness[2],
 (* lens*) Circle[{d1-r+dr,0},r,{-Pi/f,Pi/f}],
Circle[{d1+r-dr,0},r,{Pi-Pi/f,Pi+Pi/f}],
(* object *)  AbsoluteThickness[1],Arrow[{{0,0},{0,h}}],
(* image *)  Arrow[{{d1+d2,0},{d1+d2,M*h}}],
 (* optical axis *)  AbsoluteThickness[1],Dashing[Medium],Line[{{0,0},{d1+d2,0}}]}]