DPRA Financial Mathematics

Page 1

Financial Mathematics “Workhorse” Routines: Methods, Derivations, and Results used by Derivative Product Risk Advisors∗

David Schwartz† Managing Director Derivative Product Risk Advisors http://DerivativeProductsRiskAdvisors.blogspot.com/ (646) 450–0438 T davids.dpra@gmail.com k Draft 2.1 March 1, 2010

c Copyrighted 2010. This document is confidential and no part of it may be distributed in any fashion without the written permission of David Schwartz of Derivative Product Risk Advisors Inc. The body of this document is 7 inches by 8.8 inches, slightly larger than the default Adobe pdf body size for 8 12 × 11 inch paper, and it is suggested to avoiding using “size to fit” when printing. † I alone am responsible for any errors, omissions, or typos in this document. I would be grateful to receive notice of such through the email address provided.


Executive Summary

Co nfi Dr den a Pr ft 2 tia l o . p 1 of e r DP ty RA

Draft 2.1 of this document provides detailed descriptions, derivations, and explanations of the finite difference, generalized European payout function, and some other “workhorse” mathematics used for financial valuation and risk management by Derivative Product Risk Advisors.1 The methods, approaches, and functions described within this document have generally been implemented and checked multiple times by multiple teams of financial engineering professionals. They are believed to be mathematically correct; nevertheless, they are offered and described here only on a “best efforts basis.”2 Their appropriateness or usefulness is constrained by the assumptions and models they are used within. “It is better to be roughly right than precisely wrong.”

John Maynard Keynes.

Readers are warned: this memo deals with tools that are useful in financial modeling, but, as with all tools, these tools can never provide more insight or value than the models and assumptions they are used with. Good models with reasonable and reliable assumptions are necessary for these tools to be of use.3 Look at multiple models. Dare to question the assumptions. Assume in the long run something is going to go wrong – in financial modeling usually at least one assumption catastrophically fails to be true with alarming frequency and very high costs. Expect things will occasionally behave in unexpected ways. Here’s one useful rule of thumb: there are very few fields in which every single practitioner is an idiot. If your understanding of a field is such that all practitioners of it must be idiots, then probably you’re not understanding it correctly. Ted Rosencrantz in Bayesians versus non-Bayesians.

This rule applies to financial markets as well as to “hard sciences” like physics, chemistry, and engineering; however, the cost to an individual of being wrong along with the pack in the hard sciences is generally much lower than the cost in financial markets. In financial markets, the small chance of (a near) unanimous error is coupled with the potential enormous (individual) cost that mandates spending significant time and resources looking at extreme what-ifs and worst-case scenarios.

1

c Copyrighted 2010. This document is confidential and no part of it may be distributed in any fashion without the written permission of David Schwartz of Derivative Product Risk Advisors Inc. 2 I, David Schwartz, alone am responsible for any errors, omissions, or typos in this document. I would be grateful to receive notice of such through the email address davids.dpra@gmail.com. 3 Good models with reasonable and reliable assumptions are necessary, but not necessarily sufficient for these tools to be helpful or add value.


Contents Glossaries

G1.1

Acronyms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . G1.1

G2

Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . G2.1

Co nfi Dr den a Pr ft 2 tia l o . p 1 of e r DP ty RA

G1

G3

Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . G3.1

G4

Mathematical Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . G4.1

G5

Shift, Difference, and Derivative Operators

G6

Finance Functions and Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . G6.1

. . . . . . . . . . . . . . . . . . . . . . . . . . . G5.1

Introduction

1

1 Finite Difference: Time Schemes — The LHS

3

1.1

1.2

First Order Time Schemes: Forward & Backward Euler . . . . . . . . . . . . . . . . . . . .

3

1.1.1

Forward Euler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

3

1.1.2

Backward Euler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

3

Second Order Time Scheme . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

4

2 Second Order Time Scheme’s Reconciliation With Spatial Side

4

3 Finite Difference: Second Order Spatial Scheme — The RHS

5

3.1

3.2

First Order Time (Forward Euler) and Second Order Spatial Scheme . . . . . . . . . . . . .

6

Forward Euler Second Order Spatial Equation 3.1:2 . . . . . . . . . . . . . . . . . .

6

Second Order Time and Second Order Spatial Scheme . . . . . . . . . . . . . . . . . . . . .

7

Second Order Time and Spatial Equation 3.2:2 — Crank-Nicholson . . . . . . . . . .

7

4 Finite Difference: Fourth Order Spatial Scheme — The RHS 4.1

4.2

7

First Order Time and Fourth Order Spatial Scheme — Forward Euler . . . . . . . . . . . .

15

Forward Euler Fourth Order Spatial Scheme Equation 4.1:2 . . . . . . . . . . . . . .

15

