It's worth noting that the adaptive timestep algorithms (ode23, ode45), 
even if you could provide a fixed set of times, would need to interpolate 
onto those times. While MATLAB does that interpolation for you, I'm not 
sure we should necessarily emulate that API.

It's also worth observing that the only way to access the RK4 algorithm in 
MATLAB is via Simulink, where it is one of the available fixed-step solvers.

On Wednesday, January 8, 2014 3:37:43 AM UTC-6, Simon Frost wrote:
>
> Dear Alasdair,
>
> There is all sorts of oddness with the ODE API, which appears to be in a 
> bit of flux at the moment, so I haven't filed any issues. For example, 
> ode23 really should only accept a span, but will accept a vector of any 
> length. It would make sense to use types to enforce this; perhaps using
>
> (F::Function, tfinal::{T}, y0::AbstractVector{T})
>
> for a final time
>
> (F::Function, tspan::(T,T), y0::AbstractVector{T})
>
> for a span
>
> (F::Function, tvec::AbstractVector{T}, y0::AbstractVector{T})
>
> for pre-specified times, and so on.
>
> Also, ode23 will accept an Array{Float64,1} for initial values, but ode4, 
> which I'm currently using as it allows a fixed set of times to be specified 
> out of the box (needed as I'm fitting an ODE model to data) accepts a 
> column vector Array{Float64,2}.
>
> Best
> Simon
>
> On Tuesday, January 7, 2014 11:04:18 AM UTC, Alasdair McAndrew wrote:
>>
>> 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