Chapter 5 Finite Difference Methods - YorkU Math and...

90
Math6911 S08, HM Zhu Chapter 5 Finite Difference Methods

Transcript of Chapter 5 Finite Difference Methods - YorkU Math and...

Page 1: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

Math6911 S08, HM Zhu

Chapter 5 Finite Difference Methods

Page 2: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

2Math6911, S08, HM ZHU

References

1. Chapters 5 and 9, Brandimarte

2. Section 17.8, Hull

3. Chapter 7, “Numerical analysis”, Burden and Faires

Page 3: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

3Math6911, 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

Page 4: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

Math6911 S08, HM Zhu

5.1 Finite difference approximations

Chapter 5 Finite Difference Methods

Page 5: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

5Math6911, S08, HM ZHU

Finite-difference mesh

• Aim to approximate the values of the continuous function f(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 a distance ∆t apart

• (t, S) plane becomes a mesh with mesh points on (i ∆t, j∆S)

• We are interested in the values of f(t, S) at mesh points (i ∆t, j∆S), denoted as

( )i , jf f i t , j S= ∆ ∆

Page 6: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

6Math6911, S08, HM ZHU

The mesh for finite-difference approximation

t

S

i ∆t

j ∆S

( )i , jf f i t , j S= ∆ ∆

Smax=M∆S

T=N ∆t

?

Page 7: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

Math6911, S08, HM ZHU

Black-Scholes Equation for a European option with value V(S,t)

conditionsboundary and finalproper with Tt0 and S0 where

)1.5(021

2

222

<≤+∞<<

=−∂∂

++∂∂ rV

SVrS

SVS

tV

∂∂σ

Notes:This is a second-order hyperbolic, elliptic, or parabolic, forward or backward partial differential equationIts solution is sufficiently well behaved ,i.e. well-posed

Page 8: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

8Math6911, S08, HM ZHU

Finite difference approximations

The basic idea of FDM is to replace the partial derivatives by approximations obtained by Taylor expansions near the point 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 tt , S ,t

f S ,tf S ,t t f S ,t t O t

t

∆ →

∂ + ∆ − + ∆ −= ≈

∂ ∆ ∆∆

∂+ ∆ = + ∆ + ∆

Page 9: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

Forward-, Backward-, and Central-difference approximation to 1st order derivatives

( ) ( ) ( ) ( )

( ) ( ) ( ) ( )

( ) ( ) ( ) ( )( )2

Forward:

Backward:

Central:2

f t ,S f t t ,S f t ,SO t

t tf t ,S f t ,S f t t ,S

O tt t

f t ,S f t t ,S f t t ,SO t

t t

∂ + ∆ −≈ + ∆

∂ ∆∂ − − ∆

≈ + ∆∂ ∆

∂ + ∆ − − ∆≈ + ∆

∂ ∆

t t+ ∆tt t− ∆

centralbackward forward

Page 10: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

10Math6911, S08, HM ZHU

Symmetric Central-difference approximations to 2nd order derivatives

( ) ( ) ( ) ( )( )

( )( )2

222

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 ?

+ ∆ − ∆

+ ∆ =

+

− ∆ =

Page 11: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

11Math6911, 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 12

2

derivative, we have:

=

i , j i , j i , j i , j

i , j i , j i , j

f f f ff SS SS

f f f

S

+ −

+ −

− −⎛ ⎞∂≈ − ∆⎜ ⎟∆ ∆∂ ⎝ ⎠

− +

Page 12: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

12Math6911, S08, HM ZHU

• Depending on which combination of schemes we use in discretizing the equation, we will have explicit, implicit, or Crank-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 0 1

Boundary Conditions:0

for 0 1

where

N , j

i ,

r N i ti ,M max

max

f max j S K , , j , ,...,M

f, i , ,...,N

f S Ke

S M S.

− − ∆

= ∆ − =

=⎧⎪ =⎨= −⎪⎩

= ∆

Page 13: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

Math6911 S08, HM Zhu

5.2.1 Explicit Finite-Difference Method

Chapter 5 Finite Difference Methods

Page 14: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

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 , ji , j

f f frS S rf i t , j St S S

f fft t

f ffS S

f f ff , r f rf , S j SS S

σ

+ −

+ −

∂ ∂ ∂+ + = ∆ ∆

∂ ∂ ∂−∂

≈∂ ∆

−∂≈

∂ ∆

+ −∂≈ = = ∆

∂ ∆

Page 15: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

Math6911, S08, HM ZHU

Explicit Finite Difference Methods

( )( )

( )

1 1 1

2 2

2 2

2 2

12

1

12

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 and i N - , N - , ..., , j , , ..., M - .= =

Page 16: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

Math6911, S08, HM ZHU

Numerical Computation Dependency

x

x

x

x

t

S

i∆t

j∆S

Smax=M∆S

T=N ∆t00

(i-1)∆t

(j+1)∆S

(j-1)∆S

Page 17: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

17Math6911, 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 .− ≤ ≤ −

1 0 1 and N , N - ,Mf f .−

2N , jf −

Page 18: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

18Math6911, S08, HM ZHU

Example

We compare explicit finite difference solution 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.8446EFD Method with Smax=$100, ∆S=2, ∆t=5/1200: $2.8288EFD Method with Smax=$100, ∆S=1, ∆t=5/4800: $2.8406

Page 19: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

19Math6911, S08, HM ZHU

Example (Stability)

We compare explicit finite difference solution 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.8446EFD Method with Smax=$100, ∆S=2, ∆t=5/1200: $2.8288EFD Method with Smax=$100, ∆S=1.5, ∆t=5/1200: $3.1414EFD Method with Smax=$100, ∆S=1, ∆t=5/1200: -$2.8271E22

Page 20: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

Math6911 S08, HM Zhu

5.2.2 Numerical Stability

Chapter 5 Finite Difference Methods

Page 21: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

21Math6911, S08, HM ZHU

Numerical Accuracy

• The problem itself• The discretization scheme used• The numerical algorithm used

Page 22: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

22Math6911, 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 xy x

x x x x.

f x f x ,

well - co

δ δ

=

= +

. Otherwise, it is ill-posed/ill-conditioned. nditioned

Page 23: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

23Math6911, S08, HM ZHU

Conditioning Issue

• Conditioning issue is related to the problem itself, not to the specific numerical algorithm; Stability issue is related to the numerical algorithm

• One can not expect a good numerical algorithm to solve an ill-conditioned problem any more accurately than the data warrant

• But a bad numerical algorithm can produce poor solutions even to well-conditioned problems

Page 24: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

24Math6911, S08, HM ZHU

Conditional Issue

( ) ( )( )

( )( )

The concept "near" can be measured by further information aboutthe 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

δ−≤ ≠

Page 25: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

25Math6911, S08, HM ZHU

Floating Point Number & Error

( )

( ) xxfled

xxxx.x xflx

xx.x x x

i

ed

ed

≤≤≠±=≈

±=

: or integer boundedan :

systempoint floating theofprecision integer,an : 9,0 0, where

10 :numberpoint floating Truncated

10 :expansion decimal Infinite number. realany be Let

1

21

21

errorroundoffpoint Floating

Page 26: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

26Math6911, S08, HM ZHU

Error Propagation

( )

( )( )

00040011.0 :npropagatioError

0003.0 :errorpoint Floating3. where

10667.0 and 6667.0Let : errors.point floating theseofon accumulati

an istheredone, arenscalculatioadditionalWhen

22

0

=−

−=−=

−=−=

xxfl

xxfld

xfl x Example

Page 27: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

27Math6911, 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

− ∆ ∆

∆ ∆

Page 28: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

28Math6911, 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)

