Calculation time of Runge Kutta method

This post was temporarily hidden by the community for possibly being off-topic, inappropriate, or spammy.

Don’t repost.

You didn’t compare the same things. The DifferentialEquations.jl one is adaptive time stepping to hit the tolerances. The other RK4 is fixed time step and gets whatever error comes out. Of course calculating the solution with a few orders of magnitude more accuracy is more expensive! They are taking drastically different numbers of time steps so of course the computational cost is different. Try:

using BenchmarkTools
@btime sol = solve(prob,RK4(),dt=...,adaptive=false)

and if both are using the same dt then they should be the same.

Why so fast?

Because it’s not controlling the accuracy, so it’s really quickly giving an answer with an uncontrolled amount of error, which you can force DifferentialEquations.jl to do but it’s not going to do it by default since it’s trying to solve the ODE.