Numerical solution of Systems of Stochastic Differential Equations (new)

This is a wonderful program (one of the best programs I've ever written), in its very stable version, although not the final one (I would like to improve it someway).

The goal is to numerically solve systems of differential equations, not only the ordinary ones (ODE), but also stochastic ones (SDE), and now even discrete.

Input

As input, it takes (obviously) the coefficients of your system (as many dimensions as you like). SDE has two types of coefficients: drift (as the ordinary ones) and diffusions (by setting them to 0 you can solve ODE).

I have to thank some guys from the University of Moscow who wrote a very beautiful piece of code (actually a Delphi Component), that compile at run-time mathematical formulas, from a String parameter, to 80x86 code. Someday I will pay to register it, but now you still have to see their copyright... sorry! ... but this is a fairytale of yesterday...

Now I've just finished a wonderful Delphi (and Kylix) Component which does thes same as theirs... its name is RPNCompiler (you should take a look to understand how to write valid expressions).

In these formulas the name of the components of your system are called x1, x2, x3 and so on. Time is x0.

You must also give initial conditions, the range (in time) of the solution and the discretization step.

Algorithm

There are 5 algorithms

  1. Weak of order 1.0
  2. Euler 0.5 (strong)
  3. Milstein 1.0 (strong)
  4. Uni 1.5 (strong)
  5. Runge-Kutta 5.0 (deterministic)

The are some restrictions in the diffusion matrix for the higher order algorithms.

Output

The are two different outputs: visual and data.

Visual output

You can plot the solutions (toghether) vs. Time in a normal XY plan, or two of them in a phase plane.

You can also calculate the expectation and the density (even if you cannot see it yet...) of a function of the solution at a particular time (as to calculate the value of a standard option), choosing the size of your sample.

Data output

You can send the solution (as a stream of values) to Excel (live data with DDE) or to Access tables.

In the new version Access is no more supported, it will be possible to write down data in a CSV-like text file, but I need some more time...

The DDE is now fully functional: from Excel you have to write a formula like this (case sensitive):

=AndSoft|ASI!'start;end;step;component1;component2;...;'

where

parameter meaning
start the start point in time
end the end point in time
step step in time
componentN the component number you want (0 being the time)

so if you want the second and fourth components (and the time), from 1 to 5 (step 0.1) you should write

=AndSoft|ASI!'1;5;0.1;0;2;4;'

Source code

The source code is for Delphi 6, but I think you can use Delphi 2 and above.
The file AndSoft.src.zip contains the source code of the package AndSoft which is needed to copile ASIsolver.

Download  
EXE for Win9x ASIsolver.zip (360 kB)
Source code in Delphi 6 ASIsolver.src.zip (34 kB)
AndSoft.src.zip (32 kB)


Bifurcation diagrams

In the new release you can also plot bifurcation diagrams and Lyapunov exponents of a discrete system, like the case of the very known logistic map

x(n+1)=L*x(n)*(1-x(n))

which should be written as

x0*x1*(1-x1)

because of the following table

parameter meaning
x0 L (the coefficient)
x1 x(n) (the value of the state variable at time n)