Legendre and Associated Legendre Polynomials
Let $n,m$ be non-negative integers with $m\leqslant n$ and $x$ a real number with $-1\leqslant x\leqslant 1$, this application evaluates the Legendre polynomial of the first kind \[ P_n(x) = \frac{1}{2^n n!}\frac{d^n}{dx^n}(x^2-1)^n, \] its derivative $P'_n(x)$, the associated Legendre polynomial \[ P_n^m(x) = (-1)^m(1-x^2)^\frac{m}{2}\frac{d^m}{dx^m}P_n(x), \] and non-negative zeros of $P_n(x)$. If $x\neq\pm 1$ it also evaluates the Legendre polynomial of the second kind \[ Q_n(x) =\left\{ \begin{array}{ll} \frac{1}{2}\log\frac{1+x}{1-x} & n=0 \\ P_1(x)Q_0(x)-1 & n=1 \\ \frac{2n-1}{n}xQ_{n-1}(x)-\frac{n-1}{n}Q_{n-2}(x) & n\geqslant 2. \end{array} \right. \] Note that $Q_n(x)$ is singular at $x=\pm 1.$