Actually, I've looked at 
https://github.com/JuliaLang/ODE.jl/blob/master/test/test_ode.jl and 
attempted:

t,x = 
ode.ode45((t,x)->[-beta*x[1]*x[2],beta*x[1]*x[2]-gamma*x[2],gamma*x[2]],[0,14],[760.,3.,0.]);

where x[1], x[2] and x[3] are S, I, R respectively, and the parameters beta 
and gamma were defined earlier.  This seems to work well.  I suppose 
there's a way of using S, I, R instead of x[1], x[2], x[3] here...

Sundials may well be the perfect solution, but I couldn't get it to work, 
and the documentation is daunting, to say the least!

On Tuesday, January 7, 2014 9:58:54 PM UTC+11, Ivar Nesje wrote:
>
> This seems likely to be caused by changes in Julia. The fix will probably 
> involve a bug report to https://github.com/JuliaLang/ODE.jl and some code 
> reading and testing. If you see that the commit count on that repository is 
> 11 it is quite possible that it does not receive the care ODE solvers 
> deserve in a language like Julia.
>
> I am not sure, but Sundials.jl <https://github.com/JuliaLang/Sundials.jl> 
> might 
> be an option, but when I tried it last time it was no automatic script for 
> compiling and installing the dependencies.
>
>
>
> kl. 11:23:33 UTC+1 tirsdag 7. januar 2014 skrev Alasdair McAndrew følgende:
>>
>> I have copied the SIR model here: 
>> http://phylodynamics.blogspot.co.uk/2013/07/differential-equation-modeling-with.htmlwhich
>>  works fine with ode23.  But ode45, which would seem to have the same 
>> syntax, throws an error:
>>
>> julia> sol = ode.ode45((t,x)->SIR(t,x,p),t,inits);
>> ERROR: InexactError()
>>  in setindex! at array.jl:471
>>  in oderkf at /opt/julia/usr/share/julia/site/v0.3/ODE/src/ODE.jl:217
>>  in ode45_dp at /opt/julia/usr/share/julia/site/v0.3/ODE/src/ODE.jl:277
>>
>> Does anybody know what's going on here, and how I can overcome it?  In 
>> other words, how do I use ode45?  Thanks!
>>
>>
>>

Reply via email to