DPRA Financial Mathematics

20
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 [email protected] 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 1 2 × 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.

description

Public version of DPRA's memo on Financial Mathematics and Numberical Analysis

Transcript of DPRA Financial Mathematics

Page 1: DPRA Financial Mathematics

Financial Mathematics “Workhorse” Routines:Methods, Derivations, and Results used by

Derivative Product Risk Advisors∗

David Schwartz†

Managing DirectorDerivative Product Risk Advisors

http://DerivativeProductsRiskAdvisors.blogspot.com/(646) 450–0438 T [email protected] k

Draft 2.1March 1, 2010

∗ c© Copyrighted 2010. This document is confidential and no part of it may be distributed in any fashion withoutthe written permission of David Schwartz of Derivative Product Risk Advisors Inc. The body of this document is7 inches by 8.8 inches, slightly larger than the default Adobe pdf body size for 8 1

2 ×11 inch paper, and it is suggestedto 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.

Page 2: DPRA Financial Mathematics

Confi

dent

ial

Draf

t 2.1

Prop

erty

ofDP

RA

Executive Summary

Draft 2.1 of this document provides detailed descriptions, derivations, and explana-tions of the finite difference, generalized European payout function, and some other“workhorse” mathematics used for financial valuation and risk management by Deriva-tive Product Risk Advisors.1

The methods, approaches, and functions described within this document have generallybeen implemented and checked multiple times by multiple teams of financial engineeringprofessionals. They are believed to be mathematically correct; nevertheless, they areoffered and described here only on a “best efforts basis.”2 Their appropriateness orusefulness 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 financialmodeling, but, as with all tools, these tools can never provide more insightor value than the models and assumptions they are used with. Good modelswith reasonable and reliable assumptions are necessary for these tools tobe 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 modelingusually at least one assumption catastrophically fails to be true with alarmingfrequency and very high costs. Expect things will occasionally behave inunexpected ways.

Here’s one useful rule of thumb: there are very few fields in which everysingle practitioner is an idiot. If your understanding of a field is such that allpractitioners of it must be idiots, then probably you’re not understanding itcorrectly.

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 thepack 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 withthe potential enormous (individual) cost that mandates spending significant time andresources 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 withoutthe written permission of David Schwartz of Derivative Product Risk Advisors Inc.

2I, David Schwartz, alone am responsible for any errors, omissions, or typos in this document. I would be gratefulto receive notice of such through the email address [email protected].

3Good models with reasonable and reliable assumptions are necessary, but not necessarily sufficient for thesetools to be helpful or add value.

Page 3: DPRA Financial Mathematics

Confi

dent

ial

Draf

t 2.1

Prop

erty

ofDP

RA

Contents

Glossaries G1.1

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

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

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

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

G5 Shift, Difference, and Derivative Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . G5.1

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

Introduction 1

1 Finite Difference: Time Schemes — The LHS 3

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

1.1.1 Forward Euler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

1.1.2 Backward Euler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

1.2 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 First Order Time (Forward Euler) and Second Order Spatial Scheme . . . . . . . . . . . . . 6

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

3.2 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 7

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

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

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

– i –

Page 4: DPRA Financial Mathematics

Confi

dent

ial

Draf

t 2.1

Prop

erty

ofDP

RA

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

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

Useful Mathematical Equivalences, Relationships, Approximations inFinance 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

6.2 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

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 –

Page 5: DPRA Financial Mathematics

Confi

dent

ial

Draf

t 2.1

Prop

erty

ofDP

RA

A.1.2 Finite Difference Operators Equivalences . . . . . . . . . . . . . . . . . . . . . . . . 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

B Continued Fractions 37

Bibliography 38

– iii –

Page 6: DPRA Financial Mathematics

Confi

dent

ial

Draf

t 2.1

Prop

erty

ofDP

RA

Glossaries

G1 Acronyms

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

CN . . . . . . . . . . . . . . . . . . . . . Crank-Nicholson finite difference scheme

DPRA . . . . . . . . . . . . . . . . . . . Derivative Product Risk Advisors

FD . . . . . . . . . . . . . . . . . . . . . finite difference

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

– G1.1 –

Page 7: DPRA Financial Mathematics

Confi

dent

ial

Draf

t 2.1

Prop

erty

ofDP

RA

G2 Sets

Sets of Functions:

