0% found this document useful (0 votes)
54 views7 pages

Optik Optik: Optics

The document describes how matrix optics were programmed into Mathematica software to model optical systems. Key points: - Matrix optics can model the nonlinear transformations of rays in optical systems through matrix products up to any order of approximation. - The author used Mathematica to determine the appropriate matrix coefficients for modeling straight path transformations and transformations induced by conical surfaces, including both direction and position changes, up to seventh order. - As an example, the modeling capabilities were demonstrated by using the program to model a Petzval lens and study its aberrations.

Uploaded by

abhay
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
54 views7 pages

Optik Optik: Optics

The document describes how matrix optics were programmed into Mathematica software to model optical systems. Key points: - Matrix optics can model the nonlinear transformations of rays in optical systems through matrix products up to any order of approximation. - The author used Mathematica to determine the appropriate matrix coefficients for modeling straight path transformations and transformations induced by conical surfaces, including both direction and position changes, up to seventh order. - As an example, the modeling capabilities were demonstrated by using the program to model a Petzval lens and study its aberrations.

Uploaded by

abhay
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

ARTICLE IN PRESS

Optik
Optik 116 (2005) 270–276
Optics
www.elsevier.de/ijleo

Programming matrix optics into Mathematica


José B. Almeida
Escola de Ciências, Universidade do Minho, 4700-320 Braga, Portugal

Received 11 October 2004; accepted 20 January 2005

Abstract
The various non-linear transformations incurred by the rays in an optical system can be modelled by matrix
products up to any desired order of approximation. Mathematica software has been used to find the appropriate
matrix coefficients for the straight path transformation and for the transformations induced by conical surfaces, both
direction change and position offset. The same software package was programmed to model optical systems in seventh
order. A Petzval lens was used to exemplify the modelling power of the program.
r 2005 Elsevier GmbH. All rights reserved.

Keywords: Aberration; Matrix optics; Computer optics

1. Introduction approximation is desired. The possibilities of the


modelling system are then exemplified with the study
In previous papers [1,2] it was shown that it is possible of a Petzval lens’ aberrations.
to determine coefficients for matrix modelling of optical A set of Mathematica functions needed for the
systems up to any desired order, computing power being implementation of matrix models was defined and
the only limiting factor. The second of those paper lists assembled in a package which is described in its most
the calculated seventh-order coefficients for systems relevant aspects in the appendix.
comprising only spherical surfaces.
The use of matrices for optical modelling of optical
systems under paraxial approximation is well known, see 2. Determination of expansion coefficients
for instance [3]. Other authors have shown the possibility
of extending matrix modelling to higher orders [4,5] and 2.1. Initialization
the author has used in his previous work a different set of
coordinates which made feasible the implementation of In this section, we explain how Mathematica can be
matrix models in personal computers. used to evaluate all the expansion coefficients needed for
The first part of the paper describes the calculations further implementation of matrix models. The method is
necessary for the determination of matrix coefficients explained with great generality and can be used up to
and the manner these were performed with Mathematica any degree of approximation and with all surfaces that
software [6]. The programming is general for surfaces can be defined analytically.
that can be described analytically and for whatever First of all we must load two packages that will be
used further along:
Fax: +351 253678981. Needs["Calculus‘VectorAnalysis‘"],
E-mail address: bda@fisica.uminho.pt (J.B. Almeida). Needs["Optics‘expansion‘"].

0030-4026/$ - see front matter r 2005 Elsevier GmbH. All rights reserved.
doi:10.1016/j.ijleo.2005.01.021
ARTICLE IN PRESS
J.B. Almeida / Optik 116 (2005) 270–276 271

