If I need to approximate $f'(x_i), i=0..2$ with precision of $O(h^2)$ should I simply use first difference method?

25 Views Asked by At

If $x = (1/2, 1, 3/2)$ and $y = (-8, -5, 0)$, find $f'(x_i), i = 0..2$ with precision of $O(h^2)$

I just wanted to make sure whether the one sided difference method that is $f'(x_i) = \frac{f(x_{i+1}) - f(x_i)}{h}$ has a precision of $O(h^2) $ or should I possibly use the central difference method? Here is my results:

$$h = 1, \ \ f'(\frac{1}{2}) = \frac{f(1) - f\left(\frac{1}{2}\right)}{1} = -5 +8 =3 \\ f'\left(1\right) = 0 +5 = 5$$

$$f'(\frac{3}{2}) = \frac{f(\frac{3}{2}) - f(1)}{1} = 0 +5 = 5 \\ f'(1) = f(1) - f\left(\frac{1}{2}\right) = -5 +8 =3$$

The derivatives are points (3,5).