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

Similar documents
Piecewise polynomial interpolation

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

Mar. 20 Math 2335 sec 001 Spring 2014

APPM/MATH Problem Set 4 Solutions

Interpolation & Polynomial Approximation. Cubic Spline Interpolation II

8 Piecewise Polynomial Interpolation

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

Convergence of C 2 Deficient Quartic Spline Interpolation

Generalised Mean Averaging Interpolation by Discrete Cubic Splines

Interpolation and Splines

Cubic spline interpolation

Recursive Subdivision Surfaces for Geometric Modeling

Deficient Quartic Spline Interpolation

Curve fitting using linear models

A C 2 Four-Point Subdivision Scheme with Fourth Order Accuracy and its Extensions

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

ME 261: Numerical Analysis Lecture-12: Numerical Interpolation

Handout 4 - Interpolation Examples

Maximizing an interpolating quadratic

Lecture 9: Introduction to Spline Curves

Lecture VIII. Global Approximation Methods: I

Natural Quartic Spline

Parameterization. Michael S. Floater. November 10, 2011

PS Geometric Modeling Homework Assignment Sheet I (Due 20-Oct-2017)

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

A C 2 Four-Point Subdivision Scheme with Fourth Order Accuracy and its Extensions

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

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

Homework #6 Brief Solutions 2012

Interpolation by Spline Functions

Positivity Preserving Interpolation of Positive Data by Rational Quadratic Trigonometric Spline

Computational Physics PHYS 420

INTERPOLATION BY QUARTIC SPLINE

Fitting to a set of data. Lecture on fitting

Four equations are necessary to evaluate these coefficients. Eqn

Curve Representation ME761A Instructor in Charge Prof. J. Ramkumar Department of Mechanical Engineering, IIT Kanpur

Increasing/Decreasing Behavior

Discrete Cubic Interpolatory Splines

Rational Bezier Curves

Increasing/Decreasing Behavior

Know it. Control points. B Spline surfaces. Implicit surfaces

Splines and penalized regression

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

CS 450 Numerical Analysis. Chapter 7: Interpolation

Linear Interpolating Splines

Interpolation. Chapter Information from Data

Parameterization of triangular meshes

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

The use of the Spectral Properties of the Basis Splines in Problems of Signal Processing

LECTURE #6. Geometric Modelling for Engineering Applications. Geometric modeling for engineering applications

A Modified Spline Interpolation Method for Function Reconstruction from Its Zero-Crossings

An introduction to interpolation and splines

and the crooked shall be made straight, and the rough ways shall be made smooth; Luke 3:5

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

Planting the Seeds Exploring Cubic Functions

February 23 Math 2335 sec 51 Spring 2016

Lecture 4: examples of topological spaces, coarser and finer topologies, bases and closed sets

99 International Journal of Engineering, Science and Mathematics

Need for Parametric Equations

Computation of interpolatory splines via triadic subdivision

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

POLYHEDRAL GEOMETRY. Convex functions and sets. Mathematical Programming Niels Lauritzen Recall that a subset C R n is convex if

Asymptotic Error Analysis

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

Assessing the Quality of the Natural Cubic Spline Approximation

Parametric curves. Reading. Curves before computers. Mathematical curve representation. CSE 457 Winter Required:

Central issues in modelling

Research Article Data Visualization Using Rational Trigonometric Spline

9 abcd = dcba b + 90c = c + 10b b = 10c.

Connected Minimal Acceleration Trigonometric Curves

Piecewise Polynomial Interpolation, cont d

A new 8-node quadrilateral spline finite element

Objects 2: Curves & Splines Christian Miller CS Fall 2011

The Euler Equidimensional Equation ( 3.2)

APPROXIMATING PDE s IN L 1

Scientific Computing: Interpolation

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

Numerical Integration

Week 10: Colouring graphs, and Euler s paths. 14 and 16 November, 2018

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

Edges, interpolation, templates. Nuno Vasconcelos ECE Department, UCSD (with thanks to David Forsyth)

2D Spline Curves. CS 4620 Lecture 18

Computer Graphics Curves and Surfaces. Matthias Teschner

SPLINE APPROXIMATION VIA THE CONTROL POLYGON

lecture 10: B-Splines

/633 Introduction to Algorithms Lecturer: Michael Dinitz Topic: Approximation algorithms Date: 11/27/18

A Random Variable Shape Parameter Strategy for Radial Basis Function Approximation Methods

SOME PROPERTIES OF TRIGONOMETRIC FUNCTIONS. 5! x7 7! + = 6! + = 4! x6

A Cumulative Averaging Method for Piecewise Polynomial Approximation to Discrete Data

Parametric curves. Brian Curless CSE 457 Spring 2016

