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

Similar documents
Curve Fitting and Interpolation

Interpolation Theory

3.1 Interpolation and the Lagrange Polynomial

Curve Fitting. Objectives

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

Chapter 4: Interpolation and Approximation. October 28, 2005

November 20, Interpolation, Extrapolation & Polynomial Approximation

Interpolation and extrapolation

Lecture 10 Polynomial interpolation

Applied Numerical Analysis Homework #3

Computational Physics

Interpolation and Polynomial Approximation I

Engineering 7: Introduction to computer programming for scientists and engineers

Common Core Algebra 2 Review Session 1

Math Numerical Analysis Mid-Term Test Solutions

Applied Numerical Analysis Quiz #2

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

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

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

Scientific Computing

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

Preliminary Examination in Numerical Analysis

Q 0 x if x 0 x x 1. S 1 x if x 1 x x 2. i 0,1,...,n 1, and L x L n 1 x if x n 1 x x n

Lectures 9-10: Polynomial and piecewise polynomial interpolation

Jim Lambers MAT 419/519 Summer Session Lecture 13 Notes

Cubic Splines; Bézier Curves

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)

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

Least squares regression

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

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

Engg. Math. II (Unit-IV) Numerical Analysis

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

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.

Interpolation. Chapter Interpolation. 7.2 Existence, Uniqueness and conditioning

BSM510 Numerical Analysis

Interpolation (Shape Functions)

MA3457/CS4033: Numerical Methods for Calculus and Differential Equations

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

Basic Linear Algebra in MATLAB

In practice one often meets a situation where the function of interest, f(x), is only represented by a discrete set of tabulated points,

Chapter 2 Interpolation

Chapter 11. Taylor Series. Josef Leydold Mathematical Methods WS 2018/19 11 Taylor Series 1 / 27

Empirical Models Interpolation Polynomial Models

Chapter 3 Interpolation and Polynomial Approximation

Q1. Discuss, compare and contrast various curve fitting and interpolation methods

Convergence rates of derivatives of a family of barycentric rational interpolants

Math 578: Assignment 2

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

5. Polynomial Functions and Equations

Section 8.3 Partial Fraction Decomposition

Interpolation APPLIED PROBLEMS. Reading Between the Lines FLY ROCKET FLY, FLY ROCKET FLY WHAT IS INTERPOLATION? Figure Interpolation of discrete data.

SPLINE INTERPOLATION

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

