Can you post your new code and your new results? Is the difference consistent with the tolerance level?
Naively, I would expect the difference between the two implementations to be around sqrt(N)*AbsTol -- this is what you'd expect if at each step each implementation has an unbiased random error of size AbsTol. Cheers, Daniel. On 14 June 2016 at 18:22, <[email protected]> wrote: > > Hi Daniel > I did the test and the difference decreased. interesting, I had not > noticed. > > Em domingo, 12 de junho de 2016 09:53:40 UTC-3, Daniel Carrera escreveu: >> >> I don't know what you are trying to say, but did you try running the two >> programs with the same relative and absolute tolerances? Do the results >> look more similar now? >> >> On 12 June 2016 at 02:01, <[email protected]> wrote: >> >>> Hi daniel >>> in fact, there is a relationship with the tolerance between the methods. >>> >>> Em sábado, 11 de junho de 2016 11:51:53 UTC-3, Daniel Carrera escreveu: >>>> >>>> Probably because the Julia module has different default values for the >>>> absolute and relative tolerance. For Julia, the defaults are reltol=1e-5 >>>> and abstol=1e-8 but in Matlab the defaults are RelTol=1e-3 and AbsTol=1e-6. >>>> >>>> https://github.com/JuliaLang/ODE.jl >>>> http://se.mathworks.com/help/matlab/ref/odeset.html >>>> >>>> That would also explain why the Julia program took so much longer. Try >>>> again with the same tolerance and see if the results are more similar. Oh, >>>> and like Erik said, you probably meant to have parenthesis around "1/8". If >>>> the results still look difference, look for more options that might have >>>> different default values. >>>> >>>> Cheers, >>>> Daniel. >>>> >>>> >>>> >>>> On Saturday, 11 June 2016 04:29:47 UTC+2, [email protected] >>>> wrote: >>>>> >>>>> this is the test for equation differential using runge-kutta45: >>>>> f(x,y)= (-5*x - y/5)^1/8 + 10 >>>>> >>>>> >>>>> <https://lh3.googleusercontent.com/-D6U4d5pN0pw/V1t3MaV3JpI/AAAAAAAAACU/-E_ceVhrTxkT3SAgmLUy5nHDhRJTIikSgCLcB/s1600/rk45.png> >>>>> >>>>> 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 >>>>> >>>>> >>
