Interpolation & Polynomial Approximation. Cubic Spline Interpolation II

Similar documents
Parameterization. Michael S. Floater. November 10, 2011

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

APPM/MATH Problem Set 4 Solutions

Math 226A Homework 4 Due Monday, December 11th

Parameterization of triangular meshes

Piecewise Polynomial Interpolation, cont d

Mar. 20 Math 2335 sec 001 Spring 2014

Homework #6 Brief Solutions 2012

Cubic spline interpolation

Interpolation by Spline Functions

Numerical Analysis I - Final Exam Matrikelnummer:

Generalised Mean Averaging Interpolation by Discrete Cubic Splines

Linear Interpolating Splines

Chapter Introduction

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

Natural Quartic Spline

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

Convergence of C 2 Deficient Quartic Spline Interpolation

Numerical Methods in Physics Lecture 2 Interpolation

Math 225 Scientific Computing II Outline of Lectures

Discrete Cubic Interpolatory Splines

Homework #6 Brief Solutions 2011

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

Computational Physics PHYS 420

Deficient Quartic Spline Interpolation

Numerical Methods 5633

More NP-complete Problems. CS255 Chris Pollett May 3, 2006.

INTERPOLATION BY QUARTIC SPLINE

Multiple-Choice Test Spline Method Interpolation COMPLETE SOLUTION SET

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

Parametric Surfaces. Michael Kazhdan ( /657) HB , FvDFH 11.2

Math Numerical Analysis

Exercise Set Decide whether each matrix below is an elementary matrix. (a) (b) (c) (d) Answer:

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

CS 450 Numerical Analysis. Chapter 7: Interpolation

DM545 Linear and Integer Programming. Lecture 2. The Simplex Method. Marco Chiarandini

10/26/ Solving Systems of Linear Equations Using Matrices. Objectives. Matrices

lecture 10: B-Splines

Numerical Linear Algebra

3. Replace any row by the sum of that row and a constant multiple of any other row.

Interpolation and Splines

Table for Third-Degree Spline Interpolation Using Equi-Spaced Knots. By W. D. Hoskins

On the Dimension of the Bivariate Spline Space S 1 3( )

Lacunary Interpolation Using Quartic B-Spline

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

An introduction to interpolation and splines

x n x n stepnumber k order r error constant C r+1 1/2 5/12 3/8 251/720 abs. stab. interval (α,0) /11-3/10

99 International Journal of Engineering, Science and Mathematics

CS Elementary Graph Algorithms & Transform-and-Conquer

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

Problem #3 Daily Lessons and Assessments for AP* Calculus AB, A Complete Course Page Mark Sparks 2012

Lecture 6: Chain rule, Mean Value Theorem, Tangent Plane

Cubic Spline Questions

CS321 Introduction To Numerical Methods

MATH 423 Linear Algebra II Lecture 17: Reduced row echelon form (continued). Determinant of a matrix.

For example, the system. 22 may be represented by the augmented matrix

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

Solving Systems Using Row Operations 1 Name

A Practical Review of Uniform B-Splines

Friday, 11 January 13. Interpolation

X 1 = = 1 2, X 2 = = 1 4.

Lecture 2 September 3

Spline fitting tool for scientometric applications: estimation of citation peaks and publication time-lags

Methods of solving sparse linear systems. Soldatenko Oleg SPbSU, Department of Computational Physics

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

Interpolation. Chapter Information from Data

Piecewise polynomial interpolation

Connected Minimal Acceleration Trigonometric Curves

Lecture 2.2 Cubic Splines

60 2 Convex sets. {x a T x b} {x ã T x b}

Matrix Multiplication and All Pairs Shortest Paths (2002; Zwick)

Outline. CS38 Introduction to Algorithms. Linear programming 5/21/2014. Linear programming. Lecture 15 May 20, 2014

4 Integer Linear Programming (ILP)

Quadratic and cubic b-splines by generalizing higher-order voronoi diagrams

Interpolation - 2D mapping Tutorial 1: triangulation

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

Computational Methods CMSC/AMSC/MAPL 460. Vectors, Matrices, Linear Systems, LU Decomposition, Ramani Duraiswami, Dept. of Computer Science