Second Order Time and Fourth Order Spatial Scheme — Douglas . . . . . . . . . . . . . . .

15

–i–


4.3

Second Order Time and Fourth Order Spatial Scheme Equation 4.2:3 — Douglas . .

16

Spatially Constant Coefficient PDE Fourth Order Schemes . . . . . . . . . . . . . . . . . . .

16

Co nfi Dr den a Pr ft 2 tia l o . p 1 of e r DP ty RA

Useful Mathematical Equivalences, Relationships, Approximations in Finance 17 5 Creating Generalized European Payouts With Simple European Calls And Puts

17

6 Efficient, High Accuracy Routines for N (α) and Q(α)

19

6.1

Power Series: A&S’s Equation 26.2.11 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

20

6.1.1

Calculating S0,m . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

21

Continued Fraction: A&S’s Equation 26.2.14 . . . . . . . . . . . . . . . . . . . . . . . . . .

21

6.2.1

Calculating gm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

21

Table 1: Remaining Normal Function Q for αi = 0, 1/8, 1/4, 3/8, . . . , 2 7/8, and 3 . . . . . . . . .

22

Table 2: Remaining Normal Function Q for αi = 3, 3 1/8, 3 1/4, . . . , 4 7/8, and 5 . . . . . . . .

23

6.3

g(α) and its Derivatives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

23

Table 3: g Function for αi = 0, 1/8, 1/4, 3/8, . . . , 4 7/8, and 5 . . . . . . . . . . . . . . . . . . . .

24

6.4

Calculating N (α) and Q(α) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

24

6.4.1

Examples of Calculating N (α) and Q(α) . . . . . . . . . . . . . . . . . . . . . . . .

25

Table 4: Approximations gn (1.1875) of g(1.1875) for n = 0, 1, 2, . . . , 10 . . . . . . . . . . . .

25

Table 5: Approximations gn (6) of g(6) for n = 5, 10, 15, 20, 25, and 50 . . . . . . . . . . . .

26

6.2

7 Calculating N −1 (β) and Q−1 (β)

26

7.1

Aside: Calculating Inverses of Known Functions . . . . . . . . . . . . . . . . . . . . . . . . .

27

7.2

Examples of Calculating N −1 (β) and Q−1 (β) . . . . . . . . . . . . . . . . . . . . . . . . .

28

8 Calculating the Modified Bessel function (of the first kind) — CEV model

29

A Finite Difference Operators Relationships

30

A.1 Hildebrand On Finite Difference Operators . . . . . . . . . . . . . . . . . . . . . . . . . . .

30

A.1.1 Finite Difference Operators Commutative, Distributive, and Associative Properties .

30

– ii –


. . . . . . . . . . . . . . . . . . . . . . . .

31

A.2 Finite Difference Operators on Products . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

32

A.3 Taylor-Like Expansions Using Finite Difference Operators . . . . . . . . . . . . . . . . . . .

32

A.3.1 Taylor-Like Expansion of D Using Finite Difference Operators . . . . . . . . . . . .

33

Co nfi Dr den a Pr ft 2 tia l o . p 1 of e r DP ty RA

A.1.2 Finite Difference Operators Equivalences

B Continued Fractions

37

Bibliography

38

– iii –


Glossaries G1

Acronyms

A&S . . . . . . . . . . . . . . . . . . . . Milton Abramowitz and Irene A. Stegun’s [AS72]

Co nfi Dr den a Pr ft 2 tia l o . p 1 of e r DP ty RA

CN . . . . . . . . . . . . . . . . . . . . . Crank-Nicholson finite difference scheme DPRA . . . . . . . . . . . . . . . . . . . Derivative Product Risk Advisors FD . . . . . . . . . . . . . . . . . . . . . finite difference

PDE . . . . . . . . . . . . . . . . . . . . partial differential equation

– G1.1 –


G2

Sets

Sets of Functions: set of n-times continuously differentiable functions: i.e. f ∈ Cn ⇔ dn f /dxn ∈ C0 . Note that C is sometimes referred to as C0 as C and C1 are not the same. set of polynomial functions of degree ≤ n : def Pn = f : f (α) = β n αn + β n−1 αn−1 + · · · + β 1 α1 + β 0 α0 .

Co nfi Dr den a Pr ft 2 tia l o . p 1 of e r DP ty RA

Cn Pn

Sets of Numbers:

Z

set of integer numbers: {. . . , −2, −1, 0, +1, +2, . . .}.

I

R D

Z

Z

def

R

def

index set of non-negative : I(i) = {0, 1, 2, . . . , n(i) − 1}. set of positive integer numbers: {1, 2, 3, . . .}. + range of a function. domain: the set a given function is defined on. “f (α) is defined for α ∈ D.” For example,

R R

R

