This is a short example of taking a stochastic system, using Fokker-Planck to convert it to a PDES and using SUNDIALS to solve a 2D partial differential equation in Haskell via the hmatrix-sundials library. The example is taken from the C examples that come with the SUNDIALS source. Here’s the full blog.
#partial differential equations
6 posts
26 Apr 2020
18 Apr 2017
Introduction Tribbles originate from the planet Iota Geminorum IV and, according to Dr. McCoy, are born pregnant. No further details are given but we can follow Gurtin and MacCamy (1974) and perhaps recover some of what happens on the Enterprise. Of course, age-dependent population models are of more than fictional use and can be applied, for … Continue reading Trouble…
10 Feb 2014
Introduction Suppose we have a square thin plate of metal and we hold each of edges at a temperature which may vary along the edge but is fixed for all time. After some period depending on the conductivity of the metal, the temperature at every point on the plate will have stabilised. What is the … Continue reading Laplace’s Equation…
10 Feb 2013
Path Dependency Now we are able to price options using parallelism, let us consider a more exotic financial option. Let us suppose that we wish to price an Asian call option. The payoff at time is Thus the payoff depends not just on the value of the underlying at time but also on the path … Continue reading Parallelising Path…
5 Jan 2013
Can we get better performance for pricing financial options in Haskell? First let us translate our pricer using the Explicit Euler Method to use repa. {-# LANGUAGE FlexibleContexts, TypeOperators #-} {-# OPTIONS_GHC -Wall -fno-warn-name-shadowing -fno-warn-type-defaults #-} import Data.Array.Repa as Repa import Data.Array.Repa.Eval import Control.Monad r, sigma, k, t, xMax, deltaX, deltaT :: Double m, n, … Continue reading Option Pricing…
22 Apr 2012
We can solve our differential equation using the Implicit Euler method which is unconditionally stable. We can also take this opportunity to use the Vector Package rather than Arrays as it has a richer set of combinators and to tidy up the code to make the payoff explicit (thanks to suggestions by Ben Moseley). First … Continue reading The Implicit…