Java Number Cruncher: The Java Programmers Guide to Numerical Computing
6.2 Polynomial Interpolation Functions If we are given two data points in the xy plane, there is one, and only one, polynomial interpolation function f 1 ( x ) of degree 1 that will pass through both points a line function. As shown in Figure 6-2, let the two points be ( x , f 1 ( x )) and ( x 1 , f 1 ( x 1 )). Then, using similar triangles , we have
Figure 6-2. A line in the xy plane.
and so
Notice that we have derived the Newton form of the polynomial
where the coefficients b = f 1 ( x ) and b 1 = the quantity in the square brackets. The quantity in the square brackets is called a divided difference, and it happens to be the slope of the line. As we'll soon see, divided differences play a major computational role in determining polynomial interpolation functions. If there are three points in the xy plane, then there is a polynomial interpolation function f 2 ( x ) of degree 2 that will pass through all three points. This is a quadratic function, which describes a parabola. Although we won't prove it here, this parabola is unique for any three given points. The Newton form of the parabola is
where the centers x and x 1 are the x coordinates of two of our three given points. The coefficients b i are constant their values are the same for any value of x. So to compute b , first set x to the value x to get rid of the terms containing b 1 and b 2 , and we see that
Now set x to the value x 1 to get rid of the term containing b 2 and substitute in the value we just computed for b :
and so
Finally, set x to the center value x 2 (the x coordinate of the third point) and substitute in the values for b and b 1 :
Subtract f 2 ( x 1 ) from both sides:
But since
we have
Divide both sides by ( x 2 - x 1 ), and we get
and finally
Notice that the values of b and b 1 are similar to the corresponding values we had computed for the first degree polynomial. The definition of b 2 is recursive it's a divided difference that is composed of two divided differences. In general, if we are given n +1 points, then there exists a unique polynomial function f n ( x ) of degree n that passes through all the points. |
| |
| Top |
Категории