A Parent s Guide to Understanding Family Life Education in Catholic Schools (and how it connects with Ontario s revised Health and Physical Education

Radial Basis Functions I

KINGS COLLEGE OF ENGINEERING DEPARTMENT OF MATHEMATICS ACADEMIC YEAR / EVEN SEMESTER QUESTION BANK

Polynomial Interpolation

GENG2140, S2, 2012 Week 7: Curve fitting

MTH5112 Linear Algebra I MTH5212 Applied Linear Algebra (2017/2018)

Math 4263 Homework Set 1

Interpolation. Escuela de Ingeniería Informática de Oviedo. (Dpto. de Matemáticas-UniOvi) Numerical Computation Interpolation 1 / 34

Math 651 Introduction to Numerical Analysis I Fall SOLUTIONS: Homework Set 1

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

Numerical Marine Hydrodynamics

Introduction Linear system Nonlinear equation Interpolation

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

1 Piecewise Cubic Interpolation

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

Algebra III Chapter 2 Note Packet. Section 2.1: Polynomial Functions

Piecewise Polynomial Interpolation

arxiv: v1 [math.na] 1 May 2013

, B = (b) Use induction to prove that, for all positive integers n, f(n) is divisible by 4. (a) Use differentiation to find f (x).

446 CHAP. 8 NUMERICAL OPTIMIZATION. Newton's Search for a Minimum of f(x,y) Newton s Method

MTH4101 CALCULUS II REVISION NOTES. 1. COMPLEX NUMBERS (Thomas Appendix 7 + lecture notes) ax 2 + bx + c = 0. x = b ± b 2 4ac 2a. i = 1.

A New Trust Region Algorithm Using Radial Basis Function Models

Math 4310 Solutions to homework 7 Due 10/27/16

Jim Lambers MAT 460/560 Fall Semester Practice Final Exam

Partititioned Methods for Multifield Problems

Optimization and Calculus

Polynomial Interpolation

Root Finding (and Optimisation)

Piecewise Polynomial Interpolation

Taylor Series and Numerical Approximations

Kernel B Splines and Interpolation

Math 2233 Homework Set 7

Lecture 1 INF-MAT3350/ : Some Tridiagonal Matrix Problems

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

Numerical interpolation, extrapolation and fi tting of data

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.

Mathematical Olympiad Training Polynomials

, a 1. , a 2. ,..., a n

2

Newton s Method and Linear Approximations

MAT 300 Midterm Exam Summer 2017

Scientific Computing: An Introductory Survey

Each aix i is called a term of the polynomial. The number ai is called the coefficient of x i, for i = 0, 1, 2,..., n.

MULTIVARIATE BIRKHOFF-LAGRANGE INTERPOLATION SCHEMES AND CARTESIAN SETS OF NODES. 1. Introduction

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

Introduction to Computer Graphics. Modeling (1) April 13, 2017 Kenshi Takayama

Transcription:

Applied Numerical Analysis Interpolation Lecturer: Emad Fatemizadeh

Interpolation Input: A set (x i -yy i ) data. Output: Function value at arbitrary point x. 0 1 4 1-3 3 9 What for x = 1.?

Interpolation Piecewise-Linear ea Interpolation: o Draw a line from (x k,y k ) to (x k+1,y k+1 ) (x k+1,y k+1 ) (x k,y k ) k k 1 x xk f x = y + y + 1 y x x ( ) ( ) k k k k k+ 1 k x x x + Result is continuous but NOT Differentiable!

Piecewise-Linear Interpolation

Interpolation Polynomial Interpolation: Why Polynomial: Taylor Series of a f(x) near x 0: ( ) k = 0 n! ( k ) ( x0 ) ( ) N f f x x x Computation is to simple Practical Application: Complex function in engineering problems! 0 k

Interpolation Polynomial Interpolation Simple approach: We have ( x, y ) We have { } n i i i= 0 n n k i i k i k = 0 k = 0 k k ( ) = = ( ) =, = 0,1,, f x a x y f x a x i n 1 n n y 0 = a0 + ax 1 0 + + anx 0 1 x a 0 x 0 0 y 0 1 n n y 1 = a0 + ax 1 1 + + anx1 1 x a 1 x 1 1 y 1 = 1 n n y 1 n = a0 + ax 1 n + + a x a nx n n x n n y n a= 1 X y

Interpolation Example: Data: {( 0,6 ),( 1,0 ),(,) } 1 0 0 a 6 1 4 a 0 1 1 1 a1 = 0 f ( x) = 4x 10x+ 6

Polynomial Interpolation

Interpolation Problems of the this formulation: Matrix Inversion is time consuming. Matrix Inversion is erroneous.

Interpolation Lagrange Method: n f ( x ) = Lk ( x ) y k k = 0 f ( x i) = y i 1 x = x i Li ( x ) = 0 x x i x x 0 x x k 1 x x k + 1 x x n Lk ( x ) = x x x x x x x x ( ) ( )( ) ( ) ( k 0 ) ( k k 1 )( k k + 1 ) ( k n ) ( ) = 1, ( ) = 0, L x L x x x k k k i i k

Interpolation Example: {( ) ( ) ( )} ( x 1)( x ) x 3x + ( x) = = ( 0 1)( 0 ) ( x 0)( x ) x x ( x) = = ( 1 0)( 1 ) 1 ( x 0)( x 1) x x ( x) = = ( 0)( 1) ( ) ( ) ( ) ( ) Data: 0,6, 1,0,, L L L 0 1 f x = 6L x + 0L x + L x = 4x 10x+ 6 0 1

Interpolation Error: ( ) ( x x )( x x ) ( x xn ) ( N + 1! ) ( ) 0 1 ( N + 1) EN x = f c x0 c xn,

Interpolation Newton Method: x 0 1-1 - y -5-3 -15 39-9 ( ) = = ( ) ( ) ( ) ( ) P1( x1) = y1 ( ) ( ) ( ) ( )( ) P( x) = y ( ) ( ) ( ) ( )( )( ) P3( x3) = y3 ( ) P x y 0 0 5 P x = P x + c x x = 5+ c x 0 P x = 5+ x 1 0 0 1 P x = P x + c x x x x P x = 5+ x 4 x( x 1) 1 0 1 P x = P x + c x x x x x x P x = 5+ x 4 x ( x 1) + 3 0 1 3 ( ) ( ) ( )( )( )( ) P x = y 4 3 0 1 3 4 4 4 4 P x P x c x x x x x x x x P x ( ) 8x( x 1)( x+ 1) ( ) 5 x x x + ( )( + ) + ( )( + )( ) = + = + 4 ( 1) 8x x 1 x 1 3x x 1 x 1 x

Matlab Commands polyfit: Find polynomial p = polyfit(x,y,n);

Interpolation Radial Basis Function: Symmetric Function (1D) ( ) Consider, then f or radial basis. D example: f x ( ) exp f x f ( x ) ( x y ) = exp ( r )

Interpolation If φ(x) be a radial basis function: ( x y ) Data:, n { } i i i = 1 n = k k = 1 ( ) ϕ ( ) f x w x x n ( ) ϕ ( ) i i k i k k = 1 k f x = y = w x x, i = 1,,, n ( ) ϕ = ϕ x x y = wϕ ik, i k i k ik, k = 1 n

Interpolation y1 ϕ1,1 ϕ1, ϕ1, n w1 y ϕ,1 ϕ, ϕ, n w =, ϕ ik, = ϕ ki,, ϕ ii, = ϕ 0 y ϕ n n,1 ϕn, ϕn, n wn 1 w1 ϕ1,1 ϕ1, ϕ1, n y1 w ϕ,1 ϕ, ϕ, n y = w ϕ n n,1 ϕn, ϕn, n yn ( )

Interpolation Sample of RBF function: r = x x exp r r r r r 3 i ( r ) log j ( r ) 1 + c + c

{ x } { y } i Numerical Example = [ 101], = [ 15] i ( ) ( ) ( ) ( ) 1exp 1 exp 3exp 3 y = f x = w x x + w x x + w x x ( ( ) ) ( ) ( ) ( ) y = w exp x + 1 + w exp x + w exp x 1 1 3 ( ) ( ) ( ) y = f x = w e + w e + w e = 1 1 e e 1 y f x w e w e w e e = y f x w e w e w 5 0 1 4 1 4 1 1 1 3 w 1 1 0 1 1 1 = = 1 + + 3e = 1 w 4 1 0 4 1 1 3 = 3 = 1 + + 3e = 5 e e w 3 w 1-1.3650 w = 0.7559 w 3 4.7469 ( ) ( ) ( ) ( ) ( ( ) ) y = f x = -1.3650exp x + 1 + 0.7559exp x + 4.7469exp x 1

Numerical Example

Matlab Coding Hints What we need: φ = ϕ ( x ) i x j What we need: First we calculate: r = x x First Method: a for loop. x = [-1 0 1]'; y = [-1 5]'; r = zeros(length(x)); for i=1:length(x), for j=1:length(x), end; end r(i,j)=abs(x(i)-x(j)); x(j)); i j

