Legendre Polynomial coefficients

760 Views Asked by At

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.]])
2

There are 2 best solutions below

0
On BEST ANSWER

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}}$$

2
On

Give an inner product on the vector space of polynomials of degree $\leq n$ by $\langle f, g\rangle = \int_{-1}^1 f(x)g(x)\,dx$. The obvious basis $\{1,x,x^2,\ldots, x^n\}$ is not an orthonormal basi. So Apply Gram-Schmidt procedure. This will also give Legendre polynomials.