This expression is known as the Newton form of the interpolating polynomial. How do we go about finding the coefficients c i?

Similar documents
Math 3316, Fall 2016 Due Nov. 3, 2016

February 23 Math 2335 sec 51 Spring 2016

Natasha S. Sharma, PhD

Handout 4 - Interpolation Examples

APPM/MATH Problem Set 4 Solutions

Interpolation. TANA09 Lecture 7. Error analysis for linear interpolation. Linear Interpolation. Suppose we have a table x x 1 x 2...

Lecture 9. Curve fitting. Interpolation. Lecture in Numerical Methods from 28. April 2015 UVT. Lecture 9. Numerical. Interpolation his o

lecture 10: B-Splines

ME 261: Numerical Analysis Lecture-12: Numerical Interpolation

Lecture 8. Divided Differences,Least-Squares Approximations. Ceng375 Numerical Computations at December 9, 2010

Interpolation and Splines

x n x n stepnumber k order r error constant C r+1 1/2 5/12 3/8 251/720 abs. stab. interval (α,0) /11-3/10

Numerical Integration

8 Piecewise Polynomial Interpolation

Maximizing an interpolating quadratic

Numerical Analysis Fall. Numerical Differentiation

Polynomial Approximation and Interpolation Chapter 4

an interpolating polynomial P (x) for f(x) Issues: how to find, represent, compute P (x); errors?

Fitting to a set of data. Lecture on fitting

PS Geometric Modeling Homework Assignment Sheet I (Due 20-Oct-2017)

Graphing Techniques. Domain (, ) Range (, ) Squaring Function f(x) = x 2 Domain (, ) Range [, ) f( x) = x 2

Engineering Analysis ENG 3420 Fall Dan C. Marinescu Office: HEC 439 B Office hours: Tu-Th 11:00-12:00

Polynomial Functions Graphing Investigation Unit 3 Part B Day 1. Graph 1: y = (x 1) Graph 2: y = (x 1)(x + 2) Graph 3: y =(x 1)(x + 2)(x 3)

Numerical Methods with Matlab: Implementations and Applications. Gerald W. Recktenwald. Chapter 10 Interpolation

f( x ), or a solution to the equation f( x) 0. You are already familiar with ways of solving

Four equations are necessary to evaluate these coefficients. Eqn

CS 450 Numerical Analysis. Chapter 7: Interpolation

Assignment 2. with (a) (10 pts) naive Gauss elimination, (b) (10 pts) Gauss with partial pivoting

Chapter 3. Numerical Differentiation, Interpolation, and Integration. Instructor: Dr. Ming Ye

Section 3.7 Notes. Rational Functions. is a rational function. The graph of every rational function is smooth (no sharp corners)

Introduction to Mathematical Programming IE406. Lecture 20. Dr. Ted Ralphs

SHAPE Returns the number of elements in each direction in an integer vector.

CS130 : Computer Graphics Curves. Tamar Shinar Computer Science & Engineering UC Riverside

Splines and Piecewise Interpolation. Hsiao-Lung Chan Dept Electrical Engineering Chang Gung University, Taiwan

Section 5.5 Piecewise Interpolation

New formulations of the semi-lagrangian method for Vlasov-type equations

EXTRA-CREDIT PROBLEMS ON SURFACES, MULTIVARIABLE FUNCTIONS AND PARTIAL DERIVATIVES

Math 226A Homework 4 Due Monday, December 11th

Final Exam MAT 100 JS 2018

EECS 556 Image Processing W 09. Interpolation. Interpolation techniques B splines

Polynomials tend to oscillate (wiggle) a lot, even when our true function does not.

Generalized barycentric coordinates

Using Arithmetic of Real Numbers to Explore Limits and Continuity

Section Rational Functions and Inequalities. A rational function is a quotient of two polynomials. That is, is a rational function if

x 2 + 3, r 4(x) = x2 1

End Behavior and Symmetry

Economics Nonparametric Econometrics

Introduction to Matlab

Runge Example Revisited for Splines

Data Table from an Equation

Computer Graphics. Unit VI: Curves And Fractals. By Vaishali Kolhe

