Chapter 3, Interpolation and Extrapolation

Slides:



Advertisements
Similar presentations
Lecture on Numerical Analysis Dr.-Ing. Michael Dumbser
Advertisements

Mark Trew CT Halfway Down Halfway down the stairs Is a stair Where I sit. There isn't any Other stair Quite like It. I'm not at the bottom, I'm.
Polynomial Approximation PSCI 702 October 05, 2005.
Numerical Methods.  Polynomial interpolation involves finding a polynomial of order n that passes through the n+1 points.  Several methods to obtain.
CE33500 – Computational Methods in Civil Engineering Differentiation Provided by : Shahab Afshari
Data mining and statistical learning - lecture 6
MATH 685/ CSI 700/ OR 682 Lecture Notes
Chapter 18 Interpolation The Islamic University of Gaza
1 Chapter 4 Interpolation and Approximation Lagrange Interpolation The basic interpolation problem can be posed in one of two ways: The basic interpolation.
1 Curve-Fitting Spline Interpolation. 2 Curve Fitting Regression Linear Regression Polynomial Regression Multiple Linear Regression Non-linear Regression.
Computational Methods in Physics PHYS 3437
EARS1160 – Numerical Methods notes by G. Houseman
Chapter 3, Interpolation and Extrapolation. Interpolation & Extrapolation (x i,y i ) Find an analytic function f(x) that passes through given N points.
ES 240: Scientific and Engineering Computation. InterpolationPolynomial  Definition –a function f(x) that can be written as a finite series of power functions.
Chapter 4 Roots of Equations
Curve-Fitting Interpolation
Engineering Computation Curve Fitting: Interpolation 1
Curve-Fitting Polynomial Interpolation
ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 23 CURVE FITTING Chapter 18 Function Interpolation and Approximation.
ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 24 Regression Analysis-Chapter 17.
ECIV 301 Programming & Graphics Numerical Methods for Engineers REVIEW II.
Chapter 6 Numerical Interpolation
ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 21 CURVE FITTING Chapter 18 Function Interpolation and Approximation.
The Fourier series A large class of phenomena can be described as periodic in nature: waves, sounds, light, radio, water waves etc. It is natural to attempt.
CpE- 310B Engineering Computation and Simulation Dr. Manal Al-Bzoor
Computational Methods in Physics PHYS 3437 Dr Rob Thacker Dept of Astronomy & Physics (MM-301C)
Chapter 4, Integration of Functions. Open and Closed Formulas x 1 =a x 2 x 3 x 4 x 5 =b Closed formula uses end points, e.g., Open formulas - use interior.
V. Space Curves Types of curves Explicit Implicit Parametric.
Block 4 Nonlinear Systems Lesson 14 – The Methods of Differential Calculus The world is not only nonlinear but is changing as well 1 Narrator: Charles.
Today’s class Spline Interpolation Quadratic Spline Cubic Spline Fourier Approximation Numerical Methods Lecture 21 Prof. Jinbo Bi CSE, UConn 1.
1. Interpolating polynomials Polynomial of degree n,, is a linear combination of Definitions: (interval, continuous function, abscissas, and polynomial)
Course 13 Curves and Surfaces. Course 13 Curves and Surface Surface Representation Representation Interpolation Approximation Surface Segmentation.
Lecture 22 Numerical Analysis. Chapter 5 Interpolation.
Computers in Civil Engineering 53:081 Spring 2003 Lecture #15 Spline Interpolation.
Jump to first page Chapter 3 Splines Definition (3.1) : Given a function f defined on [a, b] and a set of numbers, a = x 0 < x 1 < x 2 < ……. < x n = b,
Computer Programming (TKK-2144) 13/14 Semester 1 Instructor: Rama Oktavian Office Hr.: M.13-15, W Th , F
Introduction to Numerical Analysis I MATH/CMPSC 455 Splines.
Polynomials, Curve Fitting and Interpolation. In this chapter will study Polynomials – functions of a special form that arise often in science and engineering.
L5 – Curves in GIS NGEN06 & TEK230: Algorithms in Geographical Information Systems by: Sadegh Jamali (source: Lecture notes in GIS, Lars Harrie) 1 L5-
Cubic Spline Interpolation. Cubic Splines attempt to solve the problem of the smoothness of a graph as well as reduce error. Polynomial interpolation.
 3.3 Hermite Interpolation Chapter 3 Interpolation and Polynomial Approximation -- Hermite Interpolation Find the osculating polynomial P(x) such that.
