package owl-ode

  1. Overview
  2. Docs

Any solver compatible with Owl_ode.Ode.odeint has to comply with the SolverT type. You can use this to define completely new solvers, as done in the owl-ode-sundials or ocaml-cviode libraries, or to customize pre-existing solvers (see the van_der_pol example for one such cases).

The native ocaml solvers provided by Owl_ode in both single and double precision can be found in Owl_ode.Native, respectively in the Owl_ode.Native.S and Owl_ode.Native.D modules. These provide multiple single-step and adaptive implementations.

Symplectic solvers for separable Hamiltonian systems are also available and can be found in Owl_ode.Symplectic.S and Owl_ode.Symplectic.D. Refer to the damped oscillator for an example of use.

The generic solvers in Owl_ode.Native_generic and in Owl_ode.Symplectic_generic can also be used in conjunction with jsoo, although how to do that is currently undocumented.

type s

s is the type of the state (and thus also of the initial condition) provided to Owl_ode.Ode.odeint. For example Owl.Mat.mat.

type t

t is type of the output of the evolution function f: s-> float ->t. For example, in the case of sympletic solvers, type s = Owl.Mat.(mat*mat) and type t = Owl.Mat.mat.

type output

output defines the type of the output of Owl_ode.Ode.odeint. For example, in the case of sympletc solvers, type output = Owl.Mat.(mat * mat * mat), corresponds to matrices that contain respectively the time, position, and momentum coordinates of the integrated solution

val solve : (s -> float -> t) -> s -> tspec_t -> unit -> output

solve f y0 tspec () solves the initial value problem

∂ₜ y = f(y, t) y(t₀) = y₀

with the given evolution function f, initial condition y0, and temporal specification tspec, and returns the desired outputs of type output. Several such functions have already been implemented in this library and can be used as reference.

OCaml

Innovation. Community. Security.