Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Chapter 4 Interpolation and Approximation. 2 4.1 Lagrange Interpolation The basic interpolation problem can be posed in one of two ways: The basic interpolation.

Similar presentations


Presentation on theme: "1 Chapter 4 Interpolation and Approximation. 2 4.1 Lagrange Interpolation The basic interpolation problem can be posed in one of two ways: The basic interpolation."— Presentation transcript:

1 1 Chapter 4 Interpolation and Approximation

2 2 4.1 Lagrange Interpolation The basic interpolation problem can be posed in one of two ways: The basic interpolation problem can be posed in one of two ways:

3 3

4 4

5 5

6 6 Example 4.1 e -1/2

7 7

8 8 Discussion The construction presented in this section is called Lagrange interpolation. The construction presented in this section is called Lagrange interpolation. How good is interpolation at approximating a function? (Sections 4.3, 4.11) How good is interpolation at approximating a function? (Sections 4.3, 4.11) Consider another example: Consider another example: If we use a fourth-degree interpolating polynomial to approximate this function, the results are as shown in Figure 4.3 (a). If we use a fourth-degree interpolating polynomial to approximate this function, the results are as shown in Figure 4.3 (a).

9 9 Error for n=8

10 10 Discussion There are circumstances in which polynomial interpolation as approximation will work very well, and other circumstances in which it will not. There are circumstances in which polynomial interpolation as approximation will work very well, and other circumstances in which it will not. The Lagrange form of the interpolating polynomial is not well suited for actual computations, and there is an alternative construction that is far superior to it. The Lagrange form of the interpolating polynomial is not well suited for actual computations, and there is an alternative construction that is far superior to it.

11 11 4.2 Newton Interpolation and Divided Differences The disadvantage of the Lagrange form The disadvantage of the Lagrange form If we decide to add a point to the set of nodes, we have to completely re-compute all of the functions. If we decide to add a point to the set of nodes, we have to completely re-compute all of the functions. Here we introduce an alternative form of the polynomial: the Newton form Here we introduce an alternative form of the polynomial: the Newton form It can allow us to easily write in terms of It can allow us to easily write in terms of

12 12

13 13 =0

14 14 Example 4.2

15 15 Discussion The coefficients are called divided differences. The coefficients are called divided differences. We can use divided-difference table to find them. We can use divided-difference table to find them.

16 16 Example 4.3

17 17

18 18 Example 4.3 (Con.)

19 19 Table 4.5

20 20 4.3 Interpolation Error

21 21 4.4 Application: Muller’s Method and Inverse Quadratic Interpolation We can use the idea of interpolation to develop more sophisticated root-finding methods. We can use the idea of interpolation to develop more sophisticated root-finding methods. For example: Muller ’ s Method For example: Muller ’ s Method Given three points we find the quadratic polynomial such that 0,1,2; and then define as the root of that is closest to. Given three points we find the quadratic polynomial such that 0,1,2; and then define as the root of that is closest to.

22 22

23 23

24 24 compare

25 25 Discussion One great utility of Muller ’ s method is that it is able to find complex roots of real-valued functions, because of the square root in the computation. One great utility of Muller ’ s method is that it is able to find complex roots of real-valued functions, because of the square root in the computation.

26 26 4.5 Application: More Approximations to the Derivative depends on x

27 27 4.5 Application: More Approximations to the Derivative The interpolating polynomial in Lagrange form is The interpolating polynomial in Lagrange form is The error is given as in (4.20), thus The error is given as in (4.20), thus We get We get

28 28 We can use above equations to get:

29 29 4.7 Piecewise Polynomial Interpolation If we keep the order of the polynomial fixed and use different polynomials over different intervals, with the length of the intervals getting smaller and smaller, then interpolation can be a very accurate and powerful approximation tool. If we keep the order of the polynomial fixed and use different polynomials over different intervals, with the length of the intervals getting smaller and smaller, then interpolation can be a very accurate and powerful approximation tool. For example: For example:

30 30

31 31

32 32

33 33 Example 4.6

34 34

35 35

36 36 4.8 An Introduction to Splines 4.8.1 Definition of the problem 4.8.1 Definition of the problem

37 37 Discussion From the definition: From the definition: d : degree of approximation d : degree of approximation Related to the number of unknown coefficients (the degrees of freedom) Related to the number of unknown coefficients (the degrees of freedom) N : degree of smoothness N : degree of smoothness Related to the number of constraints Related to the number of constraints

38 38 Discussion We can make the first term vanish by setting We can make the first term vanish by setting This establishes a relationship between the polynomial degree of the spline and the smoothness degree. This establishes a relationship between the polynomial degree of the spline and the smoothness degree. For example: cubic splines For example: cubic splines

