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