f (α) = α2 /α = α for α ∈ − {0} so Df = {β : β ∈ set of real numbers: (−∞, +∞). set of positive real numbers: (0, +∞). + set of non-negative real numbers: [0, +∞). 0+

– G2.1 –

R, β 6= 0}.


G3

Variables

Co nfi Dr den a Pr ft 2 tia l o . p 1 of e r DP ty RA

Unless otherwise noted: 1) vectors, ordered sets, and series will be treated and denoted identically; 2) vectors will be denoted with lowercase boldface variables and their elements with the same variables, singleindexed, in normal face; and 3) matrices will be denoted with uppercase bold variables and their elements with the same uppercase variables, double-indexed, in normal face. Exceptions include volatility matrices which will be denoted as ΣΣT with elements ρi,j σi σj to conform to normal statistical notation. General real variables used for spatial, state, time, or other quantities: α, α, A s, S

β, β, B ζ, ζ, Z

h, ht , hx ei

general spatial, time, or other scalar, vector, or matrix, respectively: def def α = hα0 , α1 , . . . , αn−1 i and A = (Ai,j )i,j . general element and “sum” or net, respectively. For example: def P def R S = i si or S = s(α) dα general spatial, time, or other scalar, vector, or matrix, respectively: def def β = hβ 0 , β 1 , . . . , β n−1 i and B = (Bi,j )i,j . general spatial, time, or other scalar, vector, or matrix, respectively: def def ζ = hζ 0 , ζ 1 , . . . , ζ n−1 i and Z = (Hi,j )i,j . general, time, and spatial shift and difference operators’ step sizes, respectively, all ∈ def normalized basis vector i: ei = hδ i,j ij .

Spatial And State Variables: ξ, ξ, Ξ

x, x, X

general spatial or state scalar, vector, or matrix, respectively: def def ξ = hξ 0 , ξ 1 , . . . , ξ n−1 i and Ξ = (Ξi,j )i,j . general spatial or state scalar, vector, or matrix, respectively: n(i) −1 def x = hxi ii=0 = hxi ii∈I(i) = hxi i = hx0 , x1 , . . . , xn−1 i and def

y, y, Y

z, z, Z

X = (Xi,j )hi,ji∈I(i) ×I(j) = (Xi,j )i,j = (Xi,j ). general spatial or state scalar, vector, or matrix, respectively: def def y = hy 0 , y 1 , . . . , y n−1 i and Y = (Yi,j )i,j . general spatial or state scalar, vector, or matrix, respectively: def def z = hz 0 , z 1 , . . . , z n−1 i and Z = (Zi,j )i,j .

Time Variables: T t0 t1 t

time time time time

of expiration or maturity. variable t0 . variable t1 . variable.

Index Variables: i, n(i) j, n(j) k, n(k) l, n(l)

general index variable i and n(i) the cardinality of {i}. general index variable j and n(j) the cardinality of {j}. spatial index variable k and n(k) the cardinality of {k}. general index variable l and n(l) the cardinality of {l}.

– G3.1 –

R+.


general index variable m and n(m) the cardinality of {m}. spatial index variable m and n(m) the cardinality of {m}. number of spatial dimensions. number of terms in expansion of time element(s). number of terms in expansion of spatial element(s). general cardinality of a vector or range of an index variable.

Co nfi Dr den a Pr ft 2 tia l o . p 1 of e r DP ty RA

m, n(m) m, n(m) ns nt nx n

Finance variables: r µ, µ

σ, σ, ΣΣT

d, d

dO O CE PE

r (x, t) is time t instantaneous short-rate in state x. µ is the time drift of the state variable(s) impacting r: dx = µ (x, t) dt + Σ (x, t) dWt . Note that x could simply be r. def volatility variables with the non-standard notation that ΣΣT = {ρi,j σi σj }i,j where dx = µ (x, t) dt + Σ (x, t) dWt . Note that x could simply be r. dividend rate per unit time of underlying asset variable(s). Should be zero for state variables. dividend per unit time of derivative product itself. “derivative” financial asset value. European call asset value: CE (z(t) , k; t, T ) is the time t value of an asset with zero distributions on [t, T ] and final time T value or payout of (z − k) θ(z − k). European put asset value: PE (z(t) , k; t, T ) is the time t value of an asset with zero distributions on [t, T ] and final time T value or payout of (k − z) θ(k − z).

– G3.2 –


G4

Mathematical Definitions

Mathematical Acronyms: left hand side right hand side such that with respect to

Co nfi Dr den a Pr ft 2 tia l o . p 1 of e r DP ty RA

LHS RHS s.t. w.r.t.

Equivalence Symbols & Notation: O(hn )

Of or within order O(hn ):

f (x, h) = g(x, h) + O(hn )

�⇒