Matlab Coding Hints Another Methods: Note that: 1 1 1 1 0 * [ 1 1 1 ] 0 0 0 = 1 1 1 1 1 1 1 1 1 1 0 1 0 0 0 0 0 0 = 1 0 1 1 1 1 1 1 1 0 0 1 Tabe absolute value: 1 0 1 0 T

Matlab Coding Hints Matlab Code: Other parts: x = [-1 0 1]'; y = [-1 5]'; Tmp = x*ones(1,3); r = abs(tmp-tmp'); Phi = exp(-r.^); w = inv(phi)*y;

Spline Consider two discussed approach: A single polynomial to N points. (N-1) line between two successive point. Now we could do a combination!

Linear Splines The simplest connection between two points is a straight line: f ( x ) = f ( x0 ) + m0 ( x x0 ), x0 x x1 f ( x) = f ( x ) + m ( x x ), x x x 1 1 1 1 ( ) ( ) ( ) f ( x ) f ( x ) f x = f x + m x x, x x x m i = i+ 1 x i+ 1 n 1 n 1 n 1 n 1 n x i i

Linear Spline Continuous at knots Not differentiable at knots. Knots

Quadratic Splines Goal: Derive a nd order polynomial for each interval between data points ( ) f x = a x + bx+ c i i i i x i-1 x i

Quadratic Splines For (n+1) points (0,1,,,n), we have n interval, 3n unknown parameters (a i, b i, and c i ). Thus we need 3n conditions

Quadratic Splines The function value of adjacent polynomials must be equal at interior knots. (i=1, i=n-1); ai 1xi 1+ bi 1xi 1+ ci 1 = f ( xi 1), fi 1 at upper bound ax + bx + c = f ( x ), f at lower bound i i 1 i i 1 i i 1 i i=,3,,n (n-1) conditions (we need 3n)

Quadratic Splines The function value of first and last polynomials must pass through the end points. (i=0, i=n); ax + bx + c = f x ( ) ( ) 1 0 1 0 1 0 ax + bx + c = f x n n n n n n conditions (n-1)+=n conditions (we need 3n)

Quadratic Splines The first derivatives at interior knots must be equal (i=0, i=n); a x + b = a x + b i 1 i 1 i 1 i i 1 i i =,3,, n n-1 conditions n+n-1=3n-11 conditions (we need 3n)

Quadratic Splines An arbitrary condition: nd derivative at first point is zero.! 1 conditions a = 1 0 3n-1+1=3n conditions (we need 3n)

Example x=[3, 45 4.5, 7, 9] and y=[.5, y=[5 1,.5, 5 0.5] 05] n=3; x a1 b1 c1 = 4.5: 0.5 + 4.5 + = 1 x = 45: 4.5: 05 0.5 a + 4.5 45 b + c = 1 x= 7: 49a + 7b + c =.5 Function value x = 7: 49 a 3 + 7 b 3 + c 3 =.5 x= 3: 9a1+ 3b1+ c1 =.5, First point x = 9: 81a + 9b + c = 1 1 1 0.5, Last point x= 4.5: 9a1+ b1 = 9a + b Function Deriv. x = 7 : 17a + b = 14a + b a 1 = 0 3 3

Example x + 55 5.5 3 x 4.5 45 f ( x) = 0.64x 6.76x+ 18.46 4.5 x 7 16 1.6 x + 4.6 46 x + 91.3 913 7 x 9

Cubic Splines Goal: Derive a 3 rd order polynomial for each interval between data points ( ) 3 f x = a x + bx + cx+ d i i i i i x i-1 x i

Cubic Splines Conditions: o The function value must be equal at the interior knots (i=,n-1) 1)-> n- The first and last function must pass through the end points (i=0,n)-> The first derivatives at the interior knots must be equal (i=,n-1) -> n-1 The second derivatives at the interior knots must be equal (i=,n-1) -> n-1 The second derivatives at the end knots are zeros (i=0,n) -> 4n condition and 4n parameters!

