The goal of this hands-on course is to introduce the new language features in C++ 11 and apply them to the design and implementation of frameworks to approximate the solution of partial differential equations (PDE) using the finite difference method (FDM). We design the frameworks with reusability and extendibility in mind so that you add your own solvers to the framework or apply design techniques to other kinds of applications in computational finance. In particular, we combine the object-oriented and functional programming models that C+11 supports and we encapsulate the algorithms in a next-generation design patterns object network.
Lecture 1. New Fundamental Language Features in C++11
In this lecture we discuss the new syntax that makes C++11 a ‘better C++’ in terms of understandability and reliability of code. Topics include: auto, decltype, noexcept, constexpr, nullptr, uniform initialization and initializer lists, template typedef, default template parameters, new fundamental data types.
Lecture 2. Advanced Language Features in C++11
In this lecture we discuss features that improve the efficiency and robustness of C++ code. Topics include: variadic templates, move semantics A-Z and smart pointers. We shall use these features when developing PDE models in C++.
Lecture 3. Introduction to Functional Programming in C++11
C+11 is a multiparadigm programming language. In this lecture we give a short overview of the functional programming (FP) model and how C++11 supports it. Topics include: FP essentials, from function pointers to universal function wrappers, higher-order functions, strict and delayed variables, C++ binders and lambda functions.
We shall see how powerful and useful the functional programming model is when developing mathematical algorithms for the finite difference method.
Lecture 4. Data Structures
In this lecture we introduce a number of new data types. Topics include: tuple, union, fixed-size arrays and unordered containers. We show some examples of use, including how to use them in design patterns code.
Lecture 5. Applied Functional Programming in C++11
In this lecture we apply C++ to the creation of next-generation design patterns and classes that model a number of essential entities in the PDE software framework. The focus is on creating code that is portable and that can be extended to suit a wide range of PDE models. It is the combination of the object-oriented and functional programming models that provides the foundation for flexible software. Topics include: implementing Bridge, Whole-Part, Adapter and other design patterns.
Lecture 6. Creating Software Frameworks
In this lecture we introduce a framework that can accommodate one-factor (and later two-factor) option pricing problems. The framework is based on experience with several software projects that have proved to be successful. The focus is on applying and integrating the topics from the first five lectures to produce customisable applications. Of particular importance is applying system patterns such as Layers and Builder.
Lecture 7. One-Factor Option Pricers
In this lecture we implement several popular finite difference schemes and we add them to the framework. Included are Crank-Nicolson, implicit Euler and Richardson extrapolation. We discuss how to model boundary conditions and payoff functions. We also pay attention to the choice of matrix solver (for example, Eigen, Boost uBLAS or minimal library) and efficiency issues.
Lecture 8. Advanced Option Pricers
We elaborate on the topics in lecture 7 by discussing nonlinear PDEs in computational finance, for example uncertain volatility models (UVM), anchoring (Asian-style problem) and early exercise features. We use both the Method of Lines (MOL) in Boost and Alternating Direction Explicit (ADE) to produce high-order accurate and efficient schemes.
Lecture 9. Two-Factor Option Pricing Models
In this lecture we give an overview of the main finite difference methods to price two-factor option problems. Topics include: Alternating Direction Implicit (ADI), ADE, MOL and the Method of Fractional Steps (‘Soviet Splitting’). We set up the systems in each case and we give examples in comptutational finance such as baskets, Heston and Asian-style PDEs.
Lecture 10. Project Discussion
The main focus of the projects is to take a focused and well-defined problem, solve it with one or more finite difference schemes and implement the schemes using C++11 and related design patterns.
- The Method of Lines (MOL) using the Boost C++ odeint library.
- PDEs with uncertain parameters.
- ADE for stochastic volatility models.
- Build a prototypical customisable framework in C++11 for two-factor PDE problems.
The final project will be marked with feedback and a pass or fail will be given when you take the online course. One retake is allowed if you fail.