Computation of interpolatory splines via triadic subdivision

2.4. A LIBRARY OF PARENT FUNCTIONS

Curve fitting using linear models

Mutation-linear algebra and universal geometric cluster algebras

UNIVERSITY OF CALGARY. Subdivision Surfaces. Advanced Geometric Modeling Faramarz Samavati

Element Quality Metrics for Higher-Order Bernstein Bézier Elements

CHAPTER 8. Copyright Cengage Learning. All rights reserved.

(Spline, Bezier, B-Spline)

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

Spline Models. Introduction to CS and NCS. Regression splines. Smoothing splines

On the maximum rank of completions of entry pattern matrices

4.2 and 4.6 filled in notes.notebook. December 08, Integration. Copyright Cengage Learning. All rights reserved.

Matrices and Systems of Linear Equations

Iterative Methods for Linear Systems

Math 2331 Linear Algebra

Surface Approximation and Interpolation via Matrix SVD

Moving Beyond Linearity

Iterative Algorithms I: Elementary Iterative Methods and the Conjugate Gradient Algorithms

Chapter 1 BACKGROUND

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

Contents. I The Basic Framework for Stationary Problems 1

Almost Curvature Continuous Fitting of B-Spline Surfaces

SPLINE APPROXIMATION VIA THE CONTROL POLYGON

Transcription:

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 c 2011 Brooks/Cole, Cengage Learning

Outline 1 Unique natural cubic spline interpolant Numerical Analysis (Chapter 3) Cubic Spline Interpolation II R L Burden & J D Faires 2 / 29

Outline 1 Unique natural cubic spline interpolant 2 Natural cubic spline approximating f (x) = e x Numerical Analysis (Chapter 3) Cubic Spline Interpolation II R L Burden & J D Faires 2 / 29

Outline 1 Unique natural cubic spline interpolant 2 Natural cubic spline approximating f (x) = e x 3 Natural cubic spline approximating 3 0 ex dx Numerical Analysis (Chapter 3) Cubic Spline Interpolation II R L Burden & J D Faires 2 / 29

Outline 1 Unique natural cubic spline interpolant 2 Natural cubic spline approximating f (x) = e x 3 Natural cubic spline approximating 3 0 ex dx Numerical Analysis (Chapter 3) Cubic Spline Interpolation II R L Burden & J D Faires 3 / 29

Existence of a unique natural spline interpolant Theorem Numerical Analysis (Chapter 3) Cubic Spline Interpolation II R L Burden & J D Faires 4 / 29

Existence of a unique natural spline interpolant Theorem If f is defined at a = x 0 < x 1 < < x n = b, then f has a unique natural spline interpolant S on the nodes x 0, x 1,..., x n ; that is, a spline interpolant that satisfies the natural boundary conditions S (a) = 0 and S (b) = 0 Numerical Analysis (Chapter 3) Cubic Spline Interpolation II R L Burden & J D Faires 4 / 29

Existence of a unique natural spline interpolant Proof (1/4) Using the notation S j (x) = a j + b j (x x j ) + c j (x x j ) 2 + d j (x x j ) 3 the boundary conditions in this case imply that c n = 1 2 S n(x n )2 = 0 and that 0 = S (x 0 ) = 2c 0 + 6d 0 (x 0 x 0 ) so c 0 = 0. Numerical Analysis (Chapter 3) Cubic Spline Interpolation II R L Burden & J D Faires 5 / 29

Existence of a unique natural spline interpolant Proof (1/4) Using the notation S j (x) = a j + b j (x x j ) + c j (x x j ) 2 + d j (x x j ) 3 the boundary conditions in this case imply that c n = 1 2 S n(x n )2 = 0 and that 0 = S (x 0 ) = 2c 0 + 6d 0 (x 0 x 0 ) so c 0 = 0. The two equations c 0 = 0 and c n = 0 together with the equations h j 1 c j 1 + 2(h j 1 + h j )c j + h j c j+1 = 3 h j (a j+1 a j ) 3 h j 1 (a j a j 1 ) produce a linear system described by the vector equation Ax = b: Numerical Analysis (Chapter 3) Cubic Spline Interpolation II R L Burden & J D Faires 5 / 29