∃K < ∞, δ(K) > 0 s.t. |f (x, h) − g(x, h) | ≤ Khn , ∀h ∈ (0, δ(K)].

p

=

Einstein/Physics summation notation:

i

p

f (i) + Îą = g(i) + β â‡?⇒ Îą + i

p

f (i) + Îą = g(i) + β â‡?⇒ Îą + i:n

=

T

A

X

i n X

g(i)

g(i)

i=0

f (i) = β +

i=n1

n2 X

g(i)

i=n1

Equal by definition or equivalent (aka ≥)

Matrix Operations: tr {A}

f (i) = β +

g(i) + β â‡?⇒ Îą +

=

i:[n1 ,n2 ]

def

i n X

f (i) = β +

i=0 n2 X

p

f (i) + Îą

X

For clarity, notations below will be applied to a general matrix A = (Ai,j )i,j : def

Trace of matrix A: tr {A} = T

Pn(i)

i=1 ai,i

def

Transpose of matrix A: A = (aj,i )i,j

General Mathematics Functions: CF

CF(A, B; ) is a generalized continued fraction for coefficients {ai }i and {bi }i with “remainder� . Using the notation of Section B:1 on page 37 we have: def

CFi;j ( ) = CFi;j (A, B; ) =

aj−1 aj ai ai+1 ¡¡¡ bi + bi+1 + bj−1 + bj +

j≼i∈

Z+.

(G4:1)

Note that this definition requires b0 = 0. If A, B are infinite vectors or series of numbers and the below limit exists, then: def

CF = lim CF1;l (A, B; 0) l→∞

– G4.1 –

(G4:2)


and finally note that: CFi;j (A, B; ) = CFi;m (A, B; CFm+1;j (A, B; ))

j≼m>i∈

Z+.

(G4:3)

Co nfi Dr den a Pr ft 2 tia l o . p 1 of e r DP ty RA

