1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 package org.hipparchus.ode.nonstiff;
24
25 import org.hipparchus.CalculusFieldElement;
26 import org.hipparchus.Field;
27 import org.hipparchus.ode.FieldEquationsMapper;
28 import org.hipparchus.ode.FieldODEStateAndDerivative;
29 import org.hipparchus.util.MathArrays;
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54 public class ThreeEighthesFieldIntegrator<T extends CalculusFieldElement<T>>
55 extends RungeKuttaFieldIntegrator<T> {
56
57
58 public static final String METHOD_NAME = ThreeEighthesIntegrator.METHOD_NAME;
59
60
61
62
63
64
65 public ThreeEighthesFieldIntegrator(final Field<T> field, final T step) {
66 super(field, METHOD_NAME, step);
67 }
68
69
70 @Override
71 public T[] getC() {
72 final T[] c = MathArrays.buildArray(getField(), 3);
73 c[0] = FieldExplicitRungeKuttaIntegrator.fraction(getField(), 1, 3);
74 c[1] = c[0].add(c[0]);
75 c[2] = getField().getOne();
76 return c;
77 }
78
79
80 @Override
81 public T[][] getA() {
82 final T[][] a = MathArrays.buildArray(getField(), 3, -1);
83 for (int i = 0; i < a.length; ++i) {
84 a[i] = MathArrays.buildArray(getField(), i + 1);
85 }
86 a[0][0] = FieldExplicitRungeKuttaIntegrator.fraction(getField(), 1, 3);
87 a[1][0] = a[0][0].negate();
88 a[1][1] = getField().getOne();
89 a[2][0] = getField().getOne();
90 a[2][1] = getField().getOne().negate();
91 a[2][2] = getField().getOne();
92 return a;
93 }
94
95
96 @Override
97 public T[] getB() {
98 final T[] b = MathArrays.buildArray(getField(), 4);
99 b[0] = FieldExplicitRungeKuttaIntegrator.fraction(getField(), 1, 8);
100 b[1] = FieldExplicitRungeKuttaIntegrator.fraction(getField(), 3, 8);
101 b[2] = b[1];
102 b[3] = b[0];
103 return b;
104 }
105
106
107 @Override
108 protected ThreeEighthesFieldStateInterpolator<T>
109 createInterpolator(final boolean forward, T[][] yDotK,
110 final FieldODEStateAndDerivative<T> globalPreviousState,
111 final FieldODEStateAndDerivative<T> globalCurrentState,
112 final FieldEquationsMapper<T> mapper) {
113 return new ThreeEighthesFieldStateInterpolator<T>(getField(), forward, yDotK,
114 globalPreviousState, globalCurrentState,
115 globalPreviousState, globalCurrentState,
116 mapper);
117 }
118
119 }