Giter Site home page Giter Site logo

sdelab2's Introduction

SDELAB2

This is a reimplementation of SDELAB, a MATLAB package for generating sample paths of initial-value problems for SDEs numerically, as described in

H. Gilsing and T. Shardlow. SDELab: a package for solving stochastic differential equations in MATLAB. In: J. Comput. Appl. Math. 205.2 (2007), pp. 1002โ€“1018. issn: 0377-0427. doi: 10.1016/j.cam.2006.05.037 .

SDELAB2 is implemented in Julia and provides the functionality described in this paper, though there are changes in syntax. The key differences are

  • drift and diffusion are autonomous (non-automous functions needs to disguised as an autonomous SDE)

  • you specify the drift function (y->f(y)), diffusion-matrix function ((y,dw)->g(y) dw), and diffusion-vector function (dif_vec[i]=(y->gi(y)) (i.e., a vector of functions y->gi(y).

  • automatic differentiation creates Jacobian fns for f (for nonlinear solve) and for the diffusion-vector function gi (for Milstein methods)

  • the main driver routine is

t,y,W=sde_strong_solution(fcn, tspan, y0, opt)

where the return values are a vector of times t and corresponding matrix of solutions y (with rows corresponding to times), and the position W of the driving Brownian motion at the final time,

and the inputs are:

  • fcn is a special data type for describing the SDE coefficient functions, created by

fcn=set_fcn(d,m,y->drift_f(y,p),(y,dw)->diff_g_mat(y,dw,sig),diff_g_vecs(sig), noise_type)

(here p and sig are parameters)

for d=phase-space dimension, m=number of Brownian motions,

  • drift_f, diff_g_mat, diff_g_vecs are the coefficient functions for the SDE,

  • noise_type=1 (unstructured), =2 (diagonal), =3 (commutative) (see the above paper for the meaning of this).

  • tspan=well-ordered vector of times where the solution is required

  • y0=d-vector of initial data

  • opt=set_opt(dt,method), where dt=maximum time step,

  • method="SIE0" or "SIE1" or "SIE" (Euler-Maruyama for explicit, implicit, or alpha-implicit),

  • "SSEH0" or "SSEH1" or "SSEH" (explicit Stratonovich Heun for explicit, implicit, or alpha-implicit),

  • "SIM0" or "SIM1" or "SIM" (for Ito Milstein),

  • "SSM0" or "SSM1" or "SSM" (Stratonovich Milstein), or

  • "SIBDF" (second-order BDF).

See above-referenced paper for details. All use auto-computed derivatives.

opt can be further adjusted to set

opt["Alpha"]=parameter alpha for alpha-implicit methods (default alpha=0.5; trapezium rule)

opt["nlsolve_param"].maxfeval and .ftol and .xtol to control nonlinear sovler (default 10,1e-6,1e-8)

opt["calc_final_W"] gives final position W of driving Wiener process (useful for calculating exact soln of geometric BM)

opt["do_plotting"]=true or false, for automatic plotting via PyPlot

opt["always_clear"]=true or false, to clear current plot each time

opt["output_sel"]= vector of indicies to plot (default to [1,2])

opt["output_plot_type"]="path_plot" or "phase_plot" ("time_phase" and "phase3_plot" not yet implemented).

SDELab2 depends on the Julia packages NLsolve and PyPlot.

The package is currently being refined. The four examples presented (geometric Brownian motion, Van der Pol, FitzHugh-Nagumo PDE, and Hodkin-Huxley) illustrate its use.

sdelab2's People

Contributors

tonyshardlow avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

eeshan9815

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.