Numerical Analysis Assignment 6 — Piecewise Interpolation and Splines
 Question #1
Consider the following set of data points:
 $x$ $y$ 0.1 0.03 0.3 0.06 0.8 0.07 1.1 0.1
Write a function f in C that returns $y$ given $x$ in the range $x_1\le x \le x_4$ using piecewise linear interpolation:
 09.26.16
 Question #2
Consider the following data points:
 $x$ $y$ 1 3 3 7 8 6 10 9 12 7 14 12
Do the following:
 (a) Using a cubic spline, find the value (by hand) of $y$ at $x=6$. Derive proper boundary conditions and do basic verifications to ensure that your answer is correct. (b) Using a Lagrange polynomial, find the value (by hand) of $y$ at $x=6$. Compare to the result obtained in (a) and discuss.
 09.28.16
 Question #3
Consider 9 nodes arranged as follows:
with the following values and $x$-$y$ coordinates:
 Node $x$ $y$ $\phi$ 1 0 ? 100 2 ? ? 120 3 1 ? 150 4 0 1 160 5 ? 1 170 6 1 1 190 7 0 2 200 8 ? 2 230 9 1 2 270
using a multidimensional piecewise-linear interpolation, it is found that: $$\phi_{x=0.2,y=1.6}=190$$ and $$\phi_{x=0.8,y=0.8}=170$$ Knowing that $$x_2=x_5=x_8$$ $$y_1=y_2=y_3$$ find (in no particular order):
 (a) The $y$ coordinate of nodes 1, 2, and 3. (b) The $x$ coordinate of nodes 2, 5, and 8.
 Question #4
Consider the following data points:
 $x$ $f(x)$ 1 2 2 4 4 3
It is given that at $x=1$, $f^{\prime\prime\prime}=0$. Using a cubic spline, find the value of $f(x)$ at $x=3$. Specifically, do the following:
 (a) Derive a boundary condition function of $b$s at the left boundary. (b) Derive a boundary condition function of $b$s at the right boundary. (c) Write down the equation for the center node function of $b$s. (d) Solve the $b$ equations in (a), (b), and (c) and evaluate $f$ at $x=3$. (e) Perform basic verifications to ensure that your answer is correct.
 11.19.18
 3. -0.9, 0.733. 4. $\frac{13}{3}$.
Equations for inner nodes within cubic splines: $$f_i(x)=a_i(x-x_i)^3 + b_i(x-x_i)^2 + c_i(x-x_i)+d_i$$ $$d_i=y_i$$ $$a_i=(b_{i+1}-b_i)/(3\Delta x_i) ~~\textrm{for}~1\le i \le N-1$$ $$c_i = \frac{\Delta y_i}{\Delta x_i} - b_i \Delta x_i - \left( \frac{b_{i+1}-b_i}{3}\right)\Delta x_i ~~\textrm{for}~1\le i \le N-1$$ $$\Delta x_{i-1} b_{i-1} + 2 \left(\Delta x_i + \Delta x_{i-1} \right) b_i + \Delta x_i b_{i+1} = 3 \left(\frac{\Delta y_i}{\Delta x_i} - \frac{\Delta y_{i-1}}{\Delta x_{i-1}}\right)~~\textrm{for}~2\le i \le N-1$$
 $\pi$