Class ODE_Lotka_Volterra

java.lang.Object
  extended by ODE_Lotka_Volterra
All Implemented Interfaces:
FirstOrderDifferentialEquations

public class ODE_Lotka_Volterra
extends java.lang.Object
implements FirstOrderDifferentialEquations

Example of a system of first order differential equations (ODEs).

  Lotka-Volterra equations for rabbits r(t) and foxes f(t)

  dr/dt = r(t) * ( a - b * f(t) )
  df/dt = f(t) * ( d * r(t) - c )
 

See Also:
CommonsMath_ODE_Lotka_Volterra~Demo.jxn, → Wikipedia

Constructor Summary
ODE_Lotka_Volterra(double a, double b, double c, double d)
          Stores the parameters of the equations.
 
Method Summary
 void computeDerivatives(double t, double[] y, double[] ydot)
          Computes dr/dt and df/dt.
 int getDimension()
          Returns the number of states(=2).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ODE_Lotka_Volterra

public ODE_Lotka_Volterra(double a,
                          double b,
                          double c,
                          double d)
Stores the parameters of the equations.

Method Detail

getDimension

public int getDimension()
Returns the number of states(=2).

Specified by:
getDimension in interface FirstOrderDifferentialEquations

computeDerivatives

public void computeDerivatives(double t,
                               double[] y,
                               double[] ydot)
Computes dr/dt and df/dt.

Specified by:
computeDerivatives in interface FirstOrderDifferentialEquations