PyDDE: Python/C DDE solver research :: home  

Update. User hensing on GitHub has packaged up PyDDE 0.2.2 with Renato Coutinho's port to Python 3. That is now the best source for PyDDE:

PyDDE is an open source numerical solver for systems of delay differential equations (DDEs), implemented as a Python package and written in both Python and C.

PyDDE is built around the back-end of ddesolve (now called PBSddesolve), an R package with the same functionality, which in turn is built on the numerical routines of Simon Wood's Solv95, a C-based DDE solver for Microsoft Windows systems. There is now also a Mac port for Solv95, with Cocoa frontend by Ashley Buckner. If you use a different OS or prefer that your simulations are scriptable within a nice environment like Python, you might wish to read on!

My involvement in any ongoing development of PyDDE has ceased. Recent development has continued on GitHub, and for PBSddesolve. If you prefer to use R, you might consider employing PBSddesolve instead or PyDDE.

Requirements. PyDDE requires Python, of course, and either of the Numeric or NumPy packages, which can be downloaded via the NumPy site.

Download. PyDDE is now on GitHub: here.

About PyDDE

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. 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 (now called PBSddesolve), 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 have used both), I decided to move PyDDE to the same back-end used by ddesolve. Apart from the usual issues likely to be encountered when translating between programming languages, it should be trivial to port models from (PBS)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.

Solution to a Lotka-Volterra predator-prey model.
Solution to Gurney & Nisbet's (1981) model for Nicholson's (1954) blowflies.
Solution to a DDE with switches.
© 2005 B.J. Cairns.
© 2002-2017 Benjamin J. Cairns: e-mail ; ph +44 1865 289673 ;
Cancer Epidemiology Unit, University of Oxford, Richard Doll Building, Roosevelt Drive, Oxford OX3 7LF, U.K.