0% found this document useful (0 votes)
45 views

NumericalSolutionoftheHeatEquation

The document discusses the numerical solution of the heat equation, a parabolic partial differential equation that models heat flow in a homogeneous bar. It outlines the necessary initial and boundary conditions for unique solutions, the properties of the heat equation, and methods for discretizing both space and time to approximate solutions. Additionally, it connects the heat equation to the Black-Scholes equation in finance, emphasizing the importance of numerical methods in solving such equations.

Uploaded by

CJ
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
45 views

NumericalSolutionoftheHeatEquation

The document discusses the numerical solution of the heat equation, a parabolic partial differential equation that models heat flow in a homogeneous bar. It outlines the necessary initial and boundary conditions for unique solutions, the properties of the heat equation, and methods for discretizing both space and time to approximate solutions. Additionally, it connects the heat equation to the Black-Scholes equation in finance, emphasizing the importance of numerical methods in solving such equations.

Uploaded by

CJ
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

The Heat Equation

We consider the numerical solution of the partial differential equation


(PDE)

(1) ut (x, t) = uxx (x, t)

This is known as the heat equation. It is the prototypical example of a par-


tial differential equation of the so-called parabolic type. Most PDEs that
arise in finance are of the parabolic type. Moreover, by judicious changes of
variables one can transform the Black-Scholes Equation to the heat equation.
Black and Scholes did this in their seminal paper and derived their famous
formula by applying the classical solution formula for the Heat Equation.
Both Meyer and Wilmott illustrate changes of variable that reduce the con-
stant coefficient Black-Scholes Equation to the Heat Equation. Wilmott’s
presentation is more comprehensive and is further developed in the exercises.
Our consideration of the Heat Equation is as the model parabolic PDE
on which we (1) encounter the issues that come to play in the modeling by
and solution of partial differential equations and (2) test ideas for numerical
methods. In this sense the Heat Equation plays the role that the model
equation, y 0 (x) = λy(x) played for ordinary differential equations.

Basic Properties of the Heat Equation and Its Solution. The heat
equation models heat flow in a homogeneous bar. If we assume that an
initial heat distribution on the bar is given, say u(x, t0 ), at time t0 over a
range of points x, then the physics of heat flow dictate that the temperature
at time t > t0 and point x is a function u(x, t) that satisfies ut = κuxx for
an appropriate physical constant κ which we’ve taken to be 1.
More details need to be prescribed in order to find a unique solution u.
Since the equation is first order in time and second order in space (the generic
name for the x-variable), one expects that, in addition to the one-initial con-
dition u(x, t0 ) relative to the variable t, two conditions on the space variable
need to be prescribed. The time initial condition is usually normalize to be
t = 0. For if ut (x, t) is known at a given time t, the determination of u(x, t)
by the “unraveling” of the relationship uxx = ut (x, t) requires two anti-
differentiations, or integrations, with respect to x. Since each integration
involves an arbitrary constant, there are two side, or boundary, conditions
required to recover u(x, t) from the value of ut (x, t). The boundary condi-
tions reflect physical conditions that are being assumed about the problem.
For example, requiring the temperatures at points a and b to be prescribed
values as t varies means that u(a, t) and u(b, t) are known functions. Or,
requiring the bar to be insulated at the point a means that ux (a, t) = 0 for
all t > t0 . If one considers a (bi)-infinite bar, defined for all real values of
x, then limiting conditions as |x| → ∞ or asymptotic growth conditions as
|x| → ∞ would be appropriate. Wilmott discusses all of these and more.
1
The Heat Equation c 2007 Stephen Demko
°

The case of an infinite bar with conditions u(x, t) → ∞ as |x| → ∞ gives


