function schmit(n,m,theta) c c Returns Schmidt normalized associated Legendre polynomial. c Requires function fac. Modified from Press, W.H., Flannery, c B.P., Teukolsky, S.A., and Vetterling, W.T., "Numerical c Recipes, The Art of Scientific Computing," Cambridge Univ. c Press, 1986. c c Input parameters: c Argument of polynomial is theta, in degrees. Degree and c order of polynomial are n and m, respectively. Parameter n c must be greater than zero, and m must be greater than or c equal to n. c data d2rad/.017453293/ x=cos(theta*d2rad) if(m.lt.0.or.m.gt.n)pause ' SCHMIT: Bad argument detected' pmm=1. if(m.gt.0)then somx2=sqrt((1.-x)*(1.+x)) fact=1. do 10 i=1,m pmm=-pmm*fact*somx2 fact=fact+2. 10 continue end if if(n.eq.m)then schmit=pmm else pmmp1=x*(2*m+1)*pmm if(n.eq.m+1)then schmit=pmmp1 else do 11 nn=m+2,n pnn=(x*(2*nn-1)*pmmp1-(nn+m-1)*pmm)/(nn-m) pmm=pmmp1 pmmp1=pnn 11 continue schmit=pnn end if end if if(m.ne.0)then xnorm=sqrt(2*fac(n-m)/fac(n+m)) schmit=xnorm*schmit end if return end