Go to the first, previous, next, last section, table of contents.

Associated Legendre Polynomials and Spherical Harmonics

The following functions compute the associated Legendre Polynomials @math{P_l^m(x)}. Note that this function grows combinatorially with @math{l} and can overflow for @math{l} larger than about 150. There is no trouble for small @math{m}, but overflow occurs when @math{m} and @math{l} are both large. Rather than allow overflows, these functions refuse to calculate @math{P_l^m(x)} and return GSL_EOVRFLW when they can sense that @math{l} and @math{m} are too big.

If you want to calculate a spherical harmonic, then do not use these functions. Instead use gsl_sf_legendre_sphPlm() below, which uses a similar recursion, but with the normalized functions.

Function: double gsl_sf_legendre_Plm (int l, int m, double x)
Function: int gsl_sf_legendre_Plm_e (int l, int m, double x, gsl_sf_result * result)
These routines compute the associated Legendre polynomial @math{P_l^m(x)} for @c{$m \ge 0$} @math{m >= 0}, @c{$l \ge m$} @math{l >= m}, @c{$|x| \le 1$} @math{|x| <= 1}.

Function: int gsl_sf_legendre_Plm_array (int lmax, int m, double x, double result_array[])
This function computes an array of Legendre polynomials @math{P_l^m(x)} for @c{$m \ge 0$} @math{m >= 0}, @c{$l = |m|, \dots, lmax$} @math{l = |m|, ..., lmax}, @c{$|x| \le 1$} @math{|x| <= 1}.

Function: double gsl_sf_legendre_sphPlm (int l, int m, double x)
Function: int gsl_sf_legendre_sphPlm_e (int l, int m, double x, gsl_sf_result * result)
These routines compute the normalized associated Legendre polynomial @math{$\sqrt{(2l+1)/(4\pi)} \sqrt{(l-m)!/(l+m)!} P_l^m(x)$} suitable for use in spherical harmonics. The parameters must satisfy @c{$m \ge 0$} @math{m >= 0}, @c{$l \ge m$} @math{l >= m}, @c{$|x| \le 1$} @math{|x| <= 1}. Theses routines avoid the overflows that occur for the standard normalization of @math{P_l^m(x)}.

Function: int gsl_sf_legendre_sphPlm_array (int lmax, int m, double x, double result_array[])
This function computes an array of normalized associated Legendre functions @math{$\sqrt{(2l+1)/(4\pi)} \sqrt{(l-m)!/(l+m)!} P_l^m(x)$} for @c{$m \ge 0$} @math{m >= 0}, @c{$l = |m|, \dots, lmax$} @math{l = |m|, ..., lmax}, @c{$|x| \le 1$} @math{|x| <= 1.0}

Function: int gsl_sf_legendre_array_size (const int lmax, const int m)
This functions returns the size of result_array[] needed for the array versions of @math{P_l^m(x)}, lmax - m + 1.


Go to the first, previous, next, last section, table of contents.