39 39 4.8.2 Cubic B-Splines B-Spline: assume a uniform grid B-Spline: assume a uniform grid

40 40 Cubic B-Splines How do we know that B ( x ) is a cubic spline function? How do we know that B ( x ) is a cubic spline function? Computer the one-sided derivatives at the knots: Computer the one-sided derivatives at the knots: and similarly for the second derivative. and similarly for the second derivative. If the one-sided values are equal to each other, then the first and second derivatives are continuous, and hence B is a cubic spline. If the one-sided values are equal to each other, then the first and second derivatives are continuous, and hence B is a cubic spline. Note that B is only “ locally defined, ” meaning that it is nonzero on only a small interval. Note that B is only “ locally defined, ” meaning that it is nonzero on only a small interval.

41 41

42 42 A Spline Approximation We can use B to construct a spline approximation to an arbitrary function f. We can use B to construct a spline approximation to an arbitrary function f. Define the sequence of functions Define the sequence of functions

43 43 x i =0.4 h =0.05 x i =0.75 h =0.05

44 44 n +1 equations in n +3 unknowns

45 45 A Spline Approximation Now, we need to come up with two additional constraints in order to eliminate two of the unknowns. Now, we need to come up with two additional constraints in order to eliminate two of the unknowns. Two common choices are Two common choices are The natural spline: The natural spline: A simple construction A simple construction Leads to higher error near the end points Leads to higher error near the end points The complete spline: The complete spline: Better approximation properties Better approximation properties Do not actually require the derivative at the end points Do not actually require the derivative at the end points

46 46 Natural Spline From n -1

47 47 Complete Spline From n+1

48 48 Example 4.7

49 49

50 50

51 51

52 52

53 53

54 54

55 55 Example 4.8

56 56

57 57

58 58

59 59

60 60 Discussion The advantage of spline interpolation lies in the smoothness of the approximation. The advantage of spline interpolation lies in the smoothness of the approximation.

61 61 4.9 Application: Solution of Boundary Value Exercises Consider the two-point boundary value problem: Consider the two-point boundary value problem: We construct the uniform grid of points: We construct the uniform grid of points: We now look for our approximation in the form of a cubic spline define on this grid. We now look for our approximation in the form of a cubic spline define on this grid. Consider the function: Consider the function:

62 62 The advantage of this approach is we can get a continuous smooth function. The advantage of this approach is we can get a continuous smooth function. Because we know the values of and its derivatives at each of the nodes, we can easily reduce this to the system of equations: (n+1 equations in n+3 unknown) Because we know the values of and its derivatives at each of the nodes, we can easily reduce this to the system of equations: (n+1 equations in n+3 unknown) where where

63 63 We can eliminate the two extra unknowns by imposing the boundary conditions on the approximation: We can eliminate the two extra unknowns by imposing the boundary conditions on the approximation: Substitute these into the first and last equations of the rectangular system, we get Substitute these into the first and last equations of the rectangular system, we get

64 64 We are then left with the square system: We are then left with the square system: where where

65 65 Example 4.9

66 66 where The solution we get

67 67

68 68 4.10 Least Squares Concepts in Approximation 4.10.1 An introduction to data fitting 4.10.1 An introduction to data fitting

69 69 Least Square Data Fitting

70 70

71 71

72 72 Example 4.10

73 73

74 74 Example 4.11

75 75

76 76

77 77

78 78

79 79 4.10.2 Least Squares Approximation and Orthogonal Polynomials Let, we can seek such that is minimized. Let, we can seek such that is minimized.

80 80 Inner Productions Inner productions of functions: Inner productions of functions: Inner product on real vector spaces: Inner product on real vector spaces:

81 81

82 82 The definition of inner product will allow us to apply a number of ideas from linear algebra to the construction of approximations. The definition of inner product will allow us to apply a number of ideas from linear algebra to the construction of approximations.

83 83 The system can be organized along matrix-vector lines as The system can be organized along matrix-vector lines as If our basis function satisfy the orthogonality condition If our basis function satisfy the orthogonality condition the special basis functions that satisfy this equation are called orthogonal polynomials. Then the above matrix is a diagonal matrix, and we very easily have Then the above matrix is a diagonal matrix, and we very easily have

84 84

85 85 Orthogonal Polynomials Legendre polynomials: Legendre polynomials:

86 86 Example 4.12

87 87

88 88

89 89 Example 4.13

90 90 4.11 Advanced Topics in Interpolation Error You can read it by yourselves. You can read it by yourselves.


Download ppt "1 Chapter 4 Interpolation and Approximation. 2 4.1 Lagrange Interpolation The basic interpolation problem can be posed in one of two ways: The basic interpolation."

Similar presentations


Ads by Google