Existence of a unique natural spline interpolant Proof (2/4) A is the (n + 1) (n + 1) matrix: 1 0 0 0. h 0 2(h 0 + h 1 ) h.. 1.. A = 0 h 1 2(h 1 + h 2 ) h.. 2.............. 0.... hn 2 2(h n 2 + h n 1 ) h n 1 0 0 0 1 Numerical Analysis (Chapter 3) Cubic Spline Interpolation II R L Burden & J D Faires 6 / 29

Existence of a unique natural spline interpolant Proof (3/4) b and x are the vectors 0 3 h 1 (a 2 a 1 ) 3 h 0 (a 1 a 0 ) b =. 3 h n 1 (a n a n 1 ) 3 h n 2 (a n 1 a n 2 ) 0 c 0 c 1 and x =. c n Numerical Analysis (Chapter 3) Cubic Spline Interpolation II R L Burden & J D Faires 7 / 29

Existence of a unique natural spline interpolant Proof (4/4) The matrix A is strictly diagonally dominant, that is, in each row the magnitude of the diagonal entry exceeds the sum of the magnitudes of all the other entries in the row.

Existence of a unique natural spline interpolant Proof (4/4) The matrix A is strictly diagonally dominant, that is, in each row the magnitude of the diagonal entry exceeds the sum of the magnitudes of all the other entries in the row. A linear system with a matrix of this form can be shown Theorem to have a unique solution for c 0, c 1,..., c n.

Existence of a unique natural spline interpolant Proof (4/4) The matrix A is strictly diagonally dominant, that is, in each row the magnitude of the diagonal entry exceeds the sum of the magnitudes of all the other entries in the row. A linear system with a matrix of this form can be shown Theorem to have a unique solution for c 0, c 1,..., c n. The solution to the cubic spline problem with the boundary conditions S (x 0 ) = S (x n ) = 0 can be obtained by applying the Natural Cubic Spline Algorithm.

Natural Cubic Spline Algorithm To construct the cubic spline interpolant S for the function f, defined at the numbers x 0 < x 1 < < x n, satisfying S (x 0 ) = S (x n ) = 0 (Note: S(x) = S j (x) = a j + b j (x x j ) + c j (x x j ) 2 + d j (x x j ) 3 for x j x x j+1.): Numerical Analysis (Chapter 3) Cubic Spline Interpolation II R L Burden & J D Faires 9 / 29

Natural Cubic Spline Algorithm To construct the cubic spline interpolant S for the function f, defined at the numbers x 0 < x 1 < < x n, satisfying S (x 0 ) = S (x n ) = 0 (Note: S(x) = S j (x) = a j + b j (x x j ) + c j (x x j ) 2 + d j (x x j ) 3 for x j x x j+1.): INPUT n; x 0, x 1,..., x n ; a 0 = f (x 0 ), a 1 = f (x 1 ),..., a n = f (x n ) Numerical Analysis (Chapter 3) Cubic Spline Interpolation II R L Burden & J D Faires 9 / 29

Natural Cubic Spline Algorithm To construct the cubic spline interpolant S for the function f, defined at the numbers x 0 < x 1 < < x n, satisfying S (x 0 ) = S (x n ) = 0 (Note: S(x) = S j (x) = a j + b j (x x j ) + c j (x x j ) 2 + d j (x x j ) 3 for x j x x j+1.): INPUT n; x 0, x 1,..., x n ; a 0 = f (x 0 ), a 1 = f (x 1 ),..., a n = f (x n ) OUTPUT a j, b j, c j, d j for j = 0, 1,..., n 1 Numerical Analysis (Chapter 3) Cubic Spline Interpolation II R L Burden & J D Faires 9 / 29

Natural Cubic Spline Algorithm To construct the cubic spline interpolant S for the function f, defined at the numbers x 0 < x 1 < < x n, satisfying S (x 0 ) = S (x n ) = 0 (Note: S(x) = S j (x) = a j + b j (x x j ) + c j (x x j ) 2 + d j (x x j ) 3 for x j x x j+1.): INPUT n; x 0, x 1,..., x n ; a 0 = f (x 0 ), a 1 = f (x 1 ),..., a n = f (x n ) OUTPUT a j, b j, c j, d j for j = 0, 1,..., n 1 Step 1 For i = 0, 1,..., n 1 set h i = x i+1 x i Numerical Analysis (Chapter 3) Cubic Spline Interpolation II R L Burden & J D Faires 9 / 29