Page 29: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

29Math6911, S08, HM ZHU

Numerical Accuracy

• These factors contribute the accuracy of a numerical solution. We can find a “good” estimate 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

⎫≈ ⎪ ≈⎬≈ ⎪⎭

Page 30: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

Math6911 S08, HM Zhu

5.2.3 Financial Interpretation of Numerical Instability

Chapter 5 Finite Difference Methods

Page 31: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

Math6911, S08, HM ZHU

Financial Interpretation of instability(Hall, page 423-4)

2

1 1 1 1 1

1

11

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 , ji, j

ˆˆ ˆf a f b f c f

a

+ − + + +

∂ ∂ ∂ ∂ +

= + +

( )

2 2

2 20

2 2

11

1 111 1

1 11 1

1 2 1 0 1 2 1

1 12 2

1 1 2 2

for and

d

j

j u

t j t r jr t r t

b j tr t r t

c t j t r jr t r t

i N - , N - , ..., , j , , ..., M - .

σ π

σ π

σ π

⎛ ⎞∆ − ∆ =⎜ ⎟+ ∆ + ∆⎝ ⎠

= − ∆ =+ ∆ + ∆

⎛ ⎞= ∆ + ∆ =⎜ ⎟+ ∆ + ∆⎝ ⎠= =

Page 32: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

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 times a discount factor. If one of these probability < 0, instability occurs.

