An Automatic Method for Generating Symbolic Expressions of Zernike Circular Polynomials
필름·전자재료 · (16) CPI(투명 폴리이미드)
기본 정보
- 저자
- DOI
- 10.1109/access.2023.3283028
- 저널
- IEEE Access
- 발행년도
- 2023
- 발행기관
- Institute of Electrical and Electronics Engineers
- 피인용수
- 2
- 라이선스
- cc-by-nc-nd
- 논문 유형
- –
- 언어
- –
- 원문 페이지
- http://dx.doi.org/10.1109/access.2023.3283028
- 토픽
- Optical Coatings and Gratings
- OpenAlex ID
- W4379472500
평가 내용
- 관련도
- 사업분야
- 필름·전자재료 · (16) CPI(투명 폴리이미드)
- 부 분야
- –
- R&D 측면
- –
- 확신도
- –
- 근거 용어
- –
- 판단 근거
- 임베딩 유사도 기반 평가로 '필름·전자재료 > CPI(투명 폴리이미드)' 분야에 선정된 논문입니다.
- R&D 활용 포인트
- –
- 평가 입력
- –
초록
본문 61,505자
본문 펼치기
섹션 본문 232문단 · 33,436자
(제목 없음)
1Zernike circular polynomials (ZCP) play a significant role in optics engineering.The symbolic expressions for ZCP are valuable for theoretic analysis and engineering designs.However, there are still two problems which remain open: firstly, there is a lack of sufficient mathematical formulas of the ZCP for optics designers; secondly the formulas for inter-conversion of Noll's single index and Born-Wolf's double indices of ZCP are neither uniquely determinate nor satisfactory.An automatic method for generating symbolic expressions for ZCP is proposed based on five essential factors: the new theorems for converting the single/double indices of the ZCP, the robust and effective numeric algorithms for computing key parameters of ZCP, the symbolic algorithms for generating mathematical expressions of ZCP, and meta-programming & L A T E X programming for generating the table of ZCP.The theorems, method, algorithms and system architecture proposed are beneficial to both optics design process, optics software, computer-output typesetting in publishing industry as well as STEM education.
Introduction
2In optics engineering, the Zernike circular polynomials (ZCP), also named Zernike polynomials for simplicity, are essential for representing aberrations in imaging system, optics design and optical testing [1][2][3][4][5][6][7][8][9].Mathematically, ZCP are a sequence of bivariate polynomials defined on the unit disk
3derived from the circular pupils of imaging system.Named after Frits Zernike, they play an important role in beam optics and optics design [10], atmospheric turbulence [11] and image processing [12].The ZCP are orthogonal functions which represent balanced aberrations that yield minimum variance [9].The computation of ZCP are significant for theoretic analysis and engineering applications.The numerical algorithms are discussed in lots of literature such as [4,[12][13][14].However, the symbolic computation for automatically generating the mathematical expressions for the ZCP is missing.It may be inconvenient or troublesome for the optics designers to look for the formulas of ZCP with "high" orders.Actually, there are less 28 ∼ 40 and 70 expressions for the ZCP in ZEMAX and CodeV respectively.
4The purpose of this paper is to propose an automatic method for generating mathematical expressions for the ZCP.FIGURE 1 illustrates the framework of our work.There are five modules for the system architecture:
5• Principle of Index Conversion, which includes our new theorems and proofs about the single/double index for the ZCP;
6• Numeric computation, which computes key parameters robustly and effectively for large integers so as to avoid the overflow problem in computing factorials;
7• Symbolic computation, which deals with the algorithms for automatic generating symbolic expressions of the ZCP;
8• Meta-programming and L A T E X programming, which generates the long table of ZCP and outputs the corresponding pdf file for printing, reading and reference;
9• System setting, which sets the necessary information for the mathematical formula of ZCP and the geometric configuration of the long table of mathematical expressions.
10The contents of this paper are organized as follows: Section 2 deals with the preliminaries of backgrounds; Section 3 copes with the principle of inter-conversion of the single/double index for computing ZCP; Section 4 focuses on how to generate long table of mathematical expressions of ZCP; Section 5 is the conclusion.
11Figure 1: System architecture for automatically generating a long table of the mathematical expressions of ZCP {Z j (ρ, θ) : j min ≤ j ≤ j max } 2 Preliminaries
Notations for Integers
12For an integer n ∈ Z = {0, ±1, ±2, • • •}, it is even if and only if 2 | n, i.e., 2 divides n or equivalently n ≡ 0 (mod 2); otherwise, it is odd if and only if 2 ∤ n or equivalently n ≡ 1 (mod 2).The sets of even and odd integers are denoted by
13respectively.The set of positive integers are N = {1, 2, 3, • • •} and the set of non-negative integers is
14In consequence, the sets of non-negative even integers and non-negative odd integers can be denoted by Z + even and Z + odd respectively.For any real number x ∈ R, the unique integer n = ⌊x⌋ ∈ Z such that n ≤ x < n + 1 is called the floor of x.Similarly, the integer
Expression of General Polynomials
15A polynomial T n (x) with argument x and degree n can be written by
16If a i = 0 for all odd i , then T n (x) is an even polynomial.Similarly, if a i = 0 for all even i, then T n (x) is an odd polynomial.Futhermore, some of the coefficients a 0 , a 1 , • • • , a n may be missing if they equal zero.
17In consequence, we can denote a polynomial as
18where p s ∈ Z + .In other words, a polynomial can be described by the sequence of coefficients c = ⟨c 0 , • • • , c k ⟩ and the corresponding sequence of power indices p = ⟨p 0 , • • • , p k ⟩.
Binomial and Tri-nomial Coefficients
19In general, for any real number α ∈ R and non-negative i ∈ Z + = {0, 1, 2, • • •} the generalized binomial expansion can be expressed by
20in which ROC is the region of convergence and
21is the binomial coefficient [15][16][17].Particularly, if α ∈ Z + is a positive integer, we have
22For any r ∈ Z + we have
23is the tri-nomial coefficients, which is symmetric for a permutation of i 1 , i 2 , i 3 and can be expressed in terms of binomial coefficients:
24Therefore, for r = n − s, p = 3,
25When computing the value of binomial coefficients with computer programs, we should keep an eye on the overflow problem since the factorial r! increases rapidly with the integer r.We can avoid such a risk by reformulating the binomial coefficient properly, i.e., for any i ∈ Z = {0} ∪ N,
26The value of α i can be computed with Algorithm 4 robustly and fastly.
Kronecker Symbol
27The notation
28is called the Kronecker symbol.Particularly, δ m0 = 1 for m = 0 and δ m0 = 0 otherwise.
Discrete Unit Step Function
29The discrete unit step function is defined by
30with the counterpart of Heaviside function in the continuous case.
Cardinality
31For a finite set A = {x 1 , • • • , x r }, its cardinality is denoted by |A|, i.e.
32where
33is the coefficients for normalization,
34is the angular function with equivalent complex form e i|m|θ , R m n (ρ) = 1
35is the radial Zernike polynomials in which
36and
37Substituting ( 7) into (17), we obtain the following efficient expression for computing c s
Single and Double Indices for Zernike Circular Polynomials
38There are different schemes for representing the order of ZCP in theory analysis and applications.The first scheme is the Born-Wolf notation (BWN), which uses the double indices ⟨n, m⟩ in the expression Z m n (ρ, θ).This kind of notation is well known in the famous book by .The BWN is also named with OSA notation.
39The second scheme is characterized by a single index j.However, there are three choices for the single index:
40• ANSI "Standard Zernike Polynomials".In this case j ANSI = n(n+2)+m 2 .
41• ZEMAX "Standard Zernike Coefficients".This is introduced by Noll in studying atmospheric turbulence [11], in which j is used to represent the order instead of n and m.In the software ZEMAX for optics design, the Noll's notation j is taken.
42• ZEMAX "Zernike Fringe Polynomials"1 , which is introduced by James C. Wyant [18].
43In this paper, we just concern the Noll's Z j and the Born-Wolf's Z m n due to their wide applications in optics design where the relation between ⟨n, m⟩ and j is well known for optics engineers.In this sense, we have [10,11] Z j (ρ, θ) = Z m n (ρ, θ), j = j(n, m) ∈ N (19) such that
Problem of the Inter-conversion of Single/Double Indices
44For the given single index j, we have [9,19]
45and
46However, there is a lack of simple expression to calculate j when both n and m are given.Actually, what we can find is a description of j in a range n(n + 1)/2 + 1 ≤ j ≤ n(n + 1)/2 + n + 1 (as explained in [9,19]).
47Here both the lower and the upper bound for j is not tight, so it can not be used to determine j uniquely.Consequently, it is worth exploring new results for the inter-conversion of j and ⟨n, m⟩.
General Description of a Table
48For a general table with abstract data set 1, there are some fundamental parameters for specifications: the caption of the table, the number of columns denoted by n cols , the number of rows denoted by n rows = i end − i begin + 1, the list of attribute names with the size n cols , the elements of attribute data which have n rows records and each record is an array of abstract data type (ADT) with n cols members.
Table of Mathematical Expressions for Zernike Circular Polynomials
49For our objective of automatically generating the long table
50for the ZCP with algorithms and computer programs, all of the data terms in the table are strings specified with L A T E X grammar.It is easy for us to set the following specifications:
51• the number of columns is n cols = 5;
52• the list of attribute names are:
53attribname-#1 -j, the symbolic expression for the single index j could be the string "$j$";
54attribname-#2 -n, the symbolic expression for the n-component of double indices ⟨n, m⟩ could be the string "$n$";
55attribname-#3 -m, the symbolic expression for the m-component of double indices ⟨n, m⟩ could be the string "$m$";
56attribname-#4 -N m n , the symbolic expression for the normalization coefficient could be the string "$N^m_n$"; attribname-#5 -R m n (ρ)Θ m (θ), the symbolic expression for the Zernike circular polynomial such that Z j (ρ, θ) = R m n (ρ)Θ m (θ) could be the string "$\\Zern_j(\\rho,\\theta)= \\Radipoly {n}{m}(\\rho)\\Theta_m(\\theta)$";
57• the caption of the table could be
58As an illustration, for 1 ≤ j ≤ 465, our table (obtained by compiling the L A T E X source file) will have the form like TABLE 2.
Inter-conversion of Single/Double Indices of Zernike Circular Polynomials
59The inter-conversion of the double indices ⟨n, m⟩ and single index j is significant for generating the table of ZCP and looking up the table for the polynomials of interests automatically.In this section, we will establish new formula and theorems to specify the implementation of the inter-conversion for Noll's single index j and Born-Wolf's double indices ⟨n, m⟩.
Conversion of Double/Single Indices
60The Noll's index j and the Born-Wolf's indices ⟨n, m⟩ can be converted to each other and the conversions can be uniquely determined.
61for |m| ≤ n and 2 | (n − m).
62be the sequence of possible integers m such that
63In other words, the integer
64is the subscript r or the position in the sequence
65Thus for the given n and m, let r be position of m ∈ V n mod 2 , then the corresponding index j for the Z j (ρ, θ) = Z m n (ρ, θ) must be the sum of base position n(n + 1)/2 and relative position r, i.e.,
66This implies that (24) holds since we have (27).Q.E.D.
Conversion of Single/Double Indices
67As mentioned above, there is a lack of simple formulae for converting Noll's single index j to Born-Wolf's double indices ⟨n, m⟩.The following theorem remedies the defects.
68Theorem 2. Given the Noll index j, the Born-Wolf 's indices ⟨n, m⟩ can be computed with the following expressions:
69−r(j), for 2 ∤ r(j) and 2 ∤ n(j); r(j) − 1, for 2 | r(j) and 2 ∤ n(j).
70(32)
71Proof : By (24), we have
72Consequently, The purpose of numeric computation for generating ZCP is to determine the key parameters involved, which includes single/double indices j, n, m, binomial coefficients α i and the powers p i in radial polynomial function R m n (ρ).Given the BWN pair ⟨n, m⟩, the Noll's single index j can be determined by (24), please see the procedure CvtNM2J in Algorithm 2 for the details.On the other hand, suppose the single index j is known, we can compute the double indices ⟨n, m⟩ according to (30), ( 31) and (32).The procedure CvtJ2NM in Algorithm 3 illustrates the steps and details completely.1: function CvtJ2NM(j)
2:
73Check the value of the integer j: j ≥ 1 3:
74n ← (−3 + √ 8j + 1)/2 ;
4:
75r ← j − n(n + 1)/2;
76if (2 | r) then end if
77return ⟨n, m⟩; 19: end function
Computation of Binomial Coefficients
78The binomial coefficients α i is important for computing the coefficients c s in (18).The robust and fast procedure CalcBinomCoef for computing the α i is given in Algorithm 4.
Algorithm 4 Calcluating the binomial coefficient α i
79Input: Real number α ∈ R and non-negative integer i ∈ Z + ;
80Output: The real number α i .
811: function CalcBinomCoef(α, i)
82Check the value of integer i: i ≥ 0
3:
83prod ← 1;
844:
85if (i ≥ 1) then 5:
86end for 8:
87return prod; 10: end function
Computation of Coefficients and Power Indices of Radial Zernike Polynomials
88The coefficients {c s : 0 ≤ s ≤ k} and power indices {p s : 0 ≤ s ≤ k} in the radial Zernike polynomials can be computed by the procedure CalcRadialPolyPowerCoef in Algorithm 5 according to (17) and (18).k ← CvtNM2K(⟨n, m⟩);
89p s ← n − 2s; determine the sign of c s since we may get "+", "-" or "0";
90• generate all of the k + 1 terms one by one with an iterative operation via loop construction in high level computer programming language.
91FIGURE 2 illustrates these steps with the help of nesting procedures for sub-tasks.
GenSexprPolynom GenSexpreGeneralTerm
92are given, the symbolic expression of g(x) can be generated with an iterative process:
93• determining the generating method for the symbolic expression of general term c s x ps ;
94• generating all of the terms iteratively for s = 0, 1, 2, • • • , k.
95However, there are three issues to be settled:
96• specifying the formal variable x for the polynomial since it may be x, t, ρ or other possible symbol;
97• specifying the operator for representing the power since x r could be implemented by x^r in L A T E X and MATLAB/Octave, or by x**r for Python, and so on;
98• specifying the special cases for the general term:
99if p s = 1, then c s x 1 should be replaced by c s x; if p s = 0, then c s x 0 should be replaced by c s ; if c s < 0, then the string +c s x ps should be replaced by − |c s | x ps ; if c s = 0, then the term c s x ps should disappear and be ignored.
100For the mathematical expression of polynomials, we should consider the coefficients and their signs carefully.The procedure GenSexprCatSign in Algorithm 6 is used to determine the symbol "+" or "−" for concatenation.The steps for generating a general polynomial are built on the following operations:
101• determining the symbol "+" or "−" for the i-th term c i x p i according to the procedure GenSex-prCatSign;
102• generating symbolic expressions for the term |c i | x p i without the sign of c i via the procedure Gen-SexprUsgnGeneralTerm in Algorithm 7;
103• generating the symbolic expression for the general term c i x p i in the polynomial according to the procedure GenSexprGeneralTerm in Algorithm 8;
104• generating the polynomial f (x) = i c i x p i with the procedure GenSexprPolynom in Algorithm 9.
105It should be noted that if c i = 0, the term c i x p i will be ignored for generating symbolic expression.
106Algorithm 6 Generate the symbol "+" or "−" for concatenation Input: Argument fp for text file, Coefficient c i and position label i Output: The sign of c i 1: function GenSexprCatSign(fp, c i , i)
107if (c i < 0) then 3:
108Fprintf(fp, "−");
4:
109else // for c i ≥ 0 5:
110Fprintf(fp, "+"); if (ucoef ̸ = 1) then 6:
111Fprintf(fp, "%d%s",ucoef,var); Fprintf(fp, "%s",var); if (ucoef ̸ = 1) then 16:
112Fprintf(fp, "%d%s%s{%d}", ucoef, var, op, p i ); Fprintf(fp, "%s%s{%d}", var, op, p i ); GenSexprCatSign(fp, c i , i);
113continue; // just ignore the term c s x ps since it is zero, increase s by 1
114GenSexprGeneralTerm(fp, s, var, op, c s , p s );
7:
115Fprintf(fp, " "); // is is optional , print empty space for better visualization.
8:
116end for 9: end function
Generating Symbolic Expressions for Radial Zernike Polynomials
117Once the algorithm for generating a general polynomial is designed, we can use it to generate the Zernike radial polynomials R m n (ρ) where the coefficients and power indices should be computed properly.The procedure GenSexprRadialPolynom in Algorithm 10 is designed for this purpose.size ← 1 + CvtNM2K(⟨n, m⟩); // size = 1 + k; GenSexprPolynom(fp, var, op, c, p, size); // Algorithm 9 5: end function
Generating Symbolic Expressions for Angular Function
118The symbolic computation for the angular function Θ m (θ) is straight ford according to (14) if (j = 0) then 8:
119Fprintf(fp, "1"); Fprintf(fp, "\\cos(\\theta)"); // print cos(θ) Fprintf(fp, "\\cos(%d\\theta)", m); // print cos(mθ) end if 31: end function
Generating Symbolic Expressions for Normalization Coefficient
120The symbolic computation of the normalization coefficient N m n can be based on ( 13) and a simple if-else statement is enough, please see the procedure GenSexprRadiNormCoef in Algorithm 12. Fprintf(fp, "\\sqrt{%d}", 2 * (n + 1)); // print 2(n + 1)
121end if 7: end function
Generating Non-Standard (Unnormalized) Zernike Circular Polynomial
122For any single index j ∈ Z + or the corresponding double indices ⟨n, m⟩, the ZCP Z
123θ) consists of three parts: the normalization coefficient N m n determined by (13), the radial polynomial R m n (ρ) specified by (15), and the angular function Θ m (θ) given by ( 14).The procedure GenSexprZernikePolynomNM in Algorithm 13 generates the un-normalized ZCP, which separates the normalization coefficient N m n clearly.
124Algorithm 13 Generate the L A T E X code for the non-standard (un-normalized) Zernike circular function Ẑj (ρ, θ) = R m n (ρ)Θ m (θ) Input: Argument fp for text file, double indices ⟨n, m⟩ Output: Symbolic expression for R m n (ρ)Θ m (θ) denoted by the grammar of L A T E X 1: function GenSexprZernikePolynomNM(fp, ⟨n, m⟩)
2:
125size ← 1 + CvtNM2K(⟨n, m⟩);
3:
126var ← "\\rho"; // for the symbol ρ in L A T E X
4:
127op ← "^"; // for the power operator in L A T E X
5:
128if (m = 0 or size = 1) then 6:
129GenSexprRadiPolynom(fp, ⟨n, m⟩, var, op); // print R m n (ρ)
130Fprintf(fp,"("); // print left bracket 9:
131GenSexprRadiPolynom(fp, ⟨n, m⟩, var, op); GenSexprAnguFun(fp, ⟨n, m⟩); // print Θ m (θ) 13: end function
Meta-Programming and L A T E X Programming
132For the purpose of generating mathematical formula for ZCP, we can use meta-programming and L A T E X programming.Essentially, the key idea of meta-programming is generating destination code with algorithms and computer programs implemented by source code.There are two fundamental steps to do so:
133• generating L A T E X code (destination code) for creating symbolic expressions for Zernike circular polynomials with some high level programming languages such as C/C++, Octave/MATLAB, Python, Java and so on (source code);
134• compiling the L A T E X code to generate the symbolic expressions and output a file with the format *.dvi or *.pdf.
135In this work, we use the C programming language to generate the L A T E X source code for representing the symbolic expressions for ZCP.Our emphasis is put on the algorithms instead of concrete C code since the algorithms can be implemented with various programming languages.
Generating L A T E X Code for a Line of a Table
136The procedure GenLaTeXTableLine is used to generate a line d i of a long table
137However, it depends on the concrete problem and we have to give details in the program.In object-oriented programming, it is a good idea to implement it with virtual function.For the purpose of generating ZCP, we can set i ← j (Noll's single index j), n cols ← 5, i begin ← j min and i end ← j max .Algorithm 14 gives the method of generating the Z j (ρ, θ).
Algorithm 14 Generate L A T E X code for the line of a table of Zernike Circular Polynomials
138Input: Argument fp for text file, single index j ∈ N Output: L A T E X code for the j-th line d j , viz.,
139⟨n, m⟩ ← CvtJ2NM(j);
3:
140Fprintf(fp, " $%d$ & $%d$ & $%d$", j, n, m); // print the indices j, n, m 4:
141Fprintf(fp, " &$");
5:
142GenSexprRadiNormCoef(fp, ⟨n, m⟩); // print the normalization coefficient N m n 6:
143Fprintf(fp, "$");
7:
144Fprintf(fp, " &$");
8:
145GenSexprNonStandardZern(fp, ⟨n, m⟩); // print Ẑj (ρ, θ) = R m n (ρ)Θ m (θ)
146Fprintf(fp, "$"); 10: end function
Generate L A T E X Code for Long Table
147We can set the format of the long table based on the \usepackage{longtable} in the preamble of the L A T E X source file.The procedure GenLaTeXLongTable in Algorithm 15 is used for automatically generating a long table which may span multiple pages.
148Algorithm 15 Generate L A T E X code for a long table with the data sheet of size n rows × n cols where n rows = i end − i begin + 1.
149Input: Argument fp for L A T E X file, integer i begin , integer i end , variable tab for table information with the four members:
150• n cols : number of attribute
151• attribname: list of attribute names
152• alignctrl: alignment information
153• caption: name of the table title
154Output: L A T E X code for the long table
155The main body of the L A T E X source file is a necessary part of the L A T E X source file, which has simple specification.The procedure GenLaTeXFileMainBody in Algorithm 16 is used for generating the main body of L A T E X source file.For controlling the the format of the pdf file to be created, it is necessary for us to set the document class of the L A T E X source file.We just set it with the mode "article" and select the 11pt fonts and A4 paper.Please see the procedure SetLaTeXDocCalss in Algorithm 17.
156Algorithm 16 Generate L A T E X code for the main body of the L A T E X source file for generating a long table Input: Argument fp for L A T E X file, integer i begin , integer i end Output: Main body of the L A T E X source file for generating a long table 1: function GenLaTeXFileMainBody(fp, tab, i begin , i end )
1572:
158Fprintf(fp, "\\begin{document}\n\n");
1593:
160Fprintf(fp, "\\maketitle\n\n");
4:
161Fprintf(fp, "\n");
5:
162GenLaTeXLongTable(fp, tab, i begin , i end );
1636:
164Fprintf(fp, "\n"); Fprintf(fp, "\\documentclass[11pt,a4paper]{article}\n\n"); 3: end function
Generate L A T E X Source File
165In the L A T E X programming, it is important for us to set the preamble so as to import the macros or definitions for special symbols, mathematical environments, format specifications and so on.For our purpose, we need to import packages for mathematics, long table and paper size.Particularly, we should define new commands for printing the mathematical notations Z m n and R m n .The procedure SetLaTeXDocPreamble in Algorithm 18 describes the details about setting the preamble.
166Algorithm 18 Set the preamble of the L A T E X source file Input: Argument fp for L A T E X source file, struct variable layout for the layout information which includes the following members:
167• orient: orientation, it could be portrait or landscape
168• left: distance for the left margin, say "2.0cm"
169• right: distance for the right margin, say "2.0cm"
170• top: distance for the top margin, say "2.0cm"
171• bottom: distance for the bottom margin, say "2.0cm"
172Output: Text lines for the preamble of the L A T E X source file 1: function SetLaTeXDocPreamble(fp,layout)
173//Import L A T E X packages required for mathematical formula, paper size and long table
3:
174Fprintf(fp, "\\usepackage{amsmath,amsfonts,amssymb}\n");
4:
175Fprintf(fp, "\\usepackage[%s,left=%s,right=%s,top=%s,bottom=%s]{geometry}\n", layout.orient,layout.left,layout.right,layout.top,layout.bottom);
5:
176Fprintf(fp, "\\usepackage{longtable}\n\n");
6:
177//Set the macros for generating the symbolic expresstions for Zernike functions: Fprintf(fp, "\\DeclareMathOperator{\\Zern}{Z}\n");
8:
178Fprintf(fp, "\\DeclareMathOperator{\\Radi}{R}\n");
9:
179Fprintf(fp,"\\newcommand{\\Zernpoly} [2]{\\Zern_{#1}^{#2}}\n"); 10:
180Fprintf(fp,"\\newcommand{\\Radipoly} [2]{\\Radi_{#1}^{#2}}\n"); //Set the title and author for the pdf document to be generated Fprintf(fp, "\\begin{document}\n\n");
1813:
182Fprintf(fp, "\\maketitle\n\n");
4:
183Fprintf(fp, "\n");
5:
184GenLaTeXLtable(fp, tab, i begin , i end );
6:
185Fprintf(fp, "\n");
7:
186Fprintf(fp, "\\end{document}\n"); 8: end function
187The ultimate goal of automatically generating mathematical formula of ZCP is to create a L A T E X source file which consists of the following steps:
188• creating an empty L A T E X *.tex file with the operation mode "write";
189• setting the document class;
190• setting the preamble;
191• generating the key contents in of the L A T E X file, and
192• closing the *.tex properly.
193The procedure GenLaTeXFile in Algorithm 20 demonstrates the above steps clearly.
194Algorithm 20 Generate L A T E X source file *.tex for producing the long table of Zernike circular polynomials, viz.
195String filename with the suffix .texfor L A T E X source file, struct variable tab with four members (viz.n cols , atribname, alignctrl and caption), minimum single index j min , maximum single index j max Output: L A T E X source file with the name filename 1: function GenLaTeXFile(filename, tab, j min , j max )
1962:
197fp ← Fopen(filename, "w"); // Create the L A T E X source file with the suffix *.tex
3:
198SetDocumentCalss(fp);
4:
199SetDocumentPreamble(fp);
5:
200GenKeyContentsInTeXFile(fp, tab, j min , j max );
6:
201Fclose(fp); // Close the L A T E X source file 7: end function 4.3.5 L A T E X Compiling Generally, the L A T E X source code for editing should be compiled with the terminal of Unix/Linux/Windows operating system or with an IDE such as TeXMaker or TeXStudio.Fortunately, there are some application program interface (API) for the operating system in high level programming language.For example, in C/C++, we can use the built-in function system(command_expr) to compile the source file.Here the command_expr stands for the commands of L A T E X compiling with the type const char*.Typical implementations for command_expr could be the string "xelatex filename.tex"or "pdflatex filename.tex".
Conclusion
202For the ZCP Z j (ρ, θ) = N m n R m n (ρ)Θ m (θ), our new theorems show that the conversion of Noll's single index j and Born-Wolf's double indices ⟨n, m⟩ can be implemented via (24), (30), ( 31) and (32).The interconversion is simple, complete and satisfactory.The symbolic expression of ZCP can be automatically generated with the GenLaTeXFile in Algorithm 20.For the convenience of theoretic analysis and engineering design, a system architecture of generating long table of mathematical expressions of ZCP is proposed with the help of meta-programming & L A T E X programming for computer-output typesetting.The value of the new paradigm for generating ZCP lies in three merits: editing mathematical expressions automatically instead of manually, avoiding potential errors by algorithms and programs that are verified, and saving the time overhead needed in manual operations.
203As a useful reference, the mathematical expressions for {Z j (ρ, θ) : 1 ≤ j ≤ 465} are provided on the GitHub site, which would be sufficient for the purpose of R & D. For the users without interest of the underlying principles and implementation details, they can just download the mathematical table of ZCP released on the GitHub web site.
204The implementation of our algorithms is based on the C programming language and the API of OS (the standard library function system in the standard C).It is easy to implement the algorithms with other programming languages which can deal with strings more conveniently such as C++, Octave, MATLAB, Python and so on.The method for automatically generating long table of mathematical expressions for ZCP can be modified slightly so as to create various long tables in optics engineering as well as in other science and technology fields, which helps to make different kinds of handbook involving massive tables.
205In the sense of project-driven science-tchnology-engineering-mathematics (STEM) education, the automatic method for generating symbolic expressions of ZCP can be used to create a comprehensive project for training college students' ability of solving complex problem by combining multi-disciplinary knowledge and methods.
Data Availability Statement
206The code for automatically generating the table of Zernike circular polynomials can be downloaded from the GitHub site https://github.com/GrAbsRD/ZernikeSymbolicExpression.For the readers who has no interest in the principles and implementation of the algorithms developed in this paper, they can just download the pdf file TableZernikePolynom-1-465.pdf or the L A T E X source file TableZernikePolynom -1-465.tex to generate the long table of 465 Zernike circular polynomials Z j (ρ, θ) such that 1 = j min ≤ j ≤ j max = 465 and |m| ≤ n max = 29.We believe that this table will satisfies the requirements of optics design.
207r and 2 | n; −r, for 2 | r and 2 | n; −r, for 2 ∤ r and 2 ∤ n; r − 1, for 2 | r and 2 ∤ n.
2084.1.1Calcualte the Parameter k for the Radial Zernike Polynomial The parameter k in (16) determines the number of terms of the radial Zernike polynomial R m n (ρ).The k can be directly obtained by the double indices ⟨n, m⟩, see Algorithm 1. Algorithm 1 Calculate the parameter k for the number of terms in the radial Zernike polynomial R m n (ρ) Input: Noll's double indices ⟨n, m⟩ Output: the parameter k for the radial polynomial R m n (ρ) 1: function CvtNM2K(⟨n, m⟩) 2: k ← (n − |m|)/2; 3: return k; 4: end function 4.1.2Interconversion of Single/Double Indices
Algorithm 2 2 :
209Convert the BWN pair ⟨n, m⟩ to the Noll's single index j Input: Double indices ⟨n, m⟩ of BWN where n ∈ Z + and m ∈ Z such that −n ≤ m ≤ n and 2 | (n − m).Output: Single index j ∈ N of Noll notation.1: function CvtNM2J(⟨n, m⟩) Check the input n and m: n ≥ 0, −n ≤ m ≤ n, 2 | (n − m).
3 : 3
210if (m ≥ 0) then 4: j ← n(n + 1)/2 + m + 1; Convert the single index j of Noll notation to double indices ⟨n, m⟩ of BWN Input: Single index j of Noll notation.Output: BWN pair ⟨n, m⟩ where n ∈ Z + and m ∈ Z such that |m| ≤ n and 2 | (n − m).
7 :mmm
211← −r; // For 2 | n and 2 | r, m = −r.← r − 1; // For 2 | n and 2 ∤ r, m = r − 1. ← r − 1; // For 2 ∤ n and 2 | r, m = r − 1. r; // For 2 ∤ n and 2 ∤ r, m = −r.
Algorithm 5
212Calculate the sequence of coefficients c = ⟨c 0 , c 1 , • • • , c k ⟩ and sequence of power indices p = ⟨p 0 , p 1 , • • • , p k ⟩ for the radial polynomial function R m n (ρ) Input: BWN pair ⟨n, m⟩ where n ∈ Z + and m ∈ Z such that |m| ≤ n and n − m is even.Output: The sequence of coefficients c = ⟨c 0 , c 1 , • • • , c k ⟩ and the sequence of powers p = ⟨p 0 , p 1 , • • • , p k ⟩ of radial polynomial function R m n (ρ) where k = (n − |m|)/2.
1:
213function CalcRadialPolyPowerCoef(⟨n, m⟩) 2:
9 :
214return ⟨c, p⟩; 10: end function 4.2 Symbolic Computation for Generating Zernike Circular Polynomials 4.2.1 Generating Symbolic Expression for a Polynomial Formally, there are two steps for generating the symbolic expression for a polynomial g(x) = k s=0 c s x ps : • generate the symbolic expression for the general term c s x ps generate the unsigned general term |c s | x ps ;
Figure 2 :
215Figure 2: Procedures involved in generating symbolic expression for a polynomial.
3 :
216GenSexprUsgnGeneralTerm(fp, var, op, c i , p i ); 4: end function Algorithm 9 Generate Symbolic Expression for a polynomial f (x) = k s=0 c s x ps Input: Argument fp for text file, symbolic argument var for x, symbolic argument op for the power operator, sequence of coefficients c = ⟨c 0 , c 1 , • • • , c k ⟩, sequence of power indices p = ⟨p 0 , p 1 , • • • , p k ⟩, integer size for the counting number of single terms in f (x).Output: Symbolic expression for the polynomial f (x) stored in the text file accessed by fp.1: function GenSexprPolynom(fp, var, op, c, p, size) 2:
Algorithm 10
217Generating symbolic expression for the Zernike radial polynomial R m n (ρ) Input: Argument fp for text file, double indices ⟨n, m⟩, string var for ρ, string op for "^".Output: Print symbolic expression for the Zernike Radial polynomial R m n (ρ) = k s=0 c s ρ ps .1:function GenSexprRadialPolynom(fp, ⟨n, m⟩, var, op)2:
3 :
218⟨c, p⟩ ← CalcRadiPolynomPowerCoef(⟨n, m⟩); // Algorithm 5 4:
Algorithm 12
219Generating symbolic expression for the normalization coefficient N m n Input: Argument fp for text file, double indices ⟨n, m⟩ Output: Print the symbolic expression normalization of coefficient N m n = 2(n + 1)/(1 + δ 0m ) 1: function GenSexprRadiNormCoef(fp, ⟨n, m⟩)
7 :
220Fprintf(fp, "\\end{document}\n"); 8: end function Algorithm 17 Set the document class of the L A T E X source file Input: Argument fp for L A T E X source file Output: Text line for the document class 1: function SetLaTeXDocCalss(fp) 2:
221Fundamentals of Mathematics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2.1.1Notations for Integers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2.1.2Expression of General Polynomials . . . . . . . . . . . . . . . . . . . . . . . . . . .2.1.3Binomial and Tri-nomial Coefficients . . . . . . . . . . . . . . . . . . . . . . . . . .2.1.4Kronecker Symbol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2.1.5Discrete Unit Step Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2.1.6Cardinality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2.2 Zernike Circular Polynomials . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2.2.1 Definition of Zernike Circular Polynomials . . . . . . . . . . . . . . . . . . . . . . .
2222.2.2 Single and Double Indices for Zernike Circular Polynomials . . . . . . . . . . . . .
Table 1 :
223General form of caption for a table with n cols attributes and n rows
Table 2 :
224Zernike Circular Polynomials Z j
4
225Generating Table of Zernike Circular Polynomials 4.1 Numeric Computation for Generating Zernike Circular Polynomials
226Generate symbolic expression for the term |c i | x p i without the sign of c Input: Argument c i for the i-th coefficient , argument p i for the power index; Output: The string of characters for |c i | x p i ; 1: function GenSexprUsgnGeneralTerm(var, op, c i , p i )
227Generate the symbolic expression for the general term c i x p i in the polynomial Input: Argument fp for text file, integer i, string argument var for x, string argument op, argument c i for the i-th coefficient, integer argument for p i for the power index of single term Output: Symbolic expression of c i x p i stored in the text file accessed by fp.
2281: function GenSexprGeneralTerm(fp, i, var, op, c i , p i ) 2:
229, please see the procedure GenSexprAnguFun in Algorithm 11.Algorithm 11 Generate Symbolic Expression for Angular Function Θ m (θ) Input: Argument fp for text file, double indices ⟨n, m⟩ Output: Symbolic expression for angular function θ m (θ)
2301: function GenSexprAnguFun(fp, ⟨n, m⟩) 2: j ← CvtNM2J(⟨n, m⟩); 3: m ← |m|; 4:if (j ∈ Z even ) then
12 :
231Fprintf(fp, "\\title{Table of Zernike Circular Polynoms}\n");The key contents of L A T E X source file is the code in the L A T E X environment \begin{document} ... \end{document}, which includes the long table generated by the procedure GenLaTeXLtable in Algorithm 15.The procedure GenKeyContentsInTeXFile in Algorithm 19 shows the mechanicsm of generating the very L A T E X code of interest.Algorithm 19 Generate the key contents, i.e. the L A T E X long table, for the L A T E X source file Input: Argument fp for L A T E Xsource file, struct variable tab with four members (viz.ncols , atribname, alignctrl and caption), integer i begin , and integer i end Output: The complete L A T E X code for creating long table1: function GenKeyContentsInTeXFile(fp, tab, i begin , i end )
2322:
참고문헌 15건
- Zernike circle polynomials and infinite integrals involving the product of Bessel functions arXiv (Cornell University) · Cornell University · 2010 10.48550/arxiv.1007.0667
- Optical Shop Testing 2006 10.1002/9780470135976
- The Art of Computer Programming. Volume 1: Fundamental Algorithms. Journal of the American Statistical Association · 1969 10.2307/2283757
- Concrete Mathematics: A Foundation for Computer Science Computers in Physics · American Institute of Physics · 1989 10.1063/1.4822863
- Zernike basis to cartesian transformations Serbian Astronomical Journal · Astronomical Observatory, Department of Astronomy, Belgrade · 2009 10.2298/saj0979107m
- Zernike polynomials and atmospheric turbulence* Journal of the Optical Society of America · Optica Publishing Group · 1976 10.1364/josa.66.000207
- Zernike annular polynomials for imaging systems with annular pupils Journal of the Optical Society of America · Optica Publishing Group · 1981 10.1364/josa.71.000075
- A comparative analysis of algorithms for fast computation of Zernike moments Pattern Recognition · Elsevier BV · 2002 10.1016/s0031-3203(02)00091-2
- On the Mathematical Properties of the Zernike Polynomials Optica Acta International Journal of Optics · Taylor & Francis · 1976 10.1080/713819334
- Orthonormal aberration polynomials for optical systems with circular and annular sector pupils Applied Optics · Optica Publishing Group · 2013 10.1364/ao.52.001136
- Recursive formula to compute Zernike radial polynomials Optics Letters · Optica Publishing Group · 2013 10.1364/ol.38.002487
- Optical Imaging and Aberrations, Part III: Wavefront Analysis SPIE eBooks · SPIE · 2013 10.1117/3.927341
- Computation of special functions Computers & Mathematics with Applications · Elsevier BV · 1996 10.1016/s0898-1221(96)90020-6
- Principles of Optics 1999 10.1017/cbo9781139644181
- Balanced Binary Tree Schemes for Computing Zernike Radial Polynomials arXiv (Cornell University) · Cornell University · 2022 10.48550/arxiv.2212.02495