#============================================================================== # Calculate the Zernike series coefficients A[n,m] and B[n,m] of # an expression. # # The expression must be in cylindrical coordinates (rho,phi), where # rho has been normalized to lie in the range [0..1]. # # See zseries.ms for documentation. # # Returns a structure [A,B]. #============================================================================== #============================================================================= # # Marc A. Murison # Astronomical Applications Dept. # U.S. Naval Observatory # 3450 Massachusetts Ave., NW # Washignton, DC 20392 # murison@riemann.usno.navy.mil # http://riemann.usno.navy.mil/AESOP/ # #============================================================================= if ZERNCOEF_READ <> 1 then ZERNCOEF_READ := 1: read`d:/optics/AESOP/zernike.p`: ZSeriesCoeff := proc( n::nonnegint, m::nonnegint, expr::algebraic ) local Irho, Iphi, coeffs: #A[n,m] Iphi := int( ZernikeCos(n,m,rho,phi)*expr, phi=0..2*Pi ): Irho := int( Iphi*rho, rho=0..1 ): if m=0 then coeffs['A'] := (n+1)/Pi*Irho: else coeffs['A'] := 2*(n+1)/Pi*Irho: fi: #B[n,m] if m <> 0 then Iphi := int( ZernikeSin(n,m,rho,phi)*expr, phi=0..2*Pi ): Irho := int( Iphi*rho, rho=0..1 ): coeffs['B'] := 2*(n+1)/Pi*Irho: else coeffs['B'] := 0: fi: gc(): RETURN( op(coeffs) ): end: #============================================================================= # user help #============================================================================= #`help/text/ZSeriesCoeff` := TEXT( #``, #` ZSeriesCoeff( n:nonnegint, m:nonnegint, expr:algebraic )`, #``, #` Calculate the Zernike series coefficients A[n,m] and B[n,m] of `, #` an expression. The expression must be in cylindrical coordinates `, #` (rho,phi), where rho has been normalized to lie in the range [0..1].`, #``, #` See zseries.ms for documentation.`, #``, #` Returns a structure [A,B].`, #``, #` See also: zernike, ZernikeSeries` #): fi;