# README
Gosl. ode. Ordinary differential equations
Package ode
implements solution techniques to ordinary differential equations, such as the
Runge-Kutta method. Methods that can handle stiff problems are also available.
Examples
Robertson's Equation
From Hairer-Wanner VII-p3 Eq.(1.4) [2].
Solution of Robertson's equation:
Output of Tests
Convergence of explicit Runge-Kutta methods
References
[1] Hairer E, Norset SP, Wanner G. Solving O. Solving Ordinary Differential Equations I. Nonstiff Problems, Springer. 1987
[2] Hairer E, Wanner G. Solving Ordinary Differential Equations II. Stiff and Differential-Algebraic Problems, Second Revision Edition. Springer. 1996
API
# Functions
Dopri5simple solves ODE using DoPri5 method without options for saving results and others.
Dopri8simple solves ODE using DoPri8 method without options for saving results and others.
NewConfig returns a new [default] set of configuration parameters method -- the ODE method: e.g.
NewSolver returns a new ODE structure with default values and allocated slices
INPUT: ndim -- problem dimension conf -- configuration parameters out -- output handler [may be nil] fcn -- f(x,y) = dy/dx function jac -- Jacobian: df/dy function [may be nil ⇒ use numerical Jacobian, if necessary] M -- "mass" matrix, such that M ⋅ dy/dx = f(x,y) [may be nil]
NOTE: remember to call Free() to release allocated resources (e.g.
NewStat returns a new structure.
ProbArenstorf returns the Arenstorf orbit problem.
ProbHwAmplifier returns the Hairer-Wanner VII-p376 Transistor Amplifier NOTE: from E.
ProbHwEq11 returns the Hairer-Wanner problem from VII-p2 Eq.(1.1).
ProbRobertson returns the Robertson's Equation as given in Hairer-Wanner VII-p3 Eq.(1.4).
ProbSimpleNdim2 returns a simple 2-dim problem.
ProbSimpleNdim4a returns a simple 4-dim problem (a).
ProbSimpleNdim4b returns a simple 4-dim problem (b).
ProbVanDerPol returns the Van der Pol' Equation as given in Hairer-Wanner VII-p5 Eq.(1.5) eps -- ε coefficient; use 0 for default value [=1e-6] stationary -- use eps=1 and compute period and amplitude such that y = [A, 0] is a stationary point.
Radau5simple solves ODE using Radau5 method without options for saving results and others.
Solve solves ODE problem using standard parameters
INPUT: method -- the method fcn -- function d{y}/dx := {f}(h=dx, x, {y}) jac -- Jacobian function d{f}/d{y} := [J](h=dx, x, {y}) [may be nil] y -- current {y} @ x=0 xf -- final x dx -- stepsize.
# Structs
BwEuler implements the (implicit) Backward Euler method.
Config holds configuration parameters for the ODE solver.
ExplicitRK implements explicit Runge-Kutta methods
The methods available are: moeuler -- 2(1) Modified-Euler 2(1) ⇒ q = 1 rk2 -- 2 Runge, order 2 (mid-point).
FwEuler implements the (explicit) Forward Euler method.
Output holds output data (prepared by Solver).
Problem defines the data for an ODE problems (e.g.
Radau5 implements the Radau5 implicit Runge-Kutta method.
Solver implements an ODE solver.
Stat holds statistics and output data.
# Type aliases
DenseOutF defines a function to produce a dense output (i.e.
Func defines the main function d{y}/dx = {f}(x, {y})
Here, the "main" function receives the stepsize h as well, i.e.
JacF defines the Jacobian matrix of Func
Here, the Jacobian function receives the stepsize h as well, i.e.
StepOutF defines a callback function to be called when a step is accepted
INPUT: istep -- index of step (0 is the very first output whereas 1 is the first accepted step) h -- stepsize = dx x -- scalar variable y -- vector variable
OUTPUT: stop -- stop simulation (nicely)
.
YanaF defines a function to be used when computing analytical solutions.