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.jupiter.api.Test;
21  
22  class HighamHall54IntegratorTest extends EmbeddedRungeKuttaIntegratorAbstractTest {
23  
24      protected EmbeddedRungeKuttaIntegrator
25      createIntegrator(final double minStep, final double maxStep,
26                       final double scalAbsoluteTolerance, final double scalRelativeTolerance) {
27          return new HighamHall54Integrator(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 HighamHall54Integrator(minStep, maxStep, vecAbsoluteTolerance, vecRelativeTolerance);
34      }
35  
36      @Override
37      @Test
38      public void testBackward() {
39          doTestBackward(5.0e-7, 5.0e-7, 1.0e-12, "Higham-Hall 5(4)");
40      }
41  
42      @Override
43      @Test
44      public void testKepler() {
45          doTestKepler(1.5e-4);
46      }
47  
48      @Override
49      @Test
50      public void testTorqueFreeMotionOmegaOnly() {
51          doTestTorqueFreeMotionOmegaOnly(2.7e-15);
52      }
53  
54      @Override
55      @Test
56      public void testTorqueFreeMotion() {
57          doTestTorqueFreeMotion(1.5e-15, 5.6e-16);
58      }
59  
60      @Override
61      @Test
62      public void testTorqueFreeMotionIssue230() {
63          doTestTorqueFreeMotionIssue230(5.4e-15, 1.5e-15);
64      }
65  
66      @Override
67      @Test
68      public void testForwardBackwardExceptions() {
69          doTestForwardBackwardExceptions();
70      }
71  
72      @Override
73      @Test
74      public void testIncreasingTolerance() {
75          // the 1.3 factor is only valid for this test
76          // and has been obtained from trial and error
77          // there is no general relation between local and global errors
78          doTestIncreasingTolerance(1.3, 1.0e-12);
79      }
80  
81      @Override
82      @Test
83      public void testEvents() {
84          doTestEvents(1.0e-7, "Higham-Hall 5(4)");
85      }
86  
87      @Override
88      @Test
89      public void testStepEnd() {
90          doTestStepEnd(119, "Higham-Hall 5(4)");
91      }
92  
93      @Override
94      @Test
95      public void testStopAfterStep() {
96          doTestStopAfterStep(12, 1.110791);
97      }
98  
99      @Override
100     @Test
101     public void testResetAfterStep() {
102         doTestResetAfterStep(12, 14);
103     }
104 
105     @Test
106     public void testMissedEndEvent() {
107         doTestMissedEndEvent(1.0e-15, 1.0e-15);
108     }
109 
110     @Test
111     public void testVariableSteps() {
112         doTestVariableSteps(0.00169, 0.267);
113     }
114 
115     @Test
116     public void testUnstableDerivative() {
117      doTestUnstableDerivative(1.0e-12);
118     }
119 
120     @Override
121     @Test
122     public void testPartialDerivatives() {
123         doTestPartialDerivatives(1.2e-11, 8.0e-11);
124     }
125 
126     @Test
127     public void testSecondaryEquations() {
128         doTestSecondaryEquations(9.7e-12, 1.3e-14);
129     }
130 
131 }