Sunteți pe pagina 1din 10

Chapter 16

Basic Numerical Methods

This chapter is an elementary introduction to finite difference methods for


the resolution of PDEs and stochastic differential equations. We cover the
explicit and implicit finite difference schemes for the heat equations and the
Black-Scholes PDE, as well as the Euler and Milshtein schemes for stochastic
differential equations.

16.1 Discretized Heat Equation


Consider the heat equation

2
(t, x) =
(t, x)
t
x2

(16.1)

with initial condition


(0, x) = f (x)
on a compact interval [0, T ] [0, X] divided into the grid points
(ti , xj ) = (it, jx),

i = 0, . . . , N,

j = 0, . . . , M,

with t = T /N and x = X/M . Our goal is to solve the heat equation


(16.1) with initial condition (0, x) and lateral boundary conditions (t, 0),
(t, X), via a discrete approximation
((ti , xj ))0iN,

0jM

of the solution to (16.1), by evaluating derivatives using finite differences.

"

N. Privault
Explicit method
Using the forward time difference approximation

(ti+1 , xj ) (ti , xj )
(ti , x) '
t
t
of the time derivative, we discretize (16.1) as
(ti+1 , xj ) (ti , xj )
(ti , xj+1 ) + (ti , xj1 ) 2(ti , xj )
=
t
(x)2
and letting = (t)/(x)2 this yields
(ti+1 , xj ) = (ti , xj+1 ) + (1 2)(ti , xj ) + (ti , xj1 ),
1 j M 1, 1 i N , i.e.

(ti , x0 )

..
i+1 = Ai +
,
.

0
(ti , xM )
with

and

The vector

i = 0, 1, . . . , N 1,

(ti , x1 )

..
i =
,
.
(ti , xM 1 )

1 2
0
1 2

0
1 2

..
..
A = ...
.
.

0
0
0

0
0
0
0
0
0

(ti , x0 )
0
..
.
0
(ti , xM )

i = 0, 1, . . . , N,

..
.

0
0
0
..
.

0
0
0
..
.

0
0
0
..
.

1 2
0

1 2

0
1 2

i = 0, . . . , N,

can be given by the lateral boundary conditions (t, 0) and (t, X).
488
This version: April 25, 2013
http://www.ntu.edu.sg/home/nprivault/indext.html

"

Basic Numerical Methods


Implicit method
Using the backward time difference approximation

(ti , xj ) (ti1 , xj )
(ti , x) '
t
t
of the time derivative, we discretize (16.1) as
(ti , xj ) (ti1 , xj )
(ti , xj+1 ) + (ti , xj1 ) 2(ti , xj )
=
t
(x)2
and letting = (t)/(x)2 we get
(ti1 , xj ) = (ti , xj+1 ) + (1 + 2)(ti , xj ) (ti , xj1 ),
1 j M 1, 1 i N , i.e.

i1

with

= Bi +

(ti , x0 )
0
..
.
0
(ti , xM )

i = 1, 2, . . . , N,

1 + 2
0
0
0
0
1 + 2
0
0
0

0
1 + 2
0
0
0

..
.
.
.
.
.
..
..
..
..
..
..
B= .
.
.

0
0

1
+
2

0
0
0 1 + 2
0
0
0
0
1 + 2

By inversion of the matrix B, i is given in terms of i1 as

(ti , x0 )

..
i = B 1 i1 B 1
i = 1, . . . , N.
,
.

0
(ti , xM )

16.2 Discretized Black-Scholes PDE


Consider the Black-Scholes PDE
"

489
This version: April 25, 2013
http://www.ntu.edu.sg/home/nprivault/indext.html

N. Privault

r(t, x) =

1
2
(t, x) + rx (t, x) + x2 2 2 (t, x),
t
x
2
x

(16.2)

under the terminal condition (T, x) = (x K)+ , resp. (T, x) = (K x)+ ,


for a European call, resp. put, option. The constant volatility coefficient
may also be replaced with a function (x) of the underlying, in the case local
volatility models.
Note that in the solution of the Black-Scholes PDE, time is run backwards
as we start from a terminal condition (T, x) at time T . Thus here the explicit
method uses backward differences while the implicit method uses forward
differences.

Explicit method
Using here the backward time difference approximation
(ti , xj ) (ti1 , xj )

(ti , x) '
t
t
of the time derivative, we discretize (16.2) as
r(ti , xj ) =

(ti , xj+1 ) (ti , xj1 )


