# 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 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 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 problem can be posed in one of two ways:

3

4 exist unique

5

6 Example 4.1 e -1/2

7

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 Error for n =8 n = 16 n = 8 n = 4

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 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 Newton Interpolation

13 =0

14 Example 4.2

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 Example 4.3

17

18 Example 4.3 (Con.)

19 Table 4.5

20 4.3 Interpolation Error

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

22 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

23 We can use above equations to get:

24 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:

25

26

27 Example 4.6

28

29

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

31 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

32 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 If we consider the common case of cubic splines, then If we consider the common case of cubic splines, then d =3 and N =2. d =3 and N =2.

33 4.8.2 Cubic B-Splines B-Spline: assume an uniform grid B-Spline: assume an uniform grid

34

35 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.

36

37 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

38 x i =0.4 h =0.05 x i =0.75 h =0.05

39 n +1 equations in n +3 unknowns

40 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

41 Natural Spline From n -1

42 Complete Spline From n+1

43 Example 4.7

44

45

46

47

48 Example 4.8

49

50

51

52

53 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.

54 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:

55 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

56 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

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

58 Example 4.9

59 where The solution we get

60

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

62 Least Square Data Fitting

63

64

65 Example 4.10

66

67 Example 4.11

68

69

70

71

72 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.

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

74 Inner Productions

75 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.

76 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

77

78 Orthogonal Polynomials Legendre polynomials: Legendre polynomials:

79 Example 4.12

80

81

82 Example 4.13

83 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