Engineering Analysis ENG 3420 Fall Dan C. Marinescu Office: HEC 439 B Office hours: Tu-Th 11:00-12:00

Size: px
Start display at page:

Download "Engineering Analysis ENG 3420 Fall Dan C. Marinescu Office: HEC 439 B Office hours: Tu-Th 11:00-12:00"

Transcription

1 Engineering Analysis ENG 3420 Fall 2009 Dan C. Marinescu Office: HEC 439 B Office hours: Tu-Th 11:00-12:00 1

2 Lecture 24 Attention: The last homework HW5 and the last project are due on Tuesday November 24!! Last time: Lagrange interpolating polynomials Splines Today Cubic splines Searching and sorting Numerical integration (chapter 17) Next Time Numerical integration Lecture 24 2

3 Cubic splines Cubic splines the simplest representation with the appearance of smoothness and without the problems of higher order polynomials. Linear splines have discontinuous first derivatives Quadratic splines have discontinuous second derivatives and require setting the second derivative at some point to a pre-determined value Quartic or higher-order splines tend to exhibit ill-conditioning or oscillations. The cubic spline function for the i th interval can be written as: s i x ()= a i + b i x x i ( )+ c i x x i ( ) 2 + d i ( x x i ) 3 For n data points, there are (n-1) intervals and thus 4(n-1) unknowns to evaluate to solve all the spline function coefficients. 3

4 Conditions to determine the spline coefficients The first condition the spline function goes through the first and last point of the interval; this leads to 2(n-1) equations: s i ( x i )= f i a i = f i s i ( x i+1 )= f i s i ( x i+1 )= a i + b i ( x i+1 x i )+ c i x i+1 x i ( ) 2 + d i ( x i+1 x i ) 3 = f i The second condition the first derivative should be continuous at each interior point; this leads to (n-2) equations: ' ' s i ( x i+1 )= s i+1 ( x i+1 ) b i + 2c i x i+1 x i ( )+ 3d i x i+1 x i ( ) 2 = b i+1 The third condition the second derivative should be continuous at each interior point; this leads to (n-2) equations: '' '' s i ( x i+1 )= s i+1 ( x i+1 ) 2c i + 6d i x i+1 x i ( )= 2c i+1 So far we have (4n-6) equations; we need (4n-4) equations! 4

5 Two additional equations There are several options for the final two equations: Natural end conditions the second derivative at the end knots are zero. Clamped end conditions the first derivatives at the first and last knots are known. Not-a-knot end conditions force continuity of the third derivative at the second and penultimate points (results in the first two intervals having the same spline function and the last two intervals having the same spline function) 5

6 Built-in functions for piecewise interpolation MATLAB has several built-in functions to implement piecewise interpolation. spline yy=spline(x, y, xx) Performs cubic spline interpolation, generally using not-a-knot conditions. If y contains two more values than x has entries, then the first and last value in y are used as the derivatives at the end points (i.e. clamped) Example: Generate data: x = linspace(-1, 1, 9); y = 1./(1+25*x.^2); Calculate 100 model points and determine not-a-knot interpolation xx = linspace(-1, 1); yy = spline(x, y, xx); Calculate actual function values at model points and data points, the 9-point not-a-knot interpolation (solid), and the actual function (dashed), yr = 1./(1+25*xx.^2) plot(x, y, o, xx, yy, -, xx, yr, -- ) 6

7 Clamped example Generate data w/ first derivative information: x = linspace(-1, 1, 9); y = 1./(1+25*x.^2); yc = [1 y -4] Calculate 100 model points and determine not-a-knot interpolation xx = linspace(-1, 1); yyc = spline(x, yc, xx); Calculate actual function values at model points and data points, the 9-point clamped interpolation (solid), and the actual function (dashed), yr = 1./(1+25*xx.^2) plot(x, y, o, xx, yyc, -, xx, yr, -- ) 7

8 interp1 built-in function interp1 function performs several different kinds of interpolation: yi = interp1(x, y, xi, method ) x& ycontain the original data xi contains the points at which to interpolate method is a string containing the desired method: nearest - nearest neighbor interpolation linear - connects the points with straight lines spline - not-a-knot cubic spline interpolation pchip or cubic - piecewise cubic Hermite interpolation 8

9 Piecewise Polynomial Comparisons 9

10 Multidimensional Interpolation The interpolation methods for onedimensional problems can be extended to multidimensional interpolation. Example - bilinear interpolation using Lagrange-form equations: f( x i, y i )= x i x 2 y i y 2 f( x 1, y 1 )+L x 1 x 2 y 1 y 2 x i x 1 y i y 2 f( x 2, y 1 )+L x 2 x 1 y 1 y 2 x i x 2 y i y 1 f( x 1, y 2 )+L x 1 x 2 y 2 y 1 x i x 1 y i y 1 f( x 2, y 2 ) x 2 x 1 y 2 y 1 10

11 Built-in functions for two- and three-dimensional piecewise interpolation 2-D interpolation: the inputs are vectors or same-size matrices. zi = interp2(x, y, z, xi, yi, method ) 3-D interpolation: the inputs are vectors or same-size 3-D arrays. vi = interp3(x, y, z, v, xi, yi, zi, method ) method is a string containing the desired method: nearest, linear, spline, pchip, cubic 11

12 Search algorithms Find an element of a set based upon some search criteria. Linear search: Compare each element of the set with the target Requires O(n) operations if the set of n elements is not sorted Binary search: Can be done only when the list is sorted. Requires O(log(n)) comparisons. Algorithm: Check the middle element. If the middle element is equal to the sought value, then the position has been found; Otherwise, the upper half or lower half is chosen for search based on whether the element is greater than or less than the middle element. 12

13 Sorting algorithms Algorithms that puts elements of a list in a certain order, e.g., numerical order and lexicographical order. Input: a list of n unsorted elements. Output: the list sorted in increasing order. Bubble sort complexity: average O(n 2 ); )); worst case O(n 2 ). Compare each pair of elements; swap them if they are in the wrong order. Go again through the list until no swaps are necessary. Quick sort complexity: average O(n log(n)); worst case O(n 2 ). Pick an element, called a pivot, from the list. Reorder the list so that all elements which are less than the pivot come before the pivot and all elements greater than the pivot come after it (equal values can go either way). After this partitioning, the pivot is in its final position. Recursively sort the sub-list of lesser elements and the sub-list of greater elements. 13

