Chapter 3 Interpolation and Polynomial Approximation

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

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

Interpolation & Polynomial Approximation. Hermite Interpolation I

3.1 Interpolation and the Lagrange Polynomial

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

Interpolation Theory

Jim Lambers MAT 460/560 Fall Semester Practice Final Exam

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

Chapter 1 Mathematical Preliminaries and Error Analysis

MA2501 Numerical Methods Spring 2015

Hermite Interpolation

3 Interpolation and Polynomial Approximation

Polynomial Interpolation with n + 1 nodes

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

Preliminary Examination in Numerical Analysis

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

November 20, Interpolation, Extrapolation & Polynomial Approximation

UNIT-II INTERPOLATION & APPROXIMATION

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

Two hours. To be provided by Examinations Office: Mathematical Formula Tables. THE UNIVERSITY OF MANCHESTER. 29 May :45 11:45

Lecture 10 Polynomial interpolation

Interpolation and the Lagrange Polynomial

Interpolation and Approximation

1 Multiply Eq. E i by λ 0: (λe i ) (E i ) 2 Multiply Eq. E j by λ and add to Eq. E i : (E i + λe j ) (E i )

Applied Numerical Analysis Quiz #2

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

A first order divided difference

Math Numerical Analysis Mid-Term Test Solutions

Computational Physics

SPLINE INTERPOLATION

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

Chapter 1 Vector Spaces

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

Numerical Analysis: Interpolation Part 1

Math 104A - Homework 3

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

Curve Fitting and Interpolation

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

Interpolation and Polynomial Approximation I

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

Introductory Numerical Analysis

Math 578: Assignment 2

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.

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

Lectures 9-10: Polynomial and piecewise polynomial interpolation

1 Review of Interpolation using Cubic Splines

1 Lecture 8: Interpolating polynomials.

CHAPTER 4. Interpolation

Interpolating Accuracy without underlying f (x)

Scientific Computing

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

Cubic Spline. s(x) = s j (x) = a j + b j (x x j ) + c j (x x j ) 2 + d j (x x j ) 3, j = 0,... n 1 (1)

Fall 2014 MAT 375 Numerical Methods. Numerical Differentiation (Chapter 9)

Numerical Methods I: Polynomial Interpolation

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

A Note on Multiplicity Weight of Nodes of Two Point Taylor Expansion

1 Piecewise Cubic Interpolation

Approximation theory

Interpolation. Chapter Interpolation. 7.2 Existence, Uniqueness and conditioning

MA 3021: Numerical Analysis I Numerical Differentiation and Integration

Convergence rates of derivatives of a family of barycentric rational interpolants

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

2

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

Chapter 2 Interpolation

Cubic Splines. Antony Jameson. Department of Aeronautics and Astronautics, Stanford University, Stanford, California, 94305

Lecture 1 INF-MAT : Chapter 2. Examples of Linear Systems

Mathematics for Engineers. Numerical mathematics

Additional exercises with Numerieke Analyse

Numerical Marine Hydrodynamics

Taylor Series and Numerical Approximations

Newton s Method and Linear Approximations

The problems that follow illustrate the methods covered in class. They are typical of the types of problems that will be on the tests.

A technique for DDA seed shifting and scaling

INTERPOLATION Background Polynomial Approximation Problem:

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)

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

Math 473: Practice Problems for Test 1, Fall 2011, SOLUTIONS

COURSE Numerical integration of functions

Piecewise Polynomial Interpolation

Lecture 1 INF-MAT3350/ : Some Tridiagonal Matrix Problems

CS412: Introduction to Numerical Methods

Mathematical Olympiad Training Polynomials

Numerical Analysis: Approximation of Functions

FINITE DIFFERENCES. Lecture 1: (a) Operators (b) Forward Differences and their calculations. (c) Backward Differences and their calculations.

Empirical Models Interpolation Polynomial Models

Integer-Valued Polynomials

Newton s Method and Linear Approximations

Linear Systems and Matrices

Piecewise Polynomial Interpolation

Chapter 5: Numerical Integration and Differentiation

LEAST SQUARES APPROXIMATION

On the positivity of linear weights in WENO approximations. Abstract

Newton's forward interpolation formula

Solutions 2. January 23, x x

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.

MATH3283W LECTURE NOTES: WEEK 6 = 5 13, = 2 5, 1 13