πd

π0

πu

Page 33: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

Math6911, S08, HM ZHU

Explicit Finite Difference Method as Trinomial Tree

[ ]

( ) ( )

0

2 220

Check if the mean and variance of the Expected value of the increase in asset price during t: E 0Variance 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 2 Var 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

σ σ

σ σ

= ∆ ∆ = ∆

⎡ ⎤∆ = ∆ − ∆ = ∆ − ∆ ≈ ∆⎣ ⎦

Page 34: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

34Math6911, 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

22 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 , ji , j

Z ln S.

f f fr rft Z Z

f f f f f f fr rf

t Z Z

f

σ σ

σ σ+ + + + − + + + − + +

=

⎛ ⎞∂ ∂ ∂+ − + =⎜ ⎟∂ ∂ ∂⎝ ⎠

− − − +⎛ ⎞+ − + =⎜ ⎟∆ ∆ ∆⎝ ⎠

1 1 1 1 1 5 4( )* * *i , j j i , j j i , j j i , jf f f .α β γ+ − + + += + +

Page 35: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

35Math6911, S08, HM ZHU

Change of Variable

2 2

2

22

2 2

2

11 2 2 2

1 11

11 2 2 2

3

where

It can be shown that it is numerically most efficient if

*j

*j

*j

t trr t Z Z

tr t Z

t trr t Z Z

Z t .

σ σα

β σ

σ σγ

σ

⎡ ⎤⎛ ⎞ ∆ ∆= − − +⎢ ⎥⎜ ⎟+ ∆ ∆ ∆⎝ ⎠⎣ ⎦

∆⎛ ⎞= −⎜ ⎟+ ∆ ∆⎝ ⎠⎡ ⎤⎛ ⎞ ∆ ∆

= − +⎢ ⎥⎜ ⎟+ ∆ ∆ ∆⎝ ⎠⎣ ⎦

∆ = ∆

Page 36: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

36Math6911, S08, HM ZHU

Reduced to Heat Equation

Get rid of the varying coefficients S and S² by using change of variables:

Equation (5.1) becomes heat equation (5.5):

( ) ( ) ( ) ( )

⎟⎠⎞

⎜⎝⎛=

=−==+−−−

2

1411

21

2

21

,,,2,2

σ

τσττ

rk

xueEtSVTtEeSkxkx

2

2 (5.5)

for and 0

u ux

x

∂ ∂∂τ ∂

τ

=

− ∞ < < +∞ >

Page 37: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

Math6911, S08, HM ZHU

( )

( )( )

( )( )( ) ( )( )

( )

( ) ⎟⎟⎟⎟

⎜⎜⎜⎜

==≤≤=

+−+=

++−

=+−

=

+−

−++

−++

δτ

T,...M,mNn-N

uuuu

δxOδτO

δxOδx

uuuδτO δτ

uu

x,mδnuu

mn

mn

mn

mn

mn

mn

mn

mn

mn

mn

2

2

111

2

22

111

21

10 and for ,x

where

21by this

eapproximatcan we, and of termsIgnoring

2

:form theof equations difference finite of system a solving involves this,With

σ

δδτα

ααα

τδ

Explicit Finite Difference Method

Page 38: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

38Math6911, S08, HM ZHU

Stability and Convergence(P. Wilmott, et al, Option Pricing)

( )2

1 ,2

: The solution of Eqn (5.5) is

1 1 i) 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

Page 39: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

Math6911 S08, HM Zhu

5.3.1 Implicit Finite-Difference Method

Chapter 5 Finite Difference Methods

Page 40: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

Math6911, S08, HM ZHU

Implicit Finite Difference Methods

22 2

2

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 ji , j

