 PolynomialInterpolation - Maple Help

# Online Help

###### All Products    Maple    MapleSim

Home : Support : Online Help : Education : Student Packages : Numerical Analysis : Computation : Student/NumericalAnalysis/PolynomialInterpolation

Student[NumericalAnalysis]

 PolynomialInterpolation
 perform polynomial interpolation on a set of data Calling Sequence PolynomialInterpolation(xy, opts) Parameters

 xy - list(numeric), list(list(numeric, numeric)), list(list(numeric, numeric, numeric)); the data points to be interpolated opts - equation(s) of the form keyword=value where keyword is one of digits, errorboundvar, extrapolate, function, independentvar, method; the options for interpolating the data xy Options

 • 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.
 • errorboundvar = name
 The name to assign to the variable in the errorbound term.
 • extrapolate = algebraic, list(algebraic)
 The points to be extrapolated. By default no points are extrapolated. To see the extrapolated values after using the PolynomialInterpolation command, use the ExactValue or ApproximateValue command.
 • function = algebraic
 The exact function to use when computing the absolute error. If only the x data is given in xy, the function must be specified by the user, or an exception will be raised. 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 function will be used.  If function and independentvar are both unspecified, ind_var will be used as the independent variable in the interpolant.
 • method = hermite, lagrange, neville, newton
 The method to use when performing the polynomial interpolation.
 – hermite : Hermite Interpolation; this method requires xy to be in the form [[${x}_{1}$, ${y}_{1}$, ${p}_{1}$], [${x}_{2}$, ${y}_{2}$, ${p}_{2}$],...].
 – lagrange : Lagrange Form Interpolation
 – neville : Neville's Algorithm
 – newton : Newton Interpolation
 If no method is specified by the user, the Lagrange method will be used.  However, if xy is of the form list(numeric, numeric, numeric) and the user does not specify a method, the Hermite method will be used. Description

 • The PolynomialInterpolation command interpolates the given data points xy 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

 • When the Hermite method is used to perform interpolation, xy must be of the form list(list(numeric, numeric, numeric)).
 • 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}\left[\mathrm{NumericalAnalysis}\right]\right):$
 > $\mathrm{xy}≔\left[\left[0,1\right],\left[\frac{1}{2},1\right],\left[1,\frac{11}{10}\right],\left[\frac{3}{2},\frac{3}{4}\right],\left[2,\frac{7}{8}\right],\left[\frac{5}{2},\frac{9}{10}\right],\left[3,\frac{11}{10}\right],\left[\frac{7}{2},1\right]\right]$
 ${\mathrm{xy}}{≔}\left[\left[{0}{,}{1}\right]{,}\left[\frac{{1}}{{2}}{,}{1}\right]{,}\left[{1}{,}\frac{{11}}{{10}}\right]{,}\left[\frac{{3}}{{2}}{,}\frac{{3}}{{4}}\right]{,}\left[{2}{,}\frac{{7}}{{8}}\right]{,}\left[\frac{{5}}{{2}}{,}\frac{{9}}{{10}}\right]{,}\left[{3}{,}\frac{{11}}{{10}}\right]{,}\left[\frac{{7}}{{2}}{,}{1}\right]\right]$ (1)
 > $L≔\mathrm{PolynomialInterpolation}\left(\mathrm{xy},\mathrm{independentvar}=x,\mathrm{method}=\mathrm{lagrange}\right):$
 > $\mathrm{Nev}≔\mathrm{PolynomialInterpolation}\left(\mathrm{xy},\mathrm{independentvar}=x,\mathrm{method}=\mathrm{neville}\right):$
 > $\mathrm{New}≔\mathrm{PolynomialInterpolation}\left(\mathrm{xy},\mathrm{independentvar}=x,\mathrm{method}=\mathrm{newton}\right):$
 > $\mathrm{expand}\left(\mathrm{Interpolant}\left(L\right)\right)$
 ${1}{+}\frac{{2254}}{{75}}{}{{x}}^{{2}}{+}\frac{{733}}{{20}}{}{{x}}^{{4}}{-}\frac{{3296}}{{225}}{}{{x}}^{{5}}{+}\frac{{221}}{{75}}{}{{x}}^{{6}}{-}\frac{{53}}{{225}}{}{{x}}^{{7}}{-}\frac{{172247}}{{3600}}{}{{x}}^{{3}}{-}\frac{{8183}}{{1200}}{}{x}$ (2)
 > $\mathrm{expand}\left(\mathrm{Interpolant}\left(\mathrm{Nev}\right)\right)$
 ${1}{+}\frac{{2254}}{{75}}{}{{x}}^{{2}}{+}\frac{{733}}{{20}}{}{{x}}^{{4}}{-}\frac{{3296}}{{225}}{}{{x}}^{{5}}{+}\frac{{221}}{{75}}{}{{x}}^{{6}}{-}\frac{{53}}{{225}}{}{{x}}^{{7}}{-}\frac{{172247}}{{3600}}{}{{x}}^{{3}}{-}\frac{{8183}}{{1200}}{}{x}$ (3)
 > $\mathrm{expand}\left(\mathrm{Interpolant}\left(\mathrm{New}\right)\right)$
 ${1}{+}\frac{{2254}}{{75}}{}{{x}}^{{2}}{+}\frac{{733}}{{20}}{}{{x}}^{{4}}{-}\frac{{3296}}{{225}}{}{{x}}^{{5}}{+}\frac{{221}}{{75}}{}{{x}}^{{6}}{-}\frac{{53}}{{225}}{}{{x}}^{{7}}{-}\frac{{172247}}{{3600}}{}{{x}}^{{3}}{-}\frac{{8183}}{{1200}}{}{x}$ (4)
 > $\mathrm{xyyp}≔\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{xyyp}}{≔}\left[\left[{1}{,}{1.105170918}{,}{0.2210341836}\right]{,}\left[{1.5}{,}{1.252322716}{,}{0.3756968148}\right]{,}\left[{2}{,}{1.491824698}{,}{0.5967298792}\right]\right]$ (5)
 > $\mathrm{p2}≔\mathrm{PolynomialInterpolation}\left(\mathrm{xyyp},\mathrm{method}=\mathrm{hermite},\mathrm{function}=\mathrm{exp}\left(0.1{x}^{2}\right),\mathrm{independentvar}=x,\mathrm{errorboundvar}=\mathrm{\xi },\mathrm{digits}=5\right):$
 > $\mathrm{RemainderTerm}\left(\mathrm{p2}\right)$
 $\left(\frac{\left({0.120}{}{{ⅇ}}^{{0.1}{}{{\mathrm{\xi }}}^{{2}}}{+}{0.0720}{}{{\mathrm{\xi }}}^{{2}}{}{{ⅇ}}^{{0.1}{}{{\mathrm{\xi }}}^{{2}}}{+}{0.00480}{}{{\mathrm{\xi }}}^{{4}}{}{{ⅇ}}^{{0.1}{}{{\mathrm{\xi }}}^{{2}}}{+}{0.000064}{}{{\mathrm{\xi }}}^{{6}}{}{{ⅇ}}^{{0.1}{}{{\mathrm{\xi }}}^{{2}}}\right){}{\left({x}{-}{1.}\right)}^{{2}}{}{\left({x}{-}{1.5}\right)}^{{2}}{}{\left({x}{-}{2.}\right)}^{{2}}}{{720}}\right)\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{&where}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\left\{{1.}{\le }{\mathrm{\xi }}{\le }{2.}\right\}$ (6)
 > $\mathrm{DividedDifferenceTable}\left(\mathrm{p2}\right)$
 $\left[\begin{array}{cccccc}{1.1052}& {0}& {0}& {0}& {0}& {0}\\ {1.1052}& {0.22103}& {0}& {0}& {0}& {0}\\ {1.2523}& {0.29420}& {0.14634}& {0}& {0}& {0}\\ {1.2523}& {0.37570}& {0.16300}& {0.033320}& {0}& {0}\\ {1.4918}& {0.47900}& {0.20660}& {0.043600}& {0.010280}& {0}\\ {1.4918}& {0.59673}& {0.23546}& {0.057720}& {0.014120}& {0.0038400}\end{array}\right]$ (7)
 > $\mathrm{Draw}\left(\mathrm{p2}\right)$ 