Homework and Computer Problems for Math*2130 (W17).

Newton s Method and Linear Approximations 10/19/2011

Numerical Programming I (for CSE)

Transcription:

Chapter 3 Interpolation and Polynomial Approximation Per-Olof Persson persson@berkeley.edu Department of Mathematics University of California, Berkeley Math 128A Numerical Analysis

Polynomial Interpolation Polynomials Polynomials P n (x) = a x x n + a 1 x + a 0 are commonly used for interpolation or approximation of functions Benefits include efficient methods, simple differentiation, and simple integration Also, Weierstrass Approximation Theorem says that for each ε > 0, there is a P (x) such that f(x) p(x) < ε for all x in [a, b] for f C[a, b]. In other words, polynomials are good at approximating general functions.

The Lagrange Polynomial Theorem If x 0,..., x n distinct and f given at these numbers, a unique polynomial P (x) of degree n exists with f(x k ) = P (x k ), for each k = 0, 1,..., n The polynomial is P (x) = f(x 0 )L n,0 (x) +... + f(x n )L n,n (x) = where n f(x k )L n,k (x) k=0 (x x 0 )(x x 1 ) (x x k 1 )(x x k+1 ) (x x n ) L n,k (x) = (x k x 0 )(x k x 1 ) (x k x k 1 )(x k x k+1 ) (x k x n ) = (x x i ) (x k x i ) i k

Lagrange Polynomial Error Term Theorem x 0,..., x n distinct in [a, b], f C n+1 [a, b], then for x [a, b] there exists ξ(x) in (a, b) with f(x) = P (x) + f (n+1) (ξ(x)) (x x 0 )(x x 1 ) (x x n ) (n + 1)! where P (x) is the interpolating polynomial.

Recursive Generation of Lagrange Polynomials Definition Let f be defined at x 0,..., x n, suppose m 1,..., m k distinct integers with 0 m i n. The Lagrange polynomial that agrees with f(x) at x m1, x m2,..., x mk is denoted P m1,m 2,...,m k (x). Theorem f defined at x 0,..., x k, and x j, x i two distinct numbers among these. 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 ) is the kth Lagrange polynomial that interpolates f.

Neville s Method Neville s Method Set Q i,j = P i j,i j+1,...,i 1,i and use the recursive formula to obtain the 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 3 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 4 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 Method MATLAB Implementation function Q=neville(x,xi,fi) n=length(xi)-1; Q=zeros(n+1,n+1); Q(:,1)=fi(:); for i=1:n for j=1:i Q(i+1,j+1)=((x-xi(i-j+1))*Q(i+1,j)-... (x-xi(i+1))*q(i,j))... /(xi(i+1)-xi(i-j+1)); end end

Divided Differences Divided Differences Write the nth Lagrange polynomial in the form P n (x) = a 0 + a 1 (x x 0 ) + a 2 (x x 0 )(x x 1 ) + = a n (x x 0 )(x x 1 ) (x x n 1 ) Introduce the kth divided difference f[x i, x i+1,..., x i+k 1, x i+k ] = f[x i+1, x i+2,..., x i+k ] f[x i, x i+1,..., x i+k 1 ] x i+k x i The coefficients are then a k = f[x 0, x 1, x 2,..., x k ] and P n (x) = f[x 0 ] + n f[x 0, x 1,..., x k ](x x 0 ) (x x k 1 ) k=1

Newton s Divided-Difference MATLAB Implementation function F=divideddifference(x,f) n=length(x)-1; F=zeros(n+1,n+1); F(:,1)=f(:); for i=1:n for j=1:i F(i+1,j+1)=(F(i+1,j)-F(i,j))/(x(i+1)-x(i-j+1)); end end

Equally Spaced Nodes Equal Spacing Suppose x 0,..., x n increasing with equal spacing h = x i+1 x i and x = x 0 + sh The Newton Forward-Difference Formula then gives where P n (x) = f(x 0 ) + f(x 0 ) = f(x 1 ) f(x 0 ) n k=1 ( ) s k f(x 0 ) k 2 f(x 0 ) = f(x 1 ) f(x 0 ) = f(x 2 ) 2f(x 1 ) + f(x 0 )

