# Strange behavior of saveat with save\_start=false

**URL:** https://discourse.julialang.org/t/strange-behavior-of-saveat-with-save-start-false/93294
**Category:** General Usage
**Created:** [January 21, 2023, 3:20am UTC](https://discourse.julialang.org/t/strange-behavior-of-saveat-with-save-start-false/93294 "2023-01-21T03:20:41Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![erlebach](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/erlebach/32/12973_2.png) [@erlebach](https://discourse.julialang.org/u/erlebach)
#### Post date: [January 21, 2023, 3:20am UTC](https://discourse.julialang.org/t/strange-behavior-of-saveat-with-save-start-false/93294/1 "2023-01-21T03:20:41Z")

</div>

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

```julia
using DifferentialEquations

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

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.

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

```

prints:

```julia
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.

```julia

```

---

<div class="post-metadata">

### Author: ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)
#### Post date: [January 21, 2023, 4:23pm UTC](https://discourse.julialang.org/t/strange-behavior-of-saveat-with-save-start-false/93294/2 "2023-01-21T16:23:14Z")

</div>

> [@erlebach](#):
>
> 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.

---

<div class="post-metadata">

### Author: ![erlebach](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/erlebach/32/12973_2.png) [@erlebach](https://discourse.julialang.org/u/erlebach)
#### Post date: [January 21, 2023, 4:25pm UTC](https://discourse.julialang.org/t/strange-behavior-of-saveat-with-save-start-false/93294/3 "2023-01-21T16:25:31Z")

</div>

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

---

<div class="post-metadata">

### Author: ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)
#### Post date: [January 21, 2023, 4:32pm UTC](https://discourse.julialang.org/t/strange-behavior-of-saveat-with-save-start-false/93294/4 "2023-01-21T16:32:49Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![erlebach](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/erlebach/32/12973_2.png) [@erlebach](https://discourse.julialang.org/u/erlebach)
#### Post date: [January 21, 2023, 4:41pm UTC](https://discourse.julialang.org/t/strange-behavior-of-saveat-with-save-start-false/93294/5 "2023-01-21T16:41:15Z")

</div>

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!

Cheers,

Gordon
