Lab for Hermite Polynomial Interpolation

Module for Hermite Polynomials

   Check out the new Numerical Analysis Projects page.

Background. Hermite Polynomials. The cubic Hermite polynomial p(x) has the interpolative properties
[Graphics:hp.txtgr1.gif],
both the function values and their derivatives are known at the endpoints of the interval [Graphics:hp.txtgr2.gif]. The Hermite polynomial is referred to as a "clamped cubic," where "clamped" refers to the slope at the endpoints being fixed.

First load Mathematica's graphics package "Colors".

[Graphics:hp.txtgr4.gif][Graphics:hp.txtgr3.gif]
 
 

Report to be handed in.

Computer Exercises
 

 

Exercise 1. Find the cubic Hermite polynomial or "clamped cubic" that satisfies
[Graphics:hp.txtgr5.gif]

[Graphics:hp.txtgr4.gif][Graphics:hp.txtgr6.gif]
[Graphics:hp.txtgr4.gif][Graphics:hp.txtgr7.gif]

Symbolic differentiation (integration too) is permitted with Mathematica.

[Graphics:hp.txtgr4.gif][Graphics:hp.txtgr8.gif]
[Graphics:hp.txtgr4.gif][Graphics:hp.txtgr9.gif]

Now set up four equations using the prescribed endpoint conditions.

[Graphics:hp.txtgr4.gif][Graphics:hp.txtgr10.gif]

It is useful to form the set of equations to be solved and the set of variables involved in the problem.

[Graphics:hp.txtgr4.gif][Graphics:hp.txtgr11.gif]
[Graphics:hp.txtgr4.gif][Graphics:hp.txtgr12.gif]
[Graphics:hp.txtgr4.gif][Graphics:hp.txtgr13.gif]

Now find the solution set to this linear system and store it in the variable solset.

[Graphics:hp.txtgr4.gif][Graphics:hp.txtgr14.gif]
[Graphics:hp.txtgr4.gif][Graphics:hp.txtgr15.gif]

Remember that we must dig out one set of braces using solset[[1]] before we can use the ReplaceAll command.

[Graphics:hp.txtgr4.gif][Graphics:hp.txtgr16.gif]
[Graphics:hp.txtgr4.gif][Graphics:hp.txtgr17.gif]
[Graphics:hp.txtgr4.gif][Graphics:hp.txtgr18.gif]

[Graphics:hp.txtgr4.gif][Graphics:hp.txtgr19.gif]

[Graphics:hp.txtgr4.gif][Graphics:hp.txtgr20.gif]
 
 

More Background. Clamped cubic splines.

 

A clamped cubic spline is obtained by forming a piecewise cubic function which passes through the given set of knots
[Graphics:hp.txtgr21.gif]with the condition the function values, their derivatives and second derivatives of adjacent cubics agree at the interior nodes. The endpoint conditions are [Graphics:hp.txtgr22.gif], where [Graphics:hp.txtgr23.gif] are given.

 

 

Exercise 2. Find the "clamped cubic spline" that satisfies
[Graphics:hp.txtgr24.gif]

Set up the formulas for the cubic polynomials and form the equations to solve.

[Graphics:hp.txtgr4.gif][Graphics:hp.txtgr25.gif]
[Graphics:hp.txtgr4.gif][Graphics:hp.txtgr26.gif]
[Graphics:hp.txtgr4.gif][Graphics:hp.txtgr27.gif]

Solve for the coefficients and form the cubic functions.

[Graphics:hp.txtgr4.gif][Graphics:hp.txtgr28.gif]
[Graphics:hp.txtgr4.gif][Graphics:hp.txtgr29.gif]

Now graph the portion of each cubic in the interval over which it is to be used.
Then combine the two piecewise cubic graphs to form the spline.

[Graphics:hp.txtgr4.gif][Graphics:hp.txtgr30.gif]

[Graphics:hp.txtgr4.gif][Graphics:hp.txtgr31.gif]

Or we could define the piecewise cubic function S[z]:

[Graphics:hp.txtgr4.gif][Graphics:hp.txtgr32.gif]
[Graphics:hp.txtgr4.gif][Graphics:hp.txtgr33.gif]

[Graphics:hp.txtgr4.gif][Graphics:hp.txtgr34.gif]

The clamped cubic spline forces the slope at the endpoints to be prescribed values.

 

 

More Background. Natural cubic splines.

 

A natural cubic spline is obtained by forming a piecewise cubic function which passes through the given set of knots
[Graphics:hp.txtgr35.gif]with the condition the function values, their derivatives and second derivatives of adjacent cubics agree at the interior nodes. The endpoint conditions are [Graphics:hp.txtgr36.gif]. The natural cubic spline is said to be "a relaxed curve."

 

 

Exercise 3. Find the "natural cubic spline" that satisfies
[Graphics:hp.txtgr37.gif]

Set up the formulas for the cubic polynomials and form the equations to solve.

[Graphics:hp.txtgr4.gif][Graphics:hp.txtgr38.gif]
[Graphics:hp.txtgr4.gif][Graphics:hp.txtgr39.gif]
[Graphics:hp.txtgr4.gif][Graphics:hp.txtgr40.gif]

Solve for the coefficients and form the cubic functions.

[Graphics:hp.txtgr4.gif][Graphics:hp.txtgr41.gif]
[Graphics:hp.txtgr4.gif][Graphics:hp.txtgr42.gif]

Now graph the portion of each cubic in the interval over which it is to be used.
Then combine the two piecewise cubic graphs to form the spline.

[Graphics:hp.txtgr4.gif][Graphics:hp.txtgr43.gif]

[Graphics:hp.txtgr4.gif][Graphics:hp.txtgr44.gif]

Or we could define the piecewise cubic function S[z]:

[Graphics:hp.txtgr4.gif][Graphics:hp.txtgr45.gif]
[Graphics:hp.txtgr4.gif][Graphics:hp.txtgr46.gif]

[Graphics:hp.txtgr4.gif][Graphics:hp.txtgr47.gif]

Notice that the natural cubic spline is different from the clamped cubic spline, it is "a relaxed curve." (and happy too!)

 

 

 

(c) John H. Mathews, 1998