Polynomial interpolation problem [Solved]
Well homework again, i solved the matrix problem but now we got some more "fun" homework. I blazed through spline and linear interpolation but now at polynomial interpolation i got a problem.
This is the table of values i got
x f(x)
0 0
2 1.9
4 2.1
5 -0.2
6 0
So the 4th degree polynomial would look like:
P4(x)= a0 + a1*(x-x0) + a2*(x-x0)*(x-x1) + a3*(x-x0)*(x-x1)*(x-x2) + a4*(x-x0)*(x-x1)*(x-x2)*(x-x3)
So putting up some linear equations i get the result:
x= 0: a0 = 0
x= 2: a0 + a1*2 = 1.9
x= 4: a0 + a1*4 + a2*4*2 = 2.1
x= 5: a0 + a1*5 + a2*5*4 + a3*5*4*2 = -0.2
x= 6: a0 + a1*6 + a2*6*5 + a3*6*5*4 + a4*6*5*4*2 = 0
a0: 0
a1: 0.95
a2: -0.2125
a3: -0.0175
a4: 0.0115625
So the polynomial should be:
0 + 0.95x - 0.2125x(x-2) - 0.0175x(x-2)(x-4) + 0.0115625x(x-2)(x-4)(x-5)
right? Well the problem is that it totally misses x=5 so i don't know what i did wrong. Here is a pic of what happened
So any idea what i did wrong?
[Edited by - KeGA84 on March 1, 2006 12:27:44 AM]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement