A solver for delay differential equations written in Python and C.
PyDDE can solve a wide range of ODE and DDE models with discontinuities that may have state-dependent effects but state-independent timings. Simulation is handled by an adaptively-stepping embedded RK2(3) scheme with cubic Hermite interpolation for calculation of delay terms. Some of the advantages of PyDDE are that it is fast, efficient and allows rapid prototyping of scriptable models in a free, platform-independent environment.
Motivation. There is a lack of easily-obtainable numerical solvers of delay differential equations for interpretted languages. Most solvers require either some knowledge of programming in either C or FORTRAN, or run only under proprietary environments such as MATLAB TM.
One freely-available (open source and distributable for non-commercial purposes) DDE solver is Simon Wood's Solv95, which employs an adaptively stepping embedded RK2(3) scheme with cubic hermite interpolation in calculating delay terms. Some of the advantages of Solv95 are that it is fast, efficient and can solve a wide range of ODE and DDE models. One of its drawbacks is that rapid prototyping of models (that interpretted languages typically provide) is hampered by the requirement that models be written in C. Also, Solv95 was developed for a Microsoft Windows environment and has been ported to the Mac OS 10.4, but is not available to users of other systems without significant modification.
Python is a free language and interpreter that is available for virtually all modern operating systems and most hardware platforms. It is purpose built to be extremely flexible and extensible. The Python.org quotes page gives an idea of the wide range of uses of Python. Because of these advantages I chose Python as an environment in which to wrap Solv95 as a fast, powerful, easy-to-use and cross-platform DDE solver.
Differences between ddesolve and PyDDE. PyDDE started life in late 2005 as a port of Solv95. It was a pretty faithful port, and it worked, but was not very user-friendly. Just when I was looking into creating a new port of Solv95 for R, along came ddesolve, by Alex Couture-Beil, Jon Schnute and Rowan Haigh from Fisheries and Oceans Canada's Pacific Biological Station. In order to simplify maintenance of both ports (and I personally use both), I decided to move PyDDE to the same back-end used by ddesolve. There are a couple of minor simplifications, and a new function to simplify interfacing with the integration routines, but otherwise PyDDE is just as powerful and flexible as before. As a bonus, it is also easier to use! Apart from the usual issues likely to be encountered when translating between programming languages, it should be trivial to port models from ddesolve to PyDDE.
Differences between Solv95 and PyDDE. PyDDE is built directly on the ddesolve back end, and ddesolve is built directly on the code used in Solv95, but there are a number of differences. The most important are related to speed: since PyDDE uses Python as another layer over the Solv95 algorithms, it is a bit slower than the original. (Note that PyDDE does not wrap the R interface from ddesolve; the interface to the back-end uses only Python and C libraries.) Much of the memory management has been rewritten, so 'mileage may vary' a little here also. However, in practical terms PyDDE should perform comparably in most situations. It also has better error-handling and makes available the power of Python to process solution data, so extra computation time should be more than made up for by much faster model development.