1
$\begingroup$

Given a central difference formula:

$$f'(x)\approx D(x)=\frac{f(x+h)-f(x-h)}{2h}$$

How can I find the closest error estimation $R(x)$ such that:

$$|D(x)-f'(x)|\le R(x)$$

I'm not much experienced in mathematics, so I prefer a simple and clear explanation.

$\endgroup$

1 Answer 1

2
$\begingroup$

If you write a Taylor expansion of $f(x + h)$ around $x$,

$$ f(x + h) = f(x) + hf'(x) + \frac{h^2}{2}f''(x) + \frac{h^3}{3!}f'''(x) + \cdots \tag{1} $$

Replacing $h\to -h$ in (1)

$$ f(x - h) = f(x) - hf'(x) + \frac{h^2}{2}f''(x) - \frac{h^3}{3!}f'''(x) + \cdots \tag{2} $$

Now, subtracting (1) from (2):

$$ f(x + h) - f(x - h) = 2f'(x)h + 2\frac{h^3}{3!}f'''(x) + \cdots \tag{3} $$

Rearranging

$$ f'(x) = \frac{f(x+h) - f(x-h)}{2h} - \frac{h^2}{3}f'''(x) + \cdots \tag{4} $$

Or

$$ \left| f'(x) - \frac{f(x+h) - f(x-h)}{2h}\right| = \left|\frac{h^2}{3}f'''(x) + \cdots \right| $$

$\endgroup$
3
  • $\begingroup$ Thank you. Is it possible to calculate it without the higher derivative terms (for example, at the cost of reduced accuracy)? $\endgroup$ Mar 20, 2018 at 0:34
  • $\begingroup$ @user1518183 You can use the the inequality $|a + b| \leq |a| + |b|$ to get rid of the high order terms $\endgroup$
    – caverac
    Mar 20, 2018 at 0:37
  • 1
    $\begingroup$ $$ \left|\frac{h^2}{3}f'''(x) + \text{some stuff}\right| \leq \frac{h^2}{3}|f'''(x)| + |\text{some stuff}| \leq \frac{h^2}{3}|f'''(x)| $$ $\endgroup$
    – caverac
    Mar 20, 2018 at 0:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .