commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From l..@apache.org
Subject [04/50] [abbrv] [math] Added test for Luther integrator.
Date Wed, 06 Jan 2016 13:50:20 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/548dfd8b
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/548dfd8b
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/548dfd8b

Branch: refs/heads/master
Commit: 548dfd8bead389790d1c438d54afaa1f060f0eba
Parents: eef2ed3
Author: Luc Maisonobe <luc@apache.org>
Authored: Wed Jan 6 12:41:10 2016 +0100
Committer: Luc Maisonobe <luc@apache.org>
Committed: Wed Jan 6 12:41:10 2016 +0100

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


http://git-wip-us.apache.org/repos/asf/commons-math/blob/548dfd8b/src/test/java/org/apache/commons/math4/ode/nonstiff/LutherFieldIntegratorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/ode/nonstiff/LutherFieldIntegratorTest.java
b/src/test/java/org/apache/commons/math4/ode/nonstiff/LutherFieldIntegratorTest.java
new file mode 100644
index 0000000..3a668b8
--- /dev/null
+++ b/src/test/java/org/apache/commons/math4/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.math4.ode.nonstiff;
+
+
+import org.apache.commons.math4.Field;
+import org.apache.commons.math4.RealFieldElement;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MaxCountExceededException;
+import org.apache.commons.math4.exception.NoBracketingException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.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