1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.hipparchus.ode.nonstiff;
19
20 import org.hipparchus.CalculusFieldElement;
21 import org.hipparchus.Field;
22 import org.hipparchus.exception.MathIllegalArgumentException;
23 import org.hipparchus.exception.MathIllegalStateException;
24 import org.hipparchus.util.Binary64Field;
25 import org.junit.jupiter.api.Test;
26
27 import static org.junit.jupiter.api.Assertions.assertThrows;
28
29 class AdamsBashforthFieldIntegratorTest extends AdamsFieldIntegratorAbstractTest {
30
31 protected <T extends CalculusFieldElement<T>> AdamsFieldIntegrator<T>
32 createIntegrator(Field<T> field, final int nSteps, final double minStep, final double maxStep,
33 final double scalAbsoluteTolerance, final double scalRelativeTolerance) {
34 return new AdamsBashforthFieldIntegrator<T>(field, nSteps, minStep, maxStep,
35 scalAbsoluteTolerance, scalRelativeTolerance);
36 }
37
38 protected <T extends CalculusFieldElement<T>> AdamsFieldIntegrator<T>
39 createIntegrator(Field<T> field, final int nSteps, final double minStep, final double maxStep,
40 final double[] vecAbsoluteTolerance, final double[] vecRelativeTolerance) {
41 return new AdamsBashforthFieldIntegrator<T>(field, nSteps, minStep, maxStep,
42 vecAbsoluteTolerance, vecRelativeTolerance);
43 }
44
45 @Test
46 void testNbPoints() {
47 doNbPointsTest();
48 }
49
50 @Test
51 public void testMinStep() {
52 assertThrows(MathIllegalArgumentException.class, () -> {
53 doDimensionCheck(Binary64Field.getInstance());
54 });
55 }
56
57 @Test
58 public void testIncreasingTolerance() {
59
60
61
62 doTestIncreasingTolerance(Binary64Field.getInstance(), 2.6, 122);
63 }
64
65 @Test
66 public void exceedMaxEvaluations() {
67 assertThrows(MathIllegalStateException.class, () -> {
68 doExceedMaxEvaluations(Binary64Field.getInstance(), 650);
69 });
70 }
71
72 @Test
73 public void backward() {
74 doBackward(Binary64Field.getInstance(), 4.3e-8, 4.3e-8, 1.0e-16, "Adams-Bashforth");
75 }
76
77 @Test
78 public void polynomial() {
79 doPolynomial(Binary64Field.getInstance(), 5, 9.0e-4, 9.3e-10);
80 }
81
82 @Test
83 public void testSecondaryEquations() {
84 doTestSecondaryEquations(Binary64Field.getInstance(), 4.3e-10, 8.9e-16);
85 }
86
87 @Test
88 public void testStartFailure() {
89 assertThrows(MathIllegalStateException.class, () -> {
90 doTestStartFailure(Binary64Field.getInstance());
91 });
92 }
93
94 }