Use of caveat in common solve


I get the error message:

┌ Warning: Endpoints do not match. Return code: Success. Likely your time range is not a multiple of `saveat`. sol.t[end]: 75.398224, ts[end]: 0.0

because I am using saveat as an integer to represent the number of times to save the solution when calling solve after calling ODEProblem.

 dudt_ude!(du,u,p,t) = dudt_univ!(du,u,p,t,protocols[k], dct)
        prob_univ = ODEProblem(dudt_ude!, σ0, tspan, θ0) 
        saveat = dct[:pts_per_cycle] * dct[:Ncycles]   # an integer
        println("saveat 2: ", saveat)]
        sol_pre = solve(prob_univ, Tsit5(),abstol = 1e-8, reltol = 1e-6, saveat=saveat)

What conditions must be satisfied for the warning error not to occur?

The end time is some real number based on \pi so the end time is irrational.


saveat as a number expands to tspan[1]:saveat:tspan[2], so it should be the interval between saves, not the number of saves. In you case maybe saveat=2π/dct[:pts_per_cycle]?

1 Like

You are correct. I misinterpreted the meaning of a:n:c. Thanksl!

1 Like