The first package is distributed standard with Mathema- scanned in order to find the appropriate one. We can
tica and is useful for performing vector operations. The write the exact solution with two commands:
second one is a proprietary package which performs series
sd ¼ Simplify[s1 /. Snell[[3]]],
expansion in different way. The standard series expansion
td ¼ Simplify[t1 /. Snell[[3]]],
for multi-variable functions sets the limit for each
variable’s exponent independently but not for the order which will output very long expressions very impractical
of the monomials. The expansion package sets a limit for for use.
the monomials’ order, so that each variable’s exponent is
adjusted accordingly; for details see Appendix B.
2.3.1. Series expansion
The solutions of Eq. (1) must be expanded in
2.2. Surface definition series to the desired order of approximation for which
we use a function from the expansion package. Deal-
The method is applicable to any surface which can be ing with axis-symmetric systems it is useful to
defined by an equation of the type f ðx; y; zÞ ¼ 0: For resort to complex coordinates; the two solutions
instance, a conic of revolution could be defined as are thus combined into one single complex solution,
surface[x_, y_, z_] ¼ Sqrt[xˆ 2 + yˆ 2 + zˆ 2] then expanded to the fifth order and sim-
+ e*z - r. plified:
sexpand ¼ Expansion[sd + I*td, s, t, Xx,
We are going to need the normal to the surface at any Yy, 5],
point; this can be found applying gradient to the surface sexpand ¼
expression Simplify[PowerExpand[sexpand]].
n ¼ Grad[surface[Xx, Yy, Zz],
Cartesian[Xx,Yy,Zz]]. The result of the Expansion function is a list of
coefficients, most of them zero. The expansion package
provides a function VectorBase which outputs a list
2.3. Snell’s law of all the monomials that can be built with the given list
of variables up to the desired order. This can be left-
Snell’s law is usually written as scalar relationship multiplied by the coefficient list in order to get a
between sines of the angles the rays form with the polynomial:
normal on both sides of the surface, but it can also be
expressed as a vector relationship using cross products sexpand ¼ sexpand . VectorBase[s, t, x, y,
[2]. Let us define to unit vectors representing the ray 5].
directions on the two sides of the surface:
v ¼ {s, t, Sqrt[1 - sˆ 2 - tˆ 2]},
v1 ¼ {s1, t1, Sqrt[1-s1ˆ 2-t1ˆ 2]}. 2.3.2. Complex coordinates
Although combined into one single complex coordi-
v and v1 represent the unit vectors, s, t, s1 and t1 are nate in sexpand, the output ray direction cosines
direction cosines. are still expressed in terms of real input ray position and
Snell’s law requires that the cross-product of the ray direction coordinates; this must be corrected by an
direction with the surface normal, multiplied by the appropriate coordinate change, followed by suitable
refractive index be equal on both sides manipulation and simplification:
u v  n ¼ v1  n, (1) Apply[Plus,Simplify[MonomialList
where u represents the refractive index ratio of the two [ComplexExpand[sexpand /.
media. We ask Mathematica to find the solutions of Eq. {x -4 (X + Conjugate[X])/2,
(1) for the surface in question y -4 (X - Conjugate[X])/(2*I),
s -4 (S + Conjugate[S])/2,
Snell ¼ Solve½fu  CrossProduct½v; n t -4 (S - Conjugate[S])/(2*I)}, {X,S},
¼ CrossProduct½v1; n; surface½Xx; Yy; Zz ¼¼ 0g, TargetFunctions-4Conjugate],
{X, Conjugate[X], S, Conjugate[S]},

fs1; t1; Zzg.
CoefficientDomain-
4RationalFunctions]]].
Eq. (1) has four solutions, corresponding to positive
and negative angles, in the forward and the reverse Mathematica will output an expression for the above
directions. The solutions found by Mathematica must be command, which is reproduced bellow in a slightly
ARTICLE IN PRESS
272 J.B. Almeida / Optik 116 (2005) 270–276

different form: tz1


y1 ¼ y þ pffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi . (2)
ð1 þ uÞX Suð1 þ uÞX ConjugateðSÞ 1 s2 t 2
Su þ
r 2r The following commands will perform the necessary
uð1 þ uÞX 2 ConjugateðSÞ calculations:

2r2 eqx ¼ x1 ¼ ¼ x + s*z1/Sqrt[1 - sˆ 2 - tˆ 2],
S ðu þ u ÞX ConjugateðSÞ2
2 4
eqy ¼ y1 ¼ ¼ y + t*z1/Sqrt[1 - sˆ 2 - tˆ 2],
þ
8r offset ¼ Solve[{eqx, eqy}, {x, y}].
Su2 ð 1 þ u2 ÞX 2 ConjugateðSÞ2
The ray will usually intersect a surface in two points but
4r2 complex surfaces can be intersected in several points; the
u ð 1 þ u ÞX ConjugateðSÞ2
2 2 3
relevant solution is the one that is closest to the surface
þ
8r3 vertex plane, which will have to be selected from the
Suð1 þ uÞX ConjugateðX Þ multiple solutions found by Mathematica:

