Can you please write out explicitly the formula for the coefficients?
From Wikipedia, \begin{aligned} P_{n}(x)&={\frac {1}{2^{n}}}\sum _{k=0}^{n}{n \choose k}^{2}(x-1)^{n-k}(x+1)^{k}\\&=\sum _{k=0}^{n}{n \choose k}{-n-1 \choose k}\left({\frac {1-x}{2}}\right)^{k}\\&=2^{n}\cdot \sum _{k=0}^{n}x^{k}{n \choose k}{{\frac {n+k-1}{2}} \choose n} \end{aligned}
I am confused about computing the combination with a fraction or a negative number in the top, \begin{aligned} {-n-1 \choose k} \\ {{\frac {n+k-1}{2}} \choose n} \end{aligned}
I am trying to do this in Python with,
>>> from scipy.misc import comb
>>> from numpy import *
>>> N = arange(5).reshape(-1, 1)
>>> K = arange(5).reshape(1, -1)
>>> 2**N * comb(N, K) * comb((N + K - 1)/2, N)
array([[ 0., 0., 0., 0., 0.],
[ 0., 0., 0., 0., 0.],
[ 0., 0., 0., 0., 0.],
[ 0., 0., 0., 0., 0.],
[ 0., 0., 0., 0., 0.]])
You can also use this formula $$\large{{P}_{n}}(x)=\frac{1}{{{2}^{n}}}\sum\limits_{k=0}^{[\frac{n}{2}]}{\,{{(-1)}^{k}}\frac{(2n-2k)!}{k!\,\,(n-k)!(n-2k)!}}\,\,{{x}^{n-2k}}$$