+ All Categories
Home > Documents > Numerical Solutions to PDEs and Option Pricingyzhang/Dissertation_Ying... · 2019-10-09 ·...

Numerical Solutions to PDEs and Option Pricingyzhang/Dissertation_Ying... · 2019-10-09 ·...

Date post: 19-Mar-2020
Category:
Upload: others
View: 5 times
Download: 0 times
Share this document with a friend
44
Transcript
Page 1: Numerical Solutions to PDEs and Option Pricingyzhang/Dissertation_Ying... · 2019-10-09 · University of Edinburgh School of Mathemtics 2014-15 Numerical Solutions to PDEs and Option

University of EdinburghSchool of Mathemtics

2014-15

Numerical Solutions to PDEs and

Option Pricing

Ying ZhangB068867

MATH11013 Dissertation (Fin. Math.)

A thesis submitted in partial ful�llment of the MSc in

Financial Mathematics

August 2015

Supervisor:

Prof. István Gyöngy

Page 2: Numerical Solutions to PDEs and Option Pricingyzhang/Dissertation_Ying... · 2019-10-09 · University of Edinburgh School of Mathemtics 2014-15 Numerical Solutions to PDEs and Option

1

Abstract

This project is to use the �nite di�erent method to solve option pricing problems.

The relationship between SDEs and PDEs will be investigated and the log transforma-

tion is applied to PDE problems. For spatial and fully discretized schemes, the in�nite

systems of ODEs and equations are truncated so that the numerical method can be

implemented, and the truncation error will be discussed. Numerical solutions for Eu-

ropean put and call options will be obtained using spatial and fully �nite di�erence

methods. Moreover, the accuracy of the solutions will be tested for various mesh size

and time steps. The properties of the fully discretized scheme will also be studied.

Finally, there will be other European type options considered as the applications of the

�nite di�erence methods.

Acknowledgements

Thanks for the help of my supervisor Professor István Gyöngy who give me very

useful suggestions for the project. I would also like to thank Dr. David �Si�ska who

helped me in programming problems.

Page 3: Numerical Solutions to PDEs and Option Pricingyzhang/Dissertation_Ying... · 2019-10-09 · University of Edinburgh School of Mathemtics 2014-15 Numerical Solutions to PDEs and Option

CONTENTS 2

Contents

1 Introduction 3

2 Relationship between SDEs and PDEs 5

3 Log Transofrmation 10

4 Truncation Error 11

5 Spatial �nite di�erence scheme 15

5.1 Spatial �nite di�erence scheme for the European put option . . . . . . . . . 15

5.2 Spatial �nite di�erence scheme under log transformation . . . . . . . . . . . 17

6 Fully discretized scheme 20

6.1 The implicit �nite di�erence scheme . . . . . . . . . . . . . . . . . . . . . . . 20

6.2 Implicit �nite di�erence scheme under log transformation . . . . . . . . . . . 22

6.3 The explicit �nite di�erence scheme . . . . . . . . . . . . . . . . . . . . . . . 24

6.4 The Crank-Nicolson method . . . . . . . . . . . . . . . . . . . . . . . . . . . 25

7 Consistency, Stability and Convergence 26

7.1 Consistency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27

7.2 Stability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28

7.2.1 Von Neumann analysis for the explicit scheme . . . . . . . . . . . . . 28

7.2.2 Von Neumann analysis for the implicit scheme . . . . . . . . . . . . . 29

7.2.3 Von Neumann analysis for the Crank-Nicolson method . . . . . . . . 29

7.3 Convergence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30

7.3.1 The order of accuracy for the implicit scheme . . . . . . . . . . . . . 31

7.3.2 The order of accuracy for the Crank-Nicolson method . . . . . . . . . 31

8 Apply the numerical scheme to other options 33

8.1 European options with more general payo� functions . . . . . . . . . . . . . 33

8.2 European style barrier options . . . . . . . . . . . . . . . . . . . . . . . . . . 33

9 Conclusion 34

References 35

Appendix 37

Page 4: Numerical Solutions to PDEs and Option Pricingyzhang/Dissertation_Ying... · 2019-10-09 · University of Edinburgh School of Mathemtics 2014-15 Numerical Solutions to PDEs and Option

1 INTRODUCTION 3

1 Introduction

In the Black-Scholes market, there are riskless assets and risky assets. The price of a riskless

asset at time t, which is denoted by Bt, follows the stochastic di�erential equation (SDE)

dBt = rBtdt, B0 = 1, Bt = ert,

where r is the risk-free rate and r > 0. As for the price of a risky asset at time t, the process

(St)t∈[0,T ] can be de�ned as follows

dSt = µStdt+ σStdWt, S0 > 0,

where µ∈(−∞,∞), σ > 0, µ and σ are constants, S0 is the spot price and (Wt)t≥0 is a Wiener

process. Then

St = S0eσWt+(µ− 1

2σ2)t, t≥0.

An option is a �nancial contract that o�ers the owner the right, but not the obligation, to

buy or sell the underlying instrument at a certain strike price on a speci�c date or during

a certain period of time. For an European call option, the buyer has the right to buy an

underlying asset S at the strike price K on the exercise date T . From an option buyer's

point of view, the payo� h is

h := max(ST −K, 0),

where ST is the underlying share price at maturity. Since there may be potential gains from

holding the options, premiums need to be charged so that there is no arbitrage opportunity

in the market. In order to determine the premium (fair price) of the option, the concept of

the trading strategy needs to be introduced. (ψt, φt)t∈[0,T ] is called a trading strategy, where

ψt is the amount of the riskless asset (bonds) and φt is the amount of the risky asset in a

portfolio at time t. (ψt)t∈[0,T ] and (φt)t∈[0,T ] are stochastic processes such that Vt, the value

of the portfolio at time t can be de�ned in the following way:

ψtBt + φtSt =: Vt(ψ, φ).

A self-�nancing strategy (ψt, φt)t∈[0,T ] is a trading strategy, such that

dVt(ψ, φ) = ψtdBt + φtdSt, t ∈ [0, T ].

This means that for a self-�nancing portfolio, the losses or gains of the portfolio solely come

from the changes in the value of the assets in the portfolio. Furthermore, a self-�nancing

strategy (ψt, φt)t∈[0,T ] with Vt(ψ, φ) ≥ 0, t ∈ [0, T ] is an admissible strategy. In addition, for

a European type option with payo� h, a hedging strategy is the strategy (ψ, φ) such that

VT (ψ, φ) ≥ h. Consequently, the fair price for the European type option at time zero is

inf{V0(ψ, φ) : VT (ψ, φ) ≥ h, (ψ, φ) hedging strategies}.

Besides, the price of a European type option can also be calculated using the following

theorem [5].

Theorem 1. (Main Theorem on Pricing European Type Options) For a European type option

with payo� h at time T . Assume h is a non-negative FT measurable random variable such

Page 5: Numerical Solutions to PDEs and Option Pricingyzhang/Dissertation_Ying... · 2019-10-09 · University of Edinburgh School of Mathemtics 2014-15 Numerical Solutions to PDEs and Option

1 INTRODUCTION 4

that EQh2 <∞, where Q is the �risk- neutral� measure. Then there is a replicating strategy

(ψ, φ), and the price of the option at time t is Vt(ψ, φ), which can be calculated using the

formula

Vt(ψ, φ) = e−r(T−t)EQ(h|FT ).

At time zero, it equals to

V0 = e−rTE(g(XT )),

where g(x) = max(x − K, 0) is the payo� function for the European call option and XT

satis�es the stochastic di�erential equation SDE

dXt = rXtdt+ σXtdWt, X0 > 0,

and

XT = X0eσWT+(r− 1

2σ2)T .

With some knowledge of the distribution of logST , the Black-Scholes formula for the Euro-

pean call option can be derived

V0 = S0Φ(d1)−Ke−rTΦ(d2),

where

d1 =ln(S0

K) + (r + 1

2σ2)T

σ√T

, d2 = d1 − σ√T ,

and Φ(·) is the distribution function of the standard normal distribution. Once the variables

in the formula are known, one can calculate the fair price of a European call. As for a

corresponding European put, the option price can be derived by the put-call parity. However,

for options with complicated payo� functions, there are no explicit formulas to calculate their

prices. Numerical methods are therefore employed in this situation to �nd approximations

to the option prices.

In this project, the relationship between SDEs and PDEs is investigated. Then, the log

transformation of PDE problems will be discussed. In order to implement the �nite di�erence

method, the ini�te systems of ODEs and equations need to be truncated to the �nite systems

and the truncation error will be analyzed. Next, spatial �nite di�erence methods will be

applied to the PDE problem to �nd numerical solutions for option pricing problems. As for

the fully discretized methods, explicit scheme, implicit scheme and Crank-Nicolson method

will be studied. The numerical results will be compared with the analytical solution obtained

using Black-Scholes formula. In addition, the accuracy of numerical approximations is tested,

and the consistency, stability and convergence of these schemes will be discussed. Finally,

there will be some other pricing examples for European type options.

Page 6: Numerical Solutions to PDEs and Option Pricingyzhang/Dissertation_Ying... · 2019-10-09 · University of Edinburgh School of Mathemtics 2014-15 Numerical Solutions to PDEs and Option

2 RELATIONSHIP BETWEEN SDES AND PDES 5

2 Relationship between SDEs and PDEs

There are relationships between SDEs and PDEs. Consider a process Xs governed by the

SDE

dXs = a(Xs)ds+ b(Xs)dWs, s ∈ [t, T ], t ∈ [0, T ],

Xt = x, x ∈ R,

where a and b are Lipschitz functions, a = a(x), b = b(x), x ∈ R. (X t,xs )s∈[t,T ] is the solution

of the SDE. The following is the Kolmogorov backward equation

Lu(t, x) = 0

for t ∈ [0, T ], x ∈ R, with the terminal condition

u(T, x) = g(x),

where g is a Lipschitz function and

L :=∂

∂t+ a(x)

∂x+

1

2b2(x)

∂2

∂x2.

Then, a theorem [5] can be introduced.

Theorem 2. Let u(t, x) ∈ C1,2([0, T ] × R) be the solution of the above PDE problem, such

that u is continuous on [0.T ]× R and satis�es the polynomial growth

|u(t, x)| ≤ K(1 + |x|m)

for all t ∈ [0, T ], x ∈ R, where m and K are positive constants. Then

u(t, x) = Eg(X t,xT )

for every t ∈ [0, T ], x ∈ R.

Proof. By Ito's fomula,

du(s,Xs) =∂

∂su(s,Xs)ds+

∂xu(s,Xs)dXs +

1

2

∂2

∂x2u(s,Xs)(dXs)

2,

which can be rewritten as

du(s,Xs) = Lu(s,Xs)ds+ b(Xs)∂

∂xu(s,Xs)dWs.

Then, integrate from t to T

u(T,Xs) = u(t, x) +

ˆ T

t

Lu(s,Xs)ds+

ˆ T

t

b(Xs)∂

∂xu(s,Xs)dWs.

Since Lu(t, x) = 0,

u(T,Xs) = u(t, x) +

ˆ T

t

b(Xs)∂

∂xu(s,Xs)dWs.

Page 7: Numerical Solutions to PDEs and Option Pricingyzhang/Dissertation_Ying... · 2019-10-09 · University of Edinburgh School of Mathemtics 2014-15 Numerical Solutions to PDEs and Option

2 RELATIONSHIP BETWEEN SDES AND PDES 6

De�ne a stopping time

τR = inf{w ≥ t :

ˆ w

t

|b(Xs)|2(∂

∂xu(s,Xs))

2ds ≥ R}.

Then

u(T ∧ τR, XT∧τR) = u(t, x) +

ˆ T∧τR

t

b(Xs)∂

∂xu(s,Xs)dWs.

Knowing that E´ T∧τRt

b2(Xs)(∂∂xu(s,Xs))

2ds ≤ R,

Eu(T ∧ τR, X t,xT∧τR) = u(t, x).

Furthermore, since u(t, x) satis�es the polynomial growth condition, one can know that

|u(s ∧ τR, Xs∧τR)| ≤ K(1 + |Xs∧τR |m) ≤ K(1 + sups≤T|Xs|m), ∀s ∈ [t, T ].

By the dominated convergence theorem, as τR →∞,

E limτR→∞

u(T ∧ τR, X t,xT∧τR) = lim

τR→∞Eu(T ∧ τR, X t,x

T∧τR).