2r2
xd ¼ Simplify[x /. offset[[2]]],
ð1 þ uÞðe þ uÞX 2 ConjugateðX Þ
2
þ yd ¼ Simplify[y /. offset[[2]]].
2r3
S2 u2 ð 1 þ u2 ÞX ConjugateðSÞConjugateðX Þ
2.4.1. Series expansion
4 r2
2 2 2
Suð1 þ uÞð1 þ e þ 2u 2u ÞX ConjugateðSÞConjugateðX Þ
The commands that follow reproduce a procedure similar

4r3
to what was explained in paragraphs 2.3.1 and 2.3.2:
uð1 þ uÞð2e2 þ u u2 ÞX 3 ConjugateðSÞConjugateðX Þ xexpand
þ
4r4 ¼ Simplify[PowerExpand[Expansion
S2 u2 ð 1 þ u2 ÞX ConjugateðX Þ2 [xd + I*yd, s,
þ t, x1, y1, 5]],TimeConstraint-4
8r3
Suð1 þ uÞð2e þ u u2 ÞX 2 ConjugateðX Þ2
2 Infinity],
þ xexpand ¼ xexpand . VectorBase[s, t, x, y,
4r4
5],
ð1 þ uÞð 3e þ u 6e2 u u2 þ u3 ÞX 3 ConjugateðX Þ2
4
þ . Simplify[MonomialList[ComplexExpand
8r5 [xexpand /.
All the coefficients resulting from similar operations {x -4 (X + Conjugate[X])/2,
performed on a spherical surface up to the seventh order y -4 (X - Conjugate[X])/(2*I),
have already been listed by the author [2] and the reader s -4 (S + Conjugate[S])/2,
is referred to that work for further elucidation. t -4 (S - Conjugate[S])/(2*I)}, {X,S},
TargetFunctions-4Conjugate],
{X, Conjugate[X], S, Conjugate[S]},
2.4. Surface offset CoefficientDomain-4RationalFunctions]].
The result is the following coefficient list:
We will now deal with the problem of the offset 
introduced by the surface on the position coordinates; ð 1 þ e2 ÞSX 2 ConjugateðX Þ2
,
the reader is again referred to the above mentioned work 8r3
for full explanation of this matter. S X 2 ConjugateðSÞConjugateðX Þ
Mathematica will respond quicker if we perform shift ,
4r2
the coordinate origin, along the axis, to the geometrical
S2 X ConjugateðX Þ2
centre of the surface; this is the purpose of the three ,
4r2
following commands:
ðS 2 X ConjugateðSÞConjugateðX ÞÞ
,
4r 
eq ¼ Solve[surface[x, y, z] ¼ ¼ 0, z],
ðSX ConjugateðX ÞÞ
z1 ¼ z /. eq[[2]], ;X .
2r
z1 ¼ z1 - r/(-1 + e).
The complete set of coefficients for the seventh-order
The ray coordinates on the point of incidence will and spherical surfaces can be found on the paper
have to obey the two equations mentioned before. The same reference lists the coeffi-
sz1 cients for the reverse offset, which are determined in an
x1 ¼ x þ pffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi ,
1 s2 t2 entirely similar manner.
ARTICLE IN PRESS
J.B. Almeida / Optik 116 (2005) 270–276 273

2.5. Straight path

The use of direction cosines to define the ray


orientation renders a straight path into a non-linear
transformation, whose expansion must also be taken
care of. The procedure is similar to what was used above
and there are no mathematical complexities involved; we
will just list the commands and the final result Fig. 1. Diagram of a Petzval lens.

