Skip to content

How equations are integrated

This document describes how xolotl solves the Ordinary Differential Equations (ODEs) in its models.

xolotl is designed to solve for state variables of conductance-based neuronal and network models. The voltage across the membrane is given by

where is the specific membrane capacitance and is a specific transmembrane current. Each current takes the form

where is the instantaneous conductance and the ionic reversal potential. In many models, the conductance is given by

where is the maximal conductance in Siemens per unit area and and are gating variables . The gating variables themselves are defined by differential equations which depend on the membrane potential. These equations are nonlinear and usually quite stiff. For these reasons, bespoke integration schemes are typically used to solve them.

The Exponential Euler method

The exponential Euler method is a time-discrete solution to differential equations of the form:

where is the state variable and and are functions of . This equation can be solved as follows:

Rearrange equation

Divide by , multiply by

Integrate, using the relation

Given a constant term , the equation can be written

For a time step , the voltage at time can be approximated from the voltage at time , where and

This approximation is more accurate than a first order Euler method approximation, and is significantly faster than higher order (viz. Runge-Kutta) methods.

For more information

See Ch. 5, Dayan, P. and Abbott, LF (2001) Theoretical Neuroscience, MIT Press. You can read the full book here

Where this method is used

The exponential Euler method is used (when solver_order = 0)

  • to integrate the gating variables (m and h in every conductance). This method is defined in the conductance class.
  • to integrate the voltage in compartments (for compartments that are not part of multi-compartment models)
  • to integrate the Calcium levels in compartments (defined in some mechanisms)

The Runge-Kutta fourth-order method

The Runge-Kutta methods are extensions of forward Euler to higher derivative orders. Given a differential equation in the form

with some initial condition . The first order (Euler) approximation for given is

Euler's method is accurate per step. The Runge-Kutta fourth-order method uses four coefficients to extend this method to accuracy of per step at the cost of speed. The coefficients are, for ,

The time-evolution formula for the Runge-Kutta fourth order method is

The method is more accurate because slope approximations at fractions of are being taken and averaged. The method is slower because the four coefficients must be computed during each integration step.

Where this method is used

The Runge-Kutta 4th order method is used when (when solver_order = 4) for components that support this method. If any component does not support it, an error will be thrown.

The Euler method

Euler's method is the most basic explicit method for solving numerical integration problems of ordinary differential equations, and is the simplest Runge-Kutta method (i.e. it's 1st order). It is fast but inaccurate and unstable. Given a differential equation

with a known initial condition , the next step is determined by the evolution equation

This process can be iterated to determine the trajectory of with accuracy on the order of .

Where this method is used

Some mechanisms may implement this method.

The Crank-Nicolson Method

The Crank-Nicolson method (Crank & Nicolson 1947) is based on the trapezoidal rule. It gives second-order convergence in time by using a combination of the forward Euler method at time and a backward Euler method at .

For a compartment with upstream compartment and downstream compartment (it is part of a multi-compartment cable), the equation of state is


Here, is the membrane capacitance of compartment , is the axial conductance from compartment to compartment , is the conductance of conductance in compartment and is the reversal potential of conductance . Additionally, is the injected current, which here is scaled by the surface area of compartment .

By defining,

the equation of state above can be rewritten in the implicit form

where for the Crank-Nicolson method. This equation must be solved to determine . For multi-compartment models, this involves writing an algebraic expression that sequentially solves starting at one end of the cable and proceeding to the other end(s). Then, a second sweep from the tips back to the soma allows for explicit solving at the next time point.

For branching morphologies that do not branch back into itself (that is, there is only one path with backtracking from soma to tip for each tip), tridiagonal matrix solvers (viz. Thomas algorithm, Hines matrix solvers), can be used to dramatically speed up the calculations. Currently, xolotl does not support solving branching morphologies.

Where this method is used

The Crank-Nicolson method is the default for multi-compartment models. The Runge-Kutta method, while sufficient to integrate multi-compartment models accurately is orders of magnitude slower than the Crank-Nicolson method.


  • Theoretical Neuroscience. Dayan and Abbott. You can read the full book here