Skip to content

Commit fdd291c

Browse files
committed
Add Ralston4
1 parent bf369d9 commit fdd291c

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

src/DiffEqDevTools.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export constructEuler, constructKutta3, constructRK4, constructRK438Rule,
5151
constructLobattoIIICStar4, constructLobattoIIID2, constructLobattoIIID4,
5252
constructRadauIA3, constructRadauIA5,
5353
constructRadauIIA3, constructRadauIIA5,
54-
constructRalston, constructHeun, constructRKF5, constructBogakiShampine3,
54+
constructRalston, constructRalston4, constructHeun, constructRKF5, constructBogakiShampine3,
5555
constructCashKarp, constructRKF8, constructDormandPrince8,
5656
constructMSRI1,constructFeagin10, constructFeagin12, constructFeagin14,
5757
constructDormandPrince8_64bit, constructRKF5, constructRungeFirst5,

src/ode_tableaus.jl

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,35 @@ function constructRK438Rule(T::Type = Float64)
231231
return(ExplicitRKTableau(A,c,α,4))
232232
end
233233

234+
"""
235+
Ralston's Order 4 method with minimum truncation error.
236+
"""
237+
function constructRalston4(T::Type = Float64)
238+
sqrt5 = sqrt(convert(T, 5))
239+
a21 = 4//10
240+
a31 = (-2889 + 1428 * sqrt5) / 1024
241+
a32 = (3785 - 1620 * sqrt5) / 1024
242+
a41 = (-3365 + 2094 * sqrt5) / 6040
243+
a42 = (-975 - 3046 * sqrt5) / 2552
244+
a43 = (467040 + 203968 * sqrt5) / 240845
245+
A = [0 0 0 0
246+
a21 0 0 0
247+
a31 a32 0 0
248+
a41 a42 a43 0]
249+
b2 = 4//10
250+
b3 = (14 - 3 * sqrt5) / 16
251+
c = [0, b2, b3, 1]
252+
b1 = (263 + 24 * sqrt5) / 1812
253+
b2 = (125 - 1000 * sqrt5) / 3828
254+
b3 = 1024 * (3346 + 1623 * sqrt5) / 5924787
255+
b4 = (30 - 4 * sqrt5) / 123
256+
α = [b1, b2, b3, b4]
257+
A = map(T,A)
258+
α = map(T,α)
259+
c = map(T,c)
260+
return ExplicitRKTableau(A,c,α,4)
261+
end
262+
234263
"""
235264
Explicit SSP method of order 2 using 2 stages.
236265
"""

0 commit comments

Comments
 (0)