rise to the Heat Kernel
1 −x2
(2) K(x, t) = √ exp{ }
2 πt 4t
which has been studied extensively. In order to advance the solution from
time t0 = 0 to time t one integrates (more accurately convolves) the heat
kernel against the initial condition. This integration is akin to finding the
expectation of a function with respect to a normal random variable: u(x, t)
is the expected value of u(s, 0) with respect to a Gaussian random variable
with mean x and variance 2t:
Z ∞
1 −(s − x)2
(3) u(x, t) = √ u0 (s) exp{ }ds
2 πt −∞ 4t
From this it follows that
(1) For all values of t, u(x, t) is infinitely differentiable in x – even if the initial
condition is discontinuous (or even a δ-function1!)
(2) if u0 (s) ≥ 0, then u(x, t) > 0 for all t and all x.
(3) If ∆t > 0, one can view the solution at time t + ∆t as though it were
obtained from an initial condition posed at time t:
Z ∞
1 −(s − x)2
(4) u(x, t + ∆t) = √ u(s, t) exp ds
2 π∆t −∞ 4∆t
(4) if the initial condition at time t0 is taken to be a δ-function, say δ(s − c)
for all s, then for t > t0 , u(x, t) is perfectly well-defined as the bell-shaped
2
curve u(x, t) = 2√1πt exp −(c−x)
4t
(5) in general, the determination of the past values of u(x, t) from the present
value is an ill-posed problem.

To expand on the last statement: If our initial condition were a δ-function,


the reconstruction of the initial condition from the present heat distribution
u(x, t), we would require a method that gets infinitely large in finite time.
(Needless to say this is not good from the computational point of view.) See
Wilmott’s discussion of the backward heat equation on page 68 for additional
comments on the Backward Heat Equation.
The previous paragraph says that the proper time-based condition to
impose on the heat equation is an initial condition, which we usually impose
at t = 0: u(x, 0) = u0 (x). However, if our PDE were
ut + uxx = 0
1The function δ(x) is best described by its properties:
(a) δ(x) = 0 if x 6= 0
(b) δ(0)
R∞ = ∞
(c) δ(x) dx = 1
−∞ R∞
(d) for any nicely behaved function f (x) and any real number c −∞ δ(x − c)f (x) dx =
f (c)

2
The Heat Equation c 2007 Stephen Demko
°

the proper condition would be a terminal condition at a specified time T :


u(x, T ) = g(x)
and we would solve the differential equation for values of t < T up to a
value of particular interest to us (typically set to be t = 0). This is the case
with the Black-Scholes PDE. The proper condition in the variable t is the
payoff which is prescribed at expiration time T . If the present is denoted by
t = 0, the solution of the Black-Scholes PDE gives the entire history of the
value of the option as a function of spot price and time from the present to
expiration. Monte Carlo simulation and tree methods typically give only a
restriced range of this history.

Numerical Methods
In our study of the numerical solution of u00 = f we saw how to discretize
the second derivative operator with central differences. The numerical so-
lution of the Heat Equation requires not only the approximation of uxx by
central differences in space, but also the discretization of the time variable.
Time discretization reduces to time stepping since we start with our initial
condition—a function, or a discretized function—and try to construct the
solution at the next time step. Equation (2) above indicates that the true
solution is really built from what one might call a “continuous time time
stepping process”. In principle one can consider creating a time stepping
method from any numerical method for the solution of ordinary differen-
tial equation of the initial value type. In practice one typically uses simple
methods whose order of accuracy is O(∆t) or, preferably, O(∆t2 ).

Discretization of Space. This follows the steps used in the notes on the
DISCRETE SECOND DERIVATIVE MATRIX with the exception that our
function u is now a function of both x and t. We discretize in x while keeping
the t continuous.
If u(x, t) is a sufficiently differentiable function, then the standard central
difference approximation to uxx (x, t) is
1
uxx (x, t) = [u(x + h, t) − 2u(x, t) + u(x − h, t)] + O(h2 )
h2
We can approximate the second space derivative of u on a space interval
[a, b], for arbitrary t, as follows:
(1) divide [a, b] into N intervals of equal length by the equally spaced
partition points xi :
a = x0 < x1 < . . . xN = b
where xi − xi−1 = (b − a)/N = h. With this we have the formulas for
1≤i≤N −1
1
uxx (xi , t) = [u(xi+1,t ) − 2u(xi , t) + u(xi−1 , t)] + O(h2 )
h2
3
The Heat Equation c 2007 Stephen Demko
°

