97nach4

Embed Size (px)

Citation preview

  • 7/28/2019 97nach4

    1/83

    1

    Chapter 4

    Interpolation and

    Approximation

  • 7/28/2019 97nach4

    2/83

    2

    4.1 Lagrange Interpolation

    The basic interpolation problem can be posedin one of two ways:

  • 7/28/2019 97nach4

    3/83

    3

  • 7/28/2019 97nach4

    4/83

    4

    exist

    unique

  • 7/28/2019 97nach4

    5/83

    5

  • 7/28/2019 97nach4

    6/83

    6

    Example 4.1

    e-1/2

  • 7/28/2019 97nach4

    7/837

  • 7/28/2019 97nach4

    8/838

    Discussion

    The construction presented in this section iscalled Lagrange interpolation.

    How good is interpolation at approximating a

    function? (Sections 4.3, 4.11) Consider another example:

    If we use a fourth-degree interpolating polynomialto approximate this function, the results are asshown in Figure 4.3 (a).

  • 7/28/2019 97nach4

    9/83

    9

    Error for n=8n= 16

    n= 8n= 4

  • 7/28/2019 97nach4

    10/83

    10

    Discussion

    There are circumstances in which polynomial interpolation asapproximation will work very well, and other circumstances in whichit will not.

    The Lagrange form of the interpolating polynomial is not well suitedfor actual computations, and there is an alternative constructionthat is far superior to it.

  • 7/28/2019 97nach4

    11/83

    11

    4.2 Newton Interpolation and

    Divided Differences

    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.

    Here we introduce an alternative form of the

    polynomial: the Newton form It can allow us to easily write in terms of

  • 7/28/2019 97nach4

    12/83

    12

    Newton Interpolation

  • 7/28/2019 97nach4

    13/83

    13

    =0

  • 7/28/2019 97nach4

    14/83

    14

    Example 4.2

  • 7/28/2019 97nach4

    15/83

    15

    Discussion

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

  • 7/28/2019 97nach4

    16/83

    16

    Example 4.3

  • 7/28/2019 97nach4

    17/83

    17

  • 7/28/2019 97nach4

    18/83

    18

    Example 4.3 (Con.)

  • 7/28/2019 97nach4

    19/83

    19

    Table 4.5

  • 7/28/2019 97nach4

    20/83

    20

    4.3 Interpolation Error

  • 7/28/2019 97nach4

    21/83

    21

    4.5 Application: More

    Approximations to the Derivative

    dependson x

  • 7/28/2019 97nach4

    22/83

    22

    4.5 Application: More

    Approximations to the Derivative

    The interpolating polynomial in Lagrange form is

    The error is given as in (4.20), thus

    We get

  • 7/28/2019 97nach4

    23/83

    23

    We can use above equations to get:

  • 7/28/2019 97nach4

    24/83

    24

    4.7 Piecewise Polynomial

    Interpolation If we keep the order of the polynomial fixed and use

    different polynomials over different intervals, with thelength of the intervals getting smaller and smaller, theninterpolation can be a very accurate and powerful

    approximation tool.

    For example:

  • 7/28/2019 97nach4

    25/83

    25

  • 7/28/2019 97nach4

    26/83

    26

  • 7/28/2019 97nach4

    27/83

    27

    Example 4.6

  • 7/28/2019 97nach4

    28/83

    28

  • 7/28/2019 97nach4

    29/83

    29

  • 7/28/2019 97nach4

    30/83

    30

    4.8 An Introduction to Splines

    4.8.1 Definition of the problem

  • 7/28/2019 97nach4

    31/83

    31

    Discussion

    From the definition:

    d: degree of approximation

    Related to the number of unknown coefficients (the degrees offreedom)

    N: degree of smoothness

    Related to the number of constraints

  • 7/28/2019 97nach4

    32/83

    32

    Discussion

    We can make the first term vanish by setting

    This establishes a relationship between the polynomialdegree of the spline and the smoothness degree.

    For example: cubic splines

    If we consider the common case of cubic splines, then

    d=3 and N=2.

  • 7/28/2019 97nach4

    33/83

    33

    4.8.2 Cubic B-Splines

    B-Spline: assume an uniform grid

  • 7/28/2019 97nach4

    34/83

    34

  • 7/28/2019 97nach4

    35/83

    35

    Cubic B-Splines

    How do we know that B(x) is a cubic spline

    function?

    Computer the one-sided derivatives at the knots:

    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.

    Note that B is only locally defined, meaning that it

    is nonzero on only a small interval.

  • 7/28/2019 97nach4

    36/83

    36

  • 7/28/2019 97nach4

    37/83

    37

    A Spline Approximation

    We can use B to construct a spline approximation to anarbitrary function f.

    Define the sequence of functions

  • 7/28/2019 97nach4

    38/83

    38

    xi=0.4h=0.05

    xi=0.75h=0.05

  • 7/28/2019 97nach4

    39/83

    39

    n+1 equations inn+3 unknowns

  • 7/28/2019 97nach4

    40/83

    40

    A Spline Approximation

    Now, we need to come up with two additional constraintsin order to eliminate two of the unknowns.

    Two common choices are The natural spline:

    A simple construction

    Leads to higher error near the end points

    The complete spline: Better approximation properties

    Do not actually require the derivative at the endpoints

  • 7/28/2019 97nach4

    41/83

    41

    Natural SplineFrom

    n-1

  • 7/28/2019 97nach4

    42/83

    42

    Complete SplineFrom

    n+1

  • 7/28/2019 97nach4

    43/83

    43

    Example 4.7

  • 7/28/2019 97nach4

    44/83

    44

  • 7/28/2019 97nach4

    45/83

    45

  • 7/28/2019 97nach4

    46/83

    46

  • 7/28/2019 97nach4

    47/83

    47

  • 7/28/2019 97nach4

    48/83

    48

    Example 4.8

  • 7/28/2019 97nach4

    49/83

    49

  • 7/28/2019 97nach4

    50/83

    50

  • 7/28/2019 97nach4

    51/83

    51

  • 7/28/2019 97nach4

    52/83

  • 7/28/2019 97nach4

    53/83

    4 9 A li ti S l ti f

  • 7/28/2019 97nach4

    54/83

    54

    4.9 Application: Solution of

    Boundary Value Exercises Consider the two-point boundary value problem:

    We construct the uniform grid of points:

    We now look for our approximation in the form of a cubic splinedefine on this grid.

    Consider the function:

  • 7/28/2019 97nach4

    55/83

    55

    The advantage of this approach is we can get a continuoussmooth function.

    Because we know the values of and its derivatives ateach of the nodes, we can easily reduce this to the systemof equations: (n+1 equations in n+3 unknown)

    where

  • 7/28/2019 97nach4

    56/83

    56

    We can eliminate the two extra unknowns by imposing

    the boundary conditions on the approximation:

    Substitute these into the first and last equations of therectangular system, we get

  • 7/28/2019 97nach4

    57/83

    57

    We are then left with the square system:

    where

  • 7/28/2019 97nach4

    58/83

    58

    Example 4.9

    h

  • 7/28/2019 97nach4

    59/83

    59

    where

    The solution we get

  • 7/28/2019 97nach4

    60/83

    60

    4 10 Least Squares Concepts in

  • 7/28/2019 97nach4

    61/83

    61

    4.10 Least Squares Concepts in

    Approximation

    4.10.1 An introduction to data fitting

  • 7/28/2019 97nach4

    62/83

    62

    Least Square Data Fitting

  • 7/28/2019 97nach4

    63/83

    63

  • 7/28/2019 97nach4

    64/83

    64

  • 7/28/2019 97nach4

    65/83

    65

    Example 4.10

  • 7/28/2019 97nach4

    66/83

    66

  • 7/28/2019 97nach4

    67/83

    67

    Example 4.11

  • 7/28/2019 97nach4

    68/83

    68

  • 7/28/2019 97nach4

    69/83

    69

  • 7/28/2019 97nach4

    70/83

  • 7/28/2019 97nach4

    71/83

    71

    4 10 2 Least Squares Approximation

  • 7/28/2019 97nach4

    72/83

    72

    4.10.2 Least Squares Approximation

    and Orthogonal Polynomials

    Let , we can seek such thatis minimized.

  • 7/28/2019 97nach4

    73/83

    73

    Inner Productions

    Inner productions of functions:

    Inner product on real vector spaces:

  • 7/28/2019 97nach4

    74/83

    74

    Inner Productions

  • 7/28/2019 97nach4

    75/83

    75

    The definition of inner product will allow us to apply anumber of ideas from linear algebra to the construction

    of approximations.

  • 7/28/2019 97nach4

    76/83

    76

    The system can be organized along matrix-vector linesas

    If our basis function satisfy the orthogonality condition

    the special basis functions that satisfy this equation arecalled orthogonal polynomials.

    Then the above matrix is a diagonal matrix, and we veryeasily have

  • 7/28/2019 97nach4

    77/83

    77

  • 7/28/2019 97nach4

    78/83

    78

    Orthogonal Polynomials Legendre polynomials:

    Example 4 12

  • 7/28/2019 97nach4

    79/83

    79

    Example 4.12

  • 7/28/2019 97nach4

    80/83

    80

  • 7/28/2019 97nach4

    81/83

    81

  • 7/28/2019 97nach4

    82/83

    82

    Example4.13

    4.11 Advanced Topics in

  • 7/28/2019 97nach4

    83/83

    4.11 Advanced Topics in

    Interpolation Error

    You can read it by yourselves.