Legendre polynomial kernel construction (source code)

= Legendre polynomial kernel construction
{c}
{title2=$K_\ell(u)=\mathbf1_{[-1,1]}(u)\sum_{m<\ell}\phi_m(0)\phi_m(u)$}

For normalized <Legendre polynomials>, this <kernel for density estimation> reproduces evaluation at zero on every <polynomial> of degree below $\ell$: expand $p$ in the <orthonormal basis> to obtain $\int K_\ell p=p(0)$. Taking monomials proves integral one and zero moments of orders $1,\ldots,\ell-1$; <compact support> gives finite absolute moments. If exact order requires a nonzero moment of order $\ell$, add $(\phi_\ell(0)+1)\phi_\ell\mathbf1_{[-1,1]}$. Lower moments remain unchanged. Writing $a_\ell=\langle u^\ell,\phi_\ell\rangle\ne0$ and evaluating the full expansion of $u^\ell$ at zero shows that the new moment is $a_\ell$. A useful three-derivative example is $K_3=(9-15u^2)\mathbf1_{[-1,1]}/8$, whose first two moments vanish and whose squared <L2 norm> is $9/8$.