...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
Home  Libraries  People  FAQ  More 
odeint is a library for solving initial value problems (IVP) of ordinary differential equations. Mathematically, these problems are formulated as follows:
x'(t) = f(x,t), x(0) = x0.
x and f can be vectors and the
solution is some function x(t) fulfilling both equations
above. In the following we will refer to x'(t) also
dxdt
which is also our notation
for the derivative in the source code.
Ordinary differential equations occur nearly everywhere in natural sciences. For example, the whole Newtonian mechanics are described by second order differential equations. Be sure, you will find them in every discipline. They also occur if partial differential equations (PDEs) are discretized. Then, a system of coupled ordinary differential occurs, sometimes also referred as lattices ODEs.
Numerical approximations for the solution x(t) are calculated iteratively. The easiest algorithm is the Euler scheme, where starting at x(0) one finds x(dt) = x(0) + dt f(x(0),0). Now one can use x(dt) and obtain x(2dt) in a similar way and so on. The Euler method is of order 1, that means the error at each step is ~ dt^{2}. This is, of course, not very satisfying, which is why the Euler method is rarely used for real life problems and serves just as illustrative example.
The main focus of odeint is to provide numerical methods implemented in a
way where the algorithm is completely independent on the data structure used
to represent the state x. In doing so, odeint is applicable
for a broad variety of situations and it can be used with many other libraries.
Besides the usual case where the state is defined as a std::vector
or a boost::array
, we provide native support for the
following libraries:
In odeint, the following algorithms are implemented:
Table 1.1. Stepper Algorithms
Algorithm 
Class 
Concept 
System Concept 
Order 
Error Estimation 
Dense Output 
Internal state 
Remarks 

Explicit Euler 

1 
No 
Yes 
No 
Very simple, only for demonstrating purpose 

Modified Midpoint 

configurable (2) 
No 
No 
No 
Used in BulirschStoer implementation 

RungeKutta 4 

4 
No 
No 
No 
The classical RungeKutta scheme, good general scheme without error control 

CashKarp 

5 
Yes (4) 
No 
No 
Good general scheme with error estimation, to be used in controlled_error_stepper 

DormandPrince 5 

5 
Yes (4) 
Yes 
Yes 
Standard method with error control and dense output, to be used in controlled_error_stepper and in dense_output_controlled_explicit_fsal. 

Fehlberg 78 

8 
Yes (7) 
No 
No 
Good high order method with error estimation, to be used in controlled_error_stepper. 

Adams Bashforth 

configurable 
No 
No 
Yes 
Multistep method 

Adams Bashforth Moulton 

configurable 
No 
No 
Yes 
Combined multistep method 

Controlled RungeKutta 

depends 
Yes 
No 
depends 
Error control for Error Stepper. Requires an Error Stepper from above. Order depends on the given ErrorStepper 

Dense Output RungeKutta 

depends 
No 
Yes 
Yes 
Dense output for Stepper
and Error
Stepper from above if they provide dense output functionality
(like 

BulirschStoer 

variable 
Yes 
No 
No 
Stepper with step size and order control. Very good if high precision is required. 

BulirschStoer Dense Output 

variable 
Yes 
Yes 
No 
Stepper with step size and order control as well as dense output. Very good if high precision and dense output is required. 

Implicit Euler 

1 
No 
No 
No 
Basic implicit routine. Requires the Jacobian. Works only with Boost.uBLAS vectors as state types. 

Rosenbrock 4 

4 
Yes 
Yes 
No 
Good for stiff systems. Works only with Boost.uBLAS vectors as state types. 

Controlled Rosenbrock 4 

4 
Yes 
Yes 
No 
Rosenbrock 4 with error control. Works only with Boost.uBLAS vectors as state types. 

Dense Output Rosenbrock 4 

4 
Yes 
Yes 
No 
Controlled Rosenbrock 4 with dense output. Works only with Boost.uBLAS vectors as state types. 

Symplectic Euler 

1 
No 
No 
No 
Basic symplectic solver for separable Hamiltonian system 

Symplectic RKN McLachlan 

4 
No 
No 
No 
Symplectic solver for separable Hamiltonian system with 6 stages and order 4. 

Symplectic RKN McLachlan 

4 
No 
No 
No 
Symplectic solver with 5 stages and order 4, can be used with arbitrary precision types. 

Velocity Verlet 

1 
No 
No 
Yes 
Velocity verlet method suitable for molecular dynamics simulation. 