# 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-Nicholson Method¶

### Where this method is used¶

## Bibliography¶

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