40
40
* volume 6, no 1, 1980, pp. 19-26
43
* @version $Revision: 786881 $ $Date: 2009-06-20 14:53:08 -0400 (Sat, 20 Jun 2009) $
43
* @version $Revision: 810196 $ $Date: 2009-09-01 15:47:46 -0400 (Tue, 01 Sep 2009) $
50
50
private static final String METHOD_NAME = "Dormand-Prince 5(4)";
52
52
/** Time steps Butcher array. */
53
private static final double[] staticC = {
53
private static final double[] STATIC_C = {
54
54
1.0/5.0, 3.0/10.0, 4.0/5.0, 8.0/9.0, 1.0, 1.0
57
57
/** Internal weights Butcher array. */
58
private static final double[][] staticA = {
58
private static final double[][] STATIC_A = {
60
60
{3.0/40.0, 9.0/40.0},
61
61
{44.0/45.0, -56.0/15.0, 32.0/9.0},
67
67
/** Propagation weights Butcher array. */
68
private static final double[] staticB = {
68
private static final double[] STATIC_B = {
69
69
35.0/384.0, 0.0, 500.0/1113.0, 125.0/192.0, -2187.0/6784.0, 11.0/84.0, 0.0
72
72
/** Error array, element 1. */
73
private static final double e1 = 71.0 / 57600.0;
73
private static final double E1 = 71.0 / 57600.0;
75
75
// element 2 is zero, so it is neither stored nor used
77
77
/** Error array, element 3. */
78
private static final double e3 = -71.0 / 16695.0;
78
private static final double E3 = -71.0 / 16695.0;
80
80
/** Error array, element 4. */
81
private static final double e4 = 71.0 / 1920.0;
81
private static final double E4 = 71.0 / 1920.0;
83
83
/** Error array, element 5. */
84
private static final double e5 = -17253.0 / 339200.0;
84
private static final double E5 = -17253.0 / 339200.0;
86
86
/** Error array, element 6. */
87
private static final double e6 = 22.0 / 525.0;
87
private static final double E6 = 22.0 / 525.0;
89
89
/** Error array, element 7. */
90
private static final double e7 = -1.0 / 40.0;
90
private static final double E7 = -1.0 / 40.0;
92
92
/** Simple constructor.
93
93
* Build a fifth order Dormand-Prince integrator with the given step bounds
101
101
public DormandPrince54Integrator(final double minStep, final double maxStep,
102
102
final double scalAbsoluteTolerance,
103
103
final double scalRelativeTolerance) {
104
super(METHOD_NAME, true, staticC, staticA, staticB, new DormandPrince54StepInterpolator(),
104
super(METHOD_NAME, true, STATIC_C, STATIC_A, STATIC_B, new DormandPrince54StepInterpolator(),
105
105
minStep, maxStep, scalAbsoluteTolerance, scalRelativeTolerance);
117
117
public DormandPrince54Integrator(final double minStep, final double maxStep,
118
118
final double[] vecAbsoluteTolerance,
119
119
final double[] vecRelativeTolerance) {
120
super(METHOD_NAME, true, staticC, staticA, staticB, new DormandPrince54StepInterpolator(),
120
super(METHOD_NAME, true, STATIC_C, STATIC_A, STATIC_B, new DormandPrince54StepInterpolator(),
121
121
minStep, maxStep, vecAbsoluteTolerance, vecRelativeTolerance);
136
136
double error = 0;
138
138
for (int j = 0; j < y0.length; ++j) {
139
final double errSum = e1 * yDotK[0][j] + e3 * yDotK[2][j] +
140
e4 * yDotK[3][j] + e5 * yDotK[4][j] +
141
e6 * yDotK[5][j] + e7 * yDotK[6][j];
139
final double errSum = E1 * yDotK[0][j] + E3 * yDotK[2][j] +
140
E4 * yDotK[3][j] + E5 * yDotK[4][j] +
141
E6 * yDotK[5][j] + E7 * yDotK[6][j];
143
143
final double yScale = Math.max(Math.abs(y0[j]), Math.abs(y1[j]));
144
144
final double tol = (vecAbsoluteTolerance == null) ?