Step and Impulse Functions: ( 1 i=j = . 0 otherwise

δi,j

Kronecker delta function: δ i,j

δ(Ξ)

Dirac delta (generalized) function: The Dirac delta function is not strictly a function. It is a generalized function, the limit of a series of functions. The concept is that δ(Ξ) is zero for Ξ 6= 0 and so large at Ξ = 0 that its integral is 1. A well known limiting series of functions for δ(Ξ) is {n(Ξ/Îą) /Îą}Îą as Îą → 0+ . This gives us: Z

b

f (Ξ) δ(Ξ) dΞ =f (0) (θ(b) − θ(a))

(G4:4)

a

Z

b

1 f (Ξ) δ(ιΞ âˆ’ β) dΞ = f (β/Îą) (θ(Îąb − β) − θ(Îąa − β)) Îą a

Z X

∂g(z) −1

f (Ξ) δ(g(Ξ)) dΞ =

∂z f (z) D z∈{x:x∈D∧ g(x)=0 }

Z

b

f (Ξ)

a

θ(Ξ)

n ∂ n δ(Ξ âˆ’ β) n ∂ f (β) dΞ = (−1) (θ(b − β) − θ(a − β)) . âˆ‚Ξ n âˆ‚Ξ n

  1

(G4:5) (G4:6)

(G4:7)

if Ξ > 0 Theta step function: θ(Ξ) = if Ξ = 0 θ is the integral of Dirac delta (generalized)  0 if Ξ < 0 function δ and the (generalized) derivative of θ is δ. 1 2

– G4.2 –


Statistical Functions: n(ξ)

Standard unit normal or Gaussian probability density function: 1 2 def n(ξ) = √ e−ξ /2 . 2π

Co nfi Dr den a Pr ft 2 tia l o . p 1 of e r DP ty RA

(G4:8)

N (ξ)

Cumulative standard normal or Gaussian probability function: 1 N (ξ) = √ 2π def

Q(ξ)

g(ξ)

Z

ξ

e−z

2 /2

dz.

(G4:9)

−∞

Remaining standard normal or Gaussian probability function: Z ∞ 1 2 def Q(ξ) = √ e−z /2 dz = N (−ξ) = 1 − N (ξ) . 2π ξ

(G4:10)

Ratio of remaining standard normal or Gaussian probability function Q to n: def

g(ξ) =

– G4.3 –

Q(ξ) . n(ξ)

(G4:11)


G5

Shift, Difference, and Derivative Operators

Co nfi Dr den a Pr ft 2 tia l o . p 1 of e r DP ty RA

Operators apply to functions rather than variables. To help clarify that operator L applies to functions rather than variables, square brackets (“[·]”) rather than rounded parentheses (“(·)”) will be used to indicate what L is operating on when notation requires. For example, L [f (x)]. Often such notation is redundant and simply Lf will be used. In both cases, x is simply a dummy variable but when f is a function of more than one variable or L is a function of another variable or parameter z, the notation z Lx [f (x, y)] will mean the parameter z version of L applied to f ’s x variable. Unless otherwise specified, parameter z will (default to) be h. Additionally, combinations of these operators will be grouped in curly brackets (“{·}”) to the left def

of the function they are operating on. For example, {L1 + L2 } f = L1 f + L2 f . Unless indicated by [·], L operates only on the function (or vector/array) immediately after it: L1 u v = (L1 u) v = vL1 u. Finally, note that all shift and difference operators can be represented as linear combinations of the forward shift operator taken to various, possibly non-integer, powers. Note: L [f g] 6≡ (L [f ])(L [g]) = (Lf )(Lg). L General Operator L−1 “Inverse” Operator of L. L−1 is the operator that inverts, to within the applicable equivalence set, L. Shift Operators: def E Forward Shift Operator: h Eαi [f (α)] = f (α + hei ). Generally, h Eβ [f (α)] = f (α + βh) def

def

E−1 Backward Shift Operator: h E−1 αi [f (α)] = f (α − hei ) and E [f (α)] = f (α − h) def

1

def

Identity Shift Operator: h 1αni [f (α)] = f (α) o andn1f (α) = f (α) o 1 def 1 − 21 2 µ Average Operator: h µ = 2 h E + h E = 12 h E + h E−1 so 2 2 o n 1 1 def 1 µf = 2 E 2 + E− 2 f and µα [f (α, β)] = 12 (f (α + h/2, β) + f (α − h/2, β)) def A Double Average Operator: h A = 2h µ = 21 h E + h E−1 and A = 1 + 12 δ 2 so def 1 Af = 2 E + E−1 f and Aα [f (α, β)] = 12 (f (α + h, β) + f (α − h, β)) Finite Difference Operators: def ∆ Forward Difference Operator: h ∆ = h E1 − h E0 = h E − h 1 so def ∆f = {E − 1} f and ∆α f (α, β) = f (α + h, β) − f (α, β) def

Backward Difference Operator: h ∇ = h E0 − h E−1 = h 1 − h E−1 so def −1 ∇f = 1 − E f and ∇α f (α, β) = f (α, β) − f (α − h, β)

δ

Centered Difference Operator: h δ = h E 2 − h E− 2 = h E − h E−1 so 2 2 o n 1 1 def δf = E 2 − E− 2 f and δα [f (α, β)] = f (α + h/2, β) − f (α − h/2, β) n 1 on 1 o 1 def −1 Averaged Difference Operator: h ζ = h µh δ = 12 h E 2 + h E− 2 hE 2 − hE 2 so ζf = 12 h E1 − h E−1 f and ζ α [f (α, β)] = 12 (f (α + h, β) − f (α − h, β))

ζ

1

def

1

def

1

def

Identity Difference Operator: h 1 = h E0 so 1f = E0 f and

Infinitesimal Difference/Calculus Operators def

D

Derivative Operator: Dα f = df /dα

I

Identity Operator: If = f

def

– G5.1 –

h 1α [f (α, β)]

= f (α, β)


G6

Finance Functions and Operators

Co nfi Dr den a Pr ft 2 tia l o . p 1 of e r DP ty RA

Finance Functions def def df rf risk-free discount factor: df trf1 ,t1 = df rf(t1 , t1 ) = PVt0 [1; t1 ] is the present value, at time t0 , of a default risk-free payment at time t1 of the fixed amount of one unit of the num´eraire. Thus it is the time t0 present value of a one unit zero coupon bond maturing at time t1 . Finance Operators PV Present Value Operator: PVt0 [f (ξ(t1 )) ; t1 | ξ(t0 )] is the present value, at time t0 , of a payment at time t1 of f (ξ(t1 )) where f (ξ) is or can be a random variable or function and t0 ≤ t1 .

– G6.1 –


Introduction And The Basic Financial Partial Differential Equation

Co nfi Dr den a Pr ft 2 tia l o . p 1 of e r DP ty RA

This document provides detailed descriptions, derivations, and explanations of the finite difference (“FD”), generalized European payout function, and some other “workhorse” mathematics used for financial valuation and risk management by Derivative Product Risk Advisors (“DPRA”).4 The basic partial differential equation (“PDE”) of finance for a financial asset O = O (x, t) is: 1 Ot = tr {ΣΣT Oxx } +(µ − dx ) Ox − rO + dO , 2

(x, t) ∈

Rn

s

× (0, T ],

(1)

R

with boundary conditions on O (for x) typically on ns × {0} and xi ∈ [−∞, +∞] , i ∈ I(ns ) for European-style or on ns × [0, T ] for American-style products. Here we have reflected O in time around T (O(t) = O0 (T − t)) from “standard” financial notation to conform better with standard numerical analysis notation having initial boundary conditions at t = 0.

R

Where r = r (x, t) is the risk-free rate (per unit time), µ is

1. for x state variable/term structure models: the drift rate of state variables x: dx = µ (x, t) dt+ Σ (x, t) dw; 2. for x asset models: the per unit cost of holding hedge assets: r (x, t) x − d (x, t) where d is the absolute dividend or distribution rates per unit asset per unit time,

Σ (x, t) is the volatility matrix of x, and dO (x, t) is the dividend stream of O per unit time. Ox , Ot , and Oxx are the obvious partial derivatives of O with values in n, s , and n. s ×ns Equation 1 is a linear, first order in time, and second order in space PDE.

R R

R

This section deals with, as its title indicates, finite difference (“FD”) solutions to financial partial differential equations. All of the methods detailed in this document will require solving tri-diagonal or simpler systems of equations. For algebraic clarity, equations will be broken into their left hand side (“LHS”) and right hand side (“RHS”) components, and each side will be analyzed separately first and then combined for final results and equations. The current version of this document provides detailed algebraic derivations of numerous numerical analysis tools and schemes used by Derivative Product Risk Advisors (“DPRA”) to evaluate financial models but it does not provide detailed proofs of stability. Fortunately most financial product pay outs are well enough behaved that reasonably direct application of below schemes should be stable; however, generally valuations should often be calculated or at least checked using a fully explicit method for the final few time steps to eliminate “phantom” oscillations. We begin with the 1-spatial dimension version of Equation 1 and drop coefficient’s a, b, c, and d’s 4

c Copyrighted 2010. This document is confidential and no part of it may be distributed in any fashion without the written permission of David Schwartz of Derivative Product Risk Advisors Inc.

Draft 2.1

Confidential

Confidential

Draft


Page 2

explicit time and spatial dependency to get: ut = auxx + bux + cu + d.

(2)

This gives us, in the notation defined in Glossary G5 on page G5.1:

Co nfi Dr den a Pr ft 2 tia l o . p 1 of e r DP ty RA

Dt u = aD2x u + bDx u + cIx u + d.

(3)

Ignoring indices boundary constraints for now and applying the expansions of Equation A.3:14 on page 365 to Equation 3 at (xk , tm ) (in the interior (x, t) region) we get: nt X

D t Îł2i−1 δt2i−1 uk;m + O h2n t

(4)

i=1

=a =a

n1 X

i=1 n1 X

D2 2i γ2i δx uk;m

+O

1 h2n x

+b

n2 X

D 2 Îł2i−1 δx2i−1 uk;m + O h2n + c1x uk;m + d x

i=1

2

D 2i γ2i δx uk;m + b

n2 X

i=1

DI Îł2i−1 Îś x δx2(i−1) uk;m + c1x uk;m + d + O h2xmin {n1 ,n2 } .

i=1

def

For n1 = n2 = nx this simplifies to: nt X

D t Îł2i−1 δt2i−1 uk;m + O h2n t

i=1

=

c1x + bÎś x +

nx X

D2 aÎł2i

+

DI bÎł2i+1 Îśx

δx2i

x uk;m + dk;m + O h2n x

i=1

=

c1x +

nx X

D2 2 aγ2i δx

+

DI bÎł2i−1 Îśx

δx2(i−1)

x uk;m + dk;m + O h2n x

(5)

i=1

2

where ÎłiD , ÎłiD , and ÎłiDI are the ith (Taylor-like) expansion coefficients for D, D2 , and DI formulas, respectively, of Equation A.3:14 on page 36. Using Physics/Einstein notation defined in Glossary G4 on page G4.1 we get:6 o p n D DI 2(j−1) D2 2j x t Îś δ + aÎł δ uk;m + d + O h2n . (6) Îł2i−1 δt2i−1 uk;m + O h2n = c1 + bÎł x x 2j−1 x 2j x x t i:[1,nt ] j:[1,nx ]

5

See Equation A.3:15 on page 36 for explicit examples of such expansions and their first five γ’s. Note that the RHS’s Physics/Einstein summation occurs only on the j indexed elements, not the identity operator within the curly bracketed expression operating on uk;m . 6

Draft 2.1

Confidential

Confidential

Draft


Page 3

1

Finite Difference: Time Schemes — The LHS

Co nfi Dr den a Pr ft 2 tia l o . p 1 of e r DP ty RA

We begin with the time side or LHS of Equation 6 for two reasons. First, it is the easier side to workout/approximate. And second, we will develop “tilded” notation for variables that will save much repetition in working out the spatial side or RHS. All the evaluation schemes in Section 1 will involve only two adjacent time steps: 1) m + 1 and m or 2) m and m − 1 with m + 1 and m making up the vast majority. This allows for simple and direct (time) step-by-step adjustment of ht . This is not true for the spatial schemes detailed in Section 1. The spatial schemes of Section 1 will generally depend on three adjacent spatial steps k − 1, k, and k + 1 and hx must be the same between them and thus ∀k. There are variable spatial grid schemes that may be included in future drafts.

