All Projects → srenevey → ode-solvers

srenevey / ode-solvers

Licence: BSD-3-Clause license
Numerical methods to solve ordinary differential equations in Rust.

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to ode-solvers

rspark
▁▂▆▇▁▄█▁ Sparklines for Rust apps
Stars: ✭ 50 (+163.16%)
Mutual labels:  rust-crate
domain-lookup-tree
A tree structure in Rust optimized for looking up domain names, with wildcard support
Stars: ✭ 17 (-10.53%)
Mutual labels:  rust-crate
tiny-secp256k1
A tiny secp256k1 native/JS wrapper
Stars: ✭ 41 (+115.79%)
Mutual labels:  rust-crate
rustfst
Rust re-implementation of OpenFST - library for constructing, combining, optimizing, and searching weighted finite-state transducers (FSTs). A Python binding is also available.
Stars: ✭ 104 (+447.37%)
Mutual labels:  rust-crate
simdutf8
SIMD-accelerated UTF-8 validation for Rust.
Stars: ✭ 426 (+2142.11%)
Mutual labels:  rust-crate
Fluid Simulation
Self advection, external force and pressure solve to a velocity field represented by a MaC grid.
Stars: ✭ 107 (+463.16%)
Mutual labels:  ode-solver
twang
Library for pure Rust advanced audio synthesis.
Stars: ✭ 83 (+336.84%)
Mutual labels:  rust-crate
random color
⚙️🎨 Rust crate for generating random attractive colors
Stars: ✭ 30 (+57.89%)
Mutual labels:  rust-crate
crates-io-cn
Source code of crates-io.cn, also tools sets for sync crates.io
Stars: ✭ 20 (+5.26%)
Mutual labels:  rust-crate
heyoka
C++ library for ODE integration via Taylor's method and LLVM
Stars: ✭ 151 (+694.74%)
Mutual labels:  ode-solver
kul
A unique textual notation that can be used as both a data format and a markup language and that has powerful extensibility of both lexical syntax and semantics, and a Rust library for parsing it.
Stars: ✭ 12 (-36.84%)
Mutual labels:  rust-crate
daemonize-me
Rust library to ease the task of creating daemons
Stars: ✭ 34 (+78.95%)
Mutual labels:  rust-crate
DiffEqPhysics.jl
A library for building differential equations arising from physical problems for physics-informed and scientific machine learning (SciML)
Stars: ✭ 46 (+142.11%)
Mutual labels:  ordinary-differential-equations
algos
A collection of algorithms in rust
Stars: ✭ 16 (-15.79%)
Mutual labels:  rust-crate
cargo-clone
A cargo subcommand to fetch the source code of a Rust crate
Stars: ✭ 72 (+278.95%)
Mutual labels:  rust-crate
pydens
PyDEns is a framework for solving Ordinary and Partial Differential Equations (ODEs & PDEs) using neural networks
Stars: ✭ 201 (+957.89%)
Mutual labels:  ode-solver
Curio
A Blazing Fast HTTP Client
Stars: ✭ 35 (+84.21%)
Mutual labels:  rust-crate
trickster
user-friendly linux memory hacking library
Stars: ✭ 50 (+163.16%)
Mutual labels:  rust-crate
ecs-rust
Tiny ECS library in Rust
Stars: ✭ 32 (+68.42%)
Mutual labels:  rust-crate
newport
Modular game engine built in Rust
Stars: ✭ 4 (-78.95%)
Mutual labels:  rust-crate

ODE-solvers

Crates.io Docs Crates.io

Homepage Documentation

Numerical methods to solve ordinary differential equations (ODEs) in Rust.

Installation

To start using the crate in a project, the following dependency must be added in the project's Cargo.toml file:

[dependencies]
ode_solvers = "0.3.6"

Then, in the main file, add

use ode_solvers::*;

Type alias definition

The numerical integration methods implemented in the crate support multi-dimensional systems. In order to define the dimension of the system, declare a type alias for the state vector. For instance

type State = Vector3<f64>;

The state representation of the system is based on the SVector<T,D> structure defined in the nalgebra crate. For convenience, ode-solvers re-exports six types to work with systems of dimension 1 to 6: Vector1<T>,..., Vector6<T>. For higher dimensions, the user should import the nalgebra crate and define a SVector<T,D> where the second type parameter of SVector is a dimension. Note that the type T must be f64. For instance, for a 9-dimensional system, one would have:

type State = SVector<f64, 9>;

Alternativly, one can also use the DVector<T> structure from the nalgebra crate as the state representation. When using a DVector<T>, the number of rows in the DVector<T> defines the dimension of the system.

type State = DVector<f64>;

System definition

The system of first order ODEs must be defined in the system method of the System<V> trait. Typically, this trait is defined for a structure containing some parameters of the model. The signature of the System<V> trait is:

pub trait System<V> {
    fn system(&self, x: f64, y: &V, dy: &mut V);
    fn solout(&self, _x: f64, _y: &V, _dy: &V) -> bool {
        false
    }
}

where system must contain the ODEs: the second argument is the independent variable (usually time), the third one is a vector containing the dependent variable(s), and the fourth one contains the derivative(s) of y with respect to x. The method solout is called after each successful integration step and stops the integration whenever it is evaluated as true. The implementation of that method is optional. See the examples for implementation details.

Method selection

The following explicit Runge-Kutta methods are implemented in the current version of the crate:

Method Name Order Error estimate order Dense output order
Runge-Kutta 4 Rk4 4 N/A N/A
Dormand-Prince Dopri5 5 4 4
Dormand-Prince Dop853 8 (5, 3) 7

These methods are defined in the modules rk4, dopri5, and dop853. The first step is to bring the desired module into scope:

use ode_solvers::dopri5::*;

Then, a structure is created using the new or the from_param method of the corresponding struct. Refer to the API documentation for a description of the input arguments.

let mut stepper = Dopri5::new(system, x0, x_end, dx, y0, rtol, atol);

The system is integrated using

let res = stepper.integrate();

and the results are retrieved with

let x_out = stepper.x_out();
let y_out = stepper.y_out();

See the homepage for more details.

Acknowledgments

The Dopri5 and Dop853 algorithms implemented in this crate were originally implemented in FORTRAN by E. Hairer and G. Wanner, Université de Genève, Switzerland. This Rust implementation has been adapted from the C version written by J. Colinge, Université de Genève, Switzerland and the C++ version written by Blake Ashby, Stanford University, USA.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].