Cn set of n-times continuously differentiable functions: i.e. f ∈ Cn ⇔ dnf/dxn ∈ C0. Note thatC is sometimes referred to as C0 as C and C1 are not the same.

Pn set of polynomial functions of degree ≤ n :

Pn def={f : f(α) = βnα

n + βn−1αn−1 + · · ·+ β1α

1 + β0α0}

.

Sets of Numbers:

Z set of integer numbers: {. . . ,−2,−1, 0,+1,+2, . . .}.I index set of non-negative Z : I(i)

def= {0, 1, 2, . . . , n(i) − 1}.

Z+ set of positive integer numbers: {1, 2, 3, . . .}.R range of a function.D domain: the set a given function is defined on. “f(α) is defined for α ∈ D.” For example,

f(α)def= α2/α = α for α ∈ R− {0} so Df = {β : β ∈ R, β 6= 0}.

R set of real numbers: (−∞,+∞).R+ set of positive real numbers: (0,+∞).R0+ set of non-negative real numbers: [0,+∞).

– G2.1 –

Page 8: DPRA Financial Mathematics

Confi

dent

ial

Draf

t 2.1

Prop

erty

ofDP

RA

G3 Variables

Unless otherwise noted: 1) vectors, ordered sets, and series will be treated and denoted identically; 2) vec-tors will be denoted with lowercase boldface variables and their elements with the same variables, single-indexed, in normal face; and 3) matrices will be denoted with uppercase bold variables and their elementswith the same uppercase variables, double-indexed, in normal face. Exceptions include volatility matriceswhich 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 general spatial, time, or other scalar, vector, or matrix, respectively:

αdef= 〈α0, α1, . . . , αn−1〉 and A

def= (Ai,j)i,j .

s, S general element and “sum” or net, respectively. For example:

Sdef=∑

i si or Sdef=∫s(α) dα

β,β,B general spatial, time, or other scalar, vector, or matrix, respectively:

βdef= 〈β0, β1, . . . , βn−1〉 and B

def= (Bi,j)i,j .

ζ, ζ,Z general spatial, time, or other scalar, vector, or matrix, respectively:

ζdef= 〈ζ0, ζ1, . . . , ζn−1〉 and Z

def= (Hi,j)i,j .

h, ht, hx general, time, and spatial shift and difference operators’ step sizes, respectively, all ∈ R+.

ei normalized basis vector i: eidef= 〈δi,j〉j .

Spatial And State Variables:

ξ, ξ,Ξ general spatial or state scalar, vector, or matrix, respectively:

ξdef= 〈ξ0, ξ1, . . . , ξn−1〉 and Ξ

def= (Ξi,j)i,j .

x,x,X general spatial or state scalar, vector, or matrix, respectively:

xdef= 〈xi〉

n(i)−1

i=0 = 〈xi〉i∈I(i)= 〈xi〉 = 〈x0, x1, . . . , xn−1〉 and

Xdef= (Xi,j)〈i,j〉∈I(i)×I(j)

= (Xi,j)i,j = (Xi,j).

y,y,Y general spatial or state scalar, vector, or matrix, respectively:

ydef= 〈y0, y1, . . . , yn−1〉 and Y

def= (Yi,j)i,j .

z, z,Z general spatial or state scalar, vector, or matrix, respectively:

zdef= 〈z0, z1, . . . , zn−1〉 and Z

def= (Zi,j)i,j .

Time Variables:

T time of expiration or maturity.t0 time variable t0.t1 time variable t1.t time variable.

Index Variables:

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

– G3.1 –

Page 9: DPRA Financial Mathematics

Confi

dent

ial

Draf

t 2.1

Prop

erty

ofDP

RA

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

Finance variables:

r 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.

σ,σ,ΣΣT volatility variables with the non-standard notation that ΣΣT def= {ρi,jσiσj}i,j where dx =

µ (x, t) dt+ Σ (x, t) dWt. Note that x could simply be r.d,d dividend rate per unit time of underlying asset variable(s). Should be zero for state

variables.dO dividend per unit time of derivative product itself.O “derivative” financial asset value.CE 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).PE 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 –

Page 10: DPRA Financial Mathematics

Confi

dent

ial

Draf

t 2.1

Prop

erty

ofDP

RA

G4 Mathematical Definitions

Mathematical Acronyms:

LHS left hand sideRHS right hand sides.t. such thatw.r.t. with respect to

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=i

