Header menu logo bristlecone

ScriptNotebook

Integration Methods

Bristlecone supports model systems defined in discrete or continuous time. For continuous-time model systems - defined as ordinary differential equation(s) - Bristlecone applies numerical integration to calculate changes in the modelled properties through time.

Note. Currently only fixed timesteps are supported, but variable timestep support (e.g. for sediment core data) is planned for a future release.

Included integration methods

The following integration functions are included within the Bristlecone.Integration namespace:

Solver

Function

Description

Runge-Kutta 4 (MathNet Numerics)

Integration.MathNet.integrate

A fourth-order Runge Kutta method to provide approximate solutions to ODE systems.

Runge-Kutta 547M (Open Solving Library for ODEs - Microsoft Research)

Integration.MsftOslo.integrate

A method based on classic Runge-Kutta, but with automatic error and step size control. See the documentation.

Adding a custom integration method

You can add a custom integration routine by wrapping your integration function to match the EstimationEngine.Integration type signature as follows:

open Bristlecone

let myCustomIntegrator: EstimationEngine.Integrate<'data, 'time> =
    fun writeOut tInitial tEnd tStep initialConditions externalEnvironment model ->
        invalidOp "Doesn't actually do anything!"

let engine =
    Bristlecone.mkContinuous |> Bristlecone.withContinuousTime myCustomIntegrator

When defining a custom integration routine, you may wish to use the Base.solve function from the Bristlecone.Integration namespace. This is used to arrange the equations into a form suitable for a simple integration routine.

Multiple items
module Bristlecone from Bristlecone
<namespacedoc><summary>The core library of Bristlecone, containing model-fitting functions.</summary></namespacedoc>
Main functionality of Bristlecone, including functions to scaffold `ModelSystem`s and for model-fitting (tests and real fits).


--------------------
namespace Bristlecone
val myCustomIntegrator<'data,'time> : writeOut: EstimationEngine.WriteOut -> tInitial: 'time -> tEnd: 'time -> tStep: 'time -> initialConditions: CodedMap<'data> -> externalEnvironment: CodedMap<Time.TimeIndex.TimeIndex<'data>> -> model: CodedMap<EstimationEngine.ODE> -> CodedMap<'data array>
module EstimationEngine from Bristlecone
type Integrate<'data,'time> = EstimationEngine.WriteOut -> 'time -> 'time -> 'time -> CodedMap<'data> -> CodedMap<Time.TimeIndex.TimeIndex<'data>> -> CodedMap<EstimationEngine.ODE> -> CodedMap<'data array>
val writeOut: EstimationEngine.WriteOut
val tInitial: 'time
val tEnd: 'time
val tStep: 'time
val initialConditions: CodedMap<'data>
val externalEnvironment: CodedMap<Time.TimeIndex.TimeIndex<'data>>
val model: CodedMap<EstimationEngine.ODE>
val invalidOp: message: string -> 'T
val engine: EstimationEngine.EstimationEngine<float,float>
val mkContinuous: EstimationEngine.EstimationEngine<float,float>
<summary>A basic estimation engine for ordinary differential equations, using a Nelder-Mead optimiser.</summary>
val withContinuousTime: t: EstimationEngine.Integrate<'a,'b> -> engine: EstimationEngine.EstimationEngine<'a,'b> -> EstimationEngine.EstimationEngine<'a,'b>
<summary> Use a custom integration method </summary>

Type something to start searching.