f f frS S r ft S S

f fft t

f ffS S

f f ff , rf rfS S

σ

∂∂

∂∂

∂∂

+

+ −

+ −

∂ ∂ ∂+ + =

∂ ∂ ∂−

≈∆

−≈

+ −≈ =

forward

Page 41: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

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 1 and i N - , N - , ..., , j , , ..., M - .= =

Page 42: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

Math6911, S08, HM ZHU

Numerical Computation Dependency

x

x

x

x

t

S

i∆t

j∆S

Smax=M∆S

T=N ∆t00

(i-1)∆t

(j+1)∆S

(j-1)∆S

(i+1)∆t

Page 43: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

Implementation

( )1

1 2 3 1 1 0 1

Equation (5.6) can be rewritten in matrix form:5 7

where and are ( 1) dimensional vectors

0 0 0

and is ( 1) ( 1) symmetric

i i i

i iT 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 bf b

f b

C

1 1

2 2 2

3 3

2

1 1

matrices0 0

0 0

0 0M

M M

b ca b c

a bc

a b−

− −

⎡ ⎤⎢ ⎥⎢ ⎥⎢ ⎥=⎢ ⎥⎢ ⎥⎢ ⎥⎣ ⎦

C

Page 44: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

44Math6911, S08, HM ZHU

Implementation

1. Starting with the final values , we need to solve a linear system (5.7) to obtain using LU factorization or iterative methods. We use the boundary condition to determine

2. Repeat the process to determine and so on

N , jf1 for 1 1N , jf j M− ≤ ≤ −

1 0 1 and N , N - ,Mf f .−

2N , jf −

Page 45: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

45Math6911, S08, HM ZHU

Example

We compare implicit finite difference solution 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.8446IFD Method with Smax=$100, ∆S=2, ∆t=5/1200: $2.8194IFD Method with Smax=$100, ∆S=1, ∆t=5/4800: $2.8383

Page 46: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

46Math6911, S08, HM ZHU

Example (Stability)

We compare implicit finite difference solution 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.8846IFD Method with Smax=$100, ∆S=2, ∆t=5/1200: $2.8288IFD Method with Smax=$100, ∆S=1.5, ∆t=5/1200: $3.1325IFD Method with Smax=$100, ∆S=1, ∆t=5/1200: $2.8348

Page 47: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

Math6911, S08, HM ZHU

Implicit vs Explicit Finite Difference Methods

ƒi +1, jƒi , 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

Page 48: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

48Math6911, S08, HM ZHU

Implicit vs Explicit Finite Difference Method

• The explicit finite difference method is equivalent 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

Page 49: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

Math6911, S08, HM ZHU

Other Points on Finite Difference Methods

• It is better to have ln S rather than S as the 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

Page 50: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

Math6911 S08, HM Zhu

5.3.2 Solving a linear system using direct methods

Chapter 5 Finite Difference Methods

Page 51: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

51Math6911, S08, HM ZHU

Solve Ax=b

A x=b

Various shapes of matrix A

Lower triangular Upper triangular General

Page 52: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

Math6911 S08, HM Zhu

5.3.2.A Triangular Solvers

Page 53: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

53Math6911, S08, HM ZHU

Example: 3 x 3 upper triangular system

⎥⎥⎥

⎢⎢⎢

⎡=

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

2010

100

400110164

3

2

1

xxx

46565*61004

51054/20

1

231

32

3

=∴=−−=⇒

=−=⇒==⇒

xxxx

xxx

Page 54: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

54Math6911, S08, HM ZHU

Solve an upper triangular system Ax=b

( )

1,1,

,,1,00 2

1

−=⎟⎟⎠

⎞⎜⎜⎝

⎛−=

=⇒

==+=

⎟⎟⎟⎟⎟

⎜⎜⎜⎜⎜

>

>

niaxabx

abx

nibxaxa

x

xx

aa

iiij

jijii

nnnn

iij

jijiii

n

inii …

Page 55: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

55Math6911, 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

Page 56: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

Math6911 S08, HM Zhu

5.3.2.B Gauss Elimination

Page 57: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

57Math6911, 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

Page 58: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

58Math6911, 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

01001

aaaa

aaaa

aaa

aaa

aaaaaaaaa

aa

⇓E 21A

Page 59: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

