JMSLTM Numerical Library 6.0

com.imsl.math
Class OdeAdamsGear

java.lang.Object
  extended by com.imsl.math.ODE
      extended by com.imsl.math.OdeAdamsGear
All Implemented Interfaces:
Serializable, Cloneable

public class OdeAdamsGear
extends ODE

Extension of the ODE class to solve a stiff initial-value problem for ordinary differential equations using the Adams-Gear methods.

Class OdeAdamsGear finds an approximation to the solution of a system of first-order differential equations of the form

frac{dy}{dt} = y' = f(t,y)

with given initial conditions for y at the starting value for t. The class attempts to keep the global error proportional to a user-specified tolerance. The proportionality depends on the differential equation and the range of integration.

The code is based on using backward difference formulas not exceeding order five as outlined in Gear (1971) and implemented by Hindmarsh (1974). There is an optional use of the code that employs implicit Adams formulas. This use is intended for nonstiff problems with expensive functions y' = f(t,y).

See Also:
Example, Serialized Form

Nested Class Summary
static class OdeAdamsGear.DidNotConvergeException
          The iteration did not converge within the maximum number of steps allowed (default 500).
static interface OdeAdamsGear.Function
          Public interface for user supplied function to OdeAdamsGear object.
static interface OdeAdamsGear.Jacobian
          Public interface for the user supplied function to evaluate the Jacobian matrix.
static class OdeAdamsGear.MaxFcnEvalsExceededException
          Maximum function evaluations exceeded.
static class OdeAdamsGear.SingularMatrixException
          The interpolation matrix is singular.
static class OdeAdamsGear.ToleranceTooSmallException
          Tolerance is too small or the problem is stiff.
 
Field Summary
static int METHOD_ADAMS
          The Adams integration method
static int METHOD_BDF
          The BDF integration method
static int SOLVE_CHORD_COMPUTED_DIAGONAL
          A chord method and a diagonal matrix based on a directional directive
static int SOLVE_CHORD_COMPUTED_JACOBIAN
          A chord or modified Newton method and a divided differences Jacobian
static int SOLVE_CHORD_USER_JACOBIAN
          A chord or modified Newton method and a user-supplied Jacobian
static int SOLVE_FUNCTION_ITERATION
          A function iteration or successive substitution method
 
Fields inherited from class com.imsl.math.ODE
AFTER_SUCCESSFUL_STEP, AFTER_UNSUCCESSFUL_STEP, BEFORE_STEP, ERROR_NORM_ABS, ERROR_NORM_EUCLIDEAN, ERROR_NORM_MAX, ERROR_NORM_MINABSREL
 
Constructor Summary
OdeAdamsGear(OdeAdamsGear.Function function)
          Constructs an ODE solver to solve the initial value problem dy/dt = f(t,y)
 
Method Summary
 int getIntegrationMethod()
          Returns the integration method used.
 int getMaximumFunctionEvaluations()
          Returns the maximum number of function evaluations of y' allowed.
 int getMaxOrder()
          Returns the highest order formula to use of implicit METHOD_ADAMS type or METHOD_BDF type.
 int getNumberOfFcnEvals()
          Returns the number of function evaluations of y' made.
 int getNumberOfJacobianEvals()
          Returns the number of Jacobian matrix evaluations used.
 int getNumberOfSteps()
          Returns the number of internal steps taken.
 int getSolveMethod()
          Returns the method for solving the formula equations.
 void setIntegrationMethod(int intMethod)
          Indicates which integration method is to be used.
 void setMaximumFunctionEvaluations(int maxfcn)
          Sets the maximum number of function evaluations of y' allowed.
 void setMaximumStepsize(double stepsize)
          Sets the maximum internal step size.
 void setMaxOrder(int maxOrder)
          Sets the highest order formula to use of implicit METHOD_ADAMS type or METHOD_BDF type.
 void setSolveMethod(int solveMethod)
          Indicates which method to use for solving the formula equations.
 void solve(double t, double tEnd, double[] y)
          Integrates the ODE system from t to tEnd.
 
Methods inherited from class com.imsl.math.ODE
examineStep, getFloor, getInitialStepsize, getMaximumStepsize, getMaxSteps, getMinimumStepsize, getNorm, getScale, getTolerance, setFloor, setInitialStepsize, setMaxSteps, setMinimumStepsize, setNorm, setScale, setTolerance, vnorm
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

METHOD_ADAMS

public static final int METHOD_ADAMS
The Adams integration method

See Also:
Constant Field Values

METHOD_BDF

public static final int METHOD_BDF
The BDF integration method

See Also:
Constant Field Values

SOLVE_CHORD_COMPUTED_DIAGONAL

public static final int SOLVE_CHORD_COMPUTED_DIAGONAL
A chord method and a diagonal matrix based on a directional directive

See Also:
Constant Field Values

SOLVE_CHORD_COMPUTED_JACOBIAN

public static final int SOLVE_CHORD_COMPUTED_JACOBIAN
A chord or modified Newton method and a divided differences Jacobian

See Also:
Constant Field Values

SOLVE_CHORD_USER_JACOBIAN

public static final int SOLVE_CHORD_USER_JACOBIAN
A chord or modified Newton method and a user-supplied Jacobian

See Also:
Constant Field Values

SOLVE_FUNCTION_ITERATION

public static final int SOLVE_FUNCTION_ITERATION
A function iteration or successive substitution method

See Also:
Constant Field Values
Constructor Detail

OdeAdamsGear

public OdeAdamsGear(OdeAdamsGear.Function function)
Constructs an ODE solver to solve the initial value problem dy/dt = f(t,y)

Parameters:
function - implementation of interface Function that defines the right-hand side function f(t,y)
Method Detail

