원시데이터 수집 시스템
선정목록으로

An Automatic Method for Generating Symbolic Expressions of Zernike Circular Polynomials

관련 필름·전자재료 · (16) CPI(투명 폴리이미드)

기본 정보

저자
  1. Hong‐Yan Zhang — School of Information Science and Technology, Hainan Normal University, Haikou, China
  2. Yu Zhou — School of Information Science and Technology, Hainan Normal University, Haikou, China
  3. Fuyun Li — School of Information Science and Technology, Hainan Normal University, Haikou, China
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 활용 포인트
–
평가 입력
–

초록

Zernike 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 & LATEX 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.

본문 61,505자

본문 펼치기
Received 8 May 2023, accepted 30 May 2023, date of publication 5 June 2023, date of current version 12 June 2023. _Digital Object Identifier 10.1109/ACCESS.2023.3283028_ # An Automatic Method for Generating Symbolic Expressions of Zernike Circular Polynomials HONG-YAN ZHANG, YU ZHOU, (Member, IEEE), AND FU-YUN LI School of Information Science and Technology, Hainan Normal University, Haikou 571158, China Corresponding author: Hong-Yan Zhang (hongyan@hainnu.edu.cn) This work was supported in part by the Hainan Provincial Natural Science Foundation of China under Grant 2019RC199, in part by the Hainan Provincial Education and Teaching Reform Project of Colleges and Universities under Grant Hnjg2019-46, and in part by the National Natural Science Foundation of China under Grant 62167003. ABSTRACT Zernike 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 metaprogramming & L <sup>A</sup> TEX 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. INDEX TERMS Zernike circular polynomial, symbolic computation, mathematical table, computer-output typesetting, L <sup>A</sup> TEX programming, STEM education. I. INTRODUCTION In 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 _D_ = �( _x, y_ ) : 0 ≤ _x_ <sup>2</sup> + _y_ <sup>2</sup> ≤ 1� = {( _ρ, θ_ ) : 0 ≤ _ρ_ ≤ 1 _,_ 0 ≤ _θ_ ≤ 2 _π_ } derived 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 The associate editor coordinating the review of this manuscript and approving it for publication was Md. Selim Habib . algorithms are discussed in lots of literature such as [4], [12], [13], and [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. The 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: - Principle of Index Conversion, which includes our new theorems and proofs about the single/double index for the ZCP; - Numeric computation, which computes key parameters robustly and effectively for large integers so as to avoid the overflow problem in computing factorials; - Symbolic computation, which deals with the algorithms for automatic generating symbolic expressions of the ZCP; This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4 0 License - Meta-programming and L <sup>A</sup> TEX programming, which generates the long table of ZCP and outputs the corresponding pdf file for printing, reading and reference; - System setting, which sets the necessary information for the mathematical formula of ZCP and the geometric configuration of the long table of mathematical expressions. The contents of this paper are organized as follows: Section II deals with the preliminaries of backgrounds; Section III copes with the principle of inter-conversion of the single/double index for computing ZCP; Section IV focuses on how to generate long table of mathematical expressions of ZCP; Section V is the conclusion. II. PRELIMINARIES _A._ _FUNDAMENTALS OF MATHEMATICS_ 1) NOTATIONS FOR INTEGERS For 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 For any _r_ ∈ Z <sup>+</sup> we have ( _x_ 1 + _x_ 2 + _x_ 3) <sup>_r_</sup> = 3) BINOMIAL AND TRI-NOMIAL COEFFICIENTS In general, for any real number _α_ ∈ R and non-negative _i_ ∈ Z <sup>+</sup> = {0 _,_ 1 _,_ 2 _,_ - · ·} the generalized binomial expansion can be expressed by (1 + _x_ ) <sup>_α_</sup> = ∞ _i_ =0 - _α_ _x_ <sup>_i_</sup> _,_ _x_ ∈ ROC = (−1 _,_ 1) _i_ in which ROC is the region of convergence and - _α_ _i_ - = <sup>_α_</sup> <sup><u>(</u></sup> <sup>_α_</sup> <sup>−</sup> <sup><u>1) · · · (</u></sup> <sup>_α_</sup> <sup>−</sup> <sup>_<u>i</u>_</sup> <sup>+ 1)</sup> (3) _i_ ! - = <sup>_α_</sup> <sup><u>(</u></sup> <sup>_α_</sup> <sup>−</sup> <sup><u>1) · · · (</u></sup> <sup>_α_</sup> <sup>−</sup> <sup>_<u>i</u>_</sup> <sup>+ 1)</sup> is the binomial coefficient [15], [16], [17]. Particularly, if _α_ ∈ Z <sup>+</sup> is a positive integer, we have - _α_ - _α_ ! = (4) _i_ _i_ !( _α_ - _i_ )! <sup>_._</sup> _x_ 1 <sup>_i_</sup> <sup>1</sup> <sup>_x_</sup> 2 <sup>_i_</sup> <sup>2</sup> <sup>_x_</sup> 3 <sup>_i_</sup> <sup>3</sup> _x_ 1 <sup>_i_</sup> <sup>1</sup> - _r_ _i_ 1 _, i_ 2 _, i_ 3 _i_ 1+ _i_ 2+ _i_ 3= _r_ Zodd = - _i_ ∈ Z : 2 ∤ _i_ - = {±1 _,_ ±3 _,_ ±5 _,_ - · ·} and Zeven = { _i_ ∈ Z : 2 | _i_ } = {0 _,_ ±2 _,_ ±4 _,_ ±6 _,_ - · ·} respectively. The set of positive integers are N = {1 _,_ 2 _,_ 3 _,_ - · ·} and the set of non-negative integers is Z <sup>+</sup> = N ∪{0} = {0 _,_ 1 _,_ 2 _,_ - · ·}. Similarly, the set of negative integers is Z <sup>−</sup> = −N = {−1 _,_ −2 _,_ −3 _,_ - · ·}. In consequence, the sets of non-negative even integers and non-negative odd integers can be denoted by Z <sup>+</sup> even <sup>and Z+</sup> odd <sup>respectively.</sup> 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 _n_ <sup>′</sup> = ⌈ _x_ ⌉∈ Z such that _n_ <sup>′</sup> - 1 _<_ _x_ ≤ _n_ <sup>′</sup> is called the ceiling of _x_ . 2) EXPRESSION OF GENERAL POLYNOMIALS A polynomial _Tn_ ( _x_ ) with argument _x_ and degree _n_ can be written by where - _r_ _i_ 1 _, i_ 2 _, i_ 3 = <sup><u>(</u></sup> <sup>_<u>i</u>_</sup> <sup><u>1</u></sup> <sup>+</sup> <sup>_<u>i</u>_</sup> <sup><u>2</u></sup> <sup>+</sup> <sup>_<u>i</u>_</sup> <sup><u>3)!</u></sup> _,_ _i_ 1 + _i_ 2 + _i_ 3 = _r_ (5) _i_ 1! _i_ 2! _i_ 3! is 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: _._ (6) - _r_ _i_ 1 _, i_ 2 _, i_ 3 = - _i_ 1 + _i_ 2 _i_ 1 �� _i_ 1 + _i_ 2 + _i_ 3 _i_ 1 + _i_ 2 Therefore, for _r_ = _n_ - _s, p_ = 3 _, i_ 1 = _s, i_ 2 = _k_ - _s, i_ 3 = _n_ - _k_ - _s, i_ 1 + _i_ 2 + _i_ 3 = _n_ - _s_, we can obtain - _n_ - _s_ = _s, k_ - _s, n_ - _k_ - _s_ - _k_ _s_ �� _n_ - _s_ _._ (7) _k_ _aix_ <sup>_i_</sup> = _a_ 0 + _a_ 1 _x_ + · · · + _aix_ <sup>_i_</sup> + · · · + _anx_ <sup>_n_</sup> (1) When 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, - _α_ = _i_ _Tn_ ( _x_ ) = _n_ _i_ =0 1 _,_ _i_ = 0; _i_ −1 _α_ - _t_ _t_ =0    If _ai_ = 0 for all odd _i_, then _Tn_ ( _x_ ) is an even polynomial. Similarly, if _ai_ = 0 for all even _i_, then _Tn_ ( _x_ ) is an odd polynomial. Futhermore, some of the coefficients _a_ 0 _, a_ 1 _,_ - · · _, an_ may be missing if they equal zero. In consequence, we can denote a polynomial as _α_ - _t_ _α_ - _t_ (8) _i_ - _t_ <sup>_,_</sup> <sup>_i_</sup> <sup>≥</sup> <sup>1</sup> <sup>_._</sup> The value of - _αi_ - can be computed with Algorithm 4 robustly and fastly. The value of - _α_ _i_ - 0 _,_ _i_ ̸ = _j_ (9) 1 _,_ _i_ = _j_ 4) KRONECKER SYMBOL The notation _δij_ = _T_ ( _x_ ) = _k_ _s_ =0 _csx_ <sup>_ps_</sup> _,_ _ps_ ∈ Z <sup>+</sup> (2) where _ps_ ∈ Z <sup>+</sup> . In other words, a polynomial can be described by the sequence of coefficients c = ⟨ _c_ 0 _,_ - · · _, ck_ ⟩ and the corresponding sequence of power indices p = ⟨ _p_ 0 _,_ - · · _, pk_ ⟩. is called the Kronecker symbol. Particularly, _δm_ 0 = 1 for _m_ = 0 and _δm_ 0 = 0 otherwise. FIGURE 1. System architecture for automatically generating a long table of the mathematical expressions of ZCP � Z _j_ ( _ρ, θ_ ) : _j_ min ≤ _j_ ≤ _j_ max � . 5) DISCRETE UNIT STEP FUNCTION The discrete unit step function is defined by where - √2( _<u>n</u>_ + 1) _<u>,</u>_ _m_ ̸ = 0 √ (13) _n_ + 1 _,_ _m_ = 0 ~~�~~ <u>2(</u> _<u>n</u>_ + 1) = 1 + _δm_ 0 _Nn_ <sup>_m_</sup> <sup>=</sup> _u_ ( _m_ ) = - 1 _,_ _m_ ∈ Z+ = {0 _,_ 1 _,_ 2 _,_ 3 _,_ - · ·} (10) 0 _,_ _m_ ∈ Z <sup>−</sup> = {−1 _,_ −2 _,_ −3 _,_ - · ·} with the counterpart of Heaviside function in the continuous case. 6) CARDINALITY For a finite set _A_ = { _x_ 1 _,_ - · · _, xr_ }, its cardinality is denoted by | _A_ |, i.e. | _A_ | = |{ _x_ 1 _,_ - · · _, xr_ }| = _r._ (11) _B._ _ZERNIKE CIRCULAR POLYNOMIALS_ 1) DEFINITION OF ZERNIKE CIRCULAR POLYNOMIALS Generally, for _n_ ∈ Z <sup>+</sup> and _m_ ∈ Z such that | _m_ | ≤ _n_ and 2 | ( _n_ - _m_ ), the ZCP can be denoted by [1], [3], [4] is the coefficients for normalization, 1 _,_ _m_ = 0 _, j_ ∈ Z <sup>+</sup> ̸ odd _�m_ ( _θ_ ) =   ̸  ̸ odd cos(| _m_ | _θ_ ) _,_ _m_ ̸ = 0 _, j_ ∈ Z <sup>+</sup> even sin(| _m_ | _θ_ ) _,_ _m_ ̸ = 0 _, j_ ∈ Z <sup>+</sup> odd (14) is the angular function with equivalent complex form e <sup>i|</sup> <sup>_m_</sup> <sup>|</sup> <sup>_θ_</sup>, <u>1</u> <sup>_m_</sup> _n_ <sup>(</sup> <sup>_ρ_</sup> <sup>) =</sup> _<u>m</u>_ <u>|</u> 2 R <sup>_m_</sup> _n_ ( <sup>_<u>n</u>_</sup> <sup><u>−|</u></sup> <sup>_<u>m</u>_</sup> <sup><u>|</u></sup> 2 <sup>_<u>m</u>_</sup> <sup><u>|</u></sup> )! _ρ_ <sup>|</sup> <sup>_m_</sup> <sup>|</sup> 2 _<u>n</u>_ <u>+|</u> _<u>m</u>_ <u>|</u> <u>�</u> <u>d</u> <u>�</u> <sup>_<u>n</u>_</sup> <sup><u>−|</u></sup> 2 <sup>_<u>m</u>_</sup> <sup><u>|</u></sup> ( _ρ_ <sup>2</sup> ) d( _ρ_ <sup>2</sup> ) _<u>m</u>_ <u>|</u> _<u>n</u>_ <u>−|</u> _<u>m</u>_ <u>|</u> 2 ( _ρ_ <sup>2</sup> - 1) 2 _<u>n</u>_ <u>−|</u> _<u>m</u>_ <u>|</u> 2 <u>�</u> _s_ =0 _k_ �(−1) <sup>_s_</sup> _s_ =0 (−1) <sup>_s_</sup> - <u>(</u> _<u>n</u>_ - _<u>s</u>_ <u>)!</u> - _n_ - _s_ _s, k_ - _s, n_ - _k_ - _s_ <u>�</u> ! <u>�</u> _<u>n</u>_ <u>−|</u> _<u>m</u>_ <u>|</u> _<u>m</u>_ <u>|</u> - _s_ 2 - _ρ_ <sup>_n_</sup> <sup>−2</sup> <sup>_s_</sup> _s_ ! <u>�</u> _<u>n</u>_ <u>+|</u> _<u>m</u>_ <u>|</u> _<u>m</u>_ <u>|</u> - _s_ 2 <u>�</u> ! Z <sup>_m_</sup> _n_ <sup>_m_</sup> _n_ <sup>(</sup> <sup>_ρ, θ_</sup> <sup>) =</sup> <sup>_N_</sup> _n_ <sup>_m_</sup> _n_ <sup>_m_</sup> <sup>R</sup> <sup>_m_</sup> _n_ <sup>_m_</sup> _n_ <sup>(</sup> <sup>_ρ_</sup> <sup>)</sup> <sup>_�m_</sup> <sup>(</sup> <sup>_θ_</sup> <sup>)</sup> <sup>_,_</sup> _ρ_ ∈ [0 _,_ 1] _, θ_ ∈ [0 _,_ 2 _π_ ] - _ρ_ <sup>_n_</sup> <sup>−2</sup> <sup>_s_</sup> (12) = = = _k_ _s_ =0 _csρ_ <sup>_ps_</sup> = _c_ 0 _ρ_ <sup>_n_</sup> + _c_ 1 _ρ_ <sup>_n_</sup> <sup>−2</sup> + · · · + _ck_ _ρ_ <sup>_n_</sup> <sup>−2</sup> <sup>_k_</sup> (15) is the radial Zernike polynomials in which _k_ = <sup><u>1</u></sup> 2 <sup>(</sup> <sup>_n_</sup> <sup>−|</sup> <sup>_m_</sup> <sup>|)</sup> (16) and _cs_ = (−1) <sup>_s_</sup> - _n_ - _s_ _s, k_ - _s, n_ - _k_ - _s_ _,_ 0 ≤ _s_ ≤ _k_ ;  _s, k_ - _s, n_ - _k_ - _s_ (17) _ps_ = _n_ - 2 _s,_ 0 ≤ _s_ ≤ _k._ However, 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]). Here 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_ ⟩. _C._ _ELEMENTS OF A TABLE_ 1) GENERAL DESCRIPTION OF A TABLE For a general table with abstract data set  Substituting (7) into (17), we obtain the following efficient expression for computing _cs_ _T_ = - _d_ <sup>_α_</sup> ∈ _S_ 1 × _S_ 2 × · · · × _Sn_ cols : _i_ begin ≤ _α_ ≤ _i_ end� where _d_ <sup>_α_</sup> = ( _d_ 1 <sup>_α_</sup> where _d_ <sup>_α_</sup> = ( _d_ 1 <sup>_α,_</sup> <sup>· · ·</sup> <sup>_, d_</sup> _β_ <sup>_α,_</sup> <sup>· · ·</sup> <sup>_, d_</sup> _n_ <sup>_α_</sup> cols <sup>)</sup> <sup>is</sup> <sup>the</sup> <sup>_α_</sup> <sup>-th</sup> <sup>record</sup> <sup>as</sup> shown in TABLE 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. 1 <sup>_α,_</sup> <sup>· · ·</sup> <sup>_, d_</sup> _β_ <sup>_α,_</sup> <sup>· · ·</sup> <sup>_, d_</sup> _n_ <sup>_α_</sup> _cs_ = (−1) <sup>_s_</sup> - _k_ _s_ �� _n_ - _s_ _,_ 0 ≤ _s_ ≤ _k._ (18) _k_ �� _n_ - _s_ _k_ 2) SINGLE AND DOUBLE INDICES FOR ZERNIKE CIRCULAR POLYNOMIALS There 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 <sup>_m_</sup> _n_ <sup>(</sup> <sup>_ρ, θ_</sup> <sup>).</sup> <sup>This</sup> <sup>kind</sup> <sup>of</sup> <sup>notation</sup> <sup>is</sup> well known in the famous book by Born-Wolf [1]. The BWN is also named with OSA notation. The second scheme is characterized by a single index _j_ . However, there are three choices for the single index: - ANSI ‘‘Standard Zernike Polynomials’’. In this case _j_ ANSI = <sup>_<u>n</u>_</sup> <sup><u>(</u></sup> <sup>_<u>n</u>_</sup> <sup><u>+</u></sup> 2 <sup><u>2)+</u></sup> <sup>_<u>m</u>_</sup> . - 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. - ZEMAX ‘‘Zernike Fringe Polynomials’’, <sup>1</sup> which is introduced by James C. Wyant [18]. In this paper, we just concern the Noll’s _Zj_ and the BornWolf’s Z <sup>_m_</sup> _n_ <sup>due</sup> <sup>to</sup> <sup>their</sup> <sup>wide</sup> <sup>applications</sup> <sup>in</sup> <sup>optics</sup> <sup>design</sup> where the relation between ⟨ _n, m_ ⟩ and _j_ is well known for optics engineers. In this sense, we have [10], [11] 2) TABLE OF MATHEMATICAL EXPRESSIONS FOR ZERNIKE CIRCULAR POLYNOMIALS For our objective of automatically generating the long table _T_ Zernike <sup>_m_</sup> _n_ <sup>(</sup> <sup>_ρ_</sup> <sup>)</sup> <sup>_�m_</sup> <sup>(</sup> <sup>_θ_</sup> <sup>)] :</sup> <sup>_j_</sup> <sup>min</sup> <sup>≤</sup> <sup>_j_</sup> <sup>≤</sup> <sup>_j_</sup> <sup>max</sup> _,_ (23) = - _d_ <sup>_j_</sup> = [ _j, n, m, Nn_ <sup>_m_</sup> _n_ <sup>_m,_</sup> <sup>R</sup> <sup>_m_</sup> _n_ Z _j_ ( _ρ, θ_ ) = Z <sup>_m_</sup> _n_ <sup>(</sup> <sup>_ρ, θ_</sup> <sup>)</sup> <sup>_,_</sup> _j_ = _j_ ( _n, m_ ) ∈ N (19) for the ZCP with algorithms and computer programs, all of the data terms in the table are strings specified with L <sup>A</sup> TEX grammar. It is easy for us to set the following specifications: - the number of columns is _n_ cols = 5; - the list of attribute names are: - - attribname-#1 — _j_, the symbolic expression for the single index _j_ could be the string "$j$"; - - attribname-#2 — _n_, the symbolic expression for the _n_ -component of double indices ⟨ _n, m_ ⟩ could be the string "$n$"; - - attribname-#3 — _m_, the symbolic expression for the such that ⟨Z _j_ | Z _j_ ′⟩= _πδjj_ ′ _._ (20) 3) PROBLEM OF THE INTER-CONVERSION OF SINGLE/DOUBLE INDICES For the given single index _j_, we have [9], [19] _m_ -component of double indices ⟨ _n, m_ ⟩ could be the string "$m$"; - - attribname-#4 - _Nn_ <sup>_m_</sup> <sup>,</sup> <sup>the</sup> <sup>symbolic</sup> <sup>expression</sup> <sup>for</sup> the normalization coefficient could be the string " $N^m_n$"; - - attribname-#5 - R <sup>_m_</sup> _n_ <sup>(</sup> <sup>_ρ_</sup> <sup>)</sup> <sup>_�m_</sup> <sup>(</sup> <sup>_θ_</sup> <sup>),</sup> the symbolic attribname-#5 - R <sup>_m_</sup> _n_ <sup>(</sup> <sup>_ρ_</sup> <sup>)</sup> <sup>_�m_</sup> <sup>(</sup> <sup>_θ_</sup> <sup>),</sup> the symbolic expression for the Zernike circular polynomial such that Z _j_ ( _ρ, θ_ ) = R <sup>_m_</sup> _n_ <sup>(</sup> <sup>_ρ_</sup> <sup>)</sup> <sup>_�m_</sup> <sup>(</sup> <sup>_θ_</sup> <sup>)</sup> <sup>could</sup> <sup>be</sup> <sup>the</sup> _n_ = _n_ ( _j_ ) = - ~~�~~ 2 _j_ - 1 + <sup><u>1</u></sup> 2 - 1 (21) and - <u>2</u> _<u>j</u>_ <u>+1−</u> _<u>n</u>_ <u>(</u> _<u>n</u>_ <u>+1)</u> 2 4 - 1 _,_ _n_ ∈ Z <sup>+</sup> odd <sup>_._</sup> (22) _m_ = _m_ ( _j_ ) =    2 - <u>2</u> _<u>j</u>_ <u>+1−4</u> _<u>n</u>_ <u>(</u> _<u>n</u>_ <u>+1)</u> - _,_ _n_ ∈ Z <sup>+</sup> even <sup>;</sup> - the caption of the table could be - - caption - Zernike Polynomials Z _j_ ( _ρ, θ_ ) = _Nn_ <sup>_m_</sup> <sup>R</sup> <sup>_m_</sup> _n_ <sup>(</sup> <sup>_ρ_</sup> <sup>)</sup> <sup>_�m_</sup> <sup>(</sup> <sup>_θ_</sup> <sup>).</sup> such that Z _j_ ( _ρ, θ_ ) = R <sup>_m_</sup> _n_ <sup>(</sup> <sup>_ρ_</sup> <sup>)</sup> <sup>_�m_</sup> <sup>(</sup> <sup>_θ_</sup> <sup>)</sup> <sup>could</sup> <sup>be</sup> <sup>the</sup> string "$\\Zern_j(\\rho,\\theta)= \\ Radipoly{n}{m}(\\rho)\\Theta_m(\\ theta)$"; 1It is also named polynomials of University of Arizona. _n_ <sup>_m_</sup> <sup>R</sup> <sup>_m_</sup> _n_ <sup>_m_</sup> _n_ <sup>(</sup> <sup>_ρ_</sup> <sup>)</sup> <sup>_�m_</sup> <sup>(</sup> <sup>_θ_</sup> <sup>).</sup> TABLE 1. General form of caption for a table with _n_ cols attributes and _n_ row = _iend_ − _ibegin_ + 1 records. As an illustration, for 1 ≤ _j_ ≤ 465, our table (obtained by compiling the L <sup>A</sup> TEX source file) will have the form like TABLE 2. III. INTER-CONVERSION OF SINGLE/DOUBLE INDICES OF ZERNIKE CIRCULAR POLYNOMIALS The 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_ ⟩. _A._ _CONVERSION OF DOUBLE/SINGLE INDICES_ The 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. _Theorem 1:_ _The Noll’s index j can be computed with Born-_ _Wolf’s indices_ ⟨ _n, m_ ⟩ _by_ _j_ ( _n, m_ ) = <sup>_<u>n</u>_</sup> <sup><u>(</u></sup> <sup>_<u>n</u>_</sup> <sup>+ 1)</sup> + | _m_ | + _u_ ( _m_ ) (24) 2 _for_ | _m_ | ≤ _n and_ 2 | ( _n_ - _m_ ) _._ _Proof_ : Let _Vn_ = ⟨ _v_ 1 _,_ - · · _, vr_ _,_ - · · _, vn_ +1 ⟩ Therefore, for _i_ ∈{0 _,_ 1 _,_ - · · _, n_ - 1}, the total number of Zernike polynomial Z <sup>_m_</sup> _i_ <sup>(</sup> <sup>_ρ, θ_</sup> <sup>) is</sup> _n_ −1 _i_ =0 | _Vi_ | = _n_ −1 ( _i_ + 1) = 1 + 2 + · · · + _n_ = <sup>_<u>n</u>_</sup> <sup><u>(</u></sup> <sup>_<u>n</u>_</sup> <sup>+ 1)</sup> _i_ =0 <sup>+ 1)</sup> _._ 2 Thus for the given _n_ and _m_, let _r_ be position of _m_ ∈ _Vn_ mod 2, then the corresponding index _j_ for the Z _j_ ( _ρ, θ_ ) = Z <sup>_m_</sup> _n_ <sup>(</sup> <sup>_ρ, θ_</sup> <sup>)</sup> must be the sum of base position _n_ ( _n_ + 1) _/_ 2 and relative position _r_, i.e., _j_ = <sup>_<u>n</u>_</sup> <sup><u>(</u></sup> <sup>_<u>n</u>_</sup> <sup>+ 1)</sup> + _r_ (29) 2 This implies that (24) holds since we have (27). Q.E.D. _B._ _CONVERSION OF SINGLE/DOUBLE INDICES_ As 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. _Theorem 2:_ _Given_ _the_ _Noll_ _index_ _j,_ _the_ _Born-Wolf’s_ _indices_ ⟨ _n, m_ ⟩ _can_ _be_ _computed_ _with_ _the_ _following_ _expressions_ : _n_ ( _j_ ) = - −3 + ~~√~~ <u>8</u> _<u>j</u>_ + 1 2 _,_ (30) (25) (26) _r_ ( _j_ ) = _j_ - <sup>_<u>n</u>_</sup> <sup><u>(</u></sup> <sup>_<u>j</u>_</sup> <sup><u>)[</u></sup> <sup>_<u>n</u>_</sup> <sup><u>(</u></sup> <sup>_<u>j</u>_</sup> <sup><u>) + 1]</u></sup> _,_ (31) 2 = - ⟨0 _,_ −2 _,_ 2 _,_ −4 _,_ 4 _,_ - · · _,_ - _n, n_ ⟩ _,_ _n_ ∈ Z+even ⟨−1 _,_ 1 _,_ −3 _,_ 3 _,_ - · · _,_ - _n, n_ ⟩ _,_ _n_ ∈ Z <sup>+</sup> odd _r_ ( _j_ ) − 1 _,_ for 2 ∤ _r_ ( _j_ ) and 2 | _n_ ( _j_ ); - _r_ ( _j_ ) _,_ for 2 | _r_ ( _j_ ) and 2 | _n_ ( _j_ ); - _r_ ( _j_ ) _,_ for 2 ∤ _r_ ( _j_ ) and 2 ∤ _n_ ( _j_ ); _r_ ( _j_ ) − 1 _,_ for 2 | _r_ ( _j_ ) and 2 ∤ _n_ ( _j_ ) _._ be the sequence of possible integers _m_ such that _m_ ( _j_ ) = _vr_ ( _j_ ) =    (32) _r_ - 1 _,_ for 2 ∤ _r_ 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._ _<u>n</u>_ <u>(</u> _<u>n</u>_ + 1) + 1) _< j_ ≤ <sup>_<u>n</u>_</sup> <sup><u>(</u></sup> <sup>_<u>n</u>_</sup> <sup>+ 1)</sup> 2 2 _m_ = _vr_ =    _Proof_ : By (24), we have <sup>+ 1)</sup> + _n_ + 1 _._ (33) 2 In other words, the integer _r_ = | _m_ | + _u_ ( _m_ ) = - _m_ + 1 _,_ _m_ ≥ 0 (27) - _m,_ _m <_ 0 Consequently, −3 + <sup>~~√~~</sup> <u>8</u> _<u>j</u>_ + 1 <sup>~~√~~</sup> <u>8</u> _<u>j</u>_ + 1 ≤ _n <_ <sup>−1 +</sup> <sup>~~√~~</sup> <sup><u>8</u></sup> <sup>_<u>j</u>_</sup> <sup>+ 1</sup> 2 2 (34) 2 is the subscript _r_ or the position in the sequence _Vn_ for _m_ = _vr_ ∈ _Vn_ . It is easy to find that the cardinality of _Vn_ is | _Vn_ | = _n_ + 1 _,_ _n_ ∈ Z <sup>+</sup> (28) This implies (30) by the definition of floor of real number. (31) is obvious by (29). With the help of (26) we immediately have (32). Q.E.D. TABLE 2. Zernike circular polynomials Z _j_ ( _ρ, θ_ ) = _Nn_ <sup>_m_</sup> <sup>R</sup> _n_ <sup>_m_</sup> <sup>(</sup> <sup>_ρ_</sup> <sup>)</sup> <sup>_�_</sup> <sup>_m_</sup> <sup>(</sup> <sup>_θ_</sup> <sup>).</sup> IV. GENERATING TABLE OF ZERNIKE CIRCULAR POLYNOMIALS _A._ _NUMERIC COMPUTATION FOR GENERATING ZERNIKE_ _CIRCULAR POLYNOMIALS_ 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 single/double indices _j, n, m_, binomial coefficients - _αi_ - and the powers _pi_ in radial polynomial function R <sup>_m_</sup> _n_ <sup>(</sup> <sup>_ρ_</sup> <sup>).</sup> <sup>_m_</sup> _n_ <sup>(</sup> <sup>_ρ_</sup> <sup>).</sup> - _α_ _i_ 1) CALCUALTE THE PARAMETER _k_ FOR THE RADIAL ZERNIKE POLYNOMIAL The parameter _k_ in (16) determines the number of terms of the radial Zernike polynomial R <sup>_m_</sup> _n_ <sup>(</sup> <sup>_ρ_</sup> <sup>).</sup> <sup>The</sup> <sup>_k_</sup> <sup>can</sup> <sup>be</sup> <sup>directly</sup> 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 <sup>_m_</sup> _<u>n</u>_ <sup>(</sup> <sup>_ρ_</sup> <sup>)</sup> 2) INTERCONVERSION OF SINGLE/DOUBLE INDICES 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. Algorithm 2 Convert the BWN pair ⟨ _n, m_ ⟩ to the Noll’s single <u>index</u> _<u>j</u>_ Input : Double indices ⟨ _n, m_ ⟩ of BWN where _n_ ∈ Z <sup>+</sup> 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_ ⟩) 2: Check the input _n_ and _m_ : _n_ ≥ 0 _,_ - _n_ ≤ _m_ ≤ _n,_ 2 | ( _n_ - _m_ ). 3: if ( _m_ ≥ 0) then 4: _j_ ← _n_ ( _n_ + 1) _/_ 2 + _m_ + 1; 5: else 6: _j_ ← _n_ ( _n_ + 1) _/_ 2 − _m_ ; 7: end if 8: return _j_ ; 9: <u>end function</u> terms in the radial Zernike polynomial R <sup>_m_</sup> _<u>n</u>_ <sup>(</sup> <sup>_ρ_</sup> <sup>)</sup> Input : Noll’s double indices ⟨ _n, m_ ⟩ Output : the parameter _k_ for the radial polynomial R <sup>_m_</sup> _n_ 1: function CvtNM2K(⟨ _n, m_ ⟩) 2: _k_ ← ( _n_ −| _m_ |) _/_ 2; 3: return _k_ ; 4: <u>end function</u> <sup>_m_</sup> _n_ <sup>(</sup> <sup>_ρ_</sup> <sup>)</sup> Algorithm 3 Convert the single index _j_ of Noll notation to <u>double indices ⟨</u> _<u>n, m</u>_ ⟩ <u>of BWN</u> Input : Single index _j_ of Noll notation. Output : BWN pair ⟨ _n, m_ ⟩ where _n_ ∈ Z <sup>+</sup> and _m_ ∈ Z such that | _m_ | ≤ _n_ and 2 | ( _n_ - _m_ ). 1: function CvtJ2NM( _j_ ) Algorithm 5 Calculate the sequence of coefficients c = ⟨ _c_ 0 _, c_ 1 _,_ - · · _, ck_ ⟩ and sequence of power indices p = ⟨ _p_ <u>0</u> _, p_ <u>1</u> _,_ - · · _, pk_ ⟩ for the radial polynomial function R <sup>_m_</sup> _<u>n</u>_ <sup>(</sup> <sup>_ρ_</sup> <sup>)</sup> Input : BWN pair ⟨ _n, m_ ⟩ where _n_ ∈ Z <sup>+</sup> and _m_ ∈ Z such that | _m_ | ≤ _n_ and _n_ - _m_ is even. Output : The sequence of coefficients c = ⟨ _c_ 0 _, c_ 1 _,_ - · · _, ck_ ⟩ 2: Check the value of the integer _j_ : _j_ ≥ 1 3: _n_ ← (−3 + <sup>~~√~~</sup> 8 _j_ + 1) _/_ 2 �; 4: _r_ ← _j_ - _n_ ( _n_ + 1) _/_ 2; 5: if (2 | _n_ ) then 6: if (2 | _r_ ) then 7: _m_ ←− _r_ ; // For 2 | _n_ and 2 | _r_, _m_ = − _r_ . 8: else 9: _m_ ← _r_ - 1; // For 2 | _n_ and 2 ∤ _r_, _m_ = _r_ - 1. 10: end if 11: else 12: if (2 | _r_ ) then 13: _m_ ← _r_ - 1; // For 2 ∤ _n_ and 2 | _r_, _m_ = _r_ - 1. 14: else 15: _m_ ←− _r_ ; // For 2 ∤ _n_ and 2 ∤ _r_, _m_ = − _r_ . 16: end if 17: end if 18: return ⟨ _n, m_ ⟩; 19: <u>end function</u> and the sequence of powers p = ⟨ _p_ 0 _, p_ 1 _,_ - · · _, pk_ ⟩ of radial polynomial function R <sup>_m_</sup> _n_ <sup>(</sup> <sup>_ρ_</sup> <sup>) where</sup> <sup>_k_</sup> <sup>= (</sup> <sup>_n_</sup> <sup>−|</sup> <sup>_m_</sup> <sup>|)</sup> <sup>_/_</sup> <sup>2.</sup> <sup>_m_</sup> _n_ <sup>(</sup> <sup>_ρ_</sup> <sup>) where</sup> <sup>_k_</sup> <sup>= (</sup> <sup>_n_</sup> <sup>−|</sup> <sup>_m_</sup> <sup>|)</sup> <sup>_/_</sup> <sup>2.</sup> 1: function CalcRadialPolyPowerCoef(⟨ _n, m_ ⟩) 3) COMPUTATION OF BINOMIAL COEFFICIENTS The binomial coefficients - _αi_ - is important - _α_ _i_ The binomial coefficients - _αi_ - is important for comput ing the coefficients _cs_ in (18). The robust and fast procedure CalcBinomCoef for computing the - _αi_ - is given in - _α_ _i_ cedure CalcBinomCoef for computing the - _αi_ - is given in Algorithm 4. <u>�</u> Algorithm 4 Calcluating the binomial coefficient <u>�</u> _α_ _i_ Input : Real number _α_ ∈ R and non-negative integer _i_ ∈ Z <sup>+</sup> ; 2: _k_ ← CvtNM2K(⟨ _n, m_ ⟩); 3: sign ← 1; 4: for _s_ ∈⟨0 _,_ 1 _,_ - · · _, k_ ⟩ do 5: _cs_ ← sign - CalcBinomCoef( _k, s_ ) CalcBinomCoef( _n_ - _s, k_ ); 6: _ps_ ← _n_ - 2 _s_ ; 7: sign ←−sign; 8: end for 9: return ⟨c _,_ p⟩; 10: <u>end function</u> FIGURE 2. Procedures involved in generating symbolic expression for a polynomial. _B._ _SYMBOLIC COMPUTATION FOR GENERATING ZERNIKE_ _CIRCULAR POLYNOMIALS_ 1) GENERATING SYMBOLIC EXPRESSION FOR A POLYNOMIAL Formally, there are two steps for generating the symbolic Output : The real number - _α_ _i_ . - _k_ _s_ =0 _csx_ <sup>_ps_</sup> : 1: function CalcBinomCoef( _α, i_ ) expression for a polynomial _g_ ( _x_ ) = 2: Check the value of integer _i_ : _i_ ≥ 0 3: prod ← 1; 4: if ( _i_ ≥ 1) then 5: for _t_ ∈⟨0 _,_ 1 _,_ - · · _, i_ - 1⟩ do 6: prod ← prod · ( _α_ - _t_ ) _/_ ( _i_ - _t_ ); 7: end for 8: end if 9: return prod; 10: <u>end function</u> 4) COMPUTATION OF COEFFICIENTS AND POWER INDICES OF RADIAL ZERNIKE POLYNOMIALS The coefficients { _cs_ : 0 ≤ _s_ ≤ _k_ } and power indices { _ps_ : 0 ≤ _s_ ≤ _k_ } in the radial Zernike polynomials can be computed by the procedure CalcRadialPolyPowerCoef in Algorithm 5 according to (17) and (18). - generate the symbolic expression for the general term _csx_ <sup>_ps_</sup> - - generate the unsigned general term | _cs_ | _x_ <sup>_ps_</sup> ; - - determine the sign of _cs_ since we may get "+", "-" or "0"; - generate all of the _k_ +1 terms one by one with an iterative operation via loop construction in high level computer programming language. FIGURE 2 illustrates these steps with the help of nesting procedures for sub-tasks. When the sequence of coefficients c = ⟨ _c_ 0 _, c_ 1 _,_ - · · _, ck_ ⟩ and the sequence of power indices p = ⟨ _p_ 0 _, p_ 1 _,_ - · · _, pk_ ⟩ of the polynomial _f_ ( _x_ ) = _c_ 0 _x_ <sup>_p_</sup> <sup>0</sup> + · · · _csx_ <sup>_ps_</sup> + · · · + _ck_ _x_ <sup>_pk_</sup> are given, the symbolic expression of _g_ ( _x_ ) can be generated with an iterative process: - determining the generating method for the symbolic expression of general term _csx_ <sup>_ps_</sup> ; - generating all of the terms iteratively for _s_ = 0 _,_ 1 _,_ 2 _,_ - · · _, k_ . However, there are three issues to be settled: - specifying the formal variable _x_ for the polynomial since it may be _x_, _t_, _ρ_ or other possible symbol; - specifying the operator for representing the power since _x_ <sup>_r_</sup> could be implemented by x^r in L <sup>A</sup> TEX and MATLAB/Octave, or by x**r for Python, and so on; - specifying the special cases for the general term: - - if _ps_ = 1, then _csx_ <sup>1</sup> should be replaced by _csx_ ; - - if _ps_ = 0, then _csx_ <sup>0</sup> should be replaced by _cs_ ; - - if _cs_ _<_ 0, then the string + _csx_ <sup>_ps_</sup> should be replaced by −| _cs_ | _x_ <sup>_ps_</sup> ; - - if _cs_ = 0, then the term _csx_ <sup>_ps_</sup> should disappear and be ignored. For 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: - determining the symbol ‘‘+’’ or ‘‘−’’ for the _i_ -th term _cix_ <sup>_pi_</sup> according to the procedure GenSexprCatSign; - generating symbolic expressions for the term | _ci_ | _x_ <sup>_pi_</sup> without the sign of _ci_ via the procedure GenSexprUsgnGeneralTerm in Algorithm 7; - generating the symbolic expression for the general term _cix_ <sup>_pi_</sup> in the polynomial according to the procedure GenSexprGeneralTerm in Algorithm 8; - generating the polynomial _f_ ( _x_ ) = _cix_ <sup>_pi_</sup> with the Algorithm 7 Generate symbolic expression for the term | _<u>ci</u>_ | _<u>x</u>_ <sup>_pi_</sup> <u>without the sign of</u> _<u>c</u>_ Input : Argument _ci_ for the _i_ -th coefficient, argument _pi_ for the power index; Output : The string of characters for | _ci_ | _x_ <sup>_pi_</sup> ; 1: function GenSexprUsgnGeneralTerm(var, op, _ci_, _pi_ ) 2: ucoef ←| _ci_ |; 3: switch _pi_ do 4: case 1 5: if (ucoef̸ = 1) then 6: Fprintf(fp, _"%d%s"_,ucoef,var); 7: else 8: Fprintf(fp, _"%s"_,var); 9: end if 10: end case 11: case 0 12: Fprintf(fp, _"%d"_,ucoef); 13: end case 14: default 15: if (ucoef̸ = 1) then 16: Fprintf(fp, _"%d%s%s{%d}"_, ucoef, var, op, _pi_ ); 17: else 18: Fprintf(fp, _"%s%s{%d}"_, var, op, _pi_ ); 19: end if 20: end default 21: end switch 22: <u>end function</u> Algorithm 8 Generate the symbolic expression for the gen<u>eral term</u> _<u>cix</u>_ <sup>_pi_</sup> <u>in the polynomial</u> Input : Argument fp for text file, integer _i_, string argument var for _x_, string argument op, argument _ci_ for the _i_ -th coefficient, integer argument for _pi_ for the power index of single term Output : Symbolic expression of _cix_ <sup>_pi_</sup> stored in the text file accessed by fp. 1: function GenSexprGeneralTerm(fp, _i_, var, op, _ci_, _pi_ ) 2: GenSexprCatSign(fp, _ci_, _i_ ); 3: GenSexprUsgnGeneralTerm(fp, var, op, _ci_, _pi_ ); 4: <u>end function</u> polynomials R <sup>_m_</sup> _n_ <sup>(</sup> <sup>_ρ_</sup> <sup>) where the coefficients and power indices</sup> should be computed properly. The procedure GenSexprRadialPolynom in Algorithm 10 is designed for this purpose. 3) GENERATING SYMBOLIC EXPRESSIONS FOR ANGULAR FUNCTION The symbolic computation for the angular function _�m_ ( _θ_ ) is straight ford according to (14), please see the procedure GenSexprAnguFun in Algorithm 11. _i_ procedure GenSexprPolynom in Algorithm 9. It should be noted that if _ci_ = 0, the term _cix_ <sup>_pi_</sup> will be ignored for generating symbolic expression. Algorithm 6 Generate the symbol "+" or "−" for concatena<u>tion</u> Input : Argument fp for text file, Coefficient _ci_ and position label _i_ Output : The sign of _ci_ 1: function GenSexprCatSign(fp, _ci_, _i_ ) 2: if ( _ci_ _<_ 0) then 3: Fprintf(fp, "−"); 4: else // for _ci_ ≥ 0 5: if ( _i_ ̸ = 0) then 6: Fprintf(fp, "+"); 7: end if 8: end if 9: <u>end function</u> 2) GENERATING SYMBOLIC EXPRESSIONS FOR RADIAL ZERNIKE POLYNOMIALS Once the algorithm for generating a general polynomial is designed, we can use it to generate the Zernike radial Algorithm 9 Generate Symbolic Expression for a polynomial _f_ ( _x_ ) = _k_ _<u>s</u>_ =0 _csx_ <sup>_ps_</sup> 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 _,_ - · · _, ck_ ⟩, sequence of power indices p = ⟨ _p_ 0 _, p_ 1 _,_ - · · _, pk_ ⟩, 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: for _s_ ∈⟨0 _,_ 1 _,_ - · · _,_ size − 1⟩ do 3: if ( _cs_ = 0) then // if _cs_ is equal to 0 4: continue ; // just ignore the term _csx_ <sup>_ps_</sup> since it is zero, increase _s_ by 1 5: end if 6: GenSexprGeneralTerm(fp, _s_, var, op, _cs_, _ps_ ); 7: Fprintf(fp, _"_ _"_ ); // is is optional, print empty space for better visualization. 8: end for 9: <u>end function</u> Algorithm 10 Generating symbolic expression for the Zernike radial polynomial R <sup>_m_</sup> _<u>n</u>_ <sup>(</sup> <sup>_ρ_</sup> <sup>)</sup> Input : Argument fp for text file, double indices ⟨ _n, m_ ⟩, string var for _ρ_, string op for _"^"_ . Output : Print symbolic expression for the Zernike Radial _csρ_ <sup>_ps_</sup> . polynomial R <sup>_m_</sup> _n_ <sup>(</sup> <sup>_ρ_</sup> <sup>) =</sup> _k_ _s_ =0 1: function GenSexprRadialPolynom(fp, ⟨ _n, m_ ⟩, var, op) 2: size ← 1 + CvtNM2K(⟨ _n, m_ ⟩); // size = 1 + _k_ ; 3: ⟨c _,_ p⟩ ← CalcRadiPolynomPowerCoef(⟨ _n, m_ ⟩); // Algorithm 5 4: GenSexprPolynom(fp, var, op, c, p, size); // Algorithm 9 5: <u>end function</u> 4) GENERATING SYMBOLIC EXPRESSIONS FOR NORMALIZATION COEFFICIENT The symbolic computation of the normalization coefficient _Nn_ <sup>_m_</sup> <sup>can</sup> <sup>be</sup> <sup>based</sup> <sup>on</sup> <sup>(13)</sup> <sup>and</sup> <sup>a</sup> <sup>simple</sup> <sup>if-else</sup> <sup>statement</sup> <sup>is</sup> enough, please see the procedure GenSexprRadiNormCoef in Algorithm 12. 5) GENERATING NON-STANDARD (UNNORMALIZED) ZERNIKE CIRCULAR POLYNOMIAL For any single index _j_ ∈ Z <sup>+</sup> or the corresponding double indices ⟨ _n, m_ ⟩, the ZCP Z _j_ ( _ρ, θ_ ) = Z <sup>_m_</sup> _n_ <sup>(</sup> <sup>_ρ, θ_</sup> <sup>)</sup> = ble indices ⟨ _n, m_ ⟩, the ZCP Z _j_ ( _ρ, θ_ ) = Z <sup>_m_</sup> _n_ <sup>(</sup> <sup>_ρ, θ_</sup> <sup>)</sup> = _Nn_ <sup>_m_</sup> <sup>R</sup> <sup>_m_</sup> _n_ <sup>(</sup> <sup>_ρ_</sup> <sup>)</sup> <sup>_�m_</sup> <sup>(</sup> <sup>_θ_</sup> <sup>)</sup> <sup>consists</sup> <sup>of</sup> <sup>three</sup> <sup>parts:</sup> <sup>the</sup> <sup>normalization</sup> _n_ <sup>_m_</sup> <sup>R</sup> <sup>_m_</sup> _n_ _Nn_ <sup>_m_</sup> <sup>R</sup> <sup>_m_</sup> _n_ <sup>(</sup> <sup>_ρ_</sup> <sup>)</sup> <sup>_�m_</sup> <sup>(</sup> <sup>_θ_</sup> <sup>)</sup> <sup>consists</sup> <sup>of</sup> <sup>three</sup> <sup>parts:</sup> <sup>the</sup> <sup>normalization</sup> coefficient _Nn_ <sup>_m_</sup> <sup>determined</sup> <sup>by</sup> <sup>(13),</sup> <sup>the</sup> <sup>radial</sup> <sup>polynomial</sup> R <sup>_m_</sup> _n_ <sup>(</sup> <sup>_ρ_</sup> <sup>)</sup> <sup>specified</sup> <sup>by</sup> <sup>(15),</sup> <sup>and</sup> <sup>the</sup> <sup>angular</sup> <sup>function</sup> <sup>_�m_</sup> <sup>(</sup> <sup>_θ_</sup> <sup>)</sup> R <sup>_m_</sup> _n_ <sup>(</sup> <sup>_ρ_</sup> <sup>)</sup> <sup>specified</sup> <sup>by</sup> <sup>(15),</sup> <sup>and</sup> <sup>the</sup> <sup>angular</sup> <sup>function</sup> <sup>_�m_</sup> <sup>(</sup> <sup>_θ_</sup> <sup>)</sup> given by (14). The procedure GenSexprZernikePolynomNM Algorithm 11 Generate Symbolic Expression for Angular <u>Function</u> _<u>�m</u>_ <u>(</u> _<u>θ</u>_ <u>)</u> Input : Argument fp for text file, double indices ⟨ _n, m_ ⟩ Output : Symbolic expression for angular function _θm_ ( _θ_ ) 1: function GenSexprAnguFun(fp, ⟨ _n, m_ ⟩) 2: _j_ ← CvtNM2J(⟨ _n, m_ ⟩); 3: _m_ ←| _m_ |; 4: if ( _j_ ∈ Zeven) then 5: switch _m_ do 6: case 0 7: if ( _j_ = 0) then 8: Fprintf(fp, _"1"_ ); 9: end if 10: end case 11: case 1 12: Fprintf(fp, _"\\cos(\\theta)"_ ); // print cos( _θ_ ) 13: end case 14: default 15: Fprintf(fp, _"\\cos(%d\\theta)"_, _m_ ); // print cos( _mθ_ ) 16: end default 17: end switch 18: else 19: switch _m_ do 20: case 0 21: // do nothing 22: end case 23: case 1 24: Fprintf(fp, _"\\sin(\\theta)"_ ); // print sin( _θ_ ) 25: end case 26: default 27: Fprintf(fp, _"\\sin(%d\\theta)"_, _m_ ); // print sin( _mθ_ ) 28: end default 29: end switch 30: end if 31: <u>end function</u> in Algorithm 13 generates the un-normalized ZCP, which separates the normalization coefficient _Nn_ <sup>_m_</sup> <sup>clearly.</sup> _C._ _META-PROGRAMMING AND L_ <sup>_A_</sup> _TEX PROGRAMMING_ For the purpose of generating mathematical formula for ZCP, we can use meta-programming and L <sup>A</sup> TEX 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: - generating L <sup>A</sup> TEX 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); Algorithm 12 Generating symbolic expression for the normalization coefficient _Nn_ <sup>_m_</sup> Input : Argument fp for text file, double indices ⟨ _n, m_ ⟩ Output : Print the symbolic <u>expression</u> <u>normalization</u> of _n_ <sup>_m_</sup> <sup>=</sup> <sup>~~√~~</sup> <sup>2(</sup> <sup>_n_</sup> <sup>+ 1)</sup> <sup>_<u>/</u>_</sup> <sup>(1 +</sup> <sup>_<u>δ</u>_</sup> <sup>0</sup> <sup>_m_</sup> <sup>)</sup> coefficient _Nn_ <sup>_m_</sup> 1: function GenSexprRadiNormCoef(fp, ⟨ _n, m_ ⟩) 2: if _m_ = 0 then 3: ~~√~~ <u>Fprintf(fp,</u> _"\\sqrt{%d}"_, _n_ + 1); // print _n_ + 1 4: else 5: <u>Fprintf(fp,</u> _"\\sqrt{%d}"_, 2 ∗ ( _n_ + 1)); // print <sup>~~√~~</sup> 2( _n_ + 1) 6: end if 7: <u>end function</u> 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 <sup>A</sup> TEX code for the line of a table of <u>Zernike Circular Polynomials</u> Input : Argument fp for text file, single index _j_ ∈ N Output : L <sup>A</sup> TEX code for the _j_ -th line _d_ <sup>_j_</sup>, viz., _d_ <sup>_j_</sup> = [ _j, n, m, Nn_ <sup>_m_</sup> <sup>_m_</sup> _n_ <sup>(</sup> <sup>_ρ_</sup> <sup>)</sup> <sup>_�m_</sup> <sup>(</sup> <sup>_θ_</sup> <sup>)] ∈</sup> <sup>_T_</sup> <sup>Zernike</sup> _n_ <sup>_m,_</sup> <sup>R</sup> <sup>_m_</sup> _n_ Algorithm 13 Generate the L <sup>A</sup> TEX code for the non-standard (un-normalized) Zernike circular function _Z_ ˆ _j_ ( _ρ, θ_ ) = R <sup>_m_</sup> _<u>n</u>_ <sup>(</sup> <sup>_ρ_</sup> <sup>)</sup> <sup>_�m_</sup> <sup>(</sup> <sup>_θ_</sup> <sup>)</sup> R <sup>_m_</sup> _<u>n</u>_ <sup>(</sup> <sup>_ρ_</sup> <sup>)</sup> <sup>_�m_</sup> <sup>(</sup> <sup>_θ_</sup> <sup>)</sup> Input : Argument fp for text file, double indices ⟨ _n, m_ ⟩ Output : Symbolic expression for R <sup>_m_</sup> _n_ <sup>(</sup> <sup>_ρ_</sup> <sup>)</sup> <sup>_�m_</sup> <sup>(</sup> <sup>_θ_</sup> <sup>)</sup> <sup>denoted</sup> Output : Symbolic expression for R <sup>_m_</sup> _n_ <sup>(</sup> <sup>_ρ_</sup> <sup>)</sup> <sup>_�m_</sup> <sup>(</sup> <sup>_θ_</sup> <sup>)</sup> <sup>denoted</sup> <sup>by</sup> the grammar of L <sup>A</sup> TEX 1: function GenSexprZernikePolynomNM(fp, ⟨ _n, m_ ⟩) 2: size ← 1 + CvtNM2K(⟨ _n, m_ ⟩); 3: var ← _"\\rho"_ ; // for the symbol _ρ_ in L <sup>A</sup> TEX 4: op ← _"^"_ ; // for the power operator in L <sup>A</sup> TEX 5: if ( _m_ = 0 or size = 1) then 6: GenSexprRadiPolynom(fp, ⟨ _n, m_ ⟩, var, op); // print R <sup>_m_</sup> _n_ <sup>(</sup> <sup>_ρ_</sup> <sup>)</sup> 9: Fprintf(fp, _"$"_ ); 10: <u>end function</u> 2) GENERATE L <sup>A</sup> TEX CODE FOR LONG TABLE We can set the format of the long table based on the \ usepackage{longtable} in the preamble of the L <sup>A</sup> TEX source file. The procedure GenLaTeXLongTable in Algorithm 15 is used for automatically generating a long table which may span multiple pages. 3) GENERATE MAIN BODY OF L <sup>A</sup> TEX SOURCE FILE The main body of the L <sup>A</sup> TEX source file is a necessary part of the L <sup>A</sup> TEX source file, which has simple specification. The procedure GenLaTeXFileMainBody in Algorithm 16 is used for generating the main body of L <sup>A</sup> TEX 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 <sup>A</sup> TEX 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. 1: function GenLaTeXTableLine(fp, _j_ ) 2: ⟨ _n, m_ ⟩← CvtJ2NM( _j_ ); 3: Fprintf(fp, _" $%d$_ _&_ _$%d$_ _&_ _$%d$"_, _j_, _n_, _m_ ); // print the indices _j, n, m_ 4: Fprintf(fp, _"_ _&$"_ ); 5: GenSexprRadiNormCoef(fp, ⟨ _n, m_ ⟩); // print the normalization coefficient _Nn_ <sup>_m_</sup> 6: Fprintf(fp, _"$"_ ); 7: Fprintf(fp, _"_ _&$"_ ); 8: GenSexprNonStandardZern(fp, ⟨ _n, m_ ⟩); // print Zˆ _j_ ( _ρ, θ_ ) = R <sup>_m_</sup> _n_ <sup>(</sup> <sup>_ρ_</sup> <sup>)</sup> <sup>_�m_</sup> <sup>(</sup> <sup>_θ_</sup> <sup>)</sup> 2: size ← 1 + CvtNM2K(⟨ _n, m_ ⟩); 3: var ← _"\\rho"_ ; // for the symbol _ρ_ in L <sup>A</sup> TEX 4: op ← _"^"_ ; // for the power operator in L <sup>A</sup> TEX 5: if ( _m_ = 0 or size = 1) then 6: GenSexprRadiPolynom(fp, ⟨ _n, m_ ⟩, var, op); // print R <sup>_m_</sup> _n_ <sup>(</sup> <sup>_ρ_</sup> <sup>)</sup> 7: else 8: Fprintf(fp, _"("_ ); // print left bracket 9: GenSexprRadiPolynom(fp, ⟨ _n, m_ ⟩, var, op); 10: Fprintf(fp, _")"_ ); // print right braket 11: end if 12: GenSexprAnguFun(fp, ⟨ _n, m_ ⟩); // print _�m_ ( _θ_ ) 13: <u>end function</u> - compiling the L <sup>A</sup> TEX code to generate the symbolic expressions and output a file with the format *.dvi or *.pdf. In this work, we use the C programming language to generate the L <sup>A</sup> TEX 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. 1) GENERATING L <sup>A</sup> TEX CODE FOR A LINE OF A TABLE The procedure GenLaTeXTableLine is used to generate a line _d_ <sup>_i_</sup> of a long table _T_ = - _d_ <sup>_i_</sup> ∈ _S_ 1 × _S_ 2 × · · · × _Sn_ cols : _i_ begin ≤ _i_ ∈ _i_ end _._ However, 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 4) GENERATE L <sup>A</sup> TEX SOURCE FILE In the L <sup>A</sup> TEX 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 <sup>_m_</sup> _n_ <sup>and</sup> <sup>R</sup> <sup>_m_</sup> _n_ <sup>.</sup> <sup>The</sup> <sup>procedure</sup> <sup>SetLaTeX-</sup> DocPreamble in Algorithm 18 describes the details about setting the preamble. The key contents of L <sup>A</sup> TEX source file is the code in the L <sup>A</sup> TEX environment \begin{document} \ldots \end{document}, which includes the long table Algorithm 15 Generate L <sup>A</sup> TEX code for a long table with the data sheet of size _n_ rows × _n_ cols where _n_ rows = _i_ end − _i_ begin + 1. Input : Argument fp for L <sup>A</sup> TEX file, integer _i_ begin, integer _i_ end, variable tab for table information with the four members: - _n_ cols: number of attribute - attribname: list of attribute names - alignctrl: alignment information - caption: name of the table title Output : L <sup>A</sup> TEX code for the long table _T_ = - _d_ <sup>_α_</sup> ∈ _S_ 1 × _S_ 2 × · · · × _Sn_ cols : _i_ begin ≤ _α_ ≤ _i_ end 1: function GenLaTeXLongTable(fp, tab, _i_ begin, _i_ end) 2: SetLtabBeginCenter(fp); 3: SetLtabBeginLtable(fp, tab); 4: SetLtabCaption(fp, tab); 5: SetLtabHline(fp); 6: SetLtabTableHead(fp, tab); 7: SetLtabHline(fp); 8: SetLtabEndFirstHead(fp); 9: SetLtabCaptionContinue(fp, tab); 10: SetLtabHline(fp); 11: SetLtabTableHead(fp, tab); 12: SetLtabHline(fp); 13: SetLtabEndHead(fp); 14: SetLtabHline(fp); 15: SetLtabEndFoot(fp); 16: SetLtabHline(fp); 17: SetLtabEndLastFoot(fp); 18: for _i_ ∈⟨ _i_ begin _, i_ begin + 1 _,_ - · · _, i_ end⟩ do 19: GenLaTeXTableLine(fp, _i_ ); // depends on concrete problem 20: end for 21: SetLtabHline(fp); 22: SetLtabEndLtable(fp); 23: SetLtabEndCenter(fp); 24: <u>end function</u> Algorithm 16 Generate L <sup>A</sup> TEX code for the main body of the <u>L</u> <sup>A</sup> <u>TEX source file for generating a long table</u> Input : Argument fp for L <sup>A</sup> TEX file, integer _i_ begin, integer _i_ end Output : Main body of the L <sup>A</sup> TEX source file for generating a long table 1: function GenLaTeXFileMainBody(fp, tab, _i_ begin, _i_ end) 2: Fprintf(fp, _"\\begin{document}\n\n"_ ); 3: Fprintf(fp, _"\\maketitle\n\n"_ ); 4: Fprintf(fp, _"\n"_ ); 5: GenLaTeXLongTable(fp, tab, _i_ begin, _i_ end); 6: Fprintf(fp, _"\n"_ ); 7: Fprintf(fp, _"\\end{document}\n"_ ); 8: <u>end function</u> generated by the procedure GenLaTeXLtable in Algorithm 15. The procedure GenKeyContentsInTeXFile in <u>Algorithm 17</u> <u>Set the document class of the L</u> <sup>A</sup> <u>TEX source file</u> Input : Argument fp for L <sup>A</sup> TEX source file Output : Text line for the document class 1: function SetLaTeXDocCalss(fp) 2: Fprintf(fp, _"\\documentclass[11pt,_ _a4paper,nolineno]{article}\n\n"_ ); 3: <u>end function</u> <u>Algorithm 18</u> <u>Set the preamble of the L</u> <sup>A</sup> <u>TEX source file</u> Input : Argument fp for L <sup>A</sup> TEX source file, struct variable layout for the layout information which includes the following members: - orient: orientation, it could be portrait or landscape - left: distance for the left margin, say _"2.0cm"_ - right: distance for the right margin, say _"2.0cm"_ - top: distance for the top margin, say _"2.0cm"_ - bottom: distance for the bottom margin, say _"2.0_ _cm"_ Output : Text lines for the preamble of the L <sup>A</sup> TEX source file 1: function SetLaTeXDocPreamble(fp,layout) 2: //Import L <sup>A</sup> TEX packages required for mathematical formula, paper size and long table 3: Fprintf(fp, _"\\usepackage{amsmath,_ _amsfonts,amssymb}\n"_ ); 4: Fprintf(fp, _"\\usepackage[%s,left=%s,_ _right=%s,top=%s,bottom=%s]{geometry_ _}\n"_, layout.orient, layout.left, layout.right, layout.top, layout.bottom); 5: Fprintf(fp, _"\\usepackage{longtable}\n\_ _n"_ ); 6: //Set the macros for generating the symbolic expresstions for Zernike functions: 7: Fprintf(fp, _"\\DeclareMathOperator{\\_ _Zern}{Z}\n"_ ); 8: Fprintf(fp, _"\\DeclareMathOperator{\\_ _Radi}{R}\n"_ ); 9: Fprintf(fp, _"\\newcommand{\\Zernpoly_ _}[2]{\\Zern_{#1}^{#2}}\n"_ ); 10: Fprintf(fp, _"\\newcommand{\\Radipoly_ _}[2]{\\Radi_{#1}^{#2}}\n"_ ); 11: //Set the title and author for the pdf document to be generated 12: Fprintf(fp, _"\\title{Table_ _of_ _Zernike_ _Circular_ _Polynoms}\n"_ ); 13: Fprintf(fp, _"\\author{\ldots}\n"_ ); 14: <u>end function</u> Algorithm 19 shows the mechanicsm of generating the very L <sup>A</sup> TEX code of interest. The ultimate goal of automatically generating mathematical formula of ZCP is to create a L <sup>A</sup> TEX source file which consists of the following steps: Algorithm 19 Generate the key contents, i.e. the L <sup>A</sup> TEX long <u>table, for the L</u> <sup>A</sup> <u>TEX source file</u> Input : Argument fp for L <sup>A</sup> TEXsource file, struct vari able tab with four members (viz. _n_ cols, atribname, alignctrl and caption), integer _i_ begin, and integer _i_ end Output : The complete L <sup>A</sup> TEX code for creating long table 1: function GenKeyContentsInTeXFile(fp, tab, _i_ begin, _i_ end) 2: Fprintf(fp, _"\\begin{document}\n\n"_ ); 3: Fprintf(fp, _"\\maketitle\n\n"_ ); 4: Fprintf(fp, _"\n"_ ); 5: GenLaTeXLtable(fp, tab, _i_ begin, _i_ end); 6: Fprintf(fp, _"\n"_ ); 7: Fprintf(fp, _"\\end{document}\n"_ ); 8: <u>end function</u> - creating an empty L <sup>A</sup> TEX *.tex file with the operation mode ‘‘write’’; - setting the document class; - setting the preamble; - generating the key contents in of the L <sup>A</sup> TEX file, and - closing the *.tex properly. The procedure GenLaTeXFile in Algorithm 20 demonstrates the above steps clearly. string "xelatex filename.tex" or "pdflatex filename.tex". V. CONCLUSION For the ZCP Z _j_ ( _ρ, θ_ ) = _Nn_ <sup>_m_</sup> _n_ <sup>_m_</sup> <sup>R</sup> <sup>_m_</sup> _n_ For the ZCP Z _j_ ( _ρ, θ_ ) = _Nn_ <sup>_m_</sup> <sup>R</sup> <sup>_m_</sup> _n_ <sup>(</sup> <sup>_ρ_</sup> <sup>)</sup> <sup>_�m_</sup> <sup>(</sup> <sup>_θ_</sup> <sup>),</sup> <sup>our</sup> <sup>new</sup> <sup>theo-</sup> rems 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 inter-conversion 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 <sup>A</sup> TEX 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. As 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. As a useful reference, the mathematical expressions for �Z _j_ ( _ρ, θ_ ) : 1 ≤ _j_ ≤ 465� are provided on the GitHub site, Algorithm 20 Generate L <sup>A</sup> TEX source file *.tex for producing the long table of Zernike circular polynomials, viz. _T_ Zernike = - _d_ <sup>_j_</sup> = [ _j, m, n, Nn_ <sup>_m,_</sup> <sup>R</sup> <sup>_m_</sup> _<u>n</u>_ <sup>(</sup> <sup>_ρ_</sup> <sup>)</sup> <sup>_�m_</sup> <sup>(</sup> <sup>_θ_</sup> <sup>)] :</sup> <sup>_j_</sup> <sup>min</sup> <sup>≤</sup> <sup>_j_</sup> <sup>≤</sup> <sup>_j_</sup> <sup>max</sup> Input : String filename with the suffix .tex for L <sup>A</sup> TEX 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 <sup>A</sup> TEX source file with the name filename 1: function GenLaTeXFile(filename, tab, _j_ min, _j_ max) 2: fp ← Fopen(filename, _"w"_ ); // Create the L <sup>A</sup> TEX source file with the suffix *.tex 3: SetDocumentCalss(fp); 4: SetDocumentPreamble(fp); 5: GenKeyContentsInTeXFile(fp, tab, _j_ min, _j_ max); 6: Fclose(fp); // Close the L <sup>A</sup> TEX source file 7: <u>end function</u> 5) L <sup>A</sup> TEX COMPILING Generally, the L <sup>A</sup> TEX 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 <sup>A</sup> TEX compiling with the type const char *. Typical implementations for command_expr could be the The 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. In the sense of project-driven science-tchnologyengineering-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 The 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 <sup>A</sup> TEX 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. _<u>n</u>_ <sup>_m,_</sup> <sup>R</sup> <sup>_m_</sup> _<u>n</u>_ <sup>_m_</sup> _<u>n</u>_ <sup>(</sup> <sup>_ρ_</sup> <sup>)</sup> <sup>_�m_</sup> <sup>(</sup> <sup>_θ_</sup> <sup>)] :</sup> <sup>_j_</sup> <sup>min</sup> <sup>≤</sup> <sup>_j_</sup> <sup>≤</sup> <sup>_j_</sup> <sup>max</sup> REFERENCES [1] M. Born and E. Wolf, _Principles_ _of_ _Optics_, 7th ed. London, U.K.: Cambridge Univ. Press, 1999. [2] V. N. Mahajan, ‘‘Zernike annular polynomials for imaging systems with annular pupils,’’ _J. Opt. Soc. Amer._, vol. 71, no. 1, pp. 75–85, Jan. 1981. [3] A. J. E. M. Janssen, ‘‘Zernike circle polynomials and infinite integrals involving the product of Bessel functions,’’ 2010, _arXiv:1007.0667_ . [4] B. H. Shakibaei and R. Paramesran, ‘‘Recursive formula to compute Zernike radial polynomials,’’ _Opt._ _Lett._, vol. 38, no. 14, pp. 2487–2489, Jul. 2013. [5] J. A. Díaz and N. Virendra Mahajan, ‘‘Orthonormal aberration polynomials for optical systems with circular and annular sector pupils,’’ _Appl._ _Opt._, vol. 52, no. 6, pp. 1136–1147, Feb. 2013. [6] R. J. Mathar, ‘‘Zernike basis to Cartesian transformations,’’ 2008, _arXiv:0809.2368_ . [7] J. Bühren, _Zernike_ _Coefficients_ . Berlin, Germany: Springer, 2018, pp. 1945–1946. [8] C. G. Berger. _Zernike_ _Aberrations_ . Accessed: Aug. 18, 2022. [Online]. Available: https://opticsthewebsite.com/Zernike [9] D. Malacara, _Optical_ _Shop_ _Testing_, 3rd ed. New York, NY, USA: Wiley, 2007. [10] ZEMAX Development Corporation. (2008). _EMAX: Optical Design Pro-_ _gram User’s Guide_ . [Online]. Available: www.zemax.com [11] R. J. Noll, ‘‘Zernike polynomials and atmospheric turbulence,’’ _J. Opt. Soc._ _Amer._, vol. 66, no. 3, pp. 207–211, 1976. [12] C.-W. Chong, P. Raveendran, and R. Mukundan, ‘‘A comparative analysis of algorithms for fast computation of Zernike moments,’’ _Pattern Recog-_ _nit._, vol. 36, no. 3, pp. 731–742, Mar. 2003. [13] E. C. Kintner, ‘‘On the mathematical properties of the Zernike polynomi als,’’ _Optica Acta, Int. J. Opt._, vol. 23, no. 8, pp. 679–680, Aug. 1976. [14] H.-Y. Zhang, Y. Zhou, and Z.-Q. Feng, ‘‘Balanced binary tree schemes for computing Zernike radial polynomials,’’ 2022, _arXiv:2212.02495_ . [15] E. D. Knuth, _The Art of Computer Programming, volume 1: Fundamental_ _Algorithms_, 3rd ed. New York, NY, USA: Addison-Wesley, 1997. [16] R. Graham, E. D. Knuth, and O. Patashnik, _Concrete_ _Mathematics:_ _A_ _Foundation for Computer Science_, 2nd ed. New York, NY, USA: AddisonWesley Professional, 1994. [17] S.-J. Zhang and J.-M. Jin, _Computation of Special Functions_ . New York, NY, USA: Wiley-Interscience, 1996. [18] J. C. Wyant. _Zernike_ _Polynomials_ . Accessed: Aug. 10, 2022. [Online]. Available: http://wyant.optics.arizona.edu/zernikes/zernikes.htm [19] N. V. Mahajan, _Optical_ _Imaging_ _and_ _Aberrations,_ _Part_ _III:_ _Wavefront_ _Analysis_ . Washington, DC, USA: SPIE, 2013. HONG-YAN ZHANG received the B.S. and M.S. degrees in applied physics and telecommunication engineering from Xidian University, China, in 2000 and 2003, respectively, and the Ph.D. degree from the Institute of Automation, Chinese Academy of Sciences, in 2011. Currently, he is with the School of Information Science and Technology, Hainan Normal University, China. His research interests include computer vision, data analysis, STEM education, and mathematics for engineering. YU ZHOU (Member, IEEE) received the Ph.D. degree in electronic engineering from The University of Newcastle, Newcastle upon Tyne, in 2008. Currently, he is a Research Associate in electronic engineering with Hainan Normal University, China. His research interests include algorithms analysis and design, circuit design, logic synthesis and CAD tools for asynchronous circuits and systems, and STEM education. FU-YUN LI received the B.S. degree in computer science from Hunan University, in 1997, and the M.S. degree in telecommunication engineering from Hainan University, in 2009. She is currently an Associate Professor in computer science. Currently, she is with the School of Information Science and Technology, Hainan Normal University, China. Her research interests include applications of computer, engineering education, and speech signals processing.

