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)

Size: px
Start display at page:

Download "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)"

Transcription

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 (x) = a j + b j (x x j ) + c j (x x j ) 2 + d j (x x j ), j = 0, n 1 (1) We also require that s(x) satisfies several properties, (i) s(x i ) = y i, or s(x) interpolates the at the x i s (ii) s(x) is continuous at x 1, x 2 x n 1 (iii) s (x) is continuous at x 1, x 2 x n 1 (iv) s (x) is continuous at x 1, x 2 x n 1 The conditions above allow one to determine the values of a j, b j, c j and d j for j = 0, n 1 (almost) The reason I say it almost allows us to compute them is that we are two conditions short Since there are n different s j (x) s and each s j (x) has four coefficients we have 4n unknowns to determine Property (i), is a condition at each of the n+1 points and Properties (ii), (iii) and (iv) are conditions at n-1 points This gives us n+1+(n 1) = 4n 2 equations Generally, you need 4n equations to solve for 4n unknowns which means we are two conditions short These two remaining conditions will be determined by some additional conditions that we will impose There are several different ways of doing this and they have different names: Boundary Conditions Natural Cubic Spline s (x 0 ) = s (x n ) = 0 Not-a-Knot s (x) is continuous at both x 1 and x n 1 Clamped If the spline is interpolating a function f(x) then one can require that s (x 0 ) = f (x 0 ) and s (x n ) = f (x n ) 1

2 Constructing the Spline To construct the spline let us first define h j = x j+1 x j or the spacings between each of the nodes and are known (or easily computable) given the x j sthe first condition (i) gives us that: s j (x j ) = y j or alternatively using (1) we have a j = y j for j = 0, 1, 2 n Note: There is some abuse of notation here as there isn t a function s n (x) but for notational purposes we let still define a n = y n We will also for notational ease allow, for notational ease to define b n, c n and d n to be s n 1(x n ), s n 1(x n ) and s n 1(x n ) However, we do not want these variables in our system when we solve at the end so they must be eliminated before solving Next we use conditions (ii) to recognize that we must have s j (x j+1 ) = y j+1 Using the definition of h his gives: y j+1 = a j + b j h j + x j h 2 j + d j h, j = 0, n 2 (2) Next, condition (iii) means that s j(x j+1 ) = s j+1(x j+1 ) If we take the derivatives of these based on (1) and evaluate at x j+1 we obtain: b j+1 = b j + 2c j h j + d j h 2 j j = 0, n 2 () Similarly, condition (iv) means that s j (x j+1 ) = s j+1(x j+1 ) If we take the derivatives of these based on (1) and evaluate at x j+1 we obtain: Using (4) we can solve for d j giving: 2c j+1 = 2c j + 6d j h j j = 0, n 2 (4) d j = c j+1 c j h j for j = 0, 1, 2, n 2 (5) Then one takes this expression for d j and substitutes it into both () and (2) This gives: and ( a j+1 = a j + b j h j + c j h 2 cj+1 c j j + h j = a j + b j h j + c j+1 + 2c j h 2 j ( b j+1 = b j + 2 cj+1 c j jh j + h j ) h j (6) ) h 2 j (7) = b j + (c j+1 + c j ) h j 2

