Numerical Analysis: Interpolation and Polynomial Approximation - Cubic Splines - Prof. Eri, Study notes of Mathematical Methods for Numerical Analysis and Optimization

The concept of cubic spline interpolation, a piecewise-polynomial approximation used in numerical analysis. The definition of cubic spline interpolants, their properties, and various boundary conditions. It also includes an example of finding coefficients for a clamped cubic spline and the use of cubic splines in matlab. Additionally, the document covers numerical differentiation and quadrature methods.

Typology: Study notes

Pre 2010

Uploaded on 08/18/2009

koofers-user-xf4
koofers-user-xf4 🇺🇸

10 documents

1 / 3

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
MATH 441/541 - Numerical Analysis
Eighth Meeting: Interpolation
Thursday, October 18th, 2007
Interpolation And Polynomial Approximation
Section 3.4 Cubic Spline Interpolation
1. Piecewise Polynomial Approximations
“Global interpolation” versus “local interpolation”:
Varying degree piecewise polynomial approximations and associated degrees of freedom:
(a) Piecewise Constant Interpolation
(b) Piecewise Linear Interpolation
(c) Piecewise Quadratic Interpolation
(d) Piecewise Cubic Interpolation ...
2. Cubic Splines
The most common piecewise-polynomial approximation.
Definition: Cubic Spline Interpolant
Given a function fdefined on [a, b] and a set of nodes a=x0< x1<· · · < xn=b, a cubic
spline interpolant Sfor fis a function that satisfies where S(x) is a cubic polynomial,
denoted Sj(x), on the subinterval [xj, xj+1] for each j= 0,1,· · · , n 1; that satisfies the
following conditions:
(a) Interpolation Condition: S(xj) = f(xj) for each j= 0,1,· · · , n;
(b) Continuity of Interpolant: Sj+1(xj+1 ) = Sj(xj+1) for each j= 0,1,· · · , n 2;
(c) Continuity of the Derivative: S0
j+1(xj+1) = S0
j(xj+1) for each j= 0,1,· · · , n 2;
(d) Continuity of the Second Derivative: S00
j+1(xj+1) = S00
j(xj+1) for each j= 0,1,· · · , n 2;
(e) One of the following sets of boundary conditions is satisfied:
i. Free or Natural Boundary: S00 (x0) = S00(xn) = 0 (Natural Spline)
ii. Clamped Boundary: S0(x0) = f0(x0) and S0(xn) = f0(xn) (Complete Cubic Spline)
iii. Not-a-Knot Condition: S00 is linear across [x0, x2] and [xn2, xn] (i.e. you are
fitting a cubic polynomial across [x0, x2] and a cubic polynomial across [xn2, xn]).
iv. Parabolic Endpoints: S00(x0) = S00(x1) and S00(xn1) = S00 (xn) (i.e. the cubics
approach parabolas at their extremities.)
A picture:
The general formula:
On each subinterval j,j= 0,· · · , n 1, we have
Sj(x) = aj+bj(xxj) + cj(xxj)2+dj(xxj)3
Example (Problem #12 from Section 3.4, p. 154):
Suppose we have a clamped cubic spline, s(x), for data from some function f(x) defined on
[1,3] and given by:
s(x) = (s0(x) = 3(x1) + 2(x1)2(x1)3,if 1 x < 2
s1(x) = a+b(x2) + c(x2)2+d(x2)3if 2 x3
Given f0(1) = f0(3), find a,b,c, and d.
Splines in MATLAB
1
pf3

Partial preview of the text

Download Numerical Analysis: Interpolation and Polynomial Approximation - Cubic Splines - Prof. Eri and more Study notes Mathematical Methods for Numerical Analysis and Optimization in PDF only on Docsity!

MATH 441/541 - Numerical Analysis Eighth Meeting: Interpolation Thursday, October 18 th, 2007

Interpolation And Polynomial Approximation

  • Section 3.4 Cubic Spline Interpolation
    1. Piecewise Polynomial Approximations
      • “Global interpolation” versus “local interpolation”:
      • Varying degree piecewise polynomial approximations and associated degrees of freedom: (a) Piecewise Constant Interpolation (b) Piecewise Linear Interpolation (c) Piecewise Quadratic Interpolation (d) Piecewise Cubic Interpolation ...
    2. Cubic Splines The most common piecewise-polynomial approximation.
      • Definition: Cubic Spline Interpolant Given a function f defined on [a, b] and a set of nodes a = x 0 < x 1 < · · · < xn = b, a cubic spline interpolant S for f is a function that satisfies where S(x) is a cubic polynomial, denoted Sj (x), on the subinterval [xj , xj+1] for each j = 0, 1 , · · · , n − 1; that satisfies the following conditions: (a) Interpolation Condition: S(xj ) = f (xj ) for each j = 0, 1 , · · · , n; (b) Continuity of Interpolant: Sj+1(xj+1) = Sj (xj+1) for each j = 0, 1 , · · · , n − 2; (c) Continuity of the Derivative: S′ j+1(xj+1) = S j′ (xj+1) for each j = 0, 1 , · · · , n − 2; (d) Continuity of the Second Derivative: S j′′+1(xj+1) = S j′′ (xj+1) for each j = 0, 1 , · · · , n − 2; (e) One of the following sets of boundary conditions is satisfied: i. Free or Natural Boundary: S′′(x 0 ) = S′′(xn) = 0 (Natural Spline) ii. Clamped Boundary: S′(x 0 ) = f ′(x 0 ) and S′(xn) = f ′(xn) (Complete Cubic Spline) iii. Not-a-Knot Condition: S′′^ is linear across [x 0 , x 2 ] and [xn− 2 , xn] (i.e. you are fitting a cubic polynomial across [x 0 , x 2 ] and a cubic polynomial across [xn− 2 , xn]). iv. Parabolic Endpoints: S′′(x 0 ) = S′′(x 1 ) and S′′(xn− 1 ) = S′′(xn) (i.e. the cubics approach parabolas at their extremities.)
      • A picture:
      • The general formula: On each subinterval j, j = 0, · · · , n − 1, we have

Sj (x) = aj + bj (x − xj ) + cj (x − xj )^2 + dj (x − xj )^3

  • Example (Problem #12 from Section 3.4, p. 154): Suppose we have a clamped cubic spline, s(x), for data from some function f (x) defined on [1, 3] and given by:

s(x) =

{ s 0 (x) = 3(x − 1) + 2(x − 1)^2 − (x − 1)^3 , if 1 ≤ x < 2 s 1 (x) = a + b(x − 2) + c(x − 2)^2 + d(x − 2)^3 if 2 ≤ x ≤ 3

Given f ′(1) = f ′(3), find a, b, c, and d.

  • Splines in MATLAB

1 Numerical Differentiation

  • Section 4.1: Numerical Differentiation (the Calculus Way!) Approximating f ′(x 0 ):
    • Finding a Bound for the Error:
      1. Using the Taylor Polynomial:
      2. Using Lagrange Polynomials:
      3. A Problem to Be Aware Of When Reducing Size of Error:
      4. Forward-Difference vs. Backward-Difference Formula:
    • Higher Order Methods: (n + 1)-Point Formulas
      1. Derivation:
      2. Three and Five-Point Formulas, Examples: Problem # 9(b) x f (x) f ′(x) -3.0 9. -2.8 8. -2.6 7. -2.4 6. -2.2 5. -2.0 4.
    • Higher Order Derivatives
    • Comparing Roundoff Error to Truncation Error:
    • When Do We Really Want to Approximate the Derivative Numerically?

An Example: Consider the following boundary value problem:

(x + 1)y′′^ + xy′^ + 3y = g(x), 0 ≤ x ≤ 1

subject to y(0) = 3, y(1) = 7

2 Numerical Integration

  • Section 4.3: Basic Numerical Quadrature Methods
    • What is Numerical Quadrature?
    • Integrating the Lagrange Interpolating Polynomial
    • Useful Theorems and Definitions: ∗ Weighted Mean Value Theorem for Integrals: Suppose f ∈ C[a, b], the Riemann integral of g exists on [a, b] and g(x) does not change sign on [a, b]. Then there exists a number c in (a, b) with (^) ∫ b

a

f (x)g(x) dx = f (c)

∫ (^) b

a

g(x) dx

∗ Degree of Accuracy: The degree of accuracy, or precision, of a quadrature formula is the largest positive integer n such that the formula is exact for f (x) = xk, for each k = 0, 1 , · · · , n. (So, look at the error term. If it has derivatives of f (n), then all polynomials of degree n − 1 will vanish by the nth^ derivative, f (n).)

  • Basic Quadrature Rules:
    1. Trapezoid Rule: Integrating the first order Lagrange Polynomial: