Math 302, Differential Equations JHU


com.rychlik.jode
Class ODESolver

java.lang.Object
  |
  +--com.rychlik.jode.ODESolver

public class ODESolver
extends java.lang.Object

Version:
$Id: ODESolver.java,v 6.0 2004/05/30 07:23:02 marek Exp $ This class implements numerical integration of differential equations.
Author:
Marek Rychlik

Field Summary
static int EULER
          Constant representing Euler algorithm.
static int ILLEGAL
          Constant representing an illegal (unknown) algorithm.
static int MIDPOINT_RULE
          Constant representing Midpoint Rule Algorithm.
static int MODIFIED_EULER
          Constant representing Modified Euler Algorithm.
static int RUNGE_KUTTA_4
          Constant representing Runge-Kutta 4 Algorithm.
static int RUNGE_KUTTA_FEHLBERG
          Constant representing Runge-Kutta-Fehlberg Algorithm.
 
Constructor Summary
ODESolver()
           
 
Method Summary
static java.util.Vector euler(com.rychlik.jode.VField f, double[] y0, double h, int maxSteps)
          Version of euler with trivial constraints.
static java.util.Vector euler(com.rychlik.jode.VField f, double[] y0, double h, int maxSteps, com.rychlik.jode.Constraints c)
           
static int getAlgorithm(java.lang.String name)
           
static java.lang.String getAlgorithmName(int algorithm)
           
static int getAlgorithmNumber()
           
static java.lang.String getErrorMessage()
           
static java.util.Vector integrate(int method, com.rychlik.jode.VField f, double[] y0, double h, int maxSteps)
          Version of integrate with trivial constraints.
static java.util.Vector integrate(int method, com.rychlik.jode.VField f, double[] y0, double h, int maxSteps, com.rychlik.jode.Constraints c)
          Selects an algorithm according to the first argument and calls one of the implemented solvers.
static java.util.Vector midpointRule(com.rychlik.jode.VField f, double[] y0, double h, int maxSteps)
          Version of midpointRule with trivial constraints.
static java.util.Vector midpointRule(com.rychlik.jode.VField f, double[] y0, double h, int maxSteps, com.rychlik.jode.Constraints c)
           
static java.util.Vector modifiedEuler(com.rychlik.jode.VField f, double[] y0, double h, int maxSteps)
          Version of modifiedEuler with trivial constraints.
static java.util.Vector modifiedEuler(com.rychlik.jode.VField f, double[] y0, double h, int maxSteps, com.rychlik.jode.Constraints c)
           
static java.util.Vector rungeKutta4(com.rychlik.jode.VField f, double[] y0, double h, int maxSteps)
          Version of rungeKutta4 with trivial constraints.
static java.util.Vector rungeKutta4(com.rychlik.jode.VField f, double[] y0, double h, int maxSteps, com.rychlik.jode.Constraints c)
           
static java.util.Vector rungeKuttaFehlberg(com.rychlik.jode.VField f, double[] y0, double h, int maxSteps)
          Version of rungeKuttaFehlberg with trivial constraints.
static java.util.Vector rungeKuttaFehlberg(com.rychlik.jode.VField f, double[] y0, double h, int maxSteps, com.rychlik.jode.Constraints c)
          Runge-Kutta-Fehlberg integrator
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ILLEGAL

public static final int ILLEGAL
Constant representing an illegal (unknown) algorithm.

See Also:
Constant Field Values

EULER

public static final int EULER
Constant representing Euler algorithm.

See Also:
Constant Field Values

MODIFIED_EULER

public static final int MODIFIED_EULER
Constant representing Modified Euler Algorithm.

See Also:
Constant Field Values

MIDPOINT_RULE

public static final int MIDPOINT_RULE
Constant representing Midpoint Rule Algorithm.

See Also:
Constant Field Values

RUNGE_KUTTA_4

public static final int RUNGE_KUTTA_4
Constant representing Runge-Kutta 4 Algorithm.

See Also:
Constant Field Values

RUNGE_KUTTA_FEHLBERG

public static final int RUNGE_KUTTA_FEHLBERG
Constant representing Runge-Kutta-Fehlberg Algorithm.

See Also:
Constant Field Values
Constructor Detail

ODESolver

public ODESolver()
Method Detail

getAlgorithmName

public static final java.lang.String getAlgorithmName(int algorithm)

getAlgorithmNumber

public static final int getAlgorithmNumber()

getAlgorithm

public static final int getAlgorithm(java.lang.String name)

rungeKutta4

public static java.util.Vector rungeKutta4(com.rychlik.jode.VField f,
                                           double[] y0,
                                           double h,
                                           int maxSteps,
                                           com.rychlik.jode.Constraints c)
Parameters:
f - Vector field
h - Step size.
maxSteps - Maximal number of steps.
c - Constraints which solution must satisfy
Returns:
Vector of solutions.

rungeKuttaFehlberg

public static java.util.Vector rungeKuttaFehlberg(com.rychlik.jode.VField f,
                                                  double[] y0,
                                                  double h,
                                                  int maxSteps,
                                                  com.rychlik.jode.Constraints c)
Runge-Kutta-Fehlberg integrator

Parameters:
f - Vector field
maxSteps - Maximal number of steps.
c - Constraints which solution must satisfy
Returns:
Vector of solutions.

euler

public static java.util.Vector euler(com.rychlik.jode.VField f,
                                     double[] y0,
                                     double h,
                                     int maxSteps,
                                     com.rychlik.jode.Constraints c)
Parameters:
f - Vector field
h - Step size.
maxSteps - Maximal number of steps.
c - Constraints which solution must satisfy
Returns:
Vector of solutions.

modifiedEuler

public static java.util.Vector modifiedEuler(com.rychlik.jode.VField f,
                                             double[] y0,
                                             double h,
                                             int maxSteps,
                                             com.rychlik.jode.Constraints c)
Parameters:
f - Vector field
h - Step size.
maxSteps - Maximal number of steps.
c - Constraints which solution must satisfy
Returns:
Vector of solutions.

midpointRule

public static java.util.Vector midpointRule(com.rychlik.jode.VField f,
                                            double[] y0,
                                            double h,
                                            int maxSteps,
                                            com.rychlik.jode.Constraints c)
Parameters:
f - Vector field
h - Step size.
maxSteps - Maximal number of steps.
c - Constraints which solution must satisfy
Returns:
Vector of solutions.

rungeKutta4

public static java.util.Vector rungeKutta4(com.rychlik.jode.VField f,
                                           double[] y0,
                                           double h,
                                           int maxSteps)
Version of rungeKutta4 with trivial constraints.


euler

public static java.util.Vector euler(com.rychlik.jode.VField f,
                                     double[] y0,
                                     double h,
                                     int maxSteps)
Version of euler with trivial constraints.


modifiedEuler

public static java.util.Vector modifiedEuler(com.rychlik.jode.VField f,
                                             double[] y0,
                                             double h,
                                             int maxSteps)
Version of modifiedEuler with trivial constraints.


midpointRule

public static java.util.Vector midpointRule(com.rychlik.jode.VField f,
                                            double[] y0,
                                            double h,
                                            int maxSteps)
Version of midpointRule with trivial constraints.


rungeKuttaFehlberg

public static java.util.Vector rungeKuttaFehlberg(com.rychlik.jode.VField f,
                                                  double[] y0,
                                                  double h,
                                                  int maxSteps)
Version of rungeKuttaFehlberg with trivial constraints.


getErrorMessage

public static java.lang.String getErrorMessage()
Returns:
The most recent error message

integrate

public static java.util.Vector integrate(int method,
                                         com.rychlik.jode.VField f,
                                         double[] y0,
                                         double h,
                                         int maxSteps,
                                         com.rychlik.jode.Constraints c)
Selects an algorithm according to the first argument and calls one of the implemented solvers.

Parameters:
method - Constant representing method of integration.
f - Vector field.
h - Step.
maxSteps - Maximal number of steps. The actual number of steps can be smaller if during integration vector field cannot be evaluated.
c - Constraints which must be satisfied by the solution point.
Returns:
Solution vector.

integrate

public static java.util.Vector integrate(int method,
                                         com.rychlik.jode.VField f,
                                         double[] y0,
                                         double h,
                                         int maxSteps)
Version of integrate with trivial constraints.

See Also:
integrate(int, VField, double[], double, int, Constraints)



This page last modified Sun Sep 12 12:31:03 2004
Questions? Comments? Please send feedback to jason howald