Backward Differencing The Newton Backward-Difference Formula Reordering the nodes gives P n (x) = f[x n ] + f[x n, x n 1 ](x x n ) + = f[x n,..., x 0 ](x x n )(x x n 1 ) (x x 1 ) The Newton Backward-Difference Formula is n ( ) s P n (x) = f[x n ] + ( 1) k k f(x n ) k k=1 where the backward difference p n is defined by p n = p n p n 1 k p n = ( k 1 p n )

Osculating Polynomials Definition Let x 0,..., x n be distinct in [a, b], and m i nonnegative integers. Suppose f C m [a, b], with m = max 0 i n m i. The osculating polynomial approximating f is the P (x) of least degree such that d k P (x i ) dx k = dk f(x i ) dx k, for i = 0,..., n and k = 0,..., m i Special Cases n = 0: m 0 th Taylor polynomial m i = 0: nth Lagrange polynomial m i = 1: Hermite polynomial

Hermite Interpolation Theorem If f C 1 [a, b] and x 0,..., x n [a, b] distinct, the Hermite polynomial is H 2n+1 (x) = n f(x j )H n,j (x) + j=0 n f (x j )Ĥn,j(x) j=0 where H n,j (x) = [1 2(x x j )L n,j(x j )]L 2 n,j(x) Ĥ n,j (x) = (x x j )L 2 n,j(x). Moreover, if f C 2n+2 [a, b], then f(x) = H 2n+1 (x) + (x x 0) 2 (x x n ) 2 f (2n+2) (ξ(x)) (2n + 2)! for some ξ(x) (a, b).

Hermite Polynomials from Divided Differences Divided Differences Suppose x 0,..., x n and f, f are given at these numbers. Define z 0,..., z 2n+1 by z 2i = z 2i+1 = x i Construct divided difference table, but use f (x 0 ), f (x 1 ),..., f (x n ) instead of the undefined divided differences The Hermite polynomial is f[z 0, z 1 ], f[z 2, z 3 ],..., f[z 2n, z 2n+1 ] 2n+1 H 2n+1 (x) = f[z 0 ] + f[z 0,..., z k ](x z 0 ) (x z k 1 ) k=1

Cubic Splines Definition Given a function f on [a, b] and nodes a = x 0 < < x n = b, a cubic spline interpolant S for f satisfies: (a) S(x) is a cubic polynomial S j (x) on [x j, x j+1 ] (b) S j (x j ) = f(x j ) and S j (x j+1 ) = f(x j+1 ) (c) S j+1 (x j+1 ) = S j (x j+1 ) (d) S j+1 (x j+1) = S j (x j+1) (e) S j+1 (x j+1) = S j (x j+1) (f) One of the following boundary conditions: (i) S (x 0 ) = S (x n ) = 0 (free or natural boundary) (ii) S (x 0 ) = f (x 0 ) and S (x n ) = f (x n ) (clamped boundary)

Natural Splines Computing Natural Cubic Splines Solve for coefficients a j, b j, c j, d j in S j(x) = a j + b j(x x j) + c j(x x j) 2 + d j(x x j) 3 by setting a j = f(x j ), h j = x j+1 x j, and solving Ax = b: Finally, 1 0 h 0 2(h 0 + h 1) h 1 A =......... h n 2 2(h n 2 + h n 1) h n 1 0 1 b = (0, 3(a 2 a 1)/h 1 3(a 1 a 0)/h 0,..., 3(a n a n 1)/h n 1 3(a n 1 a n 2)/h n 2, 0) T x = (c 0,..., c n) T b j = (a j+1 a j)/h j h j(2c j + c j+1)/3, d j = (c j+1 c j)/(3h j)

Clamped Splines Computing Clamped Cubic Splines Solve for coefficients a j, b j, c j, d j in S j(x) = a j + b j(x x j) + c j(x x j) 2 + d j(x x j) 3 using same procedure as for natural cubic splines, but with 2h 0 h 0 h 0 2(h 0 + h 1) h 1 A =......... h n 2 2(h n 2 + h n 1) h n 1 h n 1 2h n 1 b = (3(a 1 a 0)/h 0 3f (a), 3(a 2 a 1)/h 1 3(a 1 a 0)/h 0,..., 3(a n a n 1)/h n 1 3(a n 1 a n 2)/h n 2, 3f (b) 3(a n a n 1)/h n 1) T