Deepesh Thakur / Aug 26 2019
Lotka-Volterra Work-Precision Diagrams (including ESERK4)
Problem
using Pkg Pkg.update() using OrdinaryDiffEq, ParameterizedFunctions, DiffEqDevTools, Plots f = LotkaVolterra begin dx = a*x - b*x*y dy = -c*y + d*x*y end a b c d p = [1.5,1.0,3.0,1.0] prob = ODEProblem(f,[1.0;1.0],(0.0,10.0),p) abstols = 1.0 ./ 10.0 .^ (6:13) reltols = 1.0 ./ 10.0 .^ (3:10); sol = solve(prob,Vern7(),abstol=1/10^14,reltol=1/10^14) test_sol = TestSolution(sol) using Plots; gr() plot(sol,dpi=200,linewidth=1,legend=:bottomleft,legendfontsize=6)
Setups
setups = [ Dict(:alg=>DP5()), Dict(:alg=>BS5()), Dict(:alg=>Tsit5()), Dict(:alg=>Vern6()), #Dict(:alg=>RKC()), Dict(:alg=>ROCK2()), Dict(:alg=>ROCK4()), Dict(:alg=>SERK2(controller=:PI)), Dict(:alg=>SERK2(controller=:Predictive)), Dict(:alg=>ESERK4()), Dict(:alg=>ESERK5()) ] Names = ["DP5" "BS5" "Tsit5" "Vern6" "ROCK2" "ROCK4" "SERK2 PI" "SERK2 Predictive" "ESERK4" "ESERK5"]
1×10 Array{String,2}:
"DP5" "BS5" "Tsit5" "Vern6" "ROCK2" "ROCK4" … "ESERK4" "ESERK5"
Speed Only Tests
wp = WorkPrecisionSet(prob,abstols,reltols,setups;names=Names,appxsol=test_sol,save_everystep=false,numruns=100,maxiters=Int(1e8)) plot(wp,dpi=200,linewidth=1,legend=:topright,legendfontsize=6)
Interpolation
wp = WorkPrecisionSet(prob,abstols,reltols,setups;names=Names,appxsol=test_sol,save_everystep=false,numruns=100,maxiters=Int(1e8),error_estimate=:L2,dense_errors=true) plot(wp,dpi=200,linewidth=1,legend=:topleft,legendfontsize=6)
All Stabilized methods are performing reasonably well as compared to Implicit Solvers. RKC is an exception as it could not solve theprob with the given number of iterations.