3 If we solve this last equation (6) for b j we obtain: b j = a j+1 a j 2c j + c j+1 h j (8) h j Now take this expression for b j and substitute ist into (7) This will then leave an equation involving the c s and the a s After some algebra, one arrives at: h j 1 c j 1 + 2(h j 1 + h j )c j + h j c j+1 = h j (a j+1 a j ) h j 1 (a j a j 1 ) (9) which holds for j = 1, 2,, n 1 Assuming we know the a s then this is a system of n 1 equations for the n + 1 unknown c s This we either need to augment this system with two more relations or eliminate two of the c s With this, the general idea is as follows You are given the values {x j } n j=0 and {f j } n j=0 You can immediately find the values for the a js by setting a j = f j You construct a linear system (see below) using (9) to solve for the c s Knowing the c s and the a s you then back substitute for the b s using the boxed equation () and we can back substitute into () to solve for the d s The only issue left is that the linear system isn t a square system and it has c n in it Consequently we need to remove c n and we either need add one more equation (or remove one other variable) Not-A-Knot The not-a-knot boundary conditions require s 0 (x 1 ) = s 1 (x 1 ) and s n 1(x n 1 ) = s n 2(x n 1 ) Since these are cubic functions the third derivatives are constant Consequently, these imply that: d 0 = d 1, d n 2 = d n 1 Using the equations for the d j s given in (), we get: solving for c 0 we find: c 0 = c 1 c 0 h 0 = c 1 ( 1 + h ) 0 c 1 h 0

