Skip to content

ComputationalScienceLaboratory/ODE-Test-Problems

Repository files navigation

ODE Test Problems

ODE Test Problems

Version License Tests Documentation

ODE Test Problems (OTP) is an object-oriented MATLAB/Octave package offering a broad range of initial value problems in the form of ordinary and differential-algebraic equations that can be used to test numerical methods such as time integration or data assimilation. It includes problems that are linear and nonlinear, homogeneous and nonhomogeneous, autonomous and nonautonomous, scalar and high-dimensional, stiff and nonstiff, and chaotic and nonchaotic. Many are real-world problems in fields such as chemistry, astrophysics, meteorology, and electrical engineering. OTP also supports partitioned ODEs for testing split, multirate, and other multimethods. Functions for plotting solutions and creating movies are available for all problems, and exact solutions are included when available. OTP is designed for ease of use meaning that working with and modifying problems is simple and intuitive.

OTP is actively under development. We are currently writing full documentation in order to release version 1.0.0

Installation

MATLAB

  1. Download the latest OTP toolbox file.
  2. Open the toolbox file from MATLAB and follow the installer. See MATLAB's instructions for additional details.

Octave

In Octave, run

pkg install 'https://github.com/ComputationalScienceLaboratory/ODE-Test-Problems/releases/latest/download/OTP.zip'

then load the package with

pkg load 'ode test problems'

From Source

For local development, OTP can be installed by running

OTP.install

from the root directory of the project. If no longer needed, it can be uninstalled with OTP.uninstall.

Example

% Create a problem
problem = otp.lotkavolterra.presets.Canonical;

% Solve the problem
sol = problem.solve('RelTol', 1e-10);

% Plot the solution
problem.plot(sol);

% Adjust a parameter
problem.Parameters.PreyDeathRate = 2;

% Manually use a MATLAB ODE solver to solve the problem
options = odeset('Jacobian', problem.RHS.Jacobian);
[t, y] = ode15s(problem.RHS.F, problem.TimeSpan, problem.Y0, options);

% Plot the phase space with a custom title
problem.plotPhaseSpace(t, y, 'Title', 'The Circle of Life');

% Create a movie 
mov = problem.movie(t, y);