Natural Cubic Spline Algorithm To construct the cubic spline interpolant S for the function f, defined at the numbers x 0 < x 1 < < x n, satisfying S (x 0 ) = S (x n ) = 0 (Note: S(x) = S j (x) = a j + b j (x x j ) + c j (x x j ) 2 + d j (x x j ) 3 for x j x x j+1.): INPUT n; x 0, x 1,..., x n ; a 0 = f (x 0 ), a 1 = f (x 1 ),..., a n = f (x n ) OUTPUT a j, b j, c j, d j for j = 0, 1,..., n 1 Step 1 Step 2 For i = 0, 1,..., n 1 set h i = x i+1 x i For i = 1, 2,..., n 1 set α i = 3 (a i+1 a i ) 3 (a i a i 1 ) h i h i 1 Numerical Analysis (Chapter 3) Cubic Spline Interpolation II R L Burden & J D Faires 9 / 29

Natural Cubic Spline Algorithm To construct the cubic spline interpolant S for the function f, defined at the numbers x 0 < x 1 < < x n, satisfying S (x 0 ) = S (x n ) = 0 (Note: S(x) = S j (x) = a j + b j (x x j ) + c j (x x j ) 2 + d j (x x j ) 3 for x j x x j+1.): INPUT n; x 0, x 1,..., x n ; a 0 = f (x 0 ), a 1 = f (x 1 ),..., a n = f (x n ) OUTPUT a j, b j, c j, d j for j = 0, 1,..., n 1 Step 1 Step 2 For i = 0, 1,..., n 1 set h i = x i+1 x i For i = 1, 2,..., n 1 set α i = 3 (a i+1 a i ) 3 (a i a i 1 ) h i h i 1 (Note: In what follows, Steps 3, 4, 5 and part of Step 6 solve a tridiagonal linear system using a Crout Factorization algorithm.) Numerical Analysis (Chapter 3) Cubic Spline Interpolation II R L Burden & J D Faires 9 / 29

Natural Cubic Spline Algorithm (Cont d) Step 3 Set l 0 = 1 µ 0 = 0 z 0 = 0 Numerical Analysis (Chapter 3) Cubic Spline Interpolation II R L Burden & J D Faires 10 / 29

Natural Cubic Spline Algorithm (Cont d) Step 3 Set l 0 = 1 µ 0 = 0 z 0 = 0 Step 4 For i = 1, 2,..., n 1 set l i = 2(x i+1 x i 1 ) h i 1 µ i 1 µ i = h i /l i z i = (α i h i 1 z i 1 )/l i Numerical Analysis (Chapter 3) Cubic Spline Interpolation II R L Burden & J D Faires 10 / 29

Natural Cubic Spline Algorithm (Cont d) Step 3 Set l 0 = 1 µ 0 = 0 z 0 = 0 Step 4 For i = 1, 2,..., n 1 set l i = 2(x i+1 x i 1 ) h i 1 µ i 1 µ i = h i /l i z i = (α i h i 1 z i 1 )/l i Step 5 Set l n = 1 z n = 0 c n = 0 Numerical Analysis (Chapter 3) Cubic Spline Interpolation II R L Burden & J D Faires 10 / 29

Natural Cubic Spline Algorithm (Cont d) Step 3 Set l 0 = 1 µ 0 = 0 z 0 = 0 Step 4 For i = 1, 2,..., n 1 set l i = 2(x i+1 x i 1 ) h i 1 µ i 1 µ i = h i /l i z i = (α i h i 1 z i 1 )/l i Step 5 Set l n = 1 z n = 0 c n = 0 Step 6 For j = n 1, n 2,..., 0 set c j = z j µ j c j+1 b j = (a j+1 a j )/h j h j (c j+1 + 2c j )/3 d j = (c j+1 c j )/(3h j ) Numerical Analysis (Chapter 3) Cubic Spline Interpolation II R L Burden & J D Faires 10 / 29