59Math6911, 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 1131

31 32 33 31 12 31 1311 32 33

11 11

1 0 00 1 0 0 0

0 10

a a a a a aa a a aa a a aa a a a

a a a aa

a a a a a a aa a aa a

⎡ ⎤⎡ ⎤ ⎢ ⎥⎡ ⎤⎢ ⎥ ⎢ ⎥⎢ ⎥⎢ ⎥ ⎢ ⎥⎢ ⎥− − = − −⎢ ⎥ ⎢ ⎥⎢ ⎥⎢ ⎥ ⎢ ⎥⎢ ⎥⎢ ⎥ ⎢ ⎥− ⎢ ⎥⎣ ⎦⎢ ⎥ − −⎢ ⎥⎣ ⎦

⎣ ⎦

11 12 13

22 23

32 33

00

= a a a

a aa a

⎡ ⎤⎢ ⎥⎢ ⎥⎢ ⎥⎣ ⎦

⇓E 31 E 21A

Page 60: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

60Math6911, 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 00 1 0 0 0

00 1 0 0

a a a a a aa a a a

a a a a aaa a

⎡ ⎤ ⎡ ⎤⎢ ⎥ ⎢ ⎥⎡ ⎤⎢ ⎥ ⎢ ⎥⎢ ⎥ = ≡⎢ ⎥ ⎢ ⎥⎢ ⎥⎢ ⎥ ⎢ ⎥⎢ ⎥⎣ ⎦⎢ ⎥ ⎢ ⎥− −⎢ ⎥ ⎢ ⎥⎣ ⎦ ⎣ ⎦

U

32a

⇓E 32 E 31 E 21A = U

⇓lower triangular

Page 61: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

61Math6911, S08, HM ZHU

Gauss Elimination = *

Claim 1: 21

32 31 2111

31 32

11 22

1 0 0

1 0

1

aaa aa a

⎡ ⎤⎢ ⎥⎢ ⎥⎢ ⎥

= −⎢ ⎥⎢ ⎥⎢ ⎥

− −⎢ ⎥⎣ ⎦

E E E

Claim 2:

( ) 1 2132 31 21

11

31 32

11 22

1 0 0

1 0

1

aaa aa a

⎡ ⎤⎢ ⎥⎢ ⎥⎢ ⎥

= ⎢ ⎥⎢ ⎥⎢ ⎥⎢ ⎥⎣ ⎦

E E E

Page 62: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

62Math6911, S08, HM ZHU

LU Factorization = *

Therefore, through Gauss Elimination, we have

E 32 E 31 E 21A = U

A = E 32 E 31 E 21( )−1U

A = LU

It is called LU factorization. When A is symmetric,

which is called Cholesky DecompositionT=A LL

Page 63: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

63Math6911, S08, HM ZHU

To solve Ax=b for general form A

To solve Ax = b becomes

1) Use Gauss elimination to make A upper triangular, i.e.

L−1Ax = L−1b ⇒ 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.

Page 64: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

64Math6911, S08, HM ZHU

An exercise

⎥⎥⎥

⎢⎢⎢

⎡=

⎥⎥⎥

⎢⎢⎢

⎥⎥⎥

⎢⎢⎢

−−−

400

21121

12

3

2

1

xxx

% 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 = ux z = l\b;

% solve x from ux = z x = u\z

Page 65: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

65Math6911, S08, HM ZHU

General Gauss Elimination

row i

row j -a ji

aii

∗row i

Page 66: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

66Math6911, S08, HM ZHU

What if we have zero or very small diagonal elements?

LUPA

LUA

PA

A

=⎥⎦

⎤⎢⎣

⎡⎥⎦

⎤⎢⎣

⎡=⎥

⎤⎢⎣

⎡⎥⎦

⎤⎢⎣

⎡=

=⎥⎦

⎤⎢⎣

⎡⎥⎦

⎤⎢⎣

⎡=⎥

⎤⎢⎣

⎥⎦

⎤⎢⎣

⎡=⎥

⎤⎢⎣

⎡⎥⎦

⎤⎢⎣

⎡=

⎥⎦

⎤⎢⎣

.9999011

10.000101

1110.0001

0110

9999-010.0001

110,00001

1110.0001

=

1032

3210

0110

3210

=

