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.
Included integration methods
The following integration functions are included within the Bristlecone.Integration namespace:
Runge-Kutta 4
Bristlecone.Integration.RungeKutta.rk4
A fourth-order Runge Kutta method to provide approximate solutions to ODE systems.
Adding a custom integration method
You can add a custom integration routine by wrapping your integration
function to match the EstimationEngine.Integration.IntegrationRoutine type signature as follows:
open Bristlecone
let myCustomIntegrator: EstimationEngine.Integration.IntegrationRoutine =
fun tInitial tEnd tStep initialConditions (rhs:EstimationEngine.ParameterisedRHS) ->
invalidOp "Doesn't actually do anything!"
let engine () =
Bristlecone.mkContinuous () |> Bristlecone.withContinuousTime myCustomIntegrator
A custom integration routine is parameterised with fixed time-stepping between
tInitial and tEnd, with tStep step size. The 'rhs' function to be integrated
is a function compiled by Bristlecone that takes two arguments: first, a scalar
of the current time t; and second a vector of the current state values.
Internally, if variable time-steps are required Bristlecone runs multiple fixed integration routines between each pair of time-points.
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
<summary> The estimation engine represents the method used to calculate equations and optimise a likelihood function. The whole estimation engine is tensor-based internally, but may take float-based equations as a legacy option. </summary>
<summary> Represents a low-level numerical method used to integrate functions. Takes the intial time, final time, and time step, and returns a function that is compiled to only require the current time and current state. Must return the baseline state plus evolutions. </summary>
<summary> A parameterised RHS — parameters already bound. This is what the integration routine actually steps. </summary>
<summary>A basic estimation engine for ordinary differential equations, using a Nelder-Mead optimiser.</summary>
<summary> Use a custom integration method </summary>
bristlecone