I'm trying to look at the Associated Legendre Polynomial, so I plugged it into Mathematica to see the values for different input.
From wikipedia:
$$ p_l(x)=\frac{1}{2^l l!}\frac{\partial ^l}{\partial x^l}\left(x^2-1\right)^l $$
$$ p_l^m(x) = (-1)^m(1-x^2)^{m/2}\frac{\partial ^l}{\partial x^l}p_l(x) $$
But when I try to program this in Mathematica, I get a strange behavior (I think)
p[x_, l_, m_] = (-1)^m*(1 - x^2)^(m/2)*
D[1/(2^l l!)*D[(x^2 - 1)^l, {x, l}], {x, m}];
Above, what I think is the correct Associated Legendre Polynomial is zero for any value of m not equal to zero. Why?
I looked at just $p_l(x)$:
pl[x_, l_] = 1 / (2^l * l!) * D[(x^2 - 1)^l, {x, l}];
D[pl[2, 3], {x, m}]
When I took the derivative of $p_l(x)$ at $x=2, L = 3$ $$ \begin{array}{cc} \{ & \begin{array}{cc} 17 & m=0 \\ 0 & \text{True} \\ \end{array} \\ \end{array} $$
This shows that it is zero for any value of $m \neq 0$. Is my code or the equation I am using wrong? Or should the derivative really be zero for any m?
LegendreP[]
is built-in. $\endgroup$