Function Repository Resource:

PseudoZernikeR

Source Notebook

Evaluate the radial pseudo-Zernike polynomial

Contributed by: Jan Mangaldan

ResourceFunction["PseudoZernikeR"][n,m,r]

gives the radial pseudo-Zernike polynomial .

Details

Mathematical function, suitable for both symbolic and numerical manipulation.
Explicit polynomials are given when possible.
ResourceFunction["PseudoZernikeR"] can be evaluated to arbitrary numerical precision.
ResourceFunction["PseudoZernikeR"] automatically threads over lists.

Examples

Basic Examples (3) 

Evaluate numerically:

In[1]:=
ResourceFunction["PseudoZernikeR"][3, 1, 0.5]
Out[1]=

Evaluate symbolically:

In[2]:=
ResourceFunction["PseudoZernikeR"][5, 3, r]
Out[2]=

Plot over a subset of the reals:

In[3]:=
Plot[ResourceFunction["PseudoZernikeR"][7, 1, r], {r, 0, 1}]
Out[3]=

Scope (3) 

Evaluate to high precision:

In[4]:=
N[ResourceFunction["PseudoZernikeR"][5, 1, 1/3], 50]
Out[4]=

The precision of the output tracks the precision of the input:

In[5]:=
ResourceFunction[
 "PseudoZernikeR"][5, 1, 0.33333333333333333333333333333]
Out[5]=

Simple exact values are generated automatically:

In[6]:=
ResourceFunction["PseudoZernikeR"][7, 1, 1]
Out[6]=

PseudoZernikeR threads elementwise over lists:

In[7]:=
ResourceFunction["PseudoZernikeR"][4, {1, 2, 3}, r]
Out[7]=

Properties and Relations (4) 

Obtain the pseudo-Zernike polynomials from their generating function:

In[8]:=
m = 3; Series[(
 2^(2 m + 1) r^m)/((1 + t + Sqrt[1 + 2 (1 - 2 r) t + t^2])^(2 m + 1)
   Sqrt[1 + 2 (1 - 2 r) t + t^2]), {t, 0, 5}]
Out[8]=
In[9]:=
CoefficientList[%, t]
Out[9]=

Compare with the directly computed sequence:

In[10]:=
Table[ResourceFunction["PseudoZernikeR"][m + n, m, r], {n, 0, 5}] == % // Simplify
Out[10]=

Verify an expression for the pseudo-Zernike polynomial in terms of the Jacobi polynomial JacobiP:

In[11]:=
Table[ResourceFunction["PseudoZernikeR"][n, m, r] == r^m (-1)^(n - m) JacobiP[n - m, 2 m + 1, 0, 1 - 2 r] // Simplify, {n, 0, 5}, {m, 0, n}]
Out[11]=

Verify a recurrence relation for the pseudo-Zernike polynomials:

In[12]:=
Table[ResourceFunction["PseudoZernikeR"][n + 1, m, r] == (
    2 n + 3)/((n + m + 2) (n - m + 1)) ((2 (n + 1) r - (n + m + 1)^2/(2 n + 1) - (n - m + 1)^2/(
         2 n + 3)) ResourceFunction["PseudoZernikeR"][n, m, r] - ((n + m + 1) (n - m))/(2 n + 1)
        ResourceFunction["PseudoZernikeR"][n - 1, m, r]) // Simplify, {n, 5}, {m, 0, n - 1}]
Out[12]=

Verify the orthogonality relation for the pseudo-Zernike polynomials:

In[13]:=
MatrixForm /@ Table[2 (n1 + 1) Integrate[
    r ResourceFunction["PseudoZernikeR"][n1, m, r] ResourceFunction[
      "PseudoZernikeR"][n2, m, r], {r, 0, 1}], {m, 0, 3}, {n1, m, m + 3}, {n2, m, m + 3}]
Out[13]=

Neat Examples (1) 

Visualize pseudo-Zernike polynomials over the unit disk:

In[14]:=
Table[DensityPlot[
   ResourceFunction["PseudoZernikeR"][n, m, Norm[{x, y}]] Cos[
     m ArcTan[x, y]], {x, y} \[Element] Disk[], ColorFunction -> (ColorData[{"ThermometerColors", "Reverse"}, LogisticSigmoid[2 #]] &), ColorFunctionScaling -> False, Exclusions -> None, Frame -> False, PlotPoints -> 55], {n, 0, 4}, {m, 0, n}] // GraphicsGrid
Out[14]=

Version History

  • 1.0.0 – 06 February 2023

Source Metadata

Related Resources

License Information