Zernike Polynomials

Greg A. Smith

Zernike polynomials are a common tool for describing optical wavefronts and aberrations. Use the calculator below to explore the shapes of Zernike polynomials and see how they add together.

Cannot display interactive Zernike selector.
select Zernike terms to add together
constant
1st degree radial
2nd degree radial
3rd degree radial
4th degree radial
5th degree radial
6th degree radial
7th degree radial
constant
1st degree radial
2nd degree radial
3rd degree radial
4th degree radial
5th degree radial
6th degree radial
7th degree radial
constant
1st degree radial
2nd degree radial
3rd degree radial
4th degree radial
5th degree radial
6th degree radial
7th degree radial
constant
1st degree radial
2nd degree radial
3rd degree radial
4th degree radial
5th degree radial
6th degree radial
7th degree radial

Practical Considerations

A few optical aberrations such as astigmatism and spherical have been known since the 1800s, but in 1934 Frits Zernike created mathematical functions to describe any aberration in a circular region.[1,2] Many optical systems, such as camera lenses, have circular symmetry and the Zernike polynomials are a powerful tool in optical design.

Numbering Scheme

Ordering of Zernike terms is not unique or consistent in the literature. This page uses a convention specified by Robert Noll in 1975.[3] This ordering groups the terms by the exponent in the radial component, and within each group, elements are ordered by the factor associated with the azimuthal component. If an equation has a sine or cosine, then an even numbered index is a cosine term and an odd numbered index is a sine term.

It is common to specify Zernike polynomials by their ordering number (Z1, Z2, Z3, … ) which makes it important to understand which convention is used. Other choices include Fringe ordering and ANSI Z80.28 standard[4] for reporting optical aberrations of eyes.

Orthogonal basis

Zernike polynomials are known to be an orthogonal basis over a circular region. To understand the properties and limitations of Zernike polynomials, consider the meaning of this description.

orthogonal
This means if two different terms are multiplied together and integrated over the circular region, the result will be zero.
basis
This means any 2D function in a circular region can be described as a weighted combination of Zernike polynomials.

To demonstrate these features, consider the image below of the University of Arizona logo. Zernike polynomials form a basis set, and this image is created from a weighted sum of Zernike polynomials. Change the slider to observe how the number of terms in the sum changes the quality of the approximation.

Zernike fitting to logo for University of Arizona
number of terms:
piston term (Z1) = 0.2689

The orthogonal property of Zernike polynomials means each function is independent of others. This implies the weighting value for each term should never change when more terms are added or removed.

Unfortunately the image above is not the perfect circle required for Zernike polynomials. Instead, the image is approximated with a radius of 150 pixels. The consequence of this approximation is the orthogonality property is broken and therefore the weighting factors change when the number of terms changes. Zernike polynomials are ideal analytic functions, but numerical analysis requires approximations.

Calculation Accuracy

Many references, such as equation 2 in the work by Noll[3], define the radial components of the Zernike polynomials with a function that contains factorials. If directly implemented in a computer, these factorials can quickly exceed the limits of machine precision. Although the final number may be small, the individual factorial calculations will be large and catastrophic cancellation will occur.

Many publications exist for fast Zernike calculations that do not rely on factorial functions.[5] For best computer accuracy of high order Zernike polynomials, careful attention is needed to numerical accuracy.

Zernike Equations

Analytical equations for the first 37 Zernike polynomials are provided below using polar coordinates ρ and θ with 0 ≤ ρ ≤ 1. Following the convention of Noll[3], each term is normalized so the root-mean-square (rms) of the data within the circular region is equal to 1.

Z1 = 1
Z2 = 2 ρ cos(θ)
Z3 = 2 ρ sin(θ)
Z4 = √3 (2 ρ2 - 1)
Z5 = √6 ρ2 sin(2θ)
Z6 = √6 ρ2 cos(2θ)
Z7 = √8 (3 ρ3 - 2 ρ) sin(θ)
Z8 = √8 (3 ρ3 - 2 ρ) cos(θ)
Z9 = √8 ρ3 sin(3θ)
Z10 = √8 ρ3 cos(3θ)
Z11 = √5 (6 ρ4 - 6 ρ2 + 1)
Z12 = √10 (4 ρ4 - 3 ρ2) cos(2θ)
Z13 = √10 (4 ρ4 - 3 ρ2) sin(2θ)
Z14 = √10 ρ4 cos(4θ)
Z15 = √10 ρ4 sin(4θ)
Z16 = √12 (10 ρ5 - 12 ρ3 + 3 ρ) cos(θ)
Z17 = √12 (10 ρ5 - 12 ρ3 + 3 ρ) sin(θ)
Z18 = √12 (5 ρ5 - 4 ρ3) cos(3θ)
Z19 = √12 (5 ρ5 - 4 ρ3) sin(3θ)
Z20 = √12 ρ5 cos(5θ)
Z21 = √12 ρ5 sin(5θ)
Z22 = √7 (20 ρ6 - 30 ρ4 + 12 ρ2 - 1)
Z23 = √14 (15 ρ6 - 20 ρ4 + 6 ρ2) sin(2θ)
Z24 = √14 (15 ρ6 - 20 ρ4 + 6 ρ2) cos(2θ)
Z25 = √14 (6 ρ6 - 5 ρ4) sin(4θ)
Z26 = √14 (6 ρ6 - 5 ρ4) cos(4θ)
Z27 = √14 ρ6 sin(6θ)
Z28 = √14 ρ6 cos(6θ)
Z29 = 4 (35 ρ7 - 60 ρ5 + 30 ρ3 - 4 ρ) sin(θ)
Z30 = 4 (35 ρ7 - 60 ρ5 + 30 ρ3 - 4 ρ) cos(θ)
Z31 = 4 (21 ρ7 - 30 ρ5 + 10 ρ3) sin(3θ)
Z32 = 4 (21 ρ7 - 30 ρ5 + 10 ρ3) cos(3θ)
Z33 = 4 (7 ρ7 - 6 ρ5) sin(5θ)
Z34 = 4 (7 ρ7 - 6 ρ5) cos(5θ)
Z35 = 4 ρ7 sin(7θ)
Z36 = 4 ρ7 cos(7θ)
Z37 = √9 (70 ρ8 - 140 ρ6 + 90 ρ4 - 20 ρ2 + 1)

References

  1. F. Zernike, "Diffraction Theory of the Knife-Edge Test and its Improved Form, The Phase-Contrast Method", Monthly Notices of the Royal Astronomical Society, vol.94, March 1934, pp.377-384. https://doi.org/10.1093/mnras/94.5.377
  2. F. Zernike, "Beugungstheorie des schneidenver-fahrens und seiner verbesserten form, der phasenkontrastmethode", Physica, vol.1, May 1934, pp. 689-704. https://doi.org/10.1016/S0031-8914(34)80259-5
  3. R. Noll, "Zernike polynomials and atmospheric turbulence", Journal of the Optical Society of America, vol. 66, 1976, pp.207-211. https://doi.org/10.1364/JOSA.66.000207
  4. ANSI standard Z80.28 Ophthalmics - Methods For Reporting Optical Aberrations Of Eyes. https://webstore.ansi.org/Standards/VC(ASCZ80)/ANSIZ80282022.
  5. Several methods exist for fast and accurate Zernike calculations. For example, see T. B. Andersen, "Efficient and robust recurrence relations for the Zernike circle polynomials and their derivatives in Cartesian coordinates", Optics Express, 26, 2018, pp.18878-18896. https://doi.org/10.1364/OE.26.018878