A partial differential equation (PDE) can be written as:
As mentioned above, a differential operator is used to discretize the derivatives on the right-hand side, while the evolution scheme discretizes the time derivative on the left-hand side.
As you know, finite-difference methods in finance start from a known state \(f(T)\), where \(T\) stand for the maturity of the swaption, and evolve backwards to settlement date \(f(0)\). At each time step, we need to evaluate \(f(t)\) based on \(f(t+\Delta t)\).
The Explicit Euler (EE) scheme can be written as below:
Which can be simplified as:
That only simple matrix multiplication is needed to approximate the equation which is mentioned at the first of this subsection makes the EE scheme becomes the simplest one in FDM.
The Implicit Euler (IE) scheme can be written this way:
Simplified as:
Which makes it a more complex scheme to approximate the PDE.
In our implementation, we adopt a generic template to support different schemes, which can be written as:
The formula transforms to EE scheme if we set \(\theta =0\), and it transforms to IE scheme if we let \(\theta =1\) instead. Any value from 0 to 1 can be used, for example, we give a \(\theta =\frac{1}{2}\) to utilize the Crank-Nicolson scheme.