-
-
Notifications
You must be signed in to change notification settings - Fork 37
Open
Labels
Description
I have this problem that MIRK3, MIRK4, and MIRK6 seem to handle fine, but MIRK5 ends up having very large errors on:
using BoundaryValueDiffEq, BenchmarkTools
function lotkavolterra!(du, u, p, t)
du[1] = p[1]*u[1] - p[2]*u[1]*u[2]
du[2] = -p[4]*u[2] + p[3]*u[1]*u[2]
end
function bc!(du, u, p, t)
du[1] = u(0.6)[1] - 3.5
du[2] = u(0.3)[1] - 7.0
end
p = [1.5, 1., 1., 3.]
bvp = BVProblem(lotkavolterra!, bc!, [4., 2.], (0., 1.), p)
du = zeros(2)
sol = @btime solve($bvp, MIRK3(), dt = 0.05) # time: 3.134 ms
bc!(du, sol, p, 1.) # [0.00014751435360382814, -0.0001928704283686855]
sol = @btime solve($bvp, MIRK4(), dt = 0.05) # time: 411.375 μs
bc!(du, sol, p, 1.) # [0.00026448435797687964, -0.00031431123142944273]
sol = @btime solve($bvp, MIRK5(), dt = 0.05) # time: 8.272 ms
bc!(du, sol, p, 1.) # [2.0705889974019476, -0.9358530914362078]
sol = @btime solve($bvp, MIRK6(), dt = 0.05) # time: 499.292 μs
bc!(du, sol, p, 1.) # [0.0002639321800703698, -0.000315300179799749]
It also returns a successful retcode in this case. Not sure if this is something wrong or expected weirdness, but thought i'd report in case.