14 Sorting algorithms (cont d) Merge sort invented by John von Neumann: 1. Complexity: average O(n log(n)); worst case O(n log(n)); 2. If the list is of length 0 or 1, then it is already sorted. Otherwise: 3. Divide the unsorted list into two sublists of about half the size. 4. Sort each sublist recursively by re-applying merge sort. 5. Merge the two sublists back into one sorted list. Tournament sort: Complexity: average O(n log(n)); worst case O(n log(n)); It imitates conducting a tournament in which two players play with each other. Compare numbers in pairs, then form a temporary array with the winning elements. Repeat this process until you get the greatest or smallest element based on your choice. 14

15 Integration Integration: I = b () f x dx a is the total value, or summation, of f(x) dx over the range from a to b: 15

16 Newton-Cotes formulas The most common numerical integration schemes. Based on replacing a complicated function or tabulated data with a polynomial that is easy to integrate: I = b () f x dx f n x dx a () where f n (x) is an n th order interpolating polynomial. b a 16

17 Newton-Cotes Examples The integrating function can be polynomials for any order - for example, (a) straight lines or (b) parabolas. The integral can be approximated in one step or in a series of steps to improve accuracy. 17

18 The trapezoidal rule The trapezoidal rule is the first of the Newton-Cotes closed integration formulas; it uses a straight-line approximation for the function: b () I = f n x dx I = a () f (a)+ f () b f a b ( x a) dx a b a I = ( b a) f ()+ a f b 2 () 18

19 Error of the trapezoidal rule An estimate for the local truncation error of a single application of the trapezoidal rule is: E t = 1 12 f ξ ()b ( a) 3 where ξ is somewhere between a and b. This formula indicates that the error is dependent upon the curvature of the actual function as well as the distance between the points. Error can thus be reduced by breaking the curve into parts. 19

20 Composite Trapezoidal Rule Assuming n+1 data points are evenly spaced, there will be n intervals over which to integrate. The total integral can be calculated by integrating each subinterval and then adding them together: x n x 1 x 2 x n I = f n () x dx = f x n x 0 () dx + f x n x 0 () dx +L+ f x n x 1 () dx x n 1 I = ( x 1 x 0 ) f ( x 0)+ f() x 1 + ( x 2 x 1 ) f ()+ x 1 f( x 2 ) 2 2 I = h n 1 2 f ( x 0)+ 2 f( x i ) + f( x n ) i =1 +L+ ( x n x n 1 ) f x n 1 ( )+ f x n 2 ( ) 20

21 MATLAB Program 21

22 Simpson s Rules One drawback of the trapezoidal rule is that the error is related to the second derivative of the function. More complicated approximation formulas can improve the accuracy for curves - these include using (a) 2nd and (b) 3rd order polynomials. The formulas that result from taking the integrals under these polynomials are called Simpson s rules. 22

23 Simpson s 1/3 Rule Simpson s 1/3 rule corresponds to using second-order polynomials. Using the Lagrange form for a quadratic fit of three points: f n ( ()= x x x 1) ( x x 2 ) ( )( ) f x 0 x 0 x 1 x 0 x 2 Integration over the three points simplifies to: x 2 I = f n () x dx x 0 ( ) ( x x 2 ) ( )( ) f x 1 ( )+ x x 0 x 1 x 0 x 1 x 2 [ ( )] I = h 3 f ( x 0)+ 4 f( x 1 )+ f x 2 ( ) ( x x 1 ) ( )( ) f ( x 2) ( )+ x x 0 x 2 x 0 x 2 x 1 23

24 Error of Simpson s 1/3 Rule An estimate for the local truncation error of a single application of Simpson s 1/3 rule is: () ξ E t = f 4 ()b ( a) 5 where again ξ is somewhere between a and b. This formula indicates that the error is dependent upon the fourth-derivative of the actual function as well as the distance between the points. Note that the error is dependent on the fifth power of the step size (rather than the third for the trapezoidal rule). Error can thus be reduced by breaking the curve into parts. 24

25 Composite Simpson s 1/3 rule Simpson s 1/3 rule can be used on a set of subintervals in much the same way the trapezoidal rule was, except there must be an odd number of points. Because of the heavy weighting of the internal points, the formula is a little more complicated than for the trapezoidal rule: x n x 2 x 4 x n I = f n () x dx = f n () x dx + f n () x dx +L+ f n () x dx x 0 x 0 x 2 I = h [ 3 f ( x 0)+ 4 f( x 1 )+ f( x 2 )]+ h [ 3 f ( x 2)+ 4 f( x 3 )+ f( x 4 )]+L+ h 3 f ( x n 2)+ 4 f( x n 1 )+ f x n I = h n 1 n 2 3 f ( x 0)+ 4 f( x i ) + 2 f x i i=1 j=2 i, odd j, even ( ) ( ) + f x n x n 2 [ ( )] 25

26 Simpson s 3/8 rule Simpson s 3/8 rule corresponds to using third-order polynomials to fit four points. Integration over the four points simplifies to: x 3 I = f n () x dx x 0 [ ( )] I = 3h 8 f ( x 0)+ 3 f( x 1 )+ 3 f( x 2 )+ f x 3 Simpson s 3/8 rule is generally used in concert with Simpson s 1/3 rule when the number of segments is odd. 26

27 Higher-order formulas Higher-order Newton-Cotes formulas may also be used - in general, the higher the order of the polynomial used, the higher the derivative of the function in the error estimate and the higher the power of the step size. As in Simpson s 1/3 and 3/8 rule, the even-segment-odd-point formulas have truncation errors that are the same order as formulas adding one more point. For this reason, the even-segment-oddpoint formulas are usually the methods of preference. 27