Cubic Spline Questions

1 Computer arithmetic with unsigned integers

LECTURE 18 - OPTIMIZATION

A popular method for moving beyond linearity. 2. Basis expansion and regularization 1. Examples of transformations. Piecewise-polynomials and splines

On Smooth Bicubic Surfaces from Quad Meshes

Lecture 7: Counting classes

A Curve Tutorial for Introductory Computer Graphics

Multiple-Choice Test Spline Method Interpolation COMPLETE SOLUTION SET

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

C 1 Quintic Spline Interpolation Over Tetrahedral Partitions

Transcription:

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 5 2 Piecewise Polynomial Interpolation 2.2 (Natural) Cubic Splines MA378/53 Numerical Analysis II ( NA2 ) February 27.9.8.7.6.5.4.3.2. S Knots 8 x 4 7 6 5 4 3 2 5 5 5 5 These slides are licensed under CC BY-SA 4.

Introduction (2/2) The Cubic Spline is perhaps the most useful and popular interpolating function used in numerical analysis, automotive and aeronautical engineering, computer and film animation, digital photography, financial modelling, and as many other areas as there are human endeavours where continuous processes are modelled by discrete ones. It is generally accepted that (mathematical) splines were first described by Isaac Schoenberg (93-99) during WW2. However their physical realisation had been used in the ship-building and aircraft industries prior to that.

Introduction (3/2) One could argue that the most fundamental short-coming of the linear spline interpolant to f is that they are not smooth : that is, although.9.8.7.6.5.4.3 f(x) l 4 (x) l i (x i ) = l i+ (x i ), it is generally the case that l i(x i ) l i+(x i )..2. 5 5.9.8.7.6.5.4.3 f(x) l 8 (x).2. Also, the interpolating function cannot capture the curvature of f. (If you think about this last statement, you ll see that it can be expressed as l (x) = for all x [a, b].) 5 5.9.8.7.6.5.4.3.2. f(x) l 6 (x) 5 5

Definition (4/2) Cubic splines try to balance the simplicity of the linear spline approach by using a low-order polynomial on each interval with the desire for curvature and more smoothness by using cubics, and by forcing adjacent ones, and their first and second derivatives, to agree at knot points.

Definition (5/2) Definition (Cubic Spline) Let f be a function that is continuous on [a, b]. The cubic spline interpolant to f is the continuous function S such that (i) for i =,..., N, on each interval [x i, x i ] let S(x) = s i (x), where each of the s i is a cubic polynomial. (ii) s i (x i ) = f(x i ) for i =,..., N, (iii) s i (x i ) = f(x i ) for i =,..., N, (iv) s i (x i) = s i+ (x i) for i =,..., N, (v) s i (x i) = s i+ (x i) for i =,..., N. So, we have defined the cubic spline S as a function that interpolates f at N + points, has continuous first and second derivatives on [x, x N ] and is a cubic polynomial on each of the n intervals [x i, x i ]. That is, it is piecewise cubic.

Definition (6/2) We know that one can write a cubic as a + a x + a 2 x 2 + a 3 x 3. So it takes 4 terms to uniquely define a single cubic. To define the spline we need 4N terms. They can be found by solving 4N (linearly independent) equations. But the definition only gives 4N 2 equations. The missing equations can be chosen in a number of ways: (i) by setting S (x ) = and S (x N ) =. This is called a natural spline, and is the approach we ll take. (ii) by setting S (x ) = and S (x N ) =. This is called a clamped spline. (iii) set S (x ) = S (x N ) and S (x ) = S (x N ). This is the periodic spline and is used for interpolating, say, trigonometric functions. (iv) only use N 2 components of the spline: s 2,..., s N. But extend to two end ones so that s 2 (x ) = f(x ) and s N = f(x N ). This is called the not-a-knot condition.

Definition (7/2) The following figures show the linear spline (left) and natural cubic spline (right), and errors, interpolants to f(x) = /( + x 2 ) (with a = 5 and b = 5 as usual) for various N. Compared with linear splines, we seem to get significantly better approximation. Moreover, the rate at which the error decreases with respect to h is much faster.

Definition (8/2).9.8.7.6.5.4.3.2. N = 2 f(x) l 2 (x).9.8.7.6.5.4.3.2. f S Knots 5 5.2 f(x) l 2 (x). 5 5.7.6.5..4.2.3.3.2.4..5 5 5 5 5

Definition (8/2).9.8.7.6.5.4.3.2. N = 4 f(x) l 4 (x).2.8.6.4.2 f S Knots 5 5.5 f(x) l 4 (x).5.2 5 5.35.3.25.2..5..5.5.2 5 5 5 5

