Finite Difference Approximation
Using Taylor Series expansion
f ( x ) 2 f ( x ) 3 f f ( x + x ) = f ( x ) + ( x ) + +L + 2 3 x 2! x 3! x
2 3
(FD-1) (FD-2) (FD-3)
f f ( x + x ) f ( x ) x 2 f (x ) 3 f +L = 2 3 x x 2! x 3! x
2
f A B C
f f ( x + x ) f ( x ) = + O (x ), x x
i-1
i+1
f f fi = i +1 + O (x ) x i x
Forward differencing first order
(FD-4)
Finite Difference Approximation
f
Now, consider the expansion :
f 2 f (x ) 3 f (x ) f ( x x ) = f ( x ) x + 2 + ... 3 x x 2! x 3!
2 3
i-1
i+1
From which
f f ( x ) f ( x x ) = + O (x ) x x
(FD-5)
or
f f f i 1 = i + O (x ) x x
Backward differencing first order
(FD-6)
Finite Difference Approximation
Now, subtract (FD-5) from (FD-1), then
( f x ) 3 f f ( x + x ) f ( x x ) = 2 x + 2 + ... x 3! x 3
3
(FD-7)
Solving for
f , x f f ( x + x ) f ( x x ) 2 = + O (x ) x 2x
(FD-8) (FD-9)
f A B C
f f f i 1 2 = i +1 + O (x ) x i 2x
Central differencing 2nd order
i-1
i+1
Finite Difference Approximation
Thus far we have developed three approximations for the first derivative f , that is,
x
A forward difference approximation, which is first order. A backward difference approximation, which is first order. A central difference approximation, which is second order.
Finite Difference Approximation
What about the 2nd order derivative
2 f x 2
Lets Consider the following Taylor series expansion:
f ( x ) 2 f ( x ) 3 f f ( x + x ) = f ( x ) + ( x ) + +L + 2 3 x 2! x 3! x
2 3
(FD-10) (FD-11)
f (2 x ) 2 f (2 x ) 3 f +K f ( x + 2 x ) = f ( x ) + (2 x ) + + 2 3 x 2! x 3! x
2 3
Multiply (FD-10) by 2 and subtract it from (FD-11), to obtain
3 2 f 3 f 2 f ( x + x ) + f ( x + 2 x ) = f ( x ) + ( x ) + ( x ) +K x 2 x 3 2
(FD-12)
Finite Difference Approximation
From which
2 f f ( x + 2x ) 2 f ( x + x ) + f ( x ) = + O (x ) 2 2 x (x )
or
(FD-13)
2 f f i + 2 2 f i +1 + f i = + O (x ) 2 2 x i (x )
(FD-14)
This equation represents the forward difference approximation for the second order derivative which is first-order. Similarly, considering the Taylor series expansions of f ( x x ) and f ( x 2x ) , one obtains
2 f f i 2 f i 1 + f i 2 = + O (x ) 2 2 x i (x )
backward difference
(FD-15)
Finite Difference Approximation
considering the Taylor series expansions of one obtains
2 f f i 2 f i 1 + f i 2 = + O (x ) 2 2 x i (x )
f ( x x ) and f ( x 2x )
backward difference
(FD-15)
or simply add (FD-1) and (FD-5)
2f x 2
=
i
f i +1 2 f i + f i 1 2 + O ( x ) 2 (x)
central difference
(FD-16)