28 Integration with unequal segments The trapezoidal rule with data containing unequal segments: x n x 1 x 2 x n I = f n () x dx = f n () x dx + f n () x dx +L+ f n () x dx x 0 I = ( x 1 x 0 ) f x 0 x 0 ( )+ f x 1 2 ( ) x 1 + ( x 2 x 1 ) f x 1 ( )+ f x 2 2 ( ) x n 1 +L+ ( x n x n 1 ) f x n 1 ( )+ f x n 2 ( ) 28

29 Integration with unequal segments 29

30 Built-in functions MATLAB has built-in functions to evaluate integrals based on the trapezoidal rule z = trapz(y) z = trapz(x, y) produces the integral of y with respect to x. If x is omitted, the program assumes h=1. z = cumtrapz(y) z = cumtrapz(x, y) produces the cumulative integral of y with respect to x. If x is omitted, the program assumes h=1. 30

31 Multiple Integrals Multiple integrals can be determined numerically by first integrating in one dimension, then a second, and so on for all dimensions of the problem. 31

Splines and Piecewise Interpolation. Hsiao-Lung Chan Dept Electrical Engineering Chang Gung University, Taiwan

Splines and Piecewise Interpolation. Hsiao-Lung Chan Dept Electrical Engineering Chang Gung University, Taiwan Splines and Piecewise Interpolation Hsiao-Lung Chan Dept Electrical Engineering Chang Gung University, Taiwan chanhl@mail.cgu.edu.tw Splines n 1 intervals and n data points 2 Splines (cont.) Go through

More information

ES 240: Scientific and Engineering Computation. a function f(x) that can be written as a finite series of power functions like