5. Interpolation 5.1 Definition of interpolation. 5.2 Formulas for Interpolation. 5.3 Formulas for Interpolation for unequal interval. 5.4 Applications.
1 Chapter 4 Interpolation and Approximation Lagrange Interpolation The basic interpolation problem can be posed in one of two ways: The basic interpolation.
Interpolation - Introduction
Computational Methods CMSC/AMSC/MAPL 460 Polynomial Interpolation Ramani Duraiswami, Dept. of Computer Science.
Chapter 4, Integration of Functions
Data manipulation II: Least Squares Fitting
Curve-Fitting Spline Interpolation
Solving Linear Equations and Inequalities
Numerical Analysis Lecture 25.
Interpolation Methods
Chapter 3, Interpolation and Extrapolation
NUMERICAL DIFFERENTIATION AND INTEGRATION
Today’s class Multiple Variable Linear Regression
Warm-up: Find the equation of a quadratic function in standard form that has a root of 2 + 3i and passes through the point (2, -27). Answer: f(x) = -3x2.
Numerical Analysis Lecture 23.
Numerical Analysis Lecture 26.
Interpolation Methods
MATH 174: Numerical Analysis
SKTN 2393 Numerical Methods for Nuclear Engineers
9. Data Fitting Fitting Experimental Spectrum
SKTN 2393 Numerical Methods for Nuclear Engineers
Curve Fitting Filling in the gaps.
Spline representation. ❖ A spline is a flexible strip used to produce a smooth curve through a designated set of points. ❖ Mathematically describe such.
Numerical Analysis Lecture 24.
Generalized Finite Element Methods
Chapter 4, Integration of Functions
Copyright © Cengage Learning. All rights reserved.
Approximation of Functions
Theory of Approximation: Interpolation
Presentation transcript:

Chapter 3, Interpolation and Extrapolation

Interpolation & Extrapolation (xi,yi) Find an analytic function f(x) that passes through the given N points exactly.

Polynomial Interpolation Use polynomial of degree N-1 to fit exactly with N data points (xi,yi), i =1, 2, …, N. The coefficient ci is determined by a system of linear equations Use ratio of polynomials (Pade’ approximation) is another way.

Vandermonde Matrix Equation But it is not advisable to solve this system numerically because of ill-conditioning.

Condition Number cond(A) = ||A|| · ||A-1|| For singular matrix, cond(A) = ∞ A linear system is ill-conditioned if cond(A) is very large. Norm || . ||: a real function that satisfies (1) f(A) ≥ 0, (2) f(A+B) ≤ f(A) + f(B), (3) f(A) = || f(A). For cond(A), A must be a square matrix; for norm ||A||, A can be vector or matrix (of any size). For a discussion on norms, see, e.g., Golub & van Loan, “Matrix Computations”, 3rd, page 52 – 57.

Norms Vector p-norm (p ≥ 1) Matrix norm sup: supremum Frobenius norm is like a 2-norm applied to the matrix elements. Opposite of supremum is infimum (inf). What happen if p<1? sup: supremum

Commonly Used Norms Vector norm Matrix norm Where μ is the maximum eigenvalue of matrix ATA.

Lagrange’s Formula It can be verified that the solution to the Vandermonde equation is given by the formula below: li(x) has the property li(xj) = δij. Delta_{ij} is Kronecker delta. It is 1 if i=j, and 0 otherwise.

Joseph-Louis Lagrange (1736-1813) Italian-French mathematician associated with many classic mathematics and physics – Lagrange multipliers in minimization of a function, Lagrange’s interpolation formula, Lagrange’s theorem in group theory and number theory, and the Lagrangian (L=T-V) in mechanics and Euler-Lagrange equations.

Neville’s Algorithm Evaluate Lagrange’s interpolation formula f(x) at x, given the data points (xi,yi). Interpolation tableau P x1: y1 = P1 P12 x2: y2 = P2 P123 P23 P1234 x3: y3 = P3 P234 P34 x4: y4 = P4 Eric Harold Neville 1889-1961. Pi,i+1,i+2,…,i+n is a polynomial of degree n in x that passes through the points (xi,yi), (xi+1,yi+1), …, (xi+n,yi+n) exactly.

