OrdinaryDiffEq.jl icon indicating copy to clipboard operation
OrdinaryDiffEq.jl copied to clipboard

`saveat` with multiple initial time points handled incorrectly

Open devmotion opened this issue 2 years ago • 0 comments

The following works as expected:

julia> using OrdinaryDiffEq

julia> prob = ODEProblem((_, _, t) -> -0.3*t, 1.0, (0.0, 5.0))
ODEProblem with uType Float64 and tType Float64. In-place: false
timespan: (0.0, 5.0)
u0: 1.0

julia> solve(prob, Tsit5(); saveat = [0.5, 0.5, 1.0]).t
3-element Vector{Float64}:
 0.5
 0.5
 1.0

julia> solve(prob, Tsit5(); saveat = [0.5, 0.5, 1.0, 5.0]).t
4-element Vector{Float64}:
 0.5
 0.5
 1.0
 5.0

julia> solve(prob, Tsit5(); saveat = [0.5, 0.5, 1.0, 5.0, 5.0]).t
5-element Vector{Float64}:
 0.5
 0.5
 1.0
 5.0
 5.0

julia> solve(prob, Tsit5(); saveat = [0.0, 0.5, 0.5, 1.0]).t
4-element Vector{Float64}:
 0.0
 0.5
 0.5
 1.0

But the following is surprising and seems to be a bug:

julia> solve(prob, Tsit5(); saveat = [0.0, 0.0, 0.5, 0.5, 1.0]).t
4-element Vector{Float64}:
 0.0
 0.5
 0.5
 1.0

devmotion avatar Sep 15 '23 20:09 devmotion