lec02a

  • 格式:pdf
  • 大小:1.31 MB
  • 文档页数:7

-1 2
0 3
1 8
Table 1: A data set.
8
7
6
5
4

3
2
1 −1
−0.8
−0.6
−0.4
−0.2
0
0.2
0.4
0.6
0.8
1
Figure 2: The interpolating polynomial.
However, the use of Lagrange interpolation for large data set is not a good idea. The reason for this is that Lagrange interpolation is very sensitive to errors in the measurement data. For example, consider the data set shown in Table 2. An obvious function to describe this data set is y = 0. Suppose a small -8 0 -7 0 -6 0 -5 0 -4 0 -3 0 -2 0 -1 0 0 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0
-8 0
-7 0
-6 0
-5 0
-4 0
-3 0
-2 0
-1 0
0 0.001
1 0
2 0
3 0
4 0
5 0
6 0
7 0
8 0
Table 3: A data set with small error.
0.02 0 −0.02 −0.04 −0.06 −0.08 −0.1 −0.12 −0.14 −0.16 −0.18 −8
MATH 3290 Mathematical Modeling Lecture notes 2a: Empirical modeling by interpolation
1
Lagrange interpolation
Fitting curves using the least-squares criterion is appropriate for many purposes, including predicting the value of a function in the future (outside the range of data) and determining a rule or law to explain the behavior of the dependent variable. However, there are some cases that no simple fit would be appropriate, for example, the date set shown in Figure 1. In these cases, interpolation may be appropriate.
Using the Lagrangian polynomials, one can write down the polynomial P (x) as P (x) = y0 L0 (x) + y1 L1 (x) + · · · + yn Ln (x). For example, consider the data set in Table 1. One can write down the interpolating polynomial as P (x) = 2 (x − 0)(x − 1) (x − (−1))(x − 1) (x − (−1))(x − 0) +3 +8 . (−1 − 0)(−1 − 1) (0 − (−1))(0 − 1) (1 − (−1))(1 − 0)
Figure 1: Population data Interpolation is used to explain the behavior between data points. The interpolating function passes through the data points and is used to predict what the function values would have been if observations had been made between the data points. Using an interpolation curve to predict function values that extend beyond the data is called extrapolation and is not recommended because it may have extreme variations beyond the scope of the data. Now we will discuss the Lagrangian form for finding interpolating polynomial. Given a set of (n + 1) data points (x0 , y0 ), (x1 , y1 ), · · · , (xn , yn ) with distinct xi , one can find a polynomial P (x) of degree n that passes through all these n + 1 data points, i.e. yi = P (xi ), i = 0, 1, · · · , n. A convenient way to find this polynomial P (x) is to use Lagrange polynomials. For each i = 0, 1, · · · , n, we define a polynomial Li (x) of degree n by (x − x0 ) · · · (x − xi−1 )(x − xi+1 ) · · · (x − xn ) . Li (x) = (xi − x0 ) · · · (xi − xi−1 )(xi − xi+1 ) · · · (xi − xn ) Obviously, the polynomial Li (x) has the following properties Li (xi ) = 1, Li (xj ) = 0, j = i.
−6
−4
−2
0
2
4
6
8
Figure 3: The interpolating polynomial.
Then the approximate value of the population at year 1900 is s(1900) = 4483.6. Notice that linear spline is continuous, but its derivative is not continuous. In some cases, we may need to obtain approximations for derivatives. Linear spline is not suitable because it is not differentiable. To enhance smoothness of the interpolation, we introduce the cubic spline interpolation, for which we use a cubic polynomial to connect two adjacent data points. That is, on each subinterval [xi , xi+1 ], the cubic spline can be written as si (x) = ai + bi x + ci x2 + di x3 . Thus, on each subinterval, there are 4 unknowns to be determined. Since there are n subintervals, we need to determine 4n unknowns. We use the following criteria to determine these unknowns, this will result in the so-called natural cubic spline. 1. The spline function passes through all data points si (xi ) = yi , There are 2n conditions in this form. 2. The first order derivative is continuous at interior points
For example, consider the data set in Figure 4. The plot of these data is shown in Figure 1. Assume that we need to predict the population in 1900 by using linear spline interpolation. We need to use the two data points (1891, 4705) and (1901, 4459) to get the following linear function s(x) = 4705 1901 − x x − 1891 + 4459 . 1901 − 1891 1901 − 1891 2
To obtain a prediction of the value of y when x = 0.5, we evaluate y = P (0.5) = 5. The graph of this interpolating polynomial is shown in Figure 2. 1