Determine P12 from P1 & P2 Given the value P1 and P2 at x=x1 and x2, we find linear interpolation P12(x) = λ(x) P1+[1-λ(x)] P2 Since P12(x1) = P1 and P12(x2) = P2, we must have λ(x1) = 1, λ(x2) = 0 so λ(x) = λ12= (x-x2)/(x1-x2)

Determine P123 from P12 & P23 We write P123(x) = λ(x) P12(x) + [1-λ(x)] P23(x) P123(x2) = P2 already for any choice of λ(x). We require that P123(x1)=P12(x1) =P1 and P123(x3)=P23(x3) =P3, thus λ(x1) = 1, λ(x3) = 0 or

Recursion Relation for P Given two m-point interpolated value P constructed from point i,i+1,i+2,…,i+m-1, and i+1,i+2,…,i+m, the next level m+1 point interpolation from i to i+m is a convex combination:

Use Small Difference C & D P1 C1,1 = P12-P1 P12 D1,1 C2,1=P123-P12 P123 P2 D2,1 C1,2 C3,1=P1234-P123 P23 P1234 D1,2 C2,2 P234 D3,1=P1234-P234 P3 C1,3 D2,2=P234-P34 P34 D1,3 P4

Deriving the Relation among C & D PA D1=PA –P0 C2=P-PA P0 P =λ PA + (1-λ)PB C1=PB –P0 D2=P-PB PB To get required , extend the lines (in a straight way) at P back to the starting points.

Evaluate f(3) given 4-points (0,1), (1,2), (2,3),(4,0). C0,1=1 x1=0, y1=1 =P1 C1,1 = 3 D0,1=1 C2,1= 0 C0,2=2 D1,1= 2 x2=1, y2=2 =P2 C1,2= 2 C3,1= - 5/4 D2,1= 0 D0,2=2 P1234= 11/4 D1,2= 1 C2,2= -5/3 C0,3=3 D3,1= 5/12 x3=2, y3=3 =P3 C1,3= -3/2 D0,3=3 D2,2=5/6 D1,3 = 3/2 C0,4=0 x4=4, y4=0 =P4 D0,4=0

polint( ) Program import math def polint(xa, ya, n, x, y, dy): c = ya.copy() d = ya.copy() ns = 0 dif = math.fabs(x-xa[0]) for i in range(1,n): dift = math.fabs(x-xa[i]) if (dift < dif): ns = i dif = dift y[0] = ya[ns] ns -= 1 What is the computational complexity of Neville’s algorithm?

polint(), continued for m in range(1,n): for i in range(0,n-m): ho = xa[i]-x hp = xa[i+m]-x w = c[i+1]-d[i] den = ho - hp den = w/den d[i] = hp*den c[i] = ho*den if(2*(ns+1) < (n-m)): dy[0] = c[ns+1] else: dy[0] = d[ns] ns -= 1 y[0] += dy[0]

Piecewise Linear Interpolation y P23(x) P12(x) (x3,y3) (x2,y2) P34(x) (x4,y4) (x1,y1) P45(x) (x5,y5) x

Piecewise Polynomial Interpolation Discontinuous derivatives across segment P1234(x) P1234(x) (x3,y3) (x2,y2) P2345(x) (x4,y4) (x1,y1) P2345(x) (x5,y5) x

Cubic Spline Given N points (xi,yi), i=1,2,…,N, for each interval between points i to i+1, fit to cubic polynomials such that Pi(xi)=yi and Pi(xi+1)=yi+1. Make 1st and 2nd derivatives continuous across intervals, i.e., Pi(n)(xi+1) = P(n)i+1(xi+1), n = 1 and 2. Fix boundary condition to P’’(x1 or N)=0, or P’(x1 or N ) = const, to completely specify.

Reading NR, Chapter 3 See also J. Stoer and R. Bulirsch, “Introduction to Numerical Analysis,” Chapter 2. NR: Numerical Recipes in C, 2nd edition.

Problems for Lecture 3 (Interpolation) Use Neville’s algorithm to find the interpolation value at x = 0, for a cubic polynomial interpolation with 4 points (x,y) = (-1,1.25), (1,2), (2,3), (4,0). Also write out the Lagrange’s formula and compute f(0). 2. Given the same 4 points as above, determine the cubic splines with natural boundary condition (second derivatives equal to 0 at the boundaries). Give the cubic polynomials in each of the three intervals. Use the method outlined in NR page 113 to 116, or a direct fit to cubic polynomials with proper conditions.