Problem I.4. Given a polynomial $p_6(x)$ that agrees with $\sin x$ at $\tau = [0,0,\frac{\pi}{4},\frac{\pi}{4},\frac{\pi}{2},\frac{\pi}{2}]$. Estimate the largest interpolation error in the range $x \in (0, \frac{\pi}{2})$.

Solution. According to (7) we have the following identity for the absolute interpolation error at $x$: $$| g(x) - p_6(x) | = \left|\prod\limits_{i=1}^6 (x - \tau_i) [\tau_1, ..., \tau_6, x]g\right|.$$ Which, according to [1], has the following property: $$(\forall x \in [\tau_1, \tau_6])(\exists \xi \in [\tau_1, \tau_6]) \: | g(x) - p_6(x) | = \underbrace{ \left| \frac{g^{(6)}(\xi)}{6!} \right| }_{\bar{g}} \underbrace{\prod\limits_{i=1}^6 |x - \tau_i|}_{h(x)}.$$ Now since $g^{(6)}(x) = \cos(x)$, a conservative estimate is $\bar{g}^* = \frac{1}{720}$. Furthermore, $h(x)$ is stationairy if the following holds: $$h_x(x) = 2x\left(x-\frac{\pi}{4}\right)\left(x-\frac{\pi}{2}\right) \underbrace{ \left[ \left(x-\frac{\pi}{4}\right)\left(x-\frac{\pi}{2}\right) + x\left(x-\frac{\pi}{2}\right) + x\left(x-\frac{\pi}{4}\right) \right]}_{\mathcal{X}} = 0.$$ The solutions to the quadratic term $\mathcal{X}$ are $x^*_{1,2} = \frac{\pi}{4}\left( 1 \pm \frac{1}{\sqrt{3}} \right)$. Note that $h(x) \ge 0$ such that $x^*_{1,2}$ represent local maxima. An estimate for the maximum estimation error is therefore $$\max_x\{ | g(x) - p_6(x) | \} = \bar{g}^* \max_j \prod\limits_{i=1}^6 |x_j^* - \tau_i| = 3.545009 \cdot 10^{-5}.$$ The actual errors evaluated at 50 equally spaced points in the interval $(0, \frac{\pi}{2})$ show a maximum magnitude of $3.543035 \cdot 10^{-5}$ at $x = 1.250226$. The values of the polynomial were computed with a slightly modified (Octave) code given in problems 2.a and b:

01 	function value = evalpd(tau,gx,dgx,x)
02 	D = gx;
03 	n = length(tau);
04 	for k = 1 : n-1
05 		for i = 1 : n-k
06			if tau(i+k) ~= tau(i)
07				D(i) = (D(i+1)-D(i))/(tau(i+k)-tau(i));
08			else
09 				D(i) = dgx(i);
10 			end
11 		end
12	end
13	value = D(1);
14	for k = 2 : n
15		value = D(k) + value * (x - tau(k));
16 	end
17 	end

where tau are the interpolation points $\tau = [0,0,\frac{\pi}{4},\frac{\pi}{4},\frac{\pi}{2},\frac{\pi}{2}]$, gx is the function evaluated at $\tau$: $g(\tau) = [0,0,\frac{\sqrt{2}}{2},\frac{\sqrt{2}}{2},1,1]$, dgx is the derivative of the function evaluated at $\tau$: $g'(\tau) = [1,1,\frac{\sqrt{2}}{2},\frac{\sqrt{2}}{2},0,0]$, while x being the respective evaluation point. The modification is in line 09 where the evaluated function is replaced by its derivative if two interpolation points $\tau_i$ and $\tau_j$ match. This code will only work if derivatives of at most 1st order are required.
2015 APR 05 (v1.0)
Contact me: m.herrmann followed by an -at- followed by blaetterundsterne.org.

This document created with the help of MathJax (Thank you guys!)