exampleFor pivoting. partial

called is This LU.=PA i.e., stably, computedor computed becan neliminatio Gauss that soA of rows permute toneed weSomtimes,

Page 67: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

67Math6911, S08, HM ZHU

Can we always have A = LU?

( )( )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

Page 68: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

Math6911 S08, HM Zhu

Chapter 5 Finite Difference Methods

5.4.1 Crank-Nicolson Method

Page 69: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

Math6911, S08, HM ZHU

Explicit Finite Difference Methods

( )

( )

( )( )

22 2

2

1

21 1 1 1 1 1 1 1 12 22

21

12

212 2

W ith ,

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 rft S S

f fO t

tf f f f f

rj S j SS S

rf O S

σ

σ

+

+ + + − + + + − +

+

∂ ∂ ∂+ + =

∂ ∂ ∂

−+ ∆ =

∆− + −

− ∆ − ∆∆ ∆

+ + ∆

Page 70: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

Math6911, S08, HM ZHU

Implicit Finite Difference Methods

( )

( )

( )( )

22 2

2

1

21 1 1 12 22

2

12

212 2

W ith ,

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 ft S S

f fO t

tf f f f f

rj S j SS S

rf O S

σ

σ

+

+ − + −

∂ ∂ ∂+ + =

∂ ∂ ∂

−+ ∆ =

∆− + −

− ∆ − ∆∆ ∆

+ + ∆

Page 71: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

Math6911, S08, HM ZHU

Crank-Nicolson Methods: average of explicit and implicit methods(Brandmarte, p485)

( )( )

( )

( ) ( )( )

21

1 1 1 1 1 1

2 1 1 1 1 1 1 12 22 2

21

2 2 2

2 214

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 fO t

tf f f frj S

S S

f f f f f fj S

S Sr f f O S

σ

+

+ + + − + −

+ + + − + + −

+

−+ ∆ =

∆− −⎛ ⎞∆

− +⎜ ⎟∆ ∆⎝ ⎠+ − + −⎛ ⎞

− ∆ +⎜ ⎟∆ ∆⎝ ⎠

+ + + ∆

Page 72: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

Math6911, S08, HM ZHU

Crank-Nicolson Methods

( )( )

( )

1 1

1 1 1 1 1

2 2

1

1

R ew riting the equa tion , w e ge t an C rank-N ico lson schem e:

(5 .5 )

w here

=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

t j rj

α β γ

α β γ

α σ

β

− +

+ − + + +

− + − − =

+ + +

∆−

= − ( )

( )

2 2

2 2

2

1 2 1 0 1 2 1

4

fo r and

j

t j r

t j rj

i N - , N - , ..., , j , , ..., M - .

σ

γ σ

∆+

∆= +

= =

Page 73: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

Math6911, S08, HM ZHU

Numerical Computation Dependency

x

x

x

x

t

S

i∆t

j∆S

Smax=M∆S

T=N ∆t00

(i-1)∆t

(j+1)∆S

(j-1)∆S

(i+1)∆t

x

x

x

x

Page 74: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

Implementation

( ) ( )

1 2 1

1 2 3 1

1 0 1 0 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 iT

i 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 bf b

f

b

M M

1 1

2 2 2

1 3

2

1 1

1 11 0 0

1 00

0 0 1

) ( ) symmetric matrices

M

M M

Mβ γ

α β γα

γα β

− −

× −

− −⎡ ⎤⎢ ⎥− −⎢ ⎥⎢ ⎥=⎢ ⎥−⎢ ⎥⎢ ⎥− −⎣ ⎦

M

Page 75: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

75Math6911, S08, HM ZHU

Implementation

1 1

2 2 2

2 3

2

1 1

and 1 0 0

1 00

0 0 1M

M M

β γα β γ

αγ

α β−

− −

+⎡ ⎤⎢ ⎥+⎢ ⎥⎢ ⎥=⎢ ⎥⎢ ⎥⎢ ⎥+⎣ ⎦

M

Page 76: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

76Math6911, S08, HM ZHU

Example

We compare Crank-Nicolson Methods 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.8446CN Method with Smax=$100, ∆S=2, ∆t=5/1200: $2.8241CN Method with Smax=$100, ∆S=1, ∆t=5/4800: $2.8395

Page 77: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

