a) Construct the Lagrange interpolating polynomial for the function $$f(x) = \sin\left(\frac{\pi x}{2}\right)$$ and the nodes $n_0 = 0$, $n_1=1$, $n_2=2$.
b)By evaluating this Lagrange polynomial at a suitable point, find an approximation for the number $$\sin\left(\frac{\pi}{4}\right) = \frac{\sqrt{2}}{2} = 0.70710678118655$$ What are the absolute error and the relative error?
I have solved the first part of the question for which I got $p(x) = 2x - x^2$ but I am completely stumped on the second part. I would guess I need to sub in $x=\frac{1}{2}$ to my $p(x)$ ?
Yup. Just plug in $1/2$. You get $.75$, so the absolute error is the difference between the true and polynomial approximation $\mid .75-0.70710678118655\cdots \mid$ and the relative error is that divided by $\mid .75 \mid $.