26 Numerics library [numerics]

26.9 Mathematical functions for floating-point types [c.math]

26.9.5 Mathematical special functions [sf.cmath]

26.9.5.20 Spherical associated Legendre functions [sf.cmath.sph_legendre]

double sph_legendre(unsigned l, unsigned m, double theta); float sph_legendref(unsigned l, unsigned m, float theta); long double sph_legendrel(unsigned l, unsigned m, long double theta);

Effects: These functions compute the spherical associated Legendre functions of their respective arguments l, m, and theta (theta measured in radians).

Returns: Ym(θ, 0) where \[%
  \mathsf{Y}_\ell^m(\theta, \phi) =
  (-1)^m \left[ \frac{(2 \ell + 1)}
                     {4 \pi}
	        \frac{(\ell - m)!}
	             {(\ell + m)!}
         \right]^{1/2}
	 \mathsf{P}_\ell^m
	 ( \cos\theta ) e ^ {i m \phi},
	   \quad \mbox{for $|m| \le \ell$}
\] and l is l, m is m, and theta is theta.

Remarks: The effect of calling each of these functions is implementation-defined if l >= 128.