77Math6911, S08, HM ZHU

Example (Stability)

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.8446CN Method with Smax=$100, ∆S=1.5, ∆t=5/1200: $3.1370CN Method with Smax=$100, ∆S=1, ∆t=5/1200: $2.8395

Page 78: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

78Math6911, S08, HM ZHU

Example: Barrier Options

Barrier options are options where the payoff depends on whether the underlying asset’s price reaches a certain level during a certain period of time.

Types: knock-out: option ceases to exist when the asset price reaches a barrierKnock-in: option comes into existence when the asset price reaches a barrier

Page 79: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

79Math6911, S08, HM ZHU

Example: Barrier Option

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?

Page 80: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

80Math6911, S08, HM ZHU

Example: Barrier Option

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.5424CN Method with Smax=$100, ∆S=0.5, ∆t=1/1200: $0.5414

( ) ( )0 0 and max bf t ,S f t ,S= =

Page 81: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

Math6911 S08, HM Zhu

Appendix A.

Matrix Norms

Page 82: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

82Math6911, S08, HM ZHU

Vector Norms

( )

??, ?, 3]. 1- 4 [2 example,For

max

normEuclidean theis 2p

norm a define to ways variousare There -any for

any for

0 iff 0 ;any for 0

s.t. number real a to mappingfunction a is normA vector -matrix aor vector a oflength themeasure way toa as serve Norms -

21

1

1

1

n

====−

=⎟⎠

⎞⎜⎝

⎛≡

ℜ∈+≤+•

ℜ∈=•

==≠>•

ℜ∈

≤≤∞

=∑

vvvv

x

x

yxyxyx

xx

xx0xx

xx

ini

pn

i

pip

n

x

x

,

ccc

Page 83: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

Matrix Norms

( )( ) { }BB

AAA

AA

Ax

AxA

BABABA

AA

0A0A0AA

AA

x

of eigenvaluean is :max

wherenorm, spectral the,

maxmax

sup

normsmatrix usedcommonly Various -any for

any for

iff ;any for 0

s.t. number real a to mappingfunction a is normmatrix a Similarly, -

2

11111

21

1 1

2

0

nm

kk

T

n

jij

mi

m

iij

nj

m

i

n

jijF

p

pp

nm

aa

a

,

ccc

λλρ

ρ

≡≡

⎟⎟⎠

⎞⎜⎜⎝

⎛≡≡

ℜ∈+≤+•

ℜ∈=•

==≠>•

ℜ∈

∑∑

∑∑

=≤≤∞

=≤≤

= =≠

×

×

Page 84: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

84Math6911, S08, HM ZHU

An Example

??

??

132513142

1

2

==

==

⎥⎥⎥

⎢⎢⎢

−−

−=

FAA

AA

A

Page 85: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

85Math6911, S08, HM ZHU

Basic Properties of Norms

.5

.4

number real a is where .3

.2

0 and ;0 .1Then . and Let

BABA

xAAx

xx

yxyx

0xxxyx,B A,

=

+≤+

=⇔=≥

ℜ∈ℜ∈ ×

ααα

nnn

Page 86: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

86Math6911, S08, HM ZHU

Condition number of a square matrix

( )n m n

n n1 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 .

α β

α β α

×

− ×

ℜ ℜ • •

ℜ ∃ > ∈ℜ

≤ ≤

≡ ∈ℜ

xx 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

Page 87: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

87Math6911, S08, HM ZHU

- vectors xk converges to x ⇔ xk − x converges to 0

- matrix Ak → 0 ⇔ A k − 0 → 0

Convergence

Page 88: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

Math6911 S08, HM Zhu

Appendix B.

Basic Row Operations

Page 89: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

89Math6911, S08, HM ZHU

Basic row operations = *

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

⎢ ⎢ ⎢

⎥ ⎥ ⎥

Page 90: Chapter 5 Finite Difference Methods - YorkU Math and Statsmath.yorku.ca/~hmzhu/Math-6911/lectures/Lecture5/5_BlkSch_FDM.pdf · Math6911 S08, HM Zhu 5.1 Finite difference approximations

90Math6911, S08, HM ZHU

Basic row operations = *

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 −a13

a31 a32 a33

⎢ ⎢ ⎢

⎥ ⎥ ⎥