Numerical Analysis Assignment 6 — Piecewise Interpolation and Splines  
Question #1
Consider the following set of data points:
$x$$y$
0.10.03
0.30.06
0.80.07
1.10.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:
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <assert.h>

double f(double x){
09.26.16
Question #2
Consider the following data points:
$x$$y$
13
37
86
109
127
1412
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.
Reminder
$$ 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 $$
09.28.16
Question #3
Consider 9 nodes arranged as follows:
Q6.png
with the following values and $x$-$y$ coordinates:
Node$x$$y$$\phi$
10?100
2??120
31?150
401160
5?1170
611190
702200
8?2230
912270
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.
Answers
1.  
2.  
3.  -0.9, 0.733.
08.29.17
Due on Wednesday November 29th at 16:30. Do all questions.
11.22.17
Make PDF
$\pi$