1.1

1.1.1

First Order Time Schemes: Forward & Backward Euler Forward Euler

Forward Euler FD time schemes are fully explicit: values for the time step m + 1 can be explicitly calculated from values of previous time steps m, m − 1, . . . , 0. In this case, only values from m are required: 1 ∆t u + O h1t = RHS [u] ht uk;m+1 − uk;m LHS1F [uk;m ] = + O h1t = RHS [uk;m ] ht def

LHS1F [u] =

(1.1:1)

gives a first order in time scheme that can be used with either of the spatial schemes of Sections 3 and 4. 1.1.2

Backward Euler

Backward Euler FD time schemes are fully implicit: values for the time step m+1 must be implicitly determined.

1 ∇t u + O h1t = RHS [u] ht 1 Et [LHS1B [u]] = LHS1B [Et u] = ∆t u + O h1t = Et [RHS [u]] = {Et [RHS]} [Et u] . ht 1 LHS1B [Et u] = ∆t u + O h1t = Et [RHS] [Et u] . ht Note that: Et [RHS] 6≡ RHS def

LHS1B [u] =

Draft 2.1

Confidential

Confidential

(1.1:2)

(1.1:3) (1.1:4)

Draft


Page 19

6

Efficient, High Accuracy Routines for N (Îą) and Q(Îą)

