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.util.Binary64Field;
24  import org.junit.Test;
25  
26  public class EulerFieldIntegratorTest extends RungeKuttaFieldIntegratorAbstractTest {
27  
28      protected <T extends CalculusFieldElement<T>> RungeKuttaFieldIntegrator<T>
29      createIntegrator(Field<T> field, T step) {
30          return new EulerFieldIntegrator<T>(field, step);
31      }
32  
33      @Override
34      public void testNonFieldIntegratorConsistency() {
35          doTestNonFieldIntegratorConsistency(Binary64Field.getInstance());
36      }
37  
38      @Override
39      public void testMissedEndEvent() {
40          doTestMissedEndEvent(Binary64Field.getInstance(), 1.0e-15, 6.0e-5);
41      }
42  
43      @Override
44      public void testSanityChecks() {
45          doTestSanityChecks(Binary64Field.getInstance());
46      }
47  
48      @Override
49      public void testDecreasingSteps() {
50          doTestDecreasingSteps(Binary64Field.getInstance(), 1.0, 1.5, 1.0e-10);
51      }
52  
53      @Override
54      public void testSmallStep() {
55          doTestSmallStep(Binary64Field.getInstance(), 2.0e-4, 1.0e-3, 1.0e-12, "Euler");
56      }
57  
58      @Override
59      public void testBigStep() {
60          doTestBigStep(Binary64Field.getInstance(), 0.01, 0.2, 1.0e-12, "Euler");
61  
62      }
63  
64      @Override
65      public void testBackward() {
66          doTestBackward(Binary64Field.getInstance(), 0.45, 0.45, 1.0e-12, "Euler");
67      }
68  
69      @Override
70      public void testKepler() {
71          // Euler integrator is clearly not able to solve this problem
72          doTestKepler(Binary64Field.getInstance(), 881.176, 0.001);
73      }
74  
75      @Override
76      public void testStepSize() {
77          doTestStepSize(Binary64Field.getInstance(), 1.0e-12);
78      }
79  
80      @Override
81      public void testSingleStep() {
82          doTestSingleStep(Binary64Field.getInstance(), 0.21);
83      }
84  
85      @Override
86      public void testTooLargeFirstStep() {
87          doTestTooLargeFirstStep(Binary64Field.getInstance());
88      }
89  
90      @Override
91      public void testUnstableDerivative() {
92          doTestUnstableDerivative(Binary64Field.getInstance(), 1.0e-12);
93      }
94  
95      @Override
96      public void testDerivativesConsistency() {
97          doTestDerivativesConsistency(Binary64Field.getInstance(), 1.0e-10);
98      }
99  
100     @Override
101     public void testPartialDerivatives() {
102         doTestPartialDerivatives(0.085, new double[] { 0.47, 0.13, 0.019, 0.019, 0.13 });
103     }
104 
105     @Test
106     public void testSecondaryEquations() {
107         doTestSecondaryEquations(Binary64Field.getInstance(), 4.8e-3, 5.6e-13);
108     }
109 
110 }