2. AN OVERVIEW
The Method of Finite Differences
Error Approximations and Dangers
Approxmations to Diffusions
Crank Nicholson Scheme
Stability Criterion
3. Finite Differences
Approximating the derivative with a
difference quotient from the Taylor series
Function of One Variable
Choose mesh size Δx
Then uj ~ u(jΔx)
8. FUNCTION OF TWO VARIABLES
u(jΔx, nΔt) ~ uj
Backward difference for t and x
(jΔx, nΔt) ~ (uj – uj ) / Δt
(jΔx, nΔt) ~ (uj – uj ) / Δx
n
n n-1
n-1
n
∂u
∂t
∂u
∂x
9. FUNCTION OF TWO VARIABLES
Forward difference for t and x
(jΔx, nΔt) ~ (uj – uj ) / Δt
(jΔx, nΔt) ~ (uj – uj ) / Δx
n+1
n+1 n
n
∂u
∂t
∂u
∂x
10. FUNCTION OF TWO VARIABLES
Centered difference for t and x
(jΔx, nΔt) ~ (uj – uj ) / (2Δt)
(jΔx, nΔt) ~ (uj – uj ) / (2Δx)
n+1
n+1 n-1
n-1
∂u
∂t
∂u
∂x
11. FINITE DIFFERENCE EQN.
uj
n+1 - uj
n = un
j+1 - 2uj
n + un
j-1
t x
( ) 2
Error: The local truncation error is O( t)
from the left hand side and is O( x)2 from
the right hand side.
12. Assumptions
Assume that we choose a small change in
x, and that the denominator on both sides
of the equation are equal.
We are now left with the scheme:
uj
n+1 = un
j+1 - un
j + un
j-1
Solving u with this scheme is now easy to
do once we have the initial data.
13. Initial Data
Let u(x,0) = h(x) = a step function with
the following properties:
h(x) = 0 for all j except for j = 5, so
hj = 0 0 0 0 1 0 0 0 0 0 0 ….
Initially, only a certain section, which is
at j = 5 is equal to the value of 1.
“j” serves as the counter for the x
values.
14. How to solve?
We know u0
j = 1 at j = 5 and 0 at all other j
initially (given by superscript 0).
We can plug into our scheme to solve for u1
j at
all j’s.
u1
j = u0
j-1 - u0
j + u0
j+1
u1
5 = -1; u1
4 = 1; u1
6 = 1
Now we can continue to increase the # of
iterations, n, and create a table…
15. Solution for 4 iterations
4 1 -4 10 -16 19 -16 10 -4 1 0
3 0 1 -3 6 -7 6 -3 1 0 0
2 0 0 1 -2 3 -2 1 0 0 0
1 0 0 0 1 -1 1 0 0 0 0
0 0 0 0 0 1 0 0 0 0 0
1 2 3 4 5 6 7 8 9 10
j values
n
-
v
a
l
u
e
s
16. Analysis of Solution
Is this solution viable?
Maximum principle states that the solution must
be between 0 and 1 given our initial data
At n = 4, our solution has already ballooned to u
= 19!
Clearly, there are cases when the finite
difference method can pose serious problems.
17. Charting the Error
Assume the solution is constant and equal to 0.5 (halfway between
the possible 0 and 1)
18. CONCLUSION
While the finite difference method is easy
and convenient to use in many cases,
there are some dangers associated with
the method.
We will investigate why the assumption
that allowed us to simplify the scheme
could have been a major contributor to
the large error.