Find the second degree least squares approximation to f(x)=e^x on [-1, 1] using the Legendre polynomials.
Using P(x)=a_0*c_0 + a_1*c_1 + a_2*c_2 where the c's are the Legendre polys and the a's are found using the formula a_j =
int from -1 to 1 of c_j (x) f(x) dx / int from -1 to 1 of (c_j (x))^2 dx
because the weight function = 1
I have come up with -14.2556 +8.1548x+4.629x^2 which is very wrong. Could someone please walk me through this?