ca.nengo.dynamics.impl
Class RK45Integrator

java.lang.Object
  extended by ca.nengo.dynamics.impl.RK45Integrator
All Implemented Interfaces:
Integrator, java.io.Serializable, java.lang.Cloneable

public class RK45Integrator
extends java.lang.Object
implements Integrator

A variable-timestep Integrator, which uses the Dormand-Prince 4th and 5th-order Runge-Kutta formulae.

This code is adapted from a GPL Octave implementation by Marc Compere (see http://users.powernet.co.uk/kienzle/octave/matcompat/scripts/ode_v1.11/ode45.m)

See also Dormand & Prince, 1980, J Computational and Applied Mathematics 6(1), 19-26.

TODO: should re-use initial time step estimate from last integration if available

Author:
Bryan Tripp
See Also:
Serialized Form

Constructor Summary
RK45Integrator()
          Uses default error tolerance of 1e-6
RK45Integrator(float tolerance)
           
 
Method Summary
 Integrator clone()
           
 float getTolerance()
           
 TimeSeries integrate(DynamicalSystem system, TimeSeries input)
          Integrates the given system over the time span defined by the input time series.
 void setTolerance(float tolerance)
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RK45Integrator

public RK45Integrator(float tolerance)
Parameters:
tolerance - Error tolerance

RK45Integrator

public RK45Integrator()
Uses default error tolerance of 1e-6

Method Detail

getTolerance

public float getTolerance()
Returns:
Error tolerance

setTolerance

public void setTolerance(float tolerance)
Parameters:
tolerance - Error tolerance

integrate

public TimeSeries integrate(DynamicalSystem system,
                            TimeSeries input)
Description copied from interface: Integrator
Integrates the given system over the time span defined by the input time series.

Specified by:
integrate in interface Integrator
Parameters:
system - The DynamicalSystem to solve.
input - Input vector to the system, defined at the desired start and end times of integration, and optionally at times in between. The way in which the integrator interpolates between inputs at different times is decided by the Integrator implementation.
Returns:
Time series of output vector
See Also:
Integrator.integrate(ca.nengo.dynamics.DynamicalSystem, ca.nengo.util.TimeSeries)

clone

public Integrator clone()
                 throws java.lang.CloneNotSupportedException
Specified by:
clone in interface Integrator
Overrides:
clone in class java.lang.Object
Throws:
java.lang.CloneNotSupportedException