Finite Difference

The finite difference is the discrete analog of the derivative. The finite forward difference of a function f_p is defined as

 Deltaf_p=f_(p+1)-f_p,
(1)

and the finite backward difference as

 del f_p=f_p-f_(p-1).
(2)

The forward finite difference is implemented in the Wolfram Language as DifferenceDelta[f, i].

If the values are tabulated at spacings h, then the notation

 f_p=f(x_0+ph)=f(x)
(3)

is used. The kth forward difference would then be written as Delta^kf_p, and similarly, the kth backward difference as del ^kf_p.

However, when f_p is viewed as a discretization of the continuous function f(x), then the finite difference is sometimes written

Deltaf(x)=f(x+1/2)-f(x-1/2)
(4)
=2AdjustmentBox[I, BoxMargins -> {{0.101266, -0.101266}, {0.375, -0.375}}, BoxBaselineShift -> -0.375]AdjustmentBox[I, BoxMargins -> {{0, 0}, {-0.25, 0.25}}, BoxBaselineShift -> 0.25](x)*f(x),
(5)

where * denotes convolution and AdjustmentBox[I, BoxMargins -> {{0.101266, -0.101266}, {0.375, -0.375}}, BoxBaselineShift -> -0.375]AdjustmentBox[I, BoxMargins -> {{0, 0}, {-0.25, 0.25}}, BoxBaselineShift -> 0.25](x) is the odd impulse pair. The finite difference operator can therefore be written

 Delta^~=2AdjustmentBox[I, BoxMargins -> {{0.101266, -0.101266}, {0.375, -0.375}}, BoxBaselineShift -> -0.375]AdjustmentBox[I, BoxMargins -> {{0, 0}, {-0.25, 0.25}}, BoxBaselineShift -> 0.25]*.
(6)

An nth power has a constant nth finite difference. For example, take n=3 and make a difference table,

 x; 1; 2; 3; 4; 5x^3; 1; 8; 27; 64; 125Delta; 7; 19; 37; 61Delta^2; 12; 18; 24Delta^3; 6; 6Delta^4; 0.
(7)

The Delta^3 column is the constant 6.

Finite difference formulas can be very useful for extrapolating a finite amount of data in an attempt to find the general term. Specifically, if a function f(n) is known at only a few discrete values n=0, 1, 2, ... and it is desired to determine the analytical form of f, the following procedure can be used if f is assumed to be a polynomial function. Denote the nth value in the sequence of interest by a_n. Then define b_n as the forward difference Delta_n=a_(n+1)-a_n, c_n as the second forward difference Delta_n^2=b_(n+1)-b_n, etc., constructing a table as follows

 a_0=f(0)  a_1=f(1)  a_2=f(2)  ...  a_p=f(p)
(8)
   b_0=a_1-a_0  b_1=a_2-a_1  ...  b_(p-1)=a_p-a_(p-1)
(9)
 c_0=b_1-b_0  ...  ...
(10)
 ...
(11)

Continue computing d_0, e_0, etc., until a 0 value is obtained. Then the polynomial function giving the values a_n is given by

f(n)=sum_(k=0)^(p)alpha_k(n; k)
(12)
=a_0+b_0n+(c_0n(n-1))/2+(d_0n(n-1)(n-2))/(2·3)+....
(13)

When the notation Delta_0=a_0, Delta_0^2=b_0, etc., is used, this beautiful equation is called Newton's forward difference formula. To see a particular example, consider a sequence with first few values of 1, 19, 143, 607, 1789, 4211, and 8539. The difference table is then given by

 1  19  143  607  1789  4211  8539
18  124  464  1182  2422  4328
106  340  718  1240  1906
234  378  522  666
144  144  144
0  0
(14)

Reading off the first number in each row gives a_0=1, b_0=18, c_0=106, d_0=234, e_0=144. Plugging these in gives the equation

f(n)=1+18n+1/2106n(n-1)+1/6234n(n-1)(n-2)+1/(24)144n(n-1)(n-2)(n-3)
(15)
=6n^4+3n^3+2n^2+7n+1,
(16)

which indeed fits the original data exactly.

Formulas for the derivatives are given by

f^'(x_0)=1/h[f(x_0+h)-f(x_0)]-1/2hf^('')(xi)
(17)
=1/(2h)[-3f(x_0)+4f(x_0+h)-f(x_0+2h)]+1/3h^2f^((3))(xi)
(18)
=1/(2h)[f(x_0+h)-f(x_0-h)]-1/6h^2f^((3))(xi)
(19)
=1/(12h)(f_(-2)-8f_(-1)+8f_1-f_2)+1/(30)h^4f^((5))(xi)
(20)
=1/(12h)(-25f_0+48f_1-36f_2+16f_3-3f_4)+1/5h^4f^((5))(xi)
(21)
f^('')(x_0)=1/(h^2)(f_(-1)-2f_0+f_1)-1/(12)h^2f^((4))(xi)
(22)
=1/(h^2)(f_0-2f_1+f_2)+1/6h^2f^((4))(xi_1)-hf^((3))(xi_2)
(23)
f^((3))(x_0)=1/(h^3)(f_3-3f_2+3f_1-f_0)+O(h)
(24)
=1/(2h^3)(f_2-2f_1+2f_(-1)-f_(-2))+O(h^2)
(25)
f^((4))(x_0)=1/(h^4)(f_4-4f_3+6f_2-4f_1+f_0)+O(h)
(26)
=1/(h^4)(f_2-4f_1+6f_0-4f_(-1)+f_(-2))+O(h^2)
(27)

(Beyer 1987, pp. 449-451; Zwillinger 1995, p. 705).

Formulas for integrals of finite differences

 int_(x_0)^(x_n)f(x)dx=hint_0^nf_pdp
(28)

are given by Beyer (1987, pp. 455-456).

Finite differences lead to difference equations, finite analogs of differential equations. In fact, umbral calculus displays many elegant analogs of well-known identities for continuous functions. Common finite difference schemes for partial differential equations include the so-called Crank-Nicolson, Du Fort-Frankel, and Laasonen methods.

Wolfram Web Resources

Mathematica »

The #1 tool for creating Demonstrations and anything technical.

Wolfram|Alpha »

Explore anything with the first computational knowledge engine.

Wolfram Demonstrations Project »

Explore thousands of free applications across science, mathematics, engineering, technology, business, art, finance, social sciences, and more.

Computerbasedmath.org »

Join the initiative for modernizing math education.

Online Integral Calculator »

Solve integrals with Wolfram|Alpha.

Step-by-step Solutions »

Walk through homework problems step-by-step from beginning to end. Hints help you try the next step on your own.

Wolfram Problem Generator »

Unlimited random practice problems and answers with built-in Step-by-step solutions. Practice online or make a printable study sheet.

Wolfram Education Portal »

Collection of teaching and learning tools built by Wolfram education experts: dynamic textbook, lesson plans, widgets, interactive Demonstrations, and more.

Wolfram Language »

Knowledge-based programming for everyone.