Legendre Polynomials and least square approximation.

1k Views Asked by At

I'm given the following problem on a homework set.

  1. Show that the orthogonal projection of the function $f(x)=x$ onto the subspace $W$ of Problem 21 is $$ p(x) = -\frac{1}{2} + \frac{e^x}{e-1} \approx (-.5820)e^x - 0.500. $$ This is the best (least squares) approximation to $f(x)=x$ by a function on $[0,1]$ of the form $f(x) = a + be^x$. Suggestion: the antiderivative of $xe^x$ is $(x-1)e^x + C$

The problem it's referring too is

  1. Let $W$ be the subspace of $C[0,1]$ consisting of all the functions of the form $f(x)=a+be^x$. Apply the Gram-Schmidt algorithm to the basis ${1,e^x}$ to obtain the orthogonal basis ${p_1,p_2}$, where $$p_1 (x)=1$$ $$p_2(x)= e^x−e+1$$

I've shown 21 easily enough, but I'm not sure how to show 22. I've tried using a couple different formulas given in the textbook; $p(x) = \frac{\langle p_0,f \rangle}{\langle p_0,p_0 \rangle} p_0 + \frac{\langle p_1,f \rangle}{\langle p_1,p_1 \rangle} p_1 +...$ I assumed $p_1$ and $p_2$ were the ones from 21, but when plugging into this formula, it did not work out. I'm not sure where to start with this, any guidance would be appreciated.

Thank you.

EDIT: My attempt at the problem is as follows.

Given the equation $$ \sum_{n=0}^\infty \frac{\langle p_n , f \rangle}{\langle p_n , p_n \rangle} p_n$$ $$ \langle p_1 , f \rangle =\int_0^1 x \ dx = \frac{1}{2} \\ \langle p_1 , p_1 \rangle =\int_0^1 1 \ dx = 1 \\ \langle p_2 , f \rangle =\int_0^1 (e^x - e + 1) \ x \ dx = -(\frac{1}{2} + \frac{1}{2} \ e ) \\ \langle p_2 , p_2 \rangle =\int_0^1 (e^x - e + 1)^2 \ dx = \frac{1}{2} (e^x + e^x \ e - e^2 + 1) $$ Therefore, $$ p(x) = \frac{1}{2} + \frac{\frac{1}{2} + \frac{1}{2} \ e}{\frac{1}{2} (e-3)(e-1)} (e^x - e + 1) $$

I've tried simplifying, but cannot seem to get the desired result. Am I making any obvious mistakes? I may be incorrect in my approach. If I'm wrong, I believe it's going to be where I plug in $p_1$ and $p_2$.

1

There are 1 best solutions below

0
On BEST ANSWER

The target function is $$ f(x) = x, $$ the domain is $x\in\left[0,1\right]$. The basis functions are the set $$ p = \left\{ 1, e^{x} - e + 1 \right\} $$ The approximation through order $d = 1$ is $$ \begin{align} f(x) % &\approx \frac{\left< p_{1}, f \right>}{\left< p_{1}, p_{1} \right>} p_{1}(x) + \frac{\left< p_{2}, f \right>}{\left< p_{2}, p_{2} \right>} p_{2}(x) \\[5pt] % &= \frac{2 e^x+1-e}{2 (e-1)} % \end{align} $$

For completeness, the inner products are cataloged: $$ \begin{align} % \left< p_{1}, p_{1} \right> &= 1 \\ % \left< f, p_{1} \right> &= \frac{1}{2} \\ % \left< p_{2}, p_{2} \right> &= - \frac{1}{2} \left( e - 3 \right) \\ % \left< f, p_{2} \right> &= - \frac{1}{2} \left( e - 3 \right) \left( e - 1 \right) \\ % \end{align} $$ The graph below shows the target function as a gray line; the approximation is the black curve.

The approximation of f(x) = x in the basis p,