Associate Legendre Function  

               Press[1] gives a short stable code for calculating these.  He also gives a warning that "most of the recurrences involving m are unstable, and so dangerous for numerical work.  The stable recurrence is on

           

This is useful because

 

The double factorial is defined by n!! is the product of all odd integers less than or equal to n.

Using with and setting , we find

 

Thus and provide a starting point for .

                The actual code is very short.

 



[1] W. H. Press, et al, Numerical Recipes, Cambridge University Press (1986)  section 6.6 Spherical Harmonics, p 182