PrevUpHomeNext

Overview

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 ~ dt2. 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

euler

Dense Output Stepper

System

1

No

Yes

No

Very simple, only for demonstrating purpose

Modified Midpoint

modified_midpoint

Stepper

System

configurable (2)

No

No

No

Used in Bulirsch-Stoer implementation

Runge-Kutta 4

runge_kutta4

Stepper

System

4

No

No

No

The classical Runge-Kutta scheme, good general scheme without error control

Cash-Karp

runge_kutta_cash_karp54

Error Stepper

System

5

Yes (4)

No

No

Good general scheme with error estimation, to be used in controlled_error_stepper

Dormand-Prince 5

runge_kutta_dopri5

Error Stepper

System

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

runge_kutta_fehlberg78

Error Stepper

System

8

Yes (7)

No

No

Good high order method with error estimation, to be used in controlled_error_stepper.

Adams Bashforth

adams_bashforth

Stepper

System

configurable

No

No

Yes

Multistep method

Adams Moulton

adams_moulton

Stepper

System

configurable

No

No

Yes

Multistep method

Adams Bashforth Moulton

adams_bashforth_moulton

Stepper

System

configurable

No

No

Yes

Combined multistep method

Controlled Runge-Kutta

controlled_runge_kutta

Controlled Stepper

System

depends

Yes

No

depends

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

Dense Output Runge-Kutta

dense_output_runge_kutta

Dense Output Stepper

System

depends

No

Yes

Yes

Dense output for Stepper and Error Stepper from above if they provide dense output functionality (like euler and runge_kutta_dopri5). Order depends on the given stepper.

Bulirsch-Stoer

bulirsch_stoer

Controlled Stepper

System

variable

Yes

No

No

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

Bulirsch-Stoer Dense Output

bulirsch_stoer_dense_out

Dense Output Stepper

System

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

implicit_euler

Stepper

Implicit System

1

No

No

No

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

Rosenbrock 4

rosenbrock4

Error Stepper

Implicit System

4

Yes

Yes

No

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

Controlled Rosenbrock 4

rosenbrock4_controller

Controlled Stepper

Implicit System

4

Yes

Yes

No

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

Dense Output Rosenbrock 4

rosenbrock4_dense_output

Dense Output Stepper

Implicit System

4

Yes

Yes

No

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

Symplectic Euler

symplectic_euler

Stepper

Symplectic System Simple Symplectic System

1

No

No

No

Basic symplectic solver for separable Hamiltonian system

Symplectic RKN McLachlan

symplectic_rkn_sb3a_mclachlan

Stepper

Symplectic System Simple Symplectic System

4

No

No

No

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

Symplectic RKN McLachlan

symplectic_rkn_sb3a_m4_mclachlan

Stepper

Symplectic System Simple Symplectic System

4

No

No

No

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

Velocity Verlet

velocity_verlet

Stepper

Second Order System

1

No

No

Yes

Velocity verlet method suitable for molecular dynamics simulation.



PrevUpHomeNext