Upload
ginanjar-dika
View
215
Download
0
Embed Size (px)
Citation preview
7/28/2019 5blk
1/90
Math6911 S08, HM Zhu
Chapter 5 Finite Difference
Methods
7/28/2019 5blk
2/90
2
Math6911, S08, HM ZHU
References
1. Chapters 5 and 9, Brandimarte
2. Section 17.8, Hull
3. Chapter 7, Numerical analysis, Burden and Faires
7/28/2019 5blk
3/90
3
Math6911, S08, HM ZHU
Outline
Finite difference (FD) approximation to the derivatives Explicit FD method Numerical issues
Implicit FD method Crank-Nicolson method Dealing with American options Further comments
7/28/2019 5blk
4/90
Math6911 S08, HM Zhu
5.1 Finite difference approximations
Chapter 5 Finite Difference
Methods
7/28/2019 5blk
5/90
5
Math6911, S08, HM ZHU
Finite-difference mesh
Aim to approximate the values of the continuous functionf(t, S) on a set of discrete points in (t, S) plane
Divide the S-axis into equally spaced nodes at distance
S apart, and, the t-axis into equally spaced nodes adistance t apart (t, S) plane becomes a mesh with mesh points on
(i t, jS)We are interested in the values off(t, S) at mesh points
(i t, jS), denoted as
( )i , jf f i t , j S=
7/28/2019 5blk
6/90
6
Math6911, S08, HM ZHU
The mesh for finite-difference
approximation
t
S
i t
j S
( )i , jf f i t , j S= Smax=MS
T=N t
?
7/28/2019 5blk
7/90
Math6911, S08, HM ZHU
Black-Scholes Equation for a
European option with value V(S,t)
conditionsboundaryandfinalproperwith
Tt0andS0where
)1.5(021
2
222
7/28/2019 5blk
8/90
8
Math6911, S08, HM ZHU
Finite difference approximations
The basic idea of FDM is to replace the partial derivativesby approximations obtained by Taylor expansions near thepoint of interests
( ) ( ) ( ) ( ) ( )
( )
( ) ( )( )
( )( )
0
2
For example,
for small using Taylor expansion at point
t
f S,t f S ,t t f S ,t f S ,t t f S ,tlim
t t t
t , S ,t
f S ,tf S ,t t f S ,t t O t
t
+ + =
+ = + +
7/28/2019 5blk
9/90
Forward-, Backward-, and Central-
difference approximation to 1
st
orderderivatives
( ) ( ) ( )
( )( ) ( ) ( )
( )
( ) ( ) ( ) ( )( )2
Forward:
Backward:
Central:2
f t ,S f t t ,S f t ,SO t
t t
f t ,S f t ,S f t t ,SO t
t t
f t ,S f t t ,S f t t ,S O tt t
+ +
+
+ +
t t+ tt t
centralbackward forward
7/28/2019 5blk
10/90
10
Math6911, S08, HM ZHU
Symmetric Central-difference
approximations to 2nd
order derivatives
( ) ( ) ) ( )
( )( )( )
22
22
2f t ,S f t ,S S f t ,S f t ,S SO S
S S
+ + +
( ) ( )
( )
( )
( )
Use Taylor's expansions for and
around point
f t ,S S f t ,S S
t , S :
f t ,S S ?
f t ,S S ?
+
+ =+
=
7/28/2019 5blk
11/90
11
Math6911, S08, HM ZHU
Finite difference approximations
1 1
1 1
1 1 1 1
2 2
Forward Difference:
Backward Difference:
Central Difference:
As to the second
i , j i , j i , j i , j
i , j i , j i , j i , j
i , j i , j i , j i , j
f f f ff f,t t S S
f f f ff f,
t t S S
f f f ff f,
t t S S
+ +
+ +
( )
21 1
2
1 1
2
2
derivative, we have:
=
i , j i , j i , j i , j
i , j i , j i , j
f f f ffS
S SS
f f f
S
+
+
+
7/28/2019 5blk
12/90
12
Math6911, S08, HM ZHU
Depending on which combination of schemes we use in
discretizing the equation, we will have explicit, implicit, orCrank-Nicolson methods
We also need to discretize the boundary and final
conditions accordingly. For example, for European Call,
Finite difference approximations
( )
( )
0
Final Condition:
0 for 01
Boundary Conditions:
0for 01
where
N , j
i ,
r N i t
i ,M max
max
f max j S K , , j , ,...,M
f, i , ,...,N
f S Ke
S M S.
= =
==
= =
7/28/2019 5blk
13/90
Math6911 S08, HM Zhu
5.2.1 Explicit Finite-Difference Method
Chapter 5 Finite Difference
Methods
7/28/2019 5blk
14/90
Math6911, S08, HM ZHU
Explicit Finite Difference Methods
22 2
2
1
1 1
21 1
2 2
12
2
2
In , at point ( ), set
backward difference:
central difference: ,
and
i , j i , j
i , j i , j
i , j i , j i , j
i , j
f f frS S rf i t , j S t S S
f ff
t t
f ff
S S
f f ff
, r f rf , S j SS S
+
+
+ + =
+
= =
7/28/2019 5blk
15/90
Math6911, S08, HM ZHU
Explicit Finite Difference Methods
( )
( )( )
1 1 1
2 2
2 2
2 2
1
2
11
2
Rewriting the equation, we get an explicit scheme:
(5.2)
where
* * *
i , j j i , j j i , j j i , j
*
j
*
j
*
j
f a f b f c f
a t j rj
b t j r
c t j rj
+= + +
=
= +
= +
1 2 1 0 1 2 1for andi N - , N - , ..., , j , , ..., M - .= =
7/28/2019 5blk
16/90
Math6911, S08, HM ZHU
Numerical Computation Dependency
x
x
x
x
t
S
it
jS
Smax=MS
T=N t0
0
(i-1)t
(j+1)S
(j-1)S
7/28/2019 5blk
17/90
17
Math6911, S08, HM ZHU
Implementation
1. Starting with the final values , we apply (5.2) to solveWe use the boundary condition
to determine
2. Repeat the process to determine and so on
N , jf1 for 1 1N , jf j M .
10 1andN , N - ,Mf f .
2N , jf
7/28/2019 5blk
18/90
18
Math6911, S08, HM ZHU
Example
We compare explicit finite difference solution for aEuropean put with the exact Black-Scholes formula, where
T = 5/12 yr, S0=$50, K = $50, =30%, r = 10%.
Black-Scholes Price: $2.8446
EFD Method with Smax=$100, S=2, t=5/1200: $2.8288
EFD Method with Smax=$100, S=1, t=5/4800: $2.8406
7/28/2019 5blk
19/90
19
Math6911, S08, HM ZHU
Example (Stability)
We compare explicit finite difference solution for a Europeanput with the exact Black-Scholes formula, where T = 5/12 yr,
S0=$50, K = $50, =30%, r = 10%.
Black-Scholes Price: $2.8446
EFD Method with Smax=$100, S=2, t=5/1200: $2.8288
EFD Method with Smax=$100, S=1.5, t=5/1200: $3.1414EFD Method with Smax=$100, S=1, t=5/1200: -$2.8271E22
7/28/2019 5blk
20/90
Math6911 S08, HM Zhu
5.2.2 Numerical Stabili ty
Chapter 5 Finite Difference
Methods
7/28/2019 5blk
21/90
21
Math6911, S08, HM ZHU
Numerical Accuracy
The problem itselfThe discretization scheme used
The numerical algorithm used
7/28/2019 5blk
22/90
22
Math6911, S08, HM ZHU
Conditioning Issue
( )
( ) ( )
Suppose we have mathematically posed problem:
where is to evaluated given an input .
Let for small change
If hen is near then we call the problem is
*
*
y f x
y x
x x x x.
f x f x ,
well - co
=
= +
. Otherwise, it is ill-posed/ill-conditioned.nditioned
7/28/2019 5blk
23/90
23
Math6911, S08, HM ZHU
Conditioning Issue
Conditioning issue is related to the problem itself, not to thespecific numerical algorithm; Stability issue is related to thenumerical algorithm
One can not expect a good numerical algorithm to solve an ill-conditioned problem any more accurately than the datawarrant
But a bad numerical algorithm can produce poor solutions
even to well-conditioned problems
7/28/2019 5blk
24/90
24
Math6911, S08, HM ZHU
Conditional Issue
( ) ( )( )
( )( )
The concept "near" can be measured by further information about
the particular problem:
0
where C is called of this problem. If C is large,the problem is ill-conditioned.
*f x f x xC f x
xf x
condition number
7/28/2019 5blk
25/90
25
Math6911, S08, HM ZHU
Floating Point Number & Error
( )
( ) xxfled
xx
xx.xxflx
xx.xx
x
i
ed
e
d
=
=
:or
integerboundedan:systempointfloatingtheofprecisioninteger,an:
9,00,where
10:numberpointfloatingTruncated
10:expansiondecimalInfinite
number.realanybeLet
1
21
21
errorroundoffpointFloating
7/28/2019 5blk
26/90
26
Math6911, S08, HM ZHU
Error Propagation
( )
( )( )
00040011.0:npropagatioError
0003.0:errorpointFloating
3.where10667.0and6667.0Let:
errors.pointfloatingtheseofonaccumulati
anistheredone,arenscalculatioadditionalWhen
22
0
=
=
===
xxfl
xxfl
dxflxExample
7/28/2019 5blk
27/90
27
Math6911, S08, HM ZHU
Numerical Stability or Instability
( )
Stability ensures if the error between the numerical
soltuion and the exact solution remains bounded
as numerical computation progresses.
That is, (the solution of a slightly perturbed problem)
is n
*
f x
( )( )
( )
ear the computed solution
Stability concerns about the behavior of
as numerical computation progresses for fixed discretization
steps and S.
*
i , j
f x .
f f i t , j S
t
7/28/2019 5blk
28/90
28
Math6911, S08, HM ZHU
Convergence issue
( )
( )
Convergence of the numerical algorithm concerns about
the behavior of as S 0 for fixed
values .
For well-posed linear initial value problem,
Stability Convergence
(Lax's eq
i , jf f i t , j S t ,
i t , j S
uivalence theorem, Richtmyer and Morton, "Difference
Methods for Initial Value Problems" (2nd) 1967)
7/28/2019 5blk
29/90
29
Math6911, S08, HM ZHU
Numerical Accuracy
These factors contribute the accuracy of a numerical solution.
We can find a goodestimate if our problem is well-conditioned and the algorithm is stable
( ) ( )( ) ( )
( ) ( )Stable:Well-conditioned:
* *
*
*
f x f xf x f x
f x f x
7/28/2019 5blk
30/90
Math6911 S08, HM Zhu
5.2.3 Financial Interpretation of Numerical Instability
Chapter 5 Finite Difference
Methods
7/28/2019 5blk
31/90
Math6911, S08, HM ZHU
Financial Interpretation of instability
(Hall, page 423-4)
2
1 1 1 1 1
1
1
1
2If and are assumed to be the same at ( )
as they are at ( ), we obtain equations of the form:
(5.3)
where
=
i , j j i , j j i , j j i , j
j
f S f S i , j
i, j
f a f b f c f
a
+ + + +
+
= + +
( )
2 2
2 20
2 2
1
1
1 111 1
1 1
1 11 2 1 0 1 2 1
1 1
2 2
1 1
2 2for and
d
j
j u
t j t r jr t r t
b j tr t r t
c t j t r j
r t r t i N - , N - , ..., , j , , ..., M - .
= + +
= =+ +
= + = + + = =
7/28/2019 5blk
32/90
Math6911, S08, HM ZHU
Explicit Finite Difference Methods
i , j i +1, j
i +1, j 1
i +1, j +1
These coefficients can be interpreted as probabilities timesa discount factor. If one of these probability < 0, instabilityoccurs.
d
0
u
E li i Fi i Diff M h d
7/28/2019 5blk
33/90
Math6911, S08, HM ZHU
Explicit Finite Difference Method asTrinomial Tree
[ ]
( ) ( )
0
2 22
0
Check if the mean and variance of the
Expected value of the increase in asset price during t:
E 0
Variance of the increment:
E 0
d u
d
S S rj S t rS t
S S
= + + = =
= + + ( )
[ ] [ ] ( )
2 2 2 2 2
22 2 2 2 2 2 2 2Var E E
which is coherent with geometric Brownian motion in a risk-neutral world
u j S t S t
S t r S t S t
= =
= =
7/28/2019 5blk
34/90
34
Math6911, S08, HM ZHU
Change of Variable
2 2 2
2
2 21 1 1 1 1 1 1 1 1 1 1
2
2 2
2
2 2 2
Define The B-S equation becomes
The corresponding difference equation is
or
i , j i , j i , j i , j i , j i , j i , j
i , j
Z ln S.
f f fr rf
t Z Z
f f f f f f fr rf
t Z Z
f
+ + + + + + + + +
=
+ + =
+ + + =
1 1 1 1 1 54( )* * *
i , j j i , j j i , j j i , jf f f . + + + += + +
7/28/2019 5blk
35/90
35
Math6911, S08, HM ZHU
Change of Variable
2 2
2
2
2
2 2
2
1
1 2 2 2
11
1
11 2 2 2
3
where
It can be shown that it is numerically most efficient if
*
j
*
j
*j
t tr
r t Z Z
t
r t Z
t trr t Z Z
Z t .
= + +
= +
= + +
=
7/28/2019 5blk
36/90
36
Math6911, S08, HM ZHU
Reduced to Heat Equation
Get rid of the varying coefficients S and S by usingchange of variables:
Equation (5.1) becomes heat equation (5.5):
( )( ) ( )
( )
=
===+
2
14
11
2
12
21
,,,2,2
rk
xueEtSVTtEeSkxk
x
2
2(5.5)
for and 0
u u
x
x
=
< < + >
7/28/2019 5blk
37/90
Math6911, S08, HM ZHU
( )
( )( )
( )( )
( ) ( )( )
( )
( )
===
++=
++
=+
=
+
++
++
T
,...M,mNn-N
uuuu
xOO
xOx
uuuO
uu
x,mnuu
m
n
m
n
m
n
m
n
m
n
m
n
m
n
m
n
m
n
m
n
2
2
111
2
2
211
1
2
1
10andfor,x
where
21
bythis
eapproximatcanwe,andoftermsIgnoring
2
:formtheofequationsdifferencefinite
ofsystemasolvinginvolvesthis,With
Explicit Finite Difference Method
7/28/2019 5blk
38/90
38
Math6911, S08, HM ZHU
Stability and Convergence
(P. Wilmott, et al, Option Pricing)
( )
2
1,
2
:
The solution of Eqn (5.5) is
1 1i) Stable if 0 ; ii) Unstable if
2 2x
:
If 0 then the explicit finite-difference approximation
converges to the exact solution as ,
< = >
<
Stability
Convergence
( )
( )
,mn
x 0
(in the sense that as , x 0)
is O
u u n x m
Rate of Convergence
7/28/2019 5blk
39/90
Math6911 S08, HM Zhu
5.3.1 Implicit Finite-Difference Method
Chapter 5 Finite Difference
Methods
7/28/2019 5blk
40/90
Math6911, S08, HM ZHU
Implicit Finite Difference Methods
2
2 22
1
1 1
21 1
2 2
12
2
2
,j ,
, ,
, , ,
In , we use
difference:
central difference: ,
and
i i j
i j i j
i j i j i j
i , j
f f frS S r f t S S
f ff
t t
f ff
S S
f f ff, rf rf
S S
+
+
+
+ + =
+ =
forward
7/28/2019 5blk
41/90
Math6911, S08, HM ZHU
Implicit Finite Difference Methods
( )
( )( )
1 1 1
2 2
2 2
2 2
1
, , ,
Rewriting the equation, we get an implicit scheme:
= (5.6)
where
1=2
1
2
for
j i j j i j j i j i , j
j
j
j
a f b f c f f
a t j rj
b t j r
c t j rj
+ ++ +
+
= + += +
1 2 1 0 1 2 1andi N - , N - , ..., , j , , ..., M - .= =
7/28/2019 5blk
42/90
Math6911, S08, HM ZHU
Numerical Computation Dependency
x
x
x
x
t
S
it
jS
Smax=MS
T=N t0
0
(i-1)t
(j+1)S
(j-1)S
(i+1)t
Implementation
7/28/2019 5blk
43/90
Implementation
( )1
1 2 3 1 1 0 1
Equation (5.6) can be rewritten in matrix form:
57
where and are ( 1) dimensional vectors
0 0 0
and is ( 1) ( 1) symmetric
i i i
i i
T T
i i , i , i , i ,M i i , M i ,M
.
M
f , f , f , f , a f , , , , , c f
M M
+
= +
= =
Cf f b
f b
f b
C
1 1
2 2 2
3 3
2
1 1
matrices0 0
0
0
0 0
M
M M
b c
a b c
a b
c
a b
=
C
7/28/2019 5blk
44/90
44
Math6911, S08, HM ZHU
Implementation
1. Starting with the final values , we need to solve alinear system (5.7) to obtain
using LU factorization or iterative methods. We use theboundary condition to determine
2. Repeat the process to determine and so on
N , jf1 for 1 1N , jf j M
10 1and
N , N - ,Mf f .
2N , jf
E l
7/28/2019 5blk
45/90
45
Math6911, S08, HM ZHU
Example
We compare implicit finite difference solution for aEuropean put with the exact Black-Scholes formula, whereT = 5/12 yr, S0=$50, K = $50, =30%, r = 10%.
Black-Scholes Price: $2.8446
IFD Method with Smax=$100, S=2, t=5/1200: $2.8194
IFD Method with Smax=$100, S=1, t=5/4800: $2.8383
E l (St bilit )
7/28/2019 5blk
46/90
46
Math6911, S08, HM ZHU
Example (Stability)
We compare implicit finite difference solution for a Europeanput with the exact Black-Scholes formula, where T = 5/12 yr,
S0=$50, K = $50, =30%, r = 10%.
Black-Scholes Price: $2.8846
IFD Method with Smax=$100, S=2, t=5/1200: $2.8288
IFD Method with Smax=$100, S=1.5, t=5/1200: $3.1325IFD Method with Smax=$100, S=1, t=5/1200: $2.8348
7/28/2019 5blk
47/90
Math6911, S08, HM ZHU
Implicit vs Explicit Finite Difference Methods
i +1, ji , j
i , j 1
i , j +1
Implicit Method
(always stable)
i , j i +1, j
i +1, j 1
i +1, j +1
Explicit Method
Implicit vs Explicit Finite Difference
7/28/2019 5blk
48/90
48
Math6911, S08, HM ZHU
p pMethod
The explicit finite difference method isequivalent to the trinomial tree approach:
Truncation error: O(t) Stability: not always
The implicit finite difference method is
equivalent to a multinomial tree approach: Truncation error: O(t) Stability: always
Other Points on Finite Difference
7/28/2019 5blk
49/90
Math6911, S08, HM ZHU
Methods
It is better to have ln Srather than Sasthe underlying variable in general
Improvements over the basic implicit and
explicit methods: Crank-Nicolson method, average of
explicit and implicit FD methods, trying
to achieve Truncation error: O((t)2 ) Stability: always
7/28/2019 5blk
50/90
Math6911 S08, HM Zhu
5.3.2 Solving a linear system using direct methods
Chapter 5 Finite Difference
Methods
Solve Ax=b
7/28/2019 5blk
51/90
51
Math6911, S08, HM ZHU
Solve Ax=b
A x=b
Various shapes of matrix A
Lower triangular Upper triangular General
7/28/2019 5blk
52/90
Math6911 S08, HM Zhu
5.3.2.A Triangular Solvers
Example: 3 x 3 upper triangular system
7/28/2019 5blk
53/90
53
Math6911, S08, HM ZHU
Example: 3 x 3 upper triangular system
=
20
10
100
400
110
164
3
2
1
x
x
x
465
65*61004
510
54/20
1
231
32
3
=
====
==
x
xxx
xx
x
Solve an upper triangular system Ax=b
7/28/2019 5blk
54/90
54
Math6911, S08, HM ZHU
Solve an upper triangular system Ax=b
( )
1,1,
,,1,002
1
=
=
=
==+=
>
>
niaxabx
abx
nibxaxa
x
x
x
aa
ii
ij
jijii
nnnn
i
ij
jijiii
n
inii
Implementation
7/28/2019 5blk
55/90
55
Math6911, S08, HM ZHU
Implementation
Function x = UpperTriSolve(A, b)n = length(b);
x(n) = b(n)/A(n,n);
for i = n-1:-1:1
sum = b(i);
for j = i+1:n
sum = sum - A(i,j)*x(j);
endx(i) = sum/A(i,i);
end
7/28/2019 5blk
56/90
Math6911 S08, HM Zhu
5.3.2.B Gauss Elimination
To solve Ax=b for general formA
7/28/2019 5blk
57/90
57
Math6911, S08, HM ZHU
To solve Ax b for general form A
To solve Ax = b :
Suppose A = LU. Then
Ax = LUx = b
z
= *
Solve two triangular systems:
1) solve z from Lz = b
2) solve x from Ux = z
Gauss Elimination = *
7/28/2019 5blk
58/90
58
Math6911, S08, HM ZHU
Gauss Elimination =
Goal: Make A an upper triangular matrix through using
fundamental row operations
For example, to zero the elements in the lower triangular part of A
1) Zero a21
=
333231
11
132123
11
122122
131211
333231
232221
131211
11
21 0
100
01
001
aaa
aaaa
aaaa
aaa
aaa
aaa
aaa
aa
E 21A
Gauss Elimination = *
7/28/2019 5blk
59/90
59
Math6911, S08, HM ZHU
Gauss Elimination
2) Zero a31
11 12 13 11 12 13
21 13 21 1321 12 21 1222 23 22 23
11 11 11 11
31
31 32 33 31 12 31 1311 32 33
11 11
1 0 0
0 1 0 0 0
0 10
a a a a a a
a a a aa a a aa a a aa a a a
aa a a a a a a
a a aa a
=
11 12 13
22 23
32 33
0
0
=
a a a
a a
a a
E 31 E 21A
Gauss Elimination = *
7/28/2019 5blk
60/90
60
Math6911, S08, HM ZHU
Gauss Elimination
3) Zero
11 12 13 11 12 13
22 23 22 23
32 32 33 32 2333
22 22
1 0 0
0 1 0 0 00
0 1 0 0
a a a a a a
a a a aa a a a a
aa a
=
U
32
a
E 32 E 31 E 21A = U
lower triangular
Gauss Elimination = *
7/28/2019 5blk
61/90
61
Math6911, S08, HM ZHU
Claim 1:21
32 31 21
11
31 32
11 22
1 0 0
1 0
1
a
a
a aa a
=
E E E
Claim 2:
( )1 21
32 31 21
11
31 32
11 22
1 0 0
1 0
1
a
a
a aa a
=
E E E
LU Factorization = *
7/28/2019 5blk
62/90
62
Math6911, S08, HM ZHU
Therefore, through Gauss Elimination, we have
E 32 E 31 E 21A = U
A = E 32 E 31 E 21( )1
U
A =LU
It is called LU factorization. When A is symmetric,
which is called Cholesky DecompositionT=A LL
To solve Ax=b for general form A
7/28/2019 5blk
63/90
63
Math6911, S08, HM ZHU
g
To solve Ax = b becomes1) Use Gauss elimination to make A upper triangular, i.e.
L1Ax = L1b Ux = z
2) Solve x from Ux = z
This suggests that when doing Gauss elimination, we can do it
to the augmented matrix A b[ ] associated with the linear system.
An exercise
7/28/2019 5blk
64/90
64
Math6911, S08, HM ZHU
An exercise
=
4
0
0
21
121
12
3
2
1
x
x
x
% build the matrix A
A = [2, -1, 0; -1, 2, -1; 0, -1, 2]
% build the vector b
x_true = [1:3]';
b = A * x_true;
% lu decomposition of A
[l, u] = lu(A)
% solve z from lz = b where z = uxz = l\b;
% solve x from ux = z
x = u\z
General Gauss Elimination
7/28/2019 5blk
65/90
65
Math6911, S08, HM ZHU
row i
row j -aji
aiirow i
What if we have zero or very smalldiagonal elements?
7/28/2019 5blk
66/90
66
Math6911, S08, HM ZHU
diagonal elements?
LUPA
LUA
PA
A
=
=
=
=
=
=
=
.9999011
10.000101
1110.0001
0110
9999-0
10.0001
110,000
01
11
10.0001=
10
32
32
10
01
10
3210=
exampleFor
pivoting.partialcalledisThisLU.=PAi.e.,stably,computedorcomputedbecan
neliminatioGaussthatsoAofrowspermutetoneedweSomtimes,
Can we always have A = LU?
7/28/2019 5blk
67/90
67
Math6911, S08, HM ZHU
( )( )1 1 0 1 1nxn
No!
If : , : for =,..., - ,
then A has an LU factorization.Proof:
See Golub and Loan, Matrix Computation, 3rd edition
det k k k n
A
R
7/28/2019 5blk
68/90
Math6911 S08, HM Zhu
Chapter 5 Finite Difference
Methods
5.4.1 Crank-Nicolson Method
Explicit Finite Difference Methods
7/28/2019 5blk
69/90
Math6911, S08, HM ZHU
Explicit Finite Difference Methods
( )
( )
( )( )
22 2
2
1
21 1 1 1 1 1 1 1 12 2
2
2
1
1
2
21
2 2
With ,
we can obtain an explicite form:
i , j i , j
i , j i , j i , j i , j i , j
i , j
f f frS S rf t S S
f f O tt
f f f f f
rj S j S S S
rf O S
+
+ + + + + + +
+
+ + =
+ =
+
+ +
Implicit Finite Difference Methods
7/28/2019 5blk
70/90
Math6911, S08, HM ZHU
Implicit Finite Difference Methods
( )
( )
( )
( )
2
2 22
1
21 1 1 12 22
2
12
21
2 2
With ,
we can obtain an implicit form :
i , j i , j
i , j i , j i , j i , j i , j
i , j
f f frS S r f t S S
f fO t
t
f f f f frj S j S
S S
rf O S
+
+ +
+ + =
+ =
+
+ +
Crank-Nicolson Methods: average of explicitand implicit methods
7/28/2019 5blk
71/90
Math6911, S08, HM ZHU
(Brandmarte, p485)
( )( )
( )
( ) ( )( )
21
1 1 1 1 1 1
2 1 1 1 1 1 1 12 2
2 2
2
1
2 2 2
2 21
4
2
i , j i , j
i , j i , j i , j i , j
i , j i , j i , j i , j i , j i , j
i , j i , j
f f O tt
f f f frj S
S S
f f f f f fj S
S S
rf f O S
+
+ + + +
+ + + + +
+
+ =
+ + +
+
+ + +
Crank-Nicolson Methods
7/28/2019 5blk
72/90
Math6911, S08, HM ZHU
Crank Nicolson Methods
( )( )
( )
1 1
1 1 1 1 1
2 2
1
1
R ewriting the equation, we get an C rank-N icolson scheme:
(5.5)
where
=4
j i , j j i , j j i , j
j i , j j i , j j i , j
j
j
f f f
f f f
tj rj
+
+ + + +
+ =
+ + +
= ( )
( )
2 2
2 2
2
1 2 1 0 1 2 1
4
for and
j
tj r
tj rj
i N - , N - , ..., , j , , ..., M - .
+
= +
= =
Numerical Computation Dependency
7/28/2019 5blk
73/90
Math6911, S08, HM ZHU
x
x
x
x
t
S
it
jS
Smax=MS
T=N t00
(i-1)t
(j+1)S
(j-1)S
(i+1)t
x
x
x
x
Implementation
Equation (5 5) can be rewritten in matrix form:
7/28/2019 5blk
74/90
( ) ( )
1 2 1
1 2 3 1
1 0 10 1 1
1 2
1
0
Equation (5.5) can be rewritten in matrix form:
where and are ( ) dimensional vectors
and and are (
i i
i i
Ti i , i , i , i ,M
T
i , i , M i ,M i ,M
M
f , f , f , f ,
f f , , f f
M
+
+ +
= +
=
= + +
M f M f b
f b
f
b
M M
1 1
2 2 2
1 3
2
1 1
1 1
1 0 0
1 00
0 0 1
) ( ) symmetric matrices
M
M M
M
=
M
Implementation
7/28/2019 5blk
75/90
75
Math6911, S08, HM ZHU
p
1 1
2 2 2
2 3
2
1 1
and1 0 0
1 0
0
0 0 1
M
M M
+ +
=
+
M
Example
7/28/2019 5blk
76/90
76
Math6911, S08, HM ZHU
We compare Crank-Nicolson Methods for a European putwith the exact Black-Scholes formula, where T = 5/12 yr,S0=$50, K = $50, =30%, r = 10%.
Black-Scholes Price: $2.8446
CN Method with Smax=$100, S=2, t=5/1200: $2.8241
CN Method with Smax=$100, S=1, t=5/4800: $2.8395
Example (Stability)
7/28/2019 5blk
77/90
77
Math6911, S08, HM ZHU
We compare Crank-Nicolson Method for a European put with
the exact Black-Scholes formula, where T = 5/12 yr, S0=$50,K = $50, =30%, r = 10%.
Black-Scholes Price: $2.8446
CN Method with Smax=$100, S=1.5, t=5/1200: $3.1370
CN Method with Smax=$100, S=1, t=5/1200: $2.8395
Example: Barrier Options
7/28/2019 5blk
78/90
78
Math6911, S08, HM ZHU
Barrier options are options where the payoff depends on whether
the underlying assets price reaches a certain level during a certainperiod of time.
Types:
knock-out: option ceases to exist when the asset price reaches a barrier
Knock-in: option comes into existence when the asset price reaches a barrier
Example: Barrier Option
7/28/2019 5blk
79/90
79
Math6911, S08, HM ZHU
We compare Crank-Nicolson Method for a European down-
and-out put, where T = 5/12 yr, S0=$50, K = $50, Sb=$50=40%, r = 10%.
What are the boundary conditions for S?
Example: Barrier Option
7/28/2019 5blk
80/90
80
Math6911, S08, HM ZHU
We compare Crank-Nicolson Method for a European down-
and-out put, where T = 5/12 yr, S0=$50, K = $50, Sb=$50=40%, r = 10%.
Boundary conditions are
Exact Price (Hall, p533-535): $0.5424
CN Method with Smax=$100, S=0.5, t=1/1200: $0.5414
( ) ( )0 0andmax bf t ,S f t ,S= =
7/28/2019 5blk
81/90
Math6911 S08, HM Zhu
Appendix A.
Matrix Norms
Vector Norms
7/28/2019 5blk
82/90
82
Math6911, S08, HM ZHU
( )
??,?,3].1-4[2example,For
max
normEuclideantheis2p
normadefinetowaysvariousareThere-
anyfor
anyfor
0iff0;anyfor0s.t.numberrealatomappingfunctionaisnormA vector-
matrixaorvectoraoflengththemeasureway toaasserveNorms-
21
1
1
1
n
====
=
++
=
==>
=
vvvv
x
x
yxyxyx
xx
xx0xxxx
ini
pn
i
p
ip
n
x
x
,
ccc
Matrix Norms
nm
7/28/2019 5blk
83/90
( )( ) { }BB
AAA
AA
Ax
AxA
BABABA
AA
0A0A0AA
AA
x
ofeigenvalueanis:max
wherenorm,spectralthe,
maxmax
sup
normsmatrixusedcommonlyVarious-
anyfor
anyfor
iff;anyfor0
s.t.numberrealatomappingfunctionaisnormmatrixaSimilarly,-
2
11111
21
1 1
2
0
nm
kk
T
n
j ijmi
m
i ijnj
m
i
n
j
ijF
p
p
p
nm
aa
a
,
ccc
++
=
==>
==
= =
An Example
7/28/2019 5blk
84/90
84
Math6911, S08, HM ZHU
????
132
513142
1
2
====
=
FAAAA
A
Basic Properties of Norms
7/28/2019 5blk
85/90
85
Math6911, S08, HM ZHU
.5.4
numberrealaiswhere.3.2
0and;0.1Then.andLet
BABAxAAx
xxyxyx
0xxxyx,BA,
=++
==
nnn
Condition number of a square matrix
7/28/2019 5blk
86/90
86
Math6911, S08, HM ZHU
(n m n
n n
1 2
1 2
1
All norms in are equivalent. That is, if and are norms
on then 0 such that for all we have
: , where A
The
n n
, c ,c ,
c c
C .
>
x
x x x
Condition Number of A Matrix A A
condition number gives a measure of how close a matrix is
close to singular. The bigger the C, the harder it is to solve .Ax=b
Convergence
7/28/2019 5blk
87/90
87
Math6911, S08, HM ZHU
- vectors xk
converges to x xk
x converges to 0
- matrix A
k
0 Ak
0 0
7/28/2019 5blk
88/90
Math6911 S08, HM Zhu
Appendix B.
Basic Row Operations
Basic row operations= *
7/28/2019 5blk
89/90
89
Math6911, S08, HM ZHU
Three kinds of basic row operations:
1) Interchange the order of two rows or (equations)
0 1 0
1 0 0
0 0 1
a11 a12 a13
a21 a22 a23
a31 a32 a33
=
a21 a22 a23
a11 a12 a13
a31 a32 a33
Basic row operations = *
7/28/2019 5blk
90/90
90Math6911, S08, HM ZHU
2) Multiply a row by a nonzero constant
3) Add or subtract rows
c 0 0
0 1 0
0 0 1
a11 a12 a13
a21 a22 a23
a31 a32 a33
=
ca11 ca12 ca13
a21 a22 a23
a31 a32 a33
1 0 0
1 1 0
0 0 1
a11 a12 a13
a21 a22 a23
a31 a32 a33
=
a11 a12 a13
a21 a11 a22 a12 a23 a13a31 a32 a33