This section details high accuracy approximations for N (Îą) and Q(Îą): Z Îą Z ∞ 1 def def def 2 n(Îą) = √ exp âˆ’Îą /2 , N (Îą) = n(Ξ) dΞ, and Q(Îą) = n(Ξ) dΞ 2Ď€ −∞ Îą

Co nfi Dr den a Pr ft 2 tia l o . p 1 of e r DP ty RA

ÎąâˆˆR

(6:1)

where we have the basic identities N (−∞) = 0, N (+∞) = 1, n(Îą) = n(âˆ’Îą) and: Q(Îą) = N (âˆ’Îą) ,

N (Îą) = 1 − N (âˆ’Îą) ,

N (Îą) = 1 − Q(Îą) ,

and Q(Îą) = 1 − N (Îą) .

(6:2)

For most outright and end use calculations of the remaining or cumulative normal, Equation 26.2.17 of Milton Abramowitz and Irene A. Stegun (“A&Sâ€?) [AS72, page 932]: N (Îą) = 1 − n(Îą) b1 t + b2 t2 + b3 t3 + b4 t4 + b5 t5 + (Îą) , Îą ∈

R0+

t=

| (Îą) | < 7.5 Ă— 10−8 p = 0.23154 19

1 1 + pÎą (6:3)

b4 = −1.82125 5978 b5 = 1.33027 4429

b1 = 0.31938 1530 b2 = −0.35656 3782 b3 = 1.78147 7937

is probably sufficient and likely superior for communicating (at-)market levels and prices. However, higher accuracy is often advantageous or required for transformation of variables and other intermediate calculations to get stability and reliable sensitivities (differences/derivatives).

R

We will focus on calculating Q(Îą) for Îą ∈ 0+ . We do this because for a given number of significant digits in Q(Îą), using 1 − Q(Îą) for N (Îą) provides more significant digits than the same number of significant digits in N (Îą) would provide for using 1 − N (Îą) for Q(Îą), for Îą ∈ 0+ . For N (Îą) or Q(Îą), Îą ∈ (−∞, 0), use the identities N (Îą)= 1 − N (âˆ’Îą) = Q(âˆ’Îą).

R

There are four reasonably direct power series and continued fraction representations of Q(Îą) and N (Îą) on page 932 of [AS72]: power series 26.2.10 and 26.2.11 and continued fractions 26.2.14 and 26.2.15. We will focus on power series 26.2.11 and continued fraction 26.2.14 which both involve strictly positive terms allowing for straightforward error bound calculations. Note throughout this Section we will take advantage of the fact that it is fast (“inexpensiveâ€?) to calculate n(Îą) to a high degree of accuracy.

Draft 2.1

Confidential

Confidential

Draft


Page 22

mS

0.000 0.125 0.250 0.375 0.500 0.625 0.750 0.875 1.000 1.125 1.250 1.375 1.500 1.625 1.750 1.875 2.000 2.125 2.250 2.375 2.500 2.625 2.750 2.875 3.000

1 8 10 12 13 14 15 16 18 19 20 22 23 24 25 27 28 29 30 32 34 35 36 38 39

