Finite Differences

Finite Differences#

Finite difference formulas approximate values of the derivatives \(f^{(n)}(x)\) of a function using only the values \(f(x)\) of the function itself. All finite difference formulas are derived from the Taylor series

\[ f(x+h) = f(x) + f'(x)h + \frac{f''(x)}{2}h^2 + \frac{f'''(x)}{6}h^3 + \cdots \]

For example, we have the familiar forward difference formula which approximates the first derivative

\[ f'(x) = \frac{f(x+h) - f(x)}{h} + O(h) \]

Subtract Taylor series

\[ f(x+h) - f(x-h) = 2f'(x)h + O(h^3) \nonumber \]

and rearrange to get the (first order) central difference formula

\[ f'(x) = \frac{f(x+h) - f(x-h)}{2h} + O(h^2) \]

Now add the equations

\[ f(x+h) + f(x-h) = 2f(x) + f''(x)h^2 + O(h^4) \]

and rearrange to get the (second order) central difference formula

\[ f''(x) = \frac{f(x+h) - 2f(x) + f(x-h)}{h^2} + O(h^2) \]