rkm.butcher
Class ButcherMatrix

java.lang.Object
  extended by rkm.butcher.ButcherMatrix
Direct Known Subclasses:
CustomButcherMatrix, ForwardEuler, Heun, Merson, Midpoint, ModifiedEuler, RungeKutta3, RungeKutta4, ThreeEights

public abstract class ButcherMatrix
extends java.lang.Object

Butcher matrix representation of a Runge-Kutta method. This class also keeps track of all available subclasses.


Field Summary
protected  double[][] a
           
protected  double[] b
           
protected  double[] c
           
 
Constructor Summary
ButcherMatrix()
           
 
Method Summary
 double a(int i, int j)
           
 double b(int i)
           
 double c(int i)
           
static ButcherMatrix[] getAvailableMethods()
           
static ButcherMatrix getCustomButcherMatrix(double[][] a, double[] b, double[] c)
           
abstract  int order()
           
abstract  java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

a

protected double[][] a

b

protected double[] b

c

protected double[] c
Constructor Detail

ButcherMatrix

public ButcherMatrix()
Method Detail

a

public double a(int i,
                int j)
Returns:
element (i,j) of submatrix A. Both indices range from 1 to order.

b

public double b(int i)
Returns:
element i of submatrix B. The range of i is from 1 to order.

c

public double c(int i)
Returns:
element i of submatrix C. The range of i is from 1 to order.

order

public abstract int order()
Returns:
the order of the matrix. This is the size (n) of submatrices A (nxn), B (1xn) and C (nx1).

toString

public abstract java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:
a description of the Runge-Kutta method this matrix represents.

getAvailableMethods

public static ButcherMatrix[] getAvailableMethods()
Returns:
an array of ButcherMatrices, one of each available subclass.

getCustomButcherMatrix

public static ButcherMatrix getCustomButcherMatrix(double[][] a,
                                                   double[] b,
                                                   double[] c)
Returns:
a custom-built Butcher matrix built with the given submatrices.