Definition (8/2).9.8.7.6.5.4.3.2. N = 8 f(x) l 8 (x).9.8.7.6.5.4.3.2. f S Knots 5 5.8 5 5.6.6.4.2.2.4 f(x) l 8 (x).5.4.3.2..6 5 5 5 5

Definition (8/2).9.8.7.6.5.4.3.2. N = 6 f(x) l 6 (x).9.8.7.6.5.4.3.2. f S Knots 5 5.6.5.4.3.2...2 f(x) l 6 (x).3 5 5 5 5 4 x 3 3.5 3 2.5 2.5.5 5 5

Definition (8/2).9.8.7.6.5.4.3.2. N = 32 f(x) l 32 (x).9.8.7.6.5.4.3.2. f S Knots 5 5.25 5 5 8 x 4.2.5..5.5 f(x) l 32 (x) 7 6 5 4 3 2. 5 5 5 5

Constructing Cubic Splines (9/2) Some notation: h = x i x i = (x N x )/N for all i. f i := f(x i ). To construct the spline, first observe that if S is piecewise cubic, then S is piecewise quadratic, and S is piecewise linear. (i) Let σ i = S (x i ) for i =,..., N.

Constructing Cubic Splines (/2) (ii) Integrate twice: We get s i (x) = α i (x x i ) + β i (x i x)+ σ i 6h (x i x) 3 + σ i 6h (x x i ) 3, () for x [x i, x i ].

Constructing Cubic Splines (/2) (iii) The α i and β i arose as the constants of integration. To find them:

Constructing Cubic Splines (2/2) and so, for i =, 2,..., N α i = f i h h 6 σ i, Notice that this gives β i = α i. β i = f i h h 6 σ i. (2)

Constructing Cubic Splines (3/2) (iv) So, now we just need the equations for σ i. Two of these come from the fact that this is a natural cubic spline, with S (x ) = and S (x N ) =, therefore σ = and σ N =. The remaining N equations come from the fact that S is continuous at x, x 2,..., x n. So we set that s i(x i ) = s i+(x i ). After some work (see exercises...), we can show this means that the system is: σ =, (3a) 6 (σ i + 4σ i + σ i+ ) = ( fi h 2 2f i + f i+ ) (3b) for i =,..., N, σ N =. (3c)

A cubic spline example (4/2) Example Find the natural cubic spline interpolant to f at the points x =, x =, x 2 = 2 and x 3 = 3 where f =, f = 2, f 2 = and f 3 =. [We won t do all the details in class, so here they are] Solution: From () we see we are looking for S(x)= α x + β ( x) + σ 6h ( x)3 + σ 6h x3,x [, ], α 2 (x ) + β 2 (2 x) + σ 6h (2 x)3 + σ 2 6h (x )3,x [, 2], α 3 (x x 2 ) + β 3 (3 x) + σ 2 6h (3 x)3 + σ 3 6h (x 2)3,x [2, 3].

A cubic spline example (5/2) We first solve for the σ i using (3): This gives 6 Now use (2) to get σ 4 σ 4 σ 2 = 8 σ 3 σ =, σ = 24 5, σ 2 = 6 5, σ 3 =. and α = 4 5, α 2 = 4 5, α 3 =. β = β 2 = 4 5, β 3 = 4 5.

A cubic spline example (6/2) The answer is 4 5 x 4 5 x3, x [, ], 4 S(x) = 5 (x ) + 4 5 (2 x) 4 5 (2 x)3 + 5 (x )3, x [, 2], 4 5 (3 x) + 5 (3 x)3. x [2, 3]. This is shown below. 2.5 2 (x i,y i ) S.5.5.5.5.5.5 2 2.5 3 3.5

Error Estimates (7/2) We state the following error estimates without proof. You don t need to know these, or be able to prove them. But you should be able to use them if required. Theorem If f C 4 [a, b] and S is its cubic spline interpolant on N + equally spaced points, then f S 5 384 M 4h 4, f S 24 M 4h 3, f S 3 8 M 4h 2, where M 4 = f (iv).

Error Estimates (8/2) Example Give an upper bound on the error for the cubic spline interpolant to f = e x on the interval [, ] with N = mesh points.

Error Estimates (9/2) Example What is the smallest value of N that you can take which ensures that, if interpolating f(x) = e x on N equally sized intervals on [, ], the error is less that 8? How does this compare with a linear spline interpolation (see corresponding example for linear splines).

Error Estimates (2/2) Recall the minimum energy property of linear splines. There is an analogous result for natural cubic splines. Theorem Let u be any function that interpolates f at ω N, and is such that u H 2 (x, x N ). Then S 2 u 2. The proof is not hard - it is analogous to the proof of Theorem 2..9.