I have a problem from my homework that I completely botched, and no matter what I do I end up with the wrong answer. Here's the problem:
For a given function $f(x)$ let $x_0 = 0, x_1=0.6, x_2 = 0.9$. Construct interpolation polynomials of degree at most one and at most two to approximate $f(0.45)$, and find the absolute error.
Where $f(x) = \sqrt{1 + x} $
So lets start with the first case (linear)
from the formula for lagrange polynomials you get:
$L_0(x) = \frac{x - x_1}{x_0 - x_1} = \frac{x - 0.6}{0 - 0.6} = -\frac{x-0.6}{0.6}$
Then
$L_1(x) = \frac{x-x_0}{x_1 - x_0} = \frac{x - 0}{0.6 - 0} = \frac{x}{0.6}$
Then the linear polynomial is
$P_1(x) = L_0(x)f(x_0) + L_1(x)f(x_1) = -\frac{x-0.6}{0.6} (1) + \frac{x}{0.6}(1.26491)$
Simplifying:
$P_1(x) = .44151x + 1$
Then I find that $|f(x) - P_1(x)| = 0.00547946$, which does not at all agree with the book answer. What am I doing wrong?