Numerical Methods: Marisa Villano, Tom Fagan, Dave Fairburn, Chris Savino, David Goldberg, Daniel Rave
Numerical Methods: Marisa Villano, Tom Fagan, Dave Fairburn, Chris Savino, David Goldberg, Daniel Rave
Numerical Methods: Marisa Villano, Tom Fagan, Dave Fairburn, Chris Savino, David Goldberg, Daniel Rave
An Overview
The Method of Finite Differences
Error Approximations and Dangers
Approxmations to Diffusions
Crank Nicholson Scheme
Stability Criterion
Finite Differences
Best known numerical method of
approximation
Marisa Villano
Finite Differences
Taylor Expansion
Taylor Expansion
u(x) = u(x) u(x x) + O(x)
x
u(x) = u(x + x) u(x) + O(x)
x
2
u(x) = u(x + x) u(x x) + O(x)
2x
Taylor Expansion
2
u(jx, nt) ~ uj
Backward difference for t and x
u (jx, nt) ~ (ujn ujn-1) / t
t
Error
error
Dave Fairburn
( x) 2
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:
ujn+1 = unj+1 - unj + unj-1
Solving u with this scheme is now easy to
do once we have the initial data.
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.
How to solve?
-4
10 -16 19 -16 10 -4
-3
-7
-3
-2
-2
-1
10
j values
Analysis of Solution
Lessons Learned
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.
Approximations of Diffusions
Neumann Boundary Conditions
and the Crank-Nicolson Scheme
Chris Savino
Approximations of Diffusions
uj n 1 s(uj 1n uj 1n ) (1 2s)uj n
ux(0, t ) g (t )
ux(l , t ) h(t )
uj n uj 1n
hn
x
n
1
uj 1n
u u
2x
n
1
n
1
uj 1n uj 1n
hn
2x
Crank-Nicolson Scheme
Can avoid any restrictions on stability
conditions
Unconditionally stable no matter what the
value of s is.
u
)j
2
( x )
Therefore
1 2(1 ) s (1 cos k x)
(k )
1 2 s (1 cos k x)
If (k ) 1
Therefore
then
(k ) 1
1 2 0
is always true
1
1
2
If
then there is no restriction on the size
of s for stability to hold
The scheme is unconditionally stable
When theta = it is called the Crank-Nicolson
scheme
If theta < then the scheme is stable if
t
1
s
2
(x)
2 4
Stability Criterion
Approximations of the diffusion
equation, ut=uxx
David Goldberg
Stability Criterion
The method of finite differences gives an
answer, but it does not guarantee that this
answer is meaningful.
Values must be chosen appropriately, to
ensure that the results make sense and
are applicable to real world scenarios.
This condition, that values must satisfy in
order to be worthwhile, is called the
stability criterion.
Example
=0
at x=0, , that is
0, = , = 0
in
0,
2
, 0 = =
in ,
2
Example, continued
1.8
1.6
1.4
1.2
1
0.8
0.6
0.4
0.2
0
0
0.5
1.5
2.5
3.5
Example, continued
In attempting to use the method of finite
differences, we are using a forward
difference for ut and a centered difference
for uxx.
This means that +1 +1 2 + 1
Example, continued
Rearranging, we have
u nj 1 s u nj 1 2u nj u nj 1 u nj
u nj 1 s u nj 1 2s u nj u nj s u nj 1
u nj 1 s u nj 1 u nj 1 1 2s u nj
Example, continued
1.5
1.5
0.5
0.5
0
0
Example, Continued
Tn
Xj
Example, continued
Tn
Xj
Tn 1
Tn Tn 1 Tn nT0
Tn
and also
X j 1 X j 1
s
1 2 s
Xj
Example, continued
...
1 2 s s(eik x e ik x )
1 2 s 2 s cos(k x)
Since, as discovered before, Tn nT0
if 1, T will grow without bound.
By above,
1 4s 1
1
So 1 4 s 1, s
2
Example, finished
t
Approximations of Diffusions
Example from 8.2
Daniel Rave
Summary
Wide Applicability
Importance of Stability