Github link. I wrote some Python code to plot solutions to the wave equation on the unit square with Dirichelt boundary conditions. A spectral method is used, in particular the 2d fast sine transform.
Github link. The Korteweg-de Vries (KdV) equation is a nonlinear partial differential equation modelling shallow water waves. I wrote Python code for solving the KdV equation with periodic boundary conditions using the explicit finite difference method outlined in this paper. Also included is a function to generate random inital data with periodic boundary conditions.
Github link. The Benjamin-Bona-Mahony equation (BBM) equation is a refinement of the KdV equation for modelling shallow water waves. I solve this equation using a spectral method. The main tools used are the fast Fourier transform for spatial integration and and scipy.integrate.solve_ivp, an explicit Runge-Kutta method, for time integration. One interesting fact about the BBM equation is that, although it has solitary wave solitions as can be seen below on the left, these solitary waves are not solitions. After the waves interact, the wave the wave profiles are changed, as can be seen below in the middle.
Github link. Python code for solving the complex Ginzburg-Landau equation with periodic boundary conditions. The complex Ginzburg-Landau equation is one of the most studied equations in physics and describes phenomenon from Bose-Einstein condensates to superconductivity. I solve this nonlinear equation using a Strang splitting method. This is an equation I have studied extensively during my PhD. However, as this equation is complex valued, its solutions are quite hard to visualise. This code helped me understand how this equation and its solutions behave.
Github link. Python code for simulating the Ising model using the Metropolis-Hastings algorithm. The Ising model is known for being one of the simplest statistical models to exhibit phase transitions. It models phenomenon such as ferromagnetism. The long term behavior of the sytem depends heavily on the temperature parameter. Below are some animations for a very low. As can be seen, given a 'television snow' background, that is on the 50 by 50 grid each square is randomly either 1, black, or -1, white, the system evlolves to be either completely black or completely white.
If instead we start from a 'white background'. Then the long term behaviour also depends heavily on the temperature paramter. If the temrperature is low enough, below on the left. The system will remain mostly white. If instead the temperature is high enough, below on the right, the system will become roughly equally white as it is black.
This models the behaviour of magents. If a magent is heated to a high enough temperature it loses its magnetization.
Github link. A Python module for pricing exotic options, such as Asian options, Barrier options and Lookback options, using the risk neutral pricing formula and Monte Carlo. I wrote this module in an object oreintated style to make it easy to implement more exotic options when needed. The price this code gives for a European option is in very good agreement with the exact pricing formula. I developed this module for model validation purposes: I can check more complicated PDE exotic option pricing methods using this module.
Github link. Python code for calibrating, that is finding appropraite paramters given some data, the SABR volatility model. SABR is usually pronounced like "saber" in "lightsaber". The SABR volatility model, introduced this paper describes how the market implied volatility of, say a European option, depends on the strike price of the option. This is interesting becuase, according to standard Black-Scholes, theory the market volatility of an option should not depend on the strike price.