Course Webpage

For the nodes $x_{0}=-1,$ $x_{1}=1,$ $x_{2}=3$ and $x_{3}=5$ and the function

$$f\left(x\right)=\sin\left(\dfrac{\pi}{6}x\right)$$

  • Compute the table of divided differences.
  • Use it to find the interpolation polynomial in the Newton's form.
  • Approximate the value of $f$ at $x=2.$

Compute the table of divided differences

The divided differences table for 4 nodes is

$$ \begin{array}{ccccc} x_0 & y_0 & & &\\ & & [y_0,y_1]=\dfrac{y_1-y_0}{x_1-x_0} & &\\ x_1 & y_1 & &[y_0,y_1,y_2]=\dfrac{[y_1,y_2]-[y_0,y_1]}{x_2-x_0}&\\ & & [y_1,y_2]=\dfrac{y_2-y_1}{x_2-x_1} & & [y_0,y_1,y_2,y_3]=\dfrac{[y_1,y_2,y_3]-[y_0,y_1,y_2]}{x_3-x_0}\\ x_2 & y_2 & &[y_1,y_2,y_3]=\dfrac{[y_2,y_3]-[y_1,y_2]}{x_3-x_1}&\\ & & [y_2,y_3]=\dfrac{y_3-y_2}{x_3-x_2} & &\\ x_3 & y_3 & & &\\ \end{array} $$

The nodes $x$ are the data and we compute the $y$ using the function $f$.

$$f\left(x\right)=\sin\left(\dfrac{\pi}{6}x\right)\\[0.7cm] y_0=f\left(-1\right)=\sin\left(-\dfrac{\pi}{6}\right)=-\frac{1}{2}\quad y_1=f\left(1\right)=\sin\left(\dfrac{\pi}{6}\right)=\frac{1}{2}\\[0.7cm] y_2=f\left(3\right)=\sin\left(3\dfrac{\pi}{6}\right)=\sin\left(\dfrac{\pi}{2}\right)=1\quad y_3=f\left(5\right)=\sin\left(\dfrac{5\pi}{6}\right)=\frac{1}{2}$$
\begin{array}{|l|cccc|} \hline k & 0 & 1 & 2 & 3\\ \hline x & -1 & 1 & 3 & 5\\ \hline y &-\dfrac{1}{2} & \dfrac{1}{2} & 1 & \dfrac{1}{2}\\ \hline \end{array}

And, in this case, the divided differences table is

$$ \begin{array}{ccccc} x & y & & &\\ -1 & \fbox{$-\dfrac{1}{2}$}^{\;\large{c_0}} & & &\\ & & \dfrac{\frac{1}{2}-(-\frac{1}{2})}{1-(-1)}=\fbox{$\dfrac{1}{2}$}^{\;\large{c_1}} & &\\ 1 & \dfrac{1}{2} & &\dfrac{\frac{1}{4}-\frac{1}{2}}{3-(-1)}=\fbox{$-\dfrac{1}{16}$}^{\;\large{c_2}}&\\ & & \dfrac{1-\frac{1}{2}}{3-1}=\dfrac{1}{4} & & \dfrac{-\frac{1}{8}-(-\frac{1}{16})}{5-(-1)}=\fbox{$-\dfrac{1}{96}$}^{\;\large{c_3}}\\ 3 & 1 & &\dfrac{-\frac{1}{4}-\frac{1}{4}}{5-1}=-\dfrac{1}{8}&\\ & & \dfrac{\frac{1}{2}-1}{5-3}=-\dfrac{1}{4} & &\\ 5 & \dfrac{1}{2} & & &\\ \end{array} $$

If we write the numbers as floating point numbers