Today s class. Roots of equation Finish up incremental search Open methods. Numerical Methods, Fall 2011 Lecture 5. Prof. Jinbo Bi CSE, UConn

CONCAVITY AND INFLECTION POINTS

Bob Brown Math 251 Calculus 1 Chapter 4, Section 4 Completed 1 CCBC Dundalk

Financial Optimization ISE 347/447. Lecture 13. Dr. Ted Ralphs

MAT Business Calculus - Quick Notes

1 Linear programming relaxation

R f da (where da denotes the differential of area dxdy (or dydx)

UNIT 3 EXPRESSIONS AND EQUATIONS Lesson 3: Creating Quadratic Equations in Two or More Variables

over The idea is to construct an algorithm to solve the IVP ODE (8.1)

Abstract. 1 Introduction

Journal of mathematics and computer science 13 (2014),

Chapter 9 Review. By Charlie and Amy

F.BF.B.3: Graphing Polynomial Functions

Introduction to Programming for Engineers Spring Final Examination. May 10, Questions, 170 minutes

5-3 Polynomial Functions

Dyadic Interpolation Schemes

Finite Element Analysis Prof. Dr. B. N. Rao Department of Civil Engineering Indian Institute of Technology, Madras. Lecture - 24

Exploring Rational Functions

Homework #6 Brief Solutions 2012

Computational Methods. Constrained Optimization

Documentation for Numerical Derivative on Discontinuous Galerkin Space

High order regularization of Dirac-delta sources in two space dimensions.

QUADRATIC FUNCTIONS: MINIMUM/MAXIMUM POINTS, USE OF SYMMETRY. 7.1 Minimum/Maximum, Recall: Completing the square

6.867 Machine Learning

3.1 INTRODUCTION TO THE FAMILY OF QUADRATIC FUNCTIONS

Today is the last day to register for CU Succeed account AND claim your account. Tuesday is the last day to register for my class

Introduction to Optimization

Interpolation by Spline Functions

Sung-Eui Yoon ( 윤성의 )

CHAPTER 4: Polynomial and Rational Functions

GRAPHING POLYNOMIALS DAY 2 U N I T 1 1

NUMERICAL INTEGRATION

Solve Non-Linear Parabolic Partial Differential Equation by Spline Collocation Method

Need for Parametric Equations

PowerPoints organized by Dr. Michael R. Gustafson II, Duke University

Block-based Thiele-like blending rational interpolation

Section 7.6 Graphs of the Sine and Cosine Functions

over The idea is to construct an algorithm to solve the IVP ODE (9.1)

1. Divide by using long division. (8x 3 + 6x 2 + 7) (x + 2)

Linear Interpolating Splines

2.1 Quadraticsnts.notebook. September 10, 2018

Math Numerical Analysis Homework #3 Solutions

Unit #22 - The Chain Rule, Higher Partial Derivatives & Optimization Section 14.7

College Algebra. Fifth Edition. James Stewart Lothar Redlin Saleem Watson

Boolean networks, local models, and finite polynomial dynamical systems

Polymath 6. Overview

Differentiation. J. Gerlach November 2010

Mid-Chapter Quiz: Lessons 2-1 through 2-3

CS-184: Computer Graphics. Today

Transcription:

Chapter 1 Polynomial Interpolation When you are wrestling for possession of a sword, the man with the handle always wins. Neal Stephenson, Snow Crash The goal of interpolation is to fit a function exactly through a series of points. The main idea is the interpolating function goes through some required collection of points exactly. Usually we build interpolating functions using a collection of basis functions and multiply the given basis functions by a collection of coefficients such that the required set of points is satisfied. Consider the set of points: {(x 1, y 1 ), (x 2, y 2 ),..., (x n, y n )} The goal here is to find an n th order polynomial that will fit through these points. One such function we could arrive at would have the form: f n (x) = c 1 + c 2 (x x 1 ) + c 3 (x x 1 )(x x 2 ) + + c n (x x 1 )(x x 2 ) (x x n ) This expression is known as the Newton form of the interpolating polynomial. How do we go about finding the coefficients c i? Newton Interpolating Polynomial Consider fitting a polynomial to the following set of points. {( 1, ), (3, 1), (5, 3), (7, 3)} We will build up our function by finding a function that satisfies one of the points, then two, and so on until all four of the points in the set are satisfied. The coefficients c i in the 1

interpolating polynomial above may be found using divided differences. Specifically: c 1 = f(x 1 ) c 2 = f[x 2, x 1 ] = f(x 2) f(x 1 ) x 2 x 1 c 3 = f[x 3, x 2, x 1 ] = f[x 3, x 2 ] f[x 2, x 1 ]) x 3 x 1 c = f[x, x 3, x 2, x 1 ] = f[x, x 3, x 2 ] f[x 3, x 2, x 1 ] x x 1.. c n = f[x n, x n 1,..., x 1 ] = f[x n, x n 1,..., x 2 ] f[x n 1, x n 2,..., x 1 ] x n x 1 The function we aim to find that interpolates the data set given in this example is: f(x) = c 1 + c 2 (x 1) + c 3 (x ( 1))(x (5)) + c (x ( 1))(x (3))(x (5)) Note when f(x) is evaluated at each of the x-values in the data set to be interpolated that many of the additive terms become zero. Finding the coefficients c i above: c 1 = c 2 = f[x 2, x 1 ] = f(x 2) f(x 1 ) = 1 () x 2 x 1 3 ( 1) = 3 f[x 3, x 2 ] = f(x 3) f(x 2 ) = 3 (1) x 3 x 2 5 (3) = 1 f[x, x 3 ] = f(x ) f(x 3 ) x x 3 = 3 (3) 7 (5) = 3 c 3 = f[x 3, x 2, x 1 ] = f[x 3, x 2 ] f[x 2, x 1 ]) = 1 ( 3) x 3 x 1 5 ( 1) = 7 2 f[x, x 3, x 2 ] = f[x, x 3 ] f[x 3, x 2 ]) x x 2 = 3 (1) 7 (3) = 1 c = f[x, x 3, x 2, x 1 ] = f[x, x 3, x 2 ] f[x 3, x 2, x 1 ] = 1 ( 7 x x 1 7 ( 1) = 31 192 2 ) This yields the function: ( f(x) = + 3 ) ( ) ( 7 (x 1)+ (x ( 1))(x (5))+ 31 ) (x ( 1))(x (3))(x (5)) 2 192 The interpolating function can now be plotted along with its defining points: 2