Einstein/Physics summation notation:

f(i) + αp=ig(i) + β ⇐⇒ α+

∑i

f(i) = β +∑i

g(i)

f(i) + αp=i:ng(i) + β ⇐⇒ α+

n∑i=0

f(i) = β +

n∑i=0

g(i)

f(i) + αp=

i:[n1,n2]g(i) + β ⇐⇒ α+

n2∑i=n1

f(i) = β +

n2∑i=n1

g(i)

def= Equal by definition or equivalent (aka ≡)

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

tr {A} Trace of matrix A: tr {A} def=∑n(i)

i=1 ai,i

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

General Mathematics Functions:

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

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

aibi+

ai+1

bi+1+· · · aj−1

bj−1+

ajbj + ε

j ≥ i ∈ Z+. (G4:1)

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

CFdef= lim

l→∞CF1;l(A,B; 0) (G4:2)

– G4.1 –

Page 11: DPRA Financial Mathematics

Confi

dent

ial

Draf

t 2.1

Prop

erty

ofDP

RA

and finally note that:

CFi;j(A,B; ε) = CFi;m(A,B; CFm+1;j(A,B; ε)) j ≥ m > i ∈ Z+. (G4:3)

Step and Impulse Functions:

δi,j Kronecker delta function: δi,j =