getIntegrationMethod

public int getIntegrationMethod()
Returns the integration method used.

Returns:
an int indicating the integration method used. One of the following is returned:

Value Description
METHOD_ADAMS Use the implicit Adams method.
METHOD_BDF Use backward differentiation formula (BDF) methods.


getMaximumFunctionEvaluations

public int getMaximumFunctionEvaluations()
Returns the maximum number of function evaluations of y' allowed.

Returns:
an int specifying the maximum number of function evaluations of y' allowed.

getMaxOrder

public int getMaxOrder()
Returns the highest order formula to use of implicit METHOD_ADAMS type or METHOD_BDF type.

Returns:
an int specifying the highest order formula to use of implicit METHOD_ADAMS type or METHOD_BDF type.

getNumberOfFcnEvals

public int getNumberOfFcnEvals()
Returns the number of function evaluations of y' made.

Returns:
an int specifying the number of function evaluations of y' made.

getNumberOfJacobianEvals

public int getNumberOfJacobianEvals()
Returns the number of Jacobian matrix evaluations used.

Returns:
an int specifying the number of Jacobian matrix evaluations used.

getNumberOfSteps

public int getNumberOfSteps()
Returns the number of internal steps taken.

Returns:
an int specifying the number of internal steps taken.

getSolveMethod

public int getSolveMethod()
Returns the method for solving the formula equations.

Returns:
an int indicating the method used for solving the formula equations. One of the following is returned:

Value Description
SOLVE_FUNCTION_ITERATION Use a function iteration or successive substitution method.
SOLVE_CHORD_USER_JACOBIAN Use a chord or modified Newton method and a user-supplied Jacobian.
SOLVE_CHORD_COMPUTED_JACOBIAN Use a chord or modified Newton method and a Jacobian approximated by divided differences.
SOLVE_CHORD_COMPUTED_DIAGONAL Use a chord method and a diagonal matrix based on a directional directive.


setIntegrationMethod

public void setIntegrationMethod(int intMethod)
Indicates which integration method is to be used.

Parameters:
intMethod - an int specifying the integration method to be used. intMethod must be one of the values specified in the table which follows. Default: intMethod = METHOD_BDF

intMethod Description
METHOD_ADAMS Use the implicit Adams method.
METHOD_BDF Use backward differentiation formula (BDF) methods.


setMaximumFunctionEvaluations

public void setMaximumFunctionEvaluations(int maxfcn)
Sets the maximum number of function evaluations of y' allowed.

Parameters:
maxfcn - an int specifying the maximum number of function evaluations of y' allowed. maxfcn must be greater than zero. Default: No limit is enforced.

setMaximumStepsize

public void setMaximumStepsize(double stepsize)
Sets the maximum internal step size.

Overrides:
setMaximumStepsize in class ODE
Parameters:
stepsize - a double specifying the maximum internal step size. stepsize must be greater than zero. Default: stepsize = 1.7976931348623157e+308

setMaxOrder

public void setMaxOrder(int maxOrder)
Sets the highest order formula to use of implicit METHOD_ADAMS type or METHOD_BDF type.

Parameters:
maxOrder - an int specifying the highest order formula to use of implicit METHOD_ADAMS type or METHOD_BDF type. maxOrder must be greater than zero. Default: maxOrder = 12 for METHOD_ADAMS and maxOrder = 5 for METHOD_BDF.

setSolveMethod

public void setSolveMethod(int solveMethod)
Indicates which method to use for solving the formula equations.

Parameters:
solveMethod - an int specifying the method to be used for solving the formula equations. Note that if the problem is stiff and a chord or modified Newton method is most efficient, use SOLVE_CHORD_USER_JACOBIAN or SOLVE_CHORD_COMPUTED_JACOBIAN. solveMethod must be one of the values specified in the table which follows.
Default: solveMethod = SOLVE_CHORD_COMPUTED_JACOBIAN.

solveMethod Description
SOLVE_FUNCTION_ITERATION Use a function iteration or successive substitution method.
SOLVE_CHORD_USER_JACOBIAN Use a chord or modified Newton method and a user-supplied Jacobian.
SOLVE_CHORD_COMPUTED_JACOBIAN Use a chord or modified Newton method and a divided differences Jacobian.
SOLVE_CHORD_COMPUTED_DIAGONAL Use a chord method and a diagonal matrix based on a directional directive.


solve

public void solve(double t,
                  double tEnd,
                  double[] y)
           throws OdeAdamsGear.DidNotConvergeException,
                  OdeAdamsGear.MaxFcnEvalsExceededException,
                  OdeAdamsGear.ToleranceTooSmallException,
                  OdeAdamsGear.SingularMatrixException
Integrates the ODE system from t to tEnd. On all but the first call to solve, the value of t must equal the value of tEnd from the previous call.

Parameters:
t - a double specifying the independent variable
tEnd - a double specifying the value of t at which the solution is desired
y - on input, a double array containing the initial values. On output, a double array containing the approximate solution.
Throws:
OdeAdamsGear.DidNotConvergeException - is thrown if the number of internal steps exceeds maxSteps (default 500). This can be an indication that the ODE system is stiff. This exception can also be thrown if the error tolerance condition could not be met.
OdeAdamsGear.ToleranceTooSmallException - is thrown if the computation does not converge on some step.
OdeAdamsGear.MaxFcnEvalsExceededException - is thrown if the maximum number of function evaluations allowed has been exceeded.
SingularMatrixException - is thrown if the factorization function encounters a singular matrix during LU decomposition.
OdeAdamsGear.SingularMatrixException

JMSLTM Numerical Library 6.0

Copyright © 1970-2009 Visual Numerics, Inc.
Built September 1 2009.