commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From l..@apache.org
Subject [24/50] [abbrv] [math] Added test for Luther integrator.
Date Wed, 09 Dec 2015 16:17:04 GMT
Added test for Luther integrator.

BEWARE! This test does not work yet. The integrator seems to be wrong
for now, probably at step interpolation level because the Butcher arrays
are consisten with the regulat integrator.

Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/dfdaea27
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/dfdaea27
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/dfdaea27

Branch: refs/heads/MATH_3_X
Commit: dfdaea27957139243c6499ad8af93a969f23fcfb
Parents: 8e60a5f
Author: Luc Maisonobe <luc@apache.org>
Authored: Thu Dec 3 18:16:04 2015 +0100
Committer: Luc Maisonobe <luc@apache.org>
Committed: Thu Dec 3 18:16:04 2015 +0100

----------------------------------------------------------------------
 .../ode/nonstiff/LutherFieldIntegratorTest.java | 118 +++++++++++++++++++
 1 file changed, 118 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-math/blob/dfdaea27/src/test/java/org/apache/commons/math3/ode/nonstiff/LutherFieldIntegratorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/ode/nonstiff/LutherFieldIntegratorTest.java
b/src/test/java/org/apache/commons/math3/ode/nonstiff/LutherFieldIntegratorTest.java
new file mode 100644
index 0000000..cd5b4a8
--- /dev/null
+++ b/src/test/java/org/apache/commons/math3/ode/nonstiff/LutherFieldIntegratorTest.java
@@ -0,0 +1,118 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.commons.math3.ode.nonstiff;
+
+
+import org.apache.commons.math3.Field;
+import org.apache.commons.math3.RealFieldElement;
+import org.apache.commons.math3.exception.DimensionMismatchException;
+import org.apache.commons.math3.exception.MaxCountExceededException;
+import org.apache.commons.math3.exception.NoBracketingException;
+import org.apache.commons.math3.exception.NumberIsTooSmallException;
+import org.apache.commons.math3.util.Decimal64Field;
+import org.junit.Test;
+
+public class LutherFieldIntegratorTest extends AbstractRungeKuttaFieldIntegratorTest {
+
+    protected <T extends RealFieldElement<T>> RungeKuttaFieldIntegrator<T>
+    createIntegrator(Field<T> field, T step) {
+        return new LutherFieldIntegrator<T>(field, step);
+    }
+
+    @Test
+    public void testNonFieldIntegratorConsistency() {
+        doTestNonFieldIntegratorConsistency(Decimal64Field.getInstance());
+    }
+
+    @Test
+    public void testMissedEndEvent()
+        throws DimensionMismatchException, NumberIsTooSmallException,
+               MaxCountExceededException, NoBracketingException {
+        doTestMissedEndEvent(Decimal64Field.getInstance(), 1.0e-15, 1.0e-15);
+    }
+
+    @Test
+    public void testSanityChecks()
+        throws DimensionMismatchException, NumberIsTooSmallException,
+               MaxCountExceededException, NoBracketingException {
+        doTestSanityChecks(Decimal64Field.getInstance());
+    }
+
+    @Test
+    public void testDecreasingSteps()
+        throws DimensionMismatchException, NumberIsTooSmallException,
+               MaxCountExceededException, NoBracketingException {
+        doTestDecreasingSteps(Decimal64Field.getInstance(), 1.0, 1.0, 1.0e-10);
+    }
+
+    @Test
+    public void testSmallStep()
+         throws DimensionMismatchException, NumberIsTooSmallException,
+                MaxCountExceededException, NoBracketingException {
+        doTestSmallStep(Decimal64Field.getInstance(), 9.0e-17, 4.0e-15, 1.0e-12, "Luther");
+    }
+
+    @Test
+    public void testBigStep()
+        throws DimensionMismatchException, NumberIsTooSmallException,
+               MaxCountExceededException, NoBracketingException {
+        doTestBigStep(Decimal64Field.getInstance(), 0.00002, 0.001, 1.0e-12, "Luther");
+    }
+
+    @Test
+    public void testBackward()
+        throws DimensionMismatchException, NumberIsTooSmallException,
+               MaxCountExceededException, NoBracketingException {
+        doTestBackward(Decimal64Field.getInstance(), 3.0e-13, 5.0e-13, 1.0e-12, "Luther");
+    }
+
+    @Test
+    public void testKepler()
+        throws DimensionMismatchException, NumberIsTooSmallException,
+               MaxCountExceededException, NoBracketingException {
+        doTestKepler(Decimal64Field.getInstance(), 2.2e-7, 1.0e-8);
+    }
+
+    @Test
+    public void testStepSize()
+        throws DimensionMismatchException, NumberIsTooSmallException,
+               MaxCountExceededException, NoBracketingException {
+        doTestStepSize(Decimal64Field.getInstance(), 1.0e-12);
+    }
+
+    @Test
+    public void testSingleStep() {
+        doTestSingleStep(Decimal64Field.getInstance(), 1.0e-11);
+    }
+
+    @Test
+    public void testTooLargeFirstStep() {
+        doTestTooLargeFirstStep(Decimal64Field.getInstance());
+    }
+
+    @Test
+    public void testUnstableDerivative() {
+        doTestUnstableDerivative(Decimal64Field.getInstance(), 1.0e-12);
+    }
+
+    @Test
+    public void testDerivativesConsistency() {
+        doTestDerivativesConsistency(Decimal64Field.getInstance(), 1.0e-10);
+    }
+
+}


Mime
View raw message