I have a function defined as a set of weighted Legendre polynomials: $f(x)=\alpha_0 P_0(x) + \alpha_1 P_1(x) + \alpha_2 P_2(x) +\ldots$.
I have another function similarly defined with Legendre basis weights, but it's over a different range. I want to compare the two functions over the range where they overlap. This means I need to transform one function by stretching and shifting it to match the other sequence's range.
This is not too hard. I basically want to express my function with an affine transform applied to the input, and simplify the resulting polynomial down to basic Legendre basis weights. That is, finding the $\beta_i$ coefficients below.
$\begin{align*} f(Ax+B) &= \alpha_0 P_0(Ax+B) + \alpha_1 P_1(Ax+B) +\alpha_2 P_2(Ax+B) +\ldots\\ &= \beta_0 P_0(x) + \beta_1 P_1(x) + \beta_2 P_2(x) + \ldots \end{align*}$
This is quite well defined. I could in theory do it by expanding the sum into a simple giant polynomial, then collect terms and find the Legendre weights again.
So for example, for the second order term only,
$\begin{align*} P_2(Ax+B)&= {1\over2}(3(Ax+B)^2-1)\\ P_2(Ax+B)&= A^2(\frac12(3x^2-1)+ABx+{1\over2}(A^2+B^2)-\frac12\\ P_2(Ax+B)&= A^2 P_2(x) + ABP_1(x)+ {1\over 2}(A^2+B^2-1)P_0(x) \end{align*}$
This gets more and more ugly with higher orders.
My question: is there a nice recurrence relation or simple way to generate these transformed basis weights given A, B, and the set of weights $\alpha_i$, producing the resultant set of weights $\beta_i$? It feels like there should be a method that does not drop down to expanding the polynomial in full.
Well this is perhaps pretty much what you are doing, but it can be programmed quite simply. (Sorry about the lo-tech look, but I'm ASCII only).
The Legendre polynomials satisfy $P_{n+1} = d_n \cdot X\cdot P_n + f_n \cdot P_{n-1}$. If we define polynomials $p_n (x) = P_n(ax+b)$ then we have $p_n = \sum\limits_{j \leq n} \mathbf A_{n,j} P_j$ for a ( lower triangular) matrix $\mathbf A$, and the coefficient vector you seek will be $\mathbf A^T\dot \alpha$. Since the $p$'s also satisfy a recurrence relation, the rows of $\mathbf A$ can be computed recursively. I tried this and got:
which appears to work, though I cannot vouch for stability and suspect there has to be a better way.