%pylab inline
lecture = 12
Populating the interactive namespace from numpy and matplotlib
II. Finite Difference Methods for Solving PDEs
III. Numerical Examples
It can be classified into three categories: Hyperbolic, Parabolic and Elliptic
In general, the different types of equations make a big difference in how the solutions behave and
on how we can solve them more effectively
$b^2(x,t) - a(x,t)c(x,t) = 0 $ $\;$
The canonical form:
$b^2(x,y) - a(x,y)c(x,y) < 0 $ $\;$
The canonical form:
Very rare that the PDEs have closed form solutions, in general, can only be solved numerically.
Will focus on the finite difference method (FDM): other numerical methods exist and can be more appropriate---very much depends on the actual problems at hand.
First step in solving PDEs using FDM is to represent the solution $u(x,t)$ as a discrete collection of values at a well distributed grid points in space and time in the proper domain.
For example, for the rectangular domain in space and time with $t \in [0, T]$ and $x\in [x_{min}, x_{max}]$, we can represent the points simply as
in time and
$$x_0 = x_{min}, x_1, x_2, \cdots, x_N = x_{max}$$in space. The grid is uniform, i.e. $t_{k+1} = t_k + \triangle t, \;\triangle t = \frac{T}{M}$ and $x_{i+1} = x_i + \triangle x, \;\triangle x = \frac{x_{max}-x_{min}}{N}$.
The values of $u(x,t)$ at any other desired points can be approximated via interpolation.
A uniform mesh may not necessary be the most efficient form to work with, in fact, it rarely is.
A greatly simplified rule-of-thumb: the mesh needs to be refined around the region where the function varies a lot
On the other hand, the mesh can be relatively coarse if the function is smooth and changing slowly
In finance, the time grid is well advised to keep the important dates as grid points: such as cash flow dates, contractual schedule dates, etc. The spacing of these dates is most likely not uniform.
Partial Derivative | Finite Difference | Type | Order |
---|---|---|---|
$\PDux$ | $\FDux$ | forward | 1st in $x$ |
$\PDux$ | $\FDuxb$ | backward | 1st in $x$ |
$\PDux$ | $\FDuxc$ | central | 2nd in $x$ |
$\PDuxx$ | $\FDuxx$ | symmetric | 2nd in $x$ |
$\PDut$ | $\FDut$ | forward | 1st in $t$ |
$\PDut$ | $\FDutb$ | backward | 1st in $t$ |
$\PDut$ | $\FDutc$ | central | 2nd in $t$ |
$\PDutt$ | $\FDutt$ | symmetric | 2nd in $t$ |
For any FDM that are used to solve practical problems, we should ask
Taylor series expansion can verify this (or one can simply read this off of the Toolkit Table).
So the explicit method above is consistent of order 1 in time and order 2 in spatial variable.
$\hspace{0.2in}$ again satifies the FDM due to linearity.
where $e^{at}$ is a special form of the amplitude, and $l_m$ is the wavelength: $l_m = \frac{\pi m}{L}, m = 1, \cdots, M, \mbox{ and } M = \frac{L}{\triangle x}$
This is the CFL condition for the explicit method, which says, in order for the explicit method to be stable, the time step size needs to be really small.
$r\neq 0$ case?
The Lax equivalence theorem holds for PDE as well.
Takeaway: when implementing FDM for PDEs, study the CFL (Courant–Friedrichs–Lewy) stability condition before building your discretization grid.
L. Andersen and V. Piterbarg, Chapter 4 of Interest Rate Modeling, Volumn I, Atlantic Financial Press, 2010.
D. Duffy, Finite Difference Method in Financial Engineering, John Wiley & Sons, 2006.