4. The forward and backward finite-difference operators are defined by
$D_+f(x) = \frac{f(x + h) - f(x)}{h}$, $D_-f(x) = \frac{f(x) - f(x - h)}{h}$.
These operators can be applied sequentially, e.g., $D_+D_-f(x) = D_+(D_-f(x))$.
5 a) Implement the backward difference approximation $D_-f(x)$ and the central difference
approximation $D_0f(x)$ to compute the derivative $f'(x)$ (defined in the class) in MATLAB.
5 b) Let $f(x) = \cos x$. Compute $D_0f$ and $D_-f$ at $x = \frac{\pi}{3}$ for $h = 0.1, 0.05, 0.025, 0.0125$.
Report the errors for each $h$ by comparing against analytical solution. What is the order of
accuracy for each method.