xexpand
¼ Simplify[PowerExpand[Expansion[x mations induced by a single element in air and a straight
+s*e/Sqrt[1 - sˆ 2 - tˆ 2] path; they are multiplied successively, in reverse order
+I*(y + t*e/Sqrt[1 - sˆ 2 - tˆ 2]), s, relative to the transformations, in order to model the
t, x, lens:
y, 5]]];
Table[lens[i]
xexpand ¼ xexpand . VectorBase[s, t, x, y,
¼ Lens[f4[[i]],-18.44,-40.23,3] .
5],
Distance[35].
Apart[xexpand /.
Lens[bk7[[i]],41.42,103.08,8] .
{x -4 (X + Conjugate[X])/2,
Distance[25].
y -4 (X - Conjugate[X])/(2*I),
Lens[bk7[[i]],-72.05,-92.6,7] .
s -4 (S + Conjugate[S])/2,
Distance[4].
t -4 (S - Conjugate[S])/(2*I)}, r].
Lens[bk7[[i]],53.12,-799.9,10] .
The final output is Distance[60],{i,1,3}].
1
8 ð8eS þ 8X þ 4eS 2 ConjugateðSÞ þ 3eS 3 ConjugateðSÞ2 Þ The last factor, Distance[60], corresponds to the
distance from the aperture stop to the first surface. The
Table[] function is used to generate models for all
3. Simulation of a Petzval lens three wavelengths.

In this section we will use Mathematica to model a 3.3. Image coordinates


complex lens using matrix optics. The chosen lens is a
Petzval design distributed with Oslo LT [7], which The optimization performed by Oslo determined an
reproduces an example from Walker [8]; this lens is image plane position at 3.787202 mm from the last
illustrated in Fig. 1 and is built with four elements made surface, so there is one last product to make in order to
of glasses BK7 and SF4. find the overall system matrices for the three wave-
lengths:
3.1. Initialization
Table[image[i] ¼
The model uses a proprietary package named Sphericl Distance[3.787202].lens[i],{i,1,3}].
which defines all the functions needed for implementation of
matrix models of spherical systems, along with some other The system matrices must be right-multiplied by the
useful functions. The package is described in Appendix A. vector base in order to generate the coordinates and the
Needs["Optics‘Sphericl‘"]. higher order monomials for the image plane. The
function Terms[] is responsible for generating a
complex vector base from the given coordinates:
The two glasses used for the individual elements are
defined by lists of their refractive indices at three Table[imagex[i] ¼ (image[i].Terms
wavelengths, namely 587.56, 486.130 and 656.270 nm: [{x,s}])[[1]],{i,1,3}].
List imagex[i] is a 3 element vector, whose
bk7 ¼ {1.5168, 1.522376, 1.514322}, elements are the complex position coordinates for each
f4 ¼ {1.616592, 1.62848, 1.611645}. of the three wavelengths. We can isolate the tangential
and sagittal components by making the input coordinate
real or imaginary and simultaneously taking the real or
3.2. Lens definition imaginary parts, respectively:
The two functions Lens[] and Distance[] Table[timage[i] ¼ ComplexExpand
provide the matrices corresponding to the ray transfor- [Re[imagex[i]]],{i,1,3}],
ARTICLE IN PRESS
274 J.B. Almeida / Optik 116 (2005) 270–276

Table[simage[i] ¼ ComplexExpand avoids the need to re-calculate over and over. This
[Im[imagex[i]/. x-4I x]],{i,1,3}]. package is fast and allows the simulation of very
complex optical systems; one such example was demon-
3.4. Ray analysis strated in the form of a Petzval lens.
Work is now going on to extract more possibilities from
Finally, we perform some ray analysis by plotting ray the software, namely for plotting wavefronts and ray-
intercept curves for two different values of the field densities, and will be the object of other publications.
given by the variable s; the results are shown in Fig. 2:
Table[timage0 ¼ timage[1] /. x -4 0, Appendix A. The ‘‘Sphericl’’ package
Plot[{timage[1] - timage0, timage[2] -
timage0, This package provides all the functions needed for the
timage[3] - timage0}, {x, -23, 23}, implementation of seventh-order matrix models of optical
PlotRange -4 {Automatic, {-0.5, 0.5}}, systems. Some auxiliary functions are also defined in order
PlotStyle -4 {{Thickness[0.01]}, to facilitate other optical system calculations. This
{Thickness[0.01], appendix describes in detail the fundamental functions
Dashing[{0.04}]}, {Thickness[0.01], and gives only short mentions of the others.
Dashing[{0.04, 0.04, 0.003, 0.04}]}}, The package makes use of the axis symmetry to
AxesStyle -4 Thickness[0.005], reduce matrix size to 40
40; so all the coordinates are
AxesLabel -4 {"mm", "mm"}], {s, 0, 0.09, assumed to be complex. One ray, at any specific position
0.087155}]. is characterized by one complex position coordinate and
on complex direction cosine coordinate.

4. Conclusion A.1. Terms

