analytics

Wednesday, June 8, 2011

A form of polynomial

I was looking at a function f(x) that passes through the points (0, a), (1, b), (2, c), (3, d). This is what I came up with:
   (1-x)*(1/2)(2-x)*(1/3)*(3-x)*a+
   (x) *(2-x)*(1/2)*(3-x)*b +
   (1/2)*x *(x-1) *(3-x)*c +
   (1/3)*x *(1/2)*(x-1)*(x-2)*d

  If I had considered 5 terms instead the fifth would be:
  (1/4)*x  *(1/2)*(1/3)*(x-1)*(x-2)*(x-3)   *(5-x) * e
  So it generalizes pretty well.
The reason the formula I found for going through four points works is if you look at the four lines of the formula, at x=0 all that preceeds A is equal to 1, and at least one of those is 0 at every x after that so A is being multiplied by 0. The same is true for each line for x=0,1,2,3 respectively A,B,C,D are being multiplied by 1 at x=i and 0 elsewhere so the ith term is all that doesn't cancel out.

Anyway a useful feature of this type of interpolation is that if you know the f(x) values at x=0,1,... you can easily put it into this form which is a very nice and simple form (practically factored) to look at f(x) in. .

No comments:

Post a Comment