Student[NumericalAnalysis]
CubicSpline
perform cubic spline interpolation on a set of data
Calling Sequence
Parameters
Options
Description
Notes
Examples
CubicSpline(xy, opts)
xy
-
listlist; data points, in the form [[x_1,y_1],[x_2, y_2],...], to be interpolated
opts
(optional) equations of the form keyword=value where keyword is one of: boundaryconditions, digits, extrapolate, function, independentvar; the options for interpolating the data xy
boundaryconditions = natural, clamped(numeric, numeric)
The boundary conditions. The boundary conditions can either be natural or clamped(u,v), where u and v are the first derivative boundary conditions. By default, boundaryconditions = natural.
digits = posint
A positive integer; the environment variable Digits will be set to this integer during the execution of this procedure. By default, digits = 10.
extrapolate = algebraic, list(algebraic)
The points to be extrapolated. By default no points are extrapolated. To see the extrapolated values after using the CubicSpline command, use the ExactValue or ApproximateValue command.
function = algebraic
The exact function to use when computing the absolute error. By default, no function is used.
independentvar = name
The name to assign to the independent variable in the interpolant. If independentvar is not specified, the independent variable in the function option will be used. If function and independentvar are both unspecified, ind_var will be used as the independent variable in the interpolant.
The CubicSpline command interpolates the given data points xy using the cubic spline method and stores all computed information in a POLYINTERP structure.
The POLYINTERP structure is then passed around to different interpolation commands in the Student[NumericalAnalysis] subpackage where information can be extracted from it and, depending on the command, manipulated. To see a list of commands that accept a POLYINTERP structure, see Interpolation in the Glossary of Commands.
The CubicSpline command does not compute a remainder term, so it may not be used in conjunction with the RemainderTerm command or the InterpolantRemainderTerm command.
This procedure operates numerically; that is, inputs that are not numeric are first evaluated to floating-point numbers before computations proceed.
with⁡StudentNumericalAnalysis:
xy≔0,4.0,0.5,0,1.0,−2.0,1.5,0,2.0,1.0,2.5,0,3.0,−0.5
p1≔CubicSpline⁡xy,independentvar=x:
expand⁡Interpolant⁡p1
4.−8.48076923076923⁢x+1.92307692307692⁢x3x<0.5−5.13461538461539⁢x+3.44230769230769−6.69230769230769⁢x2+6.38461538461538⁢x3x<1.021.2884615384615−58.6730769230769⁢x+46.8461538461538⁢x2−11.4615384615385⁢x3x<1.515.0576923076923⁢x−15.5769230769231−2.30769230769231⁢x2−0.538461538461538⁢x3x<2.0−64.8076923076923+88.9038461538461⁢x−39.2307692307692⁢x2+5.61538461538461⁢x3x<2.5−52.4423076923077⁢x+52.9807692307692+17.3076923076923⁢x2−1.92307692307692⁢x3otherwise
Draw⁡p1
p2≔CubicSpline⁡xy,independentvar=x,boundaryconditions=clamped⁡0,6:
Draw⁡p2
See Also
Glossary of Commands
Student[NumericalAnalysis][AddPoint]
Student[NumericalAnalysis][BasisFunctions]
Student[NumericalAnalysis][ComputationOverview]
Student[NumericalAnalysis][DataPoints]
Student[NumericalAnalysis][ExactValue]
Student[NumericalAnalysis][InterpolantRemainderTerm]
Student[NumericalAnalysis][PolynomialInterpolation]
Download Help Document