Stability | experimental |
---|---|

Maintainer | David Sorokin <david.sorokin@gmail.com> |

Safe Haskell | None |

Tested with: GHC 7.0.3

This module defines basic functions for the `Dynamics`

monad.

- starttime :: Dynamics Double
- stoptime :: Dynamics Double
- dt :: Dynamics Double
- time :: Dynamics Double
- integTimes :: Simulation [Double]
- initDynamics :: Dynamics a -> Dynamics a
- discrete :: Dynamics a -> Dynamics a
- interpolate :: Dynamics a -> Dynamics a
- memo :: Dynamics e -> Simulation (Dynamics e)
- umemo :: MArray IOUArray e IO => Dynamics e -> Simulation (Dynamics e)
- memo0 :: Dynamics e -> Simulation (Dynamics e)
- umemo0 :: MArray IOUArray e IO => Dynamics e -> Simulation (Dynamics e)
- iterateDynamics :: Dynamics () -> Simulation (Dynamics ())
- foldDynamics1 :: (Dynamics a -> Simulation (Dynamics a)) -> (a -> a -> a) -> Dynamics a -> Simulation (Dynamics a)
- foldDynamics :: (Dynamics a -> Simulation (Dynamics a)) -> (a -> b -> a) -> a -> Dynamics b -> Simulation (Dynamics a)
- divideDynamics :: Dynamics Double -> Dynamics Double

# Time Parameters

integTimes :: Simulation [Double]Source

Return the integration time points.

# Interpolation and Initial Value

initDynamics :: Dynamics a -> Dynamics aSource

Return the initial value.

discrete :: Dynamics a -> Dynamics aSource

Discretize the computation in the integration time points.

interpolate :: Dynamics a -> Dynamics aSource

Interpolate the computation based on the integration time points only.
Unlike the `discrete`

function it knows about the intermediate time points
that are used in the Runge-Kutta method.

# Memoization

memo :: Dynamics e -> Simulation (Dynamics e)Source

Memoize and order the computation in the integration time points using the interpolation that knows of the Runge-Kutta method.

umemo :: MArray IOUArray e IO => Dynamics e -> Simulation (Dynamics e)Source

This is a more efficient version the `memo`

function which uses
an unboxed array to store the values.

memo0 :: Dynamics e -> Simulation (Dynamics e)Source

Memoize and order the computation in the integration time points using
the `discrete`

interpolation. It consumes less memory than the `memo`

function but it is not aware of the Runge-Kutta method. There is a subtle
difference when we request for values in the intermediate time points
that are used by this method to integrate. In general case you should
prefer the `memo0`

function above `memo`

.

umemo0 :: MArray IOUArray e IO => Dynamics e -> Simulation (Dynamics e)Source

This is a more efficient version the `memo0`

function which uses
an unboxed array to store the values.

# Iterating

iterateDynamics :: Dynamics () -> Simulation (Dynamics ())Source

Iterate sequentially the dynamic process with side effects in
the integration time points. It is equivalent to a call of the
`memo0`

function but significantly more efficient, for the array
is not created.

# Fold

foldDynamics1 :: (Dynamics a -> Simulation (Dynamics a)) -> (a -> a -> a) -> Dynamics a -> Simulation (Dynamics a)Source

foldDynamics :: (Dynamics a -> Simulation (Dynamics a)) -> (a -> b -> a) -> a -> Dynamics b -> Simulation (Dynamics a)Source