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