7
$\begingroup$

Find the best approximation to the first derivative of $f(x)$ based on the values of $f(x), f(x+h), f(x+2h)$. What is the accuracy of this approximation?

I was thinking of using a central difference approximation (because it is a 2nd order approximation) but I am unsure if that is correct.

3 Answers 3

9

Personally I would use f'(x) \approx \dfrac{f(x+h)-f(x)}{h} for small $h$ but that may be closer to f'(x+\frac{h}{2}).

So if you have a reasonable approximation to both f'(x+\frac{3h}{2}) and f'(x+\frac{h}{2}) and if you think you function is fairly smooth (in the sense of an almost constant second derivative in the range $[x,x+2h]$) then you might reduce the earlier estimate by half the difference between those two, giving f'(x) \approx f'(x+\tfrac{h}{2}) - \frac{1}{2}\left(f'(x+\tfrac{3h}{2}) -f'(x+\tfrac{h}{2})\right) and $\frac{f(x+h)-f(x)}{h} - \frac{1}{2}\left(\tfrac{f(x+2h)-f(x+h)}{h} -\tfrac{f(x+h)-f(x)}{h}\right) = \frac{4f(x+h)-3f(x)- f(x+2h)}{2h}. $

In fact this is the only estimate which gives correct results for quadratic functions and any $h$.

  • 2
    One could also derive the last result by performing Richardson extrapolation on the $2h$ and $h$ approximations...2011-10-15
7

From the Taylor series, f(x+h) = f(x) + h f'(x) + h^2 f''(x)/2 +O(h^3) and f(x-h) = f(x) - hf'(x) + h^2 f''(x)/2+O(h^3).

The only combination which gets rid of the f''(x) term is \frac{f(x+h)-f(x-h)}{2h} = f'(x) + O(h^2).

  • 0
    I talked about that [here](http://math.stackexchange.com/questions/65569/65619#65619)...2011-10-16
5

Here's a slight elaboration of my comment to Henry's answer: consider the series expansion

$\frac{f(x+h)-f(x)}{h}=f^\prime(x)+\frac{f^{\prime\prime}(x)}{2}h+\frac{f^{(3)}(x)}{6}h^2+\cdots$

From this, we get the double-step expansion

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

Richardson extrapolation here consists of finding a linear combination of the two previous expansions that knocks out the $h$ term; we find that

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

and the left-hand side, after simplification, is precisely the last expression Henry obtained.

  • 0
    The focus is on removing powers of the stepsize $h$ when applying Richardsonian extrapolation, since it is the parameter that is actually tweaked in applications.2018-01-25