diff --git a/src/test/java/org/apache/commons/math4/ode/TestProblem1.java b/src/test/java/org/apache/commons/math4/ode/TestProblem1.java index 27409203b..62ad22252 100644 --- a/src/test/java/org/apache/commons/math4/ode/TestProblem1.java +++ b/src/test/java/org/apache/commons/math4/ode/TestProblem1.java @@ -56,16 +56,16 @@ public class TestProblem1 public void doComputeDerivatives(double t, double[] y, double[] yDot) { // compute the derivatives - for (int i = 0; i < n; ++i) + for (int i = 0; i < getDimension(); ++i) yDot[i] = -y[i]; } @Override public double[] computeTheoreticalState(double t) { - double c = FastMath.exp (t0 - t); - for (int i = 0; i < n; ++i) { - y[i] = c * y0[i]; + double c = FastMath.exp (getInitialTime() - t); + for (int i = 0; i < getDimension(); ++i) { + y[i] = c * getInitialState()[i]; } return y; } diff --git a/src/test/java/org/apache/commons/math4/ode/TestProblem2.java b/src/test/java/org/apache/commons/math4/ode/TestProblem2.java index 27bd2c1d1..4936a02c7 100644 --- a/src/test/java/org/apache/commons/math4/ode/TestProblem2.java +++ b/src/test/java/org/apache/commons/math4/ode/TestProblem2.java @@ -57,7 +57,7 @@ public class TestProblem2 public void doComputeDerivatives(double t, double[] y, double[] yDot) { // compute the derivatives - for (int i = 0; i < n; ++i) + for (int i = 0; i < getDimension(); ++i) yDot[i] = t * (t * t - y[i]); } @@ -66,7 +66,7 @@ public class TestProblem2 public double[] computeTheoreticalState(double t) { double t2 = t * t; double c = t2 + 2 * (FastMath.exp (-0.5 * t2) - 1); - for (int i = 0; i < n; ++i) { + for (int i = 0; i < getDimension(); ++i) { y[i] = c; } return y; diff --git a/src/test/java/org/apache/commons/math4/ode/TestProblem5.java b/src/test/java/org/apache/commons/math4/ode/TestProblem5.java index b3a19d558..a9ae3bafd 100644 --- a/src/test/java/org/apache/commons/math4/ode/TestProblem5.java +++ b/src/test/java/org/apache/commons/math4/ode/TestProblem5.java @@ -28,7 +28,7 @@ public class TestProblem5 extends TestProblem1 { * Simple constructor. */ public TestProblem5() { - setFinalConditions(2 * t0 - t1); + setFinalConditions(2 * getInitialTime() - getFinalTime()); } } diff --git a/src/test/java/org/apache/commons/math4/ode/TestProblem6.java b/src/test/java/org/apache/commons/math4/ode/TestProblem6.java index 17b65061a..b06cf77ca 100644 --- a/src/test/java/org/apache/commons/math4/ode/TestProblem6.java +++ b/src/test/java/org/apache/commons/math4/ode/TestProblem6.java @@ -58,7 +58,7 @@ public class TestProblem6 double t2 = t * t; double t4 = t2 * t2; double t5 = t4 * t; - for (int i = 0; i < n; ++i) { + for (int i = 0; i < getDimension(); ++i) { yDot[i] = 3 * t5 - y[i]; } @@ -66,7 +66,7 @@ public class TestProblem6 @Override public double[] computeTheoreticalState(double t) { - for (int i = 0; i < n; ++i) { + for (int i = 0; i < getDimension(); ++i) { y[i] = ((((3 * t - 15) * t + 60) * t - 180) * t + 360) * t - 360; } return y; diff --git a/src/test/java/org/apache/commons/math4/ode/TestProblemAbstract.java b/src/test/java/org/apache/commons/math4/ode/TestProblemAbstract.java index aa4e3e0ae..e59df4579 100644 --- a/src/test/java/org/apache/commons/math4/ode/TestProblemAbstract.java +++ b/src/test/java/org/apache/commons/math4/ode/TestProblemAbstract.java @@ -28,22 +28,22 @@ public abstract class TestProblemAbstract implements FirstOrderDifferentialEquations { /** Dimension of the problem. */ - protected int n; + private int n; /** Number of functions calls. */ - protected int calls; + private int calls; /** Initial time */ - protected double t0; + private double t0; /** Initial state */ - protected double[] y0; + private double[] y0; /** Final time */ - protected double t1; + private double t1; /** Error scale */ - protected double[] errorScale; + private double[] errorScale; /** * Simple constructor.