If u(a, t) = L(t) and u(b, t) = R(t), then the global relationship expressed
by the equations above can be written in matrix form as
2 3 2 3 2 u(x1 , t) 3 2 3
uxx (x1 , t) −2 1 0 0 ... 0 L(t)
6 uxx (x2 , t) 7 6 1 −2 1 0 ... 07 6 u(x2 , t) 7 6 0 7
6 7 6 76 7 6 7
6 .. 7 6 0 1 −2 1 ... 07 6 .. 7 6 .. 7
6 . 7 6 76 . 7 6 . 7
6 7 = 1 6 7+ 1 6 7
6 . 7 h2 6 .
6 .. .. .. .. .. .. 7 6
7 . 7 h2 6 . 7+
6 .. 7 6 . . . . . 76 .. 7 6 .. 7
6 7 40 6 7 6 7
4u (x 5 0 ... 1 −2 1 5 4u(x 5 4 0 5
xx N −2 , t) N −2 , t)
uxx (xN −1 , t) 0 0 ... 0 1 −2 u(x , t) R(t)
N −1
O(h2 )

where the O(h2 ) quantity is the error vector whose contents are unknown,
but whose magnitude is known to be of order h2 as h → 0. This error vector
also depends on t.
Let’s write the above system as uxx = h12 Au + h12 b + O(h2 ).
From this we can see that the Heat Equation ut = uxx with initial con-
dition u(x, t0 ) = u0 (x) and boundary conditions u(a, t) = L and u(b, t) = R
becomes the (N − 1) × (N − 1) system of coupled ordinary differential equa-
tions:
     u(x , t)   
ut (x1 , t) −2 1 0 0 ... 0 1 L(t)
 ut (x2 , t)   1   u(x2 , t)   0 
   −2 1 0 ... 0    
 ..   0  ..   .. 
 .   1 −2 1 ... 0  .   . 
 = 1
 .. .. .. .. .. ..   + 1  
 .  h2  .  .  h2  . 
 ..   . . . . .  .
.   .. 
  0   
ut (xN −2 , t) 0 ... 1 −2 1  u(xN −2 , t)  0 
ut (xN −1 , t) 0 0 ... 0 1 −2 u(xN −1 , t) R(t)
Since x has been discretized, and our only continuous variable is t, we
write this system as
1
(5) u0 (t) = Ah u(t) + b(t)
h2
In this equation
 
−2 1 0 0 ... 0
 1 −2 1 0 ... 0
 

1  0 1 −2 1 ... 0

Ah = 2  .. . . .. .. .. .. 
h  . . . . . . 
 
0 0 . . . 1 −2 1 
0 0 ... 0 1 −2

Discretization of Time. We introduce a time grid 0 = t0 < t1 < · · · <


tM −1 < tM = T where T is the last value at which we are interested in the
solution. This same grid would work if we were solving the time backward
problem ut + uxx = 0, but our numerical implementation would be a bit
different. We will discuss the backward problem separately. The idea is to
4
The Heat Equation c 2007 Stephen Demko
°

replace u0 (t) by a discrete approximation. We will recall the previously stud-


ied discrete approximations to y 0 (t); derive the associated methods for linear
system u0 (t) = Ah u(t) + h12 b(t); and study the implications for stability.
We use the following notation: um i denotes the computed quantity that
is approximating u(xi , tm ). Superscripts denote time, subscripts space for
i = 0, 1, . . . , N , m = 0, 1, . . . , M . ∆x or h = xi − xi−1 denote the fineness of
the space discretization. ∆t = ti − ti−1 denotes the resolution of the time
discretization. Both are assumed to be constant. We will assume so-called
Dirichlet conditions on the boundaries: u(a, t) = L(t) and u(b, t) = R(t)
for all t > 0 where a < b and the functions L and R are given . Our
initial condition is u(x, 0) = g(x). We will assume that g(a) = u(a, 0) and
g(b) = u(b, 0) so that the initial condition is consistent with the boundary
conditions.
We also use um to denote the vector of values at time tm : um = (um 1 ,
u2 , . . . uN −1 ). Our immediate task is to get from the initial vector u to u1 .
m m 0

Recall that at time tm the values of um m


