Instructions
Select an order for the Zernike polynomial of interest. The order is represented by two integers, n and m, where m can only be as large as n. The choice is entirely up to you, although values of n and m higher than about 4 are only important in very special situations.
As an example, you could start with: n=3, m=1.
Calculate the normalization coefficient, N(n,m). The normalization coefficient is given by
sqrt (2(n+1) / (1 + delta(m,0)); where delta(m,0) is 1 when m=0, and zero everywhere else.
For the example: N(3,1) = sqrt (2(3+1) / (1 + 0)) = sqrt (8).
Calculate the radial portion of the Zernike polynomial. The radial portion is given by
R(n,m,rho) = Sum (from s=0 to s=(n-m)/2) of {[(-1)^s x (n-s)! / (s! ((n+m)/2 - s)! ((n-m)/2 - s)!)] x rho^(n-2s)}.
For the example, this becomes:
Sum (from s = 0 to s = 1) of
{[(-1)^s x (n-s)! / (s! ((n+m)/2 - s)! ((n-m)/2 - s)!)] x rho^(n-2s)}
which equals
{[3!/((2! 1!)] x rho^3 + [(-1)(2!)/1!] x rho}
which equals
(3rho^3 - 2rho).
Calculate the angular portion of the Zernike polynomial. This is given by cos(m x theta).
For the example, this is simply cos(theta).
Multiply all the separate portions of the polynomial together. This is N(n,m) x R(n,m,rho) x cos(m x theta).
For the example: N(3,1) x R(3,1,rho) x cos(theta) = sqrt(8) x (3rho^3 - 2rho) x cos(theta). This example happens to correspond to an optical aberration called coma.