Interactive Educational Modules in
Scientific Computing

Polynomial-Spline Comparison

This module compares the polynomial and natural cubic spline interpolants for a chosen set of data points.

The user chooses a set of data points either by selecting one of two preset examples or by specifying a desired set of points. For the latter, select Choose Points, then click on the graph to specify the location of each point, and then finally Apply. To prevent points from being too close to each other, no new point can be selected within the shaded buffer zone around each existing point. Examples 1 and 2 are discrete samples of the square root function and the gamma function, respectively. For the user-selected option, at least two points must be chosen. After the points have been specified, the resulting polynomial and natural cubic spline interpolants are drawn. After the interpolants have been drawn, another point can be added by selecting Add Point and then clicking on the graph at the desired location, whereupon the resulting new interpolants are drawn.

Reference: Michael T. Heath, Scientific Computing, An Introductory Survey, 2nd edition, McGraw-Hill, New York, 2002. See Sections 7.3 and 7.4; Examples 1 and 2 are given in Computer Problems 7.6 and 7.7, respectively, on page 337.

Developers: Evan VanderZee and Michael Heath