0 and uN are given by the boundary
values L(tm ) and R(tm ), so the full description of the spatial part of the
differential equation at time tm , before ut is replaced by a difference, is
1
(6) Ah um + 2 bm = u0 (t)
h
1
where Ah = h2 A and bm holds the two boundary values. (Recall that A is
(N − 1) × (N − 1) but there are N + 1 pieces of data at each time step.) We
recall that σ(A) ⊂ (−4, 0).
Explicit Euler Method. We recall the Taylor Approximation
y(t + ∆t) − y(t)
y 0 (t) = + O(∆t)
∆t
use it coordinate-wise in equation (4) to approximate u0 (0) and set it equal
to Au0 + b0 to get for 1 ≤ i ≤ N − 1:
∆t ∆t
u1i − u0i = 2 (Au0 )i + 2 (b0 )i
h h
In matrix-vector form this is
∆t ∆t ∆t ∆t
u1 = u0 + 2 Au0 + 2 b0 = (I + 2 A)u0 + 2 b0
h h h h
More generally,
∆t ∆t ∆t
um+1 = um + 2 Aum + 2 bm = (I + ∆tAh )um + 2 bm
h h h
One can show that this time discretization method has accuracy of order
O(∆t2 ) locally and O(∆t) globally (that is after many time steps we loose
a power of ∆t.). So, the total error is O(h2 + ∆t).
In considering the stability properties of this, or any, method, we need to
verify that as the number of time steps grows, the numerical solution remains
bounded. We can begin a brief assessment by looking at the pattern that
5
The Heat Equation c 2007 Stephen Demko
°

the time steps follow. For simplicity, we define the matrix R = (I + ∆tAh )
and observe:.

∆t
(7) um+1 = Rum + bm
h2
∆t
(8) = R2 um−1 + 2 (Rbm + bm−1 )
h
Xm
∆t
(9) = Rm+1 u0 + 2 ( Rj bj )
h
j=0

We can assume that the vectors bj are well behaved and that the process
of summing does not lead to instabilities. The issue that has to be explored
for stability analysis is the growth of the powers of R. As we have noted
above in the case of the Explicit Euler Method, the matrix is simply I +
∆tAh . The stability of this matrix is analyzed in a later section.
Implicit Euler Method. Here we use the same Taylor-based approxima-
tion to ut , but match it with Ah u1 :
∆t
u1 = u0 + ∆tAh u1 + 2 b1
h
so u1 is determined as the solution of a linear system
∆t
u1 − ∆tAh u1 = u0 + 2 b1
h
m
Therefore, the step from u to u m+1 requires the solution of the linear
system
∆t
(10) T um+1 = um + 2 bm+1
h
where T = (I − ∆tAh ) is a real, tridiagonal, positive definite, symmetric
matrix. As such it has a Cholesky decomposition T = CC T where C is
lower triangular bi-diagonal matrix, that is C has the form:
 
d1 0 . . . . . . 0
 .. 
 l2 d2 0 . 0 
 .. .. 
C=  0 l 3 d3 . 
. 
. . 
 .. .. ... ..
. 0 
0 ... 0 lN −1 dN −1
The Cholesky Decomposition permits us to replace the general system
Tu = f
with the two easily solved systems
(11) Cy = f
(12) CT u = y
6
The Heat Equation c 2007 Stephen Demko
°

Here’s a quick proof that the vector u obtained by solving systems (11)
and (12) solves the original system: T u = CC T u = C(C T u) = Cy = f .
It is important to note that the Cholesky Decomposition is computed one
time only and the vectors um for m ≥ 1 are calculated by

(13) Cy = um−1 + ∆tbm


(14) C T um = y

This is a very stable, very fast method.


