This is a question from Exercise set 3.1, Numerical Analysis by Faires and Burden:
Let $x_0 = 0$, $x_1 = 0.6$, and $x_2 = 0.9$.
Construct an interpolation polynomial of degree at most 1 for $f(x) = cos(x)$.
Relevant Equations:
$L_k(x) = \frac{x-x_i}{x_k - x_i}$
Attempt:
The polynomial can be constructed as $P_1(x) = f(x_0)L_0(x) + f(x_1)L_1(x)$, where:
$L_0(x) = \frac{x-0.6}{0-0.6} = \frac{-5x}{3} + 1$, $f(0) = 1$
$L_1(x) = \frac{x-0}{0.6-0} = \frac{-5x}{3}$, $f(0.6) =0.825333$
In the equations above, I have used the points 0 and 0.6, and have calculated the function values using radians.
Plugging these back in to the interpolation formula, I get:
$P_1(x) = -0.2911x + 1$. However, in the book it states $P_1(x) = -0.148878x + 1$.
Can someone please explain how the book answer is possible?
Thank you.
Similar question here: Interpolation polynomial of degree at most n