-
-
Notifications
You must be signed in to change notification settings - Fork 239
Open
Description
Is your feature request related to a problem? Please describe.
Currently reinit! supports tspan change. However changing the endpoint to a negative (reverse) direction doesn't work. An artificial MWE of a problem, which arises when integrating a profile of a likelihood function:
using OrdinaryDiffEq
prob = ODEProblem((du, u, p, t) -> du[1] = 1.0, [0.], (0.,1.))
# right direction
integrator = init(prob, Tsit5())
reinit!(integrator; t0=0., tf=5.0)
solve!(integrator)
integrator.sol.t[end]
# 5.0 correct
# left direction
integrator = init(prob, Tsit5())
reinit!(integrator; t0=0., tf=-5.0)
solve!(integrator)
integrator.sol.t[end]
# 5.0 wrong
A trick, which seems to makes the code work is to change tdir, dtmax manualy:
integrator = init(prob, Tsit5())
integrator.tdir = -1.0
integrator.opts.dtmax *= -1.0
reinit!(integrator; t0=0., tf=-5.0)
solve!(integrator)
integrator.sol.t[end]
# -5.0 correct
Describe the solution you’d like
Can we add support for integration direction change to reinit! if it is just about checking and changing tdir and dtmax?
Describe alternatives you’ve considered
An alternative solution is to remake the problem.
sumiya11
Metadata
Metadata
Assignees
Labels
No labels