Intro Polynomial Piecewise Cubic Spline Software Summary. Interpolation. Sanzheng Qiao. Department of Computing and Software McMaster University
|
|
- Gabriel Watson
- 5 years ago
- Views:
Transcription
1 Interpolation Sanzheng Qiao Department of Computing and Software McMaster University January, 2014
2 Outline 1 Introduction 2 Polynomial Interpolation 3 Piecewise Polynomial Interpolation 4 Natural Cubic Spline 5 Software Packages
3 Outline 1 Introduction 2 Polynomial Interpolation 3 Piecewise Polynomial Interpolation 4 Natural Cubic Spline 5 Software Packages
4 Introduction Problem setting: Given (x 0, y 0 ),(x 1, y 1 ),...,(x n, y n ), x 0 < x 1 < x n, for example, a set of measurements, construct a function f : f(x i ) = y i, i = 0, 1,..., n Desirable properties of f : smooth: analytic and f (x) not too large (the first and second derivatives are continuous). simple: polynomial of minimum degree, easy to evaluate.
5 Example Measurements of the speed of sound in ocean water speed (ft/sec) depth (ft)
6 Example Interpolation speed (ft/sec) depth (ft)
7 Outline 1 Introduction 2 Polynomial Interpolation 3 Piecewise Polynomial Interpolation 4 Natural Cubic Spline 5 Software Packages
8 Polynomial Interpolation Advantages: easy to evaluate and differentiate Weierstrass Approximation Theorem: If f is any continuous function on the finite closed interval [a,b], then for every ǫ > 0 there exists a polynomial p n (x) of degree n = n(ǫ) such that max f(x) p n(x) < ǫ. x [a,b]
9 Polynomial Interpolation Advantages: easy to evaluate and differentiate Weierstrass Approximation Theorem: If f is any continuous function on the finite closed interval [a,b], then for every ǫ > 0 there exists a polynomial p n (x) of degree n = n(ǫ) such that max f(x) p n(x) < ǫ. x [a,b] Impractical (degree is often too high)
10 A straightforward approach A polynomial of degree n is determined by its n + 1 coefficients.
11 A straightforward approach A polynomial of degree n is determined by its n + 1 coefficients. Given (x 0, y 0 ),...,(x n, y n ) to be interpolated, we construct the linear system (Vandermonde matrix): 1 x 0 x0 n a 0 y 0 1 x 1 x1 n a 1 y x n xn n. a n solve for the coefficients of the polynomial =. y n p n (y)(x) = a 0 + a 1 x + + a n x n
12 Horner s rule Evaluating the polynomial: a 0 x 3 + a 1 x 2 + a 2 x + a 3 Horner s form: ((a 0 x + a 1 )x + a 2 )x + a 3
13 Horner s rule Evaluating the polynomial: a 0 x 3 + a 1 x 2 + a 2 x + a 3 Horner s form: ((a 0 x + a 1 )x + a 2 )x + a 3 v = a(0); for (i = 1:n) v = v*x + a(i); end
14 Horner s rule Evaluating the polynomial: a 0 x 3 + a 1 x 2 + a 2 x + a 3 Horner s form: ((a 0 x + a 1 )x + a 2 )x + a 3 v = a(0); for (i = 1:n) v = v*x + a(i); end The optimal (most efficient and accurate) way of evaluating a 0 x n a n.
15 Vandermonde matrix When x 0,..., x n are distinct, the Vandermonde matrix is nonsingular. Thus the system has a unique solution (coefficients of the interpolating polynomial).
16 Vandermonde matrix When x 0,..., x n are distinct, the Vandermonde matrix is nonsingular. Thus the system has a unique solution (coefficients of the interpolating polynomial). Example. Given three points (28, ) and (30, ), (32, ) we have the system and the solution a 0 a 1 a 2 = p 2 (31) = sin(30 ) a 0 a 1 a 2 =
17 Vandermonde matrix problem: The coefficient (Vandermonde) matrix is often ill-conditioned
18 Vandermonde matrix problem: The coefficient (Vandermonde) matrix is often ill-conditioned question What is the condition number of the Vandermonde matrix constructed by x i = i, i = 0, 1,..., 7?
19 Vandermonde matrix problem: The coefficient (Vandermonde) matrix is often ill-conditioned question What is the condition number of the Vandermonde matrix constructed by x i = i, i = 0, 1,..., 7? Answer:
20 Lagrange form (conceptually simple) Basis polynomials: {l j (x)} (j = 0, 1,..., n) of degree n such that l j (x i ) = { 1, if i = j 0, otherwise construct l j (x) = i j x x i x j x i Thus p n (y)(x) = n l j (x)y j j=0
21 Example Given three points: (28, ), (30, ), (32, ), construct a second degree interpolating polynomial in the Lagrange form: p 2 (x) = (x 30)(x 32) (28 30)(28 32) (x 28)(x 32) + (30 28)(30 32) (x 28)(x 30) + (32 28)(32 30) p 2 (31) = sin(31 )
22 Example Given three points: (28, ), (30, ), (32, ), construct a second degree interpolating polynomial in the Lagrange form: p 2 (x) = (x 30)(x 32) (28 30)(28 32) (x 28)(x 32) + (30 28)(30 32) (x 28)(x 30) + (32 28)(32 30) p 2 (31) = sin(31 ) Expensive to evaluate.
23 Dangers of polynomial interpolation An example. Runge s function (continuous derivatives of all order) 1 y(x) = x 2 on [ 1, 1] equally spaces x 0 = 1, x 1,, x n = 1 1 Equal Spacing (n = 13)
24 Dangers of polynomial interpolation An example. Runge s function (continuous derivatives of all order) 1 y(x) = x 2 on [ 1, 1] equally spaces x 0 = 1, x 1,, x n = 1 1 Equal Spacing (n = 13) It is often best not to use global polynomial interpolation.
25 Outline 1 Introduction 2 Polynomial Interpolation 3 Piecewise Polynomial Interpolation 4 Natural Cubic Spline 5 Software Packages
26 Piecewise Polynomial Interpolation Given the partition α = x 1 < x 2 < < x n = β, interpolate on each [x i, x i+1 ] with a low degree polynomial.
27 Piecewise Polynomial Interpolation Given the partition α = x 1 < x 2 < < x n = β, interpolate on each [x i, x i+1 ] with a low degree polynomial. Linear L i (z) = a i + b i (z x i ), z [x i, x i+1 ] a i = y i, b i = y i+1 y i x i+1 x i, 1 i n 1
28 Algorithm. Piecewise linear interpolation Given vectors x and y with interpolating points, this function returns the piecewise linear interpolation coefficients in the vectors a and b. function [a,b] = pwl(x,y) n = length(x); a = y(1:n-1); b = diff(y)./diff(x);
29 Evaluation Given the piecewise linear interpolation L(z) represented by the coefficient vectors a, b, how do we evaluate this function at z [α,β]? First, we locate [x i, x i+1 ] such that z [x i, x i+1 ]. Then, we evaluate L(z) using L i (z). Search method: binary search, since x i are sorted.
30 Evaluation Given the piecewise linear interpolation L(z) represented by the coefficient vectors a, b, how do we evaluate this function at z [α,β]? First, we locate [x i, x i+1 ] such that z [x i, x i+1 ]. Then, we evaluate L(z) using L i (z). Search method: binary search, since x i are sorted. Observation: If [x i, x i+1 ] is associated with the current z, then it is likely that this subinterval will be the one for the next value.
31 Algorithm. Locate Idea: Use the previous subinterval as a guess. If not, do binary search. Given the vector x of breakpoints and a scalar z between x 1 and x n, this function locates i so that x i z x i+1. The optional g is a guess. function i = Locate(x,z,g) if nargin==3 % try the guess if (x(g)<=z)&(z<=x(g+1)) i = g; return % quick return end end
32 Algorithm. Locate (cont.) n = length(x); if z==x(n) i = n-1; % quick return else % binary search left = 1; right = n; while right > left+1 mid = floor((left + right)/2); if z < x(mid) right = mid; else left = mid; end end i = left; end
33 Algorithm. pwleval Given a piecewise linear interpolation coefficient vectors a and b from pwl and its breakpoints in x, this function returns the values of the interpolation evaluated at the points in z. function v = pwleval(a,b,x,z) m = length(z); v = zeros(m,1); g = 1; for j=1:m i = Locate(x,z(j),g); v(j) = a(i) + b(i)*(z(j) - x(i)); g = i; end
34 Example y = 1 (x 0.3) (x 0.9) Interpolation of humps(x) with PWL, n =
35 Outline 1 Introduction 2 Polynomial Interpolation 3 Piecewise Polynomial Interpolation 4 Natural Cubic Spline 5 Software Packages
36 Problem setting Given (x 1, y 1 ),(x 2, y 2 ),...,(x n, y n ), find s(x): in each subinterval [x i, x i+1 ], s(x) is cubic
37 Problem setting Given (x 1, y 1 ),(x 2, y 2 ),...,(x n, y n ), find s(x): in each subinterval [x i, x i+1 ], s(x) is cubic s(x i ) = y i, i = 1,..., n
38 Problem setting Given (x 1, y 1 ),(x 2, y 2 ),...,(x n, y n ), find s(x): in each subinterval [x i, x i+1 ], s(x) is cubic s(x i ) = y i, i = 1,..., n s (x) and s (x) are continuous at x 2, x 3,..., x n 1
39 Problem setting Given (x 1, y 1 ),(x 2, y 2 ),...,(x n, y n ), find s(x): in each subinterval [x i, x i+1 ], s(x) is cubic s(x i ) = y i, i = 1,..., n s (x) and s (x) are continuous at x 2, x 3,..., x n 1 s (x 1 ) = s (x n ) = 0 The second derivative of s(x) is zero at the end points means that s(x) is linear at the end points.
40 A straightforward approach Suppose a i + b i x + c i x 2 + d i x 3 on [x i, x i+1 ], i = 1,..., n 1. 4(n 1) unknowns to be determined.
41 A straightforward approach Suppose a i + b i x + c i x 2 + d i x 3 on [x i, x i+1 ], i = 1,..., n 1. 4(n 1) unknowns to be determined. Interpolation: a i + b i x i + c i xi 2 + d i xi 3 = y i, i = 1,..., n 1 a i + b i x i+1 + c i xi d ixi+1 3 = y i+1, i = 1,..., n 1
42 A straightforward approach Suppose a i + b i x + c i x 2 + d i x 3 on [x i, x i+1 ], i = 1,..., n 1. 4(n 1) unknowns to be determined. Interpolation: a i + b i x i + c i xi 2 + d i xi 3 = y i, i = 1,..., n 1 a i + b i x i+1 + c i xi d ixi+1 3 = y i+1, i = 1,..., n 1 Continuous first derivative (consider [x i 1, x i ] and [x i, x i+1 ]): b i 1 + 2c i 1 x i + 3d i 1 xi 2 = b i + 2c i x i + 3d i xi 2, i = 2,..., n 1
43 A straightforward approach Suppose a i + b i x + c i x 2 + d i x 3 on [x i, x i+1 ], i = 1,..., n 1. 4(n 1) unknowns to be determined. Interpolation: a i + b i x i + c i xi 2 + d i xi 3 = y i, i = 1,..., n 1 a i + b i x i+1 + c i xi d ixi+1 3 = y i+1, i = 1,..., n 1 Continuous first derivative (consider [x i 1, x i ] and [x i, x i+1 ]): b i 1 + 2c i 1 x i + 3d i 1 xi 2 = b i + 2c i x i + 3d i xi 2, i = 2,..., n 1 Continuous second derivative: 2c i 1 + 6d i 1 x i = 2c i + 6d i x i, i = 2,..., n 1
44 A straightforward approach Suppose a i + b i x + c i x 2 + d i x 3 on [x i, x i+1 ], i = 1,..., n 1. 4(n 1) unknowns to be determined. Interpolation: a i + b i x i + c i xi 2 + d i xi 3 = y i, i = 1,..., n 1 a i + b i x i+1 + c i xi d ixi+1 3 = y i+1, i = 1,..., n 1 Continuous first derivative (consider [x i 1, x i ] and [x i, x i+1 ]): b i 1 + 2c i 1 x i + 3d i 1 xi 2 = b i + 2c i x i + 3d i xi 2, i = 2,..., n 1 Continuous second derivative: 2c i 1 + 6d i 1 x i = 2c i + 6d i x i, i = 2,..., n 1 Two end conditions: 2c 1 + 6d 1 x 1 = 0 and 2c n 1 + 6d n 1 x n = 0
45 A straightforward approach Suppose a i + b i x + c i x 2 + d i x 3 on [x i, x i+1 ], i = 1,..., n 1. 4(n 1) unknowns to be determined. Interpolation: a i + b i x i + c i xi 2 + d i xi 3 = y i, i = 1,..., n 1 a i + b i x i+1 + c i xi d ixi+1 3 = y i+1, i = 1,..., n 1 Continuous first derivative (consider [x i 1, x i ] and [x i, x i+1 ]): b i 1 + 2c i 1 x i + 3d i 1 xi 2 = b i + 2c i x i + 3d i xi 2, i = 2,..., n 1 Continuous second derivative: 2c i 1 + 6d i 1 x i = 2c i + 6d i x i, i = 2,..., n 1 Two end conditions: 2c 1 + 6d 1 x 1 = 0 and 2c n 1 + 6d n 1 x n = 0 Total of 4(n 1) equations, a dense system.
46 A clever approach: Constructing s(x) In the subinterval [x i, x i+1 ], let h i = x i+1 x i and introduce new variables: w = (x x i )/h i, w = 1 w. Note: w(x i ) = 0, w(x i+1 ) = 1 and w(x i ) = 1, w(x i+1 ) = 0, (linear Lagrange polynomials). Thus wy i+1 + wy i is the (linear) Lagrange interpolation on [x i, x i+1 ].
47 A clever approach: Constructing s(x) In the subinterval [x i, x i+1 ], let h i = x i+1 x i and introduce new variables: w = (x x i )/h i, w = 1 w. Note: w(x i ) = 0, w(x i+1 ) = 1 and w(x i ) = 1, w(x i+1 ) = 0, (linear Lagrange polynomials). Thus wy i+1 + wy i is the (linear) Lagrange interpolation on [x i, x i+1 ]. Construct s(x) = wy i+1 + wy i + h 2 i [(w 3 w)σ i+1 + ( w 3 w)σ i ] where σ i to be determined, so that the properties (the first and second derivatives are continuous) are satisfied.
48 Properties of s(x) Using w = 1/h i and w = 1/h i, we can verify 1 s(x i ) = y i, s(x i+1 ) = y i+1, independent of σ, that is, s(x) interpolates (x i, y i ). 2 s (x) = 6wσ i wσ i, linear Lagrange interpolation at the points (x i, 6σ i ) and (x i+1, 6σ i+1 ). Clearly s (x i ) = 6σ i, which implies that s (x) is continuous.
49 Properties of s(x) Using w = 1/h i and w = 1/h i, we can verify 1 s(x i ) = y i, s(x i+1 ) = y i+1, independent of σ, that is, s(x) interpolates (x i, y i ). 2 s (x) = 6wσ i wσ i, linear Lagrange interpolation at the points (x i, 6σ i ) and (x i+1, 6σ i+1 ). Clearly s (x i ) = 6σ i, which implies that s (x) is continuous. Is s (x) continuous?
50 Properties of s(x) (cont.) It remains to determine σ i so that s (x) is continuous.
51 Properties of s(x) (cont.) It remains to determine σ i so that s (x) is continuous. Consider, on [x i, x i+1 ], s (x) = y i+1 y i h i + h i [(3w 2 1)σ i+1 (3 w 2 1)σ i ] Let i = (y i+1 y i )/h i. On [x i, x i+1 ], w(x i ) = 0 and w(x i ) = 1, s +(x i ) = i + h i ( σ i+1 2σ i ).
52 Properties of s(x) (cont.) On [x i 1, x i ], s (x) = y i y i 1 h i 1 + h i 1 [(3w 2 1)σ i (3 w 2 1)σ i 1 ] and w(x i ) = 1, w(x i ) = 0. Thus s (x i) = i 1 + h i 1 (2σ i + σ i 1 ).
53 Making s (x) continuous Setting we get n 2 equations: s +(x i ) = s (x i ), i = 2, 3,..., n 1, h i 1 σ i 1 + 2(h i 1 + h i )σ i + h i σ i+1 = i i 1 for i = 2, 3,..., n 1. Solve for σ 2,...,σ n 1, recalling that σ 1 = σ n = 0 (natural cubic spline).
54 Matrix form diagonal: [2(h 1 + h 2 ),, 2(h n 2 + h n 1 )] supper/subdiagonal: [h 2,, h n 2 ] unknowns: [σ 2,,σ n 1 ] T right-hand side: [ 2 1,, n 1 n 2 ] T
55 Matrix form diagonal: [2(h 1 + h 2 ),, 2(h n 2 + h n 1 )] supper/subdiagonal: [h 2,, h n 2 ] unknowns: [σ 2,,σ n 1 ] T right-hand side: [ 2 1,, n 1 n 2 ] T The matrix is symmetric tridiagonal diagonally dominant ( a i,i > j i a i,j ), when x 1 < x 2 < < x n, postive definite Can apply the Cholesky factorization, working on two vectors with O(n) operations.
56 Modeling a problem Note. Had we taken the straightforward approach to determining the coefficients of the piecewise cubic polynomials, four coefficients for each of n 1 cubic polynomials, we would have ended up with a large (4(n 1) 4(n 1)) and dense system requiring O(n 3 ) operations. Now we have an O(n) method.
57 Evaluating s(x) If s(x) is evaluated many times, arrange s(x) so that s(x) = y i + b i (x x i ) + c i (x x i ) 2 + d i (x x i ) 3 and rearrange it in the Horner s form, for x i x x i+1 and calculate and store b i, c i, d i (instead of σ i ) b i = y i+1 y i h i h i (σ i+1 + 2σ i ) for i = 1, 2,..., n 1 c i = 3σ i d i = σ i+1 σ i h i
58 Algorithm. Natural cubic spline ncspline Given a vector x with breakpoints and vector y with function values, this algorithm computes the coefficients b, c, d of natural spline interpolation. 1 Compute h i and i ; 2 Form the tridiagonal matrix (two arrays) and the right hand side; 3 Solve for σ i ; 4 Compute the coefficients b, c, and d.
59 Outline 1 Introduction 2 Polynomial Interpolation 3 Piecewise Polynomial Interpolation 4 Natural Cubic Spline 5 Software Packages
60 Software packages IMSL csint, csdec, csher, csval MATLAB polyfit, spline, ppval NAG e01aef, e01baf, e01bef, e02bbf, e01bff Octave interp1
61 Summary Polynomial interpolation: General idea and methods, Lagrange interpolation Piecewise polynomial interpolation: Construction of piecewise polynomial (linear and cubic), evaluation of a piecewise function, ncspline, seval
62 References [1 ] George E. Forsyth and Michael A. Malcolm and Cleve B. Moler. Computer Methods for Mathematical Computations. Prentice-Hall, Inc., Ch 4.
Intro Polynomial Piecewise Cubic Spline Software Summary. Interpolation. Sanzheng Qiao. Department of Computing and Software McMaster University
Interpolation Sanzheng Qiao Department of Computing and Software McMaster University July, 2012 Outline 1 Introduction 2 Polynomial Interpolation 3 Piecewise Polynomial Interpolation 4 Natural Cubic Spline
More informationNumerical Integration
Numerical Integration Sanzheng Qiao Department of Computing and Software McMaster University February, 2014 Outline 1 Introduction 2 Rectangle Rule 3 Trapezoid Rule 4 Error Estimates 5 Simpson s Rule 6
More informationNonlinear Equations and Continuous Optimization
Nonlinear Equations and Continuous Optimization Sanzheng Qiao Department of Computing and Software McMaster University March, 2014 Outline 1 Introduction 2 Bisection Method 3 Newton s Method 4 Systems
More informationSolving Ordinary Differential Equations
Solving Ordinary Differential Equations Sanzheng Qiao Department of Computing and Software McMaster University March, 2014 Outline 1 Initial Value Problem Euler s Method Runge-Kutta Methods Multistep Methods
More informationLecture 10 Polynomial interpolation
Lecture 10 Polynomial interpolation Weinan E 1,2 and Tiejun Li 2 1 Department of Mathematics, Princeton University, weinan@princeton.edu 2 School of Mathematical Sciences, Peking University, tieli@pku.edu.cn
More information3.1 Interpolation and the Lagrange Polynomial
MATH 4073 Chapter 3 Interpolation and Polynomial Approximation Fall 2003 1 Consider a sample x x 0 x 1 x n y y 0 y 1 y n. Can we get a function out of discrete data above that gives a reasonable estimate
More informationElements of Floating-point Arithmetic
Elements of Floating-point Arithmetic Sanzheng Qiao Department of Computing and Software McMaster University July, 2012 Outline 1 Floating-point Numbers Representations IEEE Floating-point Standards Underflow
More informationCubic Splines MATH 375. J. Robert Buchanan. Fall Department of Mathematics. J. Robert Buchanan Cubic Splines
Cubic Splines MATH 375 J. Robert Buchanan Department of Mathematics Fall 2006 Introduction Given data {(x 0, f(x 0 )), (x 1, f(x 1 )),...,(x n, f(x n ))} which we wish to interpolate using a polynomial...
More informationElements of Floating-point Arithmetic
Elements of Floating-point Arithmetic Sanzheng Qiao Department of Computing and Software McMaster University July, 2012 Outline 1 Floating-point Numbers Representations IEEE Floating-point Standards Underflow
More informationSPLINE INTERPOLATION
Spline Background SPLINE INTERPOLATION Problem: high degree interpolating polynomials often have extra oscillations. Example: Runge function f(x = 1 1+4x 2, x [ 1, 1]. 1 1/(1+4x 2 and P 8 (x and P 16 (x
More informationScientific Computing
2301678 Scientific Computing Chapter 2 Interpolation and Approximation Paisan Nakmahachalasint Paisan.N@chula.ac.th Chapter 2 Interpolation and Approximation p. 1/66 Contents 1. Polynomial interpolation
More informationIn practice one often meets a situation where the function of interest, f(x), is only represented by a discrete set of tabulated points,
1 Interpolation 11 Introduction In practice one often meets a situation where the function of interest, f(x), is only represented by a discrete set of tabulated points, {x i, y i = f(x i ) i = 1 n, obtained,
More informationQ1. Discuss, compare and contrast various curve fitting and interpolation methods
Q1. Discuss, compare and contrast various curve fitting and interpolation methods McMaster University 1 Curve Fitting Problem statement: Given a set of (n + 1) point-pairs {x i,y i }, i = 0,1,... n, find
More informationLecture Note 3: Interpolation and Polynomial Approximation. Xiaoqun Zhang Shanghai Jiao Tong University
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
More information1 Piecewise Cubic Interpolation
Piecewise Cubic Interpolation Typically the problem with piecewise linear interpolation is the interpolant is not differentiable as the interpolation points (it has a kinks at every interpolation point)
More informationLectures 9-10: Polynomial and piecewise polynomial interpolation
Lectures 9-1: Polynomial and piecewise polynomial interpolation Let f be a function, which is only known at the nodes x 1, x,, x n, ie, all we know about the function f are its values y j = f(x j ), j
More informationCHAPTER 4. Interpolation
CHAPTER 4 Interpolation 4.1. Introduction We will cover sections 4.1 through 4.12 in the book. Read section 4.1 in the book on your own. The basic problem of one-dimensional interpolation is this: Given
More informationCurve Fitting and Interpolation
Chapter 5 Curve Fitting and Interpolation 5.1 Basic Concepts Consider a set of (x, y) data pairs (points) collected during an experiment, Curve fitting: is a procedure to develop or evaluate mathematical
More informationPolynomial Interpolation
Capter 4 Polynomial Interpolation In tis capter, we consider te important problem of approximatinga function fx, wose values at a set of distinct points x, x, x,, x n are known, by a polynomial P x suc
More informationUniversity of Houston, Department of Mathematics Numerical Analysis, Fall 2005
4 Interpolation 4.1 Polynomial interpolation Problem: LetP n (I), n ln, I := [a,b] lr, be the linear space of polynomials of degree n on I, P n (I) := { p n : I lr p n (x) = n i=0 a i x i, a i lr, 0 i
More informationWe consider the problem of finding a polynomial that interpolates a given set of values:
Chapter 5 Interpolation 5. Polynomial Interpolation We consider the problem of finding a polynomial that interpolates a given set of values: x x 0 x... x n y y 0 y... y n where the x i are all distinct.
More information1 Review of Interpolation using Cubic Splines
cs412: introduction to numerical analysis 10/10/06 Lecture 12: Instructor: Professor Amos Ron Cubic Hermite Spline Interpolation Scribes: Yunpeng Li, Mark Cowlishaw 1 Review of Interpolation using Cubic
More informationInput: A set (x i -yy i ) data. Output: Function value at arbitrary point x. What for x = 1.2?
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
More informationChapter 4: Interpolation and Approximation. October 28, 2005
Chapter 4: Interpolation and Approximation October 28, 2005 Outline 1 2.4 Linear Interpolation 2 4.1 Lagrange Interpolation 3 4.2 Newton Interpolation and Divided Differences 4 4.3 Interpolation Error
More informationScientific Computing: An Introductory Survey
Scientific Computing: An Introductory Survey Chapter 7 Interpolation Prof. Michael T. Heath Department of Computer Science University of Illinois at Urbana-Champaign Copyright c 2002. Reproduction permitted
More informationChapter 1 Numerical approximation of data : interpolation, least squares method
Chapter 1 Numerical approximation of data : interpolation, least squares method I. Motivation 1 Approximation of functions Evaluation of a function Which functions (f : R R) can be effectively evaluated
More informationMATH ASSIGNMENT 07 SOLUTIONS. 8.1 Following is census data showing the population of the US between 1900 and 2000:
MATH4414.01 ASSIGNMENT 07 SOLUTIONS 8.1 Following is census data showing the population of the US between 1900 and 2000: Years after 1900 Population in millions 0 76.0 20 105.7 40 131.7 60 179.3 80 226.5
More informationMath 365 Homework 5 Due April 6, 2018 Grady Wright
Math 365 Homework 5 Due April 6, 018 Grady Wright 1. (Polynomial interpolation, 10pts) Consider the following three samples of some function f(x): x f(x) -1/ -1 1 1 1/ (a) Determine the unique second degree
More informationBSM510 Numerical Analysis
BSM510 Numerical Analysis Polynomial Interpolation Prof. Manar Mohaisen Department of EEC Engineering Review of Precedent Lecture Polynomial Regression Multiple Linear Regression Nonlinear Regression Lecture
More informationApplied Math 205. Full office hour schedule:
Applied Math 205 Full office hour schedule: Rui: Monday 3pm 4:30pm in the IACS lounge Martin: Monday 4:30pm 6pm in the IACS lounge Chris: Tuesday 1pm 3pm in Pierce Hall, Room 305 Nao: Tuesday 3pm 4:30pm
More informationData Analysis-I. Interpolation. Soon-Hyung Yook. December 4, Soon-Hyung Yook Data Analysis-I December 4, / 1
Data Analysis-I Interpolation Soon-Hyung Yook December 4, 2015 Soon-Hyung Yook Data Analysis-I December 4, 2015 1 / 1 Table of Contents Soon-Hyung Yook Data Analysis-I December 4, 2015 2 / 1 Introduction
More informationContinuous Optimization
Continuous Optimization Sanzheng Qiao Department of Computing and Software McMaster University March, 2009 Outline 1 Introduction 2 Golden Section Search 3 Multivariate Functions Steepest Descent Method
More informationPolynomial Interpolation
Capter 4 Polynomial Interpolation In tis capter, we consider te important problem of approximating a function f(x, wose values at a set of distinct points x, x, x 2,,x n are known, by a polynomial P (x
More informationOutline. 1 Interpolation. 2 Polynomial Interpolation. 3 Piecewise Polynomial Interpolation
Outline Interpolation 1 Interpolation 2 3 Michael T. Heath Scientific Computing 2 / 56 Interpolation Motivation Choosing Interpolant Existence and Uniqueness Basic interpolation problem: for given data
More informationSome notes on Chapter 8: Polynomial and Piecewise-polynomial Interpolation
Some notes on Chapter 8: Polynomial and Piecewise-polynomial Interpolation See your notes. 1. Lagrange Interpolation (8.2) 1 2. Newton Interpolation (8.3) different form of the same polynomial as Lagrange
More informationAdditional exercises with Numerieke Analyse
Additional exercises with Numerieke Analyse March 10, 017 1. (a) Given different points x 0, x 1, x [a, b] and scalars y 0, y 1, y, z 1, show that there exists at most one polynomial p P 3 with p(x i )
More informationInterpolation. Chapter Interpolation. 7.2 Existence, Uniqueness and conditioning
76 Chapter 7 Interpolation 7.1 Interpolation Definition 7.1.1. Interpolation of a given function f defined on an interval [a,b] by a polynomial p: Given a set of specified points {(t i,y i } n with {t
More informationINTERPOLATION Background Polynomial Approximation Problem:
INTERPOLATION Background Polynomial Approximation Problem: given f(x) C[a, b], find P n (x) = a 0 + a 1 x + a 2 x 2 + + a n x n with P n (x) close to f(x) for x [a, b]. Motivations: f(x) might be difficult
More informationInterpolation. 1. Judd, K. Numerical Methods in Economics, Cambridge: MIT Press. Chapter
Key References: Interpolation 1. Judd, K. Numerical Methods in Economics, Cambridge: MIT Press. Chapter 6. 2. Press, W. et. al. Numerical Recipes in C, Cambridge: Cambridge University Press. Chapter 3
More informationNumerical Analysis: Interpolation Part 1
Numerical Analysis: Interpolation Part 1 Computer Science, Ben-Gurion University (slides based mostly on Prof. Ben-Shahar s notes) 2018/2019, Fall Semester BGU CS Interpolation (ver. 1.00) AY 2018/2019,
More informationFunction approximation
Week 9: Monday, Mar 26 Function approximation A common task in scientific computing is to approximate a function. The approximated function might be available only through tabulated data, or it may be
More informationInterpolation Theory
Numerical Analysis Massoud Malek Interpolation Theory The concept of interpolation is to select a function P (x) from a given class of functions in such a way that the graph of y P (x) passes through the
More informationCubic Splines; Bézier Curves
Cubic Splines; Bézier Curves 1 Cubic Splines piecewise approximation with cubic polynomials conditions on the coefficients of the splines 2 Bézier Curves computer-aided design and manufacturing MCS 471
More informationx x2 2 + x3 3 x4 3. Use the divided-difference method to find a polynomial of least degree that fits the values shown: (b)
Numerical Methods - PROBLEMS. The Taylor series, about the origin, for log( + x) is x x2 2 + x3 3 x4 4 + Find an upper bound on the magnitude of the truncation error on the interval x.5 when log( + x)
More informationMA3457/CS4033: Numerical Methods for Calculus and Differential Equations
MA3457/CS4033: Numerical Methods for Calculus and Differential Equations Course Materials P A R T II B 14 2014-2015 1 2. APPROXIMATION CLASS 9 Approximation Key Idea Function approximation is closely related
More informationCHAPTER Order points and then develop a divided difference table:
1 CHAPTER 17 17.1 Order points and then develop a divided difference table: x y First Second Third Fourth Fifth Sixth 5 5.75 -.45 0.75 -.E-17 1.51788E-18 7.54895E-19 -.5719E-19 1.8 16.415 -.075 0.75-1.7E-17
More informationExam 2. Average: 85.6 Median: 87.0 Maximum: Minimum: 55.0 Standard Deviation: Numerical Methods Fall 2011 Lecture 20
Exam 2 Average: 85.6 Median: 87.0 Maximum: 100.0 Minimum: 55.0 Standard Deviation: 10.42 Fall 2011 1 Today s class Multiple Variable Linear Regression Polynomial Interpolation Lagrange Interpolation Newton
More informationMaria Cameron Theoretical foundations. Let. be a partition of the interval [a, b].
Maria Cameron 1 Interpolation by spline functions Spline functions yield smooth interpolation curves that are less likely to exhibit the large oscillations characteristic for high degree polynomials Splines
More informationCS412: Introduction to Numerical Methods
CS412: Introduction to Numerical Methods MIDTERM #1 2:30PM - 3:45PM, Tuesday, 03/10/2015 Instructions: This exam is a closed book and closed notes exam, i.e., you are not allowed to consult any textbook,
More informationInterpolation and Polynomial Approximation I
Interpolation and Polynomial Approximation I If f (n) (x), n are available, Taylor polynomial is an approximation: f (x) = f (x 0 )+f (x 0 )(x x 0 )+ 1 2! f (x 0 )(x x 0 ) 2 + Example: e x = 1 + x 1! +
More informationInterpolation. Escuela de Ingeniería Informática de Oviedo. (Dpto. de Matemáticas-UniOvi) Numerical Computation Interpolation 1 / 34
Interpolation Escuela de Ingeniería Informática de Oviedo (Dpto. de Matemáticas-UniOvi) Numerical Computation Interpolation 1 / 34 Outline 1 Introduction 2 Lagrange interpolation 3 Piecewise polynomial
More informationCS 450 Numerical Analysis. Chapter 8: Numerical Integration and Differentiation
Lecture slides based on the textbook Scientific Computing: An Introductory Survey by Michael T. Heath, copyright c 2018 by the Society for Industrial and Applied Mathematics. http://www.siam.org/books/cl80
More informationLösning: Tenta Numerical Analysis för D, L. FMN011,
Lösning: Tenta Numerical Analysis för D, L. FMN011, 090527 This exam starts at 8:00 and ends at 12:00. To get a passing grade for the course you need 35 points in this exam and an accumulated total (this
More informationLecture Note 3: Polynomial Interpolation. Xiaoqun Zhang Shanghai Jiao Tong University
Lecture Note 3: Polynomial Interpolation Xiaoqun Zhang Shanghai Jiao Tong University Last updated: October 24, 2013 1.1 Introduction We first look at some examples. Lookup table for f(x) = 2 π x 0 e x2
More informationPhysics 331 Introduction to Numerical Techniques in Physics
Physics 331 Introduction to Numerical Techniques in Physics Instructor: Joaquín Drut Lecture 12 Last time: Polynomial interpolation: basics; Lagrange interpolation. Today: Quick review. Formal properties.
More informationCS 323: Numerical Analysis and Computing
CS 323: Numerical Analysis and Computing MIDTERM #2 Instructions: This is an open notes exam, i.e., you are allowed to consult any textbook, your class notes, homeworks, or any of the handouts from us.
More informationInterpolation (Shape Functions)
Mètodes Numèrics: A First Course on Finite Elements Interpolation (Shape Functions) Following: Curs d Elements Finits amb Aplicacions (J. Masdemont) http://hdl.handle.net/2099.3/36166 Dept. Matemàtiques
More informationEigenvalue Problems and Singular Value Decomposition
Eigenvalue Problems and Singular Value Decomposition Sanzheng Qiao Department of Computing and Software McMaster University August, 2012 Outline 1 Eigenvalue Problems 2 Singular Value Decomposition 3 Software
More informationPolynomials. p n (x) = a n x n + a n 1 x n 1 + a 1 x + a 0, where
Polynomials Polynomials Evaluation of polynomials involve only arithmetic operations, which can be done on today s digital computers. We consider polynomials with real coefficients and real variable. p
More informationNumerical Methods I: Polynomial Interpolation
1/31 Numerical Methods I: Polynomial Interpolation Georg Stadler Courant Institute, NYU stadler@cims.nyu.edu November 16, 2017 lassical polynomial interpolation Given f i := f(t i ), i =0,...,n, we would
More informationCS 323: Numerical Analysis and Computing
CS 323: Numerical Analysis and Computing MIDTERM #2 Instructions: This is an open notes exam, i.e., you are allowed to consult any textbook, your class notes, homeworks, or any of the handouts from us.
More information1 Lecture 8: Interpolating polynomials.
1 Lecture 8: Interpolating polynomials. 1.1 Horner s method Before turning to the main idea of this part of the course, we consider how to evaluate a polynomial. Recall that a polynomial is an expression
More informationNumerical Methods I: Interpolation (cont ed)
1/20 Numerical Methods I: Interpolation (cont ed) Georg Stadler Courant Institute, NYU stadler@cims.nyu.edu November 30, 2017 Interpolation Things you should know 2/20 I Lagrange vs. Hermite interpolation
More informationComputational Physics
Interpolation, Extrapolation & Polynomial Approximation Lectures based on course notes by Pablo Laguna and Kostas Kokkotas revamped by Deirdre Shoemaker Spring 2014 Introduction In many cases, a function
More information7. Piecewise Polynomial (Spline) Interpolation
- 64-7 Piecewise Polynomial (Spline Interpolation Single polynomial interpolation has two major disadvantages First, it is not computationally efficient when the number of data points is large When the
More informationNumerical interpolation, extrapolation and fi tting of data
Chapter 6 Numerical interpolation, extrapolation and fi tting of data 6.1 Introduction Numerical interpolation and extrapolation is perhaps one of the most used tools in numerical applications to physics.
More informationThere is a unique function s(x) that has the required properties. It turns out to also satisfy
Numerical Analysis Grinshpan Natural Cubic Spline Let,, n be given nodes (strictly increasing) and let y,, y n be given values (arbitrary) Our goal is to produce a function s() with the following properties:
More informationCubic B-spline Collocation Method for Fourth Order Boundary Value Problems. 1 Introduction
ISSN 1749-3889 print, 1749-3897 online International Journal of Nonlinear Science Vol.142012 No.3,pp.336-344 Cubic B-spline Collocation Method for Fourth Order Boundary Value Problems K.N.S. Kasi Viswanadham,
More informationInterpolation and extrapolation
Interpolation and extrapolation Alexander Khanov PHYS6260: Experimental Methods is HEP Oklahoma State University October 30, 207 Interpolation/extrapolation vs fitting Formulation of the problem: there
More information9.4 Cubic spline interpolation
94 ubic spline interpolation Instead of going to higher and higher order, there is another way of creating a smooth function that interpolates data-points A cubic spline is a piecewise continuous curve
More informationyou 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
Qualifying exam for numerical analysis (Spring 2017) Show your work for full credit. If you are unable to solve some part, attempt the subsequent parts. 1. Consider the following finite difference: f (0)
More informationEngineering 7: Introduction to computer programming for scientists and engineers
Engineering 7: Introduction to computer programming for scientists and engineers Interpolation Recap Polynomial interpolation Spline interpolation Regression and Interpolation: learning functions from
More informationIntroduction Linear system Nonlinear equation Interpolation
Interpolation Interpolation is the process of estimating an intermediate value from a set of discrete or tabulated values. Suppose we have the following tabulated values: y y 0 y 1 y 2?? y 3 y 4 y 5 x
More informationAssignment 6, Math 575A
Assignment 6, Math 575A Part I Matlab Section: MATLAB has special functions to deal with polynomials. Using these commands is usually recommended, since they make the code easier to write and understand
More informationEmpirical Models Interpolation Polynomial Models
Mathematical Modeling Lia Vas Empirical Models Interpolation Polynomial Models Lagrange Polynomial. Recall that two points (x 1, y 1 ) and (x 2, y 2 ) determine a unique line y = ax + b passing them (obtained
More informationReview I: Interpolation
Review I: Interpolation Varun Shankar January, 206 Introduction In this document, we review interpolation by polynomials. Unlike many reviews, we will not stop there: we will discuss how to differentiate
More informationCS 257: Numerical Methods
CS 57: Numerical Methods Final Exam Study Guide Version 1.00 Created by Charles Feng http://www.fenguin.net CS 57: Numerical Methods Final Exam Study Guide 1 Contents 1 Introductory Matter 3 1.1 Calculus
More informationCubic Splines. Antony Jameson. Department of Aeronautics and Astronautics, Stanford University, Stanford, California, 94305
Cubic Splines Antony Jameson Department of Aeronautics and Astronautics, Stanford University, Stanford, California, 94305 1 References on splines 1. J. H. Ahlberg, E. N. Nilson, J. H. Walsh. Theory of
More informationAn Introduction to Numerical Analysis. James Brannick. The Pennsylvania State University
An Introduction to Numerical Analysis James Brannick The Pennsylvania State University Contents Chapter 1. Introduction 5 Chapter 2. Computer arithmetic and Error Analysis 7 Chapter 3. Approximation and
More informationLeast squares regression
Curve Fitting Least squares regression Interpolation Two categories of curve fitting. 1. Linear least squares regression, determining the straight line that best fits data points. 2. Interpolation, determining
More informationCurve Fitting. 1 Interpolation. 2 Composite Fitting. 1.1 Fitting f(x) 1.2 Hermite interpolation. 2.1 Parabolic and Cubic Splines
Curve Fitting Why do we want to curve fit? In general, we fit data points to produce a smooth representation of the system whose response generated the data points We do this for a variety of reasons 1
More informationPreliminary Examination in Numerical Analysis
Department of Applied Mathematics Preliminary Examination in Numerical Analysis August 7, 06, 0 am pm. Submit solutions to four (and no more) of the following six problems. Show all your work, and justify
More informationIntroductory Numerical Analysis
Introductory Numerical Analysis Lecture Notes December 16, 017 Contents 1 Introduction to 1 11 Floating Point Numbers 1 1 Computational Errors 13 Algorithm 3 14 Calculus Review 3 Root Finding 5 1 Bisection
More informationApplication of modified Leja sequences to polynomial interpolation
Special Issue for the years of the Padua points, Volume 8 5 Pages 66 74 Application of modified Leja sequences to polynomial interpolation L. P. Bos a M. Caliari a Abstract We discuss several applications
More information446 CHAP. 8 NUMERICAL OPTIMIZATION. Newton's Search for a Minimum of f(x,y) Newton s Method
446 CHAP. 8 NUMERICAL OPTIMIZATION Newton's Search for a Minimum of f(xy) Newton s Method The quadratic approximation method of Section 8.1 generated a sequence of seconddegree Lagrange polynomials. It
More informationLECTURE NOTES ELEMENTARY NUMERICAL METHODS. Eusebius Doedel
LECTURE NOTES on ELEMENTARY NUMERICAL METHODS Eusebius Doedel TABLE OF CONTENTS Vector and Matrix Norms 1 Banach Lemma 20 The Numerical Solution of Linear Systems 25 Gauss Elimination 25 Operation Count
More informationFinite Elements. Colin Cotter. January 18, Colin Cotter FEM
Finite Elements January 18, 2019 The finite element Given a triangulation T of a domain Ω, finite element spaces are defined according to 1. the form the functions take (usually polynomial) when restricted
More informationAIMS Exercise Set # 1
AIMS Exercise Set #. Determine the form of the single precision floating point arithmetic used in the computers at AIMS. What is the largest number that can be accurately represented? What is the smallest
More informationDepartment of Applied Mathematics and Theoretical Physics. AMA 204 Numerical analysis. Exam Winter 2004
Department of Applied Mathematics and Theoretical Physics AMA 204 Numerical analysis Exam Winter 2004 The best six answers will be credited All questions carry equal marks Answer all parts of each question
More informationMath 651 Introduction to Numerical Analysis I Fall SOLUTIONS: Homework Set 1
ath 651 Introduction to Numerical Analysis I Fall 2010 SOLUTIONS: Homework Set 1 1. Consider the polynomial f(x) = x 2 x 2. (a) Find P 1 (x), P 2 (x) and P 3 (x) for f(x) about x 0 = 0. What is the relation
More informationLecture 1 INF-MAT3350/ : Some Tridiagonal Matrix Problems
Lecture 1 INF-MAT3350/4350 2007: Some Tridiagonal Matrix Problems Tom Lyche University of Oslo Norway Lecture 1 INF-MAT3350/4350 2007: Some Tridiagonal Matrix Problems p.1/33 Plan for the day 1. Notation
More informationConsider the following example of a linear system:
LINEAR SYSTEMS Consider the following example of a linear system: Its unique solution is x + 2x 2 + 3x 3 = 5 x + x 3 = 3 3x + x 2 + 3x 3 = 3 x =, x 2 = 0, x 3 = 2 In general we want to solve n equations
More informationNUMERICAL METHODS. x n+1 = 2x n x 2 n. In particular: which of them gives faster convergence, and why? [Work to four decimal places.
NUMERICAL METHODS 1. Rearranging the equation x 3 =.5 gives the iterative formula x n+1 = g(x n ), where g(x) = (2x 2 ) 1. (a) Starting with x = 1, compute the x n up to n = 6, and describe what is happening.
More informationIn manycomputationaleconomicapplications, one must compute thede nite n
Chapter 6 Numerical Integration In manycomputationaleconomicapplications, one must compute thede nite n integral of a real-valued function f de ned on some interval I of
More informationTwo hours. To be provided by Examinations Office: Mathematical Formula Tables. THE UNIVERSITY OF MANCHESTER. 29 May :45 11:45
Two hours MATH20602 To be provided by Examinations Office: Mathematical Formula Tables. THE UNIVERSITY OF MANCHESTER NUMERICAL ANALYSIS 1 29 May 2015 9:45 11:45 Answer THREE of the FOUR questions. If more
More informationInterpolation and Approximation
Interpolation and Approximation The Basic Problem: Approximate a continuous function f(x), by a polynomial p(x), over [a, b]. f(x) may only be known in tabular form. f(x) may be expensive to compute. Definition:
More informationNumerical Methods I Orthogonal Polynomials
Numerical Methods I Orthogonal Polynomials Aleksandar Donev Courant Institute, NYU 1 donev@courant.nyu.edu 1 Course G63.2010.001 / G22.2420-001, Fall 2010 Nov. 4th and 11th, 2010 A. Donev (Courant Institute)
More informationChapter 3 Interpolation and Polynomial Approximation
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
More informationNumerical Marine Hydrodynamics
Numerical Marine Hydrodynamics Interpolation Lagrange interpolation Triangular families Newton s iteration method Equidistant Interpolation Spline Interpolation Numerical Differentiation Numerical Integration
More informationSimple Examples on Rectangular Domains
84 Chapter 5 Simple Examples on Rectangular Domains In this chapter we consider simple elliptic boundary value problems in rectangular domains in R 2 or R 3 ; our prototype example is the Poisson equation
More information