Lecture Note 3: Interpolation and Polynomial Approximation. Xiaoqun Zhang Shanghai Jiao Tong University

Similar documents
Lecture Note 3: Polynomial Interpolation. Xiaoqun Zhang Shanghai Jiao Tong University

Chapter 3 Interpolation and Polynomial Approximation

Interpolation & Polynomial Approximation. Hermite Interpolation I

Lecture 10 Polynomial interpolation

Interpolation Theory

3.1 Interpolation and the Lagrange Polynomial

CHAPTER 4. Interpolation

(0, 0), (1, ), (2, ), (3, ), (4, ), (5, ), (6, ).

Numerical Analysis: Interpolation Part 1

Neville s Method. MATH 375 Numerical Analysis. J. Robert Buchanan. Fall Department of Mathematics. J. Robert Buchanan Neville s Method

Jim Lambers MAT 460/560 Fall Semester Practice Final Exam

MA2501 Numerical Methods Spring 2015

Chapter 4: Interpolation and Approximation. October 28, 2005

INTERPOLATION. and y i = cos x i, i = 0, 1, 2 This gives us the three points. Now find a quadratic polynomial. p(x) = a 0 + a 1 x + a 2 x 2.

Some notes on Chapter 8: Polynomial and Piecewise-polynomial Interpolation

We consider the problem of finding a polynomial that interpolates a given set of values:

Lectures 9-10: Polynomial and piecewise polynomial interpolation

Additional exercises with Numerieke Analyse

November 20, Interpolation, Extrapolation & Polynomial Approximation

Cubic Splines MATH 375. J. Robert Buchanan. Fall Department of Mathematics. J. Robert Buchanan Cubic Splines

1 Review of Interpolation using Cubic Splines

BSM510 Numerical Analysis

Interpolation and Approximation

Hermite Interpolation

Interpolation. Chapter Interpolation. 7.2 Existence, Uniqueness and conditioning

(f(x) P 3 (x)) dx. (a) The Lagrange formula for the error is given by

CS 450 Numerical Analysis. Chapter 8: Numerical Integration and Differentiation

Math Numerical Analysis Mid-Term Test Solutions

Data Analysis-I. Interpolation. Soon-Hyung Yook. December 4, Soon-Hyung Yook Data Analysis-I December 4, / 1

Outline. 1 Interpolation. 2 Polynomial Interpolation. 3 Piecewise Polynomial Interpolation

Polynomial Interpolation with n + 1 nodes

3 Interpolation and Polynomial Approximation

MATH ASSIGNMENT 07 SOLUTIONS. 8.1 Following is census data showing the population of the US between 1900 and 2000:

Preliminary Examination in Numerical Analysis

Numerical Analysis Preliminary Exam 10 am to 1 pm, August 20, 2018

Introduction Linear system Nonlinear equation Interpolation

University of Houston, Department of Mathematics Numerical Analysis, Fall 2005

Scientific Computing

Chapter 1 Numerical approximation of data : interpolation, least squares method

Chapter 2 Interpolation

NUMERICAL ANALYSIS I. MARTIN LOTZ School of Mathematics The University of Manchester. May 2016

On the positivity of linear weights in WENO approximations. Abstract

Applied Math 205. Full office hour schedule:

SPLINE INTERPOLATION

CS412: Introduction to Numerical Methods

Interpolation and extrapolation

Interpolation and the Lagrange Polynomial

Polynomial Interpolation

Integration, differentiation, and root finding. Phys 420/580 Lecture 7

Scientific Computing: An Introductory Survey

Computational Physics

Interpolation. 1. Judd, K. Numerical Methods in Economics, Cambridge: MIT Press. Chapter

CS 323: Numerical Analysis and Computing

Section 0.2 & 0.3 Worksheet. Types of Functions

Review. Numerical Methods Lecture 22. Prof. Jinbo Bi CSE, UConn

Curve Fitting and Interpolation

Applied Math for Engineers

LECTURE 16 GAUSS QUADRATURE In general for Newton-Cotes (equispaced interpolation points/ data points/ integration points/ nodes).

Introductory Numerical Analysis

Exam 2. Average: 85.6 Median: 87.0 Maximum: Minimum: 55.0 Standard Deviation: Numerical Methods Fall 2011 Lecture 20

Lagrange Interpolation and Neville s Algorithm. Ron Goldman Department of Computer Science Rice University

Input: A set (x i -yy i ) data. Output: Function value at arbitrary point x. What for x = 1.2?

Math 578: Assignment 2

A first order divided difference

x x2 2 + x3 3 x4 3. Use the divided-difference method to find a polynomial of least degree that fits the values shown: (b)

1 Lecture 8: Interpolating polynomials.

you expect to encounter difficulties when trying to solve A x = b? 4. A composite quadrature rule has error associated with it in the following form

Interpolation. P. Sam Johnson. January 30, P. Sam Johnson (NITK) Interpolation January 30, / 75

