Strange behavior of saveat with save_start=false

I am getting strange behavior with the different versions of save_at and save_start and save_end. Here is a MWE:

using DifferentialEquations

function exponen!(du, u, param, t)
	du[1] = -u[1]

tspan = (0., 3.)
prob = ODEProblem(exponen!, [2.], tspan)
solve(prob, Tsit5(), saveat=[0.2, 1.3], save_start=false, save_end=false)

I expect the solution at the two times 0.2 and 1.3 to be printed. This is what happens. Next, I explicitly add the start and end times to saveat, and specify that save_start and save_end are false. I expect the solution at four times to be printed. However, only there are printed.

sol = solve(prob, Tsit5(), saveat=[0., 0.2, 1.3, 3.], save_start=false, save_end=false)
println("sol.t: ", sol.t)


sol.t: [0.2, 1.3, 3.0]

If anything, either the first and last time points should be printed or not printed. How can the observed behavior (with Julia 1.8.3) be explained? Thanks.

Seems like there’s a bug there: it should prune the 3.0 out too.

Exactly! I am really surprised this was not encountered before. Can you please keep me in the loop? Thank you, @ChrisRackauckas!

Open an issue on OrdinaryDiffEq.jl. I also find this surprising, though of course combinatorics grows fast so edge cases around feature combinations are always the place that are hardest to fully cover. It looks like we missed one.

Will do. In the meantime, I removed the first and last time points, and set save_end=save_start=true. Honestly, there should be a fix to make it easy to save_at at a given number of equally-spaced times with and without the start and end points. If that is already possible, the documentation is not clear (for me, at least.)

The issue has been submitted. Thanks for the quick response!