User Tools

Site Tools


Math 753/852 Finite Differencing

The main things to know here are a few formulae for approximating derivatives using finite differences:

First derivative df/dx

Given a set of evenly space gridpoints $x_1, x_2, \ldots$, where $x_i = x_1 + (i-1) h$, and a function $y(x)$ evaluated at the gridpoints $y_1 = y(x_1), y_2 = y(x_2), \ldots$, we can approximate the first derivative of $y(x)$ at the gridpoints several ways

One-sided finite differencing for the first derivative, rightwards

\frac{dy}{dx}(x_i) = \frac{y_{i+1} - y_{i}}{h} + O(h)

One-sided finite differencing for the first derivative, leftwards

\frac{dy}{dx}(x_i) = \frac{y_{i} - y_{i-1}}{h} + O(h)

Centered finite differencing for the first derivative

\frac{dy}{dx}(x_i) = \frac{y_{i+1} - y_{i-1}}{2h} + O(h^2)

In practice you use the fraction on the right-hand-side as an approximation of the derivative, knowing that there is an $O(h)$ or $O(h^2)$ error in the approximation.

Second derivative

To approximate the second derivative $d^2y/dx^2$, we use the

Centered finite differencing for the second derivative

\frac{d^2y}{dx^2}(x_i) = \frac{y_{i+1} - 2 y_i + y_{i-1}}{h^2} + O(h^2)

Other formulae

There are many, many other finite-difference formulae, for higher-order derivatives, higher-order accuracy, and different choices of which gridpoint values enter into the formula. As a starting point, see the following

Further reading

gibson/teaching/fall-2016/math753/finitediff.txt · Last modified: 2016/12/12 18:49 by gibson