Notes on the Matrix-Tree theorem and Cayley s tree enumerator

Numerical interpolation, extrapolation and fi tting of data

Lösning: Tenta Numerical Analysis för D, L. FMN011,

Linear Systems and Matrices

2

Legendre s Equation. PHYS Southern Illinois University. October 18, 2016

MA 3021: Numerical Analysis I Numerical Differentiation and Integration

Numerical integration and differentiation. Unit IV. Numerical Integration and Differentiation. Plan of attack. Numerical integration.

Scientific Computing: Numerical Integration

Math 660-Lecture 15: Finite element spaces (I)

NUMERICAL METHODS. x n+1 = 2x n x 2 n. In particular: which of them gives faster convergence, and why? [Work to four decimal places.

Polynomial Interpolation

Intro Polynomial Piecewise Cubic Spline Software Summary. Interpolation. Sanzheng Qiao. Department of Computing and Software McMaster University

Numerical Methods. King Saud University

Bindel, Spring 2012 Intro to Scientific Computing (CS 3220) Week 12: Monday, Apr 16. f(x) dx,

CHAPTER 10 Shape Preserving Properties of B-splines

n 1 f n 1 c 1 n+1 = c 1 n $ c 1 n 1. After taking logs, this becomes

' Liberty and Umou Ono and Inseparablo "

Review I: Interpolation

Approximation theory

Lecture 3: Basics of set-constrained and unconstrained optimization

Exam in TMA4215 December 7th 2012

Numerical Methods I Orthogonal Polynomials

Fixed point iteration and root finding

Application of modified Leja sequences to polynomial interpolation

Math Numerical Analysis

Finite Elements. Colin Cotter. January 18, Colin Cotter FEM

APPM/MATH Problem Set 6 Solutions

Numerical Programming I (for CSE)

Spring 2012 Introduction to numerical analysis Class notes. Laurent Demanet

Applied Numerical Analysis Quiz #2

Applied Numerical Analysis (AE2220-I) R. Klees and R.P. Dwight

Transcription:

Lecture Note 3: Interpolation and Polynomial Approximation Xiaoqun Zhang Shanghai Jiao Tong University Last updated: October 10, 2015

2

Contents 1.1 Introduction................................ 3 1.1.1 Existence and Uniqueness of polynomial interpolation.... 4 1.2 Lagrange Formula............................ 6 1.3 Neville s method............................. 8 1.4 Newton s divided difference....................... 9 1.4.1 Properties and Derivation of Newton s divided difference... 11 1.4.2 Newton s divided difference formula with equi-spaced nodes. 13 1.4.3 Error Analysis of Polynomial interpolation.......... 14 1.4.4 Runge Phenomenon....................... 16 1.5 Hermit interpolation........................... 17 1.5.1 Hermite interpolation by Newton divided difference..... 18 1.6 Cubic spline interpolation........................ 19 1.7 Further reading.............................. 20 1.1 Introduction We first look at some examples. Lookup table for f(x) = 2 π x 0 e x2 dx f(0.520) = 0.53790, f(0.521) = 0.53876 f(0.522) = 0.53962, f(0.523) = 0.54048 No f(0.52136) or f(0.52218). How should we do? Census of population: 1940 132165 1950 151326 1960 179323 1970 203302 1980 226542 1990 249633 There is no record for 1965. How to predict it? General questions: Let (x 0, y 0 ), (x 1, y 1 ),..., (x n, y n ) be given. Given a x which is not in {x 0, x 1,..., x n }, what is the corresponding y? Find a function f(x) such that y 0 = f(x 0 ), y 1 = f(x 1 ),..., y n = f(x n ). 3

It s hard. There are too many functions. One solution is to use polynomials since polynomials have nice properties. Polynomial Interpolation: find a polynomial p(x) such that p(x 0 ) = y 0, p(x 1 ) = y 1,..., p(x n ) = y n Theorem 1 (Weierstrass approximation theorem) Suppose that f is defined and continuous on [a, b]. For each ɛ > 0, there exists a polynomial p(x), with the property that f(x) p(x) < ɛ, for all x [a, b] 1.1.1 Existence and Uniqueness of polynomial interpolation Questions on polynomial interpolation: Does such a polynomial exist? Generally, you can not find a linear function to interpolate 3 points. If yes, what is the degree? Is it unique? 2 points, linear; 3 points, quadratic; 4 points cubic;... What is a formula for producing p(x) from the given coordinates? Given (x 0, y 0 ),..., (x n, y n ). Polynomial representation p(x) = a 0 + a 1 x + a 2 x 2 +... + a m x m We want to find a 0, a 1,..., a m. m + 1 parameters, n + 1 conditions (p(x i ) = y i ) It is reasonable to try first with n = m. So we want to find a 0, a 1,..., a m such that a 0 + a 1 x 0 + a 2 x 2 0 +... + a n x n 0 = y 0 a 0 + a 1 x 1 + a 2 x 2 1 +... + a n x n 1 = y 1 a 0 + a 1 x n + a 2 x 2 n +... + a n x n n = y n Write it into a system of linear equations 1 x 0 x 2 0... x n 0 a 0 y 0 1 x 1 x 2 1... x n 1 a 1 y 1 1 x 2 x 2 2... x n 2 a 2 = y 2..... 1 x n x 2 n... x n n a n y n 4.

X a = y X Vandermonde matrix. There exists a unique vector such that X a = y is equivalent to det(x) 0. Some fundamental theorems of Algebra (refer to Section 2.6 in the textbook) Theorem 2 If P (x) is a polynomial of degree n 1 with real or complex coefficients, then there exist unique constants x 1,, x k, possibly complex, and unique positive integers m 1, m 2, m k such that k i=1 m i = n and P (x) = a n (x x 1 ) m1 (x x k ) m k Theorem 3 Let P (x) and Q(x) be polynomials of degree at most n. If x 1,, x k, with k > n are distinct numbers with P (x i ) = Q(x i ) for i = 1, 2,, k, then P (x) = Q(x) for all values of x. Theorem 4 Given n + 1 distinct points x 0, x 1,..., x n and the corresponding y 0, y 1,..., y n, there is a polynomial p(x) of degree n such that p(x 0 ) = y 0, p(x 1 ) = y 1,..., p(x n ) = y n. This polynomial is unique among the set of all polynomials of degree n. Why degree n and not n? Why this set? Proof. We will prove that det(x) 0. Let 1 x 0 x 2 0... x n 0 1 x 1 x 2 1... x n 1 1 x 2 x 2 2... x n 2 V n (x) =... 1 x n 1 x 2 n 1... x n n 1 1 x x 2... x n so that X = V n (x n ). We have the claims: 1. V n (x) is a polynomial of degree n. 2. The roots are x 0, x 1,..., x n 1. 3. The coefficients of the term x n is V n 1 (x n 1 ). by 5

1. Expand the last row by minor. 2. If two row are the same then det(x) = 0. So V n (x) = (x x 0 )(x x 1 )... (x x n 1 )V n 1 (x n 1 ). By induction, [ ] 1 x0 V 1 (x 1 ) = det = (x 1 x 1 x 0 ) 1 V 2 (x 2 ) = (x 2 x 0 )(x 2 x 1 )(x 1 x 0 ) V 3 (x 3 ) = (x 3 x 0 )(x 3 x 1 )(x 3 x 2 )... V n (x n ) = Π 0 i<j n (x j x i ). Since x 0,..., x n are distinct, det(x) = V n (X n ) 0. 1.2 Lagrange Formula Find a polynomial P n (x) of order n passes through Method of undetermined coefficients: Need to solve (x 0, y 0 ), (x 1, y 1 ), (x 2, y 2 ),... (x n, y n ). P n (x) = a 0 + a 1 x + a 2 x 2 +... + a n x n. X a = y. Computational cost is high. Gaussian Elimination O(n 3 ). Find fast solvers of the linear equation or explicit expression of a. Use bases other than {1, x, x 2,..., x n }. Two points case: (x 0, y 0 ), (x 1, y 1 ). Construct two linear functions (polynomials of order 1) L 1,0 (x) and L 1,1 (x) such that: L 1,0 (x 0 ) = 1 L 1,0 (x 1 ) = 0 and Then, let We have L 1,1 (x 0 ) = 0 L 1,1 (x 1 ) = 1. P 1 (x) = y 0 L 1,0 (x) + y 1 L 1,1 (x) P 1 (x 0 ) = y 0 L 1,0 (x 0 )+y 1 L 1,1 (x 0 ) = y 0 P 1 (x 1 ) = y 0 L 1,0 (x 1 )+y 1 L 1,1 (x 1 ) = y 1. 6

Construct L 1,0 (x): L 1,0 (x) = x x 1 x 0 x 1 ; L 1,1 (x) = x x 0 x 1 x 0. Generalizing this idea to more points, we get Lagrange formula. Given (x 0, y 0 ), (x 1, y 1 ),... (x n, y n ). Construct polynomials L 0 (x), L 1 (x),..., L n (x) of order n such that L n,0 (x 0 ) = 1, L n,0 (x 1 ) = 0, L n,0 (x 2 ) = 0,... L n,0 (x n ) 0. L n,1 (x 0 ) = 0, L n,1 (x 1 ) = 1, L n,1 (x 2 ) = 0,... L n,1 (x n ) 0... L n,i (x i ) = 1, L n,i (x j ) = 0, j i. L n,n (x 0 ) = 0, L n,n (x 1 ) = 0,... L n,n (x n 1 ) = 0, L n,n (x n ) 1. Then construct P n (x) by n P n (x) = y i L n,i (x). i=0 We have P n (x i ) = y i. x 1, x 2,..., x n are the n roots of L n,0 (x), so where C is a constant. To find C, we use L n,0 (x 0 ) = 1. L n,0 (x) = C(x x 1 )(x x 2 )... (x x n ), 1 = L n,0 (x 0 ) = C(x x 1 )(x x 2 )... (x x n ). So Therefore, C = 1 (x 0 x 1 )(x 0 x 2 )... (x 0 x n ) L n,0 (x) = (x x 1)(x x 2 )... (x x n ) (x 0 x 1 )(x 0 x 2 )... (x 0 x n ) = n j=1 (x x j) n j=1 (x 0 x j ) Similarly, n j=0,j i L n,i (x) = (x x j) n j=0,j i (x i x j ) 7

Use a graph to illustrate it. Lagrange formula: Given (x 0, y 0 ), (x 1, y 1 ),..., (x n, y n ). Define n n j=0,j i P n (x) = y i (x x j) n j=0,j i (x i x j ). i=0 Example: x 0 = 1, x 1 = 2, x 2 = 4 and the correspondences y 0 = 8, y 1 = 1 and y 2 = 5. Find the polynomial p(x) of order 2 such that y 0 = p(x 0 ), y 1 = p(x 1 ), y 2 = p(x 2 ). (x 2)(x 4) P 2 (x) = 8 (1 2)(1 4) Drawbacks of Lagrange interpolation. 1. Given x, need O(n 2 ) to get P n (x). 1)(x 4) 1)(x 2) +1(x +5(x (2 1)(2 4) (4 1)(4 2) = 3x2 16x+21 2. No part of the previous calculation can be used. Interpolation for additional values of x requires the same amount of effort as the first value. 3. If we want to add a new point (x n+1, y n+1 ) or delete a point, all the basis L n,i (x) should be changed. 1.3 Neville s method Idea: use previous calculation and generate recursively Lagrange polynomial approximations. Definition 1 Let f be a function defined at x 0, x 1,, x 2,, x n, and suppose that m 1, m 2,, m k are k distinct integers, with 0 m i n for each i. The Lagrange polynomial that agrees with f(x) at the k points x m1, x m2,, x mk is denoted P m1,,m k (x). Theorem 5 Let f be defined at x 0, x 1,, x k, and let x j and x i be two distinct numbers in this set. Then P (x) = (x x j)p 0,1,,j 1,j+1,,k (x) (x x i )P 0,1,,i 1,i+1,,k (x) x i x j (1.1) describes the k-th Lagrange polynomial that interpolates f at the k + 1 points x 0, x 1,, x k. Proof.: Main idea: check the two conditions 1. If P (x) is a polynomial of degree at most k. 8

2. If P (x i ) = y i for any i = 0,, k. Remarks The formula (1.1) is generated as an interpolation of two points (x j, P 0,1,,j 1,j+1,,k (x)) and (x i, P 0,1,,i 1,i+1,,k (x)). For ease of notation, let Q i,j = P i j,i j+1,,i denotes the interpolating polynomial of degree j on the j + 1 numbers x i j,, x i 1, x i. Neville s table x 0 P 0 = Q 0,0 x 1 P 1 = Q 1,0 P 0,1 = Q 1,1 x 2 P 2 = Q 2,0 P 1,2 = Q 2,1 P 0,1,2 = Q 2,2 x 1 P 3 = Q 3,0 P 2,3 = Q 3,1 P 1,2,3 = Q 3,2 P 0,1,2,3 = Q 3,3 x 1 P 4 = Q 4,0 P 3,4 = Q 4,1 P 2,3,4 = Q 4,2 P 1,2,3,4 = Q 4,3 P 0,1,2,3,4 = Q 4,4 Neville s Algorithm INPUT: numbers x, x 0,, x n ; values f(x 0 ),, f(x n ) as the first column Q 0,0, Q 1,0,, Q n,0 of Q. OUTPUT: the table Q with P (x) = Q n,n. For i = 1, 2,, n for j = 1, 2,, i Output (Q). Stop. set Q i,j = (x xi j)qi,j 1 (x xi)qi 1,j 1 x i x i j. 1.4 Newton s divided difference method of undetermined coefficient: bases {1, x, x 2,..., x n }. Expand P n (x) = a 0 + a 1 x + a 2 x 2 +... + a n x n. Need to solve a system linear equation to get a i. Each basis doesn t depend on given points. Lagrange: bases {L n,i (x)}, L i (x) are polynomials of degree n and L n,i (x i ) = 1, L n,i (x j ) = 0, j i. 9

L n,i (x) = n j=0,j i (x xj) n j=0,j i (xi xj). The corresponding coefficient is y i. Each basis depends on x 0, x 1,..., x i 1, x i+1,..., x n. Less flexibility when a new point (x i+1, y i+1 ) is added. Newton s divided difference Each basis depends on part of the given points. More flexibility when a new point (x i+1, y i+1 ) is added. Newton s divided difference: bases {1, x x 0, (x x 0 )(x x 1 ),..., (x x 0 )(x x 1 )... (x x n 1 )}. We assume P n (x) = c 0 +c 1 (x x 0 )+c 2 (x x 0 )(x x 1 )+...+c n (x x 0 )(x x 1 )... (x x n 1 ). We need to find c i. For c 0, Then, For c 1, So y 0 = P n (x 0 ) = c 0 = c 0 = y 0. P n (x) = y 0 + c 1 (x x 0 ) +... y 1 = P n (x 1 ) = y 0 + c 1 (x 1 x 0 ) c 1 = y 1 y 0 x 1 x 0 For c 2, y 2 = P n (x 2 ) = y 0 + c 1 (x 2 x 0 ) + c 2 (x 2 x 0 )(x 2 x 1 ) So c 2 = y 2 y 0 c 1 (x 2 x 0 ) (x 2 x 0 )(x 2 x 1 ) And so on. Example: (x 0, y 0 ) = (1, 8), (x 1, y 1 ) = (2, 1), (x 2, y 2 ) = (4, 5). c 0 = y 0 = 8. c 1 = (y 1 b 0 )/(x 1 x 0 ) = 7 c 2 = y 2 y 0 b 1 (x 2 x 0 ) (x 2 x 0 )(x 2 x 1 ) = 3. P n (x) = 8 7(x 1) + 3(x 1)(x 2) 10

There exists a closed form for c i, i = 0,..., n. Define f[x i ] = y i f[x i, x i+1 ] = f[x i+1] f[x i ] x i+1 x i f[x i, x i+1, x i+2 ] = f[x i+1, x i+2 ] f[x i, x i+1 ] x i+2 x i f[x i, x i+1, x i+2, x i+3 ] = f[x i+1, x i+2, x i+3 ] f[x i, x i+1, x i+2 ] x i+3 x i The proof will be delayed... c 0 = f[x 0 ] c 1 = f[x 0, x 1 ] c i = f[x 0, x 1,..., x i ] c n = f[x 0, x 1,..., x n ] Divided difference table: x 1 f[x 1 ] f[x 1, x 2 ] x 2 f[x 2 ] f[x 1, x 2, x 3 ] f[x 2, x 3 ] f[x 1, x 2, x 3, x 4 ] x 3 f[x 3 ] f[x 2, x 3, x 4 ] f[x 1, x 2, x 3, x 4, x 5 ] f[x 3, x 4 ] f[x 2, x 3, x 4, x 5 ] x 4 f[x 4 ] f[x 3, x 4, x 5 ] f[x 4, x 5 ] x 5 f[x 5 ] Example: 1 8-7 2 1 3 2 4 5 Example: Give the example of interpolating f(x) = x on 2, 2.1, 2.2, 2.3, 2.4. 11

1.4.1 Properties and Derivation of Newton s divided difference We recall Newton s divided difference formula: P n (x) = f[x 0 ] + f[x 0, x 1 ](x x 0 ) + f[x 0, x 1, x 2 ](x x 0 )(x x 1 )+... + f[x 0,..., x n ](x x 0 )(x x 1 )... (x x n 1 ) Note that adding a new point (x n+1, y n+1 ) we have to add a new line in the divided difference table to get f[x 0,..., x n+1 ]. add a new term f[x 0,..., x n+1 ](x x 0 )(x x 1 )... (x x n ) into the expression of P n (x) to get P n+1. The derivation of Newton divided difference formula is given in the the following theorem Theorem 6 The unique polynomial of order n that passes through (x 0, y 0 ), (x 1, y 1 ),..., (x n, y n ) is given by P n (x) = f[x 0 ] + f[x 0, x 1 ](x x 0 ) + f[x 0, x 1, x 2 ](x x 0 )(x x 1 ) +... + f[x 0,..., x n ](x x 0 )(x x 1 )... (x x n 1 ) Proof. We prove it by induction. The unique polynomial of order 0 that passes through (x 0, y 0 ) is obviously P 0 (x) = y 0 = f[x 0 ]. is Suppose that the polynomial P k (x) of order k that passes through (x 0, y 0 ),(x 1, y 1 ),..., (x k, y k ) P k (x) = f[x 0 ] + f[x 0, x 1 ](x x 0 ) + f[x 0, x 1, x 2 ](x x 0 )(x x 1 )+... + f[x 0,..., x k ](x x 0 )(x x 1 )... (x x k 1 ) Let P k+1 (x) be the unique polynomial of order k that passes through (x 0, y 0 ), (x 1, y 1 ),..., (x k, y k ), (x k+1, y k+1 ). We claim that P k+1 (x) P k (x) = C(x x 0 )... (x x k ). In fact since both P k+1 (x) and P k (x) pass through the points (x 0, y 0 ),... (x k, y k ), thus x 0,..., x k are zeros of P k+1 (x) P k (x). By the fundamental theorem of algebra, we obtain the above equality. Thus P k+1 (x) = f[x 0 ] + f[x 0, x 1 ](x x 0 ) + f[x 0, x 1, x 2 ](x x 0 )(x x 1 ) +... + f[x 0,..., x k ](x x 0 )(x x 1 )... (x x k 1 ) + C(x x 0 )(x x 1 )... (x x k 1 )(x x k ) 12

We only need to show that C = f[x 0, x 1,..., x k, x k+1 ]. For this, let Q k (x) be the unique polynomial of order k that passes through (x 1, y 1 ),..., (x k, y k ), (x k+1, y k+1 ). Define R(x) = P k (x) + x x 0 x k+1 x 0 (Q k (x) P k (x)) Then, R(x) is a polynomial. The order of R(x) is k + 1. R(x 0 ) = P k (x 0 ) = y 0, R(x i ) = P k (x i )+ xi x0 x k+1 x 0 (Q k (x i ) P k (x i )) = P k (x i ) = y i, i = 1,..., k, R(x k+1 ) = Q k (x k+1 ) = y k+1. By the uniqueness, R(x) = P k+1 (x). The leading coefficient of P k+1 (x) is C, while the leading coefficient of R(x) is x x the leading coefficient of 0 x k+1 x 0 (Q k (x) P k (x)), which is 1 x k+1 x 0 (leading coefficient of Q k (x) leading coefficient of P k (x)). On the other hand, the leading coefficient of Q k (x) is f[x 1,..., x k+1 ], and the leading coefficient of P k (x) is f[x 0,..., x k ]. So C = f[x 1,..., x k+1 ] f[x 0,..., x k ] x k+1 x 0 = f[x 0, x 1,..., x k+1 ] Note: f[x 0, x 1,..., x n ] is independent of the order of x 0,..., x n, since it is the leading coefficient of the polynomial P n (x). 1.4.2 Newton s divided difference formula with equi-spaced nodes Let h = x i+1 x i, for each i = 0, 1,, n 1 and let x = x 0 + sh. Then the difference x x i = (s i)h. Thus the formula becomes P n (x) =P n (x 0 + sh) = f[x 0 ] + shf[x 0, x 1 ] + s(s 1)h 2 f[x 0, x 1, x 2 ] + + s(s 1)(s n + 1)h n f[x 0, x 1,, x k ] n = s(s 1) (s k + 1)h k f[x 0, x 1,, x k ] k=0 =f[x 0 ] + n k=1 ( s k) k!h k f[x 0, x i,, x k ] (1.2) 13

where ( ) s s(s 1) (s k + 1) = k k! is the generalized binomial coefficient notation. This formula (1.2) is called the Newton forward divided difference formula. Now we define Forward difference operator f(x i ) = f(x i+1 ) f(x i ) Higher power k f(x i ) are defined recursively by k f(x i ) = ( k 1 f(x i )), for k 2. Using the notation, the forward divided difference is denoted as and in general f[x 0, x 1 ] = f(x 1) f(x 0 ) x 1 x 0 = 1 h f(x 0) f[x 0, x 1, x 2 ] = 1 f(x 1 ) f(x 0 ) = 1 2h x 1 x 0 2h 2 2 f(x 0 ) f[x 0, x 1,, x k ] = 1 k!h k k f(x 0 ) Newton forward difference formula P n (x) = f(x 0 ) + n k=1 ( s k) k f(x 0 ) If the interpolating nodes are reordered, we can get the back divided difference formula and center-difference formula similarly. Backward difference operator: f(x i ) = f(x i ) f(x i 1 ) for i 1. Similarly k f(x i ) = ( k 1 f(x i )) and P n (x) = f(x n ) + n ( ) ( 1) k s k f(x k n ) k=1 14

1.4.3 Error Analysis of Polynomial interpolation We are given x 0, x 1,..., x n, and the corresponding function values f(x 0 ), f(x 1 ),..., f(x n ), but we do not know the expression for the function. Let P n (x) be the polynomial of order n that passes through the n + 1 points (x 0, f(x 0 )), (x 1, f(x 1 )),..., (x n, f(x n )). Questions: What is the error between f(x) and P (x) even we don t know f(x) in advance? Lemma 1 Suppose that x 0, x 1,..., x m are distinct numbers. Let a = min i x i and b = max i x i. Suppose f C m [a, b]. Then, there exist ξ (a, b) such that f[x 0, x 1, x 2,..., x m ] = f (m) (ξ) m! Proof. Let P m (x) be the polynomial that passes through (x 0, f(x 0 )),..., (x m, f(x m )). Then, the function f(x) P m (x) has m + 1 zeros at x 0, x 1,..., x m. So, has m zeros. has m 1 zeros, and so on. has one zero. Denote that zero by ξ. f (x) P m(x) f (x) P m(x) f (m) (x) P m (m) (x) f (m) (ξ) = P m (m) (ξ) P m (x) is a polynomial of order m. Therefore, P (m) m (x) = m!f[x 0,..., x m ] (Recall f[x 0,..., x m ] is the leading coefficient.) We get f (m) (ξ) = P (m) m (ξ) = m!f[x 0,..., x m ]. 15

Theorem 7 Suppose that x 0, x 1,..., x n are distinct numbers in [a, b] and f C n+1 [a, b]. Let P n (x) be the unique polynomial of order n that passes through Then, such that (x 0, f(x 0 )), (x 1, f(x 1 )),..., (x n, f(x n )) x [a, b], ξ(x) (a, b) f(x) P n (x) = f (n+1) (ξ(x)) (x x 0 )(x x 1 )... (x x n ). (n + 1)! Proof. We use Newton s divided difference formula to prove it. You can also use Lagrange formula to prove it as shown in the book. If x = x i, i = 0,..., n, it obviously holds. For any z x i, i = 0,..., n, the polynomial of order n+1 that passes through is (x 0, f(x 0 )), (x 1, f(x 1 )),..., (x n, f(x n )), (z, f(z)) Q(x) =f[x 0 ] + f[x 0, x 1 ](x x 0 ) +... + f[x 0, x 1,..., x n ](x x 0 )(x x 1 )... (x x n 1 ) + f[x 0, x 1,..., x n, z](x x 0 )(x x 1 )... (x x n 1 )(x x n ) The polynomial Q(x) passes through (z, f(z)), so f(z) = Q(z) =f[x 0 ] + f[x 0, x 1 ](z x 0 ) +... + f[x 0, x 1,..., x n ](z x 0 )(z x 1 )... (z x n 1 ) + f[x 0, x 1,..., x n, z](z x 0 )(z x 1 )... (z x n 1 )(z x n ) Replace z by x, we get another expression for f(x) as f(x) =f[x 0 ] + f[x 0, x 1 ](x x 0 ) +... + f[x 0, x 1,..., x n ](x x 0 )(x x 1 )... (x x n 1 ) + f[x 0, x 1,..., x n, x](x x 0 )(x x 1 )... (x x n 1 )(x x n ) = P n (x) + f[x 0, x 1,..., x n, x](x x 0 )(x x 1 )... (x x n 1 )(x x n ). By the lemma, there exists ξ (a, b) So, f[x 0, x 1,..., x n, x] = f (n+1) (ξ) (n + 1)!. f(x) = P n (x) + f (n+1) (ξ) (n + 1)! (x x 0)(x x 1 )... (x x n ) Note that the error is related to The maximum value of f (n+1) (x). This can be very large. (Runge Phenomenon) When x is out of [a, b], the error can be very large. (Interpolation vs extrapolation) 16

1.4.4 Runge Phenomenon Polynomial approximation may be very poor. 1 Example: f(x) = 1+25x on [ 1, 1]. It is in C. See the plot of f and the 2 interpolation polynomial P 12 (x) with 13 equispaced data in [ 1, 1]. We can see that Figure 1.1: Runge Pheonmenon 1. The error around 1 and 1 becomes larger and larger as n increases. P 12 (0.96) 3.5637, but f(0.96) 0.04. 2. The polynomial becomes more oscillating as n increases. This is called Runge s Phenomenon. In practice, the highest degree to be used is 3. Solution: piecewise interpolation (Hermit interpolation, spline interpolation), Chebyshev nodes (Gaussian quadrature). 1.5 Hermit interpolation Osculating polynomials generalize both Taylor polynomials and the Lagrange polynomials. Definition 2 (Osculating interpolation) Suppose that we are given n + 1 distinct numbers x 0, x 1, x n in [a, b] and nonnegative integers m 0, m 1,, m n, and m = max{m 0,, m n }. The osculating polynomial approximating a function f C m [a, b] at x i, for each i = 0,, n, is the polynomial of least degree such that d k P (x i ) dx k = dk f(x i ) dx k 17

for each i = 0,, n and k = 0,, m i. If n = 0, the polynomial approximating f is m 0 -th Taylor polynomial for f at x 0. When m i = 0 for each i, the osculating polynomial is the n-th Lagrange polynomial interpolating f on x 0, x 1, x n. The case when m i = 1 for each i = 0, 1, n gives the Hermite polynomials: agree with f and f at x 0,, x n. Theorem 8 If f C 1 [a, b] and x 0,, x n [a, b] are distinct, the unique polynomial of degree at most 2n + 1 given by H 2n+1 (x) = n f(x j )H n,j (x) + j=0 n f (x j )Ĥn,j(x) where H n,j (x) = [1 2(x x j )L n,j (x j)]l n,j (x) 2 and Ĥn,j(x) = (x x j )L n,j (x) 2. In this context, L n,j denotes the j-th Lagrange coefficients polynomial. Moreover, if f C 2n+2 [a, b], then for some ξ with a < ξ < b. j=0 f(x) = H 2n+1 (x) + (x x 0) 2 (x x n ) 2 f (2n+2) (ξ) (2n + 2)! Scratch of proof: 1) show that H n,j (x i ) = δ ij and Ĥn,j(x i ) = 0 for any i, j. 2) Show that H n,j (x i) = 0 and Ĥ n,j (x i) = δ i,j. Although the above theorem provides a complete description of the Hermite polynomials, the computation is too tedious even for small n. Alternative method: use Newton divided difference formula. 1.5.1 Hermite interpolation by Newton divided difference Suppose that the distinct numbers (x i, f(x i ), f (x i )) for i = 0,, n are given. Procedure: Define a new sequence z 0, z 1, z 2n+1 by z 2i = z 2i+1 = x i, for each i = 0,, 1, n Compute first order divided difference for z i. Since z 2i = z 2i+1 = x i, f[z 2i, z 2i+1 ] is not defined. Instead, set f[z 2i, z 2i+1 ] = f (z 2i ) = f (x i )for each i = 0,, 1, n The remainning divided differences are produced as usual divided difference. 18

