nl.tudelft.simulation.jstats.ode.integrators
Class NumericalIntegrator

java.lang.Object
  extended by nl.tudelft.simulation.jstats.ode.integrators.NumericalIntegrator
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
CachingNumericalIntegrator, Euler, Gill, Heun, RungeKutta3, RungeKutta4, RungeKuttaCashCarp, RungeKuttaFehlberg

public abstract class NumericalIntegrator
extends Object
implements Serializable

Provides basic methods for all numerical integration methods. They mostly include matrix computation.

(c) copyright 2002-2005 Delft University of Technology , the Netherlands.
See for project information www.simulation.tudelft.nl
License of use: Lesser General Public License (LGPL) , no warranty.

Since:
1.4
Version:
$Revision: 1.1 $ $Date: 2007/01/06 13:25:43 $
Author:
Peter Jacobs
See Also:
Serialized Form

Field Summary
static short ADAMS
          Adam's integration
static short DEFAULT_INTEGRATOR
          The default integrator
protected  DifferentialEquationInterface equation
          the equation to integrate
protected  double[] error
          the calculated error of the last step
static short EULER
          Euler's integration
static short GILL
          Gill's integration
static short HEUN
          Heun's integration
static short MILNE
          Milne's integration
static short RUNGEKUTTA3
          RungeKutta's (3rd level) integration
static short RUNGEKUTTA4
          RungeKutta's (4th level) integration
static short RUNGEKUTTACASHCARP
          Runge-Kutta-Cash-Carp integration
static short RUNGEKUTTAFEHLBERG
          Runge-Kutta-Fehlberg integration
protected  double timeStep
          the timeStep to use
 
Constructor Summary
NumericalIntegrator(double timeStep, DifferentialEquationInterface equation)
          constructs a new NumericalIntegrator
 
Method Summary
protected  double[] add(double[] a, double[] b)
          adds two vectors
protected  double[] add(double[] a, double[] b, double[] c)
          adds a number of vectors
protected  double[] add(double[] a, double[] b, double[] c, double[] d)
          adds a number of vectors
protected  double[] add(double[] a, double[] b, double[] c, double[] d, double[] e)
          adds a number of vectors
protected  double[] add(double[] a, double[] b, double[] c, double[] d, double[] e, double[] f)
          adds a number of vectors
 double[] getError()
           
 double getTimeStep()
           
protected  double[] multiply(double constant, double[] vector)
          multiplies a vector with a constant
abstract  double[] next(double x, double[] y)
          computes the next value
static NumericalIntegrator resolve(short integrationMethod, double timeStep, DifferentialEquationInterface equation)
           
 void setTimeStep(double timeStep)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EULER

public static final short EULER
Euler's integration

See Also:
Constant Field Values

HEUN

public static final short HEUN
Heun's integration

See Also:
Constant Field Values

RUNGEKUTTA3

public static final short RUNGEKUTTA3
RungeKutta's (3rd level) integration

See Also:
Constant Field Values

RUNGEKUTTA4

public static final short RUNGEKUTTA4
RungeKutta's (4th level) integration

See Also:
Constant Field Values

ADAMS

public static final short ADAMS
Adam's integration

See Also:
Constant Field Values

GILL

public static final short GILL
Gill's integration

See Also:
Constant Field Values

MILNE

public static final short MILNE
Milne's integration

See Also:
Constant Field Values

RUNGEKUTTAFEHLBERG

public static final short RUNGEKUTTAFEHLBERG
Runge-Kutta-Fehlberg integration

See Also:
Constant Field Values

RUNGEKUTTACASHCARP

public static final short RUNGEKUTTACASHCARP
Runge-Kutta-Cash-Carp integration

See Also:
Constant Field Values

DEFAULT_INTEGRATOR

public static final short DEFAULT_INTEGRATOR
The default integrator

See Also:
Constant Field Values

timeStep

protected double timeStep
the timeStep to use


error

protected double[] error
the calculated error of the last step


equation

protected DifferentialEquationInterface equation
the equation to integrate

Constructor Detail

NumericalIntegrator

public NumericalIntegrator(double timeStep,
                           DifferentialEquationInterface equation)
constructs a new NumericalIntegrator

Parameters:
timeStep - the timeStep
equation - the differentialEquation
Method Detail

resolve

public static NumericalIntegrator resolve(short integrationMethod,
                                          double timeStep,
                                          DifferentialEquationInterface equation)
Parameters:
integrationMethod - the type of integrator to create
timeStep - the starting timestep to use
equation - the differential equation
Returns:
the integrator

next

public abstract double[] next(double x,
                              double[] y)
computes the next value

Parameters:
x - the x value corresponding to the last y-value computed
y - the last y value
Returns:
the new value

multiply

protected double[] multiply(double constant,
                            double[] vector)
multiplies a vector with a constant

Parameters:
constant - the constant
vector - the vector
Returns:
the new vector

add

protected double[] add(double[] a,
                       double[] b)
adds two vectors

Parameters:
a - vector a
b - vector b
Returns:
the new vector

add

protected double[] add(double[] a,
                       double[] b,
                       double[] c)
adds a number of vectors

Parameters:
a - vector a
b - vector b
c - vector c
Returns:
the new vector

add

protected double[] add(double[] a,
                       double[] b,
                       double[] c,
                       double[] d)
adds a number of vectors

Parameters:
a - vector a
b - vector b
c - vector c
d - vector d
Returns:
the sum

add

protected double[] add(double[] a,
                       double[] b,
                       double[] c,
                       double[] d,
                       double[] e)
adds a number of vectors

Parameters:
a - vector a
b - vector b
c - vector c
d - vector d
e - vector e
Returns:
the sum

add

protected double[] add(double[] a,
                       double[] b,
                       double[] c,
                       double[] d,
                       double[] e,
                       double[] f)
adds a number of vectors

Parameters:
a - vector a
b - vector b
c - vector c
d - vector d
e - vector e
f - vector f
Returns:
the sum

getTimeStep

public double getTimeStep()
Returns:
Returns the timeStep.

setTimeStep

public void setTimeStep(double timeStep)
Parameters:
timeStep - The timeStep to set.

getError

public double[] getError()
Returns:
Returns the error.


Copyright © 2002-2011 Delft University of Technology, the Netherlands. All Rights Reserved.