nbody-0.1.0.0

Safe HaskellSafe
LanguageHaskell2010

Integrators

Description

Implements fourth, fifth, and eighth order Runge-Kutta integration methods for time independent second order differential equations using the classic fourth order, Dormand-Prince fifth order, and Cooper-Verner eigth order coefficients respectively. The Gauss-Jackson coefficients are generated to arbitrary order, but using RKCV8 for the startup conditions necessarily restricts the order to eigth order at most, though correction steps can more or less minimise that loss. For some inputs RK4 instead of RKCV8 or RKDP5 may make more sense for startup.

Synopsis

Documentation

rk4 :: (Floating t, Eq t) => Integrator t Source #

The classic Runge-Kutta fourth order method

rkdp5 :: (Floating t, Eq t) => Integrator t Source #

Dormand-Prince fifth order method. A less general RK method could avoid the final b calculation and the first f calculation of the next step with this one due to the coefficient choice.

rkcv8 :: (Floating t, Eq t) => Integrator t Source #

Cooper-Verner eigth order method

timeIndepRK :: (Floating t, Eq t) => BTabTIndep t -> (Vec2 t -> Vec2 t) -> Vec2 t -> t -> Vec2 t Source #

timeIndepRK implements the general Runge-Kutta form for a time independent differential equation \(f\).

timeIndepRK btab f yn dt steps one step forward in the described time-independent Runge-Kutta method where btab describes the implementation Butcher-Tableu, f the differetial function, rn the current position and velocity, and dt the integration time step.

Note that \(f\) operates on both position and velocity, i.e. it returns both \(\dot{\vec{r}}\) and \(\ddot{\vec{r}}\) and that the Butcher-Tableu's used must have the \(a_{ij}\) and \(b_i\) coefficients in reverse row order. That is, each row is in reverse order.

data Integrator t Source #

Data class encapsulating the concept of an integrator function

Constructors

SingStepIntegrator ((Vec2 t -> Vec2 t) -> Vec2 t -> t -> Vec2 t) 
MultStepIntegrator ((Vec2 t -> Vec2 t) -> [(Vec2 t, Vec3 t)] -> t -> [(Vec2 t, Vec3 t)])