0

I want to calculate the best approximation $f(x) = e^x$ on the function spaces $P_0[-1,1],P_1[-1,1],P_2[-1,1]$ with the L2 Norm. In the lecture we derived that given a orthonormal system of the function space of $P_n[-1,1]$, e.g. the Legendre polynomials in the case of the L2 inner product, we could determine the best approximation using a Fourier expansion: $$ g_n = \sum_{k=0}^n(\int_{-1}^1f(x)q_j dx)q_j$$

For $P_0[-1,1]$ we have $q_0 = 1$ for which we would get $g_0 = e-1/e$, for $P_1[-1,1]$ I get $q_0 = 1, q_1 = \frac{\sqrt{3}}{\sqrt{2}}x$, so the Fourier expansion would yield: $e-1/3+\frac{3}{e}x$.

However, if I plot these functions, they don't look to be the best approximation of f(x): P_0 best approximation

P_1 best approximation

Can someone explain what I'm doing wrong here?

eager2learn
  • 2,799

1 Answers1

1

What happens is that $q_0=1$ is not normalized, since $\int_{-1}^1q_0^2\,dx=2$. You should take $q_0=1/\sqrt2$.