(ti , xj ) (ti1 , xj )
+ rxj
t
2x
1
(ti , xj+1 ) + (ti , xj1 ) 2(ti , xj )
+ x2j 2
,
2
(x)2

1 j M 1, 0 i N 1, i.e.
(ti1 , xj ) =

1
t( 2 j 2 rj)(ti , xj1 ) + (1 t( 2 j 2 + r))(ti , xj )
2
1
+ t( 2 j 2 + rj)(ti , xj+1 ),
2

1 j M 1, where the lateral boundary conditions (ti , 0) and (ti , X)


are given by
(ti , x0 ) = 0,

(ti , xM ) = xM Ker(T ti ) ,

0 i N,

for a European call option, and


(ti , x0 ) = Ker(T ti ) ,

(ti , xM ) = 0

0 i N,

for a European put option.

490
This version: April 25, 2013
http://www.ntu.edu.sg/home/nprivault/indext.html

"

Basic Numerical Methods


The explicit finite difference method is known to have a divergent behaviour when time runs backwards, as illustrated in Figure 16.1.
Explicit method

100

50

-50

-100
0

0.1

0.2
0.3
0.4
0.5
time to maturity

0.6

0.7

0.8

0.9

20

40

60

80

100

120

140

160

180

200

strike

Fig. 16.1: Divergence of the explicit finite difference method.

Implicit method
Using the forward time difference approximation

(ti+1 , xj ) (ti , xj )
(ti , x) '
t
t
of the time derivative, we discretize (16.2) as
r(ti , xj ) =

(ti+1 , xj ) (ti , xj )
(ti , xj+1 ) (ti , xj1 )
+ rxj
t
2x
1
(ti , xj+1 ) + (ti , xj1 ) 2(ti , xj )
+ x2j 2
,
2
(x)2

1 j M 1, 0 i N 1, i.e.
1
(ti+1 , xj ) = t( 2 j 2 rj)(ti , xj1 ) + (1 + t( 2 j 2 + r))(ti , xj )
2
1
t( 2 j 2 + rj)(ti , xj+1 ),
2
1 j M 1, i.e.

"

491
This version: April 25, 2013
http://www.ntu.edu.sg/home/nprivault/indext.html

N. Privault
1
2 t

i+1

= Bi +


r 2 (ti , x0 )
0
..
.

0

21 t r(M 1) + 2 (M 1)2 (ti , xM )

i = 0, 1, . . . , N 1, with
Bj,j1 =


1
t rj 2 j 2 ,
2

Bj,j = 1 + 2 j 2 t + rt,

and


1
Bj,j+1 = t rj + 2 j 2 ,
2
for j = 1, . . . , M 1, and B(i, j) = 0 otherwise.
By inversion of the matrix B, i is given in terms of i+1 as


1
2
(ti , x0 )
2 t r

..
i = B 1 i+1 B 1
,
.

0

21 t r(M 1) + 2 (M 1)2 (ti , xM )

i = 0, 1, . . . , N 1, where the boundary conditions (ti , x0 ) and (ti , xM )


can be provided as in the case of the explicit method. Note that for all
j = 1, . . . , M 1 we have
Bj,j1 + Bj,j + Bj,j+1 = 1 + rt,
hence when the terminal condition is a constant (T, x) = c > 0 we get
(ti , x) = c(1 + rt)(N i) = c(1 + rT /N )(N i) ,

i = 0, . . . , N,

hence for all s [0, T ],


(s, x) = lim (t[N s/T ] , x)
N

= c lim (1 + rT /N )(N [N s/T ])


N

= c lim (1 + rT /N )[N (T s)/T ]


N

= c lim (1 + rT /N )(T s)/T


N

= cer(T s) ,

492
This version: April 25, 2013
http://www.ntu.edu.sg/home/nprivault/indext.html

"

Basic Numerical Methods


as expected, where [x] denotes the integer part of x R. The implicit finite
difference method is known to be more stable than the explicit method, as
illustrated in Figure 16.2, in which the discretization parameters have been
taken to be the same as in Figure 16.1.
Implicit method

140
120
100
80
60
40
20
0

time to maturity

10

20

40

60

80

100

120

140

160

180

200

strike

Fig. 16.2: Stability of the implicit finite difference method.

16.3 Euler Discretization