Cubic Splines Special case: x i+1 -x i =h, i=n-1 1,,0 x x x i 1 i ( x x ) i ( x xi 1)( x xi) 3 fi( x) = + f h h i 1 ( x x ) ( x x ) ( x x ) + h i 1 i 1 i 3 ( x x )( x x ) ( x x ) ( x x ) + S + h h i 1 i i 1 i i 1 h f i S i

Cubic Splines Condition: fi( xi) = yi ( ) i ( i ) = i + ( i ) ( ) i( i) = i+ ( i) fi( xi) = fi+ 1 ( xi) ( ) 1 1( 0) = 0 fn( xn) yn ( ) 1 1( 0) = 0 f ( x ) = 0 f 1 x x 0 x x 1 f x f 1 x f x x1 x x f x f 1 x fi x xi x xi f x y = fn x xn x xn f x n n

Cubic Splines 3 S i + 4 S i + 1 + S i + = ( y i + y i ) i = 0,1,, n h Si = 0 i = 0, n

Example x=[3, 3.5, 4] y=[1.098, 1.53, 1.386] S 0 = S = 0 3 4S1 = ( 1.386 1.098) S1 = 0.43 0.5

Matlab Command Spline Ynew = spline(xold,yold,xnew) Xnew) x=[0 1 3 4 5 6 7 8]; y=[6 0-1 3 4-5 4]; xx=0:.01:8; yy=spline(x,y,xx);

Example

Two Dimensional Interpolation We have z=f(x,y) at limited (x i,y i ): Goal: Find f(x,y) at arbitrary (x,y) among (x i,y i ).

Lagrange Method Lagrange Method M N f ( x, y ) = Lij ( x, y ) z ij i= 1 j= 1 f ( x, y ) = z 1 x = x i and y = y i Lij ( x, y ) = 0 O.W. L x, y = L x L y L i i ij ( ) ( ) ( ) ( x x 0 ) ( x x k 1 )( x x k + 1 ) ( x x n ) ( x ) = ( x k x 0) ( x k x k 1)( x k x k + 1) ( x k x n) ( ) = 1, ( ) = 0, ij i j k L x L x x x k k k i i k

Bilinear A quadratic D spline Data is regular. (, ) = (, ), f x y z i i i j f x y = z i+ 1 i i+ 1, j (, ) f x y + = z + i j+ 1 i, j+ 1 (, ) f x y = z i+ 1 j+ 1 i+ 1, j+ 1

Bilinear Interpolation Formulation: (, ) = + + +, i i+ 1, i i+ 1 = (, ) = + + + f x y axy bx cy d x x x y y y z f x y ax y bx cy d ij i i i i i i

RBF function Formulation is very similar f = f ( x, x,, x ), i = 1,,, N i 1 L L = 1 L i = = p p p= 1 T ( x, x,, x ) f f ( ), ( x y ) x x x y N k x xk k = 1 N ( ) = ( ) f x wϕ ( ) ( ) i i kϕ k f x = f = w x x, i = 1,,, N k = 1 ( x x ) ϕ, = ϕ y = wϕ, ik k i k ik k = 1 N