Second-order central difference (source code)

= Second-order central difference

On a uniform grid of spacing $h$, the second-order central difference
$$
\frac{f(x-h)-2f(x)+f(x+h)}{h^2}
$$
approximates $f''(x)$ with error $O(h^2)$ for a sufficiently smooth function.