Consider the data points: (0,1), (1,1), (2,5)
a) Find the piecewise linear interpolationg functon for the data
b) Find the quadratic interpolating
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.
The general equation of the function you are looking for is
What you already know:
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.
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
But the answer is:
f(x) =
x^3 - x + 1 for 0<=x<=1
(2-x)^3 + (4x-3) - (2-x) for 1<=x<=2
Any idea?