Natural Cubic Spline Algorithm (Cont d) Step 3 Set l 0 = 1 µ 0 = 0 z 0 = 0 Step 4 For i = 1, 2,..., n 1 set l i = 2(x i+1 x i 1 ) h i 1 µ i 1 µ i = h i /l i z i = (α i h i 1 z i 1 )/l i Step 5 Set l n = 1 z n = 0 c n = 0 Step 6 For j = n 1, n 2,..., 0 set c j = z j µ j c j+1 b j = (a j+1 a j )/h j h j (c j+1 + 2c j )/3 d j = (c j+1 c j )/(3h j ) Step 7 OUTPUT (a j, b j, c j, d j for j = 0, 1,..., n 1) & STOP Numerical Analysis (Chapter 3) Cubic Spline Interpolation II R L Burden & J D Faires 10 / 29

Outline 1 Unique natural cubic spline interpolant 2 Natural cubic spline approximating f (x) = e x 3 Natural cubic spline approximating 3 0 ex dx Numerical Analysis (Chapter 3) Cubic Spline Interpolation II R L Burden & J D Faires 11 / 29

Natural Spline Interpolant Example: f (x) = e x Use the data points (0, 1), (1, e), (2, e 2 ), and (3, e 3 ) to form a natural spline S(x) that approximates f (x) = e x. Numerical Analysis (Chapter 3) Cubic Spline Interpolation II R L Burden & J D Faires 12 / 29

Natural Spline Interpolant Example: f (x) = e x Use the data points (0, 1), (1, e), (2, e 2 ), and (3, e 3 ) to form a natural spline S(x) that approximates f (x) = e x. Solution (1/7) With n = 3, h 0 = h 1 = h 2 = 1 and the notation S(x) = S j (x) = a j + b j (x x j ) + c j (x x j ) 2 + d j (x x j ) 3 for x j x x j+1, Numerical Analysis (Chapter 3) Cubic Spline Interpolation II R L Burden & J D Faires 12 / 29

Natural Spline Interpolant Example: f (x) = e x Use the data points (0, 1), (1, e), (2, e 2 ), and (3, e 3 ) to form a natural spline S(x) that approximates f (x) = e x. Solution (1/7) With n = 3, h 0 = h 1 = h 2 = 1 and the notation S(x) = S j (x) = a j + b j (x x j ) + c j (x x j ) 2 + d j (x x j ) 3 for x j x x j+1, we have a 0 = 1, a 1 = e a 2 = e 2, a 3 = e 3 Numerical Analysis (Chapter 3) Cubic Spline Interpolation II R L Burden & J D Faires 12 / 29

Natural Spline Interpolant Solution (2/7) So the matrix A and the vectors b and x given in the Natural Spline Theorem See A, b & x have the forms 1 0 0 0 0 c 0 A = 1 4 1 0 0 1 4 1 b = 3(e 2 2e + 1) 3(e 3 2e 2 + e) and x = c 1 c 2 0 0 0 1 0 c 3 Numerical Analysis (Chapter 3) Cubic Spline Interpolation II R L Burden & J D Faires 13 / 29

Natural Spline Interpolant Solution (2/7) So the matrix A and the vectors b and x given in the Natural Spline Theorem See A, b & x have the forms 1 0 0 0 0 c 0 A = 1 4 1 0 0 1 4 1 b = 3(e 2 2e + 1) 3(e 3 2e 2 + e) and x = c 1 c 2 0 0 0 1 0 c 3 The vector-matrix equation Ax = b is equivalent to the system: c 0 = 0 c 0 + 4c 1 + c 2 = 3(e 2 2e + 1) c 1 + 4c 2 + c 3 = 3(e 3 2e 2 + e) c 3 = 0 Numerical Analysis (Chapter 3) Cubic Spline Interpolation II R L Burden & J D Faires 13 / 29

Natural Spline Interpolant Solution (3/7) This system has the solution c 0 = c 3 = 0 and, to 5 decimal places, c 1 = 1 5 ( e3 + 6e 2 9e + 4) 0.75685 c 2 = 1 5 (4e3 9e 2 + 6e 1) 5.83007 Numerical Analysis (Chapter 3) Cubic Spline Interpolation II R L Burden & J D Faires 14 / 29

