[Math] Second derivative numerical estimate – stability and approach

derivativesnumerical methods

I would like to know how to estimate second derivatives of a function sampled discretely with constant spacing.

Let there be a function $f(x)$. I sample its values $\{f(x_i)\}$ at points $\{x_i\}$ such that $x_i = x_{i-1} + \Delta x$.

The simplest thing would be
$$
\frac{\mathrm{d}^2 f}{\mathrm{d} x^2} (x_i) \approx \frac{f(x_{i+1})-2f(x_i)+f(x_{i-1})}{\Delta x^2} \, .
$$
I could shift the central point, but the essence would be the same.

I would like to know whether there are other, more elaborate estimates, and specifically whether I can use more than 3 points in the estimate. The functions I work with have no discontinuities and are well-behaved.

Thanks a lot.

Best Answer

Wikipedia (citing this article) lists coefficients for approximation of derivatives using central or forward or backward finite differences.

For example, $$ f''(x_i) = \frac{1}{(\Delta x)^2} \left(-\frac{1}{12} f(x_{i-2}) + \frac{4}{3} f(x_{i-1}) - \frac{5}{2} f(x_i) + \frac{4}{3} f(x_{i+1}) - \frac{1}{12} f(x_{i+2})\right) + O((\Delta x)^4) $$

One can also use Richardson extrapolation: let $g(x, h)$ be the numerical approximate of known order $p$. Then a more precise estimate is $$g(x, h) + \frac{g(x, h) - g(x, rh)}{r^p - 1},$$ which has order at least $p + 1$, and where $g(x, rh)$ ($r > 1$) is the estimate made using a grid with step $rh$.

Related Question