1 Piecewise Cubic Interpolation

Size: px
Start display at page:

Download "1 Piecewise Cubic Interpolation"

Transcription

1 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) A commonly used approach to obtain a smoother interpolation, is to instead replace the linear functions with cubic ones This means that we will have an interpolation function of the form s 0 (x) if x 0 x < x s (x) if x x < x 2 s(x) =, () s n (x) if x n x x n where s i (x) is a cubic polynomial of the form s i (x) = a i + b i (x x i ) + c i (x x i ) 2 + d i (x x i ) 3 (2) Since there are n polynomial functions with 4 coefficients each, we have 4n unknowns to solve for To satisfy the interpolation condition s(x i ) = y i requires that s i (x i ) = y i, i = 0,, n, and s n (x n ) = y n (3) Note that since s i (x i ) = a i, the first n conditions above immediately imply that a i = y i for i = 0, n Additionally we will impose that s(x) is twice continuously differentiable at the points x,, x n This means s i (x i ) = s i (x i ) = y i, i =,, n s i (x i ) = s i(x i ), i =,, n i (x i ) = i (x i ), i =,, n (4) The conditions (3) and (4) are the fundamental conditions that define a cubic spline Note that in addition to s i (x i ) = a i we also have s i(x i ) = b i and s i (x i ) = 2c i If we count up all the constraints, we see that the interpolation condition (3) imposes n + constraints, while twice continuous differentiability (4) imposes 3(n ) constraints This amounts to 4n 2 = (n + ) + 3(n ) total constraints, which is obviously 2 less than the 4n coefficients to be determined Typically this is corrected by imposing two conditions at the end points of the interval Some of the most common examples are the following Natural Spline: 0(x ) = n (x n ) = 0 This choice produces a spline with the natural property that it minimizes the total curvature of the the approximating spline (this will be discussed in more detail later)

