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.hipparchus.CalculusFieldElement;
22  import org.hipparchus.Field;
23  import org.hipparchus.exception.MathIllegalArgumentException;
24  import org.hipparchus.exception.MathIllegalStateException;
25  import org.hipparchus.util.Binary64Field;
26  import org.junit.Test;
27  
28  public class LutherFieldIntegratorTest extends RungeKuttaFieldIntegratorAbstractTest {
29  
30      protected <T extends CalculusFieldElement<T>> RungeKuttaFieldIntegrator<T>
31      createIntegrator(Field<T> field, T step) {
32          return new LutherFieldIntegrator<T>(field, step);
33      }
34  
35      @Override
36      public void testNonFieldIntegratorConsistency() {
37          doTestNonFieldIntegratorConsistency(Binary64Field.getInstance());
38      }
39  
40      @Override
41      public void testMissedEndEvent()
42          throws MathIllegalArgumentException, MathIllegalStateException {
43          doTestMissedEndEvent(Binary64Field.getInstance(), 1.0e-15, 1.0e-15);
44      }
45  
46      @Override
47      public void testSanityChecks()
48          throws MathIllegalArgumentException, MathIllegalStateException {
49          doTestSanityChecks(Binary64Field.getInstance());
50      }
51  
52      @Override
53      public void testDecreasingSteps()
54          throws MathIllegalArgumentException, MathIllegalStateException {
55          doTestDecreasingSteps(Binary64Field.getInstance(), 3.6, 1.0, 1.0e-10);
56      }
57  
58      @Override
59      public void testSmallStep()
60           throws MathIllegalArgumentException, MathIllegalStateException {
61          doTestSmallStep(Binary64Field.getInstance(), 8.7e-17, 3.6e-15, 1.0e-12, "Luther");
62      }
63  
64      @Override
65      public void testBigStep()
66          throws MathIllegalArgumentException, MathIllegalStateException {
67          doTestBigStep(Binary64Field.getInstance(), 2.7e-5, 1.7e-3, 1.0e-12, "Luther");
68      }
69  
70      @Override
71      public void testBackward()
72          throws MathIllegalArgumentException, MathIllegalStateException {
73          doTestBackward(Binary64Field.getInstance(), 2.4e-13, 4.3e-13, 1.0e-12, "Luther");
74      }
75  
76      @Override
77      public void testKepler()
78          throws MathIllegalArgumentException, MathIllegalStateException {
79          doTestKepler(Binary64Field.getInstance(), 2.18e-7, 4.0e-10);
80      }
81  
82      @Override
83      public void testStepSize()
84          throws MathIllegalArgumentException, MathIllegalStateException {
85          doTestStepSize(Binary64Field.getInstance(), 1.0e-22);
86      }
87  
88      @Override
89      public void testSingleStep() {
90          doTestSingleStep(Binary64Field.getInstance(), 6.0e-12);
91      }
92  
93      @Override
94      public void testTooLargeFirstStep() {
95          doTestTooLargeFirstStep(Binary64Field.getInstance());
96      }
97  
98      @Override
99      public void testUnstableDerivative() {
100         doTestUnstableDerivative(Binary64Field.getInstance(), 4.0e-15);
101     }
102 
103     @Override
104     public void testDerivativesConsistency() {
105         doTestDerivativesConsistency(Binary64Field.getInstance(), 1.0e-20);
106     }
107 
108     @Override
109     public void testPartialDerivatives() {
110         doTestPartialDerivatives(4.4e-13, new double[] { 2.3e-12, 5.6e-13, 9.5e-14, 9.5e-14, 5.6e-13 });
111     }
112 
113     @Test
114     public void testSecondaryEquations() {
115         doTestSecondaryEquations(Binary64Field.getInstance(), 1.0e-12, 5.6e-13);
116     }
117 
118 }