2-2 - -6-8 -10 2 6 8 Some CODE A listing of code that can be used in SAGE to produce the function s interpolation is given by: Listing 1.1: ]Code to Create 5 Lagrange Cardinal Polynomials on [-1,1] def F2( i, j, xe, ye ) : return ( ye [ i ] ye [ j ] ) / ( xe [ i ] xe [ j ] ) def F3( i, j, k, xe, ye ) : return (F2( i, j, xe, ye ) F2( j, k, xe, ye ) ) / ( xe [ i ] xe [ k ] ) def F( i, j, k, l, xe, ye ) : return (F3( i, j, k, xe, ye ) F3( j, k, l, xe, ye ) ) / ( xe [ i ] xe [ l ] ) xe = [ 1,3, 5, 7 ] ; ye = [, 1, 3, 3]; c1 = ye [ 0 ] c2 = F2 ( 1, 0, xe, ye ) show ( c2 ) c3 = F3 ( 2, 1, 0, xe, ye ) c = F ( 3, 2, 1, 0, xe, ye ) newt ( x ) = c1 + c2 (x xe [ 0 ] ) + c3 (x xe [ 0 ] ) ( x xe [ 1 ] ) + c (x xe [ 0 ] ) ( x xe [ 1 ] ) NewtPlot = p l o t ( newt, 1,8, c o l o r = [ 1, 0, 0 ] ) ; NewtPlot += point ( ( xe [ 0 ], ye [ 0 ] ), s i z e =30, f i g s i z e =3) NewtPlot += point ( ( xe [ 1 ], ye [ 1 ] ), s i z e =30, f i g s i z e =3) NewtPlot += point ( ( xe [ 2 ], ye [ 2 ] ), s i z e =30, f i g s i z e =3) NewtPlot += point ( ( xe [ 3 ], ye [ 3 ] ), s i z e =30, f i g s i z e =3) 3