2 2 Clamped Spline: s 0(x 0 ) = y 0 and s n (x n ) = y n Here y 0 and y n are either approximations of the derivatives of the function at that point or arbitrarily chosen to pin the slopes at a particular angle 3 Not-a-Knot Spline: 0 (x ) = (x ) and n 2(x n ) = n (x n ) Of course, in order to determine the value of s(x) for any one of these choices, one must solve a complicated linear system for the coefficients a i, b i, c i, d i, for i = 0,, n As it turns out, such a linear system can be written as a tridiagonal linear system and therefore solved in O(n) floating point operations Example: Lets consider an example Suppose we want to find the natural cubic spline that interpolates the points (0, ), (/2, ) and (, 2) The spline take the form { s 0 (x) if 0 x /2 s(x) = (5) s (x) if /2 x, where and s 0 (x) = a 0 + b 0 x + c 0 x 2 + d 0 x 3 s (x) = a + b 0 (x /2) + c 0 (x /2) 2 + d 0 (x /2) 3 From the interpolation conditions (3) and the continuity condition in (4) we have s 0 (0) = : a 0 =, s (/2) = : a =, s (/2) = 2 : a + 2 b + 4 c + 8 d = 2, s 0 (/2) = : a b c d 0 = Also the derivative conditions from (4) imply that s 0(/2) = s (/2) : b 0 + c d 0 = b, 0(/2) = (/2) : 2c 0 + 3d 0 = 2c Finally the condition of being a natural spline implies that 0(0) = 0 : c 0 = 0 (0) = 0 : 2c + 3d = 0 Now one simply need to solve the above linear system for the coefficients After doing this, one obtains s 0 (x) = 3 2 x + 0x3 and s (x) = + (x /2) + 5(x /2) 2 0(x /2) 3 2

3 Lets see how this approach works in general We will assume in what follows that the interpolation points x 0 < x < < x n (knots) are equally spaced with h = x i+ x i being the spacing between points As remarked already, the first n conditions in (3) imply that a i = y i We still need to determine the remaining 3n coefficients b i, c i and d i for i = 0,, n If we include the last condition of (3) with the continuity condition of (4), then we have s i (x i ) = y i, i =, n Using the fact that a i = y i, this can be written as y i + b i h + c i h 2 + d i h 3 = y i+, i = 0, n (6) When considering the derivative conditions in (4) we may use the fact that s i(x i ) = b i and i (x i ) = 2c i to conclude that the first derivative conditions s i (x i ) = s i(x i ), i =,, n can be written as b i + 2c i h + 3d i h 2 = b i+ i = 0, n 2 (7) while the second derivative conditions i (x i ) = i (x i ), i =,, n can be written as c i + 3d i h = c i+ i = 0, n 2 (8) If we consider the natural cubic spline condition, then we also have c 0 = 2 s 0(x 0 ) = 0 and c n = 2 s n (x n ) = 0 In this case it will make the most sense to attempt to reduce solving the linear systems (6), (7), (8) to solving for the coefficients c i, i =, n 2, first (This is because the natural cubic spline condition are on c 0 and c n If we were to consider clamped splines, then it would make more sense to solve for b i first) To begin, we solve for d i in equation (8) d i = c i+ c i (9) 3h We may also solve for b i in (6), which after using the above expression for d i gives b i = f[x i, x i+ ] c i h d i h 2 = f[x i, x i+ ] 2 3 c ih 3 c i+h (0) where we have used the divided difference notation f[x i, x i+ ] = (y i+ y i )/h Finally we can substitute the expression for b i and the expression for d i into equation (7) to obtain f[x i, x i+ ] 2 3 c ih 3 c i+h + 2c i h + (c i+ c i )h = f[x i+, x i+2 ] 2 3 c i+h 3 c i+2h Rearranging this and collecting terms gives an equation for c i, i =, n 2 3 c i c i+ + 3 c i+2 = f[x i+, x i+2 ] f[x i, x i+ ] h 3 = f[x i, x i+, x i+2 ]

4 Finally, using the fact that for the natural spline c 0 = 0 and c n = 0 gives the following linear system c f[x 0, x, x 2 ] c 2 f[x, x 2, x 3 ] = () c n 3 f[x n 3, x n 2, x n ] c n 2 f[x n 2, x n, x n ] Note that this is a tridiagonal linear system and is strictly diagonally dominant since 4 > + Therefore the matrix is positive definite and non-singular and can be solved quickly using the Thomas algorithm with O(n) flops Once you solve this system, for c i, i =, n the other coefficients b i and d i can be obtained from equations (0) and (9), each costs O(n) flops Cubic B-Splines As another approach to the computation of cubic splines, we will find useful follow an approach similar to piecewise linear interpolation or Lagrange interpolation approach, introducin a family of basis functions Our goal is to write the spline as s(x) = i a i B i (x) where B i (x) is a certain piecewise cubic spline The functions B i (x) are called cubic B- Splines Although similar to the formulas for piecewise linear interpolation and Lagrange interpolation formulas, there is an important difference The coefficients a i are not necessarily equal to the function output values y i The main benefit of this approach is that the interpolation procedure can be broken into two pieces First construct the B-splines B i (x) and then find the a i s The has the benefit that, since the construction of the B-splines will not in any way depend on the y i data, meaning, once you have computed the B-spines you do not need to compute them again for different sets of y i values Computing the B-splines We will assume that each B i (x) is piecewise cubic function of the following form 0 if x x i 2, q i 2 (x) if x i 2 x i, q i (x) if x i x i, B i (x) = q i+ (x) if x i x i+, q i+2 (x) if x i+ x i+2, 0 if x i+2 x, 4

5 where q i (x), i = 0, n are the usual cubic polynomials of the form q i (x) = A i + B i (x x i ) + C i (x x i ) 2 + D i (x x i ) 3 The functions q i will be determined by the requirement that B i (x i 2 ) = B i(x i 2 ) = B i (x i 2 ) = 0 (2) and B i (x i+2 ) = B i(x i+2 ) = B i (x i+2 ) = 0 and that B i (x) is twice continuously differentiable at x i, x i, x i+ Since we are assuming the interpolation points are equally spaced, this will imply that B i (x) is symmetric about x = x i Note that the two continuous derivatives and the symmetry automatically imply that B i(x i ) = 0 Using symmmetry, it follows that we only need to ensure equation (2) holds,that the two continuous derivatives at x i match and that B i(x i ) = 0 This is accomplished by requiring the following q i 2 (x i 2 ) = q i 2(x i 2 ) = q i 2(x i 2 ) = 0 q i 2 (x i ) = q i (x i ), q i 2(x i ) = q i (x i ), q i 2(x i ) = q i (x i ) as well as q i (x i ) = 0 From the conditions at x i 2 we can easily conclude (by integration) that q i 2 = D i 2 (x x i 2 ) 3 Additionally, from the remaining smoothness conditions at x i and the zero derivative condition at x i one finds that q i (x) = D i 2 ( h 3 + 3h 2 (x x i ) + 3h(x x i ) 2 3(x x i ) 3) Of course, since we needed to determine 8 coefficients for q i 2 and q i with only 7 constraints, we have an undetermined constant D i Typically the convention is to take B i (x i ) = 2/3 which sets D i = /6h 3 Using the symmetry of B i (x) about x = x i we automatically obtain q i+ (x) and q i+2 (x) by the formulas q i+ (x) = q i (2x i x), q i+2 (x) = q i 2 (2x i x) After doing this, we find that B i (x) is completely determined by q i 2 = 6h 3 (x x i 2) 3 q i = 6 + 2h (x x i ) + 2h 2 (x x i ) 2 2h 3 (x x i ) 3 q i+ = 6 2h (x x i+) + 2h 2 (x x i+) 2 2h 3 (x x i+) 3 q i+2 = 6h 3 (x x i+2) 3 5

6 By factoring the polynomials in the above formula, it is possible to show that ( ) x xi B i (x) = B h where 2 ( 3 x2 x ) if x <, 2 B(x) = 6 (2 x )3 if x 2, 0 if 2 x Finding the coefficients Now we write our spline as s(x) = n+ i= a i B i (x) Note that we have taken the sum over i =,, n + even though we do not have points x 3, x 2, x, x n+, x n+2, x n+3 This is because we want to sum over all B i which are non-zero on the interval [x 0, x n ] When a piece of B i (x) lies outside of the interval [x 0, x n ], we simply ignore that piece Any piece of B i (x) that lies inside [x 0, x n ] will, by the piecewise polynomial nature of B i (x), necessarily only depend on the points x i that belong to x 0,, x n The task of determining the coefficients a i is now simple once you realize that at any point x i only B i (x i ), B i (x i ) and B i+ (x i ) are non-zero (ie they are the only functions turned on at x i ) Using the fact that for each i =, n we have the exact values B i (x i ) = 6, B i(x i ) = 2 3, B i(x i+ ) = 6 We see that s(x i ) = 6 (a i + 4a i + a i+ ) and therefore, the interpolation requirement s(x i ) = y i for i = 0, n implies that a i + 4a i + a i+ = 6y i for i =, 2,, n In order to solve for a i we need to know the values of a and a n+ Again, this is where the additional endpoint conditions are used It is not difficult to show that for the natural spline, we have (x i ) = a i B i (x i ) + a i B i (x i ) + a i B i+(x i ) = h 2 (a i 2a i + a i+ ) Solving the natural spline conditions (x 0 ) = 0 and (x n ) = 0 using the above formula give a = 2a 0 a, a n+ = 2a n a n 6

7 This means when i = 0, we get a 0 = y 0 and when i = n, we get a n = y n Now the remaining linear system for a i, i =,, n can be solved by a tridiagonal system a a 2 a n 2 a n = 6y y 0 6y 2 6y n 2 6y n y n Again we find that the remaining coefficients can be computed by inverting a tridiagonal, positive definite system The main difference between this system and the tridiagonal system obtained () lies in the right-hand side In () the right-hand side involves computing n 2 2nd order divided differences, while the right-hand side of the above linear system only involves the values y i, i = 0,, n In some sense we have already done this computation in computing the B-splines B i (x) 7

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

Cubic 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 information

SPLINE INTERPOLATION

SPLINE 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 information

Data 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, 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 information

Lecture 10 Polynomial interpolation

Lecture 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 information

Cubic Splines; Bézier Curves

Cubic 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 information

There is a unique function s(x) that has the required properties. It turns out to also satisfy

There 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 information

3.1 Interpolation and the Lagrange Polynomial

3.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 information

Lectures 9-10: Polynomial and piecewise polynomial interpolation

Lectures 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 information

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

Some 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 information

CHAPTER 4. Interpolation

CHAPTER 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 information

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

In 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 information

Piecewise Polynomial Interpolation

Piecewise Polynomial Interpolation Piecewise Polynomial Interpolation 1 Piecewise linear interpolation Suppose we have data point (x k,y k ), k =0, 1,...N. A piecewise linear polynomial that interpolates these points is given by p(x) =p

More information

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

MTH5112 Linear Algebra I MTH5212 Applied Linear Algebra (2017/2018) MTH5112 Linear Algebra I MTH5212 Applied Linear Algebra (2017/2018) COURSEWORK 3 SOLUTIONS Exercise ( ) 1. (a) Write A = (a ij ) n n and B = (b ij ) n n. Since A and B are diagonal, we have a ij = 0 and

More information

Numerical interpolation, extrapolation and fi tting of data

Numerical 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 information

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

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 . - Piecewise Linear-Quadratic Interpolation Piecewise-polynomial Approximation: Problem: Givenn pairs of data points x i, y i, i,,...,n, find a piecewise-polynomial Sx S x if x x x Sx S x if x x x 2 :

More information

Curve Fitting and Interpolation

Curve 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 information

Lecture 1 INF-MAT3350/ : Some Tridiagonal Matrix Problems

Lecture 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 information

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

Q1. 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 information

Fitting a Natural Spline to Samples of the Form (t, f(t))

Fitting a Natural Spline to Samples of the Form (t, f(t)) Fitting a Natural Spline to Samples of the Form (t, f(t)) David Eberly, Geometric Tools, Redmond WA 9852 https://wwwgeometrictoolscom/ This work is licensed under the Creative Commons Attribution 4 International

More information

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

Lecture 1 INF-MAT : Chapter 2. Examples of Linear Systems Lecture 1 INF-MAT 4350 2010: Chapter 2. Examples of Linear Systems Tom Lyche Centre of Mathematics for Applications, Department of Informatics, University of Oslo August 26, 2010 Notation The set of natural

More information

Chapter 4: Interpolation and Approximation. October 28, 2005

Chapter 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 information

Cubic 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 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 information

Automatic Control Motion planning

Automatic Control Motion planning Automatic Control Motion planning (luca.bascetta@polimi.it) Politecnico di Milano Dipartimento di Elettronica, Informazione e Bioingegneria Motivations 2 Electric motors are used in many different applications,

More information

Numerical Methods of Approximation

Numerical Methods of Approximation Contents 31 Numerical Methods of Approximation 31.1 Polynomial Approximations 2 31.2 Numerical Integration 28 31.3 Numerical Differentiation 58 31.4 Nonlinear Equations 67 Learning outcomes In this Workbook

More information

Interpolation Theory

Interpolation 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 information

Empirical Models Interpolation Polynomial Models

Empirical 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 information

Computational Physics

Computational 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 information

9.4 Cubic spline interpolation

9.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 information

Exam 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: 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 information

Maria Cameron Theoretical foundations. Let. be a partition of the interval [a, b].

Maria 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 information

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)

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) Cubic Spline Suppose we are given a set of interpolating points (x i, y i ) for i = 0, 1, 2, n We seek to construct a piecewise cubic function s(x) that has the for x [[x j, x j+1 ] we have: s(x) = s j

More information

Scientific Computing: An Introductory Survey

Scientific 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 information

Chapter 2 Interpolation

Chapter 2 Interpolation Chapter 2 Interpolation Experiments usually produce a discrete set of data points (x i, f i ) which represent the value of a function f (x) for a finite set of arguments {x 0...x n }. If additional data

More information

Introductory Numerical Analysis

Introductory 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 information

n 1 f n 1 c 1 n+1 = c 1 n $ c 1 n 1. After taking logs, this becomes

n 1 f n 1 c 1 n+1 = c 1 n $ c 1 n 1. After taking logs, this becomes Root finding: 1 a The points {x n+1, }, {x n, f n }, {x n 1, f n 1 } should be co-linear Say they lie on the line x + y = This gives the relations x n+1 + = x n +f n = x n 1 +f n 1 = Eliminating α and

More information

Finite element function approximation

Finite element function approximation THE UNIVERSITY OF WESTERN ONTARIO LONDON ONTARIO Paul Klein Office: SSC 4028 Phone: 661-2111 ext. 85227 Email: paul.klein@uwo.ca URL: www.ssc.uwo.ca/economics/faculty/klein/ Economics 613/614 Advanced

More information

November 20, Interpolation, Extrapolation & Polynomial Approximation

November 20, Interpolation, Extrapolation & Polynomial Approximation Interpolation, Extrapolation & Polynomial Approximation November 20, 2016 Introduction In many cases we know the values of a function f (x) at a set of points x 1, x 2,..., x N, but we don t have the analytic

More information

Curve Fitting. 1 Interpolation. 2 Composite Fitting. 1.1 Fitting f(x) 1.2 Hermite interpolation. 2.1 Parabolic and Cubic Splines

Curve 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 information

Global polynomial interpolants suffer from the Runge Phenomenon if the data sites (nodes) are not chosen correctly.

Global polynomial interpolants suffer from the Runge Phenomenon if the data sites (nodes) are not chosen correctly. Piecewise polynomial interpolation Global polynomial interpolants suffer from the Runge Phenomenon if the data sites (nodes) are not chosen correctly. In many applications, one does not have the freedom

More information

Interpolation and Polynomial Approximation I

Interpolation 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 information

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

Numerical integration and differentiation. Unit IV. Numerical Integration and Differentiation. Plan of attack. Numerical integration. Unit IV Numerical Integration and Differentiation Numerical integration and differentiation quadrature classical formulas for equally spaced nodes improper integrals Gaussian quadrature and orthogonal

More information

Inverses. Stephen Boyd. EE103 Stanford University. October 28, 2017

Inverses. Stephen Boyd. EE103 Stanford University. October 28, 2017 Inverses Stephen Boyd EE103 Stanford University October 28, 2017 Outline Left and right inverses Inverse Solving linear equations Examples Pseudo-inverse Left and right inverses 2 Left inverses a number

More information

CHAPTER 3 Further properties of splines and B-splines

CHAPTER 3 Further properties of splines and B-splines CHAPTER 3 Further properties of splines and B-splines In Chapter 2 we established some of the most elementary properties of B-splines. In this chapter our focus is on the question What kind of functions

More information

Scientific Computing

Scientific 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 information

Math Numerical Analysis Mid-Term Test Solutions

Math Numerical Analysis Mid-Term Test Solutions Math 400 - Numerical Analysis Mid-Term Test Solutions. Short Answers (a) A sufficient and necessary condition for the bisection method to find a root of f(x) on the interval [a,b] is f(a)f(b) < 0 or f(a)

More information

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

Lecture 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 information

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

Interpolation. 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 information

1 Review of Interpolation using Cubic Splines

1 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 information

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

Outline. 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 information

MA2501 Numerical Methods Spring 2015

MA2501 Numerical Methods Spring 2015 Norwegian University of Science and Technology Department of Mathematics MA5 Numerical Methods Spring 5 Solutions to exercise set 9 Find approximate values of the following integrals using the adaptive

More information

Engineering 7: Introduction to computer programming for scientists and engineers

Engineering 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 information

Function Approximation

Function Approximation 1 Function Approximation This is page i Printer: Opaque this 1.1 Introduction In this chapter we discuss approximating functional forms. Both in econometric and in numerical problems, the need for an approximating

More information

ACM106a - Homework 2 Solutions

ACM106a - Homework 2 Solutions ACM06a - Homework 2 Solutions prepared by Svitlana Vyetrenko October 7, 2006. Chapter 2, problem 2.2 (solution adapted from Golub, Van Loan, pp.52-54): For the proof we will use the fact that if A C m

More information

Fixed point iteration and root finding

Fixed point iteration and root finding Fixed point iteration and root finding The sign function is defined as x > 0 sign(x) = 0 x = 0 x < 0. It can be evaluated via an iteration which is useful for some problems. One such iteration is given

More information

CS 323: Numerical Analysis and Computing

CS 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 information

Applied Numerical Analysis Homework #3

Applied Numerical Analysis Homework #3 Applied Numerical Analysis Homework #3 Interpolation: Splines, Multiple dimensions, Radial Bases, Least-Squares Splines Question Consider a cubic spline interpolation of a set of data points, and derivatives

More information

Polynomials. p n (x) = a n x n + a n 1 x n 1 + a 1 x + a 0, where

Polynomials. 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 information

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

Chapter 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 information

The Closed Form Reproducing Polynomial Particle Shape Functions for Meshfree Particle Methods

The Closed Form Reproducing Polynomial Particle Shape Functions for Meshfree Particle Methods The Closed Form Reproducing Polynomial Particle Shape Functions for Meshfree Particle Methods by Hae-Soo Oh Department of Mathematics, University of North Carolina at Charlotte, Charlotte, NC 28223 June

More information

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

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 January, 2014 Outline 1 Introduction 2 Polynomial Interpolation 3 Piecewise Polynomial Interpolation 4 Natural Cubic

More information

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

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 information

Applied Math 205. Full office hour schedule:

Applied 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 information

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)

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) 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 information

