Polynomial interpolation problem [Solved]

Started by
1 comment, last by KeGA84 18 years, 1 month ago
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 Graph So any idea what i did wrong? [Edited by - KeGA84 on March 1, 2006 12:27:44 AM]
Advertisement
Careless substitution for the xi values when calculating the last few terms.
Quote:Original post by Anonymous Poster
Careless substitution for the xi values when calculating the last few terms.


Thank you, it looks much better now. Staring at it to long just made me blinder so it was good to have a fresh pair of eyes to look at it. :)

This topic is closed to new replies.

Advertisement