$$ \begin{array}{ccccc} x & y & & &\\ -1 & \fbox{$-0.5$}^{\;\large{c_0}} & & &\\ & & \dfrac{0.5-(-0.5)}{1-(-1)}=\fbox{$0.5$}^{\;\large{c_1}} & &\\ 1 & 0.5 & &\dfrac{0.25-0.5}{3-(-1)}=\fbox{$-0.0625$}^{\;\large{c_2}}&\\ & & \dfrac{1-0.5}{3-1}=0.25 & & \dfrac{-0.125-(-0.0625)}{5-(-1)}=\fbox{$-0.010417$}^{\;\large{c_3}}\\ 3 & 1 & &\dfrac{-0.25-0.25}{5-1}=-0.125&\\ & & \dfrac{0.5-1}{5-3}=-0.25 & &\\ 5 & 0.5 & & &\\ \end{array} $$

Use it to find the interpolation polynomial in the Newton's form

The Lagrange intepolation polynomial in Newton's form for the nodes $x_0,$ $x_1,$ $x_2$ and $x_3$ where the values of the $f$ function are $y_0,$ $y_1,$ $y_2$ and $y_3$ is

$$ P_3\left(x\right)= c_0+c_1\left(x-x_{0}\right)+ c_2\left(x-x_{0}\right)\left(x-x_{1}\right) +c_3\left(x-x_{0}\right)\left(x-x_{1}\right)\left(x-x_{2}\right) $$

If we substitute the node values and the divided differences

$$P_3(x) = -\frac{1}{2}+\frac{1}{2}(x+1)-\frac{1}{16}(x+1)(x-1)-\frac{1}{96}(x+1)(x-1)(x-3)$$

The interpolant polynomial in Newton's form

The interpolant polynomial in Newton's form is built adding a node every time a term is added

  • $P_0(x) = -\dfrac{1}{2}$ is the interpolation polynomial for $x_0.$
  • $P_1(x) = P_0(x)+\dfrac{1}{2}(x+1)$ is the interpolation polynomial for $x_0,$ y $x_1.$
  • $P_2(x) = P_1(x)-\dfrac{1}{16}(x+1)(x-1)$ is the interpolation polynomial for $x_0,$ $x_1$ y $x_2.$
  • $P_3(x) = P_2(x)-\dfrac{1}{96}(x+1)(x-1)(x-3)$ is the interpolation polynomial for $x_0,$ $x_1,$ $x_2$ y $x_3.$
$$P_3(x) = \fbox{$\fbox{$\fbox{$\fbox{$-\frac{1}{2}$}+\frac{1}{2}(x+1)$}-\frac{1}{16}(x+1)(x-1)$}-\frac{1}{96}(x+1)(x-1)(x-3)$}$$

A consequence of this is that if the last difference divided ($ c_3 $) is zero, the interpolating polynomial would no longer be of degree 3 but degree 2. And if the last two were zero ($ c_2 $ and $ c_3 $) the polynomial would be of degree one. And so on.

An advantage of the interpolating polynomial in Newton's form is that you can add nodes one by one and you don't have to rebuild the polynomial completely every time a node is added, as in Lagrange's form.

Approximate the value of $f$ at $x=2$

The interpolating polynomial in Newton's form is

$$P_3(x) = -\frac{1}{2}+\frac{1}{2}(x+1)-\frac{1}{16}(x+1)(x-1)-\frac{1}{96}(x+1)(x-1)(x-3)$$

And we approximate the value of the function with the value of the polynomial

$$\begin{array}{rcl} P_3(2)& = &-\dfrac{1}{2}+\dfrac{1}{2}(2+1)-\dfrac{1}{16}(2+1)(2-1)-\dfrac{1}{96}(2+1)(2-1)(2-3)=\\ & = & -\dfrac{1}{2}+\dfrac{3}{2}-\dfrac{3}{16}+\dfrac{3}{96}=0.84375 \end{array}$$
$$\sin\left(2\frac{\pi}{6}\right)=\sin\left(\frac{\pi}{3}\right)\approx P_3(2)=0.84375$$

Which is the same result that we had obtained for the interpolating polynomial in Lagrange form because it is the same polynomial written in a different form.