conservation_ode, a MATLAB code which monitors the conservation of a quantity that should be constant, during the solution of an ordinary differential equation (ODE).

In most real world cases, the exact solution of an ODE is not known. In many such cases, however, one or more conserved quantities can be identified, such as mass, momentum, or energy. Then an important indicator of ODE solution quality is the accuracy with which conservation constraints are observed.

ODE's which have a conserved quantity include:


The computer code and data files described and made available on this web page are distributed under the GNU LGPL license.


conservation_ode is available in a MATLAB version and an Octave version and aPython version..

Related Data and Programs:


matlab_ode, MATLAB codes which set up various ordinary differential equations (ODE).


Source code:

The pendulum.

Predator prey.

Rigid body.

Last revised on 09 June 2021.