-1

this is the test for equation differential using runge-kutta45: f(x,y)= (-5*x - y/5)^1/8 + 10

enter image description here

why the numerical result is different? I 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

1 Answers1

1

The programs have slightly different default settings, such as default tolerances and stepping/rejection behavior. As such, you shouldn't expect them to be "exactly" the same.

To add to this, ODE.jl doesn't use stepsize stabilization (which any optimized library like DifferentialEquations.jl, ODEInterface.jl, or MATLAB's library uses), so I would expect it to have vastly worse stepsize choices (according to Hairer's book, about 2x-4x less efficient just from the stepping behavior). So even if you use the same tolerances, ODE.jl will produce different results since it's not using the standard optimized algorithm.

Chris Rackauckas
  • 18,645
  • 3
  • 50
  • 81