Lagrange Interpolation Polynomial A second method for generating the interpolating function may be presented in the following manner. Lets take advantage of some basis functions that are zero or one depending on the data point we are considering in the given collection of points. The idea of our collection of basis functions was to allow them to have a Kronecker Delta property: { 0 if i j δ i,j = 1 if i = j For a given set of data points we have seen that if l i (x) is a polynomial with the Kronecker Delta property at the given data set: The interpolating polynomial of the set is: which can be seen by observing P (x j ) = x x 0 x 1 x n y y 0 y 1 y n P (x) = n l i (x)y i, (1.0.1) i=0 n l i (x j )y i = l j (x j )y j = y j i=0 We can built an set of basis functions l i (x) for our specified data set using a product of factors. Consider ( ) ( ) ( ) ( ) ( ) x x0 x x1 x xi 1 x xi+1 x xn l i (x) = x i x 0 x i x 1 x i x i 1 x i x i+1 x i x n Notice that the i th term in the sequence is skipped and that the l i (x) expressions have the Kronecker Delta Property. Then n ( ) x xj l i (x) = i {0, 1,..., n}. x i x j j=0,j i here P (x) in (1.0.1) is the Lagrange Form of the interpolating polynomial, and the basis functions l i (x) are often called cardinal polynomials. Class Activity Using sage find the first five Lagrange Interpolating Polynomials evenly spaced on the interval [ 1, 1] then modify your code to find the Lagrange Interpolating polynomial for the data set listed below:

x 0 2 3 y 7 11 28 63 The following sage code is used: Listing 1.2: ]Code to Create 5 Lagrange Cardinal Polynomials on [-1,1] xnodes = [ 1.0, 0.5, 0. 0, 0. 5, 1. 0 ] ; ynodes = [ 0. 0, 0. 0, 0. 0, 0. 0, 0. 0 ] ; L0 ( x ) = 1. 0 ; L1 ( x ) = 1. 0 ; L2 ( x ) = 1. 0 ; L3 ( x ) = 1. 0 ; L ( x ) = 1. 0 ; f o r i in range ( l e n ( xnodes ) ) : i f ( i!= 0 ) : L0 ( x ) = L0 ( x ) ( ( x xnodes [ i ] ) / ( xnodes [0] xnodes [ i ] ) ) ; i f ( i!= 1 ) : L1 ( x ) = L1 ( x ) ( ( x xnodes [ i ] ) / ( xnodes [1] xnodes [ i ] ) ) ; i f ( i!= 2 ) : L2 ( x ) = L2 ( x ) ( ( x xnodes [ i ] ) / ( xnodes [2] xnodes [ i ] ) ) ; i f ( i!= 3 ) : L3 ( x ) = L3 ( x ) ( ( x xnodes [ i ] ) / ( xnodes [3] xnodes [ i ] ) ) ; i f ( i!= ) : L ( x ) = L ( x ) ( ( x xnodes [ i ] ) / ( xnodes [] xnodes [ i ] ) ) ; 1 0.8 0.6 0. 0.2-1 -0.5 0.5 1-0.2-0. Figure 1.0.1: Plot of the first five Lagrange cardinal polynomials on [ 1, 1]. 5

8e5 6e5 e5 2e5-1 1 2 3 5-2e5 Figure 1.0.2: The Lagrange Interpolating polynomial on [0, ]. To modify the code for the second portion of the activity note that we need to change the nodes vectors. 1.0.1 Error in Polynomial Interpolation Lets consider the error in polynomial interpolation. Given the following sets of points find a polynomial using SAGE that interpolates the data: Two Points: Three Points: Four Points: Five Points: x 0 10 y 10 0 x 0 10 y 10 5 0 x 0 7 10 y 10 5 2 0 x 0 7 9 10 y 10 5 2 3 0 6

Typically the thought is: The larger the number of nodes used the better the interpolating is between the node for a data set. Is this correct? Consider the Runge function on the interval [ 5, 5]. R(x) = 1 x 2 + 1 What would the interpolating polynomial look like if we used 11 equally spaced points to create a polynomial interpolating function that approximates the Runge function. 7