XPP - quirky but declarative and interactive

Complex systems in fields like System Biology can often be described as a set of differential equations. These differential equations represents how species like proteins and enzymes change over time during various circumstances, like differing initial conditions and parameters. The behavior of the system corresponds to various biological phenomena like cell differentiation. Usually one has a bunch of these equations, based on experiments, assumptions or both, and want to figure out how the system, say, a cell, behaves. XPP is a tool that makes this easy.

XPP is a quirky tool (the interface has barely changed since its MSDOS days), and I was skeptical when I first encountered it. It's apparently quite a common tool in System Biology though, and it seems useful for when you want to get an understanding of how complex systems behave over time. Here's a quick example of how XPP is used, and more specifically showing it's tremendous declarative and interactive nature. Some familiarity with ODEs is probably useful.

This is a simple two-species chain reaction (-> s1 -> s2 ->) modeled by two ODEs, a couple of parameters and some initial conditions. We save the follow in a text file with the .ode extension and open it in XPP.

par v0=5
par k1=3, k2=2
s1' = v0 - k1*s1
s2' = k1*s1 - k2*s2
init s1=1, s2=2

That's all there is to it. It's extremely succinct and declarative - we are just writing out what we know, like we would using pen and paper. Compare this to the equivalent code in something like Matlab - in itself a succinct language. This is the power of using languages built for a specific domain. If we wanted to and if it was necessary, we could give XPP information about the system, whether it's a stiff differential equation etc, but for regular cases the above works just fine.

XPP is very interactive and keyboard-driven. Here's how we might do some very basic exploration.

The simplest possible thing we can do is to graph a species over time. To do this we numerically simulate the model using initial conditions (I C) then fit the window to the appropriate size (W F - W Z to zoom). We can also do things like plotting a range of initial values (I R) to see how a bunch of different initial conditions change the behavior and to quickly get a sense of where things settle down to a steady state.

We can also easily do a phase plane graph (V 2) together with a direction fields (D D), null clines (N N) and naive linearized stability analysis (S M) in a couple of key presses. Not to mention all kinds of numerical tweaking, and things like bifurcation analysis.

While the program itself has many quirks, with such a declarative syntax and interactive workflow it's no wonder so many researchers in fields like System Biology use it.

The example has been adapted from the book Mathematical Modeling in Systems Biology by Brian Ingalls. XPP can be downloaded here: https://posthaven.com/www.math.pitt.edu/~bard/xpp/xpp.html