Documentation for ANISE
©
(Algorithm for Numerical Integration of Stochastic Equations)
Documentation in pdf form
Documentation in ps form
Copyright © 2004 by Yin Mei Wong.  ANISE cannot be distributed without the written permission of Innovative Stochastic Algorithms.
How ANISE works
ANISE is a numerical integration algorithm for solving systems of Itô stochastic differential equations (SDES) with strong solutions
where j = 1,..., n and
Here dWkt are normally distributed differentials with mean 0 and variance dt. These differentials must be supplied by the user. They can be generated from uniformly distributed random numbers using the Box-Muller algorithm. The functions
and
must be differentiable to high order (greater than 8) in all variables, because this is a necessary condition for the existence of strong solutions, but are otherwise arbitrary.
Generally the program works much like a Runge-Kutta algorithm for ordinary differential equations. The user calls ANISE repeatedly over a sequence of relatively small time steps of length dt in order to obtain a dynamics over some larger time scale. At each time step the user provides stochastic differentials dWkt which are sampled N(0, dt). ANISE asks the user to provide derivatives
at a number of intermediate points. This information is used to deduce the functional dependence of the solutions on time t and the Wiener processes Wtk. Based on this data the solutions are advanced from the current time t to t + dt. The accuracy of the solution is maintained by comparing an internal estimate of the error to a user specified tolerance at all intermediate steps.
The Fortran call sequence for ANISE is
call anise(n, m, t, x, dt, dw, tol)
and the C/C++ call sequence for ANISE (type void) is
anise(n, m, t, x, dt, dw, tol)
|     | fortran | C/C++ | description |
|     | integer*4 n     | int   n;     | number of equations (input) |
|     | integer*4 m     | int   m;     | number of Wiener processes (input) |
|     | real*8 t     | double t[1];     | current time (input, t + dt on return) |
|     | real*8 x(n)     | double x[n];     | initial conditions (input, solutions at t + dt on return) |
|     | real*8 dt     | double dt;     | desired time step (input) |
|     | real*8 dw(m)     | double dw[m];   | stochastic differentials (input sampled N(0,dt)) |
|     | real*8 tol     | double tol;     | desired tolerance (input) |
The fortran user must supply a subroutine stod of the form
subroutine stod(n,m,t,v,x,y)
and the C/C++ user must supply a function stod (type void) of the form
stod(n,m,t,v,x,y)
|     | fortran | C/C++ | description |
|     | real*8 v(m)  | double v[m];  | supplied by anise |
|     | real*8 y(m)  | double y[m];  | returned by stod |
The quantities y(n) are defined via
and are linear combinations of the derivatives discussed above.
Installing ANISE
ANISE is distributed as a pre-compiled subroutine and thus requires no installation. To make the routine available to multiple users in a linux environment create a library via the command
ar r libanise.a anise.o
and put the library in the /usr/local/lib directory. Users can then link to the library when compiling in the usual way (e.g. g77 -g myprogram.f -o myprogram -lanise or gcc -g myprogram.c -o myprogram -lanise or g++ -g myprogram.c++ -o myprogram -lanise).
Optional Installation of the GNU gcc/g++/g77 compilers
For users who do not at present have access to a compiler, the GNU compilers gcc/g++/g77 are freely available and easy to install (see gcc.gnu.org). Windows users must choose between installing minGW (minimalist GNU for Windows www.mingw.org) and cygwin (GNU+Cygnus+Windows www.cygwin.com). Both are very simple to install. minGW includes the gcc/g++/g77 compilers but a separate gcc/g++/g77 package must be installed with cygwin.
Getting a random number generator
Generation of random numbers with good statistical properties is an essential prerequisite for successful use of ANISE. An excellent well tested algorithm for generating uniform random numbers, ran2.f or ran2.c/ran2.c++, is included with Numerical Recipes Software package (www.nr.com). An algorithm gasdev.f or gasdev.c/gasdev.c++ is also available for generating normally distributed random numbers. By default this calls a function called ran1.f or ran1.c/ran1.c++. We recommend that this be replaced with a call to ran2. Alternatively a number of generators of uniform and normally distributed random numbers are available for free download from the GAMS (Guide to Available Mathematical Software) website gams.nist.gov. The algorithm drnor.f, for example, has been tested and can be downloaded from the GAMS website at gams.nist.gov/serve.cgi/Module/NMS/DRNOR/11308/.
The Box-Muller algorithm
The Box-Muller algorithm is used to generate normally distributed stochastic numbers with zero mean and unit variance from a pair of uniformly distibuted numbers on [0, 1]. Specifically, if x1 and x2 are independent and uniformly distributed then
is normally distributed with zero mean and unit variance.
Generating colored noise with ANISE
Colored noises with given statistical properties can be easily generated using the ANISE program. Suppose for example that a noise Vt with correlation function
is desired. In many cases it is possible to expand
(t) as a sum of the form
This expansion can for example be generated using a least squares method or with the free Harminv program (http://ab-initio.mit.edu/harminv/). Provided that the coefficients Aj are positive then the noise Vt can be generated from Wiener processes Wtj via
Now the colored noise Vt can be generated using ANISE by integrating the stochastic differential equations
for all j.
* Innovative Stochastic Algorithms *
  Top