Class JxnODE
- java.lang.Object
-
- JxnODE
-
- All Implemented Interfaces:
FirstOrderDifferentialEquations
public class JxnODE extends Object implements FirstOrderDifferentialEquations
Wrapper used to pass a system of first order ordinary differential equations (odes) to Commons Math algorithms. Computes the derivativesdyi/dtdefined in theString[] odes.
See CommonsMath_ODE_Lotka_Volterra~Test.jxn for an example.
-
-
Constructor Summary
Constructors Constructor Description JxnODE(KmgFormelInterpreter fi, String[] odes)Constructs aFirstOrderDifferentialEquationsinstance to be used by Commons Math algorithms.JxnODE(KmgFormelInterpreter fi, String init, String[] odes, double[] parameters)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcomputeDerivatives(double t, double[] y, double[] ydot)Computes derivativesydotfromyandt(internally called by Commons Math algorithms).intgetDimension()Returns the number of states.StringtoString()
-
-
-
Constructor Detail
-
JxnODE
public JxnODE(KmgFormelInterpreter fi, String[] odes)
Constructs aFirstOrderDifferentialEquationsinstance to be used by Commons Math algorithms.
Example:ode = @JxODE( $this, { "$y[0]*( a - b $y[1] );", "$y[1]*( d $y[0] - c );" } )- Parameters:
fi- instance ofKmgFormelInterpreteron which the definitions inodes[...]are executedodes- array of statement_sequences (one or more statements separated by ';'). The definitions inodes[...]must usedouble[] $yand$tto calculate the derivativesdy/dt. If the definition inodes[i]ends with ';', log output of intermediate steps is suppressed for the definition.
-
JxnODE
public JxnODE(KmgFormelInterpreter fi, String init, String[] odes, double[] parameters)
- Parameters:
init- statement_sequence (one or more statements separated by ';').initis evaluated before evaluatingodesand can usedouble[] $yand$t. Ifinitends with ';', log output is suppressed.parameters- the values can be used in theinitandodesdefinitions via the array variable$p[...]
-
-
Method Detail
-
getDimension
public int getDimension()
Returns the number of states.- Specified by:
getDimensionin interfaceFirstOrderDifferentialEquations
-
computeDerivatives
public void computeDerivatives(double t, double[] y, double[] ydot)
Computes derivativesydotfromyandt(internally called by Commons Math algorithms).- Specified by:
computeDerivativesin interfaceFirstOrderDifferentialEquations
-
-