Function to compute the associated Legendre function of x with order l & m ref) Numerical Recipes in Fortran, pp 246-248