The formation of the Cholesky Decomposition and the related LU -factorization
that is used when the system is not symmetric or positive definite will be
treated in a separate section. We note that the algorithm that results in
the Cholesky Decomposition of a tridiagonal matrix should take advantage
of all of the 0’s in the matrix T . The Cholesky Decomposition of a full
N × N matrix (i. e., one that has no discernible pattern of zeros) takes on
the order of N 3 operations, whereas the algorithm tuned to a tridiagonal
matrix takes on the order of N operations. In the case of moderate sized
N , say N = 100, the full decomposition takes 10, 000 times longer, roughly
speaking. Because of this, if a Cholesky factorization routine for tridiagonal
matrices is not available, one should use a routine for tridiagonal matrices.
The standard method used here is often called the Thomas Algorithm.
The solution of each of the systems (13) and (14) takes about N operations
if the Cholesky factors are computed as bi-diagonal matrices. If the full
matrix version decomposition is formed, these systems take on the order of
N 2 operations to solve. Since in time-stepping applications, one solves M
systems to get to the solution at time tM , the inefficiency of solving with
the full matrix version is only magnified.
One final remark on the issue of solving the sequence of systems that
arise in time-stepping. Students (and professors and professionals) often
think that because there is a formula for a solution to a problem, the best
way to find the solution is to invoke the formula. This is not true in general.
In particular, it is not true for the solution of linear systems, especially
tridiagonal ones. It is silly to calculate the inverse of T and then to calculate
um+1 by the formula um+1 = T −1 (um + ∆t b
h2 m+1
). The reason is two-fold:
(1) to find T −1 one has to solve N − 1 systems: T (columnk of T −1 ) = ek ,
where ek is the vector with 1 in position k and 0 everywhere else; (2) to
form the product T −1 z for any vector z takes on the order of N 2 operations.
(Actually, one can do it in about N log N if one is clever about it2; but that
is still not competitive with the Cholesky method.)
In summary, at each step of the solution process one must solve a tridi-
agonal system of equations, thus making the Implicit Method complicated
than the Explicit Method. However,

2Using and FFT-approach.


7
The Heat Equation c 2007 Stephen Demko
°

(1) The algorithm given for solution is very fast partly because by virtue
of the one time factorization many of the steps of Gaussian elimina-
tion needed to be carried out one time only.
(2) the Implicit Method is always stable while the Explicit Method has
stability “issues”
Crank-Nicolson Method. The idea here is to average the Implicit and
Explicit methods. First, we review the scalar case. For the equation
y 0 (t) = f (x, y)
the Explicit and Implicit Euler methods are given by the formulas:
yn+1 = yn + ∆tf (xn , yn )
yn+1 = yn + ∆tf (xn+1 , yn+1 )

The average of these is the formula