Then

E(u(T,X t,xT )) = u(t, x).

Together with u(T, x) = g(x),

Eu(T,X t,xT ) = Eg(X t,x

T ) = u(t, x).

The above discussion illustrates that given an SDE and a PDE problem, the relationship

between the two can be found. Similarlly, consider the SDE

dXs = µ(Xs)ds+ σ(Xs)dWs, s ∈ [t, T ], t ∈ [0, T ]

with the initial condition

Xt = x, x ∈ R,

where µ and σ are Lipschitz functions, µ = µ(x), σ = σ(x), x ∈ R. Let (X t,xs )s∈[t,T ] denote

the unique solution of the SDE, which exists by virtue of Ito's theorem. Meanwhile, consider

a PDE problem

L1q(t, x)− r(x)q(t, x) = 0, t ∈ [0, T ), x ∈ R, (2.1)

with the terminal condition

q(T, x) = G(x), x ∈ R, (2.2)

where G is a Lipschitz function and

L1 :=∂

∂t+ µ(x)

∂x+

1

2σ2(x)

∂2

∂x2.

Notice that q(t, x) is de�ned on [0, T ) × R and is continuous in (t, x) ∈ [0, T ] × R. q(t, x)

also satis�es

|q(t, x)| ≤ K(1 + |x|m)

for all t ∈ [0, T ], x ∈ R, and m,K are positive constants. In addition, if the derivatives of

µ, σ,G and r in x up to second order are continuous in (t, x) ∈ [0, T ] × R and satisfy the

polynomial growth condition, then the derivatives ∂∂tq, ∂

∂xq and ∂2

∂x2q exist and are continuous

in (t, x) ∈ [0, T ]×R (see the book [8]). There is a theorem [4] which can be used to describe

the relationship between the above SDE and PDE.

Page 8: Numerical Solutions to PDEs and Option Pricingyzhang/Dissertation_Ying... · 2019-10-09 · University of Edinburgh School of Mathemtics 2014-15 Numerical Solutions to PDEs and Option

2 RELATIONSHIP BETWEEN SDES AND PDES 7

Theorem 3. Assume (2.1)-(2.2) has a solution q ∈ C1,2([0, T ) × R) that is continuous in

(t, x) ∈ [0, T ]× R and satis�es the polynomial growth condition. Then

q(t, x) = E(λt,xT G(X t,xT ))

for every t ∈ [0, T ], x ∈ R, where the discount process λt,x = (λt,xs )s∈[t,T ] is de�ned as

λt,xs = e−´ st r(X

t,xu )du, s ∈ [t, T ]

for a non-negative Lipschitz function r = r(x).

Proof. The proof is similar to the previous one. First apply Ito's formula to q(s, x) and

λsq(s, x), one can get

dq(s,Xs) =∂

∂sq(s,Xs)ds+

∂xq(s,Xs)dXs +

1

2

∂2

∂x2q(s,Xs)(dXs)

2,

and

d(λsq(s,Xs)) = λsdq(s,Xs)− r(Xs)λsq(s,Xs)ds.

After some arrangement, the second equation can be simpli�ed as

d(λsq(s,Xs)) = λs(L1q(s,Xs)− r(Xs)q(s,Xs))ds+ λsσ(Xs)∂

∂xq(s,Xs)dWs.

Notice that

L1q(s,Xs)− r(Xs)q(s,Xs) = 0.

Then, integrate the simpli�ed equation from t to s, the equation becomes

λsq(s,Xs) = q(t, x) +´ stλuσ(Xu)

∂∂xq(u,Xu)dWu, s ∈ [0, T ).

Next, de�ne

τM = inf{w ≥ t :

ˆ w

t

|σ(Xu)|2|(λu)2(∂

∂xq(u,Xu))

2du ≥M}.

Then,

λs∧τM q(s ∧ τM , Xs∧τM ) = q(t, x) +

ˆ s∧τM

t

λuσ(Xu)∂

∂xq(u,Xu)dWu.

By taking the expectations of both sides

E(λt,xs∧τM q(s ∧ τM , Xt,xs∧τM )) = q(t, x),

since E´ s∧τMt

|σ(Xu)|2|(λu)2( ∂∂xq(u,Xu))

2du ≤M and E´ s∧τMt

λuσ(Xu)∂∂xq(u,Xu)dWu = 0.

Meanwhile, by the polynomial growth and the fact that λs∧τM ≤ 1,

|λs∧τM q(s ∧ τM , Xs∧τM )| ≤ |q(s ∧ τM , Xs∧τM )| ≤ K(1 + sups≤T|Xs|m)

for all s ∈ [0, T ). Finally, using the dominated convergence theorem, as M →∞,

E limτM→∞

(λt,xs∧τM q(s ∧ τM , Xt,xs∧τM )) = lim

τM→∞E(λt,xs∧τM q(s ∧ τM , X

t,xs∧τM )).

Page 9: Numerical Solutions to PDEs and Option Pricingyzhang/Dissertation_Ying... · 2019-10-09 · University of Edinburgh School of Mathemtics 2014-15 Numerical Solutions to PDEs and Option

2 RELATIONSHIP BETWEEN SDES AND PDES 8

Then,

E(λt,xs q(s,Xt,xs )) = q(t, x),

and as s→ T ,

E(λt,xT q(T,Xt,xT )) = q(t, x).

Take into consideration the terminal condition of the PDE problem,

E(λt,xT G(X t,xT )) = q(t, x).

Furthermore, consider an SDE

dXu = µ(Xu)du+ σ(Xu)dWu

with the initial condition

X0 = x.

Denote by (Xxs )s∈[0,T ] the solution of the SDE. The probability distribution of (Xx

u)u∈[0,T−t]

should be the same as the distribution of (X t,xt+u)u∈[0,T−t]. Then,

E(λt,xT G(X t,xT )) = E(λxT−tG(Xx

T−t)) = q(t, x),

where

λxs = e−´ s0 r(X

xu)du, s ≥ 0 .

Next, let (X t,xs )s∈[t,T ] be the solution of the SDE

dXs = rXsds+ σXsdWs,

where σ is a constant and r > 0, with the initial condition

Xt = x, x ∈ R.

Consider the PDE problem

∂tv(t, x) + rx

∂xv(t, x) +

1

2σ2x2 ∂

2

∂x2v(t, x)− rv(t, x) = 0 (2.3)

for t ∈ [0, T ), x ∈ R, with the terminal condition

v(T, x) = g(x), x ∈ R. (2.4)

v ∈ C1,2([0, T ) × R) is the solution, which is continuous on [0, T ] × R and satis�es the

polynomial growth. Then by the theorem 3,

v(t, x) = E(λt,xT g(X t,xT )),

where the discount process (λt,xs )s∈[t,T ] is de�ned as

λt,xs = e−r(s−t),

and

X t,xT = xe(r− 1

2σ2)(T−t)+σ(WT−Wt).

Page 10: Numerical Solutions to PDEs and Option Pricingyzhang/Dissertation_Ying... · 2019-10-09 · University of Edinburgh School of Mathemtics 2014-15 Numerical Solutions to PDEs and Option

2 RELATIONSHIP BETWEEN SDES AND PDES 9

In addition, if (Xxr )r∈[0,T−t] satis�es

dXs = rXsds+ σXsdWs, X0 = x,

it is mentioned that the probability distribution of XxT−t should be the same as X t,x

T . Thus,

v(t, x) = E(λt,xT g(X t,xT )) = E(λxT−tg(Xx

T−t)),

where λxT−t = e−r(T−t).

In this section, the relationship between SDEs and PDEs is studied. For options without

an explicit formula to calculate its price, one can instead consider solving a PDE problem

by applying numerical methods to obtain approximations of option prices.

Page 11: Numerical Solutions to PDEs and Option Pricingyzhang/Dissertation_Ying... · 2019-10-09 · University of Edinburgh School of Mathemtics 2014-15 Numerical Solutions to PDEs and Option

3 LOG TRANSOFRMATION 10

3 Log Transofrmation

Denote by v the solution of the PDE problem

∂tv(t, y) + ry

∂yv(t, y) +

1

2σ2y2 ∂

2

∂y2v(t, y)− rv(t, y) = 0 (3.1)

for t ∈ [0, T ), y ∈ R, with the terminal condition

v(T, y) = g(y), y ∈ R. (3.2)

De�ne v(t, ex) = p(t, x), and let x = ln y for y > 0. Then,

∂tv(t, y) =

∂tp(t, ln y), (3.3)

∂yv(t, y) = y−1 ∂

∂xp(t, ln y), (3.4)

∂2

∂y2v(t, y) = −y−2 ∂

∂xp(t, ln y) + y−2 ∂

2

∂x2p(t, ln y). (3.5)

Substitute (3.3)-(3.5) into the PDE (3.1) and let x = ln y, the PDE becomes

∂tp(t, x) + r

∂xp(t, x) +

1

2σ2(− ∂

∂xp(t, x) +

∂2

∂x2p(t, x))− rp(t, x) = 0.

After the arrangements,

∂tp(t, x) + b

∂xp(t, x) + a

∂2

∂x2p(t, x)− rp(t, x) = 0 (3.6)

for t ∈ [0, T ), x ∈ R, with the terminal condition

p(T, x) = g(ex), (3.7)

where

a := 12σ2, b := (r − 1

2σ2) .

According to theorem 3, with the log transformation, the function p can be given by

p(t, x) = E(e−r(T−t)g(eYt,xT )),

where (Y t,xs )s∈[t,T ] is the solution of the SDE

dYs = bds+ σdWs

with the initial condition Yt = x. Thus,

Y t,xT = x+ b(T − t) + σ(WT −Wt).

For (Y xr )r∈[0,T−t] satisfying the SDE

dYs = bds+ σdWs, Y0 = x,

the probability distribution of Y t,xT and Y x

T−t are the same. Therefore,

Y xT−t = x+ b(T − t) + σWT−t,

and

p(t, x) = E(e−r(T−t)g(eYxT−t)).

Page 12: Numerical Solutions to PDEs and Option Pricingyzhang/Dissertation_Ying... · 2019-10-09 · University of Edinburgh School of Mathemtics 2014-15 Numerical Solutions to PDEs and Option

4 TRUNCATION ERROR 11

4 Truncation Error

The spatial discretized scheme for PDE (3.6)-(3.7) is as follows:

∂tph(t, xi) + bδhph(t, xi) + aδ−hδhph(t, xi)− rph(t, xi) = 0

with the terminal condition

ph(T, xi) = g(exi),

where xi = ih for i = 0,±1,±2, . . . and for h 6= 0,

δhph(t, xi) =1

h(ph(t, xi+1)− ph(t, xi)),

δ−hδhph(t, xi) =1

h2(ph(t, xi+1)− 2ph(t, xi) + ph(t, xi−1)).

To solve the system of ODEs numerically, the in�nite system should be truncated to a �nite

one. This means that for su�ciently large N , ph(t, xi+1) = 0 for |i| ≥ N , which results in

the truncation error.

The truncation function XR(x) is a su�ciently smooth nonnegative even function on Rsuch that

XR(x) =

