View Javadoc
1   /*
2    * Licensed to the Hipparchus project under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The Hipparchus project licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    *
9    *      https://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  
18  package org.hipparchus.ode.nonstiff;
19  
20  import org.junit.Test;
21  
22  public class DormandPrince54IntegratorTest extends EmbeddedRungeKuttaIntegratorAbstractTest {
23  
24      protected EmbeddedRungeKuttaIntegrator
25      createIntegrator(final double minStep, final double maxStep,
26                       final double scalAbsoluteTolerance, final double scalRelativeTolerance) {
27          return new DormandPrince54Integrator(minStep, maxStep, scalAbsoluteTolerance, scalRelativeTolerance);
28      }
29  
30      protected EmbeddedRungeKuttaIntegrator
31      createIntegrator(final double minStep, final double maxStep,
32                       final double[] vecAbsoluteTolerance, final double[] vecRelativeTolerance) {
33          return new DormandPrince54Integrator(minStep, maxStep, vecAbsoluteTolerance, vecRelativeTolerance);
34      }
35  
36      @Override
37      public void testBackward() {
38          doTestBackward(1.6e-7, 1.6e-7, 1.0e-22, "Dormand-Prince 5(4)");
39      }
40  
41      @Override
42      public void testKepler() {
43          doTestKepler(3.1e-10);
44      }
45  
46      @Override
47      public void testTorqueFreeMotionOmegaOnly() {
48          doTestTorqueFreeMotionOmegaOnly(2.1e-16);
49      }
50  
51      @Override
52      public void testTorqueFreeMotion() {
53          doTestTorqueFreeMotion(1.5e-15, 5.6e-16);
54      }
55  
56      @Override
57      public void testTorqueFreeMotionIssue230() {
58          doTestTorqueFreeMotionIssue230(5.4e-15, 1.5e-15);
59      }
60  
61      @Override
62      public void testForwardBackwardExceptions() {
63          doTestForwardBackwardExceptions();
64      }
65  
66      @Override
67      public void testIncreasingTolerance() {
68          // the 0.7 factor is only valid for this test
69          // and has been obtained from trial and error
70          // there is no general relation between local and global errors
71          doTestIncreasingTolerance(0.7, 1.0e-12);
72      }
73  
74      @Override
75      public void testEvents() {
76          doTestEvents(1.7e-7, "Dormand-Prince 5(4)");
77      }
78  
79      @Override
80      public void testStepEnd() {
81          doTestStepEnd(119, "Dormand-Prince 5(4)");
82      }
83  
84      @Override
85      public void testStopAfterStep() {
86          doTestStopAfterStep(12, 1.117270);
87      }
88  
89      @Override
90      public void testResetAfterStep() {
91          doTestResetAfterStep(12, 14);
92      }
93  
94      @Test
95      public void testMissedEndEvent() {
96          doTestMissedEndEvent(1.0e-15, 1.0e-15);
97      }
98  
99      @Test
100     public void testVariableSteps() {
101         doTestVariableSteps(0.00216, 0.240);
102     }
103 
104     @Test
105     public void testUnstableDerivative() {
106      doTestUnstableDerivative(1.0e-12);
107     }
108 
109     @Override
110     public void testPartialDerivatives() {
111         doTestPartialDerivatives(4.8e-12, 3.3e-11);
112     }
113 
114     @Test
115     public void testSecondaryEquations() {
116         doTestSecondaryEquations(4.0e-12, 7.2e-15);
117     }
118 
119 }
120