Natural Spline Interpolant Solution (4/7) Solving for the remaining constants gives Numerical Analysis (Chapter 3) Cubic Spline Interpolation II R L Burden & J D Faires 15 / 29

Natural Spline Interpolant Solution (4/7) Solving for the remaining constants gives b 0 = 1 h 0 (a 1 a 0 ) h 0 3 (c 1 + 2c 0 ) = (e 1) 1 15 ( e3 + 6e 2 9e + 4) 1.46600 b 1 = 1 h 1 (a 2 a 1 ) h 1 3 (c 2 + 2c 1 ) = (e 2 e) 1 15 (2e3 + 3e 2 12e + 7) 2.22285 b 2 = 1 h 2 (a 3 a 2 ) h 2 3 (c 3 + 2c 2 ) = (e 3 e 2 ) 1 15 (8e3 18e 2 + 12e 2) 8.80977 Numerical Analysis (Chapter 3) Cubic Spline Interpolation II R L Burden & J D Faires 15 / 29

Natural Spline Interpolant Solution (5/7) and d 0 = 1 3h 0 (c 1 c 0 ) = 1 15 ( e3 + 6e 2 9e + 4) 0.25228 d 1 = 1 3h 1 (c 2 c 1 ) = 1 3 (e3 3e 2 + 3e 1) 1.69107 d 2 = 1 3h 2 (c 3 c 1 ) = 1 15 ( 4e3 + 9e 2 6e + 1) 1.94336 Numerical Analysis (Chapter 3) Cubic Spline Interpolation II R L Burden & J D Faires 16 / 29

Natural Spline Interpolant Solution (6/7) The natural cubic spine is described piecewise by 1 + 1.46600x + 0.25228x 3 for x [0,1] S(x) = 2.71828 + 2.22285(x 1) + 0.75685(x 1) 2 + 1.69107(x 1) 3 for x [1,2] 7.38906 + 8.80977(x 2) + 5.83007(x 2) 2 1.94336(x 2) 3 for x [2,3] The spline and its agreement with f (x) = e x are as shown in the following diagram. Numerical Analysis (Chapter 3) Cubic Spline Interpolation II R L Burden & J D Faires 17 / 29

Natural Spline Interpolant Solution (7/7): Natural spline and its agreement with f (x) = e x e 3 y y = S(x) y = e x e 2 e 1 1 2 3 x Numerical Analysis (Chapter 3) Cubic Spline Interpolation II R L Burden & J D Faires 18 / 29

Outline 1 Unique natural cubic spline interpolant 2 Natural cubic spline approximating f (x) = e x 3 Natural cubic spline approximating 3 0 ex dx Numerical Analysis (Chapter 3) Cubic Spline Interpolation II R L Burden & J D Faires 19 / 29

Natural Spline Interpolant Example: The Integral of a Spline Approximate the integral of f (x) = e x on [0, 3], which has the value 3 0 e x dx = e 3 1 20.08553692 1 = 19.08553692, by piecewise integrating the spline that approximates f on this integral. Numerical Analysis (Chapter 3) Cubic Spline Interpolation II R L Burden & J D Faires 20 / 29

Natural Spline Interpolant Example: The Integral of a Spline Approximate the integral of f (x) = e x on [0, 3], which has the value 3 0 e x dx = e 3 1 20.08553692 1 = 19.08553692, by piecewise integrating the spline that approximates f on this integral. Note: From the previous example, the natural cubic spine S(x) that approximates f (x) = e x on [0, 3] is described piecewise by 1 + 1.46600x + 0.25228x 3 for x [0,1] S(x) = 2.71828 + 2.22285(x 1) + 0.75685(x 1) 2 + 1.69107(x 1) 3 for x [1,2] 7.38906 + 8.80977(x 2) + 5.83007(x 2) 2 1.94336(x 2) 3 for x [2,3] Numerical Analysis (Chapter 3) Cubic Spline Interpolation II R L Burden & J D Faires 20 / 29