{1, |x| ≤ R,

0, |x| ≥ R + 1,

and for R ≤ x ≤ R + 1, de�ne XR(x) = −x+R + 1. Then consider the PDE problem:

LRpR(t, x)− rR(x)pR(t, x) = 0, (t, x) ∈ [0, T )× R,

pR(T, x) = gR(ex), x ∈ R,

where

LR =∂

∂t+ bR(x)

∂x+ aR(x)

∂2

∂x2

with

rR(x) = rXR(x), gR(ex) = g(ex)XR(x),

and

aR(x) = aXR(x) = 12σ2XR(x), bR(x) = bXR(x) = (r − 1

2σ2)XR(x).

Let pR(t, x) ∈ C1,2([0, T )× R) be the solution of the PDE problem above, and satis�es the

polynomial growth condition. Then by the theorem 3,

pR(t, x) = E(φxT−tgR(eZxT−t)),

where

φxT−t = e´ T−t0 rR(Zxr )dr,

and (Zxs )s∈[0,T−t] is the solution of the SDE

dYs = bR(Ys)ds+ σR(Ys)dWs, s ∈ [0, T − t]

with the initial condition

Y0 = x,

Page 13: Numerical Solutions to PDEs and Option Pricingyzhang/Dissertation_Ying... · 2019-10-09 · University of Edinburgh School of Mathemtics 2014-15 Numerical Solutions to PDEs and Option

4 TRUNCATION ERROR 12

where σR(x) = σXR(x). The truncation error can be estimated by considering

maxt∈[0,T ]

maxx∈[−Rv ,Rv ]

|p(t, x)− pR(t, x)|,

where Rv = vR, for v ∈ (0, 1). Then,

|p(t, x)− pR(t, x)| = |E(λxT−tg(eYxT−t))− E(φxT−tgR(eZ

xT−t))|.

De�ne a stopping time

τx := inf{s ∈ [0, T ] : |Y xs | ≥ R},

and for τx > T ,

|p(t, x)− pR(t, x)| = 0.

Then,

|p(t, x)− pR(t, x)| = |E{1τx≤T (λxT−tg(eYxT−t)− φxT−tgR(eZ

xT−t))}|.

Since λxs ≤ 1 and φxs ≤ 1,

|p(t, x)− pR(t, x)| ≤ |E(1τx≤Tg(eYxT−t))|+ |E(1τx≤TgR(eZ

xT−t))|,

and by Cauchy-Schwarz inequality,

|p(t, x)− pR(t, x)| ≤ P (τx ≤ T )12{(E|g(eY

xT−t)|2)

12 + (E|gR(eZ

xT−t)|2)

12}.

For |x| ≤ Rv,

E|g(eYxT−t)|2 ≤ E(K2(1 + emY

xT−t)2) ≤ 2K2(1 + Ee2mY xT−t).

Notice that

Y xT−t = x+ b(T − t) + σWT−t,

then

E|g(eYxT−t)|2 ≤ 2K2(1 + Ee2m(x+b(T−t)+σWT−t))

≤ 2K2(1 + e2m(x+b(T−t))e2m2σ2(T−t))

≤ 2K2(1 + e2m(vR+|b|T )+2m2σ2T ).

Meanwhile, for the term E|gR(eZxT−t)|2, since |x| ≤ Rv,

E|gR(ex)|2 ≤ 2K2(1 + Ee2mx) ≤ 2K2(1 + e2mvR).

As for P (τx ≤ T ),

P (τx ≤ T ) = P ( sup0≤s≤T

|Y xs | ≥ R)

= P ( sup0≤s≤T

|x+ bs+ σWs| ≥ R)

≤ P ( sup0≤s≤T

|bs+ σWs| ≥ R− vR)

= P ( sup0≤s≤T

|βs+Ws| ≥ α),

where

β := bσ, α := (1−v)R

σ.

Page 14: Numerical Solutions to PDEs and Option Pricingyzhang/Dissertation_Ying... · 2019-10-09 · University of Edinburgh School of Mathemtics 2014-15 Numerical Solutions to PDEs and Option

4 TRUNCATION ERROR 13

Since the Wiener process (Ws)s∈[0,T ] follows the normal distribution,

P (τx ≤ T ) = P ( sup0≤s≤T

|βs+Ws| ≥ α)

= P ( sup0≤s≤T

(Ws + βs) ≥ α) + P ( sup0≤s≤T

(Ws − βs) ≥ α).

To calculate P (sup0≤s≤T (Ws + βs) ≥ α), denote by Ws = Ws + βs. Then de�ne

γ :=dQ

dP,

where γ = exp(−12β2T − βWT ). By Girsanov theorem,

P ( sup0≤s≤T

(Ws + βs) ≥ α) = EP (1sup0≤s≤T (Ws+βs)≥α)

= EQ(1sup0≤s≤T Ws≥αexp(−1

2β2T + βWT ))

= EP (1sup0≤s≤T Ws≥αexp(−1

2β2T + βWT )).

Denote by MT := sup0≤s≤T Ws, Bx := [MT ≥ α,WT ≤ x], then by re�ection principle:

P (Bx) =

{P (WT ≥ 2α− x), x < α,

2P (WT ≥ α)− P (WT ≥ x), x ≥ α,

and

P (Bx) =´ x−∞ h(y)dy, ∀x ∈ (−∞,∞),

where

h(x) =∂

∂xP (Bx) =

1√2πT

e−(2α−x)2

2T , x < α,

1√2πT

e−x2

2T , x ≥ α.

Therefore, for every β > 0 and α > 0,

EP (1MT≥αe− 1

2β2T+βWT ) =

ˆ ∞−∞

h(x)e−12β2T+βxdx

=1√2πT

e−12β2T (

ˆ α

−∞eβxe−

(2α−x)22T dx+

ˆ ∞α

eβxe−x2

2T dx)

=1√2πT

e−12β2T

ˆ ∞α

(eβ(2α−x) + eβx)e−x2

2T dx.

Then,

P ( sup0≤s≤T

(Ws + βs) ≥ α) =1√2πT

e−12β2T

ˆ ∞α

(eβ(2α−x) + eβx)e−x2

2T dx

≤ 1√2πT

e−12β2T

ˆ ∞α

2e2|β|αe|β|xe−x2

6T− x

2

3T dx

≤ Ce2|β|αˆ ∞α

e−x2

3T dx

≤ Ce2|β|αˆ ∞α

x

αe−

x2

3T dx

= Ce2|β|α · 3T

αe−

α2

3T

≤ C1e−α

2

4T ,

Page 15: Numerical Solutions to PDEs and Option Pricingyzhang/Dissertation_Ying... · 2019-10-09 · University of Edinburgh School of Mathemtics 2014-15 Numerical Solutions to PDEs and Option

4 TRUNCATION ERROR 14

where C and C1 are constants depending on b, σ and T . As for P (sup0≤s≤T (Ws − βs) ≥ α),

the result is the same. This can be shown by denoting

W ∗s = Ws − βs.

According to Girsanov theorem, de�ne

γ1 :=dQ∗

dP,

where γ1 = exp(−12β2T − βWT ), then

P ( sup0≤s≤T

(Ws − βs) ≥ α) = EP (1sup0≤s≤T (Ws−βs)≥α)

= EQ∗(1sup0≤s≤T W∗s ≥αexp(−

1

2β2T + βW ∗

T ))

= EP (1sup0≤s≤T Ws≥αexp(−1

2β2T + βWT ))

= P ( sup0≤s≤T

(Ws + βs) ≥ α).

Therefore,

P (τx ≤ T ) ≤ 2C1e−α

2

4T .

Finally,

|p(t, x)− pR(t, x)| ≤ P (τx ≤ T )12{(E|g(eY

xT−t)|2)

12 + (E|gR(eZ

xT−t)|2)

12 }

≤ (2C1e−α

2

4T )12{(2K2(1 + e2m(vR+|b|T )+2m2σ2T ))

12 + (2K2(1 + e2mvR))

12}

≤ C2e−C3R2

,

and

supt∈[0,T ]

supx∈[−Rv ,Rv ]

|p(t, x)− pR(t, x)| ≤ C2e−C3R2

,

where C2 is a positive constant depending on b, σ, T,m and K, and C3 is also a constant

depending on v, σ and T . The localisation error for a more complicated option pricing

problem, for example, the American put option, is discussed in [20].

Page 16: Numerical Solutions to PDEs and Option Pricingyzhang/Dissertation_Ying... · 2019-10-09 · University of Edinburgh School of Mathemtics 2014-15 Numerical Solutions to PDEs and Option

5 SPATIAL FINITE DIFFERENCE SCHEME 15

5 Spatial �nite di�erence scheme

In order to illustrate the numerical procedures of the �nite di�erence methods, consider an

European put option as an example. S0 is the initial underlying share price of the option,

denote by K and T its strike price and maturity. Then consider the Black-Scholes PDE (2.3)

with the terminal condition

v(T, x) = g(x) = max(K − x, 0), x ≥ 0,

where r is the risk-free rate and v(t, x) is the solution of the PDE problem.

5.1 Spatial �nite di�erence scheme for the European put option

The spatial �nite di�erence scheme for the Black-Scholes PDE and its terminal condition

can be written as

∂tvhR(t, xi) + rxiδhv

hR(t, xi) +

1

2σ2x2

i δ−hδhvhR(t, xi)− rvhR(t, xi) = 0, (5.1)

and

vhR(T, xi) = g(xi) = max(K − xi, 0), (5.2)

where xi = ih, for i = 0, 1, . . . ,M and x = 0, xM = R, then for h 6= 0, by central di�eremce,

δhf(t, xi) =1

2h(f(t, xi+1)− f(t, xi−1)), (5.3)

and

δ−hδhf(t, xi) =1

h2(f(t, xi+1)− 2f(t, xi) + f(t, xi−1)). (5.4)

This is a system of ODEs with terminal conditions, but MATLAB ode solvers accept ODEs

with initial conditions. Thus one needs to make some adjustments to the ODE system. In

order to replace terminal conditions by initial conditions, T − t will be used instead of t.

Denote by t = T − t, the ODE system (5.1)-(5.2) becomes

− ∂

∂tvhR(t, xi) + rxiδhv

hR(t, xi) +

1

2σ2x2

i δ−hδhvhR(t, xi)− rvhR(t, xi) = 0, (5.5)

vhR(0, xi) = max(K − xi, 0). (5.6)

Let vt,i = vhR(t, xi), after the substituion and simpli�cation, for i = 1, 2, . . . ,M − 1, (5.5) can

be rewritten as∂

∂tvt,i = aivt,i−1 + bivt,i + civt,i+1,

where

ai =1

2σ2i2 − 1

2ri, bi = −(r + σ2i2), ci =

1

2σ2i2 +

1

2ri.

Then in the matrix form:

∂tvt,i =

b1 c1

a2 b2 c2

a3 b3 c3

. . . . . . . . .

aM−2 bM−2 cM−2

aM−1 bM−1

vt,1

vt,2

vt,3...

vt,M−2

vt,M−1

+

a1vt,0

0

0

...

0

cM−1vt,M

,

Page 17: Numerical Solutions to PDEs and Option Pricingyzhang/Dissertation_Ying... · 2019-10-09 · University of Edinburgh School of Mathemtics 2014-15 Numerical Solutions to PDEs and Option

5 SPATIAL FINITE DIFFERENCE SCHEME 16

where vt,0 and vt,M are boundary conditions. vt,0 represents the option price at time t when

the underlying share price is zero. It can be expressed as

vt,0 = vhR(t, x0) = Ke−rt, t ∈ [0, T ].

For vt,M , it is the option price at time t when the share price is very large, In this case, the

option is worthless, hence

vt,M = vhR(t, xM) = 0, t ∈ [0, T ].

Together with the boundary conditions, the matrix can be improved as

∂tvt,i =

−r

a1 b1 c1

a2 b2 c2

a3 b3 c3

. . . . . . . . .

aM−2 bM−2 cM−2

aM−1 bM−1

vt,0

vt,1

vt,2

vt,3...

vt,M−2

vt,M−1

,

since∂

∂tvt,0 = −rvt,0.

x0 20 40 60 80 100 120 140 160 180 200

v(t,x)

0

5

10

15

20

25

30

35

40

45

50

v(T,x)v(0,x)

Figure 1: Graph for European put prices at time 0 and time T

Then, set K = 50, T = 1, r = 0.1, σ = 0.4, R = 200 and M = 200. Figure 1 is a graph for

the option price at time zero and time T . If the current share price S0 = 50, the numerical

result for the option price is 5.3987 which is close to the price 5.4011 calculate using Black-

Scholes formula. Di�erent values for S0 can be set to get corresponding approximated option

prices. Furthermore, to test the accuracy of the spatial �nite di�erence (SFD) scheme, vt,ican be computed for di�erent R. To obtain approximations for di�erent mesh sizes h, it

Page 18: Numerical Solutions to PDEs and Option Pricingyzhang/Dissertation_Ying... · 2019-10-09 · University of Edinburgh School of Mathemtics 2014-15 Numerical Solutions to PDEs and Option

5 SPATIAL FINITE DIFFERENCE SCHEME 17

is equivalent to test for various number of grid points M . Then one can compare these

approximations with results from Black-Scholes (BS) formula.

Table 1 is the accuracy test for di�erent R given di�erent S0, it illustrates that the

accuracy of the numerical results is related to the value of R. For example, when the spot

price is relatively small (S0 = 20), more accurate results are obtained for small values of

R (R = 100), on the contrary, one should choose a relatively large R (R = 200), for large

values of S0 (S0 = 60). Hence, it's important to set suitably large values of R for di�erent

spot prices to improve the accuracy of numerical solutions. In table 2, numerical results are

obtained for di�erent number of grid points M , which imply that small mesh size h(h = RM

)

can result in more accurate approximations.

SFD R = 100 R = 200 R = 400 R = 500 BS

S0 = 20 25.3321 25.3324 25.3337 25.3347 25.3320

S0 = 50 5.3994 5.3987 5.3918 5.3865 5.4011

S0 = 60 2.9091 2.9135 2.9083 2.9044 2.9153

For �xed K = 50, T = 1, r = 0.1, σ = 0.4 and M = 200

Table 1: Accuracy test for di�erent R and S0

SFD M = 150 M = 200 M = 300 M = 400 M = 500 BS

S0 = 20 25.3330 25.3324 25.3321 25.3321 25.3320 25.3320

S0 = 60 2.9157 2.9135 2.9145 2.9148 2.9150 2.9153

S0 = 80 0.8241 0.8226 0.8229 0.8230 0.8231 0.8231

For �xed K = 50, T = 1, r = 0.1, σ = 0.4 and R = 200

Table 2: Accuracy test for di�erent M and S0

5.2 Spatial �nite di�erence scheme under log transformation

If log transformation is applied to PDEs, those PDEs will have constant coe�cients and

in�nite domain, which may improve numerical schemes [12]. Consider the European put

option described above, let p(t, x) = v(t, ex), then the transformed Black-Scholes PDE is

(3.6), with the terminal condition

p(T, x) = g(ex) = max(K − ex, 0), x ∈ R,

and p(t, x) is the solution of the PDE problem. Then the spatial discretization for the

transformed PDE problem is as follows:

∂tph′

R′(t, xi) + bδh′p

h′

R′(t, xi) + aδ−h′δh′p

h′

R′(t, xi)− rph

R′(t, xi) = 0, (5.7)

Page 19: Numerical Solutions to PDEs and Option Pricingyzhang/Dissertation_Ying... · 2019-10-09 · University of Edinburgh School of Mathemtics 2014-15 Numerical Solutions to PDEs and Option

5 SPATIAL FINITE DIFFERENCE SCHEME 18

and

ph′

R′(T, xi) = max(K − exi , 0), (5.8)

where xi = ih′, for i = 0, 1, . . . ,M , then x0 = 0, xM = R

′= lnR and h

′= R

M. For h

′ 6= 0,

δh′ph′

R′(t, xi) and δ−h′δh′p

h′

R′(t, xi) can be expressed using (5.3)-(5.4). Terminal conditions

should again be transformed to initial conditions. Denoted by t = T − t and pt,i = ph′

R′(t, xi),

and after some calculations, the system of ODEs (5.7) can be expressed as

∂tpt,i = apt,i−1 + bpt,i + cpt,i+1

for i = 1, . . . ,M − 1, where

a = σ2

2h′2− 1

2h′(r − σ2

2), b = −(r + σ2

h′2), c = σ2

2h′2+ 1

2h′(r − σ2

2).

The boundary conditions are

pt,0 = ph′

R′(t, x0) = Ke−rt,

pt,M = ph′

R′(t, x0) = 0

for t ∈ [0, T ]. Then in matrix form:

∂tpt,i =

−r

a b c

a b c

a b c

. . . . . . . . .

a b c

a b

pt,0

pt,1

pt,2

pt,3...

pt,M−2

pt,M−1

.

One can use ode15 solver in MATLAB to �nd numerical solutions. These solutions are

the approximations for the European put prices, and can be compared with results from

Black-Scholes formula to check the accuracy of numerical solutions. Let K = 50, T = 1, r =

0.1, σ = 0.4, R′

= 5 and M = 100. For lnS0 = 3, the numerical result is 25.2510, while the

analytical solution is 25.2493. There is a graph for p0,i and pT,i and it should be noticed that

pT,i represents the European put prices at t = 0 since t = T − t. Then, as shown in the table

3 and table 4 below, the accuracy of numerical results is tested for di�erent R′and mesh

size h′. In both tables, the approximations at grid points are of great accuracy.

Page 20: Numerical Solutions to PDEs and Option Pricingyzhang/Dissertation_Ying... · 2019-10-09 · University of Edinburgh School of Mathemtics 2014-15 Numerical Solutions to PDEs and Option

5 SPATIAL FINITE DIFFERENCE SCHEME 19

x0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5

p(t,x)

0

5

10

15

20

25

30

35

40

45

50

p(T,x)p(0,x)

Figure 2: Graph for European put prices at time 0 and time T

SFD R′= 4.8 R

′= 5 R

′= 6 BS

lnS0 = 2.4 34.219103 34.219103 34.219080 34.219149

lnS0 = 3.6 11.681478 11.684037 11.684284 11.683040

lnS0 = 4.2 1.911000 1.913807 1.913800 1.913538

For �xed K = 50, T = 1, r = 0.1, σ = 0.4 and M = 200

Table 3: Accuracy test for di�erent R′and S0

SFD M = 200 M = 250 M = 300 M = 500 BS

lnS0 = 2.4 34.219103 34.219121 34.219130 34.219144 34.219149

lnS0 = 3.6 11.684037 11.683633 11.683275 11.683079 11.683040

lnS0 = 4.2 1.913807 1.913637 1.913421 1.913429 1.9135

For �xed K = 50, T = 1, r = 0.1, σ = 0.4 and R′= 5

Table 4: Accuracy test for di�erent M and S0

Page 21: Numerical Solutions to PDEs and Option Pricingyzhang/Dissertation_Ying... · 2019-10-09 · University of Edinburgh School of Mathemtics 2014-15 Numerical Solutions to PDEs and Option

6 FULLY DISCRETIZED SCHEME 20

6 Fully discretized scheme

For fully discretized scheme, one needs to set up grids with respect to time and space.

Implicit scheme, explicit scheme and Crank-Nicolson method are three ways to deal with

option pricing problems. These schemes will be discussed respectively and the notations

used in this section are the same as described in section 5.

Now, consider a European call option with strike price K and maturity T . The numerical

methods will be applied to the PDE problem (2.3) with the terminal condition

v(T, x) = max(x−K, 0), x ≥ 0. (6.1)

6.1 The implicit �nite di�erence scheme

The fully discretized scheme for the PDE problem (2.3) and (6.1) is as follows:

δτvτ,hR (tj, xi) + rxiδhv

τ,hR (tj, xi) +

1

2σ2x2

i δ−hδhvτ,hR (tj, xi)− rvτ,hR (tj, xi) = 0, (6.2)

vτ,hR (T, xi) = max(xi −K, 0), (6.3)

where tj = jτ , for j = 0, 1, . . . , N , then, t0 = 0, tN = T and τ = TN, and xi = ih for

i = 0, 1, . . . ,M . For τ 6= 0,

δτf(tj, xi) =1

τ(f(tj+1, xi)− f(tj, xi)), (6.4)

and one can use (5.3)-(5.4) as the expressions for δhvτ,hR (tj, xi) and δ−hδhv

τ,hR (tj, xi) at time

tj. Then denote by vj,i = vτ,hR (tj, xi), the simpli�ed equation for (6.2) can be rewritten as

vj+1,i = Aivj,i−1 +Bivj,i + Civj,i+1 (6.5)

for i = 1, 2, . . . ,M − 1 and j = 0, 1, . . . , N − 1, where

Ai = (−12σ2i2 + 1

2ri)τ, Bi = 1 + rτ + σ2i2τ, Ci = −(1

2σ2i2 + 1

2ri)τ.

One can express the system of equations in matrix form as follows to facilitate further

numerical calculations.

vj+1,1

vj+1,2

vj+1,3

...

vj+1,M−2

vj+1,M−1

=

B1 C1

A2 B2 C2

A3 B3 C3

. . . . . . . . .

AM−2 BM−2 CM−2

AM−1 BM−1

vj,1

vj,2

vj,3...

vj,M−2

vj,M−1

+

A1vj,0

0

0

...

0

CM−1vj,M

,

where vj,0 and vj,M are the boundary conditions. vj,0 stands for the option price at time j

when the underlying share price is zero. For a European call option, it's obvious that

vj,0 = 0

Page 22: Numerical Solutions to PDEs and Option Pricingyzhang/Dissertation_Ying... · 2019-10-09 · University of Edinburgh School of Mathemtics 2014-15 Numerical Solutions to PDEs and Option

6 FULLY DISCRETIZED SCHEME 21

x0 10 20 30 40 50 60 70 80 90 100

v(t,x

)

0

5

10

15

20

25

30

35

40

45

p(0,x)p(T,x)

(a) (b)

Figure 3: Graphs for European call prices

for j = 0, 1, . . . , N . As for vj,M , it is the option price at time j when the underlying share

price is very large, then in the numerical scheme it should be equal to:

vj,M = R− e−r(T−jτ)K.

After specifying these conditions, set S0 = 50, K = 60, T = 1, r = 0.05, σ = 0.2, R =

100, N = 100 and M = 100 to check whether the numerical scheme works properly. The

numerical solution obtained is 1.6224, while the result calculated using Black-Scholes formula

gives 1.6237. There are two graphs in �gure 3. Figure 3(a) shows the relationship between

the option prices and the underlying share prices. The blue line is the option payo� at

maturity, while the red line is the numerical approximations of option prices at time zero.

As for the �gure 3(b), it illustrates the European call prices at di�erent time points and

underlying share prices. Then, the accuracy of fully �nite di�erence (FFD) approximations

can be tested for various R, h and τ , which is similar to test the accuracy for di�erent values

of R,M and N . The followings are tables of the results.

FFD R = 100 R = 200 R = 250 R = 400 BS

S0 = 30 0.0016 0.0017 0.0018 0.0021 0.0014

S0 = 40 0.1460 0.1464 0.1468 0.1483 0.1439

S0 = 60 6.2662 6.2631 6.2607 6.2506 6.2704

For �xed K = 60, T = 1, r = 0.05, σ = 0.2, N = 200 and M = 200

Table 5: Accuracy test for di�erent R and S0

Table 5 is the accuracy test for various R. In the numerical scheme, R represents the

in�nity of the underlying share price. It can be noticed that when R is a large value, for

example R = 400, the numerical approximations are less accurate. Thus, one needs to

choose more relevant values of R for di�erent spot prices to make the numerical method

work properly. In the table 6, numerical results are obtained for di�erent mesh size M and

step size N . The table illustrates that as M and N become larger, the approximations of

option prices converge to the analytical results.

Page 23: Numerical Solutions to PDEs and Option Pricingyzhang/Dissertation_Ying... · 2019-10-09 · University of Edinburgh School of Mathemtics 2014-15 Numerical Solutions to PDEs and Option

6 FULLY DISCRETIZED SCHEME 22

FFD M = 100 M = 200 M = 300 M = 400 M = 500

N = 100 0.5842 0.5845 0.5845 0.5846 0.5846

N = 150 0.5828 0.5831 0.5831 0.5831 0.5831

N = 200 0.5821 0.5824 0.5824 0.5824 0.5824

N = 300 0.5814 0.5817 0.5817 0.5817 0.5817

N = 450 0.5809 0.5812 0.5812 0.5813 0.5813

For �xed S0 = 45, K = 60, T = 1, r = 0.05, σ = 0.2 and R = 100.

The result obtained by the Black-Scholes formula is 0.5803

Table 6: Accuracy test for di�erent M and N .

6.2 Implicit �nite di�erence scheme under log transformation

Now apply the fully discretized scheme to the PDE (3.6) and its terminal condition

p(T, x) = max(ex −K, 0) x ∈ R.

Then, the PDE problem becomes

δτpτ,h′

R′(tj, xi) + bδh′p

τ,h′

R′(tj, xi) + aδ−h′δh′p

τ,h′

R′(tj, xi)− rpτ,h

R′(tj, xi) = 0, (6.6)

and

pτ,h′

R′(T, xi) = max(exi −K, 0),

where tj = jτ for j = 0, 1, . . . , N , tN = T and xi = ih′for i = 0, 1, . . . ,M , xM = R

′. For

h′ 6= 0 and τ 6= 0, (6.6) can be simpli�ed by substituting (5.3), (5.4) and (6.4) into it. Denote

by pj,i = pτ,h′

R′(tj, xi), the simpli�ed scheme can be expressed as:

pj+1,i = Apj,i−1 +Bpj,i + Cpj,i+1

for i = 1, 2, . . . ,M − 1 and j = 0, 1, . . . , N − 1, where

A = τ2h′2

(h′(r − 1

2σ2)− σ2), B = 1 + (r + σ2

h′2)τ, C = − τ

2h′2(h′(r − 1

2σ2) + σ2).

Then, rewritte the system of equations in matrix form:

pj+1,1

pj+1,2

pj+1,3

...

pj+1,M−2

pj+1,M−1

=

B C

A B C

A B C

. . . . . . . . .

A B C

A B

pj,1

pj,2

pj,3...

pj,M−2

pj,M−1

+

Apj,0

0

0

...

0

Cpj,M

,

Page 24: Numerical Solutions to PDEs and Option Pricingyzhang/Dissertation_Ying... · 2019-10-09 · University of Edinburgh School of Mathemtics 2014-15 Numerical Solutions to PDEs and Option

6 FULLY DISCRETIZED SCHEME 23

xi

0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5

p(t j,x

i)

0

10

20

30

40

50

60

70

80

90

p(0,xi)

p(T,xi)

(a) (b)

Figure 4: Graphs for European call prices with log transofrmation

where pj,0 and pj,M are boundary conditions with the expressions

pj,0 = 0,

pj,M = eR′− e−r(T−jτ)K

for j = 0, 1, . . . , N .

Let K = 35, T = 1, r = 0.05, σ = 0.2, R′

= 5, N = 200 and M = 200. Consider lnS0 = 3

as an example. The numerical result give 0.0104, while the result from Black-Scholes formula

is 0.0095. The are graphs, �gure 4(a) and 4(b), for the European call prices, and the following

tables are the accuracy test of numerical approximations for various R′,M and N .

In table 7, numerical results for call option prices are obtained for various R′. Table 8

gives numerical approximations for di�erent M and N , which indicates that in order to get

more accurate approximations, one needs to set relatively large values for both M and N .

FFD R′= 4.8 R

′= 5 R

′= 6 BS

lnS0 = 3 0.0103 0.0104 0.0106 0.0095

lnS0 = 3.6 4.7369 4.7377 4.7393 4.7410

lnS0 = 4.2 33.3940 33.3941 33.3942 33.3939

For �xed K = 35, T = 1, r = 0.05, σ = 0.2, N = 200 and M = 200

Table 7: Accuracy test for di�erent R′and S0

Page 25: Numerical Solutions to PDEs and Option Pricingyzhang/Dissertation_Ying... · 2019-10-09 · University of Edinburgh School of Mathemtics 2014-15 Numerical Solutions to PDEs and Option

6 FULLY DISCRETIZED SCHEME 24

FFD M = 200 M = 250 M = 350 M = 450 M = 600

N = 200 4.7377 4.7383 4.7382 4.7382 4.7391

N = 250 4.7380 4.7386 4.7386 4.7386 4.7394

N = 350 4.7385 4.7391 4.7390 4.7390 4.7399

N = 450 4.7387 4.7393 4.7393 4.7393 4.7401

N = 600 4.7389 4.7395 4.7395 4.7395 4.7403

For �xed lnS0 = 3.6, K = 35, T = 1, r = 0.05, σ = 0.2 and R′= 5.

The result obtained by the Black-Scholes formula is 4.7410

Table 8: Accuracy test for di�erent M and N

6.3 The explicit �nite di�erence scheme

Di�erent from the implicit scheme, derivative with respect to time in the explicit scheme is

approximated by a forward di�erence, which means that the expression (6.4) for δτf(tj, xi)

in the equation (6.2) should be replaced by δτf(tj, xi), where

δτf(tj, xi) =1

τ(f(tj, xi)− f(tj−1, xi)). (6.7)

Then the explicit scheme for the Black-Scholes PDE can be written as

vj−1,i = Aivj,i−1 + Bivj,i + Civj,i+1 (6.8)

for i = 1, 2, . . . ,M − 1 and j = 1, . . . , N − 1, N , where

Ai = (12σ2i2 − 1

2ri)τ, Bi = 1− rτ − σ2i2τ, Ci = (1

2σ2i2 + 1

2ri)τ.

Together with the terminal and boundary conditions:

vτ,hR (tj, x0) = 0,

vτ,hR (tj, xM) = R− e−r(T−jτ)K,

vτ,hR (T, xi) = max(xi −K, 0).

Then the scheme can be implemented in MATLAB to approximate option prices. However,

the explicit scheme is unstable, and incorrect choices of grid will lead to numerical instability.

For example, let S0 = 50, K = 40, T = 1, r = 0.05, σ = 0.2, R = 100,M = 50 and N = 100,

the numerical result is 12.2878, while the Black-Scholes formula gives 12.2944. The numerical

scheme works properly in this case and the approximation is fairly accurate. But if the value

of M is set to be 100, the result given by the explicit scheme turns out to be 7.8568e+45,

which implies the instability of explicit method.

Page 26: Numerical Solutions to PDEs and Option Pricingyzhang/Dissertation_Ying... · 2019-10-09 · University of Edinburgh School of Mathemtics 2014-15 Numerical Solutions to PDEs and Option

6 FULLY DISCRETIZED SCHEME 25

6.4 The Crank-Nicolson method

Crank-Nicolson method combines the implicit and explicit scheme which can be expressed

as

vj,i − vj−1,i

τ=r

2(vj,i + vj−1,i)−

rxi2

(vj,i+1 − vj,i−1

2h+vj−1,i+1 − vj−1,i−1

2h)

− σ2x2i

4(vj,i+1 − 2vj,i + vj,i−1

h2+vj−1,i+1 − 2vj−1,i + vj−1,i−1

h2).

After some calculations, one can get the following expression:

a∗i vj+1,i−1 + (1 + b∗i )vj+1,i + c∗i vj+1,i+1 = −a∗i vj,i−1 + (1− b∗i )vj,i − c∗i vj,i+1,

where

a∗i = τ4(σ2i2 − ri), b∗i = − τ

2(r + σ2i2), c∗i = τ

4(σ2i2 + ri) .

In the matrix form:

M∗1vj = M∗

2vj+1 + Γ ,

where

vj = [vj,1, vj,2, vj,3, . . . , vj,M−2, vj,M−1]T ,

Γ = [a∗1(vj,0 + vj+1,0), 0, 0, . . . 0, c∗M−1(vj,M + vj+1,M)]T ,

M∗1 =

1− b∗1 −c∗1

−a∗2 1− b∗2 −c∗2

−a∗3 1− b∗3 −c∗3. . . . . . . . .

−a∗M−2 1− b∗M−2 −c∗M−2

−a∗M−1 1− b∗M−1

,

and

M∗2 =

1 + b∗1 c∗1

a∗2 1 + b∗2 c∗2

a∗3 1 + b∗3 c∗3. . . . . . . . .

a∗M−2 1 + b∗M−2 c∗M−2

a∗M−1 1 + b∗M−1

,

After specifying the terminal and boundary conditions for the European call option, one

can get numerical approximations. The table 9 provides the comparison for the prices of

the European call option between Black-Scholes results and approximations obtained using

�nite di�erence schemes (implicit scheme and Crank-Nicolson method). It illustrates that

the Crank-Nicolson method which combines explicit and implicit schemes can improve the

accuracy of the numerical approximations.

Page 27: Numerical Solutions to PDEs and Option Pricingyzhang/Dissertation_Ying... · 2019-10-09 · University of Edinburgh School of Mathemtics 2014-15 Numerical Solutions to PDEs and Option

7 CONSISTENCY, STABILITY AND CONVERGENCE 26

S0 Black-Scholes Implicit Scheme Crank-Nicolson

35 0.2207 0.2227 0.2208

37 0.4181 0.4199 0.4181

44 2.1376 2.1359 2.1366

50 5.2253 5.2214 5.2241

57 10.4714 10.4687 10.4706

60 13.0845 13.0828 13.0840

For K = 50, T = 1, r = 0.05, σ = 0.2, N = 200,M = 200 and R = 100.

Table 9: Comparison between di�erent numerical schemes

7 Consistency, Stability and Convergence

The approximated solutions calculated using numerical methods are expected to converge to

the solutions of the di�erential equations. However, in the section 6.3, there is an example

indicating that the numerical solutions of the explicit scheme do not approximate the exact

solutions when the girds are not properly chosen. Therefore, the properties of the numeri-

cal methods need to be studied and the discussions are mainly about the fully discretized

schemes. In order to facilitate the analysis, �rst transform the PDE problem (3.6)-(3.7) to

the heat equation [17].

Denote by t = σ2

2(T − t) and p(t, x) = q(t, x), then,

∂tp = −σ

2

2

∂tq.

The PDE (3.6) becomes

∂tq(t, x)− (

2r

σ2− 1)

∂xq(t, x)− ∂2

∂x2q(t, x) +

2r

σ2q(t, x) = 0. (7.1)

Let t = t, rewritte (7.1) as

∂tq(t, x) =

∂2

∂x2q(t, x) + (

2r

σ2− 1)

∂xq(t, x)− 2r

σ2q(t, x) (7.2)

for x ∈ R and t ∈ [0, σ2

2T ], with the initial condition

q(0, x) = g(ex), x ∈ R.

Furthermore, set q(t, x) = eαx+βtu(t, x) = γu(t, x)

∂tq = βγu+ γ

∂tu,

∂xq = αγu+ γ

∂xu,

∂2

∂x2q = α2γu+ 2αγ

∂xu+ γ

∂2

∂x2u.

Page 28: Numerical Solutions to PDEs and Option Pricingyzhang/Dissertation_Ying... · 2019-10-09 · University of Edinburgh School of Mathemtics 2014-15 Numerical Solutions to PDEs and Option

7 CONSISTENCY, STABILITY AND CONVERGENCE 27

Then, substitute these expressions into (7.2), one can get

∂tu(t, x) =

∂2

∂x2u(t, x) + (2α + (

2r

σ2− 1))

∂xu(t, x) + (α2 − β + (

2r

σ2− 1)α− 2r

σ2)u(t, x).

In order to eliminate the last two terms and get the heat equation, set

α =σ2 − 2r

2σ2,

β = −(σ2 + 2r

2σ2)2.

Finally,∂

∂tu(t, x) =

∂2

∂x2u(t, x) (7.3)

for x ∈ R and t ∈ [0, σ2

2T ], with initial condition

u(0, x) = e−αxg(ex),x ∈ R. (7.4)

7.1 Consistency

Acoording to [18], the de�nition of consistency is as follows.

De�nition 1. Given a partial di�erential equation Pu = f , and a �nite di�erence equa-

tion Pτ,hv = f , we say that the the �nite di�erence scheme is consistent with the partial

di�erential equation if for any smooth function φ(t, x)

Pφ− Pτ,hφ→ 0 as τ, h→ 0.

Using a di�erential operator P = ∂∂t− ∂2

∂x2, (7.3) can be written as

Pφ = 0. (7.5)

At the point (tj, xi), denote by φj,i = φ(tj, xi). The forward-time central-space scheme for

the PDE given the dicretized operator Pτ,h can be expressed as

Pτ,hφ =φj+i,i − φj,i

τ− φj,i+1 − 2φj,i + φj,i−1

h2.

Then consider the Taylor expansion of φ in t and x at (tj, xi),

φj+i,i − φj,iτ

=∂

∂tφ+O(t),

φj,i+1 − φj,i−1

2h=

∂xφ+O(h2),

φj,i+1 − 2φj,i + φj,i−1

h2=

∂2

∂x2φ+O(h2).

Therefore, as (τ, h)→ 0,

Pv − Pτ,hv = O(t) +O(h2)

→ 0.

The explicit scheme is consistent. As for the implicit scheme, the only di�erence is that

the �rst derivative with respect to t is approximated by backward di�erence, hence it is also

Page 29: Numerical Solutions to PDEs and Option Pricingyzhang/Dissertation_Ying... · 2019-10-09 · University of Edinburgh School of Mathemtics 2014-15 Numerical Solutions to PDEs and Option

7 CONSISTENCY, STABILITY AND CONVERGENCE 28

consistent. In addition, the consistency of Crank-Nicolson method can be proved by noticing

that central di�erence is used for the approximation of the �rst derivative with respect to

time, that is, at the point (tj− 12, xi),

1

τ(φj,i − φj−1,i) =

∂tφ+O(t2).

and the term ∂2

∂x2φ at (tj− 1

2, xi) can be expressed as

1

2(φj,i+1 − 2φj,i + φj,i−1

h2+φj−1,i+1 − 2φj−1,i + φj−1,i−1

h2) =

∂2

∂x2φ+O(h2).

Therefore, by the similar discussion above, the Crank-Nicolson method is consistent.

7.2 Stability

A numerical scheme is said to be stable with respect to a given norm, if the approximations

obtained by the scheme are bounded in the norm whenever the step size goes to zero. Von

Neumann analysis will be used here to check the stability of the explicit scheme, implicit

scheme and the Crank-Nicolson method.

7.2.1 Von Neumann analysis for the explicit scheme

The explicit �nite di�erence scheme for (7.3) can be expressed as

u(tj+1, xi)− u(tj, xi)

τ=

1

h2(u(tj, xi+1)− 2u(tj, xi) + u(tj, xi−1)), (7.6)

where xi = ih for i = 0, 1, . . . ,M and tj = jτ ∗ for j = 0, 1, . . . , N, tN = σ2

2T . Denote by

uj,i = u(tj, xi), and assume that at the point (tj, xi), the solution is of the form [11]:

uj,i = ξje√−1k(ih), (7.7)

where ξ shows the the time dependence of the solution and k is the wave number. Then ,

the expressions for uj+1,i, uj,i+1 and uj,i−1 can be written as

uj+1,i = ξj+1e√−1k(ih),

uj,i+1 = ξje√−1k((i+1)h),

uj,i−1 = ξje√−1k((i−1)h).

Substitue these expression into (7.6), one can get

ξj+1

ξj= 1 +

τ

h2(e√−1kh − 2 + e−

√−1kh).

By the de�nition in [18], a �nite di�erence scheme is stable if and only if the ampli�cation

factor satis�es the condition

|G| ≤ 1,

where G can be expressed as

G =ξj+1

ξj.

Page 30: Numerical Solutions to PDEs and Option Pricingyzhang/Dissertation_Ying... · 2019-10-09 · University of Edinburgh School of Mathemtics 2014-15 Numerical Solutions to PDEs and Option

7 CONSISTENCY, STABILITY AND CONVERGENCE 29

In this case,

|G| = |ξj+1

ξj|

= |1 +τ

h2(e√−1kh − 2 + e−

√−1kh)|

= |1− 4τ

h2sin2(

kh

2)|

≤ 1.

Then, in order to make the condition |G| ≤ 1 satis�ed all the time, the step size τ and the

mesh size h should satisfy the following inequlity:

τ

h2≤ 1

2.

Therefore, the explicit scheme is conditionally stable.

7.2.2 Von Neumann analysis for the implicit scheme

Apply the implicit scheme to (7.3), the partial di�erential equation can be discretized as

uj,i = uj+1,i −τ

h2(uj+1,i+1 − 2uj+1,i + uj+1,i−1).

The solution at the point (tj, xi) is of the form (7.7), then one may obtain the following

equation:

ξje√−1k(ih) = ξj+1e

√−1k(ih) − τ

h2(ξj+1e

√−1k((i+1)h) − 2ξj+1e

√−1k(ih) + ξj+1e

√−1k((i−1)h)).

After simpli�cation, it can be rewritten as

ξj+1

ξj=

1

1− τh2

(e√−1kh − 2 + e−

√−1kh)

=1

1 + 4τh2

sin2(kh2

).

Then, by the stability condition on the ampli�cation factor |G| ≤ 1, the implicit scheme is

unconditionally stable since in all cases

|G| = | 1

1 + 4τh2

sin2(kh2

)| ≤ 1.

7.2.3 Von Neumann analysis for the Crank-Nicolson method

The numerical scheme of the Crank-Nicolson method for (7.3) is as follows:

uj+1,i − uj,iτ

=1

2(uj,i+1 − 2uj,i + uj,i−1

h2+uj+1,i+1 − 2uj+!,i + uj+1,i−1

h2).

With the solution expressed in(7.7), the above equation can be simpli�ed to be

ξj+1

ξj=

1− 2τh2

sin2(kh2

)

1 + 2τh2

sin2(kh2

).

Since

|G| = |1− 2τ

h2sin2(kh

2)

1 + 2τh2

sin2(kh2

)| ≤ 1,

the stability condition on the ampli�cation factor is satis�ed, thus the Crank-Nicolson

method is unconditionally stable.

Page 31: Numerical Solutions to PDEs and Option Pricingyzhang/Dissertation_Ying... · 2019-10-09 · University of Edinburgh School of Mathemtics 2014-15 Numerical Solutions to PDEs and Option

7 CONSISTENCY, STABILITY AND CONVERGENCE 30

7.3 Convergence

The fundamental theorem [18] in the analysis of �nite di�erent schemes can be introduced.

Theorem 4. (The Lax-Richtmyer Equivalence Theorem) A consistent �nite di�erence scheme

for a partial di�erential equation for which the initial value problem is well-posed is conver-

gent if and only if it is stable.

Aas discussed above, the implicit �nite di�erence scheme and the Crank-Nicolson method

are consistent and stable. The PDE problem (2.3)-(2.4) can also be regarded as a well-posed

linear inital value problem. Then according to the theorem and by the following de�nition

[18], one can determine the order of accuracy of these schemes.

De�nition 2. A scheme Pτ,hv = Rτ,hf that is consistent with the di�erential equation

Pu = f is accurate of order q in time and order p in space if for any smooth function φ(t, x),

Pτ,hφ−Rτ,hPφ = O(τ q) +O(hp).

We say that such a scheme is accurate of order (p, q).

Note that Rk,h is an approximation of the identity opertor. When the order of accuracy

of a scheme is determined theoretically, one can verify it numerically. Denote by v = v(t, x)

the exact solution of (2.3) and vh the numerical approximation that depends on the spatial

mesh size h. By [14], the numerical scheme is of order p in space if

|vh − v| ≤ Chp,

where C is a number that is not depend on h. Then, one can write the following equation:

vh − v = Chp +O(hp+1). (7.8)

To verify the order of accuracy numerically in space, other approximated values for di�erent

mesh size h need to be calculated. For example, consider vh/2 and vh/4 which satisfy the

equation (7.8), one can get the expressions:

vh/2 − v = C(h

2)p +O((

h

2)p+1),

vh/4 − v = C(h

4)p +O((

h

4)p+1).

Then,vh − vh/2vh/2 − vh/4

=2p +O(h)

1 +O(h),

and by taking the logarithm of both sides,

log2 |vh − vh/2vh/2 − vh/4

| = p+O(h).

Hence the scheme can be veri�ed to be pth order accurate in space. Meanwhile, if vτ is

denoted as the numerical solution depending on τ , the scheme is qth order accurate in time

if

|vτ − v| ≤ Cτ q.

The order of accuracy for implicit scheme and Crank-Nicolson method will be determined

theoretically, and then veri�ed by numerical calculations.

Page 32: Numerical Solutions to PDEs and Option Pricingyzhang/Dissertation_Ying... · 2019-10-09 · University of Edinburgh School of Mathemtics 2014-15 Numerical Solutions to PDEs and Option

7 CONSISTENCY, STABILITY AND CONVERGENCE 31

7.3.1 The order of accuracy for the implicit scheme

By the de�nition 2, it can be determined that the implicit scheme is �rst order accurate in

time and second order accurate in space. In order to verify the order of accuracy, �rst �nd

the numerical approximations for di�erent mesh sizes. Let S0 = 60, K = 50, T = 1, r =

0.05, σ = 0.2, R = 100, the following table is the approximations calculated using implicit

method and the order of accuracy in space.

h vh vh − vh/2vh−vh/2vh/2−vh/4

log2 |vh−vh/2vh/2−vh/4

|

2 13.0749 -0.0063 3.9853 1.9947

1 13.0812 -0.0016 3.9965 1.9987

0.5 13.0828 -0.0004 3.9991 1.9997

0.25 13.0832 -0.0001

0.125 13.0833

Table 10: The order of accuracy p setting time step τ = 0.005

From the last column of table 10, it can be veri�ed numerically that the implicit scheme

is of second order accuracy in space. Similarly, the order of accuracy in time can be veri�ed

using the equation,

log2 |vτ − vτ/2vτ/2 − vτ/4

| = q +O(τ).

It can be shown from the table 11 that the implicit �nite di�erence scheme is �rst order

accurate in time. Therefore, the implicit method is �rst-order accurate in time and second-

order accurate in space.

τ vτ vτ − vτ/2vτ−vτ/2vτ/2−vτ/4

log2 |vτ−vτ/2vτ/2−vτ/4

|

0.02 13.0794 -0.0023 1.9815 0.9866

0.01 13.0817 -0.0011 1.9907 0.9933

0.005 13.0828 -0.0006 1.9954 0.9966

0.0025 13.0834 -0.0003

0.00125 13.0837

Table 11: The order of accuracy q setting mesh size h = 0.5

7.3.2 The order of accuracy for the Crank-Nicolson method

By considering the approximations of the derivatives at (tj− 12, xi), the order of accuracy of the

Crank-Nicolson method should be of second order in time and space. One can again verify

the order of accuracy by analyzing numerical approximations. Let S0 = 50, K = 50, T =

1, r = 0.05, σ = 0.2, R = 100, the tables below shows approximated values for di�erent h

and τ , and the last column of the tables are the order of accuracy in space and time.

Page 33: Numerical Solutions to PDEs and Option Pricingyzhang/Dissertation_Ying... · 2019-10-09 · University of Edinburgh School of Mathemtics 2014-15 Numerical Solutions to PDEs and Option

7 CONSISTENCY, STABILITY AND CONVERGENCE 32

h vh vh − vh/2vh−vh/2vh/2−vh/4

log2 |vh−vh/2vh/2−vh/4

|

2 5.2054 -0.0150 4.0283 2.0102

1 5.2203 -0.0037 4.0069 2.0025

0.5 5.2241 -0.0009 4.0020 2.0007

0.25 5.2250 -0.0002

0.125 5.2252

Table 12: The order of accuracy p setting time step τ = 0.005

τ vτ vτ − vτ/2vτ−vτ/2vτ/2−vτ/4

log2 |vτ−vτ/2vτ/2−vτ/4

|

0.02 5.2241 1.0e-04 *0.3722 3.9920 1.9971

0.01 5.2241 1.0e-04 *0.0932 3.9999 2.0000

0.005 5.2241 1.0e-04 *0.0233 4.0000 2.0000

0.0025 5.2241 1.0e-04 *0.0058

0.00125 5.2241

Table 13: The order of accuracy q setting mesh size h = 0.5

From the table 12 and 13 , it can be tested numerically that the Crank-Nicolson method

is a second order accurate scheme in space and time.

Page 34: Numerical Solutions to PDEs and Option Pricingyzhang/Dissertation_Ying... · 2019-10-09 · University of Edinburgh School of Mathemtics 2014-15 Numerical Solutions to PDEs and Option

8 APPLY THE NUMERICAL SCHEME TO OTHER OPTIONS 33

8 Apply the numerical scheme to other options

In previous sections, European call and put options are used to illustrate the implementation

of the �nite di�erence methods. In this section, the numerical method will be applied to the

European type options with other payo� functions and the European-style barrier options.

8.1 European options with more general payo� functions

Assume that the stochastic process of the share price (St)t∈[0,T ] is governed by the SDE

dSt = µStdt+ σSt,

where µ ∈ R, σ > 0 and S0 is the initial share price. For a European type call with maturity

T , given the option payo� g:

g = max(S2T + 4ST − 140, 0),

then by the theorem 1 and after some calculations, the price of the option at time 0 can be

obtained using the formula

C0 = e−rTEQ(S2T1ST>10) + 4e−rTEQ(ST1ST>10)− 140e−rTEQ(1ST>10).

The term EQ(SiT1ST>10) can be further expressed as

EQ(SiT1ST>10) = Si0eirT+ 1

2(i2−i)σ2TΦ(di)

for i = 0, 1, 2, where Φ(·) is the standard normal distribution function and

di =1

σ√T

(ln(S0

10) + (r − 1

2σ2)T + iσ2T ).

Let S0 = 10, K = 50, σ = 0.2, r = 0.05,M = 800, N = 800, R = 80 and T = 1, the result

calculated using the analytical formula is 28.5072 while the approximation obtained by the

Crank-Nicolson method is 28.5014. The graphs for the option prices can be found in the ap-

pendix 5. Therefore, to calculate the prices of European type option with complicated payo�

functions, the �nite di�erence methods can be employed to get numerical approximations.

8.2 European style barrier options

Consider a European style up-and-out put with strike price K and maturity T , the barrier

price is denoted as Sb. If the Crank-Nicolson method is applied to approximate the prices

of the barrier option, using the same notations as in section 6.4, one only needs to think

carefully the settings of the boundary conditions. These boundary conditions can be written

as

vj,0 = vτ,hR (tj, x0) = Ke−r(T−jτ), vj,M = vτ,hR (tj, xM) = 0 .

In this case, notice that xM = Sb. Then, let S0 = 30, K = 40, Sb = 50, σ = 0.2, r = 0.05,M =

100, N = 100, R = 100 and T = 1, the approximation given by the Crank-Nicolson method

is 8.43568 and the solution obtained using the formula is 8.43582. Meanwhile, the price for

corresponding up-and-in put can be found using the formula,

P = PUI + PUO,

where P is the option price for the European put option, PUI is the option price for up-and-in

put and PUO is the price for up-and-out put.

Page 35: Numerical Solutions to PDEs and Option Pricingyzhang/Dissertation_Ying... · 2019-10-09 · University of Edinburgh School of Mathemtics 2014-15 Numerical Solutions to PDEs and Option

9 CONCLUSION 34

9 Conclusion

The goal of the project is to approximate option prices numerically. For an option with

underlying asset S, strike price K and maturity T , �rst, the relationship between SDEs

and PDEs is investigated so that the numerical methods can be employed to solve the PDE

problems related to the option pricing. Then, the log transformation is applied to obtain

the PDEs with constant coe�cients. Next, the original PDEs are converted into discretized

schemes. However, the discretization gives ini�nite systems of ODEs and equations. Thus,

in order to be implemented numerically, the in�nite systems need to be truncatedand. The

truncation error is discussed in section 4, and it vanishes as R tends to in�nity.

The sptial discretization for the PDEs is considered in section 5. Numerical approxima-

tions can be obtained by solving the �nite system of ODEs using ode15 solver in MATLAB.

Furthermore, the accuracy of the numerical results are tested for di�erent R and mesh size h.

Despite the fact that these approximations are quite close to analytical solutions calculated

using Black-Scholes formula, one should set suitably large R for the scheme to work properly.

In section 6, fully discretized schemes are investigated. In order to fully discretize the

PDEs, one needs to set up grids with respect to time and space. Explicit scheme, implicit

scheme and Crank-Nicolson method are studied respectively as three examples of the fully

discretized scheme to solve option pricing problems. For an explicit scheme, the time deriva-

tive is approximated by forward di�erence, and spatial derivative is approximated by central

di�erence, while in an implicit scheme, the only di�erence is that backward di�erence is

applied for the time derivative. As for the Crank-Nicolson method, it combines the explicit

and implicit schemes and can be regarded as a central-time central-space scheme. Accuracy

tests are then conducted for di�erent R, mesh size h and time step τ . It could be noticed that

the numerical approximations calculated using the Crank-Nicolson methods are of greater

accuracy compared to the explicit and implicit methods.

Moreover, in section 7, consistency, stability and convergence are considered for explicit,

implicit scheme and Crank-Nicolson method. It can be proved that these fully �nite dif-

ference methods are all consistent. To test the stability property, Von Neumann analysis

is used. By the stability condition on the ampli�cation factor G, it can be shown that the

explicit scheme is conditionally stable, whereas the implicit scheme and the Crank-Nicolson

method are unconditionally stable. Then according to the theorem 4, the implicit scheme

and the Crank-Nicolson method are also convergent. For a convergent scheme, one can de-

termine its order of accuracy. The order of accuracy for the implicit scheme is �rst order

accurate in time and second order accurate in space. This can be veri�ed numerically. Sim-

ilarly, the Crank-Nicolson method can be veri�ed to be a second order accurate scheme in

both space and time.

Finally, the �nite di�erence method is applied to other European type options. The �rst

example considered is a European call option with a di�erent payo� function. The other

one is a European style barrier option.The accurate numerical results indicate that the �nite

di�erence method is a practical alternative to �nd approximations for option prices.

Page 36: Numerical Solutions to PDEs and Option Pricingyzhang/Dissertation_Ying... · 2019-10-09 · University of Edinburgh School of Mathemtics 2014-15 Numerical Solutions to PDEs and Option

REFERENCES 35

References

[1] Bergara, A.: 2014, Finite-di�erence numerical methods of partial di�erential equations

in �nance with matlab.

URL: http://www.ehu.eus/aitor/irakas/�n/apuntes/pde.pdf

[2] Brandimarte, P.: 2006, Numerical Methods in Finance and Economics: A MATLAB-

Based Introduction, Wiley-Interscience.

[3] Fleming, W. H., Soner, M. H. and Soner, H.: 2005, Controlled Markov Processes and

Viscosity Solutions (Stochastic Modelling and Applied Probability), 2 edn, Springer-

Verlag New York, New York.

[4] Gyöngy, I.: 2013, On �nite di�erence approximations in option pricing.

URL: http://www.math.ritsumei.ac.jp/crest/Okinawa/1101/Okinawa2013.pdf

[5] Gyöngy, I.: 2015, Lecture notes in stochastic analysis in �nance.

[6] Hilber, N., Reichmann, O., Schwab, C. and Winter, C.: 2014, Computational Methods

for Quantitative Finance: Finite Element Methods for Derivative Pricing, Springer-

Verlag Berlin Heidelberg, Berlin.

[7] Isaacson, E. and Keller, H.: 1994, Analysis of numerical methods, Dover Publications,

New York.

[8] Krylov, N. V.: 2008, Controlled di�usion processes, Springer-Verlag Berlin and Heidel-

berg GmbH & Co. K, Berlin.

[9] Lapeyre, B. and Lamberton, D.: 2007, Introduction to Stochastic Calculus Applied to

Finance, Second Edition (Chapman & Hall/Crc Financial Mathematics Series), 2 edn,

Chapman & Hall/CRC, Boca Raton.

[10] Levy, G.: 2003, Computational �nance: numerical methods for pricing �nancial instru-

ments, Elsevier Butterworth-Heinemann, Boston.

[11] Olver, P.: 2008, Finite di�erence methods for partial di�erential equations.

URL: http://www.math.umn.edu/ olver/num _/lnp.pdf

[12] Persson, J.: 2006, Accurate �nite di�erence methods for option pricing, Acta Universi-

tatis Upsaliensis, Uppsala.

[13] Rosales, R.: 1999, Stability of numerical schemes for pde's.

URL: http://math.mit.edu/classes/18.311/Notes/NumSchemeStab.pdf

[14] Runborg, O.: 2012, Numerical convergence rates.

URL: http://www.csc.kth.se/utbildning/kth/kurser/DN1240/numfcl12/Lecture6.pdf

[15] Sadiku, M. N. O. and Obiozor, C. N.: 2000, A simple introduction to the method of

lines, International Journal of Electrical Engineering Education 37(3), 282�296.

[16] Shampine, L. F., Gladwell, I. and Thompson, S.: 2003, Solving ODEs with MATLAB,

Cambridge University Press, Cambridge.

Page 37: Numerical Solutions to PDEs and Option Pricingyzhang/Dissertation_Ying... · 2019-10-09 · University of Edinburgh School of Mathemtics 2014-15 Numerical Solutions to PDEs and Option

REFERENCES 36

[17] Stecher, M.: 2012, Converting the black-scholes pde to the heat equation.

URL: http://www.math.tamu.edu/ stecher/425/Sp12/blackScholesHeatEquation.pdf

[18] Strikwerda, J.: 2004, Finite di�erence schemes and partial di�erential equations, 2 edn,

SIAM, Society for Industrial and Applied Mathematics, Philadelphia.

[19] Trefethen, L. N.: 1996, Finite di�erence and spectral methods for ordinary and partial

di�erential equations.

URL: http://people.maths.ox.ac.uk/trefethen/pdetext.html

[20] �Si�ska, D.: 2012, Error estimates for approximations of american put option price, Com-

putational Methods in Applied Mathematics 12, 108�120.

Page 38: Numerical Solutions to PDEs and Option Pricingyzhang/Dissertation_Ying... · 2019-10-09 · University of Edinburgh School of Mathemtics 2014-15 Numerical Solutions to PDEs and Option

Appendix 37

Appendix

Figures

x0 2 4 6 8 10 12 14 16 18 20

v(t,x

)

0

50

100

150

200

250

300

350

400

v(0,x)v(T,x)

(a) (b)

Figure 5: The graphs for the option in section 8.1

x0 5 10 15 20 25 30 35 40 45 50

v(t,x

)

0

5

10

15

20

25

30

35

40

v(0,x)v(T,x)

(a) (b)

Figure 6: The graphs for the option in section 8.2

Page 39: Numerical Solutions to PDEs and Option Pricingyzhang/Dissertation_Ying... · 2019-10-09 · University of Edinburgh School of Mathemtics 2014-15 Numerical Solutions to PDEs and Option

Appendix 38

Codes

The Matlab code 3-8 are developed from the code in [2].

Matlab code 1: Spatial �nite di�erence scheme for European put option

1 S0 = 50;

r = 0.1;

3 K = 50;

sigma = 0.4;

5 Smax =200; T=1;

M = 200;

7 dS = Smax/M; %mesh size h

vetS = linspace(0,Smax ,M+1) ';

9 veti = 0:M;

% initial condition

11 y_0_f = max(K-vetS ,0);

y_0 = y_0_f (1:M);

13 %coefficient (for BS PDE without log transformation)

a = -(0.5* veti*r - 0.5* sigma ^2* veti .^2);

15 b = -(r + sigma ^2* veti .^2);

c = -(-0.5*veti*r - 0.5* sigma ^2* veti .^2);

17 %coefficient matrix

partA = diag(a(3:M) ,-1) + diag(b(2:M)) + diag(c(2:M-1) ,1);

19 % for boundary cond. at S = 0

first_row_A = zeros(1,M);

21 first_row_A (1) = -r;

first_col_A = zeros(M-1,1);

23 first_col_A (1) = a(2);

A_1 = [first_col_A , partA];

25 A = [first_row_A; A_1];

ode_rhs = @(t,x) A*x;

27 options = odeset('RelTol ',1e-4,'AbsTol ',1e-4);

[t_grid ,Y] = ode15s(ode_rhs ,[0 T],y_0 ,options);

29 N=length(t_grid);

plot(vetS (1:M),Y(N,:),'r');

31 ylabel('','Interpreter ','latex ','String ','v($\bar t$,x)')

line(vetS (1:M),y_0);

33 interp1(vetS (1:M),Y(N,:), S0);

Matlab code 2: Spatial �nite di�erence scheme for European put under log transforma-

tion

1 logS0 = 2.4;

T=1;

3 r = 0.1;

sigma = 0.4;

5 K = 50;

logSmax = 5;

7 M = 200;

dS = logSmax/M; %mesh size h

9 vetS = linspace(0,logSmax ,M+1) ';

veti = 0:M;

11 % initial condition

y_f = max(K-exp(vetS) ,0);

13 y_0 = y_f (1:M);

%coefficient (for BS PDE under log transformation)

15 a = -(0.5*(r-sigma ^2/2)/dS - 0.5* sigma ^2/dS^2);

b = -(r + sigma ^2/dS^2);

Page 40: Numerical Solutions to PDEs and Option Pricingyzhang/Dissertation_Ying... · 2019-10-09 · University of Edinburgh School of Mathemtics 2014-15 Numerical Solutions to PDEs and Option

Appendix 39

17 c = -(-0.5*(r-sigma ^2/2)/dS - 0.5* sigma ^2/dS^2);

%coefficient matrix

19 partA = diag(a*ones(M-2,1) ,-1) + diag(b*ones(M-1,1)) + diag(c*ones(M

-2,1) ,1);

% for boundary cond. at S = 0

21 first_row_A = zeros(1,M);

first_row_A (1) = -r;

23 first_col_A = zeros(M-1,1);

first_col_A (1) = a;

25 A_1 = [first_col_A , partA];

A = [first_row_A; A_1];

27 ode_rhs = @(t,x) A*x;

options = odeset('RelTol ',1e-4,'AbsTol ',1e-4);

29 [t_grid ,Y] = ode15s(ode_rhs ,[0 T],y_0 ,options);

N=length(t_grid);

31 interp1(vetS (1:M),Y(N,:), logS0);

ylabel('','Interpreter ','latex ','String ','p($\bar t$,x)')

33 plot(vetS (1:M),Y(N,:),'r');

line(vetS (1:M),y_0);

Matlab code 3: Implicit scheme for European call option

S0 =30; % Spot price

2 K = 60; % Strike price

r = 0.05; % Risk free interest rate

4 sigma = 0.2; % Volatility

T = 1; % Maturity

6 M = 200; % Number of spatial grid points

N = 100; % Number of time grid points

8 Smax= 100;

dS = Smax/M;

10 dt = T/N;

solmatrix = zeros(N+1,M+1);

12 vetS = linspace(0,Smax ,M+1);

vetT = linspace(0,T,N+1) ';

14 veti = 0:M;

vetj = 0:N;

16 solmatrix(N+1,:) = max(vetS -K,0);

solmatrix (:,1) = 0;

18 solmatrix (:,M+1) = Smax -exp(-r*dt*(N-vetj))*(K);

20 a = 0.5*r*dt*veti -0.5* sigma ^2*dt*(veti .^2);

b = 1+ sigma ^2*dt*(veti .^2)+r*dt;

22 c = -0.5*(r*dt*veti+sigma ^2*dt*(veti .^2));

coeff = diag(a(3:M) ,-1) + diag(b(2:M)) + diag(c(2:M-1) ,1);

24 [L,U] = lu(coeff);

aux = zeros(1,M-1);

26 for j=N:-1:1

aux(M-1) = - c(M) * solmatrix(j,M+1);

28 solmatrix(j,2:M) = U \ (L \ (solmatrix(j+1,2:M) + aux) ');

end

30 price = interp1(vetS , solmatrix (1,:), S0) ;

mesh(vetS ,vetT ,solmatrix); xlabel('x');ylabel('t');zlabel('v(t,x)');

32 plot(vetS ,solmatrix (1,:),'r'); line(vetS ,solmatrix(N+1,:));

xlabel('x'); ylabel('v(t,x)');

Page 41: Numerical Solutions to PDEs and Option Pricingyzhang/Dissertation_Ying... · 2019-10-09 · University of Edinburgh School of Mathemtics 2014-15 Numerical Solutions to PDEs and Option

Appendix 40

Matlab code 4: Fully implicit scheme with log transformation

1 logS0 =3.6;

K = 35;

3 r = 0.05;

sigma = 0.2;

5 T = 1;

M = 200;

7 N = 800;

logSmax= 4.8;

9 dS = logSmax/M;

dt = T/N;

11 solmatrix = zeros(N+1,M+1);

vetS = linspace(0,logSmax ,M+1);

13 vetT = linspace(0,T,N+1) ';

veti = 0:M;

15 vetj = 0:N;

solmatrix(N+1,:) = max(exp(vetS)-K,0);

17 solmatrix (:,1) = 0;

solmatrix (:,M+1) = exp(logSmax)-exp(-r*dt*(N-vetj))*K;

19 a = 0.5*dt*((r - 0.5* sigma ^2)*dS - sigma ^2) / (dS^2);

b = 1 + dt*(r + sigma^2 /(dS^2));

21 c = -0.5*dt*((r-0.5* sigma ^2)*dS + sigma ^2) / (dS^2);

coeff = diag(a*ones(M-2,1) ,-1) + diag(b*ones(M-1,1)) + diag(c*ones(M

-2,1) ,1);

23

[L,U] = lu(coeff);

25 aux = zeros(1,M-1);

for j=N:-1:1

27 aux(M-1) = - c * solmatrix(j,M+1);

solmatrix(j,2:M) = U \ (L \ (solmatrix(j+1,2:M) + aux) ');

29 end

31 interp1(vetS , solmatrix (1,:), logS0);

mesh(vetS ,vetT ,solmatrix); xlabel('x');ylabel('t');zlabel('v(t,x)');

33 plot(vetS ,solmatrix (1,:),'r'); line(vetS ,solmatrix(N+1,:));

xlabel('x'); ylabel('v(t,x)');

Matlab code 5: Explicit scheme for European call

K = 40;

2 S0 =50;

sigma = 0.2;

4 r = 0.05;

T = 1;

6 M = 50;

N = 100;

8 Smax= 100;

dS = Smax/M;

10 dt = T/N;

solmatrix = zeros(N+1,M+1);

12 vetS = linspace(0,Smax ,M+1);

vetT = linspace(0,T,N+1) ';

14 veti = 0:M;

vetj = 0:N;

16 solmatrix(N+1,:) = max(vetS -K,0);

solmatrix (:,1) = 0;

18 solmatrix (:,M+1) = (Smax -K)*exp(-r*dt*(N-vetj));

Page 42: Numerical Solutions to PDEs and Option Pricingyzhang/Dissertation_Ying... · 2019-10-09 · University of Edinburgh School of Mathemtics 2014-15 Numerical Solutions to PDEs and Option

Appendix 41

a = (0.5* sigma ^2* veti - 0.5*r).*veti*dt;

20 b = 1- dt*sigma ^2* veti .^2 - dt*r;

c = (0.5* sigma ^2* veti + 0.5*r).*veti*dt;

22 for j=N:-1:1

for i=2:M

24 solmatrix(j,i) = a(i)*solmatrix(j+1,i-1) + b(i)*

solmatrix(j+1,i) + c(i)*solmatrix(j+1,i+1);

end

26 end

price = interp1(vetS , solmatrix (1,:), S0);

Matlab code 6: The Crank-Nicolson method for European call

1 K = 50;

S0 =60;

3 sigma = 0.2;

r = 0.05;

5 T = 1;

M = 200;

7 N = 200;

Smax= 100;

9 dt = T/N;

dS = Smax/M;

11 solmatrix = zeros(N+1,M+1);

vetS = linspace(0,Smax ,M+1);

13 vetT = linspace(0,T,N+1) ';

veti = 0:M;

15 vetj = 0:N;

solmatrix(N+1,:) = max(vetS -K,0);

17 solmatrix (:,1) = 0;

solmatrix (:,M+1) = Smax -exp(-r*dt*(N-vetj))*K;

19 alpha = ( 0.25* sigma ^2*( veti .^2) - 0.25*r*veti )*dt;

beta = -0.5*( r*dt + sigma ^2*( veti .^2)*dt );

21 gamma = ( 0.25* sigma ^2*( veti .^2) + 0.25*r*veti )*dt;

M1 = -diag(alpha (3:M) ,-1) + diag(1-beta (2:M)) - diag(gamma (2:M-1) ,1);

23 M2 = diag(alpha (3:M) ,-1) + diag (1+ beta (2:M)) + diag(gamma (2:M-1) ,1);

[L,U] = lu(M1);

25 aux = zeros(1,M-1);

for j=N:-1:1

27 aux(1) = alpha (2)*( solmatrix(j,1)+solmatrix(j+1,1));

aux(M-1) = gamma(M) * (solmatrix(j,M+1)+solmatrix(j+1,M+1));

29 solmatrix(j,2:M) = U \ (L \ (M2*( solmatrix(j+1,2:M))' + aux ')

);

end

31 interp1(vetS , solmatrix (1,:),S0);

Matlab code 7: The Crank-Nicolson method for European call with a more general payo�

1 S0 =10;

K = 50;

3 r = 0.05;

sigma = 0.2;

5 T = 1;

M = 800;

7 N = 800;

Smax= 80;

9 dS = Smax/M;

dt = T/N;

Page 43: Numerical Solutions to PDEs and Option Pricingyzhang/Dissertation_Ying... · 2019-10-09 · University of Edinburgh School of Mathemtics 2014-15 Numerical Solutions to PDEs and Option

Appendix 42

11 solution = zeros(N+1,M+1);

vetS = linspace(0,Smax ,M+1);

13 vetT = linspace(0,T,N+1) ';

veti = 0:M;

15 vetj = 0:N;

solution(N+1,:) = max((vetS .^2) +4*vetS -140 ,0);

17 solution (:,1) = 0;

solution(:,M+1) = (Smax ^2) +4*Smax -140;

19

alpha = 0.25*( sigma ^2*( veti .^2) - r*veti )*dt;

21 beta = -0.5*( r + sigma ^2*( veti .^2))*dt;

gamma = 0.25*( sigma ^2*( veti .^2) + r*veti )*dt;

23 M1 = -diag(alpha (3:M) ,-1) + diag(1-beta (2:M)) - diag(gamma (2:M-1) ,1);

[L,U] = lu(M1);

25 M2 = diag(alpha (3:M) ,-1) + diag (1+ beta (2:M)) + diag(gamma (2:M-1) ,1);

aux = zeros(1,M-1);

27 for j=N:-1:1

aux(1) = alpha (2)*( solution(j,1)+solution(j+1,1));

29 aux(M-1) = gamma(M) * (solution(j,M+1)+solution(j+1,M+1));

solution(j,2:M) = U \ (L \ (M2*( solution(j+1,2:M))' + aux '));

31 end

33 plot(vetS (1:200) ,solution (1 ,1:200),'r'); line(vetS (1:200) ,solution(N

+1 ,1:200)); mesh(vetS (1:200) ,vetT ,solution (: ,1:200)); xlabel('S');

ylabel('t');zlabel('V(t,S)');

35 interp1(vetS , solution (1,:),S0);

Matlab code 8: The Crank-Nicolson method for European style up-and-out put

1 S0 =30;

K = 40;

3 r = 0.05;

sigma = 0.2;

5 T = 1;

M = 100;

7 N = 100;

Smax= 100;

9 Sb=50;

dS = Sb/M;

11 dt = T/N;

solmatrix = zeros(N+1,M+1);

13 vetS = linspace(0,Sb ,M+1);

vetT = linspace(0,T,N+1) ';

15 veti = vetS/dS;

vetj = 0:N;

17 solmatrix(N+1,:) = max(K-vetS ,0);

solmatrix (:,1) = K*exp(-r*dt*(N-vetj));

19 solmatrix (:,M+1) = 0;

alpha = 0.25*( sigma ^2*( veti .^2) - r*veti )*dt;

21 beta = -( 0.5*r + 0.5* sigma ^2*( veti .^2))*dt;

gamma = 0.25*( sigma ^2*( veti .^2) + r*veti )*dt;

23 M1 = -diag(alpha (3:M) ,-1) + diag(1-beta (2:M)) - diag(gamma (2:M-1) ,1);

[L,U] = lu(M1);

25 M2 = diag(alpha (3:M) ,-1) + diag (1+ beta (2:M)) + diag(gamma (2:M-1) ,1);

aux = zeros(1,M-1);

27 for j=N:-1:1

aux(1) = alpha (2)*( solmatrix(j,1)+solmatrix(j+1,1));

Page 44: Numerical Solutions to PDEs and Option Pricingyzhang/Dissertation_Ying... · 2019-10-09 · University of Edinburgh School of Mathemtics 2014-15 Numerical Solutions to PDEs and Option

Appendix 43

29 aux(M-1) = gamma(M) * (solmatrix(j,M+1)+solmatrix(j+1,M+1));

solmatrix(j,2:M) = U \ (L \ (M2*( solmatrix(j+1,2:M))' + aux ')

);

31 end

33 mesh(vetS ,vetT ,solmatrix); xlabel('S');ylabel('t');zlabel('V(t,S)');

plot(vetS ,solmatrix (1,:),'r');

line(vetS ,solmatrix(N+1,:));

35

interp1(vetS , solmatrix (1,:),S0);

Matlab code 9: Analytical formula for the option in section 8.1

%analytical formula

2 function price = parabolac(S0 ,r,T,sigma)

d0 = (log(S0/10)+(r -0.5* sigma ^2)*T)/(sigma*sqrt(T));

4 d1 = (log(S0/10)+(r -0.5* sigma ^2)*T+(sigma ^2)*T)/( sigma*sqrt(T));

d2 = (log(S0/10)+(r -0.5* sigma ^2)*T+2*( sigma ^2)*T)/( sigma*sqrt(T));

6 A = (S0^2)*exp(2*r*T+(sigma ^2)*T)*normcdf(d2);

B = S0*exp(r*T)*normcdf(d1);

8 C = normcdf(d0);

price = exp(-r*T)*A + 4*exp(-r*T)*B - 140* exp(-r*T)*C;


Recommended