ES 240: Scientific and Engineering Computation. a function f(x) that can be written as a finite series of power functions like Polynomial Deinition a unction () that can be written as a inite series o power unctions like n is a polynomial o order n n ( ) = A polynomial is represented by coeicient vector rom highest power. p=[3-5

More information

Handout 4 - Interpolation Examples

Handout 4 - Interpolation Examples Handout 4 - Interpolation Examples Middle East Technical University Example 1: Obtaining the n th Degree Newton s Interpolating Polynomial Passing through (n+1) Data Points Obtain the 4 th degree Newton

More information

ME 261: Numerical Analysis Lecture-12: Numerical Interpolation

ME 261: Numerical Analysis Lecture-12: Numerical Interpolation 1 ME 261: Numerical Analysis Lecture-12: Numerical Interpolation Md. Tanver Hossain Department of Mechanical Engineering, BUET http://tantusher.buet.ac.bd 2 Inverse Interpolation Problem : Given a table

More information

Lecture 8. Divided Differences,Least-Squares Approximations. Ceng375 Numerical Computations at December 9, 2010

Lecture 8. Divided Differences,Least-Squares Approximations. Ceng375 Numerical Computations at December 9, 2010 Lecture 8, Ceng375 Numerical Computations at December 9, 2010 Computer Engineering Department Çankaya University 8.1 Contents 1 2 3 8.2 : These provide a more efficient way to construct an interpolating

More information

8 Piecewise Polynomial Interpolation

8 Piecewise Polynomial Interpolation Applied Math Notes by R. J. LeVeque 8 Piecewise Polynomial Interpolation 8. Pitfalls of high order interpolation Suppose we know the value of a function at several points on an interval and we wish to

More information

Interpolation - 2D mapping Tutorial 1: triangulation

Interpolation - 2D mapping Tutorial 1: triangulation Tutorial 1: triangulation Measurements (Zk) at irregular points (xk, yk) Ex: CTD stations, mooring, etc... The known Data How to compute some values on the regular spaced grid points (+)? The unknown data

More information

Remark. Jacobs University Visualization and Computer Graphics Lab : ESM4A - Numerical Methods 331

Remark. Jacobs University Visualization and Computer Graphics Lab : ESM4A - Numerical Methods 331 Remark Reconsidering the motivating example, we observe that the derivatives are typically not given by the problem specification. However, they can be estimated in a pre-processing step. A good estimate

More information

Lecture 9. Curve fitting. Interpolation. Lecture in Numerical Methods from 28. April 2015 UVT. Lecture 9. Numerical. Interpolation his o

Lecture 9. Curve fitting. Interpolation. Lecture in Numerical Methods from 28. April 2015 UVT. Lecture 9. Numerical. Interpolation his o Curve fitting. Lecture in Methods from 28. April 2015 to ity Interpolation FIGURE A S Splines Piecewise relat UVT Agenda of today s lecture 1 Interpolation Idea 2 3 4 5 6 Splines Piecewise Interpolation

More information

Computational Physics PHYS 420

Computational Physics PHYS 420 Computational Physics PHYS 420 Dr Richard H. Cyburt Assistant Professor of Physics My office: 402c in the Science Building My phone: (304) 384-6006 My email: rcyburt@concord.edu My webpage: www.concord.edu/rcyburt

More information

APPM/MATH Problem Set 4 Solutions

APPM/MATH Problem Set 4 Solutions APPM/MATH 465 Problem Set 4 Solutions This assignment is due by 4pm on Wednesday, October 16th. You may either turn it in to me in class on Monday or in the box outside my office door (ECOT 35). Minimal

More information

lecture 10: B-Splines

lecture 10: B-Splines 9 lecture : -Splines -Splines: a basis for splines Throughout our discussion of standard polynomial interpolation, we viewed P n as a linear space of dimension n +, and then expressed the unique interpolating

More information

Chapter 3. Numerical Differentiation, Interpolation, and Integration. Instructor: Dr. Ming Ye

Chapter 3. Numerical Differentiation, Interpolation, and Integration. Instructor: Dr. Ming Ye Chapter 3 Numerical Differentiation, Interpolation, and Integration Instructor: Dr. Ming Ye Measuring Flow in Natural Channels Mean-Section Method (1) Divide the stream into a number of rectangular elements

More information

99 International Journal of Engineering, Science and Mathematics

99 International Journal of Engineering, Science and Mathematics Journal Homepage: Applications of cubic splines in the numerical solution of polynomials Najmuddin Ahmad 1 and Khan Farah Deeba 2 Department of Mathematics Integral University Lucknow Abstract: In this

More information

Numerical Integration

Numerical Integration Numerical Integration Numerical Integration is the process of computing the value of a definite integral, when the values of the integrand function, are given at some tabular points. As in the case of

More information

Splines. Parameterization of a Curve. Curve Representations. Roller coaster. What Do We Need From Curves in Computer Graphics? Modeling Complex Shapes

Splines. Parameterization of a Curve. Curve Representations. Roller coaster. What Do We Need From Curves in Computer Graphics? Modeling Complex Shapes CSCI 420 Computer Graphics Lecture 8 Splines Jernej Barbic University of Southern California Hermite Splines Bezier Splines Catmull-Rom Splines Other Cubic Splines [Angel Ch 12.4-12.12] Roller coaster

More information

Fall CSCI 420: Computer Graphics. 4.2 Splines. Hao Li.

Fall CSCI 420: Computer Graphics. 4.2 Splines. Hao Li. Fall 2014 CSCI 420: Computer Graphics 4.2 Splines Hao Li http://cs420.hao-li.com 1 Roller coaster Next programming assignment involves creating a 3D roller coaster animation We must model the 3D curve

More information

Polynomials tend to oscillate (wiggle) a lot, even when our true function does not.

Polynomials tend to oscillate (wiggle) a lot, even when our true function does not. AMSC/CMSC 460 Computational Methods, Fall 2007 UNIT 2: Spline Approximations Dianne P O Leary c 2001, 2002, 2007 Piecewise polynomial interpolation Piecewise polynomial interpolation Read: Chapter 3 Skip:

More information

Four equations are necessary to evaluate these coefficients. Eqn

Four equations are necessary to evaluate these coefficients. Eqn 1.2 Splines 11 A spline function is a piecewise defined function with certain smoothness conditions [Cheney]. A wide variety of functions is potentially possible; polynomial functions are almost exclusively

More information

An introduction to interpolation and splines

An introduction to interpolation and splines An introduction to interpolation and splines Kenneth H. Carpenter, EECE KSU November 22, 1999 revised November 20, 2001, April 24, 2002, April 14, 2004 1 Introduction Suppose one wishes to draw a curve

More information

Math 226A Homework 4 Due Monday, December 11th

Math 226A Homework 4 Due Monday, December 11th Math 226A Homework 4 Due Monday, December 11th 1. (a) Show that the polynomial 2 n (T n+1 (x) T n 1 (x)), is the unique monic polynomial of degree n + 1 with roots at the Chebyshev points x k = cos ( )

More information

Linear Interpolating Splines

Linear Interpolating Splines Jim Lambers MAT 772 Fall Semester 2010-11 Lecture 17 Notes Tese notes correspond to Sections 112, 11, and 114 in te text Linear Interpolating Splines We ave seen tat ig-degree polynomial interpolation

More information

Chapter 19 Interpolation

Chapter 19 Interpolation 19.1 One-Dimensional Interpolation Chapter 19 Interpolation Empirical data obtained experimentally often times conforms to a fixed (deterministic) but unkown functional relationship. When estimates of

More information

Analysis of Algorithms. Unit 4 - Analysis of well known Algorithms

Analysis of Algorithms. Unit 4 - Analysis of well known Algorithms Analysis of Algorithms Unit 4 - Analysis of well known Algorithms 1 Analysis of well known Algorithms Brute Force Algorithms Greedy Algorithms Divide and Conquer Algorithms Decrease and Conquer Algorithms

More information

Interpolation. TANA09 Lecture 7. Error analysis for linear interpolation. Linear Interpolation. Suppose we have a table x x 1 x 2...

Interpolation. TANA09 Lecture 7. Error analysis for linear interpolation. Linear Interpolation. Suppose we have a table x x 1 x 2... TANA9 Lecture 7 Interpolation Suppose we have a table x x x... x n+ Interpolation Introduction. Polynomials. Error estimates. Runge s phenomena. Application - Equation solving. Spline functions and interpolation.

More information

ECE 2574: Data Structures and Algorithms - Basic Sorting Algorithms. C. L. Wyatt

ECE 2574: Data Structures and Algorithms - Basic Sorting Algorithms. C. L. Wyatt ECE 2574: Data Structures and Algorithms - Basic Sorting Algorithms C. L. Wyatt Today we will continue looking at sorting algorithms Bubble sort Insertion sort Merge sort Quick sort Common Sorting Algorithms

More information

Numerical Analysis Fall. Numerical Differentiation

Numerical Analysis Fall. Numerical Differentiation Numerical Analysis 5 Fall Numerical Differentiation Differentiation The mathematical definition of a derivative begins with a difference approimation: and as is allowed to approach zero, the difference

More information

SAMPLE OF THE STUDY MATERIAL PART OF CHAPTER 6. Sorting Algorithms

SAMPLE OF THE STUDY MATERIAL PART OF CHAPTER 6. Sorting Algorithms SAMPLE OF THE STUDY MATERIAL PART OF CHAPTER 6 6.0 Introduction Sorting algorithms used in computer science are often classified by: Computational complexity (worst, average and best behavior) of element

More information

Unit 1 Day 4 Notes Piecewise Functions

Unit 1 Day 4 Notes Piecewise Functions AFM Unit 1 Day 4 Notes Piecewise Functions Name Date We have seen many graphs that are expressed as single equations and are continuous over a domain of the Real numbers. We have also seen the "discrete"

More information

Interactive Graphics. Lecture 9: Introduction to Spline Curves. Interactive Graphics Lecture 9: Slide 1

Interactive Graphics. Lecture 9: Introduction to Spline Curves. Interactive Graphics Lecture 9: Slide 1 Interactive Graphics Lecture 9: Introduction to Spline Curves Interactive Graphics Lecture 9: Slide 1 Interactive Graphics Lecture 13: Slide 2 Splines The word spline comes from the ship building trade

More information

over The idea is to construct an algorithm to solve the IVP ODE (9.1)

over The idea is to construct an algorithm to solve the IVP ODE (9.1) Runge- Ku(a Methods Review of Heun s Method (Deriva:on from Integra:on) The idea is to construct an algorithm to solve the IVP ODE (9.1) over To obtain the solution point we can use the fundamental theorem

More information

Interpolation by Spline Functions

Interpolation by Spline Functions Interpolation by Spline Functions Com S 477/577 Sep 0 007 High-degree polynomials tend to have large oscillations which are not the characteristics of the original data. To yield smooth interpolating curves

More information

CS 450 Numerical Analysis. Chapter 7: Interpolation

CS 450 Numerical Analysis. Chapter 7: Interpolation 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

Computer Science 4U Unit 1. Programming Concepts and Skills Algorithms

Computer Science 4U Unit 1. Programming Concepts and Skills Algorithms Computer Science 4U Unit 1 Programming Concepts and Skills Algorithms Algorithm In mathematics and computer science, an algorithm is a step-by-step procedure for calculations. Algorithms are used for calculation,

More information

LECTURE NOTES - SPLINE INTERPOLATION. 1. Introduction. Problems can arise when a single high-degree polynomial is fit to a large number

LECTURE NOTES - SPLINE INTERPOLATION. 1. Introduction. Problems can arise when a single high-degree polynomial is fit to a large number LECTURE NOTES - SPLINE INTERPOLATION DR MAZHAR IQBAL 1 Introduction Problems can arise when a single high-degree polynomial is fit to a large number of points High-degree polynomials would obviously pass

More information

Assignment 2. with (a) (10 pts) naive Gauss elimination, (b) (10 pts) Gauss with partial pivoting

Assignment 2. with (a) (10 pts) naive Gauss elimination, (b) (10 pts) Gauss with partial pivoting Assignment (Be sure to observe the rules about handing in homework). Solve: with (a) ( pts) naive Gauss elimination, (b) ( pts) Gauss with partial pivoting *You need to show all of the steps manually.

More information

Scientific Computing: Interpolation

Scientific Computing: Interpolation Scientific Computing: Interpolation Aleksandar Donev Courant Institute, NYU donev@courant.nyu.edu Course MATH-GA.243 or CSCI-GA.22, Fall 25 October 22nd, 25 A. Donev (Courant Institute) Lecture VIII /22/25

More information

Evaluating the polynomial at a point

Evaluating the polynomial at a point Evaluating the polynomial at a point Recall that we have a data structure for each piecewise polynomial (linear, quadratic, cubic and cubic Hermite). We have a routine that sets evenly spaced interpolation

More information

Bézier Splines. B-Splines. B-Splines. CS 475 / CS 675 Computer Graphics. Lecture 14 : Modelling Curves 3 B-Splines. n i t i 1 t n i. J n,i.

Bézier Splines. B-Splines. B-Splines. CS 475 / CS 675 Computer Graphics. Lecture 14 : Modelling Curves 3 B-Splines. n i t i 1 t n i. J n,i. Bézier Splines CS 475 / CS 675 Computer Graphics Lecture 14 : Modelling Curves 3 n P t = B i J n,i t with 0 t 1 J n, i t = i=0 n i t i 1 t n i No local control. Degree restricted by the control polygon.

More information

Section 5.5 Piecewise Interpolation

Section 5.5 Piecewise Interpolation Section 5.5 Piecewise Interpolation Key terms Runge phenomena polynomial wiggle problem Piecewise polynomial interpolation We have considered polynomial interpolation to sets of distinct data like {( )

More information

EECS 556 Image Processing W 09. Interpolation. Interpolation techniques B splines

EECS 556 Image Processing W 09. Interpolation. Interpolation techniques B splines EECS 556 Image Processing W 09 Interpolation Interpolation techniques B splines What is image processing? Image processing is the application of 2D signal processing methods to images Image representation

More information

over The idea is to construct an algorithm to solve the IVP ODE (8.1)

over The idea is to construct an algorithm to solve the IVP ODE (8.1) Runge- Ku(a Methods Review of Heun s Method (Deriva:on from Integra:on) The idea is to construct an algorithm to solve the IVP ODE (8.1) over To obtain the solution point we can use the fundamental theorem

More information

Splines. Patrick Breheny. November 20. Introduction Regression splines (parametric) Smoothing splines (nonparametric)

Splines. Patrick Breheny. November 20. Introduction Regression splines (parametric) Smoothing splines (nonparametric) Splines Patrick Breheny November 20 Patrick Breheny STA 621: Nonparametric Statistics 1/46 Introduction Introduction Problems with polynomial bases We are discussing ways to estimate the regression function

More information

CS 475 / CS Computer Graphics. Modelling Curves 3 - B-Splines

CS 475 / CS Computer Graphics. Modelling Curves 3 - B-Splines CS 475 / CS 675 - Computer Graphics Modelling Curves 3 - Bézier Splines n P t = i=0 No local control. B i J n,i t with 0 t 1 J n,i t = n i t i 1 t n i Degree restricted by the control polygon. http://www.cs.mtu.edu/~shene/courses/cs3621/notes/spline/bezier/bezier-move-ct-pt.html

More information

In some applications it may be important that the extrema of the interpolating function are within the extrema of the given data.

In some applications it may be important that the extrema of the interpolating function are within the extrema of the given data. Shape-preserving piecewise poly. interpolation In some applications it may be important that the extrema of the interpolating function are within the extrema of the given data. For example: If you the

More information

Derivative. Bernstein polynomials: Jacobs University Visualization and Computer Graphics Lab : ESM4A - Numerical Methods 313

Derivative. Bernstein polynomials: Jacobs University Visualization and Computer Graphics Lab : ESM4A - Numerical Methods 313 Derivative Bernstein polynomials: 120202: ESM4A - Numerical Methods 313 Derivative Bézier curve (over [0,1]): with differences. being the first forward 120202: ESM4A - Numerical Methods 314 Derivative

More information

We can use a max-heap to sort data.

We can use a max-heap to sort data. Sorting 7B N log N Sorts 1 Heap Sort We can use a max-heap to sort data. Convert an array to a max-heap. Remove the root from the heap and store it in its proper position in the same array. Repeat until

More information

February 2017 (1/20) 2 Piecewise Polynomial Interpolation 2.2 (Natural) Cubic Splines. MA378/531 Numerical Analysis II ( NA2 )

February 2017 (1/20) 2 Piecewise Polynomial Interpolation 2.2 (Natural) Cubic Splines. MA378/531 Numerical Analysis II ( NA2 ) f f f f f (/2).9.8.7.6.5.4.3.2. S Knots.7.6.5.4.3.2. 5 5.2.8.6.4.2 S Knots.2 5 5.9.8.7.6.5.4.3.2..9.8.7.6.5.4.3.2. S Knots 5 5 S Knots 5 5 5 5.35.3.25.2.5..5 5 5.6.5.4.3.2. 5 5 4 x 3 3.5 3 2.5 2.5.5 5

More information

Introduction to Programming for Engineers Spring Final Examination. May 10, Questions, 170 minutes

Introduction to Programming for Engineers Spring Final Examination. May 10, Questions, 170 minutes Final Examination May 10, 2011 75 Questions, 170 minutes Notes: 1. Before you begin, please check that your exam has 28 pages (including this one). 2. Write your name and student ID number clearly on your

More information

Splines and penalized regression

Splines and penalized regression Splines and penalized regression November 23 Introduction We are discussing ways to estimate the regression function f, where E(y x) = f(x) One approach is of course to assume that f has a certain shape,

More information

Rational Bezier Surface

Rational Bezier Surface Rational Bezier Surface The perspective projection of a 4-dimensional polynomial Bezier surface, S w n ( u, v) B i n i 0 m j 0, u ( ) B j m, v ( ) P w ij ME525x NURBS Curve and Surface Modeling Page 97

More information

CS130 : Computer Graphics Curves (cont.) Tamar Shinar Computer Science & Engineering UC Riverside

CS130 : Computer Graphics Curves (cont.) Tamar Shinar Computer Science & Engineering UC Riverside CS130 : Computer Graphics Curves (cont.) Tamar Shinar Computer Science & Engineering UC Riverside Blending Functions Blending functions are more convenient basis than monomial basis canonical form (monomial

More information

Natural Quartic Spline

Natural Quartic Spline Natural Quartic Spline Rafael E Banchs INTRODUCTION This report describes the natural quartic spline algorithm developed for the enhanced solution of the Time Harmonic Field Electric Logging problem As

More information

Design considerations

Design considerations Curves Design considerations local control of shape design each segment independently smoothness and continuity ability to evaluate derivatives stability small change in input leads to small change in

More information

UNIT 7. SEARCH, SORT AND MERGE

UNIT 7. SEARCH, SORT AND MERGE UNIT 7. SEARCH, SORT AND MERGE ALGORITHMS Year 2017-2018 Industrial Technology Engineering Paula de Toledo CONTENTS 7.1. SEARCH 7.2. SORT 7.3. MERGE 2 SEARCH Search, sort and merge algorithms Search (search

More information

Cubic Splines and Matlab

Cubic Splines and Matlab Cubic Splines and Matlab October 7, 2006 1 Introduction In this section, we introduce the concept of the cubic spline, and how they are implemented in Matlab. Of particular importance are the new Matlab

More information

Central issues in modelling

Central issues in modelling Central issues in modelling Construct families of curves, surfaces and volumes that can represent common objects usefully; are easy to interact with; interaction includes: manual modelling; fitting to

More information

Sorting and Selection

Sorting and Selection Sorting and Selection Introduction Divide and Conquer Merge-Sort Quick-Sort Radix-Sort Bucket-Sort 10-1 Introduction Assuming we have a sequence S storing a list of keyelement entries. The key of the element

More information

Piecewise Polynomial Interpolation, cont d

Piecewise Polynomial Interpolation, cont d Jim Lambers MAT 460/560 Fall Semester 2009-0 Lecture 2 Notes Tese notes correspond to Section 4 in te text Piecewise Polynomial Interpolation, cont d Constructing Cubic Splines, cont d Having determined

More information

Interpolation and Splines

Interpolation and Splines Interpolation and Splines Anna Gryboś October 23, 27 1 Problem setting Many of physical phenomenona are described by the functions that we don t know exactly. Often we can calculate or measure the values

More information

DATA STRUCTURES AND ALGORITHMS

DATA STRUCTURES AND ALGORITHMS DATA STRUCTURES AND ALGORITHMS Fast sorting algorithms Shellsort, Mergesort, Quicksort Summary of the previous lecture Why sorting is needed? Examples from everyday life What are the basic operations in

More information

In this course we will need a set of techniques to represent curves and surfaces in 2-d and 3-d. Some reasons for this include

In this course we will need a set of techniques to represent curves and surfaces in 2-d and 3-d. Some reasons for this include Parametric Curves and Surfaces In this course we will need a set of techniques to represent curves and surfaces in 2-d and 3-d. Some reasons for this include Describing curves in space that objects move

More information

Natural Numbers and Integers. Big Ideas in Numerical Methods. Overflow. Real Numbers 29/07/2011. Taking some ideas from NM course a little further

Natural Numbers and Integers. Big Ideas in Numerical Methods. Overflow. Real Numbers 29/07/2011. Taking some ideas from NM course a little further Natural Numbers and Integers Big Ideas in Numerical Methods MEI Conference 2011 Natural numbers can be in the range [0, 2 32 1]. These are known in computing as unsigned int. Numbers in the range [ (2

More information

Lecture 9: Introduction to Spline Curves

Lecture 9: Introduction to Spline Curves Lecture 9: Introduction to Spline Curves Splines are used in graphics to represent smooth curves and surfaces. They use a small set of control points (knots) and a function that generates a curve through

More information

Homework #6 Brief Solutions 2012

Homework #6 Brief Solutions 2012 Homework #6 Brief Solutions %page 95 problem 4 data=[-,;-,;,;4,] data = - - 4 xk=data(:,);yk=data(:,);s=csfit(xk,yk,-,) %Using the program to find the coefficients S =.456 -.456 -.. -.5.9 -.5484. -.58.87.

More information

Parametric Curves. University of Texas at Austin CS384G - Computer Graphics

Parametric Curves. University of Texas at Austin CS384G - Computer Graphics Parametric Curves University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell Parametric Representations 3 basic representation strategies: Explicit: y = mx + b Implicit: ax + by + c

More information

Multiple-Choice Test Spline Method Interpolation COMPLETE SOLUTION SET

Multiple-Choice Test Spline Method Interpolation COMPLETE SOLUTION SET Multiple-Choice Test Spline Method Interpolation COMPLETE SOLUTION SET 1. The ollowing n data points, ( x ), ( x ),.. ( x, ) 1, y 1, y n y n quadratic spline interpolation the x-data needs to be (A) equally

More information

See the course website for important information about collaboration and late policies, as well as where and when to turn in assignments.

See the course website for important information about collaboration and late policies, as well as where and when to turn in assignments. COS Homework # Due Tuesday, February rd See the course website for important information about collaboration and late policies, as well as where and when to turn in assignments. Data files The questions

More information

DATA FITTING IN SCILAB

DATA FITTING IN SCILAB powered by DATA FITTING IN SCILAB In this tutorial the reader can learn about data fitting, interpolation and approximation in Scilab. Interpolation is very important in industrial applications for data

More information

5.1 Introduction to the Graphs of Polynomials

5.1 Introduction to the Graphs of Polynomials Math 3201 5.1 Introduction to the Graphs of Polynomials In Math 1201/2201, we examined three types of polynomial functions: Constant Function - horizontal line such as y = 2 Linear Function - sloped line,

More information

Curves and Surfaces for Computer-Aided Geometric Design

Curves and Surfaces for Computer-Aided Geometric Design Curves and Surfaces for Computer-Aided Geometric Design A Practical Guide Fourth Edition Gerald Farin Department of Computer Science Arizona State University Tempe, Arizona /ACADEMIC PRESS I San Diego

More information

Comparison Sorts. Chapter 9.4, 12.1, 12.2

Comparison Sorts. Chapter 9.4, 12.1, 12.2 Comparison Sorts Chapter 9.4, 12.1, 12.2 Sorting We have seen the advantage of sorted data representations for a number of applications Sparse vectors Maps Dictionaries Here we consider the problem of

More information

Master Thesis. Comparison and Evaluation of Didactic Methods in Numerical Analysis for the Teaching of Cubic Spline Interpolation

Master Thesis. Comparison and Evaluation of Didactic Methods in Numerical Analysis for the Teaching of Cubic Spline Interpolation Master Thesis Comparison and Evaluation of Didactic Methods in Numerical Analysis for the Teaching of Cubic Spline Interpolation Abtihal Jaber Chitheer supervised by Prof. Dr. Carmen Arévalo May 17, 2017

More information

08 - Designing Approximating Curves

08 - Designing Approximating Curves 08 - Designing Approximating Curves Acknowledgement: Olga Sorkine-Hornung, Alexander Sorkine-Hornung, Ilya Baran Last time Interpolating curves Monomials Lagrange Hermite Different control types Polynomials

More information

Mar. 20 Math 2335 sec 001 Spring 2014

Mar. 20 Math 2335 sec 001 Spring 2014 Mar. 20 Math 2335 sec 001 Spring 2014 Chebyshev Polynomials Definition: For an integer n 0 define the function ( ) T n (x) = cos n cos 1 (x), 1 x 1. It can be shown that T n is a polynomial of degree n.

More information

Sorting. Sorting. Stable Sorting. In-place Sort. Bubble Sort. Bubble Sort. Selection (Tournament) Heapsort (Smoothsort) Mergesort Quicksort Bogosort

Sorting. Sorting. Stable Sorting. In-place Sort. Bubble Sort. Bubble Sort. Selection (Tournament) Heapsort (Smoothsort) Mergesort Quicksort Bogosort Principles of Imperative Computation V. Adamchik CS 15-1 Lecture Carnegie Mellon University Sorting Sorting Sorting is ordering a list of objects. comparison non-comparison Hoare Knuth Bubble (Shell, Gnome)

More information

Chapter 3:- Divide and Conquer. Compiled By:- Sanjay Patel Assistant Professor, SVBIT.

Chapter 3:- Divide and Conquer. Compiled By:- Sanjay Patel Assistant Professor, SVBIT. Chapter 3:- Divide and Conquer Compiled By:- Assistant Professor, SVBIT. Outline Introduction Multiplying large Integers Problem Problem Solving using divide and conquer algorithm - Binary Search Sorting

More information

Cubic Spline Questions

Cubic Spline Questions Cubic Spline Questions. Find natural cubic splines which interpolate the following dataset of, points:.0,.,.,.0, 7.0,.,.0,0.; estimate the value for. Solution: Step : Use the n- cubic spline equations

More information

MAE 384 Numerical Methods for Engineers

MAE 384 Numerical Methods for Engineers MAE 384 Numerical Methods for Engineers Instructor: Huei-Ping Huang office: ERC 359, email: hp.huang@asu.edu (Huei rhymes with way ) Tu/Th 9:00-10:15 PM WGHL 101 Textbook: Numerical Methods for Engineers

More information

CS-184: Computer Graphics

CS-184: Computer Graphics CS-184: Computer Graphics Lecture #12: Curves and Surfaces Prof. James O Brien University of California, Berkeley V2007-F-12-1.0 Today General curve and surface representations Splines and other polynomial

More information

Computer Graphics / Animation

Computer Graphics / Animation Computer Graphics / Animation Artificial object represented by the number of points in space and time (for moving, animated objects). Essential point: How do you interpolate these points in space and time?

More information

(Refer Slide Time: 00:02:24 min)

(Refer Slide Time: 00:02:24 min) CAD / CAM Prof. Dr. P. V. Madhusudhan Rao Department of Mechanical Engineering Indian Institute of Technology, Delhi Lecture No. # 9 Parametric Surfaces II So these days, we are discussing the subject

More information

Appendices - Parametric Keyframe Interpolation Incorporating Kinetic Adjustment and Phrasing Control

Appendices - Parametric Keyframe Interpolation Incorporating Kinetic Adjustment and Phrasing Control University of Pennsylvania ScholarlyCommons Technical Reports (CIS) Department of Computer & Information Science 7-1985 Appendices - Parametric Keyframe Interpolation Incorporating Kinetic Adjustment and

More information

Introduction to C++ Introduction to C++ Week 6 Dr Alex Martin 2013 Slide 1

Introduction to C++ Introduction to C++ Week 6 Dr Alex Martin 2013 Slide 1 Introduction to C++ Introduction to C++ Week 6 Dr Alex Martin 2013 Slide 1 Numerical Integration Methods The Trapezoidal Rule If one has an arbitrary function f(x) to be integrated over the region [a,b]

More information

Searching in General

Searching in General Searching in General Searching 1. using linear search on arrays, lists or files 2. using binary search trees 3. using a hash table 4. using binary search in sorted arrays (interval halving method). Data

More information

Parametric Curves. University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell

Parametric Curves. University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell Parametric Curves University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell Parametric Representations 3 basic representation strategies: Explicit: y = mx + b Implicit: ax + by + c

More information

Consider functions such that then satisfies these properties: So is represented by the cubic polynomials on on and on.

Consider functions such that then satisfies these properties: So is represented by the cubic polynomials on on and on. 1 of 9 3/1/2006 2:28 PM ne previo Next: Trigonometric Interpolation Up: Spline Interpolation Previous: Piecewise Linear Case Cubic Splines A piece-wise technique which is very popular. Recall the philosophy

More information

Equivalent Effect Function and Fast Intrinsic Mode Decomposition

Equivalent Effect Function and Fast Intrinsic Mode Decomposition Equivalent Effect Function and Fast Intrinsic Mode Decomposition Louis Yu Lu E-mail: louisyulu@gmail.com Abstract: The Equivalent Effect Function (EEF) is defined as having the identical integral values

More information

Spline Curves. Spline Curves. Prof. Dr. Hans Hagen Algorithmic Geometry WS 2013/2014 1

Spline Curves. Spline Curves. Prof. Dr. Hans Hagen Algorithmic Geometry WS 2013/2014 1 Spline Curves Prof. Dr. Hans Hagen Algorithmic Geometry WS 2013/2014 1 Problem: In the previous chapter, we have seen that interpolating polynomials, especially those of high degree, tend to produce strong

More information

Math 225 Scientific Computing II Outline of Lectures

Math 225 Scientific Computing II Outline of Lectures Math 225 Scientific Computing II Outline of Lectures Spring Semester 2003 I. Interpolating polynomials Lagrange formulation of interpolating polynomial Uniqueness of interpolating polynomial of degree

More information

Until now we have worked with flat entities such as lines and flat polygons. Fit well with graphics hardware Mathematically simple

Until now we have worked with flat entities such as lines and flat polygons. Fit well with graphics hardware Mathematically simple Curves and surfaces Escaping Flatland Until now we have worked with flat entities such as lines and flat polygons Fit well with graphics hardware Mathematically simple But the world is not composed of

More information

Computer Graphics. Unit VI: Curves And Fractals. By Vaishali Kolhe

Computer Graphics. Unit VI: Curves And Fractals. By Vaishali Kolhe Computer Graphics Unit VI: Curves And Fractals Introduction Two approaches to generate curved line 1. Curve generation algorithm Ex. DDA Arc generation algorithm 2. Approximate curve by number of straight

More information

A Cumulative Averaging Method for Piecewise Polynomial Approximation to Discrete Data

A Cumulative Averaging Method for Piecewise Polynomial Approximation to Discrete Data Applied Mathematical Sciences, Vol. 1, 16, no. 7, 331-343 HIKARI Ltd, www.m-hiari.com http://dx.doi.org/1.1988/ams.16.5177 A Cumulative Averaging Method for Piecewise Polynomial Approximation to Discrete

More information

Lecture 6 Sorting and Searching

Lecture 6 Sorting and Searching Lecture 6 Sorting and Searching Sorting takes an unordered collection and makes it an ordered one. 1 2 3 4 5 6 77 42 35 12 101 5 1 2 3 4 5 6 5 12 35 42 77 101 There are many algorithms for sorting a list

More information

L14 Quicksort and Performance Optimization

L14 Quicksort and Performance Optimization L14 Quicksort and Performance Optimization Alice E. Fischer Fall 2018 Alice E. Fischer L4 Quicksort... 1/12 Fall 2018 1 / 12 Outline 1 The Quicksort Strategy 2 Diagrams 3 Code Alice E. Fischer L4 Quicksort...

More information

Overview of Sorting Algorithms

Overview of Sorting Algorithms Unit 7 Sorting s Simple Sorting algorithms Quicksort Improving Quicksort Overview of Sorting s Given a collection of items we want to arrange them in an increasing or decreasing order. You probably have

More information

CS205b/CME306. Lecture 9

CS205b/CME306. Lecture 9 CS205b/CME306 Lecture 9 1 Convection Supplementary Reading: Osher and Fedkiw, Sections 3.3 and 3.5; Leveque, Sections 6.7, 8.3, 10.2, 10.4. For a reference on Newton polynomial interpolation via divided

More information

2D Spline Curves. CS 4620 Lecture 13

2D Spline Curves. CS 4620 Lecture 13 2D Spline Curves CS 4620 Lecture 13 2008 Steve Marschner 1 Motivation: smoothness In many applications we need smooth shapes [Boeing] that is, without discontinuities So far we can make things with corners

More information

+ bx + c = 0, you can solve for x by using The Quadratic Formula. x

+ bx + c = 0, you can solve for x by using The Quadratic Formula. x Math 33B Intermediate Algebra Fall 01 Name Study Guide for Exam 4 The exam will be on Friday, November 9 th. You are allowed to use one 3" by 5" index card on the exam as well as a scientific calculator.

More information

Interpolation & Polynomial Approximation. Cubic Spline Interpolation II

Interpolation & Polynomial Approximation. Cubic Spline Interpolation II Interpolation & Polynomial Approximation Cubic Spline Interpolation II Numerical Analysis (9th Edition) R L Burden & J D Faires Beamer Presentation Slides prepared by John Carroll Dublin City University

More information