perform cubic spline interpolation on a set of data - Maple Help

Home : Support : Online Help : Education : Student Package : Numerical Analysis : Computation : Student/NumericalAnalysis/CubicSpline

Student[NumericalAnalysis][CubicSpline] - perform cubic spline interpolation on a set of data

 Calling Sequence CubicSpline(xy, opts)

Parameters

 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

Description

 • 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.

Notes

 • 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.

Examples

 > $\mathrm{with}\left(\mathrm{Student}[\mathrm{NumericalAnalysis}]\right):$
 > $\mathrm{xy}:=\left[\left[0,4.0\right],\left[0.5,0\right],\left[1.0,-2.0\right],\left[1.5,0\right],\left[2.0,1.0\right],\left[2.5,0\right],\left[3.0,-0.5\right]\right]$
 ${\mathrm{xy}}{:=}\left[\left[{0}{,}{4.0}\right]{,}\left[{0.5}{,}{0}\right]{,}\left[{1.0}{,}{-}{2.0}\right]{,}\left[{1.5}{,}{0}\right]{,}\left[{2.0}{,}{1.0}\right]{,}\left[{2.5}{,}{0}\right]{,}\left[{3.0}{,}{-}{0.5}\right]\right]$ (1)
 > $\mathrm{p1}:=\mathrm{CubicSpline}\left(\mathrm{xy},\mathrm{independentvar}=x\right):$
 > $\mathrm{expand}\left(\mathrm{Interpolant}\left(\mathrm{p1}\right)\right)$
 ${{}\begin{array}{cc}{4.}{-}{8.48076923076923}{}{x}{+}{1.92307692307692}{}{{x}}^{{3}}& {x}{<}{0.5}\\ {-}{5.13461538461539}{}{x}{+}{3.44230769230769}{-}{6.69230769230769}{}{{x}}^{{2}}{+}{6.38461538461538}{}{{x}}^{{3}}& {x}{<}{1.0}\\ {21.2884615384615}{-}{58.6730769230769}{}{x}{+}{46.8461538461538}{}{{x}}^{{2}}{-}{11.4615384615385}{}{{x}}^{{3}}& {x}{<}{1.5}\\ {15.0576923076923}{}{x}{-}{15.5769230769231}{-}{2.30769230769231}{}{{x}}^{{2}}{-}{0.538461538461538}{}{{x}}^{{3}}& {x}{<}{2.0}\\ {-}{64.8076923076923}{+}{88.9038461538461}{}{x}{-}{39.2307692307692}{}{{x}}^{{2}}{+}{5.61538461538461}{}{{x}}^{{3}}& {x}{<}{2.5}\\ {-}{52.4423076923077}{}{x}{+}{52.9807692307692}{+}{17.3076923076923}{}{{x}}^{{2}}{-}{1.92307692307692}{}{{x}}^{{3}}& {\mathrm{otherwise}}\end{array}$ (2)
 > $\mathrm{Draw}\left(\mathrm{p1}\right)$
 > $\mathrm{p2}:=\mathrm{CubicSpline}\left(\mathrm{xy},\mathrm{independentvar}=x,\mathrm{boundaryconditions}=\mathrm{clamped}\left(0,6\right)\right):$
 > $\mathrm{Draw}\left(\mathrm{p2}\right)$