QS

mCF

QCF

Co nfi Dr den a Pr ft 2 tia l o . p 1 of e r DP ty RA

αi

5.00000 4.50261 4.01293 3.53830 3.08537 2.65985 2.26627 1.90786 1.58655 1.30294 1.05649 8.45657 6.68072 5.20812 4.00591 3.03963 2.27501 1.67933 1.22244 8.77447 6.20966 4.33244 2.97976 2.02013 1.34989

00000 77516 67431 23332 53872 52904 35237 95285 25393 51713 77366 22351 01268 79415 56863 61765 31948 06448 72655 50957 53257 83630 32350 74899 80316

00000 98871 70762 72762 59868 87005 68681 25106 14570 68088 68552 33571 85806 21954 81709 26137 17920 44881 04470 38361 76135 12558 54556 46001 30094

00000 07021 75759 05627 96362 32310 99327 25622 51415 54613 57689 99464 60045 77326 04188 50506 72003 25899 31526 68600 16698 62604 75429 68098 52665

E-01 E-01 E-01 E-01 E-01 E-01 E-01 E-01 E-01 E-01 E-01 E-02 E-02 E-02 E-02 E-02 E-02 E-02 E-02 E-03 E-03 E-03 E-03 E-03 E-03

>> >> >> >> >> >> >> >> >> >> >> >> >> >> >> 188 167 148 132 131 117 104 100 87 81

3.03963 2.27501 1.67933 1.22244 8.77447 6.20966 4.33244 2.97976 2.02013 1.34989

N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A 61765 26137 31948 17920 06448 44881 72655 04470 50957 38361 53257 76135 83630 12558 32350 54556 74899 46001 80316 30094

50506 72003 25899 31526 68600 16698 62604 75429 68098 52665

E-02 E-02 E-02 E-02 E-03 E-03 E-03 E-03 E-03 E-03

Table 1: Number of terms, m, required for 21 digits of accuracy in Q(α) from Equation 6.1:2’s summation of s (or [AS72] 26.2.11) for mS /QS and Equation 6.2:2’s continued fraction for g (or [AS72] 26.2.14) for mCF /QCF for αi = 0, 1/8, 1/4, 3/8, . . . , 2 7/8, and 3. “N/A” means effectively not available as more than 200 terms are required. Table results have last digit(s) rounded up if next digit is/would be 5 or greater.

Draft 2.1

Confidential

Confidential

Draft


Page 26

Finally, using our g 10 (1.1875) we have: N 10 (−1.185) = Q10 (1.185) = g 10 (1.185) n(1.185) = 0.117515228293214149127 Q10 (−1.185) = 1 − Q10 (−1.185) = 1 − g 10 (1.185) n(1.185) = 0.882484771706785850873.

(6.4:2)

Co nfi Dr den a Pr ft 2 tia l o . p 1 of e r DP ty RA

For α = 6 we use Equation 6.2:2 for g(α). Table 5 shows just how quickly the continued fraction version of g converges for “large” α. n

g n (6)

5 10 15 20 25 50 ∞

0.162377817674047476560 0.162377660882598732468 0.162377660896874619061 0.162377660896867452035 0.162377660896867461842 0.162377660896867461815 0.162377660896867461815

Abs Errn

−1.568 1.427 −7.157 9.780 −2.647 1.018 0.000

E-07 E-11 E-15 E-18 E-20 E-24 E 00

Table 5: Approximations gn (6) of g(6) from gn of Equation 6.2:2 for n = 5, 10, 15, 20, 25, and 50. Abs Errn = g∞ (6) − gn (6) = g(6) − gn (6). From Table 5 we see that 25 terms or elements of the CF for α = 6 provides 18 significant digits of accuracy. A similar analysis for α = 5 shows 40 terms provides 20 significant digits. Table 2 indicates this CF converges faster as α increases so n ≤ 40 should be more than sufficient for α ≥ 5 for C/C++ “double” calculations. Finally, again, using our g 25 (6) we have:

Q25 (6) = g 25 (6) n(6) = 9.86587645037698140861E-10 N 25 (6) = 1 − Q25 (6) = 1 − g 25 (6) n(6) = 0.999999999013412354962.

7

(6.4:3)

Calculating N −1(β) and Q−1(β)

Similarly to Section 6, we concentrate on calculating Q−1 (β) for β ∈ [0, 21 ] and use the identities of Equation 6:2 to get: 1 Q−1 (β) = −Q−1 (1 − β) , β ∈ ( , 1] and N −1 (β) = Q−1 (1 − β) , β ∈ [0, 1]. 2

(7:1)

Substituting some of our notation within Equation 26.2.23 on page 933 of [AS72] for approximating

Draft 2.1

Confidential

Confidential

Draft


Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.