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)}} $:
We can refer to example 3 on page 103 of this book for similar questions.




