# Thread: Need help interpolating polynomials (spline)?

1. ## Need help interpolating polynomials (spline)?

Consider the data points: (0,1), (1,1), (2,5)

a) Find the piecewise linear interpolationg functon for the data

c) Find the natural cubic spline that interpolates the data..

---

I can do part b) , but in a) how do you do a piecewise? And if someone could do c) out entirerly & explain I'd really appreciate it.

2. Originally Posted by amor_vincit_omnia
Consider the data points: (0,1), (1,1), (2,5)

a) Find the piecewise linear interpolationg functon for the data

c) Find the natural cubic spline that interpolates the data..

---

I can do part b) , but in a) how do you do a piecewise? And if someone could do c) out entirerly & explain I'd really appreciate it.
to a)

$\displaystyle f(x)= \left\{\begin{array}{lcr}x & if & 0\leq x<1 \\ 4x-3 & if & 1 \leq x \leq 2 \end{array} \right.$

3. Originally Posted by amor_vincit_omnia
Consider the data points: (0,1), (1,1), (2,5)

...

c) Find the natural cubic spline that interpolates the data..

...
The general equation of the function you are looking for is

$\displaystyle f(x)=ax^3+bx^2+cx+d$

f(0)=1
f(1)=1
f(2)=5
Now use the condition
f''(0) = 0 or
f''(2) = 0

I don't know which method you have learned in school.

Now you have a system of simultaneous equations which will give you the values of a, b, c and d.

4. Well, we didn't learn a certain method for spline, but it is in the homework. If you know a method, I would appreciate it.
When I used the three conditions,
f(0)=1
f(1)=1
f(2)=5

&

f''(0) = 0 ,

I got a = 2/3, b = 0, c = -2/3, d = 1

f(x) = 2/3x^3 - 2/3x + 1