0

We already know that some node information of function f(x) is shown in the table below:

$$\begin{array}{|c|c|c|c|} \hline x_{i} & 0 & 1 & 2 \\ \hline f\left(x_{i}\right) & 0 & 2 & 6 \\ \hline f^{\prime}\left(x_{i}\right) & & 1 & \\ \hline \end{array}$$

Now I need to find the Hermite interpolation polynomial $H_{3}(x)$ of function f and give the expression of truncation error $R(x)=f(x)-H_{3}(x)$.

I have found the Hermite interpolation polynomial $H_{3}(x)$ by the following code:

InterpolatingPolynomial[{{0, 0}, {1, 2, 1}, {2, 6}}, x] // Expand

Or

(*https://mathematica.stackexchange.com/a/230256/42417*)
newton[{X_, Y_}, x_] := 
 Module[{f, asso = X -> Y // Thread // Association}, 
  f@{a_, b___, c_} := f@{a, b, c} = (f@{b, c} - f@{a, b})/(c - a);
  f@{a_} := asso@a;
  Sum[f@#*Times @@ (x - Most@#) &@X[[;; i]], {i, Length@X}]]

xx = {0., 1., 2.}; y = {0., 2., 6.};

H3 = newton[{xx, y}, x] + a (x - 0) (x - 1) (x - 2) Solve[(D[H3, x] /. x -> 1) == 1, a] H3 /. First[%] // Expand

But I don't know how to use MMA to find the expression of truncation error function $R(x)$. What should I do?

A post with a similar question

The reference answer is $R(x)=\frac{f^{4}(\xi )}{4 !} x(x-1)^{2}(x-2), \quad \xi \in[\min (0, x),\max (x, 2)]$:

Source of this problem$\color{Gray} {\text{(2008 武汉 岩石 数值分析 5)}} $:

enter image description here

We can refer to example 3 on page 103 of this book for similar questions.

1 Answers1

-1

From this reference : Hermite interpolation I get the formula:

remainder formula for Hermite interpolation

Put in Your figures from the table:

table

I get for the third derivative K==3, each time 0. So the interpolation is already exact!

0 (x - 0)^0 * (x - 1)^1 * (x - 2)^0 == 0 (x-1) == 0

The problem is that

H[x]==x (1 + x)

has the derivative

H'[x]==1 + 2 x

and this has the value H'1==3 <>1.

The solution can be that the third row in the table indicates left-hand-side derivatives in the sense of difference quotient. Then everything fits fine.

linterp = ListInterpolation[yc, xc, InterpolationOrder -> 2]

enter image description here

ListPlot@linterp

enter image description here

Steffen Jaeschke
  • 4,088
  • 7
  • 20