{1 i = j

0 otherwise.

δ(ξ) Dirac delta (generalized) function: The Dirac delta function is not strictly a function. It isa 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 functionsfor δ(ξ) is {n(ξ/α) /α}α as α→ 0+. This gives us:∫ b

af(ξ) δ(ξ) dξ =f(0) (θ(b)− θ(a)) (G4:4)∫ b

af(ξ) δ(αξ − β) dξ =

1

αf(β/α) (θ(αb− β)− θ(αa− β)) (G4:5)∫

Df(ξ) δ(g(ξ)) dξ =

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

∣∣∣∣∂g(z)

∂z

∣∣∣∣−1

f(z) (G4:6)

∫ b

af(ξ)

∂nδ(ξ − β)

∂ξndξ = (−1)n

∂nf(β)

∂ξn(θ(b− β)− θ(a− β)) . (G4:7)

θ(ξ) Theta step function: θ(ξ) =

1 if ξ > 012 if ξ = 0

0 if ξ < 0

θ is the integral of Dirac delta (generalized)

function δ and the (generalized) derivative of θ is δ.

– G4.2 –

Page 12: DPRA Financial Mathematics

Confi

dent

ial

Draf

t 2.1

Prop

erty

ofDP

RA

Statistical Functions:

n(ξ) Standard unit normal or Gaussian probability density function:

n(ξ)def=

1√2π

e−ξ2/2. (G4:8)

N(ξ) Cumulative standard normal or Gaussian probability function:

N(ξ)def=

1√2π

∫ ξ

−∞e−z

2/2 dz. (G4:9)

Q(ξ) Remaining standard normal or Gaussian probability function:

Q(ξ)def=

1√2π

∫ ∞ξe−z

2/2 dz = N(−ξ) = 1−N(ξ) . (G4:10)

g(ξ) Ratio of remaining standard normal or Gaussian probability function Q to n:

g(ξ)def=

Q(ξ)

n(ξ). (G4:11)

– G4.3 –

Page 13: DPRA Financial Mathematics

Confi

dent

ial

Draf

t 2.1

Prop

erty

ofDP

RA

G5 Shift, Difference, and Derivative Operators

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

of the function they are operating on. For example, {L1 + L2} fdef= L1f + L2f . Unless indicated by [·],

L operates only on the function (or vector/array) immediately after it: L1u v = (L1u) v = vL1u. Finally,note that all shift and difference operators can be represented as linear combinations of the forward shiftoperator taken to various, possibly non-integer, powers. Note: L [fg] 6≡(L [f ])(L [g]) =(Lf)(Lg).

L General OperatorL−1 “Inverse” Operator of L. L−1 is the operator that inverts, to within the applicable equivalence set,L.Shift Operators:

E Forward Shift Operator: hEαi [f(α)]def= f(α+ hei). Generally, hE

β [f(α)] = f(α+ βh)

E−1 Backward Shift Operator: hE−1αi

[f(α)]def= f(α− hei) and E [f(α)]

def= f(α− h)

1 Identity Shift Operator: h1αi [f(α)]def= f(α) and 1f(α)

def= f(α)

µ Average Operator: hµdef= 1

2

{hE

12 + hE

− 12

}= 1

2

{h2E + h

2E−1

}so

µfdef= 1

2

{E

12 + E−

12

}f and µα [f(α, β)] = 1

2(f(α+ h/2, β) + f(α− h/2, β))

A Double Average Operator: hAdef= 2hµ = 1

2

{hE + hE

−1}

and A = 1 + 12δ

2 so

Afdef= 1

2

{E + E−1

}f and Aα [f(α, β)] = 1

2(f(α+ h, β) + f(α− h, β))Finite Difference Operators:

∆ Forward Difference Operator: h∆def= hE

1 − hE0 = hE− h1 so

∆fdef= {E− 1} f and ∆αf(α, β) = f(α+ h, β)− f(α, β)

∇ Backward Difference Operator: h∇def= hE

0 − hE−1 = h1− hE

−1 so

∇f def={1−E−1

}f and ∇αf(α, β) = f(α, β)− f(α− h, β)

δ Centered Difference Operator: hδdef= hE

12 − hE

− 12 = h

2E− h

2E−1 so

δfdef={

E12 −E−

12

}f and δα [f(α, β)] = f(α+ h/2, β)− f(α− h/2, β)

ζ Averaged Difference Operator: hζdef= hµhδ = 1

2

{hE

12 + hE

− 12

}{hE

12 − hE

− 12

}so ζf = 1

2

{hE

1 − hE−1}f and ζα [f(α, β)] = 1

2 (f(α+ h, β)− f(α− h, β))

1 Identity Difference Operator: h1def= hE

0 so 1fdef= E0f and h1α [f(α, β)] = f(α, β)

Infinitesimal Difference/Calculus Operators

D Derivative Operator: Dαfdef= df/dα

I Identity Operator: Ifdef= f

– G5.1 –

Page 14: DPRA Financial Mathematics

Confi

dent

ial

Draf

t 2.1

Prop

erty

ofDP

RA

G6 Finance Functions and Operators

Finance Functionsdfrf risk-free discount factor: dfrf

t1,t1def= dfrf(t1, t1)

def= 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 numeraire.Thus it is the time t0 present value of a one unit zero coupon bond maturing at time t1.

Finance OperatorsPV 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 –

Page 15: DPRA Financial Mathematics

Confi

dent

ial

Draf

t 2.1

Prop

erty

ofDP

RA

Introduction And The Basic FinancialPartial Differential Equation

This document provides detailed descriptions, derivations, and explanations of the finite difference(“FD”), generalized European payout function, and some other “workhorse” mathematics used forfinancial 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:

Ot =1

2tr {ΣΣTOxx}+(µ− dx)Ox − rO + dO, (x, t) ∈ Rns × (0, T ], (1)

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

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 isthe 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 Rns, R, and R.ns×ns Equation 1 is alinear, first order in time, and second order in space PDE.

This section deals with, as its title indicates, finite difference (“FD”) solutions to financial partialdifferential equations. All of the methods detailed in this document will require solving tri-diagonalor simpler systems of equations. For algebraic clarity, equations will be broken into their left handside (“LHS”) and right hand side (“RHS”) components, and each side will be analyzed separatelyfirst and then combined for final results and equations. The current version of this documentprovides detailed algebraic derivations of numerous numerical analysis tools and schemes used byDerivative Product Risk Advisors (“DPRA”) to evaluate financial models but it does not providedetailed proofs of stability. Fortunately most financial product pay outs are well enough behavedthat reasonably direct application of below schemes should be stable; however, generally valuationsshould often be calculated or at least checked using a fully explicit method for the final few timesteps 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 withoutthe written permission of David Schwartz of Derivative Product Risk Advisors Inc.

Draft 2.1 Confidential Confidential Draft

Page 16: DPRA Financial Mathematics

Confi

dent

ial

Draf

t 2.1

Prop

erty

ofDP

RA

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:

Dtu = aD2xu+ bDxu+ cIxu+ d. (3)

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

nt∑i=1

γD2i−1δ2i−1t uk;m + O

(h2ntt

)(4)

= a

n1∑i=1

γD2

2i δ2ix uk;m + O

(h2n1x

)+ b

n2∑i=1

γD2i−1δ2i−1x uk;m + O

(h2n2x

)+ c1xuk;m + d

= a

n1∑i=1

γD2

2i δ2ix uk;m + b

n2∑i=1

γDI2i−1ζxδ

2(i−1)x uk;m + c1xuk;m + d+ O

(h2 min {n1,n2}x

).

For n1 = n2def= nx this simplifies to:

nt∑i=1

γD2i−1δ2i−1t uk;m + O

(h2ntt

)=

{c1x + bζx +

nx∑i=1

(aγD

2

2i + bγDI2i+1ζx

)δ2ix

}uk;m + dk;m + O

(h2nxx

)=

{c1x +

nx∑i=1

(aγD

2

2i δ2x + bγDI

2i−1ζx

)δ2(i−1)x

}uk;m + dk;m + O

(h2nxx

)(5)

where γDi , γD2

i , and γDIi 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 G4on page G4.1 we get:6

γD2i−1δ2i−1t uk;m + O

(h2ntt

) p=

i:[1,nt]j:[1,nx]

{c1x + bγDI

2j−1 ζx δ2(j−1)x + aγD

2

2j δ2jx

}uk;m + d+ O

(h2nxx

). (6)

5See Equation A.3:15 on page 36 for explicit examples of such expansions and their first five γ’s.6Note 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.

Draft 2.1 Confidential Confidential Draft

Page 17: DPRA Financial Mathematics

Confi

dent

ial

Draf

t 2.1

Prop

erty

ofDP

RA

Page 3

1 Finite Difference: Time Schemes — The LHS

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

1.1 First Order Time Schemes: Forward & Backward Euler

1.1.1 Forward Euler

Forward Euler FD time schemes are fully explicit : values for the time step m+ 1 can be explicitlycalculated from values of previous time steps m,m− 1, . . . , 0. In this case, only values from m arerequired:

LHS1F [u]def=

1

ht∆tu+ O

(h1t

)= RHS [u]

LHS1F [uk;m] =uk;m+1 − uk;m

ht+ O

(h1t

)= RHS [uk;m]

(1.1:1)

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

1.1.2 Backward Euler

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

LHS1B [u]def=

1

ht∇t u+ O

(h1t

)= RHS [u]

Et [LHS1B [u]] = LHS1B [Etu] =1

ht∆tu+ O

(h1t

)= Et [RHS [u]] = {Et [RHS]} [Etu] .

(1.1:2)

LHS1B [Etu] =1

ht∆tu+ O

(h1t

)= Et [RHS] [Etu] . (1.1:3)

Note that:

Et [RHS] 6≡ RHS (1.1:4)

Draft 2.1 Confidential Confidential Draft

Page 18: DPRA Financial Mathematics

Confi

dent

ial

Draf

t 2.1

Prop

erty

ofDP

RA

Page 19

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

This section details high accuracy approximations for N(α) and Q(α):

n(α)def=

1√2π

exp(−α2/2

), N(α)

def=

∫ α

−∞n(ξ) dξ, and Q(α)

def=

∫ ∞α

n(ξ) dξ α ∈ 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.17of Milton Abramowitz and Irene A. Stegun (“A&S”) [AS72, page 932]:

N(α) = 1− n(α)(b1t+ b2t

2 + b3t3 + b4t

4 + b5t5)

+ ε(α) , α ∈ R0+ t =1

1 + pα

| ε(α) | < 7.5× 10−8

p = 0.23154 19 (6:3)

b1 = 0.31938 1530 b4 = −1.82125 5978

b2 = −0.35656 3782 b5 = 1.33027 4429

b3 = 1.78147 7937

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

We will focus on calculating Q(α) for α ∈ R0+. We do this because for a given number of signifi-

cant digits in Q(α), using 1−Q(α) for N(α) provides more significant digits than the same numberof significant digits in N(α) would provide for using 1−N(α) for Q(α), for α ∈ R0+. For N(α) orQ(α), α ∈ (−∞, 0), use the identities N(α)= 1−N(−α) = Q(−α).

There are four reasonably direct power series and continued fraction representations of Q(α) andN(α) on page 932 of [AS72]: power series 26.2.10 and 26.2.11 and continued fractions 26.2.14 and26.2.15. We will focus on power series 26.2.11 and continued fraction 26.2.14 which both involvestrictly positive terms allowing for straightforward error bound calculations. Note throughout thisSection we will take advantage of the fact that it is fast (“inexpensive”) to calculate n(α) to a highdegree of accuracy.

Draft 2.1 Confidential Confidential Draft

Page 19: DPRA Financial Mathematics

Confi

dent

ial

Draf

t 2.1

Prop

erty

ofDP

RA

Page 22

αi mS QS mCF QCF

0.000 1 5.00000 00000 00000 00000 E-01 >> N/A0.125 8 4.50261 77516 98871 07021 E-01 >> N/A0.250 10 4.01293 67431 70762 75759 E-01 >> N/A0.375 12 3.53830 23332 72762 05627 E-01 >> N/A0.500 13 3.08537 53872 59868 96362 E-01 >> N/A0.625 14 2.65985 52904 87005 32310 E-01 >> N/A0.750 15 2.26627 35237 68681 99327 E-01 >> N/A0.875 16 1.90786 95285 25106 25622 E-01 >> N/A1.000 18 1.58655 25393 14570 51415 E-01 >> N/A1.125 19 1.30294 51713 68088 54613 E-01 >> N/A1.250 20 1.05649 77366 68552 57689 E-01 >> N/A1.375 22 8.45657 22351 33571 99464 E-02 >> N/A1.500 23 6.68072 01268 85806 60045 E-02 >> N/A1.625 24 5.20812 79415 21954 77326 E-02 >> N/A1.750 25 4.00591 56863 81709 04188 E-02 >> N/A1.875 27 3.03963 61765 26137 50506 E-02 188 3.03963 61765 26137 50506 E-022.000 28 2.27501 31948 17920 72003 E-02 167 2.27501 31948 17920 72003 E-022.125 29 1.67933 06448 44881 25899 E-02 148 1.67933 06448 44881 25899 E-022.250 30 1.22244 72655 04470 31526 E-02 132 1.22244 72655 04470 31526 E-022.375 32 8.77447 50957 38361 68600 E-03 131 8.77447 50957 38361 68600 E-032.500 34 6.20966 53257 76135 16698 E-03 117 6.20966 53257 76135 16698 E-032.625 35 4.33244 83630 12558 62604 E-03 104 4.33244 83630 12558 62604 E-032.750 36 2.97976 32350 54556 75429 E-03 100 2.97976 32350 54556 75429 E-032.875 38 2.02013 74899 46001 68098 E-03 87 2.02013 74899 46001 68098 E-033.000 39 1.34989 80316 30094 52665 E-03 81 1.34989 80316 30094 52665 E-03

Table 1: Number of terms, m, required for 21 digits of accuracy in Q(α) from Equation 6.1:2’ssummation 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 effectivelynot available as more than 200 terms are required. Table results have last digit(s) rounded up ifnext digit is/would be 5 or greater.

Draft 2.1 Confidential Confidential Draft

Page 20: DPRA Financial Mathematics

Confi

dent

ial

Draf

t 2.1

Prop

erty

ofDP

RA

Page 26

Finally, using our g10(1.1875) we have:

N10(−1.185) = Q10(1.185) = g10(1.185)n(1.185) = 0.117515228293214149127

Q10(−1.185) = 1−Q10(−1.185) = 1− g10(1.185)n(1.185) = 0.882484771706785850873.(6.4:2)

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

n gn(6) Abs Errn

5 0.162377817674047476560 −1.568 E-0710 0.162377660882598732468 1.427 E-1115 0.162377660896874619061 −7.157 E-1520 0.162377660896867452035 9.780 E-1825 0.162377660896867461842 −2.647 E-2050 0.162377660896867461815 1.018 E-24∞ 0.162377660896867461815 0.000 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 digitsof accuracy. A similar analysis for α = 5 shows 40 terms provides 20 significant digits. Table 2indicates this CF converges faster as α increases so n ≤ 40 should be more than sufficient for α ≥ 5for C/C++ “double” calculations.

Finally, again, using our g25(6) we have:

Q25(6) = g25(6)n(6) = 9.86587645037698140861E-10

N25(6) = 1−Q25(6) = 1− g25(6)n(6) = 0.999999999013412354962.(6.4:3)

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

Similarly to Section 6, we concentrate on calculating Q−1(β) for β ∈ [0, 12] and use the identities of

Equation 6:2 to get:

Q−1(β) = −Q−1(1− β) , β ∈ (1

2, 1] and N−1(β) = Q−1(1− β) , β ∈ [0, 1]. (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