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.

$\endgroup$
0

3 Answers 3

9
$\begingroup$

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$.

$\endgroup$
1
  • 2
    $\begingroup$ One could also derive the last result by performing Richardson extrapolation on the $2h$ and $h$ approximations... $\endgroup$ Commented Oct 15, 2011 at 0:35
7
$\begingroup$

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)$.

$\endgroup$
1
  • $\begingroup$ I talked about that here... $\endgroup$ Commented Oct 16, 2011 at 2:58
5
$\begingroup$

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.

$\endgroup$
2
  • $\begingroup$ Wouldn't it be more precise to say that the linear combination is to knock out the f''(x) term? $\endgroup$ Commented Nov 30, 2017 at 20:28
  • $\begingroup$ 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. $\endgroup$ Commented Jan 25, 2018 at 15:57

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.