Example 5.1.1.
Use the 3-point forward difference formula in (5.1.5) above to estimate \(f'(0)\) if \(f(x) = \sin x\) and \(x_{0}=0, x_{1}=\pi/6\) and \(x_{2} =\pi/3\text{.}\) Provide a theoretical error bound and compare it to the actual derivative.
Solution.
First, the forward difference formula applied to this problem is
\begin{equation*}
\begin{aligned}f'(x_{0})\amp \approx \frac{1}{2h}\bigl(- 3 f(0) + 4 f(\pi/6) - f(\pi/3) \bigr) \\\amp = \frac{1}{2\pi/6}\bigl( 0 + 2 - \frac{\sqrt{3}}{2}\bigr) \\\amp \approx 1.083\end{aligned}
\end{equation*}
and recall that \(f'(0)=\cos 0 =1\text{.}\)
The theoretical error bound is
\begin{equation*}
\begin{aligned}|E_{2}'(x_{0})|\amp = \frac{h^{2}}{3}|f'''(\xi)| \\ \amp \qquad \text{and since $f(x)=\sin x$, $|f'''(\xi)| \leq 1$}\\ \amp \leq \biggl(\frac{\pi}{6}\biggr)^{2} \frac{1}{3}\approx 0.0913\end{aligned}
\end{equation*}
and since the actual error is 0.083, within the theoretical error bound.
