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