The Hermite polynomial is given by 2n+1 H 2n+1 = f[z 0 ] + f[z 0,, z k ](x x 0 )(x z 1 ) (x z k 1 ) k=1 See divided difference table for n = 2. z f(z) 1st divided differences 2nd divided z 0 = x 0 f[z 0 ] = f(x 0 ) f[z 0, z 1 ] = f (x 0 ) z 1 = x 0 f[z 1 ] = f(x 0 ) f[z 0, z 1, z 2 ] = f[z1,z2] f[z0,z1] z 2 z 0 f[z 1, z 2 ] = f[z2] f[z1] z 2 z 1 z 2 = x 1 f[z 2 ] = f(x 1 ) f[z 1, z 2, z 3 ] = f[z2,z3] f[z1,z2] z 3 z 1 f[z 2, z 3 ] = f (x 1 ) z 3 = x 1 f[z 3 ] = f(x 1 ) f[z 2, z 3, z 4 ] = f[z3,z4] f[z2,z3] z 4 z 2 f[z 3, z 4 ] = f[z4] f[z3] z 4 z 3 z 4 = x 2 f[z 4 ] = f(x 2 ) f[z 3, z 4, z 5 ] = f[z4,z5] f[z3,z4] z 5 z 3 f[z 4, z 5 ] = f (x 2 ) z 5 = x 2 f[z 5 ] = f(x 2 ) 1.6 Cubic spline interpolation Oscillatory nature of high degree polynomial, and a fluctuation over a small portion can induce large error over the entire range, restricts their use. Alternative approach is to divide the interval into a collection of subintervals and construct different approximating polynomial on each subinterval. Approximation of this type is called piecewise-polynomial approximation. The most commmon piecewise polynomial approximation uses cubic polynomials between each successive pair of nodes and is called cubic spline interpolation. Definition 3 Given a function f defined on [a, b] and a set of nodes a = x 0 < x 1 < < x n = b, a cubic spline interpolant S for f is a function that satisfies the following conditions S(x) a cubic polynomial, denotes S j (x), on the subinterval [x j, x j+1 ] for each j = 0, 1,, n 1. (piecewise cubic polynomails) S j (x j ) = f(x j ) and S j (x j+1 ) = f(x j+1 ) for each j = 0, 1, n 1. (interpolate on each interval). This also implies S j+1 (x j+1 ) = S j (x j+1 ) for each j = 0, 1, n 2. S j+1 (x j+1) = S j (x j+1) for each j = 0, 1,, n 2 S j+1 (x j+1) = S j (x j+1) for each j = 0, 1,, n 2 One of the following sets of boundary conditions is satisfies : 19

S (x 0 ) = S (x n ) = 0 (free or natural boundary) S (x 0 ) = f (x 0 ) and S (x n ) = f (x n ) (clamped boundary) Remark: Cubic spline can be constructed as S j (x) = a j + b j (x x j ) + c j (x x j ) 2 + d j (x x j ) 2 for j = 0,, n 1. Determine the coefficients by using the conditions listed above. Theorem 9 If f is defined at a = x 0 < x 1 < < x n = b, then f has a unique natural spline interpolant S on the nodes x 0, x 1,, x n. Theorem 10 If f is defined at a = x 0 < x 1 < < x n = b, then f has a unique clamped spline interpolant S on the nodes x 0, x 1,, x n. 1.7 Further reading Parametric curves: represent general curves by using a parameter to express both the x- and y- coordinate variables. Bezier curves: cubic spline for both x and y coordinates Survey of methods and software: spline functions. Matlab and Maple interp, polyfit, 20