섹션 본문 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건

  1. Zernike circle polynomials and infinite integrals involving the product of Bessel functions arXiv (Cornell University) · Cornell University · 2010 10.48550/arxiv.1007.0667
  2. Optical Shop Testing 2006 10.1002/9780470135976
  3. The Art of Computer Programming. Volume 1: Fundamental Algorithms. Journal of the American Statistical Association · 1969 10.2307/2283757
  4. Concrete Mathematics: A Foundation for Computer Science Computers in Physics · American Institute of Physics · 1989 10.1063/1.4822863
  5. Zernike basis to cartesian transformations Serbian Astronomical Journal · Astronomical Observatory, Department of Astronomy, Belgrade · 2009 10.2298/saj0979107m
  6. Zernike polynomials and atmospheric turbulence* Journal of the Optical Society of America · Optica Publishing Group · 1976 10.1364/josa.66.000207
  7. 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
  8. A comparative analysis of algorithms for fast computation of Zernike moments Pattern Recognition · Elsevier BV · 2002 10.1016/s0031-3203(02)00091-2
  9. On the Mathematical Properties of the Zernike Polynomials Optica Acta International Journal of Optics · Taylor & Francis · 1976 10.1080/713819334
  10. Orthonormal aberration polynomials for optical systems with circular and annular sector pupils Applied Optics · Optica Publishing Group · 2013 10.1364/ao.52.001136
  11. Recursive formula to compute Zernike radial polynomials Optics Letters · Optica Publishing Group · 2013 10.1364/ol.38.002487
  12. Optical Imaging and Aberrations, Part III: Wavefront Analysis SPIE eBooks · SPIE · 2013 10.1117/3.927341
  13. Computation of special functions Computers & Mathematics with Applications · Elsevier BV · 1996 10.1016/s0898-1221(96)90020-6
  14. Principles of Optics 1999 10.1017/cbo9781139644181
  15. Balanced Binary Tree Schemes for Computing Zernike Radial Polynomials arXiv (Cornell University) · Cornell University · 2022 10.48550/arxiv.2212.02495