Student[NumericalAnalysis] - Maple Programming Help

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

Student[NumericalAnalysis]

 Interpolant
 return the interpolated polynomial from a POLYINTERP structure

 Calling Sequence Interpolant(p, opts)

Parameters

 p - a POLYINTERP structure opts - (optional) equations of the form keyword=value where keyword is independentvar; options for returning the interpolant

Options

 • independentvar = name
 A name for the independent variable in the polynomial.  By default, the name given in the PolynomialInterpolation call is used.

Description

 • The Interpolant command retrieves the interpolated polynomial from a POLYINTERP structure.
 • The POLYINTERP structure is created using the PolynomialInterpolation command or the CubicSpline command.
 • In order to perform an interpolation, the PolynomialInterpolation command or CubicSpline command is used first, where all options are chosen and the interpolation is performed.  Then the Interpolant command can be used to extract the interpolating polynomial.

Notes

 • You may want to use the expand command to get the polynomial into a nicer form, since the Interpolant command returns the polynomial in factored form.

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{p1a}≔\mathrm{PolynomialInterpolation}\left(\mathrm{xy},\mathrm{function}={2}^{2-x}\mathrm{cos}\left(\mathrm{π}x\right),\mathrm{method}=\mathrm{lagrange},\mathrm{extrapolate}=\left[0.25,0.75,1.25\right],\mathrm{errorboundvar}=\mathrm{ξ}\right):$
 > $\mathrm{p1b}≔\mathrm{CubicSpline}\left(\mathrm{xy},\mathrm{function}={2}^{2-x}\mathrm{cos}\left(\mathrm{π}x\right),\mathrm{extrapolate}=\left[0.25,0.75,1.25\right]\right):$
 > $\mathrm{expand}\left(\mathrm{Interpolant}\left(\mathrm{p1a}\right)\right)$
 ${71.08333335}{}{{x}}^{{3}}{-}{41.05555556}{}{{x}}^{{4}}{+}{10.60000001}{}{{x}}^{{5}}{-}{1.022222222}{}{{x}}^{{6}}{+}{4.000000000}{-}{48.67222223}{}{{x}}^{{2}}{+}{3.066666669}{}{x}$ (2)
 > $\mathrm{expand}\left(\mathrm{Interpolant}\left(\mathrm{p1b}\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}$ (3)
 > $\mathrm{xyy}≔\left[\left[1,1.105170918,0.2210341836\right],\left[1.5,1.252322716,0.3756968148\right],\left[2,1.491824698,0.5967298792\right]\right]$
 ${\mathrm{xyy}}{≔}\left[\left[{1}{,}{1.105170918}{,}{0.2210341836}\right]{,}\left[{1.5}{,}{1.252322716}{,}{0.3756968148}\right]{,}\left[{2}{,}{1.491824698}{,}{0.5967298792}\right]\right]$ (4)
 > $\mathrm{p2}≔\mathrm{PolynomialInterpolation}\left(\mathrm{xyy},\mathrm{method}=\mathrm{hermite},\mathrm{function}={ⅇ}^{0.1{x}^{2}},\mathrm{independentvar}=x,\mathrm{errorboundvar}=\mathrm{ξ},\mathrm{digits}=5\right):$
 > $\mathrm{Interpolant}\left(\mathrm{p2},\mathrm{independentvar}=t\right)$
 ${0.88417}{+}{0.22103}{}{t}{+}{0.14634}{}{\left({t}{-}{1.}\right)}^{{2}}{+}{0.033320}{}{\left({t}{-}{1.}\right)}^{{2}}{}\left({t}{-}{1.5}\right){+}{0.010280}{}{\left({t}{-}{1.}\right)}^{{2}}{}{\left({t}{-}{1.5}\right)}^{{2}}{+}{0.0038400}{}{\left({t}{-}{1.}\right)}^{{2}}{}{\left({t}{-}{1.5}\right)}^{{2}}{}\left({t}{-}{2.}\right)$ (5)