4 Similarly, we must have: c n = h ( n 1 c n h ) n 1 If we use these two relationships for c 0 and c n to eliminate both c 0 and c n from the equations given in (9) and we will then have a system of n 1 equations for the n 1 unknowns c 1,, We then add in the extra step of getting c 0 using the relations above prior to computing the b s and the d s The system becomes: This can be written in matrix form A c = b where, (h h2 0 h ( + h 2 ) h h 2 2(h 2 + h ) h 0 0 A = ( + ) h2 n 1 c = c 1 c c 4 c n 2 (a 2 a 1 ) h 0 (a 1 a 0 ) h 2 (a a 2 ) (a 2 a 1 ) h, b = (a 4 a ) h 2 (a a 2 ) (a n 1 a n 2 ) h n (a n 2 a n 1 ) (a n a n 1 ) (a n 1 a n 2 ) h2 n 1 (10) 4

5 Example Suppose we are given that our function must pass through the points: (1, 1), (2, 1/2), (, 1/), (4, 1/4), (5, 1/5) Each of our h j s is 1 which makes things a bit nicer First we know that Our linear system becomes c = c If we solve this matrix we obtain: a 0 = 1, a 1 = 1/2, a 2 = 1/, a = 1/4, a 4 = 1/5 (1/ 1/2) (1/2 1) (1/4 1/) (1/ 1/2) = (1/5 1/4) (1/4 1/) c 1 = 1/6, = 1/60, c = 1/60 1 1/4 1/10 We can then get c 0 and c 4 by: Now we can compute the b s c 0 = 2c 1 = 19/60 b 0 = (a 1 a 0 ) (2c 0 + c 1 )/ = (1/2 1) (2(19/60) + 1/6)/ = 2/0 b 1 = (a 2 a 1 ) (2c 1 + )/ = (1/ 1/2) (2(1/6) + 1/60)/ = 17/60 b 2 = (a a 2 ) (2 + c )/ = (1/4 1/) (2(1/60) + 1/60)/ = 1/10 b = b 2 + (c + ) = 1/10 + (1/60 + 1/60) = 1/15 Now we can compute the d s d 0 = (c 1 c 0 )/ = (1/6 19/60)/ = 1/20 d 1 = ( c 1 )/ = (1/60 1/6)/ = 1/20 d 2 = (c )/ = (1/60 1/60)/ = 0 d = d 2 = 0 Thus our spline is of the form: s 0 (x) = (x 1) + 0 (x 60 1)2 1 (x 20 1) 1 < x < 2 s 1 (x) = 1 s(x) = 17(x 2) + 1(x )2 1 (x 20 2) 2 < x < s 2 (x) = (x ) + (x )2 < x < 4 s (x) = (x 4) + (x )2 4 < x < 5 (11) 5

6 MatLab In practice this is not really very fun to do by hand MatLab has a built in command to compute the cubic spline for you The command is called spline(x,y) The default is for it to use the not-a-knot boundary conditions It calls two vectors, x which corresponds to the x j s and y which corresponds to the f j s The vectors should be exactly the same length It outputs the values in sort of an odd way that you have to unpack Below is an example of how to use the command The coef column is the d j, c j, b j and a j values You can alter the way you use spline(x,y) to give the Clamped boundary conditions too To do so you you change the input y vector by adding the value of f (x 0 ) and f (x n ) to the y vector as the first and last entry respectively Now the y will be two entries longer than x A second example of this is below >> x=[-1, -5, 0, 5, 1]; >> y=[ ]; >> pp=spline(x,y); >> [breaks, coef, l, k, d]=unmkpp(pp); >> coef coef = >> subplot(2,1,1) >> y2=[ ]; >> pp2=spline(x,y2); >> [breaks2, coesf2, l2, k2, d2]=unmkpp(pp2); >> coesf coesf = >>y_eval=ppval(spline(x,y),x_eval); >>Y_eval2=ppval(spline(x,y2),x_eval); >> subplot(2,1,1) >> plot(x_eval, y_eval1, x_eval, y_eval2, x_eval, (x_eval+1)*exp(-x_eval),x, y, bo ) >> subplot(2,1,2) >> plot(x_eval, y_eval1-(x_eval+1)*exp(-x_eval), x_eval, y_eval2-(x_eval+1) *exp(-x_eval),x, y-y, bo ) >>maxnak=max(abs(y_eval1-(x_eval+1)*exp(-x_eval)) >>maxclamp=max(abs(y_eval2-(x_eval+1)*exp(-x_eval)) 6

7 Clamped For the clamped boundary conditions one must have information about the values of the derivatives at the endpoints of the interval Namely, we must have that s 0(x 0 ) = b 0 = f 0 is a given value and s n 1(x n ) = b n = f n is also a given value The result of these assignments is that we have: 2h 0 c 0 + h 0 c 1 = h 0 (a 1 a 0 ) f 0 which will be added to our linear system and 2 c n = f n (a n a n 1 ) which can be added as an extra equation for c n from the linear system The matrix equation we have then for the clamped boundary conditions is A c = b where, 2h 0 h h 0 2(h 0 + ) ( + h 2 ) h h 2 2(h 2 + h ) h A = ( + ) h n 2(h n + ) c = c 0 c 1 c c 4 c n 2 c n h 0 (a 1 a 0 ) f 0 (a 2 a 1 ) h 0 (a 1 a 0 ) h 2 (a a 2 ) (a 2 a 1 ) h, b = (a 4 a ) h 2 (a a 2 ) (a n 1 a n 2 ) h n (a n 2 a n 1 ) (a n a n 1 ) (a n 1 a n 2 ) f n (a n a n 1 ) (12) 7

8 ERROR THEOREM Let f(x) be continuous, with four continuous derivatives, on the interval [a, b], and let s be the clamped cubic spline interpolant of f relative to the partition: Then where h = max (x i+1 x i ) 0 i n 1 a = x 0 < x 1 < x 2 x n = b 5 max f(x) s(x) x [a,b] 84 h4 max f (4) (x) x [a,b] 8

9 Notes for Exams Given the x j s and corresponding y j s Not-A-Knot a j = y j for j = 0, 1, 2 n (1) First find the a j s and the h j s Then for the Not-a-Knot boundary conditions find the c 1, by solving the linear system: A c = b where, (h h2 0 h ( + h 2 ) h h 2 2(h 2 + h ) h 0 0 A = ( + ) h2 n 1 c = Then find c 0 using: and set c 1 c c 4 c n h2 n 1 (a 2 a 1 ) h 0 (a 1 a 0 ) h 2 (a a 2 ) (a 2 a 1 ) h, b = (a 4 a ) h 2 (a a 2 ) (a n 1 a n 2 ) h n (a n 2 a n 1 ) (a n a n 1 ) (a n 1 a n 2 ) c 0 = Then find the b j s and the d j s using: ( 1 + h ) 0 c 1 h 0 c n = h ( n 1 c n h ) n 1 d j = c j+1 c j h j for j = 0, 1, 2, n 1 b j = a j+1 a j 2c j + c j+1 h j h j 9

10 Given the x j s and corresponding y j s and f 0 and f n Clamped a j = y j for j = 0, 1, 2 n (14) First find the a j s and the h j s Then, for the Clamped boundary conditions find the c 1, by solving the linear system A c = b where, 2h 0 h h 0 2(h 0 + ) ( + h 2 ) h h 2 2(h 2 + h ) h A = ( + ) h n 2(h n + ) c = c 0 c 1 c c 4 c n 2 c n Then find the b j s and the d j s using: h 0 (a 1 a 0 ) f 0 (a 2 a 1 ) h 0 (a 1 a 0 ) h 2 (a a 2 ) (a 2 a 1 ) h, b = (a 4 a ) h 2 (a a 2 ) (a n 1 a n 2 ) h n (a n 2 a n 1 ) (a n a n 1 ) (a n 1 a n 2 ) f n (a n a n 1 ) d j = c j+1 c j h j for j = 0, 1, 2, n 1 b j = a j+1 a j 2c j + c j+1 h j For both equations you then write down: s 0 (x) = a 0 + b 0 (x x 0 ) + c 0 (x x 0 ) 2 + d 0 (x x 0 ) x [x 0, x 1 ] s 1 (x) = a 1 + b 0 (x x 1 ) + c 1 (x x 1 ) 2 + d 1 (x x 1 ) x [x 1, x 2 ] s(x) = s n 1 (x) = a n 1 + b n 1 (x x n 1 ) + (x x n 1 ) 2 + d n 1 (x x n 1 ) x [x n 1, x n ] h j 10

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

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

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

1 Piecewise Cubic Interpolation

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

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

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

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

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

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

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

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

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

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

MATH 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 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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Approximation of Continuous Functions

Approximation of Continuous Functions Approximation of Continuous Functions Francis J. Narcowich October 2014 1 Modulus of Continuit Recall that ever function continuous on a closed interval < a x b < is uniforml continuous: For ever ɛ > 0,

More information

Preliminary Examination in Numerical Analysis

Preliminary 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 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

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

Math 231E, Lecture 13. Area & Riemann Sums

Math 231E, Lecture 13. Area & Riemann Sums Math 23E, Lecture 3. Area & Riemann Sums Motivation for Integrals Question. What is an integral, and why do we care? Answer. A tool to compute a complicated expression made up of smaller pieces. Example.

More information

Applied Linear Algebra in Geoscience Using MATLAB

Applied Linear Algebra in Geoscience Using MATLAB Applied Linear Algebra in Geoscience Using MATLAB Contents Getting Started Creating Arrays Mathematical Operations with Arrays Using Script Files and Managing Data Two-Dimensional Plots Programming in

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

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

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

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

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

Hani Mehrpouyan, California State University, Bakersfield. Signals and Systems

Hani Mehrpouyan, California State University, Bakersfield. Signals and Systems Hani Mehrpouyan, Department of Electrical and Computer Engineering, Lecture 26 (LU Factorization) May 30 th, 2013 The material in these lectures is partly taken from the books: Elementary Numerical Analysis,

More information

Least squares regression

Least 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 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

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

11 /2 12 /2 13 /6 14 /14 15 /8 16 /8 17 /25 18 /2 19 /4 20 /8

11 /2 12 /2 13 /6 14 /14 15 /8 16 /8 17 /25 18 /2 19 /4 20 /8 MAC 1147 Exam #1a Answer Key Name: Answer Key ID# Summer 2012 HONOR CODE: On my honor, I have neither given nor received any aid on this examination. Signature: Instructions: Do all scratch work on the

More information

Numerical Methods Lecture 2 Simultaneous Equations

Numerical Methods Lecture 2 Simultaneous Equations Numerical Methods Lecture 2 Simultaneous Equations Topics: matrix operations solving systems of equations pages 58-62 are a repeat of matrix notes. New material begins on page 63. Matrix operations: Mathcad

More information

Last week we looked at limits generally, and at finding limits using substitution.

Last week we looked at limits generally, and at finding limits using substitution. Math 1314 ONLINE Week 4 Notes Lesson 4 Limits (continued) Last week we looked at limits generally, and at finding limits using substitution. Indeterminate Forms What do you do when substitution gives you

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

MA 323 Geometric Modelling Course Notes: Day 07 Parabolic Arcs

MA 323 Geometric Modelling Course Notes: Day 07 Parabolic Arcs MA 323 Geometric Modelling Course Notes: Day 07 Parabolic Arcs David L. Finn December 9th, 2004 We now start considering the basic curve elements to be used throughout this course; polynomial curves and

More information

Lecture 7: Introduction to linear systems

Lecture 7: Introduction to linear systems Lecture 7: Introduction to linear systems Two pictures of linear systems Consider the following system of linear algebraic equations { x 2y =, 2x+y = 7. (.) Note that it is a linear system with two unknowns

More information

Polynomial Interpolation

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

STEP Support Programme. Hints and Partial Solutions for Assignment 17

STEP Support Programme. Hints and Partial Solutions for Assignment 17 STEP Support Programme Hints and Partial Solutions for Assignment 7 Warm-up You need to be quite careful with these proofs to ensure that you are not assuming something that should not be assumed. For

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

Algorithms and Data Structures Final Lesson

Algorithms and Data Structures Final Lesson Algorithms and Data Structures Final Lesson Michael Schwarzkopf https://www.uni weimar.de/de/medien/professuren/medieninformatik/grafische datenverarbeitung Bauhaus University Weimar July 11, 2018 (Corrected

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

1 Lecture 8: Interpolating polynomials.

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

BRILL-NOETHER THEORY, II

BRILL-NOETHER THEORY, II This article follows the paper of Griffiths and Harris, "On the variety of special linear systems on a general algebraic curve" 1 WARMUP ON DEGENERATIONS The classic first problem in Schubert calculus

More information

An Efficient Algorithm Based on Quadratic Spline Collocation and Finite Difference Methods for Parabolic Partial Differential Equations.

An Efficient Algorithm Based on Quadratic Spline Collocation and Finite Difference Methods for Parabolic Partial Differential Equations. An Efficient Algorithm Based on Quadratic Spline Collocation and Finite Difference Methods for Parabolic Partial Differential Equations by Tong Chen A thesis submitted in conformity with the requirements

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

Chapter 2. Mathematical Reasoning. 2.1 Mathematical Models

Chapter 2. Mathematical Reasoning. 2.1 Mathematical Models Contents Mathematical Reasoning 3.1 Mathematical Models........................... 3. Mathematical Proof............................ 4..1 Structure of Proofs........................ 4.. Direct Method..........................

More information

MATRICES. a m,1 a m,n A =

MATRICES. a m,1 a m,n A = MATRICES Matrices are rectangular arrays of real or complex numbers With them, we define arithmetic operations that are generalizations of those for real and complex numbers The general form a matrix of

More information

Lecture 2e Row Echelon Form (pages 73-74)

Lecture 2e Row Echelon Form (pages 73-74) Lecture 2e Row Echelon Form (pages 73-74) At the end of Lecture 2a I said that we would develop an algorithm for solving a system of linear equations, and now that we have our matrix notation, we can proceed

More information

(Mathematical Operations with Arrays) Applied Linear Algebra in Geoscience Using MATLAB

(Mathematical Operations with Arrays) Applied Linear Algebra in Geoscience Using MATLAB Applied Linear Algebra in Geoscience Using MATLAB (Mathematical Operations with Arrays) Contents Getting Started Matrices Creating Arrays Linear equations Mathematical Operations with Arrays Using Script

More information

Numerical techniques to solve equations

Numerical techniques to solve equations Programming for Applications in Geomatics, Physical Geography and Ecosystem Science (NGEN13) Numerical techniques to solve equations vaughan.phillips@nateko.lu.se Vaughan Phillips Associate Professor,

More information

Math 671: Tensor Train decomposition methods

Math 671: Tensor Train decomposition methods Math 671: Eduardo Corona 1 1 University of Michigan at Ann Arbor December 8, 2016 Table of Contents 1 Preliminaries and goal 2 Unfolding matrices for tensorized arrays The Tensor Train decomposition 3

More information

Barycentric rational interpolation with no poles and high rates of approximation

Barycentric rational interpolation with no poles and high rates of approximation Barycentric rational interpolation with no poles and high rates of approximation Michael S. Floater Kai Hormann Abstract It is well known that rational interpolation sometimes gives better approximations

More information

Lecture 10: Powers of Matrices, Difference Equations

Lecture 10: Powers of Matrices, Difference Equations Lecture 10: Powers of Matrices, Difference Equations Difference Equations A difference equation, also sometimes called a recurrence equation is an equation that defines a sequence recursively, i.e. each

More information

CS 542G: Conditioning, BLAS, LU Factorization

CS 542G: Conditioning, BLAS, LU Factorization CS 542G: Conditioning, BLAS, LU Factorization Robert Bridson September 22, 2008 1 Why some RBF Kernel Functions Fail We derived some sensible RBF kernel functions, like φ(r) = r 2 log r, from basic principles

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

Computing the Hausdorff Distance between Two B-Spline Curves. Zachi Shtain

Computing the Hausdorff Distance between Two B-Spline Curves. Zachi Shtain Computing the Hausdorff Distance between Two B-Spline Curves Zachi Shtain Based on the work of: Chen et al. 2010 Definition Given two curves C 1, C 2, their Hausdorff distance is defined as: H Where:,

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

Handout 1 EXAMPLES OF SOLVING SYSTEMS OF LINEAR EQUATIONS

Handout 1 EXAMPLES OF SOLVING SYSTEMS OF LINEAR EQUATIONS 22M:33 J. Simon page 1 of 7 22M:33 Summer 06 J. Simon Example 1. Handout 1 EXAMPLES OF SOLVING SYSTEMS OF LINEAR EQUATIONS 2x 1 + 3x 2 5x 3 = 10 3x 1 + 5x 2 + 6x 3 = 16 x 1 + 5x 2 x 3 = 10 Step 1. Write

More information

Energy is always partitioned into the maximum number of states possible.

Energy is always partitioned into the maximum number of states possible. ENTROPY Entropy is another important aspect of thermodynamics. Enthalpy has something to do with the energetic content of a system or a molecule. Entropy has something to do with how that energy is stored.

More information

Answer Key for Exam #2

Answer Key for Exam #2 . Use elimination on an augmented matrix: Answer Key for Exam # 4 4 8 4 4 4 The fourth column has no pivot, so x 4 is a free variable. The corresponding system is x + x 4 =, x =, x x 4 = which we solve

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

CprE 281: Digital Logic

CprE 281: Digital Logic CprE 28: Digital Logic Instructor: Alexander Stoytchev http://www.ece.iastate.edu/~alexs/classes/ Code Converters CprE 28: Digital Logic Iowa State University, Ames, IA Copyright Alexander Stoytchev HW

More information

2D Plotting with Matlab

2D Plotting with Matlab GEEN 1300 Introduction to Engineering Computing Class Meeting #22 Monday, Nov. 9 th Engineering Computing and Problem Solving with Matlab 2-D plotting with Matlab Script files User-defined functions Matlab

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

Numerical Methods Lecture 2 Simultaneous Equations

Numerical Methods Lecture 2 Simultaneous Equations CGN 42 - Computer Methods Numerical Methods Lecture 2 Simultaneous Equations Topics: matrix operations solving systems of equations Matrix operations: Adding / subtracting Transpose Multiplication Adding

More information

SOLVING LINEAR SYSTEMS

SOLVING LINEAR SYSTEMS SOLVING LINEAR SYSTEMS We want to solve the linear system a, x + + a,n x n = b a n, x + + a n,n x n = b n This will be done by the method used in beginning algebra, by successively eliminating unknowns

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

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

11 The Max-Product Algorithm

11 The Max-Product Algorithm Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science 6.438 Algorithms for Inference Fall 2014 11 The Max-Product Algorithm In the previous lecture, we introduced

More information

2 2 + x =

2 2 + x = Lecture 30: Power series A Power Series is a series of the form c n = c 0 + c 1 x + c x + c 3 x 3 +... where x is a variable, the c n s are constants called the coefficients of the series. n = 1 + x +

More information

Homework and Computer Problems for Math*2130 (W17).

Homework and Computer Problems for Math*2130 (W17). Homework and Computer Problems for Math*2130 (W17). MARCUS R. GARVIE 1 December 21, 2016 1 Department of Mathematics & Statistics, University of Guelph NOTES: These questions are a bare minimum. You should

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

Interpolation. Chapter Interpolation. 7.2 Existence, Uniqueness and conditioning

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

for some n i (possibly infinite).

for some n i (possibly infinite). Homology with coefficients: The chain complexes that we have dealt with so far have had elements which are Z-linear combinations of basis elements (which are themselves singular simplices or equivalence

More information

MA 323 Geometric Modelling Course Notes: Day 12 de Casteljau s Algorithm and Subdivision

MA 323 Geometric Modelling Course Notes: Day 12 de Casteljau s Algorithm and Subdivision MA 323 Geometric Modelling Course Notes: Day 12 de Casteljau s Algorithm and Subdivision David L. Finn Yesterday, we introduced barycentric coordinates and de Casteljau s algorithm. Today, we want to go

More information

Math 307 Learning Goals. March 23, 2010

Math 307 Learning Goals. March 23, 2010 Math 307 Learning Goals March 23, 2010 Course Description The course presents core concepts of linear algebra by focusing on applications in Science and Engineering. Examples of applications from recent

More information

Numerical Integration

Numerical Integration Chapter 1 Numerical Integration In this chapter we examine a few basic numerical techniques to approximate a definite integral. You may recall some of this from Calculus I where we discussed the left,

More information

Polynomial Interpolation

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

Problem Set # 1 Solution, 18.06

Problem Set # 1 Solution, 18.06 Problem Set # 1 Solution, 1.06 For grading: Each problem worths 10 points, and there is points of extra credit in problem. The total maximum is 100. 1. (10pts) In Lecture 1, Prof. Strang drew the cone

More information

MATH 3283W L A TEX project template

MATH 3283W L A TEX project template MATH 3283W L A TEX project template Your Name Spring 208 Section Title The odds are that you won t need sections in your writing project, but this template includes a few section headers, so that you can

More information

Lecture 28 The Main Sources of Error

Lecture 28 The Main Sources of Error Lecture 28 The Main Sources of Error Truncation Error Truncation error is defined as the error caused directly by an approximation method For instance, all numerical integration methods are approximations

More information

18.303: Introduction to Green s functions and operator inverses

18.303: Introduction to Green s functions and operator inverses 8.33: Introduction to Green s functions and operator inverses S. G. Johnson October 9, 2 Abstract In analogy with the inverse A of a matri A, we try to construct an analogous inverse  of differential

More information

Polynomial approximation and Splines

Polynomial approximation and Splines Polnomial approimation and Splines 1. Weierstrass approimation theorem The basic question we ll look at toda is how to approimate a complicated function f() with a simpler function P () f() P () for eample,

More information