In order to apply the Monte Carlo method in option pricing, we need to
1, . . . , X
N } of sample values of a random variable X,
generate a sequence {X
such that the empirical mean
IE[(X)] '

1 ) + + (X
N )
(X
N

can be used according to the strong law of large number for the evaluation of
the expected value IE[(X)]. Despite its apparent simplicity, the Monte Carlo
method can be delicate to implement and the optimization of Monte Carlo
algorithms and random number generation have been the object of numerous
works which are outside the scope of this text, cf. e.g. [43], [69].
Random samples for the solution of a stochastic differential equation of
the form
dXt = b(Xt )dt + a(Xt )dWt
(16.3)
can be generated by discretization. More precisely, the Euler discretization
scheme for the stochastic differential equation (16.3) is given by
tN = X
tN +
X
k+1
k
'
"

N
X
tk

w tk+1
tk

b(Xs )ds +

tN )(tk+1
b(X
k

w tk+1
tk

a(Xs )dWs

tN )(Wt
tk ) + a(X
Wtk ).
k+1
k
493

This version: April 25, 2013


http://www.ntu.edu.sg/home/nprivault/indext.html

N. Privault
In particular, when Xt is the geometric Brownian motion given by
dXt = rXt dt + Xt dWt
we get
N = X
N + rX
N (tk+1 tk ) + X
N (Wt
X
Wtk ),
tk+1
tk
tk
tk
k+1
which can be computed as
tN = X
tN
X
0
k

k
Y


1 + r(ti ti1 ) + (Wti Wti1 ) .

i=1

16.4 Milshtein Discretization


In the Milshtein scheme we expand a(Xs ) as
a(Xs ) ' a(Xtk ) + a0 (Xtk )b(Xtk )(s tk ) + a0 (Xtk )a(Xtk )(Ws Wtk ).
As a consequence we get
tN = X
tN +
X
k+1
k
tN +
'X
k

w tk+1
tk
w tk+1

b(Xs )ds +

w tk+1
tk

a(Xs )dWs

b(Xs )ds + a(Xtk )(Wtk+1 Wtk )


w tk+1
+a0 (Xtk )b(Xtk )
(s tk )dWs
tk
w tk+1
0
+a (Xtk )a(Xtk )
(Ws Wtk )dWs
tk
w tk+1
tN +
'X
b(Xs )ds + a(Xtk )(Wtk+1 Wtk )
k
tk
w tk+1
+a0 (Xtk )a(Xtk )
(Ws Wtk )dWs .
tk

tk

Next, using Itos formula we note that


w tk+1
w tk+1
(Wtk+1 Wtk )2 = 2
(Ws Wtk )dWs +
ds,
tk

tk

hence
w tk+1
tk

(Ws Wtk )dWs =

1
((Wtk+1 Wtk )2 (tk+1 tk )),
2

and
tN ' X
tN +
X
k+1
k

w tk+1
tk

b(Xs )ds + a(Xtk )(Wtk+1 Wtk )

494
This version: April 25, 2013
http://www.ntu.edu.sg/home/nprivault/indext.html

"

Basic Numerical Methods


1
+ a0 (Xtk )a(Xtk )((Wtk+1 Wtk )2 (tk+1 tk ))
2
tN + b(Xt )(tk+1 tk ) + a(Xt )(Wt
'X
W tk )
k
k
k+1
k
1 0
2
+ a (Xtk )a(Xtk )((Wtk+1 Wtk ) (tk+1 tk )).
2
As a consequence the Milshtein scheme is written as
N ' X
N + b(X
N )(tk+1 tk ) + a(X
N )(Wt
X
W tk )
tk+1
tk
tk
tk
k+1
1 0 N
tN )((Wt
Wtk )2 (tk+1 tk )),
+ a (Xtk )a(X
k+1
k
2
i.e. in the Milshtein scheme we take into account the small difference
(Wtk+1 Wtk )2 (tk+1 tk )
existing between (Wt )2 and t. Taking (Wt )2 equal to t brings us back
to the Euler scheme.
When Xt is the geometric Brownian motion given by
dXt = rXt dt + Xt dWt
we get
tN (Wt Wt )2 ,
tN = X
tN +(r 2 /2)X
tN (tk+1 tk )+ X
tN (Wt Wt )+ 1 2 X
X
k+1
k
k+1
k
k
k+1
k
k
k
2
which can be computed as
tN
tN = X
X
0
k

k 
Y
i=1

"


1
1 + (r 2 /2)(ti ti1 ) + (Wti Wti1 ) + 2 (Wti Wti1 )2 .
2

495
This version: April 25, 2013
http://www.ntu.edu.sg/home/nprivault/indext.html

S-ar putea să vă placă și