The function builds the 40-element vector base with


All the calculations needed for matrix modelling
all the coordinate monomials that have non-zero
optical systems were successively programmed with
coefficients in axis-symmetric systems:
Mathematica without limitations for surface shapes or
degree of approximation. The program for the determi- Terms[r_List] :¼ Module[{x,s,ray},
nation of series expansion coefficients was run in less s ¼ r[[2]] ; x ¼ r[[1]]; ray ¼ {x, s,
than 1 h for the seventh-order and spherical surfaces. xˆ 2*Conjugate[x],
Other surface shapes have already bean used and these xˆ 2*Conjugate[s], s*x*Conjugate[x],
include conicals and toroids. s*x*Conjugate[s], sˆ 2*Conjugate[x],
After calculation, the coefficients have been incorpo- sˆ 2*Conjugate[s],
rated in a Mathematica package which runs fast and xˆ 3*Conjugate[x]ˆ 2,
xˆ 3*Conjugate[s]*Conjugate[x],
xˆ 3*Conjugate[s]ˆ 2,
mm
s*xˆ 2*Conjugate[x]ˆ 2,
0.4 s*xˆ 2*Conjugate[s]*Conjugate[x],
0.2 s*xˆ 2*Conjugate[s]ˆ 2,
sˆ 2*x*Conjugate[x]ˆ 2,
mm
-20 -10 10 20
sˆ 2*x*Conjugate[s]*Conjugate[x],
-0.2
sˆ 2*x*Conjugate[s]ˆ 2,
-0.4 sˆ 3*Conjugate[x]ˆ 2,
sˆ 3*Conjugate[s]*Conjugate[x],
mm sˆ 3*Conjugate[s]ˆ 2,
0.4 xˆ 4*Conjugate[x]ˆ 3,
0.2
xˆ 4*Conjugate[s]*Conjugate[x]ˆ 2,
xˆ 4*Conjugate[s]ˆ 2*Conjugate[x],
-20 -10 10 20
mm
xˆ 4*Conjugate[s]ˆ 3,
-0.2 s*xˆ 3*Conjugate[x]ˆ 3,
-0.4
s*xˆ 3*Conjugate[s]*Conjugate[x]ˆ 2,
s*xˆ 3*Conjugate[s]ˆ 2*Conjugate[x],
Fig. 2. Ray intercept curves for three wavelengths: green s*xˆ 3*Conjugate[s]ˆ 3,
!587.56 nm, blue !486.130 nm, red !656.270 nm. Top sˆ 2*xˆ 2*Conjugate[x]ˆ 3,
figure is for on-axis incidence, bottom figure for 5 field angle. sˆ 2*xˆ 2*Conjugate[s]*Conjugate[x]ˆ 2,
ARTICLE IN PRESS
J.B. Almeida / Optik 116 (2005) 270–276 275

sˆ 2*xˆ 2*Conjugate[s]ˆ 2*Conjugate[x], second line contains the expansion coefficients for
sˆ 2*xˆ 2*Conjugate[s]ˆ 3, Snell’s law according to paragraph 2.3:
sˆ 3*x*Conjugate[x]ˆ 3,
refraction[n1_, n2_, r_] : ¼
sˆ 3*x*Conjugate[s]*Conjugate[x]ˆ 2,
Module[{matrix,u},
sˆ 3*x*Conjugate[s]ˆ 2*Conjugate[x],
matrix ¼ IdentityMatrix[40];
sˆ 3*x*Conjugate[s]ˆ 3,
u ¼ n1/n2;
sˆ 4*Conjugate[x]ˆ 3,
matrix[[2]]
sˆ 4*Conjugate[s]*Conjugate[x]ˆ 2,
¼ {(u-1)/r,u,(uˆ 2-u)/(2 rˆ 3),(uˆ 2-u)/(2
sˆ 4*Conjugate[s]ˆ 2*Conjugate[x],
rˆ 2),(uˆ 2-u)/(2
sˆ 4*Conjugate[s]ˆ 3},
rˆ 2),(uˆ 2-u)/(2 r),0,0, (uˆ 4-u)/(8
ray].
rˆ 5),(uˆ 4-uˆ 2)/(4
rˆ 4),(uˆ 4-uˆ 2)/(8 rˆ 3),(uˆ 4-uˆ 2)/(4
rˆ 4),u(2uˆ 3-3 u + 1)/(4 rˆ 3),
A.2. Otherlines
(uˆ 4 - uˆ 2)/(4 rˆ 2),(uˆ 4-uˆ 2)/(8 rˆ 3),(uˆ 4-
uˆ 2)/(4 rˆ 2),(uˆ 4-u)/(8
All the transformation matrices have a common
r),0,0,0, (uˆ 6-u)/(16 rˆ 7),uˆ 2 (3uˆ 4 - 2uˆ 2
structure characterized by two lines of series expansion
- 1)/(16 rˆ 6),3
coefficients followed by 38 lines of elements derived
uˆ 4(uˆ 2-1)/(16 rˆ 5),(uˆ 6-uˆ 4)/(16 rˆ 4),
from the former by algebraic operations. The other-
uˆ 2(3 uˆ 4-2 uˆ 2-1)/(16
lines[] function is an internal function which accepts
rˆ 6),u(9uˆ 5-10uˆ 3 + 1)/(16 rˆ 5),uˆ 2(9 uˆ 4-
as input any 40
40 matrix and outputs another matrix
11 uˆ 2 + 2)/(16 rˆ 4), 3
with the same first two lines and lines 3–40 built
uˆ 4(uˆ 2-1)/(16 rˆ 3),3 uˆ 4(uˆ 2-1)/(16
according to the common rules.
rˆ 5),uˆ 2(9 uˆ 4-11 uˆ 2+2)/(16
It is impossible to list all the implementation lines for
rˆ 4), u(9 uˆ 5-10 uˆ 3+1)/(16 rˆ 3),uˆ 2(3 uˆ 4-
this function, for reasons of size; we will then resort to
2 uˆ 2-1)/(16
an explanation of the procedures for determining the
rˆ 2),uˆ 4(uˆ 2-1)/(16 rˆ 4),3 uˆ 4(uˆ 2-1)/(16
coefficients for one of the 38 lines.
rˆ 3), uˆ 2(3 uˆ 4-2
Suppose we want to find the coefficients for a line which
uˆ 2-1)/(16 rˆ 2),u(uˆ 5-1)/(16 r),0,0,0,0},
corresponds to the monomial X j Conjugate ½X k S l
otherlines[matrix]].
Conjugate½Sm : We start by defining a square matrix t of
dimension 40, with known elements on the first two rows:
t ¼ IdentityMatrix[40], A.4. Screen
t[[1]] ¼ Table[a[i],{i,1,40}],
t[[2]] ¼ Table[b[i],{i,1,40}]. This is an external function which is used internally
to determine the surface offset and externally to deal
The matrix is right-multiplied by the vector base of with spherical image surfaces. The structure is similar to
coordinate monomials and the first two elements of the the previous one but now its the first line which is
product are isolated: defined
X1 ¼ (t . Terms[{X, S}])[[1]], Screen[r_] :¼ Module[{matrix},
S1 ¼ (t . Terms[{X, S}])[[2]]. matrix ¼ IdentityMatrix[40];
The procedure then involves determining the product matrix[[1]] ¼ {1,0,0,0,1/
(2r),0,0,0,0,0,0,
X1ˆ j Conjugate[X1]ˆ k S1ˆ l Conjugate[S1]ˆ m 1/(8 rˆ 3),0,0,0,1/(4
and selecting just the terms up to the seventh order. The r),0,0,0,0,0,0,0,0,1/(16
same procedure must be repeated for all the 38 lines. rˆ 5),0,0,0,0,1/(16 rˆ 3),0,0,0,0,3/(16
These are lengthy calculations which must be performed r),0,0,0,0,0},
only once. The function otherlines[] incorporates the otherlines[matrix]].
results of those calculations and is fast to operate.
A.5. Back
A.3. Refraction
This is an internal function used to determine the
reverse offset.
This is an internal function which receives as input the
refractive indices of the two media and the curvature back[r_] :¼ Module[{matrix},
radius and outputs a transformation matrix whose matrix ¼ IdentityMatrix[40],
ARTICLE IN PRESS
276 J.B. Almeida / Optik 116 (2005) 270–276

matrix[[1]] ¼ {1,0,0,0,-1/ Begin["‘Private‘"];


(2r),0,0,0,0,0,0,
-1/(8 rˆ 3),1/(4 rˆ 2),0,1/(4 rˆ 2),-1/(4r), Expansion[a_, {ax_, ay_, rx_, ry_}, o_]
0,0,0,0,0,0,0,0,-1/(16 rˆ 5),3/(16 rˆ 4), :¼ Module[{final, ser1, ser2, ser3, ser4},
-1/(8 rˆ 3),0,3/(16rˆ 4),-7/(16 rˆ 3),1/(4 final ¼ {};
rˆ 2), ser1 ¼ Series[a, {ax, 0, o}];
0,-1/(8 rˆ 3),1/(4 rˆ 2),-3/ For½i ¼ 0; ioo þ 1; i þ þ;
(16r),0,0,0,0,0}; ser2 ¼ Series[Coefficient
otherlines[matrix]]. [ser1, ax, i], {ay, 0, o}];
For½j ¼ 0; joo þ 1 i; j þ þ;
ser3 ¼ Series[Coefficient[ser2,
A.6. Surface ay, j], {rx, 0, o}];
For½k ¼ 0; koo þ 1 i j; k þ þ;
This is an external function which receives as input ser4 ¼ Series[Coefficient[ser3,
the refractive indices of the two media and outputs the rx, k], {ry, 0, o}];
transformation matrix for a surface; it is built as the For½u ¼ 0; uoo þ 1 i j k; u þ þ;
product of three matrices: final ¼ AppendTo[final,
Surface[n1_, n2_, r_] Coefficient[ser4,ry,u]*axˆ i*
:¼ back[r] . refraction[n1, n2, r] . ayˆ j*rxˆ k*ryˆ u];
Screen[r]. ]]]]; final].