Functions & Graphs. Section 1.2

Functions & Graphs. Section 1.2 Functions & Graphs Section 1.2 What you will remember Functions Domains and Ranges Viewing and Interpreting Graphs Even Functions and Odd Functions Symmetry Functions Defined in Pieces Absolute Value Functions

More information

Lecture 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 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 information

Interpolation. 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 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 information

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

We 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 information

Chapter 3 Interpolation and Polynomial Approximation

Chapter 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 information

Applied Numerical Analysis Quiz #2

Applied Numerical Analysis Quiz #2 Applied Numerical Analysis Quiz #2 Modules 3 and 4 Name: Student number: DO NOT OPEN UNTIL ASKED Instructions: Make sure you have a machine-readable answer form. Write your name and student number in the

More information

Chapter 4 No. 4.0 Answer True or False to the following. Give reasons for your answers.

Chapter 4 No. 4.0 Answer True or False to the following. Give reasons for your answers. MATH 434/534 Theoretical Assignment 3 Solution Chapter 4 No 40 Answer True or False to the following Give reasons for your answers If a backward stable algorithm is applied to a computational problem,

More information

Examples 2: Composite Functions, Piecewise Functions, Partial Fractions

Examples 2: Composite Functions, Piecewise Functions, Partial Fractions Examples 2: Composite Functions, Piecewise Functions, Partial Fractions September 26, 206 The following are a set of examples to designed to complement a first-year calculus course. objectives are listed

