25.1 Introduction and Objectives
We continue from Chapter 24 with our discussion of the numerical solution of systems of first-order ordinary differential equations. Whereas in Chapter 24 we developed our own code to approximate ODEs, we now use the Boost odeint library to do the work for us. We then introduce the Method of Lines (MOL) that allows us to approximate the solutions of the time-dependent parabolic partial differential equations as discussed in Chapters 20 to 23. In this sense MOL is a competitor to the handcrafted time discretisation methods such as BTCS and Crank–Nicolson, for example. MOL offers a number of advantages:
- A1: It can be applied to linear time-dependent PDEs with a range of boundary conditions.
- A2: It can be applied to nonlinear PDEs such as UVM (Pealat and Duffy, 2011), CVA (Green, 2016) and early-exercise option pricing using penalty and barrier methods.
- A3: We can choose from a wide range of time-marching schemes, choosing the one that is most suitable to the problem at hand. For example, we may wish to produce highly accurate results or to choose a scheme that is suitable for stiff equations.
- A4: MOL is easy to apply to 2-factor and 3-factor PDEs, for example the two-dimensional heat equation, basket options, the Heston model and the anchoring problem of Chapter 23.
- A5: Run-time performance. MOL is a generic method that is suitable for linear and nonlinear PDEs and in general ...