VectorBase[{ax_, ay_, rx_, ry_}, o_]


A.7. Distance :¼ Module[{final, final ¼ {};
For½i ¼ 0; ioo þ 1; i þ þ;
This is an external function which receives as input For½j ¼ 0; joo þ 1 i; j þ þ;
the distance travelled along the axis and outputs the For½k ¼ 0; koo þ 1 i j; k þ þ;
matrix for the straight path transformation: For½u ¼ 0; uoo þ 1 i j k; u þ þ;
Distance[t_] :¼ Module[{matrix}, final ¼ AppendTo[final,
matrix ¼ IdentityMatrix[40], axˆ i*ayˆ j*rxˆ k*ryˆ u];
matrix[[1]] ¼ {1,t,0,0,0,0,0,t/ ]]]]; final]
2,0,0,0,0,0,
0,0,0,0,0,0,3t/ End[]; EndPackage[].
8,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,5 t/16},
otherlines[matrix]].
References
[1] J.B. Almeida, The use of matrices for third order modeling
A.8. Other functions of optical systems, In: K.P. Thompson, L.R. Gardner
(Eds.), International Optical Design Conference; Proc.
Auxiliary functions include Lens[], for the matrix of SPIE 3482 (1998) 917–925.
a single element lens in air, functions for gaussian [2] J.B. Almeida, General method for the determination of
constants, conjugates, etc. matrix coefficients for high order optical system modeling,
J. Opt. Soc. Am. A 16 (1999) 596–601.
[3] A. Gerrard, J.M. Burch, Introduction to Matrix Methods
Appendix B. The ‘‘expansion’’ package
in Optics, Dover Publications, New York, 1994.
BeginPackage["Optics‘expansion‘"] [4] M. Kondo, Y. Takeuchi, Matrix method for nonlinear
Expansion::usage transformation and its application to an optical lens
¼ "Expansion[e,{x,y,z,t},o] finds the system, J. Opt. Soc. Am. A 13 (1996) 71–89.
coefficients of the series [5] V. Lakshminarayanan, S. Varadharajan, Expressions for
expansion of expression e in variables aberration coefficients using nonlinear transforms, Opto-
metry Vision Sci. 74 (1997) 676–686.
x,y,z,t up to the order o".
[6] Mathematica 4.0, Wolfram Research, Inc., 1999.
VectorBase::usage
[7] Oslo LT—version 5, Optics design software, Sinclair
¼ "VectorBase[{x,y,z,t},o] outputs a Optics, Inc., 1995.
vector with all the {x,y,z,t} monomials [8] B.H. Walker, Optical Engineering Fundamentals,
of grade not higher than o". McGraw-Hill, New York, 1995.

You might also like