matlab - why the numerical result is different (RK45)? -
this test equation differential using runge-kutta45: f(x,y)= (-5*x - y/5)^1/8 + 10
why numerical result different? used :
function rk_jl() f(x,y)= (-5*x - y/5)^1/8 + 10 tspan = 0:0.001:n y0 = [0.0, 1.0] return ode.ode45(f, y0,tspan); end
and
function [x1,y1] = rk_m() f = @(x,y) (-5*x - y/5)^1/8 + 10; tspan = 0:0.001:n; y0 = 1 [x1,y1]= ode45(f,tspan,1); end
the programs have different default settings, such default tolerances , stepping/rejection behavior. such, shouldn't expect them "exactly" same.
to add this, ode.jl doesn't use stepsize stabilization (which optimized library differentialequations.jl, odeinterface.jl, or matlab's library uses), expect have vastly worse stepsize choices (according hairer's book, 2x-4x less efficient stepping behavior). if use same tolerances, ode.jl produce different results since it's not using standard optimized algorithm.
Comments
Post a Comment