∆t
yn+1 = yn + (f (xn , yn ) + f (xn+1 , yn+1 )
2
which is the well-known, stable Trapezoid Rule method. So, we have hope
for stability here and expect that the error will be locally O(∆3 ) and globally
O(∆2 )
This turns out to be mathematically equivalent to taking a half step with
the Explicit Method and then another half step with the Implicit Method.
This method is presented in just about every discussion of the Heat Equa-
tion. Some authors describe it as the preferred method and others find fault
with it. The fact is that its performance depends on the particular type of
problem you are solving. One nice feature of the Crank-Nicolson Method
is that its order of accuracy is O(∆t2 ) which often makes it preferable to
either of the Euler-based methods described above. The formula in matrix
vector terms is:
∆t ∆t ∆t
(15) (I − Ah )um+1 = (I + Ah )um + 2 (bm+1 + bm )
2 2 2h
BDF2, a Multi-step Method. We recall the Implicit Quadratic Method
used to solve ODEs. Let q(x) be the quadratic polynomial that agrees with
y(x) at the three equally spaced points t − h, t, and t + h, and approximate
y 0 (t + h) by the derivative of q at t + h. The algebra shows that
1
y 0 (t + h) = (3y(t + h) − 4y(t) + y(t − h))
2h
If instead we wanted a formula for y 0 (t − h), we would be led to the rule
1
y 0 (t − h) = (−y(t + h) + 4y(t) − 3y(t − h))
2h
For y 0 (t) we would get the central difference approximation
1
y 0 (t) = (y(t + h) − y(t − h))
2h
8
The Heat Equation c 2007 Stephen Demko
°

As a rule in time stepping explicit formulas will carry constraints on their


stability whereas implicit methods stand the chance of being stable with
no side constraints. So, we use the first formula above in conjunction with
Ah u2 to start our time stepping:
1 1
(3u2 − 4u1 + u0 ) = Ah u2 + 2 b2
2∆t h
1
where u can be found by a step of the implicit method. One may choose
to do 2 or 3 initial steps with the implicit method to get things started.
Therefore, after having found u1 we solve the system
∆t
(3I − 2∆tAh )u2 = 4u1 − u0 + 2 b2
h
and in general
∆t
(3I − 2∆tAh )um = 4um−1 − um−2 + 2 bm
h
Stability Analysis. The time stepping matrix in first three methods can
be expressed as rational functions of the matrix A whose spectral properties
were analyzed in detail earlier. The main point is that σ(A) ⊂ (−4, 0) and
that these bounds are in a well-defined sense sharp.
Explicit Euler. Therefore, for the solution to remain bounded as m → ∞,
we need the eigenvalues of I + ∆th2
A to all be < 1. (Actually we can allow one
eigenvalue to be equal to 1 if it is a simple eigenvalue.) Since σ(A) ⊂ (−2, 2),
we see that σ(I + ∆t
h2
A) ⊂ (1 − 4 ∆t h2
, 1). The 1 on the right end is good, but
we need the left end to be no smaller than −1. That is, we need
∆t
1 − 4 2 > −1
h
From this we arrive at the stability condition:
∆t
< 0.5
h2
Implicit Euler. In this case we have to study the spectrum of (I − αA)−1
where α = ∆t h2
1
. So with f (z) = 1−αz , the behavior of f on the interval
(−4, 0). Since f is increasing for z < α1 , we need to look at only what
1
happens at the ends: f (0) = 1 f (−4) = 1+4α ≥ 0. So σ((I −αA)−1 ) ⊂ (0, 1)
and the method is stable with no restriction on α. In fact as α → ∞, the
corresponding eigenvalues tend to 0. Because of this one can say something
good about how the Implicit Method damps high frequency components of
the initial condition. The eigenvalues of A that correspond to the highest
frequency eigenvectors are the eigenvalues near −4. The eigenvalues of (I −
αA)−1 that come from these are the eigenvalues closest to 0. Therefore, the
highest frequencies are damped most quickly and the lower frequencies—the
ones that govern the gross shape of the time stepped initial condition—are
damped more slowly.
9
The Heat Equation c 2007 Stephen Demko
°

Crank-Nicolson. In this case the time stepping matrix is (I − ∆tAh )−1 (I +


1+αz
∆tAh ), so we consider the function g(z) = 1−αz for z ∈ (−4, 0). Now
1−4α
g(0) = 1. So far, so good. g(−4) = 1+4α . This is always less than 1, but can
be less than 0. Fortunately, as α → ∞ it always stays greater than −1. So
we can conclude that this method is stable. But, in some sense this is not
as nice as the implicit method because the eigenvalues that correspond to
the high frequency eigenvectors can get very close to −1. Because of this, it
is possible that non-smooth initial conditions do not dissipate as quickly as
one might hope they would and that spurious oscillations can contaminate
solutions computed with this method until they eventually die out.

BDF2. The stability analysis in this case is more subtle because of the two-
step nature of the method. First we represent the two initial vectors u0 and
u1 in terms of the eigenvectors of A, say
(16) u0 = a1 v1 + a2 v2 + · · · + an vn
(17) u1 = b1 v1 + b2 v2 + · · · + bn vn
Then, we can show that the coefficient of vi in the representation of un+1
in terms of these eigenvectors satisfies (we are not showing the dependence
of the coordinate on i):
4 1
(18) cn+1 = cn − cn−1
3 − 2αλi 3 − 2αλi
That is, the eigenvector coordinates each satisfy a three-term recurrence
relation in which the eigenvalue for that eigenvector plays a role.
We analyze the behavior of the cn ’s with the same method we used to
analyze stability of the ODE solvers based on quadratic interpolation. From
equation (18) we derive the quadratic equation:
(19) (3 − 2αλ)r2 − 4r + 1 = 0
where −4 < λ < 0 and α > 0. Things get a bit simpler if we set γ = −2αλ
and note that the only constraint on γ is that it be positive. The quadratic
formula gives:
p √
4 ± 16 − 4(3 + γ) 2 ± 1 − 4γ
(20) r= =
2(3 + γ) 3+γ
There are two cases to consider:(1) 0 < γ ≤ 14 , in which case the roots
are real and (2) γ > 14 in which case the roots are complex.
√ √
Case 1: There are 2 roots: r+ (γ) = 2+3+γ1−4γ
and r− (γ) = 2−3+γ1−4γ
. For
2
r+ we have r+ (0) = 1, r+ (0.25) = 3.25 < 1, and r+ is decreasing between
0 and 0.25. For r− we have r− (0) = 23 , r− (0.25) = 3.25 2
< 1, and r− is
increasing between 0 and 0.25. We note that the value of 1 obtained in the
case that γ = 0 cannot be attained in practice since γ is neither α (the ratio
of time step to space step) nor λ (eigenvalue of A) is ever 0.
10
The Heat Equation c 2007 Stephen Demko
°
q
4+(4γ−1)
Case 2: There are 2 complex roots, each of magnitude (3+γ)2
For
q
γ = 0 this expression equals 13 , for γ > 0 the expression decreases mono-
tonically to 0.
Finally, we note that the highly oscillatory eigenvectors of A, those that
correspond to eigenvalues of A close to −4. If we chose ∆t ≈ h, so that
α = h∆2 ≈ h1 ≈ N where N is the dimension of the matrix, we have γ ≈
8N . So we are usually in the regime of Case 2, so that all frequencies, in
particular the highly
q oscillatory ones, are damped quickly: each step reduces
1
the magnitude by 3.

Summary. The Heat Equation is important because (1) it can serve as


an initial test bed for numerical methods for more general parabolic partial
differential equations. Most PDEs that arise in Finance are of the parabolic
type; and (2) the constant coefficient Black-Scholes PDE can be transformed
to the Heat Equation. In this is how Black and Scholes arrived at their
original formulas.
The Explicit Euler Method is attractive because it can be implemented
quickly in a spreadsheet. It gives global accuracy of only O(∆t). It fails to
capture the ”infinite speed of propagation“ property of the solution of the
Heat Equation. However, it has a rigid stability requirement that effectively
limits its applicability when speed or high accuracy are needed. It is closely
related to some Trinomial Tree Methods.
The Implicit Euler Method requires the solution of a tridiagonal system
of equations at each time step. This can be done very quickly by performing
an initial Cholesky or LU decomposition and using the factors at each time
step. It offers global accuracy of only O(∆t), but its stability and an ability
to damp oscillations make it attractive.
The Crank-Nicholson Method offers O(∆t2 ) accuracy and requires the
solution of a tridiagonal linear system at each time step. However, it damps
the most oscillatory eigenvectors the least. Some practitioners avoid this
method for that reason. Sometimes calculating time steps 1 and maybe 2
with the Implicit Method (which is locally O(h2 )) can help get things started
on the right foot.
The BDF2 Method is a two-step method and, thus requires the initial
calculation of u1 by another method. The Implicit Method is usually used
for this. The BDF2 Method offers O(∆t2 ) accuracy and damps oscillations
well.
It is possible to adapt any standard ODE scheme to time stepping. For
example, one can write a time stepper based on the standard Runge-Kutta
schemes. So our treatment is only a beginning, but the method discussed
here are adequate for most problems that arise in this area.
It is hard to make direct comparisons among the various methods of option
pricing. PDE methods, when they can be applied, generally are more accu-
rate and give a more complete picture of the dynamics than tree or Monte
11
The Heat Equation c 2007 Stephen Demko
°

Carlo Methods. This is particularly true of estimates of the “Greeks”–the


various partial derivatives of the option price.
Finally, we note that the fact that the Crank-Nicholson and the BDF2
methods offer accuracy on the order of O(h2 + ∆t2 ) means that one can take
relatively large time steps and obtain reasonable accuracy.
Filling the White Space (only a little). If we have a more general
parabolic PDE, say
ut (x, t) = a(x)uxx (x) + b(x)ux (x, t) + c(x)u(x, t)
with some appropriate initial and boundary conditions. The process of space
discretization via finite differences gives rise to a system of ODEs
u0 (t) = M u(t) + b(t)
where M is a tridiagonal matrix that generally not symmetric. Time step-
ping can be carried out as described in the previous sections. As we’ve
seen the time-stepping methods give rise to iterations with functions of M .
However, the eigenvalues of M are most likely not know. One might know
enough about them to make claims of stability about a particular time-
stepping method. However, one might gain insight into the appropriateness
of various time stepping schemes by carrying out an empirical analysis of
the eigenvalues of M and how they are transformed by the time stepping
schemes. Since complex eigenvalues will arise, it will be necessary to do this
in the complex plane.

12

You might also like