More information

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

University 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 information

1) The line has a slope of ) The line passes through (2, 11) and. 6) r(x) = x + 4. From memory match each equation with its graph.

1) The line has a slope of ) The line passes through (2, 11) and. 6) r(x) = x + 4. From memory match each equation with its graph. Review Test 2 Math 1314 Name Write an equation of the line satisfying the given conditions. Write the answer in standard form. 1) The line has a slope of - 2 7 and contains the point (3, 1). Use the point-slope

More information

Programs for Natural Cubic Spline Interpolation

Programs for Natural Cubic Spline Interpolation Outlines November 2, 2004 Outlines Part I: The Basics The Basic Method The Data Part I The Basic Method The Data Review of Natural Cubic Spline Method Given a series of points (x 0, f (x 0 )) (x n, f (x

More information

Interpolation and polynomial approximation Interpolation

Interpolation and polynomial approximation Interpolation Outline Interpolation and polynomial approximation Interpolation Lagrange Cubic Splines Approximation B-Splines 1 Outline Approximation B-Splines We still focus on curves for the moment. 2 3 Pierre Bézier

More information

Numerical Analysis Fall. Gauss Elimination

Numerical Analysis Fall. Gauss Elimination Numerical Analysis 2015 Fall Gauss Elimination Solving systems m g g m m g x x x k k k k k k k k k 3 2 1 3 2 1 3 3 3 2 3 2 2 2 1 0 0 Graphical Method For small sets of simultaneous equations, graphing

More information

Exam C Solutions Spring 2005

Exam C Solutions Spring 2005 Exam C Solutions Spring 005 Question # The CDF is F( x) = 4 ( + x) Observation (x) F(x) compare to: Maximum difference 0. 0.58 0, 0. 0.58 0.7 0.880 0., 0.4 0.680 0.9 0.93 0.4, 0.6 0.53. 0.949 0.6, 0.8

More information

Interpolation and polynomial approximation Interpolation

Interpolation and polynomial approximation Interpolation Outline Interpolation and polynomial approximation Interpolation Lagrange Cubic Approximation Bézier curves B- 1 Some vocabulary (again ;) Control point : Geometric point that serves as support to the

More information

LECTURE NOTES ELEMENTARY NUMERICAL METHODS. Eusebius Doedel

LECTURE 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 information

Sample Exam 1 KEY NAME: 1. CS 557 Sample Exam 1 KEY. These are some sample problems taken from exams in previous years. roughly ten questions.

Sample Exam 1 KEY NAME: 1. CS 557 Sample Exam 1 KEY. These are some sample problems taken from exams in previous years. roughly ten questions. Sample Exam 1 KEY NAME: 1 CS 557 Sample Exam 1 KEY These are some sample problems taken from exams in previous years. roughly ten questions. Your exam will have 1. (0 points) Circle T or T T Any curve

More information

Econ Slides from Lecture 7

Econ Slides from Lecture 7 Econ 205 Sobel Econ 205 - Slides from Lecture 7 Joel Sobel August 31, 2010 Linear Algebra: Main Theory A linear combination of a collection of vectors {x 1,..., x k } is a vector of the form k λ ix i for

More information

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

Input: 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 information

Additional exercises with Numerieke Analyse

Additional 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 information

Curve Fitting. Objectives

Curve Fitting. Objectives Curve Fitting Objectives Understanding the difference between regression and interpolation. Knowing how to fit curve of discrete with least-squares regression. Knowing how to compute and understand the

More information

Numerical Methods for Partial Differential Equations

Numerical Methods for Partial Differential Equations Numerical Methods for Partial Differential Equations Eric de Sturler University of Illinois at Urbana-Champaign Read section 8. to see where equations of type (au x ) x = f show up and their (exact) solution

More information

Outline. 1 Numerical Integration. 2 Numerical Differentiation. 3 Richardson Extrapolation

Outline. 1 Numerical Integration. 2 Numerical Differentiation. 3 Richardson Extrapolation Outline Numerical Integration Numerical Differentiation Numerical Integration Numerical Differentiation 3 Michael T. Heath Scientific Computing / 6 Main Ideas Quadrature based on polynomial interpolation:

More information

Piecewise Polynomial Interpolation

Piecewise Polynomial Interpolation Piecewise Polynomial Interpolation 1 Piecewise linear interpolation Suppose we have data point (x k,y k ), k =0, 1,...N. A piecewise linear polynomial that interpolates these points is given by p(x) =p

More information

Spline Methods Draft. Tom Lyche and Knut Mørken

Spline Methods Draft. Tom Lyche and Knut Mørken Spline Methods Draft Tom Lyche and Knut Mørken 25th April 2003 2 Contents 1 Splines and B-splines an Introduction 3 1.1 Convex combinations and convex hulls..................... 3 1.1.1 Stable computations...........................

More information

CHAPTER 10 Shape Preserving Properties of B-splines

CHAPTER 10 Shape Preserving Properties of B-splines CHAPTER 10 Shape Preserving Properties of B-splines In earlier chapters we have seen a number of examples of the close relationship between a spline function and its B-spline coefficients This is especially

More information

Arsène Pérard-Gayot (Slides by Piotr Danilewski)

Arsène Pérard-Gayot (Slides by Piotr Danilewski) Computer Graphics - Splines - Arsène Pérard-Gayot (Slides by Piotr Danilewski) CURVES Curves Explicit y = f x f: R R γ = x, f x y = 1 x 2 Implicit F x, y = 0 F: R 2 R γ = x, y : F x, y = 0 x 2 + y 2 =

More information

Jim Lambers MAT 460/560 Fall Semester Practice Final Exam

Jim Lambers MAT 460/560 Fall Semester Practice Final Exam Jim Lambers MAT 460/560 Fall Semester 2009-10 Practice Final Exam 1. Let f(x) = sin 2x + cos 2x. (a) Write down the 2nd Taylor polynomial P 2 (x) of f(x) centered around x 0 = 0. (b) Write down the corresponding

More information

Numerical Analysis. A Comprehensive Introduction. H. R. Schwarz University of Zürich Switzerland. with a contribution by

Numerical Analysis. A Comprehensive Introduction. H. R. Schwarz University of Zürich Switzerland. with a contribution by Numerical Analysis A Comprehensive Introduction H. R. Schwarz University of Zürich Switzerland with a contribution by J. Waldvogel Swiss Federal Institute of Technology, Zürich JOHN WILEY & SONS Chichester

More information

Introduction. Region of interest. Linear Lagrange Polynomials

Introduction. Region of interest. Linear Lagrange Polynomials Introduction The derivation and codes in this section are based on a section in Press which ends with references to the papers in which the details were wored out. The fact that the derivatives are continuous

More information

Finite difference method for elliptic problems: I

Finite difference method for elliptic problems: I Finite difference method for elliptic problems: I Praveen. C praveen@math.tifrbng.res.in Tata Institute of Fundamental Research Center for Applicable Mathematics Bangalore 560065 http://math.tifrbng.res.in/~praveen

More information

Quaternion Cubic Spline

Quaternion Cubic Spline Quaternion Cubic Spline James McEnnan jmcennan@mailaps.org May 28, 23 1. INTRODUCTION A quaternion spline is an interpolation which matches quaternion values at specified times such that the quaternion

More information

Ph.D. course: Regression models

Ph.D. course: Regression models Ph.D. course: Regression models Non-linear effect of a quantitative covariate PKA & LTS Sect. 4.2.1, 4.2.2 8 May 2017 www.biostat.ku.dk/~pka/regrmodels17 Per Kragh Andersen 1 Linear effects We have studied

More information

Simple Examples on Rectangular Domains

Simple 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

Interpolation and extrapolation

Interpolation 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 information

Ch. 03 Numerical Quadrature. Andrea Mignone Physics Department, University of Torino AA

Ch. 03 Numerical Quadrature. Andrea Mignone Physics Department, University of Torino AA Ch. 03 Numerical Quadrature Andrea Mignone Physics Department, University of Torino AA 2017-2018 Numerical Quadrature In numerical analysis quadrature refers to the computation of definite integrals. y

More information

CS 450 Numerical Analysis. Chapter 8: Numerical Integration and Differentiation

CS 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 information