Natural Spline Interpolant Solution (1/4) We can therefore write 3 0 S(x) = + + 1 0 2 1 3 2 [ 1 + 1.46600x + 0.25228x 3] dx [ 2.71828 + 2.22285(x 1) + 0.75685(x 1) 2 +1.69107(x 1) 3] dx [ 7.38906 + 8.80977(x 2) + 5.83007(x 2) 2 1.94336(x 2) 3] dx Numerical Analysis (Chapter 3) Cubic Spline Interpolation II R L Burden & J D Faires 21 / 29

Natural Spline Interpolant Solution (2/4) Integrating and collecting values from like powers gives Numerical Analysis (Chapter 3) Cubic Spline Interpolation II R L Burden & J D Faires 22 / 29

Natural Spline Interpolant Solution (2/4) Integrating and collecting values from like powers gives 3 0 S(x) = [x + 1.46600 x 2 4 2 + 0.25228x 4 + [2.71828(x 1) + 2.22285 ] 1 0 (x 1)2 2 (x 1)3 +0.75685 + 1.69107 3 (x 2)2 + [7.38906(x 2) + 8.80977 2 (x 2)3 +5.83007 1.94336 3 ] 2 (x 1)4 4 1 ] 3 (x 2)4 4 2 Numerical Analysis (Chapter 3) Cubic Spline Interpolation II R L Burden & J D Faires 22 / 29

Natural Spline Interpolant Solution (3/4) Therefore: 3 0 S(x) = (1 + 2.71828 + 7.38906) + 1 (1.46600 + 2.22285 + 8.80977) 2 + 1 (0.75685 + 5.83007) 3 + 1 (0.25228 + 1.69107 1.94336) 4 = 19.55229 Numerical Analysis (Chapter 3) Cubic Spline Interpolation II R L Burden & J D Faires 23 / 29

Natural Spline Interpolant Solution (4/4) Because the nodes are equally spaced in this example the integral approximation is simply 3 0 S(x) dx = (a 0 + a 1 + a 2 ) + 1 2 (b 0 + b 1 + b 2 ) + 1 3 (c 0 + c 1 + c 2 ) + 1 4 (d 0 + d 1 + d 2 ) Numerical Analysis (Chapter 3) Cubic Spline Interpolation II R L Burden & J D Faires 24 / 29

Questions?

Reference Material

Cubic Spline Interpolant Definition Given a function f defined on [a, b] and a set of nodes a = x 0 < x 1 < < x n = b, a cubic spline interpolant S for f is a function that satisfies the following conditions: (a) S(x) is a cubic polynomial, denoted S j (x), on the subinterval [x j, x j+1 ] for each j = 0, 1,..., n 1; (b) S j (x j ) = f (x j ) and S j (x j+1 ) = f (x j+1 ) for each j = 0, 1,..., n 1; (c) S j+1 (x j+1 ) = S j (x j+1 ) for each j = 0, 1,..., n 2; (Implied by (b).) (d) S j+1 (x j+1) = S j (x j+1) for each j = 0, 1,..., n 2; (e) S j+1 j+1) = S j (x j+1 ) for each j = 0, 1,..., n 2; (f) One of the following sets of boundary conditions is satisfied: (i) S (x 0 ) = S (x n ) = 0 (natural (or free) boundary); (ii) S (x 0 ) = f (x 0 ) and S (x n ) = f (x n ) (clamped boundary).

Strictly Diagonally Dominant Matrices Theorem A strictly diagonally dominant matrix A is nonsingular. Moreover, in this case, Gaussian elimination can be performed on any linear system of the form Ax = b to obtain its unique solution without row or column interchanges, and the computations will be stable with respect to the growth of round-off errors. Return to Natural Spline Uniqueness Proof

Natural Spline Interpolant: Linear System Ax = b 1 0 0 0. h 0 2(h 0 + h 1 ) h.. 1.. A = 0 h 1 2(h 1 + h 2 ) h.. 2.............. 0.... hn 2 2(h n 2 + h n 1 ) h n 1 0 0 0 1 0 3 h 1 (a 2 a 1 ) 3 h 0 (a 1 a 0 ) b =. 3 h n 1 (a n a n 1 ) 3 h n 2 (a n 1 a n 2 ) 0 c 0 c 1 and x =. c n Return to Natural Spline Example (f (x) = e x )